351 if (object_id >= 0xF80) {
352 if (object_id >= 0xF80 && object_id <= 0xF8F) {
353 return IM_COL32(100, 200, 255, 255);
354 }
else if (object_id >= 0xF90 && object_id <= 0xF9F) {
355 return IM_COL32(255, 200, 100, 255);
357 return IM_COL32(200, 150, 255, 255);
362 if (object_id >= 0x100 && object_id < 0x200) {
363 if (object_id >= 0x100 && object_id <= 0x10F) {
364 return IM_COL32(255, 150, 50, 255);
365 }
else if (object_id >= 0x110 && object_id <= 0x11F) {
366 return IM_COL32(150, 150, 200, 255);
367 }
else if (object_id >= 0x120 && object_id <= 0x12F) {
368 return IM_COL32(100, 200, 100, 255);
369 }
else if (object_id >= 0x130 && object_id <= 0x13F) {
370 return ImGui::GetColorU32(theme.dungeon_selection_primary);
372 return IM_COL32(180, 180, 180, 255);
377 if (object_id >= 0x10 && object_id <= 0x1F) {
378 return ImGui::GetColorU32(theme.dungeon_object_wall);
379 }
else if (object_id >= 0x20 && object_id <= 0x2F) {
380 return ImGui::GetColorU32(theme.dungeon_object_floor);
381 }
else if (object_id == 0xF9 || object_id == 0xFA) {
382 return ImGui::GetColorU32(theme.dungeon_object_chest);
383 }
else if (object_id >= 0x17 && object_id <= 0x1E) {
384 return ImGui::GetColorU32(theme.dungeon_object_floor);
385 }
else if (object_id == 0x2F || object_id == 0x2B) {
386 return ImGui::GetColorU32(theme.dungeon_object_pot);
387 }
else if (object_id >= 0x30 && object_id <= 0x3F) {
388 return ImGui::GetColorU32(theme.dungeon_object_decoration);
389 }
else if (object_id >= 0x00 && object_id <= 0x0F) {
390 return IM_COL32(120, 120, 180, 255);
392 return ImGui::GetColorU32(theme.dungeon_object_default);
492 static const ObjectRange ranges[] = {
493 {0x00, 0xFF,
"Type 1", IM_COL32(80, 120, 180, 255)},
494 {0x100, 0x141,
"Type 2", IM_COL32(120, 80, 180, 255)},
495 {0xF80, 0xFFF,
"Type 3", IM_COL32(180, 120, 80, 255)},
499 int total_objects = (0xFF - 0x00 + 1) + (0x141 - 0x100 + 1) + (0xFFF - 0xF80 + 1);
503 if (ImGui::IsItemHovered()) {
505 "Enable to show actual object graphics.\n"
506 "Requires a room to be loaded.\n"
507 "May impact performance.");
510 ImGui::TextDisabled(
"(%d objects)", total_objects);
513 const float item_size = 72.0f;
514 const float item_spacing = 6.0f;
515 const int columns = std::max(
516 1,
static_cast<int>((ImGui::GetContentRegionAvail().x - item_spacing) /
517 (item_size + item_spacing)));
520 float child_height = ImGui::GetContentRegionAvail().y;
521 if (ImGui::BeginChild(
"##ObjectGrid", ImVec2(0, child_height),
false,
522 ImGuiWindowFlags_AlwaysVerticalScrollbar)) {
525 for (
const auto& range : ranges) {
527 ImGui::PushStyleColor(ImGuiCol_Header, range.header_color);
528 ImGui::PushStyleColor(ImGuiCol_HeaderHovered,
529 IM_COL32((range.header_color & 0xFF) + 30,
530 ((range.header_color >> 8) & 0xFF) + 30,
531 ((range.header_color >> 16) & 0xFF) + 30, 255));
532 bool section_open = ImGui::CollapsingHeader(
533 absl::StrFormat(
"%s (0x%03X-0x%03X)", range.label, range.start, range.end).c_str(),
534 ImGuiTreeNodeFlags_DefaultOpen);
535 ImGui::PopStyleColor(2);
537 if (!section_open)
continue;
539 int current_column = 0;
541 for (
int obj_id = range.start; obj_id <= range.end; ++obj_id) {
542 if (current_column > 0) {
546 ImGui::PushID(obj_id);
550 ImVec2 button_size(item_size, item_size);
552 if (ImGui::Selectable(
"", is_selected,
553 ImGuiSelectableFlags_AllowDoubleClick,
574 if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
582 ImVec2 button_pos = ImGui::GetItemRectMin();
583 ImDrawList* draw_list = ImGui::GetWindowDrawList();
586 bool rendered =
false;
595 ImU32 darker_color = IM_COL32((obj_color & 0xFF) * 0.6f,
596 ((obj_color >> 8) & 0xFF) * 0.6f,
597 ((obj_color >> 16) & 0xFF) * 0.6f, 255);
600 draw_list->AddRectFilledMultiColor(
602 ImVec2(button_pos.x + item_size, button_pos.y + item_size),
603 darker_color, darker_color, obj_color, obj_color);
607 ImVec2 symbol_size = ImGui::CalcTextSize(symbol.c_str());
608 ImVec2 symbol_pos(button_pos.x + (item_size - symbol_size.x) / 2,
609 button_pos.y + (item_size - symbol_size.y) / 2 - 10);
610 draw_list->AddText(symbol_pos, IM_COL32(255, 255, 255, 180),
617 float border_thickness;
619 if (is_static_editor_obj) {
620 border_color = IM_COL32(0, 200, 255, 255);
621 border_thickness = 3.0f;
622 }
else if (is_selected) {
623 border_color = ImGui::GetColorU32(theme.dungeon_selection_primary);
624 border_thickness = 3.0f;
626 border_color = ImGui::GetColorU32(theme.panel_bg_darker);
627 border_thickness = 1.0f;
632 ImVec2(button_pos.x + item_size, button_pos.y + item_size),
633 border_color, 0.0f, 0, border_thickness);
636 if (is_static_editor_obj) {
637 ImVec2 icon_pos(button_pos.x + item_size - 14, button_pos.y + 2);
638 draw_list->AddCircleFilled(ImVec2(icon_pos.x + 6, icon_pos.y + 6), 6,
639 IM_COL32(0, 200, 255, 200));
640 draw_list->AddText(icon_pos, IM_COL32(255, 255, 255, 255),
"i");
647 std::string display_name = full_name;
648 const size_t kMaxDisplayChars = 12;
649 if (display_name.length() > kMaxDisplayChars) {
650 display_name = display_name.substr(0, kMaxDisplayChars - 2) +
"..";
654 ImVec2 name_size = ImGui::CalcTextSize(display_name.c_str());
655 ImVec2 name_pos = ImVec2(button_pos.x + (item_size - name_size.x) / 2,
656 button_pos.y + item_size - 26);
657 draw_list->AddText(name_pos,
658 ImGui::GetColorU32(theme.text_secondary_gray),
659 display_name.c_str());
662 std::string id_text = absl::StrFormat(
"%03X", obj_id);
663 ImVec2 id_size = ImGui::CalcTextSize(id_text.c_str());
664 ImVec2 id_pos = ImVec2(button_pos.x + (item_size - id_size.x) / 2,
665 button_pos.y + item_size - id_size.y - 2);
666 draw_list->AddText(id_pos, ImGui::GetColorU32(theme.text_primary),
670 if (ImGui::IsItemHovered()) {
671 ImGui::BeginTooltip();
672 ImGui::TextColored(ImVec4(1.0f, 0.9f, 0.4f, 1.0f),
"Object 0x%03X",
674 ImGui::Text(
"%s", full_name.c_str());
676 ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1.0f),
"Subtype %d",
679 ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f),
680 "Click to select for placement");
681 ImGui::TextColored(ImVec4(0.5f, 0.8f, 1.0f, 1.0f),
682 "Double-click to view details");
688 current_column = (current_column + 1) % columns;
693 ImGui::PushStyleColor(ImGuiCol_Header, IM_COL32(100, 180, 120, 255));
694 ImGui::PushStyleColor(ImGuiCol_HeaderHovered, IM_COL32(130, 210, 150, 255));
695 bool custom_open = ImGui::CollapsingHeader(
"Custom Objects", ImGuiTreeNodeFlags_DefaultOpen);
696 ImGui::PopStyleColor(2);
708 for (
int obj_id : {0x31, 0x32}) {
709 int subtype_count = obj_manager.GetSubtypeCount(obj_id);
710 for (
int subtype = 0; subtype < subtype_count; ++subtype) {
711 if (custom_col > 0) ImGui::SameLine();
713 ImGui::PushID(obj_id * 1000 + subtype);
716 ImVec2 button_size(item_size, item_size);
718 if (ImGui::Selectable(
"", is_selected, ImGuiSelectableFlags_AllowDoubleClick, button_size)) {
723 if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
729 ImVec2 button_pos = ImGui::GetItemRectMin();
730 ImDrawList* draw_list = ImGui::GetWindowDrawList();
732 bool rendered =
false;
737 temp_obj.size_ = subtype;
743 ImU32 obj_color = IM_COL32(100, 180, 120, 255);
744 ImU32 darker_color = IM_COL32(60, 100, 70, 255);
746 draw_list->AddRectFilledMultiColor(
748 ImVec2(button_pos.x + item_size, button_pos.y + item_size),
749 darker_color, darker_color, obj_color, obj_color);
751 std::string symbol = (obj_id == 0x31) ?
"Trk" :
"Cus";
753 std::string sub_text = absl::StrFormat(
"%02X", subtype);
754 ImVec2 sub_size = ImGui::CalcTextSize(sub_text.c_str());
755 ImVec2 sub_pos(button_pos.x + (item_size - sub_size.x) / 2,
756 button_pos.y + (item_size - sub_size.y) / 2);
757 draw_list->AddText(sub_pos, IM_COL32(255, 255, 255, 220), sub_text.c_str());
765 ImU32 border_color = is_selected ? ImGui::GetColorU32(theme.dungeon_selection_primary) : ImGui::GetColorU32(theme.panel_bg_darker);
766 float border_thickness = is_selected ? 3.0f : 1.0f;
769 ImVec2(button_pos.x + item_size, button_pos.y + item_size),
770 border_color, 0.0f, 0, border_thickness);
773 std::string id_text = absl::StrFormat(
"%02X:%02X", obj_id, subtype);
774 ImVec2 id_size = ImGui::CalcTextSize(id_text.c_str());
775 ImVec2 id_pos = ImVec2(button_pos.x + (item_size - id_size.x) / 2,
776 button_pos.y + item_size - id_size.y - 2);
777 draw_list->AddText(id_pos, ImGui::GetColorU32(theme.text_primary),
781 custom_col = (custom_col + 1) % columns;