diff --git a/README.md b/README.md index d958f40..d8454c2 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ CC BY-NC-SA 3.0, with the following attribution: Copyright 2015-2016, Stephen J * 39030__wildweasel__d1clsstf.ogg - push_button_switch_07.wav, by joedeshon - https://freesound.org/people/joedeshon/sounds/139061/ * 254174__kwahmah-02__s.ogg - s.wav, by kwahmah_02 - https://freesound.org/people/kwahmah_02/sounds/254174/ * 172870__escortmarius__carbidexplosion.ogg - carbidexplosion.wav, by escortmarius - https://freesound.org/people/escortmarius/sounds/172870/ +* 320181__dland__hint.ogg - hint.wav, by dland - https://freesound.org/people/dland/sounds/320181/ ### MUSIC diff --git a/sound/320181__dland__hint.ogg b/sound/320181__dland__hint.ogg new file mode 100644 index 0000000..363da5c Binary files /dev/null and b/sound/320181__dland__hint.ogg differ diff --git a/src/battle/battle.c b/src/battle/battle.c index a1c58ba..2228d7e 100644 --- a/src/battle/battle.c +++ b/src/battle/battle.c @@ -165,6 +165,11 @@ static void doBattle(void) if (battle.stats[STAT_TIME]++ % FPS == 0) { runScriptFunction("TIME %d", battle.stats[STAT_TIME] / FPS); + + if (game.currentMission->challengeData.timeLimit && game.currentMission->challengeData.timeLimit - battle.stats[STAT_TIME] < 11 * FPS) + { + playSound(SND_TIME_WARNING); + } } } } diff --git a/src/battle/hud.c b/src/battle/hud.c index 5873c15..22bf94a 100644 --- a/src/battle/hud.c +++ b/src/battle/hud.c @@ -406,6 +406,8 @@ static void drawNumFighters(void) static void drawObjectives(void) { + int timeRemaining; + if (!game.currentMission->challengeData.isChallenge) { blit(objectives, (SCREEN_WIDTH / 2) - 50, 14, 0); @@ -415,8 +417,10 @@ static void drawObjectives(void) { if (game.currentMission->challengeData.timeLimit) { + timeRemaining = game.currentMission->challengeData.timeLimit - battle.stats[STAT_TIME]; + blit(clock, (SCREEN_WIDTH / 2) - 50, 14, 0); - drawText(SCREEN_WIDTH / 2, 10, 16, TA_CENTER, colors.white, timeToString(game.currentMission->challengeData.timeLimit - battle.stats[STAT_TIME], 0)); + drawText(SCREEN_WIDTH / 2, 10, 16, TA_CENTER, (timeRemaining < 11 * FPS) ? colors.red : colors.white, timeToString(timeRemaining, 0)); } else { diff --git a/src/defs.h b/src/defs.h index a07cb3c..e485342 100644 --- a/src/defs.h +++ b/src/defs.h @@ -242,6 +242,7 @@ enum SND_BOOST, SND_RADIO, SND_MINE_WARNING, + SND_TIME_WARNING, SND_GUI_CLICK, SND_GUI_SELECT, SND_GUI_CLOSE, diff --git a/src/system/sound.c b/src/system/sound.c index a2c68d3..68d9431 100644 --- a/src/system/sound.c +++ b/src/system/sound.c @@ -119,6 +119,7 @@ static void loadSounds(void) sounds[SND_POWER_DOWN] = loadSound("sound/39030__wildweasel__d1clsstf.ogg"); sounds[SND_SELECT_WEAPON] = loadSound("sound/329359__bassoonrckr__reed-guillotine.ogg"); sounds[SND_MINE_WARNING] = loadSound("sound/254174__kwahmah-02__s.ogg"); + sounds[SND_TIME_WARNING] = loadSound("sound/320181__dland__hint.ogg"); sounds[SND_GUI_CLICK] = loadSound("sound/257786__xtrgamr__mouse-click.ogg"); sounds[SND_GUI_SELECT] = loadSound("sound/321104__nsstudios__blip2.ogg");