Tile under foot
This commit is contained in:
@@ -75,16 +75,16 @@ void entityWalk(entity_t *entity, const entitydir_t direction) {
|
||||
newPos.y += relY;
|
||||
}
|
||||
|
||||
// TODO: Tile in way?
|
||||
// Get tile under foot
|
||||
chunkpos_t chunkPos;
|
||||
worldPosToChunkPos(&newPos, &chunkPos);
|
||||
chunkindex_t chunkIndex = mapGetChunkIndexAt(chunkPos);
|
||||
tile_t tile = TILE_NULL;
|
||||
if(chunkIndex != -1) {
|
||||
chunk_t *chunk = mapGetChunkByIndex((uint8_t)chunkIndex);
|
||||
assertNotbNull(chunk, "Chunk pointer cannot be NULL");
|
||||
chunkGetTile
|
||||
} else {
|
||||
return;// Out of bounds
|
||||
chunk_t *chunk = mapGetChunk(chunkIndex);
|
||||
assertNotNull(chunk, "Chunk pointer cannot be NULL");
|
||||
chunktileindex_t tileIndex = woprldPosToChunkTileIndex(&newPos);
|
||||
tile = chunk->tiles[tileIndex];
|
||||
}
|
||||
|
||||
// Entity in way?
|
||||
|
||||
Reference in New Issue
Block a user