Ensure we draw entities when in observing mode.

This commit is contained in:
Steve 2018-02-18 17:01:38 +00:00
parent 17cb8bdc84
commit bea993ece0
3 changed files with 19 additions and 0 deletions

View File

@ -260,6 +260,22 @@ void doEntities(void)
} }
} }
void doEntitiesStatic(void)
{
int camMidX, camMidY;
camMidX = camera.x + (SCREEN_WIDTH / 2);
camMidY = camera.y + (SCREEN_HEIGHT / 2);
for (self = world.entityHead.next ; self != NULL ; self = self->next)
{
if (getDistance(camMidX, camMidY, self->x, self->y) < SCREEN_WIDTH || isObserving())
{
self->isVisible = 1;
}
}
}
void drawEntities(int plane) void drawEntities(int plane)
{ {
int x, y, draw, i, t; int x, y, draw, i, t;

View File

@ -353,6 +353,8 @@ static void doWorldObserving(void)
cameraTrack(world.entityToTrack); cameraTrack(world.entityToTrack);
doEntitiesStatic();
if (--world.observationTimer == 0) if (--world.observationTimer == 0)
{ {
if (++observationIndex < MAX_ENTS_TO_OBSERVE && world.entitiesToObserve[observationIndex] != NULL) if (++observationIndex < MAX_ENTS_TO_OBSERVE && world.entitiesToObserve[observationIndex] != NULL)

View File

@ -42,6 +42,7 @@ extern int isSolid(int x, int y);
extern int isLiquid(int x, int y); extern int isLiquid(int x, int y);
extern int isWalkable(int x, int y); extern int isWalkable(int x, int y);
extern void doEntities(void); extern void doEntities(void);
extern void doEntitiesStatic(void);
extern void doParticles(void); extern void doParticles(void);
extern void doHud(void); extern void doHud(void);
extern Entity *createEntity(char *typeStr); extern Entity *createEntity(char *typeStr);