Allow jumpgate to be put into "sleep" state: effectively inactive.

This commit is contained in:
Steve 2016-03-08 06:55:41 +00:00
parent a74ff87a46
commit 99013a4e99
7 changed files with 23 additions and 9 deletions

View File

@ -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"
]
}

View File

@ -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",

View File

@ -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);
}

View File

@ -47,7 +47,10 @@ static void think(void)
self->angle -= 360;
}
handleFleeingEntities();
if (self->alive == ALIVE_ALIVE)
{
handleFleeingEntities();
}
battle.jumpgate = self;
}

View File

@ -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]);

View File

@ -165,7 +165,8 @@ enum
ALIVE_ALIVE,
ALIVE_DYING,
ALIVE_DEAD,
ALIVE_ESCAPED
ALIVE_ESCAPED,
ALIVE_SLEEPING /* used by jumpgate */
};
enum

View File

@ -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);
}