Improve worldpos.h
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
#include "rpg/world/tile.h"
|
||||
#include "worldpos.h"
|
||||
|
||||
#define CHUNK_WIDTH 4
|
||||
#define CHUNK_HEIGHT 4
|
||||
@@ -14,20 +15,23 @@
|
||||
#define CHUNK_TILE_COUNT (CHUNK_WIDTH * CHUNK_HEIGHT * CHUNK_DEPTH)
|
||||
|
||||
typedef struct chunk_s {
|
||||
int16_t x, y, z;
|
||||
chunkpos_t position;
|
||||
tile_t tiles[CHUNK_TILE_COUNT];
|
||||
} chunk_t;
|
||||
|
||||
/**
|
||||
* Gets the tile index for a tile position within a chunk.
|
||||
*
|
||||
* @param relativeTileX The X coordinate of the tile within the chunk.
|
||||
* @param relativeTileY The Y coordinate of the tile within the chunk.
|
||||
* @param relativeTileZ The Z coordinate of the tile within the chunk.
|
||||
* @param position The position within the chunk.
|
||||
* @return The tile index within the chunk.
|
||||
*/
|
||||
uint32_t chunkGetTileIndex(
|
||||
const uint8_t relativeTileX,
|
||||
const uint8_t relativeTileY,
|
||||
const uint8_t relativeTileZ
|
||||
);
|
||||
uint32_t chunkGetTileIndex(const chunkpos_t position);
|
||||
|
||||
/**
|
||||
* Checks if two chunk positions are equal.
|
||||
*
|
||||
* @param a The first chunk position.
|
||||
* @param b The second chunk position.
|
||||
* @return true if equal, false otherwise.
|
||||
*/
|
||||
bool_t chunkPositionIsEqual(const chunkpos_t a, const chunkpos_t b);
|
||||
Reference in New Issue
Block a user