hyperultra/src/map.c

34 lines
639 B
C

#include "map.h"
#include "lzy.h"
#include "cfg.h"
#include "00.h"
int
map_get(int x, int y)
{
if (x < 0 || y < 0 || x >= map_00_json.width || y >= map_00_json.height)
return 0;
return map_00_json.data[x + y * map_00_json.width];
}
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)
{
extern long tick;
const int tile_id = 1 + tick / 18 % 2;
for (int y = 0; y < 14; y++)
for (int x = 0; x < map_00_json.width; x++)
if (map_00_json.data[x + y * map_00_json.width] == 1) {
LZY_DrawSetColor(BLACK);
LZY_DrawTile(tile_id, x * 16, y * 16);
}
}