Rooms are now styled randomly based on assets/styles.json which will evolve into specifications for themes of levels and rooms in them plus other configs.

This commit is contained in:
Zed A. Shaw 2025-05-30 20:35:17 -04:00
parent e45de2a2cf
commit d2a5dfa713
7 changed files with 56 additions and 2 deletions

View file

@ -46,6 +46,7 @@ namespace textures {
auto &config = el.value();
const std::string& texture_fname = config["texture"];
size_t surface_i = config["id"];
TMGR.name_to_id.insert_or_assign(el.key(), surface_i);
if(surface_i >= tiles.size()) {
resize_shit(surface_i + 1);
@ -113,4 +114,10 @@ namespace textures {
size_t ceiling_num = TMGR.ceilings[num];
return (const uint32_t *)TMGR.surfaces[ceiling_num].getPixelsPtr();
}
size_t get_id(const std::string& name) {
dbc::check(TMGR.name_to_id.contains(name),
fmt::format("there is no texture named {} in tiles.json", name));
return TMGR.name_to_id.at(name);
}
};