Mercurial > molko
comparison libmlk-rpg/rpg/map-file.h @ 250:8ef7fb7f14ad
rpg: add support for collisions with actions
While here, minimal cleanup in maps.
author | David Demelier <markand@malikania.fr> |
---|---|
date | Tue, 01 Dec 2020 19:24:11 +0100 |
parents | 71b3b7036de7 |
children | 08ab73b32832 |
comparison
equal
deleted
inserted
replaced
249:f4dc208aa1e3 | 250:8ef7fb7f14ad |
---|---|
37 * itself. | 37 * itself. |
38 */ | 38 */ |
39 | 39 |
40 #include <stdbool.h> | 40 #include <stdbool.h> |
41 | 41 |
42 #include <core/alloc.h> | |
42 #include <core/sprite.h> | 43 #include <core/sprite.h> |
43 #include <core/texture.h> | 44 #include <core/texture.h> |
44 | 45 |
45 #include "map.h" | 46 #include "map.h" |
46 #include "tileset.h" | 47 #include "tileset.h" |
63 */ | 64 */ |
64 struct map_file { | 65 struct map_file { |
65 /** | 66 /** |
66 * (+?) User function to create an action when it is listed in the map | 67 * (+?) User function to create an action when it is listed in the map |
67 * definition. | 68 * definition. |
68 * | |
69 * The returned value is owned by the user and is never free'ed from the | |
70 * map file itself. If the function is present and return a non-NULL | |
71 * action it is added into map. | |
72 */ | 69 */ |
73 struct action *(*load_action)(struct map *map, int x, int y, int w, int h, const char *exec); | 70 void (*load_action)(struct map *map, int x, int y, int w, int h, const char *exec); |
74 | 71 |
75 /** | 72 char title[MAP_FILE_TITLE_MAX]; /*!< \private */ |
76 * (*) Map title loaded from file. | 73 struct map_layer layers[MAP_LAYER_TYPE_NUM]; /*!< \private */ |
77 */ | 74 struct tileset_file tileset_file; /*!< \private */ |
78 char title[MAP_FILE_TITLE_MAX]; | 75 struct tileset tileset; /*!< \private */ |
79 | 76 struct alloc_pool blocks; /*!< \private */ |
80 /** | |
81 * (*) Map layers stored dynamically here. | |
82 */ | |
83 struct map_layer layers[MAP_LAYER_TYPE_NUM]; | |
84 | |
85 /** | |
86 * (*) Tileset file loader. | |
87 */ | |
88 struct tileset_file tileset_file; | |
89 | |
90 /** | |
91 * (*) Tileset referenced from the map. | |
92 */ | |
93 struct tileset tileset; | |
94 }; | 77 }; |
95 | 78 |
96 /** | 79 /** |
97 * Try to open a map from a file path. | 80 * Try to open a map from a file path. |
98 * | 81 * |