Control trophy alerts from the main loop.

This commit is contained in:
Steve 2016-05-31 09:37:46 +01:00
parent 2b7641b809
commit 1474ecf7ca
11 changed files with 20 additions and 29 deletions

View File

@ -115,10 +115,7 @@ static void logic(void)
} }
} }
if (battle.status != MS_IN_PROGRESS && battle.missionFinishedTimer <= -FPS * 2) app.doTrophyAlerts = (battle.status != MS_IN_PROGRESS && battle.missionFinishedTimer <= -FPS * 2);
{
doTrophyAlerts();
}
} }
doWidgets(); doWidgets();
@ -258,11 +255,6 @@ static void draw(void)
drawOptions(); drawOptions();
break; break;
} }
if (battle.status != MS_IN_PROGRESS && battle.status != MS_PAUSED && battle.missionFinishedTimer <= -FPS * 2)
{
drawTrophyAlert();
}
} }
static void drawMenu(void) static void drawMenu(void)

View File

@ -85,8 +85,6 @@ extern void updateAccuracyStats(unsigned int *stats);
extern void clearInput(void); extern void clearInput(void);
extern void runScriptFunction(const char *format, ...); extern void runScriptFunction(const char *format, ...);
extern void doSpawners(void); extern void doSpawners(void);
extern void doTrophyAlerts(void);
extern void drawTrophyAlert(void);
extern void cancelScript(void); extern void cancelScript(void);
extern void awardTrophy(char *id); extern void awardTrophy(char *id);
extern void initCredits(void); extern void initCredits(void);

View File

@ -202,11 +202,9 @@ static void logic(void)
break; break;
} }
doTrophyAlerts();
doWidgets(); doWidgets();
doTrophies(); app.doTrophyAlerts = 1;
} }
static void doChallenges(void) static void doChallenges(void)
@ -313,8 +311,6 @@ static void draw(void)
drawOptions(); drawOptions();
break; break;
} }
drawTrophyAlert();
} }
static void drawChallenges(void) static void drawChallenges(void)

View File

@ -60,13 +60,10 @@ extern void playMusic(char *filename, int loop);
extern char *timeToString(long millis, int showHours); extern char *timeToString(long millis, int showHours);
extern char *getChallengeDescription(Challenge *c); extern char *getChallengeDescription(Challenge *c);
extern void clearInput(void); extern void clearInput(void);
extern void doTrophyAlerts(void);
extern void drawTrophyAlert(void);
extern void awardStatsTrophies(void); extern void awardStatsTrophies(void);
extern void awardChallengeTrophies(void); extern void awardChallengeTrophies(void);
extern void initTrophiesDisplay(void); extern void initTrophiesDisplay(void);
extern void drawTrophies(void); extern void drawTrophies(void);
extern void doTrophies(void);
extern App app; extern App app;
extern Battle battle; extern Battle battle;

View File

@ -181,9 +181,7 @@ static void logic(void)
doWidgets(); doWidgets();
doTrophyAlerts(); app.doTrophyAlerts = 1;
doTrophies();
} }
static void doStarSystems(void) static void doStarSystems(void)
@ -384,8 +382,6 @@ static void draw(void)
drawOptions(); drawOptions();
break; break;
} }
drawTrophyAlert();
} }
static void drawPulses(void) static void drawPulses(void)

View File

@ -60,13 +60,10 @@ extern StarSystem *getStarSystem(char *name);
extern void showOKDialog(void (*callback)(void), const char *format, ...); extern void showOKDialog(void (*callback)(void), const char *format, ...);
extern char *getTranslatedString(char *string); extern char *getTranslatedString(char *string);
extern void clearInput(void); extern void clearInput(void);
extern void doTrophyAlerts(void);
extern void drawTrophyAlert(void);
extern void awardCampaignTrophies(void); extern void awardCampaignTrophies(void);
extern void awardStatsTrophies(void); extern void awardStatsTrophies(void);
extern void initTrophiesDisplay(void); extern void initTrophiesDisplay(void);
extern void drawTrophies(void); extern void drawTrophies(void);
extern void doTrophies(void);
extern App app; extern App app;
extern Colors colors; extern Colors colors;

View File

@ -131,7 +131,7 @@ static void logic(void)
doEffects(); doEffects();
doTrophies(); app.doTrophyAlerts = 1;
doWidgets(); doWidgets();
} }

View File

@ -59,7 +59,6 @@ extern void updateAllMissions(void);
extern void clearInput(void); extern void clearInput(void);
extern void initTrophiesDisplay(void); extern void initTrophiesDisplay(void);
extern void drawTrophies(void); extern void drawTrophies(void);
extern void doTrophies(void);
extern App app; extern App app;
extern Battle battle; extern Battle battle;

View File

@ -108,10 +108,18 @@ int main(int argc, char *argv[])
while (td >= LOGIC_RATE) while (td >= LOGIC_RATE)
{ {
/* let the delegate decide during logic() */
app.doTrophyAlerts = 0;
app.delegate.logic(); app.delegate.logic();
td -= LOGIC_RATE; td -= LOGIC_RATE;
if (app.doTrophyAlerts)
{
doTrophyAlerts();
}
if (app.resetTimeDelta) if (app.resetTimeDelta)
{ {
td = 0; td = 0;
@ -126,6 +134,11 @@ int main(int argc, char *argv[])
app.delegate.draw(); app.delegate.draw();
if (app.doTrophyAlerts)
{
drawTrophyAlert();
}
if (app.modalDialog.type != MD_NONE) if (app.modalDialog.type != MD_NONE)
{ {
drawModalDialog(); drawModalDialog();

View File

@ -52,6 +52,8 @@ extern int isControl(int type);
extern void clearControl(int type); extern void clearControl(int type);
extern void saveGame(void); extern void saveGame(void);
extern void initCredits(void); extern void initCredits(void);
extern void doTrophyAlerts(void);
extern void drawTrophyAlert(void);
App app; App app;
Colors colors; Colors colors;

View File

@ -486,6 +486,7 @@ typedef struct {
int fullscreen; int fullscreen;
int musicVolume; int musicVolume;
int soundVolume; int soundVolume;
int doTrophyAlerts;
Gameplay gameplay; Gameplay gameplay;
Mouse mouse; Mouse mouse;
int keyboard[MAX_KEYBOARD_KEYS]; int keyboard[MAX_KEYBOARD_KEYS];