From 3be64d0b268ab7ab3c0d51fd22d4815efe52ae9e Mon Sep 17 00:00:00 2001 From: scawful Date: Tue, 6 Aug 2024 01:56:49 -0400 Subject: [PATCH] fix item names bug in overworld editor --- src/app/editor/overworld_editor.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/app/editor/overworld_editor.cc b/src/app/editor/overworld_editor.cc index 64871849..62f0f92b 100644 --- a/src/app/editor/overworld_editor.cc +++ b/src/app/editor/overworld_editor.cc @@ -1,11 +1,9 @@ #include "overworld_editor.h" -#include "ImGuiFileDialog/ImGuiFileDialog.h" -#include "imgui/imgui.h" - #include #include +#include "ImGuiFileDialog/ImGuiFileDialog.h" #include "absl/container/flat_hash_map.h" #include "absl/status/status.h" #include "absl/status/statusor.h" @@ -25,6 +23,7 @@ #include "app/gui/zeml.h" #include "app/rom.h" #include "app/zelda3/overworld/overworld.h" +#include "imgui/imgui.h" namespace yaze { namespace app { @@ -883,8 +882,6 @@ void OverworldEditor::DrawOverworldItems() { // Get the item's bitmap and real X and Y positions if (item.room_map_id < 0x40 + (current_world_ * 0x40) && item.room_map_id >= (current_world_ * 0x40) && !item.deleted) { - std::string item_name = zelda3::overworld::kSecretItemNames[item.id]; - ow_map_canvas_.DrawRect(item.x_, item.y_, 16, 16, ImVec4(255, 0, 0, 150)); if (current_mode == EditingMode::ITEMS) { @@ -901,6 +898,12 @@ void OverworldEditor::DrawOverworldItems() { current_entity_ = &item; } } + std::string item_name = ""; + if (item.id < zelda3::overworld::kSecretItemNames.size()) { + item_name = zelda3::overworld::kSecretItemNames[item.id]; + } else { + item_name = absl::StrFormat("0x%02X", item.id); + } ow_map_canvas_.DrawText(item_name, item.x_, item.y_); } i++;