88 auto& chests = room.GetChests();
91 int chest_count =
static_cast<int>(chests.size());
93 chest_count > 6 ? theme.text_error_red : theme.text_primary;
97 if (chest_count > 6) {
100 if (ImGui::IsItemHovered()) {
102 "Room exceeds chest limit (6 max)!\n"
103 "This may cause game crashes.");
111 zelda3::chest_data new_chest;
113 new_chest.size =
false;
114 chests.push_back(new_chest);
120 if (ImGui::IsItemHovered()) {
121 ImGui::SetTooltip(
"Add new chest to room");
125 if (chests.empty()) {
126 ImGui::TextColored(theme.text_secondary_gray,
133 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));
143 const char* size_icon =
145 const char* size_label =
chest.size ?
"Big" :
"Small";
148 std::string item_name =
149 (
chest.id < item_names.size())
150 ? item_names[
chest.id]
151 : absl::StrFormat(
"Unknown (0x%02X)",
chest.id);
154 std::string label = absl::StrFormat(
"%s [%zu] %s: %s", size_icon, i + 1,
155 size_label, item_name.c_str());
157 if (ImGui::Selectable(label.c_str(), is_selected)) {
163 ImVec2 min = ImGui::GetItemRectMin();
164 ImVec2 max = ImGui::GetItemRectMax();
166 ImGui::ColorConvertFloat4ToU32(theme.dungeon_selection_primary);
167 ImGui::GetWindowDrawList()->AddRect(min, max, sel_color, 0.0f, 0, 2.0f);
179 auto& chests = room.GetChests();
183 ImGui::TextColored(theme.text_secondary_gray,
194 ImGui::Text(
"Type:");
196 bool is_big =
chest.size;
197 if (ImGui::RadioButton(
"Small", !is_big)) {
204 if (ImGui::RadioButton(
"Big", is_big)) {
212 ImGui::Text(
"Item:");
215 std::string current_item =
216 (
chest.id < item_names.size())
217 ? absl::StrFormat(
"[%02X] %s",
chest.id,
218 item_names[
chest.id].c_str())
219 : absl::StrFormat(
"[%02X] Unknown",
chest.id);
221 ImGui::SetNextItemWidth(-1);
222 if (ImGui::BeginCombo(
"##ItemSelect", current_item.c_str())) {
224 static char search_buf[64] =
"";
225 ImGui::InputTextWithHint(
"##Search",
"Search items...", search_buf,
229 for (
size_t i = 0; i < item_names.size(); ++i) {
231 if (search_buf[0] !=
'\0') {
232 std::string name_lower = item_names[i];
233 std::string filter_lower = search_buf;
234 for (
auto& c : name_lower) {
235 c =
static_cast<char>(tolower(
static_cast<unsigned char>(c)));
237 for (
auto& c : filter_lower) {
238 c =
static_cast<char>(tolower(
static_cast<unsigned char>(c)));
240 if (name_lower.find(filter_lower) == std::string::npos) {
245 std::string item_label = absl::StrFormat(
246 "[%02X] %s",
static_cast<int>(i), item_names[i].c_str());
247 bool is_selected = (
chest.id ==
static_cast<uint8_t
>(i));
249 if (ImGui::Selectable(item_label.c_str(), is_selected)) {
250 chest.id =
static_cast<uint8_t
>(i);
257 ImGui::SetItemDefaultFocus();