Add entity map

This commit is contained in:
2023-11-15 18:32:43 +01:00
parent 79adcad8de
commit 4c37622240
14 changed files with 253 additions and 18 deletions

View File

@@ -48,7 +48,6 @@ bool initEntityObjectsLayer(BzTileMap *map, BzTileObjectGroup *objectGroup) {
bool initBuildingsLayer(BzTileMap *map, BzTileLayer *layer) {
Game *game = ecs_singleton_get_mut(ECS, Game);
game->entityMap = bzCalloc(sizeof(*game->entityMap), layer->width * layer->height);
BzTileLayer *ownershipLayer = layer;
BzTileLayer *buildingLayer = bzTileMapGetLayer(map, LAYER_BUILDINGS);
@@ -76,12 +75,6 @@ bool initBuildingsLayer(BzTileMap *map, BzTileLayer *layer) {
ownerTile = getTileBuilding(ownerTile);
ecs_set(ECS, e, Owner, {.playerID=ownerTile});
for (i32 yIdx = y; yIdx < y + size.sizeY; yIdx++) {
for (i32 xIdx = x; xIdx < x + size.sizeX; xIdx++) {
game->entityMap[yIdx * layer->width + xIdx] = e;
}
}
//bzTileMapUpdateCollider(&GAME.map, x, y);
}
}