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());
328 ImGui::Text(tr(
"ROM not loaded"));
333 ImGui::Text(tr(
"Entrances not loaded"));
337 if (show_properties) {
343 const bool properties_editable =
345 bool changed =
false;
348 if (!properties_editable) {
351 ImGui::BeginDisabled(!properties_editable);
352 if (ImGui::BeginTable(
"EntranceProps", 4, ImGuiTableFlags_Borders)) {
353 ImGui::TableSetupColumn(
"Core", ImGuiTableColumnFlags_WidthStretch);
354 ImGui::TableSetupColumn(
"Position", ImGuiTableColumnFlags_WidthStretch);
355 ImGui::TableSetupColumn(
"Camera", ImGuiTableColumnFlags_WidthStretch);
356 ImGui::TableSetupColumn(
"Scroll", ImGuiTableColumnFlags_WidthStretch);
357 ImGui::TableHeadersRow();
359 ImGui::TableNextRow();
360 ImGui::TableNextColumn();
361 ImGui::Text(tr(
"Entr ID: %04X"), current_entrance.entrance_id_);
366 ImGui::TableNextColumn();
372 ImGui::TableNextColumn();
379 ImGui::TableNextColumn();
385 ImGui::EndDisabled();
388 if (ImGui::CollapsingHeader(tr(
"Camera Boundaries"))) {
389 ImGui::Text(tr(
" North East South West"));
390 ImGui::BeginDisabled(!properties_editable);
391 ImGui::Text(tr(
"Quadrant "));
394 ¤t_entrance.camera_boundary_qn_, 40.f);
397 ¤t_entrance.camera_boundary_qe_, 40.f);
400 ¤t_entrance.camera_boundary_qs_, 40.f);
403 ¤t_entrance.camera_boundary_qw_, 40.f);
405 ImGui::Text(tr(
"Full Room "));
408 ¤t_entrance.camera_boundary_fn_, 40.f);
411 ¤t_entrance.camera_boundary_fe_, 40.f);
414 ¤t_entrance.camera_boundary_fs_, 40.f);
417 ¤t_entrance.camera_boundary_fw_, 40.f);
418 ImGui::EndDisabled();
437 if (ImGui::BeginTable(
"EntranceList", 3,
438 ImGuiTableFlags_ScrollY | ImGuiTableFlags_Borders |
439 ImGuiTableFlags_RowBg |
440 ImGuiTableFlags_Resizable)) {
441 ImGui::TableSetupColumn(
"ID", ImGuiTableColumnFlags_WidthFixed, 40.0f);
442 ImGui::TableSetupColumn(
"Room", ImGuiTableColumnFlags_WidthFixed, 50.0f);
443 ImGui::TableSetupColumn(
"Name");
444 ImGui::TableHeadersRow();
447 ImGuiListClipper clipper;
450 while (clipper.Step()) {
451 for (
int row = clipper.DisplayStart; row < clipper.DisplayEnd; ++row) {
453 std::string display_name;
455 if (i < kNumSpawnPoints) {
456 display_name = absl::StrFormat(
"Spawn Point %d", i);
458 int entrance_id = i - kNumSpawnPoints;
462 int room_id = (i < static_cast<int>(
entrances_->size()))
466 ImGui::TableNextRow();
467 ImGui::TableNextColumn();
470 snprintf(label,
sizeof(label),
"%02X", i);
472 ImGuiSelectableFlags_SpanAllColumns)) {
474 if (i <
static_cast<int>(
entrances_->size())) {
490 ImGui::TableNextColumn();
491 ImGui::Text(
"%03X", room_id);
493 ImGui::TableNextColumn();
494 ImGui::TextUnformatted(display_name.c_str());
574 std::vector<int> room_ids;
576 std::map<int, GroupInfo> groups;
580 std::string group_name =
"Unloaded";
582 size_t dungeon_index = 0;
584 project_, room_id, &dungeon_index)) {
585 key = -
static_cast<int>(dungeon_index) - 1;
588 key = loaded_room->blockset();
592 auto& g = groups[key];
594 g.room_ids.push_back(room_id);
598 if (ImGui::BeginChild(
"##GroupedRoomList", ImVec2(0, 0),
false,
599 ImGuiWindowFlags_None)) {
600 for (
auto& [key, group] : groups) {
602 snprintf(header,
sizeof(header),
"%s (%zu rooms)##grp%d",
603 group.name.c_str(), group.room_ids.size(), key);
607 std::find(group.room_ids.begin(), group.room_ids.end(),
610 ImGui::SetNextItemOpen(
616 if (ImGui::CollapsingHeader(header)) {
617 for (
int room_id : group.room_ids) {
618 std::string display_name =
621 snprintf(label,
sizeof(label),
"%03X %s##r%d", room_id,
622 display_name.c_str(), room_id);
625 if (ImGui::Selectable(label, is_current,
626 ImGuiSelectableFlags_AllowDoubleClick)) {
634 if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
650 ImGui::SetScrollHereY(0.5f);
655 if (ImGui::IsItemHovered() &&
rooms_) {
657 if (loaded_room !=
nullptr) {
658 ImGui::BeginTooltip();
659 ImGui::Text(
"%s", display_name.c_str());
660 ImGui::TextDisabled(tr(
"Blockset: %d | Palette: %d"),
661 loaded_room->blockset(),
662 loaded_room->palette());
663 auto& room = *loaded_room;
666 auto& bmp = room.GetCompositeBitmap(layer_mgr);
667 if (bmp.is_active() && bmp.texture() != 0) {
668 ImGui::Image((ImTextureID)(intptr_t)bmp.texture(),
::yaze::EventBus * event_bus()
Get the current EventBus instance.