Added time up status for finishing a challenge already partly passed.
This commit is contained in:
parent
f55a4e57c8
commit
09a89e692b
Binary file not shown.
After Width: | Height: | Size: 7.5 KiB |
|
@ -96,7 +96,7 @@ void initBattle(void)
|
||||||
|
|
||||||
static void logic(void)
|
static void logic(void)
|
||||||
{
|
{
|
||||||
if (battle.status == MS_IN_PROGRESS || battle.status == MS_COMPLETE || battle.status == MS_FAILED)
|
if (battle.status == MS_IN_PROGRESS || battle.status == MS_COMPLETE || battle.status == MS_FAILED || battle.status == MS_TIME_UP)
|
||||||
{
|
{
|
||||||
handleKeyboard();
|
handleKeyboard();
|
||||||
|
|
||||||
|
@ -276,12 +276,12 @@ static void handleKeyboard(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS);
|
clearInput();
|
||||||
|
|
||||||
playSound(SND_GUI_CLOSE);
|
playSound(SND_GUI_CLOSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (app.keyboard[SDL_SCANCODE_TAB])
|
if (battle.status == MS_IN_PROGRESS && app.keyboard[SDL_SCANCODE_TAB])
|
||||||
{
|
{
|
||||||
battle.status = MS_PAUSED;
|
battle.status = MS_PAUSED;
|
||||||
}
|
}
|
||||||
|
@ -296,7 +296,7 @@ static void resume(void)
|
||||||
{
|
{
|
||||||
show = SHOW_BATTLE;
|
show = SHOW_BATTLE;
|
||||||
|
|
||||||
memset(app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS);
|
clearInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void continueGame(void)
|
static void continueGame(void)
|
||||||
|
|
|
@ -83,6 +83,7 @@ extern void destroyBullets(void);
|
||||||
extern void destroyEffects(void);
|
extern void destroyEffects(void);
|
||||||
extern void initChallengeHome(void);
|
extern void initChallengeHome(void);
|
||||||
extern void updateAccuracyStats(unsigned int *stats);
|
extern void updateAccuracyStats(unsigned int *stats);
|
||||||
|
extern void clearInput(void);
|
||||||
|
|
||||||
extern App app;
|
extern App app;
|
||||||
extern Battle battle;
|
extern Battle battle;
|
||||||
|
|
|
@ -28,6 +28,7 @@ static SDL_Texture *missionStartTexture;
|
||||||
static SDL_Texture *missionInProgressTexture;
|
static SDL_Texture *missionInProgressTexture;
|
||||||
static SDL_Texture *missionCompleteTexture;
|
static SDL_Texture *missionCompleteTexture;
|
||||||
static SDL_Texture *missionFailedTexture;
|
static SDL_Texture *missionFailedTexture;
|
||||||
|
static SDL_Texture *timeUpTexture;
|
||||||
static const char *objectiveStatus[OS_MAX];
|
static const char *objectiveStatus[OS_MAX];
|
||||||
|
|
||||||
void initMissionInfo(void)
|
void initMissionInfo(void)
|
||||||
|
@ -43,6 +44,7 @@ void initMissionInfo(void)
|
||||||
missionInProgressTexture = !isChallenge ? getTexture("gfx/battle/missionInProgress.png") : getTexture("gfx/battle/challengeInProgress.png");
|
missionInProgressTexture = !isChallenge ? getTexture("gfx/battle/missionInProgress.png") : getTexture("gfx/battle/challengeInProgress.png");
|
||||||
missionCompleteTexture = !isChallenge ? getTexture("gfx/battle/missionComplete.png") : getTexture("gfx/battle/challengeComplete.png");
|
missionCompleteTexture = !isChallenge ? getTexture("gfx/battle/missionComplete.png") : getTexture("gfx/battle/challengeComplete.png");
|
||||||
missionFailedTexture = !isChallenge ? getTexture("gfx/battle/missionFailed.png") : getTexture("gfx/battle/challengeFailed.png");
|
missionFailedTexture = !isChallenge ? getTexture("gfx/battle/missionFailed.png") : getTexture("gfx/battle/challengeFailed.png");
|
||||||
|
timeUpTexture = getTexture("gfx/battle/timeUp.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawMissionInfo(void)
|
void drawMissionInfo(void)
|
||||||
|
@ -74,6 +76,18 @@ void drawMissionInfo(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MS_TIME_UP:
|
||||||
|
if (battle.missionFinishedTimer <= -FPS)
|
||||||
|
{
|
||||||
|
drawMissionSummary(timeUpTexture);
|
||||||
|
|
||||||
|
if (battle.missionFinishedTimer <= -(FPS * 2))
|
||||||
|
{
|
||||||
|
drawWidgets("battleWon");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,8 @@ static void failChallenge(void);
|
||||||
static void updateChallenges(void);
|
static void updateChallenges(void);
|
||||||
static char *getFormattedChallengeDescription(const char *format, ...);
|
static char *getFormattedChallengeDescription(const char *format, ...);
|
||||||
char *getChallengeDescription(Challenge *c);
|
char *getChallengeDescription(Challenge *c);
|
||||||
static int hasFailedAllChallenges(void);
|
|
||||||
static int challengeFinished(void);
|
static int challengeFinished(void);
|
||||||
|
static int alreadyPassed(void);
|
||||||
static void printStats(void);
|
static void printStats(void);
|
||||||
|
|
||||||
static char descriptionBuffer[MAX_DESCRIPTION_LENGTH];
|
static char descriptionBuffer[MAX_DESCRIPTION_LENGTH];
|
||||||
|
@ -80,14 +80,14 @@ void doChallenges(void)
|
||||||
{
|
{
|
||||||
if (challengeFinished())
|
if (challengeFinished())
|
||||||
{
|
{
|
||||||
updateChallenges();
|
if (battle.stats[STAT_TIME] >= game.currentMission->challengeData.timeLimit)
|
||||||
|
|
||||||
if (hasFailedAllChallenges())
|
|
||||||
{
|
{
|
||||||
failChallenge();
|
failChallenge();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
updateChallenges();
|
||||||
|
|
||||||
completeChallenge();
|
completeChallenge();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,24 +120,6 @@ static int challengeFinished(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hasFailedAllChallenges(void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
Challenge *c;
|
|
||||||
|
|
||||||
for (i = 0 ; i < MAX_CHALLENGES ; i++)
|
|
||||||
{
|
|
||||||
c = game.currentMission->challengeData.challenges[i];
|
|
||||||
|
|
||||||
if (c && c->passed)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void updateChallenges(void)
|
static void updateChallenges(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -379,5 +361,28 @@ static void failChallenge(void)
|
||||||
retreatEnemies();
|
retreatEnemies();
|
||||||
|
|
||||||
player->flags |= EF_IMMORTAL;
|
player->flags |= EF_IMMORTAL;
|
||||||
|
|
||||||
|
if (alreadyPassed())
|
||||||
|
{
|
||||||
|
battle.status = MS_TIME_UP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int alreadyPassed(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
Challenge *c;
|
||||||
|
|
||||||
|
for (i = 0 ; i < MAX_CHALLENGES ; i++)
|
||||||
|
{
|
||||||
|
c = game.currentMission->challengeData.challenges[i];
|
||||||
|
|
||||||
|
if (c && c->passed)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -262,7 +262,8 @@ enum
|
||||||
MS_IN_PROGRESS,
|
MS_IN_PROGRESS,
|
||||||
MS_PAUSED,
|
MS_PAUSED,
|
||||||
MS_COMPLETE,
|
MS_COMPLETE,
|
||||||
MS_FAILED
|
MS_FAILED,
|
||||||
|
MS_TIME_UP
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
|
Loading…
Reference in New Issue