Various trophy integration tweaks.
This commit is contained in:
parent
0671000366
commit
0952920325
|
@ -27,7 +27,7 @@
|
|||
"id" : "CAMPAIGN_40",
|
||||
"title" : "Commander",
|
||||
"description" : "Complete 40% of all missions",
|
||||
"value" : "TROPHY_SILVER"
|
||||
"value" : "TROPHY_BRONZE"
|
||||
},
|
||||
{
|
||||
"id" : "CAMPAIGN_50",
|
||||
|
@ -51,13 +51,13 @@
|
|||
"id" : "CAMPAIGN_90",
|
||||
"title" : "Admiral",
|
||||
"description" : "Complete 90% of all missions",
|
||||
"value" : "TROPHY_SILVER"
|
||||
"value" : "TROPHY_GOLD"
|
||||
},
|
||||
{
|
||||
"id" : "CAMPAIGN_100",
|
||||
"title" : "Fleet Admiral",
|
||||
"description" : "Complete all campaign missions",
|
||||
"value" : "TROPHY_SILVER"
|
||||
"value" : "TROPHY_GOLD"
|
||||
},
|
||||
{
|
||||
"id" : "CAMPAIGN_SOL",
|
||||
|
@ -83,7 +83,7 @@
|
|||
"id" : "CAMPAIGN_ILIAD",
|
||||
"title" : "The shape of things to come",
|
||||
"description" : "Complete all missions at Iliad",
|
||||
"value" : "TROPHY_BRONZE",
|
||||
"value" : "TROPHY_SILVER",
|
||||
"hidden" : 1
|
||||
},
|
||||
{
|
||||
|
@ -108,17 +108,29 @@
|
|||
"statValue" : 1
|
||||
},
|
||||
{
|
||||
"id" : "PANDORAN_FIRST",
|
||||
"title" : "Plenty more where that came from",
|
||||
"description" : "Engage the Pandorans in battle",
|
||||
"id" : "PANDORAN",
|
||||
"title" : "Plenty more where that came from, unfortunately",
|
||||
"description" : "Destroy a Pandoran-controlled craft",
|
||||
"value" : "TROPHY_BRONZE"
|
||||
},
|
||||
{
|
||||
"id" : "ATAF_FIRST",
|
||||
"id" : "ATAF",
|
||||
"title" : "Man, I gotta get me one of these!",
|
||||
"description" : "Pilot an ATAF during the campaign",
|
||||
"value" : "TROPHY_BRONZE"
|
||||
},
|
||||
{
|
||||
"id" : "TUG",
|
||||
"title" : "The 4th emergency service",
|
||||
"description" : "Complete a mission using a Tug",
|
||||
"value" : "TROPHY_BRONZE"
|
||||
},
|
||||
{
|
||||
"id" : "SHUTTLE",
|
||||
"title" : "Room for one more on top",
|
||||
"description" : "Complete a mission using a Shuttle",
|
||||
"value" : "TROPHY_BRONZE"
|
||||
},
|
||||
{
|
||||
"id" : "CHALLENGE_25",
|
||||
"title" : "",
|
||||
|
@ -141,7 +153,7 @@
|
|||
"id" : "FIRE_100000",
|
||||
"title" : "Your name's on one of these!",
|
||||
"description" : "Fire 100,000 shots",
|
||||
"value" : "TROPHY_SILVER",
|
||||
"value" : "TROPHY_BRONZE",
|
||||
"stat" : "STAT_SHOTS_FIRED",
|
||||
"statValue" : 10000
|
||||
},
|
||||
|
@ -149,10 +161,51 @@
|
|||
"id" : "MISSILE_1000",
|
||||
"title" : "Dodge this!",
|
||||
"description" : "Launch 1,000 missiles",
|
||||
"value" : "TROPHY_SILVER",
|
||||
"value" : "TROPHY_BRONZE",
|
||||
"stat" : "STAT_MISSILES_FIRED",
|
||||
"statValue" : 1000
|
||||
},
|
||||
{
|
||||
"id" : "ECM_100",
|
||||
"title" : "Isn't technology wonderful?",
|
||||
"description" : "Use the ECM 100 times",
|
||||
"value" : "TROPHY_BRONZE",
|
||||
"stat" : "STAT_ECM",
|
||||
"statValue" : 100
|
||||
},
|
||||
{
|
||||
"id" : "BOOST_100",
|
||||
"title" : "Runaway!",
|
||||
"description" : "Boost 100 times",
|
||||
"value" : "TROPHY_BRONZE",
|
||||
"stat" : "STAT_BOOST",
|
||||
"statValue" : 100
|
||||
},
|
||||
{
|
||||
"id" : "EVADE_50",
|
||||
"title" : "Missed, you f**kers!",
|
||||
"description" : "Evade 50 missiles",
|
||||
"value" : "TROPHY_BRONZE",
|
||||
"stat" : "STAT_MISSILES_EVADED",
|
||||
"statValue" : 50,
|
||||
"hidden" : 1
|
||||
},
|
||||
{
|
||||
"id" : "WAYPOINT_100",
|
||||
"title" : "Sightseer",
|
||||
"description" : "Visit 100 waypoints",
|
||||
"value" : "TROPHY_BRONZE",
|
||||
"stat" : "STAT_WAYPOINTS_VISITED",
|
||||
"statValue" : 100
|
||||
},
|
||||
{
|
||||
"id" : "EPIC_KILL_13",
|
||||
"title" : "Yippie-ki-yay",
|
||||
"description" : "Destroy 13 or more enemies in an epic battle without being killed",
|
||||
"value" : "TROPHY_SILVER",
|
||||
"stat" : "STAT_EPIC_KILL_STREAK",
|
||||
"statValue" : 13
|
||||
},
|
||||
{
|
||||
"id" : "ATAF_DESTROYED",
|
||||
"title" : "Almost indestructable. Almost.",
|
||||
|
|
|
@ -373,6 +373,11 @@ static void postBattle(void)
|
|||
if (game.currentMission && !game.currentMission->completed)
|
||||
{
|
||||
game.currentMission->completed = (battle.status == MS_COMPLETE || !battle.numObjectivesTotal);
|
||||
|
||||
if (game.currentMission->completed)
|
||||
{
|
||||
awardPostMissionTrophies();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,6 +84,7 @@ extern void destroyEffects(void);
|
|||
extern void initChallengeHome(void);
|
||||
extern void updateAccuracyStats(unsigned int *stats);
|
||||
extern void clearInput(void);
|
||||
extern void awardPostMissionTrophies(void);
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
|
|
|
@ -145,7 +145,7 @@ static void resizeDrawList(void)
|
|||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "Resizing bullet draw capacity: %d -> %d\n", drawCapacity, n);
|
||||
|
||||
bulletsToDraw = resize(bulletsToDraw, sizeof(Bullet*) * drawCapacity, sizeof(Bullet*) * n);
|
||||
|
||||
|
||||
drawCapacity = n;
|
||||
}
|
||||
|
||||
|
@ -207,6 +207,11 @@ static void checkCollisions(Bullet *b)
|
|||
{
|
||||
battle.stats[STAT_ENEMIES_KILLED_PLAYER]++;
|
||||
battle.stats[STAT_EPIC_KILL_STREAK]++;
|
||||
|
||||
if (e->side == SIDE_PANDORAN)
|
||||
{
|
||||
awardTrophy("PANDORAN");
|
||||
}
|
||||
}
|
||||
|
||||
if (b->owner == player && b->type == BT_MISSILE)
|
||||
|
|
|
@ -254,7 +254,7 @@ void doFighter(void)
|
|||
addHudMessage(colors.red, _("Mission target has escaped."));
|
||||
battle.stats[STAT_ENEMIES_ESCAPED]++;
|
||||
}
|
||||
|
||||
|
||||
if (strcmp(self->defName, "Civilian") == 0)
|
||||
{
|
||||
battle.stats[STAT_CIVILIANS_RESCUED]++;
|
||||
|
@ -278,6 +278,12 @@ void doFighter(void)
|
|||
if (self == player)
|
||||
{
|
||||
battle.stats[STAT_PLAYER_KILLED]++;
|
||||
|
||||
/* the player is known as "Player", so we need to check the craft they were assigned to */
|
||||
if (strcmp(game.currentMission->craft, "ATAF") == 0)
|
||||
{
|
||||
awardTrophy("ATAF_DESTROYED");
|
||||
}
|
||||
}
|
||||
else if (player != NULL)
|
||||
{
|
||||
|
|
|
@ -40,10 +40,8 @@ static char *listRestrictions(void);
|
|||
static SDL_Texture *background;
|
||||
static int startIndex;
|
||||
static Widget *start;
|
||||
static int completedChallenges;
|
||||
static SDL_Texture *planetTexture;
|
||||
static PointF planet;
|
||||
static int totalChallenges;
|
||||
static int show;
|
||||
static char timeLimit[MAX_DESCRIPTION_LENGTH];
|
||||
static char restrictions[MAX_DESCRIPTION_LENGTH];
|
||||
|
@ -59,6 +57,8 @@ void initChallengeHome(void)
|
|||
|
||||
unlockChallenges();
|
||||
|
||||
awardChallengeTrophies();
|
||||
|
||||
awardStatsTrophies();
|
||||
|
||||
saveGame();
|
||||
|
@ -109,7 +109,7 @@ static void unlockChallenges(void)
|
|||
|
||||
int i, prevCompleted;
|
||||
|
||||
i = completedChallenges = totalChallenges = 0;
|
||||
i = game.completedChallenges = game.totalChallenges = 0;
|
||||
|
||||
prevCompleted = 1;
|
||||
|
||||
|
@ -117,8 +117,8 @@ static void unlockChallenges(void)
|
|||
{
|
||||
m->available = (prevCompleted > 0 || dev.debug);
|
||||
|
||||
completedChallenges += m->completedChallenges;
|
||||
totalChallenges += m->totalChallenges;
|
||||
game.completedChallenges += m->completedChallenges;
|
||||
game.totalChallenges += m->totalChallenges;
|
||||
prevCompleted = m->completedChallenges;
|
||||
|
||||
i++;
|
||||
|
@ -232,7 +232,7 @@ static void draw(void)
|
|||
|
||||
drawText(SCREEN_WIDTH / 2, 50, 30, TA_CENTER, colors.white, _("Challenges"));
|
||||
|
||||
drawText(SCREEN_WIDTH / 2, 100, 24, TA_CENTER, colors.white, "%d / %d", completedChallenges, totalChallenges);
|
||||
drawText(SCREEN_WIDTH / 2, 100, 24, TA_CENTER, colors.white, "%d / %d", game.completedChallenges, game.totalChallenges);
|
||||
|
||||
drawChallenges();
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@ extern void clearInput(void);
|
|||
extern void doTrophies(void);
|
||||
extern void drawTrophyAlert(void);
|
||||
extern void awardStatsTrophies(void);
|
||||
extern void awardChallengeTrophies(void);
|
||||
|
||||
extern App app;
|
||||
extern Battle battle;
|
||||
|
|
|
@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
static void loadTrophyData(char *filename);
|
||||
static void resetAlert(void);
|
||||
static void awardCraftTrophy(void);
|
||||
|
||||
static Trophy *alertTrophy;
|
||||
static SDL_Texture *trophyIcons[TROPHY_MAX];
|
||||
|
@ -74,7 +75,7 @@ void doTrophies(void)
|
|||
|
||||
if (alertRect.x > -50)
|
||||
{
|
||||
alertDX *= 0.95;
|
||||
alertDX *= 0.9;
|
||||
}
|
||||
|
||||
if (--alertTimer <= 0)
|
||||
|
@ -193,12 +194,12 @@ void awardCampaignTrophies(void)
|
|||
{
|
||||
char trophyId[MAX_NAME_LENGTH];
|
||||
char name[MAX_NAME_LENGTH];
|
||||
int completedMissions, i, len;
|
||||
int completed, i, len;
|
||||
StarSystem *starSystem;
|
||||
|
||||
/* check % of missions completed */
|
||||
completedMissions = getPercent(game.completedMissions, game.totalMissions);
|
||||
sprintf(trophyId, "CAMPAIGN_%d", completedMissions);
|
||||
completed = getPercent(game.completedMissions, game.totalMissions);
|
||||
sprintf(trophyId, "CAMPAIGN_%d", completed);
|
||||
awardTrophy(trophyId);
|
||||
|
||||
/* check if all star system missions are completed */
|
||||
|
@ -220,7 +221,41 @@ void awardCampaignTrophies(void)
|
|||
}
|
||||
}
|
||||
|
||||
void awardChallengeTrophies(void)
|
||||
{
|
||||
char trophyId[MAX_NAME_LENGTH];
|
||||
int completed;
|
||||
|
||||
/* check % of challenges completed */
|
||||
completed = getPercent(game.completedChallenges, game.totalChallenges);
|
||||
sprintf(trophyId, "CHALLENGE_%d", completed);
|
||||
awardTrophy(trophyId);
|
||||
}
|
||||
|
||||
void awardPostMissionTrophies(void)
|
||||
{
|
||||
awardCraftTrophy();
|
||||
|
||||
if (game.currentMission->epic)
|
||||
{
|
||||
awardTrophy("EPIC");
|
||||
}
|
||||
}
|
||||
|
||||
/* the player is known as "Player", so we need to check the craft they were assigned to */
|
||||
static void awardCraftTrophy(void)
|
||||
{
|
||||
char trophyId[MAX_NAME_LENGTH];
|
||||
int len;
|
||||
|
||||
memset(trophyId, '\0', MAX_NAME_LENGTH);
|
||||
|
||||
len = strlen(game.currentMission->craft);
|
||||
|
||||
for (i = 0 ; i < len ; i++)
|
||||
{
|
||||
trophyId[i] = toupper(game.currentMission->craft[i]);
|
||||
}
|
||||
|
||||
awardTrophy(trophyId);
|
||||
}
|
||||
|
|
|
@ -364,6 +364,8 @@ typedef struct {
|
|||
int completedMissions;
|
||||
int availableMissions;
|
||||
int totalMissions;
|
||||
int completedChallenges;
|
||||
int totalChallenges;
|
||||
unsigned int stats[STAT_MAX];
|
||||
Trophy trophyHead;
|
||||
} Game;
|
||||
|
|
Loading…
Reference in New Issue