Fixed being able to get hurt after the mission is over.

There were two problems:

1. Some areas did not have any code to protect against this.

2. In one area that did have such code, it was malformed, and actually
   caused the "no damage" cheat to be negated after the mission was
   completed.

Both have been fixed.
This commit is contained in:
onpon4 2016-01-08 16:36:20 -05:00
parent 8897012030
commit 75029e45ee
3 changed files with 6 additions and 6 deletions

View File

@ -1642,7 +1642,7 @@ void alien_move(object *alien)
{ {
if (alien->classDef == CD_ASTEROID) if (alien->classDef == CD_ASTEROID)
{ {
if (!engine.cheatShield) if ((!engine.cheatShield) && (engine.missionCompleteTimer == 0))
player.shield -= alien->shield; player.shield -= alien->shield;
alien->shield = 0; alien->shield = 0;
audio_playSound(SFX_EXPLOSION, alien->x); audio_playSound(SFX_EXPLOSION, alien->x);
@ -1652,7 +1652,7 @@ void alien_move(object *alien)
if (alien->classDef == CD_ASTEROID2) if (alien->classDef == CD_ASTEROID2)
{ {
if (!engine.cheatShield) if ((!engine.cheatShield) && (engine.missionCompleteTimer == 0))
player.shield -= alien->shield; player.shield -= alien->shield;
alien->shield = 0; alien->shield = 0;
audio_playSound(SFX_EXPLOSION, alien->x); audio_playSound(SFX_EXPLOSION, alien->x);
@ -1662,7 +1662,7 @@ void alien_move(object *alien)
if (alien->classDef == CD_BARRIER) if (alien->classDef == CD_BARRIER)
{ {
if (!engine.cheatShield) if ((!engine.cheatShield) && (engine.missionCompleteTimer == 0))
player.shield--; player.shield--;
player.hit = 5; player.hit = 5;
audio_playSound(SFX_HIT, player.x); audio_playSound(SFX_HIT, player.x);

View File

@ -678,7 +678,7 @@ static void game_doBullets()
{ {
old_shield = player.shield; old_shield = player.shield;
if ((!engine.cheatShield) || (engine.missionCompleteTimer != 0)) if ((!engine.cheatShield) && (engine.missionCompleteTimer == 0))
{ {
if ((player.shield > engine.lowShield) && if ((player.shield > engine.lowShield) &&
(player.shield - bullet->damage <= engine.lowShield)) (player.shield - bullet->damage <= engine.lowShield))

View File

@ -164,8 +164,8 @@ void ship_fireRay(object *ship)
if (player.shield > 0) if (player.shield > 0)
{ {
if (game_collision(player.x, player.y, player.image[0]->w, if (game_collision(player.x, player.y, player.image[0]->w,
player.image[0]->h, ray.x, ray.y, ray.w, ray.h) && player.image[0]->h, ray.x, ray.y, ray.w, ray.h) &&
(!engine.cheatShield)) (!engine.cheatShield) && (engine.missionCompleteTimer == 0))
{ {
if (player.shield > engine.lowShield) if (player.shield > engine.lowShield)
{ {