Improve worldpos.h

This commit is contained in:
2025-11-09 20:55:41 -06:00
parent d6c497731f
commit aee06f51f0
8 changed files with 115 additions and 107 deletions

View File

@@ -61,7 +61,7 @@ void sceneMapEntityGetPosition(const entity_t *entity, vec3 outPosition) {
float_t animPercentage = entity->animTime / ENTITY_ANIM_WALK_DURATION;
// Get facing rel, we know we moved from the inverse direction.
int8_t x, y;
worldunits_t x, y;
entityDirGetRelative(entity->direction, &x, &y);
x = -x, y = -y;
@@ -163,9 +163,9 @@ void sceneMapRenderMap() {
chunk_t *chunk = MAP.chunkOrder[i];
vec3 min, max;
min[0] = chunk->x * CHUNK_WIDTH * TILE_SIZE;
min[1] = chunk->y * CHUNK_HEIGHT * TILE_SIZE;
min[2] = chunk->z * CHUNK_DEPTH * TILE_SIZE;
min[0] = chunk->position.x * CHUNK_WIDTH * TILE_SIZE;
min[1] = chunk->position.y * CHUNK_HEIGHT * TILE_SIZE;
min[2] = chunk->position.z * CHUNK_DEPTH * TILE_SIZE;
// center tile
min[0] -= TILE_SIZE / 2.0f;
@@ -177,10 +177,10 @@ void sceneMapRenderMap() {
max[2] = min[2];
color_t color = COLOR_WHITE;
if(chunk->x % 2 == 0) {
color = (chunk->y % 2 == 0) ? COLOR_BLACK : COLOR_WHITE;
if(chunk->position.x % 2 == 0) {
color = (chunk->position.y % 2 == 0) ? COLOR_BLACK : COLOR_WHITE;
} else {
color = (chunk->y % 2 == 0) ? COLOR_WHITE : COLOR_BLACK;
color = (chunk->position.y % 2 == 0) ? COLOR_WHITE : COLOR_BLACK;
}
spriteBatchPush3D(