From a2984f2ce73fccf2faeac0ff65ec5704283baed1 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 7 Nov 2026 14:41:56 +0000 Subject: [PATCH] Maintenance: Aliased globals, CNavigationManager group: 25 GLOBAL IDs (gl_24608..gl_24626, gl_24632, gl_24967, gl_25081, gl_25082, gl Batch #14697 by ragnarok-clanker: no function's compiled code changes; checked with 21 compiled unit(s), including every includer of Source/UI/Navigation/UINavigationV4Wnd.h, Source/UI/Window/UINavigationWnd.h. --- Source/Client/Mode/GameModePackets.cpp | 5 +- Source/UI/Navigation/UINavigationV4Wnd.h | 8 -- Source/UI/Shortcuts/UIShortCutWnd.cpp | 2 +- Source/UI/Window/UINavigationWnd.cpp | 137 ++++++++-------------- Source/UI/Window/UINavigationWnd.h | 13 --- Source/UI/Window/UIRoMapWnd.cpp | 6 +- Source/UI/Window/UIWindow.cpp | 143 +++++++++-------------- Source/UI/Window/UIWindowMgr.cpp | 10 +- Source/UI/Window/WindowMgrState.cpp | 3 +- 9 files changed, 116 insertions(+), 211 deletions(-) diff --git a/Source/Client/Mode/GameModePackets.cpp b/Source/Client/Mode/GameModePackets.cpp index 672d84ae7..7f4ae97b6 100644 --- a/Source/Client/Mode/GameModePackets.cpp +++ b/Source/Client/Mode/GameModePackets.cpp @@ -1363,15 +1363,12 @@ __declspec(noinline) void CGameMode::ReceiveUnknown173A5BC(const unsigned char* } } -// GLOBAL: gl_24967 -int g_unknown16FC588; - // OFFSET: 0x00D7A0B0 // FUNCTION: fn_22186 __declspec(noinline) void CGameMode::ReceiveUnknown16FC588(const unsigned char* packet) { const signed char value = *reinterpret_cast(packet + 2); if (value != 1 && value != 2) { - g_unknown16FC588 = 0; + g_navigationManager.unknown_1280 = 0; } } diff --git a/Source/UI/Navigation/UINavigationV4Wnd.h b/Source/UI/Navigation/UINavigationV4Wnd.h index dd73582dd..db6d915b7 100644 --- a/Source/UI/Navigation/UINavigationV4Wnd.h +++ b/Source/UI/Navigation/UINavigationV4Wnd.h @@ -103,13 +103,5 @@ public: /* 00B4 */ UIListBox_NaviSearch* routeList; }; -extern int g_navigationTab; -extern int g_navigationRoadIcon; -extern CTexture* g_navigationMapTexture; -extern std::string g_navigationText0; -extern std::string g_navigationText1; -extern std::string g_navigationText2; -extern std::string g_navigationText3; -extern std::string g_navigationText4; #endif diff --git a/Source/UI/Shortcuts/UIShortCutWnd.cpp b/Source/UI/Shortcuts/UIShortCutWnd.cpp index ae539b0bc..a096c0416 100644 --- a/Source/UI/Shortcuts/UIShortCutWnd.cpp +++ b/Source/UI/Shortcuts/UIShortCutWnd.cpp @@ -665,7 +665,7 @@ void UIRoMapWnd::Slot31(int x, int y) { name.resize(name.size() - 4); } - g_navigationMinimized = false; + g_navigationManager.unknown_1254 = false; g_navigationManager.SearchNavigation(name, 0, false); if (g_windowMgr.window_4F174) { static_cast(g_windowMgr.window_4F174)->SelectRoute(0); diff --git a/Source/UI/Window/UINavigationWnd.cpp b/Source/UI/Window/UINavigationWnd.cpp index bcee3d91f..eceb5110f 100644 --- a/Source/UI/Window/UINavigationWnd.cpp +++ b/Source/UI/Window/UINavigationWnd.cpp @@ -29,57 +29,12 @@ #include #include -// GLOBAL: gl_24609 -bool g_navigationMinimized; - -// GLOBAL: gl_24610 -int g_navigationMode; - -// GLOBAL: gl_24608 -bool g_navigationHidden; - -// GLOBAL: gl_24613 -bool g_navigationFilter; - -// GLOBAL: gl_25095 -bool g_unknown16FC585; - -// GLOBAL: gl_25096 -bool g_unknown16FC586; - -// GLOBAL: gl_24612 -int g_navigationSearchType; - -// GLOBAL: gl_25130 -std::string g_navigationSearchText; - -// GLOBAL: gl_24614 -int g_navigationActiveLabel; - -// GLOBAL: gl_25081 -int g_navigationMapCellX; - -// GLOBAL: gl_25082 -int g_navigationMapCellY; - // GLOBAL: gl_25083 float g_navigationPointScale = 0.0078125f; // GLOBAL: gl_25084 float g_navigationMarkerScale = 0.453125f; -// GLOBAL: gl_24616 -CActRes* g_navigationActions; - -// GLOBAL: gl_24617 -CSprRes* g_navigationSprites; - -// GLOBAL: gl_24615 -std::vector g_navigationPoints; - -// GLOBAL: gl_24618 -std::vector g_navigationLabels; - // OFFSET: 0x00921A70 // FUNCTION: fn_12643 void UINavigationWnd::Slot15(int width, int height) { @@ -185,7 +140,7 @@ void UINavigationWnd::Slot15(int width, int height) { path = base; this->unknown_0118->SetImages((path + "checkbox_1.bmp").c_str(), (path + "checkbox_0.bmp").c_str(), LookupMessage(0x8A3)); this->unknown_0118->Move(-1000, -1000); - this->unknown_0118->SetChecked(g_unknown16FC585); + this->unknown_0118->SetChecked(g_navigationManager.unknown_127D); this->unknown_0118->SetTooltip(LookupMessage(0x8A4)); this->AddChild(this->unknown_0118); @@ -194,7 +149,7 @@ void UINavigationWnd::Slot15(int width, int height) { path = base; this->unknown_0114->SetImages((path + "checkbox_1.bmp").c_str(), (path + "checkbox_0.bmp").c_str(), LookupMessage(0x8A5)); this->unknown_0114->Move(-1000, -1000); - this->unknown_0114->SetChecked(g_navigationFilter); + this->unknown_0114->SetChecked(g_navigationManager.unknown_127C); this->unknown_0114->SetTooltip(LookupMessage(0x8A6)); this->AddChild(this->unknown_0114); @@ -203,7 +158,7 @@ void UINavigationWnd::Slot15(int width, int height) { path = base; this->unknown_011C->SetImages((path + "checkbox_1.bmp").c_str(), (path + "checkbox_0.bmp").c_str(), LookupMessage(0x8A7)); this->unknown_011C->Move(-1000, -1000); - this->unknown_011C->SetChecked(g_unknown16FC586); + this->unknown_011C->SetChecked(g_navigationManager.unknown_127E); this->unknown_011C->SetTooltip(LookupMessage(0x8A8)); this->AddChild(this->unknown_011C); } @@ -226,9 +181,9 @@ void UINavigationWnd::LayoutTabs() { this->m_searchFooter->Move(-1000, -1000); const int x = this->geometry.width - 222; - if (!g_navigationMinimized) { + if (!g_navigationManager.unknown_1254) { UIWindow* footer; - if (g_navigationTab == 1) { + if (g_navigationManager.unknown_125C == 1) { this->m_searchPanel->Move(x, 37); this->m_searchPanel->Invalidate(); footer = this->m_searchFooter; @@ -246,7 +201,7 @@ void UINavigationWnd::LayoutTabs() { // OFFSET: 0x0093DB80 // FUNCTION: fn_12771 void UINavigationWnd::RefreshHeaderTexts(int mode) { - if (g_navigationMinimized) { + if (g_navigationManager.unknown_1254) { if (mode == 2) { char text[260]; char saved[260]; @@ -275,7 +230,7 @@ void UINavigationWnd::RefreshHeaderTexts(int mode) { // FUNCTION: fn_12772 void UINavigationWnd::RefreshWorldMapMarks() { g_worldViewMgr.ClearMarks(); - if (g_navigationMode == 2) { + if (g_navigationManager.unknown_1258 == 2) { std::string name; for (int index = 0; index < g_navigationManager.NodeCount(); ++index) { CNavi_Link* node = g_navigationManager.GetNode(index); @@ -333,7 +288,7 @@ void UINavigationWnd::RefreshRouteList() { this->m_searchPanel->Invalidate(); const int nodeCount = g_navigationManager.NodeCount(); - if (g_navigationMode != 2) { + if (g_navigationManager.unknown_1258 != 2) { return; } @@ -468,7 +423,7 @@ void UINavigationWnd::RefreshRouteList() { // OFFSET: 0x0093EB60 // FUNCTION: fn_12776 void UINavigationWnd::ApplyMinimized() { - if (g_navigationMinimized) { + if (g_navigationManager.unknown_1254) { this->Resize(134, 61); int x = this->geometry.x; int y = this->geometry.y; @@ -570,7 +525,7 @@ void UINavigationWnd::Slot11() { void UINavigationWnd::Paint() { this->DrawTitleBar(true, this->m_title.c_str(), 0); this->DrawPanelBackground(0x11, 0, ""); - if (g_navigationMinimized) { + if (g_navigationManager.unknown_1254) { this->DrawTextAt(6, 20, this->m_subtitle.c_str(), 0, 0, 12, 0, 0, 0); return; } @@ -579,13 +534,13 @@ void UINavigationWnd::Paint() { return; } - int mapCellY = g_navigationMapCellY; - int mapCellX = g_navigationMapCellX; + int mapCellY = g_navigationManager.unknown_1290; + int mapCellX = g_navigationManager.unknown_128C; const int targetType = g_navigationManager.GetCurrentTarget().type; int size = 0x80; this->FillRegion(6, 0x25, 0x82, 0x82, 0x646464); - if (g_navigationActiveLabel == 2) { + if (g_navigationManager.unknown_1284 == 2) { int markerSize = size; if (targetType == 2) { markerSize = size - 0x3D; @@ -597,28 +552,28 @@ void UINavigationWnd::Paint() { } else if (targetType == 3) { size = 0x20; } - this->DrawActionSprite(g_navigationSprites, g_navigationActions, 7, 0x26, markerSize, 0x80, 0x5dc, true, nullptr); + this->DrawActionSprite(g_navigationManager.unknown_12A4, g_navigationManager.unknown_12A0, 7, 0x26, markerSize, 0x80, 0x5dc, true, nullptr); } const int mapX = 0x87 - size; const int mapY = 0xA6 - size; this->FillRegion(mapX, mapY, size, size, 0); - if (g_navigationMapTexture != nullptr) { - const float scale = static_cast(size) / static_cast(g_navigationMapTexture->Width()); + if (g_navigationManager.unknown_1288 != nullptr) { + const float scale = static_cast(size) / static_cast(g_navigationManager.unknown_1288->Width()); this->geometry.surface->DrawScaledSurface( - mapX, mapY, size, size, g_navigationMapTexture, g_navigationMapTexture->Width(), g_navigationMapTexture->Height(), scale, scale, 0xFFFFFFFFu, false, 0, 0, 0, + mapX, mapY, size, size, g_navigationManager.unknown_1288, g_navigationManager.unknown_1288->Width(), g_navigationManager.unknown_1288->Height(), scale, scale, 0xFFFFFFFFu, false, 0, 0, 0, 0 ); } bool drawCrosshair = true; - if (g_navigationMode == 2) { + if (g_navigationManager.unknown_1258 == 2) { if (g_navigationManager.IsCurrentTarget(g_session.m_navigationPlayerMap)) { - if (g_navigationTab == 1) { + if (g_navigationManager.unknown_125C == 1) { drawCrosshair = false; } const float scale = static_cast(size) * g_navigationPointScale; - for (const NaviCell& point : g_navigationPoints) { + for (const NaviCell& point : g_navigationManager.cells) { this->FillRegion(static_cast(point.x * scale + mapX), static_cast(point.y * scale + mapY), 2, 2, 0x00F0F00A); } @@ -644,14 +599,14 @@ void UINavigationWnd::Paint() { this->FillRegion(mapX + mapCellX - 1, mapY + mapCellY - 1, 2, 2, 0xFFFF); } - const int activeLabel = g_navigationActiveLabel; - const int labelCount = static_cast(g_navigationLabels.size()); + const int activeLabel = g_navigationManager.unknown_1284; + const int labelCount = static_cast(g_navigationManager.routeLines.size()); for (int index = 0; index < labelCount; ++index) { - if (g_navigationLabels[index].kind == activeLabel) { - const int x = g_navigationLabels[index].x; - const int y = g_navigationLabels[index].y; - this->DrawTextAt(x + 1, y + 1, g_navigationLabels[index].text.c_str(), 0, 0, 12, 0x1E1E1E, 0, 0); - this->DrawTextAt(x, y, g_navigationLabels[index].text.c_str(), 0, 0, 12, 0xE6E6E6, 0, 0); + if (g_navigationManager.routeLines[index].kind == activeLabel) { + const int x = g_navigationManager.routeLines[index].x; + const int y = g_navigationManager.routeLines[index].y; + this->DrawTextAt(x + 1, y + 1, g_navigationManager.routeLines[index].text.c_str(), 0, 0, 12, 0x1E1E1E, 0, 0); + this->DrawTextAt(x, y, g_navigationManager.routeLines[index].text.c_str(), 0, 0, 12, 0xE6E6E6, 0, 0); } } } @@ -694,7 +649,7 @@ int UINavigationWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argume } case 0x141: if (this->m_titleBar->Length() != 0) { - g_navigationSearchText = this->m_titleBar->Text(); + g_navigationManager.unknown_1264 = this->m_titleBar->Text(); g_navigationManager.RefreshSearch(); this->SendMsg(this, 6, 0xBE, 0, 0, 0); if (g_windowMgr.modal) { @@ -720,16 +675,16 @@ int UINavigationWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argume } break; case 0x1AD: - if (!g_navigationMinimized && this->m_saved->minimized) { + if (!g_navigationManager.unknown_1254 && this->m_saved->minimized) { const int targetType = g_navigationManager.GetCurrentTarget().type; if (targetType != 1 && targetType != 6 && targetType != 0) { - if (g_navigationActiveLabel == 1) { - g_navigationActiveLabel = 2; + if (g_navigationManager.unknown_1284 == 1) { + g_navigationManager.unknown_1284 = 2; this->Invalidate(); return 0; } - if (g_navigationActiveLabel == 2) { - g_navigationActiveLabel = 1; + if (g_navigationManager.unknown_1284 == 2) { + g_navigationManager.unknown_1284 = 1; } this->Invalidate(); return 0; @@ -742,16 +697,16 @@ int UINavigationWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argume this->Invalidate(); return 0; case 0xCA: - g_navigationMinimized = !g_navigationMinimized; + g_navigationManager.unknown_1254 = !g_navigationManager.unknown_1254; this->ApplyMinimized(); - this->RefreshHeaderTexts(g_navigationMode); - if (g_navigationMinimized && g_windowMgr.modal) { + this->RefreshHeaderTexts(g_navigationManager.unknown_1258); + if (g_navigationManager.unknown_1254 && g_windowMgr.modal) { static_cast(g_windowMgr.modal)->UpdateNavigationButtons(); return 0; } break; case 0xC9: - if (g_navigationMode == 2) { + if (g_navigationManager.unknown_1258 == 2) { const int response = g_windowMgr.Confirm(LookupMessage(0x8BF), 2, true, false, 0, "Message", 280, 120, 0); if (response != 0xBB) { break; @@ -762,10 +717,10 @@ int UINavigationWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argume g_worldViewMgr.ClearLevels(); g_worldViewMgr.ResetSelection(); g_navigationManager.Reset(true); - g_navigationMinimized = false; - g_navigationHidden = false; + g_navigationManager.unknown_1254 = false; + g_navigationManager.unknown_1248 = false; if (g_windowMgr.modal) { - g_navigationMinimized = true; + g_navigationManager.unknown_1254 = true; static_cast(g_windowMgr.modal)->UpdateNavigationButtons(); return 0; } @@ -773,11 +728,11 @@ int UINavigationWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argume g_windowMgr.window_4F174 = nullptr; return 0; case 0xBD: - g_navigationTab = 1; + g_navigationManager.unknown_125C = 1; this->LayoutTabs(); return 0; case 0xBE: - g_navigationTab = 0; + g_navigationManager.unknown_125C = 0; this->LayoutTabs(); return 0; case 0xBF: { @@ -810,15 +765,15 @@ int UINavigationWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argume } case 0xD5: if (sender == this->unknown_0114) { - g_navigationFilter = argument2 != 0; + g_navigationManager.unknown_127C = argument2 != 0; return 0; } if (sender == this->unknown_0118) { - g_unknown16FC585 = argument2 != 0; + g_navigationManager.unknown_127D = argument2 != 0; return 0; } if (sender == this->unknown_011C) { - g_unknown16FC586 = argument2 != 0; + g_navigationManager.unknown_127E = argument2 != 0; return 0; } break; @@ -849,7 +804,7 @@ int UINavigationWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argume break; case 0x27: if (this->unknown_00EC == sender) { - g_navigationSearchType = static_cast(argument1); + g_navigationManager.unknown_1260 = static_cast(argument1); this->Invalidate(); if (g_replayAnimationScaling != 0) { this->unknown_00EC->SendMsg(nullptr, 0x39, argument1, 0, 0, 0); diff --git a/Source/UI/Window/UINavigationWnd.h b/Source/UI/Window/UINavigationWnd.h index dedf93188..ed10704c8 100644 --- a/Source/UI/Window/UINavigationWnd.h +++ b/Source/UI/Window/UINavigationWnd.h @@ -27,19 +27,6 @@ struct NavigationWndInfo { /* 0010 */ bool minimized; }; -extern bool g_navigationMinimized; -extern int g_navigationMode; -extern bool g_navigationHidden; -extern CActRes* g_navigationActions; -extern CSprRes* g_navigationSprites; -extern bool g_unknown16FC585; -extern bool g_unknown16FC586; -extern std::string g_navigationSearchText; -extern int g_navigationActiveLabel; -extern std::vector g_navigationPoints; -extern std::vector g_navigationLabels; -extern bool g_navigationFilter; -extern int g_navigationSearchType; class UINavigationWnd : public UIFrameWnd { public: diff --git a/Source/UI/Window/UIRoMapWnd.cpp b/Source/UI/Window/UIRoMapWnd.cpp index 6589327da..7cdfe8243 100644 --- a/Source/UI/Window/UIRoMapWnd.cpp +++ b/Source/UI/Window/UIRoMapWnd.cpp @@ -83,7 +83,7 @@ void UIRoMapWnd::ResetKafraBounds() { // FUNCTION: fn_12634 void UIRoMapWnd::UpdateNavigationButtons() { UIWindow** buttons = reinterpret_cast(reinterpret_cast(this) + 0x20C); - if (g_windowMgr.window_4F174 != nullptr && !g_navigationMinimized) { + if (g_windowMgr.window_4F174 != nullptr && !g_navigationManager.unknown_1254) { buttons[0]->Move(-100, -100); buttons[1]->Move(-100, -100); buttons[2]->Move(-100, -100); @@ -91,7 +91,7 @@ void UIRoMapWnd::UpdateNavigationButtons() { buttons[0]->Move(335, 0); buttons[1]->Move(375, 3); buttons[2]->Move(131, 0); - g_navigationHidden = true; + g_navigationManager.unknown_1248 = true; } this->Invalidate(); @@ -766,7 +766,7 @@ int UIRoMapWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argument1, if (name.size() > 4) { name.resize(name.size() - 4); } - g_navigationMinimized = false; + g_navigationManager.unknown_1254 = false; g_navigationManager.SearchNavigation(name, 0, false); if (g_windowMgr.LookupWindow(203)) { static_cast(g_windowMgr.window_4F174)->SelectRoute(0); diff --git a/Source/UI/Window/UIWindow.cpp b/Source/UI/Window/UIWindow.cpp index 3eabcd224..6510bfdc0 100644 --- a/Source/UI/Window/UIWindow.cpp +++ b/Source/UI/Window/UIWindow.cpp @@ -130,27 +130,6 @@ inline std::uint32_t WindowGeometry::Color() { // GLOBAL: gl_24364 std::uint32_t g_windowUid = 0xFFFFFFFFu; -// GLOBAL: gl_24611 -int g_navigationTab; - -// GLOBAL: gl_25449 -int g_navigationSelectedNode; - -// GLOBAL: gl_24621 -std::string g_navigationText0; - -// GLOBAL: gl_24622 -std::string g_navigationText1; - -// GLOBAL: gl_24623 -std::string g_navigationText2; - -// GLOBAL: gl_24624 -std::string g_navigationText3; - -// GLOBAL: gl_24625 -std::string g_navigationText4; - // OFFSET: 0x005C2260 // FUNCTION: fn_03528 int __fastcall sub_5C2260(const int* object) { @@ -175,12 +154,6 @@ int __fastcall sub_5C22F0(const int* object) { return object[9]; } -// GLOBAL: gl_24626 -int g_navigationRoadIcon; - -// GLOBAL: gl_24632 -CTexture* g_navigationMapTexture; - // OFFSET: 0x00A79A90 // FUNCTION: fn_16914 UIWindow::UIWindow(unsigned char cached) @@ -1959,11 +1932,11 @@ bool UINavigationV4Wnd::ClearRouteTexts() { // OFFSET: 0x005C33E0 // FUNCTION: fn_03557 void UINavigationV4Wnd::DrawMapTexture(int x, int y, int size) { - if (g_navigationMapTexture) { + if (g_navigationManager.unknown_1288) { this->FillRegion(x, y, size, size, 0); - const float scale = static_cast(size) / static_cast(g_navigationMapTexture->Width()); + const float scale = static_cast(size) / static_cast(g_navigationManager.unknown_1288->Width()); this->geometry.surface->DrawScaledSurface( - x, y, size, size, g_navigationMapTexture, g_navigationMapTexture->Width(), g_navigationMapTexture->Height(), scale, scale, 0xFFFFFFFFu, false, 0, 0, 0, + x, y, size, size, g_navigationManager.unknown_1288, g_navigationManager.unknown_1288->Width(), g_navigationManager.unknown_1288->Height(), scale, scale, 0xFFFFFFFFu, false, 0, 0, 0, 0 ); } @@ -2137,7 +2110,7 @@ void UIPrivateAirplaneWnd::Paint() { // OFFSET: 0x005C72A0 // FUNCTION: fn_03604 void UINavigationV4Wnd::Slot19() { - if (g_navigationTab == 2) { + if (g_navigationManager.unknown_125C == 2) { this->Invalidate(); } } @@ -2301,7 +2274,7 @@ void UINavigationV4Wnd::Slot15(int, int) { UIBitmapButton* roadIconButton = new UIBitmapButton(); this->unknown_00C8 = roadIconButton; - this->SetRoadIcon(g_navigationRoadIcon); + this->SetRoadIcon(g_navigationManager.viewIcon); roadIconButton->SetSize(roadIconButton->BitmapWidth(), roadIconButton->BitmapHeight()); roadIconButton->SetId(189); roadIconButton->SetTooltip(LookupMessage(0x0C8B)); @@ -2340,7 +2313,7 @@ void UINavigationV4Wnd::Slot15(int, int) { filterCheck->SetSize(110, 12); filterCheck->SetImages("유저인터페이스\\checkbox_1.bmp", "유저인터페이스\\checkbox_0.bmp", "service"); filterCheck->SetId(213); - filterCheck->SetChecked(g_navigationFilter); + filterCheck->SetChecked(g_navigationManager.unknown_127C); filterCheck->SetTooltip(LookupMessage(0x0C8C)); this->AddChild(filterCheck); @@ -2448,7 +2421,7 @@ void UINavigationV4Wnd::Slot15(int, int) { searchType->AddOption(LookupMessage(0x089F), 0); searchType->AddOption(LookupMessage(0x08A0), 0); searchType->AddOption(LookupMessage(0x08A1), 0); - searchType->Select(g_navigationSearchType); + searchType->Select(g_navigationManager.unknown_1260); this->RefreshLayout(); } @@ -2471,16 +2444,16 @@ void UINavigationroadiconWnd::Slot15(int, int) { // OFFSET: 0x005C62F0 // FUNCTION: fn_03588 void UINavigationV4Wnd::Paint() { - if (g_navigationMinimized == true) { + if (g_navigationManager.unknown_1254 == true) { DrawFilledRoundedBorder(*this, 0, 0, 0x86, 0x3d, 0xffffff); DrawFilledRoundedBorder(*this, 1, 0x11, 0x84, 0x2b, 0); this->DrawTextAt(3, 3, LookupMessage(0x8ad), 0, 0, 12, 0, 0, 0); - if (g_navigationText1.size() != 0) { + if (g_navigationManager.destinationText.size() != 0) { this->DrawBitmap( 2, 0x12, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\navigation_interface3\\ico_destination.bmp"))), true ); - this->DrawTextAt(5, 0x15, g_navigationText3.c_str(), 0, 0, 12, 0xffffff, 1, 0); - this->DrawTextAt(5, 0x28, g_navigationText4.c_str(), 0, 0, 12, 0xffffff, 1, 0); + this->DrawTextAt(5, 0x15, g_navigationManager.selectedNodeText.c_str(), 0, 0, 12, 0xffffff, 1, 0); + this->DrawTextAt(5, 0x28, g_navigationManager.subDestinationText.c_str(), 0, 0, 12, 0xffffff, 1, 0); } return; } @@ -2493,22 +2466,22 @@ void UINavigationV4Wnd::Paint() { static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\navigation_interface3\\bg_down.bmp"))), false ); - if (g_navigationMode == 2 && g_navigationTab == 1) { + if (g_navigationManager.unknown_1258 == 2 && g_navigationManager.unknown_125C == 1) { this->FillRegion(1, 0x2c, 0x10e, 0x10e, 0xcccccc); this->DrawMapTexture(3, 0x2e, 0x10a); - this->DrawTextAt(10, 0x30, g_navigationText0.c_str(), 0, 0, 12, 0xffffff, 1, 0); - this->DrawTextAt(10, 0x44, g_navigationText1.c_str(), 0, 0, 12, 0xffffff, 1, 0); - this->DrawTextAt(10, this->geometry.height - 0x2a, g_navigationText2.c_str(), 0, 0, 12, 0xffffff, 1, 0 + this->DrawTextAt(10, 0x30, g_navigationManager.destinationTitle.c_str(), 0, 0, 12, 0xffffff, 1, 0); + this->DrawTextAt(10, 0x44, g_navigationManager.destinationText.c_str(), 0, 0, 12, 0xffffff, 1, 0); + this->DrawTextAt(10, this->geometry.height - 0x2a, g_navigationManager.routeText.c_str(), 0, 0, 12, 0xffffff, 1, 0 ); - if (g_navigationPoints.begin() != g_navigationPoints.end()) { - for (const NaviCell& point : g_navigationPoints) { + if (g_navigationManager.cells.begin() != g_navigationManager.cells.end()) { + for (const NaviCell& point : g_navigationManager.cells) { this->FillRegion( static_cast(point.x * 2.078125f + 3.0f), static_cast(point.y * 2.078125f + 46.0f), 2, 2, 0xf0f00a ); } - const NaviCell& last = g_navigationPoints.back(); + const NaviCell& last = g_navigationManager.cells.back(); this->DrawBitmap( static_cast(last.x * 2.078125f + 3.0f - 8.0f), static_cast(last.y * 2.078125f + 46.0f - 21.0f), static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\navigation_interface3\\ico_destination.bmp"))), true @@ -2528,7 +2501,7 @@ void UINavigationV4Wnd::Paint() { return; } - if (g_navigationTab == 2) { + if (g_navigationManager.unknown_125C == 2) { this->FillRegion(1, 0x2c, 0x10e, 0x10e, 0xcccccc); this->DrawMapTexture(3, 0x2e, 0x10a); CNaviInfo* info = static_cast(g_navigationManager.GetCurrentTarget().object); @@ -2596,24 +2569,24 @@ void UINavigationV4Wnd::Paint() { mapX = 0xe3; mapSize = 0x28; this->DrawActionSprite( - g_navigationSprites, g_navigationActions, 0x93, 0x2d, 0x74, 0x74, 0x5dc, true, + g_navigationManager.unknown_12A4, g_navigationManager.unknown_12A0, 0x93, 0x2d, 0x74, 0x74, 0x5dc, true, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\Anibackground.bmp"))) ); mapY = 0x78; } this->DrawMapTexture(mapX, mapY, mapSize); - const int active = g_navigationActiveLabel; - const int count = static_cast(g_navigationLabels.size()); + const int active = g_navigationManager.unknown_1284; + const int count = static_cast(g_navigationManager.routeLines.size()); for (int index = 0; index < count; ++index) { - if (g_navigationLabels[index].kind == active) { - const int labelX = g_navigationLabels[index].x; - const int labelY = g_navigationLabels[index].y; - this->DrawTextAt(labelX + 1, labelY + 1, g_navigationLabels[index].text.c_str(), 0, 0, 12, - g_navigationLabels[index].color, 0, 0 + if (g_navigationManager.routeLines[index].kind == active) { + const int labelX = g_navigationManager.routeLines[index].x; + const int labelY = g_navigationManager.routeLines[index].y; + this->DrawTextAt(labelX + 1, labelY + 1, g_navigationManager.routeLines[index].text.c_str(), 0, 0, 12, + g_navigationManager.routeLines[index].color, 0, 0 ); - this->DrawTextAt(labelX, labelY, g_navigationLabels[index].text.c_str(), 0, 0, 12, - g_navigationLabels[index].shadowColor, 0, 0 + this->DrawTextAt(labelX, labelY, g_navigationManager.routeLines[index].text.c_str(), 0, 0, 12, + g_navigationManager.routeLines[index].shadowColor, 0, 0 ); } } @@ -2698,7 +2671,7 @@ int UINavigationV4Wnd::SendMsg(UIWindow* sender, int message, std::intptr_t argu result = g_navigationManager.Navigate(target.x, target.y); } if (result >= 0) { - g_navigationTab = 1; + g_navigationManager.unknown_125C = 1; g_navigationManager.SelectTarget(g_navigationManager.GetSelectedNode()); if (g_windowMgr.modal) { static_cast(g_windowMgr.modal)->RefreshWorldMapMarks(); @@ -2713,15 +2686,15 @@ int UINavigationV4Wnd::SendMsg(UIWindow* sender, int message, std::intptr_t argu break; } case 0x141: - if (static_cast(this->unknown_00E0)->Length() != 0 && !g_navigationMinimized) { - g_navigationSearchText = static_cast(this->unknown_00E0)->Text(); + if (static_cast(this->unknown_00E0)->Length() != 0 && !g_navigationManager.unknown_1254) { + g_navigationManager.unknown_1264 = static_cast(this->unknown_00E0)->Text(); g_navigationManager.UpdateSearchResults(); this->unknown_00F0->Clear(); this->unknown_00F0->Invalidate(); g_navigationManager.ResetCurrentTarget(); g_navigationManager.LoadTargetPreview(); this->FillRouteGroups(); - g_navigationTab = 0; + g_navigationManager.unknown_125C = 0; if (g_windowMgr.modal) { static_cast(g_windowMgr.modal)->RefreshWorldMapLevels(); } @@ -2730,12 +2703,12 @@ int UINavigationV4Wnd::SendMsg(UIWindow* sender, int message, std::intptr_t argu } break; case 0xD5: - g_unknown16FC585 = false; - g_navigationFilter = argument2 != 0; - g_unknown16FC586 = g_navigationFilter; + g_navigationManager.unknown_127D = false; + g_navigationManager.unknown_127C = argument2 != 0; + g_navigationManager.unknown_127E = g_navigationManager.unknown_127C; break; case 0xCA: - g_navigationMinimized = true; + g_navigationManager.unknown_1254 = true; this->geometry.targetAlpha = 0xAA; this->geometry.alphaStart = timeGetTime(); if (g_windowMgr.modal) { @@ -2744,10 +2717,10 @@ int UINavigationV4Wnd::SendMsg(UIWindow* sender, int message, std::intptr_t argu this->RefreshLayout(); break; case 0xC8: - g_navigationMinimized = false; + g_navigationManager.unknown_1254 = false; this->geometry.targetAlpha = 0xFF; this->geometry.alphaStart = timeGetTime(); - g_navigationHidden = false; + g_navigationManager.unknown_1248 = false; this->RefreshLayout(); break; case 0xBD: @@ -2796,12 +2769,12 @@ int UINavigationV4Wnd::SendMsg(UIWindow* sender, int message, std::intptr_t argu } this->SelectRoute(static_cast(argument2)); if (argument2 != -1) { - g_navigationSelectedNode = 0; + g_navigationManager.unknown_12C8 = 0; if (!g_navigationManager.SelectNodeState()) { - g_navigationSelectedNode = 0; + g_navigationManager.unknown_12C8 = 0; g_navigationManager.SelectNodeState(); } - this->unknown_00F0->selected = g_navigationSelectedNode; + this->unknown_00F0->selected = g_navigationManager.unknown_12C8; this->unknown_00F0->Invalidate(); if (g_windowMgr.modal) { static_cast(g_windowMgr.modal)->RefreshWorldMapSelection(); @@ -2823,23 +2796,23 @@ int UINavigationV4Wnd::SendMsg(UIWindow* sender, int message, std::intptr_t argu break; case 0x11C: if (!g_navigationManager.GetSavedTarget().object) { - if (g_navigationTab == 2) { - if (g_navigationMode == 2) { + if (g_navigationManager.unknown_125C == 2) { + if (g_navigationManager.unknown_1258 == 2) { this->LayoutWithoutDetails(); - g_navigationTab = 1; + g_navigationManager.unknown_125C = 1; g_navigationManager.SelectTarget(g_navigationManager.GetSelectedNode()); } else { this->LayoutWithDetails(); - g_navigationTab = 0; + g_navigationManager.unknown_125C = 0; g_navigationManager.SelectNodeState(); } } - } else if (g_navigationTab == 1 || (g_navigationTab == 2 && g_navigationMode != 2)) { - g_navigationTab = 0; + } else if (g_navigationManager.unknown_125C == 1 || (g_navigationManager.unknown_125C == 2 && g_navigationManager.unknown_1258 != 2)) { + g_navigationManager.unknown_125C = 0; g_navigationManager.SelectNodeState(); this->RefreshLayout(); } else { - g_navigationTab = 1; + g_navigationManager.unknown_125C = 1; g_navigationManager.SelectTarget(g_navigationManager.GetSelectedNode()); this->RefreshLayout(); } @@ -2849,7 +2822,7 @@ int UINavigationV4Wnd::SendMsg(UIWindow* sender, int message, std::intptr_t argu const int type = g_navigationManager.GetCurrentTarget().type; if (type < 2) { this->LayoutWithoutDetails(); - g_navigationTab = 2; + g_navigationManager.unknown_125C = 2; this->unknown_0118 = timeGetTime() + 5000; } else { const NavigationTarget target = g_navigationManager.GetCurrentTarget(); @@ -2867,10 +2840,10 @@ int UINavigationV4Wnd::SendMsg(UIWindow* sender, int message, std::intptr_t argu } break; case 0xC9: - if (g_navigationMode == 2) { + if (g_navigationManager.unknown_1258 == 2) { if (g_windowMgr.Confirm(LookupMessage(0x8BF), 2, true, false, 0, "Message", 0x118, 0x78, 0) == 0xBB) { g_navigationManager.SetViewMode(1); - g_navigationTab = 0; + g_navigationManager.unknown_125C = 0; g_navigationManager.ClearSavedTarget(); g_windowMgr.CloseWindow(0x13A); this->RefreshLayout(); @@ -2880,8 +2853,8 @@ int UINavigationV4Wnd::SendMsg(UIWindow* sender, int message, std::intptr_t argu if (g_windowMgr.modal) { this->SendMsg(nullptr, 6, 0xCA, 0, 0, 0); } - g_navigationTab = 0; - g_navigationMinimized = false; + g_navigationManager.unknown_125C = 0; + g_navigationManager.unknown_1254 = false; g_navigationManager.Reset(true); g_worldViewMgr.ClearMarks(); g_worldViewMgr.ClearLevels(); @@ -2895,7 +2868,7 @@ int UINavigationV4Wnd::SendMsg(UIWindow* sender, int message, std::intptr_t argu case 0x27: if (sender == this->unknown_00DC) { - g_navigationSearchType = static_cast(argument1); + g_navigationManager.unknown_1260 = static_cast(argument1); g_navigationManager.BuildNodePaths(); this->FillRouteGroups(); this->Invalidate(); @@ -3327,10 +3300,10 @@ void UIWindow::DrawActionSprite( void UINavigationV4Wnd::Slot31(int x, int y) { UIFrameWnd::Slot31(x, y); - if (!g_navigationMinimized) { + if (!g_navigationManager.unknown_1254) { const int mapY = y - 46; const int mapX = x - 3; - if (mapY >= 0 && mapY <= 266 && mapX >= 0 && mapX <= 266 && g_navigationTab == 2) { + if (mapY >= 0 && mapY <= 266 && mapX >= 0 && mapX <= 266 && g_navigationManager.unknown_125C == 2) { NavigationTarget target = g_navigationManager.GetCurrentTarget(); CNaviInfo* info = static_cast(target.object); const int width = info->GetCellX(); @@ -3666,7 +3639,7 @@ void UINavigationV4Wnd::DrawTargetSprite(int x, int y, int width, int height, co target->unknown_006C, target->unknown_0070, target->unknown_0074, target->unknown_0078, }; if (!look.job) { - this->DrawActionSprite(g_navigationSprites, g_navigationActions, x, y, width, height, 1500, true, background); + this->DrawActionSprite(g_navigationManager.unknown_12A4, g_navigationManager.unknown_12A0, x, y, width, height, 1500, true, background); return; } diff --git a/Source/UI/Window/UIWindowMgr.cpp b/Source/UI/Window/UIWindowMgr.cpp index 3a5a435a1..1a7b0b814 100644 --- a/Source/UI/Window/UIWindowMgr.cpp +++ b/Source/UI/Window/UIWindowMgr.cpp @@ -2548,10 +2548,10 @@ bool UIWindowMgr::ProcessHotkeyAction(int action, int pressed) { if (this->CloseWindow(id) == true) { return false; } - } else if (g_navigationMode == 2) { + } else if (g_navigationManager.unknown_1258 == 2) { if (g_windowMgr.Confirm(LookupMessage(0x8BF), 2, true, false, 0, "Message", 280, 120, 0) == 187) { - g_navigationTab = 0; - g_navigationMinimized = false; + g_navigationManager.unknown_125C = 0; + g_navigationManager.unknown_1254 = false; g_navigationManager.Reset(true); g_worldViewMgr.ClearMarks(); g_worldViewMgr.ClearLevels(); @@ -3734,7 +3734,7 @@ bool UIWindowMgr::CloseWindow(int id) { this->modal = nullptr; closed = true; if (this->window_4F174) { - g_navigationHidden = false; + g_navigationManager.unknown_1248 = false; static_cast(this->window_4F174)->RefreshLayout(); } } @@ -6395,7 +6395,7 @@ UIWindow* UIWindowMgr::EnsureWindow(int id) { case 203: if (this->window_4F174 == nullptr) { this->RecordWindowPacket(203); - g_navigationHidden = false; + g_navigationManager.unknown_1248 = false; window = new UINavigationV4Wnd(); this->window_4F174 = window; window->SetSize(272, 338); diff --git a/Source/UI/Window/WindowMgrState.cpp b/Source/UI/Window/WindowMgrState.cpp index 27a755387..4cc0e745f 100644 --- a/Source/UI/Window/WindowMgrState.cpp +++ b/Source/UI/Window/WindowMgrState.cpp @@ -9,6 +9,7 @@ #include "Contents/Configuration/ServiceConfiguration.h" #include "Contents/Messenger/ClientMessenger.h" #include "Contents/Messenger/MessengerMember.h" +#include "Contents/NavigationManager.h" #include "Contents/UserData/NormalItemSlots.h" #include "Contents/World/World.h" #include "Render/DeviceContext/DCSurface.h" @@ -656,7 +657,7 @@ void UIWindowMgr::SaveVisibleWindowIds() { // OFFSET: 0x00AAB8A0 // FUNCTION: fn_17282 void UIWindowMgr::UpdateNavigationList() { - if (this->window_4F174 && !g_navigationMinimized && static_cast(this->window_4F174)->IsListShown()) { + if (this->window_4F174 && !g_navigationManager.unknown_1254 && static_cast(this->window_4F174)->IsListShown()) { this->window_4F174->SendMsg(nullptr, 6, 202, 0, 0, 0); } }