From 93e65d1431604623b174c69bd59449f3cc4f0864 Mon Sep 17 00:00:00 2001 From: Steve Date: Fri, 3 Jun 2016 07:41:44 +0100 Subject: [PATCH] Trophy updates. --- data/trophies/trophies.json | 2 +- src/challenges/challenges.c | 2 ++ src/challenges/challenges.h | 1 + src/galaxy/mission.c | 7 +++---- src/galaxy/mission.h | 1 + src/game/trophies.c | 39 +++++++++++++++++++------------------ 6 files changed, 28 insertions(+), 24 deletions(-) diff --git a/data/trophies/trophies.json b/data/trophies/trophies.json index 9230ef9..b85a4ef 100644 --- a/data/trophies/trophies.json +++ b/data/trophies/trophies.json @@ -123,7 +123,7 @@ { "id" : "SHUTTLE", "title" : "Room for one more on top", - "description" : "Complete a mission using a Shuttle", + "description" : "Complete a challenge using a Shuttle", "value" : "TROPHY_BRONZE" }, { diff --git a/src/challenges/challenges.c b/src/challenges/challenges.c index 3302e24..a2dcb5b 100644 --- a/src/challenges/challenges.c +++ b/src/challenges/challenges.c @@ -538,6 +538,8 @@ static void completeChallenge(void) retreatEnemies(); awardStatsTrophies(); + + awardCraftTrophy(); } } diff --git a/src/challenges/challenges.h b/src/challenges/challenges.h index 169073c..f558f92 100644 --- a/src/challenges/challenges.h +++ b/src/challenges/challenges.h @@ -33,6 +33,7 @@ extern long lookup(char *name); extern void awardStatsTrophies(void); extern void retreatAllies(void); extern void retreatEnemies(void); +extern void awardCraftTrophy(void); extern Dev dev; extern Battle battle; diff --git a/src/galaxy/mission.c b/src/galaxy/mission.c index 240f68d..f8ebb98 100644 --- a/src/galaxy/mission.c +++ b/src/galaxy/mission.c @@ -283,10 +283,9 @@ void completeMission(void) awardStatsTrophies(); - if (!game.currentMission->challengeData.isChallenge) - { - awardPostMissionTrophies(); - } + awardPostMissionTrophies(); + + awardCraftTrophy(); } } diff --git a/src/galaxy/mission.h b/src/galaxy/mission.h index 7ad7b32..4a150ca 100644 --- a/src/galaxy/mission.h +++ b/src/galaxy/mission.h @@ -62,6 +62,7 @@ extern Entity *spawnMine(int type); extern void activateNextWaypoint(void); extern void awardStatsTrophies(void); extern void awardPostMissionTrophies(void); +extern void awardCraftTrophy(void); extern Battle battle; extern Dev dev; diff --git a/src/game/trophies.c b/src/game/trophies.c index 1aa1b34..ad05728 100644 --- a/src/game/trophies.c +++ b/src/game/trophies.c @@ -24,7 +24,6 @@ static void prevPage(void); static void nextPage(void); static void loadTrophyData(char *filename); static void resetAlert(void); -static void awardCraftTrophy(void); static void setSparkleColor(Trophy *t); static void nextAlert(void); @@ -457,10 +456,6 @@ void awardChallengeTrophies(void) void awardPostMissionTrophies(void) { - awardCraftTrophy(); - - awardPandoranCraftTrophy(); - if (game.currentMission->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 */ - 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"); } } -/* the player is known as "Player", so we need to check the craft they were assigned to */ -static void awardCraftTrophy(void) +void awardCraftTrophy(void) { - char trophyId[MAX_NAME_LENGTH]; - int len, i; - - memset(trophyId, '\0', MAX_NAME_LENGTH); - - len = strlen(game.currentMission->craft); - - for (i = 0 ; i < len ; i++) + if (!game.currentMission->challengeData.isChallenge) { - 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"); + } } - - awardTrophy(trophyId); + else + { + if (strcmp(game.currentMission->craft, "Shuttle") == 0 && battle.stats[STAT_ITEMS_COLLECTED_PLAYER] > 0) + { + awardTrophy("SHUTTLE"); + } + } + + awardPandoranCraftTrophy(); } static void setSparkleColor(Trophy *t)