summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2023-03-18 19:01:48 +0100
committerkdx <kikoodx@paranoici.org>2023-03-18 19:01:48 +0100
commitef3cf8e9df99856d4c322afd17fed5e3e15f383b (patch)
tree1c777521576852444258381c6c37b76135975d4f /src
parentc357b72d6a6c3ecf68d1545cfd8004a1ecde25e1 (diff)
downloadhyperultra-ef3cf8e9df99856d4c322afd17fed5e3e15f383b.tar.gz
top tier level design
Diffstat (limited to 'src')
-rw-r--r--src/map.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/map.c b/src/map.c
index 5d9245e..cdaaf72 100644
--- a/src/map.c
+++ b/src/map.c
@@ -1,13 +1,16 @@
#include "map.h"
#include "lzy.h"
#include "cfg.h"
-#include "00.h"
-#include "01.h"
+#include "weallstartsomewhere.h"
+#include "wakywakysnakysnake.h"
+#include "idkwymlol.h"
#include <stddef.h>
+#define LOL(x) (unsigned char *)(x)
unsigned char *maps[] = {
- map_00_json.data,
- map_01_json.data,
+ map_weallstartsomewhere_json.data, LOL("we all start somewhere"),
+ map_wakywakysnakysnake_json.data, LOL("waky waky snaky snake"),
+ map_idkwymlol_json.data, LOL("idk wym lol"),
NULL
};
unsigned int map_id = 0;
@@ -15,8 +18,8 @@ unsigned int map_id = 0;
void
map_next(void)
{
- if (maps[map_id + 1] != NULL)
- map_id += 1;
+ if (maps[map_id + 2] != NULL)
+ map_id += 2;
else
map_id = 0;
}
@@ -24,21 +27,21 @@ map_next(void)
int
map_width(void)
{
- return map_00_json.width;
+ return 25;
}
int
map_height(void)
{
- return map_00_json.height;
+ return 14;
}
int
map_get(int x, int y)
{
- if (x < 0 || y < 0 || x >= map_00_json.width || y >= map_00_json.height)
+ if (x < 0 || y < 0 || x >= map_width() || y >= map_height())
return 0;
- return maps[map_id][x + y * map_00_json.width];
+ return maps[map_id][x + y * map_width()];
}
int
@@ -52,9 +55,9 @@ map_get_px(int x, int y)
void
map_draw(void)
{
- for (int y = 0; y < 14; y++)
- for (int x = 0; x < map_00_json.width; x++)
- if (maps[map_id][x + y * map_00_json.width] == 1) {
+ for (int y = 0; y < map_height(); y++)
+ for (int x = 0; x < map_width(); x++)
+ if (maps[map_id][x + y * map_width()] == 1) {
LZY_DrawSetColor(BLACK);
LZY_DrawTile(2, x * 16, y * 16);
}