Use EF_DISABLED for jumpgates, rather than systemPower.
This commit is contained in:
parent
5d38abcbeb
commit
71b0a00689
|
@ -74,7 +74,7 @@
|
||||||
"type" : "ET_JUMPGATE",
|
"type" : "ET_JUMPGATE",
|
||||||
"x" : 25,
|
"x" : 25,
|
||||||
"y" : 25,
|
"y" : 25,
|
||||||
"systemPower" : 0
|
"flags" : "+EF_DISABLED"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"script" : [
|
"script" : [
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
"MSG_BOX Dodds;Estelle, we've got this. We can take them.",
|
"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.",
|
"MSG_BOX de Winter;We're taking too many losses, Dodds. Fall back now, that's an order.",
|
||||||
"WAIT_MSG_BOX",
|
"WAIT_MSG_BOX",
|
||||||
"ACTIVATE_JUMPGATE",
|
"ACTIVATE_JUMPGATE 1",
|
||||||
"RETREAT_ALLIES"
|
"RETREAT_ALLIES"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@
|
||||||
"type" : "ET_JUMPGATE",
|
"type" : "ET_JUMPGATE",
|
||||||
"x" : 10,
|
"x" : 10,
|
||||||
"y" : 8,
|
"y" : 8,
|
||||||
"systemPower" : 0
|
"flags" : "+EF_DISABLED"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"items" : [
|
"items" : [
|
||||||
|
@ -159,7 +159,7 @@
|
||||||
"WAIT 2",
|
"WAIT 2",
|
||||||
"MSG_BOX Tug;Tow cable attached. Ready to head home.",
|
"MSG_BOX Tug;Tow cable attached. Ready to head home.",
|
||||||
"MSG_BOX Carr;We're done here. Let's bring our mystery guest in.",
|
"MSG_BOX Carr;We're done here. Let's bring our mystery guest in.",
|
||||||
"ACTIVATE_JUMPGATE",
|
"ACTIVATE_JUMPGATE 1",
|
||||||
"WAIT 20",
|
"WAIT 20",
|
||||||
"ACTIVATE_ENTITIES Dart",
|
"ACTIVATE_ENTITIES Dart",
|
||||||
"ACTIVATE_OBJECTIVES Destroy intercepting Darts",
|
"ACTIVATE_OBJECTIVES Destroy intercepting Darts",
|
||||||
|
|
|
@ -101,7 +101,7 @@
|
||||||
"type" : "ET_JUMPGATE",
|
"type" : "ET_JUMPGATE",
|
||||||
"x" : 30,
|
"x" : 30,
|
||||||
"y" : 1,
|
"y" : 1,
|
||||||
"systemPower" : 0
|
"flags" : "+EF_DISABLED"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"script" : [
|
"script" : [
|
||||||
|
@ -146,7 +146,7 @@
|
||||||
"MSG_BOX Control;Commander, your current missions has been aborted. Return to the jumpgate. We need a full report as to what just happened out there.",
|
"MSG_BOX Control;Commander, your current missions has been aborted. Return to the jumpgate. We need a full report as to what just happened out there.",
|
||||||
"MSG_BOX Spencer;Got it, coming home.",
|
"MSG_BOX Spencer;Got it, coming home.",
|
||||||
"WAIT_MSG_BOX",
|
"WAIT_MSG_BOX",
|
||||||
"ACTIVATE_JUMPGATE",
|
"ACTIVATE_JUMPGATE 1",
|
||||||
"ACTIVATE_OBJECTIVES Retreat to jumpgate",
|
"ACTIVATE_OBJECTIVES Retreat to jumpgate",
|
||||||
"RETREAT_ALLIES"
|
"RETREAT_ALLIES"
|
||||||
]
|
]
|
||||||
|
|
|
@ -330,7 +330,7 @@ static void drawPlayerTargeter(void)
|
||||||
float angle;
|
float angle;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
if (player->target || battle.missionTarget || (battle.jumpgate && battle.jumpgate->systemPower))
|
if (player->target || battle.missionTarget || jumpgateEnabled())
|
||||||
{
|
{
|
||||||
if (player->target)
|
if (player->target)
|
||||||
{
|
{
|
||||||
|
@ -376,7 +376,7 @@ static void drawPlayerTargeter(void)
|
||||||
blitRotated(targetPointer, x - battle.camera.x, y - battle.camera.y, angle);
|
blitRotated(targetPointer, x - battle.camera.x, y - battle.camera.y, angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (battle.jumpgate && battle.jumpgate->systemPower)
|
if (jumpgateEnabled())
|
||||||
{
|
{
|
||||||
angle = getAngle(player->x, player->y, battle.jumpgate->x, battle.jumpgate->y);
|
angle = getAngle(player->x, player->y, battle.jumpgate->x, battle.jumpgate->y);
|
||||||
x = player->x;
|
x = player->x;
|
||||||
|
@ -478,7 +478,7 @@ static void drawDistancesInfo(void)
|
||||||
y += 25;
|
y += 25;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (battle.jumpgate && battle.jumpgate->systemPower)
|
if (jumpgateEnabled())
|
||||||
{
|
{
|
||||||
distance = distanceToKM(player->x, player->y, battle.jumpgate->x, battle.jumpgate->y);
|
distance = distanceToKM(player->x, player->y, battle.jumpgate->x, battle.jumpgate->y);
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ extern int getPercent(float current, float total);
|
||||||
extern int playerHasGun(int type);
|
extern int playerHasGun(int type);
|
||||||
extern char *getTranslatedString(char *string);
|
extern char *getTranslatedString(char *string);
|
||||||
extern char *timeToString(long millis, int showHours);
|
extern char *timeToString(long millis, int showHours);
|
||||||
|
extern int jumpgateEnabled(void);
|
||||||
|
|
||||||
extern App app;
|
extern App app;
|
||||||
extern Battle battle;
|
extern Battle battle;
|
||||||
|
|
|
@ -45,6 +45,26 @@ Entity *spawnJumpgate(void)
|
||||||
return jumpgate;
|
return jumpgate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int jumpgateEnabled(void)
|
||||||
|
{
|
||||||
|
return (battle.jumpgate && (!(battle.jumpgate->flags & EF_DISABLED)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void activateJumpgate(int activate)
|
||||||
|
{
|
||||||
|
if (battle.jumpgate)
|
||||||
|
{
|
||||||
|
if (activate)
|
||||||
|
{
|
||||||
|
battle.jumpgate->flags &= ~EF_DISABLED;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
battle.jumpgate->flags |= EF_DISABLED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void think(void)
|
static void think(void)
|
||||||
{
|
{
|
||||||
self->thinkTime = 4;
|
self->thinkTime = 4;
|
||||||
|
@ -55,7 +75,7 @@ static void think(void)
|
||||||
self->angle -= 360;
|
self->angle -= 360;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->systemPower)
|
if (jumpgateEnabled())
|
||||||
{
|
{
|
||||||
handleFleeingEntities();
|
handleFleeingEntities();
|
||||||
}
|
}
|
||||||
|
@ -128,7 +148,7 @@ static void addEscapeEffect(Entity *ent)
|
||||||
|
|
||||||
static void draw(void)
|
static void draw(void)
|
||||||
{
|
{
|
||||||
if (self->systemPower)
|
if (jumpgateEnabled())
|
||||||
{
|
{
|
||||||
blitRotated(portal, self->x - battle.camera.x, self->y - battle.camera.y, portalAngle);
|
blitRotated(portal, self->x - battle.camera.x, self->y - battle.camera.y, portalAngle);
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,7 +211,8 @@ static void executeNextLine(ScriptRunner *runner)
|
||||||
}
|
}
|
||||||
else if (strcmp(command, "ACTIVATE_JUMPGATE") == 0)
|
else if (strcmp(command, "ACTIVATE_JUMPGATE") == 0)
|
||||||
{
|
{
|
||||||
battle.jumpgate->systemPower = MAX_SYSTEM_POWER;
|
sscanf(line, "%*s %d", &intParam[0]);
|
||||||
|
activateJumpgate(intParam[0]);
|
||||||
}
|
}
|
||||||
else if (strcmp(command, "ACTIVATE_NEXT_WAYPOINT") == 0)
|
else if (strcmp(command, "ACTIVATE_NEXT_WAYPOINT") == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,6 +36,7 @@ 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 void activateNextWaypoint(int id);
|
||||||
|
extern void activateJumpgate(int activate);
|
||||||
|
|
||||||
extern Battle battle;
|
extern Battle battle;
|
||||||
extern Colors colors;
|
extern Colors colors;
|
||||||
|
|
|
@ -374,7 +374,7 @@ static void loadFighters(cJSON *node)
|
||||||
Entity *e;
|
Entity *e;
|
||||||
char **types, *name, *groupName, *type;
|
char **types, *name, *groupName, *type;
|
||||||
int side, scatter, number, active;
|
int side, scatter, number, active;
|
||||||
int i, numTypes, addFlags, addAIFlags, systemPower;
|
int i, numTypes, addFlags, addAIFlags;
|
||||||
long flags, aiFlags;
|
long flags, aiFlags;
|
||||||
float x, y;
|
float x, y;
|
||||||
|
|
||||||
|
@ -398,7 +398,6 @@ static void loadFighters(cJSON *node)
|
||||||
number = getJSONValue(node, "number", 1);
|
number = getJSONValue(node, "number", 1);
|
||||||
scatter = getJSONValue(node, "scatter", 1);
|
scatter = getJSONValue(node, "scatter", 1);
|
||||||
active = getJSONValue(node, "active", 1);
|
active = getJSONValue(node, "active", 1);
|
||||||
systemPower = getJSONValue(node, "systemPower", MAX_SYSTEM_POWER);
|
|
||||||
|
|
||||||
if (cJSON_GetObjectItem(node, "flags"))
|
if (cJSON_GetObjectItem(node, "flags"))
|
||||||
{
|
{
|
||||||
|
@ -461,12 +460,6 @@ static void loadFighters(cJSON *node)
|
||||||
{
|
{
|
||||||
STRNCPY(e->groupName, groupName, MAX_NAME_LENGTH);
|
STRNCPY(e->groupName, groupName, MAX_NAME_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
e->systemPower = systemPower;
|
|
||||||
if (!e->systemPower)
|
|
||||||
{
|
|
||||||
e->flags |= EF_DISABLED;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
node = node->next;
|
node = node->next;
|
||||||
|
@ -572,8 +565,9 @@ static void loadEntities(cJSON *node)
|
||||||
{
|
{
|
||||||
Entity *e;
|
Entity *e;
|
||||||
char *name, *groupName;
|
char *name, *groupName;
|
||||||
int i, type, scatter, number, active, systemPower;
|
int i, type, scatter, number, active, addFlags;
|
||||||
float x, y;
|
float x, y;
|
||||||
|
long flags;
|
||||||
|
|
||||||
if (node)
|
if (node)
|
||||||
{
|
{
|
||||||
|
@ -593,7 +587,11 @@ static void loadEntities(cJSON *node)
|
||||||
number = getJSONValue(node, "number", 1);
|
number = getJSONValue(node, "number", 1);
|
||||||
active = getJSONValue(node, "active", 1);
|
active = getJSONValue(node, "active", 1);
|
||||||
scatter = getJSONValue(node, "scatter", 1);
|
scatter = getJSONValue(node, "scatter", 1);
|
||||||
systemPower = getJSONValue(node, "systemPower", MAX_SYSTEM_POWER);
|
|
||||||
|
if (cJSON_GetObjectItem(node, "flags"))
|
||||||
|
{
|
||||||
|
flags = flagsToLong(cJSON_GetObjectItem(node, "flags")->valuestring, &addFlags);
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0 ; i < number ; i++)
|
for (i = 0 ; i < number ; i++)
|
||||||
{
|
{
|
||||||
|
@ -622,6 +620,20 @@ static void loadEntities(cJSON *node)
|
||||||
{
|
{
|
||||||
STRNCPY(e->groupName, groupName, MAX_NAME_LENGTH);
|
STRNCPY(e->groupName, groupName, MAX_NAME_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (flags != -1)
|
||||||
|
{
|
||||||
|
if (addFlags)
|
||||||
|
{
|
||||||
|
e->flags |= flags;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e->flags = flags;
|
||||||
|
|
||||||
|
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "Flags for '%s' (%s) replaced", e->name, e->defName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
e->x = x;
|
e->x = x;
|
||||||
e->y = y;
|
e->y = y;
|
||||||
|
@ -634,8 +646,6 @@ static void loadEntities(cJSON *node)
|
||||||
|
|
||||||
e->active = active;
|
e->active = active;
|
||||||
|
|
||||||
e->systemPower = systemPower;
|
|
||||||
|
|
||||||
SDL_QueryTexture(e->texture, NULL, NULL, &e->w, &e->h);
|
SDL_QueryTexture(e->texture, NULL, NULL, &e->w, &e->h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue