From 13a9a9c9b157f7a00c475be9e4658d4fa50f27f5 Mon Sep 17 00:00:00 2001 From: Dregu Date: Sun, 25 Aug 2024 05:31:51 +0300 Subject: [PATCH] Add room warps --- ui.cpp | 23 ++++++++++++++++++++--- ui.h | 2 +- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/ui.cpp b/ui.cpp index 5bc9214..b18b9e7 100644 --- a/ui.cpp +++ b/ui.cpp @@ -1342,6 +1342,21 @@ void UI::DrawPlayer() { fmt::format("Warp ({})", ImGui::GetKeyChordName(keys["warp"])) .c_str())) doWarp = true; + ImGui::SeparatorText("Room warps"); + ImGui::PushID("RoomWarps"); + for (int m = 0; m < 5; ++m) { + ImGui::PushID(m); + for (int i = 0; i < 32; ++i) { + auto tile = GetNthTile(653, i, m); + if (!tile.has_value()) + break; + ImGui::PushID(i); + DrawSelectedTileRow(tile.value(), false); + ImGui::PopID(); + } + ImGui::PopID(); + } + ImGui::PopID(); ImGui::PopID(); } if (*Max::get().equipment() != 0 && *Max::get().item() == 0) { @@ -2153,9 +2168,11 @@ void UI::DrawSelectedTile(SelectedTile &tile) { ImGui::PopItemWidth(); } -void UI::DrawSelectedTileRow(SelectedTile &tile) { - DrawTileRow(*tile.tile); - ImGui::SameLine(0, 4); +void UI::DrawSelectedTileRow(SelectedTile &tile, bool editable) { + if (editable) { + DrawTileRow(*tile.tile); + ImGui::SameLine(0, 4); + } ImGui::Text("M:%d R:%02d,%02d T:%02d,%02d L:%s", tile.map, tile.room.x, tile.room.y, tile.pos.x, tile.pos.y, (tile.layer ? "BG" : "FG")); ImGui::SameLine(ImGui::GetContentRegionMax().x - 24.f * uiScale, 0); diff --git a/ui.h b/ui.h index 3ddb077..e70ae77 100644 --- a/ui.h +++ b/ui.h @@ -292,7 +292,7 @@ class UI { void DrawTile(Tile &tile); void DrawTileRow(Tile &tile); void DrawSelectedTile(SelectedTile &tile); - void DrawSelectedTileRow(SelectedTile &tile); + void DrawSelectedTileRow(SelectedTile &tile, bool editable = true); void DrawCustomKey(std::string name, GAME_INPUT i); void DrawUIKeys(); void KeyCapture();