Control trophy alerts from the main loop.
This commit is contained in:
parent
2b7641b809
commit
1474ecf7ca
|
@ -115,10 +115,7 @@ static void logic(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (battle.status != MS_IN_PROGRESS && battle.missionFinishedTimer <= -FPS * 2)
|
||||
{
|
||||
doTrophyAlerts();
|
||||
}
|
||||
app.doTrophyAlerts = (battle.status != MS_IN_PROGRESS && battle.missionFinishedTimer <= -FPS * 2);
|
||||
}
|
||||
|
||||
doWidgets();
|
||||
|
@ -258,11 +255,6 @@ static void draw(void)
|
|||
drawOptions();
|
||||
break;
|
||||
}
|
||||
|
||||
if (battle.status != MS_IN_PROGRESS && battle.status != MS_PAUSED && battle.missionFinishedTimer <= -FPS * 2)
|
||||
{
|
||||
drawTrophyAlert();
|
||||
}
|
||||
}
|
||||
|
||||
static void drawMenu(void)
|
||||
|
|
|
@ -85,8 +85,6 @@ extern void updateAccuracyStats(unsigned int *stats);
|
|||
extern void clearInput(void);
|
||||
extern void runScriptFunction(const char *format, ...);
|
||||
extern void doSpawners(void);
|
||||
extern void doTrophyAlerts(void);
|
||||
extern void drawTrophyAlert(void);
|
||||
extern void cancelScript(void);
|
||||
extern void awardTrophy(char *id);
|
||||
extern void initCredits(void);
|
||||
|
|
|
@ -202,11 +202,9 @@ static void logic(void)
|
|||
break;
|
||||
}
|
||||
|
||||
doTrophyAlerts();
|
||||
|
||||
doWidgets();
|
||||
|
||||
doTrophies();
|
||||
app.doTrophyAlerts = 1;
|
||||
}
|
||||
|
||||
static void doChallenges(void)
|
||||
|
@ -313,8 +311,6 @@ static void draw(void)
|
|||
drawOptions();
|
||||
break;
|
||||
}
|
||||
|
||||
drawTrophyAlert();
|
||||
}
|
||||
|
||||
static void drawChallenges(void)
|
||||
|
|
|
@ -60,13 +60,10 @@ extern void playMusic(char *filename, int loop);
|
|||
extern char *timeToString(long millis, int showHours);
|
||||
extern char *getChallengeDescription(Challenge *c);
|
||||
extern void clearInput(void);
|
||||
extern void doTrophyAlerts(void);
|
||||
extern void drawTrophyAlert(void);
|
||||
extern void awardStatsTrophies(void);
|
||||
extern void awardChallengeTrophies(void);
|
||||
extern void initTrophiesDisplay(void);
|
||||
extern void drawTrophies(void);
|
||||
extern void doTrophies(void);
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
|
|
|
@ -181,9 +181,7 @@ static void logic(void)
|
|||
|
||||
doWidgets();
|
||||
|
||||
doTrophyAlerts();
|
||||
|
||||
doTrophies();
|
||||
app.doTrophyAlerts = 1;
|
||||
}
|
||||
|
||||
static void doStarSystems(void)
|
||||
|
@ -384,8 +382,6 @@ static void draw(void)
|
|||
drawOptions();
|
||||
break;
|
||||
}
|
||||
|
||||
drawTrophyAlert();
|
||||
}
|
||||
|
||||
static void drawPulses(void)
|
||||
|
|
|
@ -60,13 +60,10 @@ extern StarSystem *getStarSystem(char *name);
|
|||
extern void showOKDialog(void (*callback)(void), const char *format, ...);
|
||||
extern char *getTranslatedString(char *string);
|
||||
extern void clearInput(void);
|
||||
extern void doTrophyAlerts(void);
|
||||
extern void drawTrophyAlert(void);
|
||||
extern void awardCampaignTrophies(void);
|
||||
extern void awardStatsTrophies(void);
|
||||
extern void initTrophiesDisplay(void);
|
||||
extern void drawTrophies(void);
|
||||
extern void doTrophies(void);
|
||||
|
||||
extern App app;
|
||||
extern Colors colors;
|
||||
|
|
|
@ -131,7 +131,7 @@ static void logic(void)
|
|||
|
||||
doEffects();
|
||||
|
||||
doTrophies();
|
||||
app.doTrophyAlerts = 1;
|
||||
|
||||
doWidgets();
|
||||
}
|
||||
|
|
|
@ -59,7 +59,6 @@ extern void updateAllMissions(void);
|
|||
extern void clearInput(void);
|
||||
extern void initTrophiesDisplay(void);
|
||||
extern void drawTrophies(void);
|
||||
extern void doTrophies(void);
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
|
|
13
src/main.c
13
src/main.c
|
@ -108,10 +108,18 @@ int main(int argc, char *argv[])
|
|||
|
||||
while (td >= LOGIC_RATE)
|
||||
{
|
||||
/* let the delegate decide during logic() */
|
||||
app.doTrophyAlerts = 0;
|
||||
|
||||
app.delegate.logic();
|
||||
|
||||
td -= LOGIC_RATE;
|
||||
|
||||
if (app.doTrophyAlerts)
|
||||
{
|
||||
doTrophyAlerts();
|
||||
}
|
||||
|
||||
if (app.resetTimeDelta)
|
||||
{
|
||||
td = 0;
|
||||
|
@ -126,6 +134,11 @@ int main(int argc, char *argv[])
|
|||
|
||||
app.delegate.draw();
|
||||
|
||||
if (app.doTrophyAlerts)
|
||||
{
|
||||
drawTrophyAlert();
|
||||
}
|
||||
|
||||
if (app.modalDialog.type != MD_NONE)
|
||||
{
|
||||
drawModalDialog();
|
||||
|
|
|
@ -52,6 +52,8 @@ extern int isControl(int type);
|
|||
extern void clearControl(int type);
|
||||
extern void saveGame(void);
|
||||
extern void initCredits(void);
|
||||
extern void doTrophyAlerts(void);
|
||||
extern void drawTrophyAlert(void);
|
||||
|
||||
App app;
|
||||
Colors colors;
|
||||
|
|
|
@ -486,6 +486,7 @@ typedef struct {
|
|||
int fullscreen;
|
||||
int musicVolume;
|
||||
int soundVolume;
|
||||
int doTrophyAlerts;
|
||||
Gameplay gameplay;
|
||||
Mouse mouse;
|
||||
int keyboard[MAX_KEYBOARD_KEYS];
|
||||
|
|
Loading…
Reference in New Issue