Convert buildings to entities (partially)
This commit is contained in:
@@ -19,9 +19,15 @@ bool bzTileObjectsClear(BzTileObjectGroup *objectGroup, BzTileObject *objects, i
|
||||
BzTileLayerFunc BZ_TILE_LAYER_CLEAR = bzTileLayerClear;
|
||||
BzTileObjectsFunc BZ_TILE_OBJECTS_CLEAR = bzTileObjectsClear;
|
||||
|
||||
int16_t bzTileLayerGetTile(BzTileLayer *layer, i32 x, i32 y) {
|
||||
BzTile bzTileLayerGetTile(BzTileLayer *layer, i32 x, i32 y) {
|
||||
return layer->data[layer->width * y + x];
|
||||
}
|
||||
BzTileset *bzTileLayerGetTileset(BzTileMap *map, BzTileLayer *layer) {
|
||||
i32 idx = layer->tilesetIdx;
|
||||
if (idx < 0 || idx >= map->tilesetCount)
|
||||
return NULL;
|
||||
return &map->tilesets[idx];
|
||||
}
|
||||
|
||||
static void handleTileLayer(BzTileLayer *layer, cute_tiled_layer_t *cuteLayer) {
|
||||
layer->id = cuteLayer->id;
|
||||
@@ -313,6 +319,15 @@ static void drawObjectLayer(BzTileObjectGroup *objectLayer) {
|
||||
}
|
||||
}
|
||||
|
||||
BzTileLayer *bzTileMapGetLayer(BzTileMap *map, i32 slotID) {
|
||||
BZ_ASSERT(slotID >= 0 && slotID < map->layerCount);
|
||||
return &map->layers[slotID];
|
||||
}
|
||||
BzTileObjectGroup *bzTileMapGetObjects(BzTileMap *map, i32 slotID) {
|
||||
BZ_ASSERT(slotID >= 0 && slotID < map->objectGroupCount);
|
||||
return &map->objectGroups[slotID];
|
||||
}
|
||||
|
||||
void bzTileMapDraw(BzTileMap *map) {
|
||||
for (i32 i = 0; i < map->layerCount; i++) {
|
||||
BzTileLayer *layer = map->layers + i;
|
||||
|
||||
Reference in New Issue
Block a user