From 2443336f9d9e7042ce43404e4dd75e79335a9164 Mon Sep 17 00:00:00 2001 From: scawful Date: Tue, 20 Aug 2024 11:06:06 -0400 Subject: [PATCH] add GetLabel to ResourceLabelManager --- src/app/core/labeling.cc | 5 +++ src/app/core/labeling.h | 1 + src/app/editor/overworld/overworld_editor.cc | 34 ++------------------ 3 files changed, 9 insertions(+), 31 deletions(-) diff --git a/src/app/core/labeling.cc b/src/app/core/labeling.cc index 8198a752..32a925ca 100644 --- a/src/app/core/labeling.cc +++ b/src/app/core/labeling.cc @@ -154,6 +154,11 @@ void ResourceLabelManager::SelectableLabelWithNameEdit( } } +std::string ResourceLabelManager::GetLabel(const std::string& type, + const std::string& key) { + return labels_[type][key]; +} + std::string ResourceLabelManager::CreateOrGetLabel( const std::string& type, const std::string& key, const std::string& defaultValue) { diff --git a/src/app/core/labeling.h b/src/app/core/labeling.h index 8116620d..d7be52b5 100644 --- a/src/app/core/labeling.h +++ b/src/app/core/labeling.h @@ -38,6 +38,7 @@ struct ResourceLabelManager { void SelectableLabelWithNameEdit(bool selected, const std::string& type, const std::string& key, const std::string& defaultValue); + std::string GetLabel(const std::string& type, const std::string& key); std::string CreateOrGetLabel(const std::string& type, const std::string& key, const std::string& defaultValue); diff --git a/src/app/editor/overworld/overworld_editor.cc b/src/app/editor/overworld/overworld_editor.cc index 16b99c02..c22640ef 100644 --- a/src/app/editor/overworld/overworld_editor.cc +++ b/src/app/editor/overworld/overworld_editor.cc @@ -1118,38 +1118,8 @@ void OverworldEditor::DrawOverworldProperties() { SameLine(); properties_canvas_.UpdateInfoGrid(ImVec2(256, 256), 8, 1.0f, 32, 3); - static bool dark_world = false; - int world = dark_world ? 3 : 0; - static int current = 0; - static bool show_gfx_group = false; Checkbox("Show Gfx Group Editor", &show_gfx_group); - if (Checkbox("Dark World", &dark_world)) { - properties_canvas_.set_current_labels(current + world); - } - SameLine(); - if (Button("Area Graphics")) { - current = 0; - properties_canvas_.set_current_labels(current + world); - } - SameLine(); - if (Button("Area Palette")) { - current = 1; - properties_canvas_.set_current_labels(current + world); - } - if (Button("Sprite Graphics")) { - if (dark_world) { - properties_canvas_.set_current_labels(7); - } else { - properties_canvas_.set_current_labels(6); - } - } - SameLine(); - if (Button("Sprite Palette")) { - current = 2; - properties_canvas_.set_current_labels(current + world); - } - if (show_gfx_group) { gui::BeginWindowWithDisplaySettings("Gfx Group Editor", &show_gfx_group); status_ = gfx_group_editor_.Update(); @@ -1219,7 +1189,9 @@ absl::Status OverworldEditor::UpdateUsageStats() { if (BeginChild("UnusedSpritesetScroll", ImVec2(0, 0), true, ImGuiWindowFlags_HorizontalScrollbar)) { for (int i = 0; i < 0x81; i++) { - std::string str = absl::StrFormat("%#x", i); + auto entrance_name = rom()->resource_label()->GetLabel( + "Dungeon Entrance Names", core::UppercaseHexByte(i)); + std::string str = absl::StrFormat("%#x - %s", i, entrance_name); if (Selectable(str.c_str(), selected_entrance_ == i, overworld_.entrances().at(i).deleted ? ImGuiSelectableFlags_Disabled