Percent complete stats updates.
This commit is contained in:
parent
bf7d6dc921
commit
9b6abf764a
|
@ -24,7 +24,6 @@ static void logic(void);
|
||||||
static void draw(void);
|
static void draw(void);
|
||||||
static void handleKeyboard(void);
|
static void handleKeyboard(void);
|
||||||
static void drawChallenges(void);
|
static void drawChallenges(void);
|
||||||
static void updateChallengeMissions(void);
|
|
||||||
static void doChallenges(void);
|
static void doChallenges(void);
|
||||||
static void startChallengeMission(void);
|
static void startChallengeMission(void);
|
||||||
static void drawMenu(void);
|
static void drawMenu(void);
|
||||||
|
@ -33,6 +32,7 @@ static void stats(void);
|
||||||
static void options(void);
|
static void options(void);
|
||||||
static void statsOK(void);
|
static void statsOK(void);
|
||||||
static void returnFromOptions(void);
|
static void returnFromOptions(void);
|
||||||
|
static void unlockChallenges(void);
|
||||||
static void quit(void);
|
static void quit(void);
|
||||||
|
|
||||||
static SDL_Texture *background;
|
static SDL_Texture *background;
|
||||||
|
@ -48,7 +48,9 @@ void initChallengeHome(void)
|
||||||
|
|
||||||
stopMusic();
|
stopMusic();
|
||||||
|
|
||||||
updateChallengeMissions();
|
updateAllMissions();
|
||||||
|
|
||||||
|
unlockChallenges();
|
||||||
|
|
||||||
saveGame();
|
saveGame();
|
||||||
|
|
||||||
|
@ -84,10 +86,9 @@ void initChallengeHome(void)
|
||||||
endSectionTransition();
|
endSectionTransition();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void updateChallengeMissions(void)
|
static void unlockChallenges(void)
|
||||||
{
|
{
|
||||||
Mission *m;
|
Mission *m;
|
||||||
Challenge *c;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = completedChallenges = totalChallenges = 0;
|
i = completedChallenges = totalChallenges = 0;
|
||||||
|
@ -96,18 +97,6 @@ static void updateChallengeMissions(void)
|
||||||
{
|
{
|
||||||
m->available = i <= completedChallenges;
|
m->available = i <= completedChallenges;
|
||||||
|
|
||||||
m->totalChallenges = m->completedChallenges = 0;
|
|
||||||
|
|
||||||
for (c = m->challengeHead.next ; c != NULL ; c = c->next)
|
|
||||||
{
|
|
||||||
m->totalChallenges++;
|
|
||||||
|
|
||||||
if (c->passed)
|
|
||||||
{
|
|
||||||
m->completedChallenges++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
completedChallenges += m->completedChallenges;
|
completedChallenges += m->completedChallenges;
|
||||||
totalChallenges += m->totalChallenges;
|
totalChallenges += m->totalChallenges;
|
||||||
|
|
||||||
|
@ -174,7 +163,7 @@ static void draw(void)
|
||||||
|
|
||||||
drawStars();
|
drawStars();
|
||||||
|
|
||||||
drawText(SCREEN_WIDTH / 2, 50, 30, TA_CENTER, colors.white, "Challenges");
|
drawText(SCREEN_WIDTH / 2, 50, 30, TA_CENTER, colors.white, _("Challenges"));
|
||||||
|
|
||||||
drawText(SCREEN_WIDTH / 2, 100, 24, TA_CENTER, colors.white, "%d / %d", completedChallenges, totalChallenges);
|
drawText(SCREEN_WIDTH / 2, 100, 24, TA_CENTER, colors.white, "%d / %d", completedChallenges, totalChallenges);
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,8 @@ extern void initOptions(void (*returnFromOptions)(void));
|
||||||
extern void drawStats(void);
|
extern void drawStats(void);
|
||||||
extern void playSound(int sound);
|
extern void playSound(int sound);
|
||||||
extern void selectWidget(const char *name, const char *group);
|
extern void selectWidget(const char *name, const char *group);
|
||||||
|
extern void updateAllMissions(void);
|
||||||
|
extern char *getTranslatedString(char *string);
|
||||||
|
|
||||||
extern App app;
|
extern App app;
|
||||||
extern Battle battle;
|
extern Battle battle;
|
||||||
|
|
|
@ -261,11 +261,13 @@ enum
|
||||||
CHALLENGE_LOSSES,
|
CHALLENGE_LOSSES,
|
||||||
CHALLENGE_PLAYER_KILLS,
|
CHALLENGE_PLAYER_KILLS,
|
||||||
CHALLENGE_DISABLE,
|
CHALLENGE_DISABLE,
|
||||||
CHALLENGE_TIME_MINS
|
CHALLENGE_TIME_MINS,
|
||||||
|
CHALLENGE_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
STAT_PERCENT_COMPLETE,
|
||||||
STAT_MISSIONS_STARTED,
|
STAT_MISSIONS_STARTED,
|
||||||
STAT_MISSIONS_COMPLETED,
|
STAT_MISSIONS_COMPLETED,
|
||||||
STAT_CHALLENGES_STARTED,
|
STAT_CHALLENGES_STARTED,
|
||||||
|
|
|
@ -84,7 +84,7 @@ void initGalacticMap(void)
|
||||||
|
|
||||||
centerOnSelectedStarSystem();
|
centerOnSelectedStarSystem();
|
||||||
|
|
||||||
updateStarSystemMissions();
|
updateAllMissions();
|
||||||
|
|
||||||
updatePandoranAdvance();
|
updatePandoranAdvance();
|
||||||
|
|
||||||
|
@ -597,7 +597,6 @@ static void handleKeyboard(void)
|
||||||
case SHOW_GALAXY:
|
case SHOW_GALAXY:
|
||||||
selectWidget("resume", "galacticMap");
|
selectWidget("resume", "galacticMap");
|
||||||
show = SHOW_MENU;
|
show = SHOW_MENU;
|
||||||
memset(app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS);
|
|
||||||
playSound(SND_GUI_CLOSE);
|
playSound(SND_GUI_CLOSE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -608,14 +607,12 @@ static void handleKeyboard(void)
|
||||||
|
|
||||||
case SHOW_MENU:
|
case SHOW_MENU:
|
||||||
show = SHOW_GALAXY;
|
show = SHOW_GALAXY;
|
||||||
memset(app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHOW_OPTIONS:
|
case SHOW_OPTIONS:
|
||||||
case SHOW_STATS:
|
case SHOW_STATS:
|
||||||
show = SHOW_MENU;
|
show = SHOW_MENU;
|
||||||
selectWidget("resume", "galacticMap");
|
selectWidget("resume", "galacticMap");
|
||||||
memset(app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ extern void drawStats(void);
|
||||||
extern void playSound(int id);
|
extern void playSound(int id);
|
||||||
extern void blitRotated(SDL_Texture *texture, int x, int y, float angle);
|
extern void blitRotated(SDL_Texture *texture, int x, int y, float angle);
|
||||||
extern void initStatsDisplay(void);
|
extern void initStatsDisplay(void);
|
||||||
extern void updateStarSystemMissions(void);
|
extern void updateAllMissions(void);
|
||||||
extern StarSystem *getStarSystem(char *name);
|
extern StarSystem *getStarSystem(char *name);
|
||||||
extern void setMouse(int x, int y);
|
extern void setMouse(int x, int y);
|
||||||
extern void showOKDialog(void (*callback)(void), const char *format, ...);
|
extern void showOKDialog(void (*callback)(void), const char *format, ...);
|
||||||
|
|
|
@ -865,6 +865,13 @@ Mission *getMission(char *filename)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updateAllMissions(void)
|
||||||
|
{
|
||||||
|
updateStarSystemMissions();
|
||||||
|
|
||||||
|
updateChallengeMissions();
|
||||||
|
}
|
||||||
|
|
||||||
int isMissionAvailable(Mission *mission, Mission *prev)
|
int isMissionAvailable(Mission *mission, Mission *prev)
|
||||||
{
|
{
|
||||||
return prev->completed && mission->requires <= game.completedMissions;
|
return prev->completed && mission->requires <= game.completedMissions;
|
||||||
|
|
|
@ -49,6 +49,8 @@ extern void updateCapitalShipComponentProperties(Entity *parent);
|
||||||
extern void countNumEnemies(void);
|
extern void countNumEnemies(void);
|
||||||
extern void initMissionInfo(void);
|
extern void initMissionInfo(void);
|
||||||
extern char *getTranslatedString(char *string);
|
extern char *getTranslatedString(char *string);
|
||||||
|
extern void updateStarSystemMissions(void);
|
||||||
|
extern void updateChallengeMissions(void);
|
||||||
|
|
||||||
extern Battle battle;
|
extern Battle battle;
|
||||||
extern Entity *player;
|
extern Entity *player;
|
||||||
|
|
|
@ -74,6 +74,8 @@ void initTitle(void)
|
||||||
|
|
||||||
initFighters();
|
initFighters();
|
||||||
|
|
||||||
|
updateAllMissions();
|
||||||
|
|
||||||
getWidget("campaign", "title")->action = campaign;
|
getWidget("campaign", "title")->action = campaign;
|
||||||
getWidget("challenges", "title")->action = challenges;
|
getWidget("challenges", "title")->action = challenges;
|
||||||
getWidget("stats", "title")->action = stats;
|
getWidget("stats", "title")->action = stats;
|
||||||
|
|
|
@ -55,6 +55,7 @@ extern void setMouse(int x, int y);
|
||||||
extern void initChallengeHome(void);
|
extern void initChallengeHome(void);
|
||||||
extern void selectWidget(const char *name, const char *group);
|
extern void selectWidget(const char *name, const char *group);
|
||||||
extern void drawStats(void);
|
extern void drawStats(void);
|
||||||
|
extern void updateAllMissions(void);
|
||||||
|
|
||||||
extern App app;
|
extern App app;
|
||||||
extern Battle battle;
|
extern Battle battle;
|
||||||
|
|
|
@ -116,6 +116,7 @@ void initLookups(void)
|
||||||
addLookup("CHALLENGE_DISABLE", CHALLENGE_DISABLE);
|
addLookup("CHALLENGE_DISABLE", CHALLENGE_DISABLE);
|
||||||
addLookup("CHALLENGE_TIME_MINS", CHALLENGE_TIME_MINS);
|
addLookup("CHALLENGE_TIME_MINS", CHALLENGE_TIME_MINS);
|
||||||
|
|
||||||
|
addLookup("STAT_PERCENT_COMPLETE", STAT_PERCENT_COMPLETE);
|
||||||
addLookup("STAT_MISSIONS_STARTED", STAT_MISSIONS_STARTED);
|
addLookup("STAT_MISSIONS_STARTED", STAT_MISSIONS_STARTED);
|
||||||
addLookup("STAT_MISSIONS_COMPLETED", STAT_MISSIONS_COMPLETED);
|
addLookup("STAT_MISSIONS_COMPLETED", STAT_MISSIONS_COMPLETED);
|
||||||
addLookup("STAT_CHALLENGES_STARTED", STAT_CHALLENGES_STARTED);
|
addLookup("STAT_CHALLENGES_STARTED", STAT_CHALLENGES_STARTED);
|
||||||
|
|
Loading…
Reference in New Issue