diff --git a/src/alien.c b/src/alien.c index e7d42fa..16bfe9b 100644 --- a/src/alien.c +++ b/src/alien.c @@ -1190,7 +1190,11 @@ void aliens_init() } } -int alien_add() +/* Adds an alien. If spawnedMisnTarget is non-NULL, it is set to 1 if + * a mission target which can be forced with game.forceMisnTarget was + * spawned (or otherwise left unchanged). + */ +int alien_add(int *spawnedMisnTarget) { int index = alien_getFreeIndex(); @@ -1315,10 +1319,19 @@ int alien_add() && (game.area != MISN_SIVEDI) && (game.area != MISN_MARS)) { - if ((game.system == SYSTEM_EYANANTH) && (game.area == MISN_INTERCEPTION)) + if ((game.system == SYSTEM_EYANANTH) + && (game.area == MISN_INTERCEPTION)) { - if (CHANCE(1. / 5.)) + if (CHANCE(1. / 5.) + || (game.difficulty != DIFFICULTY_ORIGINAL + && game.forceMisnTarget)) + { randEnemy = CD_SLAVETRANSPORT; + game.forceMisnTarget = 0; + + if (spawnedMisnTarget != NULL) + *spawnedMisnTarget = 1; + } } if (CHANCE(1. / 6.)) diff --git a/src/alien.h b/src/alien.h index 6a8a631..fcfb435 100644 --- a/src/alien.h +++ b/src/alien.h @@ -29,7 +29,7 @@ extern Object aliens[ALIEN_MAX]; void alien_nerf(int index); void alien_defs_init(); void aliens_init(); -int alien_add(); +int alien_add(int *spawnedMisnTarget); void alien_addDrone(Object *hostAlien); void alien_addSmallAsteroid(Object *hostAlien); void alien_addFriendly(int type); diff --git a/src/game.c b/src/game.c index 604852c..291e582 100644 --- a/src/game.c +++ b/src/game.c @@ -104,6 +104,8 @@ void game_init() game.slavesRescued = 0; game.experimentalShield = 1000; + game.forceMisnTarget = 1; + game.timeTaken = 0; game.stationedPlanet = -1; @@ -2523,6 +2525,7 @@ void game_getDifficultyText(char *dest, int difficulty) int game_mainLoop() { + int spawnedMisnTarget; float chance; engine_resetLists(); @@ -2541,8 +2544,12 @@ int game_mainLoop() if (game.area == MISN_ELAMALE) aliens[ALIEN_KLINE].active = 0; + spawnedMisnTarget = 0; for (int i = 0 ; i < engine.maxAliens ; i++) - alien_add(); + alien_add(&spawnedMisnTarget); + + if (!spawnedMisnTarget) + game.forceMisnTarget = 1; if (game.hasWingMate1) alien_addFriendly(ALIEN_PHOEBE); @@ -2594,7 +2601,9 @@ int game_mainLoop() if ((game.system == SYSTEM_MORDOR) && (game.experimentalShield > 0)) { - if (CHANCE(4. / 5.)) + if (CHANCE(4. / 5.) + || (game.difficulty != DIFFICULTY_ORIGINAL + && game.forceMisnTarget)) { aliens[ALIEN_BOSS] = alien_defs[CD_CLOAKFIGHTER]; aliens[ALIEN_BOSS].owner = &aliens[ALIEN_BOSS]; @@ -2605,7 +2614,10 @@ int game_mainLoop() aliens[ALIEN_BOSS].y = player.y; player_setTarget(ALIEN_BOSS); aliens[ALIEN_BOSS].shield = game.experimentalShield; + game.forceMisnTarget = 0; } + else + game.forceMisnTarget = 1; } // Note: music is started here only for interceptions. For @@ -2893,7 +2905,7 @@ int game_mainLoop() WRAP_ADD(engine.addAliens, -1, 0, mission.addAliens); if ((engine.addAliens == 0) && (allowableAliens > 0)) { - allowableAliens -= alien_add(); + allowableAliens -= alien_add(NULL); } } diff --git a/src/game.h b/src/game.h index 5f483ed..ecf6bac 100644 --- a/src/game.h +++ b/src/game.h @@ -64,6 +64,9 @@ typedef struct Game_ { // remaining shield for experimental fighter int experimentalShield; + // Whether to force interception targets to appear + int forceMisnTarget; + Uint32 timeTaken; // In seconds int missionCompleted[MAX_PLANETS]; diff --git a/src/intermission.c b/src/intermission.c index 755193a..9106c16 100644 --- a/src/intermission.c +++ b/src/intermission.c @@ -179,6 +179,7 @@ void intermission_updateSystemStatus() game.stationedPlanet = 0; game.system = 1; game.area = MISN_RESCUESLAVES; + game.forceMisnTarget = 1; intermission_initPlanets(game.system); if (game.difficulty == DIFFICULTY_ORIGINAL) @@ -189,6 +190,7 @@ void intermission_updateSystemStatus() game.stationedPlanet = 0; game.system = 2; game.area = MISN_CLOAKFIGHTER; + game.forceMisnTarget = 1; intermission_initPlanets(game.system); if (game.difficulty == DIFFICULTY_ORIGINAL)