diff --git a/src/world/entities.c b/src/world/entities.c index 3f7d8e7..3279ad7 100644 --- a/src/world/entities.c +++ b/src/world/entities.c @@ -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) { int x, y, draw, i, t; diff --git a/src/world/world.c b/src/world/world.c index 5b0734e..1f04fa0 100644 --- a/src/world/world.c +++ b/src/world/world.c @@ -353,6 +353,8 @@ static void doWorldObserving(void) cameraTrack(world.entityToTrack); + doEntitiesStatic(); + if (--world.observationTimer == 0) { if (++observationIndex < MAX_ENTS_TO_OBSERVE && world.entitiesToObserve[observationIndex] != NULL) diff --git a/src/world/world.h b/src/world/world.h index 3a2f220..29124f7 100644 --- a/src/world/world.h +++ b/src/world/world.h @@ -42,6 +42,7 @@ extern int isSolid(int x, int y); extern int isLiquid(int x, int y); extern int isWalkable(int x, int y); extern void doEntities(void); +extern void doEntitiesStatic(void); extern void doParticles(void); extern void doHud(void); extern Entity *createEntity(char *typeStr);