diff --git a/data/missions/coyote/03 - coyote assault #3.json b/data/missions/coyote/03 - coyote assault #3.json index c53056c..15abeb9 100644 --- a/data/missions/coyote/03 - coyote assault #3.json +++ b/data/missions/coyote/03 - coyote assault #3.json @@ -74,7 +74,7 @@ "type" : "ET_JUMPGATE", "x" : 25, "y" : 25, - "active" : 0 + "sleeping" : 1 } ], "script" : [ @@ -99,7 +99,7 @@ "MSG_BOX Dodds;Estelle, we've got this. We can take them.", "MSG_BOX de Winter;We're taking too many losses, Dodds. Fall back now, that's an order.", "WAIT_MSG_BOX", - "ACTIVATE_ENTITIES Jumpgate", + "ACTIVATE_JUMPGATE", "RETREAT_ALLIES" ] } diff --git a/data/missions/granada/02 - suspect packages #2.json b/data/missions/granada/02 - suspect packages #2.json index 264f2e9..563f44f 100644 --- a/data/missions/granada/02 - suspect packages #2.json +++ b/data/missions/granada/02 - suspect packages #2.json @@ -110,7 +110,7 @@ "type" : "ET_JUMPGATE", "x" : 10, "y" : 8, - "active" : 0 + "sleeping" : 1 } ], "items" : [ @@ -153,7 +153,7 @@ "WAIT 2", "MSG_BOX Tug;Tow cable attached. Ready to head home.", "MSG_BOX Carr;We're done here. Let's bring our mystery guest in.", - "ACTIVATE_ENTITIES Jumpgate", + "ACTIVATE_JUMPGATE", "WAIT 20", "ACTIVATE_ENTITIES Dart", "ACTIVATE_OBJECTIVES Destroy intercepting Darts", diff --git a/src/battle/entities.c b/src/battle/entities.c index 54c4b1b..d4ec9a6 100644 --- a/src/battle/entities.c +++ b/src/battle/entities.c @@ -139,7 +139,7 @@ void doEntities(void) break; } - if (e->alive == ALIVE_ALIVE || e->alive == ALIVE_DYING) + if (e->alive == ALIVE_ALIVE || e->alive == ALIVE_DYING || e->alive == ALIVE_SLEEPING) { if (e->action != NULL) { @@ -391,7 +391,7 @@ void drawEntities(void) static void drawEntity(Entity *e) { - if (e->type == ET_JUMPGATE) + if (e->type == ET_JUMPGATE && e->alive == ALIVE_ALIVE) { blitRotated(jumpPortal, e->x - battle.camera.x, e->y - battle.camera.y, jumpPortAngle); } diff --git a/src/battle/jumpgate.c b/src/battle/jumpgate.c index afd5558..5771bc1 100644 --- a/src/battle/jumpgate.c +++ b/src/battle/jumpgate.c @@ -47,7 +47,10 @@ static void think(void) self->angle -= 360; } - handleFleeingEntities(); + if (self->alive == ALIVE_ALIVE) + { + handleFleeingEntities(); + } battle.jumpgate = self; } diff --git a/src/battle/script.c b/src/battle/script.c index 96af2f8..e80854b 100644 --- a/src/battle/script.c +++ b/src/battle/script.c @@ -141,6 +141,10 @@ static void executeNextLine(ScriptRunner *runner) sscanf(line, "%*s %[^\n]", strParam[0]); activateLocations(strParam[0]); } + else if (strcmp(command, "ACTIVATE_JUMPGATE") == 0) + { + battle.jumpgate->alive = ALIVE_ALIVE; + } else if (strcmp(command, "MSG_BOX") == 0) { sscanf(line, "%*s %255[^;]%*c%255[^\n]", strParam[0], strParam[1]); diff --git a/src/defs.h b/src/defs.h index 17ff32a..229258b 100644 --- a/src/defs.h +++ b/src/defs.h @@ -165,7 +165,8 @@ enum ALIVE_ALIVE, ALIVE_DYING, ALIVE_DEAD, - ALIVE_ESCAPED + ALIVE_ESCAPED, + ALIVE_SLEEPING /* used by jumpgate */ }; enum diff --git a/src/galaxy/mission.c b/src/galaxy/mission.c index 08e73af..99899df 100644 --- a/src/galaxy/mission.c +++ b/src/galaxy/mission.c @@ -565,7 +565,7 @@ static void loadEntities(cJSON *node) { Entity *e; char *name, *groupName; - int i, type, scatter, number, active; + int i, type, scatter, number, active, sleeping; float x, y; if (node) @@ -586,6 +586,7 @@ static void loadEntities(cJSON *node) number = getJSONValue(node, "number", 1); active = getJSONValue(node, "active", 1); scatter = getJSONValue(node, "scatter", 1); + sleeping = getJSONValue(node, "sleeping", 0); for (i = 0 ; i < number ; i++) { @@ -625,6 +626,11 @@ static void loadEntities(cJSON *node) } e->active = active; + + if (sleeping) + { + e->alive = ALIVE_SLEEPING; + } SDL_QueryTexture(e->texture, NULL, NULL, &e->w, &e->h); }