2023-03-17 13:45:20 +01:00
|
|
|
#include "map.h"
|
|
|
|
#include "lzy.h"
|
|
|
|
#include "cfg.h"
|
2023-03-18 19:01:48 +01:00
|
|
|
#include "weallstartsomewhere.h"
|
|
|
|
#include "wakywakysnakysnake.h"
|
|
|
|
#include "idkwymlol.h"
|
2023-03-17 21:07:07 +01:00
|
|
|
#include <stddef.h>
|
|
|
|
|
2023-03-18 19:01:48 +01:00
|
|
|
#define LOL(x) (unsigned char *)(x)
|
2023-03-17 21:07:07 +01:00
|
|
|
unsigned char *maps[] = {
|
2023-03-18 19:01:48 +01:00
|
|
|
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"),
|
2023-03-17 21:07:07 +01:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
unsigned int map_id = 0;
|
|
|
|
|
|
|
|
void
|
|
|
|
map_next(void)
|
|
|
|
{
|
2023-03-18 19:01:48 +01:00
|
|
|
if (maps[map_id + 2] != NULL)
|
|
|
|
map_id += 2;
|
2023-03-17 21:07:07 +01:00
|
|
|
else
|
|
|
|
map_id = 0;
|
|
|
|
}
|
2023-03-17 13:45:20 +01:00
|
|
|
|
2023-03-17 20:44:59 +01:00
|
|
|
int
|
|
|
|
map_width(void)
|
|
|
|
{
|
2023-03-18 19:01:48 +01:00
|
|
|
return 25;
|
2023-03-17 20:44:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
map_height(void)
|
|
|
|
{
|
2023-03-18 19:01:48 +01:00
|
|
|
return 14;
|
2023-03-17 20:44:59 +01:00
|
|
|
}
|
|
|
|
|
2023-03-17 13:45:20 +01:00
|
|
|
int
|
|
|
|
map_get(int x, int y)
|
|
|
|
{
|
2023-03-18 19:01:48 +01:00
|
|
|
if (x < 0 || y < 0 || x >= map_width() || y >= map_height())
|
2023-03-17 13:45:20 +01:00
|
|
|
return 0;
|
2023-03-18 19:01:48 +01:00
|
|
|
return maps[map_id][x + y * map_width()];
|
2023-03-17 13:45:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
map_get_px(int x, int y)
|
|
|
|
{
|
|
|
|
if (x < 0 || y < 0)
|
|
|
|
return 0;
|
|
|
|
return map_get(x / TSIZE, y / TSIZE);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
map_draw(void)
|
|
|
|
{
|
2023-03-18 19:01:48 +01:00
|
|
|
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) {
|
2023-03-17 13:45:20 +01:00
|
|
|
LZY_DrawSetColor(BLACK);
|
2023-03-17 20:44:59 +01:00
|
|
|
LZY_DrawTile(2, x * 16, y * 16);
|
2023-03-17 13:45:20 +01:00
|
|
|
}
|
|
|
|
}
|