diff --git a/sound/242856__plasterbrain__nuclear-alarm.ogg b/sound/242856__plasterbrain__nuclear-alarm.ogg new file mode 100644 index 0000000..9fc5a7a Binary files /dev/null and b/sound/242856__plasterbrain__nuclear-alarm.ogg differ diff --git a/src/battle/bullets.c b/src/battle/bullets.c index f3e63eb..832042a 100644 --- a/src/battle/bullets.c +++ b/src/battle/bullets.c @@ -25,6 +25,7 @@ static void checkCollisions(Bullet *b); static Bullet bulletDef[BT_MAX]; static Bullet *bulletsToDraw[MAX_BULLETS_TO_DRAW]; +static int incomingMissile; void initBulletDefs(void) { @@ -63,6 +64,8 @@ void doBullets(void) Bullet *b; Bullet *prev = &battle.bulletHead; + incomingMissile = 0; + memset(bulletsToDraw, 0, sizeof(Bullet*) * MAX_BULLETS_TO_DRAW); for (b = battle.bulletHead.next ; b != NULL ; b = b->next) @@ -75,6 +78,11 @@ void doBullets(void) addMissileEngineEffect(b); huntTarget(b); + + if (b->target == player && player != NULL && player->health > 0) + { + incomingMissile = 1; + } } checkCollisions(b); @@ -164,6 +172,11 @@ void drawBullets(void) { blitRotated(b->texture, b->x - battle.camera.x, b->y - battle.camera.y, b->angle); } + + if (incomingMissile && battle.stats[STAT_TIME] % FPS < 40) + { + drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 60, 18, TA_CENTER, colors.red, "WARNING: INCOMING MISSILE!"); + } } static void faceTarget(Bullet *b) @@ -302,6 +315,11 @@ void fireMissile(Entity *owner) } playBattleSound(b->sound, owner->x, owner->y); + + if (owner->target == player) + { + playSound(SND_INCOMING); + } } void destroyBulletDefs(void) diff --git a/src/battle/bullets.h b/src/battle/bullets.h index aae9421..d86c25e 100644 --- a/src/battle/bullets.h +++ b/src/battle/bullets.h @@ -41,6 +41,9 @@ extern void addMissileEngineEffect(Bullet *b); extern int mod(int n, int x); extern void addMissileExplosion(Bullet *b); extern Entity **getAllEntsWithin(int x, int y, int w, int h, Entity *ignore); +extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...); +extern void playSound(int id); extern Battle battle; +extern Colors colors; extern Entity *player; diff --git a/src/battle/radar.c b/src/battle/radar.c index da6115f..45e3b3c 100644 --- a/src/battle/radar.c +++ b/src/battle/radar.c @@ -122,6 +122,6 @@ void drawRadarRangeWarning(void) if (leaving && battle.stats[STAT_TIME] % FPS < 40) { - drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 50, 14, TA_CENTER, colors.red, "WARNING: Leaving battle area - turn around!"); + drawText(SCREEN_WIDTH / 2, SCREEN_HEIGHT - 30, 14, TA_CENTER, colors.white, "Caution: Leaving battle area - turn around."); } } diff --git a/src/defs.h b/src/defs.h index a07e1dd..324deef 100644 --- a/src/defs.h +++ b/src/defs.h @@ -157,6 +157,7 @@ enum SND_EXPLOSION_4, SND_GET_ITEM, SND_MISSILE, + SND_INCOMING, SND_BOOST, SND_GUI_CLICK, SND_GUI_SELECT, diff --git a/src/system/sound.c b/src/system/sound.c index ebe10a9..aec3d32 100644 --- a/src/system/sound.c +++ b/src/system/sound.c @@ -98,6 +98,7 @@ static void loadSounds(void) sounds[SND_MISSILE] = Mix_LoadWAV("sound/65787__iwilldstroyu__laserrocket.ogg"); sounds[SND_BOOST] = Mix_LoadWAV("sound/18380__inferno__hvrl.ogg"); /*sounds[SND_ECM] = Mix_LoadWAV("sound/18380__inferno__hvrl.ogg");*/ + sounds[SND_INCOMING] = Mix_LoadWAV("sound/242856__plasterbrain__nuclear-alarm.ogg"); sounds[SND_GET_ITEM] = Mix_LoadWAV("sound/56246__q-k__latch-04.ogg"); sounds[SND_EXPLOSION_1] = Mix_LoadWAV("sound/162265__qubodup__explosive.ogg"); sounds[SND_EXPLOSION_2] = Mix_LoadWAV("sound/207322__animationisaac__short-explosion.ogg");