Trophy updates.

This commit is contained in:
Steve 2016-06-03 07:41:44 +01:00
parent d8e2bb4f29
commit 93e65d1431
6 changed files with 28 additions and 24 deletions

View File

@ -123,7 +123,7 @@
{ {
"id" : "SHUTTLE", "id" : "SHUTTLE",
"title" : "Room for one more on top", "title" : "Room for one more on top",
"description" : "Complete a mission using a Shuttle", "description" : "Complete a challenge using a Shuttle",
"value" : "TROPHY_BRONZE" "value" : "TROPHY_BRONZE"
}, },
{ {

View File

@ -538,6 +538,8 @@ static void completeChallenge(void)
retreatEnemies(); retreatEnemies();
awardStatsTrophies(); awardStatsTrophies();
awardCraftTrophy();
} }
} }

View File

@ -33,6 +33,7 @@ extern long lookup(char *name);
extern void awardStatsTrophies(void); extern void awardStatsTrophies(void);
extern void retreatAllies(void); extern void retreatAllies(void);
extern void retreatEnemies(void); extern void retreatEnemies(void);
extern void awardCraftTrophy(void);
extern Dev dev; extern Dev dev;
extern Battle battle; extern Battle battle;

View File

@ -283,10 +283,9 @@ void completeMission(void)
awardStatsTrophies(); awardStatsTrophies();
if (!game.currentMission->challengeData.isChallenge)
{
awardPostMissionTrophies(); awardPostMissionTrophies();
}
awardCraftTrophy();
} }
} }

View File

@ -62,6 +62,7 @@ extern Entity *spawnMine(int type);
extern void activateNextWaypoint(void); extern void activateNextWaypoint(void);
extern void awardStatsTrophies(void); extern void awardStatsTrophies(void);
extern void awardPostMissionTrophies(void); extern void awardPostMissionTrophies(void);
extern void awardCraftTrophy(void);
extern Battle battle; extern Battle battle;
extern Dev dev; extern Dev dev;

View File

@ -24,7 +24,6 @@ static void prevPage(void);
static void nextPage(void); static void nextPage(void);
static void loadTrophyData(char *filename); static void loadTrophyData(char *filename);
static void resetAlert(void); static void resetAlert(void);
static void awardCraftTrophy(void);
static void setSparkleColor(Trophy *t); static void setSparkleColor(Trophy *t);
static void nextAlert(void); static void nextAlert(void);
@ -457,10 +456,6 @@ void awardChallengeTrophies(void)
void awardPostMissionTrophies(void) void awardPostMissionTrophies(void)
{ {
awardCraftTrophy();
awardPandoranCraftTrophy();
if (game.currentMission->epic) if (game.currentMission->epic)
{ {
awardTrophy("EPIC"); awardTrophy("EPIC");
@ -474,28 +469,34 @@ void awardPostMissionTrophies(void)
/* /*
* Must be a non-challenge mission, a common fighter, must not be Sol, and must not have fired any shots or missiles * Must be a non-challenge mission, a common fighter, must not be Sol, and must not have fired any shots or missiles
*/ */
if (!game.currentMission->challengeData.isChallenge && player->flags & EF_COMMON_FIGHTER && player->missiles && strcmp(game.selectedStarSystem, "Sol") && !battle.stats[STAT_SHOTS_FIRED] && !battle.stats[STAT_MISSILES_FIRED]) if (player->flags & EF_COMMON_FIGHTER && player->missiles && strcmp(game.selectedStarSystem, "Sol") && !battle.stats[STAT_SHOTS_FIRED] && !battle.stats[STAT_MISSILES_FIRED])
{ {
awardTrophy("PACIFIST"); awardTrophy("PACIFIST");
} }
} }
/* the player is known as "Player", so we need to check the craft they were assigned to */ void awardCraftTrophy(void)
static void awardCraftTrophy(void)
{ {
char trophyId[MAX_NAME_LENGTH]; if (!game.currentMission->challengeData.isChallenge)
int len, i;
memset(trophyId, '\0', MAX_NAME_LENGTH);
len = strlen(game.currentMission->craft);
for (i = 0 ; i < len ; i++)
{ {
trophyId[i] = toupper(game.currentMission->craft[i]); if (strcmp(game.currentMission->craft, "ATAF") == 0)
{
awardTrophy("ATAF");
}
else if (strcmp(game.currentMission->craft, "Tug") == 0)
{
awardTrophy("TUG");
}
}
else
{
if (strcmp(game.currentMission->craft, "Shuttle") == 0 && battle.stats[STAT_ITEMS_COLLECTED_PLAYER] > 0)
{
awardTrophy("SHUTTLE");
}
} }
awardTrophy(trophyId); awardPandoranCraftTrophy();
} }
static void setSparkleColor(Trophy *t) static void setSparkleColor(Trophy *t)