Warn about entities that are stuck in walls at start of level.

This commit is contained in:
Steve 2018-03-07 21:38:18 +00:00
parent e577d7e16f
commit 34df6121dd
1 changed files with 26 additions and 0 deletions

View File

@ -36,6 +36,7 @@ static int hasHitWorld(int mx, int my);
static void compareEnvironments(void); static void compareEnvironments(void);
static int getMarkerType(void); static int getMarkerType(void);
static int drawComparator(const void *a, const void *b); static int drawComparator(const void *a, const void *b);
static void checkStuckInWall(void);
static Entity *riders[MAX_RIDERS]; static Entity *riders[MAX_RIDERS];
static Entity *touched[MAX_TOUCHED]; static Entity *touched[MAX_TOUCHED];
@ -70,6 +71,8 @@ void initEntities(void)
} }
addToQuadtree(self, &world.quadtree); addToQuadtree(self, &world.quadtree);
checkStuckInWall();
} }
} }
@ -446,6 +449,29 @@ static void moveEntity(void)
} }
} }
static void checkStuckInWall(void)
{
int mx, my;
switch (self->type)
{
case ET_PRESSURE_PLATE:
case ET_TELEPORTER:
case ET_DOOR:
break;
default:
mx = self->x / MAP_TILE_SIZE;
my = self->y / MAP_TILE_SIZE;
if (hasHitWorld(mx, my))
{
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "%s (%d): in wall at %d,%d", self->name, self->type, mx, my);
}
break;
}
}
static void haltAtEdge(void) static void haltAtEdge(void)
{ {
float x, y; float x, y;