Quick move into textures.cpp so I can work on the final form of wall to door mapping.

This commit is contained in:
Zed A. Shaw 2026-03-17 12:40:31 -04:00
parent f57d202f5c
commit 6d7a944a7d
3 changed files with 10 additions and 11 deletions

View file

@ -179,21 +179,11 @@ void WorldBuilder::place_doors(DinkyECS::World& world, GameConfig& config) {
// note, we set this to WALL_VALUE so it renders as a wall but map.iswall will check if its a door for collision
walls[door_at.y][door_at.x] = WALL_VALUE;
size_t moss_wall_id = textures::get_id("wall_moss");
size_t plain_door_id = textures::get_id("door_plain");
size_t moss_door_id = textures::get_id("door_moss_wall");
for(matrix::compass it{tiles, door_at.x, door_at.y}; it.next();) {
if(walls[it.y][it.x] == WALL_VALUE) {
// found a wall near the door, and since doors always have n/s/e/w walls it should be the one to use
size_t wall_id = tiles[it.y][it.x]; // this is wall to use
// change this to texture::door_for_wall(wall_id);
if(wall_id == moss_wall_id) {
tiles[door_at.y][door_at.x] = moss_door_id;
} else {
tiles[door_at.y][door_at.x] = plain_door_id;
}
tiles[door_at.y][door_at.x] = textures::door_for_wall(wall_id);
break;
}
}

View file

@ -201,4 +201,11 @@ namespace textures {
return TMGR.map_sprites.at(display);
}
size_t door_for_wall(size_t wall_id) {
size_t moss_wall_id = textures::get_id("wall_moss");
size_t plain_door_id = textures::get_id("door_plain");
size_t moss_door_id = textures::get_id("door_moss_wall");
return wall_id == moss_wall_id ? moss_door_id : plain_door_id;
}
};

View file

@ -51,4 +51,6 @@ namespace textures {
sf::Sprite& get_map_sprite(wchar_t display);
size_t get_id(const std::string& name);
size_t door_for_wall(size_t wall_id);
}