6 #include "engine/asset.h"
10 BLOCKTYPE_OBSTACLE_X = 1 << 0,
11 BLOCKTYPE_OBSTACLE_Z = 1 << 1
20 OBSTACLE_XP_ZP = 1 << 4,
21 OBSTACLE_XP_ZN = 1 << 5,
22 OBSTACLE_XN_ZP = 1 << 6,
23 OBSTACLE_XN_ZN = 1 << 7
26 typedef enum BlockType BlockType;
27 typedef enum Obstacle Obstacle;
28 typedef struct Block Block;
29 typedef struct BlockGrid BlockGrid;
30 typedef struct GridLocation GridLocation;
48 static const float BLOCKGRID_CELL_SIZE = 2.5f;
50 extern BlockGrid levelGrid;
54 GridLocation gridLocationFromPosition(Vector pos);
55 Obstacle getObstacles(GridLocation loc);
57 static inline Block* getBlockFromGrid(BlockGrid grid, size_t x, size_t z) {
58 return grid.blocks[(z * grid.width) + x];
61 static inline void setBlockInGrid(BlockGrid grid, size_t x, size_t z, Block* block) {
62 grid.blocks[(z * grid.width) + x] = block;
65 static inline float cellBoundaryCoord(size_t cellIndex) {
66 return cellIndex * BLOCKGRID_CELL_SIZE;