Don't make fighters appear onscreen when being spawned during epic battles.

This commit is contained in:
Steve 2016-04-26 10:52:47 +01:00
parent a0170c74c0
commit 262eefec6e
2 changed files with 12 additions and 0 deletions

View File

@ -569,6 +569,17 @@ static void activateEpicFighters(int side)
if (!e->active && e->type == ET_FIGHTER && !(e->flags & EF_NO_EPIC) && ((side == SIDE_ALLIES && e->side == SIDE_ALLIES) || (side != SIDE_ALLIES && e->side != SIDE_ALLIES)))
{
e->active = 1;
/* don't spring into existence in front of the player */
if (isOnBattleScreen(e->x, e->y, e->w, e->h))
{
e->x = player->x;
e->y = player->y;
e->x += (rand() % 2) ? -SCREEN_WIDTH : SCREEN_WIDTH;
e->y += (rand() % 2) ? -SCREEN_HEIGHT : SCREEN_HEIGHT;
}
return;
}
}

View File

@ -35,6 +35,7 @@ extern void removeFromQuadtree(Entity *e, Quadtree *root);
extern void addToQuadtree(Entity *e, Quadtree *root);
extern void updateCapitalShipComponentProperties(Entity *parent, long flags);
extern Entity **getAllEntsWithin(int x, int y, int w, int h, Entity *ignore);
extern int isOnBattleScreen(int x, int y, int w, int h);
extern App app;
extern Battle battle;