From e79d331599d177cc7a5826baf8bc2816dc40b46a Mon Sep 17 00:00:00 2001 From: Steve Date: Thu, 25 Feb 2016 10:52:01 +0000 Subject: [PATCH] Added ALL_OBJECTIVES_COMPLETE script command. --- data/missions/clarke/02 - clarke defence #2.json | 2 +- data/missions/clarke/03 - clarke defence #3.json | 2 +- data/missions/coyote/01 - coyote assault #1.json | 2 +- data/missions/granada/02 - suspect packages #2.json | 2 +- data/missions/granada/03 - suspect packages #3.json | 2 +- data/missions/granada/04 - pirate smash.json | 2 +- data/missions/iliad/04 - iliad defence #4.json | 2 +- data/missions/temper/05 - pirate uprising #5.json | 2 +- data/missions/warro/04 - evacuation #4.json | 2 +- data/missions/warro/05 - evacuation #5.json | 2 +- src/battle/battle.c | 4 ++-- src/battle/objectives.c | 9 ++++++++- 12 files changed, 20 insertions(+), 13 deletions(-) diff --git a/data/missions/clarke/02 - clarke defence #2.json b/data/missions/clarke/02 - clarke defence #2.json index 47a41c4..c7b27ef 100644 --- a/data/missions/clarke/02 - clarke defence #2.json +++ b/data/missions/clarke/02 - clarke defence #2.json @@ -106,7 +106,7 @@ ] }, { - "function" : "OBJECTIVES_COMPLETE 3", + "function" : "ALL_OBJECTIVES_COMPLETE", "lines" : [ "WAIT 1", "MSG_BOX Carlyle;This is Carlyle. Enemy corvette has been destroyed. All other fighters scratched.", diff --git a/data/missions/clarke/03 - clarke defence #3.json b/data/missions/clarke/03 - clarke defence #3.json index db4b809..9c5a507 100644 --- a/data/missions/clarke/03 - clarke defence #3.json +++ b/data/missions/clarke/03 - clarke defence #3.json @@ -135,7 +135,7 @@ ] }, { - "function" : "OBJECTIVES_COMPLETE 4", + "function" : "ALL_OBJECTIVES_COMPLETE", "lines" : [ "WAIT 1", "MSG_BOX Carlyle;This is Carlyle. Enemy targets have been eliminated. Cleopatra still in one piece.", diff --git a/data/missions/coyote/01 - coyote assault #1.json b/data/missions/coyote/01 - coyote assault #1.json index 4518aca..94131ed 100644 --- a/data/missions/coyote/01 - coyote assault #1.json +++ b/data/missions/coyote/01 - coyote assault #1.json @@ -139,7 +139,7 @@ ] }, { - "function" : "OBJECTIVES_COMPLETE 1", + "function" : "ALL_OBJECTIVES_COMPLETE", "lines" : [ "WAIT 1", "MSG_BOX de Winter;Griffin, this is de Winter. All targets destroyed.", diff --git a/data/missions/granada/02 - suspect packages #2.json b/data/missions/granada/02 - suspect packages #2.json index 30f95ae..99e3d1b 100644 --- a/data/missions/granada/02 - suspect packages #2.json +++ b/data/missions/granada/02 - suspect packages #2.json @@ -162,7 +162,7 @@ ] }, { - "function" : "OBJECTIVES_COMPLETE 4", + "function" : "ALL_OBJECTIVES_COMPLETE", "lines" : [ "WAIT 2", "MSG_BOX Carr;Alexandria, packaged delivered.", diff --git a/data/missions/granada/03 - suspect packages #3.json b/data/missions/granada/03 - suspect packages #3.json index 6c75dd1..b0a3039 100644 --- a/data/missions/granada/03 - suspect packages #3.json +++ b/data/missions/granada/03 - suspect packages #3.json @@ -144,7 +144,7 @@ ] }, { - "function" : "OBJECTIVES_COMPLETE 5", + "function" : "ALL_OBJECTIVES_COMPLETE", "lines" : [ "WAIT 2", "MSG_BOX Carr;This is Carr, reporting operation successful. Bagged us two squadron commanders.", diff --git a/data/missions/granada/04 - pirate smash.json b/data/missions/granada/04 - pirate smash.json index 9be7713..8ede394 100644 --- a/data/missions/granada/04 - pirate smash.json +++ b/data/missions/granada/04 - pirate smash.json @@ -123,7 +123,7 @@ ] }, { - "function" : "OBJECTIVES_COMPLETE 3", + "function" : "ALL_OBJECTIVES_COMPLETE", "lines" : [ "WAIT 2", "MSG_BOX Carr;This is Carr. Reporting threat eliminated, operation successful.", diff --git a/data/missions/iliad/04 - iliad defence #4.json b/data/missions/iliad/04 - iliad defence #4.json index 181505c..0f709df 100644 --- a/data/missions/iliad/04 - iliad defence #4.json +++ b/data/missions/iliad/04 - iliad defence #4.json @@ -259,7 +259,7 @@ ] }, { - "function" : "OBJECTIVES_COMPLETE 4", + "function" : "ALL_OBJECTIVES_COMPLETE", "lines" : [ "WAIT 2", "MSG_BOX Williams;Control, this is Williams. Enemy capital ships have been destroyed, along with all other forces.", diff --git a/data/missions/temper/05 - pirate uprising #5.json b/data/missions/temper/05 - pirate uprising #5.json index 161558b..d897ec8 100644 --- a/data/missions/temper/05 - pirate uprising #5.json +++ b/data/missions/temper/05 - pirate uprising #5.json @@ -117,7 +117,7 @@ ] }, { - "function" : "OBJECTIVES_COMPLETE 1", + "function" : "ALL_OBJECTIVES_COMPLETE", "lines" : [ "WAIT 2", "MSG_BOX Strickland; Looks like that was the last of 'em.", diff --git a/data/missions/warro/04 - evacuation #4.json b/data/missions/warro/04 - evacuation #4.json index 4a48e51..e3aea1a 100644 --- a/data/missions/warro/04 - evacuation #4.json +++ b/data/missions/warro/04 - evacuation #4.json @@ -223,7 +223,7 @@ ] }, { - "function" : "OBJECTIVES_COMPLETE 4", + "function" : "ALL_OBJECTIVES_COMPLETE", "lines" : [ "WAIT 1", "MSG_BOX de Winter;Control, this is de Winter. All enemy forces have been destroyed.", diff --git a/data/missions/warro/05 - evacuation #5.json b/data/missions/warro/05 - evacuation #5.json index 3a771fe..6814009 100644 --- a/data/missions/warro/05 - evacuation #5.json +++ b/data/missions/warro/05 - evacuation #5.json @@ -205,7 +205,7 @@ ] }, { - "function" : "OBJECTIVES_COMPLETE 5", + "function" : "ALL_OBJECTIVES_COMPLETE", "lines" : [ "WAIT 2", "MSG_BOX Taylor;Leviathan, this is Taylor. All targets have been eliminated.", diff --git a/src/battle/battle.c b/src/battle/battle.c index 594bdd0..e31740f 100644 --- a/src/battle/battle.c +++ b/src/battle/battle.c @@ -134,6 +134,8 @@ static void doBattle(void) battle.planet.x -= ssx * 0.05; battle.planet.y -= ssy * 0.05; + + doObjectives(); doHud(); @@ -149,8 +151,6 @@ static void doBattle(void) doPlayer(); - doObjectives(); - if (player != NULL) { doLocations(); diff --git a/src/battle/objectives.c b/src/battle/objectives.c index 64efa1d..a60e641 100644 --- a/src/battle/objectives.c +++ b/src/battle/objectives.c @@ -101,13 +101,20 @@ void updateObjective(char *name, int type) if (o->currentValue == o->targetValue) { + completed++; + o->status = OS_COMPLETE; addHudMessage(colors.green, "%s - Objective Complete!", o->description); runScriptFunction(o->description); - runScriptFunction("OBJECTIVES_COMPLETE %d", ++completed); + runScriptFunction("OBJECTIVES_COMPLETE %d", completed); + + if (completed == battle.numObjectivesTotal) + { + runScriptFunction("ALL_OBJECTIVES_COMPLETE"); + } } }