Some cleanup I forgot to do in gfx.cpp.
This commit is contained in:
parent
e4633652f9
commit
697a302fc6
|
@ -981,8 +981,8 @@ void aliens_init()
|
||||||
aliens[i].imageIndex[0] += 15;
|
aliens[i].imageIndex[0] += 15;
|
||||||
aliens[i].imageIndex[1] += 15;
|
aliens[i].imageIndex[1] += 15;
|
||||||
|
|
||||||
aliens[i].image[0] = shipShape[aliens[i].imageIndex[0]];
|
aliens[i].image[0] = gfx_shipSprites[aliens[i].imageIndex[0]];
|
||||||
aliens[i].image[1] = shipShape[aliens[i].imageIndex[1]];
|
aliens[i].image[1] = gfx_shipSprites[aliens[i].imageIndex[1]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1213,8 +1213,8 @@ void alien_addSmallAsteroid(object *hostAlien)
|
||||||
{
|
{
|
||||||
aliens[index] = alien_defs[CD_ASTEROID2];
|
aliens[index] = alien_defs[CD_ASTEROID2];
|
||||||
aliens[index].imageIndex[0] = aliens[index].imageIndex[1] = 39 + rand() % 2;
|
aliens[index].imageIndex[0] = aliens[index].imageIndex[1] = 39 + rand() % 2;
|
||||||
aliens[index].image[0] = shipShape[aliens[index].imageIndex[0]];
|
aliens[index].image[0] = gfx_shipSprites[aliens[index].imageIndex[0]];
|
||||||
aliens[index].image[1] = shipShape[aliens[index].imageIndex[1]];
|
aliens[index].image[1] = gfx_shipSprites[aliens[index].imageIndex[1]];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2003 Parallel Realities
|
Copyright (C) 2003 Parallel Realities
|
||||||
Copyright (C) 2011, 2012 Guus Sliepen
|
Copyright (C) 2011, 2012 Guus Sliepen
|
||||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
Copyright (C) 2015, 2016 onpon4 <onpon4@riseup.net>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
|
@ -131,7 +131,7 @@ void bullet_add(object *theWeapon, object *attacker, int y, int dy)
|
||||||
{
|
{
|
||||||
bullet->dx = RANDRANGE(-20, 20);
|
bullet->dx = RANDRANGE(-20, 20);
|
||||||
bullet->dy = RANDRANGE(-20, 20);
|
bullet->dy = RANDRANGE(-20, 20);
|
||||||
bullet->image[0] = shape[4];
|
bullet->image[0] = gfx_sprites[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
engine.bulletTail->next = bullet;
|
engine.bulletTail->next = bullet;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2003 Parallel Realities
|
Copyright (C) 2003 Parallel Realities
|
||||||
Copyright (C) 2011 Guus Sliepen
|
Copyright (C) 2011 Guus Sliepen
|
||||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
Copyright (C) 2015, 2016 onpon4 <onpon4@riseup.net>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
|
@ -58,9 +58,9 @@ object *cargo_add(object *owner, int cargoType)
|
||||||
cargo[index].dx = 0;
|
cargo[index].dx = 0;
|
||||||
cargo[index].dy = 0;
|
cargo[index].dy = 0;
|
||||||
cargo[index].collectType = cargoType;
|
cargo[index].collectType = cargoType;
|
||||||
cargo[index].image[0] = shape[32];
|
cargo[index].image[0] = gfx_sprites[32];
|
||||||
if (cargoType == P_PHOEBE)
|
if (cargoType == P_PHOEBE)
|
||||||
cargo[index].image[0] = shipShape[20];
|
cargo[index].image[0] = gfx_shipSprites[20];
|
||||||
|
|
||||||
return &cargo[index];
|
return &cargo[index];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2003 Parallel Realities
|
Copyright (C) 2003 Parallel Realities
|
||||||
Copyright (C) 2011, 2012 Guus Sliepen
|
Copyright (C) 2011, 2012 Guus Sliepen
|
||||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
Copyright (C) 2015, 2016 onpon4 <onpon4@riseup.net>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
|
@ -153,52 +153,52 @@ void collectable_add(float x, float y, int type, int value, int life)
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
case P_CASH:
|
case P_CASH:
|
||||||
collectable->image = shape[24];
|
collectable->image = gfx_sprites[24];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case P_ROCKET:
|
case P_ROCKET:
|
||||||
collectable->image = shape[49];
|
collectable->image = gfx_sprites[49];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case P_PLASMA_AMMO:
|
case P_PLASMA_AMMO:
|
||||||
collectable->image = shape[25];
|
collectable->image = gfx_sprites[25];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case P_SHIELD:
|
case P_SHIELD:
|
||||||
collectable->image = shape[26];
|
collectable->image = gfx_sprites[26];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case P_PLASMA_SHOT:
|
case P_PLASMA_SHOT:
|
||||||
collectable->image = shape[27];
|
collectable->image = gfx_sprites[27];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case P_PLASMA_RATE:
|
case P_PLASMA_RATE:
|
||||||
collectable->image = shape[28];
|
collectable->image = gfx_sprites[28];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case P_PLASMA_DAMAGE:
|
case P_PLASMA_DAMAGE:
|
||||||
collectable->image = shape[29];
|
collectable->image = gfx_sprites[29];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case P_CARGO:
|
case P_CARGO:
|
||||||
collectable->image = shape[32];
|
collectable->image = gfx_sprites[32];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case P_SUPER:
|
case P_SUPER:
|
||||||
collectable->image = shape[50];
|
collectable->image = gfx_sprites[50];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case P_MINE:
|
case P_MINE:
|
||||||
collectable->image = shape[31];
|
collectable->image = gfx_sprites[31];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case P_SLAVES:
|
case P_SLAVES:
|
||||||
case P_ESCAPEPOD:
|
case P_ESCAPEPOD:
|
||||||
collectable->image = shape[45];
|
collectable->image = gfx_sprites[45];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case P_ORE:
|
case P_ORE:
|
||||||
collectable->image = shape[46 + rand() % 3];
|
collectable->image = gfx_sprites[46 + rand() % 3];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
src/defs.h
16
src/defs.h
|
@ -102,11 +102,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#define WF_TIMEDEXPLOSION 2048
|
#define WF_TIMEDEXPLOSION 2048
|
||||||
|
|
||||||
#define MAX_WEAPONS 20
|
#define MAX_WEAPONS 20
|
||||||
#define MAX_SHAPES 100
|
#define MAX_SPRITES 100
|
||||||
#define MAX_SHIPSHAPES 120
|
#define MAX_SHIPSPRITES 120
|
||||||
#define MAX_TEXTSHAPES 150
|
#define MAX_TEXTSPRITES 150
|
||||||
#define MAX_FONTSHAPES 6
|
#define MAX_FONTSPRITES 6
|
||||||
#define MAX_SHOPSHAPES 6
|
#define MAX_SHOPSPRITES 6
|
||||||
#define MAX_CARGO 20
|
#define MAX_CARGO 20
|
||||||
#define MAX_INFOLINES 3
|
#define MAX_INFOLINES 3
|
||||||
#define MAX_EVENTS 20
|
#define MAX_EVENTS 20
|
||||||
|
@ -283,7 +283,7 @@ enum {
|
||||||
CD_URSULA
|
CD_URSULA
|
||||||
};
|
};
|
||||||
|
|
||||||
// Text shapes (main menu)
|
// Text sprites (main menu)
|
||||||
enum {
|
enum {
|
||||||
TS_PRESENTS,
|
TS_PRESENTS,
|
||||||
TS_AN_SDL_GAME,
|
TS_AN_SDL_GAME,
|
||||||
|
@ -312,11 +312,11 @@ enum {
|
||||||
TS_DIFFICULTY
|
TS_DIFFICULTY
|
||||||
};
|
};
|
||||||
|
|
||||||
// Text shapes (intermission)
|
// Text sprites (intermission)
|
||||||
enum {
|
enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Text shapes (mission)
|
// Text sprites (mission)
|
||||||
enum {
|
enum {
|
||||||
TS_RADIO = MAX_INFOLINES,
|
TS_RADIO = MAX_INFOLINES,
|
||||||
TS_SHIELD,
|
TS_SHIELD,
|
||||||
|
|
|
@ -266,10 +266,10 @@ void engine_cleanup()
|
||||||
delete(engine.collectableHead);
|
delete(engine.collectableHead);
|
||||||
delete(screen_bufferHead);
|
delete(screen_bufferHead);
|
||||||
|
|
||||||
for (int i = 0 ; i < MAX_FONTSHAPES ; i++)
|
for (int i = 0 ; i < MAX_FONTSPRITES ; i++)
|
||||||
{
|
{
|
||||||
if (fontShape[i] != NULL)
|
if (gfx_fontSprites[i] != NULL)
|
||||||
SDL_FreeSurface(fontShape[i]);
|
SDL_FreeSurface(gfx_fontSprites[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
char filename[PATH_MAX];
|
char filename[PATH_MAX];
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2003 Parallel Realities
|
Copyright (C) 2003 Parallel Realities
|
||||||
Copyright (C) 2011 Guus Sliepen
|
Copyright (C) 2011 Guus Sliepen
|
||||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
Copyright (C) 2015, 2016 onpon4 <onpon4@riseup.net>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
|
@ -35,7 +35,7 @@ void explosion_add(float x, float y, int type)
|
||||||
explosion->y = y;
|
explosion->y = y;
|
||||||
explosion->thinktime = 28;
|
explosion->thinktime = 28;
|
||||||
explosion->face = type;
|
explosion->face = type;
|
||||||
explosion->image[0] = shape[type];
|
explosion->image[0] = gfx_sprites[type];
|
||||||
|
|
||||||
engine.explosionTail->next = explosion;
|
engine.explosionTail->next = explosion;
|
||||||
engine.explosionTail = explosion;
|
engine.explosionTail = explosion;
|
||||||
|
|
46
src/game.cpp
46
src/game.cpp
|
@ -1085,7 +1085,7 @@ static void game_doAliens()
|
||||||
(aliens[i].classDef != CD_ASTEROID2))
|
(aliens[i].classDef != CD_ASTEROID2))
|
||||||
explosion_addEngine(&aliens[i]);
|
explosion_addEngine(&aliens[i]);
|
||||||
if ((!(aliens[i].flags & FL_ISCLOAKED)) || (aliens[i].hit > 0))
|
if ((!(aliens[i].flags & FL_ISCLOAKED)) || (aliens[i].hit > 0))
|
||||||
screen_blit(shipShape[shapeToUse], (int)aliens[i].x,
|
screen_blit(gfx_shipSprites[shapeToUse], (int)aliens[i].x,
|
||||||
(int)aliens[i].y);
|
(int)aliens[i].y);
|
||||||
if (aliens[i].flags & FL_DISABLED)
|
if (aliens[i].flags & FL_DISABLED)
|
||||||
{
|
{
|
||||||
|
@ -1395,7 +1395,7 @@ static void game_doPlayer()
|
||||||
|
|
||||||
LIMIT_ADD(player.hit, -1, 0, 100);
|
LIMIT_ADD(player.hit, -1, 0, 100);
|
||||||
|
|
||||||
screen_blit(shipShape[shapeToUse], (int)player.x, (int)player.y);
|
screen_blit(gfx_shipSprites[shapeToUse], (int)player.x, (int)player.y);
|
||||||
if ((player.maxShield > 1) && (player.shield <= engine.lowShield) &&
|
if ((player.maxShield > 1) && (player.shield <= engine.lowShield) &&
|
||||||
(rand() % 5 < 1))
|
(rand() % 5 < 1))
|
||||||
explosion_add(player.x + RANDRANGE(-10, 10),
|
explosion_add(player.x + RANDRANGE(-10, 10),
|
||||||
|
@ -1481,7 +1481,7 @@ static void game_doCargo()
|
||||||
// draw the chain link line
|
// draw the chain link line
|
||||||
for (int j = 0 ; j < 10 ; j++)
|
for (int j = 0 ; j < 10 ; j++)
|
||||||
{
|
{
|
||||||
screen_blit(shape[30], (int)chainX, (int)chainY);
|
screen_blit(gfx_sprites[30], (int)chainX, (int)chainY);
|
||||||
chainX -= dx;
|
chainX -= dx;
|
||||||
chainY -= dy;
|
chainY -= dy;
|
||||||
}
|
}
|
||||||
|
@ -1560,7 +1560,7 @@ void game_doExplosions()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
explosion->face++;
|
explosion->face++;
|
||||||
explosion->image[0] = shape[explosion->face];
|
explosion->image[0] = gfx_sprites[explosion->face];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1604,31 +1604,31 @@ static void game_doArrow(int i)
|
||||||
|
|
||||||
if (sxy == sx) {
|
if (sxy == sx) {
|
||||||
arrow = x < screen->w / 2 ? 42 : 38;
|
arrow = x < screen->w / 2 ? 42 : 38;
|
||||||
x -= x > screen->w / 2 ? shape[arrow]->w : 0;
|
x -= x > screen->w / 2 ? gfx_sprites[arrow]->w : 0;
|
||||||
y -= shape[arrow]->h / 2;
|
y -= gfx_sprites[arrow]->h / 2;
|
||||||
} else {
|
} else {
|
||||||
arrow = y < screen->h / 2 ? 36 : 40;
|
arrow = y < screen->h / 2 ? 36 : 40;
|
||||||
x -= shape[arrow]->w / 2;
|
x -= gfx_sprites[arrow]->w / 2;
|
||||||
y -= y > screen->h / 2 ? shape[arrow]->h : 0;
|
y -= y > screen->h / 2 ? gfx_sprites[arrow]->h : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
screen_blit(shape[arrow], x, y);
|
screen_blit(gfx_sprites[arrow], x, y);
|
||||||
|
|
||||||
if (i != engine.targetIndex)
|
if (i != engine.targetIndex)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (gfx_text[TS_RADIO].life > 0)
|
if (gfx_textSprites[TS_RADIO].life > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (sxy == sx) {
|
if (sxy == sx) {
|
||||||
x -= x > screen->w / 2 ? 5 + shape[44]->w : -5 - shape[arrow]->w;
|
x -= x > screen->w / 2 ? 5 + gfx_sprites[44]->w : -5 - gfx_sprites[arrow]->w;
|
||||||
y -= (shape[44]->h - shape[arrow]->h) / 2;
|
y -= (gfx_sprites[44]->h - gfx_sprites[arrow]->h) / 2;
|
||||||
} else {
|
} else {
|
||||||
x -= (shape[44]->w - shape[arrow]->w) / 2;
|
x -= (gfx_sprites[44]->w - gfx_sprites[arrow]->w) / 2;
|
||||||
y -= y > screen->h / 2 ? 5 + shape[44]->h : -5 - shape[arrow]->h;
|
y -= y > screen->h / 2 ? 5 + gfx_sprites[44]->h : -5 - gfx_sprites[arrow]->h;
|
||||||
}
|
}
|
||||||
|
|
||||||
screen_blit(shape[44], x, y);
|
screen_blit(gfx_sprites[44], x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void game_doHud()
|
static void game_doHud()
|
||||||
|
@ -1769,28 +1769,28 @@ static void game_doHud()
|
||||||
|
|
||||||
for (int i = 0 ; i < MAX_INFOLINES ; i++)
|
for (int i = 0 ; i < MAX_INFOLINES ; i++)
|
||||||
{
|
{
|
||||||
if (gfx_text[i].life > 0)
|
if (gfx_textSprites[i].life > 0)
|
||||||
{
|
{
|
||||||
gfx_text[i].y = screen->h - 75 - (i * 20);
|
gfx_textSprites[i].y = screen->h - 75 - (i * 20);
|
||||||
screen_blitText(i);
|
screen_blitText(i);
|
||||||
gfx_text[i].life--;
|
gfx_textSprites[i].life--;
|
||||||
|
|
||||||
if (gfx_text[i].life == 0)
|
if (gfx_textSprites[i].life == 0)
|
||||||
{
|
{
|
||||||
for (int j = i ; j < MAX_INFOLINES - 1 ; j++)
|
for (int j = i ; j < MAX_INFOLINES - 1 ; j++)
|
||||||
{
|
{
|
||||||
copyInfoLine(j + 1, j);
|
copyInfoLine(j + 1, j);
|
||||||
}
|
}
|
||||||
gfx_text[MAX_INFOLINES - 1].life = 0;
|
gfx_textSprites[MAX_INFOLINES - 1].life = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show the radio message if there is one
|
// Show the radio message if there is one
|
||||||
if (gfx_text[TS_RADIO].life > 0)
|
if (gfx_textSprites[TS_RADIO].life > 0)
|
||||||
{
|
{
|
||||||
screen_blit(messageBox, (screen->w - messageBox->w) / 2, 50);
|
screen_blit(gfx_messageBox, (screen->w - gfx_messageBox->w) / 2, 50);
|
||||||
gfx_text[TS_RADIO].life--;
|
gfx_textSprites[TS_RADIO].life--;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do the target's remaining shield (if required)
|
// Do the target's remaining shield (if required)
|
||||||
|
|
120
src/gfx.cpp
120
src/gfx.cpp
|
@ -22,14 +22,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "Starfighter.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
SDL_Surface *gfx_background;
|
SDL_Surface *gfx_background;
|
||||||
SDL_Surface *shape[MAX_SHAPES];
|
SDL_Surface *gfx_sprites[MAX_SPRITES];
|
||||||
SDL_Surface *shipShape[MAX_SHIPSHAPES];
|
SDL_Surface *gfx_shipSprites[MAX_SHIPSPRITES];
|
||||||
SDL_Surface *fontShape[MAX_FONTSHAPES];
|
SDL_Surface *gfx_fontSprites[MAX_FONTSPRITES];
|
||||||
SDL_Surface *shopSurface[MAX_SHOPSHAPES];
|
SDL_Surface *gfx_shopSprites[MAX_SHOPSPRITES];
|
||||||
bRect *screen_bufferHead;
|
textObject gfx_textSprites[MAX_TEXTSPRITES];
|
||||||
bRect *screen_bufferTail;
|
SDL_Surface *gfx_messageBox;
|
||||||
textObject gfx_text[MAX_TEXTSHAPES];
|
|
||||||
SDL_Surface *messageBox;
|
|
||||||
|
|
||||||
void gfx_init()
|
void gfx_init()
|
||||||
{
|
{
|
||||||
|
@ -37,23 +35,23 @@ void gfx_init()
|
||||||
screen_bufferHead->next = NULL;
|
screen_bufferHead->next = NULL;
|
||||||
screen_bufferTail = screen_bufferHead;
|
screen_bufferTail = screen_bufferHead;
|
||||||
|
|
||||||
for (int i = 0 ; i < MAX_SHAPES ; i++)
|
for (int i = 0 ; i < MAX_SPRITES ; i++)
|
||||||
shape[i] = NULL;
|
gfx_sprites[i] = NULL;
|
||||||
|
|
||||||
for (int i = 0 ; i < MAX_SHIPSHAPES ; i++)
|
for (int i = 0 ; i < MAX_SHIPSPRITES ; i++)
|
||||||
shipShape[i] = NULL;
|
gfx_shipSprites[i] = NULL;
|
||||||
|
|
||||||
for (int i = 0 ; i < MAX_TEXTSHAPES ; i++)
|
for (int i = 0 ; i < MAX_TEXTSPRITES ; i++)
|
||||||
gfx_text[i].image = NULL;
|
gfx_textSprites[i].image = NULL;
|
||||||
|
|
||||||
for (int i = 0 ; i < MAX_SHOPSHAPES ; i++)
|
for (int i = 0 ; i < MAX_SHOPSPRITES ; i++)
|
||||||
shopSurface[i] = NULL;
|
gfx_shopSprites[i] = NULL;
|
||||||
|
|
||||||
for (int i = 0 ; i < MAX_FONTSHAPES ; i++)
|
for (int i = 0 ; i < MAX_FONTSPRITES ; i++)
|
||||||
fontShape[i] = NULL;
|
gfx_fontSprites[i] = NULL;
|
||||||
|
|
||||||
gfx_background = NULL;
|
gfx_background = NULL;
|
||||||
messageBox = NULL;
|
gfx_messageBox = NULL;
|
||||||
|
|
||||||
screen = NULL;
|
screen = NULL;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +116,7 @@ static int gfx_renderStringBase(const char *in, int x, int y, int fontColor, sig
|
||||||
letter.x *= 8;
|
letter.x *= 8;
|
||||||
|
|
||||||
/* Blit onto the screen surface */
|
/* Blit onto the screen surface */
|
||||||
if (SDL_BlitSurface(fontShape[fontColor], &letter, dest, &area) < 0)
|
if (SDL_BlitSurface(gfx_fontSprites[fontColor], &letter, dest, &area) < 0)
|
||||||
{
|
{
|
||||||
printf("BlitSurface error: %s\n", SDL_GetError());
|
printf("BlitSurface error: %s\n", SDL_GetError());
|
||||||
engine_showError(2, "");
|
engine_showError(2, "");
|
||||||
|
@ -150,7 +148,7 @@ static int gfx_renderStringBase(const char *in, int x, int y, int fontColor, sig
|
||||||
{
|
{
|
||||||
letter.x = (int)('-') - 33;
|
letter.x = (int)('-') - 33;
|
||||||
letter.x *= 8;
|
letter.x *= 8;
|
||||||
if (SDL_BlitSurface(fontShape[fontColor], &letter, dest, &area) < 0)
|
if (SDL_BlitSurface(gfx_fontSprites[fontColor], &letter, dest, &area) < 0)
|
||||||
{
|
{
|
||||||
printf("BlitSurface error: %s\n", SDL_GetError());
|
printf("BlitSurface error: %s\n", SDL_GetError());
|
||||||
engine_showError(2, "");
|
engine_showError(2, "");
|
||||||
|
@ -358,25 +356,25 @@ SDL_Surface *gfx_createTextSurface(const char *inString, int color)
|
||||||
void gfx_createTextObject(int index, const char *inString, int x, int y, int fontColor)
|
void gfx_createTextObject(int index, const char *inString, int x, int y, int fontColor)
|
||||||
{
|
{
|
||||||
/* Shortcut: if we already rendered the same string in the same color, don't render it again. */
|
/* Shortcut: if we already rendered the same string in the same color, don't render it again. */
|
||||||
if(gfx_text[index].text && gfx_text[index].image && gfx_text[index].fontColor == fontColor && !strcmp(gfx_text[index].text, inString)) {
|
if(gfx_textSprites[index].text && gfx_textSprites[index].image && gfx_textSprites[index].fontColor == fontColor && !strcmp(gfx_textSprites[index].text, inString)) {
|
||||||
gfx_text[index].x = x;
|
gfx_textSprites[index].x = x;
|
||||||
gfx_text[index].y = y;
|
gfx_textSprites[index].y = y;
|
||||||
if (x == -1)
|
if (x == -1)
|
||||||
gfx_text[index].x = (screen->w - gfx_text[index].image->w) / 2;
|
gfx_textSprites[index].x = (screen->w - gfx_textSprites[index].image->w) / 2;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(gfx_text[index].text, inString);
|
strcpy(gfx_textSprites[index].text, inString);
|
||||||
gfx_text[index].x = x;
|
gfx_textSprites[index].x = x;
|
||||||
gfx_text[index].y = y;
|
gfx_textSprites[index].y = y;
|
||||||
gfx_text[index].fontColor = fontColor;
|
gfx_textSprites[index].fontColor = fontColor;
|
||||||
if (gfx_text[index].image != NULL)
|
if (gfx_textSprites[index].image != NULL)
|
||||||
{
|
{
|
||||||
SDL_FreeSurface(gfx_text[index].image);
|
SDL_FreeSurface(gfx_textSprites[index].image);
|
||||||
}
|
}
|
||||||
gfx_text[index].image = gfx_createTextSurface(inString, fontColor);
|
gfx_textSprites[index].image = gfx_createTextSurface(inString, fontColor);
|
||||||
if (x == -1)
|
if (x == -1)
|
||||||
gfx_text[index].x = (screen->w - gfx_text[index].image->w) / 2;
|
gfx_textSprites[index].x = (screen->w - gfx_textSprites[index].image->w) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Surface *gfx_createAlphaRect(int width, int height, Uint8 red, Uint8 green, Uint8 blue)
|
SDL_Surface *gfx_createAlphaRect(int width, int height, Uint8 red, Uint8 green, Uint8 blue)
|
||||||
|
@ -394,29 +392,29 @@ void gfx_createMessageBox(SDL_Surface *face, const char *message, signed char tr
|
||||||
{
|
{
|
||||||
int x = 60;
|
int x = 60;
|
||||||
|
|
||||||
if (messageBox != NULL)
|
if (gfx_messageBox != NULL)
|
||||||
{
|
{
|
||||||
SDL_FreeSurface(messageBox);
|
SDL_FreeSurface(gfx_messageBox);
|
||||||
messageBox = NULL;
|
gfx_messageBox = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transparent)
|
if (transparent)
|
||||||
messageBox = gfx_createAlphaRect(550, 60, 0x00, 0x00, 0x00);
|
gfx_messageBox = gfx_createAlphaRect(550, 60, 0x00, 0x00, 0x00);
|
||||||
else
|
else
|
||||||
messageBox = gfx_createSurface(550, 60);
|
gfx_messageBox = gfx_createSurface(550, 60);
|
||||||
|
|
||||||
if (face != NULL)
|
if (face != NULL)
|
||||||
{
|
{
|
||||||
gfx_drawRect(messageBox, 0, 0, messageBox->w - 1, messageBox->h - 1, 0x00, 0x00, 0xaa);
|
gfx_drawRect(gfx_messageBox, 0, 0, gfx_messageBox->w - 1, gfx_messageBox->h - 1, 0x00, 0x00, 0xaa);
|
||||||
gfx_blit(face, 5, 5, messageBox);
|
gfx_blit(face, 5, 5, gfx_messageBox);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gfx_drawRect(messageBox, 0, 0, messageBox->w - 1, messageBox->h - 1, 0x00, 0x00, 0x00);
|
gfx_drawRect(gfx_messageBox, 0, 0, gfx_messageBox->w - 1, gfx_messageBox->h - 1, 0x00, 0x00, 0x00);
|
||||||
x = 10;
|
x = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx_renderString(message, x, 5, FONT_WHITE, 1, messageBox);
|
gfx_renderString(message, x, 5, FONT_WHITE, 1, gfx_messageBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Surface *gfx_loadImage(const char *filename)
|
SDL_Surface *gfx_loadImage(const char *filename)
|
||||||
|
@ -445,45 +443,45 @@ SDL_Surface *gfx_loadImage(const char *filename)
|
||||||
|
|
||||||
void gfx_free()
|
void gfx_free()
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < MAX_SHAPES ; i++)
|
for (int i = 0 ; i < MAX_SPRITES ; i++)
|
||||||
{
|
{
|
||||||
if (shape[i] != NULL)
|
if (gfx_sprites[i] != NULL)
|
||||||
{
|
{
|
||||||
SDL_FreeSurface(shape[i]);
|
SDL_FreeSurface(gfx_sprites[i]);
|
||||||
shape[i] = NULL;
|
gfx_sprites[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0 ; i < MAX_SHIPSHAPES ; i++)
|
for (int i = 0 ; i < MAX_SHIPSPRITES ; i++)
|
||||||
{
|
{
|
||||||
if (shipShape[i] != NULL)
|
if (gfx_shipSprites[i] != NULL)
|
||||||
{
|
{
|
||||||
SDL_FreeSurface(shipShape[i]);
|
SDL_FreeSurface(gfx_shipSprites[i]);
|
||||||
shipShape[i] = NULL;
|
gfx_shipSprites[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0 ; i < MAX_TEXTSHAPES ; i++)
|
for (int i = 0 ; i < MAX_TEXTSPRITES ; i++)
|
||||||
{
|
{
|
||||||
if (gfx_text[i].image != NULL)
|
if (gfx_textSprites[i].image != NULL)
|
||||||
{
|
{
|
||||||
SDL_FreeSurface(gfx_text[i].image);
|
SDL_FreeSurface(gfx_textSprites[i].image);
|
||||||
gfx_text[i].image = NULL;
|
gfx_textSprites[i].image = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0 ; i < MAX_SHOPSHAPES ; i++)
|
for (int i = 0 ; i < MAX_SHOPSPRITES ; i++)
|
||||||
{
|
{
|
||||||
if (shopSurface[i] != NULL)
|
if (gfx_shopSprites[i] != NULL)
|
||||||
{
|
{
|
||||||
SDL_FreeSurface(shopSurface[i]);
|
SDL_FreeSurface(gfx_shopSprites[i]);
|
||||||
shopSurface[i] = NULL;
|
gfx_shopSprites[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (messageBox != NULL)
|
if (gfx_messageBox != NULL)
|
||||||
{
|
{
|
||||||
SDL_FreeSurface(messageBox);
|
SDL_FreeSurface(gfx_messageBox);
|
||||||
messageBox = NULL;
|
gfx_messageBox = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
13
src/gfx.h
13
src/gfx.h
|
@ -23,13 +23,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "Starfighter.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
extern SDL_Surface *gfx_background;
|
extern SDL_Surface *gfx_background;
|
||||||
extern SDL_Surface *shape[MAX_SHAPES];
|
extern SDL_Surface *gfx_sprites[MAX_SPRITES];
|
||||||
extern SDL_Surface *shipShape[MAX_SHIPSHAPES];
|
extern SDL_Surface *gfx_shipSprites[MAX_SHIPSPRITES];
|
||||||
extern SDL_Surface *fontShape[MAX_FONTSHAPES];
|
extern SDL_Surface *gfx_fontSprites[MAX_FONTSPRITES];
|
||||||
extern SDL_Surface *shopSurface[MAX_SHOPSHAPES];
|
extern SDL_Surface *gfx_shopSprites[MAX_SHOPSPRITES];
|
||||||
extern textObject gfx_text[MAX_TEXTSHAPES];
|
extern textObject gfx_textSprites[MAX_TEXTSPRITES];
|
||||||
extern SDL_Surface *messageBox;
|
extern SDL_Surface *gfx_messageBox;
|
||||||
|
|
||||||
|
|
||||||
void gfx_init();
|
void gfx_init();
|
||||||
SDL_Surface *gfx_setTransparent(SDL_Surface *sprite);
|
SDL_Surface *gfx_setTransparent(SDL_Surface *sprite);
|
||||||
|
|
|
@ -26,9 +26,9 @@ static void intermission_doCursor()
|
||||||
{
|
{
|
||||||
getPlayerInput();
|
getPlayerInput();
|
||||||
|
|
||||||
LIMIT(engine.cursor_x, 10, screen->w - 10 - shape[0]->w);
|
LIMIT(engine.cursor_x, 10, screen->w - 10 - gfx_sprites[0]->w);
|
||||||
LIMIT(engine.cursor_y, 10, screen->h - 10 - shape[0]->h);
|
LIMIT(engine.cursor_y, 10, screen->h - 10 - gfx_sprites[0]->h);
|
||||||
screen_blit(shape[0], engine.cursor_x, engine.cursor_y);
|
screen_blit(gfx_sprites[0], engine.cursor_x, engine.cursor_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -146,20 +146,20 @@ static void intermission_setStatusLines()
|
||||||
gfx_createTextObject(26, string, -1, 0, FONT_WHITE);
|
gfx_createTextObject(26, string, -1, 0, FONT_WHITE);
|
||||||
gfx_createTextObject(27, "Current Status", -1, 0, FONT_WHITE);
|
gfx_createTextObject(27, "Current Status", -1, 0, FONT_WHITE);
|
||||||
|
|
||||||
gfx_text[0].y = 400;
|
gfx_textSprites[0].y = 400;
|
||||||
gfx_text[0].x = 150;
|
gfx_textSprites[0].x = 150;
|
||||||
|
|
||||||
for (int i = 1 ; i < 25 ; i++)
|
for (int i = 1 ; i < 25 ; i++)
|
||||||
{
|
{
|
||||||
gfx_text[i].y = gfx_text[i - 1].y + 20;
|
gfx_textSprites[i].y = gfx_textSprites[i - 1].y + 20;
|
||||||
if ((i == 7) || (i == 16) || (i == 19))
|
if ((i == 7) || (i == 16) || (i == 19))
|
||||||
gfx_text[i].y += 25;
|
gfx_textSprites[i].y += 25;
|
||||||
|
|
||||||
gfx_text[i].x = 150;
|
gfx_textSprites[i].x = 150;
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx_text[26].y = 404;
|
gfx_textSprites[26].y = 404;
|
||||||
gfx_text[27].y = 83;
|
gfx_textSprites[27].y = 83;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -204,7 +204,7 @@ static void intermission_setSystemPlanets()
|
||||||
|
|
||||||
systemPlanet[i].y = distance;
|
systemPlanet[i].y = distance;
|
||||||
strcpy(systemPlanet[i].name, name);
|
strcpy(systemPlanet[i].name, name);
|
||||||
systemPlanet[i].image = shape[image];
|
systemPlanet[i].image = gfx_sprites[image];
|
||||||
}
|
}
|
||||||
|
|
||||||
int messageMission;
|
int messageMission;
|
||||||
|
@ -247,7 +247,7 @@ static bool intermission_showSystem(float x, float y, bool selectable)
|
||||||
bool rtn = false;
|
bool rtn = false;
|
||||||
|
|
||||||
// Blit the sun
|
// Blit the sun
|
||||||
screen_blit(shape[30], 370, 220);
|
screen_blit(gfx_sprites[30], 370, 220);
|
||||||
|
|
||||||
for (int i = 50 ; i < 300 ; i+= planetSpace)
|
for (int i = 50 ; i < 300 ; i+= planetSpace)
|
||||||
{
|
{
|
||||||
|
@ -320,20 +320,20 @@ static void intermission_showStatus(SDL_Surface *infoSurface)
|
||||||
|
|
||||||
for (int i = 0 ; i < 22 ; i++)
|
for (int i = 0 ; i < 22 ; i++)
|
||||||
{
|
{
|
||||||
gfx_text[i].y -= speed;
|
gfx_textSprites[i].y -= speed;
|
||||||
if ((gfx_text[i].y > 80) && (gfx_text[i].y < 400))
|
if ((gfx_textSprites[i].y > 80) && (gfx_textSprites[i].y < 400))
|
||||||
screen_blitText(i);
|
screen_blitText(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gfx_text[21].y < 65)
|
if (gfx_textSprites[21].y < 65)
|
||||||
{
|
{
|
||||||
gfx_text[0].y = 400;
|
gfx_textSprites[0].y = 400;
|
||||||
|
|
||||||
for (int i = 1 ; i < 25 ; i++)
|
for (int i = 1 ; i < 25 ; i++)
|
||||||
{
|
{
|
||||||
gfx_text[i].y = gfx_text[i - 1].y + 20;
|
gfx_textSprites[i].y = gfx_textSprites[i - 1].y + 20;
|
||||||
if ((i == 7) || (i == 16) || (i == 19))
|
if ((i == 7) || (i == 16) || (i == 19))
|
||||||
gfx_text[i].y += 25;
|
gfx_textSprites[i].y += 25;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ static void intermission_updateCommsSurface(SDL_Surface *comms)
|
||||||
char string[255];
|
char string[255];
|
||||||
|
|
||||||
gfx_drawRect(comms, 0, 10, comms->w - 1, 55, 0x00, 0x22, 0x00);
|
gfx_drawRect(comms, 0, 10, comms->w - 1, 55, 0x00, 0x22, 0x00);
|
||||||
gfx_blit(shape[FACE_CHRIS], 20, 15, comms);
|
gfx_blit(gfx_sprites[FACE_CHRIS], 20, 15, comms);
|
||||||
gfx_renderString("Chris Bainfield", 80, 15, FONT_WHITE, 0, comms);
|
gfx_renderString("Chris Bainfield", 80, 15, FONT_WHITE, 0, comms);
|
||||||
sprintf(string, "Current Location: %s", systemPlanet[game.stationedPlanet].name);
|
sprintf(string, "Current Location: %s", systemPlanet[game.stationedPlanet].name);
|
||||||
gfx_renderString(string, 80, 35, FONT_WHITE, 0, comms);
|
gfx_renderString(string, 80, 35, FONT_WHITE, 0, comms);
|
||||||
|
@ -375,7 +375,7 @@ static void intermission_createCommsSurface(SDL_Surface *comms)
|
||||||
{
|
{
|
||||||
yOffset = systemPlanet[i].messageSlot * 60;
|
yOffset = systemPlanet[i].messageSlot * 60;
|
||||||
gfx_drawRect(comms, 0, 105 + yOffset, comms->w - 1, 55, 0x00, 0x00, 0x77);
|
gfx_drawRect(comms, 0, 105 + yOffset, comms->w - 1, 55, 0x00, 0x00, 0x77);
|
||||||
gfx_blit(shape[systemPlanet[i].faceImage], 20, 110 + yOffset, comms);
|
gfx_blit(gfx_sprites[systemPlanet[i].faceImage], 20, 110 + yOffset, comms);
|
||||||
gfx_renderString(systemPlanet[i].from, 80, 110 + yOffset, FONT_WHITE, 0, comms);
|
gfx_renderString(systemPlanet[i].from, 80, 110 + yOffset, FONT_WHITE, 0, comms);
|
||||||
gfx_renderString(systemPlanet[i].subject, 80, 130 + yOffset, FONT_CYAN, 0, comms);
|
gfx_renderString(systemPlanet[i].subject, 80, 130 + yOffset, FONT_CYAN, 0, comms);
|
||||||
gfx_renderString("INCOMPLETE", 350, 110 + yOffset, FONT_RED, 0, comms);
|
gfx_renderString("INCOMPLETE", 350, 110 + yOffset, FONT_RED, 0, comms);
|
||||||
|
@ -426,7 +426,7 @@ static void intermission_createMissionDetailSurface(SDL_Surface *comms, int miss
|
||||||
faceNumber = getFace(string);
|
faceNumber = getFace(string);
|
||||||
if (faceNumber > -1)
|
if (faceNumber > -1)
|
||||||
{
|
{
|
||||||
gfx_blit(shape[faceNumber], 10, y, comms);
|
gfx_blit(gfx_sprites[faceNumber], 10, y, comms);
|
||||||
col = FONT_WHITE;
|
col = FONT_WHITE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -587,33 +587,33 @@ int intermission()
|
||||||
|
|
||||||
engine.cursor_x = screen->w / 2;
|
engine.cursor_x = screen->w / 2;
|
||||||
engine.cursor_y = screen->h / 2;
|
engine.cursor_y = screen->h / 2;
|
||||||
shape[0] = gfx_loadImage("gfx/cursor.png");
|
gfx_sprites[0] = gfx_loadImage("gfx/cursor.png");
|
||||||
|
|
||||||
// Icons 1 - 29
|
// Icons 1 - 29
|
||||||
for (int i = 0 ; i < 26 ; i++)
|
for (int i = 0 ; i < 26 ; i++)
|
||||||
{
|
{
|
||||||
sprintf(string, "gfx/icon%d.png", (i + 1));
|
sprintf(string, "gfx/icon%d.png", (i + 1));
|
||||||
shape[i + 1] = gfx_loadImage(string);
|
gfx_sprites[i + 1] = gfx_loadImage(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
shape[27] = gfx_loadImage("gfx/buyIcon.png");
|
gfx_sprites[27] = gfx_loadImage("gfx/buyIcon.png");
|
||||||
shape[28] = gfx_loadImage("gfx/sellIcon.png");
|
gfx_sprites[28] = gfx_loadImage("gfx/sellIcon.png");
|
||||||
shape[29] = gfx_loadImage("gfx/firefly1.png");
|
gfx_sprites[29] = gfx_loadImage("gfx/firefly1.png");
|
||||||
|
|
||||||
// Planets 30 - 39
|
// Planets 30 - 39
|
||||||
shape[30] = gfx_loadImage("gfx/planet_sun.png");
|
gfx_sprites[30] = gfx_loadImage("gfx/planet_sun.png");
|
||||||
shape[31] = gfx_loadImage("gfx/planet_green.png");
|
gfx_sprites[31] = gfx_loadImage("gfx/planet_green.png");
|
||||||
shape[32] = gfx_loadImage("gfx/planet_blue.png");
|
gfx_sprites[32] = gfx_loadImage("gfx/planet_blue.png");
|
||||||
shape[33] = gfx_loadImage("gfx/planet_red.png");
|
gfx_sprites[33] = gfx_loadImage("gfx/planet_red.png");
|
||||||
shape[34] = gfx_loadImage("gfx/planet_orange.png");
|
gfx_sprites[34] = gfx_loadImage("gfx/planet_orange.png");
|
||||||
|
|
||||||
// Faces (as defines)
|
// Faces (as defines)
|
||||||
shape[FACE_CHRIS] = gfx_loadImage("gfx/face_chris.png");
|
gfx_sprites[FACE_CHRIS] = gfx_loadImage("gfx/face_chris.png");
|
||||||
shape[FACE_SID] = gfx_loadImage("gfx/face_sid.png");
|
gfx_sprites[FACE_SID] = gfx_loadImage("gfx/face_sid.png");
|
||||||
shape[FACE_KRASS] = gfx_loadImage("gfx/face_krass.png");
|
gfx_sprites[FACE_KRASS] = gfx_loadImage("gfx/face_krass.png");
|
||||||
shape[FACE_PHOEBE] = gfx_loadImage("gfx/face_phoebe.png");
|
gfx_sprites[FACE_PHOEBE] = gfx_loadImage("gfx/face_phoebe.png");
|
||||||
shape[FACE_URSULA] = gfx_loadImage("gfx/face_ursula.png");
|
gfx_sprites[FACE_URSULA] = gfx_loadImage("gfx/face_ursula.png");
|
||||||
shape[FACE_KLINE] = gfx_loadImage("gfx/face_kline.png");
|
gfx_sprites[FACE_KLINE] = gfx_loadImage("gfx/face_kline.png");
|
||||||
|
|
||||||
engine.done = 0;
|
engine.done = 0;
|
||||||
engine.keyState[KEY_FIRE] = 0;
|
engine.keyState[KEY_FIRE] = 0;
|
||||||
|
@ -911,13 +911,13 @@ int intermission()
|
||||||
(systemPlanet[game.stationedPlanet].missionCompleted != 0))
|
(systemPlanet[game.stationedPlanet].missionCompleted != 0))
|
||||||
continue;
|
continue;
|
||||||
else if (game.stationedPlanet == game.destinationPlanet)
|
else if (game.stationedPlanet == game.destinationPlanet)
|
||||||
screen_blit(shape[1], 80 + (i * 90), 500);
|
screen_blit(gfx_sprites[1], 80 + (i * 90), 500);
|
||||||
else if (game.stationedPlanet != game.destinationPlanet)
|
else if (game.stationedPlanet != game.destinationPlanet)
|
||||||
screen_blit(shape[26], 80 + (i * 90), 500);
|
screen_blit(gfx_sprites[26], 80 + (i * 90), 500);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
screen_blit(shape[i + 1], 80 + (i * 90), 500);
|
screen_blit(gfx_sprites[i + 1], 80 + (i * 90), 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 80 + (i * 90), 500, 32, 32))
|
if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 80 + (i * 90), 500, 32, 32))
|
||||||
|
|
16
src/misc.cpp
16
src/misc.cpp
|
@ -23,15 +23,15 @@ void clearInfoLines()
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < 4 ; i++)
|
for (int i = 0 ; i < 4 ; i++)
|
||||||
{
|
{
|
||||||
gfx_text[i].life = 0;
|
gfx_textSprites[i].life = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// from a to b
|
// from a to b
|
||||||
void copyInfoLine(int a, int b)
|
void copyInfoLine(int a, int b)
|
||||||
{
|
{
|
||||||
gfx_createTextObject(b, gfx_text[a].text, -1, 0, gfx_text[a].fontColor);
|
gfx_createTextObject(b, gfx_textSprites[a].text, -1, 0, gfx_textSprites[a].fontColor);
|
||||||
gfx_text[b].life = gfx_text[a].life;
|
gfx_textSprites[b].life = gfx_textSprites[a].life;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -46,7 +46,7 @@ void setInfoLine(const char *in, int color)
|
||||||
|
|
||||||
for (int i = 0 ; i < MAX_INFOLINES ; i++)
|
for (int i = 0 ; i < MAX_INFOLINES ; i++)
|
||||||
{
|
{
|
||||||
if ((gfx_text[i].life == 0) && (index == -1))
|
if ((gfx_textSprites[i].life == 0) && (index == -1))
|
||||||
{
|
{
|
||||||
index = i;
|
index = i;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ void setInfoLine(const char *in, int color)
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx_createTextObject(index, in, -1, 0, color);
|
gfx_createTextObject(index, in, -1, 0, color);
|
||||||
gfx_text[index].life = 240;
|
gfx_textSprites[index].life = 240;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -73,15 +73,15 @@ Phoebe or Ursula's banter to interrupt an important message
|
||||||
*/
|
*/
|
||||||
void setRadioMessage(signed char face, const char *in, int priority)
|
void setRadioMessage(signed char face, const char *in, int priority)
|
||||||
{
|
{
|
||||||
if ((gfx_text[TS_RADIO].life > 0) && (priority == 0))
|
if ((gfx_textSprites[TS_RADIO].life > 0) && (priority == 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gfx_createTextObject(TS_RADIO, in, -1, 50, FONT_WHITE);
|
gfx_createTextObject(TS_RADIO, in, -1, 50, FONT_WHITE);
|
||||||
gfx_text[TS_RADIO].life = 240;
|
gfx_textSprites[TS_RADIO].life = 240;
|
||||||
|
|
||||||
SDL_Surface *faceShape = NULL;
|
SDL_Surface *faceShape = NULL;
|
||||||
if (face > -1)
|
if (face > -1)
|
||||||
faceShape = shape[face];
|
faceShape = gfx_sprites[face];
|
||||||
|
|
||||||
gfx_createMessageBox(faceShape, in, 1);
|
gfx_createMessageBox(faceShape, in, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,8 +34,8 @@ void initPlayer()
|
||||||
player.systemPower = player.maxShield;
|
player.systemPower = player.maxShield;
|
||||||
player.face = 0;
|
player.face = 0;
|
||||||
|
|
||||||
player.image[0] = shipShape[0];
|
player.image[0] = gfx_shipSprites[0];
|
||||||
player.image[1] = shipShape[1];
|
player.image[1] = gfx_shipSprites[1];
|
||||||
|
|
||||||
player.engineX = player.image[0]->w;
|
player.engineX = player.image[0]->w;
|
||||||
player.engineY = (player.image[0]->h / 2);
|
player.engineY = (player.image[0]->h / 2);
|
||||||
|
|
|
@ -41,8 +41,8 @@ void loadGameGraphics()
|
||||||
|
|
||||||
gfx_free();
|
gfx_free();
|
||||||
|
|
||||||
shipShape[0] = gfx_loadImage("gfx/firefly1.png");
|
gfx_shipSprites[0] = gfx_loadImage("gfx/firefly1.png");
|
||||||
shipShape[1] = gfx_loadImage("gfx/firefly2.png");
|
gfx_shipSprites[1] = gfx_loadImage("gfx/firefly2.png");
|
||||||
|
|
||||||
switch(game.system)
|
switch(game.system)
|
||||||
{
|
{
|
||||||
|
@ -67,7 +67,7 @@ void loadGameGraphics()
|
||||||
|
|
||||||
while (fscanf(fp, "%d %s", &index, string) == 2)
|
while (fscanf(fp, "%d %s", &index, string) == 2)
|
||||||
{
|
{
|
||||||
shipShape[index] = gfx_loadImage(string);
|
gfx_shipSprites[index] = gfx_loadImage(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
@ -75,54 +75,54 @@ void loadGameGraphics()
|
||||||
/*
|
/*
|
||||||
Create images of ships being hit that show a lot of red
|
Create images of ships being hit that show a lot of red
|
||||||
*/
|
*/
|
||||||
for (int i = SHIP_HIT_INDEX ; i < MAX_SHIPSHAPES ; i++)
|
for (int i = SHIP_HIT_INDEX ; i < MAX_SHIPSPRITES ; i++)
|
||||||
{
|
{
|
||||||
if (shipShape[i - SHIP_HIT_INDEX] == NULL)
|
if (gfx_shipSprites[i - SHIP_HIT_INDEX] == NULL)
|
||||||
continue;
|
continue;
|
||||||
shipShape[i] = gfx_createSurface(shipShape[i - SHIP_HIT_INDEX]->w,
|
gfx_shipSprites[i] = gfx_createSurface(gfx_shipSprites[i - SHIP_HIT_INDEX]->w,
|
||||||
shipShape[i - SHIP_HIT_INDEX]->h);
|
gfx_shipSprites[i - SHIP_HIT_INDEX]->h);
|
||||||
SDL_SetSurfaceBlendMode(shipShape[i - SHIP_HIT_INDEX], SDL_BLENDMODE_NONE);
|
SDL_SetSurfaceBlendMode(gfx_shipSprites[i - SHIP_HIT_INDEX], SDL_BLENDMODE_NONE);
|
||||||
gfx_blit(shipShape[i - SHIP_HIT_INDEX], 0, 0, shipShape[i]);
|
gfx_blit(gfx_shipSprites[i - SHIP_HIT_INDEX], 0, 0, gfx_shipSprites[i]);
|
||||||
SDL_SetSurfaceBlendMode(shipShape[i - SHIP_HIT_INDEX], SDL_BLENDMODE_BLEND);
|
SDL_SetSurfaceBlendMode(gfx_shipSprites[i - SHIP_HIT_INDEX], SDL_BLENDMODE_BLEND);
|
||||||
|
|
||||||
switch (shipShape[i]->format->BitsPerPixel)
|
switch (gfx_shipSprites[i]->format->BitsPerPixel)
|
||||||
{
|
{
|
||||||
case 32:
|
case 32:
|
||||||
SDL_LockSurface(shipShape[i]);
|
SDL_LockSurface(gfx_shipSprites[i]);
|
||||||
p32 = (Uint32 *)shipShape[i]->pixels;
|
p32 = (Uint32 *)gfx_shipSprites[i]->pixels;
|
||||||
for (int j = 0; j < shipShape[i]->w * shipShape[i]->h; j++)
|
for (int j = 0; j < gfx_shipSprites[i]->w * gfx_shipSprites[i]->h; j++)
|
||||||
{
|
{
|
||||||
if (p32[j])
|
if (p32[j])
|
||||||
p32[j] |= shipShape[i]->format->Rmask;
|
p32[j] |= gfx_shipSprites[i]->format->Rmask;
|
||||||
}
|
}
|
||||||
SDL_UnlockSurface(shipShape[i]);
|
SDL_UnlockSurface(gfx_shipSprites[i]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 16:
|
case 16:
|
||||||
SDL_LockSurface(shipShape[i]);
|
SDL_LockSurface(gfx_shipSprites[i]);
|
||||||
p16 = (Uint16 *)shipShape[i]->pixels;
|
p16 = (Uint16 *)gfx_shipSprites[i]->pixels;
|
||||||
for (int j = 0; j < shipShape[i]->w * shipShape[i]->h; j++)
|
for (int j = 0; j < gfx_shipSprites[i]->w * gfx_shipSprites[i]->h; j++)
|
||||||
{
|
{
|
||||||
if (p16[j])
|
if (p16[j])
|
||||||
p16[j] |= shipShape[i]->format->Rmask;
|
p16[j] |= gfx_shipSprites[i]->format->Rmask;
|
||||||
}
|
}
|
||||||
SDL_UnlockSurface(shipShape[i]);
|
SDL_UnlockSurface(gfx_shipSprites[i]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
SDL_LockSurface(shipShape[i]);
|
SDL_LockSurface(gfx_shipSprites[i]);
|
||||||
p8 = (Uint8 *)shipShape[i]->pixels;
|
p8 = (Uint8 *)gfx_shipSprites[i]->pixels;
|
||||||
for (int j = 0; j < shipShape[i]->w * shipShape[i]->h; j++)
|
for (int j = 0; j < gfx_shipSprites[i]->w * gfx_shipSprites[i]->h; j++)
|
||||||
{
|
{
|
||||||
if (p8[j])
|
if (p8[j])
|
||||||
p8[j] = SDL_MapRGB(shipShape[i]->format, 255, 0, 0);
|
p8[j] = SDL_MapRGB(gfx_shipSprites[i]->format, 255, 0, 0);
|
||||||
}
|
}
|
||||||
SDL_UnlockSurface(shipShape[i]);
|
SDL_UnlockSurface(gfx_shipSprites[i]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_SetColorKey(shipShape[i], SDL_TRUE,
|
SDL_SetColorKey(gfx_shipSprites[i], SDL_TRUE,
|
||||||
SDL_MapRGB(shipShape[i]->format, 0, 0, 0));
|
SDL_MapRGB(gfx_shipSprites[i]->format, 0, 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(string, "data/resources_all.dat");
|
strcpy(string, "data/resources_all.dat");
|
||||||
|
@ -131,7 +131,7 @@ void loadGameGraphics()
|
||||||
|
|
||||||
while (fscanf(fp, "%d %s", &index, string) == 2)
|
while (fscanf(fp, "%d %s", &index, string) == 2)
|
||||||
{
|
{
|
||||||
shape[index] = gfx_loadImage(string);
|
gfx_sprites[index] = gfx_loadImage(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
@ -140,10 +140,10 @@ void loadGameGraphics()
|
||||||
|
|
||||||
for (int i = 0 ; i < CD_MAX ; i++)
|
for (int i = 0 ; i < CD_MAX ; i++)
|
||||||
{
|
{
|
||||||
if (shipShape[alien_defs[i].imageIndex[0]] != NULL)
|
if (gfx_shipSprites[alien_defs[i].imageIndex[0]] != NULL)
|
||||||
{
|
{
|
||||||
alien_defs[i].image[0] = shipShape[alien_defs[i].imageIndex[0]];
|
alien_defs[i].image[0] = gfx_shipSprites[alien_defs[i].imageIndex[0]];
|
||||||
alien_defs[i].image[1] = shipShape[alien_defs[i].imageIndex[1]];
|
alien_defs[i].image[1] = gfx_shipSprites[alien_defs[i].imageIndex[1]];
|
||||||
alien_defs[i].engineX = alien_defs[i].image[0]->w;
|
alien_defs[i].engineX = alien_defs[i].image[0]->w;
|
||||||
alien_defs[i].engineY = (alien_defs[i].image[0]->h / 2);
|
alien_defs[i].engineY = (alien_defs[i].image[0]->h / 2);
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ void loadFont()
|
||||||
{
|
{
|
||||||
SDL_Surface *image, *newImage;
|
SDL_Surface *image, *newImage;
|
||||||
|
|
||||||
for (int i = 0 ; i < MAX_FONTSHAPES ; i++)
|
for (int i = 0 ; i < MAX_FONTSPRITES ; i++)
|
||||||
{
|
{
|
||||||
image = IMG_Load("gfx/smallFont.png");
|
image = IMG_Load("gfx/smallFont.png");
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ void loadFont()
|
||||||
|
|
||||||
newImage = SDL_ConvertSurface(image, screen->format, 0);
|
newImage = SDL_ConvertSurface(image, screen->format, 0);
|
||||||
|
|
||||||
fontShape[i] = gfx_setTransparent(newImage);
|
gfx_fontSprites[i] = gfx_setTransparent(newImage);
|
||||||
|
|
||||||
SDL_FreeSurface(image);
|
SDL_FreeSurface(image);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2003 Parallel Realities
|
Copyright (C) 2003 Parallel Realities
|
||||||
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
Copyright (C) 2011, 2012, 2013 Guus Sliepen
|
||||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
Copyright (C) 2015, 2016 onpon4 <onpon4@riseup.net>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
|
@ -26,6 +26,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
|
|
||||||
SDL_Surface *screen;
|
SDL_Surface *screen;
|
||||||
|
bRect *screen_bufferHead;
|
||||||
|
bRect *screen_bufferTail;
|
||||||
|
|
||||||
void screen_blit(SDL_Surface *image, int x, int y)
|
void screen_blit(SDL_Surface *image, int x, int y)
|
||||||
{
|
{
|
||||||
|
@ -34,7 +36,7 @@ void screen_blit(SDL_Surface *image, int x, int y)
|
||||||
|
|
||||||
void screen_blitText(int i)
|
void screen_blitText(int i)
|
||||||
{
|
{
|
||||||
screen_blit(gfx_text[i].image, (int)gfx_text[i].x, (int)gfx_text[i].y);
|
screen_blit(gfx_textSprites[i].image, (int)gfx_textSprites[i].x, (int)gfx_textSprites[i].y);
|
||||||
}
|
}
|
||||||
|
|
||||||
int screen_renderString(const char *in, int x, int y, int fontColor)
|
int screen_renderString(const char *in, int x, int y, int fontColor)
|
||||||
|
|
|
@ -25,8 +25,13 @@ static void setScene(int scene)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char string[255], face[255];
|
char string[255], face[255];
|
||||||
float sx, sy, x, y, speed;
|
float sx;
|
||||||
int index, shape;
|
float sy;
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
float speed;
|
||||||
|
int index;
|
||||||
|
int img;
|
||||||
|
|
||||||
sprintf(string, "data/cutscene%d.dat", scene);
|
sprintf(string, "data/cutscene%d.dat", scene);
|
||||||
|
|
||||||
|
@ -47,15 +52,15 @@ static void setScene(int scene)
|
||||||
engine.ssy = sy;
|
engine.ssy = sy;
|
||||||
|
|
||||||
// Read in the specs for each ship
|
// Read in the specs for each ship
|
||||||
while (fscanf(fp, "%d %d %f %f %f", &index, &shape, &x, &y, &speed) == 5)
|
while (fscanf(fp, "%d %d %f %f %f", &index, &img, &x, &y, &speed) == 5)
|
||||||
{
|
{
|
||||||
if (x < 0) x = (rand() % abs((int)x));
|
if (x < 0) x = (rand() % abs((int)x));
|
||||||
if (y < 0) y = (rand() % abs((int)y));
|
if (y < 0) y = (rand() % abs((int)y));
|
||||||
if (speed <= -1) speed = 1 + (rand() % abs((int)speed));
|
if (speed <= -1) speed = 1 + (rand() % abs((int)speed));
|
||||||
|
|
||||||
if (shape > -1)
|
if (img > -1)
|
||||||
{
|
{
|
||||||
aliens[index].image[0] = shipShape[shape];
|
aliens[index].image[0] = gfx_shipSprites[img];
|
||||||
aliens[index].x = x;
|
aliens[index].x = x;
|
||||||
aliens[index].y = y;
|
aliens[index].y = y;
|
||||||
aliens[index].dx = speed;
|
aliens[index].dx = speed;
|
||||||
|
@ -188,13 +193,13 @@ void doCutscene(int scene)
|
||||||
|
|
||||||
face = NULL;
|
face = NULL;
|
||||||
if (cutMessage[currentMessage].face != -1)
|
if (cutMessage[currentMessage].face != -1)
|
||||||
face = shape[cutMessage[currentMessage].face];
|
face = gfx_sprites[cutMessage[currentMessage].face];
|
||||||
gfx_createMessageBox(face, cutMessage[currentMessage].message, 0);
|
gfx_createMessageBox(face, cutMessage[currentMessage].message, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((showMessage) && (messageBox != NULL))
|
if ((showMessage) && (gfx_messageBox != NULL))
|
||||||
screen_blit(messageBox, (screen->w - messageBox->w) / 2, screen->h - 100);
|
screen_blit(gfx_messageBox, (screen->w - gfx_messageBox->w) / 2, screen->h - 100);
|
||||||
|
|
||||||
screen_renderString("Press [Escape] to skip", -1, 580, FONT_WHITE);
|
screen_renderString("Press [Escape] to skip", -1, 580, FONT_WHITE);
|
||||||
|
|
||||||
|
|
128
src/shop.cpp
128
src/shop.cpp
|
@ -28,7 +28,7 @@ static void drawSecondaryWeaponSurface()
|
||||||
{
|
{
|
||||||
char description[50] = "";
|
char description[50] = "";
|
||||||
|
|
||||||
gfx_renderString("Secondary Weapon", 10, 3, FONT_WHITE, 0, shopSurface[2]);
|
gfx_renderString("Secondary Weapon", 10, 3, FONT_WHITE, 0, gfx_shopSprites[2]);
|
||||||
|
|
||||||
switch (player.weaponType[1])
|
switch (player.weaponType[1])
|
||||||
{
|
{
|
||||||
|
@ -60,13 +60,13 @@ static void drawSecondaryWeaponSurface()
|
||||||
strcpy(description, "Type : Mcr Homing Missiles");
|
strcpy(description, "Type : Mcr Homing Missiles");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
gfx_renderString(description, 10, 22, FONT_WHITE, 0, shopSurface[2]);
|
gfx_renderString(description, 10, 22, FONT_WHITE, 0, gfx_shopSprites[2]);
|
||||||
|
|
||||||
if ((player.weaponType[1] != W_LASER) &&
|
if ((player.weaponType[1] != W_LASER) &&
|
||||||
(player.weaponType[1] != W_CHARGER) && (player.weaponType[1] != W_NONE))
|
(player.weaponType[1] != W_CHARGER) && (player.weaponType[1] != W_NONE))
|
||||||
{
|
{
|
||||||
sprintf(description, "Capacity : %d", game.maxRocketAmmo);
|
sprintf(description, "Capacity : %d", game.maxRocketAmmo);
|
||||||
gfx_renderString(description, 10, 37, FONT_WHITE, 0, shopSurface[2]);
|
gfx_renderString(description, 10, 37, FONT_WHITE, 0, gfx_shopSprites[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,25 +144,25 @@ static void drawShop()
|
||||||
{
|
{
|
||||||
adjustShopPrices();
|
adjustShopPrices();
|
||||||
|
|
||||||
for (int i = 0 ; i < MAX_SHOPSHAPES ; i++)
|
for (int i = 0 ; i < MAX_SHOPSPRITES ; i++)
|
||||||
{
|
{
|
||||||
if (shopSurface[i] != NULL)
|
if (gfx_shopSprites[i] != NULL)
|
||||||
{
|
{
|
||||||
SDL_FreeSurface(shopSurface[i]);
|
SDL_FreeSurface(gfx_shopSprites[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0 ; i < 3 ; i++)
|
for (int i = 0 ; i < 3 ; i++)
|
||||||
shopSurface[i] = gfx_createSurface(246, 91);
|
gfx_shopSprites[i] = gfx_createSurface(246, 91);
|
||||||
|
|
||||||
for (int i = 0 ; i < 3 ; i++)
|
for (int i = 0 ; i < 3 ; i++)
|
||||||
{
|
{
|
||||||
gfx_drawRect(shopSurface[i], 0, 0, 245, 90, 0x00, 0x00, 0x55);
|
gfx_drawRect(gfx_shopSprites[i], 0, 0, 245, 90, 0x00, 0x00, 0x55);
|
||||||
gfx_drawRect(shopSurface[i], 0, 0, 245, 20, 0x00, 0x00, 0x99);
|
gfx_drawRect(gfx_shopSprites[i], 0, 0, 245, 20, 0x00, 0x00, 0x99);
|
||||||
}
|
}
|
||||||
|
|
||||||
shopSurface[4] = gfx_createAlphaRect(601, 101, 0x00, 0x00, 0x00);
|
gfx_shopSprites[4] = gfx_createAlphaRect(601, 101, 0x00, 0x00, 0x00);
|
||||||
gfx_drawRect(shopSurface[4], 0, 0, 600, 100, 0x00, 0x00, 0x33);
|
gfx_drawRect(gfx_shopSprites[4], 0, 0, 600, 100, 0x00, 0x00, 0x33);
|
||||||
|
|
||||||
switch (shopSelectedItem)
|
switch (shopSelectedItem)
|
||||||
{
|
{
|
||||||
|
@ -177,63 +177,63 @@ static void drawShop()
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
case 8:
|
case 8:
|
||||||
gfx_drawRect(shopSurface[1], 0, 0, 245, 90, 0x55, 0x00, 0x00);
|
gfx_drawRect(gfx_shopSprites[1], 0, 0, 245, 90, 0x55, 0x00, 0x00);
|
||||||
gfx_drawRect(shopSurface[1], 0, 0, 245, 20, 0x99, 0x00, 0x00);
|
gfx_drawRect(gfx_shopSprites[1], 0, 0, 245, 20, 0x99, 0x00, 0x00);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
case 4:
|
case 4:
|
||||||
gfx_drawRect(shopSurface[4], 0, 0, 600, 100, 0x33, 0x00, 0x00);
|
gfx_drawRect(gfx_shopSprites[4], 0, 0, 600, 100, 0x33, 0x00, 0x00);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
case 6:
|
case 6:
|
||||||
case 7:
|
case 7:
|
||||||
gfx_drawRect(shopSurface[0], 0, 0, 245, 90, 0x55, 0x00, 0x00);
|
gfx_drawRect(gfx_shopSprites[0], 0, 0, 245, 90, 0x55, 0x00, 0x00);
|
||||||
gfx_drawRect(shopSurface[0], 0, 0, 245, 20, 0x99, 0x00, 0x00);
|
gfx_drawRect(gfx_shopSprites[0], 0, 0, 245, 20, 0x99, 0x00, 0x00);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
gfx_drawRect(shopSurface[2], 0, 0, 245, 90, 0x55, 0x00, 0x00);
|
gfx_drawRect(gfx_shopSprites[2], 0, 0, 245, 90, 0x55, 0x00, 0x00);
|
||||||
gfx_drawRect(shopSurface[2], 0, 0, 245, 20, 0x99, 0x00, 0x00);
|
gfx_drawRect(gfx_shopSprites[2], 0, 0, 245, 20, 0x99, 0x00, 0x00);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
char description[100];
|
char description[100];
|
||||||
strcpy(description, "");
|
strcpy(description, "");
|
||||||
|
|
||||||
gfx_renderString("Primary Weapon", 10, 3, FONT_WHITE, 0, shopSurface[0]);
|
gfx_renderString("Primary Weapon", 10, 3, FONT_WHITE, 0, gfx_shopSprites[0]);
|
||||||
sprintf(description, "Plasma Cannons : %d", game.minPlasmaOutput);
|
sprintf(description, "Plasma Cannons : %d", game.minPlasmaOutput);
|
||||||
gfx_renderString(description, 10, 22, FONT_WHITE, 0, shopSurface[0]);
|
gfx_renderString(description, 10, 22, FONT_WHITE, 0, gfx_shopSprites[0]);
|
||||||
sprintf(description, "Plasma Power : Stage %d",
|
sprintf(description, "Plasma Power : Stage %d",
|
||||||
game.minPlasmaDamage);
|
game.minPlasmaDamage);
|
||||||
gfx_renderString(description, 10, 37, FONT_WHITE, 0, shopSurface[0]);
|
gfx_renderString(description, 10, 37, FONT_WHITE, 0, gfx_shopSprites[0]);
|
||||||
sprintf(description, "Cooler : Stage %d",
|
sprintf(description, "Cooler : Stage %d",
|
||||||
game.minPlasmaRate);
|
game.minPlasmaRate);
|
||||||
gfx_renderString(description, 10, 52, FONT_WHITE, 0, shopSurface[0]);
|
gfx_renderString(description, 10, 52, FONT_WHITE, 0, gfx_shopSprites[0]);
|
||||||
|
|
||||||
gfx_renderString("Powerup Weapon", 10, 3, FONT_WHITE, 0, shopSurface[1]);
|
gfx_renderString("Powerup Weapon", 10, 3, FONT_WHITE, 0, gfx_shopSprites[1]);
|
||||||
sprintf(description, "Plasma Output : Stage %d",
|
sprintf(description, "Plasma Output : Stage %d",
|
||||||
game.maxPlasmaOutput);
|
game.maxPlasmaOutput);
|
||||||
gfx_renderString(description, 10, 22, FONT_WHITE, 0, shopSurface[1]);
|
gfx_renderString(description, 10, 22, FONT_WHITE, 0, gfx_shopSprites[1]);
|
||||||
sprintf(description, "Plasma Condensor : Stage %d",
|
sprintf(description, "Plasma Condensor : Stage %d",
|
||||||
game.maxPlasmaDamage);
|
game.maxPlasmaDamage);
|
||||||
gfx_renderString(description, 10, 37, FONT_WHITE, 0, shopSurface[1]);
|
gfx_renderString(description, 10, 37, FONT_WHITE, 0, gfx_shopSprites[1]);
|
||||||
sprintf(description, "Liquid Nitrogen : Stage %d",
|
sprintf(description, "Liquid Nitrogen : Stage %d",
|
||||||
game.maxPlasmaRate);
|
game.maxPlasmaRate);
|
||||||
gfx_renderString(description, 10, 52, FONT_WHITE, 0, shopSurface[1]);
|
gfx_renderString(description, 10, 52, FONT_WHITE, 0, gfx_shopSprites[1]);
|
||||||
sprintf(description, "Plasma Capacity : %d", game.maxPlasmaAmmo);
|
sprintf(description, "Plasma Capacity : %d", game.maxPlasmaAmmo);
|
||||||
gfx_renderString(description, 10, 67, FONT_WHITE, 0, shopSurface[1]);
|
gfx_renderString(description, 10, 67, FONT_WHITE, 0, gfx_shopSprites[1]);
|
||||||
|
|
||||||
drawSecondaryWeaponSurface();
|
drawSecondaryWeaponSurface();
|
||||||
|
|
||||||
shopSurface[3] = gfx_createSurface(601, 121);
|
gfx_shopSprites[3] = gfx_createSurface(601, 121);
|
||||||
|
|
||||||
gfx_drawRect(shopSurface[3], 0, 0, 600, 120, 0x00, 0x00, 0x22);
|
gfx_drawRect(gfx_shopSprites[3], 0, 0, 600, 120, 0x00, 0x00, 0x22);
|
||||||
|
|
||||||
gfx_renderString("Temporary Weapons", 10, 2, FONT_WHITE, 0, shopSurface[3]);
|
gfx_renderString("Temporary Weapons", 10, 2, FONT_WHITE, 0, gfx_shopSprites[3]);
|
||||||
gfx_renderString("Ammo and Storage", 260, 2, FONT_WHITE, 0, shopSurface[3]);
|
gfx_renderString("Ammo and Storage", 260, 2, FONT_WHITE, 0, gfx_shopSprites[3]);
|
||||||
|
|
||||||
gfx_renderString("Primary Weapons", 10, 62, FONT_WHITE, 0, shopSurface[3]);
|
gfx_renderString("Primary Weapons", 10, 62, FONT_WHITE, 0, gfx_shopSprites[3]);
|
||||||
|
|
||||||
gfx_renderString("Secondary Weapons", 260, 62, FONT_WHITE, 0, shopSurface[3]);
|
gfx_renderString("Secondary Weapons", 260, 62, FONT_WHITE, 0, gfx_shopSprites[3]);
|
||||||
|
|
||||||
signed char icons = MAX_SHOPITEMS;
|
signed char icons = MAX_SHOPITEMS;
|
||||||
|
|
||||||
|
@ -246,23 +246,23 @@ static void drawShop()
|
||||||
|
|
||||||
for (int i = 0 ; i < icons ; i++)
|
for (int i = 0 ; i < icons ; i++)
|
||||||
{
|
{
|
||||||
gfx_blit(shape[shopItems[i].image], shopItems[i].x - 90,
|
gfx_blit(gfx_sprites[shopItems[i].image], shopItems[i].x - 90,
|
||||||
shopItems[i].y - 178, shopSurface[3]);
|
shopItems[i].y - 178, gfx_shopSprites[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(description, "Shield Units : %d", player.maxShield);
|
sprintf(description, "Shield Units : %d", player.maxShield);
|
||||||
gfx_renderString(description, 10, 4, FONT_WHITE, 0, shopSurface[4]);
|
gfx_renderString(description, 10, 4, FONT_WHITE, 0, gfx_shopSprites[4]);
|
||||||
sprintf(description, "Cash : $%d", game.cash);
|
sprintf(description, "Cash : $%d", game.cash);
|
||||||
gfx_renderString(description, 10, 80, FONT_WHITE, 0, shopSurface[4]);
|
gfx_renderString(description, 10, 80, FONT_WHITE, 0, gfx_shopSprites[4]);
|
||||||
sprintf(description, "Plasma Cells : %.3d", player.ammo[0]);
|
sprintf(description, "Plasma Cells : %.3d", player.ammo[0]);
|
||||||
gfx_renderString(description, 430, 4, FONT_WHITE, 0, shopSurface[4]);
|
gfx_renderString(description, 430, 4, FONT_WHITE, 0, gfx_shopSprites[4]);
|
||||||
sprintf(description, "Rockets : %.3d", player.ammo[1]);
|
sprintf(description, "Rockets : %.3d", player.ammo[1]);
|
||||||
gfx_renderString(description, 475, 80, FONT_WHITE, 0, shopSurface[4]);
|
gfx_renderString(description, 475, 80, FONT_WHITE, 0, gfx_shopSprites[4]);
|
||||||
|
|
||||||
shopSurface[5] = gfx_createSurface(601, 56);
|
gfx_shopSprites[5] = gfx_createSurface(601, 56);
|
||||||
gfx_drawRect(shopSurface[5], 0, 0, 600, 35, 0x00, 0x99, 0x00);
|
gfx_drawRect(gfx_shopSprites[5], 0, 0, 600, 35, 0x00, 0x99, 0x00);
|
||||||
gfx_drawRect(shopSurface[5], 0, 20, 600, 35, 0x00, 0x33, 0x00);
|
gfx_drawRect(gfx_shopSprites[5], 0, 20, 600, 35, 0x00, 0x33, 0x00);
|
||||||
gfx_renderString("Information", 5, 4, FONT_WHITE, 0, shopSurface[5]);
|
gfx_renderString("Information", 5, 4, FONT_WHITE, 0, gfx_shopSprites[5]);
|
||||||
|
|
||||||
switch (shopSelectedItem)
|
switch (shopSelectedItem)
|
||||||
{
|
{
|
||||||
|
@ -270,37 +270,37 @@ static void drawShop()
|
||||||
break;
|
break;
|
||||||
case -2:
|
case -2:
|
||||||
gfx_renderString("You don't have enough money", 20, 30, FONT_WHITE,
|
gfx_renderString("You don't have enough money", 20, 30, FONT_WHITE,
|
||||||
0, shopSurface[5]);
|
0, gfx_shopSprites[5]);
|
||||||
break;
|
break;
|
||||||
case -3:
|
case -3:
|
||||||
gfx_renderString("Cannot upgrade ship", 5, 22, FONT_WHITE, 0,
|
gfx_renderString("Cannot upgrade ship", 5, 22, FONT_WHITE, 0,
|
||||||
shopSurface[5]);
|
gfx_shopSprites[5]);
|
||||||
gfx_renderString("Hardware capacity has been reached", 20, 38,
|
gfx_renderString("Hardware capacity has been reached", 20, 38,
|
||||||
FONT_CYAN, 0, shopSurface[5]);
|
FONT_CYAN, 0, gfx_shopSprites[5]);
|
||||||
break;
|
break;
|
||||||
case -4:
|
case -4:
|
||||||
gfx_renderString("Ammunition limit reached", 20, 30, FONT_WHITE, 0,
|
gfx_renderString("Ammunition limit reached", 20, 30, FONT_WHITE, 0,
|
||||||
shopSurface[5]);
|
gfx_shopSprites[5]);
|
||||||
break;
|
break;
|
||||||
case -5:
|
case -5:
|
||||||
gfx_renderString("You cannot sell that item", 20, 30, FONT_WHITE,
|
gfx_renderString("You cannot sell that item", 20, 30, FONT_WHITE,
|
||||||
0, shopSurface[5]);
|
0, gfx_shopSprites[5]);
|
||||||
break;
|
break;
|
||||||
case -6:
|
case -6:
|
||||||
gfx_renderString("Nothing to sell", 20, 30, FONT_WHITE, 0,
|
gfx_renderString("Nothing to sell", 20, 30, FONT_WHITE, 0,
|
||||||
shopSurface[5]);
|
gfx_shopSprites[5]);
|
||||||
break;
|
break;
|
||||||
case -7:
|
case -7:
|
||||||
gfx_renderString("Rockets cannot be bought for Laser or Charger Cannon",
|
gfx_renderString("Rockets cannot be bought for Laser or Charger Cannon",
|
||||||
5, 30, FONT_WHITE, 0, shopSurface[5]);
|
5, 30, FONT_WHITE, 0, gfx_shopSprites[5]);
|
||||||
break;
|
break;
|
||||||
case -8:
|
case -8:
|
||||||
gfx_renderString("You already have that weapon", 20, 30,
|
gfx_renderString("You already have that weapon", 20, 30,
|
||||||
FONT_WHITE, 0, shopSurface[5]);
|
FONT_WHITE, 0, gfx_shopSprites[5]);
|
||||||
break;
|
break;
|
||||||
case -9:
|
case -9:
|
||||||
gfx_renderString("This weapon's ammo limit has been reached", 20,
|
gfx_renderString("This weapon's ammo limit has been reached", 20,
|
||||||
30, FONT_WHITE, 0, shopSurface[5]);
|
30, FONT_WHITE, 0, gfx_shopSprites[5]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (shopItems[shopSelectedItem].price != 0)
|
if (shopItems[shopSelectedItem].price != 0)
|
||||||
|
@ -315,8 +315,8 @@ static void drawShop()
|
||||||
shopItems[shopSelectedItem].description);
|
shopItems[shopSelectedItem].description);
|
||||||
}
|
}
|
||||||
gfx_renderString(shopItems[shopSelectedItem].name, 5, 22,
|
gfx_renderString(shopItems[shopSelectedItem].name, 5, 22,
|
||||||
FONT_WHITE, 0, shopSurface[5]);
|
FONT_WHITE, 0, gfx_shopSprites[5]);
|
||||||
gfx_renderString(description, 20, 38, FONT_CYAN, 0, shopSurface[5]);
|
gfx_renderString(description, 20, 38, FONT_CYAN, 0, gfx_shopSprites[5]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -485,7 +485,7 @@ void initShop()
|
||||||
|
|
||||||
shopSelectedItem = -1;
|
shopSelectedItem = -1;
|
||||||
|
|
||||||
player.image[0] = shape[0];
|
player.image[0] = gfx_sprites[0];
|
||||||
player.x = 380;
|
player.x = 380;
|
||||||
player.y = 95;
|
player.y = 95;
|
||||||
|
|
||||||
|
@ -1018,20 +1018,20 @@ static void sell(int i)
|
||||||
|
|
||||||
void showShop()
|
void showShop()
|
||||||
{
|
{
|
||||||
screen_blit(shopSurface[0], 20, 395);
|
screen_blit(gfx_shopSprites[0], 20, 395);
|
||||||
screen_blit(shopSurface[1], 275, 395);
|
screen_blit(gfx_shopSprites[1], 275, 395);
|
||||||
screen_blit(shopSurface[2], 530, 395);
|
screen_blit(gfx_shopSprites[2], 530, 395);
|
||||||
screen_blit(shopSurface[3], 100, 180);
|
screen_blit(gfx_shopSprites[3], 100, 180);
|
||||||
screen_blit(shopSurface[4], 100, 50);
|
screen_blit(gfx_shopSprites[4], 100, 50);
|
||||||
screen_blit(shopSurface[5], 100, 320);
|
screen_blit(gfx_shopSprites[5], 100, 320);
|
||||||
|
|
||||||
if (shopSelectedItem > -1)
|
if (shopSelectedItem > -1)
|
||||||
{
|
{
|
||||||
screen_blit(shape[27], 60, 350);
|
screen_blit(gfx_sprites[27], 60, 350);
|
||||||
screen_blit(shape[28], 710, 350);
|
screen_blit(gfx_sprites[28], 710, 350);
|
||||||
}
|
}
|
||||||
|
|
||||||
screen_blit(shape[29], (int)player.x, (int)player.y);
|
screen_blit(gfx_sprites[29], (int)player.x, (int)player.y);
|
||||||
|
|
||||||
signed char icons = MAX_SHOPITEMS;
|
signed char icons = MAX_SHOPITEMS;
|
||||||
|
|
||||||
|
|
|
@ -30,12 +30,12 @@ static signed char showGameMenu(signed char continueSaveSlot)
|
||||||
screen_blitText(TS_OPTIONS);
|
screen_blitText(TS_OPTIONS);
|
||||||
if (engine.cheat)
|
if (engine.cheat)
|
||||||
{
|
{
|
||||||
gfx_text[TS_QUIT].y = screen->h / 3 + 150;
|
gfx_textSprites[TS_QUIT].y = screen->h / 3 + 150;
|
||||||
screen_blitText(TS_CHEAT_OPTIONS);
|
screen_blitText(TS_CHEAT_OPTIONS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gfx_text[TS_QUIT].y = screen->h / 3 + 130;
|
gfx_textSprites[TS_QUIT].y = screen->h / 3 + 130;
|
||||||
}
|
}
|
||||||
screen_blitText(TS_QUIT);
|
screen_blitText(TS_QUIT);
|
||||||
|
|
||||||
|
@ -52,10 +52,10 @@ static signed char showLoadMenu()
|
||||||
for (int i = TS_SAVESLOT_0 ; i <= TS_SAVESLOT_5 ; i++)
|
for (int i = TS_SAVESLOT_0 ; i <= TS_SAVESLOT_5 ; i++)
|
||||||
{
|
{
|
||||||
rtn++;
|
rtn++;
|
||||||
if (gfx_text[i].image != NULL)
|
if (gfx_textSprites[i].image != NULL)
|
||||||
{
|
{
|
||||||
screen_blitText(i);
|
screen_blitText(i);
|
||||||
gfx_text[TS_BACK_TO_MAIN_MENU].y = gfx_text[i].y + 40;
|
gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = gfx_textSprites[i].y + 40;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
screen_blitText(TS_BACK_TO_MAIN_MENU);
|
screen_blitText(TS_BACK_TO_MAIN_MENU);
|
||||||
|
@ -87,7 +87,7 @@ static void createDifficultyMenu()
|
||||||
|
|
||||||
static signed char showDifficultyMenu()
|
static signed char showDifficultyMenu()
|
||||||
{
|
{
|
||||||
gfx_text[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 110;
|
gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 110;
|
||||||
|
|
||||||
screen_blitText(TS_START_GAME);
|
screen_blitText(TS_START_GAME);
|
||||||
screen_blitText(TS_DIFFICULTY);
|
screen_blitText(TS_DIFFICULTY);
|
||||||
|
@ -129,7 +129,7 @@ static void createOptionsMenu()
|
||||||
|
|
||||||
static signed char showOptionsMenu()
|
static signed char showOptionsMenu()
|
||||||
{
|
{
|
||||||
gfx_text[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 150;
|
gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 150;
|
||||||
|
|
||||||
screen_blitText(TS_SOUND);
|
screen_blitText(TS_SOUND);
|
||||||
screen_blitText(TS_MUSIC);
|
screen_blitText(TS_MUSIC);
|
||||||
|
@ -173,7 +173,7 @@ static void createCheatMenu()
|
||||||
|
|
||||||
static signed char showCheatMenu()
|
static signed char showCheatMenu()
|
||||||
{
|
{
|
||||||
gfx_text[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 150;
|
gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 150;
|
||||||
|
|
||||||
screen_blitText(TS_UNLIMITED_SHIELD);
|
screen_blitText(TS_UNLIMITED_SHIELD);
|
||||||
screen_blitText(TS_UNLIMITED_AMMO);
|
screen_blitText(TS_UNLIMITED_AMMO);
|
||||||
|
@ -635,11 +635,11 @@ void showStory()
|
||||||
|
|
||||||
// XXX: The fact that it's line 8 that's watched is completely
|
// XXX: The fact that it's line 8 that's watched is completely
|
||||||
// arbitrary. It might be prudent to replace this with something else.
|
// arbitrary. It might be prudent to replace this with something else.
|
||||||
if (gfx_text[8].y > (screen->h / 2) + 150)
|
if (gfx_textSprites[8].y > (screen->h / 2) + 150)
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < 9 ; i++)
|
for (int i = 0 ; i < 9 ; i++)
|
||||||
{
|
{
|
||||||
gfx_text[i].y -= 0.33333;
|
gfx_textSprites[i].y -= 0.33333;
|
||||||
screen_blitText(i);
|
screen_blitText(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2003 Parallel Realities
|
Copyright (C) 2003 Parallel Realities
|
||||||
Copyright (C) 2011, 2013 Guus Sliepen
|
Copyright (C) 2011, 2013 Guus Sliepen
|
||||||
Copyright (C) 2015 onpon4 <onpon4@riseup.net>
|
Copyright (C) 2015, 2016 onpon4 <onpon4@riseup.net>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License
|
modify it under the terms of the GNU General Public License
|
||||||
|
@ -25,8 +25,8 @@ void setWeaponShapes()
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < MAX_WEAPONS ; i++)
|
for (int i = 0 ; i < MAX_WEAPONS ; i++)
|
||||||
{
|
{
|
||||||
weapon[i].image[0] = shape[weapon[i].imageIndex[0]];
|
weapon[i].image[0] = gfx_sprites[weapon[i].imageIndex[0]];
|
||||||
weapon[i].image[1] = shape[weapon[i].imageIndex[1]];
|
weapon[i].image[1] = gfx_sprites[weapon[i].imageIndex[1]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue