From 891d551179149a9110640d2916c768a54d5cdfb6 Mon Sep 17 00:00:00 2001 From: Steve Date: Sat, 24 Feb 2018 15:58:33 +0000 Subject: [PATCH] Trophy screenshot update. --- src/game/trophies.c | 18 ++++++++++++++---- src/main.c | 2 ++ src/main.h | 1 + 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/game/trophies.c b/src/game/trophies.c index 2e84057..07020e9 100644 --- a/src/game/trophies.c +++ b/src/game/trophies.c @@ -39,6 +39,7 @@ static Atlas *left; static Atlas *right; static int page; static float maxPages; +static int savedScreenshot; void initTrophies(void) { @@ -63,6 +64,8 @@ void initTrophies(void) sparkleAngle = 0; + savedScreenshot = 0; + page = 0; maxPages = STAT_TIME_PLAYED; @@ -266,10 +269,6 @@ void doTrophyAlerts(void) if (alertTimer <= 0) { - if (app.config.trophyScreenshot) - { - saveScreenshot(alertTrophy->id); - } alertTrophy->notify = 0; resetAlert(); } @@ -313,6 +312,7 @@ static void resetAlert(void) { alertTimer = FPS * 3; alertTrophy = NULL; + savedScreenshot = 0; } void drawTrophyAlert(void) @@ -339,6 +339,16 @@ void drawTrophyAlert(void) } } +void saveTrophyScreenshot(void) +{ + if (alertTrophy && alertRect.x == -1 && app.config.trophyScreenshot && !savedScreenshot) + { + saveScreenshot(alertTrophy->id); + + savedScreenshot = 1; + } +} + static void loadTrophyData(void) { cJSON *root, *node; diff --git a/src/main.c b/src/main.c index ecb88c2..2e39aa6 100644 --- a/src/main.c +++ b/src/main.c @@ -67,6 +67,8 @@ int main(int argc, char *argv[]) presentScene(); + saveTrophyScreenshot(); + then = capFrameRate(then); frames++; diff --git a/src/main.h b/src/main.h index 7ed23c6..429d211 100644 --- a/src/main.h +++ b/src/main.h @@ -34,6 +34,7 @@ extern void awardTrophies(void); extern void doTrophyAlerts(void); extern void drawTrophyAlert(void); extern void expireTexts(int all); +extern void saveTrophyScreenshot(void); App app; Camera camera;