summaryrefslogtreecommitdiff
path: root/src/map.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map.c')
-rw-r--r--src/map.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/map.c b/src/map.c
index 05774c6..dcfd3fe 100644
--- a/src/map.c
+++ b/src/map.c
@@ -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);