Separate object layers, asign layers to proper slots
This commit is contained in:
@@ -2,8 +2,9 @@
|
||||
#define BREEZE_MAP_H
|
||||
|
||||
#include "tileset.h"
|
||||
#include "../utils/string.h"
|
||||
|
||||
#define BZ_MAX_MAP_LAYERS 16
|
||||
#define BZ_MAX_MAP_LAYERS 8
|
||||
#define BZ_MAX_MAP_TILESETS 8
|
||||
|
||||
|
||||
@@ -25,11 +26,36 @@ typedef struct BzTileLayer {
|
||||
i32 tilesetIdx;
|
||||
} BzTileLayer;
|
||||
|
||||
typedef struct BzTileObject {
|
||||
u32 id;
|
||||
BzTileShape shape;
|
||||
} BzTileObject;
|
||||
|
||||
typedef struct BzTileObjectLayer {
|
||||
BzTileObject *objects;
|
||||
i32 objectCount;
|
||||
} BzTileObjectLayer;
|
||||
|
||||
// Return true, if it should be added to map
|
||||
typedef bool BzTileLayerHandler(BzTileLayer *layer);
|
||||
typedef bool BzTileObjectsHandler(BzTileObjectLayer *objectLayer);
|
||||
|
||||
typedef struct BzTileLayerDesc {
|
||||
const char *name; // Matches map layer names
|
||||
BzTileLayerHandler *handler;
|
||||
} BzTileLayerDesc;
|
||||
typedef struct BzTileObjectsDesc {
|
||||
const char *name; // Matches map layer names
|
||||
BzTileObjectsHandler *handler;
|
||||
BzStringHashFunc *hashFunc;
|
||||
} BzTileObjectsDesc;
|
||||
|
||||
typedef struct BzTileMapDesc {
|
||||
const char *path;
|
||||
BzTileset tilesets[BZ_MAX_MAP_TILESETS];
|
||||
i32 tilesetCount;
|
||||
|
||||
BzTileLayerDesc layers[BZ_MAX_MAP_LAYERS];
|
||||
BzTileObjectsDesc objectLayers[BZ_MAX_MAP_LAYERS];
|
||||
} BzTileMapDesc;
|
||||
|
||||
typedef struct BzTileMap {
|
||||
@@ -43,6 +69,9 @@ typedef struct BzTileMap {
|
||||
BzTileLayer layers[BZ_MAX_MAP_LAYERS];
|
||||
i32 layerCount;
|
||||
|
||||
BzTileObjectLayer objectLayers[BZ_MAX_MAP_LAYERS];
|
||||
i32 objectLayerCount;
|
||||
|
||||
BzTileset tilesets[BZ_MAX_MAP_TILESETS];
|
||||
i32 tilesetCount;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user