2021-07-29 18:33:22 +02:00
|
|
|
#pragma once
|
|
|
|
|
2021-08-15 02:42:26 +02:00
|
|
|
#include <gint/display.h>
|
|
|
|
#include "engine.h"
|
|
|
|
|
2021-08-15 03:46:49 +02:00
|
|
|
struct Map {
|
2021-08-08 01:43:26 +02:00
|
|
|
/*width, height and the number of layer of the map (max 2)*/
|
2021-08-19 02:29:51 +02:00
|
|
|
int w, h, nb_layers;
|
2021-08-08 01:43:26 +02:00
|
|
|
/*the tileset to use*/
|
2021-07-29 18:33:22 +02:00
|
|
|
bopti_image_t *tileset;
|
2021-08-08 01:43:26 +02:00
|
|
|
/*state of each tile on the map (solid, air ...)*/
|
2021-07-31 03:40:14 +02:00
|
|
|
short *info_map;
|
2021-08-18 02:10:31 +02:00
|
|
|
/*list of all the tiles*/
|
|
|
|
short *layers[];
|
2021-07-29 18:33:22 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
enum map_state {
|
|
|
|
TILE_AIR = 0,
|
|
|
|
TILE_SOLID = 1,
|
2021-08-06 23:42:49 +02:00
|
|
|
TILE_DOOR = 2,
|
|
|
|
TILE_CHARACTER = 3,
|
2021-07-29 18:33:22 +02:00
|
|
|
};
|
2021-08-15 02:42:26 +02:00
|
|
|
|
2021-08-15 03:10:05 +02:00
|
|
|
/*check if a tile is walkable*/
|
2021-08-15 03:46:49 +02:00
|
|
|
int map_walkable(struct Map const *map, int x, int y);
|
2021-08-15 03:10:05 +02:00
|
|
|
/*get the tile under the player*/
|
2021-08-15 03:46:49 +02:00
|
|
|
int map_get_player_tile(struct Game const *game);
|
2021-08-21 02:54:03 +02:00
|
|
|
|
|
|
|
void generate_interior_map(struct Game *game);
|