Allow campaign to be ended with script.

This commit is contained in:
Steve 2016-05-31 09:12:14 +01:00
parent d1e9c4a734
commit 5d5c19a62d
4 changed files with 18 additions and 0 deletions

View File

@ -433,6 +433,17 @@ static void doTorelliFireStorm(void)
} }
} }
void endCampaign(void)
{
awardTrophy("CAMPAIGN_COMPLETE");
postBattle();
destroyBattle();
initCredits();
}
void destroyBattle(void) void destroyBattle(void)
{ {
Entity *ent; Entity *ent;

View File

@ -88,6 +88,8 @@ extern void doSpawners(void);
extern void doTrophyAlerts(void); extern void doTrophyAlerts(void);
extern void drawTrophyAlert(void); extern void drawTrophyAlert(void);
extern void cancelScript(void); extern void cancelScript(void);
extern void awardTrophy(char *id);
extern void initCredits(void);
extern App app; extern App app;
extern Battle battle; extern Battle battle;

View File

@ -303,6 +303,10 @@ static void executeNextLine(ScriptRunner *runner)
{ {
battle.destroyTorelli = 1; battle.destroyTorelli = 1;
} }
else if (strcmp(command, "END_CAMPAIGN") == 0)
{
endCampaign();
}
else else
{ {
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "ERROR: Unrecognised script command '%s'\n", command); SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "ERROR: Unrecognised script command '%s'\n", command);

View File

@ -42,6 +42,7 @@ extern void createChristabelLocation(void);
extern void killEntity(char *name); extern void killEntity(char *name);
extern void updateEntitySide(char *side, char *entity); extern void updateEntitySide(char *side, char *entity);
extern void activateTrespasserSpawner(void); extern void activateTrespasserSpawner(void);
extern void endCampaign(void);
extern Battle battle; extern Battle battle;
extern Colors colors; extern Colors colors;