Mirai's Miscellaneous Misadventures

M41 / include / mimimi / ground.h

1// copyright 2023 zamfofex
2// license: AGPLv3 or later
3
4#ifndef MIMIMI_GROUND_H
5#define MIMIMI_GROUND_H
6
7struct mimimi_ground
8{
9	int width, height;
10	unsigned char *tiles;
11};
12
13static unsigned char mimimi_ground_tile(struct mimimi_ground *ground, int x, int y)
14{
15	if (x < 0) return 0;
16	if (y < 0) return 0;
17	if (x >= ground->width) return 0;
18	if (y >= ground->height) return 0;
19	return ground->tiles[x + y * ground->width];
20}
21
22#endif