Time limit warning for challenges.

This commit is contained in:
Steve 2016-04-03 14:04:56 +01:00
parent 16a1e1b20a
commit 77da136e75
6 changed files with 13 additions and 1 deletions

View File

@ -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

Binary file not shown.

View File

@ -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);
}
}
}
}

View File

@ -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
{

View File

@ -242,6 +242,7 @@ enum
SND_BOOST,
SND_RADIO,
SND_MINE_WARNING,
SND_TIME_WARNING,
SND_GUI_CLICK,
SND_GUI_SELECT,
SND_GUI_CLOSE,

View File

@ -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");