diff --git a/src/battle/battle.c b/src/battle/battle.c index 9cad771..f37bbcc 100644 --- a/src/battle/battle.c +++ b/src/battle/battle.c @@ -433,6 +433,17 @@ static void doTorelliFireStorm(void) } } +void endCampaign(void) +{ + awardTrophy("CAMPAIGN_COMPLETE"); + + postBattle(); + + destroyBattle(); + + initCredits(); +} + void destroyBattle(void) { Entity *ent; diff --git a/src/battle/battle.h b/src/battle/battle.h index 3515d66..cebad5b 100644 --- a/src/battle/battle.h +++ b/src/battle/battle.h @@ -88,6 +88,8 @@ extern void doSpawners(void); extern void doTrophyAlerts(void); extern void drawTrophyAlert(void); extern void cancelScript(void); +extern void awardTrophy(char *id); +extern void initCredits(void); extern App app; extern Battle battle; diff --git a/src/battle/script.c b/src/battle/script.c index 385b521..188d4df 100644 --- a/src/battle/script.c +++ b/src/battle/script.c @@ -303,6 +303,10 @@ static void executeNextLine(ScriptRunner *runner) { battle.destroyTorelli = 1; } + else if (strcmp(command, "END_CAMPAIGN") == 0) + { + endCampaign(); + } else { SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "ERROR: Unrecognised script command '%s'\n", command); diff --git a/src/battle/script.h b/src/battle/script.h index 450ad5a..2e5a609 100644 --- a/src/battle/script.h +++ b/src/battle/script.h @@ -42,6 +42,7 @@ extern void createChristabelLocation(void); extern void killEntity(char *name); extern void updateEntitySide(char *side, char *entity); extern void activateTrespasserSpawner(void); +extern void endCampaign(void); extern Battle battle; extern Colors colors;