diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/game.h | 2 | ||||
| -rw-r--r-- | include/map.h | 10 | ||||
| -rw-r--r-- | include/objects.h | 9 |
3 files changed, 18 insertions, 3 deletions
diff --git a/include/game.h b/include/game.h index f2fd0cb..cc1057d 100644 --- a/include/game.h +++ b/include/game.h @@ -11,6 +11,8 @@ #define SERVER_MAX_PLAYERS (10) #define SERVER_PATHFINDING_INTERVAL (0.25f) +bool is_editing_map = false; + typedef enum t_game_state { GAMESTATE_IDLE, GAMESTATE_LOADING_MAP, diff --git a/include/map.h b/include/map.h index 4147146..6a509e2 100644 --- a/include/map.h +++ b/include/map.h @@ -6,8 +6,14 @@ #include "players.h" #include "objects.h" +typedef enum t_tile_type { + TILE_NONE = 0, + TILE_COBBLESTONE1 = 1, +} tile_type; + typedef struct t_tile { int height; + tile_type type; // filled in on load. int topleft; @@ -36,17 +42,21 @@ typedef struct t_map_data { int width; int height; int heightmap[MAP_SIZE_Y][MAP_SIZE_X]; + tile_type tiles[MAP_SIZE_Y][MAP_SIZE_X]; + object objects[MAX_OBJECTS]; } map_data; typedef struct t_extracted_map_data { int width; int height; tile heightmap[MAP_SIZE_Y][MAP_SIZE_X]; + object objects[MAX_OBJECTS]; } extracted_map_data; map_data map_to_load = {0}; extracted_map_data loaded_map = {0}; +void create_empty_map(); void load_map_from_file(); tile get_tile_under_coords(float x, float y); float get_height_of_tile_under_coords(float tocheckx, float tochecky); diff --git a/include/objects.h b/include/objects.h index d586838..5842985 100644 --- a/include/objects.h +++ b/include/objects.h @@ -11,12 +11,17 @@ typedef struct t_vec3f { float x,y,z; } vec3f; +typedef enum t_object_type { + OBJECT_COBBLESTONEWALL1 = 1, + OBJECT_PLANTBOX1 = 2, +} object_type; + typedef struct t_object { bool active; vec2f position; vec3f size; float h; - image* image; + object_type type; } object; typedef struct t_box { @@ -31,8 +36,6 @@ typedef struct t_box { vec2f br_u; } box; -object objects[MAX_OBJECTS]; - object get_object_at_tile(float x, float y); void create_objects(); void draw_objects_at_row(platform_window* window, int row); |
