diff --git a/Source/Client/Mode/CMode.h b/Source/Client/Mode/CMode.h index a26abbab..e084f747 100644 --- a/Source/Client/Mode/CMode.h +++ b/Source/Client/Mode/CMode.h @@ -41,6 +41,7 @@ public: CMode(); std::uint32_t ClearTooltip(); void ExpireTooltip(); + void SetCursorAction(int action); void TakeScreenshot(); void DrawCursor(); void DrawFadeIn(); diff --git a/Source/Client/Mode/GameMode.cpp b/Source/Client/Mode/GameMode.cpp index ab9b0031..88fa0f59 100644 --- a/Source/Client/Mode/GameMode.cpp +++ b/Source/Client/Mode/GameMode.cpp @@ -38,7 +38,6 @@ #include "Client/Application/Launcher.h" #include "UI/Text/NavigationLink.h" #include "Contents/RenewQuestMgr.h" -#include "Client/Mode/ModeCursor.h" #include "Contents/Skills/AutomaticSkills.h" #include "UI/Shortcuts/UIShortCutWnd.h" #include "Contents/MapInfoMgr.h" @@ -3592,7 +3591,7 @@ void CGameMode::ProcessRightButtonDrag() { } case 2: if (!HIBYTE(GetAsyncKeyState(VK_MENU)) && !HIBYTE(GetAsyncKeyState(VK_SHIFT))) { - reinterpret_cast(&this->cursorAction)->Set(4, this->cursorTick); + this->SetCursorAction(4); if (this->hasViewParameters) { float yaw = static_cast(g_screenWidth) + this->camera->camera.desiredYaw - static_cast(this->unknown_00DC); const float low = static_cast(this->viewParameters[3]); @@ -4020,23 +4019,22 @@ void CGameMode::ShowActorNameBalloon(std::uint32_t id) { void CGameMode::ProcessActorClick(int& handled, ActorPickInfo* pick, CGameActor* actor) { const unsigned char selfTargetOption = g_serviceOptions.Get(0x69); const unsigned char forceOption = g_serviceOptions.Get(0x6D); - ModeCursor& cursor = *reinterpret_cast(&this->cursorAction); const std::intptr_t mode = reinterpret_cast(this->unknown_0408); int attack; if (mode == 2 || mode == 4) { const int shiftHeld = HIBYTE(GetAsyncKeyState(VK_SHIFT)); attack = IsSupportSkill(this->unknown_040C) ? shiftHeld : shiftHeld == 0; - cursor.Set(11, this->cursorTick); + this->SetCursorAction(11); } else { attack = HIBYTE(GetAsyncKeyState(VK_SHIFT)) == 0; if (actor->unknown_0314 == 7) { - cursor.Set(0, this->cursorTick); + this->SetCursorAction(0); } else if (g_session.GetMapProperty08() == 0 && this->scene->unknown_004C == 0) { - cursor.Set(5, this->cursorTick); + this->SetCursorAction(5); } else if (g_session.IsLocalPlayerAid(actor->Slot50())) { attack = 0; - cursor.Set(0, this->cursorTick); + this->SetCursorAction(0); } } @@ -4067,7 +4065,7 @@ void CGameMode::ProcessActorClick(int& handled, ActorPickInfo* pick, CGameActor* } g_session.unknown_5610 = 0; } else { - cursor.Set(11, this->cursorTick); + this->SetCursorAction(11); g_groundMarkAid = actor->render.accountId; g_groundMarkA = 0; g_groundMarkB = 0; @@ -4110,7 +4108,7 @@ void CGameMode::ProcessActorClick(int& handled, ActorPickInfo* pick, CGameActor* } g_session.unknown_56AC = 0; } else { - cursor.Set(11, this->cursorTick); + this->SetCursorAction(11); g_groundMarkAltAid = actor->render.accountId; g_groundMarkAltA = 0; g_groundMarkAltB = 0; @@ -4244,7 +4242,6 @@ int CGameMode::ProcessMousePick(int result, ActorPickInfo* pick) { return result; } - ModeCursor& cursor = *reinterpret_cast(&this->cursorAction); int& lockedPick = this->forcedAttack; int& pickTarget = *reinterpret_cast(&this->unknown_00EC[0x00]); int& clickTarget = *reinterpret_cast(&this->unknown_00EC[0x04]); @@ -4262,12 +4259,12 @@ int CGameMode::ProcessMousePick(int result, ActorPickInfo* pick) { return result; } } else { - cursor.Set(5, this->cursorTick); + this->SetCursorAction(5); if (lockedPick != 0) { if (g_sub_1319eb4 == 1) { this->SendMsg(26, 0, 0, 0, 0); } else { - cursor.Set(0, this->cursorTick); + this->SetCursorAction(0); if (!pick) { return result; } @@ -4287,11 +4284,11 @@ int CGameMode::ProcessMousePick(int result, ActorPickInfo* pick) { if (clickTarget != 0) { if (pick) { if (pick->kind == 3) { - cursor.Set(0, this->cursorTick); + this->SetCursorAction(0); return 0; } if (pick->kind == 4) { - cursor.Set(0, this->cursorTick); + this->SetCursorAction(0); this->ShowActorNameBalloon(pick->accountId); return this->HandleActorPick(pick, result); } @@ -4775,9 +4772,8 @@ void CGameMode::ProcessInput() { } if (handled == 0) { - ModeCursor& cursor = *reinterpret_cast(&this->cursorAction); if (this->unknown_0408 != nullptr) { - cursor.Set(10, this->cursorTick); + this->SetCursorAction(10); } else if (g_mouse.buttons[1] != 2) { int column = -1; int row = -1; @@ -4787,9 +4783,9 @@ void CGameMode::ProcessInput() { ); const TerrainHeightCell* cell = this->scene->terrain->Grid().CellAt(column, row); if (cell && cell->type != 1 && cell->type != 5) { - cursor.Set(0, this->cursorTick); + this->SetCursorAction(0); } else { - cursor.Set(13, this->cursorTick); + this->SetCursorAction(13); } } } @@ -4900,7 +4896,6 @@ static_assert(sizeof(TalkSelectPacket) == 8); void CGameMode::ProcessActorPick(int& handled, ActorPickInfo* pick, CGameActor* actor) { const unsigned char selfTargetOption = g_serviceOptions.Get(0x69); const unsigned char forceOption = g_serviceOptions.Get(0x6D); - ModeCursor& cursor = *reinterpret_cast(&this->cursorAction); const std::intptr_t mode = reinterpret_cast(this->unknown_0408); int skillMode; @@ -4993,14 +4988,14 @@ void CGameMode::ProcessActorPick(int& handled, ActorPickInfo* pick, CGameActor* } if (resetCursor) { - cursor.Set(0, this->cursorTick); + this->SetCursorAction(0); } else if (attack && actor->render.unknown_0070 != 3) { - cursor.Set(skillMode ? 11 : 5, this->cursorTick); + this->SetCursorAction(skillMode ? 11 : 5); handled = 1; } else if (skillMode && actor->render.unknown_0070 != 3) { - cursor.Set(10, this->cursorTick); + this->SetCursorAction(10); } else { - cursor.Set(0, this->cursorTick); + this->SetCursorAction(0); } const std::uint32_t homunAid = *reinterpret_cast(&g_session.unknown_5570[8]); @@ -5025,7 +5020,7 @@ void CGameMode::ProcessActorPick(int& handled, ActorPickInfo* pick, CGameActor* } g_session.unknown_5610 = 0; } else { - cursor.Set(11, this->cursorTick); + this->SetCursorAction(11); g_groundMarkAid = actor->render.accountId; g_groundMarkA = 0; g_groundMarkB = 0; @@ -5067,7 +5062,7 @@ void CGameMode::ProcessActorPick(int& handled, ActorPickInfo* pick, CGameActor* } g_session.unknown_56AC = 0; } else { - cursor.Set(11, this->cursorTick); + this->SetCursorAction(11); g_groundMarkAltAid = actor->render.accountId; g_groundMarkAltA = 0; g_groundMarkAltB = 0; @@ -5305,7 +5300,6 @@ void CGameMode::ProcessStatusIconTooltip(int x, int y) { int CGameMode::HandleActorPick(ActorPickInfo* pick, int result) { const unsigned char selfTargetOption = g_serviceOptions.Get(0x69); const unsigned char forceOption = g_serviceOptions.Get(0x6D); - ModeCursor& cursor = *reinterpret_cast(&this->cursorAction); const int& siegeMode = *reinterpret_cast(&g_session.unknown_5454[4]); const std::uint32_t& homunAid = *reinterpret_cast(&g_session.unknown_5570[8]); const std::uint32_t& mercenaryAid = *reinterpret_cast(&g_session.unknown_5620[8]); @@ -5315,14 +5309,14 @@ int CGameMode::HandleActorPick(ActorPickInfo* pick, int result) { switch (pick->kind) { case 0: if (pick->job != 45 && g_session.IsAllyActor(pick->accountId, pick->job) == 1) { - cursor.Set(1, this->cursorTick); + this->SetCursorAction(1); if (g_mouse.buttons[0] == 2) { result = 2; } else { result = 1; } } else if (pick->job == 45) { - cursor.Set(7, this->cursorTick); + this->SetCursorAction(7); result = 2; } else { result = 1; @@ -5387,18 +5381,18 @@ int CGameMode::HandleActorPick(ActorPickInfo* pick, int result) { const int state = actor != nullptr ? actor->render.unknown_0070 : 3; if (attack && state != 3) { - cursor.Set(skillMode ? 11 : 5, this->cursorTick); + this->SetCursorAction(skillMode ? 11 : 5); result = 1; *reinterpret_cast(&this->unknown_00EC[0]) = pick->accountId; } else { - cursor.Set(skillMode && state != 3 ? 10 : 0, this->cursorTick); + this->SetCursorAction(skillMode && state != 3 ? 10 : 0); result = 0; if (g_mouse.buttons[0] == 0 && this->unknown_0028 == 0 && *reinterpret_cast(&this->unknown_00EC[4]) == 0) { *reinterpret_cast(&this->unknown_00EC[0]) = pick->accountId; } } } else if (g_session.IsNpcJob(pick->job) == true) { - cursor.Set(1, this->cursorTick); + this->SetCursorAction(1); if (g_mouse.buttons[0] == 2) { result = 2; } @@ -5433,14 +5427,14 @@ int CGameMode::HandleActorPick(ActorPickInfo* pick, int result) { if (this->unknown_00F8 != 0) { if (attack) { if (skillMode) { - cursor.Set(11, this->cursorTick); + this->SetCursorAction(11); } else if (actor != nullptr && actor->unknown_0314 == 7) { - cursor.Set(0, this->cursorTick); + this->SetCursorAction(0); } else { - cursor.Set(5, this->cursorTick); + this->SetCursorAction(5); } } else { - cursor.Set(skillMode ? 10 : 0, this->cursorTick); + this->SetCursorAction(skillMode ? 10 : 0); } } @@ -5521,7 +5515,7 @@ int CGameMode::HandleActorPick(ActorPickInfo* pick, int result) { break; } } - cursor.Set(action, this->cursorTick); + this->SetCursorAction(action); if (g_mouse.buttons[0] == 2) { result = 2; } @@ -5529,24 +5523,24 @@ int CGameMode::HandleActorPick(ActorPickInfo* pick, int result) { } case 1: result = 1; - cursor.Set(9, this->cursorTick); + this->SetCursorAction(9); if (g_mouse.buttons[0] == 2) { result = 2; } break; case 3: result = 0; - cursor.Set(0, this->cursorTick); + this->SetCursorAction(0); break; case 4: { result = 0; - cursor.Set(0, this->cursorTick); + this->SetCursorAction(0); CGameActor* actor = static_cast(this->scene->GetGameActorByAID(pick->accountId)); if (actor != nullptr && actor->render.unknown_0070 != 3) { if (g_session.m_aid == static_cast(actor->unknown_02EC)) { if (actor->unknown_0314 == 8 && this->unknown_040C == 0xE7) { result = 1; - cursor.Set(11, this->cursorTick); + this->SetCursorAction(11); *reinterpret_cast(&this->unknown_00EC[4]) = pick->accountId; } } else { @@ -5559,7 +5553,7 @@ int CGameMode::HandleActorPick(ActorPickInfo* pick, int result) { } } result = 1; - cursor.Set(5, this->cursorTick); + this->SetCursorAction(5); *reinterpret_cast(&this->unknown_00EC[4]) = pick->accountId; } } @@ -5644,7 +5638,7 @@ int CGameMode::HandleActorPick(ActorPickInfo* pick, int result) { } g_session.unknown_5610 = 0; } else { - cursor.Set(11, this->cursorTick); + this->SetCursorAction(11); g_groundMarkAid = pick->accountId; g_groundMarkA = 0; g_groundMarkB = 0; @@ -5688,7 +5682,7 @@ int CGameMode::HandleActorPick(ActorPickInfo* pick, int result) { } g_session.unknown_56AC = 0; } else { - cursor.Set(11, this->cursorTick); + this->SetCursorAction(11); g_groundMarkAltAid = pick->accountId; g_groundMarkAltA = 0; g_groundMarkAltB = 0; @@ -5844,7 +5838,7 @@ int CGameMode::HandleActorPick(ActorPickInfo* pick, int result) { return result; } case 3: - cursor.Set(0, this->cursorTick); + this->SetCursorAction(0); return 0; case 1: if (g_mouse.buttons[0] == 1 && reinterpret_cast(this->unknown_0408) == 0) { @@ -5852,12 +5846,12 @@ int CGameMode::HandleActorPick(ActorPickInfo* pick, int result) { } break; case 4: { - cursor.Set(0, this->cursorTick); + this->SetCursorAction(0); if (g_session.IsMercenaryJob(pick->job)) { CWorld* scene = this->scene; if (this->unknown_040C == 0xE7 || ((scene->unknown_0048 != 0 || scene->unknown_004C != 0 || siegeMode != 0) && !g_session.IsHomunAid(pick->accountId))) { if ((this->scene->unknown_0048 != 0 || this->scene->unknown_004C != 0 || siegeMode != 0) && !g_session.IsHomunAid(pick->accountId)) { - cursor.Set(5, this->cursorTick); + this->SetCursorAction(5); } this->RequestPlayerAction(pick->accountId, 1); this->forcedAttack = 0; diff --git a/Source/Client/Mode/ModeCursor.cpp b/Source/Client/Mode/ModeCursor.cpp index b136c680..aa0e59f1 100644 --- a/Source/Client/Mode/ModeCursor.cpp +++ b/Source/Client/Mode/ModeCursor.cpp @@ -1,5 +1,4 @@ #include "Client/Mode/CMode.h" -#include "Client/Mode/ModeCursor.h" #include "UI/Window/UIWindowMgr.h" #include @@ -26,13 +25,13 @@ CMode::CMode() { // OFFSET: 0x00AD75E0 // FUNCTION: fn_17850 -void ModeCursor::Set(std::int32_t value, std::uint32_t& changeTick) { - if (this->type == value) { +void CMode::SetCursorAction(int action) { + if (this->cursorAction == action) { return; } - this->type = value; - this->frame = 0; - changeTick = timeGetTime(); - g_windowMgr.SendNotice(15, this->type, 0, 0, 0, 0); + this->cursorAction = action; + this->cursorActionFrame = 0; + this->cursorTick = timeGetTime(); + g_windowMgr.SendNotice(15, this->cursorAction, 0, 0, 0, 0); } diff --git a/Source/Contents/CashEmotionMgr.cpp b/Source/Contents/CashEmotionMgr.cpp index 82411d40..4e8a8137 100644 --- a/Source/Contents/CashEmotionMgr.cpp +++ b/Source/Contents/CashEmotionMgr.cpp @@ -1,3 +1,4 @@ +#include "Render/DeviceContext/DCSurface.h" #include "UI/Window/UINewSelectCharWnd.h" #include "Client/Mode/ModeTooltip.h" #include "Contents/CashEmotionMgr.h" @@ -3767,7 +3768,7 @@ void UICashEmotionSprBtn::Paint() { if (cell->imageType == 0) { texture = g_renderer->atlas.Find(image, palette, record); if (!texture) { - texture = g_renderer->atlas.Insert(this->m_context->renderSystem, image, palette, record, g_serviceType, g_resourceReuseDelay); + texture = g_renderer->atlas.Insert(*GetRenderSystemHolder()->system, image, palette, record, g_serviceType, g_resourceReuseDelay); } } else { texture = static_cast(const_cast(image->unknown_0008)); @@ -3913,7 +3914,7 @@ void UIHeadsprButton::Paint() { if (cell.imageType == 0) { texture = g_renderer->atlas.Find(image, palette, record); if (!texture) { - texture = g_renderer->atlas.Insert(this->m_context->renderSystem, image, palette, record, g_serviceType, g_resourceReuseDelay); + texture = g_renderer->atlas.Insert(*GetRenderSystemHolder()->system, image, palette, record, g_serviceType, g_resourceReuseDelay); } } else { texture = static_cast(const_cast(image->unknown_0008)); @@ -3963,7 +3964,7 @@ void UISpriteButton::Paint() { if (cell.imageType == 0) { texture = g_renderer->atlas.Find(image, palette, record); if (!texture) { - texture = g_renderer->atlas.Insert(this->m_context->renderSystem, image, palette, record, g_serviceType, g_resourceReuseDelay); + texture = g_renderer->atlas.Insert(*GetRenderSystemHolder()->system, image, palette, record, g_serviceType, g_resourceReuseDelay); } } else { texture = static_cast(const_cast(image->unknown_0008)); diff --git a/Source/Contents/Messenger/MessengerMember.cpp b/Source/Contents/Messenger/MessengerMember.cpp index 8470f680..2220dcd1 100644 --- a/Source/Contents/Messenger/MessengerMember.cpp +++ b/Source/Contents/Messenger/MessengerMember.cpp @@ -648,7 +648,7 @@ void UIJobIconButton::Paint() { // OFFSET: 0x007395E0 // FUNCTION: fn_07688 void UIJobIconButton::Slot25(int x, int y) { - if (UIWindow* window = this->m_context->windowMgr.LookupWindow(34)) { + if (UIWindow* window = g_windowMgr.LookupWindow(34)) { window->Slot25(x + this->geometry.x, y + this->geometry.y); } } @@ -656,7 +656,7 @@ void UIJobIconButton::Slot25(int x, int y) { // OFFSET: 0x00739610 // FUNCTION: fn_07689 void UIJobIconButton::Slot31(int x, int y) { - if (UIWindow* window = this->m_context->windowMgr.LookupWindow(34)) { + if (UIWindow* window = g_windowMgr.LookupWindow(34)) { window->Slot31(x + this->geometry.x, y + this->geometry.y); } } @@ -664,7 +664,7 @@ void UIJobIconButton::Slot31(int x, int y) { // OFFSET: 0x00739640 // FUNCTION: fn_07690 void UIJobIconButton::Slot33(int x, int y) { - if (UIWindow* window = this->m_context->windowMgr.LookupWindow(34)) { + if (UIWindow* window = g_windowMgr.LookupWindow(34)) { window->Slot33(x + this->geometry.x, y + this->geometry.y); } } diff --git a/Source/Render/Primitives/ScreenLine.cpp b/Source/Render/Primitives/ScreenLine.cpp index 209815ad..0d73b86d 100644 --- a/Source/Render/Primitives/ScreenLine.cpp +++ b/Source/Render/Primitives/ScreenLine.cpp @@ -1,3 +1,4 @@ +#include "Render/DeviceContext/DCSurface.h" #include "UI/Window/UIRoMapWnd.h" #include "Client/Session.h" @@ -225,7 +226,7 @@ void UIRoMapWnd::DrawKafraIcon(float x, float y) { if (cell->imageType == 0) { texture = g_renderer->atlas.Find(image, palette, record); if (!texture) { - texture = g_renderer->atlas.Insert(this->m_context->renderSystem, image, palette, record, g_serviceType, g_resourceReuseDelay); + texture = g_renderer->atlas.Insert(*GetRenderSystemHolder()->system, image, palette, record, g_serviceType, g_resourceReuseDelay); } } else { texture = static_cast(const_cast(image->unknown_0008)); diff --git a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp index f0e900b0..c2fc4715 100644 --- a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp +++ b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp @@ -7,6 +7,7 @@ #include "Contents/Skills/SkillInfo.h" #include "File/File.h" #include "File/ShortcutFilename.h" +#include "Render/DeviceContext/DCSurface.h" #include "UI/Exchange/UIExchangeUI.h" #include "UI/Items/UISpellListWnd.h" #include "Client/Registry.h" @@ -21,7 +22,6 @@ #include "UI/Chat/ChatSuggestions.h" #include "UI/Rodex/UIRodexComposeWnd.h" #include "Contents/Items/ItemNaming.h" -#include "UI/Window/WindowRegistration.h" #include "Contents/GuildInfo.h" #include "Contents/TipBoxTitles.h" #include "Contents/TipOfTheDay.h" @@ -879,7 +879,7 @@ void UIMonsterDisplayWnd::Paint() { if (cell.imageType == 0) { texture = g_renderer->atlas.Find(image, sprite->palette, record); if (!texture) { - texture = g_renderer->atlas.Insert(this->m_context->renderSystem, image, sprite->palette, record, g_serviceType, g_resourceReuseDelay); + texture = g_renderer->atlas.Insert(*GetRenderSystemHolder()->system, image, sprite->palette, record, g_serviceType, g_resourceReuseDelay); } } else { texture = static_cast(const_cast(image->unknown_0008)); @@ -1777,7 +1777,7 @@ void UIPetTamingDeceiveWnd::Paint() { const SpriteRleImage* image = sprite->images[0][cell.image]; CTexture* texture = g_renderer->atlas.Find(image, sprite->palette, record); if (!texture) { - texture = g_renderer->atlas.Insert(this->m_context->renderSystem, image, sprite->palette, record, g_serviceType, g_resourceReuseDelay); + texture = g_renderer->atlas.Insert(*GetRenderSystemHolder()->system, image, sprite->palette, record, g_serviceType, g_resourceReuseDelay); } this->geometry.surface->DrawSurface( this->geometry.width / 2 + cell.x, this->geometry.height / 2 + cell.y, texture, static_cast(record.u0 * 256.0f), @@ -1981,7 +1981,7 @@ void UIMenuWnd::Slot31(int x, int y) { if (target) { target->SendMsg(nullptr, 48, choice, 0, 0, 0); } else if (this->m_menuId == 10041) { - this->m_context->mode->SendModeMessage(24, choice, 0, 0, 0); + static_cast(g_charViewMode)->SendMsg(24, choice, 0, 0, 0); } g_windowMgr.CloseWindow(18); } @@ -3317,10 +3317,10 @@ int UIBabyAcceptWnd2::SendMsg(UIWindow* sender, int message, std::intptr_t a, st this->m_acceptance->recorder.Record(this->geometry.id, static_cast(a), b, c, d); if (a == 184) { g_windowMgr.CloseWindow(110); - this->m_context->mode->SendModeMessage(173, this->identity, 1, 0, 0); + static_cast(g_charViewMode)->SendMsg(173, this->identity, 1, 0, 0); } else if (a == 185) { g_windowMgr.CloseWindow(110); - this->m_context->mode->SendModeMessage(173, this->identity, 0, 0, 0); + static_cast(g_charViewMode)->SendMsg(173, this->identity, 0, 0, 0); } return 0; } @@ -3370,7 +3370,7 @@ int UIBabyAcceptWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std g_windowMgr.EnsureWindow(110)->SendMsg(nullptr, 91, 184, b, 0, 0); } else if (a == 185) { g_windowMgr.CloseWindow(105); - this->m_context->mode->SendModeMessage(173, this->identity, 0, 0, 0); + static_cast(g_charViewMode)->SendMsg(173, this->identity, 0, 0, 0); } return 0; } @@ -3606,10 +3606,10 @@ int UIChooseSellBuyWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, if (this->geometry.visible != 0) { if (response == 185) { - this->m_context->mode->SendModeMessage(40, 0, 0, 0, 0); + static_cast(g_charViewMode)->SendMsg(40, 0, 0, 0, 0); g_windowMgr.CloseWindow(25); } else if (response == 223 || response == 224) { - this->m_context->mode->SendModeMessage(response == 223 ? 37 : 38, this->identity, 0, 0, 0); + static_cast(g_charViewMode)->SendMsg(response == 223 ? 37 : 38, this->identity, 0, 0, 0); g_windowMgr.LookupWindow(25)->Show(0); } else { return 0; @@ -6431,10 +6431,10 @@ int UIJoinGuildAcceptWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a g_windowMgr.CloseWindow(214); g_windowMgr.CloseWindow(213); g_windowMgr.CloseWindow(212); - this->m_context->mode->SendModeMessage(114, this->identity, 1, 0, 0); + static_cast(g_charViewMode)->SendMsg(114, this->identity, 1, 0, 0); } else if (a == 185) { g_windowMgr.CloseWindow(70); - this->m_context->mode->SendModeMessage(114, this->identity, 0, 0, 0); + static_cast(g_charViewMode)->SendMsg(114, this->identity, 0, 0, 0); } return 0; } @@ -6769,7 +6769,7 @@ int UICoupleAcceptWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, s } else { return 0; } - this->m_context->mode->SendModeMessage(167, this->identity, accepted, 0, 0); + static_cast(g_charViewMode)->SendMsg(167, this->identity, accepted, 0, 0); return 0; } @@ -6858,7 +6858,7 @@ int UIJoinFriendAcceptWnd::SendMsg(UIWindow* sender, int message, std::intptr_t } else { return 0; } - this->m_context->mode->SendModeMessage(175, this->m_accountId, this->m_characterId, accepted, 0); + static_cast(g_charViewMode)->SendMsg(175, this->m_accountId, this->m_characterId, accepted, 0); return 0; } @@ -6911,7 +6911,7 @@ int UIMixAcceptWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std: if (a == 184) { g_windowMgr.CloseWindow(160); g_windowMgr.CloseWindow(161); - this->m_context->mode->SendModeMessage(266, 0, 0, 0, 0); + static_cast(g_charViewMode)->SendMsg(266, 0, 0, 0, 0); g_windowMgr.CloseWindow(163); reinterpret_cast(&g_session)->ClearTradeItems(); } else if (a == 185) { @@ -7088,7 +7088,7 @@ int UISkillNameChangeWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a if (message == 6) { if (a == 184) { if (this->m_skillId != -1 && this->m_edit->Length() != 0) { - this->m_context->mode->SendModeMessage(98, this->m_skillId, reinterpret_cast(this->m_edit->Text()), 0, 0); + static_cast(g_charViewMode)->SendMsg(98, this->m_skillId, reinterpret_cast(this->m_edit->Text()), 0, 0); } g_windowMgr.CloseWindow(55); } @@ -9548,7 +9548,7 @@ int UIFrameWnd::BuildItemName( ItemDescriptions descriptions{g_itemDescriptions}; const auto unknownCreator = [&]() { - this->m_context->registration.Add(this); + g_windowMgr.RegisterWindow(this); const int error = strncpy_s(*cursor, *remaining, LookupMessage(581), _TRUNCATE); if (error == 0 || error == STRUNCATE) { const std::size_t bytes = *cursor ? strnlen(*cursor, *remaining) : 0; @@ -10291,7 +10291,8 @@ void UIExchangeWnd::Paint() { continue; } const int y = this->m_rowHeight * row; - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, this->m_context->fonts, this->m_context->locale, 16, y + 21, item, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, 16, y + 21, item, 0, 0); this->DrawFittedItemName(48, y + 29, &item, 0, 0, 12, 1); if (item.unknown_0088 > 0) { const std::string path = FormatOwnedString("유저인터페이스\\grade_enchant\\grade_icon%d.bmp", item.unknown_0088); @@ -10309,7 +10310,8 @@ void UIExchangeWnd::Paint() { continue; } const int y = this->m_rowHeight * row; - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, this->m_context->fonts, this->m_context->locale, 295, y + 21, item, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, 295, y + 21, item, 0, 0); this->DrawFittedItemName(327, y + 29, &item, 0, 0, 12, 1); if (item.unknown_0088 > 0) { const std::string path = FormatOwnedString("유저인터페이스\\grade_enchant\\grade_icon%d.bmp", item.unknown_0088); diff --git a/Source/UI/Acceptance/UIExchangeAcceptWnd.cpp b/Source/UI/Acceptance/UIExchangeAcceptWnd.cpp index 53bbfd01..d1372438 100644 --- a/Source/UI/Acceptance/UIExchangeAcceptWnd.cpp +++ b/Source/UI/Acceptance/UIExchangeAcceptWnd.cpp @@ -1,3 +1,4 @@ +#include "Client/Mode/CMode.h" #include "Contents/MessageTable.h" #include "Client/Mode/ModeEvents.h" #include "Client/ReplayPacketRecorder.h" @@ -6,6 +7,7 @@ #include "UI/Buttons/UIButton.h" #include "UI/Acceptance/UIJoinPartyAcceptWnd.h" #include "UI/Text/UITextViewer.h" +#include "UI/Window/UINewSelectCharWnd.h" #include "UI/Window/WindowManagerWindows.h" #include @@ -42,7 +44,7 @@ int UIExchangeAcceptWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, if (response == 184 || response == 185) { g_windowMgr.CloseWindow(32); - this->m_context->mode->SendModeMessage(50, response == 184 ? 3 : 4, 0, 0, 0); + static_cast(g_charViewMode)->SendMsg(50, response == 184 ? 3 : 4, 0, 0, 0); } return 0; diff --git a/Source/UI/Acceptance/UIJoinPartyAcceptWnd.cpp b/Source/UI/Acceptance/UIJoinPartyAcceptWnd.cpp index d64bb1c3..41a6a362 100644 --- a/Source/UI/Acceptance/UIJoinPartyAcceptWnd.cpp +++ b/Source/UI/Acceptance/UIJoinPartyAcceptWnd.cpp @@ -1,9 +1,11 @@ +#include "Client/Mode/CMode.h" #include "Contents/MessageTable.h" #include "Client/Mode/ModeEvents.h" #include "Client/ReplayPacketRecorder.h" #include "UI/Buttons/UIButton.h" #include "UI/Acceptance/UIJoinPartyAcceptWnd.h" #include "UI/Text/UITextViewer.h" +#include "UI/Window/UINewSelectCharWnd.h" #include "UI/Window/WindowManagerWindows.h" #include @@ -26,7 +28,7 @@ int UIJoinPartyAcceptWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a if (response == 184 || response == 185) { g_windowMgr.CloseWindow(35); - this->m_context->mode->SendModeMessage(60, this->identity, response == 184, 0, 0); + static_cast(g_charViewMode)->SendMsg(60, this->identity, response == 184, 0, 0); } return 0; diff --git a/Source/UI/Buttons/UIButton.cpp b/Source/UI/Buttons/UIButton.cpp index 1a832bd6..b810a987 100644 --- a/Source/UI/Buttons/UIButton.cpp +++ b/Source/UI/Buttons/UIButton.cpp @@ -5,7 +5,6 @@ #include "Client/Mode/ModeTooltip.h" #include "Contents/MessageTable.h" #include "Client/Mode/CMode.h" -#include "Client/Mode/ModeCursor.h" #include "Client/Mode/ModeEvents.h" #include "Resource/Bitmap/BitmapResource.h" #include "Resource/ResourceMgr.h" @@ -143,7 +142,7 @@ void UIButton::Slot29(int x, int y) { // OFFSET: 0x0085F950 // FUNCTION: fn_10875 void UIButton::ResetCursor(int, int) { - this->m_context->cursor.Set(this->m_disabled != 0 ? 0 : 2, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(this->m_disabled != 0 ? 0 : 2); } // OFFSET: 0x0085EED0 @@ -170,10 +169,10 @@ void UIButton::Slot31(int x, int y) { 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 && this->m_context->mode && static_cast(g_charViewMode)->cursorType == 2) { + if (id == 185 && g_charViewMode && static_cast(g_charViewMode)->cursorType == 2) { const char* text = LookupMessage(17); if (reinterpret_cast(&g_windowMgr)->Confirm(text, 2, true, false, 0, "Message", 280, 120, 0) == 187) { - this->m_context->mode->SendModeMessage(2, 0, 0, 0, 0); + static_cast(g_charViewMode)->SendMsg(2, 0, 0, 0, 0); } } else { if (id == 184 || id == 321) { @@ -186,7 +185,7 @@ void UIButton::Slot31(int x, int y) { } } } else { - this->m_context->mode->SendModeMessage(0, this->geometry.id, this->m_argument, 0, 0); + static_cast(g_charViewMode)->SendMsg(0, this->geometry.id, this->m_argument, 0, 0); } } diff --git a/Source/UI/Buttons/UICheckBox.cpp b/Source/UI/Buttons/UICheckBox.cpp index fb1da416..4ebb69de 100644 --- a/Source/UI/Buttons/UICheckBox.cpp +++ b/Source/UI/Buttons/UICheckBox.cpp @@ -1,7 +1,7 @@ +#include "Client/Mode/CMode.h" #include "UI/Window/UINewSelectCharWnd.h" #include "Client/Mode/ModeTooltip.h" #include "Client/Replay.h" -#include "Client/Mode/ModeCursor.h" #include "Render/DeviceContext/DeviceContext.h" #include "Resource/Bitmap/BitmapResource.h" #include "Resource/ResourceMgr.h" @@ -128,7 +128,7 @@ void UICheckBox::Slot28(int x, int y) { // FUNCTION: fn_10877 void UICheckBox::ResetCursor(int, int) { if (this->m_disabled == 0) { - this->m_context->cursor.Set(2, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(2); } } diff --git a/Source/UI/Buttons/UITextButton.cpp b/Source/UI/Buttons/UITextButton.cpp index 10fa7bb9..ad7ca61c 100644 --- a/Source/UI/Buttons/UITextButton.cpp +++ b/Source/UI/Buttons/UITextButton.cpp @@ -1,4 +1,6 @@ #include "Client/Input/InputCharset.h" +#include "Client/Mode/CMode.h" +#include "Render/Renderer.h" #include "UI/Window/UINewSelectCharWnd.h" #include "Client/Replay.h" #include "UI/Window/WindowPolicy.h" @@ -24,7 +26,6 @@ #include "UI/UIBasicCtrl.h" #include "Utility/Text/FormatString.h" #include "UI/Lists/UIMemberListBox.h" -#include "Client/Mode/ModeCursor.h" #include "UI/Buttons/UIBitmapButton2.h" #include "UI/Buttons/UISlotBmpButton.h" #include "UI/UIStaticBitmap.h" @@ -1050,14 +1051,14 @@ void UITreeView::Slot27(int x, int y) { // OFFSET: 0x00892560 // FUNCTION: fn_11473 void UIImgMenu::ResetCursor(int, int) { - this->m_context->cursor.Set(2, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(2); } // OFFSET: 0x008925A0 // FUNCTION: fn_11475 void UIString::ResetCursor(int, int) { if (!this->unknown_0084.empty() || !this->unknown_00AC.empty()) { - this->m_context->cursor.Set(2, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(2); } } @@ -1076,7 +1077,7 @@ void UITVTextButton::ResetCursor(int x, int y) { if (this->m_disabled != 0) { UIWindow::ResetCursor(x, y); } else { - this->m_context->cursor.Set(0, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(0); } } @@ -2296,7 +2297,7 @@ void UIBasicSkillCtrl::Paint() { if (skill.level != 0) { std::sprintf(text, "%d", skill.level); FontCache& fonts = g_fontCache; - const TextLocale& locale = this->m_context->locale; + const TextLocale locale = {}; const int x = this->geometry.width - this->TextWidth(text, 0, 0, 11, 0, 0); this->DrawTextAt(x, 15, text, 0, 0, 11, 0xFFFFFF, 0, 0); this->DrawTextAt(x - 2, 15, text, 0, 0, 11, 0xFFFFFF, 0, 0); @@ -2333,7 +2334,7 @@ void UIBmpRadioBtn::Paint() { } FontCache& fonts = g_fontCache; - const TextLocale& locale = this->m_context->locale; + const TextLocale locale = {}; if (this->m_disabled == true) { for (auto it = this->m_texts.begin(); it != this->m_texts.end(); ++it) { if (it->id == 3) { @@ -3399,9 +3400,9 @@ void UITextViewEX::Paint() { // OFFSET: 0x0088D560 // FUNCTION: fn_11376 void UIRPImageWnd::Paint() { - this->SetSolid(this->m_context->primitives, this->geometry.width, this->geometry.height, 0); + this->SetSolid(g_renderer->primitives, this->geometry.width, this->geometry.height, 0); for (int i = 0; i < this->m_imageCount; ++i) { - this->DrawNamed(this->m_context->primitives, 0, 0, this->m_imageName.c_str(), 0xFFFFFFFF, 0, 0); + this->DrawNamed(g_renderer->primitives, 0, 0, this->m_imageName.c_str(), 0xFFFFFFFF, 0, 0); } } @@ -3452,7 +3453,7 @@ void UIChatHisBox2::Paint() { } FontCache& fonts = g_fontCache; - const TextLocale& locale = this->m_context->locale; + const TextLocale locale = {}; for (int row = 0; top + row < static_cast(end); ++row) { const int index = top + row; int x; @@ -3487,7 +3488,7 @@ void UIChatHisBox3::Paint() { } FontCache& fonts = g_fontCache; - const TextLocale& locale = this->m_context->locale; + const TextLocale locale = {}; for (int row = 0; top + row < static_cast(end); ++row) { const int index = top + row; this->DrawTextAt(2, this->lineHeight * row + 3, this->lines[index].c_str(), 0, 0, this->unknown_0134, this->unknown_00E4[index], 0, 0); diff --git a/Source/UI/Buttons/UITextureButton.cpp b/Source/UI/Buttons/UITextureButton.cpp index ebfc51d6..36c06ff2 100644 --- a/Source/UI/Buttons/UITextureButton.cpp +++ b/Source/UI/Buttons/UITextureButton.cpp @@ -37,10 +37,10 @@ void UITextureButton::Slot31(int x, int y) { 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 && this->m_context->mode && static_cast(g_charViewMode)->cursorType == 2) { + if (id == 185 && g_charViewMode && static_cast(g_charViewMode)->cursorType == 2) { const char* text = LookupMessage(17); if (reinterpret_cast(&g_windowMgr)->Confirm(text, 2, true, false, 0, "Message", 280, 120, 0) == 187) { - this->m_context->mode->SendModeMessage(2, 0, 0, 0, 0); + static_cast(g_charViewMode)->SendMsg(2, 0, 0, 0, 0); } } else { if (id == 184 || id == 321) { @@ -52,7 +52,7 @@ void UITextureButton::Slot31(int x, int y) { } } } else { - this->m_context->mode->SendModeMessage(0, this->geometry.id, this->m_argument, 0, 0); + static_cast(g_charViewMode)->SendMsg(0, this->geometry.id, this->m_argument, 0, 0); } } diff --git a/Source/UI/CashShop/UICashShopWnd.cpp b/Source/UI/CashShop/UICashShopWnd.cpp index f9e21682..a46a6e5d 100644 --- a/Source/UI/CashShop/UICashShopWnd.cpp +++ b/Source/UI/CashShop/UICashShopWnd.cpp @@ -2,7 +2,6 @@ #include "Client/Mode/CGameMode.h" #include "Client/Mode/CMode.h" -#include "Client/Mode/ModeCursor.h" #include "Client/Mode/ModeDragState.h" #include "Client/Mode/ModeMgr.h" #include "Client/Mode/ModeTooltip.h" @@ -26,6 +25,7 @@ #include "UI/Lists/UIScrollBarVariants.h" #include "UI/Shortcuts/ShortcutVisibility.h" #include "UI/UIStaticBitmap.h" +#include "UI/Window/UINewSelectCharWnd.h" #include "UI/Window/UIWindowMgr.h" #include "UI/Window/WindowDialogs.h" #include "UI/Window/WindowManagerWindows.h" @@ -701,7 +701,7 @@ void UICashShopWnd_Item::Slot28(int x, int y) { // OFFSET: 0x007D1230 // FUNCTION: fn_09550 void UICashShopWnd_Banner::ResetCursor(int, int) { - this->m_context->cursor.Set(2, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(2); } // OFFSET: 0x007D1240 diff --git a/Source/UI/Chat/UIChatRoomTitle.cpp b/Source/UI/Chat/UIChatRoomTitle.cpp index 2fc1b768..8671c1ad 100644 --- a/Source/UI/Chat/UIChatRoomTitle.cpp +++ b/Source/UI/Chat/UIChatRoomTitle.cpp @@ -1,4 +1,4 @@ -#include "Client/Mode/ModeCursor.h" +#include "Client/Mode/CMode.h" #include "Client/Mode/ModeMgr.h" #include "Contents/ForbiddenWords.h" #include "Contents/MessageTable.h" @@ -7,6 +7,7 @@ #include "Resource/TextureNames.h" #include "UI/Chat/UIChatRoomTitle.h" #include "UI/Text/UIStaticText.h" +#include "UI/Window/UINewSelectCharWnd.h" #include "UI/Window/UIWindowMgr.h" #include @@ -81,9 +82,9 @@ void UIChatRoomTitle::Paint() { // FUNCTION: fn_10876 void UIChatRoomTitle::ResetCursor(int x, int y) { if (x >= 0 && x < this->geometry.width && y >= 0 && y <= this->geometry.height) { - this->m_context->cursor.Set(2, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(2); } else { - this->m_context->cursor.Set(0, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(0); } } diff --git a/Source/UI/Dialogs/UIEditctrlWnd.cpp b/Source/UI/Dialogs/UIEditctrlWnd.cpp index 8c21f8dd..95e2b234 100644 --- a/Source/UI/Dialogs/UIEditctrlWnd.cpp +++ b/Source/UI/Dialogs/UIEditctrlWnd.cpp @@ -1,8 +1,8 @@ +#include "Client/Mode/CMode.h" #include "UI/Dialogs/UIEditctrlWnd.h" #include "Client/Application/Launcher.h" #include "Client/Mode/CGameMode.h" -#include "Client/Mode/ModeCursor.h" #include "Client/Mode/ModeMgr.h" #include "Client/Session.h" #include "Render/DeviceContext/DeviceContext.h" @@ -22,6 +22,7 @@ #include "UI/Dialogs/UIMiniMapWnd.h" #include "UI/Edit/UIEditCtrl.h" #include "UI/Window/InputFocus.h" +#include "UI/Window/UINewSelectCharWnd.h" #include "UI/Window/UIWindowMgr.h" #include "UI/Window/WindowDialogs.h" #include "Utility/Text/FormatString.h" @@ -238,9 +239,9 @@ void UIMiniMapWnd::Slot25(int x, int y) { // FUNCTION: fn_13561 void UIMiniMapWnd::ResetCursor(int, int) { if (this->dragging) { - this->m_context->cursor.Set(1, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(1); } else { - this->m_context->cursor.Set(0, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(0); } } diff --git a/Source/UI/Edit/UIEditCtrl.cpp b/Source/UI/Edit/UIEditCtrl.cpp index 7a6bfa52..95183ec1 100644 --- a/Source/UI/Edit/UIEditCtrl.cpp +++ b/Source/UI/Edit/UIEditCtrl.cpp @@ -93,7 +93,6 @@ #include "Contents/UserData/CharacterConfigSave.h" #include "UI/Edit/UIItemTagCtrl.h" #include "UI/Window/WindowBorder.h" -#include "UI/Window/WindowRegistration.h" #include "UI/Window/UINewSelectCharWnd.h" #include "Contents/TipBoxTitles.h" #include @@ -413,6 +412,7 @@ void UIEditCtrl::PaintText() { void UIEditCtrl::Synchronize() { const bool focused = g_windowMgr.hoverWindow == this; EditTextState state{this->text, this->anchor, this->cursor, this->maximum, focused, g_textCodePage}; + const TextLocale locale = {}; EditViewport viewport{ this->text, this->anchor, @@ -423,7 +423,7 @@ void UIEditCtrl::Synchronize() { state, *this->geometry.surface, g_fontCache, - this->m_context->locale + locale }; viewport.Synchronize(); } @@ -890,7 +890,7 @@ void UIEditCtrl_Custom::Synchronize() { } FontCache& fonts = g_fontCache; - const TextLocale& locale = this->m_context->locale; + const TextLocale locale = {}; const int available = this->geometry.width - 12; if (this->cursor > previousCursor || clamped) { @@ -1412,7 +1412,8 @@ void UIItemBaseWnd::Paint() { const int x = visible % this->columns * 32 + 44; if (this->showQuantity != 0) { - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, x, top + 21, *it, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, x, top + 21, *it, 0, 0); } else { DrawItemIcon(*this, ResourceMgr::Instance(), descriptions, x, top + 21, *it, 0); } @@ -6864,7 +6865,8 @@ void UIItemStoreFindWnd::Paint() { const int left = visible % this->columns * 32 + 10; const int width = this->geometry.width - left - 66; const int x = left + 4; - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, x, top + 21, *it, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, x, top + 21, *it, 0, 0); this->DrawWrappedItemName(left + 40, top + 29, width, &*it, 0, 0, 12); if (it->unknown_0088 > 0) { @@ -6923,7 +6925,8 @@ void UIItemStoreSubWnd::Paint() { const int left = visible % this->columns * 32 + 10; const int width = this->geometry.width - left - 66; const int x = left + 4; - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, x, top + 21, *it, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, x, top + 21, *it, 0, 0); this->DrawWrappedItemName(left + 40, top + 29, width, &*it, 0, 0, 12); if (it->unknown_0088 > 0) { @@ -7002,7 +7005,8 @@ void UIItemPurchaseWnd::Paint() { } const int x = column + 44; - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, x, top + 21, *it, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, x, top + 21, *it, 0, 0); int nameWidth = 110; const int amount = static_cast(it->unknown_0014[0]); @@ -7131,7 +7135,8 @@ void UIItemSellWnd::Paint() { } const int x = column + 44; - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, x, top + 21, *it, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, x, top + 21, *it, 0, 0); int nameWidth = 100; const int amount = static_cast(it->unknown_0014[0]); @@ -7240,7 +7245,8 @@ void UIItemShopWnd::Paint() { } const int x = column + 44; - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, x, top + 21, *it, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, x, top + 21, *it, 0, 0); int nameWidth = 100; const int amount = static_cast(it->unknown_0014[0]); @@ -7388,7 +7394,8 @@ void UIItemStoreWnd::Paint() { const int top = visible / this->columns * 32; const int column = visible % this->columns * 32; const int x = column + 44; - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, x, top + 21, *it, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, x, top + 21, *it, 0, 0); this->DrawWrappedItemName(column + 80, top + 29, 180, &*it, 0, 0, 12); if (it->unknown_0088 > 0) { @@ -7470,7 +7477,8 @@ void UIMerchantItemPurchaseWnd::Paint() { } const int x = column + 44; - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, x, top + 21, *it, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, x, top + 21, *it, 0, 0); this->DrawWrappedItemName(column + 76, top + 29, 90, &*it, 0, 0, 12); if (it->unknown_0088 > 0) { @@ -7668,7 +7676,8 @@ void UIMerchantShopMakeWnd::Paint() { const int top = visible / this->columns * 42; const int column = visible % this->columns * 42; const int x = column + 7; - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, x, top + 48, *it, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, x, top + 48, *it, 0, 0); this->DrawWrappedItemName(column + 39, top + 57, 100, &*it, 0, 0, 12); if (it->unknown_0088 > 0) { @@ -8290,7 +8299,7 @@ void UIMerchantItemShopWnd::Paint() { if (!actor.empty()) { sprintf(title, "%s - %s", label, actor.c_str()); } else { - this->m_context->registration.Add(this); + g_windowMgr.RegisterWindow(this); sprintf(title, "%s", label); } this->DrawTextAt(17, 3, title, 0, 0, 12, 0xFFFFFF, 0, 0); @@ -8326,7 +8335,8 @@ void UIMerchantItemShopWnd::Paint() { DrawItemIcon(*this, ResourceMgr::Instance(), descriptions, x, top + 21, *it, 0); } else { x = column + 44; - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, x, top + 21, *it, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, x, top + 21, *it, 0, 0); } if (it->unknown_0088 > 0) { @@ -8659,7 +8669,8 @@ void UIItemSellWnd2::Paint() { } const int x = column + 44; - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, x, top + 21, *it, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, x, top + 21, *it, 0, 0); this->DrawFittedItemName(column + 76, top + 29, &*it, 0, 0, 12, 0); if (it->unknown_0088 > 0) { @@ -8738,7 +8749,8 @@ void UIItemShopWnd2::Paint() { } const int x = column + 44; - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, x, top + 21, *it, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, x, top + 21, *it, 0, 0); this->DrawFittedItemName(column + 76, top + 29, &*it, 0, 0, 12, 0); if (it->unknown_0088 > 0) { @@ -8997,7 +9009,8 @@ void UIItemWnd::Paint() { const int top = visible / this->columns * 32; const int x = visible % this->columns * 32 + 44; const int y = top + 21; - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, x, y, *it, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, x, y, *it, 0, 0); if (it->unknown_0088 > 0) { this->DrawBitmap( diff --git a/Source/UI/Edit/UIEditVariants.cpp b/Source/UI/Edit/UIEditVariants.cpp index f9530afe..aef7a00e 100644 --- a/Source/UI/Edit/UIEditVariants.cpp +++ b/Source/UI/Edit/UIEditVariants.cpp @@ -439,7 +439,7 @@ void UIEditCtrl_OldList::RecallHistory(int step) { // FUNCTION: fn_10753 void UIEditCtrl3::PaintText() { FontCache& fonts = g_fontCache; - const TextLocale& locale = this->m_context->locale; + const TextLocale locale = {}; int x = 3; if (this->invalidatesParent == 0 && this->firstVisible != 0) { diff --git a/Source/UI/Guild/UIGuildWnd.cpp b/Source/UI/Guild/UIGuildWnd.cpp index 76e5daa7..21266613 100644 --- a/Source/UI/Guild/UIGuildWnd.cpp +++ b/Source/UI/Guild/UIGuildWnd.cpp @@ -1,3 +1,4 @@ +#include "Render/DeviceContext/DCSurface.h" #include "UI/Guild/UIGuildWnd.h" #include "Client/Mode/CGameMode.h" #include "Client/Mode/CMode.h" @@ -1950,7 +1951,7 @@ bool UIGuildMemberManageWnd::DrawMember(GuildInfo::Member& member, int& index, i if (cell.imageType == 0) { texture = g_renderer->atlas.Find(image, palette, record); if (!texture) { - texture = g_renderer->atlas.Insert(this->m_context->renderSystem, image, palette, record, g_serviceType, g_resourceReuseDelay); + texture = g_renderer->atlas.Insert(*GetRenderSystemHolder()->system, image, palette, record, g_serviceType, g_resourceReuseDelay); } } else { texture = static_cast(const_cast(image->unknown_0008)); diff --git a/Source/UI/Item/UIMerchantItemLogWnd.cpp b/Source/UI/Item/UIMerchantItemLogWnd.cpp index dee54ba9..de366ba5 100644 --- a/Source/UI/Item/UIMerchantItemLogWnd.cpp +++ b/Source/UI/Item/UIMerchantItemLogWnd.cpp @@ -1,4 +1,5 @@ #include "Render/Text/FontCache.h" +#include "Render/Text/TextContext.h" #include "UI/Item/UIMerchantItemLogWnd.h" #include "Client/Mode/ModeTooltip.h" @@ -121,7 +122,8 @@ void UIMerchantItemLogWnd::Paint() { const int top = visible / this->columns * 32; const int x = visible % this->columns * 32 + 44; - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, x, top + 21, *it, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, x, top + 21, *it, 0, 0); if (it->unknown_0088 > 0) { this->DrawBitmap( diff --git a/Source/UI/Item/UIParaItemShopWnd.cpp b/Source/UI/Item/UIParaItemShopWnd.cpp index dff16fed..fc1fdf4c 100644 --- a/Source/UI/Item/UIParaItemShopWnd.cpp +++ b/Source/UI/Item/UIParaItemShopWnd.cpp @@ -1,4 +1,5 @@ #include "Render/Text/FontCache.h" +#include "Render/Text/TextContext.h" #include "UI/Item/UIParaItemShopWnd.h" #include "Client/Input/InputCharset.h" @@ -729,9 +730,11 @@ void UIParaItemShopWnd::Paint() { } if (this->unknown_00F8 == 1 || it->quantity != 0) { - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, 34, top + 4, *it, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, 34, top + 4, *it, 0, 0); } else { - DrawItemWithQuantityAuxiliary(*this, descriptions, g_fontCache, this->m_context->locale, 1, 34, top + 4, *it, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantityAuxiliary(*this, descriptions, g_fontCache, locale, 1, 34, top + 4, *it, 0, 0); } this->DrawWrappedItemName(70, top + 12, 120, &*it, 0, 0, 12); @@ -854,7 +857,8 @@ void UIParaResultWnd::Paint() { } const int x = column + 44; - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, x, top + 21, *it, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, x, top + 21, *it, 0, 0); this->DrawWrappedItemName(column + 76, top + 29, 110, &*it, 0, 0, 12); if (it->unknown_0088 > 0) { diff --git a/Source/UI/Items/MergeItemWnd.cpp b/Source/UI/Items/MergeItemWnd.cpp index 0c89a7aa..f073a6af 100644 --- a/Source/UI/Items/MergeItemWnd.cpp +++ b/Source/UI/Items/MergeItemWnd.cpp @@ -1,4 +1,5 @@ #include "Render/Text/FontCache.h" +#include "Render/Text/TextContext.h" #include "UI/Items/MergeItemWnd.h" #include "Client/Input/InputCharset.h" @@ -160,8 +161,9 @@ void CMergeItemWnd::Paint() { box->SetHidden(false); box->Move(this->m_checkOffsetX + x, this->m_checkOffsetY + y); ItemDescriptions descriptions{g_itemDescriptions}; + const TextLocale locale = {}; DrawItemWithQuantity( - *this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, this->m_slotOffsetX + x, this->m_slotOffsetY + y, item, 0, 0 + *this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, this->m_slotOffsetX + x, this->m_slotOffsetY + y, item, 0, 0 ); } } diff --git a/Source/UI/Lists/UIScrollBar.cpp b/Source/UI/Lists/UIScrollBar.cpp index 31a39c5b..c44b5cd6 100644 --- a/Source/UI/Lists/UIScrollBar.cpp +++ b/Source/UI/Lists/UIScrollBar.cpp @@ -1,7 +1,6 @@ #include "Network/TextEncoding.h" #include "Render/Text/FontCache.h" #include "Client/Mode/ModeMgr.h" -#include "Client/Mode/ModeCursor.h" #include "Render/DeviceContext/DeviceContext.h" #include "Resource/Bitmap/BitmapResource.h" #include "Resource/ResourceMgr.h" @@ -297,7 +296,7 @@ void UIScrollBar::Slot27(int x, int y) { // OFFSET: 0x00892570 // FUNCTION: fn_11474 void UIScrollBar::ResetCursor(int, int) { - this->m_context->cursor.Set(this->maximum != 0 ? 2 : 0, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(this->maximum != 0 ? 2 : 0); } // OFFSET: 0x00890E90 @@ -656,7 +655,7 @@ void UIEditCtrl_Custom::PaintText() { const int y = this->unknown_0124 + this->textY; std::string display; FontCache& fonts = g_fontCache; - const TextLocale& locale = this->m_context->locale; + const TextLocale locale = {}; const auto align = [&]() { if (this->unknown_0128 == 1) { x = this->geometry.width - x - this->TextWidth(display.c_str(), 0, 0, 12, this->unknown_011C, 0); @@ -739,7 +738,7 @@ void UIBasicItemCtrl::DrawItemIcon(int x, int y, int, bool compact) { const std::string count = FormatOwnedString("%d", this->m_item.quantity); FontCache& fonts = g_fontCache; - const TextLocale& locale = this->m_context->locale; + const TextLocale locale = {}; int textY; if (compact) { textY = y + 20; @@ -1360,7 +1359,7 @@ void UIChatHisBox::Paint() { } FontCache& fonts = g_fontCache; - const TextLocale& locale = this->m_context->locale; + const TextLocale locale = {}; for (int row = 0; top + row < static_cast(end); ++row) { const int index = top + row; int x; @@ -1482,7 +1481,7 @@ int UITreeView::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::int } break; case 108: - this->m_context->cursor.Set(0, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(0); if (this->unknown_008C && this->unknown_008C->id != a) { UITreeNode* target = reinterpret_cast(a); this->unknown_0090 = target; @@ -1506,7 +1505,7 @@ int UITreeView::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::int break; } - this->m_context->cursor.Set(2, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(2); UITreeNode* node = this->unknown_008C; UITVTextButton* label = node->labelButton; this->RemoveChildNode(node->unknown_0170, node->id, true); diff --git a/Source/UI/Menu/UIMenuIconWnd.cpp b/Source/UI/Menu/UIMenuIconWnd.cpp index 76afe689..167413aa 100644 --- a/Source/UI/Menu/UIMenuIconWnd.cpp +++ b/Source/UI/Menu/UIMenuIconWnd.cpp @@ -1,3 +1,4 @@ +#include "Render/Renderer.h" #include "UI/Menu/UIMenuIconWnd.h" #include "Client/Application/ApplicationWindow.h" @@ -219,7 +220,7 @@ void UIMenuIconWnd::Paint() { this->unknown_00BC[it->first]->Enable(0); } } else { - this->DrawNamed(this->m_context->primitives, 0, 13, "유저인터페이스\\menu_icon\\bg_menu.tga", 0xFFFFFFFF, 0, 0); + this->DrawNamed(g_renderer->primitives, 0, 13, "유저인터페이스\\menu_icon\\bg_menu.tga", 0xFFFFFFFF, 0, 0); const bool pinned = std::find(this->unknown_00C4.begin(), this->unknown_00C4.end(), it->first) != this->unknown_00C4.end(); it->second->Enable(!pinned); if (this->unknown_00BC.find(it->first) != this->unknown_00BC.end()) { diff --git a/Source/UI/Party/UIMiniPartyWnd.cpp b/Source/UI/Party/UIMiniPartyWnd.cpp index abc4ba7e..20c9dbe7 100644 --- a/Source/UI/Party/UIMiniPartyWnd.cpp +++ b/Source/UI/Party/UIMiniPartyWnd.cpp @@ -63,7 +63,7 @@ void UIMiniPartyWnd::Paint() { this->m_primitives.clear(); const int count = this->m_member.offline != 1 ? 3 : 1; for (int index = 0; index < count; ++index) { - this->DrawNamed(this->m_context->primitives, 0, 0, this->m_imageName, 0xFFFFFFFF, 0, 0); + this->DrawNamed(g_renderer->primitives, 0, 0, this->m_imageName, 0xFFFFFFFF, 0, 0); } } diff --git a/Source/UI/Party/UIRequestJoinPartyWnd.cpp b/Source/UI/Party/UIRequestJoinPartyWnd.cpp index 0df30c19..f7354a2f 100644 --- a/Source/UI/Party/UIRequestJoinPartyWnd.cpp +++ b/Source/UI/Party/UIRequestJoinPartyWnd.cpp @@ -1,3 +1,4 @@ +#include "Client/Mode/CMode.h" #include "Contents/MessageTable.h" #include "Client/Mode/ModeEvents.h" #include "Client/Session.h" @@ -13,6 +14,7 @@ #include "UI/Party/UIRequestJoinPartyWnd.h" #include "UI/Text/UIStaticText.h" #include "UI/Text/UITextViewer.h" +#include "UI/Window/UINewSelectCharWnd.h" #include @@ -161,7 +163,7 @@ int UIRequestJoinPartyWnd::SendMsg(UIWindow* sender, int message, std::intptr_t this->m_request->requests.Block(this->accountId); } - this->m_context->mode->SendModeMessage(264, this->characterId, value == 541, reinterpret_cast(&this->accountId), 0); + static_cast(g_charViewMode)->SendMsg(264, this->characterId, value == 541, reinterpret_cast(&this->accountId), 0); this->m_request->requests.Advance(); this->block->SetChecked(0); diff --git a/Source/UI/Quest/UIRenewQuestWnd.cpp b/Source/UI/Quest/UIRenewQuestWnd.cpp index fab20012..5ff43f6c 100644 --- a/Source/UI/Quest/UIRenewQuestWnd.cpp +++ b/Source/UI/Quest/UIRenewQuestWnd.cpp @@ -1,7 +1,8 @@ +#include "Client/Mode/CMode.h" +#include "Render/DeviceContext/DCSurface.h" #include "UI/Quest/UIRenewQuestWnd.h" #include "Client/Application/ApplicationWindow.h" -#include "Client/Mode/ModeCursor.h" #include "Client/ReplayPacketRecorder.h" #include "Contents/Configuration/ServiceConfiguration.h" #include "Contents/Items/ItemDescription.h" @@ -28,6 +29,7 @@ #include "UI/Text/UIStaticText.h" #include "UI/Text/UITagTextViewer.h" #include "UI/UIStaticBitmap.h" +#include "UI/Window/UINewSelectCharWnd.h" #include "UI/Window/UITab.h" #include "UI/Window/UIWindowMgr.h" #include "UI/Window/WindowDialogs.h" @@ -108,7 +110,7 @@ void UINpcSprWnd::Paint() { if (cell.imageType == 0) { texture = g_renderer->atlas.Find(image, palette, record); if (!texture) { - texture = g_renderer->atlas.Insert(this->m_context->renderSystem, image, palette, record, g_serviceType, g_resourceReuseDelay); + texture = g_renderer->atlas.Insert(*GetRenderSystemHolder()->system, image, palette, record, g_serviceType, g_resourceReuseDelay); } } else { texture = static_cast(const_cast(image->unknown_0008)); @@ -136,7 +138,7 @@ void UINpcSprWnd::Slot31(int, int) { // OFFSET: 0x007F97F0 // FUNCTION: fn_09936 void UINpcSprWnd::ResetCursor(int, int) { - this->m_context->cursor.Set(2, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(2); } // OFFSET: 0x007F9800 diff --git a/Source/UI/Rodex/UIRodexComposeWnd.cpp b/Source/UI/Rodex/UIRodexComposeWnd.cpp index 57f64999..28a372c9 100644 --- a/Source/UI/Rodex/UIRodexComposeWnd.cpp +++ b/Source/UI/Rodex/UIRodexComposeWnd.cpp @@ -1,3 +1,5 @@ +#include "Render/Text/FontCache.h" +#include "Render/Text/TextContext.h" #include "UI/Rodex/UIRodexComposeWnd.h" #include "Client/Mode/CGameMode.h" @@ -515,9 +517,11 @@ void UIRodexComposeWnd::Paint() { const auto* shadowOn = &static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\rodexsystem\\renewal\\shadow_item_on.bmp")))->image; this->DrawBitmap(itemX - 4, 319, shadowOn, true); if (this->unknown_00F8 <= g_session.m_zeny) { - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, this->m_context->fonts, this->m_context->locale, itemX, 309, item, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, itemX, 309, item, 0, 0); } else { - DrawItemWithQuantityAuxiliary(*this, descriptions, this->m_context->fonts, this->m_context->locale, 2, itemX, 309, item, item.identified, 0); + const TextLocale locale = {}; + DrawItemWithQuantityAuxiliary(*this, descriptions, g_fontCache, locale, 2, itemX, 309, item, item.identified, 0); } if (item.unknown_0088 > 0) { std::string gradeStr = FormatOwnedString("유저인터페이스\\grade_enchant\\grade_icon%d.bmp", static_cast(item.unknown_0088)); diff --git a/Source/UI/Shop/UIMerchantShopTitle.cpp b/Source/UI/Shop/UIMerchantShopTitle.cpp index d5501b70..bb3a4ae6 100644 --- a/Source/UI/Shop/UIMerchantShopTitle.cpp +++ b/Source/UI/Shop/UIMerchantShopTitle.cpp @@ -1,4 +1,4 @@ -#include "Client/Mode/ModeCursor.h" +#include "Client/Mode/CMode.h" #include "Client/Mode/ModeMgr.h" #include "Client/Session.h" #include "Contents/Configuration/ServiceOptions.h" @@ -7,6 +7,7 @@ #include "Resource/ResourceMgr.h" #include "Resource/TextureNames.h" #include "UI/Shop/UIMerchantShopTitle.h" +#include "UI/Window/UINewSelectCharWnd.h" #include "UI/Window/UIWindowMgr.h" #include "UI/Window/WindowBorder.h" #include "UI/Text/UIStaticText.h" @@ -71,9 +72,9 @@ void UIMerchantShopTitle::Slot26(int, int) { // FUNCTION: fn_10878 void UIMerchantShopTitle::ResetCursor(int x, int y) { if (x >= 0 && x < this->geometry.width && y >= 0 && y <= this->geometry.height) { - this->m_context->cursor.Set(2, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(2); } else { - this->m_context->cursor.Set(0, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(0); } } diff --git a/Source/UI/Shortcuts/ShortcutDrop.cpp b/Source/UI/Shortcuts/ShortcutDrop.cpp index 473ed8b5..1534d01f 100644 --- a/Source/UI/Shortcuts/ShortcutDrop.cpp +++ b/Source/UI/Shortcuts/ShortcutDrop.cpp @@ -1,9 +1,11 @@ +#include "Client/Mode/CMode.h" #include "Client/Mode/ModeDragState.h" #include "Client/Mode/ModeEvents.h" #include "Client/Session.h" #include "Contents/Skills/ClientSkills.h" #include "UI/Shortcuts/UIQuickSlotWnd.h" #include "UI/Shortcuts/ShortcutDrop.h" +#include "UI/Window/UINewSelectCharWnd.h" #include "UI/Window/UIWindow.h" #include #include @@ -272,6 +274,6 @@ void UIQuickSlotWnd::Slot10(int x, int y, std::intptr_t argument) { } } - this->m_context->mode->SendModeMessage(18, 0, 0, 0, 0); + static_cast(g_charViewMode)->SendMsg(18, 0, 0, 0, 0); } diff --git a/Source/UI/StylingShop/UIStylingShopWnd.cpp b/Source/UI/StylingShop/UIStylingShopWnd.cpp index e536c895..b69be2a8 100644 --- a/Source/UI/StylingShop/UIStylingShopWnd.cpp +++ b/Source/UI/StylingShop/UIStylingShopWnd.cpp @@ -169,10 +169,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 && this->m_context->mode && static_cast(g_charViewMode)->cursorType == 2) { + if (id == 185 && g_charViewMode && static_cast(g_charViewMode)->cursorType == 2) { const char* text = LookupMessage(17); if (reinterpret_cast(&g_windowMgr)->Confirm(text, 2, true, false, 0, "Message", 280, 120, 0) == 187) { - this->m_context->mode->SendModeMessage(2, 0, 0, 0, 0); + static_cast(g_charViewMode)->SendMsg(2, 0, 0, 0, 0); } } else { if (id == 184 || id == 321) { @@ -185,7 +185,7 @@ void UIStylingShopButton::Slot31(int, int) { } } } else { - this->m_context->mode->SendModeMessage(0, this->geometry.id, this->m_argument, 0, 0); + static_cast(g_charViewMode)->SendMsg(0, this->geometry.id, this->m_argument, 0, 0); } this->Invalidate(); diff --git a/Source/UI/UIBartermarketWnd.cpp b/Source/UI/UIBartermarketWnd.cpp index 231fb62d..5323629c 100644 --- a/Source/UI/UIBartermarketWnd.cpp +++ b/Source/UI/UIBartermarketWnd.cpp @@ -1705,7 +1705,8 @@ void UIBarterItemPurchaseWnd::Paint() { } const ITEM_INFO item = it->ToItemInfo(); - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, x + 44, y + 21, item, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, x + 44, y + 21, item, 0, 0); this->DrawItemName(x + 76, y + 29, 100, &item, 0, 0, 12); const std::string iconId = std::to_string(it->field_2c); DrawItemIconById(*this, descriptions, this->geometry.width - 70, y + 21, iconId.c_str(), 1); @@ -1789,7 +1790,8 @@ void UIBartermarketWnd::Paint() { if (it->flag_38) { DrawItemIcon(*this, ResourceMgr::Instance(), descriptions, x + 44, y + 21, item, 0); } else { - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, x + 44, y + 21, item, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, x + 44, y + 21, item, 0, 0); } this->DrawItemName(x + 76, y + 29, 120, &item, 0, 0, 12); const std::string iconId = std::to_string(it->field_2c); @@ -1847,7 +1849,8 @@ void UIExpandedBartermarketWnd::Paint() { } const ITEM_INFO item = it->ToItemInfo(); - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, this->m_context->fonts, this->m_context->locale, 44, y + 21, item, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, 44, y + 21, item, 0, 0); this->DrawItemName(76, y + 29, 100, &item, 0, 0, 12); if (it->field_28 > 0) { @@ -1862,7 +1865,7 @@ void UIExpandedBartermarketWnd::Paint() { chunkItem.quantity = chunk->amount * it->value; chunkItem.unknown_0060 = chunk->field_4; const int chunkX = 84 + chunkIndex * 42; - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, this->m_context->fonts, this->m_context->locale, chunkX - 8, y + 49, chunkItem, 1, 0); + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, chunkX - 8, y + 49, chunkItem, 1, 0); if (chunk->field_4 > 0) { const std::string chunkAmount = FormatOwnedString("+%d", chunk->field_4); DrawOutlinedText(*this, chunkX, y + 49, chunkAmount.c_str(), 0, 0xFFFFFF, 200, 0, 12, 1, 0); @@ -1932,9 +1935,11 @@ void UIExpandedBarterItemPurchaseWnd::Paint() { if (it->flag_30) { DrawItemIcon(*this, ResourceMgr::Instance(), descriptions, 44, y + 21, item, 0); } else if (it->value == 0) { - DrawItemWithQuantityAuxiliary(*this, descriptions, this->m_context->fonts, this->m_context->locale, 1, 44, y + 21, item, 1, 0); + const TextLocale locale = {}; + DrawItemWithQuantityAuxiliary(*this, descriptions, g_fontCache, locale, 1, 44, y + 21, item, 1, 0); } else { - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, this->m_context->fonts, this->m_context->locale, 44, y + 21, item, 1, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, 44, y + 21, item, 1, 0); } this->DrawItemName(76, y + 29, 100, &item, 0, 0, 12); if (it->field_28 > 0) { @@ -1950,9 +1955,11 @@ void UIExpandedBarterItemPurchaseWnd::Paint() { chunkItem.unknown_0060 = chunk->field_4; const int chunkX = 76 + chunkIndex * 42; if (it->value == 0) { - DrawItemWithQuantityAuxiliary(*this, descriptions, this->m_context->fonts, this->m_context->locale, 1, chunkX, y + 49, chunkItem, 1, 0); + const TextLocale locale = {}; + DrawItemWithQuantityAuxiliary(*this, descriptions, g_fontCache, locale, 1, chunkX, y + 49, chunkItem, 1, 0); } else { - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, this->m_context->fonts, this->m_context->locale, chunkX, y + 49, chunkItem, 1, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, chunkX, y + 49, chunkItem, 1, 0); } if (chunk->field_4 != 0) { const std::string chunkAmount = FormatOwnedString("+%d", chunk->field_4); diff --git a/Source/UI/UIChangeMaterialWnd.cpp b/Source/UI/UIChangeMaterialWnd.cpp index 71db3195..2296403e 100644 --- a/Source/UI/UIChangeMaterialWnd.cpp +++ b/Source/UI/UIChangeMaterialWnd.cpp @@ -1,4 +1,5 @@ #include "Render/Text/FontCache.h" +#include "Render/Text/TextContext.h" #include "UI/UIChangeMaterialWnd.h" #include "Client/Input/InputCharset.h" @@ -547,13 +548,16 @@ void UIChangeMaterialWnd::Paint() { const MaterialSlotPos* position = this->m_materialPos; for (auto it = this->m_materials.begin(); it != this->m_materials.end(); ++it, ++position) { if (it->identified == 1) { - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, position->x, position->y, *it, 1, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, position->x, position->y, *it, 1, 0); } else { - DrawItemWithQuantityAuxiliary(*this, descriptions, g_fontCache, this->m_context->locale, 1, position->x, position->y, *it, 1, 0); + const TextLocale locale = {}; + DrawItemWithQuantityAuxiliary(*this, descriptions, g_fontCache, locale, 1, position->x, position->y, *it, 1, 0); } } - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, this->m_resultX, this->m_resultY, this->m_resultItem, 1, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, this->m_resultX, this->m_resultY, this->m_resultItem, 1, 0); const std::string amount = FormatOwnedString(LookupMessage(0xE8C), this->m_resultAmount / 10); const int width = this->TextWidth(amount.c_str(), 0, 0x1D, 0x17, 1, 0); @@ -603,7 +607,7 @@ void UIChangeMaterialWnd_List::Paint() { item.quantity = entry->results[0].quantity; item.identified = 1; - UIWindowContext& context = *this->m_context; + const TextLocale locale = {}; ItemDescriptions descriptions{g_itemDescriptions}; std::string name = item.DisplayName(0); if (this->TextWidth(name.c_str(), 0, 0, 12, 0, 0) > 100) { @@ -612,11 +616,11 @@ void UIChangeMaterialWnd_List::Paint() { const int y = rowHeight * row; if (entry->state == 1) { - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, context.fonts, context.locale, 0, y, item, 1, 0); + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, 0, y, item, 1, 0); this->DrawTextAt(30, y + 6, name.c_str(), 0, 0, 12, 0, 0, 0); this->DrawRightAlignedText(163, y + 6, FormatOwnedString(LookupMessage(182), item.quantity).c_str(), 0, 0, 12, 0, 0); } else { - DrawItemWithQuantityAuxiliary(*this, descriptions, context.fonts, context.locale, 1, 0, y, item, 1, 0); + DrawItemWithQuantityAuxiliary(*this, descriptions, g_fontCache, locale, 1, 0, y, item, 1, 0); this->DrawTextAt(30, y + 6, name.c_str(), 0, 0, 12, 0xAAAAAA, 0, 0); this->DrawRightAlignedText(163, y + 6, FormatOwnedString(LookupMessage(182), item.quantity).c_str(), 0, 0, 12, 0xAAAAAA, 0); } diff --git a/Source/UI/UICheckAttendanceWnd.cpp b/Source/UI/UICheckAttendanceWnd.cpp index f742ed79..8c736cd7 100644 --- a/Source/UI/UICheckAttendanceWnd.cpp +++ b/Source/UI/UICheckAttendanceWnd.cpp @@ -1,8 +1,8 @@ #include "Render/Text/FontCache.h" +#include "Render/Text/TextContext.h" #include "UI/UICheckAttendanceWnd.h" #include "Client/Mode/CMode.h" -#include "Client/Mode/ModeCursor.h" #include "Client/Mode/ModeMgr.h" #include "Client/Mode/ModeTooltip.h" #include "Client/Session.h" @@ -24,6 +24,7 @@ #include "UI/Buttons/UIBmpRadioBtn.h" #include "UI/Buttons/UIBmpTextButton.h" #include "UI/Shop/ItemDrawing.h" +#include "UI/Window/UINewSelectCharWnd.h" #include "UI/Window/UIWindowMgr.h" #include "Utility/Text/FormatString.h" @@ -208,7 +209,8 @@ void UICheckAttendanceWnd::Paint() { const int x = (day - 1) % 5 * 62; const int y = (day - 1) / 5 * 64; - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, x + 43, y + 109 + bannerHeight, item, 1, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, x + 43, y + 109 + bannerHeight, item, 1, 0); this->DrawCenteredText(x + 26, y + 140 + bannerHeight, FormatOwnedString(LookupMessage(3467), day).c_str(), 58, 0, 12, 0xA44F3B, 1); } } @@ -296,7 +298,7 @@ void UICheckAttendanceWnd::Slot28(int x, int y) { // OFFSET: 0x007DDEF0 // FUNCTION: fn_09646 void UICheckAttendanceWnd_Banner::ResetCursor(int, int) { - this->m_context->cursor.Set(2, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(2); } // OFFSET: 0x007DDF00 diff --git a/Source/UI/UILapineScrollBar.cpp b/Source/UI/UILapineScrollBar.cpp index b1eceb47..77b1fe23 100644 --- a/Source/UI/UILapineScrollBar.cpp +++ b/Source/UI/UILapineScrollBar.cpp @@ -1,4 +1,5 @@ #include "Render/Text/FontCache.h" +#include "Render/Text/TextContext.h" #include "UI/UIIngredientInfoWnd.h" #include "UI/UILapineScrollBar.h" @@ -230,9 +231,11 @@ void UIIngredientInfoWnd::Paint() { ItemDescriptions descriptions{g_itemDescriptions}; std::uint32_t color = 0; if (this->insufficient == 0) { - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, this->m_context->fonts, this->m_context->locale, 4, 3, this->item, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, 4, 3, this->item, 0, 0); } else { - DrawItemWithQuantityAuxiliary(*this, descriptions, this->m_context->fonts, this->m_context->locale, 2, 4, 3, this->item, this->item.identified, 0); + const TextLocale locale = {}; + DrawItemWithQuantityAuxiliary(*this, descriptions, g_fontCache, locale, 2, 4, 3, this->item, this->item.identified, 0); color = 0x969696; } @@ -278,7 +281,8 @@ void UILapineBoxWnd::Paint() { } CBitmapRes* slot = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\lapine\\shadow_item_off.bmp"))); this->DrawBitmap(x - 4, y + 11, &slot->image, true); - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, x, y, this->items[index], 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, x, y, this->items[index], 0, 0); } if (timeGetTime() < this->noticeTick + this->noticeDuration) { diff --git a/Source/UI/UILapineUpgradeBoxWnd.cpp b/Source/UI/UILapineUpgradeBoxWnd.cpp index 70f32642..d69ca5a3 100644 --- a/Source/UI/UILapineUpgradeBoxWnd.cpp +++ b/Source/UI/UILapineUpgradeBoxWnd.cpp @@ -1,3 +1,4 @@ +#include "Client/Mode/CMode.h" #include "UI/Window/UINewSelectCharWnd.h" #include "Client/Mode/ModeTooltip.h" #include "UI/UILapineUpgradeBoxWnd.h" @@ -173,16 +174,16 @@ void UILapineUpgradeBoxWnd::Paint() { // OFFSET: 0x006035E0 // FUNCTION: fn_04194 void UILapineUpgradeBoxWnd::Slot10(int x, int y, std::intptr_t value) { - ModeEvents* mode = this->m_context->mode; + CMode* mode = static_cast(g_charViewMode); if (this->item.unknown_0000[1] > 0) { - mode->SendModeMessage(18, 0, 0, 0, 0); + mode->SendMsg(18, 0, 0, 0, 0); return; } const ModeDragState* drag = reinterpret_cast(value); if (drag->source == 27) { this->SendMsg(this, 31, drag->id, 0, 0, 0); } - mode->SendModeMessage(18, 0, 0, 0, 0); + mode->SendMsg(18, 0, 0, 0, 0); } // OFFSET: 0x00603650 diff --git a/Source/UI/UIPreviewEquipWnd.cpp b/Source/UI/UIPreviewEquipWnd.cpp index 2dc119f3..f10894bc 100644 --- a/Source/UI/UIPreviewEquipWnd.cpp +++ b/Source/UI/UIPreviewEquipWnd.cpp @@ -131,8 +131,8 @@ void UIPreviewEquipWnd::Slot15(int width, int height) { // OFFSET: 0x007F3CD0 // FUNCTION: fn_09883 void UIPreviewEquipWnd::Paint() { - this->SetSolid(this->m_context->primitives, this->geometry.width, this->geometry.height, 0); - this->DrawNamed(this->m_context->primitives, 0, 0, "유저인터페이스\\equip_preview\\bg_mounting2.bmp", 0xffffffff, 0, 0); + this->SetSolid(g_renderer->primitives, this->geometry.width, this->geometry.height, 0); + this->DrawNamed(g_renderer->primitives, 0, 0, "유저인터페이스\\equip_preview\\bg_mounting2.bmp", 0xffffffff, 0, 0); void (UIPreviewEquipWnd::*draw)() = &UIPreviewEquipWnd::DrawCharacter; (this->*draw)(); } diff --git a/Source/UI/UIScrollWnd.cpp b/Source/UI/UIScrollWnd.cpp index 6db9e2bb..c96b4018 100644 --- a/Source/UI/UIScrollWnd.cpp +++ b/Source/UI/UIScrollWnd.cpp @@ -1,3 +1,4 @@ +#include "Render/DeviceContext/DCSurface.h" #include "UI/UIScrollWnd.h" #include "Render/DeviceContext/DCBitmap.h" #include "Render/Primitives/RenderPrimitivePool.h" @@ -134,7 +135,7 @@ bool UIScrollWnd::UpdateCached(int redraw) { if (child != this->horizontalBar && child != this->scrollBar) { primitives.push_back(child->DrawPrimitive()); } else { - static_cast(child->geometry.surface)->UploadTexture(this->m_context->renderSystem, child->m_texture); + static_cast(child->geometry.surface)->UploadTexture(*GetRenderSystemHolder()->system, child->m_texture); primitives.push_back(this->BuildPrimitive( child->geometry.x + this->unknown_009C, child->geometry.y + this->scrollPosition, 0, 0, child->geometry.width, child->geometry.height, child->m_texture, child->Color() @@ -225,7 +226,7 @@ RenderPrimitive* UIScrollWnd::DrawPrimitive() { // OFFSET: 0x009AD100 // FUNCTION: fn_13782 RenderPrimitive* UIScrollWnd::BuildPrimitive(int x, int y, int sourceX, int sourceY, int width, int height, CTexture* texture, std::uint32_t color) { - RenderPrimitive* primitive = this->m_context->primitives.Acquire(); + RenderPrimitive* primitive = g_renderer->primitives.Acquire(); primitive->texture = texture; const float textureWidth = static_cast(std::bit_cast(texture->TextureWidth())); const float textureHeight = static_cast(std::bit_cast(texture->TextureHeight())); diff --git a/Source/UI/Window/UICollectionSystemWnd.cpp b/Source/UI/Window/UICollectionSystemWnd.cpp index f755c04d..5430f226 100644 --- a/Source/UI/Window/UICollectionSystemWnd.cpp +++ b/Source/UI/Window/UICollectionSystemWnd.cpp @@ -1,3 +1,4 @@ +#include "Render/DeviceContext/DCSurface.h" #include "UI/Window/UICollectionSystemWnd.h" #include "Client/Mode/ModeMgr.h" @@ -44,7 +45,7 @@ void CUICollectionSystemWnd::Paint() { const SpriteRleImage* image = this->m_sprite->images[0][cell.image]; CTexture* texture = g_renderer->atlas.Find(image, palette, record); if (!texture) { - texture = g_renderer->atlas.Insert(this->m_context->renderSystem, image, palette, record, g_serviceType, g_resourceReuseDelay); + texture = g_renderer->atlas.Insert(*GetRenderSystemHolder()->system, image, palette, record, g_serviceType, g_resourceReuseDelay); } this->geometry.surface->DrawSurface( this->geometry.width / 2 + cell.x, this->geometry.height / 2 + cell.y, texture, static_cast(record.u0 * 256.0f), diff --git a/Source/UI/Window/UIControl.cpp b/Source/UI/Window/UIControl.cpp index e0419972..7c7b4d6f 100644 --- a/Source/UI/Window/UIControl.cpp +++ b/Source/UI/Window/UIControl.cpp @@ -1,15 +1,16 @@ +#include "Client/Mode/CMode.h" #include "UI/Window/UIControl.h" #include "UI/Buttons/UIRadioButton.h" #include "UI/Buttons/UITextButton.h" #include "UI/Lists/UIListBoxTemplate.h" #include "UI/Lists/UIThumb.h" #include "UI/Edit/UIEditCtrl.h" -#include "Client/Mode/ModeCursor.h" #include "Client/Mode/ModeMgr.h" #include "Client/Mode/ModeTooltip.h" #include "Resource/Bitmap/BitmapResource.h" #include "Resource/ResourceMgr.h" #include "Resource/TextureNames.h" +#include "UI/Window/UINewSelectCharWnd.h" #include "UI/Window/UIWindowMgr.h" #include "UI/Window/UIPadding.h" #include "UI/Text/UIStaticTextControl.h" @@ -537,7 +538,7 @@ void CUIHThumb::Slot27(int x, int) { // OFFSET: 0x009F24F0 // FUNCTION: fn_14714 void CUIThumb::ResetCursor(int, int) { - this->m_context->cursor.Set(2, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(2); } // OFFSET: 0x009F2450 @@ -859,7 +860,7 @@ void CUIButton::Slot48() { // OFFSET: 0x009EEAA0 // FUNCTION: fn_14633 void CUIButton::ResetCursor(int, int) { - this->m_context->cursor.Set(this->disabled ? 0 : 2, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(this->disabled ? 0 : 2); } // OFFSET: 0x009ECCD0 @@ -2593,7 +2594,7 @@ void CUIResizer::Slot27(int x, int y) { // OFFSET: 0x009E96B0 // FUNCTION: fn_14507 void CUIResizer::ResetCursor(int, int) { - this->m_context->cursor.Set(2, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(2); } // OFFSET: 0x009E96C0 @@ -3174,8 +3175,8 @@ void CUIBasicButton::Slot55() { return; } - FontCache& fonts = this->m_context->fonts; - const TextLocale& locale = this->m_context->locale; + FontCache& fonts = g_fontCache; + const TextLocale locale = {}; if (this->disabled) { this->DrawTextAt(this->textX + 1, this->textY + 1, this->displayText.c_str(), 0, 0, 12, 0xE2E2E2, 0, 0); this->DrawTextAt(this->textX, this->textY, this->displayText.c_str(), 0, 0, 12, 0x6F6F6F, 0, 0); diff --git a/Source/UI/Window/UIFrameWnd.cpp b/Source/UI/Window/UIFrameWnd.cpp index 148dfe3a..71d755da 100644 --- a/Source/UI/Window/UIFrameWnd.cpp +++ b/Source/UI/Window/UIFrameWnd.cpp @@ -416,7 +416,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 { - this->m_context->mode->SendModeMessage(0, this->geometry.id, this->m_argument, 0, 0); + static_cast(g_charViewMode)->SendMsg(0, this->geometry.id, this->m_argument, 0, 0); } } @@ -451,10 +451,10 @@ int UIAllyGuildAcceptWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a if (message == 6) { if (a == 184) { g_windowMgr.CloseWindow(72); - this->m_context->mode->SendModeMessage(120, this->identity, 1, 0, 0); + static_cast(g_charViewMode)->SendMsg(120, this->identity, 1, 0, 0); } else if (a == 185) { g_windowMgr.CloseWindow(72); - this->m_context->mode->SendModeMessage(120, this->identity, 0, 0, 0); + static_cast(g_charViewMode)->SendMsg(120, this->identity, 0, 0, 0); } return 0; @@ -587,7 +587,7 @@ int UICntWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intpt switch (message) { case 6: if (a == 184) { - this->m_context->mode->SendModeMessage(this->m_event, std::atoi(this->m_edit->Text()), 0, 0, 0); + static_cast(g_charViewMode)->SendMsg(this->m_event, std::atoi(this->m_edit->Text()), 0, 0, 0); } g_windowMgr.Schedule(this); diff --git a/Source/UI/Window/UIHotKeyWnd.cpp b/Source/UI/Window/UIHotKeyWnd.cpp index 32d82712..d9c59eeb 100644 --- a/Source/UI/Window/UIHotKeyWnd.cpp +++ b/Source/UI/Window/UIHotKeyWnd.cpp @@ -1,7 +1,9 @@ +#include "Client/Mode/CMode.h" +#include "Render/Text/FontCache.h" +#include "Render/Text/TextContext.h" #include "UI/Window/UIHotKeyWnd.h" #include "UI/Chat/ChatSuggestions.h" #include "Client/Session.h" -#include "Client/Mode/ModeCursor.h" #include "Client/Mode/ModeTooltip.h" #include "Contents/Hotkeys/UserHotkeyMgr.h" #include "Contents/Skills/AutomaticSkills.h" @@ -398,7 +400,7 @@ void UISerachStoreInfoWnd::Slot28(int x, int y) { text = text.substr(0, end); } - this->m_context->cursor.Set(2, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(2); } } else { text = item.DisplayName(0); @@ -425,8 +427,8 @@ void UIHotKeyWnd::Paint() { return; } - FontCache& fonts = this->m_context->fonts; - const TextLocale& locale = this->m_context->locale; + FontCache& fonts = g_fontCache; + const TextLocale locale = {}; this->unknown_00BC = this->DrawTitleBar(true, LookupMessage(1494), 0); this->unknown_00C0 = this->DrawButtonBar(2, 0, 1); diff --git a/Source/UI/Window/UIMessageBox.cpp b/Source/UI/Window/UIMessageBox.cpp index 17b28959..eff1f0bf 100644 --- a/Source/UI/Window/UIMessageBox.cpp +++ b/Source/UI/Window/UIMessageBox.cpp @@ -1,3 +1,4 @@ +#include "Render/DeviceContext/DCSurface.h" #include "Render/Text/FontCache.h" #include "Client/ReplayPacketRecorder.h" #include "Contents/Items/ItemDescription.h" @@ -401,7 +402,7 @@ void UIMakeCharWnd::Paint() { if (cell.imageType == 0) { texture = g_renderer->atlas.Find(image, palette, record); if (!texture) { - texture = g_renderer->atlas.Insert(this->m_context->renderSystem, image, palette, record, g_serviceType, g_resourceReuseDelay); + texture = g_renderer->atlas.Insert(*GetRenderSystemHolder()->system, image, palette, record, g_serviceType, g_resourceReuseDelay); } } else { texture = static_cast(const_cast(image->unknown_0008)); @@ -434,7 +435,8 @@ void UIMerInfoWnd::Paint() { for (int i = 0; i < 8; ++i) { const int value = i == 7 ? (2000 - g_session.m_mercenaryStats[i]) / 10 : g_session.m_mercenaryStats[i]; const int bytes = std::sprintf(number, "%d", value); - DrawTextRight(*this, g_fontCache, this->m_context->locale, 79, 24 + 18 * i, number, bytes, 1, 14, 0, 0); + const TextLocale locale = {}; + DrawTextRight(*this, g_fontCache, locale, 79, 24 + 18 * i, number, bytes, 1, 14, 0, 0); } this->DrawTextAt(136, 24, g_session.m_mercenaryName, 0, 0, 12, 0x646464, 0, 0); this->DrawTextAt(135, 24, g_session.m_mercenaryName, 0, 0, 12, 0, 0, 0); diff --git a/Source/UI/Window/UINewMakeCharWnd.cpp b/Source/UI/Window/UINewMakeCharWnd.cpp index 277e1c91..2e15625e 100644 --- a/Source/UI/Window/UINewMakeCharWnd.cpp +++ b/Source/UI/Window/UINewMakeCharWnd.cpp @@ -1,3 +1,4 @@ +#include "Render/DeviceContext/DCSurface.h" #include "UI/Window/WindowDialogs.h" #include "UI/Window/UIWindowMgr.h" #include "UI/Window/UINewMakeCharWnd.h" @@ -210,7 +211,7 @@ void UINewMakeCharWnd::Paint() { if (cell.imageType == 0) { texture = g_renderer->atlas.Find(image, palette, record); if (!texture) { - texture = g_renderer->atlas.Insert(this->m_context->renderSystem, image, palette, record, g_serviceType, g_resourceReuseDelay); + texture = g_renderer->atlas.Insert(*GetRenderSystemHolder()->system, image, palette, record, g_serviceType, g_resourceReuseDelay); } } else { texture = static_cast(const_cast(image->unknown_0008)); diff --git a/Source/UI/Window/UINewSkillListWnd.cpp b/Source/UI/Window/UINewSkillListWnd.cpp index c7373ca8..9eba4c98 100644 --- a/Source/UI/Window/UINewSkillListWnd.cpp +++ b/Source/UI/Window/UINewSkillListWnd.cpp @@ -1,3 +1,4 @@ +#include "Render/DeviceContext/DCSurface.h" #include "UI/Window/UINewSkillListWnd.h" #include "Client/Mode/CGameMode.h" #include "Client/Mode/ModeMgr.h" @@ -266,7 +267,7 @@ void UINewSkillListWnd::sub_9AE930() { if (cell.imageType == 0) { texture = g_renderer->atlas.Find(image, palette, record); if (!texture) { - texture = g_renderer->atlas.Insert(this->m_context->renderSystem, image, palette, record, g_serviceType, g_resourceReuseDelay); + texture = g_renderer->atlas.Insert(*GetRenderSystemHolder()->system, image, palette, record, g_serviceType, g_resourceReuseDelay); } } else { texture = static_cast(const_cast(image->unknown_0008)); diff --git a/Source/UI/Window/UIRPImageWnd2.cpp b/Source/UI/Window/UIRPImageWnd2.cpp index d8d84fba..cce9423c 100644 --- a/Source/UI/Window/UIRPImageWnd2.cpp +++ b/Source/UI/Window/UIRPImageWnd2.cpp @@ -1,3 +1,4 @@ +#include "Render/Renderer.h" #include "UI/Window/UIRPImageWnd2.h" // OFFSET: 0x0094EAF0 @@ -7,9 +8,9 @@ void UIRPImageWnd2::Paint() { return; } - this->SetSolid(this->m_context->primitives, this->geometry.width, this->geometry.height, 0); + this->SetSolid(g_renderer->primitives, this->geometry.width, this->geometry.height, 0); for (int i = 0; i < this->m_imageCount; ++i) { - this->DrawNamed(this->m_context->primitives, 0, 0, this->m_imageName, 0xFFFFFFFF, 0, 0); + this->DrawNamed(g_renderer->primitives, 0, 0, this->m_imageName, 0xFFFFFFFF, 0, 0); } } diff --git a/Source/UI/Window/UIResizer.cpp b/Source/UI/Window/UIResizer.cpp index 2c06264e..6d47eb78 100644 --- a/Source/UI/Window/UIResizer.cpp +++ b/Source/UI/Window/UIResizer.cpp @@ -1,7 +1,8 @@ -#include "Client/Mode/ModeCursor.h" +#include "Client/Mode/CMode.h" #include "Resource/Bitmap/BitmapResource.h" #include "Resource/ResourceMgr.h" #include "Resource/TextureNames.h" +#include "UI/Window/UINewSelectCharWnd.h" #include "UI/Window/UIResizer.h" #include "UI/Window/UIWindowMgr.h" @@ -110,9 +111,9 @@ void UIResizer::Slot27(int x, int y) { // FUNCTION: fn_10879 void UIResizer::ResetCursor(int x, int y) { if (g_windowMgr.Capture() == this || (x >= 0 && x < this->geometry.width && y >= 0 && y <= this->geometry.height)) { - this->m_context->cursor.Set(2, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(2); } else if (g_windowMgr.Capture() != this) { - this->m_context->cursor.Set(0, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(0); } } diff --git a/Source/UI/Window/UIRodexContentsWnd.cpp b/Source/UI/Window/UIRodexContentsWnd.cpp index 8e8c07ae..59da4220 100644 --- a/Source/UI/Window/UIRodexContentsWnd.cpp +++ b/Source/UI/Window/UIRodexContentsWnd.cpp @@ -1,4 +1,5 @@ #include "Render/Text/FontCache.h" +#include "Render/Text/TextContext.h" #include "UI/Window/UIRodexContentsWnd.h" #include "Client/Input/InputCharset.h" @@ -185,7 +186,8 @@ void UIRodexContentsWnd::Paint() { ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\rodexsystem\\renewal\\shadow_item_on.bmp")) ); this->DrawBitmap(x - 4, 319, &slot->image, true); - DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, this->m_context->locale, x, 309, *item, 0, 0); + const TextLocale locale = {}; + DrawItemWithQuantity(*this, ResourceMgr::Instance(), descriptions, g_fontCache, locale, x, 309, *item, 0, 0); if (item->unknown_0088 > 0) { ResourceMgr& resources = ResourceMgr::Instance(); const std::string name = FormatOwnedString("유저인터페이스\\grade_enchant\\grade_icon%d.bmp", item->unknown_0088); diff --git a/Source/UI/Window/UIVideoWnd.cpp b/Source/UI/Window/UIVideoWnd.cpp index b4edc2a4..13baeb78 100644 --- a/Source/UI/Window/UIVideoWnd.cpp +++ b/Source/UI/Window/UIVideoWnd.cpp @@ -1,3 +1,4 @@ +#include "Render/Renderer.h" #include "UI/Window/UIVideoWnd.h" #include "Contents/MessageTable.h" @@ -70,7 +71,7 @@ void UIVideoSkipButton::Paint() { // OFFSET: 0x00AB4600 // FUNCTION: fn_17443 void UIVideoWnd::Paint() { - this->SetSolid(this->m_context->primitives, this->geometry.width, this->geometry.height, 0xFF000000); + this->SetSolid(g_renderer->primitives, this->geometry.width, this->geometry.height, 0xFF000000); if (this->m_movie->State() != 1) { return; } @@ -80,7 +81,7 @@ void UIVideoWnd::Paint() { const int height = this->geometry.height; const float scaled = (std::min)(static_cast(static_cast(handle->height)) / static_cast(static_cast(handle->width)) * static_cast(width), static_cast(height)); const int videoHeight = static_cast(scaled); - this->DrawStretched(this->m_context->primitives, 0, static_cast((height - videoHeight) * 0.5), this->m_texture, 0xFFFFFFFF, width, videoHeight); + this->DrawStretched(g_renderer->primitives, 0, static_cast((height - videoHeight) * 0.5), this->m_texture, 0xFFFFFFFF, width, videoHeight); } // OFFSET: 0x00AB4680 diff --git a/Source/UI/Window/UIWindow.cpp b/Source/UI/Window/UIWindow.cpp index e3a0a2b0..1dc24106 100644 --- a/Source/UI/Window/UIWindow.cpp +++ b/Source/UI/Window/UIWindow.cpp @@ -1,6 +1,9 @@ #include "UI/Chat/UINewChatWnd.h" #include "Client/Application/Launcher.h" #include "Client/Input/InputCharset.h" +#include "Client/Mode/CMode.h" +#include "Render/DeviceContext/DCSurface.h" +#include "UI/Window/UINewSelectCharWnd.h" #include "UI/Window/WindowDialogs.h" #include "UI/Window/UIRoMapWnd.h" #include "File/FileEnumeration.h" @@ -16,7 +19,6 @@ #include "Contents/NavigationManager.h" #include "Contents/SpriteRidingOffset.h" #include "Client/Session.h" -#include "Client/Mode/ModeCursor.h" #include "Client/Mode/ModeEvents.h" #include "Network/TextEncoding.h" #include "Render/DeviceContext/DCBitmap.h" @@ -214,15 +216,6 @@ static const char* FindColorCode(const char* text, const char* end) { return text; } -// INLINED -void UIWindowContext::DestroyDeferredChildren() { - for (UIWindow* window : this->deferredDeletion) { - delete window; - } - - this->deferredDeletion.clear(); -} - // OFFSET: 0x00A79A90 // FUNCTION: fn_16914 UIWindow::UIWindow(UIWindowContext& context, unsigned char cached) @@ -318,7 +311,7 @@ bool UIWindow::CanHitTest() { // OFFSET: 0x00A7BB00 // FUNCTION: fn_16933 void UIWindow::Slot10(int, int, std::intptr_t) { - this->m_context->mode->SendModeMessage(18, 0, 0, 0, 0); + static_cast(g_charViewMode)->SendMsg(18, 0, 0, 0, 0); } // OFFSET: 0x005CA0F0 @@ -421,7 +414,7 @@ void UIWindow::Slot29(int, int) { // OFFSET: 0x00A81D60 // FUNCTION: fn_16988 void UIWindow::ResetCursor(int, int) { - this->m_context->cursor.Set(0, this->m_context->cursorTick); + static_cast(g_charViewMode)->SetCursorAction(0); } // OFFSET: 0x005C7240 @@ -527,7 +520,7 @@ bool UIWindow::Update(int redraw) { } } - this->m_context->renderer.RenderToTexture(this->geometry.width, this->geometry.height, primitives, this->m_texture); + g_renderer->RenderToTexture(this->geometry.width, this->geometry.height, primitives, this->m_texture); return this->parent != nullptr; } @@ -612,10 +605,10 @@ void UIWindow::Slot48() { // FUNCTION: fn_16970 RenderPrimitive* UIWindow::DrawPrimitive() { if (this->m_cached == 0) { - static_cast(this->geometry.surface)->UploadTexture(this->m_context->renderSystem, this->m_texture); + static_cast(this->geometry.surface)->UploadTexture(*GetRenderSystemHolder()->system, this->m_texture); } - RenderPrimitive* primitive = this->m_context->primitives.Acquire(); + RenderPrimitive* primitive = g_renderer->primitives.Acquire(); primitive->texture = this->m_texture; const float width = static_cast(std::bit_cast(this->m_texture->TextureWidth())); const float height = static_cast(std::bit_cast(this->m_texture->TextureHeight())); @@ -849,13 +842,13 @@ void UIWindow::ClearChildren(bool destroy) { // OFFSET: 0x00AA5E90 // FUNCTION: fn_17226 -void UIWindow::DeferDeletion(UIWindow* window) { +void UIWindowMgr::DeferDeletion(UIWindow* window) { if (!window) { return; } - this->m_context->windowMgr.ForgetWindowReferences(window); - this->m_context->deferredDeletion.insert(window); + this->ForgetWindowReferences(window); + this->deferredDeletion.insert(window); window->Show(0); } @@ -869,7 +862,7 @@ void UIWindow::RemoveChild(UIWindow* child, unsigned char destroy) { for (auto entry = this->m_children.begin(); entry != this->m_children.end(); ++entry) { if (*entry == child) { if (destroy == 1) { - this->DeferDeletion(child); + g_windowMgr.DeferDeletion(child); } this->m_children.erase(entry); @@ -2104,7 +2097,7 @@ void UINavigationV4Wnd::Slot11() { info->width = this->geometry.width; this->info->height = this->geometry.height; const int margin = this->info->expanded ? 272 : 228; - const int maximumX = this->m_context->renderer.viewport.width - margin; + const int maximumX = g_renderer->viewport.width - margin; if (maximumX < this->geometry.x) { this->geometry.x = maximumX; } @@ -2114,7 +2107,7 @@ void UINavigationV4Wnd::Slot11() { } this->info->x = this->geometry.x; - const int maximumY = this->m_context->renderer.viewport.height - 338; + const int maximumY = g_renderer->viewport.height - 338; if (maximumY < this->geometry.y) { this->geometry.y = maximumY; } @@ -3403,7 +3396,7 @@ void UIWindow::DrawActionSprite( const SpriteRleImage* const* images[2] = {sprite->images[0].data(), sprite->images[1].data()}; this->geometry.surface->DrawScaledSprite( x, y, width, height, std::span(frame.cells), images, frame.cellCount, offsetX, offsetY, scale, nullptr, - this->m_context->renderer.atlas, this->m_context->renderSystem, g_serviceType, g_resourceReuseDelay + g_renderer->atlas, *GetRenderSystemHolder()->system, g_serviceType, g_resourceReuseDelay ); } } @@ -3844,7 +3837,7 @@ void UINavigationV4Wnd::DrawTargetSprite(int x, int y, int width, int height, co const SpriteRleImage* const* images[2] = {sprites[8]->images[0].data(), sprites[8]->images[1].data()}; this->geometry.surface->DrawScaledSprite( x, y, width, height, std::span(robeFrame->cells), images, robeFrame->cellCount, offsetX, offsetY, scale, nullptr, - this->m_context->renderer.atlas, this->m_context->renderSystem, g_serviceType, g_resourceReuseDelay + g_renderer->atlas, *GetRenderSystemHolder()->system, g_serviceType, g_resourceReuseDelay ); } } @@ -3866,7 +3859,7 @@ void UINavigationV4Wnd::DrawTargetSprite(int x, int y, int width, int height, co const SpriteRleImage* const* images[2] = {sprites[0]->images[0].data(), sprites[0]->images[1].data()}; this->geometry.surface->DrawScaledSprite( x, y, width, height, std::span(body->cells), images, body->cellCount, offsetX, offsetY, 1.0f, bodyPalette, - this->m_context->renderer.atlas, this->m_context->renderSystem, g_serviceType, g_resourceReuseDelay + g_renderer->atlas, *GetRenderSystemHolder()->system, g_serviceType, g_resourceReuseDelay ); } @@ -3887,7 +3880,7 @@ void UINavigationV4Wnd::DrawTargetSprite(int x, int y, int width, int height, co const SpriteRleImage* const* images[2] = {sprites[1]->images[0].data(), sprites[1]->images[1].data()}; this->geometry.surface->DrawScaledSprite( x + headX, y + headY, width, height, std::span(headFrame->cells), images, headFrame->cellCount, offsetX, offsetY, scale, - headPalette, this->m_context->renderer.atlas, this->m_context->renderSystem, g_serviceType, g_resourceReuseDelay + headPalette, g_renderer->atlas, *GetRenderSystemHolder()->system, g_serviceType, g_resourceReuseDelay ); } } @@ -3910,7 +3903,7 @@ void UINavigationV4Wnd::DrawTargetSprite(int x, int y, int width, int height, co const SpriteRleImage* const* images[2] = {sprites[2]->images[0].data(), sprites[2]->images[1].data()}; this->geometry.surface->DrawScaledSprite( x + accessoryX, y + accessoryY, width, height, std::span(frame->cells), images, frame->cellCount, offsetX, offsetY, - scale, nullptr, this->m_context->renderer.atlas, this->m_context->renderSystem, g_serviceType, g_resourceReuseDelay + scale, nullptr, g_renderer->atlas, *GetRenderSystemHolder()->system, g_serviceType, g_resourceReuseDelay ); } } @@ -3934,7 +3927,7 @@ void UINavigationV4Wnd::DrawTargetSprite(int x, int y, int width, int height, co const SpriteRleImage* const* images[2] = {sprites[3]->images[0].data(), sprites[3]->images[1].data()}; this->geometry.surface->DrawScaledSprite( x + accessoryX, y + accessoryY, width, height, std::span(frame->cells), images, frame->cellCount, offsetX, offsetY, - scale, nullptr, this->m_context->renderer.atlas, this->m_context->renderSystem, g_serviceType, g_resourceReuseDelay + scale, nullptr, g_renderer->atlas, *GetRenderSystemHolder()->system, g_serviceType, g_resourceReuseDelay ); } } @@ -3958,7 +3951,7 @@ void UINavigationV4Wnd::DrawTargetSprite(int x, int y, int width, int height, co const SpriteRleImage* const* images[2] = {sprites[4]->images[0].data(), sprites[4]->images[1].data()}; this->geometry.surface->DrawScaledSprite( x + accessoryX, y + accessoryY, width, height, std::span(frame->cells), images, frame->cellCount, offsetX, offsetY, - scale, nullptr, this->m_context->renderer.atlas, this->m_context->renderSystem, g_serviceType, g_resourceReuseDelay + scale, nullptr, g_renderer->atlas, *GetRenderSystemHolder()->system, g_serviceType, g_resourceReuseDelay ); } } diff --git a/Source/UI/Window/UIWindow.h b/Source/UI/Window/UIWindow.h index 54c1b77e..346e83c0 100644 --- a/Source/UI/Window/UIWindow.h +++ b/Source/UI/Window/UIWindow.h @@ -10,19 +10,12 @@ #include #include -class CRenderSystemBase; -class ModeEvents; -class RenderPrimitivePool; -class CRenderer; -struct ModeCursor; -struct WindowRegistration; class UIWindow; class UIWindowMgr; class CUIGameSettingsUI; struct RenderQueues; struct BitmapImage; class FontCache; -struct TextLocale; struct tagRECT; struct tagSIZE; struct ActionFrame; @@ -38,20 +31,7 @@ struct ITEM_INFO; class UIItemTagButton; struct UIWindowContext { - RenderPrimitivePool& primitives; - CRenderSystemBase& renderSystem; - CRenderer& renderer; - ModeEvents*& mode; - ModeCursor& cursor; - std::uint32_t& cursorTick; - WindowRegistration& registration; - UIWindowMgr& windowMgr; - std::unordered_set& deferredDeletion; UITextViewer* const& chatConverter; - FontCache& fonts; - const TextLocale& locale; - - void DestroyDeferredChildren(); }; class UIWindow : public UIRPData { @@ -253,7 +233,6 @@ protected: private: UIWindow* Parent() const; - void DeferDeletion(UIWindow* window); UIWindow(const UIWindow&) = delete; UIWindow& operator=(const UIWindow&) = delete; }; diff --git a/Source/UI/Window/UIWindowMgr.h b/Source/UI/Window/UIWindowMgr.h index 97b64a12..5671617e 100644 --- a/Source/UI/Window/UIWindowMgr.h +++ b/Source/UI/Window/UIWindowMgr.h @@ -471,11 +471,13 @@ public: UIWindow* FindSnapExcludedWindow(int cell); void Schedule(UIWindow* window); void AddRendered(UIWindow* window); + void RegisterWindow(UIWindow* window); void UnregisterWindow(UIWindow* window); void InvalidateRegisteredWindows(); void SetUnknown04DC(const char* text); void Destroy(UIWindow* window); void ForgetWindowReferences(UIWindow* removed); + void DeferDeletion(UIWindow* window); void DismissTransient(); void MoveTransient(int x, int y); void RetireTransientWindow(); diff --git a/Source/UI/Window/WindowRegistration.cpp b/Source/UI/Window/WindowRegistration.cpp index f6f85c82..2266f649 100644 --- a/Source/UI/Window/WindowRegistration.cpp +++ b/Source/UI/Window/WindowRegistration.cpp @@ -1,17 +1,16 @@ #include "UI/Window/UIWindow.h" #include "UI/Window/UIWindowMgr.h" -#include "UI/Window/WindowRegistration.h" // OFFSET: 0x00A8B060 // FUNCTION: fn_17120 -void WindowRegistration::Add(UIWindow* window) { - for (UIWindow* existing : this->windows) { +void UIWindowMgr::RegisterWindow(UIWindow* window) { + for (UIWindow* existing : this->registeredWindows) { if (existing == window) { return; } } - this->windows.push_back(window); + this->registeredWindows.push_back(window); } // OFFSET: 0x00AA7200 diff --git a/Source/UI/WindowBackground.cpp b/Source/UI/WindowBackground.cpp index 51d01641..026d33bc 100644 --- a/Source/UI/WindowBackground.cpp +++ b/Source/UI/WindowBackground.cpp @@ -1,6 +1,7 @@ #include "Client/Session.h" #include "Contents/Configuration/ServiceConfiguration.h" #include "Contents/Skills/ClientSkills.h" +#include "Render/DeviceContext/DCSurface.h" #include "Render/DeviceContext/DeviceContext.h" #include "Render/Renderer.h" #include "Render/Textures/SpriteAtlas.h" @@ -106,7 +107,7 @@ void UIWindow::DrawRobeSprite(int job, int sex, int robe, int x, int y, bool ove if (cell.imageType == 0) { texture = g_renderer->atlas.Find(image, sprite->palette, record); if (!texture) { - texture = g_renderer->atlas.Insert(this->m_context->renderSystem, image, sprite->palette, record, g_serviceType, g_resourceReuseDelay); + texture = g_renderer->atlas.Insert(*GetRenderSystemHolder()->system, image, sprite->palette, record, g_serviceType, g_resourceReuseDelay); } } else { texture = static_cast(const_cast(image->unknown_0008));