diff options
author | kdx <kikoodx@paranoici.org> | 2023-03-24 23:31:41 +0100 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2023-03-24 23:31:41 +0100 |
commit | c2f29cd7b97cf028ba7ed10896a37eeb05be6a78 (patch) | |
tree | f5084a9e2192e79ff0fdd39056cf7cbeed6029a7 /src | |
parent | e236ce10d4b7b38890a533e7e520f661b09c30a8 (diff) | |
download | hyperultra-c2f29cd7b97cf028ba7ed10896a37eeb05be6a78.tar.gz |
ditch able for our boi tiled
Diffstat (limited to 'src')
-rw-r--r-- | src/map.c | 30 |
1 files changed, 14 insertions, 16 deletions
@@ -1,30 +1,28 @@ #include "map.h" #include "lzy.h" #include "cfg.h" -#include "nuancierdesaut.h" -#include "trailblazer.h" -#include "weallstartsomewhere.h" -#include "wakywakysnakysnake.h" -#include "idkwymmdr.h" +#include "maps.h" #include <stddef.h> #include <string.h> #define LOL(x) (unsigned char *)(x) -unsigned char *maps[] = { - map_nuancierdesaut_json.data, LOL("nuancier de saut"), - map_trailblazer_json.data, LOL("trailblazer"), - map_weallstartsomewhere_json.data, LOL("we all start somewhere"), - map_wakywakysnakysnake_json.data, LOL("waky waky snaky snake"), - map_idkwymmdr_json.data, LOL("idk wym mdr"), - NULL +struct { + const Tmj2cMap *map; + const char *name; +} maps[] = { + { &map_nuancierdesaut_tmj, "nuancier de saut" }, + { &map_trailblazer_tmj, "trailblazer" }, + { &map_weallstartsomewhere_tmj, "we all start somewhere" }, + { &map_wakywakysnakysnake_tmj, "waky waky snaky snake" }, + { &map_idkwymmdr_tmj, "idk wym mdr" }, }; unsigned int map_id = 0; void map_next(void) { - if (maps[map_id + 2] != NULL) - map_id += 2; + if (map_id + 1 < sizeof(maps) / sizeof(maps[0])) + map_id += 1; else map_id = 0; } @@ -46,7 +44,7 @@ map_get(int x, int y) { if (x < 0 || y < 0 || x >= map_width() || y >= map_height()) return 1; - return maps[map_id][x + y * map_width()]; + return maps[map_id].map->layers[0].data[x + y * map_width()]; } int @@ -85,7 +83,7 @@ map_draw(void) void map_draw_ui(void) { - const char *s = (char *)maps[1 + map_id]; + const char *s = maps[map_id].name; const int x = (DISPLAY_WIDTH - CHR_WIDTH * strlen(s)) / 2; const int y = (DISPLAY_HEIGHT - CHR_HEIGHT) / 2; LZY_DrawText(x, y, s); |