Removed the very last of the image-related magic numbers (in source code).
The only magic numbers left now are related to positioning, image sizing, and the remaining "data" files (the "planets" and "brief" ones). At least, I'm pretty sure that's the case.
This commit is contained in:
parent
4be080225b
commit
822ff849e4
|
@ -1,59 +0,0 @@
|
||||||
0 gfx/plasmaGreen.png
|
|
||||||
1 gfx/plasmaRed.png
|
|
||||||
2 gfx/rocket1.png
|
|
||||||
3 gfx/rocket2.png
|
|
||||||
4 gfx/explode1.png
|
|
||||||
5 gfx/explode2.png
|
|
||||||
6 gfx/explode3.png
|
|
||||||
7 gfx/explode4.png
|
|
||||||
8 gfx/explode05.png
|
|
||||||
9 gfx/explode06.png
|
|
||||||
10 gfx/explode07.png
|
|
||||||
11 gfx/explode08.png
|
|
||||||
12 gfx/explode9.png
|
|
||||||
13 gfx/explode10.png
|
|
||||||
14 gfx/explode11.png
|
|
||||||
15 gfx/explode12.png
|
|
||||||
16 gfx/explode13.png
|
|
||||||
17 gfx/explode14.png
|
|
||||||
18 gfx/explode15.png
|
|
||||||
19 gfx/explode16.png
|
|
||||||
20 gfx/elec1.png
|
|
||||||
21 gfx/elec2.png
|
|
||||||
22 gfx/elec3.png
|
|
||||||
23 gfx/elec4.png
|
|
||||||
24 gfx/dollar.png
|
|
||||||
25 gfx/rocket.png
|
|
||||||
26 gfx/heart.png
|
|
||||||
27 gfx/plasmaAmmo.png
|
|
||||||
28 gfx/plasmaRate.png
|
|
||||||
29 gfx/plasmaDamage.png
|
|
||||||
30 gfx/chainLink.png
|
|
||||||
31 gfx/mine.png
|
|
||||||
32 gfx/cargo1.png
|
|
||||||
33 gfx/greenDir.png
|
|
||||||
34 gfx/redDir.png
|
|
||||||
35 gfx/stunBolt.png
|
|
||||||
36 gfx/arrowNorth.png
|
|
||||||
37 gfx/arrowNorthEast.png
|
|
||||||
38 gfx/arrowEast.png
|
|
||||||
39 gfx/arrowSouthEast.png
|
|
||||||
40 gfx/arrowSouth.png
|
|
||||||
41 gfx/arrowSouthWest.png
|
|
||||||
42 gfx/arrowWest.png
|
|
||||||
43 gfx/arrowNorthWest.png
|
|
||||||
44 gfx/targetText.png
|
|
||||||
45 gfx/pod.png
|
|
||||||
46 gfx/ore1.png
|
|
||||||
47 gfx/ore2.png
|
|
||||||
48 gfx/ore3.png
|
|
||||||
49 gfx/rocketAmmo.png
|
|
||||||
50 gfx/superCharge.png
|
|
||||||
90 gfx/face_chris.png
|
|
||||||
91 gfx/face_sid.png
|
|
||||||
92 gfx/face_krass.png
|
|
||||||
93 gfx/face_kline.png
|
|
||||||
94 gfx/face_phoebe.png
|
|
||||||
95 gfx/face_ursula.png
|
|
||||||
96 gfx/face_crew.png
|
|
||||||
-1
|
|
|
@ -998,10 +998,10 @@ bool alien_add()
|
||||||
(game.area == MISN_VENUS))
|
(game.area == MISN_VENUS))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
signed char *alienArray;
|
int *alienArray;
|
||||||
signed char numberOfAliens = 1;
|
int numberOfAliens = 1;
|
||||||
|
|
||||||
alienArray = new signed char[8];
|
alienArray = new int[8];
|
||||||
|
|
||||||
switch(game.area)
|
switch(game.area)
|
||||||
{
|
{
|
||||||
|
@ -1100,7 +1100,7 @@ bool alien_add()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
signed char randEnemy = alienArray[rand() % numberOfAliens];
|
int randEnemy = alienArray[rand() % numberOfAliens];
|
||||||
|
|
||||||
if ((game.area != MISN_DORIM) &&
|
if ((game.area != MISN_DORIM) &&
|
||||||
(game.area != MISN_SIVEDI) &&
|
(game.area != MISN_SIVEDI) &&
|
||||||
|
@ -1728,7 +1728,7 @@ void alien_destroy(object *alien, object *attacker)
|
||||||
|
|
||||||
if (rand() % 100 <= alien->collectChance)
|
if (rand() % 100 <= alien->collectChance)
|
||||||
{
|
{
|
||||||
unsigned char value;
|
int value;
|
||||||
|
|
||||||
if ((rand() % 10) == 0)
|
if ((rand() % 10) == 0)
|
||||||
alien->collectValue *= 2;
|
alien->collectValue *= 2;
|
||||||
|
|
|
@ -378,7 +378,7 @@ void cutscene_init(int scene)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool showMessage = false;
|
bool showMessage = false;
|
||||||
signed char currentMessage = -1;
|
int currentMessage = -1;
|
||||||
int timer = 60 * 4;
|
int timer = 60 * 4;
|
||||||
|
|
||||||
screen_drawBackground();
|
screen_drawBackground();
|
||||||
|
|
|
@ -34,7 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
((x) + (y) < (a) ? ((b) - (a)) : 0) + \
|
((x) + (y) < (a) ? ((b) - (a)) : 0) + \
|
||||||
((x) + (y) > (b) ? ((a) - (b)) : 0))
|
((x) + (y) > (b) ? ((a) - (b)) : 0))
|
||||||
#define CHANCE(x) ((rand() % RAND_MAX) < ((x) * RAND_MAX))
|
#define CHANCE(x) ((rand() % RAND_MAX) < ((x) * RAND_MAX))
|
||||||
#define RANDRANGE(x, y) (((x) < (y)) ? ((x) + (rand() % (long long)(1 + (y) - (x)))) : (x))
|
#define RANDRANGE(x, y) (((x) < (y)) ? ((x) + (rand() % (long)(1 + (y) - (x)))) : (x))
|
||||||
|
|
||||||
|
|
||||||
// Compile-time options
|
// Compile-time options
|
||||||
|
@ -97,7 +97,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#define WF_DISABLE 1024
|
#define WF_DISABLE 1024
|
||||||
#define WF_TIMEDEXPLOSION 2048
|
#define WF_TIMEDEXPLOSION 2048
|
||||||
|
|
||||||
#define MAX_WEAPONS 20
|
|
||||||
#define MAX_CARGO 20
|
#define MAX_CARGO 20
|
||||||
#define MAX_INFOLINES 3
|
#define MAX_INFOLINES 3
|
||||||
#define MAX_EVENTS 20
|
#define MAX_EVENTS 20
|
||||||
|
@ -197,7 +196,8 @@ enum {
|
||||||
W_AIMED_SHOT,
|
W_AIMED_SHOT,
|
||||||
W_SPREADSHOT,
|
W_SPREADSHOT,
|
||||||
W_IONCANNON,
|
W_IONCANNON,
|
||||||
W_DIRSHOCKMISSILE
|
W_DIRSHOCKMISSILE,
|
||||||
|
W_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
// Mission types
|
// Mission types
|
||||||
|
|
|
@ -1011,6 +1011,9 @@ static void game_doAliens()
|
||||||
((rand() % 1000 < aliens[i].chance[0]) ||
|
((rand() % 1000 < aliens[i].chance[0]) ||
|
||||||
(aliens[i].flags & FL_CONTINUOUS_FIRE)))
|
(aliens[i].flags & FL_CONTINUOUS_FIRE)))
|
||||||
{
|
{
|
||||||
|
// FIXME: I'm pretty sure this is the line that's causing mobile energy ray cannons
|
||||||
|
// to fire off 5 plasma bullets. Need to find out exactly what
|
||||||
|
// this line is for and make the appropriate adjustments.
|
||||||
ship_fireBullet(&aliens[i], 0);
|
ship_fireBullet(&aliens[i], 0);
|
||||||
}
|
}
|
||||||
if ((aliens[i].reload[1] == 0) &&
|
if ((aliens[i].reload[1] == 0) &&
|
||||||
|
@ -1641,7 +1644,7 @@ static void game_doHud()
|
||||||
{
|
{
|
||||||
int shieldColor = 0;
|
int shieldColor = 0;
|
||||||
SDL_Rect bar;
|
SDL_Rect bar;
|
||||||
signed char fontColor;
|
int fontColor;
|
||||||
char text[25];
|
char text[25];
|
||||||
|
|
||||||
screen_addBuffer(0, 20, screen->w, 25);
|
screen_addBuffer(0, 20, screen->w, 25);
|
||||||
|
|
|
@ -93,7 +93,7 @@ void gfx_blit(SDL_Surface *image, int x, int y, SDL_Surface *dest)
|
||||||
In 16 bit mode this is slow. VERY slow. Don't write directly to a surface
|
In 16 bit mode this is slow. VERY slow. Don't write directly to a surface
|
||||||
that constantly needs updating (eg - the main game screen)
|
that constantly needs updating (eg - the main game screen)
|
||||||
*/
|
*/
|
||||||
static int gfx_renderStringBase(const char *in, int x, int y, int fontColor, signed char wrap, SDL_Surface *dest)
|
static int gfx_renderStringBase(const char *in, int x, int y, int fontColor, int wrap, SDL_Surface *dest)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int splitword;
|
int splitword;
|
||||||
|
@ -389,7 +389,7 @@ SDL_Surface *gfx_createAlphaRect(int width, int height, Uint8 red, Uint8 green,
|
||||||
return surface;
|
return surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfx_createMessageBox(SDL_Surface *face, const char *message, signed char transparent)
|
void gfx_createMessageBox(SDL_Surface *face, const char *message, int transparent)
|
||||||
{
|
{
|
||||||
int x = 60;
|
int x = 60;
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ SDL_Surface *gfx_createSurface(int width, int height);
|
||||||
SDL_Surface *gfx_createTextSurface(const char *inString, int color);
|
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);
|
||||||
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);
|
||||||
void gfx_createMessageBox(SDL_Surface *face, const char *message, signed char transparent);
|
void gfx_createMessageBox(SDL_Surface *face, const char *message, int transparent);
|
||||||
SDL_Surface *gfx_loadImage(const char *filename);
|
SDL_Surface *gfx_loadImage(const char *filename);
|
||||||
void gfx_free();
|
void gfx_free();
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,7 @@ will show their name and their current status
|
||||||
static bool intermission_showSystem(float x, float y, bool selectable)
|
static bool intermission_showSystem(float x, float y, bool selectable)
|
||||||
{
|
{
|
||||||
SDL_Rect r;
|
SDL_Rect r;
|
||||||
signed char planet = 0;
|
int planet = 0;
|
||||||
int planetSpace = systemPlanet[planet].y;
|
int planetSpace = systemPlanet[planet].y;
|
||||||
bool rtn = false;
|
bool rtn = false;
|
||||||
|
|
||||||
|
@ -555,6 +555,24 @@ int intermission()
|
||||||
{
|
{
|
||||||
int iconInfoY;
|
int iconInfoY;
|
||||||
|
|
||||||
|
char string[25];
|
||||||
|
|
||||||
|
SDL_Rect r;
|
||||||
|
SDL_Rect destRect;
|
||||||
|
int distance = 0;
|
||||||
|
double interceptionChance;
|
||||||
|
|
||||||
|
int section = 1;
|
||||||
|
|
||||||
|
float sinX = 300;
|
||||||
|
float cosY = 300;
|
||||||
|
bool movePlanets = true;
|
||||||
|
int saveSlot = -1;
|
||||||
|
|
||||||
|
int rtn = 0;
|
||||||
|
|
||||||
|
bool redrawBackground = true;
|
||||||
|
|
||||||
gfx_free();
|
gfx_free();
|
||||||
|
|
||||||
checkForBossMission(); // double check just to make sure!
|
checkForBossMission(); // double check just to make sure!
|
||||||
|
@ -571,8 +589,6 @@ int intermission()
|
||||||
|
|
||||||
loadBackground(systemBackground[game.system]);
|
loadBackground(systemBackground[game.system]);
|
||||||
|
|
||||||
char string[25];
|
|
||||||
|
|
||||||
engine.cursor_x = screen->w / 2;
|
engine.cursor_x = screen->w / 2;
|
||||||
engine.cursor_y = screen->h / 2;
|
engine.cursor_y = screen->h / 2;
|
||||||
gfx_sprites[SP_CURSOR] = gfx_loadImage("gfx/cursor.png");
|
gfx_sprites[SP_CURSOR] = gfx_loadImage("gfx/cursor.png");
|
||||||
|
@ -629,11 +645,6 @@ int intermission()
|
||||||
engine.ssx = 0;
|
engine.ssx = 0;
|
||||||
engine.ssy = 0;
|
engine.ssy = 0;
|
||||||
|
|
||||||
SDL_Rect r;
|
|
||||||
SDL_Rect destRect;
|
|
||||||
int distance = 0;
|
|
||||||
double interceptionChance;
|
|
||||||
|
|
||||||
intermission_setStatusLines();
|
intermission_setStatusLines();
|
||||||
initShop();
|
initShop();
|
||||||
intermission_setSystemPlanets();
|
intermission_setSystemPlanets();
|
||||||
|
@ -647,13 +658,6 @@ int intermission()
|
||||||
intermission_createOptions(optionsSurface);
|
intermission_createOptions(optionsSurface);
|
||||||
intermission_createCommsSurface(commsSurface);
|
intermission_createCommsSurface(commsSurface);
|
||||||
|
|
||||||
signed char section = 1;
|
|
||||||
|
|
||||||
float sinX = 300;
|
|
||||||
float cosY = 300;
|
|
||||||
bool movePlanets = true;
|
|
||||||
signed char saveSlot = -1;
|
|
||||||
|
|
||||||
// Remove the Supercharge, if it is there
|
// Remove the Supercharge, if it is there
|
||||||
if ((game.difficulty != DIFFICULTY_EASY) &&
|
if ((game.difficulty != DIFFICULTY_EASY) &&
|
||||||
(game.difficulty != DIFFICULTY_ORIGINAL))
|
(game.difficulty != DIFFICULTY_ORIGINAL))
|
||||||
|
@ -686,8 +690,6 @@ int intermission()
|
||||||
interceptionChance = 0;
|
interceptionChance = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rtn = 0;
|
|
||||||
|
|
||||||
if ((engine.useAudio) && (engine.useMusic))
|
if ((engine.useAudio) && (engine.useMusic))
|
||||||
audio_playMusic("music/through_space.ogg", -1);
|
audio_playMusic("music/through_space.ogg", -1);
|
||||||
|
|
||||||
|
@ -715,8 +717,6 @@ int intermission()
|
||||||
strcpy(string, "Destination: None");
|
strcpy(string, "Destination: None");
|
||||||
gfx_createTextObject(TS_DEST_PLANET, string, 550, 450, FONT_WHITE);
|
gfx_createTextObject(TS_DEST_PLANET, string, 550, 450, FONT_WHITE);
|
||||||
|
|
||||||
bool rescreen_drawBackground = true;
|
|
||||||
|
|
||||||
if (game.distanceCovered > 0)
|
if (game.distanceCovered > 0)
|
||||||
section = 0;
|
section = 0;
|
||||||
else
|
else
|
||||||
|
@ -730,10 +730,10 @@ int intermission()
|
||||||
{
|
{
|
||||||
renderer_update();
|
renderer_update();
|
||||||
|
|
||||||
if (rescreen_drawBackground)
|
if (redrawBackground)
|
||||||
{
|
{
|
||||||
screen_drawBackground();
|
screen_drawBackground();
|
||||||
rescreen_drawBackground = false;
|
redrawBackground = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -889,7 +889,7 @@ int intermission()
|
||||||
gfx_createTextObject(TS_CURRENT_PLANET, string, 90, 450, FONT_WHITE);
|
gfx_createTextObject(TS_CURRENT_PLANET, string, 90, 450, FONT_WHITE);
|
||||||
intermission_updateCommsSurface(commsSurface);
|
intermission_updateCommsSurface(commsSurface);
|
||||||
section = 1;
|
section = 1;
|
||||||
rescreen_drawBackground = true;
|
redrawBackground = true;
|
||||||
saveGame(0);
|
saveGame(0);
|
||||||
}
|
}
|
||||||
else if (interceptionChance > 0)
|
else if (interceptionChance > 0)
|
||||||
|
@ -910,64 +910,111 @@ int intermission()
|
||||||
|
|
||||||
if (section != 8)
|
if (section != 8)
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < 8 ; i++)
|
if ((game.stationedPlanet == game.destinationPlanet) &&
|
||||||
|
(!systemPlanet[game.stationedPlanet].missionCompleted))
|
||||||
|
screen_blit(gfx_sprites[SP_START_MISSION], 80, 500);
|
||||||
|
else if (game.stationedPlanet != game.destinationPlanet)
|
||||||
|
screen_blit(gfx_sprites[SP_GOTO], 80, 500);
|
||||||
|
|
||||||
|
screen_blit(gfx_sprites[SP_MAP], 170, 500);
|
||||||
|
screen_blit(gfx_sprites[SP_STATUS], 260, 500);
|
||||||
|
screen_blit(gfx_sprites[SP_SAVE], 350, 500);
|
||||||
|
screen_blit(gfx_sprites[SP_SHOP], 440, 500);
|
||||||
|
screen_blit(gfx_sprites[SP_COMM], 530, 500);
|
||||||
|
screen_blit(gfx_sprites[SP_OPTIONS], 620, 500);
|
||||||
|
screen_blit(gfx_sprites[SP_EXIT], 710, 500);
|
||||||
|
|
||||||
|
if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 80, 500, 32, 32) &&
|
||||||
|
((game.stationedPlanet != game.destinationPlanet) ||
|
||||||
|
(!systemPlanet[game.stationedPlanet].missionCompleted)))
|
||||||
{
|
{
|
||||||
// if the mission has been completed, there is no
|
if (game.stationedPlanet == game.destinationPlanet)
|
||||||
// "Start Next Mission" icon
|
screen_blitText(TS_INFO_START_MISSION);
|
||||||
if (i == 0)
|
|
||||||
{
|
|
||||||
if ((game.stationedPlanet == game.destinationPlanet) &&
|
|
||||||
(systemPlanet[game.stationedPlanet].missionCompleted != 0))
|
|
||||||
continue;
|
|
||||||
else if (game.stationedPlanet == game.destinationPlanet)
|
|
||||||
screen_blit(gfx_sprites[SP_START_MISSION], 80 + (i * 90), 500);
|
|
||||||
else if (game.stationedPlanet != game.destinationPlanet)
|
|
||||||
screen_blit(gfx_sprites[SP_GOTO], 80 + (i * 90), 500);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
|
screen_blitText(TS_INFO_GOTO);
|
||||||
|
|
||||||
|
if ((engine.keyState[KEY_FIRE]))
|
||||||
{
|
{
|
||||||
screen_blit(gfx_sprites[i + 1], 80 + (i * 90), 500);
|
redrawBackground = true;
|
||||||
|
section = 0;
|
||||||
|
engine.keyState[KEY_FIRE] = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 170, 500, 32, 32))
|
||||||
|
{
|
||||||
|
screen_blitText(TS_INFO_MAP);
|
||||||
|
|
||||||
if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 80 + (i * 90), 500, 32, 32))
|
if ((engine.keyState[KEY_FIRE]))
|
||||||
{
|
{
|
||||||
switch (i)
|
redrawBackground = true;
|
||||||
{
|
section = 1;
|
||||||
case 0:
|
engine.keyState[KEY_FIRE] = 0;
|
||||||
if (game.stationedPlanet == game.destinationPlanet)
|
}
|
||||||
screen_blitText(TS_INFO_START_MISSION);
|
}
|
||||||
else
|
else if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 260, 500, 32, 32))
|
||||||
screen_blitText(TS_INFO_GOTO);
|
{
|
||||||
break;
|
screen_blitText(TS_INFO_STATUS);
|
||||||
case 1:
|
|
||||||
screen_blitText(TS_INFO_MAP);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
screen_blitText(TS_INFO_STATUS);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
screen_blitText(TS_INFO_SAVE_GAME);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
screen_blitText(TS_INFO_SHOP);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
screen_blitText(TS_INFO_COMMS);
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
screen_blitText(TS_INFO_OPTIONS);
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
screen_blitText(TS_INFO_EXIT);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((engine.keyState[KEY_FIRE]))
|
if ((engine.keyState[KEY_FIRE]))
|
||||||
{
|
{
|
||||||
rescreen_drawBackground = true;
|
redrawBackground = true;
|
||||||
section = i;
|
section = 2;
|
||||||
engine.keyState[KEY_FIRE] = 0;
|
engine.keyState[KEY_FIRE] = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 350, 500, 32, 32))
|
||||||
|
{
|
||||||
|
screen_blitText(TS_INFO_SAVE_GAME);
|
||||||
|
|
||||||
|
if ((engine.keyState[KEY_FIRE]))
|
||||||
|
{
|
||||||
|
redrawBackground = true;
|
||||||
|
section = 3;
|
||||||
|
engine.keyState[KEY_FIRE] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 440, 500, 32, 32))
|
||||||
|
{
|
||||||
|
screen_blitText(TS_INFO_SHOP);
|
||||||
|
|
||||||
|
if ((engine.keyState[KEY_FIRE]))
|
||||||
|
{
|
||||||
|
redrawBackground = true;
|
||||||
|
section = 4;
|
||||||
|
engine.keyState[KEY_FIRE] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 530, 500, 32, 32))
|
||||||
|
{
|
||||||
|
screen_blitText(TS_INFO_COMMS);
|
||||||
|
|
||||||
|
if ((engine.keyState[KEY_FIRE]))
|
||||||
|
{
|
||||||
|
redrawBackground = true;
|
||||||
|
section = 5;
|
||||||
|
engine.keyState[KEY_FIRE] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 620, 500, 32, 32))
|
||||||
|
{
|
||||||
|
screen_blitText(TS_INFO_OPTIONS);
|
||||||
|
|
||||||
|
if ((engine.keyState[KEY_FIRE]))
|
||||||
|
{
|
||||||
|
redrawBackground = true;
|
||||||
|
section = 6;
|
||||||
|
engine.keyState[KEY_FIRE] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, 710, 500, 32, 32))
|
||||||
|
{
|
||||||
|
screen_blitText(TS_INFO_EXIT);
|
||||||
|
|
||||||
|
if ((engine.keyState[KEY_FIRE]))
|
||||||
|
{
|
||||||
|
redrawBackground = true;
|
||||||
|
section = 7;
|
||||||
|
engine.keyState[KEY_FIRE] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,7 +168,7 @@ void saveGame(int slot)
|
||||||
engine.keyState[KEY_FIRE] = 0;
|
engine.keyState[KEY_FIRE] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void createSavesSurface(SDL_Surface *savesSurface, signed char clickedSlot)
|
void createSavesSurface(SDL_Surface *savesSurface, int clickedSlot)
|
||||||
{
|
{
|
||||||
int y = 10;
|
int y = 10;
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ Displays the save slot available. For use with an interface that
|
||||||
has the cursor enabled. It returns the index number of the slot clicked
|
has the cursor enabled. It returns the index number of the slot clicked
|
||||||
so that the function invoking it can perform a load or save on that slot.
|
so that the function invoking it can perform a load or save on that slot.
|
||||||
*/
|
*/
|
||||||
int showSaveSlots(SDL_Surface *savesSurface, signed char saveSlot)
|
int showSaveSlots(SDL_Surface *savesSurface, int saveSlot)
|
||||||
{
|
{
|
||||||
int clickedSlot = -1;
|
int clickedSlot = -1;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
extern int initSaveSlots();
|
extern int initSaveSlots();
|
||||||
extern bool loadGame(int slot);
|
extern bool loadGame(int slot);
|
||||||
extern void saveGame(int slot);
|
extern void saveGame(int slot);
|
||||||
extern void createSavesSurface(SDL_Surface *savesSurface, signed char clickedSlot);
|
extern void createSavesSurface(SDL_Surface *savesSurface, int clickedSlot);
|
||||||
extern int showSaveSlots(SDL_Surface *savesSurface, signed char saveSlot);
|
extern int showSaveSlots(SDL_Surface *savesSurface, int saveSlot);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,7 +23,7 @@ Planet systemPlanet[10];
|
||||||
mission currentMission;
|
mission currentMission;
|
||||||
static mission missions[MISN_MAX];
|
static mission missions[MISN_MAX];
|
||||||
|
|
||||||
void initPlanetMissions(signed char system)
|
void initPlanetMissions(int system)
|
||||||
{
|
{
|
||||||
for (int i = 0 ; i < 10 ; i++)
|
for (int i = 0 ; i < 10 ; i++)
|
||||||
{
|
{
|
||||||
|
@ -639,7 +639,7 @@ bool allMissionsCompleted()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
signed char remaining;
|
int remaining;
|
||||||
bool add = false;
|
bool add = false;
|
||||||
bool allDone = true;
|
bool allDone = true;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
extern Planet systemPlanet[10];
|
extern Planet systemPlanet[10];
|
||||||
extern mission currentMission;
|
extern mission currentMission;
|
||||||
|
|
||||||
extern void initPlanetMissions(signed char system);
|
extern void initPlanetMissions(int system);
|
||||||
extern void checkForBossMission();
|
extern void checkForBossMission();
|
||||||
extern void updateSystemStatus();
|
extern void updateSystemStatus();
|
||||||
extern void setMission(int mission);
|
extern void setMission(int mission);
|
||||||
|
|
|
@ -240,7 +240,7 @@ void loadGameGraphics()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0 ; i < MAX_WEAPONS ; i++)
|
for (int i = 0 ; i < W_MAX ; i++)
|
||||||
{
|
{
|
||||||
weapon[i].image[0] = gfx_sprites[weapon[i].imageIndex[0]];
|
weapon[i].image[0] = gfx_sprites[weapon[i].imageIndex[0]];
|
||||||
weapon[i].image[1] = gfx_sprites[weapon[i].imageIndex[1]];
|
weapon[i].image[1] = gfx_sprites[weapon[i].imageIndex[1]];
|
||||||
|
|
|
@ -95,16 +95,16 @@ void ship_fireBullet(object *ship, int weaponType)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(theWeapon->ammo[0] & 1)
|
if (theWeapon->ammo[0] & 1)
|
||||||
bullet_add(theWeapon, ship, y * 3, 0);
|
bullet_add(theWeapon, ship, y * 3, 0);
|
||||||
|
|
||||||
if(theWeapon->ammo[0] >= 2)
|
if (theWeapon->ammo[0] >= 2)
|
||||||
{
|
{
|
||||||
bullet_add(theWeapon, ship, y * 2, 0);
|
bullet_add(theWeapon, ship, y * 2, 0);
|
||||||
bullet_add(theWeapon, ship, y * 4, 0);
|
bullet_add(theWeapon, ship, y * 4, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(theWeapon->ammo[0] >= 4)
|
if (theWeapon->ammo[0] >= 4)
|
||||||
{
|
{
|
||||||
bullet_add(theWeapon, ship, y * 1, 0);
|
bullet_add(theWeapon, ship, y * 1, 0);
|
||||||
bullet_add(theWeapon, ship, y * 5, 0);
|
bullet_add(theWeapon, ship, y * 5, 0);
|
||||||
|
|
14
src/shop.cpp
14
src/shop.cpp
|
@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "Starfighter.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
static ShopItem shopItems[SHOP_MAX];
|
static ShopItem shopItems[SHOP_MAX];
|
||||||
static signed char shopSelectedItem;
|
static int shopSelectedItem;
|
||||||
|
|
||||||
static void sell(int i);
|
static void sell(int i);
|
||||||
|
|
||||||
|
@ -142,6 +142,9 @@ static void adjustShopPrices()
|
||||||
|
|
||||||
static void drawShop()
|
static void drawShop()
|
||||||
{
|
{
|
||||||
|
char description[100];
|
||||||
|
int icons = SHOP_MAX;
|
||||||
|
|
||||||
adjustShopPrices();
|
adjustShopPrices();
|
||||||
|
|
||||||
for (int i = 0 ; i < SHOP_S_MAX ; i++)
|
for (int i = 0 ; i < SHOP_S_MAX ; i++)
|
||||||
|
@ -198,7 +201,6 @@ static void drawShop()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
char description[100];
|
|
||||||
strcpy(description, "");
|
strcpy(description, "");
|
||||||
|
|
||||||
gfx_renderString("Primary Weapon", 10, 3, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_PRIMARY]);
|
gfx_renderString("Primary Weapon", 10, 3, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_PRIMARY]);
|
||||||
|
@ -237,8 +239,6 @@ static void drawShop()
|
||||||
|
|
||||||
gfx_renderString("Secondary Weapons", 260, 62, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_CATALOG]);
|
gfx_renderString("Secondary Weapons", 260, 62, FONT_WHITE, 0, gfx_shopSprites[SHOP_S_CATALOG]);
|
||||||
|
|
||||||
signed char icons = SHOP_MAX;
|
|
||||||
|
|
||||||
if (game.system == 0)
|
if (game.system == 0)
|
||||||
icons = SHOP_DOUBLE_ROCKETS + 1;
|
icons = SHOP_DOUBLE_ROCKETS + 1;
|
||||||
else if (game.system == 1)
|
else if (game.system == 1)
|
||||||
|
@ -1016,7 +1016,9 @@ static void sell(int i)
|
||||||
|
|
||||||
void showShop()
|
void showShop()
|
||||||
{
|
{
|
||||||
screen_blit(gfx_shopSprites[SHOP_S_PRIMARY], 20, 395);
|
int icons = SHOP_MAX;
|
||||||
|
|
||||||
|
screen_blit(gfx_shopSprites[SHOP_S_PRIMARY], 20, 395);
|
||||||
screen_blit(gfx_shopSprites[SHOP_S_POWERUP], 275, 395);
|
screen_blit(gfx_shopSprites[SHOP_S_POWERUP], 275, 395);
|
||||||
screen_blit(gfx_shopSprites[SHOP_S_SECONDARY], 530, 395);
|
screen_blit(gfx_shopSprites[SHOP_S_SECONDARY], 530, 395);
|
||||||
screen_blit(gfx_shopSprites[SHOP_S_CATALOG], 100, 180);
|
screen_blit(gfx_shopSprites[SHOP_S_CATALOG], 100, 180);
|
||||||
|
@ -1031,8 +1033,6 @@ void showShop()
|
||||||
|
|
||||||
screen_blit(gfx_sprites[SP_FIREFLY], 380, 95);
|
screen_blit(gfx_sprites[SP_FIREFLY], 380, 95);
|
||||||
|
|
||||||
signed char icons = SHOP_MAX;
|
|
||||||
|
|
||||||
if (game.system == 0)
|
if (game.system == 0)
|
||||||
icons = SHOP_DOUBLE_ROCKETS + 1;
|
icons = SHOP_DOUBLE_ROCKETS + 1;
|
||||||
else if (game.system == 1)
|
else if (game.system == 1)
|
||||||
|
|
|
@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "Starfighter.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
static signed char showGameMenu(signed char continueSaveSlot)
|
static int showGameMenu(int continueSaveSlot)
|
||||||
{
|
{
|
||||||
screen_blitText(TS_START_NEW_GAME);
|
screen_blitText(TS_START_NEW_GAME);
|
||||||
if (continueSaveSlot != -1)
|
if (continueSaveSlot != -1)
|
||||||
|
@ -45,9 +45,9 @@ static signed char showGameMenu(signed char continueSaveSlot)
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
static signed char showLoadMenu()
|
static int showLoadMenu()
|
||||||
{
|
{
|
||||||
signed char rtn = 1;
|
int rtn = 1;
|
||||||
|
|
||||||
for (int i = TS_SAVESLOT_0 ; i <= TS_SAVESLOT_5 ; i++)
|
for (int i = TS_SAVESLOT_0 ; i <= TS_SAVESLOT_5 ; i++)
|
||||||
{
|
{
|
||||||
|
@ -85,7 +85,7 @@ static void createDifficultyMenu()
|
||||||
-1, screen->h / 3 + 70, FONT_WHITE);
|
-1, screen->h / 3 + 70, FONT_WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static signed char showDifficultyMenu()
|
static int showDifficultyMenu()
|
||||||
{
|
{
|
||||||
gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 110;
|
gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 110;
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ static void createOptionsMenu()
|
||||||
-1, screen->h / 3 + 110, FONT_WHITE);
|
-1, screen->h / 3 + 110, FONT_WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static signed char showOptionsMenu()
|
static int showOptionsMenu()
|
||||||
{
|
{
|
||||||
gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 150;
|
gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 150;
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ static void createCheatMenu()
|
||||||
-1, screen->h / 3 + 110, FONT_WHITE);
|
-1, screen->h / 3 + 110, FONT_WHITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static signed char showCheatMenu()
|
static int showCheatMenu()
|
||||||
{
|
{
|
||||||
gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 150;
|
gfx_textSprites[TS_BACK_TO_MAIN_MENU].y = screen->h / 3 + 150;
|
||||||
|
|
||||||
|
@ -190,6 +190,25 @@ This is the main title screen, with the stars whirling past and the
|
||||||
*/
|
*/
|
||||||
int doTitle()
|
int doTitle()
|
||||||
{
|
{
|
||||||
|
int continueSaveSlot;
|
||||||
|
|
||||||
|
int prx;
|
||||||
|
int pry;
|
||||||
|
int sfx;
|
||||||
|
int sfy;
|
||||||
|
|
||||||
|
int then;
|
||||||
|
int now;
|
||||||
|
|
||||||
|
int redGlow = 255;
|
||||||
|
int redDir = -2;
|
||||||
|
char buildVersion[25];
|
||||||
|
|
||||||
|
int selectedOption = 1;
|
||||||
|
bool skip = false;
|
||||||
|
int listLength = 5; // menu list length
|
||||||
|
int menuType = MENU_MAIN;
|
||||||
|
|
||||||
game_init();
|
game_init();
|
||||||
|
|
||||||
engine.gameSection = SECTION_TITLE;
|
engine.gameSection = SECTION_TITLE;
|
||||||
|
@ -208,7 +227,7 @@ int doTitle()
|
||||||
renderer_update();
|
renderer_update();
|
||||||
screen_clear(black);
|
screen_clear(black);
|
||||||
|
|
||||||
signed char continueSaveSlot = initSaveSlots();
|
continueSaveSlot = initSaveSlots();
|
||||||
|
|
||||||
loadBackground("gfx/spirit.jpg");
|
loadBackground("gfx/spirit.jpg");
|
||||||
|
|
||||||
|
@ -216,11 +235,11 @@ int doTitle()
|
||||||
prlogo = gfx_loadImage("gfx/prlogo.png");
|
prlogo = gfx_loadImage("gfx/prlogo.png");
|
||||||
sflogo = gfx_loadImage("gfx/sflogo.png");
|
sflogo = gfx_loadImage("gfx/sflogo.png");
|
||||||
|
|
||||||
int prx = ((screen->w - prlogo->w) / 2);
|
prx = ((screen->w - prlogo->w) / 2);
|
||||||
int pry = ((screen->h - prlogo->h) / 2);
|
pry = ((screen->h - prlogo->h) / 2);
|
||||||
|
|
||||||
int sfx = ((screen->w - sflogo->w) / 2);
|
sfx = ((screen->w - sflogo->w) / 2);
|
||||||
int sfy = ((screen->h - sflogo->h) / 3);
|
sfy = ((screen->h - sflogo->h) / 3);
|
||||||
|
|
||||||
gfx_createTextObject(TS_PRESENTS, "PRESENTS",
|
gfx_createTextObject(TS_PRESENTS, "PRESENTS",
|
||||||
-1, screen->h / 2, FONT_WHITE);
|
-1, screen->h / 2, FONT_WHITE);
|
||||||
|
@ -251,8 +270,7 @@ int doTitle()
|
||||||
engine.smx = 0;
|
engine.smx = 0;
|
||||||
engine.smy = 0;
|
engine.smy = 0;
|
||||||
|
|
||||||
int then = SDL_GetTicks();
|
then = SDL_GetTicks();
|
||||||
int now;
|
|
||||||
|
|
||||||
for (int i = 0 ; i < 15 ; i++)
|
for (int i = 0 ; i < 15 ; i++)
|
||||||
{
|
{
|
||||||
|
@ -267,9 +285,6 @@ int doTitle()
|
||||||
aliens[i].face = 0;
|
aliens[i].face = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int redGlow = 255;
|
|
||||||
signed char redDir = -2;
|
|
||||||
char buildVersion[25];
|
|
||||||
sprintf(buildVersion, "Version "VERSION);
|
sprintf(buildVersion, "Version "VERSION);
|
||||||
|
|
||||||
SDL_Rect optionRec;
|
SDL_Rect optionRec;
|
||||||
|
@ -279,14 +294,9 @@ int doTitle()
|
||||||
optionRec.h = 22;
|
optionRec.h = 22;
|
||||||
optionRec.w = 215;
|
optionRec.w = 215;
|
||||||
|
|
||||||
signed char selectedOption = 1;
|
|
||||||
if (continueSaveSlot > -1)
|
if (continueSaveSlot > -1)
|
||||||
{selectedOption = 3; optionRec.y += 40;}
|
{selectedOption = 3; optionRec.y += 40;}
|
||||||
|
|
||||||
bool skip = false;
|
|
||||||
signed char listLength = 5; // menu list length
|
|
||||||
signed char menuType = MENU_MAIN;
|
|
||||||
|
|
||||||
screen_drawBackground();
|
screen_drawBackground();
|
||||||
|
|
||||||
engine.done = 0;
|
engine.done = 0;
|
||||||
|
|
|
@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "Starfighter.h"
|
#include "Starfighter.h"
|
||||||
|
|
||||||
object weapon[MAX_WEAPONS];
|
object weapon[W_MAX];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
A list of predefined weaponary.
|
A list of predefined weaponary.
|
||||||
|
|
|
@ -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
|
||||||
|
@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#ifndef WEAPONS_H
|
#ifndef WEAPONS_H
|
||||||
#define WEAPONS_H
|
#define WEAPONS_H
|
||||||
|
|
||||||
extern object weapon[MAX_WEAPONS];
|
extern object weapon[W_MAX];
|
||||||
|
|
||||||
extern void initWeapons();
|
extern void initWeapons();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue