Removed the "nomove" and "nofire" cheats.

I honestly don't understand why these cheats were here. Preventing
enemies from moving breaks some missions and doesn't do anything
useful, and preventing enemies from firing is basically no better
than the invincibility cheat (and might even be worse, if it applies
to Sid; I didn't check).
This commit is contained in:
onpon4 2015-05-20 19:41:43 -04:00
parent 6d26236290
commit f306825636
21 changed files with 543 additions and 566 deletions

View File

@ -52,16 +52,6 @@ int main(int argc, char **argv)
for (int i = 1 ; i < argc ; i++) for (int i = 1 ; i < argc ; i++)
{ {
if (strcmp(argv[i], "-nomove") == 0)
{
printf("Enemy movement disabled\n");
dev.moveAliens = 0;
}
if (strcmp(argv[i], "-nofire") == 0)
{
printf("Enemy firing disabled\n");
dev.fireAliens = 0;
}
if (strcmp(argv[i], "-cheat") == 0) if (strcmp(argv[i], "-cheat") == 0)
cheatAttempt = true; cheatAttempt = true;
if (strcmp(argv[i], "-noaudio") == 0) if (strcmp(argv[i], "-noaudio") == 0)
@ -120,8 +110,8 @@ int main(int argc, char **argv)
// Determine which part of the game we will go to... // Determine which part of the game we will go to...
section = 0; section = 0;
currentGame.difficulty = DIFFICULTY_NORMAL; game.difficulty = DIFFICULTY_NORMAL;
newGame(); game_init();
while (true) while (true)
{ {
@ -136,9 +126,9 @@ int main(int argc, char **argv)
break; break;
case 2: case 2:
if (currentGame.stationedPlanet == -1) if (game.stationedPlanet == -1)
doCutscene(0); doCutscene(0);
section = mainGameLoop(); section = game_mainLoop();
break; break;
} }
} }

View File

@ -703,7 +703,7 @@ void aliens_init()
strcpy(string, ""); strcpy(string, "");
barrierSpeed = 1; barrierSpeed = 1;
sprintf(string, "data/aliens%d.dat", currentGame.area); sprintf(string, "data/aliens%d.dat", game.area);
fp = fopen(string, "rb"); fp = fopen(string, "rb");
if (fp != NULL) if (fp != NULL)
@ -735,9 +735,9 @@ void aliens_init()
showErrorAndExit(2, ""); showErrorAndExit(2, "");
} }
if (currentGame.area == MISN_CERADSE) if (game.area == MISN_CERADSE)
cargo_add(&aliens[index], P_CARGO); cargo_add(&aliens[index], P_CARGO);
else if (currentGame.area == MISN_NEROD) else if (game.area == MISN_NEROD)
cargo_add(&aliens[index], P_PHOEBE); cargo_add(&aliens[index], P_PHOEBE);
if (index == ALIEN_KLINE) if (index == ALIEN_KLINE)
@ -770,17 +770,17 @@ void aliens_init()
barrierSpeed++; barrierSpeed++;
} }
if ((currentGame.area == MISN_POSWIC) && if ((game.area == MISN_POSWIC) &&
(aliens[index].classDef == CD_BOSS)) (aliens[index].classDef == CD_BOSS))
{ {
aliens[index].imageIndex[1] = 29; aliens[index].imageIndex[1] = 29;
aliens[index].flags |= FL_IMMORTAL; aliens[index].flags |= FL_IMMORTAL;
} }
if (currentGame.area == MISN_ELLESH) if (game.area == MISN_ELLESH)
aliens[index].flags |= FL_HASMINIMUMSPEED; aliens[index].flags |= FL_HASMINIMUMSPEED;
if (currentGame.area == MISN_JUPITER) if (game.area == MISN_JUPITER)
{ {
aliens[index].flags = FL_WEAPCO; aliens[index].flags = FL_WEAPCO;
if (index == ALIEN_BOSS) if (index == ALIEN_BOSS)
@ -790,7 +790,7 @@ void aliens_init()
fclose(fp); fclose(fp);
if (currentGame.area == MISN_MOEBO) if (game.area == MISN_MOEBO)
{ {
aliens[ALIEN_BOSS].target = &player; aliens[ALIEN_BOSS].target = &player;
aliens[ALIEN_BOSS].x = -screen->w / 2; aliens[ALIEN_BOSS].x = -screen->w / 2;
@ -806,8 +806,8 @@ void aliens_init()
aliens[ALIEN_BOSS_PART2].dx = -20; aliens[ALIEN_BOSS_PART2].dx = -20;
aliens[ALIEN_BOSS_PART2].dy = 37; aliens[ALIEN_BOSS_PART2].dy = 37;
} }
else if ((currentGame.area == MISN_ELAMALE) || else if ((game.area == MISN_ELAMALE) ||
(currentGame.area == MISN_FELLON)) (game.area == MISN_FELLON))
{ {
aliens[ALIEN_BOSS].target = &player; aliens[ALIEN_BOSS].target = &player;
aliens[ALIEN_BOSS].x = -screen->w / 2; aliens[ALIEN_BOSS].x = -screen->w / 2;
@ -833,7 +833,7 @@ void aliens_init()
aliens[ALIEN_BOSS_PART4].dx = -35; aliens[ALIEN_BOSS_PART4].dx = -35;
aliens[ALIEN_BOSS_PART4].dy = 20; aliens[ALIEN_BOSS_PART4].dy = 20;
if (currentGame.area == MISN_FELLON) if (game.area == MISN_FELLON)
{ {
aliens[ALIEN_BOSS].AIType = AI_EVASIVE; aliens[ALIEN_BOSS].AIType = AI_EVASIVE;
@ -847,7 +847,7 @@ void aliens_init()
} }
} }
} }
else if (currentGame.area == MISN_URANUS) else if (game.area == MISN_URANUS)
{ {
aliens[ALIEN_BOSS].target = &player; aliens[ALIEN_BOSS].target = &player;
aliens[ALIEN_BOSS].x = -screen->w / 2; aliens[ALIEN_BOSS].x = -screen->w / 2;
@ -866,8 +866,8 @@ bool alien_add()
{ {
int index = alien_getFreeIndex(); int index = alien_getFreeIndex();
if ((index == -1) || (currentGame.area == MISN_JUPITER) || if ((index == -1) || (game.area == MISN_JUPITER) ||
(currentGame.area == MISN_VENUS)) (game.area == MISN_VENUS))
return 0; return 0;
signed char *alienArray; signed char *alienArray;
@ -875,7 +875,7 @@ bool alien_add()
alienArray = new signed char[8]; alienArray = new signed char[8];
switch(currentGame.area) switch(game.area)
{ {
case MISN_START: case MISN_START:
case MISN_HINSTAG: case MISN_HINSTAG:
@ -952,7 +952,7 @@ bool alien_add()
alienArray[0] = CD_DUALFIGHTER; alienArray[0] = CD_DUALFIGHTER;
alienArray[1] = CD_MISSILEBOAT; alienArray[1] = CD_MISSILEBOAT;
alienArray[2] = CD_AIMFIGHTER; alienArray[2] = CD_AIMFIGHTER;
if (currentGame.system == 2) if (game.system == 2)
{ {
numberOfAliens = 4; numberOfAliens = 4;
alienArray[3] = CD_PROTOFIGHTER; alienArray[3] = CD_PROTOFIGHTER;
@ -966,11 +966,11 @@ bool alien_add()
signed char randEnemy = alienArray[rand() % numberOfAliens]; signed char randEnemy = alienArray[rand() % numberOfAliens];
if ((currentGame.area != MISN_DORIM) && if ((game.area != MISN_DORIM) &&
(currentGame.area != MISN_SIVEDI) && (game.area != MISN_SIVEDI) &&
(currentGame.area != MISN_MARS)) (game.area != MISN_MARS))
{ {
if ((currentGame.system == 1) && (currentGame.area == MISN_INTERCEPTION)) if ((game.system == 1) && (game.area == MISN_INTERCEPTION))
{ {
if ((rand() % 5) == 0) if ((rand() % 5) == 0)
randEnemy = CD_SLAVETRANSPORT; randEnemy = CD_SLAVETRANSPORT;
@ -1018,7 +1018,7 @@ bool alien_add()
aliens[index].ammo[0] = 0; aliens[index].ammo[0] = 0;
if (currentGame.area == MISN_ELLESH) if (game.area == MISN_ELLESH)
aliens[index].flags |= FL_HASMINIMUMSPEED; aliens[index].flags |= FL_HASMINIMUMSPEED;
return true; return true;
@ -1107,7 +1107,7 @@ void alien_addFriendly(int type)
aliens[type].classDef = CD_URSULA; aliens[type].classDef = CD_URSULA;
// For the sake of it being the final battle :) // For the sake of it being the final battle :)
if (currentGame.area == MISN_EARTH) if (game.area == MISN_EARTH)
aliens[type].flags |= FL_IMMORTAL; aliens[type].flags |= FL_IMMORTAL;
} }
@ -1123,7 +1123,7 @@ bool alien_place(object *alien)
else else
alien->y = RANDRANGE(-screen->h, 0); alien->y = RANDRANGE(-screen->h, 0);
if (currentGame.area == MISN_MARS) if (game.area == MISN_MARS)
{ {
alien->x = screen->w + RANDRANGE(0, 400); alien->x = screen->w + RANDRANGE(0, 400);
alien->y = RANDRANGE(-screen->h / 3, (4 * screen->h) / 3); alien->y = RANDRANGE(-screen->h / 3, (4 * screen->h) / 3);
@ -1261,7 +1261,7 @@ void alien_setKlineAI(object *alien)
// Weapon type change // Weapon type change
if ((rand() % 3) == 0) if ((rand() % 3) == 0)
{ {
if (currentGame.area != MISN_VENUS) if (game.area != MISN_VENUS)
{ {
alien->flags &= ~FL_AIMS; alien->flags &= ~FL_AIMS;
@ -1295,7 +1295,7 @@ void alien_setKlineAI(object *alien)
case 2: case 2:
// Kline only attacks then he is ready! // Kline only attacks then he is ready!
if ((!(alien->flags & FL_NOFIRE)) && if ((!(alien->flags & FL_NOFIRE)) &&
(currentGame.area == MISN_MOEBO)) (game.area == MISN_MOEBO))
alien->flags |= FL_DROPMINES; alien->flags |= FL_DROPMINES;
break; break;
case 3: case 3:
@ -1333,14 +1333,14 @@ void alien_searchForTarget(object *alien)
// Tell Sid not to attack craft that are already disabled or can // Tell Sid not to attack craft that are already disabled or can
// return fire. This will save him from messing about (unless we're on the last mission) // return fire. This will save him from messing about (unless we're on the last mission)
if ((alien->classDef == CD_SID) && (currentGame.area != MISN_EARTH)) if ((alien->classDef == CD_SID) && (game.area != MISN_EARTH))
{ {
if ((targetEnemy->flags & FL_DISABLED) || (!(targetEnemy->flags & FL_NOFIRE))) if ((targetEnemy->flags & FL_DISABLED) || (!(targetEnemy->flags & FL_NOFIRE)))
return; return;
} }
// Tell Phoebe and Ursula not to attack ships that cannot fire or are disabled (unless we're on the last mission) // Tell Phoebe and Ursula not to attack ships that cannot fire or are disabled (unless we're on the last mission)
if (currentGame.area != MISN_EARTH) if (game.area != MISN_EARTH)
{ {
if ((alien->classDef == CD_PHOEBE) || (alien->classDef == CD_URSULA)) if ((alien->classDef == CD_PHOEBE) || (alien->classDef == CD_URSULA))
{ {
@ -1548,12 +1548,12 @@ void alien_destroy(object *alien, object *attacker)
if (alien->flags & FL_FRIEND) if (alien->flags & FL_FRIEND)
{ {
if (alien->classDef == CD_PHOEBE) if (alien->classDef == CD_PHOEBE)
currentGame.wingMate1Ejects++; game.wingMate1Ejects++;
else if (alien->classDef == CD_URSULA) else if (alien->classDef == CD_URSULA)
currentGame.wingMate2Ejects++; game.wingMate2Ejects++;
// Phoebe cannot eject on the rescue mission // Phoebe cannot eject on the rescue mission
if (currentGame.area != MISN_NEROD) if (game.area != MISN_NEROD)
{ {
if ((alien->classDef == CD_PHOEBE) || (alien->classDef == CD_URSULA)) if ((alien->classDef == CD_PHOEBE) || (alien->classDef == CD_URSULA))
setInfoLine(">> Ally has ejected! <<\n", FONT_RED); setInfoLine(">> Ally has ejected! <<\n", FONT_RED);
@ -1566,19 +1566,19 @@ void alien_destroy(object *alien, object *attacker)
{ {
if (attacker == &player) if (attacker == &player)
{ {
currentGame.totalKills++; game.totalKills++;
} }
else if (attacker->classDef == CD_PHOEBE) else if (attacker->classDef == CD_PHOEBE)
{ {
currentGame.wingMate1Kills++; game.wingMate1Kills++;
} }
else if (attacker->classDef == CD_URSULA) else if (attacker->classDef == CD_URSULA)
{ {
currentGame.wingMate2Kills++; game.wingMate2Kills++;
} }
else else
{ {
currentGame.totalOtherKills++; game.totalOtherKills++;
} }
if ((attacker->classDef == CD_PHOEBE) || (attacker->classDef == CD_URSULA)) if ((attacker->classDef == CD_PHOEBE) || (attacker->classDef == CD_URSULA))
@ -1642,7 +1642,7 @@ void alien_hurt(object *alien, object *attacker, int damage, bool ion)
if (alien->classDef == CD_KLINE) if (alien->classDef == CD_KLINE)
{ {
if (currentGame.area == MISN_ELAMALE) if (game.area == MISN_ELAMALE)
{ {
if ((alien->shield <= alien->maxShield - 500) && if ((alien->shield <= alien->maxShield - 500) &&
!(alien->flags & FL_LEAVESECTOR)) !(alien->flags & FL_LEAVESECTOR))
@ -1652,7 +1652,7 @@ void alien_hurt(object *alien, object *attacker, int damage, bool ion)
setRadioMessage(FACE_KLINE, "Seems I underestimated you, Bainfield. We'll meet again!", 1); setRadioMessage(FACE_KLINE, "Seems I underestimated you, Bainfield. We'll meet again!", 1);
} }
} }
else if (currentGame.area == MISN_EARTH) else if (game.area == MISN_EARTH)
{ {
if ((alien->shield <= alien->maxShield - 750) && if ((alien->shield <= alien->maxShield - 750) &&
!(alien->flags & FL_LEAVESECTOR)) !(alien->flags & FL_LEAVESECTOR))
@ -1662,7 +1662,7 @@ void alien_hurt(object *alien, object *attacker, int damage, bool ion)
setRadioMessage(FACE_SID, "Chris, Kethlan is getting away!", 1); setRadioMessage(FACE_SID, "Chris, Kethlan is getting away!", 1);
} }
} }
else if (currentGame.area == MISN_VENUS) else if (game.area == MISN_VENUS)
{ {
if (alien->shield + damage > 1500 && if (alien->shield + damage > 1500 &&
alien->shield <= 1500) alien->shield <= 1500)

View File

@ -153,7 +153,7 @@ void audio_playRandomTrack()
"music/frozen_jam.ogg", "music/sound_and_silence.ogg" "music/frozen_jam.ogg", "music/sound_and_silence.ogg"
}; };
switch(currentGame.area) switch(game.area)
{ {
case MISN_START: case MISN_START:
audio_playMusic("music/railjet_short.ogg", -1); audio_playMusic("music/railjet_short.ogg", -1);

View File

@ -28,7 +28,7 @@ void bullet_add(object *theWeapon, object *attacker, int y, int dy)
bullet = new object; bullet = new object;
if (attacker == &player) if (attacker == &player)
currentGame.shots++; game.shots++;
bullet->next = NULL; bullet->next = NULL;
bullet->active = true; bullet->active = true;
@ -45,8 +45,8 @@ void bullet_add(object *theWeapon, object *attacker, int y, int dy)
if (attacker->face == 0) if (attacker->face == 0)
{ {
bullet->dx = theWeapon->speed; bullet->dx = theWeapon->speed;
if ((currentGame.area == MISN_ELLESH) || if ((game.area == MISN_ELLESH) ||
(currentGame.area == MISN_MARS)) (game.area == MISN_MARS))
bullet->dx += fabsf(engine.ssx + engine.smx); bullet->dx += fabsf(engine.ssx + engine.smx);
} }
else else

View File

@ -50,13 +50,13 @@ void collectable_add(float x, float y, int type, int value, int life)
{ {
type = P_PLASMA_RATE; type = P_PLASMA_RATE;
if ((currentGame.difficulty == DIFFICULTY_NIGHTMARE) || if ((game.difficulty == DIFFICULTY_NIGHTMARE) ||
((currentGame.difficulty != DIFFICULTY_EASY) && ((game.difficulty != DIFFICULTY_EASY) &&
(currentGame.difficulty != DIFFICULTY_ORIGINAL) && (game.difficulty != DIFFICULTY_ORIGINAL) &&
((currentGame.area == MISN_MOEBO) || ((game.area == MISN_MOEBO) ||
(currentGame.area == MISN_ELAMALE) || (game.area == MISN_ELAMALE) ||
(currentGame.area == MISN_ELLESH) || (game.area == MISN_ELLESH) ||
(currentGame.area == MISN_EARTH)))) (game.area == MISN_EARTH))))
{ {
// Deny the Super Charge in Nightmare difficulty, and on bosses. // Deny the Super Charge in Nightmare difficulty, and on bosses.
r = rand() % 59; r = rand() % 59;
@ -84,9 +84,9 @@ void collectable_add(float x, float y, int type, int value, int life)
// upgraded! Give them money instead. // upgraded! Give them money instead.
if (type == P_PLASMA_AMMO) if (type == P_PLASMA_AMMO)
{ {
if ((weapon[W_PLAYER_WEAPON].reload[0] >= rate2reload[currentGame.minPlasmaRate]) && if ((weapon[W_PLAYER_WEAPON].reload[0] >= rate2reload[game.minPlasmaRate]) &&
(weapon[W_PLAYER_WEAPON].ammo[0] <= currentGame.minPlasmaOutput) && (weapon[W_PLAYER_WEAPON].ammo[0] <= game.minPlasmaOutput) &&
(weapon[W_PLAYER_WEAPON].damage <= currentGame.minPlasmaDamage)) (weapon[W_PLAYER_WEAPON].damage <= game.minPlasmaDamage))
{ {
type = P_CASH; type = P_CASH;
} }
@ -105,17 +105,17 @@ void collectable_add(float x, float y, int type, int value, int life)
// Shield bonus is useless in Nightmare difficulty; give cash instead. // Shield bonus is useless in Nightmare difficulty; give cash instead.
if (type == P_SHIELD) if (type == P_SHIELD)
{ {
if (currentGame.difficulty == DIFFICULTY_NIGHTMARE) if (game.difficulty == DIFFICULTY_NIGHTMARE)
{ {
type = P_CASH; type = P_CASH;
} }
} }
if (currentGame.difficulty == DIFFICULTY_ORIGINAL) if (game.difficulty == DIFFICULTY_ORIGINAL)
{ {
// Cash is just rare in the original game. You can still grind, // Cash is just rare in the original game. You can still grind,
// just not as much. // just not as much.
if ((currentGame.area == MISN_INTERCEPTION) && (type == P_CASH)) if ((game.area == MISN_INTERCEPTION) && (type == P_CASH))
{ {
if (rand() % 10 > 0) if (rand() % 10 > 0)
return; return;
@ -124,7 +124,7 @@ void collectable_add(float x, float y, int type, int value, int life)
else else
{ {
// No cash or ammo on interceptions. Completely stops grinding. // No cash or ammo on interceptions. Completely stops grinding.
if ((currentGame.area == MISN_INTERCEPTION) && if ((game.area == MISN_INTERCEPTION) &&
((type == P_CASH) || (type == P_PLASMA_AMMO) || (type == P_ROCKET))) ((type == P_CASH) || (type == P_PLASMA_AMMO) || (type == P_ROCKET)))
{ {
return; return;

View File

@ -19,14 +19,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h" #include "Starfighter.h"
Game currentGame; Game game;
void newGame() void game_init()
{ {
currentGame.system = 0; game.system = 0;
currentGame.area = MISN_START; game.area = MISN_START;
currentGame.sfxVolume = 0; game.sfxVolume = 0;
currentGame.musicVolume = 0; game.musicVolume = 0;
if (!engine.useAudio) if (!engine.useAudio)
{ {
@ -34,99 +34,99 @@ void newGame()
engine.useMusic = false; engine.useMusic = false;
} }
currentGame.cash = 0; game.cash = 0;
currentGame.cashEarned = 0; game.cashEarned = 0;
currentGame.shots = 0; game.shots = 0;
currentGame.hits = 0; game.hits = 0;
currentGame.accuracy = 0; game.accuracy = 0;
currentGame.totalKills = currentGame.wingMate1Kills = currentGame.wingMate2Kills = 0; game.totalKills = game.wingMate1Kills = game.wingMate2Kills = 0;
currentGame.totalOtherKills = 0; game.totalOtherKills = 0;
currentGame.hasWingMate1 = currentGame.hasWingMate2 = 0; game.hasWingMate1 = game.hasWingMate2 = 0;
currentGame.wingMate1Ejects = currentGame.wingMate2Ejects = 0; game.wingMate1Ejects = game.wingMate2Ejects = 0;
currentGame.secondaryMissions = currentGame.secondaryMissionsCompleted = 0; game.secondaryMissions = game.secondaryMissionsCompleted = 0;
currentGame.shieldPickups = currentGame.rocketPickups = currentGame.cellPickups = 0; game.shieldPickups = game.rocketPickups = game.cellPickups = 0;
currentGame.powerups = currentGame.minesKilled = currentGame.cargoPickups = 0; game.powerups = game.minesKilled = game.cargoPickups = 0;
currentGame.slavesRescued = 0; game.slavesRescued = 0;
currentGame.experimentalShield = 1000; game.experimentalShield = 1000;
currentGame.timeTaken = 0; game.timeTaken = 0;
currentGame.stationedPlanet = -1; game.stationedPlanet = -1;
currentGame.destinationPlanet = -1; game.destinationPlanet = -1;
for (int i = 0 ; i < 10 ; i++) for (int i = 0 ; i < 10 ; i++)
currentGame.missionCompleted[i] = 0; game.missionCompleted[i] = 0;
currentGame.distanceCovered = 0; game.distanceCovered = 0;
currentGame.minPlasmaRate = 1; game.minPlasmaRate = 1;
currentGame.minPlasmaOutput = 1; game.minPlasmaOutput = 1;
currentGame.minPlasmaDamage = 1; game.minPlasmaDamage = 1;
currentGame.maxPlasmaRate = 2; game.maxPlasmaRate = 2;
currentGame.maxPlasmaOutput = 2; game.maxPlasmaOutput = 2;
currentGame.maxPlasmaDamage = 2; game.maxPlasmaDamage = 2;
currentGame.maxPlasmaAmmo = 100; game.maxPlasmaAmmo = 100;
currentGame.maxRocketAmmo = 10; game.maxRocketAmmo = 10;
currentGame.minPlasmaRateLimit = 2; game.minPlasmaRateLimit = 2;
currentGame.minPlasmaDamageLimit = 2; game.minPlasmaDamageLimit = 2;
currentGame.minPlasmaOutputLimit = 2; game.minPlasmaOutputLimit = 2;
currentGame.maxPlasmaRateLimit = 3; game.maxPlasmaRateLimit = 3;
currentGame.maxPlasmaDamageLimit = 3; game.maxPlasmaDamageLimit = 3;
currentGame.maxPlasmaOutputLimit = 3; game.maxPlasmaOutputLimit = 3;
currentGame.maxPlasmaAmmoLimit = 250; game.maxPlasmaAmmoLimit = 250;
currentGame.maxRocketAmmoLimit = 50; game.maxRocketAmmoLimit = 50;
player.maxShield = 50; player.maxShield = 50;
switch (currentGame.difficulty) switch (game.difficulty)
{ {
case DIFFICULTY_EASY: case DIFFICULTY_EASY:
player.maxShield = 100; player.maxShield = 100;
currentGame.minPlasmaRate = 2; game.minPlasmaRate = 2;
currentGame.minPlasmaOutput = 2; game.minPlasmaOutput = 2;
currentGame.minPlasmaDamage = 2; game.minPlasmaDamage = 2;
currentGame.maxPlasmaRate = 3; game.maxPlasmaRate = 3;
currentGame.maxPlasmaOutput = 3; game.maxPlasmaOutput = 3;
currentGame.maxPlasmaDamage = 3; game.maxPlasmaDamage = 3;
currentGame.maxPlasmaAmmo = 150; game.maxPlasmaAmmo = 150;
currentGame.maxRocketAmmo = 20; game.maxRocketAmmo = 20;
currentGame.minPlasmaRateLimit = 3; game.minPlasmaRateLimit = 3;
currentGame.minPlasmaDamageLimit = 3; game.minPlasmaDamageLimit = 3;
currentGame.minPlasmaOutputLimit = 3; game.minPlasmaOutputLimit = 3;
currentGame.maxPlasmaRateLimit = 5; game.maxPlasmaRateLimit = 5;
currentGame.maxPlasmaDamageLimit = 5; game.maxPlasmaDamageLimit = 5;
currentGame.maxPlasmaOutputLimit = 5; game.maxPlasmaOutputLimit = 5;
break; break;
case DIFFICULTY_HARD: case DIFFICULTY_HARD:
player.maxShield = 25; player.maxShield = 25;
break; break;
case DIFFICULTY_NIGHTMARE: case DIFFICULTY_NIGHTMARE:
player.maxShield = 1; player.maxShield = 1;
currentGame.maxRocketAmmo = 5; game.maxRocketAmmo = 5;
break; break;
case DIFFICULTY_ORIGINAL: case DIFFICULTY_ORIGINAL:
player.maxShield = 25; player.maxShield = 25;
currentGame.minPlasmaRateLimit = 3; game.minPlasmaRateLimit = 3;
currentGame.minPlasmaDamageLimit = 3; game.minPlasmaDamageLimit = 3;
currentGame.minPlasmaOutputLimit = 3; game.minPlasmaOutputLimit = 3;
currentGame.maxPlasmaRateLimit = 5; game.maxPlasmaRateLimit = 5;
currentGame.maxPlasmaDamageLimit = 5; game.maxPlasmaDamageLimit = 5;
currentGame.maxPlasmaOutputLimit = 5; game.maxPlasmaOutputLimit = 5;
break; break;
} }
player.shield = player.maxShield; player.shield = player.maxShield;
player.ammo[0] = 0; player.ammo[0] = 0;
player.ammo[1] = currentGame.maxRocketAmmo / 2; player.ammo[1] = game.maxRocketAmmo / 2;
player.weaponType[0] = W_PLAYER_WEAPON; player.weaponType[0] = W_PLAYER_WEAPON;
player.weaponType[1] = W_ROCKETS; player.weaponType[1] = W_ROCKETS;
initWeapons(); initWeapons();
initMissions(); initMissions();
initPlanetMissions(currentGame.system); initPlanetMissions(game.system);
} }
static void game_addDebris(int x, int y, int amount) static void game_addDebris(int x, int y, int amount)
@ -203,18 +203,18 @@ static void game_doCollectables()
switch(collectable->type) switch(collectable->type)
{ {
case P_CASH: case P_CASH:
if (currentGame.difficulty == DIFFICULTY_ORIGINAL) if (game.difficulty == DIFFICULTY_ORIGINAL)
collectable->value *= 2; collectable->value *= 2;
currentGame.cash += collectable->value; game.cash += collectable->value;
currentGame.cashEarned += collectable->value; game.cashEarned += collectable->value;
sprintf(temp, "Got $%d ", collectable->value); sprintf(temp, "Got $%d ", collectable->value);
break; break;
case P_ROCKET: case P_ROCKET:
LIMIT_ADD(player.ammo[1], collectable->value, 0, LIMIT_ADD(player.ammo[1], collectable->value, 0,
currentGame.maxRocketAmmo); game.maxRocketAmmo);
if (player.ammo[1] == currentGame.maxRocketAmmo) if (player.ammo[1] == game.maxRocketAmmo)
sprintf(temp, "Rocket Ammo at Maximum"); sprintf(temp, "Rocket Ammo at Maximum");
else else
{ {
@ -223,27 +223,27 @@ static void game_doCollectables()
else else
sprintf(temp, "Got a rocket"); sprintf(temp, "Got a rocket");
} }
currentGame.rocketPickups += collectable->value; game.rocketPickups += collectable->value;
break; break;
case P_SHIELD: case P_SHIELD:
LIMIT_ADD(player.shield, 10, 0, player.maxShield); LIMIT_ADD(player.shield, 10, 0, player.maxShield);
currentGame.shieldPickups ++; game.shieldPickups ++;
sprintf(temp, "Restored 10 shield points"); sprintf(temp, "Restored 10 shield points");
break; break;
case P_PLASMA_RATE: case P_PLASMA_RATE:
currentGame.powerups++; game.powerups++;
if ((currentGame.area != MISN_INTERCEPTION) || if ((game.area != MISN_INTERCEPTION) ||
(currentGame.difficulty == DIFFICULTY_ORIGINAL) || (game.difficulty == DIFFICULTY_ORIGINAL) ||
(player.ammo[0] > 0)) (player.ammo[0] > 0))
{ {
if ((currentGame.area != MISN_INTERCEPTION) || if ((game.area != MISN_INTERCEPTION) ||
(currentGame.difficulty == DIFFICULTY_ORIGINAL)) (game.difficulty == DIFFICULTY_ORIGINAL))
LIMIT_ADD(player.ammo[0], collectable->value, LIMIT_ADD(player.ammo[0], collectable->value,
0, currentGame.maxPlasmaAmmo); 0, game.maxPlasmaAmmo);
if (weapon[W_PLAYER_WEAPON].reload[0] <= rate2reload[currentGame.maxPlasmaRate]) if (weapon[W_PLAYER_WEAPON].reload[0] <= rate2reload[game.maxPlasmaRate])
sprintf(temp, "Firing rate already at maximum"); sprintf(temp, "Firing rate already at maximum");
else else
{ {
@ -258,17 +258,17 @@ static void game_doCollectables()
break; break;
case P_PLASMA_SHOT: case P_PLASMA_SHOT:
currentGame.powerups++; game.powerups++;
if ((currentGame.area != MISN_INTERCEPTION) || if ((game.area != MISN_INTERCEPTION) ||
(currentGame.difficulty == DIFFICULTY_ORIGINAL) || (game.difficulty == DIFFICULTY_ORIGINAL) ||
(player.ammo[0] > 0)) (player.ammo[0] > 0))
{ {
if ((currentGame.area != MISN_INTERCEPTION) || if ((game.area != MISN_INTERCEPTION) ||
(currentGame.difficulty == DIFFICULTY_ORIGINAL)) (game.difficulty == DIFFICULTY_ORIGINAL))
LIMIT_ADD(player.ammo[0], collectable->value, LIMIT_ADD(player.ammo[0], collectable->value,
0, currentGame.maxPlasmaAmmo); 0, game.maxPlasmaAmmo);
if (weapon[W_PLAYER_WEAPON].ammo[0] >= currentGame.maxPlasmaOutput) if (weapon[W_PLAYER_WEAPON].ammo[0] >= game.maxPlasmaOutput)
sprintf(temp, "Plasma output already at maximum"); sprintf(temp, "Plasma output already at maximum");
else else
{ {
@ -283,17 +283,17 @@ static void game_doCollectables()
break; break;
case P_PLASMA_DAMAGE: case P_PLASMA_DAMAGE:
currentGame.powerups++; game.powerups++;
if ((currentGame.area != MISN_INTERCEPTION) || if ((game.area != MISN_INTERCEPTION) ||
(currentGame.difficulty == DIFFICULTY_ORIGINAL) || (game.difficulty == DIFFICULTY_ORIGINAL) ||
(player.ammo[0] > 0)) (player.ammo[0] > 0))
{ {
if ((currentGame.area != MISN_INTERCEPTION) || if ((game.area != MISN_INTERCEPTION) ||
(currentGame.difficulty == DIFFICULTY_ORIGINAL)) (game.difficulty == DIFFICULTY_ORIGINAL))
LIMIT_ADD(player.ammo[0], collectable->value, LIMIT_ADD(player.ammo[0], collectable->value,
0, currentGame.maxPlasmaAmmo); 0, game.maxPlasmaAmmo);
if (weapon[W_PLAYER_WEAPON].damage >= currentGame.maxPlasmaDamage) if (weapon[W_PLAYER_WEAPON].damage >= game.maxPlasmaDamage)
sprintf(temp, "Plasma damage already at maximum"); sprintf(temp, "Plasma damage already at maximum");
else { else {
weapon[W_PLAYER_WEAPON].damage++; weapon[W_PLAYER_WEAPON].damage++;
@ -307,15 +307,15 @@ static void game_doCollectables()
break; break;
case P_SUPER: case P_SUPER:
currentGame.powerups++; game.powerups++;
if ((currentGame.area != MISN_INTERCEPTION) || if ((game.area != MISN_INTERCEPTION) ||
(currentGame.difficulty == DIFFICULTY_ORIGINAL) || (game.difficulty == DIFFICULTY_ORIGINAL) ||
(player.ammo[0] > 0)) (player.ammo[0] > 0))
{ {
if ((currentGame.area != MISN_INTERCEPTION) || if ((game.area != MISN_INTERCEPTION) ||
(currentGame.difficulty == DIFFICULTY_ORIGINAL)) (game.difficulty == DIFFICULTY_ORIGINAL))
LIMIT_ADD(player.ammo[0], collectable->value, LIMIT_ADD(player.ammo[0], collectable->value,
0, currentGame.maxPlasmaAmmo); 0, game.maxPlasmaAmmo);
weapon[W_PLAYER_WEAPON].ammo[0] = 5; weapon[W_PLAYER_WEAPON].ammo[0] = 5;
weapon[W_PLAYER_WEAPON].damage = 5; weapon[W_PLAYER_WEAPON].damage = 5;
@ -331,12 +331,12 @@ static void game_doCollectables()
break; break;
case P_PLASMA_AMMO: case P_PLASMA_AMMO:
if (player.ammo[0] >= currentGame.maxPlasmaAmmo) if (player.ammo[0] >= game.maxPlasmaAmmo)
sprintf(temp, "Plasma cells already at Maximum"); sprintf(temp, "Plasma cells already at Maximum");
else else
{ {
LIMIT_ADD(player.ammo[0], collectable->value, LIMIT_ADD(player.ammo[0], collectable->value,
0, currentGame.maxPlasmaAmmo); 0, game.maxPlasmaAmmo);
if (collectable->value > 1) if (collectable->value > 1)
{ {
sprintf(temp, "Got %d plasma cells", collectable->value); sprintf(temp, "Got %d plasma cells", collectable->value);
@ -348,17 +348,17 @@ static void game_doCollectables()
sprintf(temp, "Got one whole plasma cell (wahoo!)"); sprintf(temp, "Got one whole plasma cell (wahoo!)");
} }
} }
currentGame.cellPickups += collectable->value; game.cellPickups += collectable->value;
break; break;
case P_CARGO: case P_CARGO:
strcpy(temp, "Picked up some Cargo"); strcpy(temp, "Picked up some Cargo");
currentGame.cargoPickups++; game.cargoPickups++;
break; break;
case P_SLAVES: case P_SLAVES:
sprintf(temp, "Rescued %d slaves", collectable->value); sprintf(temp, "Rescued %d slaves", collectable->value);
currentGame.slavesRescued += collectable->value; game.slavesRescued += collectable->value;
break; break;
case P_ESCAPEPOD: case P_ESCAPEPOD:
@ -387,9 +387,9 @@ static void game_doCollectables()
// stop people from exploiting a weapon check condition // stop people from exploiting a weapon check condition
if (player.ammo[0] == 0) if (player.ammo[0] == 0)
{ {
weapon[W_PLAYER_WEAPON].ammo[0] = currentGame.minPlasmaOutput; weapon[W_PLAYER_WEAPON].ammo[0] = game.minPlasmaOutput;
weapon[W_PLAYER_WEAPON].damage = currentGame.minPlasmaDamage; weapon[W_PLAYER_WEAPON].damage = game.minPlasmaDamage;
weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[currentGame.minPlasmaRate]; weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[game.minPlasmaRate];
} }
} }
@ -541,7 +541,7 @@ static void game_doBullets()
if (bullet->owner == &player) if (bullet->owner == &player)
{ {
currentGame.hits++; game.hits++;
if ((aliens[i].classDef == CD_PHOEBE) || if ((aliens[i].classDef == CD_PHOEBE) ||
(aliens[i].classDef == CD_URSULA)) (aliens[i].classDef == CD_URSULA))
getMissFireMessage(&aliens[i]); getMissFireMessage(&aliens[i]);
@ -636,7 +636,7 @@ static void game_doBullets()
} }
} }
if ((currentGame.difficulty != DIFFICULTY_EASY) && if ((game.difficulty != DIFFICULTY_EASY) &&
((bullet->owner == &player) || (bullet->id == WT_ROCKET))) ((bullet->owner == &player) || (bullet->id == WT_ROCKET)))
{ {
for (int j = 0 ; j < 20 ; j++) for (int j = 0 ; j < 20 ; j++)
@ -691,8 +691,8 @@ static void game_doBullets()
if (bullet->owner == &player) if (bullet->owner == &player)
{ {
currentGame.minesKilled++; game.minesKilled++;
currentGame.hits++; game.hits++;
} }
} }
} }
@ -848,7 +848,7 @@ static void game_doAliens()
if (aliens[i].x > aliens[i].target->x) aliens[i].face = 1; if (aliens[i].x > aliens[i].target->x) aliens[i].face = 1;
} }
if ((currentGame.area == MISN_ELLESH) && if ((game.area == MISN_ELLESH) &&
(aliens[i].classDef == CD_BOSS)) (aliens[i].classDef == CD_BOSS))
aliens[i].face = 0; aliens[i].face = 0;
@ -874,7 +874,7 @@ static void game_doAliens()
if (aliens[i].classDef == CD_CLOAKFIGHTER) if (aliens[i].classDef == CD_CLOAKFIGHTER)
{ {
currentGame.experimentalShield = aliens[i].shield; game.experimentalShield = aliens[i].shield;
setInfoLine("Experimental Fighter has fled", setInfoLine("Experimental Fighter has fled",
FONT_CYAN); FONT_CYAN);
} }
@ -933,7 +933,7 @@ static void game_doAliens()
canFire = false; canFire = false;
} }
if ((canFire) && (dev.fireAliens)) if (canFire)
{ {
if ((aliens[i].reload[0] == 0) && if ((aliens[i].reload[0] == 0) &&
((rand() % 1000 < aliens[i].chance[0]) || ((rand() % 1000 < aliens[i].chance[0]) ||
@ -1024,7 +1024,7 @@ static void game_doAliens()
} }
} }
if ((currentGame.area == MISN_MARS) && (aliens[i].x < -60)) if ((game.area == MISN_MARS) && (aliens[i].x < -60))
aliens[i].active = false; aliens[i].active = false;
} }
else else
@ -1062,11 +1062,11 @@ static void game_doAliens()
} }
// Adjust the movement even whilst exploding // Adjust the movement even whilst exploding
if ((dev.moveAliens) && (!(aliens[i].flags & FL_NOMOVE)) && if ((!(aliens[i].flags & FL_NOMOVE)) &&
(!(aliens[i].flags & FL_DISABLED))) (!(aliens[i].flags & FL_DISABLED)))
alien_move(&aliens[i]); alien_move(&aliens[i]);
if ((currentGame.area != MISN_ELLESH) || (aliens[i].shield < 0)) if ((game.area != MISN_ELLESH) || (aliens[i].shield < 0))
aliens[i].x += engine.ssx; aliens[i].x += engine.ssx;
aliens[i].x += engine.smx; aliens[i].x += engine.smx;
@ -1126,7 +1126,7 @@ static void game_doPlayer()
if (player.weaponType[1] == W_CHARGER) if (player.weaponType[1] == W_CHARGER)
{ {
if (engine.keyState[KEY_ALTFIRE] && if (engine.keyState[KEY_ALTFIRE] &&
((currentGame.difficulty == DIFFICULTY_ORIGINAL) || ((game.difficulty == DIFFICULTY_ORIGINAL) ||
!(engine.keyState[KEY_FIRE]))) !(engine.keyState[KEY_FIRE])))
{ {
if (!player_chargerFired) if (!player_chargerFired)
@ -1136,7 +1136,7 @@ static void game_doPlayer()
if (engine.cheatAmmo) if (engine.cheatAmmo)
player.ammo[1] = 200; player.ammo[1] = 200;
if (currentGame.difficulty == DIFFICULTY_ORIGINAL) if (game.difficulty == DIFFICULTY_ORIGINAL)
{ {
LIMIT_ADD(player.ammo[1], 1, 0, 200); LIMIT_ADD(player.ammo[1], 1, 0, 200);
} }
@ -1164,7 +1164,7 @@ static void game_doPlayer()
if ((engine.keyState[KEY_SWITCH])) if ((engine.keyState[KEY_SWITCH]))
{ {
if ((weapon[W_PLAYER_WEAPON].ammo[0] >= 3) && if ((weapon[W_PLAYER_WEAPON].ammo[0] >= 3) &&
(weapon[W_PLAYER_WEAPON].ammo[0] <= currentGame.maxPlasmaOutput)) (weapon[W_PLAYER_WEAPON].ammo[0] <= game.maxPlasmaOutput))
{ {
weapon[W_PLAYER_WEAPON].flags ^= WF_SPREAD; weapon[W_PLAYER_WEAPON].flags ^= WF_SPREAD;
@ -1231,9 +1231,9 @@ static void game_doPlayer()
engine.keyState[KEY_PAUSE] = 0; engine.keyState[KEY_PAUSE] = 0;
} }
if (((currentGame.area == MISN_ELLESH) && if (((game.area == MISN_ELLESH) &&
(aliens[ALIEN_BOSS].shield > 0)) || (aliens[ALIEN_BOSS].shield > 0)) ||
(currentGame.area == MISN_MARS)) (game.area == MISN_MARS))
{ {
player.face = 0; player.face = 0;
xmoved = true; xmoved = true;
@ -1242,9 +1242,9 @@ static void game_doPlayer()
if (engine.done == 0) if (engine.done == 0)
{ {
if ((currentGame.difficulty != DIFFICULTY_ORIGINAL) || if ((game.difficulty != DIFFICULTY_ORIGINAL) ||
((currentGame.area != MISN_ELLESH) && ((game.area != MISN_ELLESH) &&
(currentGame.area != MISN_MARS))) (game.area != MISN_MARS)))
{ {
if (xmoved) if (xmoved)
{ {
@ -1259,7 +1259,7 @@ static void game_doPlayer()
player.x = screen->w - xViewBorder; player.x = screen->w - xViewBorder;
} }
} }
else if (currentGame.difficulty != DIFFICULTY_ORIGINAL) else if (game.difficulty != DIFFICULTY_ORIGINAL)
{ {
cd = player.x - screen->w / 2; cd = player.x - screen->w / 2;
if (cd < 0) if (cd < 0)
@ -1289,7 +1289,7 @@ static void game_doPlayer()
player.y = screen->h - yViewBorder; player.y = screen->h - yViewBorder;
} }
} }
else if (currentGame.difficulty != DIFFICULTY_ORIGINAL) else if (game.difficulty != DIFFICULTY_ORIGINAL)
{ {
cd = player.y - screen->h / 2; cd = player.y - screen->h / 2;
if (cd < 0) if (cd < 0)
@ -1335,11 +1335,11 @@ static void game_doPlayer()
player.shield--; player.shield--;
if (player.shield == -1) if (player.shield == -1)
{ {
if ((currentGame.hasWingMate1) || (aliens[ALIEN_KLINE].active)) if ((game.hasWingMate1) || (aliens[ALIEN_KLINE].active))
getPlayerDeathMessage(); getPlayerDeathMessage();
// Make it look like the ships are all still moving... // Make it look like the ships are all still moving...
if (currentGame.area == MISN_ELLESH) if (game.area == MISN_ELLESH)
{ {
for (int i = 0 ; i < ALIEN_MAX ; i++) for (int i = 0 ; i < ALIEN_MAX ; i++)
aliens[i].flags |= FL_LEAVESECTOR; aliens[i].flags |= FL_LEAVESECTOR;
@ -1362,14 +1362,14 @@ static void game_doPlayer()
LIMIT(engine.ssy, -cameraMaxSpeed, cameraMaxSpeed); LIMIT(engine.ssy, -cameraMaxSpeed, cameraMaxSpeed);
// Specific for the mission were you have to chase the Executive Transport // Specific for the mission were you have to chase the Executive Transport
if ((currentGame.area == MISN_ELLESH) && (aliens[ALIEN_BOSS].shield > 0) && if ((game.area == MISN_ELLESH) && (aliens[ALIEN_BOSS].shield > 0) &&
(player.shield > 0)) (player.shield > 0))
{ {
engine.ssx = -6; engine.ssx = -6;
engine.ssy = 0; engine.ssy = 0;
} }
if (currentGame.area == MISN_MARS) if (game.area == MISN_MARS)
{ {
engine.ssx = -6; engine.ssx = -6;
engine.ssy = 0; engine.ssy = 0;
@ -1533,11 +1533,11 @@ static bool game_checkPauseRequest()
return false; return false;
} }
int mainGameLoop() int game_mainLoop()
{ {
resetLists(); resetLists();
setMission(currentGame.area); setMission(game.area);
missionBriefScreen(); missionBriefScreen();
cargo_init(); cargo_init();
@ -1545,28 +1545,28 @@ int mainGameLoop()
aliens_init(); aliens_init();
// specific for Phoebe being captured! // specific for Phoebe being captured!
if (currentGame.area == MISN_NEROD) if (game.area == MISN_NEROD)
currentGame.hasWingMate1 = 1; game.hasWingMate1 = 1;
if (currentGame.area == MISN_ELAMALE) if (game.area == MISN_ELAMALE)
aliens[ALIEN_KLINE].active = false; aliens[ALIEN_KLINE].active = false;
for (int i = 0 ; i < engine.maxAliens ; i++) for (int i = 0 ; i < engine.maxAliens ; i++)
alien_add(); alien_add();
if (currentGame.hasWingMate1) if (game.hasWingMate1)
alien_addFriendly(ALIEN_PHOEBE); alien_addFriendly(ALIEN_PHOEBE);
if (currentGame.hasWingMate2) if (game.hasWingMate2)
alien_addFriendly(ALIEN_URSULA); alien_addFriendly(ALIEN_URSULA);
if ((currentGame.area == MISN_URUSOR) || if ((game.area == MISN_URUSOR) ||
(currentGame.area == MISN_POSWIC) || (game.area == MISN_POSWIC) ||
(currentGame.area == MISN_EARTH)) (game.area == MISN_EARTH))
alien_addFriendly(ALIEN_SID); alien_addFriendly(ALIEN_SID);
// Disable Wingmates for certain missions // Disable Wingmates for certain missions
switch (currentGame.area) switch (game.area)
{ {
case MISN_NEROD: case MISN_NEROD:
case MISN_URUSOR: case MISN_URUSOR:
@ -1581,16 +1581,16 @@ int mainGameLoop()
break; break;
} }
if (currentGame.area == MISN_DORIM) if (game.area == MISN_DORIM)
{ {
aliens[0].collectChance = 100; aliens[0].collectChance = 100;
aliens[0].collectType = P_ESCAPEPOD; aliens[0].collectType = P_ESCAPEPOD;
} }
// Some specifics for interception missions // Some specifics for interception missions
if (currentGame.area == MISN_INTERCEPTION) if (game.area == MISN_INTERCEPTION)
{ {
if ((currentGame.system > 1) && ((rand() % 5) == 0)) if ((game.system > 1) && ((rand() % 5) == 0))
{ {
aliens[ALIEN_KLINE] = alien_defs[CD_KLINE]; aliens[ALIEN_KLINE] = alien_defs[CD_KLINE];
aliens[ALIEN_KLINE].owner = &aliens[ALIEN_KLINE]; aliens[ALIEN_KLINE].owner = &aliens[ALIEN_KLINE];
@ -1601,7 +1601,7 @@ int mainGameLoop()
player_setTarget(ALIEN_KLINE); player_setTarget(ALIEN_KLINE);
} }
if ((currentGame.system == 2) && (currentGame.experimentalShield > 0)) if ((game.system == 2) && (game.experimentalShield > 0))
{ {
if ((rand() % 5) > 0) if ((rand() % 5) > 0)
{ {
@ -1613,12 +1613,12 @@ int mainGameLoop()
aliens[10].x = player.x - 1000; aliens[10].x = player.x - 1000;
aliens[10].y = player.y; aliens[10].y = player.y;
player_setTarget(10); player_setTarget(10);
aliens[10].shield = currentGame.experimentalShield; aliens[10].shield = game.experimentalShield;
} }
} }
} }
if (currentGame.area == MISN_VENUS) if (game.area == MISN_VENUS)
{ {
aliens[ALIEN_KLINE].x = player.x + 1000; aliens[ALIEN_KLINE].x = player.x + 1000;
aliens[ALIEN_KLINE].y = player.y; aliens[ALIEN_KLINE].y = player.y;
@ -1632,7 +1632,7 @@ int mainGameLoop()
} }
// Set target energy meter // Set target energy meter
switch (currentGame.area) switch (game.area)
{ {
case MISN_MOEBO: case MISN_MOEBO:
case MISN_ELAMALE: case MISN_ELAMALE:
@ -1721,7 +1721,7 @@ int mainGameLoop()
if ((missionFailed()) && (engine.missionCompleteTimer == 0)) if ((missionFailed()) && (engine.missionCompleteTimer == 0))
{ {
if (currentGame.area != MISN_MOEBO) if (game.area != MISN_MOEBO)
engine.missionCompleteTimer = SDL_GetTicks() + 4000; engine.missionCompleteTimer = SDL_GetTicks() + 4000;
} }
@ -1732,15 +1732,15 @@ int mainGameLoop()
{ {
if (SDL_GetTicks() >= engine.missionCompleteTimer) if (SDL_GetTicks() >= engine.missionCompleteTimer)
{ {
if ((!missionFailed()) && (currentGame.area != MISN_VENUS)) if ((!missionFailed()) && (game.area != MISN_VENUS))
{ {
leaveSector(); leaveSector();
if ((engine.done == 2) && if ((engine.done == 2) &&
(currentGame.area != MISN_DORIM) && (game.area != MISN_DORIM) &&
(currentGame.area != MISN_SIVEDI)) (game.area != MISN_SIVEDI))
{ {
if ((aliens[ALIEN_PHOEBE].shield > 0) && if ((aliens[ALIEN_PHOEBE].shield > 0) &&
(currentGame.area != MISN_EARTH)) (game.area != MISN_EARTH))
{ {
aliens[ALIEN_PHOEBE].x = player.x - 40; aliens[ALIEN_PHOEBE].x = player.x - 40;
aliens[ALIEN_PHOEBE].y = player.y - 35; aliens[ALIEN_PHOEBE].y = player.y - 35;
@ -1748,15 +1748,15 @@ int mainGameLoop()
} }
if ((aliens[ALIEN_URSULA].shield > 0) && if ((aliens[ALIEN_URSULA].shield > 0) &&
(currentGame.area != MISN_EARTH)) (game.area != MISN_EARTH))
{ {
aliens[ALIEN_URSULA].x = player.x - 40; aliens[ALIEN_URSULA].x = player.x - 40;
aliens[ALIEN_URSULA].y = player.y + 45; aliens[ALIEN_URSULA].y = player.y + 45;
aliens[ALIEN_URSULA].face = 0; aliens[ALIEN_URSULA].face = 0;
} }
if ((currentGame.area == MISN_URUSOR) || if ((game.area == MISN_URUSOR) ||
(currentGame.area == MISN_POSWIC)) (game.area == MISN_POSWIC))
{ {
aliens[ALIEN_SID].x = player.x - 100; aliens[ALIEN_SID].x = player.x - 100;
aliens[ALIEN_SID].y = player.y; aliens[ALIEN_SID].y = player.y;
@ -1764,7 +1764,7 @@ int mainGameLoop()
} }
} }
} }
else if ((currentGame.area == MISN_VENUS) && else if ((game.area == MISN_VENUS) &&
(engine.musicVolume > 0)) (engine.musicVolume > 0))
{ {
engine.keyState[KEY_UP] = 0; engine.keyState[KEY_UP] = 0;
@ -1830,7 +1830,7 @@ int mainGameLoop()
audio_resumeMusic(); audio_resumeMusic();
} }
if ((currentGame.area == MISN_MARS) && (engine.addAliens > -1)) if ((game.area == MISN_MARS) && (engine.addAliens > -1))
{ {
if ((rand() % 5) == 0) if ((rand() % 5) == 0)
// XXX: The originally specified range for x was [800, 100], // XXX: The originally specified range for x was [800, 100],
@ -1857,7 +1857,7 @@ int mainGameLoop()
engine.missionCompleteTimer = SDL_GetTicks() + 7000; engine.missionCompleteTimer = SDL_GetTicks() + 7000;
// specific to Boss 1 // specific to Boss 1
if ((currentGame.area == MISN_MOEBO) && if ((game.area == MISN_MOEBO) &&
(aliens[ALIEN_BOSS].flags & FL_ESCAPED)) (aliens[ALIEN_BOSS].flags & FL_ESCAPED))
{ {
audio_playSound(SFX_DEATH, aliens[ALIEN_BOSS].x); audio_playSound(SFX_DEATH, aliens[ALIEN_BOSS].x);
@ -1880,10 +1880,10 @@ int mainGameLoop()
if ((player.shield > 0) && (!missionFailed())) if ((player.shield > 0) && (!missionFailed()))
{ {
if (currentGame.area < MISN_VENUS) if (game.area < MISN_VENUS)
missionFinishedScreen(); missionFinishedScreen();
switch (currentGame.area) switch (game.area)
{ {
case MISN_MOEBO: case MISN_MOEBO:
doCutscene(1); doCutscene(1);
@ -1906,7 +1906,7 @@ int mainGameLoop()
break; break;
} }
if (currentGame.area < MISN_VENUS) if (game.area < MISN_VENUS)
{ {
updateSystemStatus(); updateSystemStatus();
saveGame(0); saveGame(0);
@ -1914,7 +1914,7 @@ int mainGameLoop()
rtn = 1; rtn = 1;
if (currentGame.area == MISN_VENUS) if (game.area == MISN_VENUS)
rtn = 0; rtn = 0;
} }
else else

View File

@ -20,10 +20,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef GAME_H #ifndef GAME_H
#define GAME_H #define GAME_H
extern Game currentGame; extern Game game;
extern void newGame(); void game_init();
void game_doExplosions(); void game_doExplosions();
extern int mainGameLoop(); int game_mainLoop();
#endif #endif

View File

@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "Starfighter.h" #include "Starfighter.h"
devVariables dev;
globalEngineVariables engine; globalEngineVariables engine;
void defineGlobals() void defineGlobals()
@ -69,8 +68,4 @@ void defineGlobals()
engine.cheatShield = false; engine.cheatShield = false;
engine.cheatAmmo = false; engine.cheatAmmo = false;
engine.cheatCash = false; engine.cheatCash = false;
// All Development Stuff...
dev.moveAliens = 1;
dev.fireAliens = 1;
} }

View File

@ -20,9 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef GLOBALS_H #ifndef GLOBALS_H
#define GLOBALS_H #define GLOBALS_H
extern devVariables dev;
extern globalEngineVariables engine; extern globalEngineVariables engine;
extern void defineGlobals(); void defineGlobals();
#endif #endif

View File

@ -47,7 +47,7 @@ static void setStatusLines()
{ {
char string[50]; char string[50];
sprintf(string, "System : %s", systemNames[currentGame.system]); sprintf(string, "System : %s", systemNames[game.system]);
textSurface(0, string, 0, 0, FONT_WHITE); textSurface(0, string, 0, 0, FONT_WHITE);
@ -77,76 +77,76 @@ static void setStatusLines()
sprintf(string, "Missions Completed : %d/%d", completed, total); sprintf(string, "Missions Completed : %d/%d", completed, total);
textSurface(1, string, 0, 0, FONT_WHITE); textSurface(1, string, 0, 0, FONT_WHITE);
sprintf(string, "Shots Fired : %d", currentGame.shots); sprintf(string, "Shots Fired : %d", game.shots);
textSurface(2, string, 0, 0, FONT_WHITE); textSurface(2, string, 0, 0, FONT_WHITE);
sprintf(string, "Hits Scored : %d", currentGame.hits); sprintf(string, "Hits Scored : %d", game.hits);
textSurface(3, string, 0, 0, FONT_WHITE); textSurface(3, string, 0, 0, FONT_WHITE);
sprintf(string, "Accuracy : %d%%", currentGame.accuracy); sprintf(string, "Accuracy : %d%%", game.accuracy);
textSurface(4, string, 0, 0, FONT_WHITE); textSurface(4, string, 0, 0, FONT_WHITE);
sprintf(string, "Enemies Killed by Others : %d", currentGame.totalOtherKills); sprintf(string, "Enemies Killed by Others : %d", game.totalOtherKills);
textSurface(5, string, 0, 0, FONT_WHITE); textSurface(5, string, 0, 0, FONT_WHITE);
sprintf(string, "Total Cash Earned : %d", currentGame.cashEarned); sprintf(string, "Total Cash Earned : %d", game.cashEarned);
textSurface(6, string, 0, 0, FONT_WHITE); textSurface(6, string, 0, 0, FONT_WHITE);
textSurface(7, "*** Chris ***", 0, 0, FONT_WHITE); textSurface(7, "*** Chris ***", 0, 0, FONT_WHITE);
sprintf(string, "Enemies Killed : %d", currentGame.totalKills); sprintf(string, "Enemies Killed : %d", game.totalKills);
textSurface(8, string, 0, 0, FONT_WHITE); textSurface(8, string, 0, 0, FONT_WHITE);
sprintf(string, "Shield Restores Picked Up : %d", currentGame.shieldPickups); sprintf(string, "Shield Restores Picked Up : %d", game.shieldPickups);
textSurface(9, string, 0, 0, FONT_WHITE); textSurface(9, string, 0, 0, FONT_WHITE);
sprintf(string, "Plasma Cells Picked Up : %d", currentGame.cellPickups); sprintf(string, "Plasma Cells Picked Up : %d", game.cellPickups);
textSurface(10, string, 0, 0, FONT_WHITE); textSurface(10, string, 0, 0, FONT_WHITE);
sprintf(string, "Rockets Picked Up : %d", currentGame.rocketPickups); sprintf(string, "Rockets Picked Up : %d", game.rocketPickups);
textSurface(11, string, 0, 0, FONT_WHITE); textSurface(11, string, 0, 0, FONT_WHITE);
sprintf(string, "Powerups Picked Up : %d", currentGame.rocketPickups); sprintf(string, "Powerups Picked Up : %d", game.rocketPickups);
textSurface(12, string, 0, 0, FONT_WHITE); textSurface(12, string, 0, 0, FONT_WHITE);
sprintf(string, "Mines Destroyed : %d", currentGame.minesKilled); sprintf(string, "Mines Destroyed : %d", game.minesKilled);
textSurface(13, string, 0, 0, FONT_WHITE); textSurface(13, string, 0, 0, FONT_WHITE);
sprintf(string, "Slaves Rescued : %d", currentGame.slavesRescued); sprintf(string, "Slaves Rescued : %d", game.slavesRescued);
textSurface(14, string, 0, 0, FONT_WHITE); textSurface(14, string, 0, 0, FONT_WHITE);
sprintf(string, "Cargo Picked Up : %d", currentGame.cargoPickups); sprintf(string, "Cargo Picked Up : %d", game.cargoPickups);
textSurface(15, string, 0, 0, FONT_WHITE); textSurface(15, string, 0, 0, FONT_WHITE);
if (currentGame.hasWingMate1) if (game.hasWingMate1)
{ {
textSurface(16, "*** Phoebe ***", 0, 0, FONT_WHITE); textSurface(16, "*** Phoebe ***", 0, 0, FONT_WHITE);
sprintf(string, "Enemies Killed : %d", currentGame.wingMate1Kills); sprintf(string, "Enemies Killed : %d", game.wingMate1Kills);
textSurface(17, string, 0, 0, FONT_WHITE); textSurface(17, string, 0, 0, FONT_WHITE);
sprintf(string, "Ejections : %d", currentGame.wingMate1Ejects); sprintf(string, "Ejections : %d", game.wingMate1Ejects);
textSurface(18, string, 0, 0, FONT_WHITE); textSurface(18, string, 0, 0, FONT_WHITE);
} }
if (currentGame.hasWingMate2) if (game.hasWingMate2)
{ {
textSurface(19, "*** Ursula ***", 0, 0, FONT_WHITE); textSurface(19, "*** Ursula ***", 0, 0, FONT_WHITE);
sprintf(string, "Enemies Killed : %d", currentGame.wingMate2Kills); sprintf(string, "Enemies Killed : %d", game.wingMate2Kills);
textSurface(20, string, 0, 0, FONT_WHITE); textSurface(20, string, 0, 0, FONT_WHITE);
sprintf(string, "Ejections : %d", currentGame.wingMate2Ejects); sprintf(string, "Ejections : %d", game.wingMate2Ejects);
textSurface(21, string, 0, 0, FONT_WHITE); textSurface(21, string, 0, 0, FONT_WHITE);
} }
signed char percentage = 0; signed char percentage = 0;
if ((currentGame.secondaryMissions > 0) && (currentGame.secondaryMissionsCompleted > 0)) if ((game.secondaryMissions > 0) && (game.secondaryMissionsCompleted > 0))
percentage = (currentGame.secondaryMissionsCompleted / currentGame.secondaryMissions) * 100; percentage = (game.secondaryMissionsCompleted / game.secondaryMissions) * 100;
sprintf(string, "Seconday Missions Completed : %d / %d (%d%%)", currentGame.secondaryMissionsCompleted, currentGame.secondaryMissions, percentage); sprintf(string, "Seconday Missions Completed : %d / %d (%d%%)", game.secondaryMissionsCompleted, game.secondaryMissions, percentage);
textSurface(24, string, 0, 0, FONT_WHITE); textSurface(24, string, 0, 0, FONT_WHITE);
int timeTaken = currentGame.timeTaken; int timeTaken = game.timeTaken;
snprintf(string, sizeof string, "Total Time : %2d:%02d:%02d", timeTaken / 3600, (timeTaken / 60) % 60, timeTaken % 60); snprintf(string, sizeof string, "Total Time : %2d:%02d:%02d", timeTaken / 3600, (timeTaken / 60) % 60, timeTaken % 60);
@ -180,7 +180,7 @@ static void setSystemPlanets()
char string[100]; char string[100];
strcpy(string, ""); strcpy(string, "");
switch (currentGame.system) switch (game.system)
{ {
case 0: case 0:
strcpy(string, "data/planets_spirit.dat"); strcpy(string, "data/planets_spirit.dat");
@ -281,18 +281,18 @@ static bool showSystem(float x, float y, bool selectable)
drawString(systemPlanet[planet].name, -1, 545, FONT_WHITE); drawString(systemPlanet[planet].name, -1, 545, FONT_WHITE);
if ((engine.keyState[KEY_FIRE])) if ((engine.keyState[KEY_FIRE]))
{ {
if (currentGame.system == 0) if (game.system == 0)
{ {
currentGame.stationedPlanet = planet; game.stationedPlanet = planet;
currentGame.destinationPlanet = planet; game.destinationPlanet = planet;
currentGame.area = systemPlanet[currentGame.stationedPlanet].missionNumber; game.area = systemPlanet[game.stationedPlanet].missionNumber;
strcpy(currentGame.stationedName, systemPlanet[currentGame.stationedPlanet].name); strcpy(game.stationedName, systemPlanet[game.stationedPlanet].name);
saveGame(0); saveGame(0);
} }
else else
{ {
currentGame.destinationPlanet = planet; game.destinationPlanet = planet;
strcpy(currentGame.destinationName, systemPlanet[currentGame.destinationPlanet].name); strcpy(game.destinationName, systemPlanet[game.destinationPlanet].name);
} }
rtn = true; rtn = true;
@ -363,7 +363,7 @@ static void updateCommsSurface(SDL_Surface *comms)
blevelRect(comms, 0, 10, comms->w - 1, 55, 0x00, 0x22, 0x00); blevelRect(comms, 0, 10, comms->w - 1, 55, 0x00, 0x22, 0x00);
blit(shape[FACE_CHRIS], 20, 15, comms); blit(shape[FACE_CHRIS], 20, 15, comms);
drawString("Chris Bainfield", 80, 15, FONT_WHITE, comms); drawString("Chris Bainfield", 80, 15, FONT_WHITE, comms);
sprintf(string, "Current Location: %s", systemPlanet[currentGame.stationedPlanet].name); sprintf(string, "Current Location: %s", systemPlanet[game.stationedPlanet].name);
drawString(string, 80, 35, FONT_WHITE, comms); drawString(string, 80, 35, FONT_WHITE, comms);
} }
@ -589,7 +589,7 @@ int galaxyMap()
initSaveSlots(); initSaveSlots();
loadBackground(systemBackground[currentGame.system]); loadBackground(systemBackground[game.system]);
char string[25]; char string[25];
@ -654,23 +654,23 @@ int galaxyMap()
signed char saveSlot = -1; signed char saveSlot = -1;
// Remove the Supercharge, if it is there // Remove the Supercharge, if it is there
if ((currentGame.difficulty != DIFFICULTY_EASY) && if ((game.difficulty != DIFFICULTY_EASY) &&
(currentGame.difficulty != DIFFICULTY_ORIGINAL)) (game.difficulty != DIFFICULTY_ORIGINAL))
{ {
weapon[W_PLAYER_WEAPON].reload[0] = MAX( weapon[W_PLAYER_WEAPON].reload[0] = MAX(
weapon[W_PLAYER_WEAPON].reload[0], weapon[W_PLAYER_WEAPON].reload[0],
rate2reload[currentGame.maxPlasmaRate]); rate2reload[game.maxPlasmaRate]);
weapon[W_PLAYER_WEAPON].ammo[0] = MIN(weapon[W_PLAYER_WEAPON].ammo[0], weapon[W_PLAYER_WEAPON].ammo[0] = MIN(weapon[W_PLAYER_WEAPON].ammo[0],
currentGame.maxPlasmaOutput); game.maxPlasmaOutput);
weapon[W_PLAYER_WEAPON].damage = MIN(weapon[W_PLAYER_WEAPON].damage, weapon[W_PLAYER_WEAPON].damage = MIN(weapon[W_PLAYER_WEAPON].damage,
currentGame.maxPlasmaDamage); game.maxPlasmaDamage);
} }
if (currentGame.system > 0) if (game.system > 0)
interceptionChance = (300 / currentGame.system); interceptionChance = (300 / game.system);
// There is no chance of being interceptted after the final attack on Earth // There is no chance of being interceptted after the final attack on Earth
if ((currentGame.system == 3) && (systemPlanet[2].missionCompleted)) if ((game.system == 3) && (systemPlanet[2].missionCompleted))
interceptionChance = 0; interceptionChance = 0;
int rtn = 0; int rtn = 0;
@ -689,14 +689,14 @@ int galaxyMap()
iconInfo[6].image = textSurface("Options", FONT_WHITE); iconInfo[6].image = textSurface("Options", FONT_WHITE);
iconInfo[7].image = textSurface("Exit to Title Screen", FONT_WHITE); iconInfo[7].image = textSurface("Exit to Title Screen", FONT_WHITE);
sprintf(string, "System : %s", systemNames[currentGame.system]); sprintf(string, "System : %s", systemNames[game.system]);
iconInfo[8].image = textSurface(string, FONT_WHITE); iconInfo[8].image = textSurface(string, FONT_WHITE);
sprintf(string, "Stationed At: %s", systemPlanet[currentGame.stationedPlanet].name); sprintf(string, "Stationed At: %s", systemPlanet[game.stationedPlanet].name);
iconInfo[9].image = textSurface(string, FONT_WHITE); iconInfo[9].image = textSurface(string, FONT_WHITE);
if (currentGame.destinationPlanet > -1) if (game.destinationPlanet > -1)
sprintf(string, "Destination: %s", systemPlanet[currentGame.destinationPlanet].name); sprintf(string, "Destination: %s", systemPlanet[game.destinationPlanet].name);
else else
strcpy(string, "Destination: None"); strcpy(string, "Destination: None");
iconInfo[10].image = textSurface(string, FONT_WHITE); iconInfo[10].image = textSurface(string, FONT_WHITE);
@ -707,7 +707,7 @@ int galaxyMap()
bool redrawBackGround = true; bool redrawBackGround = true;
if (currentGame.distanceCovered > 0) if (game.distanceCovered > 0)
section = 0; section = 0;
else else
player.shield = player.maxShield; player.shield = player.maxShield;
@ -771,32 +771,32 @@ int galaxyMap()
switch(section) switch(section)
{ {
case 0: case 0:
if (currentGame.stationedPlanet == currentGame.destinationPlanet) if (game.stationedPlanet == game.destinationPlanet)
{ {
currentGame.area = systemPlanet[currentGame.stationedPlanet].missionNumber; game.area = systemPlanet[game.stationedPlanet].missionNumber;
rtn = 2; rtn = 2;
engine.done = 1; engine.done = 1;
} }
else else
{ {
distance = abs(currentGame.stationedPlanet - currentGame.destinationPlanet); distance = abs(game.stationedPlanet - game.destinationPlanet);
distance = (5 / distance); distance = (5 / distance);
if (distance < 1) if (distance < 1)
distance = 1; distance = 1;
SDL_FreeSurface(iconInfo[9].image); SDL_FreeSurface(iconInfo[9].image);
iconInfo[9].image = textSurface(systemPlanet[currentGame.stationedPlanet].name, FONT_WHITE); iconInfo[9].image = textSurface(systemPlanet[game.stationedPlanet].name, FONT_WHITE);
SDL_FreeSurface(iconInfo[10].image); SDL_FreeSurface(iconInfo[10].image);
iconInfo[10].image = textSurface(systemPlanet[currentGame.destinationPlanet].name, FONT_WHITE); iconInfo[10].image = textSurface(systemPlanet[game.destinationPlanet].name, FONT_WHITE);
section = 8; section = 8;
destRect.x = 180; destRect.x = 180;
destRect.y = 450; destRect.y = 450;
destRect.w = 1; destRect.w = 1;
if (currentGame.distanceCovered > 0) if (game.distanceCovered > 0)
destRect.w = currentGame.distanceCovered; destRect.w = game.distanceCovered;
destRect.h = 20; destRect.h = 20;
} }
break; break;
@ -816,23 +816,23 @@ int galaxyMap()
if (showSystem(sinX, cosY, true)) if (showSystem(sinX, cosY, true))
{ {
if (currentGame.system == 0) if (game.system == 0)
{ {
sprintf(string, "Stationed At: %s", systemPlanet[currentGame.stationedPlanet].name); sprintf(string, "Stationed At: %s", systemPlanet[game.stationedPlanet].name);
SDL_FreeSurface(iconInfo[9].image); SDL_FreeSurface(iconInfo[9].image);
iconInfo[9].image = textSurface(string, FONT_WHITE); iconInfo[9].image = textSurface(string, FONT_WHITE);
updateCommsSurface(commsSurface); updateCommsSurface(commsSurface);
} }
else else
{ {
sprintf(string, "Destination: %s", systemPlanet[currentGame.destinationPlanet].name); sprintf(string, "Destination: %s", systemPlanet[game.destinationPlanet].name);
SDL_FreeSurface(iconInfo[10].image); SDL_FreeSurface(iconInfo[10].image);
iconInfo[10].image = textSurface(string, FONT_WHITE); iconInfo[10].image = textSurface(string, FONT_WHITE);
} }
} }
blit(iconInfo[9].image, 90, 450); blit(iconInfo[9].image, 90, 450);
if ((currentGame.system > 0) && (currentGame.stationedPlanet != currentGame.destinationPlanet)) if ((game.system > 0) && (game.stationedPlanet != game.destinationPlanet))
blit(iconInfo[10].image, 550, 450); blit(iconInfo[10].image, 550, 450);
break; break;
@ -867,9 +867,9 @@ int galaxyMap()
case 8: case 8:
showSystem(sinX, cosY, false); showSystem(sinX, cosY, false);
blit(systemPlanet[currentGame.stationedPlanet].image, 150, 450); blit(systemPlanet[game.stationedPlanet].image, 150, 450);
blit(iconInfo[9].image, 135, 480); blit(iconInfo[9].image, 135, 480);
blit(systemPlanet[currentGame.destinationPlanet].image, 650, 450); blit(systemPlanet[game.destinationPlanet].image, 650, 450);
blit(iconInfo[10].image, 635, 480); blit(iconInfo[10].image, 635, 480);
destRect.w += distance; destRect.w += distance;
@ -877,13 +877,13 @@ int galaxyMap()
if (destRect.w >= 450) if (destRect.w >= 450)
{ {
currentGame.stationedPlanet = currentGame.destinationPlanet; game.stationedPlanet = game.destinationPlanet;
currentGame.distanceCovered = 0; game.distanceCovered = 0;
player.shield = player.maxShield; player.shield = player.maxShield;
sprintf(string, "Stationed At: %s", sprintf(string, "Stationed At: %s",
systemPlanet[currentGame.stationedPlanet].name); systemPlanet[game.stationedPlanet].name);
strcpy(currentGame.stationedName, strcpy(game.stationedName,
systemPlanet[currentGame.stationedPlanet].name); systemPlanet[game.stationedPlanet].name);
SDL_FreeSurface(iconInfo[9].image); SDL_FreeSurface(iconInfo[9].image);
iconInfo[9].image = textSurface(string, FONT_WHITE); iconInfo[9].image = textSurface(string, FONT_WHITE);
updateCommsSurface(commsSurface); updateCommsSurface(commsSurface);
@ -895,10 +895,10 @@ int galaxyMap()
{ {
if ((rand() % interceptionChance) == 0) if ((rand() % interceptionChance) == 0)
{ {
currentGame.area = MISN_INTERCEPTION; game.area = MISN_INTERCEPTION;
rtn = 2; rtn = 2;
engine.done = 1; engine.done = 1;
currentGame.distanceCovered = destRect.w; game.distanceCovered = destRect.w;
} }
} }
@ -915,12 +915,12 @@ int galaxyMap()
// "Start Next Mission" icon // "Start Next Mission" icon
if (i == 0) if (i == 0)
{ {
if ((currentGame.stationedPlanet == currentGame.destinationPlanet) && if ((game.stationedPlanet == game.destinationPlanet) &&
(systemPlanet[currentGame.stationedPlanet].missionCompleted != 0)) (systemPlanet[game.stationedPlanet].missionCompleted != 0))
continue; continue;
else if (currentGame.stationedPlanet == currentGame.destinationPlanet) else if (game.stationedPlanet == game.destinationPlanet)
blit(shape[1], 80 + (i * 90), 500); blit(shape[1], 80 + (i * 90), 500);
else if (currentGame.stationedPlanet != currentGame.destinationPlanet) else if (game.stationedPlanet != game.destinationPlanet)
blit(shape[26], 80 + (i * 90), 500); blit(shape[26], 80 + (i * 90), 500);
} }
else else
@ -936,7 +936,7 @@ int galaxyMap()
} }
else else
{ {
if (currentGame.stationedPlanet == currentGame.destinationPlanet) if (game.stationedPlanet == game.destinationPlanet)
blit(iconInfo[0].image, (int)iconInfo[i].x, 545); blit(iconInfo[0].image, (int)iconInfo[i].x, 545);
else else
blit(iconInfo[11].image, (int)iconInfo[i].x, 545); blit(iconInfo[11].image, (int)iconInfo[i].x, 545);
@ -966,7 +966,7 @@ int galaxyMap()
for (int i = 0 ; i < 12 ; i++) for (int i = 0 ; i < 12 ; i++)
SDL_FreeSurface(iconInfo[i].image); SDL_FreeSurface(iconInfo[i].image);
if (currentGame.distanceCovered == 0) if (game.distanceCovered == 0)
player.shield = player.maxShield; player.shield = player.maxShield;
return rtn; return rtn;

View File

@ -103,7 +103,7 @@ bool loadGame(int slot)
if (fp == NULL) if (fp == NULL)
return false; return false;
if (fread(&currentGame, sizeof(Game), 1, fp) != 1) if (fread(&game, sizeof(Game), 1, fp) != 1)
{ {
printf("Save game error. The file was not of the expected format.\n"); printf("Save game error. The file was not of the expected format.\n");
fclose(fp); fclose(fp);
@ -112,18 +112,18 @@ bool loadGame(int slot)
fclose(fp); fclose(fp);
if (currentGame.saveFormat < 2) if (game.saveFormat < 2)
currentGame.difficulty = DIFFICULTY_NORMAL; game.difficulty = DIFFICULTY_NORMAL;
weapon[W_PLAYER_WEAPON] = currentGame.playerWeapon; weapon[W_PLAYER_WEAPON] = game.playerWeapon;
player = currentGame.thePlayer; player = game.thePlayer;
// Re-init all the planets in this system... // Re-init all the planets in this system...
initPlanetMissions(currentGame.system); initPlanetMissions(game.system);
// ... and then override with completition status // ... and then override with completition status
for (int i = 0 ; i < 10 ; i++) for (int i = 0 ; i < 10 ; i++)
systemPlanet[i].missionCompleted = currentGame.missionCompleted[i]; systemPlanet[i].missionCompleted = game.missionCompleted[i];
return true; return true;
} }
@ -142,15 +142,15 @@ void saveGame(int slot)
sprintf(fileName, "%ssave%.2d.dat", engine.userHomeDirectory, slot); sprintf(fileName, "%ssave%.2d.dat", engine.userHomeDirectory, slot);
fp = fopen(fileName, "wb"); fp = fopen(fileName, "wb");
currentGame.saveFormat = 3; game.saveFormat = 3;
currentGame.playerWeapon = weapon[W_PLAYER_WEAPON]; game.playerWeapon = weapon[W_PLAYER_WEAPON];
currentGame.thePlayer = player; game.thePlayer = player;
for (int i = 0 ; i < 10 ; i++) for (int i = 0 ; i < 10 ; i++)
currentGame.missionCompleted[i] = systemPlanet[i].missionCompleted; game.missionCompleted[i] = systemPlanet[i].missionCompleted;
if (fp != NULL) if (fp != NULL)
{ {
if (fwrite(&currentGame, sizeof(Game), 1, fp) != 1) if (fwrite(&game, sizeof(Game), 1, fp) != 1)
{ {
printf("Error Saving Game to Slot %d\n", slot); printf("Error Saving Game to Slot %d\n", slot);
} }

View File

@ -67,27 +67,27 @@ void getKillMessage(object *ally)
if (ally == &aliens[ALIEN_PHOEBE]) if (ally == &aliens[ALIEN_PHOEBE])
{ {
strcpy(otherName, "Ursula"); strcpy(otherName, "Ursula");
kills = currentGame.wingMate1Kills; kills = game.wingMate1Kills;
difference = currentGame.wingMate1Kills - currentGame.wingMate2Kills; difference = game.wingMate1Kills - game.wingMate2Kills;
if ((currentGame.wingMate1Kills > currentGame.wingMate2Kills) && if ((game.wingMate1Kills > game.wingMate2Kills) &&
(currentGame.wingMate1Kills > currentGame.totalKills)) (game.wingMate1Kills > game.totalKills))
firstPlace = true; firstPlace = true;
faceToUse = FACE_PHOEBE; faceToUse = FACE_PHOEBE;
} }
else else
{ {
strcpy(otherName, "Phoebe"); strcpy(otherName, "Phoebe");
kills = currentGame.wingMate2Kills; kills = game.wingMate2Kills;
difference = currentGame.wingMate2Kills - currentGame.wingMate1Kills; difference = game.wingMate2Kills - game.wingMate1Kills;
if ((currentGame.wingMate2Kills > currentGame.wingMate1Kills) && if ((game.wingMate2Kills > game.wingMate1Kills) &&
(currentGame.wingMate2Kills > currentGame.totalKills)) (game.wingMate2Kills > game.totalKills))
firstPlace = true; firstPlace = true;
faceToUse = FACE_URSULA; faceToUse = FACE_URSULA;
} }
int r = rand() % 10; int r = rand() % 10;
if (currentGame.hasWingMate2 == 0) if (game.hasWingMate2 == 0)
r = rand() % 7; r = rand() % 7;
switch(r) switch(r)
@ -139,7 +139,7 @@ const char *getKlineInsult()
"And now you're nothing but a DEAD hero." "And now you're nothing but a DEAD hero."
}; };
if (currentGame.area != MISN_VENUS) if (game.area != MISN_VENUS)
return (insult[rand() % 3]); return (insult[rand() % 3]);
else else
return (insult[3 + (rand() % 2)]); return (insult[3 + (rand() % 2)]);
@ -162,12 +162,12 @@ void getPlayerDeathMessage()
int faceToUse = FACE_PHOEBE; int faceToUse = FACE_PHOEBE;
if ((currentGame.area == MISN_URUSOR) || (currentGame.area == MISN_POSWIC) || if ((game.area == MISN_URUSOR) || (game.area == MISN_POSWIC) ||
(currentGame.area == MISN_EARTH)) (game.area == MISN_EARTH))
{ {
faceToUse = FACE_SID; faceToUse = FACE_SID;
} }
else if (currentGame.hasWingMate2) else if (game.hasWingMate2)
{ {
if ((rand() % 2) == 0) if ((rand() % 2) == 0)
faceToUse = FACE_URSULA; faceToUse = FACE_URSULA;

View File

@ -163,7 +163,7 @@ void doInfo()
blitText(30); blitText(30);
} }
if (currentGame.area != MISN_INTERCEPTION) if (game.area != MISN_INTERCEPTION)
{ {
blitText(9); // mission objectives blitText(9); // mission objectives
sprintf(text, "%d", (currentMission.remainingObjectives1 + currentMission.remainingObjectives2)); sprintf(text, "%d", (currentMission.remainingObjectives1 + currentMission.remainingObjectives2));
@ -172,7 +172,7 @@ void doInfo()
} }
blitText(8); // cash blitText(8); // cash
sprintf(text, "%.6d", currentGame.cash); sprintf(text, "%.6d", game.cash);
textSurface(38, text, 90, 21, FONT_WHITE); textSurface(38, text, 90, 21, FONT_WHITE);
blitText(38); blitText(38);
@ -300,7 +300,7 @@ void doInfo()
} }
// Do the target's remaining shield (if required) // Do the target's remaining shield (if required)
if (currentGame.area != MISN_DORIM) if (game.area != MISN_DORIM)
{ {
if ((engine.targetIndex > -1) && (aliens[engine.targetIndex].shield > 0) && (engine.targetIndex > 9)) if ((engine.targetIndex > -1) && (aliens[engine.targetIndex].shield > 0) && (engine.targetIndex > 9))
{ {
@ -334,11 +334,11 @@ void doInfo()
for (int i = 1 ; i <= 5 ; i++) for (int i = 1 ; i <= 5 ; i++)
{ {
if (weapon[W_PLAYER_WEAPON].damage >= i) { if (weapon[W_PLAYER_WEAPON].damage >= i) {
if(i <= currentGame.maxPlasmaDamage || (SDL_GetTicks() % 1000 > (unsigned)i * 100)) if(i <= game.maxPlasmaDamage || (SDL_GetTicks() % 1000 > (unsigned)i * 100))
{ {
SDL_FillRect(screen, &bar, green); SDL_FillRect(screen, &bar, green);
} }
} else if (i <= currentGame.maxPlasmaDamage) } else if (i <= game.maxPlasmaDamage)
SDL_FillRect(screen, &bar, darkGreen); SDL_FillRect(screen, &bar, darkGreen);
bar.x += 30; bar.x += 30;
} }
@ -354,12 +354,12 @@ void doInfo()
for (int i = 1 ; i <= 5 ; i++) for (int i = 1 ; i <= 5 ; i++)
{ {
if (weapon[W_PLAYER_WEAPON].ammo[0] >= i) { if (weapon[W_PLAYER_WEAPON].ammo[0] >= i) {
if(i <= currentGame.maxPlasmaOutput || (SDL_GetTicks() % 1000 > (unsigned)i * 100)) if(i <= game.maxPlasmaOutput || (SDL_GetTicks() % 1000 > (unsigned)i * 100))
{ {
SDL_FillRect(screen, &bar, yellow); SDL_FillRect(screen, &bar, yellow);
} }
} }
else if (i <= currentGame.maxPlasmaOutput) else if (i <= game.maxPlasmaOutput)
SDL_FillRect(screen, &bar, darkYellow); SDL_FillRect(screen, &bar, darkYellow);
bar.x += 30; bar.x += 30;
} }
@ -374,12 +374,12 @@ void doInfo()
for (int i = 1 ; i <= 5 ; i++) for (int i = 1 ; i <= 5 ; i++)
{ {
if (weapon[W_PLAYER_WEAPON].reload[0] <= rate2reload[i]) { if (weapon[W_PLAYER_WEAPON].reload[0] <= rate2reload[i]) {
if(i <= currentGame.maxPlasmaRate || (SDL_GetTicks() % 1000 > (unsigned)i * 100)) if(i <= game.maxPlasmaRate || (SDL_GetTicks() % 1000 > (unsigned)i * 100))
{ {
SDL_FillRect(screen, &bar, blue); SDL_FillRect(screen, &bar, blue);
} }
} }
else if (i <= currentGame.maxPlasmaRate) else if (i <= game.maxPlasmaRate)
SDL_FillRect(screen, &bar, darkerBlue); SDL_FillRect(screen, &bar, darkerBlue);
bar.x += 30; bar.x += 30;
} }

View File

@ -150,53 +150,53 @@ void checkForBossMission()
void updateSystemStatus() void updateSystemStatus()
{ {
if (currentGame.area == MISN_START) if (game.area == MISN_START)
{ {
currentGame.stationedPlanet = 0; game.stationedPlanet = 0;
currentGame.area = 1; game.area = 1;
strcpy(currentGame.stationedName, "Hail"); strcpy(game.stationedName, "Hail");
initPlanetMissions(currentGame.system); initPlanetMissions(game.system);
} }
else if (currentGame.area == MISN_MOEBO) else if (game.area == MISN_MOEBO)
{ {
currentGame.stationedPlanet = 0; game.stationedPlanet = 0;
currentGame.system = 1; game.system = 1;
currentGame.area = MISN_RESCUESLAVES; game.area = MISN_RESCUESLAVES;
strcpy(currentGame.stationedName, "Nerod"); strcpy(game.stationedName, "Nerod");
initPlanetMissions(currentGame.system); initPlanetMissions(game.system);
if (currentGame.difficulty == DIFFICULTY_ORIGINAL) if (game.difficulty == DIFFICULTY_ORIGINAL)
player.maxShield = 50; player.maxShield = 50;
} }
else if (currentGame.area == MISN_ELAMALE) else if (game.area == MISN_ELAMALE)
{ {
currentGame.stationedPlanet = 0; game.stationedPlanet = 0;
currentGame.system = 2; game.system = 2;
currentGame.area = MISN_CLOAKFIGHTER; game.area = MISN_CLOAKFIGHTER;
strcpy(currentGame.stationedName, "Odeon"); strcpy(game.stationedName, "Odeon");
initPlanetMissions(currentGame.system); initPlanetMissions(game.system);
if (currentGame.difficulty == DIFFICULTY_ORIGINAL) if (game.difficulty == DIFFICULTY_ORIGINAL)
player.maxShield = 75; player.maxShield = 75;
} }
else if (currentGame.area == MISN_ELLESH) else if (game.area == MISN_ELLESH)
{ {
currentGame.stationedPlanet = 8; game.stationedPlanet = 8;
currentGame.system = 3; game.system = 3;
currentGame.area = MISN_PLUTO; game.area = MISN_PLUTO;
strcpy(currentGame.stationedName, "Pluto"); strcpy(game.stationedName, "Pluto");
initPlanetMissions(currentGame.system); initPlanetMissions(game.system);
if (currentGame.difficulty == DIFFICULTY_ORIGINAL) if (game.difficulty == DIFFICULTY_ORIGINAL)
player.maxShield = 100; player.maxShield = 100;
} }
else // Update the mission for the planet else // Update the mission for the planet
{ {
systemPlanet[currentGame.stationedPlanet].missionCompleted = 1; systemPlanet[game.stationedPlanet].missionCompleted = 1;
} }
strcpy(currentGame.destinationName, "None"); strcpy(game.destinationName, "None");
currentGame.destinationPlanet = currentGame.stationedPlanet; game.destinationPlanet = game.stationedPlanet;
} }
/* /*
@ -316,12 +316,12 @@ void checkTimer()
} }
// specific to Spirit Boss // specific to Spirit Boss
if ((currentGame.area == MISN_MOEBO) && if ((game.area == MISN_MOEBO) &&
(currentMission.completed1[0] < OB_INCOMPLETE)) (currentMission.completed1[0] < OB_INCOMPLETE))
engine.timeMission = 1; engine.timeMission = 1;
// specific to the Asteroid belt // specific to the Asteroid belt
if ((currentGame.area == MISN_MARS) && if ((game.area == MISN_MARS) &&
(currentMission.completed1[0] < OB_INCOMPLETE)) (currentMission.completed1[0] < OB_INCOMPLETE))
{ {
currentMission.completed1[0] = OB_COMPLETED; currentMission.completed1[0] = OB_COMPLETED;
@ -340,7 +340,7 @@ static void evaluateRequirement(int type, int id, int *completed, int *targetVal
{ {
*completed = 2; *completed = 2;
checkTimer(); checkTimer();
if ((currentGame.area == MISN_URUSOR) && (type == M_DISABLE_TARGET)) if ((game.area == MISN_URUSOR) && (type == M_DISABLE_TARGET))
setRadioMessage(FACE_SID, "All vessels disabled!", 1); setRadioMessage(FACE_SID, "All vessels disabled!", 1);
} }
else else
@ -374,12 +374,12 @@ static void evaluateRequirement(int type, int id, int *completed, int *targetVal
{ {
case P_CARGO: case P_CARGO:
sprintf(message, "Cargo pod destroyed!"); sprintf(message, "Cargo pod destroyed!");
if (currentGame.area == MISN_CERADSE) // Get lectured by Sid if (game.area == MISN_CERADSE) // Get lectured by Sid
setRadioMessage(FACE_SID, "Chris, we needed that pod!! I warned you that we couldn't afford to lose a single one!!", 1); setRadioMessage(FACE_SID, "Chris, we needed that pod!! I warned you that we couldn't afford to lose a single one!!", 1);
break; break;
case P_ESCAPEPOD: case P_ESCAPEPOD:
sprintf(message, "Escape Pod lost!"); sprintf(message, "Escape Pod lost!");
if (currentGame.area == MISN_ODEON) // Get lectured by Phoebe if (game.area == MISN_ODEON) // Get lectured by Phoebe
setRadioMessage(FACE_PHOEBE, "No... Ursula...", 1); setRadioMessage(FACE_PHOEBE, "No... Ursula...", 1);
break; break;
} }
@ -388,7 +388,7 @@ static void evaluateRequirement(int type, int id, int *completed, int *targetVal
if (*targetValue <= 0) if (*targetValue <= 0)
{ {
*completed = -2; *completed = -2;
switch (currentGame.area) switch (game.area)
{ {
case MISN_NEROD: case MISN_NEROD:
setRadioMessage(FACE_SID, "Dammit, Chris! We just lost her!", 1); setRadioMessage(FACE_SID, "Dammit, Chris! We just lost her!", 1);
@ -474,20 +474,20 @@ void updateMissionRequirements(int type, int id, int value)
} }
// Special Case - Interceptions // Special Case - Interceptions
if (currentGame.area == MISN_INTERCEPTION) if (game.area == MISN_INTERCEPTION)
{ {
if ((type == M_COLLECT) && (id == P_SLAVES)) if ((type == M_COLLECT) && (id == P_SLAVES))
{ {
if (systemPlanet[9].missionCompleted == 0) if (systemPlanet[9].missionCompleted == 0)
{ {
if (currentGame.slavesRescued >= 250) if (game.slavesRescued >= 250)
{ {
setInfoLine("*** Slaves Rescued - Mission Completed ***", FONT_GREEN); setInfoLine("*** Slaves Rescued - Mission Completed ***", FONT_GREEN);
systemPlanet[9].missionCompleted = 1; systemPlanet[9].missionCompleted = 1;
} }
else else
{ {
sprintf(message, "Rescue %d more...", 250 - currentGame.slavesRescued); sprintf(message, "Rescue %d more...", 250 - game.slavesRescued);
setInfoLine(message, FONT_CYAN); setInfoLine(message, FONT_CYAN);
} }
} }
@ -498,7 +498,7 @@ void updateMissionRequirements(int type, int id, int value)
setInfoLine("*** Experimental Fighter Destroyed - Mission Completed ***", FONT_GREEN); setInfoLine("*** Experimental Fighter Destroyed - Mission Completed ***", FONT_GREEN);
systemPlanet[9].missionCompleted = 1; systemPlanet[9].missionCompleted = 1;
setRadioMessage(FACE_CHRIS, "That's one less suprise that WEAPCO can spring on us!", 1); setRadioMessage(FACE_CHRIS, "That's one less suprise that WEAPCO can spring on us!", 1);
currentGame.experimentalShield = 0; game.experimentalShield = 0;
} }
} }
} }
@ -526,7 +526,7 @@ static char revealHiddenObjectives()
if (!allDone) if (!allDone)
{ {
// Activate Kline!! :) // Activate Kline!! :)
if (currentGame.area == MISN_ELAMALE) if (game.area == MISN_ELAMALE)
{ {
mission_killAllEnemies(); mission_killAllEnemies();
syncScriptEvents(); syncScriptEvents();
@ -574,7 +574,7 @@ bool allMissionsCompleted()
{ {
if (currentMission.remainingObjectives1 > 1) if (currentMission.remainingObjectives1 > 1)
{ {
if ((currentGame.area != MISN_POSWIC) || (i != 1)) if ((game.area != MISN_POSWIC) || (i != 1))
setInfoLine("*** Primary Objective Completed ***", FONT_GREEN); setInfoLine("*** Primary Objective Completed ***", FONT_GREEN);
else else
setInfoLine(">>> Primary Objective Failed <<<", FONT_RED); setInfoLine(">>> Primary Objective Failed <<<", FONT_RED);
@ -582,17 +582,17 @@ bool allMissionsCompleted()
} }
else else
{ {
if (currentGame.area != MISN_INTERCEPTION) if (game.area != MISN_INTERCEPTION)
setInfoLine("*** All Primary Objectives Completed ***", FONT_GREEN); setInfoLine("*** All Primary Objectives Completed ***", FONT_GREEN);
else else
setInfoLine("*** Interception Destroyed ***", FONT_GREEN); setInfoLine("*** Interception Destroyed ***", FONT_GREEN);
currentMission.completed1[i] = OB_COMPLETED; currentMission.completed1[i] = OB_COMPLETED;
// do some area specific things // do some area specific things
if ((currentGame.area == MISN_MOEBO) || if ((game.area == MISN_MOEBO) ||
(currentGame.area == MISN_DORIM) || (game.area == MISN_DORIM) ||
(currentGame.area == MISN_ELLESH) || (game.area == MISN_ELLESH) ||
(currentGame.area == MISN_MARS)) (game.area == MISN_MARS))
{ {
if (currentMission.remainingObjectives2 == 0) if (currentMission.remainingObjectives2 == 0)
{ {
@ -601,7 +601,7 @@ bool allMissionsCompleted()
} }
} }
if (currentGame.area == MISN_EARTH) if (game.area == MISN_EARTH)
setRadioMessage(FACE_CHRIS, "You guys stay here and keep things under control. I'm going after Kethlan!", 1); setRadioMessage(FACE_CHRIS, "You guys stay here and keep things under control. I'm going after Kethlan!", 1);
} }
} }
@ -619,7 +619,7 @@ bool allMissionsCompleted()
currentMission.completed2[i] = OB_COMPLETED; currentMission.completed2[i] = OB_COMPLETED;
// do some area specific things // do some area specific things
if ((currentGame.area == MISN_DORIM) && if ((game.area == MISN_DORIM) &&
(currentMission.remainingObjectives1 == 0)) (currentMission.remainingObjectives1 == 0))
{ {
mission_killAllEnemies(); mission_killAllEnemies();
@ -736,7 +736,7 @@ static void drawBriefScreen()
if (currentMission.secondaryType[i] != NONE) if (currentMission.secondaryType[i] != NONE)
{ {
drawString(currentMission.secondaryObjective[i], 160, 274 + (i * 30), FONT_WHITE); drawString(currentMission.secondaryObjective[i], 160, 274 + (i * 30), FONT_WHITE);
currentGame.secondaryMissions++; game.secondaryMissions++;
} }
} }
} }
@ -756,7 +756,7 @@ void missionBriefScreen()
clearScreen(black); clearScreen(black);
updateScreen(); updateScreen();
if (currentGame.area != MISN_INTERCEPTION) if (game.area != MISN_INTERCEPTION)
{ {
clearScreen(black); clearScreen(black);
drawBriefScreen(); drawBriefScreen();
@ -764,14 +764,14 @@ void missionBriefScreen()
if (currentMission.timeLimit1[0] > 0) if (currentMission.timeLimit1[0] > 0)
{ {
char temp[50]; char temp[50];
if (currentGame.area != MISN_MARS) if (game.area != MISN_MARS)
sprintf(temp, "TIME LIMIT: %d minutes", currentMission.timeLimit1[0]); sprintf(temp, "TIME LIMIT: %d minutes", currentMission.timeLimit1[0]);
else else
sprintf(temp, "SURVIVAL FOR %d minutes", currentMission.timeLimit1[0]); sprintf(temp, "SURVIVAL FOR %d minutes", currentMission.timeLimit1[0]);
drawString(temp, -1, 500, FONT_RED); drawString(temp, -1, 500, FONT_RED);
} }
switch (currentGame.area) switch (game.area)
{ {
case MISN_URUSOR: case MISN_URUSOR:
case MISN_DORIM: case MISN_DORIM:
@ -781,14 +781,14 @@ void missionBriefScreen()
case MISN_MARS: case MISN_MARS:
case MISN_VENUS: case MISN_VENUS:
drawString("Phoebe Lexx will not be present", 160, 420, FONT_WHITE); drawString("Phoebe Lexx will not be present", 160, 420, FONT_WHITE);
if (currentGame.hasWingMate2) if (game.hasWingMate2)
drawString("Ursula Lexx will not be present", 160, 450, FONT_WHITE); drawString("Ursula Lexx will not be present", 160, 450, FONT_WHITE);
break; break;
} }
if ((currentGame.area == MISN_URUSOR) || if ((game.area == MISN_URUSOR) ||
(currentGame.area == MISN_POSWIC) || (game.area == MISN_POSWIC) ||
(currentGame.area == MISN_EARTH)) (game.area == MISN_EARTH))
drawString("Sid Wilson will join you on this mission", 160, 480, FONT_WHITE); drawString("Sid Wilson will join you on this mission", 160, 480, FONT_WHITE);
updateScreen(); updateScreen();
@ -814,7 +814,7 @@ void missionBriefScreen()
textSurface(13, "Cooler", 485, 570, FONT_WHITE); textSurface(13, "Cooler", 485, 570, FONT_WHITE);
audio_playRandomTrack(); audio_playRandomTrack();
if (currentGame.area != MISN_INTERCEPTION) if (game.area != MISN_INTERCEPTION)
{ {
drawString("PRESS ENTER TO CONTINUE...", -1, 550, FONT_WHITE); drawString("PRESS ENTER TO CONTINUE...", -1, 550, FONT_WHITE);
@ -854,13 +854,13 @@ void missionFinishedScreen()
int shield_bonus; int shield_bonus;
char temp[100]; char temp[100];
if (currentGame.area != MISN_INTERCEPTION) if (game.area != MISN_INTERCEPTION)
{ {
clearScreen(black); clearScreen(black);
updateScreen(); updateScreen();
if (currentGame.shots > 0) if (game.shots > 0)
currentGame.accuracy = (currentGame.hits * 100) / currentGame.shots; game.accuracy = (game.hits * 100) / game.shots;
clearScreen(black); clearScreen(black);
drawBriefScreen(); drawBriefScreen();
@ -869,7 +869,7 @@ void missionFinishedScreen()
{ {
if (currentMission.primaryType[i] != NONE) if (currentMission.primaryType[i] != NONE)
{ {
if ((currentGame.area != MISN_POSWIC) || (i != 1)) if ((game.area != MISN_POSWIC) || (i != 1))
drawString("COMPLETED", 550, 114 + (i * 30), FONT_GREEN); drawString("COMPLETED", 550, 114 + (i * 30), FONT_GREEN);
else else
drawString("FAILED", 550, 114 + (i * 30), FONT_RED); drawString("FAILED", 550, 114 + (i * 30), FONT_RED);
@ -886,7 +886,7 @@ void missionFinishedScreen()
if (currentMission.completed2[i] >= 1) if (currentMission.completed2[i] >= 1)
{ {
drawString("COMPLETED", 550, 274 + (i * 30), FONT_GREEN); drawString("COMPLETED", 550, 274 + (i * 30), FONT_GREEN);
currentGame.secondaryMissionsCompleted++; game.secondaryMissionsCompleted++;
} }
else else
{ {
@ -901,11 +901,11 @@ void missionFinishedScreen()
shield_bonus = player.shield * 10; shield_bonus = player.shield * 10;
sprintf(temp, "Shield Bonus: $%.3d", shield_bonus); sprintf(temp, "Shield Bonus: $%.3d", shield_bonus);
drawString(temp, -1, 430, FONT_WHITE); drawString(temp, -1, 430, FONT_WHITE);
currentGame.cash += shield_bonus; game.cash += shield_bonus;
currentGame.cashEarned += shield_bonus; game.cashEarned += shield_bonus;
} }
currentGame.timeTaken += engine.timeTaken; game.timeTaken += engine.timeTaken;
snprintf(temp, sizeof temp, "Mission Time: %2ld:%02ld:%02ld", snprintf(temp, sizeof temp, "Mission Time: %2ld:%02ld:%02ld",
engine.timeTaken / 3600, (engine.timeTaken / 60) % 60, engine.timeTaken / 3600, (engine.timeTaken / 60) % 60,
@ -914,12 +914,12 @@ void missionFinishedScreen()
drawString(temp, -1, 500, FONT_WHITE); drawString(temp, -1, 500, FONT_WHITE);
// Do some mission specific stuff here... // Do some mission specific stuff here...
if (currentGame.area == MISN_HAIL) if (game.area == MISN_HAIL)
currentGame.cash -= 500; game.cash -= 500;
else if (currentGame.area == MISN_ODEON) else if (game.area == MISN_ODEON)
currentGame.hasWingMate2 = 1; game.hasWingMate2 = 1;
else if (currentGame.area == MISN_ALMARTHA) else if (game.area == MISN_ALMARTHA)
currentGame.cash -= 2000; game.cash -= 2000;
checkForBossMission(); checkForBossMission();

View File

@ -45,12 +45,12 @@ void initPlayer()
player.weaponType[0] = W_PLAYER_WEAPON; player.weaponType[0] = W_PLAYER_WEAPON;
if (weapon[W_PLAYER_WEAPON].ammo[0] < currentGame.minPlasmaOutput) if (weapon[W_PLAYER_WEAPON].ammo[0] < game.minPlasmaOutput)
weapon[W_PLAYER_WEAPON].ammo[0] = currentGame.minPlasmaOutput; weapon[W_PLAYER_WEAPON].ammo[0] = game.minPlasmaOutput;
if (weapon[W_PLAYER_WEAPON].damage < currentGame.minPlasmaDamage) if (weapon[W_PLAYER_WEAPON].damage < game.minPlasmaDamage)
weapon[W_PLAYER_WEAPON].damage = currentGame.minPlasmaDamage; weapon[W_PLAYER_WEAPON].damage = game.minPlasmaDamage;
if (weapon[W_PLAYER_WEAPON].reload[0] > rate2reload[currentGame.minPlasmaRate]) if (weapon[W_PLAYER_WEAPON].reload[0] > rate2reload[game.minPlasmaRate])
weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[currentGame.minPlasmaRate]; weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[game.minPlasmaRate];
player.hit = 0; player.hit = 0;

View File

@ -44,7 +44,7 @@ void loadGameGraphics()
shipShape[0] = loadImage("gfx/firefly1.png"); shipShape[0] = loadImage("gfx/firefly1.png");
shipShape[1] = loadImage("gfx/firefly2.png"); shipShape[1] = loadImage("gfx/firefly2.png");
switch(currentGame.system) switch(game.system)
{ {
case 0: case 0:
strcpy(string, "data/resources_spirit.dat"); strcpy(string, "data/resources_spirit.dat");
@ -136,7 +136,7 @@ void loadGameGraphics()
fclose(fp); fclose(fp);
loadBackground(systemBackground[currentGame.system]); loadBackground(systemBackground[game.system]);
for (int i = 0 ; i < CD_MAX ; i++) for (int i = 0 ; i < CD_MAX ; i++)
{ {

View File

@ -48,13 +48,13 @@ void loadScriptEvents()
gameEvent[i].flag = 0; gameEvent[i].flag = 0;
} }
if ((currentGame.area == MISN_INTERCEPTION) && if ((game.area == MISN_INTERCEPTION) &&
(aliens[ALIEN_KLINE].classDef == CD_KLINE) && (aliens[ALIEN_KLINE].classDef == CD_KLINE) &&
(aliens[ALIEN_KLINE].active)) (aliens[ALIEN_KLINE].active))
setKlineGreeting(); setKlineGreeting();
char filename[255]; char filename[255];
sprintf(filename, "data/script%d.txt", currentGame.area); sprintf(filename, "data/script%d.txt", game.area);
FILE *fp; FILE *fp;
int i = 0; int i = 0;

View File

@ -107,9 +107,9 @@ void ship_fireBullet(object *ship, int weaponType)
player.ammo[0]--; player.ammo[0]--;
if (player.ammo[0] <= 0) if (player.ammo[0] <= 0)
{ {
weapon[W_PLAYER_WEAPON].ammo[0] = currentGame.minPlasmaOutput; weapon[W_PLAYER_WEAPON].ammo[0] = game.minPlasmaOutput;
weapon[W_PLAYER_WEAPON].damage = currentGame.minPlasmaDamage; weapon[W_PLAYER_WEAPON].damage = game.minPlasmaDamage;
weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[currentGame.minPlasmaRate]; weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[game.minPlasmaRate];
} }
} }
} }

View File

@ -65,78 +65,78 @@ static void drawSecondaryWeaponSurface()
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", currentGame.maxRocketAmmo); sprintf(description, "Capacity : %d", game.maxRocketAmmo);
drawString(description, 10, 37, FONT_WHITE, shopSurface[2]); drawString(description, 10, 37, FONT_WHITE, shopSurface[2]);
} }
} }
static void adjustShopPrices() static void adjustShopPrices()
{ {
if (currentGame.difficulty == DIFFICULTY_ORIGINAL) if (game.difficulty == DIFFICULTY_ORIGINAL)
{ {
shopItems[SHOP_PLASMA_MAX_OUTPUT].price = (500 * shopItems[SHOP_PLASMA_MAX_OUTPUT].price = (500 *
currentGame.maxPlasmaOutput); game.maxPlasmaOutput);
shopItems[SHOP_PLASMA_MAX_DAMAGE].price = (500 * shopItems[SHOP_PLASMA_MAX_DAMAGE].price = (500 *
currentGame.maxPlasmaDamage); game.maxPlasmaDamage);
shopItems[SHOP_PLASMA_MAX_RATE].price = (500 * shopItems[SHOP_PLASMA_MAX_RATE].price = (500 *
(currentGame.maxPlasmaRate * 2 - 1)); (game.maxPlasmaRate * 2 - 1));
shopItems[SHOP_PLASMA_MIN_OUTPUT].price = (2000 * shopItems[SHOP_PLASMA_MIN_OUTPUT].price = (2000 *
currentGame.minPlasmaOutput); game.minPlasmaOutput);
shopItems[SHOP_PLASMA_MIN_DAMAGE].price = (2000 * shopItems[SHOP_PLASMA_MIN_DAMAGE].price = (2000 *
currentGame.minPlasmaDamage); game.minPlasmaDamage);
shopItems[SHOP_PLASMA_MIN_RATE].price = (2000 * shopItems[SHOP_PLASMA_MIN_RATE].price = (2000 *
(currentGame.minPlasmaRate * 2 - 1)); (game.minPlasmaRate * 2 - 1));
} }
else else
{ {
shopItems[SHOP_PLASMA_MAX_OUTPUT].price = (1000 * shopItems[SHOP_PLASMA_MAX_OUTPUT].price = (1000 *
(currentGame.maxPlasmaOutput + 1)); (game.maxPlasmaOutput + 1));
shopItems[SHOP_PLASMA_MAX_DAMAGE].price = (1000 * shopItems[SHOP_PLASMA_MAX_DAMAGE].price = (1000 *
(currentGame.maxPlasmaDamage + 1)); (game.maxPlasmaDamage + 1));
shopItems[SHOP_PLASMA_MAX_RATE].price = (1000 * shopItems[SHOP_PLASMA_MAX_RATE].price = (1000 *
(currentGame.maxPlasmaRate + 1)); (game.maxPlasmaRate + 1));
shopItems[SHOP_PLASMA_MIN_OUTPUT].price = (1500 * shopItems[SHOP_PLASMA_MIN_OUTPUT].price = (1500 *
(currentGame.minPlasmaOutput + 1)); (game.minPlasmaOutput + 1));
shopItems[SHOP_PLASMA_MIN_DAMAGE].price = (1500 * shopItems[SHOP_PLASMA_MIN_DAMAGE].price = (1500 *
(currentGame.minPlasmaDamage + 1)); (game.minPlasmaDamage + 1));
shopItems[SHOP_PLASMA_MIN_RATE].price = (1500 * shopItems[SHOP_PLASMA_MIN_RATE].price = (1500 *
(currentGame.minPlasmaRate + 1)); (game.minPlasmaRate + 1));
} }
if (currentGame.maxPlasmaOutput <= currentGame.minPlasmaOutput) if (game.maxPlasmaOutput <= game.minPlasmaOutput)
shopItems[SHOP_PLASMA_MIN_OUTPUT].price += shopItems[SHOP_PLASMA_MAX_OUTPUT].price; shopItems[SHOP_PLASMA_MIN_OUTPUT].price += shopItems[SHOP_PLASMA_MAX_OUTPUT].price;
if (currentGame.maxPlasmaDamage <= currentGame.minPlasmaDamage) if (game.maxPlasmaDamage <= game.minPlasmaDamage)
shopItems[SHOP_PLASMA_MIN_DAMAGE].price += shopItems[SHOP_PLASMA_MAX_DAMAGE].price; shopItems[SHOP_PLASMA_MIN_DAMAGE].price += shopItems[SHOP_PLASMA_MAX_DAMAGE].price;
if (currentGame.maxPlasmaRate <= currentGame.minPlasmaRate) if (game.maxPlasmaRate <= game.minPlasmaRate)
shopItems[SHOP_PLASMA_MIN_RATE].price += shopItems[SHOP_PLASMA_MAX_RATE].price; shopItems[SHOP_PLASMA_MIN_RATE].price += shopItems[SHOP_PLASMA_MAX_RATE].price;
shopItems[SHOP_PLASMA_MAX_AMMO].price = (10 * (currentGame.maxPlasmaAmmo - 75)); shopItems[SHOP_PLASMA_MAX_AMMO].price = (10 * (game.maxPlasmaAmmo - 75));
shopItems[SHOP_ROCKET_MAX_AMMO].price = (25 * currentGame.maxRocketAmmo); shopItems[SHOP_ROCKET_MAX_AMMO].price = (25 * game.maxRocketAmmo);
if (currentGame.maxPlasmaOutput >= currentGame.maxPlasmaOutputLimit) if (game.maxPlasmaOutput >= game.maxPlasmaOutputLimit)
shopItems[SHOP_PLASMA_MAX_OUTPUT].price = 0; shopItems[SHOP_PLASMA_MAX_OUTPUT].price = 0;
if (currentGame.maxPlasmaDamage >= currentGame.maxPlasmaDamageLimit) if (game.maxPlasmaDamage >= game.maxPlasmaDamageLimit)
shopItems[SHOP_PLASMA_MAX_DAMAGE].price = 0; shopItems[SHOP_PLASMA_MAX_DAMAGE].price = 0;
if (currentGame.maxPlasmaRate >= currentGame.maxPlasmaRateLimit) if (game.maxPlasmaRate >= game.maxPlasmaRateLimit)
shopItems[SHOP_PLASMA_MAX_RATE].price = 0; shopItems[SHOP_PLASMA_MAX_RATE].price = 0;
if (currentGame.minPlasmaOutput >= currentGame.minPlasmaOutputLimit) if (game.minPlasmaOutput >= game.minPlasmaOutputLimit)
shopItems[SHOP_PLASMA_MIN_OUTPUT].price = 0; shopItems[SHOP_PLASMA_MIN_OUTPUT].price = 0;
if (currentGame.minPlasmaDamage >= currentGame.minPlasmaDamageLimit) if (game.minPlasmaDamage >= game.minPlasmaDamageLimit)
shopItems[SHOP_PLASMA_MIN_DAMAGE].price = 0; shopItems[SHOP_PLASMA_MIN_DAMAGE].price = 0;
if (currentGame.minPlasmaRate >= currentGame.minPlasmaRateLimit) if (game.minPlasmaRate >= game.minPlasmaRateLimit)
shopItems[SHOP_PLASMA_MIN_RATE].price = 0; shopItems[SHOP_PLASMA_MIN_RATE].price = 0;
if (currentGame.maxPlasmaAmmo >= currentGame.maxPlasmaAmmoLimit) if (game.maxPlasmaAmmo >= game.maxPlasmaAmmoLimit)
shopItems[SHOP_PLASMA_MAX_AMMO].price = 0; shopItems[SHOP_PLASMA_MAX_AMMO].price = 0;
if (currentGame.maxRocketAmmo >= currentGame.maxRocketAmmoLimit) if (game.maxRocketAmmo >= game.maxRocketAmmoLimit)
shopItems[SHOP_ROCKET_MAX_AMMO].price = 0; shopItems[SHOP_ROCKET_MAX_AMMO].price = 0;
} }
@ -200,26 +200,26 @@ static void drawShop()
strcpy(description, ""); strcpy(description, "");
drawString("Primary Weapon", 10, 3, FONT_WHITE, shopSurface[0]); drawString("Primary Weapon", 10, 3, FONT_WHITE, shopSurface[0]);
sprintf(description, "Plasma Cannons : %d", currentGame.minPlasmaOutput); sprintf(description, "Plasma Cannons : %d", game.minPlasmaOutput);
drawString(description, 10, 22, FONT_WHITE, shopSurface[0]); drawString(description, 10, 22, FONT_WHITE, shopSurface[0]);
sprintf(description, "Plasma Power : Stage %d", sprintf(description, "Plasma Power : Stage %d",
currentGame.minPlasmaDamage); game.minPlasmaDamage);
drawString(description, 10, 37, FONT_WHITE, shopSurface[0]); drawString(description, 10, 37, FONT_WHITE, shopSurface[0]);
sprintf(description, "Cooler : Stage %d", sprintf(description, "Cooler : Stage %d",
currentGame.minPlasmaRate); game.minPlasmaRate);
drawString(description, 10, 52, FONT_WHITE, shopSurface[0]); drawString(description, 10, 52, FONT_WHITE, shopSurface[0]);
drawString("Powerup Weapon", 10, 3, FONT_WHITE, shopSurface[1]); drawString("Powerup Weapon", 10, 3, FONT_WHITE, shopSurface[1]);
sprintf(description, "Plasma Output : Stage %d", sprintf(description, "Plasma Output : Stage %d",
currentGame.maxPlasmaOutput); game.maxPlasmaOutput);
drawString(description, 10, 22, FONT_WHITE, shopSurface[1]); drawString(description, 10, 22, FONT_WHITE, shopSurface[1]);
sprintf(description, "Plasma Condensor : Stage %d", sprintf(description, "Plasma Condensor : Stage %d",
currentGame.maxPlasmaDamage); game.maxPlasmaDamage);
drawString(description, 10, 37, FONT_WHITE, shopSurface[1]); drawString(description, 10, 37, FONT_WHITE, shopSurface[1]);
sprintf(description, "Liquid Nitrogen : Stage %d", sprintf(description, "Liquid Nitrogen : Stage %d",
currentGame.maxPlasmaRate); game.maxPlasmaRate);
drawString(description, 10, 52, FONT_WHITE, shopSurface[1]); drawString(description, 10, 52, FONT_WHITE, shopSurface[1]);
sprintf(description, "Plasma Capacity : %d", currentGame.maxPlasmaAmmo); sprintf(description, "Plasma Capacity : %d", game.maxPlasmaAmmo);
drawString(description, 10, 67, FONT_WHITE, shopSurface[1]); drawString(description, 10, 67, FONT_WHITE, shopSurface[1]);
drawSecondaryWeaponSurface(); drawSecondaryWeaponSurface();
@ -237,11 +237,11 @@ static void drawShop()
signed char icons = MAX_SHOPITEMS; signed char icons = MAX_SHOPITEMS;
if (currentGame.system == 0) if (game.system == 0)
icons = SHOP_DOUBLE_ROCKETS + 1; icons = SHOP_DOUBLE_ROCKETS + 1;
else if (currentGame.system == 1) else if (game.system == 1)
icons = SHOP_LASER + 1; icons = SHOP_LASER + 1;
else if (currentGame.system == 2) else if (game.system == 2)
icons = SHOP_CHARGER + 1; icons = SHOP_CHARGER + 1;
for (int i = 0 ; i < icons ; i++) for (int i = 0 ; i < icons ; i++)
@ -252,7 +252,7 @@ static void drawShop()
sprintf(description, "Shield Units : %d", player.maxShield); sprintf(description, "Shield Units : %d", player.maxShield);
drawString(description, 10, 4, FONT_WHITE, shopSurface[4]); drawString(description, 10, 4, FONT_WHITE, shopSurface[4]);
sprintf(description, "Cash : $%d", currentGame.cash); sprintf(description, "Cash : $%d", game.cash);
drawString(description, 10, 80, FONT_WHITE, shopSurface[4]); drawString(description, 10, 80, FONT_WHITE, shopSurface[4]);
sprintf(description, "Plasma Cells : %.3d", player.ammo[0]); sprintf(description, "Plasma Cells : %.3d", player.ammo[0]);
drawString(description, 430, 4, FONT_WHITE, shopSurface[4]); drawString(description, 430, 4, FONT_WHITE, shopSurface[4]);
@ -526,7 +526,7 @@ static void shop_sellSecondaryWeapon()
static void buy(int i) static void buy(int i)
{ {
if ((currentGame.cash < shopItems[i].price) && (!engine.cheatCash)) if ((game.cash < shopItems[i].price) && (!engine.cheatCash))
{ {
shopSelectedItem = -2; shopSelectedItem = -2;
drawShop(); drawShop();
@ -536,39 +536,39 @@ static void buy(int i)
switch (i) switch (i)
{ {
case SHOP_PLASMA_MAX_OUTPUT: case SHOP_PLASMA_MAX_OUTPUT:
if (currentGame.maxPlasmaOutput >= currentGame.maxPlasmaOutputLimit) if (game.maxPlasmaOutput >= game.maxPlasmaOutputLimit)
{ {
shopSelectedItem = -3; shopSelectedItem = -3;
return; return;
} }
currentGame.maxPlasmaOutput++; game.maxPlasmaOutput++;
break; break;
case SHOP_PLASMA_MAX_DAMAGE: case SHOP_PLASMA_MAX_DAMAGE:
if (currentGame.maxPlasmaDamage >= currentGame.maxPlasmaDamageLimit) if (game.maxPlasmaDamage >= game.maxPlasmaDamageLimit)
{ {
shopSelectedItem = -3; shopSelectedItem = -3;
return; return;
} }
currentGame.maxPlasmaDamage++; game.maxPlasmaDamage++;
break; break;
case SHOP_PLASMA_MAX_RATE: case SHOP_PLASMA_MAX_RATE:
if (currentGame.maxPlasmaRate >= currentGame.maxPlasmaRateLimit) if (game.maxPlasmaRate >= game.maxPlasmaRateLimit)
{ {
shopSelectedItem = -3; shopSelectedItem = -3;
return; return;
} }
currentGame.maxPlasmaRate++; game.maxPlasmaRate++;
break; break;
case SHOP_PLASMA_AMMO: case SHOP_PLASMA_AMMO:
if (player.ammo[0] >= currentGame.maxPlasmaAmmo) if (player.ammo[0] >= game.maxPlasmaAmmo)
{ {
shopSelectedItem = -4; shopSelectedItem = -4;
return; return;
} }
LIMIT_ADD(player.ammo[0], 10, 0, currentGame.maxPlasmaAmmo); LIMIT_ADD(player.ammo[0], 10, 0, game.maxPlasmaAmmo);
break; break;
case SHOP_ROCKET_AMMO: case SHOP_ROCKET_AMMO:
@ -578,7 +578,7 @@ static void buy(int i)
shopSelectedItem = -7; shopSelectedItem = -7;
return; return;
} }
if (player.ammo[1] == currentGame.maxRocketAmmo) if (player.ammo[1] == game.maxRocketAmmo)
{ {
shopSelectedItem = -4; shopSelectedItem = -4;
return; return;
@ -605,45 +605,45 @@ static void buy(int i)
break; break;
case SHOP_PLASMA_MIN_OUTPUT: case SHOP_PLASMA_MIN_OUTPUT:
if (currentGame.minPlasmaOutput >= currentGame.minPlasmaOutputLimit) if (game.minPlasmaOutput >= game.minPlasmaOutputLimit)
{ {
shopSelectedItem = -3; shopSelectedItem = -3;
return; return;
} }
currentGame.minPlasmaOutput++; game.minPlasmaOutput++;
if (currentGame.maxPlasmaOutput < currentGame.minPlasmaOutput) if (game.maxPlasmaOutput < game.minPlasmaOutput)
currentGame.maxPlasmaOutput = currentGame.minPlasmaOutput; game.maxPlasmaOutput = game.minPlasmaOutput;
break; break;
case SHOP_PLASMA_MIN_DAMAGE: case SHOP_PLASMA_MIN_DAMAGE:
if (currentGame.minPlasmaDamage >= currentGame.minPlasmaDamageLimit) if (game.minPlasmaDamage >= game.minPlasmaDamageLimit)
{ {
shopSelectedItem = -3; shopSelectedItem = -3;
return; return;
} }
currentGame.minPlasmaDamage++; game.minPlasmaDamage++;
if (currentGame.maxPlasmaDamage < currentGame.minPlasmaDamage) if (game.maxPlasmaDamage < game.minPlasmaDamage)
currentGame.maxPlasmaDamage = currentGame.minPlasmaDamage; game.maxPlasmaDamage = game.minPlasmaDamage;
break; break;
case SHOP_PLASMA_MIN_RATE: case SHOP_PLASMA_MIN_RATE:
if (currentGame.minPlasmaRate >= currentGame.minPlasmaRateLimit) if (game.minPlasmaRate >= game.minPlasmaRateLimit)
{ {
shopSelectedItem = -3; shopSelectedItem = -3;
return; return;
} }
currentGame.minPlasmaRate++; game.minPlasmaRate++;
if (currentGame.maxPlasmaRate < currentGame.minPlasmaRate) if (game.maxPlasmaRate < game.minPlasmaRate)
currentGame.maxPlasmaRate = currentGame.minPlasmaRate; game.maxPlasmaRate = game.minPlasmaRate;
break; break;
case SHOP_PLASMA_MAX_AMMO: case SHOP_PLASMA_MAX_AMMO:
if (currentGame.maxPlasmaAmmo >= currentGame.maxPlasmaAmmoLimit) if (game.maxPlasmaAmmo >= game.maxPlasmaAmmoLimit)
{ {
shopSelectedItem = -3; shopSelectedItem = -3;
return; return;
} }
currentGame.maxPlasmaAmmo += 25; game.maxPlasmaAmmo += 25;
break; break;
case SHOP_ROCKET_MAX_AMMO: case SHOP_ROCKET_MAX_AMMO:
@ -654,29 +654,29 @@ static void buy(int i)
return; return;
} }
if ((player.weaponType[1] == W_HOMING_MISSILE) && if ((player.weaponType[1] == W_HOMING_MISSILE) &&
(currentGame.maxRocketAmmo >= maxHoming)) (game.maxRocketAmmo >= maxHoming))
{ {
shopSelectedItem = -9; shopSelectedItem = -9;
return; return;
} }
if ((player.weaponType[1] == W_DOUBLE_HOMING_MISSILES) && if ((player.weaponType[1] == W_DOUBLE_HOMING_MISSILES) &&
(currentGame.maxRocketAmmo >= maxDoubleHoming)) (game.maxRocketAmmo >= maxDoubleHoming))
{ {
shopSelectedItem = -9; shopSelectedItem = -9;
return; return;
} }
if ((player.weaponType[1] == W_MICRO_HOMING_MISSILES) && if ((player.weaponType[1] == W_MICRO_HOMING_MISSILES) &&
(currentGame.maxRocketAmmo >= maxMicroHoming)) (game.maxRocketAmmo >= maxMicroHoming))
{ {
shopSelectedItem = -9; shopSelectedItem = -9;
return; return;
} }
if (currentGame.maxRocketAmmo >= currentGame.maxRocketAmmoLimit) if (game.maxRocketAmmo >= game.maxRocketAmmoLimit)
{ {
shopSelectedItem = -3; shopSelectedItem = -3;
return; return;
} }
currentGame.maxRocketAmmo += 5; game.maxRocketAmmo += 5;
break; break;
case SHOP_DOUBLE_ROCKETS: case SHOP_DOUBLE_ROCKETS:
@ -687,7 +687,7 @@ static void buy(int i)
} }
shop_sellSecondaryWeapon(); shop_sellSecondaryWeapon();
player.weaponType[1] = W_DOUBLE_ROCKETS; player.weaponType[1] = W_DOUBLE_ROCKETS;
LIMIT(currentGame.maxRocketAmmo, 5, 50); LIMIT(game.maxRocketAmmo, 5, 50);
shopSelectedItem = -1; shopSelectedItem = -1;
break; break;
@ -699,7 +699,7 @@ static void buy(int i)
} }
shop_sellSecondaryWeapon(); shop_sellSecondaryWeapon();
player.weaponType[1] = W_MICRO_ROCKETS; player.weaponType[1] = W_MICRO_ROCKETS;
LIMIT(currentGame.maxRocketAmmo, 5, 50); LIMIT(game.maxRocketAmmo, 5, 50);
shopSelectedItem = -1; shopSelectedItem = -1;
break; break;
@ -712,7 +712,7 @@ static void buy(int i)
shop_sellSecondaryWeapon(); shop_sellSecondaryWeapon();
player.weaponType[1] = W_LASER; player.weaponType[1] = W_LASER;
while (currentGame.maxRocketAmmo > 5) while (game.maxRocketAmmo > 5)
sell(SHOP_ROCKET_MAX_AMMO); sell(SHOP_ROCKET_MAX_AMMO);
while (player.ammo[1] > 0) while (player.ammo[1] > 0)
sell(SHOP_ROCKET_AMMO); sell(SHOP_ROCKET_AMMO);
@ -729,10 +729,10 @@ static void buy(int i)
shop_sellSecondaryWeapon(); shop_sellSecondaryWeapon();
player.weaponType[1] = W_HOMING_MISSILE; player.weaponType[1] = W_HOMING_MISSILE;
while (currentGame.maxRocketAmmo > maxHoming) while (game.maxRocketAmmo > maxHoming)
sell(SHOP_ROCKET_MAX_AMMO); sell(SHOP_ROCKET_MAX_AMMO);
LIMIT(currentGame.maxRocketAmmo, 5, maxHoming); LIMIT(game.maxRocketAmmo, 5, maxHoming);
shopSelectedItem = -1; shopSelectedItem = -1;
break; break;
@ -745,7 +745,7 @@ static void buy(int i)
shop_sellSecondaryWeapon(); shop_sellSecondaryWeapon();
player.weaponType[1] = W_CHARGER; player.weaponType[1] = W_CHARGER;
while (currentGame.maxRocketAmmo > 5) while (game.maxRocketAmmo > 5)
sell(SHOP_ROCKET_MAX_AMMO); sell(SHOP_ROCKET_MAX_AMMO);
while (player.ammo[1] > 0) while (player.ammo[1] > 0)
sell(SHOP_ROCKET_AMMO); sell(SHOP_ROCKET_AMMO);
@ -762,10 +762,10 @@ static void buy(int i)
shop_sellSecondaryWeapon(); shop_sellSecondaryWeapon();
player.weaponType[1] = W_DOUBLE_HOMING_MISSILES; player.weaponType[1] = W_DOUBLE_HOMING_MISSILES;
while (currentGame.maxRocketAmmo > maxDoubleHoming) while (game.maxRocketAmmo > maxDoubleHoming)
sell(SHOP_ROCKET_MAX_AMMO); sell(SHOP_ROCKET_MAX_AMMO);
LIMIT(currentGame.maxRocketAmmo, 5, maxDoubleHoming); LIMIT(game.maxRocketAmmo, 5, maxDoubleHoming);
shopSelectedItem = -1; shopSelectedItem = -1;
break; break;
@ -778,16 +778,16 @@ static void buy(int i)
shop_sellSecondaryWeapon(); shop_sellSecondaryWeapon();
player.weaponType[1] = W_MICRO_HOMING_MISSILES; player.weaponType[1] = W_MICRO_HOMING_MISSILES;
while (currentGame.maxRocketAmmo > maxMicroHoming) while (game.maxRocketAmmo > maxMicroHoming)
sell(SHOP_ROCKET_MAX_AMMO); sell(SHOP_ROCKET_MAX_AMMO);
LIMIT(currentGame.maxRocketAmmo, 5, maxMicroHoming); LIMIT(game.maxRocketAmmo, 5, maxMicroHoming);
shopSelectedItem = -1; shopSelectedItem = -1;
break; break;
} }
if (!engine.cheatCash) if (!engine.cheatCash)
currentGame.cash -= shopItems[i].price; game.cash -= shopItems[i].price;
saveGame(0); saveGame(0);
} }
@ -796,87 +796,87 @@ static void sell(int i)
switch (i) switch (i)
{ {
case SHOP_PLASMA_MAX_OUTPUT: case SHOP_PLASMA_MAX_OUTPUT:
if (currentGame.maxPlasmaOutput <= 1) if (game.maxPlasmaOutput <= 1)
{ {
shopSelectedItem = -5; shopSelectedItem = -5;
return; return;
} }
while (currentGame.minPlasmaOutput >= currentGame.maxPlasmaOutput) while (game.minPlasmaOutput >= game.maxPlasmaOutput)
sell(SHOP_PLASMA_MIN_OUTPUT); sell(SHOP_PLASMA_MIN_OUTPUT);
currentGame.maxPlasmaOutput--; game.maxPlasmaOutput--;
if (weapon[W_PLAYER_WEAPON].ammo[0] <= currentGame.maxPlasmaOutput + 1) if (weapon[W_PLAYER_WEAPON].ammo[0] <= game.maxPlasmaOutput + 1)
weapon[W_PLAYER_WEAPON].ammo[0] = MIN( weapon[W_PLAYER_WEAPON].ammo[0] = MIN(
weapon[W_PLAYER_WEAPON].ammo[0], weapon[W_PLAYER_WEAPON].ammo[0],
currentGame.maxPlasmaOutput); game.maxPlasmaOutput);
break; break;
case SHOP_PLASMA_MAX_DAMAGE: case SHOP_PLASMA_MAX_DAMAGE:
if (currentGame.maxPlasmaDamage <= 1) if (game.maxPlasmaDamage <= 1)
{ {
shopSelectedItem = -5; shopSelectedItem = -5;
return; return;
} }
while (currentGame.minPlasmaDamage >= currentGame.maxPlasmaDamage) while (game.minPlasmaDamage >= game.maxPlasmaDamage)
sell(SHOP_PLASMA_MIN_DAMAGE); sell(SHOP_PLASMA_MIN_DAMAGE);
currentGame.maxPlasmaDamage--; game.maxPlasmaDamage--;
if (weapon[W_PLAYER_WEAPON].damage <= currentGame.maxPlasmaDamage + 1) if (weapon[W_PLAYER_WEAPON].damage <= game.maxPlasmaDamage + 1)
weapon[W_PLAYER_WEAPON].damage = MIN( weapon[W_PLAYER_WEAPON].damage = MIN(
weapon[W_PLAYER_WEAPON].damage, weapon[W_PLAYER_WEAPON].damage,
currentGame.maxPlasmaDamage); game.maxPlasmaDamage);
break; break;
case SHOP_PLASMA_MAX_RATE: case SHOP_PLASMA_MAX_RATE:
if (currentGame.maxPlasmaRate <= 1) if (game.maxPlasmaRate <= 1)
{ {
shopSelectedItem = -5; shopSelectedItem = -5;
return; return;
} }
while (currentGame.minPlasmaRate >= currentGame.maxPlasmaRate) while (game.minPlasmaRate >= game.maxPlasmaRate)
sell(SHOP_PLASMA_MIN_RATE); sell(SHOP_PLASMA_MIN_RATE);
currentGame.maxPlasmaRate--; game.maxPlasmaRate--;
if (weapon[W_PLAYER_WEAPON].reload[0] >= rate2reload[currentGame.maxPlasmaRate + 1]) if (weapon[W_PLAYER_WEAPON].reload[0] >= rate2reload[game.maxPlasmaRate + 1])
weapon[W_PLAYER_WEAPON].reload[0] = MAX( weapon[W_PLAYER_WEAPON].reload[0] = MAX(
weapon[W_PLAYER_WEAPON].reload[0], weapon[W_PLAYER_WEAPON].reload[0],
rate2reload[currentGame.maxPlasmaRate]); rate2reload[game.maxPlasmaRate]);
break; break;
case SHOP_PLASMA_MIN_OUTPUT: case SHOP_PLASMA_MIN_OUTPUT:
if (currentGame.minPlasmaOutput <= 1) if (game.minPlasmaOutput <= 1)
{ {
shopSelectedItem = -5; shopSelectedItem = -5;
return; return;
} }
currentGame.minPlasmaOutput--; game.minPlasmaOutput--;
if (player.ammo[0] <= 0) if (player.ammo[0] <= 0)
weapon[W_PLAYER_WEAPON].ammo[0] = currentGame.minPlasmaOutput; weapon[W_PLAYER_WEAPON].ammo[0] = game.minPlasmaOutput;
break; break;
case SHOP_PLASMA_MIN_DAMAGE: case SHOP_PLASMA_MIN_DAMAGE:
if (currentGame.minPlasmaDamage <= 1) if (game.minPlasmaDamage <= 1)
{ {
shopSelectedItem = -5; shopSelectedItem = -5;
return; return;
} }
currentGame.minPlasmaDamage--; game.minPlasmaDamage--;
if (player.ammo[0] <= 0) if (player.ammo[0] <= 0)
weapon[W_PLAYER_WEAPON].damage = currentGame.minPlasmaDamage; weapon[W_PLAYER_WEAPON].damage = game.minPlasmaDamage;
break; break;
case SHOP_PLASMA_MIN_RATE: case SHOP_PLASMA_MIN_RATE:
if (currentGame.minPlasmaRate <= 1) if (game.minPlasmaRate <= 1)
{ {
shopSelectedItem = -5; shopSelectedItem = -5;
return; return;
} }
currentGame.minPlasmaRate--; game.minPlasmaRate--;
if (player.ammo[0] <= 0) if (player.ammo[0] <= 0)
weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[currentGame.minPlasmaRate]; weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[game.minPlasmaRate];
break; break;
case SHOP_PLASMA_AMMO: case SHOP_PLASMA_AMMO:
@ -890,9 +890,9 @@ static void sell(int i)
else else
{ {
player.ammo[0] = 0; player.ammo[0] = 0;
weapon[W_PLAYER_WEAPON].ammo[0] = currentGame.minPlasmaOutput; weapon[W_PLAYER_WEAPON].ammo[0] = game.minPlasmaOutput;
weapon[W_PLAYER_WEAPON].damage = currentGame.minPlasmaDamage; weapon[W_PLAYER_WEAPON].damage = game.minPlasmaDamage;
weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[currentGame.minPlasmaRate]; weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[game.minPlasmaRate];
} }
break; break;
@ -906,27 +906,27 @@ static void sell(int i)
break; break;
case SHOP_PLASMA_MAX_AMMO: case SHOP_PLASMA_MAX_AMMO:
if (currentGame.maxPlasmaAmmo <= 100) if (game.maxPlasmaAmmo <= 100)
{ {
shopSelectedItem = -1; shopSelectedItem = -1;
return; return;
} }
currentGame.maxPlasmaAmmo -= 25; game.maxPlasmaAmmo -= 25;
while (player.ammo[0] > currentGame.maxPlasmaAmmo) while (player.ammo[0] > game.maxPlasmaAmmo)
sell(SHOP_PLASMA_AMMO); sell(SHOP_PLASMA_AMMO);
break; break;
case SHOP_ROCKET_MAX_AMMO: case SHOP_ROCKET_MAX_AMMO:
if (currentGame.maxRocketAmmo <= 5) if (game.maxRocketAmmo <= 5)
{ {
shopSelectedItem = -1; shopSelectedItem = -1;
return; return;
} }
currentGame.maxRocketAmmo -= 5; game.maxRocketAmmo -= 5;
while (player.ammo[1] > currentGame.maxRocketAmmo) while (player.ammo[1] > game.maxRocketAmmo)
sell(SHOP_ROCKET_AMMO); sell(SHOP_ROCKET_AMMO);
break; break;
@ -1005,7 +1005,7 @@ static void sell(int i)
} }
adjustShopPrices(); adjustShopPrices();
currentGame.cash += shopItems[i].price; game.cash += shopItems[i].price;
saveGame(0); saveGame(0);
} }
@ -1028,11 +1028,11 @@ void showShop()
signed char icons = MAX_SHOPITEMS; signed char icons = MAX_SHOPITEMS;
if (currentGame.system == 0) if (game.system == 0)
icons = SHOP_DOUBLE_ROCKETS + 1; icons = SHOP_DOUBLE_ROCKETS + 1;
else if (currentGame.system == 1) else if (game.system == 1)
icons = SHOP_LASER + 1; icons = SHOP_LASER + 1;
else if (currentGame.system == 2) else if (game.system == 2)
icons = SHOP_CHARGER + 1; icons = SHOP_CHARGER + 1;
if ((engine.keyState[KEY_FIRE])) if ((engine.keyState[KEY_FIRE]))

View File

@ -330,11 +330,4 @@ struct cutMsg {
}; };
struct devVariables {
int moveAliens;
int fireAliens;
};
#endif #endif

View File

@ -67,13 +67,13 @@ static void createDifficultyMenu()
{ {
textSurface(TS_START_GAME, "START GAME", -1, 350, FONT_WHITE); textSurface(TS_START_GAME, "START GAME", -1, 350, FONT_WHITE);
if (currentGame.difficulty == DIFFICULTY_EASY) if (game.difficulty == DIFFICULTY_EASY)
textSurface(TS_DIFFICULTY, "DIFFICULTY - EASY", -1, 370, FONT_WHITE); textSurface(TS_DIFFICULTY, "DIFFICULTY - EASY", -1, 370, FONT_WHITE);
else if (currentGame.difficulty == DIFFICULTY_HARD) else if (game.difficulty == DIFFICULTY_HARD)
textSurface(TS_DIFFICULTY, "DIFFICULTY - HARD", -1, 370, FONT_WHITE); textSurface(TS_DIFFICULTY, "DIFFICULTY - HARD", -1, 370, FONT_WHITE);
else if (currentGame.difficulty == DIFFICULTY_NIGHTMARE) else if (game.difficulty == DIFFICULTY_NIGHTMARE)
textSurface(TS_DIFFICULTY, "DIFFICULTY - NIGHTMARE!", -1, 370, FONT_WHITE); textSurface(TS_DIFFICULTY, "DIFFICULTY - NIGHTMARE!", -1, 370, FONT_WHITE);
else if (currentGame.difficulty == DIFFICULTY_ORIGINAL) else if (game.difficulty == DIFFICULTY_ORIGINAL)
textSurface(TS_DIFFICULTY, "DIFFICULTY - ORIGINAL", -1, 370, FONT_WHITE); textSurface(TS_DIFFICULTY, "DIFFICULTY - ORIGINAL", -1, 370, FONT_WHITE);
else else
textSurface(TS_DIFFICULTY, "DIFFICULTY - NORMAL", -1, 370, FONT_WHITE); textSurface(TS_DIFFICULTY, "DIFFICULTY - NORMAL", -1, 370, FONT_WHITE);
@ -170,7 +170,7 @@ This is the main title screen, with the stars whirling past and the
*/ */
int doTitle() int doTitle()
{ {
newGame(); game_init();
engine.gameSection = SECTION_TITLE; engine.gameSection = SECTION_TITLE;
@ -179,8 +179,8 @@ int doTitle()
resetLists(); resetLists();
// required to stop the title screen crashing // required to stop the title screen crashing
currentGame.system = 0; game.system = 0;
currentGame.area = MISN_START; game.area = MISN_START;
loadGameGraphics(); loadGameGraphics();
@ -431,8 +431,8 @@ int doTitle()
engine.done = 1; engine.done = 1;
else if (selectedOption == 2) else if (selectedOption == 2)
{ {
currentGame.difficulty++; game.difficulty++;
currentGame.difficulty %= DIFFICULTY_MAX; game.difficulty %= DIFFICULTY_MAX;
} }
else if (selectedOption == listLength) else if (selectedOption == listLength)
{ {
@ -528,13 +528,13 @@ int doTitle()
if (selectedOption == 1) if (selectedOption == 1)
{ {
newGame(); game_init();
selectedOption = 2; // go straight to mission 0 selectedOption = 2; // go straight to mission 0
} }
if (selectedOption == 3) if (selectedOption == 3)
{ {
newGame(); game_init();
selectedOption = loadGame(continueSaveSlot); selectedOption = loadGame(continueSaveSlot);
} }