Trophy-related prototyping fixes.

This commit is contained in:
Steve 2016-03-10 18:02:19 +00:00
parent 5706e1d29c
commit da97818259
7 changed files with 17 additions and 7 deletions

View File

@ -59,7 +59,7 @@ void initChallengeHome(void)
unlockChallenges(); unlockChallenges();
checkStatTrophies(); awardStatsTrophies();
saveGame(); saveGame();
@ -255,7 +255,7 @@ static void draw(void)
break; break;
} }
doTrophyAlert(); drawTrophyAlert();
} }
static void drawChallenges(void) static void drawChallenges(void)

View File

@ -62,7 +62,7 @@ extern char *getChallengeDescription(Challenge *c);
extern void clearInput(void); extern void clearInput(void);
extern void doTrophies(void); extern void doTrophies(void);
extern void drawTrophyAlert(void); extern void drawTrophyAlert(void);
extern void checkStatTrophies(void); extern void awardStatsTrophies(void);
extern App app; extern App app;
extern Battle battle; extern Battle battle;

View File

@ -233,6 +233,7 @@ enum
SND_POWER_DOWN, SND_POWER_DOWN,
SND_BOOST, SND_BOOST,
SND_RADIO, SND_RADIO,
SND_TROPHY,
SND_GUI_CLICK, SND_GUI_CLICK,
SND_GUI_SELECT, SND_GUI_SELECT,
SND_GUI_CLOSE, SND_GUI_CLOSE,

View File

@ -366,7 +366,7 @@ static void draw(void)
break; break;
} }
drawTrophyAlerts(); drawTrophyAlert();
} }
static void drawPulses(void) static void drawPulses(void)

View File

@ -162,7 +162,7 @@ static void loadTrophyData(char *filename)
/* can't use the getJSONValue here, as it could lead to false positives */ /* can't use the getJSONValue here, as it could lead to false positives */
if (cJSON_GetObjectItem(node, "stat")) 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; t->statValue = cJSON_GetObjectItem(node, "statValue")->valueint;
} }
@ -194,10 +194,10 @@ void awardCampaignTrophies(void)
char trophyId[MAX_NAME_LENGTH]; char trophyId[MAX_NAME_LENGTH];
char name[MAX_NAME_LENGTH]; char name[MAX_NAME_LENGTH];
int completedMissions, i, len; int completedMissions, i, len;
StarSystem *ss; StarSystem *starSystem;
/* check % of missions completed */ /* check % of missions completed */
completedMissions = (int)getPercent(game.completedMissions, game.totalMissions); completedMissions = getPercent(game.completedMissions, game.totalMissions);
sprintf(trophyId, "CAMPAIGN_%d", completedMissions); sprintf(trophyId, "CAMPAIGN_%d", completedMissions);
awardTrophy(trophyId); awardTrophy(trophyId);

View File

@ -26,5 +26,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern long lookup(char *name); extern long lookup(char *name);
extern char *readFile(char *filename); extern char *readFile(char *filename);
extern int getJSONValue(cJSON *node, char *name, int defValue); 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; extern Game game;

View File

@ -117,6 +117,7 @@ static void loadSounds(void)
sounds[SND_MAG_HIT] = loadSound("sound/172591__timbre__zapitydooda.ogg"); sounds[SND_MAG_HIT] = loadSound("sound/172591__timbre__zapitydooda.ogg");
sounds[SND_POWER_DOWN] = loadSound("sound/39030__wildweasel__d1clsstf.ogg"); sounds[SND_POWER_DOWN] = loadSound("sound/39030__wildweasel__d1clsstf.ogg");
sounds[SND_SELECT_WEAPON] = loadSound("sound/329359__bassoonrckr__reed-guillotine.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_CLICK] = loadSound("sound/257786__xtrgamr__mouse-click.ogg");
sounds[SND_GUI_SELECT] = loadSound("sound/321104__nsstudios__blip2.ogg"); sounds[SND_GUI_SELECT] = loadSound("sound/321104__nsstudios__blip2.ogg");