Now have doors that you can walk though. No open/close animation yet.

This commit is contained in:
Zed A. Shaw 2026-03-16 12:53:10 -04:00
parent 02d23bb77d
commit 0add3b29ae
10 changed files with 41 additions and 5 deletions

View file

@ -163,11 +163,25 @@ void WorldBuilder::randomize_entities(DinkyECS::World &world, GameConfig &config
}
for(auto& at : $map.$dead_ends) {
if($map.$doors.contains(at)) continue;
auto& entity_data = random_entity_data(config, gen_config);
configure_entity_in_map(world, entity_data, at);
}
}
void WorldBuilder::place_doors(DinkyECS::World& world, GameConfig& config) {
auto& device_config = config.devices.json();
auto entity_data = device_config["DOOR_PLAIN"];
auto& tiles = $map.tiles();
size_t door_id = textures::get_id("door_plain");
for(auto [door_at, _] : $map.$doors) {
$map.$walls[door_at.y][door_at.x] = WALL_VALUE;
tiles[door_at.y][door_at.x] = door_id;
}
}
void WorldBuilder::place_stairs(DinkyECS::World& world, GameConfig& config) {
auto& device_config = config.devices.json();
auto entity_data = device_config["STAIRS_DOWN"];
@ -233,6 +247,7 @@ void WorldBuilder::place_entities(DinkyECS::World &world) {
dbc::check(player_pos.location.x != 0 && player_pos.location.y != 0,
"failed to place the player correctly");
place_doors(world, config);
randomize_entities(world, config);
place_stairs(world, config);
}