From 5a63b4c2710732f73caed6fa9fa08fcf1ca7fd44 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sun, 17 Feb 2013 04:50:18 -0500 Subject: Support layers in maps. --- (limited to 'src/resources/map.h') diff --git a/src/resources/map.h b/src/resources/map.h index 2926aa5..11ba808 100644 --- a/src/resources/map.h +++ b/src/resources/map.h @@ -4,8 +4,17 @@ #include #include "resource.h" #include "image.h" -#include "layer.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; @@ -19,6 +28,13 @@ struct map_tileset { int firstgid; struct map_tileset *next; }; +struct layer { + struct map *map; + Uint32 *tiles; + char *encoding; + char *compression; + char *raw_data; +}; struct map { struct resource res; char *dirname; @@ -28,15 +44,14 @@ struct map { int tileheight; struct map_tileset *tilesets_head; struct map_tileset *tilesets_tail; - struct layer *layers_head; - struct layer *layers_tail; + struct layer layers[LAYERS_MAX]; Uint8 *collision; int cur_ts_firstgid; }; struct map *map_get(const char *path); void map_free(struct map *map); -void map_add_layer(struct map *m, struct layer *l); void map_add_tileset(struct map *m, struct tileset *t, int firstgid); +struct layer *map_get_layer(struct map *m, const char *name); #endif -- cgit v0.9.1