From be5c7263406aef867501c7965bcced6a7e2898a6 Mon Sep 17 00:00:00 2001 From: quou Date: Sun, 29 Sep 2024 16:39:31 +1000 Subject: animation, player movement, physics etc. --- map.h | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 map.h (limited to 'map.h') diff --git a/map.h b/map.h new file mode 100644 index 0000000..806de4d --- /dev/null +++ b/map.h @@ -0,0 +1,60 @@ +#ifndef map_h_included +#define map_h_included + +#include "config.h" + +struct Renderer; + +#define tiles_xmacro \ + x(tile_stone, 0, 0) \ + x(tile_block1, 16, 0) \ + x(tile_block2, 32, 0) \ + x(tile_brick, 48, 0) \ + x(tile_ladder1, 64, 0) \ + x(tile_ladder2, 80, 0) \ + x(tile_stone_ramp1, 96, 0) \ + x(tile_stone_ramp2, 112, 0) \ + x(tile_stone_ramp3, 128, 0) \ + x(tile_stone_ramp4, 144, 0) \ + x(tile_stone_ramp5, 0, 16) \ + x(tile_stone_ramp6, 16, 16) \ + x(tile_stone_ramp7, 32, 16) \ + x(tile_stone_ramp8, 48, 16) \ + x(tile_stone_ramp9, 64, 16) \ + x(tile_stone_ramp10, 80, 16) \ + x(tile_stone_ramp11, 96, 16) \ + x(tile_stone_ramp12, 112, 16) \ + x(tile_stone_ramp13, 128, 16) \ + x(tile_stone_ramp14, 144, 16) \ + x(tile_brick_ramp5, 0, 32) \ + x(tile_brick_ramp6, 16, 32) \ + x(tile_brick_ramp7, 32, 32) \ + x(tile_brick_ramp8, 48, 32) \ + x(tile_brick_ramp9, 64, 32) \ + x(tile_brick_ramp10, 80, 32) \ + x(tile_brick_ramp11, 96, 32) \ + x(tile_brick_ramp12, 112, 32) \ + x(tile_brick_ramp13, 128, 32) \ + +typedef enum { +#define x(n, x, y) \ + n, + tiles_xmacro +#undef x + tile_count +} Map_Tile; + +typedef struct Map { + unsigned short tiles[map_w * map_h]; + unsigned short collision[map_w * map_h]; + /* collision: + * 0 = nothing + * 1 = tile + * >2 = mask + */ +} Map; + +void generate_floor(Map* m, int seed); +void render_map(const Map* m, struct Renderer* r); + +#endif -- cgit v1.2.3-54-g00ecf