Jumpgate state fix.

This commit is contained in:
Steve 2016-04-17 11:52:48 +01:00
parent c175ccb35f
commit c215dc75d3
2 changed files with 24 additions and 17 deletions

View File

@ -66,7 +66,7 @@
"type" : "ET_JUMPGATE", "type" : "ET_JUMPGATE",
"x" : 48, "x" : 48,
"y" : 48, "y" : 48,
"active" : 0 "flags" : "+EF_DISABLED"
} }
], ],
"spawners" : [ "spawners" : [
@ -93,7 +93,7 @@
{ {
"function" : "ENEMIES_KILLED 80", "function" : "ENEMIES_KILLED 80",
"lines" : [ "lines" : [
"MSG_BOX UNF Hopper;We're picking up a lot of chatter on the mercenaries' channels. They're not happy how things are going.", "MSG_BOX UNF Hopper;We're picking up a lot of chatter on the mercenaries' channels. They're not happy with how things are going.",
"MSG_BOX Wing Commander;Then let's concentrate on making them even more unhappy." "MSG_BOX Wing Commander;Then let's concentrate on making them even more unhappy."
] ]
}, },

View File

@ -32,8 +32,15 @@ static float portalAngle;
Entity *spawnJumpgate(int side, long flags) Entity *spawnJumpgate(int side, long flags)
{ {
Entity *jumpgate = spawnEntity(); Entity *jumpgate;
if (battle.jumpgate)
{
printf("ERROR: Only one jumpgate is allowed\n");
exit(1);
}
jumpgate = spawnEntity();
jumpgate->type = ET_JUMPGATE; jumpgate->type = ET_JUMPGATE;
jumpgate->health = jumpgate->maxHealth = 1; jumpgate->health = jumpgate->maxHealth = 1;
jumpgate->texture = getTexture("gfx/entities/jumpgate.png"); jumpgate->texture = getTexture("gfx/entities/jumpgate.png");
@ -41,6 +48,10 @@ Entity *spawnJumpgate(int side, long flags)
jumpgate->draw = draw; jumpgate->draw = draw;
jumpgate->side = side; jumpgate->side = side;
jumpgate->flags = EF_NO_MT_BOX+EF_IMMORTAL+EF_AI_IGNORE; jumpgate->flags = EF_NO_MT_BOX+EF_IMMORTAL+EF_AI_IGNORE;
if (flags & EF_DISABLED)
{
jumpgate->flags |= EF_DISABLED;
}
addNodes(jumpgate, flags); addNodes(jumpgate, flags);
@ -49,6 +60,8 @@ Entity *spawnJumpgate(int side, long flags)
SDL_QueryTexture(jumpgate->texture, NULL, NULL, &jumpgate->w, &jumpgate->h); SDL_QueryTexture(jumpgate->texture, NULL, NULL, &jumpgate->w, &jumpgate->h);
battle.jumpgate = jumpgate;
return jumpgate; return jumpgate;
} }
@ -129,6 +142,7 @@ static void think(void)
self->thinkTime = 4; self->thinkTime = 4;
self->angle += 0.1; self->angle += 0.1;
if (self->angle >= 360) if (self->angle >= 360)
{ {
self->angle -= 360; self->angle -= 360;
@ -139,20 +153,13 @@ static void think(void)
handleFleeingEntities(); handleFleeingEntities();
} }
if (!battle.jumpgate)
{
battle.jumpgate = self;
}
if (battle.jumpgate == self)
{
portalAngle += 2; portalAngle += 2;
if (portalAngle >= 360) if (portalAngle >= 360)
{ {
portalAngle -= 360; portalAngle -= 360;
} }
} }
}
static void handleFleeingEntities(void) static void handleFleeingEntities(void)
{ {