diff --git a/src/entities/boss/blobBoss.c b/src/entities/boss/blobBoss.c index bc902be..d9e731b 100644 --- a/src/entities/boss/blobBoss.c +++ b/src/entities/boss/blobBoss.c @@ -387,5 +387,10 @@ static void die2(void) game.stats[STAT_TARGETS_DEFEATED]++; game.stats[STAT_ENEMIES_KILLED]++; + + if (world.allObjectivesComplete) + { + awardTrophy("BLAZE_FROST"); + } } } diff --git a/src/entities/boss/blobBoss.h b/src/entities/boss/blobBoss.h index 1f0baa2..747b997 100644 --- a/src/entities/boss/blobBoss.h +++ b/src/entities/boss/blobBoss.h @@ -34,6 +34,7 @@ extern int getDistance(int x1, int y1, int x2, int y2); extern void getSlope(int x1, int y1, int x2, int y2, float *dx, float *dy); extern int enemyCanSeePlayer(Entity *e); extern void updateObjective(char *targetName); +extern void awardTrophy(char *id); extern Entity *self; extern Game game; diff --git a/src/entities/boss/eyeDroidCommander.c b/src/entities/boss/eyeDroidCommander.c index 7dbba42..191d613 100644 --- a/src/entities/boss/eyeDroidCommander.c +++ b/src/entities/boss/eyeDroidCommander.c @@ -378,7 +378,7 @@ static void die2() game.stats[STAT_TARGETS_DEFEATED]++; - awardTrophy(""); + awardTrophy("EYEDROID_COMMANDER"); game.stats[STAT_ENEMIES_KILLED]++; } diff --git a/src/entities/boss/tankCommander.c b/src/entities/boss/tankCommander.c index 6778a9b..c9fd334 100644 --- a/src/entities/boss/tankCommander.c +++ b/src/entities/boss/tankCommander.c @@ -332,7 +332,7 @@ static void die2(void) game.stats[STAT_TARGETS_DEFEATED]++; - awardTrophy(""); + awardTrophy("TANK_COMMANDER"); game.stats[STAT_ENEMIES_KILLED]++; } diff --git a/src/entities/items/keycard.c b/src/entities/items/keycard.c index ba4776b..8804a20 100644 --- a/src/entities/items/keycard.c +++ b/src/entities/items/keycard.c @@ -107,6 +107,6 @@ static void touchWhiteKeycard(Entity *other) teekaExitMission(); - awardTrophy(""); + awardTrophy("HEY_BUDDY"); } } diff --git a/src/hub/hub.c b/src/hub/hub.c index b21a398..20fb216 100644 --- a/src/hub/hub.c +++ b/src/hub/hub.c @@ -43,6 +43,7 @@ static void doCursor(void); static void doMissionSelect(void); static void doMissionInfo(void); static void drawHudWidgets(void); +static void awardMissionTrophies(void); static HubMission hubMissionHead; static HubMission *hubMissionTail; @@ -189,6 +190,8 @@ void initHub(void) { teeka->status = MS_LOCKED; } + + awardMissionTrophies(); cloudPos.x = randF() - randF(); cloudPos.y = randF() - randF(); @@ -415,7 +418,7 @@ static void drawHudWidgets(void) w = 300; h = 420; - drawRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0, 64); + drawRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0, 0, 128); drawRect((SCREEN_WIDTH - w) / 2, (SCREEN_HEIGHT - h) / 2, w, h, 0, 0, 0, 192); drawOutlineRect((SCREEN_WIDTH - w) / 2, (SCREEN_HEIGHT - h) / 2, w, h, 255, 255, 255, 255); @@ -686,6 +689,69 @@ static void loadMissions(void) free(text); } +static void awardMissionTrophies(void) +{ + int beach, greenlands, underground, outpost; + HubMission *mission; + + beach = greenlands = underground = outpost = 1; + + for (mission = hubMissionHead.next ; mission != NULL ; mission = mission->next) + { + if (mission->status != MS_COMPLETE) + { + if (strstr(mission->id, "beach")) + { + beach = 0; + } + else if (strstr(mission->id, "greenlands")) + { + greenlands = 0; + } + else if (strstr(mission->id, "underground")) + { + underground = 0; + } + else if (strstr(mission->id, "outpost")) + { + outpost = 0; + } + } + } + + if (beach) + { + awardTrophy("BEACH"); + } + + if (greenlands) + { + awardTrophy("GREENLANDS"); + } + + if (underground) + { + awardTrophy("UNDERGROUND"); + } + + if (outpost) + { + awardTrophy("OUTPOST"); + } + + /* ignore training mission */ + if (completedMissions == 2) + { + awardTrophy("CLEAN"); + } + + /* ignore teeka's mission, as this ends the game */ + if (completedMissions == numMissions - 1) + { + awardTrophy("FULLY_CLEAN"); + } +} + static int missionComparator(const void *a, const void *b) { HubMission *m1 = *((HubMission**)a); diff --git a/src/hub/hub.h b/src/hub/hub.h index c414117..7dcbbc1 100644 --- a/src/hub/hub.h +++ b/src/hub/hub.h @@ -23,10 +23,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define CURSOR_SPEED 8 -#define SHOW_NONE 0 -#define SHOW_WIDGETS 1 -#define SHOW_STATS 2 -#define SHOW_TROPHIES 3 +enum +{ + SHOW_NONE, + SHOW_WIDGETS, + SHOW_STATS, + SHOW_TROPHIES +}; extern int getDistance(int x1, int y1, int x2, int y2); extern char *readFile(const char *filename); @@ -61,6 +64,7 @@ extern double randF(void); extern void doWidgets(void); extern void drawStats(void); extern void doStats(void); +extern void awardTrophy(char *id); extern App app; extern Colors colors;