Removed the shock damage messages, fixed a mistake.

This commit is contained in:
onpon4 2015-04-24 16:37:55 -04:00
parent 5982fcc0d8
commit 59a15eb6f3
4 changed files with 14 additions and 17 deletions

View File

@ -216,6 +216,5 @@ void collectable_explode(collectables *collectable)
addExplosion(collectable->x + rand() % 25 - rand() % 25, addExplosion(collectable->x + rand() % 25 - rand() % 25,
collectable->y + rand() % 25 - rand() % 25, E_BIG_EXPLOSION); collectable->y + rand() % 25 - rand() % 25, E_BIG_EXPLOSION);
if (player_checkShockDamage(collectable->x, collectable->y)) player_checkShockDamage(collectable->x, collectable->y);
setInfoLine("Warning: Mine damage to shield!!", FONT_RED);
} }

View File

@ -430,13 +430,15 @@ static void game_doBullets()
object *bullet = engine.bulletHead; object *bullet = engine.bulletHead;
object *prevBullet = engine.bulletHead; object *prevBullet = engine.bulletHead;
collectables *collectable = engine.collectableHead; collectables *collectable;
collectables *prevCollectable = engine.collectableHead; collectables *prevCollectable;
bool okayToHit = false; bool okayToHit = false;
int old_shield; int old_shield;
float homingMissileSpeed = 0; float homingMissileSpeed = 0;
bullet = engine.bulletHead;
prevBullet = engine.bulletHead;
engine.bulletTail = engine.bulletHead; engine.bulletTail = engine.bulletHead;
while (bullet->next != NULL) while (bullet->next != NULL)
@ -660,6 +662,8 @@ static void game_doBullets()
} }
// check to see if a bullet (on any side) hits a mine // check to see if a bullet (on any side) hits a mine
collectable = engine.collectableHead;
prevCollectable = engine.collectableHead;
engine.collectableTail = engine.collectableHead; engine.collectableTail = engine.collectableHead;
while (collectable->next != NULL) while (collectable->next != NULL)
{ {
@ -715,9 +719,7 @@ static void game_doBullets()
addExplosion(bullet->x + RANDRANGE(-35, 35), addExplosion(bullet->x + RANDRANGE(-35, 35),
bullet->y + RANDRANGE(-35, 35), E_BIG_EXPLOSION); bullet->y + RANDRANGE(-35, 35), E_BIG_EXPLOSION);
if (player_checkShockDamage (bullet->x, bullet->y)) player_checkShockDamage(bullet->x, bullet->y);
setInfoLine("Warning: Missile Shockwave Damage!!",
FONT_RED);
} }
bullet->active = false; bullet->active = false;
} }

View File

@ -68,15 +68,15 @@ void player_setTarget(int index)
engine.targetShield /= aliens[index].shield; 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 // Don't let the player be hurt by an explosion after they have completed
// all the mission objectives. That would be *really* annoying! // all the mission objectives. That would be *really* annoying!
if ((engine.cheatShield) || (engine.missionCompleteTimer != 0)) if ((engine.cheatShield) || (engine.missionCompleteTimer != 0))
return 0; return;
float distX = fabsf(x - player.x);
float distY = fabsf(y - player.y);
if ((distX <= 50) && (distY <= 50)) if ((distX <= 50) && (distY <= 50))
{ {
@ -90,11 +90,7 @@ char player_checkShockDamage(float x, float y)
player.shield -= (int)(10 - distY); player.shield -= (int)(10 - distY);
LIMIT(player.shield, 0, player.maxShield); LIMIT(player.shield, 0, player.maxShield);
player.hit = 10; player.hit = 10;
return 1;
} }
return 0;
} }
void exitPlayer() void exitPlayer()

View File

@ -25,7 +25,7 @@ extern bool player_chargerFired;
extern void initPlayer(); extern void initPlayer();
void player_setTarget(int index); void player_setTarget(int index);
char player_checkShockDamage(float x, float y); void player_checkShockDamage(float x, float y);
extern void exitPlayer(); extern void exitPlayer();
extern void flushInput(); extern void flushInput();
extern void getPlayerInput(); extern void getPlayerInput();