Merge branch 'develop' into trophies
Conflicts: src/battle/battle.c
This commit is contained in:
parent
0a69dd0e5e
commit
f5b3933a87
|
@ -27,7 +27,7 @@
|
||||||
"id" : "CAMPAIGN_40",
|
"id" : "CAMPAIGN_40",
|
||||||
"title" : "Commander",
|
"title" : "Commander",
|
||||||
"description" : "Complete 40% of all missions",
|
"description" : "Complete 40% of all missions",
|
||||||
"value" : "TROPHY_SILVER"
|
"value" : "TROPHY_BRONZE"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id" : "CAMPAIGN_50",
|
"id" : "CAMPAIGN_50",
|
||||||
|
@ -51,13 +51,13 @@
|
||||||
"id" : "CAMPAIGN_90",
|
"id" : "CAMPAIGN_90",
|
||||||
"title" : "Admiral",
|
"title" : "Admiral",
|
||||||
"description" : "Complete 90% of all missions",
|
"description" : "Complete 90% of all missions",
|
||||||
"value" : "TROPHY_SILVER"
|
"value" : "TROPHY_GOLD"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id" : "CAMPAIGN_100",
|
"id" : "CAMPAIGN_100",
|
||||||
"title" : "Fleet Admiral",
|
"title" : "Fleet Admiral",
|
||||||
"description" : "Complete all campaign missions",
|
"description" : "Complete all campaign missions",
|
||||||
"value" : "TROPHY_SILVER"
|
"value" : "TROPHY_GOLD"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id" : "CAMPAIGN_SOL",
|
"id" : "CAMPAIGN_SOL",
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
"id" : "CAMPAIGN_ILIAD",
|
"id" : "CAMPAIGN_ILIAD",
|
||||||
"title" : "The shape of things to come",
|
"title" : "The shape of things to come",
|
||||||
"description" : "Complete all missions at Iliad",
|
"description" : "Complete all missions at Iliad",
|
||||||
"value" : "TROPHY_BRONZE",
|
"value" : "TROPHY_SILVER",
|
||||||
"hidden" : 1
|
"hidden" : 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -108,17 +108,29 @@
|
||||||
"statValue" : 1
|
"statValue" : 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id" : "PANDORAN_FIRST",
|
"id" : "PANDORAN",
|
||||||
"title" : "Plenty more where that came from",
|
"title" : "Plenty more where that came from, unfortunately",
|
||||||
"description" : "Engage the Pandorans in battle",
|
"description" : "Destroy a Pandoran-controlled craft",
|
||||||
"value" : "TROPHY_BRONZE"
|
"value" : "TROPHY_BRONZE"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id" : "ATAF_FIRST",
|
"id" : "ATAF",
|
||||||
"title" : "Man, I gotta get me one of these!",
|
"title" : "Man, I gotta get me one of these!",
|
||||||
"description" : "Pilot an ATAF during the campaign",
|
"description" : "Pilot an ATAF during the campaign",
|
||||||
"value" : "TROPHY_BRONZE"
|
"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",
|
"id" : "CHALLENGE_25",
|
||||||
"title" : "",
|
"title" : "",
|
||||||
|
@ -141,7 +153,7 @@
|
||||||
"id" : "FIRE_100000",
|
"id" : "FIRE_100000",
|
||||||
"title" : "Your name's on one of these!",
|
"title" : "Your name's on one of these!",
|
||||||
"description" : "Fire 100,000 shots",
|
"description" : "Fire 100,000 shots",
|
||||||
"value" : "TROPHY_SILVER",
|
"value" : "TROPHY_BRONZE",
|
||||||
"stat" : "STAT_SHOTS_FIRED",
|
"stat" : "STAT_SHOTS_FIRED",
|
||||||
"statValue" : 10000
|
"statValue" : 10000
|
||||||
},
|
},
|
||||||
|
@ -149,10 +161,51 @@
|
||||||
"id" : "MISSILE_1000",
|
"id" : "MISSILE_1000",
|
||||||
"title" : "Dodge this!",
|
"title" : "Dodge this!",
|
||||||
"description" : "Launch 1,000 missiles",
|
"description" : "Launch 1,000 missiles",
|
||||||
"value" : "TROPHY_SILVER",
|
"value" : "TROPHY_BRONZE",
|
||||||
"stat" : "STAT_MISSILES_FIRED",
|
"stat" : "STAT_MISSILES_FIRED",
|
||||||
"statValue" : 1000
|
"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",
|
"id" : "ATAF_DESTROYED",
|
||||||
"title" : "Almost indestructable. Almost.",
|
"title" : "Almost indestructable. Almost.",
|
||||||
|
|
|
@ -371,6 +371,11 @@ static void postBattle(void)
|
||||||
if (game.currentMission && !game.currentMission->completed)
|
if (game.currentMission && !game.currentMission->completed)
|
||||||
{
|
{
|
||||||
game.currentMission->completed = (battle.status == MS_COMPLETE || !battle.numObjectivesTotal);
|
game.currentMission->completed = (battle.status == MS_COMPLETE || !battle.numObjectivesTotal);
|
||||||
|
|
||||||
|
if (game.currentMission->completed)
|
||||||
|
{
|
||||||
|
awardPostMissionTrophies();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,6 +85,7 @@ extern void initChallengeHome(void);
|
||||||
extern void updateAccuracyStats(unsigned int *stats);
|
extern void updateAccuracyStats(unsigned int *stats);
|
||||||
extern void clearInput(void);
|
extern void clearInput(void);
|
||||||
extern void runScriptTimeFunctions(void);
|
extern void runScriptTimeFunctions(void);
|
||||||
|
extern void awardPostMissionTrophies(void);
|
||||||
|
|
||||||
extern App app;
|
extern App app;
|
||||||
extern Battle battle;
|
extern Battle battle;
|
||||||
|
|
|
@ -207,6 +207,11 @@ static void checkCollisions(Bullet *b)
|
||||||
{
|
{
|
||||||
battle.stats[STAT_ENEMIES_KILLED_PLAYER]++;
|
battle.stats[STAT_ENEMIES_KILLED_PLAYER]++;
|
||||||
battle.stats[STAT_EPIC_KILL_STREAK]++;
|
battle.stats[STAT_EPIC_KILL_STREAK]++;
|
||||||
|
|
||||||
|
if (e->side == SIDE_PANDORAN)
|
||||||
|
{
|
||||||
|
awardTrophy("PANDORAN");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->owner == player && b->type == BT_MISSILE)
|
if (b->owner == player && b->type == BT_MISSILE)
|
||||||
|
|
|
@ -314,6 +314,12 @@ void doFighter(void)
|
||||||
if (self == player)
|
if (self == player)
|
||||||
{
|
{
|
||||||
battle.stats[STAT_PLAYER_KILLED]++;
|
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)
|
else if (player != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,10 +40,8 @@ static char *listRestrictions(void);
|
||||||
static SDL_Texture *background;
|
static SDL_Texture *background;
|
||||||
static int startIndex;
|
static int startIndex;
|
||||||
static Widget *start;
|
static Widget *start;
|
||||||
static int completedChallenges;
|
|
||||||
static SDL_Texture *planetTexture;
|
static SDL_Texture *planetTexture;
|
||||||
static PointF planet;
|
static PointF planet;
|
||||||
static int totalChallenges;
|
|
||||||
static int show;
|
static int show;
|
||||||
static char timeLimit[MAX_DESCRIPTION_LENGTH];
|
static char timeLimit[MAX_DESCRIPTION_LENGTH];
|
||||||
static char restrictions[MAX_DESCRIPTION_LENGTH];
|
static char restrictions[MAX_DESCRIPTION_LENGTH];
|
||||||
|
@ -59,6 +57,8 @@ void initChallengeHome(void)
|
||||||
|
|
||||||
unlockChallenges();
|
unlockChallenges();
|
||||||
|
|
||||||
|
awardChallengeTrophies();
|
||||||
|
|
||||||
awardStatsTrophies();
|
awardStatsTrophies();
|
||||||
|
|
||||||
saveGame();
|
saveGame();
|
||||||
|
@ -109,7 +109,7 @@ static void unlockChallenges(void)
|
||||||
|
|
||||||
int i, prevCompleted;
|
int i, prevCompleted;
|
||||||
|
|
||||||
i = completedChallenges = totalChallenges = 0;
|
i = game.completedChallenges = game.totalChallenges = 0;
|
||||||
|
|
||||||
prevCompleted = 1;
|
prevCompleted = 1;
|
||||||
|
|
||||||
|
@ -117,8 +117,8 @@ static void unlockChallenges(void)
|
||||||
{
|
{
|
||||||
m->available = (prevCompleted > 0 || dev.debug);
|
m->available = (prevCompleted > 0 || dev.debug);
|
||||||
|
|
||||||
completedChallenges += m->completedChallenges;
|
game.completedChallenges += m->completedChallenges;
|
||||||
totalChallenges += m->totalChallenges;
|
game.totalChallenges += m->totalChallenges;
|
||||||
prevCompleted = m->completedChallenges;
|
prevCompleted = m->completedChallenges;
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
@ -232,7 +232,7 @@ static void draw(void)
|
||||||
|
|
||||||
drawText(SCREEN_WIDTH / 2, 50, 30, TA_CENTER, colors.white, _("Challenges"));
|
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();
|
drawChallenges();
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ extern void clearInput(void);
|
||||||
extern void doTrophies(void);
|
extern void doTrophies(void);
|
||||||
extern void drawTrophyAlert(void);
|
extern void drawTrophyAlert(void);
|
||||||
extern void awardStatsTrophies(void);
|
extern void awardStatsTrophies(void);
|
||||||
|
extern void awardChallengeTrophies(void);
|
||||||
|
|
||||||
extern App app;
|
extern App app;
|
||||||
extern Battle battle;
|
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 loadTrophyData(char *filename);
|
||||||
static void resetAlert(void);
|
static void resetAlert(void);
|
||||||
|
static void awardCraftTrophy(void);
|
||||||
|
|
||||||
static Trophy *alertTrophy;
|
static Trophy *alertTrophy;
|
||||||
static SDL_Texture *trophyIcons[TROPHY_MAX];
|
static SDL_Texture *trophyIcons[TROPHY_MAX];
|
||||||
|
@ -74,7 +75,7 @@ void doTrophies(void)
|
||||||
|
|
||||||
if (alertRect.x > -50)
|
if (alertRect.x > -50)
|
||||||
{
|
{
|
||||||
alertDX *= 0.95;
|
alertDX *= 0.9;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (--alertTimer <= 0)
|
if (--alertTimer <= 0)
|
||||||
|
@ -193,12 +194,12 @@ void awardCampaignTrophies(void)
|
||||||
{
|
{
|
||||||
char trophyId[MAX_NAME_LENGTH];
|
char trophyId[MAX_NAME_LENGTH];
|
||||||
char name[MAX_NAME_LENGTH];
|
char name[MAX_NAME_LENGTH];
|
||||||
int completedMissions, i, len;
|
int completed, i, len;
|
||||||
StarSystem *starSystem;
|
StarSystem *starSystem;
|
||||||
|
|
||||||
/* check % of missions completed */
|
/* check % of missions completed */
|
||||||
completedMissions = getPercent(game.completedMissions, game.totalMissions);
|
completed = getPercent(game.completedMissions, game.totalMissions);
|
||||||
sprintf(trophyId, "CAMPAIGN_%d", completedMissions);
|
sprintf(trophyId, "CAMPAIGN_%d", completed);
|
||||||
awardTrophy(trophyId);
|
awardTrophy(trophyId);
|
||||||
|
|
||||||
/* check if all star system missions are completed */
|
/* 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)
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -365,6 +365,8 @@ typedef struct {
|
||||||
int completedMissions;
|
int completedMissions;
|
||||||
int availableMissions;
|
int availableMissions;
|
||||||
int totalMissions;
|
int totalMissions;
|
||||||
|
int completedChallenges;
|
||||||
|
int totalChallenges;
|
||||||
unsigned int stats[STAT_MAX];
|
unsigned int stats[STAT_MAX];
|
||||||
Trophy trophyHead;
|
Trophy trophyHead;
|
||||||
} Game;
|
} Game;
|
||||||
|
|
Loading…
Reference in New Issue