Made Chris not leave until all worthwhile collectables are gone.
This is something I've been thinking of doing for awhile. The automatic leaving can be frustrating if you were trying to collect the money dropped by the enemy and you're suddenly forced out of the mission. This prevents that by simply waiting to do the exit sequence until no worthwhile collectables are left in the area. Ellesh and Mars are excluded since this won't really work in those areas. Also excluded by Classic and Nightmare difficulties.
This commit is contained in:
parent
becb2cc501
commit
cfecdbd585
|
@ -315,3 +315,42 @@ void collectable_explode(Collectable *collectable)
|
|||
|
||||
player_checkShockDamage(collectable->x, collectable->y);
|
||||
}
|
||||
|
||||
/*
|
||||
Returns the number of "good" collectables (all collectables excluding
|
||||
mines and unneeded refills) that exist.
|
||||
*/
|
||||
int collectable_numGood()
|
||||
{
|
||||
Collectable *col = engine.collectableHead->next;
|
||||
int n = 0;
|
||||
|
||||
while (col != NULL)
|
||||
{
|
||||
if ((col->type != P_MINE) &&
|
||||
((col->type != P_SHIELD) || (player.shield < player.maxShield)) &&
|
||||
((col->type != P_ROCKET) || (player.ammo[1] < game.maxRocketAmmo)) &&
|
||||
((col->type != P_PLASMA_AMMO) || (player.ammo[0] < game.maxPlasmaAmmo)) &&
|
||||
((col->type != P_PLASMA_SHOT) ||
|
||||
(player.ammo[0] < game.maxPlasmaAmmo) ||
|
||||
(weapons[W_PLAYER_WEAPON].ammo[0] < game.maxPlasmaOutput)) &&
|
||||
((col->type != P_PLASMA_DAMAGE) ||
|
||||
(player.ammo[0] < game.maxPlasmaAmmo) ||
|
||||
(weapons[W_PLAYER_WEAPON].damage < game.maxPlasmaDamage)) &&
|
||||
((col->type != P_PLASMA_RATE) ||
|
||||
(player.ammo[0] < game.maxPlasmaAmmo) ||
|
||||
(weapons[W_PLAYER_WEAPON].reload[0] > rate2reload[game.maxPlasmaRate])) &&
|
||||
((col->type != P_SUPER) ||
|
||||
(player.ammo[0] < game.maxPlasmaAmmo) ||
|
||||
(weapons[W_PLAYER_WEAPON].ammo[0] < game.maxPlasmaOutput) ||
|
||||
(weapons[W_PLAYER_WEAPON].damage < game.maxPlasmaDamage) ||
|
||||
(weapons[W_PLAYER_WEAPON].reload[0] > rate2reload[game.maxPlasmaRate])))
|
||||
{
|
||||
n++;
|
||||
}
|
||||
|
||||
col = col->next;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
|
|
@ -41,5 +41,6 @@ typedef struct Collectable_ {
|
|||
void collectable_add(float x, float y, int type, int value, int life);
|
||||
int collectable_collision(Collectable *collectable, Object *ship);
|
||||
void collectable_explode(Collectable *collectable);
|
||||
int collectable_numGood();
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2601,7 +2601,11 @@ int game_mainLoop()
|
|||
engine.gameSection = SECTION_INTERMISSION;
|
||||
if (player.shield > 0)
|
||||
{
|
||||
if (SDL_GetTicks() >= engine.missionCompleteTimer)
|
||||
if ((SDL_GetTicks() >= engine.missionCompleteTimer) &&
|
||||
((game.difficulty == DIFFICULTY_ORIGINAL) ||
|
||||
(game.difficulty == DIFFICULTY_NIGHTMARE) ||
|
||||
(game.area == MISN_ELLESH) || (game.area == MISN_MARS) ||
|
||||
(mission_checkFailed()) || (collectable_numGood() <= 0)))
|
||||
{
|
||||
if ((!mission_checkFailed()) && (game.area != MISN_VENUS))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue