From d9c762253171dea8aace3ac5ef6901735a6966fc Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Fri, 6 Nov 2026 23:23:11 +0000 Subject: [PATCH] Maintenance: Forced (maintainer). gl_24792 'g_charViewMode' (0x013495BC) is not a separate global: it is g_modeMgr.gameMode (g_modeMg Batch #13844 by ragnarok-clanker: forced by an admin (0 lower score(s), 0 changed function(s)); checked with 53 compiled unit(s), including every includer of Source/UI/Window/UINewSelectCharWnd.h. --- Source/Client/Mode/GameMode.cpp | 4 +- Source/Client/Mode/LoginMode.cpp | 4 +- Source/UI/Acceptance/UIChooseSellBuyWnd.cpp | 6 +-- Source/UI/Acceptance/UIExchangeAcceptWnd.cpp | 4 +- Source/UI/Buttons/UIButton.cpp | 2 +- Source/UI/Edit/UIEditCtrl.cpp | 4 +- Source/UI/GameSettings/GameSettingsUI.cpp | 4 +- Source/UI/Shortcuts/UIShortCutWnd.cpp | 2 +- Source/UI/StylingShop/UIStylingShopWnd.cpp | 6 +-- Source/UI/Window/UIFrameWnd.cpp | 4 +- Source/UI/Window/UINewSelectCharWnd.cpp | 44 ++++++++++---------- Source/UI/Window/UINewSelectCharWnd.h | 1 - Source/UI/Window/UIWindowMgr.cpp | 20 ++++----- Source/UI/Window/WindowDialogs.cpp | 4 +- Source/UI/Window/WindowMgrState.cpp | 4 +- 15 files changed, 55 insertions(+), 58 deletions(-) diff --git a/Source/Client/Mode/GameMode.cpp b/Source/Client/Mode/GameMode.cpp index e431cec12..1b18fda83 100644 --- a/Source/Client/Mode/GameMode.cpp +++ b/Source/Client/Mode/GameMode.cpp @@ -3036,8 +3036,8 @@ int CGameMode::SendMsg(int event, int argument1, int argument2, int argument3, i g_windowMgr.CloseWindow(0xC); } else { g_windowMgr.CloseWindow(0xFF); - if (g_charViewMode != nullptr) { - static_cast(g_charViewMode)->SendMsg(0x28, 0, 0, 0, 0); + if (g_modeMgr.gameMode != nullptr) { + g_modeMgr.gameMode->SendMsg(0x28, 0, 0, 0, 0); } } g_session.ClearTradeItems(); diff --git a/Source/Client/Mode/LoginMode.cpp b/Source/Client/Mode/LoginMode.cpp index ec703a9cf..7766f1762 100644 --- a/Source/Client/Mode/LoginMode.cpp +++ b/Source/Client/Mode/LoginMode.cpp @@ -2401,7 +2401,7 @@ void CLoginMode::PollNetworkStatus() { memset(g_gameModePacketBuffer, 0, sizeof(g_gameModePacketBuffer)); if (!GetRagConnection().Update()) { - static_cast(g_charViewMode)->SendMsg(1, 0, 0, 0, 0); + g_modeMgr.gameMode->SendMsg(1, 0, 0, 0, 0); } if (g_charServerAccountIdPending == 1) { @@ -2928,7 +2928,7 @@ void CLoginMode::PollNetworkStatus() { } case 0xB71: { const CharacterInfoPacket* packet = reinterpret_cast(g_gameModePacketBuffer); - CharacterInfo* character = reinterpret_cast(static_cast(g_charViewMode)->SendMsg(8, packet->info.slot, 0, 0, 0)); + CharacterInfo* character = reinterpret_cast(g_modeMgr.gameMode->SendMsg(8, packet->info.slot, 0, 0, 0)); if (character && character->gid == *reinterpret_cast(&g_session.unknown_5913[1])) { *character = packet->info; StringFormat(character->mapName, sizeof(character->mapName), static_cast(-1), "%s", g_session.GatName2RswName(character->mapName)); diff --git a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp index a5ba5d6ea..de457b878 100644 --- a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp +++ b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp @@ -4618,7 +4618,7 @@ int UIWhisperWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::i } else if (talkType == 51) { this->SaveChatLog(); } else { - static_cast(g_charViewMode)->SendMsg(42, talkType, reinterpret_cast(parts), 0, 0); + g_modeMgr.gameMode->SendMsg(42, talkType, reinterpret_cast(parts), 0, 0); } return 0; } @@ -4631,7 +4631,7 @@ int UIWhisperWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::i g_windowMgr.unknown_04DC.assign(text, std::strlen(text)); } - static_cast(g_charViewMode)->SendMsg(11, reinterpret_cast(this->m_target.c_str()), 0, 0, 0); + g_modeMgr.gameMode->SendMsg(11, reinterpret_cast(this->m_target.c_str()), 0, 0, 0); return 0; } case 14: @@ -4701,7 +4701,7 @@ int UIWhisperWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::i this->m_log.push_back(WhisperLogLine{std::string(LookupMessage(358)), 21}); } - static_cast(g_charViewMode)->SendMsg(101, reinterpret_cast(this->m_target.c_str()), 0, 0, 0); + g_modeMgr.gameMode->SendMsg(101, reinterpret_cast(this->m_target.c_str()), 0, 0, 0); if (this->m_log.empty()) { return 0; } diff --git a/Source/UI/Acceptance/UIExchangeAcceptWnd.cpp b/Source/UI/Acceptance/UIExchangeAcceptWnd.cpp index 65511f33c..b8f0c3be0 100644 --- a/Source/UI/Acceptance/UIExchangeAcceptWnd.cpp +++ b/Source/UI/Acceptance/UIExchangeAcceptWnd.cpp @@ -83,11 +83,11 @@ int UIExchangeAcceptWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, switch (a) { case 184: g_windowMgr.CloseWindow(32); - static_cast(g_charViewMode)->SendMsg(50, 3, 0, 0, 0); + g_modeMgr.gameMode->SendMsg(50, 3, 0, 0, 0); return 0; case 185: g_windowMgr.CloseWindow(32); - static_cast(g_charViewMode)->SendMsg(50, 4, 0, 0, 0); + g_modeMgr.gameMode->SendMsg(50, 4, 0, 0, 0); return 0; } return 0; diff --git a/Source/UI/Buttons/UIButton.cpp b/Source/UI/Buttons/UIButton.cpp index 479da89d2..66e8a36f8 100644 --- a/Source/UI/Buttons/UIButton.cpp +++ b/Source/UI/Buttons/UIButton.cpp @@ -148,7 +148,7 @@ void UIButton::ResetCursor(int x, int y) { return; } - static_cast(g_charViewMode)->SetCursorAction(2); + g_modeMgr.gameMode->SetCursorAction(2); } // OFFSET: 0x0085EED0 diff --git a/Source/UI/Edit/UIEditCtrl.cpp b/Source/UI/Edit/UIEditCtrl.cpp index 5636e3b7a..9e5fff938 100644 --- a/Source/UI/Edit/UIEditCtrl.cpp +++ b/Source/UI/Edit/UIEditCtrl.cpp @@ -6500,7 +6500,7 @@ int UIMerchantItemPurchaseWnd::SendMsg(UIWindow* sender, int message, std::intpt } case 6: { this->RecordResponse(static_cast(a), b, c, d); - CMode* mode = static_cast(g_charViewMode); + CMode* mode = g_modeMgr.gameMode; if (a == 184) { if (this->unknown_0108) { int sum = 0; @@ -9954,7 +9954,7 @@ int UIMerchantItemPurchaseMSGWnd::SendMsg(UIWindow* sender, int message, std::in switch (a) { case 184: - static_cast(g_charViewMode)->SendMsg(83, this->purchaseIndex, this->unknown_00D0, 0, 0); + g_modeMgr.gameMode->SendMsg(83, this->purchaseIndex, this->unknown_00D0, 0, 0); case 185: g_windowMgr.CloseWindow(230); g_session.ClearItems1760And1748(); diff --git a/Source/UI/GameSettings/GameSettingsUI.cpp b/Source/UI/GameSettings/GameSettingsUI.cpp index 12a7eee69..dcbb846da 100644 --- a/Source/UI/GameSettings/GameSettingsUI.cpp +++ b/Source/UI/GameSettings/GameSettingsUI.cpp @@ -4352,8 +4352,8 @@ void GameSettingsUI::CUIGraphicsPage::ApplySettings() { g_configuredFullscreen = this->m_fullscreen->m_onButton->checked; g_restartClient = true; GetRagConnection().Close(); - if (g_charViewMode) { - static_cast(g_charViewMode)->SendMsg(2, 0, 0, 0, 0); + if (g_modeMgr.gameMode) { + g_modeMgr.gameMode->SendMsg(2, 0, 0, 0, 0); } return; } diff --git a/Source/UI/Shortcuts/UIShortCutWnd.cpp b/Source/UI/Shortcuts/UIShortCutWnd.cpp index 3386d659a..299c556b3 100644 --- a/Source/UI/Shortcuts/UIShortCutWnd.cpp +++ b/Source/UI/Shortcuts/UIShortCutWnd.cpp @@ -292,7 +292,7 @@ inline void UseShortcutSlot(const NormalItemSlot& slot) { level = skill.level; } - static_cast(g_charViewMode)->SendMsg(113, reinterpret_cast(&skill), level, 0, 0); + g_modeMgr.gameMode->SendMsg(113, reinterpret_cast(&skill), level, 0, 0); } return; diff --git a/Source/UI/StylingShop/UIStylingShopWnd.cpp b/Source/UI/StylingShop/UIStylingShopWnd.cpp index e2f40880b..cc4550e9c 100644 --- a/Source/UI/StylingShop/UIStylingShopWnd.cpp +++ b/Source/UI/StylingShop/UIStylingShopWnd.cpp @@ -153,10 +153,10 @@ void UIStylingShopButton::Slot31(int, int) { if (parent) { if (WindowPolicy(g_windowMgr.policy[0].actions, g_replayAnimationScaling != 0, 3, parent->geometry.id) != 0) { int id = this->geometry.id; - if (id == 185 && g_charViewMode && static_cast(g_charViewMode)->cursorType == 2) { + if (id == 185 && g_modeMgr.gameMode && g_modeMgr.gameMode->cursorType == 2) { const char* text = LookupMessage(17); if (g_windowMgr.Confirm(text, 2, true, false, 0, "Message", 280, 120, 0) == 187) { - static_cast(g_charViewMode)->SendMsg(2, 0, 0, 0, 0); + g_modeMgr.gameMode->SendMsg(2, 0, 0, 0, 0); } } else { if (id == 184 || id == 321) { @@ -169,7 +169,7 @@ void UIStylingShopButton::Slot31(int, int) { } } } else { - static_cast(g_charViewMode)->SendMsg(0, this->geometry.id, this->m_argument, 0, 0); + g_modeMgr.gameMode->SendMsg(0, this->geometry.id, this->m_argument, 0, 0); } this->Invalidate(); diff --git a/Source/UI/Window/UIFrameWnd.cpp b/Source/UI/Window/UIFrameWnd.cpp index 40276cae1..c53455dfa 100644 --- a/Source/UI/Window/UIFrameWnd.cpp +++ b/Source/UI/Window/UIFrameWnd.cpp @@ -424,7 +424,7 @@ void UIReplayButton::Slot31(int x, int y) { this->parent->SendMsg(this, 6, this->geometry.id, this->m_argument, 0, 0); this->parent->SendMsg(nullptr, 35, 0, 0, 0, 0); } else { - static_cast(g_charViewMode)->SendMsg(0, this->geometry.id, this->m_argument, 0, 0); + g_modeMgr.gameMode->SendMsg(0, this->geometry.id, this->m_argument, 0, 0); } } @@ -449,7 +449,7 @@ void UIMonsterInfoWnd::Slot28(int x, int y) { } if (this->TextWidth(name.c_str(), 0, 0, 12, 0, 0) > 100) { - static_cast(g_charViewMode)->ShowTooltip(name.c_str(), screenX + x, screenY + y, -1, false, true); + g_modeMgr.gameMode->ShowTooltip(name.c_str(), screenX + x, screenY + y, -1, false, true); } } diff --git a/Source/UI/Window/UINewSelectCharWnd.cpp b/Source/UI/Window/UINewSelectCharWnd.cpp index 7256bc42a..fbb1a2199 100644 --- a/Source/UI/Window/UINewSelectCharWnd.cpp +++ b/Source/UI/Window/UINewSelectCharWnd.cpp @@ -61,8 +61,6 @@ int g_doramSex; // GLOBAL: gl_25013 char g_selectedSlotIndex; -// GLOBAL: gl_24792 -void* g_charViewMode; extern const char* LookupMessage(int id); @@ -397,7 +395,7 @@ void UINewSelectCharWnd::Slot15(int width, int height) { } for (int index = 0; index < this->m_totalSlots; ++index) { - CharacterInfo* character = reinterpret_cast(static_cast(g_charViewMode)->SendMsg(8, index, 0, 0, 0)); + CharacterInfo* character = reinterpret_cast(g_modeMgr.gameMode->SendMsg(8, index, 0, 0, 0)); if (character == nullptr) { continue; } @@ -411,7 +409,7 @@ void UINewSelectCharWnd::Slot15(int width, int height) { std::memset(message, 0, sizeof(message)); std::sprintf(message, LookupMessage(0x974), index, 0x9C41); g_windowMgr.Confirm(message, 0, true, false, 0, "Message", 0x118, 0x78, 0); - static_cast(g_charViewMode)->SendMsg(2, 0, 0, 0, 0); + g_modeMgr.gameMode->SendMsg(2, 0, 0, 0, 0); break; } @@ -481,7 +479,7 @@ void UINewSelectCharWnd::Slot15(int width, int height) { this->AddChild(name); this->m_characterWindows[column] = name; - const CharacterInfo* character = reinterpret_cast(static_cast(g_charViewMode)->SendMsg(8, index, 0, 0, 0)); + const CharacterInfo* character = reinterpret_cast(g_modeMgr.gameMode->SendMsg(8, index, 0, 0, 0)); if (character != nullptr) { name->SetTextFitted(character->name); name->Move(x + 0x58 - this->TextWidth(name->GetText().c_str(), 0, 0, 0xC, 0, 0) / 2, y + 0xBD); @@ -503,7 +501,7 @@ void UINewSelectCharWnd::Paint() { continue; } - const CharacterInfo* info = reinterpret_cast(static_cast(g_charViewMode)->SendMsg(8, slot, 0, 0, 0)); + const CharacterInfo* info = reinterpret_cast(g_modeMgr.gameMode->SendMsg(8, slot, 0, 0, 0)); const int column = slot % this->m_slotsPerPage; const char* label = nullptr; if (g_premiumSlotCount > 0 && slot >= g_normalSlotCount && slot < g_normalSlotCount + g_premiumSlotCount) { @@ -559,7 +557,7 @@ void UINewSelectCharWnd::Paint() { } } - const CharacterInfo* selected = reinterpret_cast(static_cast(g_charViewMode)->SendMsg(8, static_cast(g_selectedSlotIndex), 0, 0, 0)); + const CharacterInfo* selected = reinterpret_cast(g_modeMgr.gameMode->SendMsg(8, static_cast(g_selectedSlotIndex), 0, 0, 0)); if (selected && selected->deleteDate > 0) { Timestamp deleteDate(selected->deleteDate); auto* button = static_cast(this->m_window100); @@ -616,7 +614,7 @@ int UINewSelectCharWnd::SendMsg(UIWindow* sender, int message, std::intptr_t arg } CharacterInfo* info = - reinterpret_cast(static_cast(g_charViewMode)->SendMsg(8, static_cast(g_selectedSlotIndex), 0, 0, 0)); + reinterpret_cast(g_modeMgr.gameMode->SendMsg(8, static_cast(g_selectedSlotIndex), 0, 0, 0)); if (info == nullptr) { this->SendMsg(nullptr, 6, 0xCB, this->m_pageSlot, 0, 0); break; @@ -642,7 +640,7 @@ int UINewSelectCharWnd::SendMsg(UIWindow* sender, int message, std::intptr_t arg } g_soundMgr->PlayWave("버튼소리.wav", 0.0f, 0.0f, 0.0f, 250, 40, 1.0f, 0); - static_cast(g_charViewMode)->SendMsg(0, 0x2712, 0, 0, 0); + g_modeMgr.gameMode->SendMsg(0, 0x2712, 0, 0, 0); this->m_unknown13C = true; if (this->m_windowFC != nullptr) { UIBitmapButton* button = static_cast(this->m_windowFC); @@ -656,10 +654,10 @@ int UINewSelectCharWnd::SendMsg(UIWindow* sender, int message, std::intptr_t arg g_accountLinkedUserDataMgr->Save(); if (g_loginModeFlag == 1) { if (g_windowMgr.Confirm(LookupMessage(0xD68), 2, true, false, 0, "Message", 0x118, 0x78, 0) == 0xBB) { - static_cast(g_charViewMode)->SendMsg(0x271B, 0, 0, 0, 0); + g_modeMgr.gameMode->SendMsg(0x271B, 0, 0, 0, 0); } } else if (g_windowMgr.Confirm(LookupMessage(0x11), 2, true, false, 0, "Message", 0x118, 0x78, 0) == 0xBB) { - static_cast(g_charViewMode)->SendMsg(2, 0, 0, 0, 0); + g_modeMgr.gameMode->SendMsg(2, 0, 0, 0, 0); g_windowMgr.Schedule(this); } break; @@ -698,7 +696,7 @@ int UINewSelectCharWnd::SendMsg(UIWindow* sender, int message, std::intptr_t arg if (argument2 == 0xE2) { bool shown = false; const CharacterInfo* info = - reinterpret_cast(static_cast(g_charViewMode)->SendMsg(8, static_cast(g_selectedSlotIndex), 0, 0, 0)); + reinterpret_cast(g_modeMgr.gameMode->SendMsg(8, static_cast(g_selectedSlotIndex), 0, 0, 0)); const int selected = static_cast(g_selectedSlotIndex); if (this->m_unknown138 != selected && selected < this->m_maxCharacters) { if (info == nullptr) { @@ -729,7 +727,7 @@ int UINewSelectCharWnd::SendMsg(UIWindow* sender, int message, std::intptr_t arg } const CharacterInfo* info = - reinterpret_cast(static_cast(g_charViewMode)->SendMsg(8, static_cast(g_selectedSlotIndex), 0, 0, 0)); + reinterpret_cast(g_modeMgr.gameMode->SendMsg(8, static_cast(g_selectedSlotIndex), 0, 0, 0)); const BlockedCharacterEntry* blocked = reinterpret_cast(&g_session.unknown_07F4[0x40]); for (int index = 0; index < g_session.unknown_59D0; ++index) { if (info->gid == blocked[index].gid) { @@ -744,7 +742,7 @@ int UINewSelectCharWnd::SendMsg(UIWindow* sender, int message, std::intptr_t arg if (g_windowMgr.Confirm(LookupMessage(0x13), 2, false, false, 0, "Message", 0x118, 0x78, 0) == 0xBB) { this->m_unknown118 = true; if (g_windowMgr.RunEmailAddress() == 0xB8) { - static_cast(g_charViewMode)->SendMsg(0, 0x271A, 0, 0, 0); + g_modeMgr.gameMode->SendMsg(0, 0x271A, 0, 0, 0); g_windowMgr.Schedule(this); } this->m_unknown118 = false; @@ -755,7 +753,7 @@ int UINewSelectCharWnd::SendMsg(UIWindow* sender, int message, std::intptr_t arg case 0x11E: { char text[260]; std::memset(text, 0, sizeof(text)); - static_cast(g_charViewMode)->SendMsg(0x2724, reinterpret_cast(text), 0, 0, 0); + g_modeMgr.gameMode->SendMsg(0x2724, reinterpret_cast(text), 0, 0, 0); g_windowMgr.Confirm(text, 0, true, false, 0, "Message", 0x118, 0x78, 0); break; } @@ -810,7 +808,7 @@ int UINewSelectCharWnd::SendMsg(UIWindow* sender, int message, std::intptr_t arg button->SetSlot(index, -1); button->SendMsg(nullptr, 0x1AF, 1, 0, 0, 0); - const CharacterInfo* info = reinterpret_cast(static_cast(g_charViewMode)->SendMsg(8, index, 0, 0, 0)); + const CharacterInfo* info = reinterpret_cast(g_modeMgr.gameMode->SendMsg(8, index, 0, 0, 0)); if (info != nullptr) { this->m_characterWindows[column]->SetTextFitted(info->name); UIStaticText* name = this->m_characterWindows[column]; @@ -876,7 +874,7 @@ int UINewSelectCharWnd::SendMsg(UIWindow* sender, int message, std::intptr_t arg button->SetSlot(index, -1); button->SendMsg(nullptr, 0x1AF, 1, 0, 0, 0); - const CharacterInfo* info = reinterpret_cast(static_cast(g_charViewMode)->SendMsg(8, index, 0, 0, 0)); + const CharacterInfo* info = reinterpret_cast(g_modeMgr.gameMode->SendMsg(8, index, 0, 0, 0)); if (info != nullptr) { this->m_characterWindows[column]->SetTextFitted(info->name); UIStaticText* name = this->m_characterWindows[column]; @@ -895,7 +893,7 @@ int UINewSelectCharWnd::SendMsg(UIWindow* sender, int message, std::intptr_t arg if (g_windowMgr.window_03DC != nullptr) { g_windowMgr.CloseWindow(0x80); } - const std::intptr_t info = static_cast(g_charViewMode)->SendMsg(8, static_cast(g_selectedSlotIndex), 0, 0, 0); + const std::intptr_t info = g_modeMgr.gameMode->SendMsg(8, static_cast(g_selectedSlotIndex), 0, 0, 0); UIWindow* window = g_windowMgr.EnsureWindow(0x80); if (window != nullptr) { window->SendMsg(nullptr, 0x22, info, 0, 0, 0); @@ -904,7 +902,7 @@ int UINewSelectCharWnd::SendMsg(UIWindow* sender, int message, std::intptr_t arg } case 0x160: { CharacterInfo* info = - reinterpret_cast(static_cast(g_charViewMode)->SendMsg(8, static_cast(g_selectedSlotIndex), 0, 0, 0)); + reinterpret_cast(g_modeMgr.gameMode->SendMsg(8, static_cast(g_selectedSlotIndex), 0, 0, 0)); if (info->gid != g_renameGid) { break; } @@ -925,7 +923,7 @@ int UINewSelectCharWnd::SendMsg(UIWindow* sender, int message, std::intptr_t arg } const CharacterInfo* info = - reinterpret_cast(static_cast(g_charViewMode)->SendMsg(8, static_cast(g_selectedSlotIndex), 0, 0, 0)); + reinterpret_cast(g_modeMgr.gameMode->SendMsg(8, static_cast(g_selectedSlotIndex), 0, 0, 0)); CharacterGidPacket packet; packet.id = 0x827; packet.gid = info->gid; @@ -960,7 +958,7 @@ int UINewSelectCharWnd::SendMsg(UIWindow* sender, int message, std::intptr_t arg case 0x1B1: { const unsigned char selected = static_cast(g_selectedSlotIndex); if (g_windowMgr.Confirm(LookupMessage(0x7E0), 2, false, false, 0, "Message", 0x118, 0x78, 0) == 0xBB) { - const CharacterInfo* info = reinterpret_cast(static_cast(g_charViewMode)->SendMsg(8, this->m_unknown138, 0, 0, 0)); + const CharacterInfo* info = reinterpret_cast(g_modeMgr.gameMode->SendMsg(8, this->m_unknown138, 0, 0, 0)); if (info != nullptr) { CharacterMovePacket packet; packet.id = 0x8D4; @@ -1137,7 +1135,7 @@ __declspec(noinline) void UINewSelectCharWnd::UpdateDeleteButtons() { return; } - const CharacterInfo* info = reinterpret_cast(static_cast(g_charViewMode)->SendMsg(8, slot, 0, 0, 0)); + const CharacterInfo* info = reinterpret_cast(g_modeMgr.gameMode->SendMsg(8, slot, 0, 0, 0)); if (!info) { return; } @@ -1185,7 +1183,7 @@ void UINewSelectCharWnd::UpdateCharacterInfo() { return; } - const CharacterInfo* info = reinterpret_cast(static_cast(g_charViewMode)->SendMsg(8, current, 0, 0, 0)); + const CharacterInfo* info = reinterpret_cast(g_modeMgr.gameMode->SendMsg(8, current, 0, 0, 0)); if (info) { static_cast(this->m_slotButtons[0])->SetTextFitted(g_session.GetJobName(info->job, info->sex)); static_cast(this->m_slotButtons[1])->SetTextFitted(FormatOwnedString("%d", info->level).c_str()); diff --git a/Source/UI/Window/UINewSelectCharWnd.h b/Source/UI/Window/UINewSelectCharWnd.h index 4841d6562..393eb60c8 100644 --- a/Source/UI/Window/UINewSelectCharWnd.h +++ b/Source/UI/Window/UINewSelectCharWnd.h @@ -12,7 +12,6 @@ class UIBmpTextButton; class UIStaticText; class CUIControl; -extern void* g_charViewMode; extern char g_selectedSlotIndex; extern int g_doramSex; extern int g_sub_1319eb4; diff --git a/Source/UI/Window/UIWindowMgr.cpp b/Source/UI/Window/UIWindowMgr.cpp index 348fa04e3..e7fc862b1 100644 --- a/Source/UI/Window/UIWindowMgr.cpp +++ b/Source/UI/Window/UIWindowMgr.cpp @@ -1654,7 +1654,7 @@ void UIWindowMgr::SendEmotionHotkey(int index) { } } - CMode* mode = static_cast(g_charViewMode); + CMode* mode = g_modeMgr.gameMode; if (text[0] == '/') { if (g_session.ProcessEmotionShortcut(text) == 0) { std::string parts[3]; @@ -1663,7 +1663,7 @@ void UIWindowMgr::SendEmotionHotkey(int index) { if (offset != -1) { g_windowMgr.unknown_04DC = text + offset; } - static_cast(g_charViewMode)->SendMsg(0x2A, talkType, reinterpret_cast(parts), 0, 0); + g_modeMgr.gameMode->SendMsg(0x2A, talkType, reinterpret_cast(parts), 0, 0); } return; } @@ -2894,7 +2894,7 @@ bool UIWindowMgr::CloseWindow(int id) { break; case 25: if (this->unknown_0264) { - static_cast(g_charViewMode)->SendMsg(291, 0, 0, 0, 0); + g_modeMgr.gameMode->SendMsg(291, 0, 0, 0, 0); this->Schedule(this->unknown_0264); this->unknown_0264 = nullptr; closed = true; @@ -2902,7 +2902,7 @@ bool UIWindowMgr::CloseWindow(int id) { break; case 24: if (this->unknown_025C) { - static_cast(g_charViewMode)->SendMsg(291, 0, 0, 0, 0); + g_modeMgr.gameMode->SendMsg(291, 0, 0, 0, 0); this->Schedule(this->unknown_025C); this->unknown_025C = nullptr; closed = true; @@ -2924,7 +2924,7 @@ bool UIWindowMgr::CloseWindow(int id) { break; case 23: if (this->unknown_0258) { - static_cast(g_charViewMode)->SendMsg(291, 0, 0, 0, 0); + g_modeMgr.gameMode->SendMsg(291, 0, 0, 0, 0); this->Schedule(this->unknown_0258); this->unknown_0258 = nullptr; closed = true; @@ -2990,8 +2990,8 @@ bool UIWindowMgr::CloseWindow(int id) { break; case 335: if (this->window_4F264) { - if (g_charViewMode) { - static_cast(g_charViewMode)->SendMsg(309, 0, 0, 0, 0); + if (g_modeMgr.gameMode) { + g_modeMgr.gameMode->SendMsg(309, 0, 0, 0, 0); } this->Schedule(this->window_4F264); this->window_4F264 = nullptr; @@ -3010,8 +3010,8 @@ bool UIWindowMgr::CloseWindow(int id) { break; case 342: if (this->window_4F26C) { - if (g_charViewMode) { - static_cast(g_charViewMode)->SendMsg(322, 0, 0, 0, 0); + if (g_modeMgr.gameMode) { + g_modeMgr.gameMode->SendMsg(322, 0, 0, 0, 0); } this->Schedule(this->window_4F26C); closed = true; @@ -3534,7 +3534,7 @@ bool UIWindowMgr::CloseWindow(int id) { this->Schedule(this->unknown_0390); this->unknown_0390 = nullptr; closed = true; - static_cast(g_charViewMode)->SendMsg(146, -1, 0, 0, 0); + g_modeMgr.gameMode->SendMsg(146, -1, 0, 0, 0); } break; case 91: diff --git a/Source/UI/Window/WindowDialogs.cpp b/Source/UI/Window/WindowDialogs.cpp index 75dac54cd..ed393c041 100644 --- a/Source/UI/Window/WindowDialogs.cpp +++ b/Source/UI/Window/WindowDialogs.cpp @@ -187,7 +187,7 @@ int UIWindowMgr::Confirm( int response = 184; if (g_modalImmediate == 0) { - CMode* pump = static_cast(g_charViewMode); + CMode* pump = g_modeMgr.gameMode; for (;;) { if (this->activeWindowId != 0) { @@ -220,7 +220,7 @@ int UIWindowMgr::Confirm( if (pump) { pump->Update(); - pump = static_cast(g_charViewMode); + pump = g_modeMgr.gameMode; } if (g_session.GetOption(20) > 0) { diff --git a/Source/UI/Window/WindowMgrState.cpp b/Source/UI/Window/WindowMgrState.cpp index dbe372aba..27d368ccf 100644 --- a/Source/UI/Window/WindowMgrState.cpp +++ b/Source/UI/Window/WindowMgrState.cpp @@ -1178,7 +1178,7 @@ int UIWindowMgr::RunEmailAddress() { int response = 184; if (g_modalImmediate == 0) { - CMode* pump = static_cast(g_charViewMode); + CMode* pump = g_modeMgr.gameMode; for (;;) { if (this->activeWindowId != 0) { @@ -1211,7 +1211,7 @@ int UIWindowMgr::RunEmailAddress() { if (pump) { pump->Update(); - pump = static_cast(g_charViewMode); + pump = g_modeMgr.gameMode; } if (g_session.GetOption(20) > 0) {