Added an enum for missions/areas.

Eliminating another set of magic numbers, and God, that was tedious.
This commit is contained in:
onpon4 2015-03-29 13:11:12 -04:00
parent 576d254e4a
commit 5019244da1
13 changed files with 617 additions and 518 deletions

View File

@ -686,7 +686,8 @@ bool alien_add()
{ {
int index = alien_getFreeIndex(); int index = alien_getFreeIndex();
if ((index == -1) || (currentGame.area == 23) || (currentGame.area == 26)) if ((index == -1) || (currentGame.area == MISN_JUPITER) ||
(currentGame.area == MISN_VENUS))
return 0; return 0;
signed char *alienArray; signed char *alienArray;
@ -696,28 +697,28 @@ bool alien_add()
switch(currentGame.area) switch(currentGame.area)
{ {
case 0: case MISN_START:
case 3: case MISN_HINSTAG:
case 11: case MISN_ELAMALE:
numberOfAliens = 1; numberOfAliens = 1;
alienArray[0] = CD_DUALFIGHTER; alienArray[0] = CD_DUALFIGHTER;
break; break;
case 1: case MISN_HAIL:
case 2: case MISN_CERADSE:
case 4: case MISN_JOLDAR:
case 5: case MISN_MOEBO:
numberOfAliens = 2; numberOfAliens = 2;
alienArray[0] = CD_DUALFIGHTER; alienArray[0] = CD_DUALFIGHTER;
alienArray[1] = CD_PROTOFIGHTER; alienArray[1] = CD_PROTOFIGHTER;
break; break;
case 7: case MISN_NEROD:
case 8: case MISN_ALLEZ:
numberOfAliens = 3; numberOfAliens = 3;
alienArray[0] = CD_DUALFIGHTER; alienArray[0] = CD_DUALFIGHTER;
alienArray[1] = CD_PROTOFIGHTER; alienArray[1] = CD_PROTOFIGHTER;
alienArray[2] = CD_AIMFIGHTER; alienArray[2] = CD_AIMFIGHTER;
break; break;
case 9: case MISN_URUSOR:
// This is the mission where you need to disable cargo ships. // This is the mission where you need to disable cargo ships.
// Missiles are extremely bad in this mission, not because // Missiles are extremely bad in this mission, not because
// of the damage they do to you, but because they tend to // of the damage they do to you, but because they tend to
@ -728,26 +729,36 @@ bool alien_add()
alienArray[0] = CD_PROTOFIGHTER; alienArray[0] = CD_PROTOFIGHTER;
alienArray[1] = CD_AIMFIGHTER; alienArray[1] = CD_AIMFIGHTER;
break; break;
case 10: case MISN_DORIM:
case 15: case MISN_SIVEDI:
numberOfAliens = 1; numberOfAliens = 1;
alienArray[0] = CD_ASTEROID; alienArray[0] = CD_ASTEROID;
break; break;
case 13: case MISN_ODEON:
case 14: case MISN_FELLON:
case 16: case MISN_ALMARTHA:
numberOfAliens = 4; numberOfAliens = 4;
alienArray[0] = CD_DUALFIGHTER; alienArray[0] = CD_DUALFIGHTER;
alienArray[1] = CD_PROTOFIGHTER; alienArray[1] = CD_PROTOFIGHTER;
alienArray[2] = CD_MISSILEBOAT; alienArray[2] = CD_MISSILEBOAT;
alienArray[3] = CD_AIMFIGHTER; alienArray[3] = CD_AIMFIGHTER;
break; break;
case 18: case MISN_ELLESH:
numberOfAliens = 2; numberOfAliens = 2;
alienArray[0] = CD_DUALFIGHTER; alienArray[0] = CD_DUALFIGHTER;
alienArray[1] = CD_MINER; alienArray[1] = CD_MINER;
break; break;
case 25: case MISN_SATURN:
numberOfAliens = 2;
alienArray[0] = CD_AIMFIGHTER;
alienArray[1] = CD_DUALFIGHTER;
break;
case MISN_MARS:
numberOfAliens = 2;
alienArray[0] = CD_ASTEROID;
alienArray[1] = CD_ASTEROID2;
break;
case MISN_EARTH:
numberOfAliens = 6; numberOfAliens = 6;
alienArray[0] = CD_DUALFIGHTER; alienArray[0] = CD_DUALFIGHTER;
alienArray[1] = CD_PROTOFIGHTER; alienArray[1] = CD_PROTOFIGHTER;
@ -756,17 +767,7 @@ bool alien_add()
alienArray[4] = CD_ESCORT; alienArray[4] = CD_ESCORT;
alienArray[5] = CD_MOBILE_RAY; alienArray[5] = CD_MOBILE_RAY;
break; break;
case 22: case MISN_INTERCEPTION:
numberOfAliens = 2;
alienArray[0] = CD_AIMFIGHTER;
alienArray[1] = CD_DUALFIGHTER;
break;
case 24:
numberOfAliens = 2;
alienArray[0] = CD_ASTEROID;
alienArray[1] = CD_ASTEROID2;
break;
case MAX_MISSIONS - 1:
numberOfAliens = 3; numberOfAliens = 3;
alienArray[0] = CD_DUALFIGHTER; alienArray[0] = CD_DUALFIGHTER;
alienArray[1] = CD_MISSILEBOAT; alienArray[1] = CD_MISSILEBOAT;
@ -785,10 +786,11 @@ bool alien_add()
signed char randEnemy = alienArray[rand() % numberOfAliens]; signed char randEnemy = alienArray[rand() % numberOfAliens];
if ((currentGame.area != 10) && (currentGame.area != 15) && if ((currentGame.area != MISN_DORIM) &&
(currentGame.area != 24)) (currentGame.area != MISN_SIVEDI) &&
(currentGame.area != MISN_MARS))
{ {
if ((currentGame.system == 1) && (currentGame.area == MAX_MISSIONS - 1)) if ((currentGame.system == 1) && (currentGame.area == MISN_INTERCEPTION))
{ {
if ((rand() % 5) == 0) if ((rand() % 5) == 0)
randEnemy = CD_SLAVETRANSPORT; randEnemy = CD_SLAVETRANSPORT;
@ -836,7 +838,7 @@ bool alien_add()
aliens[index].ammo[0] = 0; aliens[index].ammo[0] = 0;
if (currentGame.area == 18) if (currentGame.area == MISN_ELLESH)
aliens[index].flags |= FL_HASMINIMUMSPEED; aliens[index].flags |= FL_HASMINIMUMSPEED;
return true; return true;
@ -925,7 +927,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 == 25) if (currentGame.area == MISN_EARTH)
aliens[type].flags |= FL_IMMORTAL; aliens[type].flags |= FL_IMMORTAL;
} }
@ -941,7 +943,7 @@ bool alien_place(object *alien)
else else
alien->y = RANDRANGE(-screen->h, 0); alien->y = RANDRANGE(-screen->h, 0);
if (currentGame.area == 24) if (currentGame.area == MISN_MARS)
{ {
alien->x = screen->w; alien->x = screen->w;
alien->y = RANDRANGE(screen->h / 3, (2 * screen->h) / 3); alien->y = RANDRANGE(screen->h / 3, (2 * screen->h) / 3);
@ -1079,7 +1081,7 @@ void alien_setKlineAI(object *alien)
// Weapon type change // Weapon type change
if ((rand() % 3) == 0) if ((rand() % 3) == 0)
{ {
if (currentGame.area != 26) if (currentGame.area != MISN_VENUS)
{ {
alien->flags &= ~FL_AIMS; alien->flags &= ~FL_AIMS;
@ -1112,7 +1114,8 @@ void alien_setKlineAI(object *alien)
case 1: case 1:
case 2: case 2:
// Kline only attacks then he is ready! // Kline only attacks then he is ready!
if ((!(alien->flags & FL_NOFIRE)) && (currentGame.area == 11)) if ((!(alien->flags & FL_NOFIRE)) &&
(currentGame.area == MISN_MOEBO))
alien->flags |= FL_DROPMINES; alien->flags |= FL_DROPMINES;
break; break;
case 3: case 3:
@ -1150,14 +1153,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 != 25)) if ((alien->classDef == CD_SID) && (currentGame.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 != 25) if (currentGame.area != MISN_EARTH)
{ {
if ((alien->classDef == CD_PHOEBE) || (alien->classDef == CD_URSULA)) if ((alien->classDef == CD_PHOEBE) || (alien->classDef == CD_URSULA))
{ {
@ -1370,7 +1373,7 @@ void alien_destroy(object *alien, object *attacker)
currentGame.wingMate2Ejects++; currentGame.wingMate2Ejects++;
// Phoebe cannot eject on the rescue mission // Phoebe cannot eject on the rescue mission
if (currentGame.area != 7) if (currentGame.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);
@ -1459,7 +1462,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 == 11) if (currentGame.area == MISN_ELAMALE)
{ {
if ((alien->shield <= alien->maxShield - 500) && if ((alien->shield <= alien->maxShield - 500) &&
!(alien->flags & FL_LEAVESECTOR)) !(alien->flags & FL_LEAVESECTOR))
@ -1469,7 +1472,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 == 25) else if (currentGame.area == MISN_EARTH)
{ {
if ((alien->shield <= alien->maxShield - 750) && if ((alien->shield <= alien->maxShield - 750) &&
!(alien->flags & FL_LEAVESECTOR)) !(alien->flags & FL_LEAVESECTOR))
@ -1479,7 +1482,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 == 26) else if (currentGame.area == MISN_VENUS)
{ {
if (alien->shield + damage > 1500 && if (alien->shield + damage > 1500 &&
alien->shield <= 1500) alien->shield <= 1500)

View File

@ -141,16 +141,16 @@ void audio_playRandomTrack()
switch(currentGame.area) switch(currentGame.area)
{ {
case 0: case MISN_START:
audio_playMusic("music/railjet_short.ogg", -1); audio_playMusic("music/railjet_short.ogg", -1);
break; break;
case 5: case MISN_MOEBO:
case 11: case MISN_ELAMALE:
case 18: case MISN_ELLESH:
case 25: case MISN_EARTH:
audio_playMusic("music/orbital_colossus.ogg", -1); audio_playMusic("music/orbital_colossus.ogg", -1);
break; break;
case 26: case MISN_VENUS:
audio_playMusic("music/RE.ogg", -1); audio_playMusic("music/RE.ogg", -1);
break; break;
default: default:

View File

@ -45,7 +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 == 18) || (currentGame.area == 24)) if ((currentGame.area == MISN_ELLESH) ||
(currentGame.area == MISN_MARS))
bullet->dx += fabsf(engine.ssx + engine.smx); bullet->dx += fabsf(engine.ssx + engine.smx);
} }
else else

View File

@ -53,8 +53,10 @@ void addCollectable(float x, float y, int type, int value, int life)
if ((currentGame.difficulty == DIFFICULTY_NIGHTMARE) || if ((currentGame.difficulty == DIFFICULTY_NIGHTMARE) ||
((currentGame.difficulty != DIFFICULTY_EASY) && ((currentGame.difficulty != DIFFICULTY_EASY) &&
(currentGame.difficulty != DIFFICULTY_ORIGINAL) && (currentGame.difficulty != DIFFICULTY_ORIGINAL) &&
((currentGame.area == 5) || (currentGame.area == 11) || ((currentGame.area == MISN_MOEBO) ||
(currentGame.area == 18) || (currentGame.area == 25)))) (currentGame.area == MISN_ELAMALE) ||
(currentGame.area == MISN_ELLESH) ||
(currentGame.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;
@ -113,7 +115,7 @@ void addCollectable(float x, float y, int type, int value, int life)
{ {
// 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 == MAX_MISSIONS - 1) && (type == P_CASH)) if ((currentGame.area == MISN_INTERCEPTION) && (type == P_CASH))
{ {
if (rand() % 10 > 0) if (rand() % 10 > 0)
return; return;
@ -122,7 +124,7 @@ void addCollectable(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 == MAX_MISSIONS - 1) && if ((currentGame.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;
@ -334,11 +336,11 @@ void doCollectables()
case P_PLASMA_RATE: case P_PLASMA_RATE:
currentGame.powerups++; currentGame.powerups++;
if ((currentGame.area != MAX_MISSIONS - 1) || if ((currentGame.area != MISN_INTERCEPTION) ||
(currentGame.difficulty == DIFFICULTY_ORIGINAL) || (currentGame.difficulty == DIFFICULTY_ORIGINAL) ||
(player.ammo[0] > 0)) (player.ammo[0] > 0))
{ {
if ((currentGame.area != MAX_MISSIONS - 1) || if ((currentGame.area != MISN_INTERCEPTION) ||
(currentGame.difficulty == DIFFICULTY_ORIGINAL)) (currentGame.difficulty == DIFFICULTY_ORIGINAL))
LIMIT_ADD(player.ammo[0], collectable->value, LIMIT_ADD(player.ammo[0], collectable->value,
0, currentGame.maxPlasmaAmmo); 0, currentGame.maxPlasmaAmmo);
@ -359,11 +361,11 @@ void doCollectables()
case P_PLASMA_SHOT: case P_PLASMA_SHOT:
currentGame.powerups++; currentGame.powerups++;
if ((currentGame.area != MAX_MISSIONS - 1) || if ((currentGame.area != MISN_INTERCEPTION) ||
(currentGame.difficulty == DIFFICULTY_ORIGINAL) || (currentGame.difficulty == DIFFICULTY_ORIGINAL) ||
(player.ammo[0] > 0)) (player.ammo[0] > 0))
{ {
if ((currentGame.area != MAX_MISSIONS - 1) || if ((currentGame.area != MISN_INTERCEPTION) ||
(currentGame.difficulty == DIFFICULTY_ORIGINAL)) (currentGame.difficulty == DIFFICULTY_ORIGINAL))
LIMIT_ADD(player.ammo[0], collectable->value, LIMIT_ADD(player.ammo[0], collectable->value,
0, currentGame.maxPlasmaAmmo); 0, currentGame.maxPlasmaAmmo);
@ -384,11 +386,11 @@ void doCollectables()
case P_PLASMA_DAMAGE: case P_PLASMA_DAMAGE:
currentGame.powerups++; currentGame.powerups++;
if ((currentGame.area != MAX_MISSIONS - 1) || if ((currentGame.area != MISN_INTERCEPTION) ||
(currentGame.difficulty == DIFFICULTY_ORIGINAL) || (currentGame.difficulty == DIFFICULTY_ORIGINAL) ||
(player.ammo[0] > 0)) (player.ammo[0] > 0))
{ {
if ((currentGame.area != MAX_MISSIONS - 1) || if ((currentGame.area != MISN_INTERCEPTION) ||
(currentGame.difficulty == DIFFICULTY_ORIGINAL)) (currentGame.difficulty == DIFFICULTY_ORIGINAL))
LIMIT_ADD(player.ammo[0], collectable->value, LIMIT_ADD(player.ammo[0], collectable->value,
0, currentGame.maxPlasmaAmmo); 0, currentGame.maxPlasmaAmmo);
@ -408,11 +410,11 @@ void doCollectables()
case P_SUPER: case P_SUPER:
currentGame.powerups++; currentGame.powerups++;
if ((currentGame.area != MAX_MISSIONS - 1) || if ((currentGame.area != MISN_INTERCEPTION) ||
(currentGame.difficulty == DIFFICULTY_ORIGINAL) || (currentGame.difficulty == DIFFICULTY_ORIGINAL) ||
(player.ammo[0] > 0)) (player.ammo[0] > 0))
{ {
if ((currentGame.area != MAX_MISSIONS - 1) || if ((currentGame.area != MISN_INTERCEPTION) ||
(currentGame.difficulty == DIFFICULTY_ORIGINAL)) (currentGame.difficulty == DIFFICULTY_ORIGINAL))
LIMIT_ADD(player.ammo[0], collectable->value, LIMIT_ADD(player.ammo[0], collectable->value,
0, currentGame.maxPlasmaAmmo); 0, currentGame.maxPlasmaAmmo);

View File

@ -97,7 +97,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MAX_TEXTSHAPES 150 #define MAX_TEXTSHAPES 150
#define MAX_FONTSHAPES 6 #define MAX_FONTSHAPES 6
#define MAX_SHOPSHAPES 6 #define MAX_SHOPSHAPES 6
#define MAX_MISSIONS 28
#define MAX_CARGO 20 #define MAX_CARGO 20
#define SHIP_HIT_INDEX 60 #define SHIP_HIT_INDEX 60
@ -355,6 +354,7 @@ enum {
SFX_MAX SFX_MAX
}; };
// Sections
enum { enum {
SECTION_TITLE, SECTION_TITLE,
@ -362,6 +362,7 @@ enum {
SECTION_GAME SECTION_GAME
}; };
// Faces
enum { enum {
FACE_CHRIS = 90, FACE_CHRIS = 90,
@ -373,6 +374,40 @@ enum {
FACE_CREW FACE_CREW
}; };
// Missions
enum {
MISN_START,
MISN_HAIL,
MISN_CERADSE,
MISN_HINSTAG,
MISN_JOLDAR,
MISN_MOEBO,
MISN_RESCUESLAVES,
MISN_NEROD,
MISN_ALLEZ,
MISN_URUSOR,
MISN_DORIM,
MISN_ELAMALE,
MISN_CLOAKFIGHTER,
MISN_ODEON,
MISN_FELLON,
MISN_SIVEDI,
MISN_ALMARTHA,
MISN_POSWIC,
MISN_ELLESH,
MISN_PLUTO,
MISN_NEPTUNE,
MISN_URANUS,
MISN_SATURN,
MISN_JUPITER,
MISN_MARS,
MISN_EARTH,
MISN_VENUS,
MISN_INTERCEPTION,
MISN_MAX
};
// Difficulties // Difficulties
enum { enum {
DIFFICULTY_EASY = 0, DIFFICULTY_EASY = 0,

View File

@ -24,7 +24,7 @@ Game currentGame;
void newGame() void newGame()
{ {
currentGame.system = 0; currentGame.system = 0;
currentGame.area = 0; currentGame.area = MISN_START;
currentGame.sfxVolume = 0; currentGame.sfxVolume = 0;
currentGame.musicVolume = 0; currentGame.musicVolume = 0;
@ -194,9 +194,9 @@ int mainGameLoop()
showErrorAndExit(2, ""); showErrorAndExit(2, "");
} }
if (currentGame.area == 2) if (currentGame.area == MISN_CERADSE)
addCargo(&aliens[index], P_CARGO); addCargo(&aliens[index], P_CARGO);
else if (currentGame.area == 7) else if (currentGame.area == MISN_NEROD)
addCargo(&aliens[index], P_PHOEBE); addCargo(&aliens[index], P_PHOEBE);
if (index == ALIEN_KLINE) if (index == ALIEN_KLINE)
@ -229,16 +229,17 @@ int mainGameLoop()
barrierSpeed++; barrierSpeed++;
} }
if ((currentGame.area == 17) && (aliens[index].classDef == CD_BOSS)) if ((currentGame.area == MISN_POSWIC) &&
(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 == 18) if (currentGame.area == MISN_ELLESH)
aliens[index].flags |= FL_HASMINIMUMSPEED; aliens[index].flags |= FL_HASMINIMUMSPEED;
if (currentGame.area == 23) if (currentGame.area == MISN_JUPITER)
{ {
aliens[index].flags = FL_WEAPCO; aliens[index].flags = FL_WEAPCO;
if (index == ALIEN_BOSS) if (index == ALIEN_BOSS)
@ -248,7 +249,7 @@ int mainGameLoop()
fclose(fp); fclose(fp);
if (currentGame.area == 5) if (currentGame.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;
@ -264,7 +265,8 @@ int mainGameLoop()
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 == 11) || (currentGame.area == 14)) else if ((currentGame.area == MISN_ELAMALE) ||
(currentGame.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;
@ -290,7 +292,7 @@ int mainGameLoop()
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 == 14) if (currentGame.area == MISN_FELLON)
{ {
aliens[ALIEN_BOSS].AIType = AI_EVASIVE; aliens[ALIEN_BOSS].AIType = AI_EVASIVE;
@ -304,7 +306,7 @@ int mainGameLoop()
} }
} }
} }
else if (currentGame.area == 21) else if (currentGame.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;
@ -319,10 +321,10 @@ int mainGameLoop()
} }
// specific for Phoebe being captured! // specific for Phoebe being captured!
if (currentGame.area == 7) if (currentGame.area == MISN_NEROD)
currentGame.hasWingMate1 = 1; currentGame.hasWingMate1 = 1;
if (currentGame.area == 11) if (currentGame.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++)
@ -334,34 +336,35 @@ int mainGameLoop()
if (currentGame.hasWingMate2) if (currentGame.hasWingMate2)
alien_addFriendly(ALIEN_URSULA); alien_addFriendly(ALIEN_URSULA);
if ((currentGame.area == 9) || (currentGame.area == 17) || if ((currentGame.area == MISN_URUSOR) ||
(currentGame.area == 25)) (currentGame.area == MISN_POSWIC) ||
(currentGame.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 (currentGame.area)
{ {
case 7: case MISN_NEROD:
case 9: case MISN_URUSOR:
case 10: case MISN_DORIM:
case 15: case MISN_SIVEDI:
case 16: case MISN_ALMARTHA:
case 18: case MISN_ELLESH:
case 24: case MISN_MARS:
case 26: case MISN_VENUS:
aliens[ALIEN_PHOEBE].active = false; aliens[ALIEN_PHOEBE].active = false;
aliens[ALIEN_URSULA].active = false; aliens[ALIEN_URSULA].active = false;
break; break;
} }
if (currentGame.area == 10) if (currentGame.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 == MAX_MISSIONS - 1) if (currentGame.area == MISN_INTERCEPTION)
{ {
if ((currentGame.system > 1) && ((rand() % 5) == 0)) if ((currentGame.system > 1) && ((rand() % 5) == 0))
{ {
@ -391,7 +394,7 @@ int mainGameLoop()
} }
} }
if (currentGame.area == 26) if (currentGame.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;
@ -407,35 +410,34 @@ int mainGameLoop()
// Set target energy meter // Set target energy meter
switch (currentGame.area) switch (currentGame.area)
{ {
case 5: case MISN_MOEBO:
case 11: case MISN_ELAMALE:
case 13: case MISN_ODEON:
case 17: case MISN_FELLON:
case 18: case MISN_POSWIC:
case 19: case MISN_ELLESH:
case 20: case MISN_PLUTO:
case 21: case MISN_NEPTUNE:
case 23: case MISN_URANUS:
case MISN_JUPITER:
player_setTarget(ALIEN_BOSS); player_setTarget(ALIEN_BOSS);
break; break;
case 7: case MISN_NEROD:
player_setTarget(ALIEN_PHOEBE); player_setTarget(ALIEN_PHOEBE);
break; break;
case 8: case MISN_ALLEZ:
player_setTarget(ALIEN_GOODTRANSPORT); player_setTarget(ALIEN_GOODTRANSPORT);
break; break;
case 9: case MISN_URUSOR:
player_setTarget(ALIEN_SID); player_setTarget(ALIEN_SID);
break; break;
case 10: case MISN_DORIM:
player_setTarget(0); player_setTarget(0);
break; break;
case 25: case MISN_EARTH:
case 26: case MISN_VENUS:
player_setTarget(ALIEN_KLINE); player_setTarget(ALIEN_KLINE);
break; break;
default:
break;
} }
clearInfoLines(); clearInfoLines();
@ -498,7 +500,7 @@ int mainGameLoop()
if ((missionFailed()) && (engine.missionCompleteTimer == 0)) if ((missionFailed()) && (engine.missionCompleteTimer == 0))
{ {
if (currentGame.area != 5) if (currentGame.area != MISN_MOEBO)
engine.missionCompleteTimer = SDL_GetTicks() + 4000; engine.missionCompleteTimer = SDL_GetTicks() + 4000;
} }
@ -509,14 +511,15 @@ int mainGameLoop()
{ {
if (SDL_GetTicks() >= engine.missionCompleteTimer) if (SDL_GetTicks() >= engine.missionCompleteTimer)
{ {
if ((!missionFailed()) && (currentGame.area != 26)) if ((!missionFailed()) && (currentGame.area != MISN_VENUS))
{ {
leaveSector(); leaveSector();
if ((engine.done == 2) && (currentGame.area != 10) && if ((engine.done == 2) &&
(currentGame.area != 15)) (currentGame.area != MISN_DORIM) &&
(currentGame.area != MISN_SIVEDI))
{ {
if ((aliens[ALIEN_PHOEBE].shield > 0) && if ((aliens[ALIEN_PHOEBE].shield > 0) &&
(currentGame.area != 25)) (currentGame.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;
@ -524,15 +527,15 @@ int mainGameLoop()
} }
if ((aliens[ALIEN_URSULA].shield > 0) && if ((aliens[ALIEN_URSULA].shield > 0) &&
(currentGame.area != 25)) (currentGame.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 == 9) || if ((currentGame.area == MISN_URUSOR) ||
(currentGame.area == 17)) (currentGame.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;
@ -540,7 +543,8 @@ int mainGameLoop()
} }
} }
} }
else if ((currentGame.area == 26) && (engine.musicVolume > 0)) else if ((currentGame.area == MISN_VENUS) &&
(engine.musicVolume > 0))
{ {
LIMIT_ADD(engine.musicVolume, -0.2, 0, 100); LIMIT_ADD(engine.musicVolume, -0.2, 0, 100);
audio_setMusicVolume((int)engine.musicVolume); audio_setMusicVolume((int)engine.musicVolume);
@ -676,7 +680,8 @@ int mainGameLoop()
if (alien->x > alien->target->x) alien->face = 1; if (alien->x > alien->target->x) alien->face = 1;
} }
if ((currentGame.area == 18) && (alien->classDef == CD_BOSS)) if ((currentGame.area == MISN_ELLESH) &&
(alien->classDef == CD_BOSS))
alien->face = 0; alien->face = 0;
if ((alien->flags & FL_DEPLOYDRONES) && ((rand() % 300) == 0)) if ((alien->flags & FL_DEPLOYDRONES) && ((rand() % 300) == 0))
@ -849,7 +854,7 @@ int mainGameLoop()
} }
} }
if ((currentGame.area == 24) && (alien->x < -300)) if ((currentGame.area == MISN_MARS) && (alien->x < -300))
alien->active = false; alien->active = false;
} }
else else
@ -886,7 +891,7 @@ int mainGameLoop()
(!(alien->flags & FL_DISABLED))) (!(alien->flags & FL_DISABLED)))
alien_move(alien); alien_move(alien);
if ((currentGame.area != 18) || (alien->shield < 0)) if ((currentGame.area != MISN_ELLESH) || (alien->shield < 0))
alien->x += engine.ssx; alien->x += engine.ssx;
alien->x += engine.smx; alien->x += engine.smx;
@ -917,7 +922,7 @@ int mainGameLoop()
} }
} }
if ((currentGame.area == 24) && (engine.addAliens > -1)) if ((currentGame.area == MISN_MARS) && (engine.addAliens > -1))
{ {
if ((rand() % 10) == 0) if ((rand() % 10) == 0)
// XXX: The originally specified range for x was [800, 100], // XXX: The originally specified range for x was [800, 100],
@ -943,7 +948,8 @@ int mainGameLoop()
engine.missionCompleteTimer = SDL_GetTicks() + 7000; engine.missionCompleteTimer = SDL_GetTicks() + 7000;
// specific to Boss 1 // specific to Boss 1
if ((currentGame.area == 5) && (aliens[ALIEN_BOSS].flags & FL_ESCAPED)) if ((currentGame.area == MISN_MOEBO) &&
(aliens[ALIEN_BOSS].flags & FL_ESCAPED))
{ {
audio_playSound(SFX_DEATH, aliens[ALIEN_BOSS].x); audio_playSound(SFX_DEATH, aliens[ALIEN_BOSS].x);
clearScreen(white); clearScreen(white);
@ -965,33 +971,33 @@ int mainGameLoop()
if ((player.shield > 0) && (!missionFailed())) if ((player.shield > 0) && (!missionFailed()))
{ {
if (currentGame.area < 26) if (currentGame.area < MISN_VENUS)
missionFinishedScreen(); missionFinishedScreen();
switch (currentGame.area) switch (currentGame.area)
{ {
case 5: case MISN_MOEBO:
doCutscene(1); doCutscene(1);
doCutscene(2); doCutscene(2);
break; break;
case 7: case MISN_NEROD:
doCutscene(3); doCutscene(3);
break; break;
case 11: case MISN_ELAMALE:
doCutscene(4); doCutscene(4);
break; break;
case 13: case MISN_ODEON:
doCutscene(5); doCutscene(5);
break; break;
case 18: case MISN_ELLESH:
doCutscene(6); doCutscene(6);
break; break;
case 26: case MISN_VENUS:
doCredits(); doCredits();
break; break;
} }
if (currentGame.area < 26) if (currentGame.area < MISN_VENUS)
{ {
updateSystemStatus(); updateSystemStatus();
saveGame(0); saveGame(0);
@ -999,7 +1005,7 @@ int mainGameLoop()
rtn = 1; rtn = 1;
if (currentGame.area == 26) if (currentGame.area == MISN_VENUS)
rtn = 0; rtn = 0;
} }
else else

View File

@ -768,7 +768,7 @@ int galaxyMap()
{ {
if ((rand() % interceptionChance) == 0) if ((rand() % interceptionChance) == 0)
{ {
currentGame.area = MAX_MISSIONS - 1; currentGame.area = MISN_INTERCEPTION;
rtn = 2; rtn = 2;
engine.done = 1; engine.done = 1;
currentGame.distanceCovered = destRect.w; currentGame.distanceCovered = destRect.w;

View File

@ -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 != 26) if (currentGame.area != MISN_VENUS)
return (insult[rand() % 3]); return (insult[rand() % 3]);
else else
return (insult[3 + (rand() % 2)]); return (insult[3 + (rand() % 2)]);
@ -162,8 +162,8 @@ void getPlayerDeathMessage()
int faceToUse = FACE_PHOEBE; int faceToUse = FACE_PHOEBE;
if ((currentGame.area == 9) || (currentGame.area == 17) || if ((currentGame.area == MISN_URUSOR) || (currentGame.area == MISN_POSWIC) ||
(currentGame.area == 25)) (currentGame.area == MISN_EARTH))
{ {
faceToUse = FACE_SID; faceToUse = FACE_SID;
} }

View File

@ -163,7 +163,7 @@ void doInfo()
blitText(30); blitText(30);
} }
if (currentGame.area != MAX_MISSIONS - 1) if (currentGame.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));
@ -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 != 10) if (currentGame.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))
{ {

File diff suppressed because it is too large Load Diff

View File

@ -224,8 +224,9 @@ void doPlayer()
engine.keyState[KEY_PAUSE] = 0; engine.keyState[KEY_PAUSE] = 0;
} }
if (((currentGame.area == 18) && (aliens[ALIEN_BOSS].shield > 0)) || if (((currentGame.area == MISN_ELLESH) &&
(currentGame.area == 24)) (aliens[ALIEN_BOSS].shield > 0)) ||
(currentGame.area == MISN_MARS))
{ {
player.face = 0; player.face = 0;
xmoved = true; xmoved = true;
@ -321,7 +322,7 @@ void doPlayer()
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 == 18) if (currentGame.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;
@ -344,14 +345,14 @@ void 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 == 18) && (aliens[ALIEN_BOSS].shield > 0) && if ((currentGame.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 == 24) if (currentGame.area == MISN_MARS)
{ {
engine.ssx = -6; engine.ssx = -6;
engine.ssy = 0; engine.ssy = 0;

View File

@ -48,7 +48,7 @@ void loadScriptEvents()
gameEvent[i].flag = 0; gameEvent[i].flag = 0;
} }
if ((currentGame.area == MAX_MISSIONS - 1) && if ((currentGame.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();

View File

@ -180,7 +180,7 @@ int doTitle()
// required to stop the title screen crashing // required to stop the title screen crashing
currentGame.system = 0; currentGame.system = 0;
currentGame.area = 0; currentGame.area = MISN_START;
loadGameGraphics(); loadGameGraphics();