Adoranda/include/map.h

33 lines
716 B
C
Raw Normal View History

2021-07-29 18:33:22 +02:00
#pragma once
#include <gint/display.h>
#include "engine.h"
#include <stdbool.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 ...)*/
short *info_map;
/*list of all the tiles*/
short *layers[];
2021-07-29 18:33:22 +02:00
};
enum map_state {
TILE_AIR = 0,
TILE_SOLID = 1,
TILE_DOOR_IN = 2,
TILE_DOOR_OUT = 3,
TILE_CHARACTER = 4,
2021-07-29 18:33:22 +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);
void generate_interior_map(struct Game *game);
bool is_map_larger(struct Map *map);