Trophy updates.

This commit is contained in:
Steve 2018-02-19 19:13:29 +00:00
parent 44e34ab7de
commit 72efd1048b
7 changed files with 84 additions and 8 deletions

View File

@ -387,5 +387,10 @@ static void die2(void)
game.stats[STAT_TARGETS_DEFEATED]++; game.stats[STAT_TARGETS_DEFEATED]++;
game.stats[STAT_ENEMIES_KILLED]++; game.stats[STAT_ENEMIES_KILLED]++;
if (world.allObjectivesComplete)
{
awardTrophy("BLAZE_FROST");
}
} }
} }

View File

@ -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 void getSlope(int x1, int y1, int x2, int y2, float *dx, float *dy);
extern int enemyCanSeePlayer(Entity *e); extern int enemyCanSeePlayer(Entity *e);
extern void updateObjective(char *targetName); extern void updateObjective(char *targetName);
extern void awardTrophy(char *id);
extern Entity *self; extern Entity *self;
extern Game game; extern Game game;

View File

@ -378,7 +378,7 @@ static void die2()
game.stats[STAT_TARGETS_DEFEATED]++; game.stats[STAT_TARGETS_DEFEATED]++;
awardTrophy(""); awardTrophy("EYEDROID_COMMANDER");
game.stats[STAT_ENEMIES_KILLED]++; game.stats[STAT_ENEMIES_KILLED]++;
} }

View File

@ -332,7 +332,7 @@ static void die2(void)
game.stats[STAT_TARGETS_DEFEATED]++; game.stats[STAT_TARGETS_DEFEATED]++;
awardTrophy(""); awardTrophy("TANK_COMMANDER");
game.stats[STAT_ENEMIES_KILLED]++; game.stats[STAT_ENEMIES_KILLED]++;
} }

View File

@ -107,6 +107,6 @@ static void touchWhiteKeycard(Entity *other)
teekaExitMission(); teekaExitMission();
awardTrophy(""); awardTrophy("HEY_BUDDY");
} }
} }

View File

@ -43,6 +43,7 @@ static void doCursor(void);
static void doMissionSelect(void); static void doMissionSelect(void);
static void doMissionInfo(void); static void doMissionInfo(void);
static void drawHudWidgets(void); static void drawHudWidgets(void);
static void awardMissionTrophies(void);
static HubMission hubMissionHead; static HubMission hubMissionHead;
static HubMission *hubMissionTail; static HubMission *hubMissionTail;
@ -189,6 +190,8 @@ void initHub(void)
{ {
teeka->status = MS_LOCKED; teeka->status = MS_LOCKED;
} }
awardMissionTrophies();
cloudPos.x = randF() - randF(); cloudPos.x = randF() - randF();
cloudPos.y = randF() - randF(); cloudPos.y = randF() - randF();
@ -415,7 +418,7 @@ static void drawHudWidgets(void)
w = 300; w = 300;
h = 420; 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); 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); 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); 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) static int missionComparator(const void *a, const void *b)
{ {
HubMission *m1 = *((HubMission**)a); HubMission *m1 = *((HubMission**)a);

View File

@ -23,10 +23,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define CURSOR_SPEED 8 #define CURSOR_SPEED 8
#define SHOW_NONE 0 enum
#define SHOW_WIDGETS 1 {
#define SHOW_STATS 2 SHOW_NONE,
#define SHOW_TROPHIES 3 SHOW_WIDGETS,
SHOW_STATS,
SHOW_TROPHIES
};
extern int getDistance(int x1, int y1, int x2, int y2); extern int getDistance(int x1, int y1, int x2, int y2);
extern char *readFile(const char *filename); extern char *readFile(const char *filename);
@ -61,6 +64,7 @@ extern double randF(void);
extern void doWidgets(void); extern void doWidgets(void);
extern void drawStats(void); extern void drawStats(void);
extern void doStats(void); extern void doStats(void);
extern void awardTrophy(char *id);
extern App app; extern App app;
extern Colors colors; extern Colors colors;