From eeaccec32723cd7c18618ac66da64c3d370c7dd6 Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 29 Nov 2015 12:55:15 +0000 Subject: [PATCH] Update script function calls. --- data/missions/alba/01 - patrol #1.json | 2 +- data/missions/alba/02 - patrol #2.json | 6 ++-- .../coyote/01 - coyote assault #1.json | 2 +- .../coyote/03 - coyote assault #3.json | 4 +-- .../granada/01 - suspect packages #1.json | 2 +- .../granada/02 - suspect packages #2.json | 25 +++++++++++------ .../missions/iliad/01 - iliad defence #1.json | 2 +- data/missions/sol/01 - free flight.json | 2 +- data/missions/sol/02 - weapons.json | 2 +- data/missions/sol/03 - moving target.json | 2 +- data/missions/sol/04 - armed target.json | 2 +- data/missions/sol/05 - ecm.json | 2 +- data/missions/sol/06 - wingmates.json | 2 +- data/missions/sol/07 - final.json | 2 +- .../temper/01 - pirate uprising #1.json | 2 +- .../temper/02 - pirate uprising #2.json | 2 +- .../temper/03 - pirate uprising #3.json | 2 +- .../temper/04 - pirate uprising #4.json | 2 +- data/missions/warro/01 - evacuation #1.json | 2 +- data/missions/warro/02 - evacuation #2.json | 8 +++--- data/missions/warro/03 - evacuation #3.json | 2 +- src/battle/entities.c | 16 ++++++++--- src/battle/objectives.c | 28 +++++++++++++------ src/battle/objectives.h | 1 + src/battle/script.c | 12 ++++---- src/battle/script.h | 4 +-- 26 files changed, 83 insertions(+), 55 deletions(-) diff --git a/data/missions/alba/01 - patrol #1.json b/data/missions/alba/01 - patrol #1.json index 5464d62..5f3bd6a 100644 --- a/data/missions/alba/01 - patrol #1.json +++ b/data/missions/alba/01 - patrol #1.json @@ -16,7 +16,7 @@ "player" : { "type" : "Firefly", "side" : "SIDE_ALLIES", - "pilot" : "Curtis Rice", + "pilot" : "1st Lt. Curtis Rice", "squadron" : "Eightballers" }, "fighters" : [ diff --git a/data/missions/alba/02 - patrol #2.json b/data/missions/alba/02 - patrol #2.json index 0b5f08b..920c941 100644 --- a/data/missions/alba/02 - patrol #2.json +++ b/data/missions/alba/02 - patrol #2.json @@ -23,7 +23,7 @@ "player" : { "type" : "Firefly", "side" : "SIDE_ALLIES", - "pilot" : "Curtis Rice", + "pilot" : "1st Lt. Curtis Rice", "squadron" : "Eightballers" }, "fighters" : [ @@ -61,8 +61,8 @@ { "function" : "Waypoint #3", "lines" : [ - "ACTIVATE_ENTITY Pandoran", - "ACTIVATE_OBJECTIVE 1", + "ACTIVATE_ENTITIES Pandoran", + "ACTIVATE_OBJECTIVES 1", "MSG_BOX Alba Control;Patrol A-82, you have hostiles incoming. Identified as 3 Mitikas fighters; Jackals, possibly Pandoran. Engage, but exercise extreme caution." ] } diff --git a/data/missions/coyote/01 - coyote assault #1.json b/data/missions/coyote/01 - coyote assault #1.json index 9991626..90526ac 100644 --- a/data/missions/coyote/01 - coyote assault #1.json +++ b/data/missions/coyote/01 - coyote assault #1.json @@ -23,7 +23,7 @@ "player" : { "type" : "ATAF", "side" : "SIDE_ALLIES", - "pilot" : "Simon Dodds", + "pilot" : "Lt. Cdr. Simon Dodds", "squadron" : "White Knights" }, "fighters" : [ diff --git a/data/missions/coyote/03 - coyote assault #3.json b/data/missions/coyote/03 - coyote assault #3.json index 0270d22..0942cef 100644 --- a/data/missions/coyote/03 - coyote assault #3.json +++ b/data/missions/coyote/03 - coyote assault #3.json @@ -88,7 +88,7 @@ "function" : "ALLIES_KILLED 80", "lines" : [ "MSG_BOX UNF Pilot #2;The White Knights are here! Finally!", - "ACTIVATE_ENTITY ATAFs" + "ACTIVATE_ENTITIES ATAFs" ] }, { @@ -99,7 +99,7 @@ "MSG_BOX Lt Cdr Dodds;Estelle, we've got this. We can take them.", "MSG_BOX Cdr de Winter;We're taking too many losses, Dodds. Fall back now, that's an order.", "WAIT_MSG_BOX", - "ACTIVATE_ENTITY Extraction Point", + "ACTIVATE_ENTITIES Extraction Point", "RETREAT_ALLIES" ] } diff --git a/data/missions/granada/01 - suspect packages #1.json b/data/missions/granada/01 - suspect packages #1.json index dc3a0f4..74f419b 100644 --- a/data/missions/granada/01 - suspect packages #1.json +++ b/data/missions/granada/01 - suspect packages #1.json @@ -14,7 +14,7 @@ } ], "player" : { - "pilot" : "Daniel Carr", + "pilot" : "Lt. Cdr. Daniel Carr", "squadron" : "Iron Patriots", "type" : "TAF", "side" : "SIDE_ALLIES" diff --git a/data/missions/granada/02 - suspect packages #2.json b/data/missions/granada/02 - suspect packages #2.json index 3f4f627..9781a46 100644 --- a/data/missions/granada/02 - suspect packages #2.json +++ b/data/missions/granada/02 - suspect packages #2.json @@ -26,6 +26,14 @@ "targetType" : "TT_ESCAPED", "active" : 0 }, + { + "description" : "Do not destroy Stranded Dart", + "targetName" : "Stranded Dart", + "targetValue" : 1, + "targetType" : "TT_DESTROY", + "isCondition" : 1, + "active" : 0 + }, { "description" : "Destroy Intercepting Darts", "targetName" : "Dart", @@ -35,7 +43,7 @@ } ], "player" : { - "pilot" : "Lt. Daniel Carr", + "pilot" : "Lt. Cdr. Daniel Carr", "squadron" : "Iron Patriots", "type" : "TAF", "side" : "SIDE_ALLIES", @@ -121,8 +129,8 @@ "function" : "Waypoint #2", "lines" : [ "MSG_BOX Alexandria Orbital;Patrol, we're again identifying a handful of crates drifting close to your current position. Please effect pick up.", - "ACTIVATE_ENTITY package", - "ACTIVATE_OBJECTIVE 1" + "ACTIVATE_ENTITIES package", + "ACTIVATE_OBJECTIVES 1" ] }, { @@ -131,9 +139,8 @@ "MSG_BOX Alexandria Orbital;Patrol, a stranded Dart has been spotted nearby. A tug has been dispatch to bring it in. Please escort it to the target's location.", "MSG_BOX 1st Lt Carr;Know anything about the occupant, or affiliation?", "MSG_BOX Alexandria Orbital;Negative, Lieutenant. We'll know more once it's brought in.", - "ACTIVATE_ENTITY Stranded Dart", - "ACTIVATE_ENTITY Tug", - "ACTIVATE_OBJECTIVE 2" + "ACTIVATE_ENTITIES Stranded Dart;Tug", + "ACTIVATE_OBJECTIVES 2;3" ] }, { @@ -142,10 +149,10 @@ "WAIT 2", "MSG_BOX Tug;Tow cable attached. Ready to head home.", "MSG_BOX 1st Lt Carr;We're done here. Let's bring our mystery guest in.", - "ACTIVATE_ENTITY Extraction Point", + "ACTIVATE_ENTITIES Extraction Point", "WAIT 20", - "ACTIVATE_ENTITY Dart", - "ACTIVATE_OBJECTIVE 3", + "ACTIVATE_ENTITIES Dart", + "ACTIVATE_OBJECTIVES 4", "MSG_BOX TAF Pilot;Dan, we've got enemy vessels inbound. More Darts.", "MSG_BOX 1st Lt Carr;Prepare to engage. Protect the asset!" ] diff --git a/data/missions/iliad/01 - iliad defence #1.json b/data/missions/iliad/01 - iliad defence #1.json index 8127275..0647533 100644 --- a/data/missions/iliad/01 - iliad defence #1.json +++ b/data/missions/iliad/01 - iliad defence #1.json @@ -22,7 +22,7 @@ "player" : { "type" : "Firefly", "side" : "SIDE_ALLIES", - "pilot" : "Opal Williams", + "pilot" : "1st Lt. Opal Williams", "squadron" : "Agamemnon's 1st", "x" : 25, "y" : 45 diff --git a/data/missions/sol/01 - free flight.json b/data/missions/sol/01 - free flight.json index fbbd2b6..df8171a 100644 --- a/data/missions/sol/01 - free flight.json +++ b/data/missions/sol/01 - free flight.json @@ -7,7 +7,7 @@ "player" : { "type" : "TAF", "side" : "SIDE_ALLIES", - "pilot" : "Jim Goddard", + "pilot" : "2nd Lt. Jim Goddard", "squadron" : "Midnight Runners" }, "script" : [ diff --git a/data/missions/sol/02 - weapons.json b/data/missions/sol/02 - weapons.json index 9d2473b..62f2a5d 100644 --- a/data/missions/sol/02 - weapons.json +++ b/data/missions/sol/02 - weapons.json @@ -15,7 +15,7 @@ "player" : { "type" : "TAF", "side" : "SIDE_ALLIES", - "pilot" : "Jim Goddard", + "pilot" : "2nd Lt. Jim Goddard", "squadron" : "Midnight Runners" }, "fighters" : [ diff --git a/data/missions/sol/03 - moving target.json b/data/missions/sol/03 - moving target.json index 8c71f15..69b96ae 100644 --- a/data/missions/sol/03 - moving target.json +++ b/data/missions/sol/03 - moving target.json @@ -15,7 +15,7 @@ "player" : { "type" : "TAF", "side" : "SIDE_ALLIES", - "pilot" : "Jim Goddard", + "pilot" : "2nd Lt. Jim Goddard", "squadron" : "Midnight Runners" }, "fighters" : [ diff --git a/data/missions/sol/04 - armed target.json b/data/missions/sol/04 - armed target.json index 56b8eeb..1d64621 100644 --- a/data/missions/sol/04 - armed target.json +++ b/data/missions/sol/04 - armed target.json @@ -15,7 +15,7 @@ "player" : { "type" : "TAF", "side" : "SIDE_ALLIES", - "pilot" : "Jim Goddard", + "pilot" : "2nd Lt. Jim Goddard", "squadron" : "Midnight Runners" }, "fighters" : [ diff --git a/data/missions/sol/05 - ecm.json b/data/missions/sol/05 - ecm.json index 02810ed..fdc21ae 100644 --- a/data/missions/sol/05 - ecm.json +++ b/data/missions/sol/05 - ecm.json @@ -15,7 +15,7 @@ "player" : { "type" : "TAF", "side" : "SIDE_ALLIES", - "pilot" : "Jim Goddard", + "pilot" : "2nd Lt. Jim Goddard", "squadron" : "Midnight Runners" }, "fighters" : [ diff --git a/data/missions/sol/06 - wingmates.json b/data/missions/sol/06 - wingmates.json index 63bcb60..cae16da 100644 --- a/data/missions/sol/06 - wingmates.json +++ b/data/missions/sol/06 - wingmates.json @@ -15,7 +15,7 @@ "player" : { "type" : "TAF", "side" : "SIDE_ALLIES", - "pilot" : "Jim Goddard", + "pilot" : "2nd Lt. Jim Goddard", "squadron" : "Midnight Runners" }, "fighters" : [ diff --git a/data/missions/sol/07 - final.json b/data/missions/sol/07 - final.json index 9533095..963fb98 100644 --- a/data/missions/sol/07 - final.json +++ b/data/missions/sol/07 - final.json @@ -15,7 +15,7 @@ "player" : { "type" : "TAF", "side" : "SIDE_ALLIES", - "pilot" : "Jim Goddard", + "pilot" : "2nd Lt. Jim Goddard", "squadron" : "Midnight Runners" }, "fighters" : [ diff --git a/data/missions/temper/01 - pirate uprising #1.json b/data/missions/temper/01 - pirate uprising #1.json index 37f8ac9..834d37c 100644 --- a/data/missions/temper/01 - pirate uprising #1.json +++ b/data/missions/temper/01 - pirate uprising #1.json @@ -15,7 +15,7 @@ "player" : { "type" : "TAF", "side" : "SIDE_ALLIES", - "pilot" : "Katherine Strickland", + "pilot" : "Cdr. Katherine Strickland", "squadron" : "Steel Bulls" }, "fighters" : [ diff --git a/data/missions/temper/02 - pirate uprising #2.json b/data/missions/temper/02 - pirate uprising #2.json index 7f32214..ae61d01 100644 --- a/data/missions/temper/02 - pirate uprising #2.json +++ b/data/missions/temper/02 - pirate uprising #2.json @@ -16,7 +16,7 @@ "player" : { "type" : "TAF", "side" : "SIDE_ALLIES", - "pilot" : "Katherine Strickland", + "pilot" : "Cdr. Katherine Strickland", "squadron" : "Steel Bulls" }, "fighters" : [ diff --git a/data/missions/temper/03 - pirate uprising #3.json b/data/missions/temper/03 - pirate uprising #3.json index 8511347..c498f45 100644 --- a/data/missions/temper/03 - pirate uprising #3.json +++ b/data/missions/temper/03 - pirate uprising #3.json @@ -36,7 +36,7 @@ "player" : { "type" : "Ray", "side" : "SIDE_ALLIES", - "pilot" : "Ian Barclay", + "pilot" : "Lt. Cdr. Seth McLeod", "squadron" : "Steel Bulls" }, "fighters" : [ diff --git a/data/missions/temper/04 - pirate uprising #4.json b/data/missions/temper/04 - pirate uprising #4.json index ab82529..1707e99 100644 --- a/data/missions/temper/04 - pirate uprising #4.json +++ b/data/missions/temper/04 - pirate uprising #4.json @@ -29,7 +29,7 @@ "player" : { "type" : "TAF", "side" : "SIDE_ALLIES", - "pilot" : "Katherine Strickland", + "pilot" : "Cdr. Katherine Strickland", "squadron" : "Steel Bulls", "x" : 10, "y" : 25 diff --git a/data/missions/warro/01 - evacuation #1.json b/data/missions/warro/01 - evacuation #1.json index b5cfe1d..e5e031c 100644 --- a/data/missions/warro/01 - evacuation #1.json +++ b/data/missions/warro/01 - evacuation #1.json @@ -13,7 +13,7 @@ } ], "player" : { - "pilot" : "Eliza Gaskin", + "pilot" : "1st Lt. Eliza Gaskin", "squadron" : "The ABCs", "type" : "Firefly", "side" : "SIDE_ALLIES" diff --git a/data/missions/warro/02 - evacuation #2.json b/data/missions/warro/02 - evacuation #2.json index 75e6e6a..bc19792 100644 --- a/data/missions/warro/02 - evacuation #2.json +++ b/data/missions/warro/02 - evacuation #2.json @@ -21,7 +21,7 @@ } ], "player" : { - "pilot" : "Eliza Gaskin", + "pilot" : "1st Lt. Eliza Gaskin", "squadron" : "The ABCs", "type" : "Firefly", "side" : "SIDE_ALLIES" @@ -109,19 +109,19 @@ { "function" : "TIME 60", "lines" : [ - "ACTIVATE_ENTITY_GROUP Pandoran-1" + "ACTIVATE_ENTITY_GROUPS Pandoran-1" ] }, { "function" : "TIME 120", "lines" : [ - "ACTIVATE_ENTITY_GROUP Pandoran-2" + "ACTIVATE_ENTITY_GROUPS Pandoran-2" ] }, { "function" : "TIME 180", "lines" : [ - "ACTIVATE_ENTITY_GROUP Pandoran-3" + "ACTIVATE_ENTITY_GROUPS Pandoran-3" ] } ] diff --git a/data/missions/warro/03 - evacuation #3.json b/data/missions/warro/03 - evacuation #3.json index be75f26..f0b3749 100644 --- a/data/missions/warro/03 - evacuation #3.json +++ b/data/missions/warro/03 - evacuation #3.json @@ -21,7 +21,7 @@ } ], "player" : { - "pilot" : "Preston Palmer", + "pilot" : "2nd Lt. Preston Palmer", "squadron" : "S&R", "type" : "Tug", "side" : "SIDE_ALLIES" diff --git a/src/battle/entities.c b/src/battle/entities.c index a1a04a8..3209998 100644 --- a/src/battle/entities.c +++ b/src/battle/entities.c @@ -293,16 +293,24 @@ void activateEntities(char *name) } } -void activateEntityGroup(char *groupName) +void activateEntityGroups(char *groupNames) { Entity *e; + char *groupName; - for (e = battle.entityHead.next ; e != NULL ; e = e->next) + groupName = strtok(groupNames, ";"); + + while (groupName) { - if (strcmp(e->groupName, groupName) == 0) + for (e = battle.entityHead.next ; e != NULL ; e = e->next) { - e->active = 1; + if (strcmp(e->groupName, groupName) == 0) + { + e->active = 1; + } } + + groupName = strtok(NULL, ";"); } } diff --git a/src/battle/objectives.c b/src/battle/objectives.c index a069959..ac8c7dc 100644 --- a/src/battle/objectives.c +++ b/src/battle/objectives.c @@ -106,6 +106,8 @@ void updateObjective(char *name, int type) { o->status = OS_COMPLETE; addHudMessage(colors.green, "%s - Objective Complete!", o->description); + + runScriptFunction("OBJECTIVES_COMPLETE %d", battle.numObjectivesComplete + 1); } } } @@ -177,20 +179,30 @@ void failIncompleteObjectives(void) } } -void activateObjective(int num) +void activateObjectives(char *objectives) { - int i = 0; + char *token; + int i, num; Objective *o; - for (o = battle.objectiveHead.next ; o != NULL ; o = o->next) + token = strtok(objectives, ";"); + + while (token) { - if (i == num) + i = 0; + num = atoi(token); + + for (o = battle.objectiveHead.next ; o != NULL ; o = o->next) { - addHudMessage(colors.cyan, "New Objective : %s", o->description); - o->active = 1; - return; + if (i == num) + { + addHudMessage(colors.cyan, "New Objective : %s", o->description); + o->active = 1; + } + + i++; } - i++; + token = strtok(NULL, ";"); } } diff --git a/src/battle/objectives.h b/src/battle/objectives.h index f18dfc5..1d9eb75 100644 --- a/src/battle/objectives.h +++ b/src/battle/objectives.h @@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern void updateChallenges(void); extern void addHudMessage(SDL_Color c, char *format, ...); +extern void runScriptFunction(char *format, ...); extern void completeMission(void); extern void failMission(void); diff --git a/src/battle/script.c b/src/battle/script.c index 6425c31..a2a9e52 100644 --- a/src/battle/script.c +++ b/src/battle/script.c @@ -121,20 +121,20 @@ static void executeNextLine(ScriptRunner *runner) sscanf(line, "%s", command); - if (strcmp(command, "ACTIVATE_ENTITY") == 0) + if (strcmp(command, "ACTIVATE_ENTITIES") == 0) { sscanf(line, "%*s %[^\n]", strParam[0]); activateEntities(strParam[0]); } - else if (strcmp(command, "ACTIVATE_ENTITY_GROUP") == 0) + else if (strcmp(command, "ACTIVATE_ENTITY_GROUPS") == 0) { sscanf(line, "%*s %[^\n]", strParam[0]); - activateEntityGroup(strParam[0]); + activateEntityGroups(strParam[0]); } - else if (strcmp(command, "ACTIVATE_OBJECTIVE") == 0) + else if (strcmp(command, "ACTIVATE_OBJECTIVES") == 0) { - sscanf(line, "%*s %d", &intParam[0]); - activateObjective(intParam[0]); + sscanf(line, "%*s %s", strParam[0]); + activateObjectives(strParam[0]); } else if (strcmp(command, "MSG_BOX") == 0) { diff --git a/src/battle/script.h b/src/battle/script.h index 6d6496e..2c62e35 100644 --- a/src/battle/script.h +++ b/src/battle/script.h @@ -31,8 +31,8 @@ extern void retreatAllies(void); extern void addHudMessage(SDL_Color c, char *format, ...); extern void addMessageBox(char *title, char *format, ...); extern void activateEntities(char *name); -extern void activateEntityGroup(char *groupName); -extern void activateObjective(int num); +extern void activateEntityGroups(char *groupName); +void activateObjectives(char *objectives); extern int showingMessageBoxes(void); extern Battle battle;