diff --git a/src/Starfighter.cpp b/src/Starfighter.cpp index 6c5d099..c088847 100644 --- a/src/Starfighter.cpp +++ b/src/Starfighter.cpp @@ -52,16 +52,6 @@ int main(int argc, char **argv) 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) cheatAttempt = true; 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... section = 0; - currentGame.difficulty = DIFFICULTY_NORMAL; - newGame(); + game.difficulty = DIFFICULTY_NORMAL; + game_init(); while (true) { @@ -136,9 +126,9 @@ int main(int argc, char **argv) break; case 2: - if (currentGame.stationedPlanet == -1) + if (game.stationedPlanet == -1) doCutscene(0); - section = mainGameLoop(); + section = game_mainLoop(); break; } } diff --git a/src/alien.cpp b/src/alien.cpp index 55aa664..2d2f8a7 100644 --- a/src/alien.cpp +++ b/src/alien.cpp @@ -703,7 +703,7 @@ void aliens_init() strcpy(string, ""); barrierSpeed = 1; - sprintf(string, "data/aliens%d.dat", currentGame.area); + sprintf(string, "data/aliens%d.dat", game.area); fp = fopen(string, "rb"); if (fp != NULL) @@ -735,9 +735,9 @@ void aliens_init() showErrorAndExit(2, ""); } - if (currentGame.area == MISN_CERADSE) + if (game.area == MISN_CERADSE) cargo_add(&aliens[index], P_CARGO); - else if (currentGame.area == MISN_NEROD) + else if (game.area == MISN_NEROD) cargo_add(&aliens[index], P_PHOEBE); if (index == ALIEN_KLINE) @@ -770,17 +770,17 @@ void aliens_init() barrierSpeed++; } - if ((currentGame.area == MISN_POSWIC) && + if ((game.area == MISN_POSWIC) && (aliens[index].classDef == CD_BOSS)) { aliens[index].imageIndex[1] = 29; aliens[index].flags |= FL_IMMORTAL; } - if (currentGame.area == MISN_ELLESH) + if (game.area == MISN_ELLESH) aliens[index].flags |= FL_HASMINIMUMSPEED; - if (currentGame.area == MISN_JUPITER) + if (game.area == MISN_JUPITER) { aliens[index].flags = FL_WEAPCO; if (index == ALIEN_BOSS) @@ -790,7 +790,7 @@ void aliens_init() fclose(fp); - if (currentGame.area == MISN_MOEBO) + if (game.area == MISN_MOEBO) { aliens[ALIEN_BOSS].target = &player; aliens[ALIEN_BOSS].x = -screen->w / 2; @@ -806,8 +806,8 @@ void aliens_init() aliens[ALIEN_BOSS_PART2].dx = -20; aliens[ALIEN_BOSS_PART2].dy = 37; } - else if ((currentGame.area == MISN_ELAMALE) || - (currentGame.area == MISN_FELLON)) + else if ((game.area == MISN_ELAMALE) || + (game.area == MISN_FELLON)) { aliens[ALIEN_BOSS].target = &player; aliens[ALIEN_BOSS].x = -screen->w / 2; @@ -833,7 +833,7 @@ void aliens_init() aliens[ALIEN_BOSS_PART4].dx = -35; aliens[ALIEN_BOSS_PART4].dy = 20; - if (currentGame.area == MISN_FELLON) + if (game.area == MISN_FELLON) { 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].x = -screen->w / 2; @@ -866,8 +866,8 @@ bool alien_add() { int index = alien_getFreeIndex(); - if ((index == -1) || (currentGame.area == MISN_JUPITER) || - (currentGame.area == MISN_VENUS)) + if ((index == -1) || (game.area == MISN_JUPITER) || + (game.area == MISN_VENUS)) return 0; signed char *alienArray; @@ -875,7 +875,7 @@ bool alien_add() alienArray = new signed char[8]; - switch(currentGame.area) + switch(game.area) { case MISN_START: case MISN_HINSTAG: @@ -952,7 +952,7 @@ bool alien_add() alienArray[0] = CD_DUALFIGHTER; alienArray[1] = CD_MISSILEBOAT; alienArray[2] = CD_AIMFIGHTER; - if (currentGame.system == 2) + if (game.system == 2) { numberOfAliens = 4; alienArray[3] = CD_PROTOFIGHTER; @@ -966,11 +966,11 @@ bool alien_add() signed char randEnemy = alienArray[rand() % numberOfAliens]; - if ((currentGame.area != MISN_DORIM) && - (currentGame.area != MISN_SIVEDI) && - (currentGame.area != MISN_MARS)) + if ((game.area != MISN_DORIM) && + (game.area != MISN_SIVEDI) && + (game.area != MISN_MARS)) { - if ((currentGame.system == 1) && (currentGame.area == MISN_INTERCEPTION)) + if ((game.system == 1) && (game.area == MISN_INTERCEPTION)) { if ((rand() % 5) == 0) randEnemy = CD_SLAVETRANSPORT; @@ -1018,7 +1018,7 @@ bool alien_add() aliens[index].ammo[0] = 0; - if (currentGame.area == MISN_ELLESH) + if (game.area == MISN_ELLESH) aliens[index].flags |= FL_HASMINIMUMSPEED; return true; @@ -1107,7 +1107,7 @@ void alien_addFriendly(int type) aliens[type].classDef = CD_URSULA; // For the sake of it being the final battle :) - if (currentGame.area == MISN_EARTH) + if (game.area == MISN_EARTH) aliens[type].flags |= FL_IMMORTAL; } @@ -1123,7 +1123,7 @@ bool alien_place(object *alien) else alien->y = RANDRANGE(-screen->h, 0); - if (currentGame.area == MISN_MARS) + if (game.area == MISN_MARS) { alien->x = screen->w + RANDRANGE(0, 400); alien->y = RANDRANGE(-screen->h / 3, (4 * screen->h) / 3); @@ -1261,7 +1261,7 @@ void alien_setKlineAI(object *alien) // Weapon type change if ((rand() % 3) == 0) { - if (currentGame.area != MISN_VENUS) + if (game.area != MISN_VENUS) { alien->flags &= ~FL_AIMS; @@ -1295,7 +1295,7 @@ void alien_setKlineAI(object *alien) case 2: // Kline only attacks then he is ready! if ((!(alien->flags & FL_NOFIRE)) && - (currentGame.area == MISN_MOEBO)) + (game.area == MISN_MOEBO)) alien->flags |= FL_DROPMINES; break; case 3: @@ -1333,14 +1333,14 @@ void alien_searchForTarget(object *alien) // 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) - 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))) return; } // 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)) { @@ -1548,12 +1548,12 @@ void alien_destroy(object *alien, object *attacker) if (alien->flags & FL_FRIEND) { if (alien->classDef == CD_PHOEBE) - currentGame.wingMate1Ejects++; + game.wingMate1Ejects++; else if (alien->classDef == CD_URSULA) - currentGame.wingMate2Ejects++; + game.wingMate2Ejects++; // 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)) setInfoLine(">> Ally has ejected! <<\n", FONT_RED); @@ -1566,19 +1566,19 @@ void alien_destroy(object *alien, object *attacker) { if (attacker == &player) { - currentGame.totalKills++; + game.totalKills++; } else if (attacker->classDef == CD_PHOEBE) { - currentGame.wingMate1Kills++; + game.wingMate1Kills++; } else if (attacker->classDef == CD_URSULA) { - currentGame.wingMate2Kills++; + game.wingMate2Kills++; } else { - currentGame.totalOtherKills++; + game.totalOtherKills++; } 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 (currentGame.area == MISN_ELAMALE) + if (game.area == MISN_ELAMALE) { if ((alien->shield <= alien->maxShield - 500) && !(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); } } - else if (currentGame.area == MISN_EARTH) + else if (game.area == MISN_EARTH) { if ((alien->shield <= alien->maxShield - 750) && !(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); } } - else if (currentGame.area == MISN_VENUS) + else if (game.area == MISN_VENUS) { if (alien->shield + damage > 1500 && alien->shield <= 1500) diff --git a/src/audio.cpp b/src/audio.cpp index cac2f9f..8bfcf68 100644 --- a/src/audio.cpp +++ b/src/audio.cpp @@ -153,7 +153,7 @@ void audio_playRandomTrack() "music/frozen_jam.ogg", "music/sound_and_silence.ogg" }; - switch(currentGame.area) + switch(game.area) { case MISN_START: audio_playMusic("music/railjet_short.ogg", -1); diff --git a/src/bullet.cpp b/src/bullet.cpp index 4cfcf9b..c04087c 100644 --- a/src/bullet.cpp +++ b/src/bullet.cpp @@ -28,7 +28,7 @@ void bullet_add(object *theWeapon, object *attacker, int y, int dy) bullet = new object; if (attacker == &player) - currentGame.shots++; + game.shots++; bullet->next = NULL; bullet->active = true; @@ -45,8 +45,8 @@ void bullet_add(object *theWeapon, object *attacker, int y, int dy) if (attacker->face == 0) { bullet->dx = theWeapon->speed; - if ((currentGame.area == MISN_ELLESH) || - (currentGame.area == MISN_MARS)) + if ((game.area == MISN_ELLESH) || + (game.area == MISN_MARS)) bullet->dx += fabsf(engine.ssx + engine.smx); } else diff --git a/src/collectable.cpp b/src/collectable.cpp index 19ae2cc..cf0c155 100644 --- a/src/collectable.cpp +++ b/src/collectable.cpp @@ -50,13 +50,13 @@ void collectable_add(float x, float y, int type, int value, int life) { type = P_PLASMA_RATE; - if ((currentGame.difficulty == DIFFICULTY_NIGHTMARE) || - ((currentGame.difficulty != DIFFICULTY_EASY) && - (currentGame.difficulty != DIFFICULTY_ORIGINAL) && - ((currentGame.area == MISN_MOEBO) || - (currentGame.area == MISN_ELAMALE) || - (currentGame.area == MISN_ELLESH) || - (currentGame.area == MISN_EARTH)))) + if ((game.difficulty == DIFFICULTY_NIGHTMARE) || + ((game.difficulty != DIFFICULTY_EASY) && + (game.difficulty != DIFFICULTY_ORIGINAL) && + ((game.area == MISN_MOEBO) || + (game.area == MISN_ELAMALE) || + (game.area == MISN_ELLESH) || + (game.area == MISN_EARTH)))) { // Deny the Super Charge in Nightmare difficulty, and on bosses. 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. if (type == P_PLASMA_AMMO) { - if ((weapon[W_PLAYER_WEAPON].reload[0] >= rate2reload[currentGame.minPlasmaRate]) && - (weapon[W_PLAYER_WEAPON].ammo[0] <= currentGame.minPlasmaOutput) && - (weapon[W_PLAYER_WEAPON].damage <= currentGame.minPlasmaDamage)) + if ((weapon[W_PLAYER_WEAPON].reload[0] >= rate2reload[game.minPlasmaRate]) && + (weapon[W_PLAYER_WEAPON].ammo[0] <= game.minPlasmaOutput) && + (weapon[W_PLAYER_WEAPON].damage <= game.minPlasmaDamage)) { 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. if (type == P_SHIELD) { - if (currentGame.difficulty == DIFFICULTY_NIGHTMARE) + if (game.difficulty == DIFFICULTY_NIGHTMARE) { 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, // just not as much. - if ((currentGame.area == MISN_INTERCEPTION) && (type == P_CASH)) + if ((game.area == MISN_INTERCEPTION) && (type == P_CASH)) { if (rand() % 10 > 0) return; @@ -124,7 +124,7 @@ void collectable_add(float x, float y, int type, int value, int life) else { // 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))) { return; diff --git a/src/game.cpp b/src/game.cpp index e11d50d..ab27195 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -19,14 +19,14 @@ along with this program. If not, see . #include "Starfighter.h" -Game currentGame; +Game game; -void newGame() +void game_init() { - currentGame.system = 0; - currentGame.area = MISN_START; - currentGame.sfxVolume = 0; - currentGame.musicVolume = 0; + game.system = 0; + game.area = MISN_START; + game.sfxVolume = 0; + game.musicVolume = 0; if (!engine.useAudio) { @@ -34,99 +34,99 @@ void newGame() engine.useMusic = false; } - currentGame.cash = 0; - currentGame.cashEarned = 0; - currentGame.shots = 0; - currentGame.hits = 0; - currentGame.accuracy = 0; - currentGame.totalKills = currentGame.wingMate1Kills = currentGame.wingMate2Kills = 0; - currentGame.totalOtherKills = 0; - currentGame.hasWingMate1 = currentGame.hasWingMate2 = 0; - currentGame.wingMate1Ejects = currentGame.wingMate2Ejects = 0; - currentGame.secondaryMissions = currentGame.secondaryMissionsCompleted = 0; - currentGame.shieldPickups = currentGame.rocketPickups = currentGame.cellPickups = 0; - currentGame.powerups = currentGame.minesKilled = currentGame.cargoPickups = 0; + game.cash = 0; + game.cashEarned = 0; + game.shots = 0; + game.hits = 0; + game.accuracy = 0; + game.totalKills = game.wingMate1Kills = game.wingMate2Kills = 0; + game.totalOtherKills = 0; + game.hasWingMate1 = game.hasWingMate2 = 0; + game.wingMate1Ejects = game.wingMate2Ejects = 0; + game.secondaryMissions = game.secondaryMissionsCompleted = 0; + game.shieldPickups = game.rocketPickups = game.cellPickups = 0; + game.powerups = game.minesKilled = game.cargoPickups = 0; - currentGame.slavesRescued = 0; - currentGame.experimentalShield = 1000; + game.slavesRescued = 0; + game.experimentalShield = 1000; - currentGame.timeTaken = 0; + game.timeTaken = 0; - currentGame.stationedPlanet = -1; - currentGame.destinationPlanet = -1; + game.stationedPlanet = -1; + game.destinationPlanet = -1; for (int i = 0 ; i < 10 ; i++) - currentGame.missionCompleted[i] = 0; - currentGame.distanceCovered = 0; + game.missionCompleted[i] = 0; + game.distanceCovered = 0; - currentGame.minPlasmaRate = 1; - currentGame.minPlasmaOutput = 1; - currentGame.minPlasmaDamage = 1; - currentGame.maxPlasmaRate = 2; - currentGame.maxPlasmaOutput = 2; - currentGame.maxPlasmaDamage = 2; - currentGame.maxPlasmaAmmo = 100; - currentGame.maxRocketAmmo = 10; + game.minPlasmaRate = 1; + game.minPlasmaOutput = 1; + game.minPlasmaDamage = 1; + game.maxPlasmaRate = 2; + game.maxPlasmaOutput = 2; + game.maxPlasmaDamage = 2; + game.maxPlasmaAmmo = 100; + game.maxRocketAmmo = 10; - currentGame.minPlasmaRateLimit = 2; - currentGame.minPlasmaDamageLimit = 2; - currentGame.minPlasmaOutputLimit = 2; - currentGame.maxPlasmaRateLimit = 3; - currentGame.maxPlasmaDamageLimit = 3; - currentGame.maxPlasmaOutputLimit = 3; - currentGame.maxPlasmaAmmoLimit = 250; - currentGame.maxRocketAmmoLimit = 50; + game.minPlasmaRateLimit = 2; + game.minPlasmaDamageLimit = 2; + game.minPlasmaOutputLimit = 2; + game.maxPlasmaRateLimit = 3; + game.maxPlasmaDamageLimit = 3; + game.maxPlasmaOutputLimit = 3; + game.maxPlasmaAmmoLimit = 250; + game.maxRocketAmmoLimit = 50; player.maxShield = 50; - switch (currentGame.difficulty) + switch (game.difficulty) { case DIFFICULTY_EASY: player.maxShield = 100; - currentGame.minPlasmaRate = 2; - currentGame.minPlasmaOutput = 2; - currentGame.minPlasmaDamage = 2; - currentGame.maxPlasmaRate = 3; - currentGame.maxPlasmaOutput = 3; - currentGame.maxPlasmaDamage = 3; - currentGame.maxPlasmaAmmo = 150; - currentGame.maxRocketAmmo = 20; + game.minPlasmaRate = 2; + game.minPlasmaOutput = 2; + game.minPlasmaDamage = 2; + game.maxPlasmaRate = 3; + game.maxPlasmaOutput = 3; + game.maxPlasmaDamage = 3; + game.maxPlasmaAmmo = 150; + game.maxRocketAmmo = 20; - currentGame.minPlasmaRateLimit = 3; - currentGame.minPlasmaDamageLimit = 3; - currentGame.minPlasmaOutputLimit = 3; - currentGame.maxPlasmaRateLimit = 5; - currentGame.maxPlasmaDamageLimit = 5; - currentGame.maxPlasmaOutputLimit = 5; + game.minPlasmaRateLimit = 3; + game.minPlasmaDamageLimit = 3; + game.minPlasmaOutputLimit = 3; + game.maxPlasmaRateLimit = 5; + game.maxPlasmaDamageLimit = 5; + game.maxPlasmaOutputLimit = 5; break; case DIFFICULTY_HARD: player.maxShield = 25; break; case DIFFICULTY_NIGHTMARE: player.maxShield = 1; - currentGame.maxRocketAmmo = 5; + game.maxRocketAmmo = 5; break; case DIFFICULTY_ORIGINAL: player.maxShield = 25; - currentGame.minPlasmaRateLimit = 3; - currentGame.minPlasmaDamageLimit = 3; - currentGame.minPlasmaOutputLimit = 3; - currentGame.maxPlasmaRateLimit = 5; - currentGame.maxPlasmaDamageLimit = 5; - currentGame.maxPlasmaOutputLimit = 5; + game.minPlasmaRateLimit = 3; + game.minPlasmaDamageLimit = 3; + game.minPlasmaOutputLimit = 3; + game.maxPlasmaRateLimit = 5; + game.maxPlasmaDamageLimit = 5; + game.maxPlasmaOutputLimit = 5; break; } player.shield = player.maxShield; player.ammo[0] = 0; - player.ammo[1] = currentGame.maxRocketAmmo / 2; + player.ammo[1] = game.maxRocketAmmo / 2; player.weaponType[0] = W_PLAYER_WEAPON; player.weaponType[1] = W_ROCKETS; initWeapons(); initMissions(); - initPlanetMissions(currentGame.system); + initPlanetMissions(game.system); } static void game_addDebris(int x, int y, int amount) @@ -203,18 +203,18 @@ static void game_doCollectables() switch(collectable->type) { case P_CASH: - if (currentGame.difficulty == DIFFICULTY_ORIGINAL) + if (game.difficulty == DIFFICULTY_ORIGINAL) collectable->value *= 2; - currentGame.cash += collectable->value; - currentGame.cashEarned += collectable->value; + game.cash += collectable->value; + game.cashEarned += collectable->value; sprintf(temp, "Got $%d ", collectable->value); break; case P_ROCKET: LIMIT_ADD(player.ammo[1], collectable->value, 0, - currentGame.maxRocketAmmo); - if (player.ammo[1] == currentGame.maxRocketAmmo) + game.maxRocketAmmo); + if (player.ammo[1] == game.maxRocketAmmo) sprintf(temp, "Rocket Ammo at Maximum"); else { @@ -223,27 +223,27 @@ static void game_doCollectables() else sprintf(temp, "Got a rocket"); } - currentGame.rocketPickups += collectable->value; + game.rocketPickups += collectable->value; break; case P_SHIELD: LIMIT_ADD(player.shield, 10, 0, player.maxShield); - currentGame.shieldPickups ++; + game.shieldPickups ++; sprintf(temp, "Restored 10 shield points"); break; case P_PLASMA_RATE: - currentGame.powerups++; - if ((currentGame.area != MISN_INTERCEPTION) || - (currentGame.difficulty == DIFFICULTY_ORIGINAL) || + game.powerups++; + if ((game.area != MISN_INTERCEPTION) || + (game.difficulty == DIFFICULTY_ORIGINAL) || (player.ammo[0] > 0)) { - if ((currentGame.area != MISN_INTERCEPTION) || - (currentGame.difficulty == DIFFICULTY_ORIGINAL)) + if ((game.area != MISN_INTERCEPTION) || + (game.difficulty == DIFFICULTY_ORIGINAL)) 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"); else { @@ -258,17 +258,17 @@ static void game_doCollectables() break; case P_PLASMA_SHOT: - currentGame.powerups++; - if ((currentGame.area != MISN_INTERCEPTION) || - (currentGame.difficulty == DIFFICULTY_ORIGINAL) || + game.powerups++; + if ((game.area != MISN_INTERCEPTION) || + (game.difficulty == DIFFICULTY_ORIGINAL) || (player.ammo[0] > 0)) { - if ((currentGame.area != MISN_INTERCEPTION) || - (currentGame.difficulty == DIFFICULTY_ORIGINAL)) + if ((game.area != MISN_INTERCEPTION) || + (game.difficulty == DIFFICULTY_ORIGINAL)) 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"); else { @@ -283,17 +283,17 @@ static void game_doCollectables() break; case P_PLASMA_DAMAGE: - currentGame.powerups++; - if ((currentGame.area != MISN_INTERCEPTION) || - (currentGame.difficulty == DIFFICULTY_ORIGINAL) || + game.powerups++; + if ((game.area != MISN_INTERCEPTION) || + (game.difficulty == DIFFICULTY_ORIGINAL) || (player.ammo[0] > 0)) { - if ((currentGame.area != MISN_INTERCEPTION) || - (currentGame.difficulty == DIFFICULTY_ORIGINAL)) + if ((game.area != MISN_INTERCEPTION) || + (game.difficulty == DIFFICULTY_ORIGINAL)) 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"); else { weapon[W_PLAYER_WEAPON].damage++; @@ -307,15 +307,15 @@ static void game_doCollectables() break; case P_SUPER: - currentGame.powerups++; - if ((currentGame.area != MISN_INTERCEPTION) || - (currentGame.difficulty == DIFFICULTY_ORIGINAL) || + game.powerups++; + if ((game.area != MISN_INTERCEPTION) || + (game.difficulty == DIFFICULTY_ORIGINAL) || (player.ammo[0] > 0)) { - if ((currentGame.area != MISN_INTERCEPTION) || - (currentGame.difficulty == DIFFICULTY_ORIGINAL)) + if ((game.area != MISN_INTERCEPTION) || + (game.difficulty == DIFFICULTY_ORIGINAL)) LIMIT_ADD(player.ammo[0], collectable->value, - 0, currentGame.maxPlasmaAmmo); + 0, game.maxPlasmaAmmo); weapon[W_PLAYER_WEAPON].ammo[0] = 5; weapon[W_PLAYER_WEAPON].damage = 5; @@ -331,12 +331,12 @@ static void game_doCollectables() break; case P_PLASMA_AMMO: - if (player.ammo[0] >= currentGame.maxPlasmaAmmo) + if (player.ammo[0] >= game.maxPlasmaAmmo) sprintf(temp, "Plasma cells already at Maximum"); else { LIMIT_ADD(player.ammo[0], collectable->value, - 0, currentGame.maxPlasmaAmmo); + 0, game.maxPlasmaAmmo); if (collectable->value > 1) { sprintf(temp, "Got %d plasma cells", collectable->value); @@ -348,17 +348,17 @@ static void game_doCollectables() sprintf(temp, "Got one whole plasma cell (wahoo!)"); } } - currentGame.cellPickups += collectable->value; + game.cellPickups += collectable->value; break; case P_CARGO: strcpy(temp, "Picked up some Cargo"); - currentGame.cargoPickups++; + game.cargoPickups++; break; case P_SLAVES: sprintf(temp, "Rescued %d slaves", collectable->value); - currentGame.slavesRescued += collectable->value; + game.slavesRescued += collectable->value; break; case P_ESCAPEPOD: @@ -387,9 +387,9 @@ static void game_doCollectables() // stop people from exploiting a weapon check condition if (player.ammo[0] == 0) { - weapon[W_PLAYER_WEAPON].ammo[0] = currentGame.minPlasmaOutput; - weapon[W_PLAYER_WEAPON].damage = currentGame.minPlasmaDamage; - weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[currentGame.minPlasmaRate]; + weapon[W_PLAYER_WEAPON].ammo[0] = game.minPlasmaOutput; + weapon[W_PLAYER_WEAPON].damage = game.minPlasmaDamage; + weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[game.minPlasmaRate]; } } @@ -541,7 +541,7 @@ static void game_doBullets() if (bullet->owner == &player) { - currentGame.hits++; + game.hits++; if ((aliens[i].classDef == CD_PHOEBE) || (aliens[i].classDef == CD_URSULA)) 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))) { for (int j = 0 ; j < 20 ; j++) @@ -691,8 +691,8 @@ static void game_doBullets() if (bullet->owner == &player) { - currentGame.minesKilled++; - currentGame.hits++; + game.minesKilled++; + game.hits++; } } } @@ -848,7 +848,7 @@ static void game_doAliens() 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].face = 0; @@ -874,7 +874,7 @@ static void game_doAliens() if (aliens[i].classDef == CD_CLOAKFIGHTER) { - currentGame.experimentalShield = aliens[i].shield; + game.experimentalShield = aliens[i].shield; setInfoLine("Experimental Fighter has fled", FONT_CYAN); } @@ -933,7 +933,7 @@ static void game_doAliens() canFire = false; } - if ((canFire) && (dev.fireAliens)) + if (canFire) { if ((aliens[i].reload[0] == 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; } else @@ -1062,11 +1062,11 @@ static void game_doAliens() } // 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))) 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.smx; @@ -1126,7 +1126,7 @@ static void game_doPlayer() if (player.weaponType[1] == W_CHARGER) { if (engine.keyState[KEY_ALTFIRE] && - ((currentGame.difficulty == DIFFICULTY_ORIGINAL) || + ((game.difficulty == DIFFICULTY_ORIGINAL) || !(engine.keyState[KEY_FIRE]))) { if (!player_chargerFired) @@ -1136,7 +1136,7 @@ static void game_doPlayer() if (engine.cheatAmmo) player.ammo[1] = 200; - if (currentGame.difficulty == DIFFICULTY_ORIGINAL) + if (game.difficulty == DIFFICULTY_ORIGINAL) { LIMIT_ADD(player.ammo[1], 1, 0, 200); } @@ -1164,7 +1164,7 @@ static void game_doPlayer() if ((engine.keyState[KEY_SWITCH])) { 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; @@ -1231,9 +1231,9 @@ static void game_doPlayer() engine.keyState[KEY_PAUSE] = 0; } - if (((currentGame.area == MISN_ELLESH) && + if (((game.area == MISN_ELLESH) && (aliens[ALIEN_BOSS].shield > 0)) || - (currentGame.area == MISN_MARS)) + (game.area == MISN_MARS)) { player.face = 0; xmoved = true; @@ -1242,9 +1242,9 @@ static void game_doPlayer() if (engine.done == 0) { - if ((currentGame.difficulty != DIFFICULTY_ORIGINAL) || - ((currentGame.area != MISN_ELLESH) && - (currentGame.area != MISN_MARS))) + if ((game.difficulty != DIFFICULTY_ORIGINAL) || + ((game.area != MISN_ELLESH) && + (game.area != MISN_MARS))) { if (xmoved) { @@ -1259,7 +1259,7 @@ static void game_doPlayer() player.x = screen->w - xViewBorder; } } - else if (currentGame.difficulty != DIFFICULTY_ORIGINAL) + else if (game.difficulty != DIFFICULTY_ORIGINAL) { cd = player.x - screen->w / 2; if (cd < 0) @@ -1289,7 +1289,7 @@ static void game_doPlayer() player.y = screen->h - yViewBorder; } } - else if (currentGame.difficulty != DIFFICULTY_ORIGINAL) + else if (game.difficulty != DIFFICULTY_ORIGINAL) { cd = player.y - screen->h / 2; if (cd < 0) @@ -1335,11 +1335,11 @@ static void game_doPlayer() player.shield--; if (player.shield == -1) { - if ((currentGame.hasWingMate1) || (aliens[ALIEN_KLINE].active)) + if ((game.hasWingMate1) || (aliens[ALIEN_KLINE].active)) getPlayerDeathMessage(); // 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++) aliens[i].flags |= FL_LEAVESECTOR; @@ -1362,14 +1362,14 @@ static void game_doPlayer() LIMIT(engine.ssy, -cameraMaxSpeed, cameraMaxSpeed); // 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)) { engine.ssx = -6; engine.ssy = 0; } - if (currentGame.area == MISN_MARS) + if (game.area == MISN_MARS) { engine.ssx = -6; engine.ssy = 0; @@ -1533,11 +1533,11 @@ static bool game_checkPauseRequest() return false; } -int mainGameLoop() +int game_mainLoop() { resetLists(); - setMission(currentGame.area); + setMission(game.area); missionBriefScreen(); cargo_init(); @@ -1545,28 +1545,28 @@ int mainGameLoop() aliens_init(); // specific for Phoebe being captured! - if (currentGame.area == MISN_NEROD) - currentGame.hasWingMate1 = 1; + if (game.area == MISN_NEROD) + game.hasWingMate1 = 1; - if (currentGame.area == MISN_ELAMALE) + if (game.area == MISN_ELAMALE) aliens[ALIEN_KLINE].active = false; for (int i = 0 ; i < engine.maxAliens ; i++) alien_add(); - if (currentGame.hasWingMate1) + if (game.hasWingMate1) alien_addFriendly(ALIEN_PHOEBE); - if (currentGame.hasWingMate2) + if (game.hasWingMate2) alien_addFriendly(ALIEN_URSULA); - if ((currentGame.area == MISN_URUSOR) || - (currentGame.area == MISN_POSWIC) || - (currentGame.area == MISN_EARTH)) + if ((game.area == MISN_URUSOR) || + (game.area == MISN_POSWIC) || + (game.area == MISN_EARTH)) alien_addFriendly(ALIEN_SID); // Disable Wingmates for certain missions - switch (currentGame.area) + switch (game.area) { case MISN_NEROD: case MISN_URUSOR: @@ -1581,16 +1581,16 @@ int mainGameLoop() break; } - if (currentGame.area == MISN_DORIM) + if (game.area == MISN_DORIM) { aliens[0].collectChance = 100; aliens[0].collectType = P_ESCAPEPOD; } // 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].owner = &aliens[ALIEN_KLINE]; @@ -1601,7 +1601,7 @@ int mainGameLoop() player_setTarget(ALIEN_KLINE); } - if ((currentGame.system == 2) && (currentGame.experimentalShield > 0)) + if ((game.system == 2) && (game.experimentalShield > 0)) { if ((rand() % 5) > 0) { @@ -1613,12 +1613,12 @@ int mainGameLoop() aliens[10].x = player.x - 1000; aliens[10].y = player.y; 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].y = player.y; @@ -1632,7 +1632,7 @@ int mainGameLoop() } // Set target energy meter - switch (currentGame.area) + switch (game.area) { case MISN_MOEBO: case MISN_ELAMALE: @@ -1721,7 +1721,7 @@ int mainGameLoop() if ((missionFailed()) && (engine.missionCompleteTimer == 0)) { - if (currentGame.area != MISN_MOEBO) + if (game.area != MISN_MOEBO) engine.missionCompleteTimer = SDL_GetTicks() + 4000; } @@ -1732,15 +1732,15 @@ int mainGameLoop() { if (SDL_GetTicks() >= engine.missionCompleteTimer) { - if ((!missionFailed()) && (currentGame.area != MISN_VENUS)) + if ((!missionFailed()) && (game.area != MISN_VENUS)) { leaveSector(); if ((engine.done == 2) && - (currentGame.area != MISN_DORIM) && - (currentGame.area != MISN_SIVEDI)) + (game.area != MISN_DORIM) && + (game.area != MISN_SIVEDI)) { if ((aliens[ALIEN_PHOEBE].shield > 0) && - (currentGame.area != MISN_EARTH)) + (game.area != MISN_EARTH)) { aliens[ALIEN_PHOEBE].x = player.x - 40; aliens[ALIEN_PHOEBE].y = player.y - 35; @@ -1748,15 +1748,15 @@ int mainGameLoop() } if ((aliens[ALIEN_URSULA].shield > 0) && - (currentGame.area != MISN_EARTH)) + (game.area != MISN_EARTH)) { aliens[ALIEN_URSULA].x = player.x - 40; aliens[ALIEN_URSULA].y = player.y + 45; aliens[ALIEN_URSULA].face = 0; } - if ((currentGame.area == MISN_URUSOR) || - (currentGame.area == MISN_POSWIC)) + if ((game.area == MISN_URUSOR) || + (game.area == MISN_POSWIC)) { aliens[ALIEN_SID].x = player.x - 100; 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.keyState[KEY_UP] = 0; @@ -1830,7 +1830,7 @@ int mainGameLoop() audio_resumeMusic(); } - if ((currentGame.area == MISN_MARS) && (engine.addAliens > -1)) + if ((game.area == MISN_MARS) && (engine.addAliens > -1)) { if ((rand() % 5) == 0) // XXX: The originally specified range for x was [800, 100], @@ -1857,7 +1857,7 @@ int mainGameLoop() engine.missionCompleteTimer = SDL_GetTicks() + 7000; // specific to Boss 1 - if ((currentGame.area == MISN_MOEBO) && + if ((game.area == MISN_MOEBO) && (aliens[ALIEN_BOSS].flags & FL_ESCAPED)) { audio_playSound(SFX_DEATH, aliens[ALIEN_BOSS].x); @@ -1880,10 +1880,10 @@ int mainGameLoop() if ((player.shield > 0) && (!missionFailed())) { - if (currentGame.area < MISN_VENUS) + if (game.area < MISN_VENUS) missionFinishedScreen(); - switch (currentGame.area) + switch (game.area) { case MISN_MOEBO: doCutscene(1); @@ -1906,7 +1906,7 @@ int mainGameLoop() break; } - if (currentGame.area < MISN_VENUS) + if (game.area < MISN_VENUS) { updateSystemStatus(); saveGame(0); @@ -1914,7 +1914,7 @@ int mainGameLoop() rtn = 1; - if (currentGame.area == MISN_VENUS) + if (game.area == MISN_VENUS) rtn = 0; } else diff --git a/src/game.h b/src/game.h index b51ff83..0e05f46 100644 --- a/src/game.h +++ b/src/game.h @@ -20,10 +20,10 @@ along with this program. If not, see . #ifndef GAME_H #define GAME_H -extern Game currentGame; +extern Game game; -extern void newGame(); +void game_init(); void game_doExplosions(); -extern int mainGameLoop(); +int game_mainLoop(); #endif diff --git a/src/globals.cpp b/src/globals.cpp index 144f57e..7720e4d 100644 --- a/src/globals.cpp +++ b/src/globals.cpp @@ -19,7 +19,6 @@ along with this program. If not, see . #include "Starfighter.h" -devVariables dev; globalEngineVariables engine; void defineGlobals() @@ -69,8 +68,4 @@ void defineGlobals() engine.cheatShield = false; engine.cheatAmmo = false; engine.cheatCash = false; - - // All Development Stuff... - dev.moveAliens = 1; - dev.fireAliens = 1; } diff --git a/src/globals.h b/src/globals.h index babc92a..e9d60ba 100644 --- a/src/globals.h +++ b/src/globals.h @@ -20,9 +20,8 @@ along with this program. If not, see . #ifndef GLOBALS_H #define GLOBALS_H -extern devVariables dev; extern globalEngineVariables engine; -extern void defineGlobals(); +void defineGlobals(); #endif diff --git a/src/intermission.cpp b/src/intermission.cpp index 076697b..9b6fc7f 100644 --- a/src/intermission.cpp +++ b/src/intermission.cpp @@ -47,7 +47,7 @@ static void setStatusLines() { char string[50]; - sprintf(string, "System : %s", systemNames[currentGame.system]); + sprintf(string, "System : %s", systemNames[game.system]); textSurface(0, string, 0, 0, FONT_WHITE); @@ -77,76 +77,76 @@ static void setStatusLines() sprintf(string, "Missions Completed : %d/%d", completed, total); 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); - sprintf(string, "Hits Scored : %d", currentGame.hits); + sprintf(string, "Hits Scored : %d", game.hits); 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); - 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); - sprintf(string, "Total Cash Earned : %d", currentGame.cashEarned); + sprintf(string, "Total Cash Earned : %d", game.cashEarned); textSurface(6, string, 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); - 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); - 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); - sprintf(string, "Rockets Picked Up : %d", currentGame.rocketPickups); + sprintf(string, "Rockets Picked Up : %d", game.rocketPickups); 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); - sprintf(string, "Mines Destroyed : %d", currentGame.minesKilled); + sprintf(string, "Mines Destroyed : %d", game.minesKilled); 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); - sprintf(string, "Cargo Picked Up : %d", currentGame.cargoPickups); + sprintf(string, "Cargo Picked Up : %d", game.cargoPickups); textSurface(15, string, 0, 0, FONT_WHITE); - if (currentGame.hasWingMate1) + if (game.hasWingMate1) { 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); - sprintf(string, "Ejections : %d", currentGame.wingMate1Ejects); + sprintf(string, "Ejections : %d", game.wingMate1Ejects); textSurface(18, string, 0, 0, FONT_WHITE); } - if (currentGame.hasWingMate2) + if (game.hasWingMate2) { 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); - sprintf(string, "Ejections : %d", currentGame.wingMate2Ejects); + sprintf(string, "Ejections : %d", game.wingMate2Ejects); textSurface(21, string, 0, 0, FONT_WHITE); } signed char percentage = 0; - if ((currentGame.secondaryMissions > 0) && (currentGame.secondaryMissionsCompleted > 0)) - percentage = (currentGame.secondaryMissionsCompleted / currentGame.secondaryMissions) * 100; - sprintf(string, "Seconday Missions Completed : %d / %d (%d%%)", currentGame.secondaryMissionsCompleted, currentGame.secondaryMissions, percentage); + if ((game.secondaryMissions > 0) && (game.secondaryMissionsCompleted > 0)) + percentage = (game.secondaryMissionsCompleted / game.secondaryMissions) * 100; + sprintf(string, "Seconday Missions Completed : %d / %d (%d%%)", game.secondaryMissionsCompleted, game.secondaryMissions, percentage); 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); @@ -180,7 +180,7 @@ static void setSystemPlanets() char string[100]; strcpy(string, ""); - switch (currentGame.system) + switch (game.system) { case 0: 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); if ((engine.keyState[KEY_FIRE])) { - if (currentGame.system == 0) + if (game.system == 0) { - currentGame.stationedPlanet = planet; - currentGame.destinationPlanet = planet; - currentGame.area = systemPlanet[currentGame.stationedPlanet].missionNumber; - strcpy(currentGame.stationedName, systemPlanet[currentGame.stationedPlanet].name); + game.stationedPlanet = planet; + game.destinationPlanet = planet; + game.area = systemPlanet[game.stationedPlanet].missionNumber; + strcpy(game.stationedName, systemPlanet[game.stationedPlanet].name); saveGame(0); } else { - currentGame.destinationPlanet = planet; - strcpy(currentGame.destinationName, systemPlanet[currentGame.destinationPlanet].name); + game.destinationPlanet = planet; + strcpy(game.destinationName, systemPlanet[game.destinationPlanet].name); } rtn = true; @@ -363,7 +363,7 @@ static void updateCommsSurface(SDL_Surface *comms) blevelRect(comms, 0, 10, comms->w - 1, 55, 0x00, 0x22, 0x00); blit(shape[FACE_CHRIS], 20, 15, 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); } @@ -589,7 +589,7 @@ int galaxyMap() initSaveSlots(); - loadBackground(systemBackground[currentGame.system]); + loadBackground(systemBackground[game.system]); char string[25]; @@ -654,23 +654,23 @@ int galaxyMap() signed char saveSlot = -1; // Remove the Supercharge, if it is there - if ((currentGame.difficulty != DIFFICULTY_EASY) && - (currentGame.difficulty != DIFFICULTY_ORIGINAL)) + if ((game.difficulty != DIFFICULTY_EASY) && + (game.difficulty != DIFFICULTY_ORIGINAL)) { weapon[W_PLAYER_WEAPON].reload[0] = MAX( 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], - currentGame.maxPlasmaOutput); + game.maxPlasmaOutput); weapon[W_PLAYER_WEAPON].damage = MIN(weapon[W_PLAYER_WEAPON].damage, - currentGame.maxPlasmaDamage); + game.maxPlasmaDamage); } - if (currentGame.system > 0) - interceptionChance = (300 / currentGame.system); + if (game.system > 0) + interceptionChance = (300 / game.system); // 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; int rtn = 0; @@ -689,14 +689,14 @@ int galaxyMap() iconInfo[6].image = textSurface("Options", 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); - 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); - if (currentGame.destinationPlanet > -1) - sprintf(string, "Destination: %s", systemPlanet[currentGame.destinationPlanet].name); + if (game.destinationPlanet > -1) + sprintf(string, "Destination: %s", systemPlanet[game.destinationPlanet].name); else strcpy(string, "Destination: None"); iconInfo[10].image = textSurface(string, FONT_WHITE); @@ -707,7 +707,7 @@ int galaxyMap() bool redrawBackGround = true; - if (currentGame.distanceCovered > 0) + if (game.distanceCovered > 0) section = 0; else player.shield = player.maxShield; @@ -771,32 +771,32 @@ int galaxyMap() switch(section) { 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; engine.done = 1; } else { - distance = abs(currentGame.stationedPlanet - currentGame.destinationPlanet); + distance = abs(game.stationedPlanet - game.destinationPlanet); distance = (5 / distance); if (distance < 1) distance = 1; 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); - iconInfo[10].image = textSurface(systemPlanet[currentGame.destinationPlanet].name, FONT_WHITE); + iconInfo[10].image = textSurface(systemPlanet[game.destinationPlanet].name, FONT_WHITE); section = 8; destRect.x = 180; destRect.y = 450; destRect.w = 1; - if (currentGame.distanceCovered > 0) - destRect.w = currentGame.distanceCovered; + if (game.distanceCovered > 0) + destRect.w = game.distanceCovered; destRect.h = 20; } break; @@ -816,23 +816,23 @@ int galaxyMap() 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); iconInfo[9].image = textSurface(string, FONT_WHITE); updateCommsSurface(commsSurface); } else { - sprintf(string, "Destination: %s", systemPlanet[currentGame.destinationPlanet].name); + sprintf(string, "Destination: %s", systemPlanet[game.destinationPlanet].name); SDL_FreeSurface(iconInfo[10].image); iconInfo[10].image = textSurface(string, FONT_WHITE); } } 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); break; @@ -867,9 +867,9 @@ int galaxyMap() case 8: 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(systemPlanet[currentGame.destinationPlanet].image, 650, 450); + blit(systemPlanet[game.destinationPlanet].image, 650, 450); blit(iconInfo[10].image, 635, 480); destRect.w += distance; @@ -877,13 +877,13 @@ int galaxyMap() if (destRect.w >= 450) { - currentGame.stationedPlanet = currentGame.destinationPlanet; - currentGame.distanceCovered = 0; + game.stationedPlanet = game.destinationPlanet; + game.distanceCovered = 0; player.shield = player.maxShield; sprintf(string, "Stationed At: %s", - systemPlanet[currentGame.stationedPlanet].name); - strcpy(currentGame.stationedName, - systemPlanet[currentGame.stationedPlanet].name); + systemPlanet[game.stationedPlanet].name); + strcpy(game.stationedName, + systemPlanet[game.stationedPlanet].name); SDL_FreeSurface(iconInfo[9].image); iconInfo[9].image = textSurface(string, FONT_WHITE); updateCommsSurface(commsSurface); @@ -895,10 +895,10 @@ int galaxyMap() { if ((rand() % interceptionChance) == 0) { - currentGame.area = MISN_INTERCEPTION; + game.area = MISN_INTERCEPTION; rtn = 2; engine.done = 1; - currentGame.distanceCovered = destRect.w; + game.distanceCovered = destRect.w; } } @@ -915,12 +915,12 @@ int galaxyMap() // "Start Next Mission" icon if (i == 0) { - if ((currentGame.stationedPlanet == currentGame.destinationPlanet) && - (systemPlanet[currentGame.stationedPlanet].missionCompleted != 0)) + if ((game.stationedPlanet == game.destinationPlanet) && + (systemPlanet[game.stationedPlanet].missionCompleted != 0)) continue; - else if (currentGame.stationedPlanet == currentGame.destinationPlanet) + else if (game.stationedPlanet == game.destinationPlanet) 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); } else @@ -936,7 +936,7 @@ int galaxyMap() } else { - if (currentGame.stationedPlanet == currentGame.destinationPlanet) + if (game.stationedPlanet == game.destinationPlanet) blit(iconInfo[0].image, (int)iconInfo[i].x, 545); else blit(iconInfo[11].image, (int)iconInfo[i].x, 545); @@ -966,7 +966,7 @@ int galaxyMap() for (int i = 0 ; i < 12 ; i++) SDL_FreeSurface(iconInfo[i].image); - if (currentGame.distanceCovered == 0) + if (game.distanceCovered == 0) player.shield = player.maxShield; return rtn; diff --git a/src/loadSave.cpp b/src/loadSave.cpp index fefa9ef..758055e 100644 --- a/src/loadSave.cpp +++ b/src/loadSave.cpp @@ -103,7 +103,7 @@ bool loadGame(int slot) if (fp == NULL) return false; - if (fread(¤tGame, 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"); fclose(fp); @@ -112,18 +112,18 @@ bool loadGame(int slot) fclose(fp); - if (currentGame.saveFormat < 2) - currentGame.difficulty = DIFFICULTY_NORMAL; + if (game.saveFormat < 2) + game.difficulty = DIFFICULTY_NORMAL; - weapon[W_PLAYER_WEAPON] = currentGame.playerWeapon; - player = currentGame.thePlayer; + weapon[W_PLAYER_WEAPON] = game.playerWeapon; + player = game.thePlayer; // Re-init all the planets in this system... - initPlanetMissions(currentGame.system); + initPlanetMissions(game.system); // ... and then override with completition status for (int i = 0 ; i < 10 ; i++) - systemPlanet[i].missionCompleted = currentGame.missionCompleted[i]; + systemPlanet[i].missionCompleted = game.missionCompleted[i]; return true; } @@ -142,15 +142,15 @@ void saveGame(int slot) sprintf(fileName, "%ssave%.2d.dat", engine.userHomeDirectory, slot); fp = fopen(fileName, "wb"); - currentGame.saveFormat = 3; - currentGame.playerWeapon = weapon[W_PLAYER_WEAPON]; - currentGame.thePlayer = player; + game.saveFormat = 3; + game.playerWeapon = weapon[W_PLAYER_WEAPON]; + game.thePlayer = player; for (int i = 0 ; i < 10 ; i++) - currentGame.missionCompleted[i] = systemPlanet[i].missionCompleted; + game.missionCompleted[i] = systemPlanet[i].missionCompleted; if (fp != NULL) { - if (fwrite(¤tGame, sizeof(Game), 1, fp) != 1) + if (fwrite(&game, sizeof(Game), 1, fp) != 1) { printf("Error Saving Game to Slot %d\n", slot); } diff --git a/src/messages.cpp b/src/messages.cpp index 147cd21..4d630c2 100644 --- a/src/messages.cpp +++ b/src/messages.cpp @@ -67,27 +67,27 @@ void getKillMessage(object *ally) if (ally == &aliens[ALIEN_PHOEBE]) { strcpy(otherName, "Ursula"); - kills = currentGame.wingMate1Kills; - difference = currentGame.wingMate1Kills - currentGame.wingMate2Kills; - if ((currentGame.wingMate1Kills > currentGame.wingMate2Kills) && - (currentGame.wingMate1Kills > currentGame.totalKills)) + kills = game.wingMate1Kills; + difference = game.wingMate1Kills - game.wingMate2Kills; + if ((game.wingMate1Kills > game.wingMate2Kills) && + (game.wingMate1Kills > game.totalKills)) firstPlace = true; faceToUse = FACE_PHOEBE; } else { strcpy(otherName, "Phoebe"); - kills = currentGame.wingMate2Kills; - difference = currentGame.wingMate2Kills - currentGame.wingMate1Kills; - if ((currentGame.wingMate2Kills > currentGame.wingMate1Kills) && - (currentGame.wingMate2Kills > currentGame.totalKills)) + kills = game.wingMate2Kills; + difference = game.wingMate2Kills - game.wingMate1Kills; + if ((game.wingMate2Kills > game.wingMate1Kills) && + (game.wingMate2Kills > game.totalKills)) firstPlace = true; faceToUse = FACE_URSULA; } int r = rand() % 10; - if (currentGame.hasWingMate2 == 0) + if (game.hasWingMate2 == 0) r = rand() % 7; switch(r) @@ -139,7 +139,7 @@ const char *getKlineInsult() "And now you're nothing but a DEAD hero." }; - if (currentGame.area != MISN_VENUS) + if (game.area != MISN_VENUS) return (insult[rand() % 3]); else return (insult[3 + (rand() % 2)]); @@ -162,12 +162,12 @@ void getPlayerDeathMessage() int faceToUse = FACE_PHOEBE; - if ((currentGame.area == MISN_URUSOR) || (currentGame.area == MISN_POSWIC) || - (currentGame.area == MISN_EARTH)) + if ((game.area == MISN_URUSOR) || (game.area == MISN_POSWIC) || + (game.area == MISN_EARTH)) { faceToUse = FACE_SID; } - else if (currentGame.hasWingMate2) + else if (game.hasWingMate2) { if ((rand() % 2) == 0) faceToUse = FACE_URSULA; diff --git a/src/misc.cpp b/src/misc.cpp index 23488bd..bcb59b8 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -163,7 +163,7 @@ void doInfo() blitText(30); } - if (currentGame.area != MISN_INTERCEPTION) + if (game.area != MISN_INTERCEPTION) { blitText(9); // mission objectives sprintf(text, "%d", (currentMission.remainingObjectives1 + currentMission.remainingObjectives2)); @@ -172,7 +172,7 @@ void doInfo() } blitText(8); // cash - sprintf(text, "%.6d", currentGame.cash); + sprintf(text, "%.6d", game.cash); textSurface(38, text, 90, 21, FONT_WHITE); blitText(38); @@ -300,7 +300,7 @@ void doInfo() } // 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)) { @@ -334,11 +334,11 @@ void doInfo() for (int i = 1 ; i <= 5 ; 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); } - } else if (i <= currentGame.maxPlasmaDamage) + } else if (i <= game.maxPlasmaDamage) SDL_FillRect(screen, &bar, darkGreen); bar.x += 30; } @@ -354,12 +354,12 @@ void doInfo() for (int i = 1 ; i <= 5 ; 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); } } - else if (i <= currentGame.maxPlasmaOutput) + else if (i <= game.maxPlasmaOutput) SDL_FillRect(screen, &bar, darkYellow); bar.x += 30; } @@ -374,12 +374,12 @@ void doInfo() for (int i = 1 ; i <= 5 ; 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); } } - else if (i <= currentGame.maxPlasmaRate) + else if (i <= game.maxPlasmaRate) SDL_FillRect(screen, &bar, darkerBlue); bar.x += 30; } diff --git a/src/missions.cpp b/src/missions.cpp index 74fb171..5d4c8ac 100644 --- a/src/missions.cpp +++ b/src/missions.cpp @@ -150,53 +150,53 @@ void checkForBossMission() void updateSystemStatus() { - if (currentGame.area == MISN_START) + if (game.area == MISN_START) { - currentGame.stationedPlanet = 0; - currentGame.area = 1; - strcpy(currentGame.stationedName, "Hail"); - initPlanetMissions(currentGame.system); + game.stationedPlanet = 0; + game.area = 1; + strcpy(game.stationedName, "Hail"); + initPlanetMissions(game.system); } - else if (currentGame.area == MISN_MOEBO) + else if (game.area == MISN_MOEBO) { - currentGame.stationedPlanet = 0; - currentGame.system = 1; - currentGame.area = MISN_RESCUESLAVES; - strcpy(currentGame.stationedName, "Nerod"); - initPlanetMissions(currentGame.system); + game.stationedPlanet = 0; + game.system = 1; + game.area = MISN_RESCUESLAVES; + strcpy(game.stationedName, "Nerod"); + initPlanetMissions(game.system); - if (currentGame.difficulty == DIFFICULTY_ORIGINAL) + if (game.difficulty == DIFFICULTY_ORIGINAL) player.maxShield = 50; } - else if (currentGame.area == MISN_ELAMALE) + else if (game.area == MISN_ELAMALE) { - currentGame.stationedPlanet = 0; - currentGame.system = 2; - currentGame.area = MISN_CLOAKFIGHTER; - strcpy(currentGame.stationedName, "Odeon"); - initPlanetMissions(currentGame.system); + game.stationedPlanet = 0; + game.system = 2; + game.area = MISN_CLOAKFIGHTER; + strcpy(game.stationedName, "Odeon"); + initPlanetMissions(game.system); - if (currentGame.difficulty == DIFFICULTY_ORIGINAL) + if (game.difficulty == DIFFICULTY_ORIGINAL) player.maxShield = 75; } - else if (currentGame.area == MISN_ELLESH) + else if (game.area == MISN_ELLESH) { - currentGame.stationedPlanet = 8; - currentGame.system = 3; - currentGame.area = MISN_PLUTO; - strcpy(currentGame.stationedName, "Pluto"); - initPlanetMissions(currentGame.system); + game.stationedPlanet = 8; + game.system = 3; + game.area = MISN_PLUTO; + strcpy(game.stationedName, "Pluto"); + initPlanetMissions(game.system); - if (currentGame.difficulty == DIFFICULTY_ORIGINAL) + if (game.difficulty == DIFFICULTY_ORIGINAL) player.maxShield = 100; } else // Update the mission for the planet { - systemPlanet[currentGame.stationedPlanet].missionCompleted = 1; + systemPlanet[game.stationedPlanet].missionCompleted = 1; } - strcpy(currentGame.destinationName, "None"); - currentGame.destinationPlanet = currentGame.stationedPlanet; + strcpy(game.destinationName, "None"); + game.destinationPlanet = game.stationedPlanet; } /* @@ -316,12 +316,12 @@ void checkTimer() } // specific to Spirit Boss - if ((currentGame.area == MISN_MOEBO) && + if ((game.area == MISN_MOEBO) && (currentMission.completed1[0] < OB_INCOMPLETE)) engine.timeMission = 1; // specific to the Asteroid belt - if ((currentGame.area == MISN_MARS) && + if ((game.area == MISN_MARS) && (currentMission.completed1[0] < OB_INCOMPLETE)) { currentMission.completed1[0] = OB_COMPLETED; @@ -340,7 +340,7 @@ static void evaluateRequirement(int type, int id, int *completed, int *targetVal { *completed = 2; 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); } else @@ -374,12 +374,12 @@ static void evaluateRequirement(int type, int id, int *completed, int *targetVal { case P_CARGO: 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); break; case P_ESCAPEPOD: 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); break; } @@ -388,7 +388,7 @@ static void evaluateRequirement(int type, int id, int *completed, int *targetVal if (*targetValue <= 0) { *completed = -2; - switch (currentGame.area) + switch (game.area) { case MISN_NEROD: 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 - if (currentGame.area == MISN_INTERCEPTION) + if (game.area == MISN_INTERCEPTION) { if ((type == M_COLLECT) && (id == P_SLAVES)) { if (systemPlanet[9].missionCompleted == 0) { - if (currentGame.slavesRescued >= 250) + if (game.slavesRescued >= 250) { setInfoLine("*** Slaves Rescued - Mission Completed ***", FONT_GREEN); systemPlanet[9].missionCompleted = 1; } else { - sprintf(message, "Rescue %d more...", 250 - currentGame.slavesRescued); + sprintf(message, "Rescue %d more...", 250 - game.slavesRescued); setInfoLine(message, FONT_CYAN); } } @@ -498,7 +498,7 @@ void updateMissionRequirements(int type, int id, int value) setInfoLine("*** Experimental Fighter Destroyed - Mission Completed ***", FONT_GREEN); systemPlanet[9].missionCompleted = 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) { // Activate Kline!! :) - if (currentGame.area == MISN_ELAMALE) + if (game.area == MISN_ELAMALE) { mission_killAllEnemies(); syncScriptEvents(); @@ -574,7 +574,7 @@ bool allMissionsCompleted() { if (currentMission.remainingObjectives1 > 1) { - if ((currentGame.area != MISN_POSWIC) || (i != 1)) + if ((game.area != MISN_POSWIC) || (i != 1)) setInfoLine("*** Primary Objective Completed ***", FONT_GREEN); else setInfoLine(">>> Primary Objective Failed <<<", FONT_RED); @@ -582,17 +582,17 @@ bool allMissionsCompleted() } else { - if (currentGame.area != MISN_INTERCEPTION) + if (game.area != MISN_INTERCEPTION) setInfoLine("*** All Primary Objectives Completed ***", FONT_GREEN); else setInfoLine("*** Interception Destroyed ***", FONT_GREEN); currentMission.completed1[i] = OB_COMPLETED; // do some area specific things - if ((currentGame.area == MISN_MOEBO) || - (currentGame.area == MISN_DORIM) || - (currentGame.area == MISN_ELLESH) || - (currentGame.area == MISN_MARS)) + if ((game.area == MISN_MOEBO) || + (game.area == MISN_DORIM) || + (game.area == MISN_ELLESH) || + (game.area == MISN_MARS)) { 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); } } @@ -619,7 +619,7 @@ bool allMissionsCompleted() currentMission.completed2[i] = OB_COMPLETED; // do some area specific things - if ((currentGame.area == MISN_DORIM) && + if ((game.area == MISN_DORIM) && (currentMission.remainingObjectives1 == 0)) { mission_killAllEnemies(); @@ -736,7 +736,7 @@ static void drawBriefScreen() if (currentMission.secondaryType[i] != NONE) { drawString(currentMission.secondaryObjective[i], 160, 274 + (i * 30), FONT_WHITE); - currentGame.secondaryMissions++; + game.secondaryMissions++; } } } @@ -756,7 +756,7 @@ void missionBriefScreen() clearScreen(black); updateScreen(); - if (currentGame.area != MISN_INTERCEPTION) + if (game.area != MISN_INTERCEPTION) { clearScreen(black); drawBriefScreen(); @@ -764,14 +764,14 @@ void missionBriefScreen() if (currentMission.timeLimit1[0] > 0) { char temp[50]; - if (currentGame.area != MISN_MARS) + if (game.area != MISN_MARS) sprintf(temp, "TIME LIMIT: %d minutes", currentMission.timeLimit1[0]); else sprintf(temp, "SURVIVAL FOR %d minutes", currentMission.timeLimit1[0]); drawString(temp, -1, 500, FONT_RED); } - switch (currentGame.area) + switch (game.area) { case MISN_URUSOR: case MISN_DORIM: @@ -781,14 +781,14 @@ void missionBriefScreen() case MISN_MARS: case MISN_VENUS: 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); break; } - if ((currentGame.area == MISN_URUSOR) || - (currentGame.area == MISN_POSWIC) || - (currentGame.area == MISN_EARTH)) + if ((game.area == MISN_URUSOR) || + (game.area == MISN_POSWIC) || + (game.area == MISN_EARTH)) drawString("Sid Wilson will join you on this mission", 160, 480, FONT_WHITE); updateScreen(); @@ -814,7 +814,7 @@ void missionBriefScreen() textSurface(13, "Cooler", 485, 570, FONT_WHITE); audio_playRandomTrack(); - if (currentGame.area != MISN_INTERCEPTION) + if (game.area != MISN_INTERCEPTION) { drawString("PRESS ENTER TO CONTINUE...", -1, 550, FONT_WHITE); @@ -854,13 +854,13 @@ void missionFinishedScreen() int shield_bonus; char temp[100]; - if (currentGame.area != MISN_INTERCEPTION) + if (game.area != MISN_INTERCEPTION) { clearScreen(black); updateScreen(); - if (currentGame.shots > 0) - currentGame.accuracy = (currentGame.hits * 100) / currentGame.shots; + if (game.shots > 0) + game.accuracy = (game.hits * 100) / game.shots; clearScreen(black); drawBriefScreen(); @@ -869,7 +869,7 @@ void missionFinishedScreen() { 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); else drawString("FAILED", 550, 114 + (i * 30), FONT_RED); @@ -886,7 +886,7 @@ void missionFinishedScreen() if (currentMission.completed2[i] >= 1) { drawString("COMPLETED", 550, 274 + (i * 30), FONT_GREEN); - currentGame.secondaryMissionsCompleted++; + game.secondaryMissionsCompleted++; } else { @@ -901,11 +901,11 @@ void missionFinishedScreen() shield_bonus = player.shield * 10; sprintf(temp, "Shield Bonus: $%.3d", shield_bonus); drawString(temp, -1, 430, FONT_WHITE); - currentGame.cash += shield_bonus; - currentGame.cashEarned += shield_bonus; + game.cash += shield_bonus; + game.cashEarned += shield_bonus; } - currentGame.timeTaken += engine.timeTaken; + game.timeTaken += engine.timeTaken; snprintf(temp, sizeof temp, "Mission Time: %2ld:%02ld:%02ld", engine.timeTaken / 3600, (engine.timeTaken / 60) % 60, @@ -914,12 +914,12 @@ void missionFinishedScreen() drawString(temp, -1, 500, FONT_WHITE); // Do some mission specific stuff here... - if (currentGame.area == MISN_HAIL) - currentGame.cash -= 500; - else if (currentGame.area == MISN_ODEON) - currentGame.hasWingMate2 = 1; - else if (currentGame.area == MISN_ALMARTHA) - currentGame.cash -= 2000; + if (game.area == MISN_HAIL) + game.cash -= 500; + else if (game.area == MISN_ODEON) + game.hasWingMate2 = 1; + else if (game.area == MISN_ALMARTHA) + game.cash -= 2000; checkForBossMission(); diff --git a/src/player.cpp b/src/player.cpp index eaae30d..80813b2 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -45,12 +45,12 @@ void initPlayer() player.weaponType[0] = W_PLAYER_WEAPON; - if (weapon[W_PLAYER_WEAPON].ammo[0] < currentGame.minPlasmaOutput) - weapon[W_PLAYER_WEAPON].ammo[0] = currentGame.minPlasmaOutput; - if (weapon[W_PLAYER_WEAPON].damage < currentGame.minPlasmaDamage) - weapon[W_PLAYER_WEAPON].damage = currentGame.minPlasmaDamage; - if (weapon[W_PLAYER_WEAPON].reload[0] > rate2reload[currentGame.minPlasmaRate]) - weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[currentGame.minPlasmaRate]; + if (weapon[W_PLAYER_WEAPON].ammo[0] < game.minPlasmaOutput) + weapon[W_PLAYER_WEAPON].ammo[0] = game.minPlasmaOutput; + if (weapon[W_PLAYER_WEAPON].damage < game.minPlasmaDamage) + weapon[W_PLAYER_WEAPON].damage = game.minPlasmaDamage; + if (weapon[W_PLAYER_WEAPON].reload[0] > rate2reload[game.minPlasmaRate]) + weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[game.minPlasmaRate]; player.hit = 0; diff --git a/src/resources.cpp b/src/resources.cpp index a40b1fc..09ead65 100644 --- a/src/resources.cpp +++ b/src/resources.cpp @@ -44,7 +44,7 @@ void loadGameGraphics() shipShape[0] = loadImage("gfx/firefly1.png"); shipShape[1] = loadImage("gfx/firefly2.png"); - switch(currentGame.system) + switch(game.system) { case 0: strcpy(string, "data/resources_spirit.dat"); @@ -136,7 +136,7 @@ void loadGameGraphics() fclose(fp); - loadBackground(systemBackground[currentGame.system]); + loadBackground(systemBackground[game.system]); for (int i = 0 ; i < CD_MAX ; i++) { diff --git a/src/script.cpp b/src/script.cpp index de6b504..a2bc6fa 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -48,13 +48,13 @@ void loadScriptEvents() gameEvent[i].flag = 0; } - if ((currentGame.area == MISN_INTERCEPTION) && + if ((game.area == MISN_INTERCEPTION) && (aliens[ALIEN_KLINE].classDef == CD_KLINE) && (aliens[ALIEN_KLINE].active)) setKlineGreeting(); char filename[255]; - sprintf(filename, "data/script%d.txt", currentGame.area); + sprintf(filename, "data/script%d.txt", game.area); FILE *fp; int i = 0; diff --git a/src/ship.cpp b/src/ship.cpp index 7dff728..45e8b95 100644 --- a/src/ship.cpp +++ b/src/ship.cpp @@ -107,9 +107,9 @@ void ship_fireBullet(object *ship, int weaponType) player.ammo[0]--; if (player.ammo[0] <= 0) { - weapon[W_PLAYER_WEAPON].ammo[0] = currentGame.minPlasmaOutput; - weapon[W_PLAYER_WEAPON].damage = currentGame.minPlasmaDamage; - weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[currentGame.minPlasmaRate]; + weapon[W_PLAYER_WEAPON].ammo[0] = game.minPlasmaOutput; + weapon[W_PLAYER_WEAPON].damage = game.minPlasmaDamage; + weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[game.minPlasmaRate]; } } } diff --git a/src/shop.cpp b/src/shop.cpp index 293603a..813ce43 100644 --- a/src/shop.cpp +++ b/src/shop.cpp @@ -65,78 +65,78 @@ static void drawSecondaryWeaponSurface() if ((player.weaponType[1] != W_LASER) && (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]); } } static void adjustShopPrices() { - if (currentGame.difficulty == DIFFICULTY_ORIGINAL) + if (game.difficulty == DIFFICULTY_ORIGINAL) { shopItems[SHOP_PLASMA_MAX_OUTPUT].price = (500 * - currentGame.maxPlasmaOutput); + game.maxPlasmaOutput); shopItems[SHOP_PLASMA_MAX_DAMAGE].price = (500 * - currentGame.maxPlasmaDamage); + game.maxPlasmaDamage); shopItems[SHOP_PLASMA_MAX_RATE].price = (500 * - (currentGame.maxPlasmaRate * 2 - 1)); + (game.maxPlasmaRate * 2 - 1)); shopItems[SHOP_PLASMA_MIN_OUTPUT].price = (2000 * - currentGame.minPlasmaOutput); + game.minPlasmaOutput); shopItems[SHOP_PLASMA_MIN_DAMAGE].price = (2000 * - currentGame.minPlasmaDamage); + game.minPlasmaDamage); shopItems[SHOP_PLASMA_MIN_RATE].price = (2000 * - (currentGame.minPlasmaRate * 2 - 1)); + (game.minPlasmaRate * 2 - 1)); } else { shopItems[SHOP_PLASMA_MAX_OUTPUT].price = (1000 * - (currentGame.maxPlasmaOutput + 1)); + (game.maxPlasmaOutput + 1)); shopItems[SHOP_PLASMA_MAX_DAMAGE].price = (1000 * - (currentGame.maxPlasmaDamage + 1)); + (game.maxPlasmaDamage + 1)); shopItems[SHOP_PLASMA_MAX_RATE].price = (1000 * - (currentGame.maxPlasmaRate + 1)); + (game.maxPlasmaRate + 1)); shopItems[SHOP_PLASMA_MIN_OUTPUT].price = (1500 * - (currentGame.minPlasmaOutput + 1)); + (game.minPlasmaOutput + 1)); shopItems[SHOP_PLASMA_MIN_DAMAGE].price = (1500 * - (currentGame.minPlasmaDamage + 1)); + (game.minPlasmaDamage + 1)); 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; - if (currentGame.maxPlasmaDamage <= currentGame.minPlasmaDamage) + if (game.maxPlasmaDamage <= game.minPlasmaDamage) 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_MAX_AMMO].price = (10 * (currentGame.maxPlasmaAmmo - 75)); - shopItems[SHOP_ROCKET_MAX_AMMO].price = (25 * currentGame.maxRocketAmmo); + shopItems[SHOP_PLASMA_MAX_AMMO].price = (10 * (game.maxPlasmaAmmo - 75)); + 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; - if (currentGame.maxPlasmaDamage >= currentGame.maxPlasmaDamageLimit) + if (game.maxPlasmaDamage >= game.maxPlasmaDamageLimit) shopItems[SHOP_PLASMA_MAX_DAMAGE].price = 0; - if (currentGame.maxPlasmaRate >= currentGame.maxPlasmaRateLimit) + if (game.maxPlasmaRate >= game.maxPlasmaRateLimit) shopItems[SHOP_PLASMA_MAX_RATE].price = 0; - if (currentGame.minPlasmaOutput >= currentGame.minPlasmaOutputLimit) + if (game.minPlasmaOutput >= game.minPlasmaOutputLimit) shopItems[SHOP_PLASMA_MIN_OUTPUT].price = 0; - if (currentGame.minPlasmaDamage >= currentGame.minPlasmaDamageLimit) + if (game.minPlasmaDamage >= game.minPlasmaDamageLimit) shopItems[SHOP_PLASMA_MIN_DAMAGE].price = 0; - if (currentGame.minPlasmaRate >= currentGame.minPlasmaRateLimit) + if (game.minPlasmaRate >= game.minPlasmaRateLimit) shopItems[SHOP_PLASMA_MIN_RATE].price = 0; - if (currentGame.maxPlasmaAmmo >= currentGame.maxPlasmaAmmoLimit) + if (game.maxPlasmaAmmo >= game.maxPlasmaAmmoLimit) shopItems[SHOP_PLASMA_MAX_AMMO].price = 0; - if (currentGame.maxRocketAmmo >= currentGame.maxRocketAmmoLimit) + if (game.maxRocketAmmo >= game.maxRocketAmmoLimit) shopItems[SHOP_ROCKET_MAX_AMMO].price = 0; } @@ -200,26 +200,26 @@ static void drawShop() strcpy(description, ""); 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]); sprintf(description, "Plasma Power : Stage %d", - currentGame.minPlasmaDamage); + game.minPlasmaDamage); drawString(description, 10, 37, FONT_WHITE, shopSurface[0]); sprintf(description, "Cooler : Stage %d", - currentGame.minPlasmaRate); + game.minPlasmaRate); drawString(description, 10, 52, FONT_WHITE, shopSurface[0]); drawString("Powerup Weapon", 10, 3, FONT_WHITE, shopSurface[1]); sprintf(description, "Plasma Output : Stage %d", - currentGame.maxPlasmaOutput); + game.maxPlasmaOutput); drawString(description, 10, 22, FONT_WHITE, shopSurface[1]); sprintf(description, "Plasma Condensor : Stage %d", - currentGame.maxPlasmaDamage); + game.maxPlasmaDamage); drawString(description, 10, 37, FONT_WHITE, shopSurface[1]); sprintf(description, "Liquid Nitrogen : Stage %d", - currentGame.maxPlasmaRate); + game.maxPlasmaRate); 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]); drawSecondaryWeaponSurface(); @@ -237,11 +237,11 @@ static void drawShop() signed char icons = MAX_SHOPITEMS; - if (currentGame.system == 0) + if (game.system == 0) icons = SHOP_DOUBLE_ROCKETS + 1; - else if (currentGame.system == 1) + else if (game.system == 1) icons = SHOP_LASER + 1; - else if (currentGame.system == 2) + else if (game.system == 2) icons = SHOP_CHARGER + 1; for (int i = 0 ; i < icons ; i++) @@ -252,7 +252,7 @@ static void drawShop() sprintf(description, "Shield Units : %d", player.maxShield); 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]); sprintf(description, "Plasma Cells : %.3d", player.ammo[0]); drawString(description, 430, 4, FONT_WHITE, shopSurface[4]); @@ -526,7 +526,7 @@ static void shop_sellSecondaryWeapon() static void buy(int i) { - if ((currentGame.cash < shopItems[i].price) && (!engine.cheatCash)) + if ((game.cash < shopItems[i].price) && (!engine.cheatCash)) { shopSelectedItem = -2; drawShop(); @@ -536,39 +536,39 @@ static void buy(int i) switch (i) { case SHOP_PLASMA_MAX_OUTPUT: - if (currentGame.maxPlasmaOutput >= currentGame.maxPlasmaOutputLimit) + if (game.maxPlasmaOutput >= game.maxPlasmaOutputLimit) { shopSelectedItem = -3; return; } - currentGame.maxPlasmaOutput++; + game.maxPlasmaOutput++; break; case SHOP_PLASMA_MAX_DAMAGE: - if (currentGame.maxPlasmaDamage >= currentGame.maxPlasmaDamageLimit) + if (game.maxPlasmaDamage >= game.maxPlasmaDamageLimit) { shopSelectedItem = -3; return; } - currentGame.maxPlasmaDamage++; + game.maxPlasmaDamage++; break; case SHOP_PLASMA_MAX_RATE: - if (currentGame.maxPlasmaRate >= currentGame.maxPlasmaRateLimit) + if (game.maxPlasmaRate >= game.maxPlasmaRateLimit) { shopSelectedItem = -3; return; } - currentGame.maxPlasmaRate++; + game.maxPlasmaRate++; break; case SHOP_PLASMA_AMMO: - if (player.ammo[0] >= currentGame.maxPlasmaAmmo) + if (player.ammo[0] >= game.maxPlasmaAmmo) { shopSelectedItem = -4; return; } - LIMIT_ADD(player.ammo[0], 10, 0, currentGame.maxPlasmaAmmo); + LIMIT_ADD(player.ammo[0], 10, 0, game.maxPlasmaAmmo); break; case SHOP_ROCKET_AMMO: @@ -578,7 +578,7 @@ static void buy(int i) shopSelectedItem = -7; return; } - if (player.ammo[1] == currentGame.maxRocketAmmo) + if (player.ammo[1] == game.maxRocketAmmo) { shopSelectedItem = -4; return; @@ -605,45 +605,45 @@ static void buy(int i) break; case SHOP_PLASMA_MIN_OUTPUT: - if (currentGame.minPlasmaOutput >= currentGame.minPlasmaOutputLimit) + if (game.minPlasmaOutput >= game.minPlasmaOutputLimit) { shopSelectedItem = -3; return; } - currentGame.minPlasmaOutput++; - if (currentGame.maxPlasmaOutput < currentGame.minPlasmaOutput) - currentGame.maxPlasmaOutput = currentGame.minPlasmaOutput; + game.minPlasmaOutput++; + if (game.maxPlasmaOutput < game.minPlasmaOutput) + game.maxPlasmaOutput = game.minPlasmaOutput; break; case SHOP_PLASMA_MIN_DAMAGE: - if (currentGame.minPlasmaDamage >= currentGame.minPlasmaDamageLimit) + if (game.minPlasmaDamage >= game.minPlasmaDamageLimit) { shopSelectedItem = -3; return; } - currentGame.minPlasmaDamage++; - if (currentGame.maxPlasmaDamage < currentGame.minPlasmaDamage) - currentGame.maxPlasmaDamage = currentGame.minPlasmaDamage; + game.minPlasmaDamage++; + if (game.maxPlasmaDamage < game.minPlasmaDamage) + game.maxPlasmaDamage = game.minPlasmaDamage; break; case SHOP_PLASMA_MIN_RATE: - if (currentGame.minPlasmaRate >= currentGame.minPlasmaRateLimit) + if (game.minPlasmaRate >= game.minPlasmaRateLimit) { shopSelectedItem = -3; return; } - currentGame.minPlasmaRate++; - if (currentGame.maxPlasmaRate < currentGame.minPlasmaRate) - currentGame.maxPlasmaRate = currentGame.minPlasmaRate; + game.minPlasmaRate++; + if (game.maxPlasmaRate < game.minPlasmaRate) + game.maxPlasmaRate = game.minPlasmaRate; break; case SHOP_PLASMA_MAX_AMMO: - if (currentGame.maxPlasmaAmmo >= currentGame.maxPlasmaAmmoLimit) + if (game.maxPlasmaAmmo >= game.maxPlasmaAmmoLimit) { shopSelectedItem = -3; return; } - currentGame.maxPlasmaAmmo += 25; + game.maxPlasmaAmmo += 25; break; case SHOP_ROCKET_MAX_AMMO: @@ -654,29 +654,29 @@ static void buy(int i) return; } if ((player.weaponType[1] == W_HOMING_MISSILE) && - (currentGame.maxRocketAmmo >= maxHoming)) + (game.maxRocketAmmo >= maxHoming)) { shopSelectedItem = -9; return; } if ((player.weaponType[1] == W_DOUBLE_HOMING_MISSILES) && - (currentGame.maxRocketAmmo >= maxDoubleHoming)) + (game.maxRocketAmmo >= maxDoubleHoming)) { shopSelectedItem = -9; return; } if ((player.weaponType[1] == W_MICRO_HOMING_MISSILES) && - (currentGame.maxRocketAmmo >= maxMicroHoming)) + (game.maxRocketAmmo >= maxMicroHoming)) { shopSelectedItem = -9; return; } - if (currentGame.maxRocketAmmo >= currentGame.maxRocketAmmoLimit) + if (game.maxRocketAmmo >= game.maxRocketAmmoLimit) { shopSelectedItem = -3; return; } - currentGame.maxRocketAmmo += 5; + game.maxRocketAmmo += 5; break; case SHOP_DOUBLE_ROCKETS: @@ -687,7 +687,7 @@ static void buy(int i) } shop_sellSecondaryWeapon(); player.weaponType[1] = W_DOUBLE_ROCKETS; - LIMIT(currentGame.maxRocketAmmo, 5, 50); + LIMIT(game.maxRocketAmmo, 5, 50); shopSelectedItem = -1; break; @@ -699,7 +699,7 @@ static void buy(int i) } shop_sellSecondaryWeapon(); player.weaponType[1] = W_MICRO_ROCKETS; - LIMIT(currentGame.maxRocketAmmo, 5, 50); + LIMIT(game.maxRocketAmmo, 5, 50); shopSelectedItem = -1; break; @@ -712,7 +712,7 @@ static void buy(int i) shop_sellSecondaryWeapon(); player.weaponType[1] = W_LASER; - while (currentGame.maxRocketAmmo > 5) + while (game.maxRocketAmmo > 5) sell(SHOP_ROCKET_MAX_AMMO); while (player.ammo[1] > 0) sell(SHOP_ROCKET_AMMO); @@ -729,10 +729,10 @@ static void buy(int i) shop_sellSecondaryWeapon(); player.weaponType[1] = W_HOMING_MISSILE; - while (currentGame.maxRocketAmmo > maxHoming) + while (game.maxRocketAmmo > maxHoming) sell(SHOP_ROCKET_MAX_AMMO); - LIMIT(currentGame.maxRocketAmmo, 5, maxHoming); + LIMIT(game.maxRocketAmmo, 5, maxHoming); shopSelectedItem = -1; break; @@ -745,7 +745,7 @@ static void buy(int i) shop_sellSecondaryWeapon(); player.weaponType[1] = W_CHARGER; - while (currentGame.maxRocketAmmo > 5) + while (game.maxRocketAmmo > 5) sell(SHOP_ROCKET_MAX_AMMO); while (player.ammo[1] > 0) sell(SHOP_ROCKET_AMMO); @@ -762,10 +762,10 @@ static void buy(int i) shop_sellSecondaryWeapon(); player.weaponType[1] = W_DOUBLE_HOMING_MISSILES; - while (currentGame.maxRocketAmmo > maxDoubleHoming) + while (game.maxRocketAmmo > maxDoubleHoming) sell(SHOP_ROCKET_MAX_AMMO); - LIMIT(currentGame.maxRocketAmmo, 5, maxDoubleHoming); + LIMIT(game.maxRocketAmmo, 5, maxDoubleHoming); shopSelectedItem = -1; break; @@ -778,16 +778,16 @@ static void buy(int i) shop_sellSecondaryWeapon(); player.weaponType[1] = W_MICRO_HOMING_MISSILES; - while (currentGame.maxRocketAmmo > maxMicroHoming) + while (game.maxRocketAmmo > maxMicroHoming) sell(SHOP_ROCKET_MAX_AMMO); - LIMIT(currentGame.maxRocketAmmo, 5, maxMicroHoming); + LIMIT(game.maxRocketAmmo, 5, maxMicroHoming); shopSelectedItem = -1; break; } if (!engine.cheatCash) - currentGame.cash -= shopItems[i].price; + game.cash -= shopItems[i].price; saveGame(0); } @@ -796,87 +796,87 @@ static void sell(int i) switch (i) { case SHOP_PLASMA_MAX_OUTPUT: - if (currentGame.maxPlasmaOutput <= 1) + if (game.maxPlasmaOutput <= 1) { shopSelectedItem = -5; return; } - while (currentGame.minPlasmaOutput >= currentGame.maxPlasmaOutput) + while (game.minPlasmaOutput >= game.maxPlasmaOutput) sell(SHOP_PLASMA_MIN_OUTPUT); - currentGame.maxPlasmaOutput--; - if (weapon[W_PLAYER_WEAPON].ammo[0] <= currentGame.maxPlasmaOutput + 1) + game.maxPlasmaOutput--; + if (weapon[W_PLAYER_WEAPON].ammo[0] <= game.maxPlasmaOutput + 1) weapon[W_PLAYER_WEAPON].ammo[0] = MIN( weapon[W_PLAYER_WEAPON].ammo[0], - currentGame.maxPlasmaOutput); + game.maxPlasmaOutput); break; case SHOP_PLASMA_MAX_DAMAGE: - if (currentGame.maxPlasmaDamage <= 1) + if (game.maxPlasmaDamage <= 1) { shopSelectedItem = -5; return; } - while (currentGame.minPlasmaDamage >= currentGame.maxPlasmaDamage) + while (game.minPlasmaDamage >= game.maxPlasmaDamage) sell(SHOP_PLASMA_MIN_DAMAGE); - currentGame.maxPlasmaDamage--; - if (weapon[W_PLAYER_WEAPON].damage <= currentGame.maxPlasmaDamage + 1) + game.maxPlasmaDamage--; + if (weapon[W_PLAYER_WEAPON].damage <= game.maxPlasmaDamage + 1) weapon[W_PLAYER_WEAPON].damage = MIN( weapon[W_PLAYER_WEAPON].damage, - currentGame.maxPlasmaDamage); + game.maxPlasmaDamage); break; case SHOP_PLASMA_MAX_RATE: - if (currentGame.maxPlasmaRate <= 1) + if (game.maxPlasmaRate <= 1) { shopSelectedItem = -5; return; } - while (currentGame.minPlasmaRate >= currentGame.maxPlasmaRate) + while (game.minPlasmaRate >= game.maxPlasmaRate) sell(SHOP_PLASMA_MIN_RATE); - currentGame.maxPlasmaRate--; - if (weapon[W_PLAYER_WEAPON].reload[0] >= rate2reload[currentGame.maxPlasmaRate + 1]) + game.maxPlasmaRate--; + if (weapon[W_PLAYER_WEAPON].reload[0] >= rate2reload[game.maxPlasmaRate + 1]) weapon[W_PLAYER_WEAPON].reload[0] = MAX( weapon[W_PLAYER_WEAPON].reload[0], - rate2reload[currentGame.maxPlasmaRate]); + rate2reload[game.maxPlasmaRate]); break; case SHOP_PLASMA_MIN_OUTPUT: - if (currentGame.minPlasmaOutput <= 1) + if (game.minPlasmaOutput <= 1) { shopSelectedItem = -5; return; } - currentGame.minPlasmaOutput--; + game.minPlasmaOutput--; if (player.ammo[0] <= 0) - weapon[W_PLAYER_WEAPON].ammo[0] = currentGame.minPlasmaOutput; + weapon[W_PLAYER_WEAPON].ammo[0] = game.minPlasmaOutput; break; case SHOP_PLASMA_MIN_DAMAGE: - if (currentGame.minPlasmaDamage <= 1) + if (game.minPlasmaDamage <= 1) { shopSelectedItem = -5; return; } - currentGame.minPlasmaDamage--; + game.minPlasmaDamage--; if (player.ammo[0] <= 0) - weapon[W_PLAYER_WEAPON].damage = currentGame.minPlasmaDamage; + weapon[W_PLAYER_WEAPON].damage = game.minPlasmaDamage; break; case SHOP_PLASMA_MIN_RATE: - if (currentGame.minPlasmaRate <= 1) + if (game.minPlasmaRate <= 1) { shopSelectedItem = -5; return; } - currentGame.minPlasmaRate--; + game.minPlasmaRate--; if (player.ammo[0] <= 0) - weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[currentGame.minPlasmaRate]; + weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[game.minPlasmaRate]; break; case SHOP_PLASMA_AMMO: @@ -890,9 +890,9 @@ static void sell(int i) else { player.ammo[0] = 0; - weapon[W_PLAYER_WEAPON].ammo[0] = currentGame.minPlasmaOutput; - weapon[W_PLAYER_WEAPON].damage = currentGame.minPlasmaDamage; - weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[currentGame.minPlasmaRate]; + weapon[W_PLAYER_WEAPON].ammo[0] = game.minPlasmaOutput; + weapon[W_PLAYER_WEAPON].damage = game.minPlasmaDamage; + weapon[W_PLAYER_WEAPON].reload[0] = rate2reload[game.minPlasmaRate]; } break; @@ -906,27 +906,27 @@ static void sell(int i) break; case SHOP_PLASMA_MAX_AMMO: - if (currentGame.maxPlasmaAmmo <= 100) + if (game.maxPlasmaAmmo <= 100) { shopSelectedItem = -1; return; } - currentGame.maxPlasmaAmmo -= 25; + game.maxPlasmaAmmo -= 25; - while (player.ammo[0] > currentGame.maxPlasmaAmmo) + while (player.ammo[0] > game.maxPlasmaAmmo) sell(SHOP_PLASMA_AMMO); break; case SHOP_ROCKET_MAX_AMMO: - if (currentGame.maxRocketAmmo <= 5) + if (game.maxRocketAmmo <= 5) { shopSelectedItem = -1; return; } - currentGame.maxRocketAmmo -= 5; + game.maxRocketAmmo -= 5; - while (player.ammo[1] > currentGame.maxRocketAmmo) + while (player.ammo[1] > game.maxRocketAmmo) sell(SHOP_ROCKET_AMMO); break; @@ -1005,7 +1005,7 @@ static void sell(int i) } adjustShopPrices(); - currentGame.cash += shopItems[i].price; + game.cash += shopItems[i].price; saveGame(0); } @@ -1028,11 +1028,11 @@ void showShop() signed char icons = MAX_SHOPITEMS; - if (currentGame.system == 0) + if (game.system == 0) icons = SHOP_DOUBLE_ROCKETS + 1; - else if (currentGame.system == 1) + else if (game.system == 1) icons = SHOP_LASER + 1; - else if (currentGame.system == 2) + else if (game.system == 2) icons = SHOP_CHARGER + 1; if ((engine.keyState[KEY_FIRE])) diff --git a/src/structs.h b/src/structs.h index bde370b..6c05e5a 100644 --- a/src/structs.h +++ b/src/structs.h @@ -330,11 +330,4 @@ struct cutMsg { }; -struct devVariables { - - int moveAliens; - int fireAliens; - -}; - #endif diff --git a/src/title.cpp b/src/title.cpp index be9d6d6..4bae8c5 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -67,13 +67,13 @@ static void createDifficultyMenu() { 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); - else if (currentGame.difficulty == DIFFICULTY_HARD) + else if (game.difficulty == DIFFICULTY_HARD) 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); - else if (currentGame.difficulty == DIFFICULTY_ORIGINAL) + else if (game.difficulty == DIFFICULTY_ORIGINAL) textSurface(TS_DIFFICULTY, "DIFFICULTY - ORIGINAL", -1, 370, FONT_WHITE); else 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() { - newGame(); + game_init(); engine.gameSection = SECTION_TITLE; @@ -179,8 +179,8 @@ int doTitle() resetLists(); // required to stop the title screen crashing - currentGame.system = 0; - currentGame.area = MISN_START; + game.system = 0; + game.area = MISN_START; loadGameGraphics(); @@ -431,8 +431,8 @@ int doTitle() engine.done = 1; else if (selectedOption == 2) { - currentGame.difficulty++; - currentGame.difficulty %= DIFFICULTY_MAX; + game.difficulty++; + game.difficulty %= DIFFICULTY_MAX; } else if (selectedOption == listLength) { @@ -528,13 +528,13 @@ int doTitle() if (selectedOption == 1) { - newGame(); + game_init(); selectedOption = 2; // go straight to mission 0 } if (selectedOption == 3) { - newGame(); + game_init(); selectedOption = loadGame(continueSaveSlot); }