85 ImGui::Text(tr(
"ROM not loaded"));
89 if (show_room_id_input) {
109 room_filter_.Draw(
"Filter", ImGui::GetContentRegionAvail().x);
119 if (ImGui::IsItemHovered()) {
121 tr(
"Toggle between flat list and dungeon-grouped view"));
123 ImGui::SameLine(0, 12);
126 const char* labels[] = {
"All",
"Sprites",
"Items",
"Objects"};
129 for (
int idx = 0; idx < 4; ++idx) {
134 ImGui::PushStyleColor(ImGuiCol_Button,
135 ImGui::GetStyleColorVec4(ImGuiCol_ButtonActive));
137 if (ImGui::SmallButton(labels[idx])) {
141 ImGui::PopStyleColor();
155 std::optional<gui::StyleVarGuard> touch_pad_guard;
157 float touch_pad = std::max(
160 touch_pad_guard.emplace(ImGuiStyleVar_CellPadding,
161 ImVec2(ImGui::GetStyle().CellPadding.x, touch_pad));
171 if (ImGui::BeginTable(
"RoomList", 2,
172 ImGuiTableFlags_ScrollY | ImGuiTableFlags_Borders |
173 ImGuiTableFlags_RowBg |
174 ImGuiTableFlags_Resizable)) {
175 ImGui::TableSetupColumn(
"ID", ImGuiTableColumnFlags_WidthFixed, 40.0f);
176 ImGui::TableSetupColumn(
"Name");
177 ImGui::TableHeadersRow();
180 ImGuiListClipper clipper;
183 while (clipper.Step()) {
184 for (
int row = clipper.DisplayStart; row < clipper.DisplayEnd; ++row) {
186 std::string display_name =
189 ImGui::TableNextRow();
190 ImGui::TableNextColumn();
193 snprintf(label,
sizeof(label),
"%03X", room_id);
195 ImGuiSelectableFlags_SpanAllColumns |
196 ImGuiSelectableFlags_AllowDoubleClick)) {
205 if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
222 if (ImGui::BeginPopupContextItem()) {
223 if (ImGui::MenuItem(tr(
"Open in Workbench"))) {
232 if (ImGui::MenuItem(tr(
"Open as Panel"))) {
243 snprintf(id_buf,
sizeof(id_buf),
"0x%03X", room_id);
244 if (ImGui::MenuItem(tr(
"Copy Room ID"))) {
245 ImGui::SetClipboardText(id_buf);
251 if (ImGui::IsItemHovered()) {
252 ImGui::BeginTooltip();
253 ImGui::Text(
"%s", display_name.c_str());
256 if (loaded_room !=
nullptr) {
257 ImGui::TextDisabled(tr(
"Blockset: %d | Palette: %d"),
258 loaded_room->blockset(),
259 loaded_room->palette());
260 auto& room = *loaded_room;
263 auto& bmp = room.GetCompositeBitmap(layer_mgr);
264 if (bmp.is_active() && bmp.texture() != 0) {
265 ImGui::Image((ImTextureID)(intptr_t)bmp.texture(),
273 ImGui::TableNextColumn();
274 ImGui::TextUnformatted(display_name.c_str());
331 ImGui::Text(tr(
"ROM not loaded"));
336 ImGui::Text(tr(
"Entrances not loaded"));
340 if (show_properties) {
346 const bool properties_editable =
348 bool changed =
false;
351 if (!properties_editable) {
354 ImGui::BeginDisabled(!properties_editable);
355 if (ImGui::BeginTable(
"EntranceProps", 4, ImGuiTableFlags_Borders)) {
356 ImGui::TableSetupColumn(
"Core", ImGuiTableColumnFlags_WidthStretch);
357 ImGui::TableSetupColumn(
"Position", ImGuiTableColumnFlags_WidthStretch);
358 ImGui::TableSetupColumn(
"Camera", ImGuiTableColumnFlags_WidthStretch);
359 ImGui::TableSetupColumn(
"Scroll", ImGuiTableColumnFlags_WidthStretch);
360 ImGui::TableHeadersRow();
362 ImGui::TableNextRow();
363 ImGui::TableNextColumn();
364 ImGui::Text(tr(
"Entr ID: %04X"), current_entrance.entrance_id_);
369 ImGui::TableNextColumn();
375 ImGui::TableNextColumn();
382 ImGui::TableNextColumn();
388 ImGui::EndDisabled();
391 if (ImGui::CollapsingHeader(tr(
"Camera Boundaries"))) {
392 ImGui::Text(tr(
" North East South West"));
393 ImGui::BeginDisabled(!properties_editable);
394 ImGui::Text(tr(
"Quadrant "));
397 ¤t_entrance.camera_boundary_qn_, 40.f);
400 ¤t_entrance.camera_boundary_qe_, 40.f);
403 ¤t_entrance.camera_boundary_qs_, 40.f);
406 ¤t_entrance.camera_boundary_qw_, 40.f);
408 ImGui::Text(tr(
"Full Room "));
411 ¤t_entrance.camera_boundary_fn_, 40.f);
414 ¤t_entrance.camera_boundary_fe_, 40.f);
417 ¤t_entrance.camera_boundary_fs_, 40.f);
420 ¤t_entrance.camera_boundary_fw_, 40.f);
421 ImGui::EndDisabled();
440 if (ImGui::BeginTable(
"EntranceList", 3,
441 ImGuiTableFlags_ScrollY | ImGuiTableFlags_Borders |
442 ImGuiTableFlags_RowBg |
443 ImGuiTableFlags_Resizable)) {
444 ImGui::TableSetupColumn(
"ID", ImGuiTableColumnFlags_WidthFixed, 40.0f);
445 ImGui::TableSetupColumn(
"Room", ImGuiTableColumnFlags_WidthFixed, 50.0f);
446 ImGui::TableSetupColumn(
"Name");
447 ImGui::TableHeadersRow();
450 ImGuiListClipper clipper;
453 while (clipper.Step()) {
454 for (
int row = clipper.DisplayStart; row < clipper.DisplayEnd; ++row) {
456 std::string display_name;
458 if (i < kNumSpawnPoints) {
459 display_name = absl::StrFormat(
"Spawn Point %d", i);
461 int entrance_id = i - kNumSpawnPoints;
467 room_id = (*spawn_points_)[i].room_id;
468 }
else if (i <
static_cast<int>(
entrances_->size())) {
469 room_id = (*entrances_)[i].room_;
472 ImGui::TableNextRow();
473 ImGui::TableNextColumn();
476 snprintf(label,
sizeof(label),
"%02X", i);
478 ImGuiSelectableFlags_SpanAllColumns)) {
480 if (i <
static_cast<int>(
entrances_->size())) {
496 ImGui::TableNextColumn();
497 ImGui::Text(
"%03X", room_id);
499 ImGui::TableNextColumn();
500 ImGui::TextUnformatted(display_name.c_str());
580 std::vector<int> room_ids;
582 std::map<int, GroupInfo> groups;
586 std::string group_name =
"Unloaded";
588 size_t dungeon_index = 0;
590 project_, room_id, &dungeon_index)) {
591 key = -
static_cast<int>(dungeon_index) - 1;
594 key = loaded_room->blockset();
598 auto& g = groups[key];
600 g.room_ids.push_back(room_id);
604 if (ImGui::BeginChild(
"##GroupedRoomList", ImVec2(0, 0),
false,
605 ImGuiWindowFlags_None)) {
606 for (
auto& [key, group] : groups) {
608 snprintf(header,
sizeof(header),
"%s (%zu rooms)##grp%d",
609 group.name.c_str(), group.room_ids.size(), key);
613 std::find(group.room_ids.begin(), group.room_ids.end(),
616 ImGui::SetNextItemOpen(
622 if (ImGui::CollapsingHeader(header)) {
623 for (
int room_id : group.room_ids) {
624 std::string display_name =
627 snprintf(label,
sizeof(label),
"%03X %s##r%d", room_id,
628 display_name.c_str(), room_id);
631 if (ImGui::Selectable(label, is_current,
632 ImGuiSelectableFlags_AllowDoubleClick)) {
640 if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
656 ImGui::SetScrollHereY(0.5f);
661 if (ImGui::IsItemHovered() &&
rooms_) {
663 if (loaded_room !=
nullptr) {
664 ImGui::BeginTooltip();
665 ImGui::Text(
"%s", display_name.c_str());
666 ImGui::TextDisabled(tr(
"Blockset: %d | Palette: %d"),
667 loaded_room->blockset(),
668 loaded_room->palette());
669 auto& room = *loaded_room;
672 auto& bmp = room.GetCompositeBitmap(layer_mgr);
673 if (bmp.is_active() && bmp.texture() != 0) {
674 ImGui::Image((ImTextureID)(intptr_t)bmp.texture(),
::yaze::EventBus * event_bus()
Get the current EventBus instance.