Control waypoints from script.

This commit is contained in:
Steve 2016-03-12 12:09:42 +00:00
parent 4f19dcb9a5
commit ae6e2ede09
9 changed files with 38 additions and 4 deletions

View File

@ -8,7 +8,7 @@
"manualComplete" : 1, "manualComplete" : 1,
"objectives" : [ "objectives" : [
{ {
"description" : "Check all wayponts", "description" : "Check all waypoints",
"targetName" : "Waypoint", "targetName" : "Waypoint",
"targetValue" : 5, "targetValue" : 5,
"targetType" : "TT_WAYPOINT" "targetType" : "TT_WAYPOINT"
@ -42,6 +42,12 @@
} }
], ],
"script" : [ "script" : [
{
"function" : "TIME 0",
"lines" : [
"ACTIVATE_NEXT_WAYPOINT"
]
}
{ {
"function" : "Waypoint #2", "function" : "Waypoint #2",
"lines" : [ "lines" : [

View File

@ -59,6 +59,12 @@
} }
], ],
"script" : [ "script" : [
{
"function" : "TIME 0",
"lines" : [
"ACTIVATE_NEXT_WAYPOINT"
]
},
{ {
"function" : "Waypoint #3", "function" : "Waypoint #3",
"lines" : [ "lines" : [

View File

@ -45,6 +45,12 @@
} }
], ],
"script" : [ "script" : [
{
"function" : "TIME 0",
"lines" : [
"ACTIVATE_NEXT_WAYPOINT"
]
},
{ {
"function" : "TIME 3", "function" : "TIME 3",
"lines" : [ "lines" : [

View File

@ -126,6 +126,12 @@
} }
], ],
"script" : [ "script" : [
{
"function" : "TIME 0",
"lines" : [
"ACTIVATE_NEXT_WAYPOINT"
]
},
{ {
"function" : "Waypoint #2", "function" : "Waypoint #2",
"lines" : [ "lines" : [

View File

@ -126,6 +126,12 @@
} }
], ],
"script" : [ "script" : [
{
"function" : "TIME 0",
"lines" : [
"ACTIVATE_NEXT_WAYPOINT"
]
},
{ {
"function" : "Waypoint #1", "function" : "Waypoint #1",
"lines" : [ "lines" : [

View File

@ -213,6 +213,10 @@ static void executeNextLine(ScriptRunner *runner)
{ {
battle.jumpgate->systemPower = MAX_SYSTEM_POWER; battle.jumpgate->systemPower = MAX_SYSTEM_POWER;
} }
else if (strcmp(command, "ACTIVATE_NEXT_WAYPOINT") == 0)
{
activateNextWaypoint(0);
}
else if (strcmp(command, "MSG_BOX") == 0) else if (strcmp(command, "MSG_BOX") == 0)
{ {
sscanf(line, "%*s %255[^;]%*c%255[^\n]", strParam[0], strParam[1]); sscanf(line, "%*s %255[^;]%*c%255[^\n]", strParam[0], strParam[1]);
@ -273,6 +277,8 @@ void destroyScript(void)
if (scriptJSON) if (scriptJSON)
{ {
cJSON_Delete(scriptJSON); cJSON_Delete(scriptJSON);
scriptJSON = NULL;
} }
while (head.next) while (head.next)

View File

@ -35,6 +35,7 @@ void activateObjectives(char *objectives);
extern int showingMessageBoxes(void); extern int showingMessageBoxes(void);
extern char *getTranslatedString(char *string); extern char *getTranslatedString(char *string);
extern void spawnScriptFighter(char *fighters, char *side, int num, char *location); extern void spawnScriptFighter(char *fighters, char *side, int num, char *location);
extern void activateNextWaypoint(int id);
extern Battle battle; extern Battle battle;
extern Colors colors; extern Colors colors;

View File

@ -216,8 +216,6 @@ void loadMission(char *filename)
battle.status = MS_IN_PROGRESS; battle.status = MS_IN_PROGRESS;
} }
activateNextWaypoint();
countNumEnemies(); countNumEnemies();
initPlayer(); initPlayer();

View File

@ -35,7 +35,6 @@ extern void stopMusic(void);
extern void initPlayer(void); extern void initPlayer(void);
extern long flagsToLong(char *flags, int *add); extern long flagsToLong(char *flags, int *add);
extern Entity *spawnWaypoint(void); extern Entity *spawnWaypoint(void);
extern void activateNextWaypoint(void);
extern void selectWidget(const char *name, const char *group); extern void selectWidget(const char *name, const char *group);
extern Entity *spawnJumpgate(void); extern Entity *spawnJumpgate(void);
extern Entity *spawnItem(char *type); extern Entity *spawnItem(char *type);