diff --git a/src/collectable.cpp b/src/collectable.cpp index 1e67c76..6752553 100644 --- a/src/collectable.cpp +++ b/src/collectable.cpp @@ -216,6 +216,5 @@ void collectable_explode(collectables *collectable) addExplosion(collectable->x + rand() % 25 - rand() % 25, collectable->y + rand() % 25 - rand() % 25, E_BIG_EXPLOSION); - if (player_checkShockDamage(collectable->x, collectable->y)) - setInfoLine("Warning: Mine damage to shield!!", FONT_RED); + player_checkShockDamage(collectable->x, collectable->y); } diff --git a/src/game.cpp b/src/game.cpp index 9a3222f..c958ee6 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -430,13 +430,15 @@ static void game_doBullets() object *bullet = engine.bulletHead; object *prevBullet = engine.bulletHead; - collectables *collectable = engine.collectableHead; - collectables *prevCollectable = engine.collectableHead; + collectables *collectable; + collectables *prevCollectable; bool okayToHit = false; int old_shield; float homingMissileSpeed = 0; + bullet = engine.bulletHead; + prevBullet = engine.bulletHead; engine.bulletTail = engine.bulletHead; while (bullet->next != NULL) @@ -660,6 +662,8 @@ static void game_doBullets() } // check to see if a bullet (on any side) hits a mine + collectable = engine.collectableHead; + prevCollectable = engine.collectableHead; engine.collectableTail = engine.collectableHead; while (collectable->next != NULL) { @@ -715,9 +719,7 @@ static void game_doBullets() addExplosion(bullet->x + RANDRANGE(-35, 35), bullet->y + RANDRANGE(-35, 35), E_BIG_EXPLOSION); - if (player_checkShockDamage (bullet->x, bullet->y)) - setInfoLine("Warning: Missile Shockwave Damage!!", - FONT_RED); + player_checkShockDamage(bullet->x, bullet->y); } bullet->active = false; } diff --git a/src/player.cpp b/src/player.cpp index ba3d32f..9a99368 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -68,15 +68,15 @@ void player_setTarget(int index) engine.targetShield /= aliens[index].shield; } -char player_checkShockDamage(float x, float y) +void player_checkShockDamage(float x, float y) { + float distX = fabsf(x - player.x); + float distY = fabsf(y - player.y); + // Don't let the player be hurt by an explosion after they have completed // all the mission objectives. That would be *really* annoying! if ((engine.cheatShield) || (engine.missionCompleteTimer != 0)) - return 0; - - float distX = fabsf(x - player.x); - float distY = fabsf(y - player.y); + return; if ((distX <= 50) && (distY <= 50)) { @@ -90,11 +90,7 @@ char player_checkShockDamage(float x, float y) player.shield -= (int)(10 - distY); LIMIT(player.shield, 0, player.maxShield); player.hit = 10; - - return 1; } - - return 0; } void exitPlayer() diff --git a/src/player.h b/src/player.h index fbe5dca..0f70ada 100644 --- a/src/player.h +++ b/src/player.h @@ -25,7 +25,7 @@ extern bool player_chargerFired; extern void initPlayer(); void player_setTarget(int index); -char player_checkShockDamage(float x, float y); +void player_checkShockDamage(float x, float y); extern void exitPlayer(); extern void flushInput(); extern void getPlayerInput();