90 auto& chests = room.GetChests();
93 int chest_count =
static_cast<int>(chests.size());
95 chest_count > 6 ? theme.text_error_red : theme.text_primary;
99 if (chest_count > 6) {
102 if (ImGui::IsItemHovered()) {
103 ImGui::SetTooltip(
"Room exceeds chest limit (6 max)!\n"
104 "This may cause game crashes.");
112 zelda3::chest_data new_chest;
114 new_chest.size =
false;
115 chests.push_back(new_chest);
121 if (ImGui::IsItemHovered()) {
122 ImGui::SetTooltip(
"Add new chest to room");
126 if (chests.empty()) {
127 ImGui::TextColored(theme.text_secondary_gray,
133 float list_height = std::min(200.0f, ImGui::GetContentRegionAvail().y * 0.5f);
134 ImGui::BeginChild(
"##ChestList", ImVec2(0, list_height),
true);
136 for (
size_t i = 0; i < chests.size(); ++i) {
137 const auto&
chest = chests[i];
140 ImGui::PushID(
static_cast<int>(i));
144 const char* size_label =
chest.size ?
"Big" :
"Small";
147 std::string item_name = (
chest.id < item_names.size())
148 ? item_names[
chest.id]
149 : absl::StrFormat(
"Unknown (0x%02X)",
chest.id);
152 std::string label = absl::StrFormat(
"%s [%zu] %s: %s",
153 size_icon, i + 1, size_label, item_name.c_str());
155 if (ImGui::Selectable(label.c_str(), is_selected)) {
161 ImVec2 min = ImGui::GetItemRectMin();
162 ImVec2 max = ImGui::GetItemRectMax();
163 ImU32 sel_color = ImGui::ColorConvertFloat4ToU32(
164 theme.dungeon_selection_primary);
165 ImGui::GetWindowDrawList()->AddRect(min, max, sel_color, 0.0f, 0, 2.0f);
177 auto& chests = room.GetChests();
181 ImGui::TextColored(theme.text_secondary_gray,
192 ImGui::Text(
"Type:");
194 bool is_big =
chest.size;
195 if (ImGui::RadioButton(
"Small", !is_big)) {
202 if (ImGui::RadioButton(
"Big", is_big)) {
210 ImGui::Text(
"Item:");
213 std::string current_item = (
chest.id < item_names.size())
214 ? absl::StrFormat(
"[%02X] %s",
chest.id, item_names[
chest.id].c_str())
215 : absl::StrFormat(
"[%02X] Unknown",
chest.id);
217 ImGui::SetNextItemWidth(-1);
218 if (ImGui::BeginCombo(
"##ItemSelect", current_item.c_str())) {
220 static char search_buf[64] =
"";
221 ImGui::InputTextWithHint(
"##Search",
"Search items...",
222 search_buf,
sizeof(search_buf));
225 for (
size_t i = 0; i < item_names.size(); ++i) {
227 if (search_buf[0] !=
'\0') {
228 std::string name_lower = item_names[i];
229 std::string filter_lower = search_buf;
230 for (
auto& c : name_lower) {
231 c =
static_cast<char>(tolower(
static_cast<unsigned char>(c)));
233 for (
auto& c : filter_lower) {
234 c =
static_cast<char>(tolower(
static_cast<unsigned char>(c)));
236 if (name_lower.find(filter_lower) == std::string::npos) {
241 std::string item_label = absl::StrFormat(
"[%02X] %s",
242 static_cast<int>(i), item_names[i].c_str());
243 bool is_selected = (
chest.id ==
static_cast<uint8_t
>(i));
245 if (ImGui::Selectable(item_label.c_str(), is_selected)) {
246 chest.id =
static_cast<uint8_t
>(i);
253 ImGui::SetItemDefaultFocus();