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(
371 theme.dungeon_selection_primary);
373 return IM_COL32(180, 180, 180, 255);
378 if (object_id >= 0x10 && object_id <= 0x1F) {
379 return ImGui::GetColorU32(theme.dungeon_object_wall);
380 }
else if (object_id >= 0x20 && object_id <= 0x2F) {
381 return ImGui::GetColorU32(theme.dungeon_object_floor);
382 }
else if (object_id == 0xF9 || object_id == 0xFA) {
383 return ImGui::GetColorU32(theme.dungeon_object_chest);
384 }
else if (object_id >= 0x17 && object_id <= 0x1E) {
385 return ImGui::GetColorU32(theme.dungeon_object_floor);
386 }
else if (object_id == 0x2F || object_id == 0x2B) {
387 return ImGui::GetColorU32(
388 theme.dungeon_object_pot);
389 }
else if (object_id >= 0x30 && object_id <= 0x3F) {
390 return ImGui::GetColorU32(
391 theme.dungeon_object_decoration);
392 }
else if (object_id >= 0x00 && object_id <= 0x0F) {
393 return IM_COL32(120, 120, 180, 255);
395 return ImGui::GetColorU32(theme.dungeon_object_default);
495 static const ObjectRange ranges[] = {
496 {0x00, 0xFF,
"Type 1", IM_COL32(80, 120, 180, 255)},
497 {0x100, 0x141,
"Type 2", IM_COL32(120, 80, 180, 255)},
498 {0xF80, 0xFFF,
"Type 3", IM_COL32(180, 120, 80, 255)},
503 (0xFF - 0x00 + 1) + (0x141 - 0x100 + 1) + (0xFFF - 0xF80 + 1);
507 if (ImGui::IsItemHovered()) {
509 "Enable to show actual object graphics.\n"
510 "Requires a room to be loaded.\n"
511 "May impact performance.");
514 ImGui::TextDisabled(
"(%d objects)", total_objects);
517 const float item_size = 72.0f;
518 const float item_spacing = 6.0f;
519 const int columns = std::max(
520 1,
static_cast<int>((ImGui::GetContentRegionAvail().x - item_spacing) /
521 (item_size + item_spacing)));
524 float child_height = ImGui::GetContentRegionAvail().y;
525 if (ImGui::BeginChild(
"##ObjectGrid", ImVec2(0, child_height),
false,
526 ImGuiWindowFlags_AlwaysVerticalScrollbar)) {
529 for (
const auto& range : ranges) {
531 ImGui::PushStyleColor(ImGuiCol_Header, range.header_color);
532 ImGui::PushStyleColor(
533 ImGuiCol_HeaderHovered,
534 IM_COL32((range.header_color & 0xFF) + 30,
535 ((range.header_color >> 8) & 0xFF) + 30,
536 ((range.header_color >> 16) & 0xFF) + 30, 255));
537 bool section_open = ImGui::CollapsingHeader(
538 absl::StrFormat(
"%s (0x%03X-0x%03X)", range.label, range.start,
541 ImGuiTreeNodeFlags_DefaultOpen);
542 ImGui::PopStyleColor(2);
547 int current_column = 0;
549 for (
int obj_id = range.start; obj_id <= range.end; ++obj_id) {
550 if (current_column > 0) {
554 ImGui::PushID(obj_id);
558 ImVec2 button_size(item_size, item_size);
560 if (ImGui::Selectable(
"", is_selected,
561 ImGuiSelectableFlags_AllowDoubleClick,
583 if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
591 ImVec2 button_pos = ImGui::GetItemRectMin();
592 ImDrawList* draw_list = ImGui::GetWindowDrawList();
595 bool rendered =
false;
604 ImU32 darker_color = IM_COL32((obj_color & 0xFF) * 0.6f,
605 ((obj_color >> 8) & 0xFF) * 0.6f,
606 ((obj_color >> 16) & 0xFF) * 0.6f, 255);
609 draw_list->AddRectFilledMultiColor(
611 ImVec2(button_pos.x + item_size, button_pos.y + item_size),
612 darker_color, darker_color, obj_color, obj_color);
616 ImVec2 symbol_size = ImGui::CalcTextSize(symbol.c_str());
618 button_pos.x + (item_size - symbol_size.x) / 2,
619 button_pos.y + (item_size - symbol_size.y) / 2 - 10);
620 draw_list->AddText(symbol_pos, IM_COL32(255, 255, 255, 180),
627 float border_thickness;
629 if (is_static_editor_obj) {
630 border_color = IM_COL32(0, 200, 255, 255);
631 border_thickness = 3.0f;
632 }
else if (is_selected) {
633 border_color = ImGui::GetColorU32(theme.dungeon_selection_primary);
634 border_thickness = 3.0f;
636 border_color = ImGui::GetColorU32(theme.panel_bg_darker);
637 border_thickness = 1.0f;
642 ImVec2(button_pos.x + item_size, button_pos.y + item_size),
643 border_color, 0.0f, 0, border_thickness);
646 if (is_static_editor_obj) {
647 ImVec2 icon_pos(button_pos.x + item_size - 14, button_pos.y + 2);
648 draw_list->AddCircleFilled(ImVec2(icon_pos.x + 6, icon_pos.y + 6), 6,
649 IM_COL32(0, 200, 255, 200));
650 draw_list->AddText(icon_pos, IM_COL32(255, 255, 255, 255),
"i");
657 std::string display_name = full_name;
658 const size_t kMaxDisplayChars = 12;
659 if (display_name.length() > kMaxDisplayChars) {
660 display_name = display_name.substr(0, kMaxDisplayChars - 2) +
"..";
664 ImVec2 name_size = ImGui::CalcTextSize(display_name.c_str());
665 ImVec2 name_pos = ImVec2(button_pos.x + (item_size - name_size.x) / 2,
666 button_pos.y + item_size - 26);
667 draw_list->AddText(name_pos,
668 ImGui::GetColorU32(theme.text_secondary_gray),
669 display_name.c_str());
672 std::string id_text = absl::StrFormat(
"%03X", obj_id);
673 ImVec2 id_size = ImGui::CalcTextSize(id_text.c_str());
674 ImVec2 id_pos = ImVec2(button_pos.x + (item_size - id_size.x) / 2,
675 button_pos.y + item_size - id_size.y - 2);
676 draw_list->AddText(id_pos, ImGui::GetColorU32(theme.text_primary),
680 if (ImGui::IsItemHovered()) {
681 ImGui::BeginTooltip();
682 ImGui::TextColored(ImVec4(1.0f, 0.9f, 0.4f, 1.0f),
"Object 0x%03X",
684 ImGui::Text(
"%s", full_name.c_str());
686 ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1.0f),
"Subtype %d",
689 ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f),
690 "Click to select for placement");
691 ImGui::TextColored(ImVec4(0.5f, 0.8f, 1.0f, 1.0f),
692 "Double-click to view details");
698 current_column = (current_column + 1) % columns;
703 ImGui::PushStyleColor(ImGuiCol_Header, IM_COL32(100, 180, 120, 255));
704 ImGui::PushStyleColor(ImGuiCol_HeaderHovered, IM_COL32(130, 210, 150, 255));
705 bool custom_open = ImGui::CollapsingHeader(
"Custom Objects",
706 ImGuiTreeNodeFlags_DefaultOpen);
707 ImGui::PopStyleColor(2);
719 for (
int obj_id : {0x31, 0x32}) {
720 int subtype_count = obj_manager.GetSubtypeCount(obj_id);
721 for (
int subtype = 0; subtype < subtype_count; ++subtype) {
725 ImGui::PushID(obj_id * 1000 + subtype);
729 ImVec2 button_size(item_size, item_size);
731 if (ImGui::Selectable(
"", is_selected,
732 ImGuiSelectableFlags_AllowDoubleClick,
738 if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
745 ImVec2 button_pos = ImGui::GetItemRectMin();
746 ImDrawList* draw_list = ImGui::GetWindowDrawList();
748 bool rendered =
false;
753 temp_obj.size_ = subtype;
759 ImU32 obj_color = IM_COL32(100, 180, 120, 255);
760 ImU32 darker_color = IM_COL32(60, 100, 70, 255);
762 draw_list->AddRectFilledMultiColor(
764 ImVec2(button_pos.x + item_size, button_pos.y + item_size),
765 darker_color, darker_color, obj_color, obj_color);
767 std::string symbol = (obj_id == 0x31) ?
"Trk" :
"Cus";
769 std::string sub_text = absl::StrFormat(
"%02X", subtype);
770 ImVec2 sub_size = ImGui::CalcTextSize(sub_text.c_str());
771 ImVec2 sub_pos(button_pos.x + (item_size - sub_size.x) / 2,
772 button_pos.y + (item_size - sub_size.y) / 2);
773 draw_list->AddText(sub_pos, IM_COL32(255, 255, 255, 220),
784 is_selected ? ImGui::GetColorU32(theme.dungeon_selection_primary)
785 : ImGui::GetColorU32(theme.panel_bg_darker);
786 float border_thickness = is_selected ? 3.0f : 1.0f;
789 ImVec2(button_pos.x + item_size, button_pos.y + item_size),
790 border_color, 0.0f, 0, border_thickness);
793 std::string id_text = absl::StrFormat(
"%02X:%02X", obj_id, subtype);
794 ImVec2 id_size = ImGui::CalcTextSize(id_text.c_str());
795 ImVec2 id_pos = ImVec2(button_pos.x + (item_size - id_size.x) / 2,
796 button_pos.y + item_size - id_size.y - 2);
797 draw_list->AddText(id_pos, ImGui::GetColorU32(theme.text_primary),
801 custom_col = (custom_col + 1) % columns;