#ifndef RESOURCE_MAP_H #define RESOURCE_MAP_H #include #include "resource.h" #include "image.h" enum layer_id { LAYER_GROUND = 0, LAYER_OBJ_LOW, LAYER_CHAR_BOT, LAYER_OBJ_MID, LAYER_CHAR_TOP, LAYER_OBJ_HIGH, LAYER_WEATHER, LAYERS_MAX }; struct tileset { struct resource res; char *dirname; char *name; int tilewidth; int tileheight; struct image *image; }; struct map_tileset { struct tileset *tileset; int firstgid; struct map_tileset *next; }; struct layer { struct map *map; Uint32 *tiles; char *encoding; char *compression; char *raw_data; }; struct map_exit { struct map *map; int x; int y; int width; int height; char *target_map_name; struct map *target_map; int target_x_coord; int target_y_coord; struct map_exit *next; }; struct map_spawn { struct map *map; int x; int y; int width; int height; int player; struct map_spawn *next; }; struct map { struct resource res; char *dirname; /* TODO: map_get() should take a name, not a path. char *name; */ int width; int height; int tilewidth; int tileheight; struct map_tileset *tilesets_head; struct map_tileset *tilesets_tail; struct layer layers[LAYERS_MAX]; Uint8 *collision; struct map_exit *map_exits_head; struct map_exit *map_exits_tail; int cur_ts_firstgid; }; struct map *map_get(const char *path); void map_free(struct map *map); void map_add_tileset(struct map *m, struct tileset *t, int firstgid); struct layer *map_get_layer(struct map *m, const char *name); void map_add_exit(struct map *m, struct map_exit *e); #endif