summaryrefslogtreecommitdiff
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
parentc357b72d6a6c3ecf68d1545cfd8004a1ecde25e1 (diff)
downloadhyperultra-ef3cf8e9df99856d4c322afd17fed5e3e15f383b.tar.gz
top tier level design
-rw-r--r--map/idkwymlol.json1
-rw-r--r--map/wakywakysnakysnake.json (renamed from map/01.json)0
-rw-r--r--map/weallstartsomewhere.json (renamed from map/00.json)0
-rw-r--r--src/map.c29
4 files changed, 17 insertions, 13 deletions
diff --git a/map/idkwymlol.json b/map/idkwymlol.json
new file mode 100644
index 0000000..55ba8ff
--- /dev/null
+++ b/map/idkwymlol.json
@@ -0,0 +1 @@
+{"width":25,"height":14,"data":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,1,0,1,0,1,1,0,0,0,0,0,0,1,1,0,0,1,1,1,0,0,0,1,0,0,1,0,0,1,1,1,1,1,0,0,1,1,1,0,0,1,0,1,1,0,0,0,1,1,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,1,1,0,0,1,1,1,0,0,0,0,1,0,0,0,1,0,1,1,1,1,0,1,1,0,1,1,0,0,1,0,1,1,1,0,1,1,0,0,1,1,0,1,0,0,0,0,1,0,0,1,1,2,0,1,0,0,0,1,0,1,1,0,1,1,0,0,1,0,0,0,1,1,0,0,1,1,1,1,0,0,0,1,0,0,0,1,1,1,0,0,1,0,0,0,1,1,0,4,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,0,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]} \ No newline at end of file
diff --git a/map/01.json b/map/wakywakysnakysnake.json
index 88edf18..88edf18 100644
--- a/map/01.json
+++ b/map/wakywakysnakysnake.json
diff --git a/map/00.json b/map/weallstartsomewhere.json
index 57f5963..57f5963 100644
--- a/map/00.json
+++ b/map/weallstartsomewhere.json
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);
}