Tile under foot

This commit is contained in:
2025-11-10 11:01:41 -06:00
parent 3eb24da475
commit 562da971e9
6 changed files with 36 additions and 9 deletions

View File

@@ -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?