89 ImGui::Text(tr(
"ROM not loaded"));
93 if (show_room_id_input) {
113 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
124 if (ImGui::IsItemHovered()) {
126 tr(
"Toggle between flat list and dungeon-grouped view"));
128 ImGui::SameLine(0, 12);
131 const char* labels[] = {
"All",
"Sprites",
"Items",
"Objects"};
134 for (
int idx = 0; idx < 4; ++idx) {
138 std::optional<gui::StyleColorGuard> selected_guard;
140 selected_guard.emplace(ImGuiCol_Button,
141 ImGui::GetStyleColorVec4(ImGuiCol_ButtonActive));
143 if (ImGui::SmallButton(labels[idx])) {
158 std::optional<gui::StyleVarGuard> touch_pad_guard;
160 float touch_pad = std::max(
163 touch_pad_guard.emplace(ImGuiStyleVar_CellPadding,
164 ImVec2(ImGui::GetStyle().CellPadding.x, touch_pad));
174 if (ImGui::BeginTable(
"RoomList", 2,
175 ImGuiTableFlags_ScrollY | ImGuiTableFlags_Borders |
176 ImGuiTableFlags_RowBg |
177 ImGuiTableFlags_Resizable)) {
178 ImGui::TableSetupColumn(
"ID", ImGuiTableColumnFlags_WidthFixed, 40.0f);
179 ImGui::TableSetupColumn(
"Name");
180 ImGui::TableHeadersRow();
183 ImGuiListClipper clipper;
186 while (clipper.Step()) {
187 for (
int row = clipper.DisplayStart; row < clipper.DisplayEnd; ++row) {
189 std::string display_name =
192 ImGui::TableNextRow();
193 ImGui::TableNextColumn();
196 snprintf(label,
sizeof(label),
"%03X", room_id);
198 ImGuiSelectableFlags_SpanAllColumns |
199 ImGuiSelectableFlags_AllowDoubleClick)) {
208 if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
226 std::vector<gui::MenuItemSpec> items;
248 items.back().separator_after =
true;
250 tr(
"Copy Room ID"), absl::StrFormat(
"0x%03X", room_id)));
255 if (ImGui::IsItemHovered()) {
256 ImGui::BeginTooltip();
257 ImGui::Text(
"%s", display_name.c_str());
260 if (loaded_room !=
nullptr) {
261 ImGui::TextDisabled(tr(
"Blockset: %d | Palette: %d"),
262 loaded_room->blockset(),
263 loaded_room->palette());
268 if (bmp.is_active() && bmp.texture() != 0) {
269 ImGui::Image((ImTextureID)(intptr_t)bmp.texture(),
277 ImGui::TableNextColumn();
278 ImGui::TextUnformatted(display_name.c_str());
336 ImGui::Text(tr(
"ROM not loaded"));
341 ImGui::Text(tr(
"Entrances not loaded"));
345 if (show_properties) {
351 const bool properties_editable =
353 bool changed =
false;
356 if (!properties_editable) {
359 ImGui::BeginDisabled(!properties_editable);
360 if (ImGui::BeginTable(
"EntranceProps", 4, ImGuiTableFlags_Borders)) {
361 ImGui::TableSetupColumn(
"Core", ImGuiTableColumnFlags_WidthStretch);
362 ImGui::TableSetupColumn(
"Position", ImGuiTableColumnFlags_WidthStretch);
363 ImGui::TableSetupColumn(
"Camera", ImGuiTableColumnFlags_WidthStretch);
364 ImGui::TableSetupColumn(
"Scroll", ImGuiTableColumnFlags_WidthStretch);
365 ImGui::TableHeadersRow();
367 ImGui::TableNextRow();
368 ImGui::TableNextColumn();
369 ImGui::Text(tr(
"Entr ID: %04X"), current_entrance.entrance_id_);
374 ImGui::TableNextColumn();
380 ImGui::TableNextColumn();
387 ImGui::TableNextColumn();
393 ImGui::EndDisabled();
396 if (ImGui::CollapsingHeader(tr(
"Camera Boundaries"))) {
397 ImGui::Text(tr(
" North East South West"));
398 ImGui::BeginDisabled(!properties_editable);
399 ImGui::Text(tr(
"Quadrant "));
402 ¤t_entrance.camera_boundary_qn_, 40.f);
405 ¤t_entrance.camera_boundary_qe_, 40.f);
408 ¤t_entrance.camera_boundary_qs_, 40.f);
411 ¤t_entrance.camera_boundary_qw_, 40.f);
413 ImGui::Text(tr(
"Full Room "));
416 ¤t_entrance.camera_boundary_fn_, 40.f);
419 ¤t_entrance.camera_boundary_fe_, 40.f);
422 ¤t_entrance.camera_boundary_fs_, 40.f);
425 ¤t_entrance.camera_boundary_fw_, 40.f);
426 ImGui::EndDisabled();
433 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
443 if (ImGui::BeginTable(
"EntranceList", 3,
444 ImGuiTableFlags_ScrollY | ImGuiTableFlags_Borders |
445 ImGuiTableFlags_RowBg |
446 ImGuiTableFlags_Resizable)) {
447 ImGui::TableSetupColumn(
"ID", ImGuiTableColumnFlags_WidthFixed, 40.0f);
448 ImGui::TableSetupColumn(
"Room", ImGuiTableColumnFlags_WidthFixed, 50.0f);
449 ImGui::TableSetupColumn(
"Name");
450 ImGui::TableHeadersRow();
453 ImGuiListClipper clipper;
456 while (clipper.Step()) {
457 for (
int row = clipper.DisplayStart; row < clipper.DisplayEnd; ++row) {
459 std::string display_name;
461 if (i < kNumSpawnPoints) {
462 display_name = absl::StrFormat(
"Spawn Point %d", i);
464 int entrance_id = i - kNumSpawnPoints;
471 room_id = (*spawn_points_)[i].room_id;
472 }
else if (i <
static_cast<int>(
entrances_->size())) {
473 room_id = (*entrances_)[i].room_;
476 ImGui::TableNextRow();
477 ImGui::TableNextColumn();
480 snprintf(label,
sizeof(label),
"%c%02X",
481 i < kNumSpawnPoints ?
'S' :
'E',
482 i < kNumSpawnPoints ? i : i - kNumSpawnPoints);
484 ImGuiSelectableFlags_SpanAllColumns)) {
486 if (i <
static_cast<int>(
entrances_->size())) {
502 ImGui::TableNextColumn();
503 ImGui::Text(
"%03X", room_id);
505 ImGui::TableNextColumn();
506 ImGui::TextUnformatted(display_name.c_str());
586 std::vector<int> room_ids;
588 std::map<int, GroupInfo> groups;
592 std::string group_name =
"Unloaded";
594 size_t dungeon_index = 0;
596 project_, room_id, &dungeon_index)) {
597 key = -
static_cast<int>(dungeon_index) - 1;
600 key = loaded_room->blockset();
604 auto& g = groups[key];
606 g.room_ids.push_back(room_id);
610 if (ImGui::BeginChild(
"##GroupedRoomList", ImVec2(0, 0),
false,
611 ImGuiWindowFlags_None)) {
612 for (
auto& [key, group] : groups) {
614 snprintf(header,
sizeof(header),
"%s (%zu rooms)##grp%d",
615 group.name.c_str(), group.room_ids.size(), key);
619 std::find(group.room_ids.begin(), group.room_ids.end(),
622 ImGui::SetNextItemOpen(
628 if (ImGui::CollapsingHeader(header)) {
629 for (
int room_id : group.room_ids) {
630 std::string display_name =
633 snprintf(label,
sizeof(label),
"%03X %s##r%d", room_id,
634 display_name.c_str(), room_id);
637 if (ImGui::Selectable(label, is_current,
638 ImGuiSelectableFlags_AllowDoubleClick)) {
646 if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
662 ImGui::SetScrollHereY(0.5f);
667 if (ImGui::IsItemHovered() &&
rooms_) {
669 if (loaded_room !=
nullptr) {
670 ImGui::BeginTooltip();
671 ImGui::Text(
"%s", display_name.c_str());
672 ImGui::TextDisabled(tr(
"Blockset: %d | Palette: %d"),
673 loaded_room->blockset(),
674 loaded_room->palette());
679 if (bmp.is_active() && bmp.texture() != 0) {
680 ImGui::Image((ImTextureID)(intptr_t)bmp.texture(),
::yaze::EventBus * event_bus()
Get the current EventBus instance.