From da97818259321aaf8fa57b3236e80ab518cbd979 Mon Sep 17 00:00:00 2001 From: Steve Date: Thu, 10 Mar 2016 18:02:19 +0000 Subject: [PATCH] Trophy-related prototyping fixes. --- src/challenges/challengeHome.c | 4 ++-- src/challenges/challengeHome.h | 2 +- src/defs.h | 1 + src/galaxy/galacticMap.c | 2 +- src/game/trophies.c | 6 +++--- src/game/trophies.h | 8 ++++++++ src/system/sound.c | 1 + 7 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/challenges/challengeHome.c b/src/challenges/challengeHome.c index 05771e4..5f43774 100644 --- a/src/challenges/challengeHome.c +++ b/src/challenges/challengeHome.c @@ -59,7 +59,7 @@ void initChallengeHome(void) unlockChallenges(); - checkStatTrophies(); + awardStatsTrophies(); saveGame(); @@ -255,7 +255,7 @@ static void draw(void) break; } - doTrophyAlert(); + drawTrophyAlert(); } static void drawChallenges(void) diff --git a/src/challenges/challengeHome.h b/src/challenges/challengeHome.h index 985f984..dfeadcd 100644 --- a/src/challenges/challengeHome.h +++ b/src/challenges/challengeHome.h @@ -62,7 +62,7 @@ extern char *getChallengeDescription(Challenge *c); extern void clearInput(void); extern void doTrophies(void); extern void drawTrophyAlert(void); -extern void checkStatTrophies(void); +extern void awardStatsTrophies(void); extern App app; extern Battle battle; diff --git a/src/defs.h b/src/defs.h index d5359dd..a004116 100644 --- a/src/defs.h +++ b/src/defs.h @@ -233,6 +233,7 @@ enum SND_POWER_DOWN, SND_BOOST, SND_RADIO, + SND_TROPHY, SND_GUI_CLICK, SND_GUI_SELECT, SND_GUI_CLOSE, diff --git a/src/galaxy/galacticMap.c b/src/galaxy/galacticMap.c index 2fbcd20..dac56d4 100644 --- a/src/galaxy/galacticMap.c +++ b/src/galaxy/galacticMap.c @@ -366,7 +366,7 @@ static void draw(void) break; } - drawTrophyAlerts(); + drawTrophyAlert(); } static void drawPulses(void) diff --git a/src/game/trophies.c b/src/game/trophies.c index ee02e6d..9abdae7 100644 --- a/src/game/trophies.c +++ b/src/game/trophies.c @@ -162,7 +162,7 @@ static void loadTrophyData(char *filename) /* can't use the getJSONValue here, as it could lead to false positives */ if (cJSON_GetObjectItem(node, "stat")) { - t->stat = lookup(cJSON_GetObjectItem(node, "stat")->valuestring)); + t->stat = lookup(cJSON_GetObjectItem(node, "stat")->valuestring); t->statValue = cJSON_GetObjectItem(node, "statValue")->valueint; } @@ -194,10 +194,10 @@ void awardCampaignTrophies(void) char trophyId[MAX_NAME_LENGTH]; char name[MAX_NAME_LENGTH]; int completedMissions, i, len; - StarSystem *ss; + StarSystem *starSystem; /* check % of missions completed */ - completedMissions = (int)getPercent(game.completedMissions, game.totalMissions); + completedMissions = getPercent(game.completedMissions, game.totalMissions); sprintf(trophyId, "CAMPAIGN_%d", completedMissions); awardTrophy(trophyId); diff --git a/src/game/trophies.h b/src/game/trophies.h index 9a9c05a..ef5b084 100644 --- a/src/game/trophies.h +++ b/src/game/trophies.h @@ -26,5 +26,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern long lookup(char *name); extern char *readFile(char *filename); extern int getJSONValue(cJSON *node, char *name, int defValue); +extern int getPercent(float current, float total); +extern void drawText(int x, int y, int size, int align, SDL_Color c, const char *format, ...); +extern void blit(SDL_Texture *t, int x, int y, int center); +extern char *getTranslatedString(char *string); +extern SDL_Texture *getTexture(char *filename); +extern void playSound(int id); +extern App app; +extern Colors colors; extern Game game; diff --git a/src/system/sound.c b/src/system/sound.c index 3b122b2..81d78f1 100644 --- a/src/system/sound.c +++ b/src/system/sound.c @@ -117,6 +117,7 @@ static void loadSounds(void) sounds[SND_MAG_HIT] = loadSound("sound/172591__timbre__zapitydooda.ogg"); sounds[SND_POWER_DOWN] = loadSound("sound/39030__wildweasel__d1clsstf.ogg"); sounds[SND_SELECT_WEAPON] = loadSound("sound/329359__bassoonrckr__reed-guillotine.ogg"); + sounds[SND_TROPHY] = loadSound("sound/278142__ricemaster__effect-notify.ogg"); sounds[SND_GUI_CLICK] = loadSound("sound/257786__xtrgamr__mouse-click.ogg"); sounds[SND_GUI_SELECT] = loadSound("sound/321104__nsstudios__blip2.ogg");