From 386b136fb7d31d6424bd988d1d7c095626ceb393 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 22 Feb 2023 12:18:21 -0500 Subject: Added painting room randomisation --- generator.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'generator.cpp') diff --git a/generator.cpp b/generator.cpp index 6b6c1be..8334904 100644 --- a/generator.cpp +++ b/generator.cpp @@ -654,6 +654,30 @@ void Generator::GenerateCrossTower( SavePanel(west_other_name3, sets[3][3], sets[3][3]); } +void Generator::GeneratePaintingPuzzle(std::string panel_name, std::string painting_name) { + std::string node_name; + std::string answer; + int resource_id = 0; + + for (;;) { + std::tie(node_name, answer, resource_id) = paintings_->GetPainting(rng_); + if (!used_paintings_.count(node_name)) { + break; + } + } + + used_paintings_.insert(node_name); + + SavePanel(panel_name, "painting", answer, {}); + + std::string resource_path = std::string("res://nodes/paintings/") + node_name + ".tscn"; + if (resource_id == 0) { + resources_.emplace_back(resource_path, "PackedScene"); + } + + replace_nodes_[painting_name] = {resource_path, resource_id}; +} + void Generator::SavePanel(std::string name, std::string question, std::string answer, GenerateOptions options) { if (options.save_for_later) { reusable_.push_back(answer); -- cgit 1.4.1