From ffbeee0f2abc224a45e3d2e63824dae5cb059e6f Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 7 Nov 2026 14:05:21 +0000 Subject: [PATCH] Maintenance: Forced maintainer submission (resubmission of 14678 after td sync to 8deac7a3; replaces 14460 and 14473). Native-run fix Batch #14681 by ragnarok-clanker: forced by an admin (6 lower score(s), 70 changed function(s)); checked with 555 compiled unit(s), including every includer of Source/Client/Mode/CLoginMode.h, Source/Client/Session.h, Source/Contents/Actors/GameActor.h, Source/Contents/Actors/GrannyGameActor.h, Source/Contents/Actors/Pc.h, Source/Contents/Actors/RenderObject.h, Source/Contents/EffectResourceSwitcher.h, Source/Contents/Effects/CartCannon.h, Source/Contents/Effects/EZ2STREffectEx.h, Source/Contents/Effects/EffectActor.h, Source/Contents/Effects/MonsterSkillEffects.h, Source/Contents/Effects/RagEffect.h, Source/Contents/Effects/RectUpEffect.h, Source/Contents/Ground/GroundGeometry.h, Source/Network/Connection/Connection.h, Source/Resource/Audio/WaveResource.h, Source/Resource/Bitmap/BitmapResource.h, Source/Resource/EZeffectResource.h, Source/Resource/EmblemResource.h, Source/Resource/GifResource.h, Source/Resource/ImfResource.h, Source/Resource/Models/AnimatedModelResource.h, Source/Resource/Models/GrannyModelResource.h, Source/Resource/Models/ModelResource.h, Source/Resource/PaletteResource.h, Source/Resource/RmaResource.h, Source/Resource/Sprites/ActionResource.h, Source/Resource/Sprites/SpriteResource.h, Source/Resource/World/GroundResource.h, Source/Resource/World/TerrainResource.h, Source/Resource/World/WorldResource.h, Source/UI/Buttons/UIBmpRadioBtn.h, Source/UI/Buttons/UITextButton.h, Source/UI/Item/UIItemPurchaseWnd.h, Source/UI/Item/UIItemSellWnd.h, Source/UI/Item/UIItemSellWnd2.h, Source/UI/Item/UIItemStoreWnd.h, Source/UI/Item/UIItemWnd.h, Source/UI/Item/UIParaItemShopWnd.h, Source/UI/Items/UIItemRepairWnd.h, Source/UI/Items/UIMakeTargetListWnd.h, Source/UI/Items/UIMakeTargetProcessWnd.h, Source/UI/Items/UIWeaponRefineWnd.h, Source/UI/Rodex/UIRodexInboxWnd.h, Source/UI/Shop/UIMerchantItemShopWnd.h, Source/UI/Shop/UIMerchantMirrorItemWnd.h, Source/UI/Shop/UIMerchantShopMakeWnd.h, Source/UI/StylingShop/UIStylingShopWnd.h, Source/UI/UIChangeMaterialWnd.h, Source/UI/UIIngredientInfoWnd.h, Source/UI/UIItemReformWnd.h, Source/UI/UILapineScrollBar.h, Source/UI/Window/UIHotKeyWnd.h, Source/UI/Window/UINewSelectCharWnd.h. --- Source/Client/Mode/CLoginMode.h | 5 +- Source/Client/Mode/GameMode.cpp | 50 +++++++++---------- Source/Client/Mode/GameModeMiniMap.cpp | 2 - Source/Client/Mode/GameModeNotices.cpp | 2 +- Source/Client/Mode/GameModePackets.cpp | 2 +- Source/Client/Mode/LoginMode.cpp | 44 +++++++--------- Source/Client/Replay.cpp | 2 +- Source/Client/Session.cpp | 23 +++++---- Source/Client/Session.h | 14 +++--- Source/Contents/Actors/GameActor.h | 2 +- Source/Contents/Actors/GameObject.cpp | 1 + Source/Contents/Actors/GrannyGameActor.h | 4 +- Source/Contents/Actors/Pc.h | 6 +-- Source/Contents/Actors/Player.cpp | 12 ++--- Source/Contents/Actors/RenderObject.cpp | 4 +- Source/Contents/Actors/RenderObject.h | 4 ++ Source/Contents/ClientState.cpp | 2 +- Source/Contents/EffectResourceSwitcher.cpp | 38 +++++++------- Source/Contents/EffectResourceSwitcher.h | 31 +----------- Source/Contents/Effects/CartCannon.cpp | 2 +- Source/Contents/Effects/CartCannon.h | 2 +- Source/Contents/Effects/EZ2STREffectEx.cpp | 10 ++-- Source/Contents/Effects/EZ2STREffectEx.h | 32 +++++++++--- Source/Contents/Effects/EffectActor.cpp | 6 +-- Source/Contents/Effects/EffectActor.h | 1 + Source/Contents/Effects/MonsterSkillEffects.h | 4 ++ .../Contents/Effects/PartyMemberEffects.cpp | 2 +- Source/Contents/Effects/RagEffect.h | 2 +- Source/Contents/Effects/RectUpEffect.cpp | 2 +- Source/Contents/Effects/RectUpEffect.h | 2 +- Source/Contents/Ground/GroundGeometry.cpp | 5 ++ Source/Contents/Ground/GroundGeometry.h | 1 + Source/Contents/Messenger/ClientMessenger.cpp | 2 +- Source/Contents/Messenger/MessengerMember.cpp | 4 +- Source/Contents/SignBoard/SignBoard.cpp | 6 +-- Source/Contents/Sound/SoundMaker.cpp | 5 +- Source/Contents/World/WorldModelLoading.cpp | 12 ++--- Source/Contents/World/WorldModelView.cpp | 17 ++----- Source/Contents/World/WorldObjects.cpp | 12 +++-- Source/Contents/World/WorldTerrainPicking.cpp | 3 +- Source/Network/Connection/Connection.h | 3 ++ Source/Render/DX9/GroundQueuesDX9.cpp | 4 +- Source/Resource/Audio/WaveResource.cpp | 8 +++ Source/Resource/Audio/WaveResource.h | 1 + Source/Resource/Bitmap/BitmapResource.cpp | 18 +++++++ Source/Resource/Bitmap/BitmapResource.h | 1 + Source/Resource/EZeffectResource.cpp | 9 ++++ Source/Resource/EZeffectResource.h | 1 + Source/Resource/EmblemResource.cpp | 9 ++++ Source/Resource/EmblemResource.h | 1 + Source/Resource/GifResource.cpp | 9 ++++ Source/Resource/GifResource.h | 1 + Source/Resource/ImfResource.cpp | 9 ++++ Source/Resource/ImfResource.h | 1 + .../Resource/Models/AnimatedModelResource.cpp | 23 +++++++++ .../Resource/Models/AnimatedModelResource.h | 1 + Source/Resource/Models/GrannyModelResource.h | 2 + Source/Resource/Models/ModelResource.cpp | 9 ++++ Source/Resource/Models/ModelResource.h | 2 + Source/Resource/Models/ModelResourceV2.cpp | 9 ++++ Source/Resource/PaletteResource.cpp | 9 ++++ Source/Resource/PaletteResource.h | 1 + Source/Resource/RmaResource.cpp | 9 ++++ Source/Resource/RmaResource.h | 1 + Source/Resource/Sprites/ActionResource.cpp | 8 +++ Source/Resource/Sprites/ActionResource.h | 1 + Source/Resource/Sprites/SpriteResource.cpp | 9 ++++ Source/Resource/Sprites/SpriteResource.h | 1 + Source/Resource/World/GroundResource.cpp | 9 ++++ Source/Resource/World/GroundResource.h | 1 + Source/Resource/World/TerrainResource.cpp | 9 ++++ Source/Resource/World/TerrainResource.h | 1 + Source/Resource/World/WorldResource.cpp | 9 ++++ Source/Resource/World/WorldResource.h | 1 + Source/UI/Acceptance/UIChooseSellBuyWnd.cpp | 22 ++++---- Source/UI/AdventureGuide/UIAdventureGuide.cpp | 9 ++++ Source/UI/Buttons/UIBmpRadioBtn.h | 10 ++++ Source/UI/Buttons/UITextButton.cpp | 24 ++++----- Source/UI/Buttons/UITextButton.h | 2 - Source/UI/CashShop/UICashShopWnd.cpp | 18 +++---- Source/UI/Edit/UIEditCtrl.cpp | 14 +++--- Source/UI/Enchant/UIEnchantUI.cpp | 9 ++++ Source/UI/Exchange/UIExchangeUI.cpp | 9 ++++ Source/UI/GameSettings/GameSettingsUI.cpp | 11 +++- Source/UI/Guild/UIGuildWnd.cpp | 8 +-- Source/UI/Guild/UIGuild_Storage_Log.cpp | 5 +- Source/UI/Item/UIEquipmentPropertiesWnd.cpp | 9 ++++ Source/UI/Item/UIItemPurchaseWnd.h | 2 +- Source/UI/Item/UIItemSellWnd.h | 2 +- Source/UI/Item/UIItemSellWnd2.h | 2 +- Source/UI/Item/UIItemStoreWnd.h | 2 +- Source/UI/Item/UIItemWnd.h | 4 ++ Source/UI/Item/UIParaItemShopWnd.cpp | 10 ++-- Source/UI/Item/UIParaItemShopWnd.h | 4 +- Source/UI/Items/UIItemRepairWnd.cpp | 2 +- Source/UI/Items/UIItemRepairWnd.h | 2 +- Source/UI/Items/UIMakeTargetListWnd.cpp | 2 +- Source/UI/Items/UIMakeTargetListWnd.h | 2 +- Source/UI/Items/UIMakeTargetProcessWnd.cpp | 2 +- Source/UI/Items/UIMakeTargetProcessWnd.h | 2 +- Source/UI/Items/UIWeaponRefineWnd.cpp | 2 +- Source/UI/Items/UIWeaponRefineWnd.h | 2 +- Source/UI/Lists/UIComboBoxDefWnd.cpp | 14 +++--- Source/UI/Lists/UIScrollBar.cpp | 24 ++++----- Source/UI/Menu/UIMenuIconWnd.cpp | 2 +- Source/UI/Party/UIMiniPartyWnd.cpp | 9 ++-- Source/UI/Party/UIRequestJoinPartyWnd.cpp | 2 +- .../ProbabilityTable/UIProbabilityTable.cpp | 9 ++++ Source/UI/Quest/UIOngoingQuestInfo.cpp | 9 ++++ Source/UI/Quest/UIRecommendedQuestInfo.cpp | 9 ++++ Source/UI/Quest/UIRenewQuestUI.cpp | 9 ++++ Source/UI/Rodex/UIRodexInboxWnd.cpp | 10 ++-- Source/UI/Rodex/UIRodexInboxWnd.h | 6 +-- Source/UI/RuneSystem/UIRuneSystemWnd.cpp | 44 ++++++++-------- .../UISelectPackageItemBox.cpp | 9 ++++ Source/UI/Shop/UIMerchantItemShopWnd.h | 2 +- Source/UI/Shop/UIMerchantMirrorItemWnd.h | 2 +- Source/UI/Shop/UIMerchantShopMakeWnd.h | 2 +- Source/UI/SkillDelayInfo/UISkillDelayInfo.cpp | 9 ++++ Source/UI/StylingShop/UIStylingShopWnd.cpp | 2 +- Source/UI/StylingShop/UIStylingShopWnd.h | 4 +- Source/UI/UIBartermarketWnd.cpp | 4 +- Source/UI/UIChangeMaterialWnd.cpp | 12 ++--- Source/UI/UIChangeMaterialWnd.h | 10 ++-- Source/UI/UICheckAttendanceWnd.cpp | 2 +- Source/UI/UIGradeEnchantWnd.cpp | 30 +++++------ Source/UI/UIIngredientInfoWnd.h | 2 +- Source/UI/UIItemReformWnd.h | 4 ++ Source/UI/UILapineBoxWnd.cpp | 8 +-- Source/UI/UILapineScrollBar.h | 6 +-- Source/UI/UIMacroReport.cpp | 9 ++++ Source/UI/Window/UIHotKeyWnd.cpp | 2 +- Source/UI/Window/UIHotKeyWnd.h | 2 +- Source/UI/Window/UIMessageBox.cpp | 5 +- Source/UI/Window/UIMileageWnd.cpp | 2 +- Source/UI/Window/UINewMakeCharWnd.cpp | 2 +- Source/UI/Window/UINewSelectCharWnd.cpp | 44 +++++----------- Source/UI/Window/UINewSelectCharWnd.h | 4 +- Source/UI/Window/UIWindow.cpp | 5 +- Source/UI/Window/UIWindowMgr.cpp | 2 +- Source/UI/Window/WindowDialogs.cpp | 2 +- Source/Utility/JsonCppLoader.cpp | 48 ++++++++---------- 142 files changed, 709 insertions(+), 435 deletions(-) diff --git a/Source/Client/Mode/CLoginMode.h b/Source/Client/Mode/CLoginMode.h index a42f0693d..d4f7b8e80 100644 --- a/Source/Client/Mode/CLoginMode.h +++ b/Source/Client/Mode/CLoginMode.h @@ -27,6 +27,7 @@ struct NotifyZoneServer2Packet; struct PasswordModePacket; struct AcceptEnterPositionPacket; struct AcceptLoginPacket; +struct ConnectionEndpoint; #pragma pack(push, 1) struct CharacterInfo { @@ -193,9 +194,7 @@ extern int g_modalImmediate; extern bool g_pingLogEnabled; extern std::uint32_t g_pingLogFirstTick; extern std::list g_pingLogTicks; -extern char g_zoneServerIp[16]; -extern int g_zoneServerPort; -extern char g_zoneServerHost[129]; +extern ConnectionEndpoint g_zoneServerEndpoint; extern CharacterInfo g_charInfo; extern bool g_replayMode; extern int g_restoreSurfaces; diff --git a/Source/Client/Mode/GameMode.cpp b/Source/Client/Mode/GameMode.cpp index a89fbe37a..3fc7ec209 100644 --- a/Source/Client/Mode/GameMode.cpp +++ b/Source/Client/Mode/GameMode.cpp @@ -13,6 +13,7 @@ #include "Contents/Effects/EffectLists.h" #include "Contents/Effects/SkillEffects.h" #include "Contents/Effects/RagEffect.h" +#include "Contents/Ground/GroundGeometry.h" #include "Contents/Jobs/JobInheritance.h" #include "Contents/GuildInfo.h" #include "Contents/GuildMgr.h" @@ -6509,9 +6510,9 @@ void CGameMode::ChangeZoneServer(std::string mapName, int x, int y, int ip, int in_addr address; address.s_addr = static_cast(ip); - StringFormat(g_zoneServerIp, sizeof(g_zoneServerIp), static_cast(-1), inet_ntoa(address)); - g_zoneServerPort = port; - StringFormat(g_zoneServerHost, sizeof(g_zoneServerHost), static_cast(-1), "%s", host.c_str()); + StringFormat(g_zoneServerEndpoint.address, sizeof(g_zoneServerEndpoint.address), static_cast(-1), inet_ntoa(address)); + g_zoneServerEndpoint.port = port; + StringFormat(g_zoneServerEndpoint.overrideAddress, sizeof(g_zoneServerEndpoint.overrideAddress), static_cast(-1), "%s", host.c_str()); GetRagConnection().Close(); g_activeSkillEffects.clear(); @@ -6523,7 +6524,7 @@ void CGameMode::ChangeZoneServer(std::string mapName, int x, int y, int ip, int } if (g_replayAnimationScaling == 0) { - this->unknown_0018 = GetRagConnection().Connect(*reinterpret_cast(g_zoneServerIp)); + this->unknown_0018 = GetRagConnection().Connect(g_zoneServerEndpoint); if (!this->unknown_0018) { GetRagConnection().Close(); if (g_windowMgr.Confirm(LookupMessage(1), 1, true, true, 0, "Message", 280, 120, 0) != 269) { @@ -6541,7 +6542,7 @@ void CGameMode::ChangeZoneServer(std::string mapName, int x, int y, int ip, int packet.clientTime = timeGetTime(); packet.aid = g_session.m_aid; packet.gid = g_session.m_gid; - packet.authCode = reinterpret_cast(g_session.unknown_0E9C)[2]; + packet.authCode = *reinterpret_cast(&g_session.unknown_0EA0[0x04]); packet.sex = static_cast(g_session.SyncUnknown0E98()); GetRagConnection().Send(reinterpret_cast(GetRagConnection()).FixedLength(packet.packetType), &packet); g_session.SetOption(17, 1, 0); @@ -7283,10 +7284,10 @@ void CGameMode::InitializeState() { this->cursorOffsetX = 0.0f; this->cursorOffsetY = 0.0f; *reinterpret_cast(this->unknown_00D8) = 0; - *reinterpret_cast(&this->unknown_00D8[4]) = g_screenWidth; - *reinterpret_cast(&this->unknown_00D8[8]) = g_screenHeight; - this->unknown_00E4 = g_screenWidth; - this->unknown_00E8 = g_screenHeight; + *reinterpret_cast(&this->unknown_00D8[4]) = g_mouse.x; + *reinterpret_cast(&this->unknown_00D8[8]) = g_mouse.y; + this->unknown_00E4 = g_mouse.x; + this->unknown_00E8 = g_mouse.y; this->unknown_0244 = 0; this->unknown_024C = 0; this->unknown_0250 = 0; @@ -7371,7 +7372,7 @@ void CGameMode::InitializeState() { g_guildInfo.Init(); g_windowMgr.SendNotice(3, 0, 0, 0, 0, 0); g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(22)), 0xFFE6E6, 0, 0, 0); - inet_ntoa(*reinterpret_cast(&g_session.unknown_0E9C[0x10])); + inet_ntoa(*reinterpret_cast(&g_session.unknown_0EA0[0x0C])); if (!g_accountLinkedUserDataMgr->m_loaded) { g_windowMgr.SendNotice(1, reinterpret_cast(LookupMessage(3457)), 255, 0, 0, 0); } @@ -7459,7 +7460,7 @@ void CGameMode::InitializeState() { } this->unknown_05FC = nullptr; - *reinterpret_cast(this->unknown_0600) = 0; + this->unknown_0600 = 0; s_signBoardMgr->Initialize(); g_statusRefreshSuppressed = 0; int& localMapMove = g_session.m_localMapMove; @@ -7821,7 +7822,7 @@ void CGameMode::Initialize(const char* name) { miniMap.append(".bmp", 4); std::strcpy(reinterpret_cast(this->unknown_0090), miniMap.c_str()); - g_renderer->SetFog(1); + g_renderer->ClearDepth(1); g_session.m_weight = 0; g_session.RefreshHpSpWindows(); g_session.InvalidateWindowFrames(); @@ -7838,7 +7839,7 @@ void CGameMode::Initialize(const char* name) { g_windowMgr.SendNotice(4, 0, 0, 0, 0, 0); g_windowMgr.CenterSurface0478(); g_windowMgr.DrawWindows(); - if (g_renderer->CaptureBackBuffer()) { + if (g_renderer->Draw()) { g_renderer->Present(1); } @@ -7859,12 +7860,12 @@ void CGameMode::Initialize(const char* name) { g_depthEnd = static_cast(std::atof((*fog)[1].c_str())); g_worldOverlayColor = ParseHexString((*fog)[2].c_str()); g_fogDensity = static_cast(std::atof((*fog)[3].c_str())); - g_renderer->SetClearColor(1); + g_renderer->SetFog(1); } else { - g_renderer->SetClearColor(0); + g_renderer->SetFog(0); } } else { - g_renderer->SetClearColor(0); + g_renderer->SetFog(0); } Replay::Instance().ResetPlayback(); @@ -8332,7 +8333,7 @@ __forceinline void CGameMode::ShowHoverActorName(CGameActor* actor) { // OFFSET: 0x00CDFE10 // FUNCTION: fn_21328 int CGameMode::ProcessMousePick(int result, ActorPickInfo* pick) { - if (g_sub_1319eb4 == 1 && pick) { + if (g_mouse.buttons[0] == 1 && pick) { UIMacroReporterWnd* reporter = static_cast(g_windowMgr.LookupWindow(286)); if (reporter && reporter->unknown_010C == true && reporter->m_mode == 0) { reporter->AddPickedActor(reinterpret_cast(pick)); @@ -8350,10 +8351,10 @@ int CGameMode::ProcessMousePick(int result, ActorPickInfo* pick) { if (this->unknown_0028 == 0) { if (!pick) { - if (lockedPick != 0 || g_sub_1319eb4 == 1) { + if (lockedPick != 0 || g_mouse.buttons[0] == 1) { return result; } - if (this->unknown_00DC == g_screenWidth && this->unknown_00E0 == g_screenHeight) { + if (this->unknown_00DC == g_mouse.x && this->unknown_00E0 == g_mouse.y) { return result; } pickTarget = 0; @@ -8363,7 +8364,7 @@ int CGameMode::ProcessMousePick(int result, ActorPickInfo* pick) { } else { this->SetCursorAction(5); if (lockedPick != 0) { - if (g_sub_1319eb4 == 1) { + if (g_mouse.buttons[0] == 1) { this->SendMsg(26, 0, 0, 0, 0); } else { this->SetCursorAction(0); @@ -8373,7 +8374,7 @@ int CGameMode::ProcessMousePick(int result, ActorPickInfo* pick) { result = 0; } } else { - if (g_sub_1319eb4 == 2) { + if (g_mouse.buttons[0] == 2) { return 1; } if (!pick && clickTarget == 0 && pickTarget == 0) { @@ -8434,9 +8435,8 @@ void __stdcall SendMacroUserInfoPacket(std::uint16_t first, std::uint16_t second // OFFSET: 0x00CE0210 // FUNCTION: fn_21329 int CGameMode::ProcessGroundClick(int result) { - const auto drawCell = [](GroundGeometry* ground, const float* matrix, int column, int row, std::uint32_t color) { - void** groundVtable = *reinterpret_cast(ground); - reinterpret_cast(groundVtable[14])(ground, matrix, column, row, color); + const auto drawCell = [this](GroundGeometry* ground, const float* matrix, int column, int row, std::uint32_t color) { + ground->DrawGrid(*this->scene->terrain, matrix, column, row, color); }; UIWindow* macroArea = g_windowMgr.LookupWindow(0x11E); @@ -10307,7 +10307,7 @@ void CGameMode::ProcessActorPick(int& handled, ActorPickInfo* pick, CGameActor* } int& balloonAid = *reinterpret_cast(&this->unknown_00EC[0x00]); - if (this->unknown_00DC == g_screenWidth && this->unknown_00E0 == g_screenHeight) { + if (this->unknown_00DC == g_mouse.x && this->unknown_00E0 == g_mouse.y) { this->ShowActorNameBalloon(balloonAid); return; } diff --git a/Source/Client/Mode/GameModeMiniMap.cpp b/Source/Client/Mode/GameModeMiniMap.cpp index 9b7450cf2..5711d941d 100644 --- a/Source/Client/Mode/GameModeMiniMap.cpp +++ b/Source/Client/Mode/GameModeMiniMap.cpp @@ -572,8 +572,6 @@ int g_minimapCoordinateValue; int g_minimapCoordinateDigits; // GLOBAL: gl_25046 int g_minimapCoordinateDigitValues[4]; -// GLOBAL: gl_24672 -int g_screenWidth; // OFFSET: 0x00CD2A10 diff --git a/Source/Client/Mode/GameModeNotices.cpp b/Source/Client/Mode/GameModeNotices.cpp index 50f3bcb9b..fb154efca 100644 --- a/Source/Client/Mode/GameModeNotices.cpp +++ b/Source/Client/Mode/GameModeNotices.cpp @@ -4367,7 +4367,7 @@ void CGameMode::ReceiveAcceptEnter(const unsigned char* data) { _time32(&now); fprintf(file, "\n"); fprintf(file, "server:%s\n", g_session.m_accountName.c_str()); - fprintf(file, "ip:%s\n", g_zoneServerIp); + fprintf(file, "ip:%s\n", g_zoneServerEndpoint.address); fprintf(file, "map:%s.gat\n", g_session.m_navigationPlayerMap); fprintf(file, "time:%s\n\n", _ctime32(&now)); fclose(file); diff --git a/Source/Client/Mode/GameModePackets.cpp b/Source/Client/Mode/GameModePackets.cpp index b7166dd74..672d84ae7 100644 --- a/Source/Client/Mode/GameModePackets.cpp +++ b/Source/Client/Mode/GameModePackets.cpp @@ -21544,7 +21544,7 @@ void CGameMode::ProcessIncomingPackets() { _time32(&now); fprintf(file, "\n"); fprintf(file, "server:%s\n", g_session.m_accountName.c_str()); - fprintf(file, "ip:%s\n", g_zoneServerIp); + fprintf(file, "ip:%s\n", g_zoneServerEndpoint.address); fprintf(file, "map:%s.gat\n", g_session.m_navigationPlayerMap); fprintf(file, "time:%s\n\n", _ctime32(&now)); fclose(file); diff --git a/Source/Client/Mode/LoginMode.cpp b/Source/Client/Mode/LoginMode.cpp index 7766f1762..776958159 100644 --- a/Source/Client/Mode/LoginMode.cpp +++ b/Source/Client/Mode/LoginMode.cpp @@ -648,11 +648,11 @@ const char* GetUserCountText(unsigned short userCount) { // OFFSET: 0x00D8E990 // FUNCTION: fn_22274 void CLoginMode::ReceiveCharacterSlots(const CharacterSlotsPacket* packet) { - g_session.unknown_59C0 = packet->normalSlots; - g_session.unknown_59C4 = packet->premiumSlots; - g_session.unknown_59C8 = packet->billingSlots; - g_session.unknown_59CC = packet->validSlots; - g_session.unknown_59D4 = packet->producibleSlots; + g_session.m_normalSlotCount = packet->normalSlots; + g_session.m_premiumSlotCount = packet->premiumSlots; + g_session.m_billingSlotCount = packet->billingSlots; + g_session.m_producibleSlotCount = packet->validSlots; + g_session.m_validSlotCount = packet->producibleSlots; SecureZeroMemory(this->characters, sizeof(this->characters)); g_session.unknown_59BC = 0; @@ -776,7 +776,7 @@ void CLoginMode::ReceiveCharacterPage(const CharacterPagePacket* packet) { _time32(&now); for (int i = 0; i < static_cast(count); ++i) { if (this->characters[this->unknown_01D8 + i].sex == 99) { - this->characters[this->unknown_01D8 + i].sex = g_session.unknown_0E9C[0]; + this->characters[this->unknown_01D8 + i].sex = static_cast(g_session.m_sex); } if (this->characters[this->unknown_01D8 + i].deleteDate != 0) { this->characters[this->unknown_01D8 + i].deleteDate += now; @@ -1570,13 +1570,7 @@ struct NotifyZoneServer2Packet { #pragma pack(pop) // GLOBAL: gl_25028 -char g_zoneServerIp[16]; - -// GLOBAL: gl_25079 -int g_zoneServerPort; - -// GLOBAL: gl_25080 -char g_zoneServerHost[129]; +ConnectionEndpoint g_zoneServerEndpoint; // OFFSET: 0x00D929A0 // FUNCTION: fn_22290 @@ -1593,9 +1587,9 @@ void CLoginMode::ConnectZoneServer(std::uint32_t gid, std::string mapName, std:: in_addr address; address.s_addr = ip; - strcpy(g_zoneServerIp, inet_ntoa(address)); - g_zoneServerPort = port; - memcpy_s(g_zoneServerHost, sizeof(g_zoneServerHost), host.c_str(), std::min(sizeof(g_zoneServerHost), host.size() + 1)); + strcpy(g_zoneServerEndpoint.address, inet_ntoa(address)); + g_zoneServerEndpoint.port = port; + memcpy_s(g_zoneServerEndpoint.overrideAddress, sizeof(g_zoneServerEndpoint.overrideAddress), host.c_str(), std::min(sizeof(g_zoneServerEndpoint.overrideAddress), host.size() + 1)); GetRagConnection().Close(); this->pendingCursorType = 12; @@ -1882,7 +1876,7 @@ void CLoginMode::Zc_Accept_Enter3(const AcceptEnterPositionPacket* packet) { _time32(&now); fprintf(file, "\n"); fprintf(file, "server:%s\n", g_session.m_accountName.c_str()); - fprintf(file, "ip:%s\n", g_zoneServerIp); + fprintf(file, "ip:%s\n", g_zoneServerEndpoint.address); fprintf(file, "map:%s.gat\n", g_session.m_navigationPlayerMap); fprintf(file, "time:%s\n\n", _ctime32(&now)); fclose(file); @@ -1923,7 +1917,7 @@ void CLoginMode::Zc_Accept_Enter2(const AcceptEnterPositionPacket* packet) { _time32(&now); fprintf(file, "\n"); fprintf(file, "server:%s\n", g_session.m_accountName.c_str()); - fprintf(file, "ip:%s\n", g_zoneServerIp); + fprintf(file, "ip:%s\n", g_zoneServerEndpoint.address); fprintf(file, "map:%s.gat\n", g_session.m_navigationPlayerMap); fprintf(file, "time:%s\n\n", _ctime32(&now)); fclose(file); @@ -2312,7 +2306,7 @@ void CLoginMode::ReceiveAcceptLogin(const AcceptLoginPacket* packet, int version g_loginAcceptTime = timeGetTime(); *reinterpret_cast(&g_session.unknown_56B8[4]) = LookupMessage(940); - SessionAccount& account = *reinterpret_cast(g_session.unknown_0E9C); + SessionAccount& account = *reinterpret_cast(&g_session.m_sex); account.authCode = packet->authCode; account.userLevel = packet->userLevel; g_session.m_aid = packet->aid; @@ -2324,13 +2318,13 @@ void CLoginMode::ReceiveAcceptLogin(const AcceptLoginPacket* packet, int version if (packet->sex >= 10) { g_session.SetFlag(packet->sex - 10); - g_doramSex = packet->sex - 10; + g_session.m_sex = packet->sex - 10; } else { if (g_loginExitFlag == 1) { exit(0); } g_session.SetFlag(packet->sex); - g_doramSex = packet->sex; + g_session.m_sex = packet->sex; } if (g_serviceType == 6 || g_serviceType == 10 || g_serviceType == 12) { @@ -3128,7 +3122,7 @@ int CLoginMode::SendMsg(int event, int argument1, int argument2, int argument3, g_windowMgr.LoadShortcutItems(); for (int i = 0; i < this->characterCount; ++i) { if (this->characters[i].slot == static_cast(g_selectedSlotIndex)) { - *reinterpret_cast(&g_session.unknown_0E9C[0x04]) = this->characters[i].slot; + *reinterpret_cast(&g_session.unknown_0EA0[0x00]) = this->characters[i].slot; g_session.SetJob(this->characters[i].job); g_session.m_gid = this->characters[i].gid; *reinterpret_cast(g_session.unknown_16F4) = this->characters[i].speed; @@ -3184,7 +3178,7 @@ int CLoginMode::SendMsg(int event, int argument1, int argument2, int argument3, g_session.InvalidateWindowFrames(); g_session.m_jobLevel = *reinterpret_cast(&this->characters[i].unknown_000C[0x0C]); g_session.InvalidateWindowFrames(); - *reinterpret_cast(&g_session.unknown_0E9C[0x34]) = this->characters[i].unknown_008B[0]; + *reinterpret_cast(&g_session.unknown_0EA0[0x30]) = this->characters[i].unknown_008B[0]; g_session.m_head = this->characters[i].head; *reinterpret_cast(&g_session.unknown_0EDC[0x04]) = 0; *reinterpret_cast(&g_session.unknown_0EDC[0x08]) = 0; @@ -3643,7 +3637,7 @@ void CLoginMode::Slot7(int value) { this->unknown_0018 = 1; ServerAddress2* servers = reinterpret_cast(this->serverList); - SessionAccount& account = *reinterpret_cast(g_session.unknown_0E9C); + SessionAccount& account = *reinterpret_cast(&g_session.m_sex); switch (value) { case 0: @@ -4044,7 +4038,7 @@ void CLoginMode::Slot7(int value) { g_session.unknown_593C = 0; this->wallpaperName = g_loginWallpaperName; g_windowMgr.SetSurface0478(reinterpret_cast(ResourceMgr::Instance().Load(Resolve(this->wallpaperName.c_str())))); - this->unknown_0018 = GetRagConnection().Connect(*reinterpret_cast(g_zoneServerIp)); + this->unknown_0018 = GetRagConnection().Connect(g_zoneServerEndpoint); if (!this->unknown_0018) { GetRagConnection().Close(); if (g_windowMgr.Confirm(LookupMessage(1), 1, true, true, 0, "Message", 280, 120, 0) != 0x10D) { diff --git a/Source/Client/Replay.cpp b/Source/Client/Replay.cpp index 0cc21a5f7..e6e437d04 100644 --- a/Source/Client/Replay.cpp +++ b/Source/Client/Replay.cpp @@ -1245,7 +1245,7 @@ std::vector CSession::BuildCharacterReplayRecords() { AppendRecord(records, MakeReplayRecord(1056, this->unknown_1704, 4)); AppendRecord(records, MakeReplayRecord(1057, &this->unknown_1708, sizeof(this->unknown_1708))); AppendRecord(records, MakeReplayRecord(1058, this->unknown_170C, 4)); - AppendRecord(records, MakeReplayRecord(1059, &this->unknown_0E9C[0x34], 4)); + AppendRecord(records, MakeReplayRecord(1059, &this->unknown_0EA0[0x30], 4)); AppendRecord(records, MakeReplayRecord(1060, &this->m_head, sizeof(this->m_head))); AppendRecord(records, MakeReplayRecord(1061, &this->unknown_0EDC[0x4], 8)); AppendRecord(records, MakeReplayRecord(1062, &this->unknown_0EDC[0xC], 4)); diff --git a/Source/Client/Session.cpp b/Source/Client/Session.cpp index 3c0ac5428..af8cba19d 100644 --- a/Source/Client/Session.cpp +++ b/Source/Client/Session.cpp @@ -225,7 +225,7 @@ bool CSession::IsWithinUnknown59C0(int value) const { return false; } - return this->unknown_59C0 - this->unknown_8130 <= value; + return this->m_normalSlotCount - this->unknown_8130 <= value; } // OFFSET: 0x00E3D390 @@ -247,11 +247,11 @@ __declspec(noinline) int CSession::HasItem61B8(std::uint32_t id) const { // OFFSET: 0x00E3DB20 // FUNCTION: fn_24194 bool CSession::ResetUnknownState() { - this->unknown_59C0 = 1; - this->unknown_59C4 = 1; - this->unknown_59C8 = 1; - this->unknown_59CC = 1; - this->unknown_59D4 = 1; + this->m_normalSlotCount = 1; + this->m_premiumSlotCount = 1; + this->m_billingSlotCount = 1; + this->m_producibleSlotCount = 1; + this->m_validSlotCount = 1; this->unknown_59BC = 1; this->unknown_0E94 = 1; this->unknown_103C = -1; @@ -3006,12 +3006,12 @@ void CSession::Init() { this->m_simplifiedSkillList = 0; this->m_showSkillDescription = 1; this->unknown_59BC = 0; - this->unknown_59C0 = 0; - this->unknown_59C4 = 0; - this->unknown_59C8 = 0; - this->unknown_59CC = 0; + this->m_normalSlotCount = 0; + this->m_premiumSlotCount = 0; + this->m_billingSlotCount = 0; + this->m_producibleSlotCount = 0; this->unknown_59D0 = 0; - this->unknown_59D4 = 0; + this->m_validSlotCount = 0; this->m_noSubChatWnds.clear(); this->m_subChatWnds.clear(); this->m_hotkeyScript = nullptr; @@ -7069,6 +7069,7 @@ void CSession::LoadSessionTables() { session->LoadLuaDataFiles(); session->InitWeaponHitWaveNames(); session->InitResourceNameTables(); + session->InitJobSpriteNames(); session->InitJobNameTable(); session->InitNpcLocationRadius(); session->InitCommandTables(); diff --git a/Source/Client/Session.h b/Source/Client/Session.h index 8a2c3a80c..38f880ee1 100644 --- a/Source/Client/Session.h +++ b/Source/Client/Session.h @@ -234,7 +234,8 @@ public: /* 07F4 */ unsigned char unknown_07F4[0x6A0]; /* 0E94 */ int unknown_0E94; /* 0E98 */ int unknown_0E98; - /* 0E9C */ unsigned char unknown_0E9C[0x3C]; + /* 0E9C */ int m_sex; + /* 0EA0 */ unsigned char unknown_0EA0[0x38]; /* 0ED8 */ int m_head; /* 0EDC */ unsigned char unknown_0EDC[0x10]; /* 0EEC */ int m_bodyStyle; @@ -500,12 +501,12 @@ public: /* 5970 */ int unknown_5970; /* 5974 */ unsigned char unknown_5974[0x48]; /* 59BC */ int unknown_59BC; - /* 59C0 */ int unknown_59C0; - /* 59C4 */ int unknown_59C4; - /* 59C8 */ int unknown_59C8; - /* 59CC */ int unknown_59CC; + /* 59C0 */ int m_normalSlotCount; + /* 59C4 */ int m_premiumSlotCount; + /* 59C8 */ int m_billingSlotCount; + /* 59CC */ int m_producibleSlotCount; /* 59D0 */ int unknown_59D0; - /* 59D4 */ int unknown_59D4; + /* 59D4 */ int m_validSlotCount; /* 59D8 */ LuaScript* m_hotkeyScript; union { /* 59DC */ unsigned char unknown_59DC[0x19C]; @@ -1338,6 +1339,7 @@ static_assert(offsetof(CSession, m_humanFemaleHeadNames) == 0xF78); static_assert(offsetof(CSession, m_doramMaleHeadNames) == 0x618C); static_assert(offsetof(CSession, m_doramFemaleHeadNames) == 0x6198); static_assert(offsetof(CSession, unknown_0E98) == 0xE98); +static_assert(offsetof(CSession, m_sex) == 0xE9C); static_assert(offsetof(CSession, m_petActionTable) == 0x1058); static_assert(offsetof(CSession, m_job) == 0x1628); static_assert(offsetof(CSession, m_inventoryItems) == 0x1710); diff --git a/Source/Contents/Actors/GameActor.h b/Source/Contents/Actors/GameActor.h index e7dd5cd69..ee8a823d3 100644 --- a/Source/Contents/Actors/GameActor.h +++ b/Source/Contents/Actors/GameActor.h @@ -170,7 +170,7 @@ public: void SetRenderInfo(const float* bounds, float x, float y) override; void SetAction(unsigned animation, int motion, int repeat) override; - virtual std::uint32_t Slot13(); + std::uint32_t Slot13() override; virtual bool Slot14(); virtual void Slot15(int first, int second); virtual void Slot16(); diff --git a/Source/Contents/Actors/GameObject.cpp b/Source/Contents/Actors/GameObject.cpp index 6558fa5e5..c0e337717 100644 --- a/Source/Contents/Actors/GameObject.cpp +++ b/Source/Contents/Actors/GameObject.cpp @@ -314,6 +314,7 @@ void CRenderObject::DrawSprite(int argument, bool seasonal, float offset) { } drawn = true; + quad.image = image; if (this->render.unknown_00A4Bytes[1] != 0) { const float minX = quad.left < quad.right ? quad.left : quad.right; const float maxX = quad.left > quad.right ? quad.left : quad.right; diff --git a/Source/Contents/Actors/GrannyGameActor.h b/Source/Contents/Actors/GrannyGameActor.h index aaa040609..ad244c865 100644 --- a/Source/Contents/Actors/GrannyGameActor.h +++ b/Source/Contents/Actors/GrannyGameActor.h @@ -30,11 +30,11 @@ public: int Slot37() override; void Unused6860(int value); void Unused7950(int value); - void SetModel(int job, int value, int unused); + void Slot18(int job, int value, int unused) override; void Render(int argument) override; void RenderLit(int argument, const GrannyActorLight& light); void RenderShadowed(int argument); - void SpawnCorpseActor(); + void Slot38() override; bool OnProcess() override; /* 0410 */ CTexture* emblemTexture; diff --git a/Source/Contents/Actors/Pc.h b/Source/Contents/Actors/Pc.h index 6c94370e0..64ad8d21a 100644 --- a/Source/Contents/Actors/Pc.h +++ b/Source/Contents/Actors/Pc.h @@ -40,7 +40,8 @@ public: void Render(int argument) override; bool Slot14() override; - void Slot15(int first, int second) override; + void Slot15(int state, int resetPosition) override; + void Slot43(int first, int second) override; void Slot19( int first, int second, int third, int fourth, int fifth, int sixth, int seventh, int eighth, int ninth, int tenth, int eleventh ) override; @@ -103,7 +104,6 @@ public: void RenderOverlaySprite(const float* matrix, int); void UpdateGaugeWindow(); void DrawLayers(const float* matrix, int unknown0030, char unknown0034); - void ChangeState(int state, int resetPosition); float* GetExtent(float* extent) const override; @@ -218,7 +218,7 @@ public: float AdjustFollowDistance(CGameActor* target, float distance); void UpdatePendingAction(); void Initialize(); - void ChangeState(int state, int resetPosition); + void Slot15(int state, int resetPosition) override; /* 0510 */ int unknown_0510; /* 0514 */ int unknown_0514; diff --git a/Source/Contents/Actors/Player.cpp b/Source/Contents/Actors/Player.cpp index 94ae2ec85..5fa885eac 100644 --- a/Source/Contents/Actors/Player.cpp +++ b/Source/Contents/Actors/Player.cpp @@ -764,7 +764,7 @@ void CPc::LoadEquipSprites(const std::vector& names) { // OFFSET: 0x00DB23A0 // FUNCTION: fn_22643 -void CPc::Slot15(int first, int second) { +void CPc::Slot43(int first, int second) { if (this->unknown_049C == first) { return; } @@ -2375,7 +2375,7 @@ void CPc::UpdateGaugeWindow() { // OFFSET: 0x00DB1760 // FUNCTION: fn_22635 -void CPc::Slot20(int first, int second, int third, int fourth, int fifth, int sixth, int seventh, int eighth, int ninth, int tenth, int eleventh) { +void CPc::Slot19(int first, int second, int third, int fourth, int fifth, int sixth, int seventh, int eighth, int ninth, int tenth, int eleventh) { this->unknown_04D4 = first; this->SetUnknown0260(second); this->unknown_0440 = third; @@ -2421,7 +2421,7 @@ void CPc::Slot20(int first, int second, int third, int fourth, int fifth, int si // OFFSET: 0x00DB0CE0 // FUNCTION: fn_22633 -void CPc::Slot19(int first, int second, int third, int fourth, int fifth, int sixth, int seventh, int eighth, int ninth, int tenth, int eleventh) { +void CPc::Slot20(int first, int second, int third, int fourth, int fifth, int sixth, int seventh, int eighth, int ninth, int tenth, int eleventh) { this->unknown_04D4 = first; this->SetUnknown0260(second); this->unknown_0440 = third; @@ -4348,7 +4348,7 @@ void CPlayer::Initialize() { // OFFSET: 0x00DB4290 // FUNCTION: fn_22651 -void CPc::ChangeState(int state, int resetPosition) { +void CPc::Slot15(int state, int resetPosition) { int current = this->render.unknown_0070; if (current == 3 || this->unknown_017C != 0) { return; @@ -5574,7 +5574,7 @@ bool CPc::Slot14() { // OFFSET: 0x00DBA5D0 // FUNCTION: fn_22673 -void CPlayer::ChangeState(int state, int resetPosition) { +void CPlayer::Slot15(int state, int resetPosition) { if (this->render.unknown_0070 == 3) { return; } @@ -5600,5 +5600,5 @@ void CPlayer::ChangeState(int state, int resetPosition) { g_screenShakeDuration = 0; } - CPc::ChangeState(state, resetPosition); + CPc::Slot15(state, resetPosition); } diff --git a/Source/Contents/Actors/RenderObject.cpp b/Source/Contents/Actors/RenderObject.cpp index e74fc58f8..be189fd4e 100644 --- a/Source/Contents/Actors/RenderObject.cpp +++ b/Source/Contents/Actors/RenderObject.cpp @@ -3448,7 +3448,7 @@ C3dGrannyGameActor::C3dGrannyGameActor(const char* name) { // OFFSET: 0x00CC7ED0 // FUNCTION: fn_21189 -void C3dGrannyGameActor::SetModel(int job, int value, int) { +void C3dGrannyGameActor::Slot18(int job, int value, int) { this->SetActorJob(job); this->SetUnknown0260(value); this->model = static_cast(ResourceMgr::Instance().Load(this->name)); @@ -4606,7 +4606,7 @@ void CGameActor::NotifyCellMove(const float* x, const float* z) { // OFFSET: 0x00CC5750 // FUNCTION: fn_21177 -void C3dGrannyGameActor::SpawnCorpseActor() { +void C3dGrannyGameActor::Slot38() { static_cast(g_modeMgr.GetGameMode())->SpawnGrannyCorpse( this->render.position.x, this->render.position.y, this->render.position.z, this->angle, this->name ); diff --git a/Source/Contents/Actors/RenderObject.h b/Source/Contents/Actors/RenderObject.h index d2e9d37fa..107b6d390 100644 --- a/Source/Contents/Actors/RenderObject.h +++ b/Source/Contents/Actors/RenderObject.h @@ -52,6 +52,10 @@ public: const std::uint32_t* palette, const SpriteRleImage* image, int blend, short hover ); virtual void Slot12(SpriteQuad* quad, const int* box, float shiftX, int first, int second); + // INLINED + virtual std::uint32_t Slot13() { + return 0; + } static float __stdcall Heading(float x, float z, float targetX, float targetZ); void Face(float x, float z); float CalcDist(float x, float z) const; diff --git a/Source/Contents/ClientState.cpp b/Source/Contents/ClientState.cpp index 67b599cb5..eff39091b 100644 --- a/Source/Contents/ClientState.cpp +++ b/Source/Contents/ClientState.cpp @@ -1337,7 +1337,7 @@ std::uint32_t CSession::ReadReplayCharacter(const std::vector& da offset += header.bytes; break; case 1059: - std::memcpy(&this->unknown_0E9C[0x34], data.data() + offset, header.bytes); + std::memcpy(&this->unknown_0EA0[0x30], data.data() + offset, header.bytes); offset += header.bytes; break; case 1060: diff --git a/Source/Contents/EffectResourceSwitcher.cpp b/Source/Contents/EffectResourceSwitcher.cpp index 9ab7749dd..a66c4c0be 100644 --- a/Source/Contents/EffectResourceSwitcher.cpp +++ b/Source/Contents/EffectResourceSwitcher.cpp @@ -116,7 +116,7 @@ void EffectResourceSwitcher::SetNames(const std::string& source, const std::stri } EffectLists* effects = g_effectMgr; - this->effect = static_cast( + this->effect = static_cast( effects->Spawn(actor->render.accountId, CEZ2STREffectMgr::GetInstance()->EffectId(this->sourceName), 0.0f, 0.0f, 0.0f, 0, -1, 0, 0)); this->spawnPosition = actor->render.position; } @@ -152,10 +152,10 @@ void EffectResourceSwitcher::Slot03() { return; } - CEZ2STREffect* previous = this->effect; + CEZ2STREffectEx* previous = this->effect; this->sourceName = this->targetName; this->targetName = ""; - this->effect = static_cast(g_effectMgr->Spawn(0, CEZ2STREffectMgr::GetInstance()->EffectId(this->sourceName), this->spawnPosition.x, + this->effect = static_cast(g_effectMgr->Spawn(0, CEZ2STREffectMgr::GetInstance()->EffectId(this->sourceName), this->spawnPosition.x, this->spawnPosition.y, this->spawnPosition.z, 0, -1, 0, 0)); this->active = 0; if (previous) { @@ -264,7 +264,7 @@ CEZ2STREffectMgr* Singleton::GetInstance() { // OFFSET: 0x006FFA00 // FUNCTION: fn_06967 -__declspec(noinline) bool CEZ2STREffect::IsFinished() { +__declspec(noinline) bool CEZ2STREffectEx::IsFinished() { if (!this->emitter) { return false; } @@ -274,7 +274,7 @@ __declspec(noinline) bool CEZ2STREffect::IsFinished() { // OFFSET: 0x006FFA20 // FUNCTION: fn_06968 -void CEZ2STREffect::Slot01() { +void CEZ2STREffectEx::Slot01() { EZ2STREffectInfo* info = CEZ2STREffectMgr::GetInstance()->FindById(this->id); if (!info) { return; @@ -323,7 +323,7 @@ void CEZ2STREffect::Slot01() { // OFFSET: 0x006FFBF0 // FUNCTION: fn_06969 -bool CEZ2STREffect::Slot06() { +bool CEZ2STREffectEx::Slot06() { EZ2STREmitter* emitter = this->emitter; if (!emitter) { return false; @@ -346,7 +346,7 @@ bool CEZ2STREffect::Slot06() { // OFFSET: 0x006FFC60 // FUNCTION: fn_06970 -void CEZ2STREffect::Slot03() { +void CEZ2STREffectEx::Slot03() { if (!this->emitter) { return; } @@ -386,7 +386,7 @@ void CEZ2STREffect::Slot03() { // OFFSET: 0x006FFEA0 // FUNCTION: fn_06971 -void CEZ2STREffect::Slot04() { +void CEZ2STREffectEx::Slot04() { if (!this->emitter) { return; } @@ -400,7 +400,7 @@ void CEZ2STREffect::Slot04() { // OFFSET: 0x006FFEF0 // FUNCTION: fn_06972 -void CEZ2STREffect::Slot23(float argument) { +void CEZ2STREffectEx::Slot23(float argument) { if (this->emitter) { this->emitter->remainingTime = argument; } @@ -408,7 +408,7 @@ void CEZ2STREffect::Slot23(float argument) { // OFFSET: 0x006FFF10 // FUNCTION: fn_06973 -void CEZ2STREffect::Slot26(int argument) { +void CEZ2STREffectEx::Slot26(int argument) { if (this->emitter) { this->emitter->unknown_3FE8 = static_cast(argument); } @@ -416,7 +416,7 @@ void CEZ2STREffect::Slot26(int argument) { // OFFSET: 0x006FFF30 // FUNCTION: fn_06974 -void CEZ2STREffect::Slot27(int argument) { +void CEZ2STREffectEx::Slot27(int argument) { if (this->emitter) { this->emitter->unknown_3FE9 = static_cast(argument); } @@ -424,7 +424,7 @@ void CEZ2STREffect::Slot27(int argument) { // OFFSET: 0x006FFF50 // FUNCTION: fn_06975 -__declspec(noinline) void CEZ2STREffect::EndLoop(unsigned char fadeOut) { +__declspec(noinline) void CEZ2STREffectEx::EndLoop(unsigned char fadeOut) { if (this->emitter) { this->emitter->looping = 0; this->emitter->fadeOut = fadeOut; @@ -433,13 +433,13 @@ __declspec(noinline) void CEZ2STREffect::EndLoop(unsigned char fadeOut) { // OFFSET: 0x006FFF80 // FUNCTION: fn_06976 -void CEZ2STREffect::Slot32() { +void CEZ2STREffectEx::Slot32() { this->alternateRender = 1; } // OFFSET: 0x006FFF90 // FUNCTION: fn_06977 -void CEZ2STREffect::Slot14(int argument) { +void CEZ2STREffectEx::Slot14(int argument) { if (this->emitter) { this->emitter->unknown_3F98 = argument; } @@ -447,7 +447,7 @@ void CEZ2STREffect::Slot14(int argument) { // OFFSET: 0x006FFFB0 // FUNCTION: fn_06978 -void CEZ2STREffect::Slot17(float argument) { +void CEZ2STREffectEx::Slot17(float argument) { if (this->emitter) { this->emitter->unknown_3FA4 = argument; } @@ -455,7 +455,7 @@ void CEZ2STREffect::Slot17(float argument) { // OFFSET: 0x006FFFD0 // FUNCTION: fn_06979 -void CEZ2STREffect::Slot18(float argument) { +void CEZ2STREffectEx::Slot18(float argument) { if (this->emitter) { this->emitter->unknown_3FA8 = argument; } @@ -463,7 +463,7 @@ void CEZ2STREffect::Slot18(float argument) { // OFFSET: 0x006FFFF0 // FUNCTION: fn_06980 -void CEZ2STREffect::Slot19(float argument) { +void CEZ2STREffectEx::Slot19(float argument) { if (this->emitter) { this->emitter->unknown_3FAC = argument; } @@ -471,7 +471,7 @@ void CEZ2STREffect::Slot19(float argument) { // OFFSET: 0x00700010 // FUNCTION: fn_06981 -void CEZ2STREffect::Slot22(float argument) { +void CEZ2STREffectEx::Slot22(float argument) { if (this->emitter) { this->emitter->unknown_3FB0 = argument; } @@ -479,7 +479,7 @@ void CEZ2STREffect::Slot22(float argument) { // OFFSET: 0x00700030 // FUNCTION: fn_06982 -void CEZ2STREffect::Slot16(int argument) { +void CEZ2STREffectEx::Slot16(int argument) { if (this->emitter) { this->emitter->duration = argument; } diff --git a/Source/Contents/EffectResourceSwitcher.h b/Source/Contents/EffectResourceSwitcher.h index dd3c43a5a..c2413c85a 100644 --- a/Source/Contents/EffectResourceSwitcher.h +++ b/Source/Contents/EffectResourceSwitcher.h @@ -1,6 +1,7 @@ #ifndef RAGNAROK_SOURCE_CONTENTS_EFFECTRESOURCESWITCHER_H #define RAGNAROK_SOURCE_CONTENTS_EFFECTRESOURCESWITCHER_H +#include "Contents/Effects/EZ2STREffectEx.h" #include "Contents/Effects/Effect.h" #include "Contents/Effects/EffectEmitter.h" #include "Utility/Math/Vector3d.h" @@ -51,38 +52,11 @@ public: bool Load(); }; -class CEZ2STREffect : public CEffect { -public: - /* 00CC */ EZ2STREmitter* emitter; - /* 00D0 */ unsigned char timed; - /* 00D1 */ unsigned char unknown_00D1[3]; - /* 00D4 */ int frameStep; - /* 00D8 */ unsigned char alternateRender; - - void Slot01() override; - void Slot03() override; - void Slot04() override; - bool Slot06() override; - void Slot14(int argument) override; - void Slot16(int argument) override; - void Slot17(float argument) override; - void Slot18(float argument) override; - void Slot19(float argument) override; - void Slot22(float argument) override; - void Slot23(float argument) override; - void Slot26(int argument) override; - void Slot27(int argument) override; - void Slot32() override; - - bool IsFinished(); - void EndLoop(unsigned char fadeOut); -}; - class EffectResourceSwitcher : public CEffect { public: /* 00CC */ unsigned char active; /* 00CD */ unsigned char unknown_00CD[3]; - /* 00D0 */ CEZ2STREffect* effect; + /* 00D0 */ CEZ2STREffectEx* effect; /* 00D4 */ vector3d spawnPosition; /* 00E0 */ std::string sourceName; /* 00F8 */ std::string targetName; @@ -114,7 +88,6 @@ static_assert(offsetof(EZ2STREmitter, looping) == 0x3F5C); static_assert(offsetof(EZ2STREmitter, unknown_3F98) == 0x3F98); static_assert(offsetof(EZ2STREmitter, remainingTime) == 0x3FB4); static_assert(offsetof(EZ2STREmitter, unknown_3FE9) == 0x3FE9); -static_assert(offsetof(CEZ2STREffect, alternateRender) == 0xD8); static_assert(offsetof(EffectResourceSwitcher, effect) == 0xD0); static_assert(offsetof(EffectResourceSwitcher, targetName) == 0xF8); static_assert(sizeof(EffectResourceSwitcher) == 0x110); diff --git a/Source/Contents/Effects/CartCannon.cpp b/Source/Contents/Effects/CartCannon.cpp index 9e4d11844..48a39c52f 100644 --- a/Source/Contents/Effects/CartCannon.cpp +++ b/Source/Contents/Effects/CartCannon.cpp @@ -150,6 +150,6 @@ void CCartCannon::Slot04() { // OFFSET: 0x006FB0E0 // FUNCTION: fn_06901 -void CCartCannon::SetDelay(int delay) { +void CCartCannon::Slot16(int delay) { this->delay = delay; } diff --git a/Source/Contents/Effects/CartCannon.h b/Source/Contents/Effects/CartCannon.h index f26fa648a..e4ae84099 100644 --- a/Source/Contents/Effects/CartCannon.h +++ b/Source/Contents/Effects/CartCannon.h @@ -17,7 +17,7 @@ public: void Close() override; bool Slot06() override; - void SetDelay(int delay); + void Slot16(int delay) override; /* 00CC */ CEZ2STRParticle* particle; /* 00D0 */ int currentStep; diff --git a/Source/Contents/Effects/EZ2STREffectEx.cpp b/Source/Contents/Effects/EZ2STREffectEx.cpp index 276d4e60e..9e495458a 100644 --- a/Source/Contents/Effects/EZ2STREffectEx.cpp +++ b/Source/Contents/Effects/EZ2STREffectEx.cpp @@ -8,22 +8,22 @@ // OFFSET: 0x006FF480 // FUNCTION: fn_06962 -CEZ2STREffectEx::CEZ2STREffectEx() : CEffect(-1), particle(nullptr), finished(0), unknown_00D4(0), unknown_00D8(0) { +CEZ2STREffectEx::CEZ2STREffectEx() : CEffect(-1), emitter(nullptr), timed(0), frameStep(0), alternateRender(0) { } // OFFSET: 0x006FF740 // FUNCTION: fn_06964 void CEZ2STREffectEx::Close() { - if (this->particle) { - FreeParticle(this->particle); - this->particle = nullptr; + if (this->emitter) { + FreeParticle(reinterpret_cast(this->emitter)); + this->emitter = nullptr; } } // OFFSET: 0x006FF770 // FUNCTION: fn_06965 void CEZ2STREffectEx::Slot31() { - this->finished = 1; + this->timed = 1; } // OFFSET: 0x006FF780 diff --git a/Source/Contents/Effects/EZ2STREffectEx.h b/Source/Contents/Effects/EZ2STREffectEx.h index 5fbeb13ad..eb3796765 100644 --- a/Source/Contents/Effects/EZ2STREffectEx.h +++ b/Source/Contents/Effects/EZ2STREffectEx.h @@ -5,25 +5,43 @@ #include -class CParticle; +struct EZ2STREmitter; class CEZ2STREffectEx : public CEffect { public: CEZ2STREffectEx(); + void Slot01() override; + void Slot03() override; + void Slot04() override; void Close() override; + bool Slot06() override; + void Slot14(int argument) override; + void Slot16(int argument) override; + void Slot17(float argument) override; + void Slot18(float argument) override; + void Slot19(float argument) override; + void Slot22(float argument) override; + void Slot23(float argument) override; + void Slot26(int argument) override; + void Slot27(int argument) override; void Slot31() override; + void Slot32() override; - /* 00CC */ CParticle* particle; - /* 00D0 */ unsigned char finished; - /* 00D4 */ int unknown_00D4; - /* 00D8 */ unsigned char unknown_00D8; + bool IsFinished(); + void EndLoop(unsigned char fadeOut); + + /* 00CC */ EZ2STREmitter* emitter; + /* 00D0 */ unsigned char timed; + /* 00D1 */ unsigned char unknown_00D1[3]; + /* 00D4 */ int frameStep; + /* 00D8 */ unsigned char alternateRender; }; float ScreenAngle(const float* from, const float* to, const float* matrix); #if defined(_WIN32) && !defined(_WIN64) -static_assert(offsetof(CEZ2STREffectEx, particle) == 0xCC); -static_assert(offsetof(CEZ2STREffectEx, unknown_00D8) == 0xD8); +static_assert(offsetof(CEZ2STREffectEx, emitter) == 0xCC); +static_assert(offsetof(CEZ2STREffectEx, alternateRender) == 0xD8); #endif #endif diff --git a/Source/Contents/Effects/EffectActor.cpp b/Source/Contents/Effects/EffectActor.cpp index d8ad3aa99..142420245 100644 --- a/Source/Contents/Effects/EffectActor.cpp +++ b/Source/Contents/Effects/EffectActor.cpp @@ -15,13 +15,9 @@ EffectActor::EffectActor() { this->render.unknown_0130[0] = 0; } -struct CAbleToMakeEffect : EffectActor { - ~CAbleToMakeEffect() override; -}; - // OFFSET: 0x00CA8C40 // FUNCTION: fn_20993 -CAbleToMakeEffect::~CAbleToMakeEffect() { +EffectActor::~EffectActor() { if (!this->state.effects.empty()) { for (std::list::iterator it = this->state.effects.begin(); it != this->state.effects.end(); ++it) { if (*it) { diff --git a/Source/Contents/Effects/EffectActor.h b/Source/Contents/Effects/EffectActor.h index 7147fb6eb..893351c1d 100644 --- a/Source/Contents/Effects/EffectActor.h +++ b/Source/Contents/Effects/EffectActor.h @@ -24,6 +24,7 @@ struct EffectActorState { struct EffectActor : CRenderObject { EffectActor(); + ~EffectActor() override; void SendMsg(CGameObject* sender, int message, int a, int b, int c, int d, int e, int f, int g, int h, int i, int j, int k, int l, int m) override; bool EffectVisible() const; bool HasId(int id) const; diff --git a/Source/Contents/Effects/MonsterSkillEffects.h b/Source/Contents/Effects/MonsterSkillEffects.h index 58a0433bb..7f48b77bb 100644 --- a/Source/Contents/Effects/MonsterSkillEffects.h +++ b/Source/Contents/Effects/MonsterSkillEffects.h @@ -328,6 +328,10 @@ public: void Slot03() override; void Slot04() override; void Close() override; + // INLINED + bool Slot06() override { + return this->active; + } /* 00CC */ bool active; /* 00CD */ unsigned char unknown_00CD[3]; diff --git a/Source/Contents/Effects/PartyMemberEffects.cpp b/Source/Contents/Effects/PartyMemberEffects.cpp index 2c93f12c1..e6f2f7fec 100644 --- a/Source/Contents/Effects/PartyMemberEffects.cpp +++ b/Source/Contents/Effects/PartyMemberEffects.cpp @@ -57,7 +57,7 @@ int CRollingCutterRagEffect::GetDuration() { // OFFSET: 0x00612010 // FUNCTION: fn_04339 -int CRagEffect::Slot13() { +std::uint32_t CRagEffect::Slot13() { return 0; } diff --git a/Source/Contents/Effects/RagEffect.h b/Source/Contents/Effects/RagEffect.h index 5949271a1..14310e3e7 100644 --- a/Source/Contents/Effects/RagEffect.h +++ b/Source/Contents/Effects/RagEffect.h @@ -346,7 +346,7 @@ struct CRagEffect : CRenderObject { void TorchDust(char kind); void Render(int argument) override; - virtual int Slot13(); + std::uint32_t Slot13() override; virtual bool Slot14(); virtual bool Slot15(); virtual void SendMsg(CGameObject* sender, int message, int first, std::int64_t second, int third, int fourth, int fifth, int sixth); diff --git a/Source/Contents/Effects/RectUpEffect.cpp b/Source/Contents/Effects/RectUpEffect.cpp index c73291e4a..ace2111b1 100644 --- a/Source/Contents/Effects/RectUpEffect.cpp +++ b/Source/Contents/Effects/RectUpEffect.cpp @@ -131,7 +131,7 @@ void CRectUpEffect::Close() { // OFFSET: 0x0070A260 // FUNCTION: fn_07099 -void CRectUpEffect::Slot02() { +void CRectUpEffect::Slot01() { if (this->id != 1088) { return; } diff --git a/Source/Contents/Effects/RectUpEffect.h b/Source/Contents/Effects/RectUpEffect.h index 618cfacb4..05ec53ef8 100644 --- a/Source/Contents/Effects/RectUpEffect.h +++ b/Source/Contents/Effects/RectUpEffect.h @@ -13,7 +13,7 @@ class CRectUpEffect : public CEffect { public: CRectUpEffect(); - void Slot02() override; + void Slot01() override; void Slot03() override; void Slot04() override; void Close() override; diff --git a/Source/Contents/Ground/GroundGeometry.cpp b/Source/Contents/Ground/GroundGeometry.cpp index 0f9444a4a..4a07de931 100644 --- a/Source/Contents/Ground/GroundGeometry.cpp +++ b/Source/Contents/Ground/GroundGeometry.cpp @@ -368,6 +368,11 @@ bool GroundGeometry::Ground15Slot10() { return true; } +// OFFSET: 0x00AC3080 +// FUNCTION: fn_17598 +void GroundGeometry::Ground15Slot15(float, int, int) { +} + // OFFSET: 0x00AC1530 // FUNCTION: fn_17584 bool GroundGeometry::Slot10() { diff --git a/Source/Contents/Ground/GroundGeometry.h b/Source/Contents/Ground/GroundGeometry.h index bbe78a89e..35ef06c88 100644 --- a/Source/Contents/Ground/GroundGeometry.h +++ b/Source/Contents/Ground/GroundGeometry.h @@ -59,6 +59,7 @@ public: void Slot09(int first, int second, int third, int fourth); bool Slot10(); bool Ground15Slot10(); + void Ground15Slot15(float alpha, int x, int y); void Slot11(); int Slot12(int first, int second, int third, int fourth, int fifth) const; void Slot14(int first, int second, int third, int fourth); diff --git a/Source/Contents/Messenger/ClientMessenger.cpp b/Source/Contents/Messenger/ClientMessenger.cpp index c54cf67d6..4ad6b2bd1 100644 --- a/Source/Contents/Messenger/ClientMessenger.cpp +++ b/Source/Contents/Messenger/ClientMessenger.cpp @@ -2195,7 +2195,7 @@ void EquipmentProperties::CEquipmentPropertiesMgr::LoadEnumVar() { if (state == nullptr) { return; } - const char* name = "EnumVar"; + const char* name = "EnumVAR"; lua_getfield(state, LUA_GLOBALSINDEX, name); if (lua_type(state, -1) == LUA_TTABLE) { lua_pushnil(state); diff --git a/Source/Contents/Messenger/MessengerMember.cpp b/Source/Contents/Messenger/MessengerMember.cpp index a16e08e0c..c8c5278ed 100644 --- a/Source/Contents/Messenger/MessengerMember.cpp +++ b/Source/Contents/Messenger/MessengerMember.cpp @@ -1103,7 +1103,7 @@ void UIMessengerGroupWnd::Slot26(int, int) { // OFFSET: 0x0073D460 // FUNCTION: fn_07713 -void UIMessengerGroupWnd::Slot25(int x, int y) { +void UIMessengerGroupWnd::Slot33(int x, int y) { if (g_session.m_lockMouse) { return; } @@ -1121,7 +1121,7 @@ void UIMessengerGroupWnd::Slot25(int x, int y) { // OFFSET: 0x0073CD60 // FUNCTION: fn_07709 -void UIMessengerGroupWnd::Slot33(int x, int y) { +void UIMessengerGroupWnd::Slot25(int x, int y) { if (y < 17) { UIFrameWnd::Slot33(x, y); if (UIWindow* window = this->CompanionWindow()) { diff --git a/Source/Contents/SignBoard/SignBoard.cpp b/Source/Contents/SignBoard/SignBoard.cpp index ec4a098a0..879a17a7a 100644 --- a/Source/Contents/SignBoard/SignBoard.cpp +++ b/Source/Contents/SignBoard/SignBoard.cpp @@ -270,15 +270,15 @@ void CSignBoardWnd::Slot15(int width, int height) { // OFFSET: 0x00821C50 // FUNCTION: fn_10265 void CBmpObjWnd::Paint() { - this->DrawBitmap(0, 0, reinterpret_cast(ResourceMgr::Instance().Load(Resolve(this->path.c_str()))), false); + this->DrawBitmap(0, 0, static_cast(ResourceMgr::Instance().Load(Resolve(this->path.c_str()))), false); } // OFFSET: 0x00821C90 // FUNCTION: fn_10266 void CSignBoardWnd::Paint() { this->ClearSurface(0xFFFF00FF); - this->DrawBitmap(0, 0, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\signboard\\bg_signboard.bmp"))), false); - this->DrawBitmap(5, 5, reinterpret_cast(ResourceMgr::Instance().Load(Resolve(this->iconPath.c_str()))), true); + this->DrawBitmap(0, 0, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\signboard\\bg_signboard.bmp"))), false); + this->DrawBitmap(5, 5, static_cast(ResourceMgr::Instance().Load(Resolve(this->iconPath.c_str()))), true); } // OFFSET: 0x00821D10 diff --git a/Source/Contents/Sound/SoundMaker.cpp b/Source/Contents/Sound/SoundMaker.cpp index 6818bc608..a7824d573 100644 --- a/Source/Contents/Sound/SoundMaker.cpp +++ b/Source/Contents/Sound/SoundMaker.cpp @@ -7,6 +7,7 @@ #include "Contents/Actors/Npc.h" #include "Contents/Actors/Pc.h" #include "Contents/Effects/MsgEffect.h" +#include "Contents/Ground/GroundGeometry.h" #include "Contents/MessageTable.h" #include "Contents/MapSkyMgr.h" #include "Contents/Sound/SoundMgr.h" @@ -509,9 +510,7 @@ bool CGndRiser::OnProcess() { alpha = -(frame * frame) / 25.0f; } - using GroundSlot15 = void(__thiscall*)(GroundGeometry*, float, int, int); - GroundGeometry* ground = mode->scene->ground; - reinterpret_cast((*reinterpret_cast(ground))[15])(ground, alpha, this->screenX, this->screenY); + mode->scene->ground->Ground15Slot15(alpha, this->screenX, this->screenY); } return true; diff --git a/Source/Contents/World/WorldModelLoading.cpp b/Source/Contents/World/WorldModelLoading.cpp index 40e27fcc4..48aa9affa 100644 --- a/Source/Contents/World/WorldModelLoading.cpp +++ b/Source/Contents/World/WorldModelLoading.cpp @@ -205,13 +205,9 @@ void CWorld::InitWorld() { } this->ground = new GroundGeometry(); - void** groundVtbl = *reinterpret_cast(this->ground); - reinterpret_cast(groundVtbl[2])( - this->ground, groundRes, g_worldLightDirection, g_worldDiffuse, g_worldAmbient - ); - *reinterpret_cast(reinterpret_cast(this->ground) + 4) = this->terrain; + this->ground->Build(*groundRes, g_worldLightDirection, g_worldDiffuse, g_worldAmbient); - reinterpret_cast(this->ground)->Set( + this->ground->water.Set( worldRes->waterLevel, worldRes->waterType, worldRes->waterAnimation, @@ -220,7 +216,7 @@ void CWorld::InitWorld() { worldRes->waveHeight ); - reinterpret_cast(groundVtbl[13])(this->ground, groundRes); + this->ground->water.Import(*groundRes); ResourceMgr::Instance().Remove(groundRes); @@ -274,7 +270,7 @@ void CWorld::InitWorld() { this->InitializeSpatial(); this->LoadMapEffects(); - reinterpret_cast(groundVtbl[11])(this->ground); + this->ground->InitializeLighting(*this->terrain); this->published = static_cast(this->models.size()); diff --git a/Source/Contents/World/WorldModelView.cpp b/Source/Contents/World/WorldModelView.cpp index 6ec43c865..ff49db9f9 100644 --- a/Source/Contents/World/WorldModelView.cpp +++ b/Source/Contents/World/WorldModelView.cpp @@ -194,9 +194,7 @@ void CView::Render() { model->renderFrame = g_renderer->frame; } - void** groundVtable = *reinterpret_cast((*node)->ground); - reinterpret_cast(groundVtable[6])( - (*node)->ground, matrix, (*node)->groundCells, true); + (*node)->ground->DrawLit(matrix, (*node)->groundCells, true); if (g_visibleMinX > (*node)->groundCells[0]) { g_visibleMinX = (*node)->groundCells[0]; @@ -229,9 +227,7 @@ void CView::Render() { } } - void** groundVtable = *reinterpret_cast((*node)->ground); - reinterpret_cast(groundVtable[6])( - (*node)->ground, matrix, (*node)->groundCells, false); + (*node)->ground->DrawLit(matrix, (*node)->groundCells, false); if (g_visibleMinY > (*node)->groundCells[1]) { g_visibleMinY = (*node)->groundCells[1]; @@ -252,15 +248,12 @@ void CView::Render() { g_navigationManager.DrawRoute(matrix); - void** sceneGroundVtable = *reinterpret_cast(this->scene->ground); if (g_groundOverlaySkip == 0) { - reinterpret_cast(sceneGroundVtable[14])( - this->scene->ground, matrix, g_groundOverlayA, g_groundOverlayB, g_groundOverlayC); + this->scene->ground->DrawGrid(*this->scene->terrain, matrix, g_groundOverlayA, g_groundOverlayB, g_groundOverlayC); } if (g_session.unknown_5614 != 0 && g_session.unknown_5600 != 0 && g_session.unknown_5604 != 0) { - reinterpret_cast(sceneGroundVtable[14])( - this->scene->ground, matrix, g_session.unknown_5600, g_session.unknown_5604, 0xfeff0000); + this->scene->ground->DrawGrid(*this->scene->terrain, matrix, g_session.unknown_5600, g_session.unknown_5604, 0xfeff0000); } for (auto it = this->scene->objects.begin(); it != this->scene->objects.end(); ++it) { @@ -283,5 +276,5 @@ void CView::Render() { this->spatial.inside.clear(); this->spatial.clipped.clear(); - reinterpret_cast(sceneGroundVtable[4])(this->scene->ground, matrix); + this->scene->ground->Ground15Slot04(reinterpret_cast(matrix)); } diff --git a/Source/Contents/World/WorldObjects.cpp b/Source/Contents/World/WorldObjects.cpp index 9410272a3..dbfa1d421 100644 --- a/Source/Contents/World/WorldObjects.cpp +++ b/Source/Contents/World/WorldObjects.cpp @@ -579,10 +579,12 @@ CMsgEffect* CGameMode::SpawnCashEmotion(int aid, int packId, int emotionId, std: CMsgEffect* effect = nullptr; if (data) { - std::string sprite; - std::string pack; - sprite = g_cashEmotionMgr->GetSprFileName(data->actId); - pack = g_cashEmotionMgr->GetPackName(data->sprId); + struct { + std::string sprite; + std::string action; + } names; + names.sprite = g_cashEmotionMgr->GetSprFileName(data->actId); + names.action = g_cashEmotionMgr->GetPackName(data->sprId); effect = new (std::nothrow) CMsgEffect; if (effect) { @@ -591,7 +593,7 @@ CMsgEffect* CGameMode::SpawnCashEmotion(int aid, int packId, int emotionId, std: } effect->SendMsg(nullptr, 22, 0, duration, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0); - effect->SendMsg(nullptr, 14, 0, aid, aid >> 31, reinterpret_cast(&sprite), reinterpret_cast(&sprite) >> 31, data->unknown_0020, + effect->SendMsg(nullptr, 14, 0, aid, aid >> 31, reinterpret_cast(&names), reinterpret_cast(&names) >> 31, data->unknown_0020, data->unknown_0020 >> 31, 0, 0, 0, 0, 0, 0); } } diff --git a/Source/Contents/World/WorldTerrainPicking.cpp b/Source/Contents/World/WorldTerrainPicking.cpp index 78516cb3a..c74ed62c6 100644 --- a/Source/Contents/World/WorldTerrainPicking.cpp +++ b/Source/Contents/World/WorldTerrainPicking.cpp @@ -1,3 +1,4 @@ +#include "Client/Input/Mouse.h" #include "Client/Mode/CGameMode.h" #include "Contents/Camera/Camera.h" #include "Contents/World/World.h" @@ -13,7 +14,7 @@ bool CGameMode::PickScreenTerrain(int& column, int& row) { WorldRayQuery query; float ray[6]{}; - g_renderer->viewport.Ray(g_screenWidth, g_screenHeight, this->camera->frame.eye, this->camera->frame.inverse.values, ray); + g_renderer->viewport.Ray(g_mouse.x, g_mouse.y, this->camera->frame.eye, this->camera->frame.inverse.values, ray); query.Collect(ray, &this->scene->spatial); float nearest = 999999.0f; float result = nearest; diff --git a/Source/Network/Connection/Connection.h b/Source/Network/Connection/Connection.h index a98376a7f..c4e8e8b74 100644 --- a/Source/Network/Connection/Connection.h +++ b/Source/Network/Connection/Connection.h @@ -3,6 +3,7 @@ #include "Network/Connection/PacketQueue.h" +#include #include class PacketLengths; @@ -69,6 +70,8 @@ private: CRagConnection& GetRagConnection(); #if defined(_WIN32) && !defined(_WIN64) +static_assert(offsetof(ConnectionEndpoint, port) == 0x10); +static_assert(offsetof(ConnectionEndpoint, overrideAddress) == 0x14); static_assert(sizeof(CConnection) == 0x6C); static_assert(sizeof(CRagConnection) == 0x70); #endif diff --git a/Source/Render/DX9/GroundQueuesDX9.cpp b/Source/Render/DX9/GroundQueuesDX9.cpp index 35709eea5..53668d64e 100644 --- a/Source/Render/DX9/GroundQueuesDX9.cpp +++ b/Source/Render/DX9/GroundQueuesDX9.cpp @@ -33,7 +33,7 @@ void CRendererDX9::DrawBaseQueue() { // FUNCTION: fn_02226 void CRendererDX9::DrawGroundQueues(RenderQueues& queues) { ScopedDeviceStateDX9 restore(this->device->state); - this->device->state.SetRenderState(D3DRS_COLORWRITEENABLE, 0xFFFFFFFFu); + this->device->state.SetRenderState(D3DRS_AMBIENT, 0xFFFFFFFFu); this->device->state.SetRenderState(D3DRS_CULLMODE, D3DCULL_CW); if (g_serviceOptions.Get(119) != 0) { @@ -81,6 +81,6 @@ void CRendererDX9::DrawGroundQueues(RenderQueues& queues) { this->DrawBaseQueue(); } - this->device->state.SetRenderState(D3DRS_COLORWRITEENABLE, 0); + this->device->state.SetRenderState(D3DRS_AMBIENT, 0); this->device->state.SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); } diff --git a/Source/Resource/Audio/WaveResource.cpp b/Source/Resource/Audio/WaveResource.cpp index 4df26c4f4..b04ef45aa 100644 --- a/Source/Resource/Audio/WaveResource.cpp +++ b/Source/Resource/Audio/WaveResource.cpp @@ -86,3 +86,11 @@ void CWave::Unload() { void RegisterWaveResource(ResourceMgr& resourceMgr, CWave& prototype) { resourceMgr.Register("wav", "wav\\", &prototype); } + +// INLINED +CWave::CWave(const char* extension, const char* prefix) { + ResourceMgr::Instance().Register(extension, prefix, this); +} + +// GLOBAL: gl_24585 +CWave g_wavePrototype("wav", "wav\\"); diff --git a/Source/Resource/Audio/WaveResource.h b/Source/Resource/Audio/WaveResource.h index 4aca6abf2..b26816997 100644 --- a/Source/Resource/Audio/WaveResource.h +++ b/Source/Resource/Audio/WaveResource.h @@ -10,6 +10,7 @@ class ResourceMgr; class CWave : public CRes { public: CWave(); + CWave(const char* extension, const char* prefix); ~CWave() override; CWave* Create() override; bool Load(const char* name) override; diff --git a/Source/Resource/Bitmap/BitmapResource.cpp b/Source/Resource/Bitmap/BitmapResource.cpp index 1417a0d98..3791949be 100644 --- a/Source/Resource/Bitmap/BitmapResource.cpp +++ b/Source/Resource/Bitmap/BitmapResource.cpp @@ -2,6 +2,7 @@ #include "File/File.h" #include "Render/DeviceContext/DCSurface.h" #include "Resource/Bitmap/BitmapResource.h" +#include "Resource/ResourceMgr.h" #include #include @@ -66,3 +67,20 @@ bool CBitmapRes::Decode(const char* name, const void* data, int bytes, bool icon ShowErrorDialog("Unsupport fileformat!", 0); return false; } + +// INLINED +CBitmapRes::CBitmapRes(const char* extension, const char* prefix) { + ResourceMgr::Instance().Register(extension, prefix, this); +} + +// GLOBAL: gl_25549 +CBitmapRes g_tgaPrototype("tga", "texture\\"); + +// GLOBAL: gl_25550 +CBitmapRes g_jpgPrototype("jpg", "texture\\"); + +// GLOBAL: gl_25551 +CBitmapRes g_pngPrototype("png", "texture\\"); + +// GLOBAL: gl_25552 +CBitmapRes g_bmpPrototype("bmp", "texture\\"); diff --git a/Source/Resource/Bitmap/BitmapResource.h b/Source/Resource/Bitmap/BitmapResource.h index 6da053f2b..8ba832a69 100644 --- a/Source/Resource/Bitmap/BitmapResource.h +++ b/Source/Resource/Bitmap/BitmapResource.h @@ -20,6 +20,7 @@ protected: class CBitmapRes : public CRes { public: CBitmapRes(); + CBitmapRes(const char* extension, const char* prefix); ~CBitmapRes() override; CBitmapRes* Create() override; bool Load(const char* name) override; diff --git a/Source/Resource/EZeffectResource.cpp b/Source/Resource/EZeffectResource.cpp index 2cf0375c8..7688cb25e 100644 --- a/Source/Resource/EZeffectResource.cpp +++ b/Source/Resource/EZeffectResource.cpp @@ -3,6 +3,7 @@ #include "Render/DeviceContext/DCSurface.h" #include "Resource/EZeffectResource.h" #include "Render/Textures/TextureCache.h" +#include "Resource/ResourceMgr.h" #include #include @@ -141,3 +142,11 @@ CTexture* EZeffectClip::Texture(int index, const char* prefix) { return this->textures[index]; } + +// INLINED +CEZeffectRes::CEZeffectRes(const char* extension, const char* prefix) { + ResourceMgr::Instance().Register(extension, prefix, this); +} + +// GLOBAL: gl_25555 +CEZeffectRes g_strPrototype("str", "texture\\effect\\"); diff --git a/Source/Resource/EZeffectResource.h b/Source/Resource/EZeffectResource.h index e522e88ce..985d10e4e 100644 --- a/Source/Resource/EZeffectResource.h +++ b/Source/Resource/EZeffectResource.h @@ -58,6 +58,7 @@ struct EZeffectClip { class CEZeffectRes : public CRes { public: CEZeffectRes(); + CEZeffectRes(const char* extension, const char* prefix); ~CEZeffectRes() override; CEZeffectRes* Create() override; bool Load(const char* name) override; diff --git a/Source/Resource/EmblemResource.cpp b/Source/Resource/EmblemResource.cpp index 4fbfa07b1..2a2b92f0d 100644 --- a/Source/Resource/EmblemResource.cpp +++ b/Source/Resource/EmblemResource.cpp @@ -2,6 +2,7 @@ #include "Contents/GuildMgr.h" #include "File/File.h" +#include "Resource/ResourceMgr.h" #include #include @@ -70,3 +71,11 @@ void CEmblemRes::MissingFile(CRenderSystemBase*, const char*) { // FUNCTION: fn_07887 CEmblemRes::CEmblemRes() : CRes(), gif() { } + +// INLINED +CEmblemRes::CEmblemRes(const char* extension, const char* prefix) { + ResourceMgr::Instance().Register(extension, prefix, this); +} + +// GLOBAL: gl_25554 +CEmblemRes g_ebmPrototype("ebm", "..\\_tmpEmblem\\"); diff --git a/Source/Resource/EmblemResource.h b/Source/Resource/EmblemResource.h index cd47d3b42..f541fac51 100644 --- a/Source/Resource/EmblemResource.h +++ b/Source/Resource/EmblemResource.h @@ -7,6 +7,7 @@ class CEmblemRes : public CRes { public: CEmblemRes(); + CEmblemRes(const char* extension, const char* prefix); ~CEmblemRes() override; void Slot02() override; bool IsTransient() override; diff --git a/Source/Resource/GifResource.cpp b/Source/Resource/GifResource.cpp index e9e7163a9..10604ed01 100644 --- a/Source/Resource/GifResource.cpp +++ b/Source/Resource/GifResource.cpp @@ -4,6 +4,7 @@ #include "File/File.h" #include "Resource/GifLzw.h" #include "Render/DeviceContext/DCSurface.h" +#include "Resource/ResourceMgr.h" #include #include @@ -390,3 +391,11 @@ bool CGifRes::DecodeGif(const void* data, int bytes, bool iconOnly) { delete[] globalPalette; return false; } + +// INLINED +CGifRes::CGifRes(const char* extension, const char* prefix) { + ResourceMgr::Instance().Register(extension, prefix, this); +} + +// GLOBAL: gl_25553 +CGifRes g_gifPrototype("gif", "texture\\"); diff --git a/Source/Resource/GifResource.h b/Source/Resource/GifResource.h index 8d8707325..a5b9306f8 100644 --- a/Source/Resource/GifResource.h +++ b/Source/Resource/GifResource.h @@ -13,6 +13,7 @@ public: using Frame = std::pair; CGifRes(); + CGifRes(const char* extension, const char* prefix); ~CGifRes() override; void Slot02() override; bool IsTransient() override; diff --git a/Source/Resource/ImfResource.cpp b/Source/Resource/ImfResource.cpp index f92e30616..6eea7c1a5 100644 --- a/Source/Resource/ImfResource.cpp +++ b/Source/Resource/ImfResource.cpp @@ -1,5 +1,6 @@ #include "Resource/ImfResource.h" #include "File/File.h" +#include "Resource/ResourceMgr.h" // INLINED CImfRes::CImfRes() { @@ -71,3 +72,11 @@ bool CImfRes::Load(const char* name) { file.Close(); return true; } + +// INLINED +CImfRes::CImfRes(const char* extension, const char* prefix) { + ResourceMgr::Instance().Register(extension, prefix, this); +} + +// GLOBAL: gl_25557 +CImfRes g_imfPrototype("imf", "imf\\"); diff --git a/Source/Resource/ImfResource.h b/Source/Resource/ImfResource.h index a41c0307a..e71575f23 100644 --- a/Source/Resource/ImfResource.h +++ b/Source/Resource/ImfResource.h @@ -16,6 +16,7 @@ struct ImfData { class CImfRes : public CRes { public: CImfRes(); + CImfRes(const char* extension, const char* prefix); CImfRes* Create() override; bool Load(const char* name) override; diff --git a/Source/Resource/Models/AnimatedModelResource.cpp b/Source/Resource/Models/AnimatedModelResource.cpp index 4246059ab..c06ff3b66 100644 --- a/Source/Resource/Models/AnimatedModelResource.cpp +++ b/Source/Resource/Models/AnimatedModelResource.cpp @@ -7,6 +7,7 @@ #include "Resource/Models/GrannyModelResource.h" #include "Resource/Bitmap/BitmapResource.h" #include "Resource/ResourceByteReader.h" +#include "Resource/ResourceMgr.h" #include #include @@ -266,6 +267,12 @@ C3dGrannyModelRes* C3dGrannyModelRes::Create() { return new C3dGrannyModelRes; } +// OFFSET: 0x00753610 +// FUNCTION: fn_07962 +void C3dGrannyModelRes::Unload() { + this->Release(); +} + // OFFSET: 0x00753620 // FUNCTION: fn_07963 bool C3dGrannyModelRes::Load(const char* name) { @@ -375,3 +382,19 @@ bool C3dGrannyModelRes::Load(const char* name) { file.Close(); return result; } + +// INLINED +C3dAnimModelRes::C3dAnimModelRes(const char* extension, const char* prefix) { + ResourceMgr::Instance().Register(extension, prefix, this); +} + +// GLOBAL: gl_25558 +C3dAnimModelRes g_rsxPrototype("rsx", "model\\"); + +// INLINED +C3dGrannyModelRes::C3dGrannyModelRes(const char* extension, const char* prefix) { + ResourceMgr::Instance().Register(extension, prefix, this); +} + +// GLOBAL: gl_25559 +C3dGrannyModelRes g_gr2Prototype("gr2", "model\\3dmob\\"); diff --git a/Source/Resource/Models/AnimatedModelResource.h b/Source/Resource/Models/AnimatedModelResource.h index eed4355ac..b22310d26 100644 --- a/Source/Resource/Models/AnimatedModelResource.h +++ b/Source/Resource/Models/AnimatedModelResource.h @@ -58,6 +58,7 @@ private: class C3dAnimModelRes : public CRes { public: C3dAnimModelRes(); + C3dAnimModelRes(const char* extension, const char* prefix); ~C3dAnimModelRes() override; C3dAnimModelRes* Create() override; bool Load(const char* name) override; diff --git a/Source/Resource/Models/GrannyModelResource.h b/Source/Resource/Models/GrannyModelResource.h index 620dc6a48..155bc280d 100644 --- a/Source/Resource/Models/GrannyModelResource.h +++ b/Source/Resource/Models/GrannyModelResource.h @@ -221,7 +221,9 @@ struct GrannyHairPivot { class C3dGrannyModelRes : public CRes { public: C3dGrannyModelRes(); + C3dGrannyModelRes(const char* extension, const char* prefix); C3dGrannyModelRes* Create() override; + void Unload() override; bool Load(const char* name) override; void RebindMeshes(const C3dGrannyModelRes& target); void InstantiateModel(GrannyModelInstance* target, const granny_model* model); diff --git a/Source/Resource/Models/ModelResource.cpp b/Source/Resource/Models/ModelResource.cpp index 18c99fd61..5ccc6c197 100644 --- a/Source/Resource/Models/ModelResource.cpp +++ b/Source/Resource/Models/ModelResource.cpp @@ -11,6 +11,7 @@ #include "Resource/Models/GrannyModelResource.h" #include "Resource/Models/ModelResource.h" #include "Utility/Math/AffineMatrix.h" +#include "Resource/ResourceMgr.h" #include #include @@ -1048,3 +1049,11 @@ void C3dGrannyModelRes::Release() { delete this->instance; this->instance = nullptr; } + +// INLINED +C3dModelResV1::C3dModelResV1(const char* extension, const char* prefix) { + ResourceMgr::Instance().Register(extension, prefix, this); +} + +// GLOBAL: gl_25560 +C3dModelResV1 g_rsmPrototype("rsm", "model\\"); diff --git a/Source/Resource/Models/ModelResource.h b/Source/Resource/Models/ModelResource.h index 6b2a589c0..0f7318edc 100644 --- a/Source/Resource/Models/ModelResource.h +++ b/Source/Resource/Models/ModelResource.h @@ -120,6 +120,7 @@ public: class C3dModelResV1 : public C3dModelRes { public: C3dModelResV1(); + C3dModelResV1(const char* extension, const char* prefix); ~C3dModelResV1() override; C3dModelResV1* Create() override; bool Load(const char* name) override; @@ -132,6 +133,7 @@ private: class C3dModelResV2 : public C3dModelRes { public: C3dModelResV2(); + C3dModelResV2(const char* extension, const char* prefix); ~C3dModelResV2() override; C3dModelResV2* Create() override; bool Load(const char* name) override; diff --git a/Source/Resource/Models/ModelResourceV2.cpp b/Source/Resource/Models/ModelResourceV2.cpp index 999deaed2..b122f5a6f 100644 --- a/Source/Resource/Models/ModelResourceV2.cpp +++ b/Source/Resource/Models/ModelResourceV2.cpp @@ -5,6 +5,7 @@ #include "Render/Textures/TextureCache.h" #include "Resource/Bitmap/BitmapResource.h" #include "Resource/Models/ModelResource.h" +#include "Resource/ResourceMgr.h" #include #include @@ -469,3 +470,11 @@ void C3dModelResV2::ReadVersion3(CFile& input) { this->volumes.push_back(volume); } } + +// INLINED +C3dModelResV2::C3dModelResV2(const char* extension, const char* prefix) { + ResourceMgr::Instance().Register(extension, prefix, this); +} + +// GLOBAL: gl_25561 +C3dModelResV2 g_rsm2Prototype("rsm2", "model\\"); diff --git a/Source/Resource/PaletteResource.cpp b/Source/Resource/PaletteResource.cpp index 4bacdc107..23ed97bfc 100644 --- a/Source/Resource/PaletteResource.cpp +++ b/Source/Resource/PaletteResource.cpp @@ -3,6 +3,7 @@ #include "File/File.h" #include "Render/DeviceContext/DCSurface.h" #include "Resource/Sprites/SpriteResource.h" +#include "Resource/ResourceMgr.h" #include @@ -40,3 +41,11 @@ bool CPaletteRes::Load(const char* name) { // FUNCTION: fn_08041 void CPaletteRes::Unload() { } + +// INLINED +CPaletteRes::CPaletteRes(const char* extension, const char* prefix) { + ResourceMgr::Instance().Register(extension, prefix, this); +} + +// GLOBAL: gl_25562 +CPaletteRes g_palPrototype("pal", "palette\\"); diff --git a/Source/Resource/PaletteResource.h b/Source/Resource/PaletteResource.h index 62bf61ebd..2fd903ff5 100644 --- a/Source/Resource/PaletteResource.h +++ b/Source/Resource/PaletteResource.h @@ -8,6 +8,7 @@ class CPaletteRes : public CRes { public: CPaletteRes(); + CPaletteRes(const char* extension, const char* prefix); ~CPaletteRes() override; CPaletteRes* Create() override; bool Load(const char* name) override; diff --git a/Source/Resource/RmaResource.cpp b/Source/Resource/RmaResource.cpp index d2a979512..b6c08053d 100644 --- a/Source/Resource/RmaResource.cpp +++ b/Source/Resource/RmaResource.cpp @@ -3,6 +3,7 @@ #include "File/File.h" #include "Render/DeviceContext/DCSurface.h" #include "Utility/Tokenizer.h" +#include "Resource/ResourceMgr.h" #include #include @@ -100,3 +101,11 @@ void CRmaRes::Unload() { this->models.clear(); this->actionModels.clear(); } + +// INLINED +CRmaRes::CRmaRes(const char* extension, const char* prefix) { + ResourceMgr::Instance().Register(extension, prefix, this); +} + +// GLOBAL: gl_25547 +CRmaRes g_rmaPrototype("rma", "model\\"); diff --git a/Source/Resource/RmaResource.h b/Source/Resource/RmaResource.h index 55db04992..730c57361 100644 --- a/Source/Resource/RmaResource.h +++ b/Source/Resource/RmaResource.h @@ -17,6 +17,7 @@ struct RmaAction { class CRmaRes : public CRes { public: CRmaRes(); + CRmaRes(const char* extension, const char* prefix); ~CRmaRes() override; CRmaRes* Create() override; bool Load(const char* name) override; diff --git a/Source/Resource/Sprites/ActionResource.cpp b/Source/Resource/Sprites/ActionResource.cpp index c213fe891..6866fcc3c 100644 --- a/Source/Resource/Sprites/ActionResource.cpp +++ b/Source/Resource/Sprites/ActionResource.cpp @@ -275,3 +275,11 @@ unsigned CActRes::FrameCount(unsigned animation) const { const auto& frames = this->Animation(animation); return (std::max)(static_cast(frames.size()), 1u); } + +// INLINED +CActRes::CActRes(const char* extension, const char* prefix) { + ResourceMgr::Instance().Register(extension, prefix, this); +} + +// GLOBAL: gl_25546 +CActRes g_actPrototype("act", "sprite\\"); diff --git a/Source/Resource/Sprites/ActionResource.h b/Source/Resource/Sprites/ActionResource.h index 3a217e53c..21913d9fd 100644 --- a/Source/Resource/Sprites/ActionResource.h +++ b/Source/Resource/Sprites/ActionResource.h @@ -33,6 +33,7 @@ struct ActionFrame { class CActRes : public CRes { public: CActRes(); + CActRes(const char* extension, const char* prefix); ~CActRes() override; CActRes* Create() override; bool Load(const char* name) override; diff --git a/Source/Resource/Sprites/SpriteResource.cpp b/Source/Resource/Sprites/SpriteResource.cpp index aeb5051c9..dbe14b69e 100644 --- a/Source/Resource/Sprites/SpriteResource.cpp +++ b/Source/Resource/Sprites/SpriteResource.cpp @@ -8,6 +8,7 @@ #include "Render/DeviceContext/DCSurface.h" #include "Render/Textures/TextureCache.h" #include "Resource/ResourcePreload.h" +#include "Resource/ResourceMgr.h" #include #include @@ -208,3 +209,11 @@ void CSprRes::Unload() { this->images[type].erase(this->images[type].begin(), this->images[type].end()); } } + +// INLINED +CSprRes::CSprRes(const char* extension, const char* prefix) { + ResourceMgr::Instance().Register(extension, prefix, this); +} + +// GLOBAL: gl_25563 +CSprRes g_sprPrototype("spr", "sprite\\"); diff --git a/Source/Resource/Sprites/SpriteResource.h b/Source/Resource/Sprites/SpriteResource.h index 20a6e9168..4a4d6ee5a 100644 --- a/Source/Resource/Sprites/SpriteResource.h +++ b/Source/Resource/Sprites/SpriteResource.h @@ -11,6 +11,7 @@ class ResourceBytes; class CSprRes : public CRes { public: CSprRes(); + CSprRes(const char* extension, const char* prefix); ~CSprRes() override; CSprRes* Create() override; bool Load(const char* name) override; diff --git a/Source/Resource/World/GroundResource.cpp b/Source/Resource/World/GroundResource.cpp index c45825a39..a7b5780de 100644 --- a/Source/Resource/World/GroundResource.cpp +++ b/Source/Resource/World/GroundResource.cpp @@ -1,4 +1,5 @@ #include "Resource/World/GroundResource.h" +#include "Resource/ResourceMgr.h" #include @@ -173,3 +174,11 @@ void CGndRes::Lightmap(int index, unsigned char* output) const { output[66 + 3 * transposed] = blue[pixel]; } } + +// INLINED +CGndRes::CGndRes(const char* extension, const char* prefix) { + ResourceMgr::Instance().Register(extension, prefix, this); +} + +// GLOBAL: gl_25556 +CGndRes g_gndPrototype("gnd", ""); diff --git a/Source/Resource/World/GroundResource.h b/Source/Resource/World/GroundResource.h index bb5e0f28c..40471a7e2 100644 --- a/Source/Resource/World/GroundResource.h +++ b/Source/Resource/World/GroundResource.h @@ -29,6 +29,7 @@ struct GroundLegacyLightmap { class CGndRes : public CRes { public: CGndRes(); + CGndRes(const char* extension, const char* prefix); ~CGndRes() override; CGndRes* Create() override; bool Load(const char* name) override; diff --git a/Source/Resource/World/TerrainResource.cpp b/Source/Resource/World/TerrainResource.cpp index 6a9d1f4d6..72eef9054 100644 --- a/Source/Resource/World/TerrainResource.cpp +++ b/Source/Resource/World/TerrainResource.cpp @@ -2,6 +2,7 @@ #include "File/File.h" #include "Render/DeviceContext/DCSurface.h" #include "Resource/World/TerrainResource.h" +#include "Resource/ResourceMgr.h" #include @@ -76,3 +77,11 @@ void C3dAttr::Unload() { this->width = 0; this->height = 0; } + +// INLINED +C3dAttr::C3dAttr(const char* extension, const char* prefix) { + ResourceMgr::Instance().Register(extension, prefix, this); +} + +// GLOBAL: gl_25548 +C3dAttr g_gatPrototype("gat", ""); diff --git a/Source/Resource/World/TerrainResource.h b/Source/Resource/World/TerrainResource.h index 57ac3910d..408dc44ff 100644 --- a/Source/Resource/World/TerrainResource.h +++ b/Source/Resource/World/TerrainResource.h @@ -9,6 +9,7 @@ class C3dAttr : public CRes { public: C3dAttr(); + C3dAttr(const char* extension, const char* prefix); ~C3dAttr() override; C3dAttr* Create() override; bool Load(const char* name) override; diff --git a/Source/Resource/World/WorldResource.cpp b/Source/Resource/World/WorldResource.cpp index 5b9851256..90f0473e2 100644 --- a/Source/Resource/World/WorldResource.cpp +++ b/Source/Resource/World/WorldResource.cpp @@ -3,6 +3,7 @@ #include "Render/DeviceContext/DCSurface.h" #include "Resource/World/WorldResource.h" #include "Utility/Math/AffineMatrix.h" +#include "Resource/ResourceMgr.h" #include #include @@ -374,3 +375,11 @@ bool C3dWorldRes::Load(const char* name) { return true; } + +// INLINED +C3dWorldRes::C3dWorldRes(const char* extension, const char* prefix) { + ResourceMgr::Instance().Register(extension, prefix, this); +} + +// GLOBAL: gl_25564 +C3dWorldRes g_rswPrototype("rsw", ""); diff --git a/Source/Resource/World/WorldResource.h b/Source/Resource/World/WorldResource.h index 58bbe15dc..c52229649 100644 --- a/Source/Resource/World/WorldResource.h +++ b/Source/Resource/World/WorldResource.h @@ -55,6 +55,7 @@ extern WorldLighting g_worldLighting; class C3dWorldRes : public CRes { public: C3dWorldRes(); + C3dWorldRes(const char* extension, const char* prefix); ~C3dWorldRes() override; C3dWorldRes* Create() override; bool Load(const char* name) override; diff --git a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp index fa1d8343d..26cb5edf4 100644 --- a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp +++ b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp @@ -4736,8 +4736,8 @@ int UIWhisperWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::i } menu->SendMsg(nullptr, 0x1E, 0, 0, 0, 0); menu->Move( - std::min(std::max(g_screenWidth + 1, 1), g_renderer->viewport.width - menu->geometry.width), - std::min(std::max(g_screenHeight + 1, 1), g_renderer->viewport.height - menu->geometry.height) + std::min(std::max(g_mouse.x + 1, 1), g_renderer->viewport.width - menu->geometry.width), + std::min(std::max(g_mouse.y + 1, 1), g_renderer->viewport.height - menu->geometry.height) ); return 0; } @@ -8994,7 +8994,7 @@ void UIBookWnd::Paint() { void UICardItemIllustWnd::Paint() { this->DrawTitleBar(false, "", 0); if (this->m_bitmapPath.size() != 0) { - this->DrawBitmap(0, 17, reinterpret_cast(ResourceMgr::Instance().Load(Resolve(this->m_bitmapPath.c_str()))), false); + this->DrawBitmap(0, 17, static_cast(ResourceMgr::Instance().Load(Resolve(this->m_bitmapPath.c_str()))), false); } ITEM_INFO item; @@ -9461,8 +9461,8 @@ void UISecondPasswordInputWnd::Paint() { // OFFSET: 0x008F2BC0 // FUNCTION: fn_12260 void UInCashWnd::Paint() { - if (const auto* background = - reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\NC_BackGround3.bmp")))) { + if (auto* background = + static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\NC_BackGround3.bmp")))) { this->DrawBitmap(0, 0, background, false); } @@ -9553,7 +9553,7 @@ void UIItemCollectionWnd::Paint() { this->DrawSkinBox(FormatOwnedString("유저인터페이스\\sysbox_g%d_", this->m_item.unknown_0088).c_str(), 0, 0, width, bottom, false); this->DrawBitmap( 0, 0, - reinterpret_cast( + static_cast( ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\basic_interface\\collection_bg_g%d.bmp", this->m_item.unknown_0088).c_str())) ), true @@ -9564,11 +9564,11 @@ void UIItemCollectionWnd::Paint() { background = "유저인터페이스\\basic_interface\\collection_bg.bmp"; } if (background != nullptr) { - this->DrawBitmap(0, 0, reinterpret_cast(ResourceMgr::Instance().Load(Resolve(background))), true); + this->DrawBitmap(0, 0, static_cast(ResourceMgr::Instance().Load(Resolve(background))), true); } if (this->unknown_01C4.size() != 0) { - this->DrawBitmap(10, 11, reinterpret_cast(ResourceMgr::Instance().Load(Resolve(this->unknown_01C4.c_str()))), true); + this->DrawBitmap(10, 11, static_cast(ResourceMgr::Instance().Load(Resolve(this->unknown_01C4.c_str()))), true); } this->DrawFittedItemName(90, 10, &this->m_item, this->m_item.identified ? 0 : 0x808080, 0, 12, 0); @@ -9604,13 +9604,13 @@ void UIItemCollectionWnd::Paint() { for (int x = 4; x < 104; x += 25, ++slot) { const int card = reinterpret_cast(this->m_item.unknown_001C)[slot]; if (card < 1) { - const BitmapImage* bitmap = reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\empty_card_slot.bmp"))); + CBitmapRes* bitmap = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\empty_card_slot.bmp"))); if (this->m_kind == 234) { const char* name = slot < ItemSlotsCount(this->m_item) ? "유저인터페이스\\basic_interface\\comparison_empty_card_slot.bmp" : "유저인터페이스\\basic_interface\\comparison_disable_card_slot.bmp"; - bitmap = reinterpret_cast(ResourceMgr::Instance().Load(Resolve(name))); + bitmap = static_cast(ResourceMgr::Instance().Load(Resolve(name))); } else if (ItemSlotsCount(this->m_item) <= slot) { - bitmap = reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\disable_card_slot.bmp"))); + bitmap = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\disable_card_slot.bmp"))); } this->DrawBitmap(x, y, bitmap, true); } else { diff --git a/Source/UI/AdventureGuide/UIAdventureGuide.cpp b/Source/UI/AdventureGuide/UIAdventureGuide.cpp index a79045291..d6f44c2b7 100644 --- a/Source/UI/AdventureGuide/UIAdventureGuide.cpp +++ b/Source/UI/AdventureGuide/UIAdventureGuide.cpp @@ -19,6 +19,7 @@ #include "Utility/Text/FormatString.h" #include "Utility/Text/StringUtil.h" #include "Contents/Items/ItemDescription.h" +#include "UI/Window/UIRegisterMgr.h" #include #include #include @@ -2195,6 +2196,14 @@ CUIAdventureGuide* CreateAdventureGuide() { return new CUIAdventureGuide(); } +// OFFSET: 0x00487B10 +// FUNCTION: fn_45546 +static bool s_registered = [] { + std::function factory = CreateAdventureGuide; + Singleton::GetInstance()->Register(10002, factory); + return true; +}(); + // OFFSET: 0x009DB280 // FUNCTION: fn_14306 template <> diff --git a/Source/UI/Buttons/UIBmpRadioBtn.h b/Source/UI/Buttons/UIBmpRadioBtn.h index 32cb9c96e..52d0ed5ef 100644 --- a/Source/UI/Buttons/UIBmpRadioBtn.h +++ b/Source/UI/Buttons/UIBmpRadioBtn.h @@ -28,6 +28,16 @@ public: void Slot25(int x, int y) override; void Slot28(int x, int y) override; int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override; + // INLINED + void Slot47() override { + this->m_hovered = true; + this->Invalidate(); + } + // INLINED + void Slot48() override { + this->m_hovered = false; + this->Invalidate(); + } bool SetBitmap(const char* name, int state); void AddText(int id, int height, std::uint32_t color, bool bold, bool unknown, int x, int y); diff --git a/Source/UI/Buttons/UITextButton.cpp b/Source/UI/Buttons/UITextButton.cpp index 26edeb319..92b2c3022 100644 --- a/Source/UI/Buttons/UITextButton.cpp +++ b/Source/UI/Buttons/UITextButton.cpp @@ -57,8 +57,6 @@ #include #include #include -// GLOBAL: gl_24606 -int g_screenHeight; // OFFSET: 0x0086EEB0 // FUNCTION: fn_11085 @@ -2155,26 +2153,26 @@ void UIZeroQuestScrollBar::Paint() { return; } - const auto* up = ResourceMgr::Instance().Load(Resolve("유저인터페이스\\UIRenewal\\questui\\btn_scroll_arrow_up.bmp")); - this->DrawBitmap(0, 0, reinterpret_cast(up), true); + auto* up = ResourceMgr::Instance().Load(Resolve("유저인터페이스\\UIRenewal\\questui\\btn_scroll_arrow_up.bmp")); + this->DrawBitmap(0, 0, static_cast(up), true); - const auto* down = ResourceMgr::Instance().Load(Resolve("유저인터페이스\\UIRenewal\\questui\\btn_scroll_arrow_down.bmp")); - this->DrawBitmap(0, this->geometry.height - this->arrowLength, reinterpret_cast(down), true); + auto* down = ResourceMgr::Instance().Load(Resolve("유저인터페이스\\UIRenewal\\questui\\btn_scroll_arrow_down.bmp")); + this->DrawBitmap(0, this->geometry.height - this->arrowLength, static_cast(down), true); const int extent = this->vertical == 0 ? this->geometry.width : this->geometry.height; int y = this->arrowLength + (this->position * (extent - this->arrowLength * 2 - this->ThumbLength())) / this->maximum; - const auto* thumbUp = ResourceMgr::Instance().Load(Resolve("유저인터페이스\\UIRenewal\\questui\\btn_scroll_thumb_up.bmp")); - this->DrawBitmap(0, y, reinterpret_cast(thumbUp), true); + auto* thumbUp = ResourceMgr::Instance().Load(Resolve("유저인터페이스\\UIRenewal\\questui\\btn_scroll_thumb_up.bmp")); + this->DrawBitmap(0, y, static_cast(thumbUp), true); const int bottom = y + this->ThumbLength() - 4; for (y += 4; y < bottom; y += 4) { - const auto* thumbMiddle = ResourceMgr::Instance().Load(Resolve("유저인터페이스\\UIRenewal\\questui\\btn_scroll_thumb_mid.bmp")); - this->DrawBitmap(0, y, reinterpret_cast(thumbMiddle), true); + auto* thumbMiddle = ResourceMgr::Instance().Load(Resolve("유저인터페이스\\UIRenewal\\questui\\btn_scroll_thumb_mid.bmp")); + this->DrawBitmap(0, y, static_cast(thumbMiddle), true); } - const auto* thumbDown = ResourceMgr::Instance().Load(Resolve("유저인터페이스\\UIRenewal\\questui\\btn_scroll_thumb_down.bmp")); - this->DrawBitmap(0, bottom, reinterpret_cast(thumbDown), true); + auto* thumbDown = ResourceMgr::Instance().Load(Resolve("유저인터페이스\\UIRenewal\\questui\\btn_scroll_thumb_down.bmp")); + this->DrawBitmap(0, bottom, static_cast(thumbDown), true); } // OFFSET: 0x00884DD0 @@ -3531,7 +3529,7 @@ void UIString::Paint() { if (!res) { return; } - this->DrawBitmap(0, 0, reinterpret_cast(res), true); + this->DrawBitmap(0, 0, static_cast(res), true); while (cur < end) { cur = ParseColorCode(SegmentEnd(cur, end), color); } diff --git a/Source/UI/Buttons/UITextButton.h b/Source/UI/Buttons/UITextButton.h index 31183b8d5..b273c9b60 100644 --- a/Source/UI/Buttons/UITextButton.h +++ b/Source/UI/Buttons/UITextButton.h @@ -7,8 +7,6 @@ #include #include -extern int g_screenHeight; -extern int g_screenWidth; class UITextButton : public UIButton { friend class UITextViewer; diff --git a/Source/UI/CashShop/UICashShopWnd.cpp b/Source/UI/CashShop/UICashShopWnd.cpp index 5330cf425..0ce9d2c48 100644 --- a/Source/UI/CashShop/UICashShopWnd.cpp +++ b/Source/UI/CashShop/UICashShopWnd.cpp @@ -429,10 +429,10 @@ void UICashShopWnd_Item::Slot15(int, int) { // FUNCTION: fn_09539 void UICashShopWnd::Paint() { const char* background = this->m_selectedTab == 9 ? "유저인터페이스\\cashshop\\img_shop_bg2.bmp" : "유저인터페이스\\cashshop\\img_shop_bg.bmp"; - this->DrawBitmap(0, 0, reinterpret_cast(ResourceMgr::Instance().Load(Resolve(background))), false); + this->DrawBitmap(0, 0, static_cast(ResourceMgr::Instance().Load(Resolve(background))), false); if (g_session.unknown_5912) { this->DrawBitmap( - 0x218, 0x11, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\cashshop\\img_shop_bg3_cover.bmp"))), false + 0x218, 0x11, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\cashshop\\img_shop_bg3_cover.bmp"))), false ); } @@ -478,7 +478,7 @@ void UICashShopWnd_Banner::Paint() { ResourceMgr& resources = ResourceMgr::Instance(); this->DrawBitmap( - 0, 0, reinterpret_cast(resources.Load(Resolve(("유저인터페이스\\cashshop\\" + this->m_entries[this->m_index].image).c_str()))), + 0, 0, static_cast(resources.Load(Resolve(("유저인터페이스\\cashshop\\" + this->m_entries[this->m_index].image).c_str()))), false ); } @@ -487,7 +487,7 @@ void UICashShopWnd_Banner::Paint() { // FUNCTION: fn_09541 void UICashShopWnd_Cart::Paint() { ResourceMgr& resources = ResourceMgr::Instance(); - this->DrawBitmap(0, 0, reinterpret_cast(resources.Load(Resolve("유저인터페이스\\cashshop\\img_shop_cart_bg.bmp"))), false); + this->DrawBitmap(0, 0, static_cast(resources.Load(Resolve("유저인터페이스\\cashshop\\img_shop_cart_bg.bmp"))), false); unsigned int index = this->m_scrollIndex; for (int slot = 0; slot < this->m_visibleCount; ++slot, ++index) { @@ -504,7 +504,7 @@ void UICashShopWnd_Cart::Paint() { // FUNCTION: fn_09542 void UICashShopWnd_CartItem::Paint() { this->DrawBitmap( - 0, 0, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\cashshop\\img_shop_itemBg2.bmp"))), false + 0, 0, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\cashshop\\img_shop_itemBg2.bmp"))), false ); std::string name = this->FitDisplayText(0x70, this->m_item.unknown_0044.c_str(), 0, 0xB, 0); @@ -526,7 +526,7 @@ void UICashShopWnd_CartItem::Paint() { void UICashShopWnd_Item::Paint() { if (this->m_largeLayout == true) { this->DrawBitmap( - 0, 0, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\cashshop\\img_shop_item_bg2.bmp"))), false + 0, 0, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\cashshop\\img_shop_item_bg2.bmp"))), false ); std::string stock; @@ -542,7 +542,7 @@ void UICashShopWnd_Item::Paint() { this->DrawCenteredText(0, 6, name.c_str(), this->geometry.width, 0, 0xC, 0xA44F3B, 1); this->DrawBitmap( 5, 0x34, - reinterpret_cast( + static_cast( ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\collection\\%s.bmp", ItemResourcePath(this->m_item)).c_str())) ), true @@ -584,7 +584,7 @@ void UICashShopWnd_Item::Paint() { this->DrawTextAt(0x9E - endWidth, 0xAD, endText.c_str(), 0, 0, 0xB, 0, 0, 0); } else { this->DrawBitmap( - 0, 0, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\cashshop\\img_shop_itemBg.bmp"))), false + 0, 0, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\cashshop\\img_shop_itemBg.bmp"))), false ); if (this->m_item.unknown_0000[1] == 0) { return; @@ -594,7 +594,7 @@ void UICashShopWnd_Item::Paint() { this->DrawCenteredText(0, 6, name.c_str(), this->geometry.width, 0, 0xC, 0xA44F3B, 1); this->DrawBitmap( 5, 0x17, - reinterpret_cast( + static_cast( ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\collection\\%s.bmp", ItemResourcePath(this->m_item)).c_str())) ), true diff --git a/Source/UI/Edit/UIEditCtrl.cpp b/Source/UI/Edit/UIEditCtrl.cpp index 9540ff39f..96d457d16 100644 --- a/Source/UI/Edit/UIEditCtrl.cpp +++ b/Source/UI/Edit/UIEditCtrl.cpp @@ -5140,7 +5140,7 @@ static void AppendReplayRecord(std::vector& records, const std::v // OFFSET: 0x00972E60 // FUNCTION: fn_13281 -std::vector UIItemPurchaseWnd::BuildReplayRecords() { +std::vector UIItemPurchaseWnd::Slot44() { std::vector records; AppendReplayRecord(records, BuildReplayTaggedRecord(0x50DC, nullptr, 0)); AppendReplayRecord(records, BuildReplayTaggedRecord(0x50DD, nullptr, 0)); @@ -5149,7 +5149,7 @@ std::vector UIItemPurchaseWnd::BuildReplayRecords() { // OFFSET: 0x00972F50 // FUNCTION: fn_13282 -std::vector UIItemSellWnd2::BuildReplayRecords() { +std::vector UIItemSellWnd2::Slot44() { std::vector records; AppendReplayRecord(records, BuildReplayTaggedRecord(20800, nullptr, 0)); AppendReplayRecord(records, BuildReplayTaggedRecord(20802, &this->unknown_00FC, 4)); @@ -5159,7 +5159,7 @@ std::vector UIItemSellWnd2::BuildReplayRecords() { // OFFSET: 0x00973080 // FUNCTION: fn_13283 -std::vector UIItemSellWnd::BuildReplayRecords() { +std::vector UIItemSellWnd::Slot44() { std::vector records; AppendReplayRecord(records, BuildReplayTaggedRecord(0x510E, nullptr, 0)); AppendReplayRecord(records, BuildReplayTaggedRecord(0x510F, nullptr, 0)); @@ -5168,7 +5168,7 @@ std::vector UIItemSellWnd::BuildReplayRecords() { // OFFSET: 0x00973170 // FUNCTION: fn_13284 -std::vector UIItemStoreWnd::BuildReplayRecords() { +std::vector UIItemStoreWnd::Slot44() { std::vector records; AppendReplayRecord(records, BuildReplayTaggedRecord(0x51A4, nullptr, 0)); AppendReplayRecord(records, BuildReplayTaggedRecord(0x51A5, nullptr, 0)); @@ -5205,7 +5205,7 @@ std::vector UIParaItemShopWnd::BuildReplayRecords() { // OFFSET: 0x009734E0 // FUNCTION: fn_13287 -std::vector UIMerchantItemShopWnd::BuildReplayRecords() { +std::vector UIMerchantItemShopWnd::Slot44() { std::vector records; if (this->unknown_010C != 0) { AppendReplayRecord(records, BuildReplayTaggedRecord(21250, nullptr, 0)); @@ -5220,7 +5220,7 @@ std::vector UIMerchantItemShopWnd::BuildReplayRecords() { // OFFSET: 0x00973670 // FUNCTION: fn_13288 -std::vector UIMerchantMirrorItemWnd::BuildReplayRecords() { +std::vector UIMerchantMirrorItemWnd::Slot44() { std::vector records; AppendReplayRecord(records, BuildReplayTaggedRecord(0x5398, nullptr, 0)); AppendReplayRecord(records, BuildReplayTaggedRecord(0x5399, nullptr, 0)); @@ -5229,7 +5229,7 @@ std::vector UIMerchantMirrorItemWnd::BuildReplayRecords() { // OFFSET: 0x00973760 // FUNCTION: fn_13289 -std::vector UIMerchantShopMakeWnd::BuildReplayRecords() { +std::vector UIMerchantShopMakeWnd::Slot44() { std::vector records; if (this->mode != 0) { AppendReplayRecord(records, BuildReplayTaggedRecord(21350, nullptr, 0)); diff --git a/Source/UI/Enchant/UIEnchantUI.cpp b/Source/UI/Enchant/UIEnchantUI.cpp index 40c8ac7e8..2d0aee24f 100644 --- a/Source/UI/Enchant/UIEnchantUI.cpp +++ b/Source/UI/Enchant/UIEnchantUI.cpp @@ -7,6 +7,7 @@ #include "UI/Text/UITextViewerControl.h" #include "UI/Text/UIStaticTextControl.h" #include "Utility/Cipher/XorBytes.h" +#include "UI/Window/UIRegisterMgr.h" #include #include #include @@ -557,6 +558,14 @@ CUIEnchantUI* CreateEnchantUI() { return new CUIEnchantUI(); } +// OFFSET: 0x00492010 +// FUNCTION: fn_45547 +static bool s_registered = [] { + std::function factory = CreateEnchantUI; + Singleton::GetInstance()->Register(10006, factory); + return true; +}(); + namespace EnchantUI { // OFFSET: 0x009FD340 // FUNCTION: fn_14823 diff --git a/Source/UI/Exchange/UIExchangeUI.cpp b/Source/UI/Exchange/UIExchangeUI.cpp index 63e3e4cdd..540ed1114 100644 --- a/Source/UI/Exchange/UIExchangeUI.cpp +++ b/Source/UI/Exchange/UIExchangeUI.cpp @@ -19,6 +19,7 @@ #include "Utility/Cipher/XorBytes.h" #include "Utility/Text/FormatString.h" #include "Utility/Text/GroupedInteger.h" +#include "UI/Window/UIRegisterMgr.h" #include #include @@ -1300,6 +1301,14 @@ CUIExchangeUI* CreateExchangeUI() { return new CUIExchangeUI(); } +// OFFSET: 0x00493AD0 +// FUNCTION: fn_45549 +static bool s_registered = [] { + std::function factory = CreateExchangeUI; + Singleton::GetInstance()->Register(10011, factory); + return true; +}(); + // OFFSET: 0x00A151F0 // FUNCTION: fn_15195 template <> diff --git a/Source/UI/GameSettings/GameSettingsUI.cpp b/Source/UI/GameSettings/GameSettingsUI.cpp index 3f0c415e2..75457c799 100644 --- a/Source/UI/GameSettings/GameSettingsUI.cpp +++ b/Source/UI/GameSettings/GameSettingsUI.cpp @@ -31,6 +31,7 @@ #include "UI/Window/WindowBorder.h" #include "Utility/Cipher/XorBytes.h" #include "Utility/Text/StringUtil.h" +#include "UI/Window/UIRegisterMgr.h" #include #include #include @@ -2157,10 +2158,18 @@ void UIWindowMgr::RefreshGameSettingHotkeys() { // OFFSET: 0x00A1BF50 // FUNCTION: fn_15373 -UIFrameWnd* CreateGameSettingsUI() { +CUIFrameWnd* CreateGameSettingsUI() { return new CUIGameSettingsUI(); } +// OFFSET: 0x00494730 +// FUNCTION: fn_45545 +static bool s_registered = [] { + std::function factory = CreateGameSettingsUI; + Singleton::GetInstance()->Register(10014, factory); + return true; +}(); + // OFFSET: 0x00A1BFD0 // FUNCTION: fn_15374 template <> diff --git a/Source/UI/Guild/UIGuildWnd.cpp b/Source/UI/Guild/UIGuildWnd.cpp index ca1679a04..e9935400b 100644 --- a/Source/UI/Guild/UIGuildWnd.cpp +++ b/Source/UI/Guild/UIGuildWnd.cpp @@ -1491,11 +1491,11 @@ void UIGuildInfoManageWnd::Paint() { CBitmapRes* online = static_cast(ResourceMgr::Instance().Load(Resolve(text))); int x; if (g_serviceType == 0) { - this->DrawBitmap(128, 95, &online->image, true); + this->DrawBitmap(128, 95, online, true); std::sprintf(text, " %d", guild.unknown_0068); x = 138; } else { - this->DrawBitmap(width + 16, 95, &online->image, true); + this->DrawBitmap(width + 16, 95, online, true); std::sprintf(text, " %d", guild.unknown_0068); this->TextWidth(LookupMessage(330), 0, 0, 12, 0, 0); x = online->image.width + 16 + width; @@ -1520,9 +1520,9 @@ void UIGuildInfoManageWnd::Paint() { this->FillRegion(299, 64, 26, 26, RGB(red, green, blue)); { const std::string emblemName = g_guildMgr->GetEmblemFilename(this->m_guildId); - CBitmapRes* emblem = static_cast(ResourceMgr::Instance().Load(emblemName)); + CEmblemRes* emblem = static_cast(ResourceMgr::Instance().Load(emblemName)); if (emblem) { - this->DrawBitmap(300, 65, &emblem->image, true); + this->DrawBitmap(300, 65, &emblem->gif, true); } } diff --git a/Source/UI/Guild/UIGuild_Storage_Log.cpp b/Source/UI/Guild/UIGuild_Storage_Log.cpp index 8e0b0de37..c1fc4c61c 100644 --- a/Source/UI/Guild/UIGuild_Storage_Log.cpp +++ b/Source/UI/Guild/UIGuild_Storage_Log.cpp @@ -1,5 +1,6 @@ #include "UI/Guild/UIGuild_Storage_Log.h" #include "Contents/MessageTable.h" +#include "Resource/Bitmap/BitmapResource.h" #include "Resource/ResourceMgr.h" #include "Resource/TextureNames.h" #include "UI/Lists/UITabControl.h" @@ -192,8 +193,8 @@ void UIGuild_Storage_Log::Paint() { this->DrawTitleBar(true, LookupMessage(0x9F3), 0); this->DrawPanelBackground(17, 0, ""); this->DrawButtonBar(2, 0, 1); - const BitmapImage* out = reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\out.bmp"))); - const BitmapImage* in = reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\in.bmp"))); + CBitmapRes* out = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\out.bmp"))); + CBitmapRes* in = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\in.bmp"))); for (int tab = 0; tab < static_cast(this->unknown_0158->labels.size()); ++tab) { this->unknown_0158->colors[tab] = 0xFFFFFFFF; diff --git a/Source/UI/Item/UIEquipmentPropertiesWnd.cpp b/Source/UI/Item/UIEquipmentPropertiesWnd.cpp index 0e47d5a7c..30f0f36d6 100644 --- a/Source/UI/Item/UIEquipmentPropertiesWnd.cpp +++ b/Source/UI/Item/UIEquipmentPropertiesWnd.cpp @@ -7,6 +7,7 @@ #include "Resource/SkinPalette.h" #include "Resource/TextureNames.h" #include "UI/Text/UIStaticTextControl.h" +#include "UI/Window/UIRegisterMgr.h" #include "UI/Window/UIWindowMgr.h" #include "Utility/Cipher/XorBytes.h" #include "Utility/Text/StringUtil.h" @@ -1089,3 +1090,11 @@ __declspec(noinline) CUIEquipmentPropertiesWnd::CUIEquipmentPropertiesWnd() CUIEquipmentPropertiesWnd* CreateEquipmentPropertiesWnd() { return new CUIEquipmentPropertiesWnd(); } + +// OFFSET: 0x00492C70 +// FUNCTION: fn_45548 +static bool s_registered = [] { + std::function factory = CreateEquipmentPropertiesWnd; + Singleton::GetInstance()->Register(10001, factory); + return true; +}(); diff --git a/Source/UI/Item/UIItemPurchaseWnd.h b/Source/UI/Item/UIItemPurchaseWnd.h index 1bbb734ce..8ffdb53fa 100644 --- a/Source/UI/Item/UIItemPurchaseWnd.h +++ b/Source/UI/Item/UIItemPurchaseWnd.h @@ -11,7 +11,7 @@ class UIStaticText; class UIItemPurchaseWnd : public UIItemBaseWnd { public: - std::vector BuildReplayRecords(); + std::vector Slot44() override; UIItemPurchaseWnd(); void Slot10(int x, int y, std::intptr_t value) override; void Slot11() override; diff --git a/Source/UI/Item/UIItemSellWnd.h b/Source/UI/Item/UIItemSellWnd.h index 10213857a..e3ed1fcb1 100644 --- a/Source/UI/Item/UIItemSellWnd.h +++ b/Source/UI/Item/UIItemSellWnd.h @@ -10,7 +10,7 @@ class UIStaticText; class UIItemSellWnd : public UIItemBaseWnd { public: - std::vector BuildReplayRecords(); + std::vector Slot44() override; UIItemSellWnd(); void Slot11() override; void Slot25(int x, int y) override; diff --git a/Source/UI/Item/UIItemSellWnd2.h b/Source/UI/Item/UIItemSellWnd2.h index bc1958fef..d0999fab9 100644 --- a/Source/UI/Item/UIItemSellWnd2.h +++ b/Source/UI/Item/UIItemSellWnd2.h @@ -12,7 +12,7 @@ class UIStaticText; class UIItemSellWnd2 : public UIItemBaseWnd { public: UIItemSellWnd2(); - std::vector BuildReplayRecords(); + std::vector Slot44() override; void Slot10(int x, int y, std::intptr_t value) override; void Slot11() override; void Paint() override; diff --git a/Source/UI/Item/UIItemStoreWnd.h b/Source/UI/Item/UIItemStoreWnd.h index 4116b39a1..5a628612c 100644 --- a/Source/UI/Item/UIItemStoreWnd.h +++ b/Source/UI/Item/UIItemStoreWnd.h @@ -15,7 +15,7 @@ class UITab; class UIItemStoreWnd : public UIItemBaseWnd { public: - std::vector BuildReplayRecords(); + std::vector Slot44() override; UIItemStoreWnd(); __declspec(noinline) ~UIItemStoreWnd() override; void Slot10(int x, int y, std::intptr_t value) override; diff --git a/Source/UI/Item/UIItemWnd.h b/Source/UI/Item/UIItemWnd.h index fe5e1d32f..541656050 100644 --- a/Source/UI/Item/UIItemWnd.h +++ b/Source/UI/Item/UIItemWnd.h @@ -16,6 +16,10 @@ class UIItemWnd : public UIItemBaseWnd { public: UIItemWnd(); __declspec(noinline) ~UIItemWnd() override; + // INLINED + bool Slot03() override { + return true; + } void Slot11() override; void Slot10(int x, int y, std::intptr_t value) override; void Slot18() override; diff --git a/Source/UI/Item/UIParaItemShopWnd.cpp b/Source/UI/Item/UIParaItemShopWnd.cpp index 084addf1f..37b9d1bad 100644 --- a/Source/UI/Item/UIParaItemShopWnd.cpp +++ b/Source/UI/Item/UIParaItemShopWnd.cpp @@ -155,14 +155,14 @@ void UIParaResultWnd::Slot10(int x, int y, std::intptr_t value) { // OFFSET: 0x009A96C0 // FUNCTION: fn_13754 -void UIParaItemPurchaseWnd::Slot25(int x, int y) { +void UIParaResultWnd::Slot25(int x, int y) { if (y < 17) { UIFrameWnd::Slot25(x, y); } - int previousHovered = this->hovered; - this->hovered = this->GetItemIndexAt(x, y); - if (previousHovered != this->hovered) { + int previousHovered = this->unknown_00F8; + this->unknown_00F8 = this->GetItemIndexAt(x, y); + if (previousHovered != this->unknown_00F8) { this->Invalidate(); } } @@ -193,7 +193,7 @@ void UIParaResultWnd::Slot28(int x, int y) { // OFFSET: 0x009A99C0 // FUNCTION: fn_13756 -void UIParaItemShopWnd::Slot32(int x, int y) { +void UIParaResultWnd::Slot32(int x, int y) { const int previousHovered = this->unknown_00F8; this->unknown_00F8 = this->GetItemIndexAt(x, y); if (previousHovered != this->unknown_00F8) { diff --git a/Source/UI/Item/UIParaItemShopWnd.h b/Source/UI/Item/UIParaItemShopWnd.h index fd6289558..b9417777a 100644 --- a/Source/UI/Item/UIParaItemShopWnd.h +++ b/Source/UI/Item/UIParaItemShopWnd.h @@ -17,7 +17,6 @@ extern int g_pendingGid; class UIParaItemPurchaseWnd : public UIItemPurchaseWnd { public: UIParaItemPurchaseWnd(); - void Slot25(int x, int y) override; void Slot10(int x, int y, std::intptr_t value) override; int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override; }; @@ -27,7 +26,6 @@ public: UIParaItemShopWnd(); std::vector BuildReplayRecords(); void Slot10(int x, int y, std::intptr_t value) override; - void Slot32(int x, int y) override; void Paint() override; int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override; }; @@ -38,7 +36,9 @@ public: void Slot10(int x, int y, std::intptr_t value) override; void Slot15(int width, int height) override; void Paint() override; + void Slot25(int x, int y) override; void Slot28(int x, int y) override; + void Slot32(int x, int y) override; int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override; void AddItem(const RawItemBasic& item, int quantity); diff --git a/Source/UI/Items/UIItemRepairWnd.cpp b/Source/UI/Items/UIItemRepairWnd.cpp index f82005e38..7df5a58aa 100644 --- a/Source/UI/Items/UIItemRepairWnd.cpp +++ b/Source/UI/Items/UIItemRepairWnd.cpp @@ -371,7 +371,7 @@ UIItemRepairWnd::~UIItemRepairWnd() = default; // OFFSET: 0x009A0280 // FUNCTION: fn_13599 -std::vector UIItemRepairWnd::BuildReplayRecords() { +std::vector UIItemRepairWnd::Slot44() { std::vector records; { const auto record = BuildReplayTaggedRecord(22150, nullptr, 0); diff --git a/Source/UI/Items/UIItemRepairWnd.h b/Source/UI/Items/UIItemRepairWnd.h index 4799e04c2..a657ac6f3 100644 --- a/Source/UI/Items/UIItemRepairWnd.h +++ b/Source/UI/Items/UIItemRepairWnd.h @@ -26,7 +26,7 @@ public: void Slot15(int width, int height) override; void Paint() override; int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override; - std::vector BuildReplayRecords(); + std::vector Slot44() override; protected: diff --git a/Source/UI/Items/UIMakeTargetListWnd.cpp b/Source/UI/Items/UIMakeTargetListWnd.cpp index 0efaec090..a968f03c4 100644 --- a/Source/UI/Items/UIMakeTargetListWnd.cpp +++ b/Source/UI/Items/UIMakeTargetListWnd.cpp @@ -20,7 +20,7 @@ // OFFSET: 0x009A0490 // FUNCTION: fn_13600 -std::vector UIMakeTargetListWnd::BuildReplayRecords() { +std::vector UIMakeTargetListWnd::Slot44() { std::vector records; { const auto record = BuildReplayTaggedRecord(22050, nullptr, 0); diff --git a/Source/UI/Items/UIMakeTargetListWnd.h b/Source/UI/Items/UIMakeTargetListWnd.h index 121805475..8d2a98d9a 100644 --- a/Source/UI/Items/UIMakeTargetListWnd.h +++ b/Source/UI/Items/UIMakeTargetListWnd.h @@ -10,7 +10,7 @@ class UIListBox; class UIMakeTargetListWnd : public UIFrameWnd { public: UIMakeTargetListWnd(); - std::vector BuildReplayRecords(); + std::vector Slot44() override; void Slot15(int width, int height) override; void Paint() override; int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override; diff --git a/Source/UI/Items/UIMakeTargetProcessWnd.cpp b/Source/UI/Items/UIMakeTargetProcessWnd.cpp index 8f31e07dc..efdff905f 100644 --- a/Source/UI/Items/UIMakeTargetProcessWnd.cpp +++ b/Source/UI/Items/UIMakeTargetProcessWnd.cpp @@ -65,7 +65,7 @@ void UIMakeTargetProcessWnd::Slot10(int x, int y, std::intptr_t value) { // OFFSET: 0x009A0690 // FUNCTION: fn_13601 -std::vector UIMakeTargetProcessWnd::BuildReplayRecords() { +std::vector UIMakeTargetProcessWnd::Slot44() { std::vector records; { const auto record = BuildReplayTaggedRecord(22000, nullptr, 0); diff --git a/Source/UI/Items/UIMakeTargetProcessWnd.h b/Source/UI/Items/UIMakeTargetProcessWnd.h index 2b94519f4..5ea1101b7 100644 --- a/Source/UI/Items/UIMakeTargetProcessWnd.h +++ b/Source/UI/Items/UIMakeTargetProcessWnd.h @@ -14,7 +14,7 @@ public: void Slot15(int width, int height) override; void Slot25(int x, int y) override; int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override; - std::vector BuildReplayRecords(); + std::vector Slot44() override; ITEM_INFO GetItemAt(int x, int y); /* 00B4 */ int makeType; diff --git a/Source/UI/Items/UIWeaponRefineWnd.cpp b/Source/UI/Items/UIWeaponRefineWnd.cpp index 9c1b0212d..f6826960a 100644 --- a/Source/UI/Items/UIWeaponRefineWnd.cpp +++ b/Source/UI/Items/UIWeaponRefineWnd.cpp @@ -19,7 +19,7 @@ // OFFSET: 0x009A07C0 // FUNCTION: fn_13602 -std::vector UIWeaponRefineWnd::BuildReplayRecords() { +std::vector UIWeaponRefineWnd::Slot44() { std::vector records; { const auto record = BuildReplayTaggedRecord(22200, nullptr, 0); diff --git a/Source/UI/Items/UIWeaponRefineWnd.h b/Source/UI/Items/UIWeaponRefineWnd.h index b8588df05..c89fdbf55 100644 --- a/Source/UI/Items/UIWeaponRefineWnd.h +++ b/Source/UI/Items/UIWeaponRefineWnd.h @@ -10,7 +10,7 @@ class UIListBox; class UIWeaponRefineWnd : public UIFrameWnd { public: UIWeaponRefineWnd(); - std::vector BuildReplayRecords(); + std::vector Slot44() override; void Slot15(int width, int height) override; void Paint() override; int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override; diff --git a/Source/UI/Lists/UIComboBoxDefWnd.cpp b/Source/UI/Lists/UIComboBoxDefWnd.cpp index 4dcf3e49e..2082f3f59 100644 --- a/Source/UI/Lists/UIComboBoxDefWnd.cpp +++ b/Source/UI/Lists/UIComboBoxDefWnd.cpp @@ -530,15 +530,15 @@ void UIDescriptRace::DrawRaceDescription() { CImfRes* imf = nullptr; switch (layer) { case 0: - act = static_cast(ResourceMgr::Instance().Load(GetBodyActionResourceName(job, g_doramSex, job, 0))); - sprite = static_cast(ResourceMgr::Instance().Load(g_session.GetBodySprName(job, g_doramSex, job, 0))); - imf = static_cast(ResourceMgr::Instance().Load(GetBodyImfName(job, g_doramSex, 1, job).c_str())); + act = static_cast(ResourceMgr::Instance().Load(GetBodyActionResourceName(job, g_session.m_sex, job, 0))); + sprite = static_cast(ResourceMgr::Instance().Load(g_session.GetBodySprName(job, g_session.m_sex, job, 0))); + imf = static_cast(ResourceMgr::Instance().Load(GetBodyImfName(job, g_session.m_sex, 1, job).c_str())); break; case 1: { int head = 1; - act = static_cast(ResourceMgr::Instance().Load(g_session.GetHeadActName(job, g_doramSex, &head).c_str())); - sprite = static_cast(ResourceMgr::Instance().Load(g_session.GetHeadSprName(job, g_doramSex, &head).c_str())); - imf = static_cast(ResourceMgr::Instance().Load(GetBodyImfName(job, g_doramSex, head, job).c_str())); + act = static_cast(ResourceMgr::Instance().Load(g_session.GetHeadActName(job, g_session.m_sex, &head).c_str())); + sprite = static_cast(ResourceMgr::Instance().Load(g_session.GetHeadSprName(job, g_session.m_sex, &head).c_str())); + imf = static_cast(ResourceMgr::Instance().Load(GetBodyImfName(job, g_session.m_sex, head, job).c_str())); break; } } @@ -559,7 +559,7 @@ void UIDescriptRace::DrawRaceDescription() { const std::uint32_t* palette = sprite->palette; POINT point = imf->GetLongPoint(layer, action, frame); if (layer == 1) { - const ActionFrame* body = &static_cast(ResourceMgr::Instance().Load(GetBodyActionResourceName(job, g_doramSex, job, 0)))->Frame(action, frame); + const ActionFrame* body = &static_cast(ResourceMgr::Instance().Load(GetBodyActionResourceName(job, g_session.m_sex, job, 0)))->Frame(action, frame); if (actionFrame->anchorCount != 0 && body->anchorCount != 0 && actionFrame->anchors[0].unknown_0008 == body->anchors[0].unknown_0008) { point.x += body->anchors[0].x - actionFrame->anchors[0].x; point.y += body->anchors[0].y - actionFrame->anchors[0].y; diff --git a/Source/UI/Lists/UIScrollBar.cpp b/Source/UI/Lists/UIScrollBar.cpp index 4a7006f08..88989ff28 100644 --- a/Source/UI/Lists/UIScrollBar.cpp +++ b/Source/UI/Lists/UIScrollBar.cpp @@ -407,9 +407,9 @@ void UIScrollBar::Paint() { switch (this->vertical) { case 0: { - const BitmapImage* bitmap = reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll1left.bmp"))); + CBitmapRes* bitmap = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll1left.bmp"))); this->DrawBitmap(1, 0, bitmap, false); - const BitmapImage* middle = reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll1mid.bmp"))); + CBitmapRes* middle = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll1mid.bmp"))); const int interior = this->geometry.width - this->arrowLength - 14; const int count = interior / 13 + (interior % 13 != 0); @@ -419,27 +419,27 @@ void UIScrollBar::Paint() { this->DrawBitmap(this->geometry.width - this->arrowLength - 13, 0, middle, false); this->FillRegion(this->geometry.width - this->arrowLength, 0, 13, this->geometry.height, 0xFFFF00FFu); - bitmap = reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll1right.bmp"))); + bitmap = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll1right.bmp"))); this->DrawBitmap(this->geometry.width - this->arrowLength - 1, 0, bitmap, true); const int thumb = this->arrowLength + this->ThumbOffset(); - bitmap = reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll1bar_left.bmp"))); + bitmap = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll1bar_left.bmp"))); this->DrawBitmap(thumb, 0, bitmap, true); const int end = thumb + this->ThumbLength() - 4; for (int offset = thumb + 4; offset < end; offset += 4) { - bitmap = reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll1bar_mid.bmp"))); + bitmap = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll1bar_mid.bmp"))); this->DrawBitmap(offset, 0, bitmap, true); } - bitmap = reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll1bar_right.bmp"))); + bitmap = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll1bar_right.bmp"))); this->DrawBitmap(end, 0, bitmap, true); break; } case 1: { - const BitmapImage* bitmap = reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll0up.bmp"))); + CBitmapRes* bitmap = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll0up.bmp"))); this->DrawBitmap(0, 1, bitmap, false); - const BitmapImage* middle = reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll0mid.bmp"))); + CBitmapRes* middle = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll0mid.bmp"))); const int interior = this->geometry.height - this->arrowLength - 14; const int count = interior / 13 + (interior % 13 != 0); @@ -449,20 +449,20 @@ void UIScrollBar::Paint() { this->DrawBitmap(0, this->geometry.height - this->arrowLength - 13, middle, false); this->FillRegion(0, this->geometry.height - this->arrowLength, this->geometry.width, 13, 0xFFFF00FFu); - bitmap = reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll0down.bmp"))); + bitmap = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll0down.bmp"))); this->DrawBitmap(0, this->geometry.height - this->arrowLength - 1, bitmap, true); const int thumb = this->arrowLength + this->ThumbOffset(); - bitmap = reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll0bar_up.bmp"))); + bitmap = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll0bar_up.bmp"))); this->DrawBitmap(0, thumb, bitmap, true); const int end = thumb + this->ThumbLength() - 4; for (int offset = thumb + 4; offset < end; offset += 4) { - bitmap = reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll0bar_mid.bmp"))); + bitmap = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll0bar_mid.bmp"))); this->DrawBitmap(0, offset, bitmap, true); } - bitmap = reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll0bar_down.bmp"))); + bitmap = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\scroll0bar_down.bmp"))); this->DrawBitmap(0, end, bitmap, true); break; } diff --git a/Source/UI/Menu/UIMenuIconWnd.cpp b/Source/UI/Menu/UIMenuIconWnd.cpp index 4b4dde230..a5c0f0bf4 100644 --- a/Source/UI/Menu/UIMenuIconWnd.cpp +++ b/Source/UI/Menu/UIMenuIconWnd.cpp @@ -195,7 +195,7 @@ void UIMenuIconWnd::Slot15(int width, int height) { // OFFSET: 0x0084B940 // FUNCTION: fn_10617 void UIMenuIconWnd::Paint() { - this->m_children.clear(); + this->m_primitives.clear(); this->unknown_00CC->Enable(0); this->unknown_00D0->Enable(0); this->unknown_00D4->Enable(0); diff --git a/Source/UI/Party/UIMiniPartyWnd.cpp b/Source/UI/Party/UIMiniPartyWnd.cpp index a2e33b73d..7cb649685 100644 --- a/Source/UI/Party/UIMiniPartyWnd.cpp +++ b/Source/UI/Party/UIMiniPartyWnd.cpp @@ -7,6 +7,7 @@ #include "Contents/World/World.h" #include "File/ShortcutFilename.h" #include "Render/Renderer.h" +#include "Resource/Bitmap/BitmapResource.h" #include "UI/Buttons/UITextButton.h" #include "Client/Session.h" #include "Contents/MessageTable.h" @@ -538,18 +539,18 @@ void UIMiniPartyInfoWnd::Paint() { std::sprintf(path, dead ? "%sicon_jobs_%d_die.bmp" : "%sicon_jobs_%d.bmp", directory.c_str(), job); CRes* icon = ResourceMgr::Instance().Load(Resolve(path)); if (this->m_owner->GetMember().offline == 1) { - this->DrawAuxiliary(1, 7, leader == 0 ? 8 : 6, reinterpret_cast(icon), true, false); + this->DrawAuxiliary(1, 7, leader == 0 ? 8 : 6, icon ? &static_cast(icon)->image : nullptr, true, false); } else { - this->DrawBitmap(7, leader == 0 ? 8 : 6, reinterpret_cast(icon), true); + this->DrawBitmap(7, leader == 0 ? 8 : 6, static_cast(icon), true); } if (this->m_owner->GetMember().leader == 0) { std::sprintf(path, "%sico_partyCrown.bmp", directory.c_str()); CRes* crown = ResourceMgr::Instance().Load(Resolve(path)); if (this->m_owner->GetMember().offline == 1) { - this->DrawAuxiliary(1, 9, 0, reinterpret_cast(crown), true, false); + this->DrawAuxiliary(1, 9, 0, crown ? &static_cast(crown)->image : nullptr, true, false); } else { - this->DrawBitmap(9, 0, reinterpret_cast(crown), true); + this->DrawBitmap(9, 0, static_cast(crown), true); } } diff --git a/Source/UI/Party/UIRequestJoinPartyWnd.cpp b/Source/UI/Party/UIRequestJoinPartyWnd.cpp index d89410dd0..dae739792 100644 --- a/Source/UI/Party/UIRequestJoinPartyWnd.cpp +++ b/Source/UI/Party/UIRequestJoinPartyWnd.cpp @@ -89,7 +89,7 @@ void UIRequestJoinPartyWnd::Slot15(int, int) { // OFFSET: 0x007BFC20 // FUNCTION: fn_09306 void UIRequestJoinPartyWnd::Paint() { - this->DrawBitmap(0, 0, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\UIadventurerAgency\\bg_agency_admit.bmp"))), false); + this->DrawBitmap(0, 0, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\UIadventurerAgency\\bg_agency_admit.bmp"))), false); this->DrawTitleBar(true, LookupMessage(3505), 0); } diff --git a/Source/UI/ProbabilityTable/UIProbabilityTable.cpp b/Source/UI/ProbabilityTable/UIProbabilityTable.cpp index 8a96bce46..b5886568e 100644 --- a/Source/UI/ProbabilityTable/UIProbabilityTable.cpp +++ b/Source/UI/ProbabilityTable/UIProbabilityTable.cpp @@ -12,6 +12,7 @@ #include "Utility/Cipher/XorBytes.h" #include "Utility/Text/FormatString.h" #include "Utility/Text/StringUtil.h" +#include "UI/Window/UIRegisterMgr.h" #include #include @@ -177,6 +178,14 @@ CUIProbabilityTable* CreateProbabilityTable() { return new CUIProbabilityTable(); } +// OFFSET: 0x00496610 +// FUNCTION: fn_45551 +static bool s_registered = [] { + std::function factory = CreateProbabilityTable; + Singleton::GetInstance()->Register(10012, factory); + return true; +}(); + // OFFSET: 0x00A48740 // FUNCTION: fn_16115 template <> diff --git a/Source/UI/Quest/UIOngoingQuestInfo.cpp b/Source/UI/Quest/UIOngoingQuestInfo.cpp index 307a88545..01a026770 100644 --- a/Source/UI/Quest/UIOngoingQuestInfo.cpp +++ b/Source/UI/Quest/UIOngoingQuestInfo.cpp @@ -14,6 +14,7 @@ #include "UI/Quest/UIRenewQuestWnd.h" #include "UI/Text/UIStaticTextControl.h" #include "UI/Text/UITextViewerControl.h" +#include "UI/Window/UIRegisterMgr.h" #include "UI/Window/UIWindowMgr.h" #include "Utility/Text/FormatString.h" @@ -66,6 +67,14 @@ CUIOngoingQuestInfo* CreateOngoingQuestInfo() { return new CUIOngoingQuestInfo(); } +// OFFSET: 0x00497950 +// FUNCTION: fn_45552 +static bool s_registered = [] { + std::function factory = CreateOngoingQuestInfo; + Singleton::GetInstance()->Register(10009, factory); + return true; +}(); + // OFFSET: 0x00A4FDE0 // FUNCTION: fn_16223 template <> diff --git a/Source/UI/Quest/UIRecommendedQuestInfo.cpp b/Source/UI/Quest/UIRecommendedQuestInfo.cpp index f1b72d8d2..57f24875a 100644 --- a/Source/UI/Quest/UIRecommendedQuestInfo.cpp +++ b/Source/UI/Quest/UIRecommendedQuestInfo.cpp @@ -5,6 +5,7 @@ #include "Render/Renderer.h" #include "UI/Quest/UIRenewQuestWnd.h" #include "UI/Text/UIStaticTextControl.h" +#include "UI/Window/UIRegisterMgr.h" #include "UI/Window/UIWindowMgr.h" #include @@ -250,6 +251,14 @@ CUIFrameWnd* CreateRecommendedQuestInfo() { return new CUIRecommendedQuestInfo(); } +// OFFSET: 0x004985B0 +// FUNCTION: fn_45553 +static bool s_registered = [] { + std::function factory = CreateRecommendedQuestInfo; + Singleton::GetInstance()->Register(10010, factory); + return true; +}(); + // OFFSET: 0x00A58E00 // FUNCTION: fn_16351 void CUIRecommendedQuestInfo::SetQuest(unsigned int questId) { diff --git a/Source/UI/Quest/UIRenewQuestUI.cpp b/Source/UI/Quest/UIRenewQuestUI.cpp index 2b9932abf..c2c23b0ce 100644 --- a/Source/UI/Quest/UIRenewQuestUI.cpp +++ b/Source/UI/Quest/UIRenewQuestUI.cpp @@ -16,6 +16,7 @@ #include "UI/Text/UIStaticTextControl.h" #include "UI/Window/UIWindowMgr.h" #include "Utility/Cipher/XorBytes.h" +#include "UI/Window/UIRegisterMgr.h" #include #include @@ -1292,6 +1293,14 @@ CUIFrameWnd* CreateRenewQuestUI() { return new CUIRenewQuestUI(); } +// OFFSET: 0x00499210 +// FUNCTION: fn_45554 +static bool s_registered = [] { + std::function factory = CreateRenewQuestUI; + Singleton::GetInstance()->Register(10008, factory); + return true; +}(); + // OFFSET: 0x00A5C590 // FUNCTION: fn_16434 void RenewQuestUI::CUIQuestItem::Slot15(int width, int height) { diff --git a/Source/UI/Rodex/UIRodexInboxWnd.cpp b/Source/UI/Rodex/UIRodexInboxWnd.cpp index 8391a9c86..0842eb5dc 100644 --- a/Source/UI/Rodex/UIRodexInboxWnd.cpp +++ b/Source/UI/Rodex/UIRodexInboxWnd.cpp @@ -92,15 +92,15 @@ void UIRodexInboxWnd::Slot25(int x, int y) { // OFFSET: 0x00807660 // FUNCTION: fn_10050 -void UIRodexInboxWnd::Slot26(int, int) {} +void UIRodexInboxWnd::Slot28(int, int) {} // OFFSET: 0x00807670 // FUNCTION: fn_10051 -void UIRodexInboxWnd::Nullsub257() {} +void UIRodexInboxWnd::Slot19() {} // OFFSET: 0x00807680 // FUNCTION: fn_10052 -void UIRodexInboxWnd::Slot28(int, int) {} +void UIRodexInboxWnd::Slot32(int, int) {} // OFFSET: 0x00805750 // FUNCTION: fn_10045 @@ -391,13 +391,13 @@ void UIRodexInboxWnd::Slot15(int width, int height) { // FUNCTION: fn_10048 void UIRodexInboxWnd::Paint() { this->ClearSurface(0xFF00FF); - this->DrawBitmap(0, 0, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\rodexsystem\\renewal\\bg_rodex_list.bmp"))), false); + this->DrawBitmap(0, 0, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\rodexsystem\\renewal\\bg_rodex_list.bmp"))), false); for (int i = 0; i < 6; ++i) { this->unknown_01A8[i]->Enable(0); } if (!g_rodexMailStore->unknown_001C) { - this->DrawBitmap(0x1F, 0x9A, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\rodexsystem\\renewal\\img_notice.bmp"))), true); + this->DrawBitmap(0x1F, 0x9A, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\basic_interface\\rodexsystem\\renewal\\img_notice.bmp"))), true); this->DrawWrappedFormattedText(0x1F, 0xE5, std::string(LookupMessage(0xC76)), 0xF8, 3, 6, 0, 12, 0, 0); this->DrawCenteredText(0x1F, 0x10E, LookupMessage(0xC77), 0xF8, 0, 0x12, 0xC89482, 1); return; diff --git a/Source/UI/Rodex/UIRodexInboxWnd.h b/Source/UI/Rodex/UIRodexInboxWnd.h index 37732316f..17a10c22d 100644 --- a/Source/UI/Rodex/UIRodexInboxWnd.h +++ b/Source/UI/Rodex/UIRodexInboxWnd.h @@ -47,10 +47,10 @@ public: void Slot15(int width, int height) override; void Paint() override; void Slot25(int x, int y) override; - void Slot26(int x, int y) override; - void Nullsub257(); - void Slot28(int x, int y) override; + void Slot19() override; + + void Slot32(int x, int y) override; int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override; void DrawMailIcons(int row, unsigned char attachments, unsigned char read, unsigned char returned); diff --git a/Source/UI/RuneSystem/UIRuneSystemWnd.cpp b/Source/UI/RuneSystem/UIRuneSystemWnd.cpp index 62a6605ad..9ad05a073 100644 --- a/Source/UI/RuneSystem/UIRuneSystemWnd.cpp +++ b/Source/UI/RuneSystem/UIRuneSystemWnd.cpp @@ -1986,29 +1986,29 @@ void UIRuneSet_Info::Slot15(int, int) { // FUNCTION: fn_10182 void UIRuneSet_Info::Paint() { if (!this->m_runeSet) { - this->DrawBitmap(0, 0, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_main.bmp"))), true); - this->DrawBitmap(0xF4, 0xB7, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_runeset.bmp"))), true); + this->DrawBitmap(0, 0, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_main.bmp"))), true); + this->DrawBitmap(0xF4, 0xB7, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_runeset.bmp"))), true); return; } - this->DrawBitmap(0, 0, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_runeset_center.bmp"))), true); + this->DrawBitmap(0, 0, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_runeset_center.bmp"))), true); std::string path = FormatOwnedString("유저인터페이스\\runesystem\\runeset\\%s.bmp", this->m_runeSet->GetResName()); CBitmapRes* runeSetBitmap = static_cast(ResourceMgr::Instance().Load(Resolve(path.c_str()))); if (this->m_runeSet->IsActive()) { - this->DrawBitmap(0x76, 0xBF, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_runeset.bmp"))), true); - this->DrawBitmap(0x76, 0xBF, reinterpret_cast(runeSetBitmap), true); + this->DrawBitmap(0x76, 0xBF, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_runeset.bmp"))), true); + this->DrawBitmap(0x76, 0xBF, static_cast(runeSetBitmap), true); for (int slot = 0; slot < 6; ++slot) { if (!this->m_runeSet->m_slots[slot]) { this->DrawBitmap( g_runeSetSlotX[slot] - 3, g_runeSetSlotY[slot] - 3, - reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\rune_empty.bmp"))), true + static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\rune_empty.bmp"))), true ); continue; } this->DrawBitmap( g_runeSetSlotX[slot] - 3, g_runeSetSlotY[slot] - 3, - reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\rune_edge.bmp"))), true + static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\rune_edge.bmp"))), true ); path = FormatOwnedString("유저인터페이스\\runesystem\\rune\\%s.bmp", this->m_runeSet->m_slots[slot]->GetResName()); CTexture* texture = g_texMgr.Load(path.c_str(), 0, false, true, false); @@ -2023,22 +2023,22 @@ void UIRuneSet_Info::Paint() { } } } else { - this->DrawBitmap(0x76, 0x95, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_runeset.bmp"))), true); - this->DrawBitmap(0x76, 0x95, reinterpret_cast(runeSetBitmap), true); + this->DrawBitmap(0x76, 0x95, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_runeset.bmp"))), true); + this->DrawBitmap(0x76, 0x95, static_cast(runeSetBitmap), true); } const std::uint32_t tab = this->m_tab->geometry.unknown_0030; if (tab == 0) { this->DrawBitmap( - 0x179, 0, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_runeset_desc_title.bmp"))), true + 0x179, 0, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_runeset_desc_title.bmp"))), true ); this->DrawBitmap( 0x179, this->geometry.height - 0x48, - reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_runeset_desc_down.bmp"))), true + static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_runeset_desc_down.bmp"))), true ); } else if (tab == 1) { this->DrawBitmap( - 0x179, 0, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_runeset_reward.bmp"))), true + 0x179, 0, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_runeset_reward.bmp"))), true ); if (this->m_runeSet->m_reward.values[0] == 1) { const int rewardX[7] = {0, 417, 505, 559, 559, 505, 417}; @@ -2061,14 +2061,14 @@ void UIRuneSet_Info::Paint() { g_session.IconPath(iconPath, item.itemId.c_str(), 1); CBitmapRes* icon = static_cast(ResourceMgr::Instance().Load(Resolve(iconPath))); if (icon) { - this->DrawBitmap(rewardX[index], rewardY[index], reinterpret_cast(icon), true); + this->DrawBitmap(rewardX[index], rewardY[index], static_cast(icon), true); } } item.SetItemId(static_cast(this->m_runeSet->m_reward.values[7])); const char* resource = ItemResourcePath(item); const std::string collection = std::format("유저인터페이스\\collection\\{}.bmp", resource); - this->DrawBitmap(0x188, 0xE1, reinterpret_cast(ResourceMgr::Instance().Load(Resolve(collection.c_str()))), true); + this->DrawBitmap(0x188, 0xE1, static_cast(ResourceMgr::Instance().Load(Resolve(collection.c_str()))), true); if (this->m_runeSet->m_reward.values[0] != 0) { this->DrawTextAt(0x1BC, 0x30, LookupMessage(4203), 0, 0, 13, 0xFFF0E1, 1, 0); this->DrawTextAt(0x1BC, 0x31, LookupMessage(4203), 0, 0, 13, 0x864D43, 1, 0); @@ -2076,7 +2076,7 @@ void UIRuneSet_Info::Paint() { } } else { this->DrawBitmap( - 0x179, 0, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_runeset_upgrade.bmp"))), true + 0x179, 0, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_runeset_upgrade.bmp"))), true ); if (this->m_runeSet->m_grade < 15) { path = FormatOwnedString(LookupMessage(4045), static_cast(static_cast(g_runeSystemMgr->GetGradeFailValue(this->m_runeSet)) * 0.001f)); @@ -2108,14 +2108,14 @@ void UIRuneSet_Info::Paint() { // OFFSET: 0x0081AF10 // FUNCTION: fn_10191 void UIRune_Decom::Paint() { - this->DrawBitmap(0, 0, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_main.bmp"))), true); - this->DrawBitmap(0xDD, 0x8E, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\rune_edge_big.bmp"))), true); + this->DrawBitmap(0, 0, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_main.bmp"))), true); + this->DrawBitmap(0xDD, 0x8E, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\rune_edge_big.bmp"))), true); if (!this->m_decomList || this->unknown_0094.empty()) { return; } - this->DrawBitmap(0, 0, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_main.bmp"))), true); - this->DrawBitmap(0xDD, 0x47, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\rune_edge_big.bmp"))), true); + this->DrawBitmap(0, 0, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_main.bmp"))), true); + this->DrawBitmap(0xDD, 0x47, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\rune_edge_big.bmp"))), true); CTexture* texture = g_texMgr.Load(this->unknown_0094.c_str(), 0, false, true, false); if (texture) { const float scale = 180.0f / static_cast(texture->Width()); @@ -2129,13 +2129,13 @@ void UIRune_Decom::Paint() { this->DrawTextAt(nameX - 1, 0x1A, this->unknown_007C.c_str(), 0, 0, 13, 0x864D43, 1, 0); } - this->DrawBitmap(200, 0x149, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_radio2.bmp"))), true); + this->DrawBitmap(200, 0x149, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\bg_radio2.bmp"))), true); unsigned int rowIndex = 0; for (int y = 0x177; y < 0x1E3; y += 0x36, rowIndex += 4) { unsigned int index = rowIndex; for (int x = 0xD8; x < 0x1B0; x += 0x36, ++index) { this->DrawBitmap( - x - 1, y - 6, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\iconslot_yellow.bmp"))), true + x - 1, y - 6, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\runesystem\\iconslot_yellow.bmp"))), true ); if (index >= this->m_decomList->size()) { continue; @@ -2152,7 +2152,7 @@ void UIRune_Decom::Paint() { icon = static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\item\\사과.bmp"))); } if (icon) { - this->DrawBitmap(x + 7, y, reinterpret_cast(icon), true); + this->DrawBitmap(x + 7, y, static_cast(icon), true); } const int percent = (*this->m_decomList)[index].m_percent; diff --git a/Source/UI/SelectPackageItemBox/UISelectPackageItemBox.cpp b/Source/UI/SelectPackageItemBox/UISelectPackageItemBox.cpp index 920659b20..3a2d2e4c5 100644 --- a/Source/UI/SelectPackageItemBox/UISelectPackageItemBox.cpp +++ b/Source/UI/SelectPackageItemBox/UISelectPackageItemBox.cpp @@ -14,6 +14,7 @@ #include "UI/Window/UIWindowMgr.h" #include "Utility/Cipher/XorBytes.h" #include "Utility/Text/FormatString.h" +#include "UI/Window/UIRegisterMgr.h" #include #include #include @@ -1364,6 +1365,14 @@ CUIFrameWnd* CreateSelectPackageItemBox() { return new CUISelectPackageItemBox(); } +// OFFSET: 0x0049B670 +// FUNCTION: fn_45555 +static bool s_registered = [] { + std::function factory = CreateSelectPackageItemBox; + Singleton::GetInstance()->Register(10033, factory); + return true; +}(); + // OFFSET: 0x00A6F470 // FUNCTION: fn_16772 CUISelectPackageItemBox::CUISelectPackageItemBox() diff --git a/Source/UI/Shop/UIMerchantItemShopWnd.h b/Source/UI/Shop/UIMerchantItemShopWnd.h index f68ac7812..321f44e8a 100644 --- a/Source/UI/Shop/UIMerchantItemShopWnd.h +++ b/Source/UI/Shop/UIMerchantItemShopWnd.h @@ -13,7 +13,7 @@ class UIStaticText; class UIMerchantItemShopWnd : public UIItemBaseWnd { public: UIMerchantItemShopWnd(int value); - std::vector BuildReplayRecords(); + std::vector Slot44() override; void Slot11() override; void Slot19() override; void Slot10(int x, int y, std::intptr_t value) override; diff --git a/Source/UI/Shop/UIMerchantMirrorItemWnd.h b/Source/UI/Shop/UIMerchantMirrorItemWnd.h index 0dcf3be73..b6bf4ed8b 100644 --- a/Source/UI/Shop/UIMerchantMirrorItemWnd.h +++ b/Source/UI/Shop/UIMerchantMirrorItemWnd.h @@ -9,7 +9,7 @@ class UIMerchantMirrorItemWnd : public UIItemBaseWnd { public: - std::vector BuildReplayRecords(); + std::vector Slot44() override; UIMerchantMirrorItemWnd(int value); void Slot28(int x, int y) override; void Slot32(int x, int y) override; diff --git a/Source/UI/Shop/UIMerchantShopMakeWnd.h b/Source/UI/Shop/UIMerchantShopMakeWnd.h index 4e3111a70..d6810e6b3 100644 --- a/Source/UI/Shop/UIMerchantShopMakeWnd.h +++ b/Source/UI/Shop/UIMerchantShopMakeWnd.h @@ -17,7 +17,7 @@ class UIEditCtrl; class UIMerchantShopMakeWnd : public UIFrameWnd { public: explicit UIMerchantShopMakeWnd(int mode); - std::vector BuildReplayRecords(); + std::vector Slot44() override; void Slot11() override; void Slot15(int width, int height) override; void Slot19() override; diff --git a/Source/UI/SkillDelayInfo/UISkillDelayInfo.cpp b/Source/UI/SkillDelayInfo/UISkillDelayInfo.cpp index 2d716aead..d3ab4b008 100644 --- a/Source/UI/SkillDelayInfo/UISkillDelayInfo.cpp +++ b/Source/UI/SkillDelayInfo/UISkillDelayInfo.cpp @@ -9,6 +9,7 @@ #include "UI/Text/UIStaticTextControl.h" #include "UI/Text/UITextViewerControl.h" #include "UI/Window/WindowBorder.h" +#include "UI/Window/UIRegisterMgr.h" #include "UI/Window/UIWindowMgr.h" #include #include @@ -108,6 +109,14 @@ CUISkillDelayInfo* CreateSkillDelayInfo() { return new CUISkillDelayInfo(); } +// OFFSET: 0x0049C2D0 +// FUNCTION: fn_45556 +static bool s_registered = [] { + std::function factory = CreateSkillDelayInfo; + Singleton::GetInstance()->Register(10030, factory); + return true; +}(); + // OFFSET: 0x00A71950 // FUNCTION: fn_16806 template <> diff --git a/Source/UI/StylingShop/UIStylingShopWnd.cpp b/Source/UI/StylingShop/UIStylingShopWnd.cpp index e6927dc68..3f9ab3c5f 100644 --- a/Source/UI/StylingShop/UIStylingShopWnd.cpp +++ b/Source/UI/StylingShop/UIStylingShopWnd.cpp @@ -1952,7 +1952,7 @@ bool UIShowInfoWnd::SendStyleChange() { // OFFSET: 0x00825CA0 // FUNCTION: fn_10321 -void UIAccessoryShowCase::Slot15(int, int) { +void UIAccessoryShowCase::LoadAccessories(int, int) { int loaded = 0; int skipped = 0; int count = 0; diff --git a/Source/UI/StylingShop/UIStylingShopWnd.h b/Source/UI/StylingShop/UIStylingShopWnd.h index ca4b35e70..370f6b5eb 100644 --- a/Source/UI/StylingShop/UIStylingShopWnd.h +++ b/Source/UI/StylingShop/UIStylingShopWnd.h @@ -165,9 +165,9 @@ class UIAccessoryShowCase : public UIScrollWnd { public: // INLINED UIAccessoryShowCase(int width, int height) : UIScrollWnd(width, height, 0), m_itemFrames() { - this->Slot15(width, height); + this->LoadAccessories(width, height); } - void Slot15(int width, int height) override; + void LoadAccessories(int width, int height); void AddAccessories(int& loaded, int& skipped, const char* table, const int& count, const int& slot); void Paint() override; int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override; diff --git a/Source/UI/UIBartermarketWnd.cpp b/Source/UI/UIBartermarketWnd.cpp index 7a9c250df..cabc0f353 100644 --- a/Source/UI/UIBartermarketWnd.cpp +++ b/Source/UI/UIBartermarketWnd.cpp @@ -1799,7 +1799,7 @@ void UIBartermarketWnd::Paint() { // OFFSET: 0x008473F0 // FUNCTION: fn_10585 -void UIExpandedBartermarketWnd::Paint() { +void UIExpandedBarterItemPurchaseWnd::Paint() { this->DrawTitleBar(false, LookupMessage(0xE69), 0); const int borderHeight = this->geometry.height - 46; @@ -1885,7 +1885,7 @@ void UIExpandedBartermarketWnd::Paint() { // OFFSET: 0x00847AA0 // FUNCTION: fn_10586 -void UIExpandedBarterItemPurchaseWnd::Paint() { +void UIExpandedBartermarketWnd::Paint() { this->DrawTitleBar(false, LookupMessage(0xBA), 0); const int borderHeight = this->geometry.height - 46; diff --git a/Source/UI/UIChangeMaterialWnd.cpp b/Source/UI/UIChangeMaterialWnd.cpp index 909258ac9..2853f5a5b 100644 --- a/Source/UI/UIChangeMaterialWnd.cpp +++ b/Source/UI/UIChangeMaterialWnd.cpp @@ -79,7 +79,7 @@ UIChangeMaterialWnd_ScrollBar::UIChangeMaterialWnd_ScrollBar() : UIScrollBar() { // OFFSET: 0x005E1B30 // FUNCTION: fn_03877 -void UIChangeMaterialWnd_List::CreateScrollBar(int width, int height) { +void UIChangeMaterialWnd_List::Slot15(int width, int height) { this->m_scrollBar = new UIChangeMaterialWnd_ScrollBar(); this->m_scrollBar->Configure(width - this->unknown_00B8, 0, 1, height); this->m_scrollBar->Show(0); @@ -148,7 +148,7 @@ void UIChangeMaterialWnd_List::Move(int x, int y) { // OFFSET: 0x005E2590 // FUNCTION: fn_03883 -void UIChangeMaterialWnd_List::SelectItemAtPosition(int, int position) { +void UIChangeMaterialWnd_List::Slot31(int, int position) { const int rowHeight = this->unknown_00B4; const unsigned int last = static_cast(this->m_items.size() - 1); unsigned int index = static_cast(position / rowHeight + this->m_scrollOffset); @@ -180,7 +180,7 @@ void UIChangeMaterialWnd_List::Slot27(int x, int y) { // OFFSET: 0x005E2850 // FUNCTION: fn_03887 -void UIChangeMaterialWnd::UpdateSearchPlaceholder() { +void UIChangeMaterialWnd::Slot19() { const std::string text = this->unknown_00B8->Text(); if (text.compare(LookupMessage(0xec0)) != 0) { if (text.empty()) { @@ -194,7 +194,7 @@ void UIChangeMaterialWnd::UpdateSearchPlaceholder() { // OFFSET: 0x005E29F0 // FUNCTION: fn_03888 -void UIChangeMaterialWnd::Slot32(int x, int y) { +void UIChangeMaterialWnd::Slot33(int x, int y) { ITEM_INFO* item = this->GetItemAt(x, y); if (!item) { return; @@ -566,7 +566,7 @@ void UIChangeMaterialWnd_List::Paint() { const int rowHeight = this->unknown_00B4; if (!entry) { CRes* disabled = ResourceMgr::Instance().Load(Resolve("유저인터페이스\\ChangeMaterial\\btn_material_disable.bmp")); - this->DrawBitmap(0, rowHeight * row, reinterpret_cast(disabled), true); + this->DrawBitmap(0, rowHeight * row, static_cast(disabled), true); continue; } @@ -580,7 +580,7 @@ void UIChangeMaterialWnd_List::Paint() { } CRes* background = ResourceMgr::Instance().Load(Resolve(bitmap)); - this->DrawBitmap(0, rowHeight * row, reinterpret_cast(background), true); + this->DrawBitmap(0, rowHeight * row, static_cast(background), true); ITEM_INFO item; item.SetItemId(entry->results[0].id); diff --git a/Source/UI/UIChangeMaterialWnd.h b/Source/UI/UIChangeMaterialWnd.h index 910776c70..49d135966 100644 --- a/Source/UI/UIChangeMaterialWnd.h +++ b/Source/UI/UIChangeMaterialWnd.h @@ -73,10 +73,10 @@ public: bool Slot02() override; void Paint() override; void Slot28(int x, int y) override; - void Slot32(int x, int y) override; + void Slot33(int x, int y) override; ITEM_INFO* GetItemAt(int x, int y); void SendChangeMaterial(); - void UpdateSearchPlaceholder(); + void Slot19() override; int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override; @@ -99,6 +99,8 @@ public: void Paint() override; void Move(int x, int y) override; + // INLINED + void Slot25(int, int) override {} void Slot28(int x, int y) override; void Slot27(int x, int y) override; void Slot35(int argument) override; @@ -110,10 +112,10 @@ public: void RefreshVisibleEntries(); void UpdateScrollBar(); void SetSelectedIndex(int index); - void SelectItemAtPosition(int unknown, int position); + void Slot31(int unknown, int position) override; void SelectNextItem(int delta); void ShiftSelectedIndex(int value); - void CreateScrollBar(int width, int height); + void Slot15(int width, int height) override; const MaterialListEntry* GetEntry(unsigned int index) const; /* 00B4 */ int unknown_00B4; diff --git a/Source/UI/UICheckAttendanceWnd.cpp b/Source/UI/UICheckAttendanceWnd.cpp index 19331fe49..871c5e07b 100644 --- a/Source/UI/UICheckAttendanceWnd.cpp +++ b/Source/UI/UICheckAttendanceWnd.cpp @@ -222,7 +222,7 @@ void UICheckAttendanceWnd_Banner::Paint() { if (this->m_entries.size() != 0) { this->DrawBitmap( 0, 0, - reinterpret_cast( + static_cast( ResourceMgr::Instance().Load(Resolve(("유저인터페이스\\check_attendance\\" + this->m_entries[this->m_current].image).c_str())) ), false diff --git a/Source/UI/UIGradeEnchantWnd.cpp b/Source/UI/UIGradeEnchantWnd.cpp index f700d6564..247721a15 100644 --- a/Source/UI/UIGradeEnchantWnd.cpp +++ b/Source/UI/UIGradeEnchantWnd.cpp @@ -215,16 +215,16 @@ void UIGradeEnchantWnd::Slot15(int, int) { // FUNCTION: fn_09754 void UIGradeEnchantWnd::Paint() { this->ClearSurface(0xFFFF00FF); - this->DrawBitmap(0, 0, reinterpret_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\grade_enchant\\bg_grade_enchant.bmp"))), false); + this->DrawBitmap(0, 0, static_cast(ResourceMgr::Instance().Load(Resolve("유저인터페이스\\grade_enchant\\bg_grade_enchant.bmp"))), false); - this->DrawBitmap(158, 142, reinterpret_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\btn_material.bmp").c_str()))), false); - this->DrawBitmap(158, 182, reinterpret_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\btn_material.bmp").c_str()))), false); - this->DrawBitmap(158, 102, reinterpret_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\btn_material.bmp").c_str()))), false); + this->DrawBitmap(158, 142, static_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\btn_material.bmp").c_str()))), false); + this->DrawBitmap(158, 182, static_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\btn_material.bmp").c_str()))), false); + this->DrawBitmap(158, 102, static_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\btn_material.bmp").c_str()))), false); if (this->state == 0) { - this->DrawBitmap(152, 46, reinterpret_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\caution.bmp").c_str()))), true); - this->DrawBitmap(152, 62, reinterpret_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\caution.bmp").c_str()))), true); - this->DrawBitmap(152, 78, reinterpret_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\caution.bmp").c_str()))), true); + this->DrawBitmap(152, 46, static_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\caution.bmp").c_str()))), true); + this->DrawBitmap(152, 62, static_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\caution.bmp").c_str()))), true); + this->DrawBitmap(152, 78, static_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\caution.bmp").c_str()))), true); this->DrawAlignedText(166, 46, LookupMessage(3870), 228, 0, 0x00A0ADC, 0, 0, 11, 1, 0); this->DrawAlignedText(166, 62, LookupMessage(3871), 228, 0, 0x5AEB00, 0, 0, 11, 1, 0); @@ -232,15 +232,15 @@ void UIGradeEnchantWnd::Paint() { } if (this->state == 1 || this->state == 2) { - this->DrawBitmap(192, 225, reinterpret_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\btn_unbroken.bmp").c_str()))), false); - this->DrawBitmap(24, 54, reinterpret_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\bg_gradeitem%d.bmp", this->unknown_00D8).c_str()))), false); + this->DrawBitmap(192, 225, static_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\btn_unbroken.bmp").c_str()))), false); + this->DrawBitmap(24, 54, static_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\bg_gradeitem%d.bmp", this->unknown_00D8).c_str()))), false); if (this->hoverMaterial >= 0 && this->hoverMaterial != this->selectedMaterial) { - this->DrawBitmap(158, this->hoverMaterial * 40 + 102, reinterpret_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\btn_material_over.bmp").c_str()))), false); + this->DrawBitmap(158, this->hoverMaterial * 40 + 102, static_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\btn_material_over.bmp").c_str()))), false); } if (this->selectedMaterial >= 0) { - this->DrawBitmap(158, this->selectedMaterial * 40 + 102, reinterpret_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\btn_material_pick.bmp").c_str()))), false); + this->DrawBitmap(158, this->selectedMaterial * 40 + 102, static_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\btn_material_pick.bmp").c_str()))), false); } char description[260]; @@ -273,7 +273,7 @@ void UIGradeEnchantWnd::Paint() { for (int i = 0; i < 3; ++i) { if (i < count) { const int itemY = 46 + i * 16; - this->DrawBitmap(152, itemY, reinterpret_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\caution.bmp").c_str()))), true); + this->DrawBitmap(152, itemY, static_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\caution.bmp").c_str()))), true); const int msgId = this->unknown_011C[i]; if (msgId == 3711 || msgId == 3822) { this->DrawAlignedText(166, itemY, LookupMessage(msgId), 228, 0, 0x5AEB00, 0, 0, 11, 1, 0); @@ -288,15 +288,15 @@ void UIGradeEnchantWnd::Paint() { } if (this->state == 2) { - this->DrawBitmap(56, 268, reinterpret_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\gradewheel%d.bmp", this->unknown_00DC).c_str()))), true); + this->DrawBitmap(56, 268, static_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\gradewheel%d.bmp", this->unknown_00DC).c_str()))), true); } else { - this->DrawBitmap(56, 268, reinterpret_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\gradewheel%d.bmp", 1).c_str()))), true); + this->DrawBitmap(56, 268, static_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\gradewheel%d.bmp", 1).c_str()))), true); } if (this->item.unknown_0000[1] > 0) { DrawItemIcon(*this, ResourceMgr::Instance(), 64, 125, this->item, 0); if (this->item.unknown_0088 > 0) { - this->DrawBitmap(64, 137, reinterpret_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\grade_icon%d.bmp", this->item.unknown_0088).c_str()))), true); + this->DrawBitmap(64, 137, static_cast(ResourceMgr::Instance().Load(Resolve(FormatOwnedString("유저인터페이스\\grade_enchant\\grade_icon%d.bmp", this->item.unknown_0088).c_str()))), true); } } diff --git a/Source/UI/UIIngredientInfoWnd.h b/Source/UI/UIIngredientInfoWnd.h index 51fb64548..74b377246 100644 --- a/Source/UI/UIIngredientInfoWnd.h +++ b/Source/UI/UIIngredientInfoWnd.h @@ -25,7 +25,7 @@ public: void Slot32(int x, int y) override; void Slot35(int argument) override; void Paint() override; - void Click(int button, int unused); + void Slot26(int button, int unused) override; void SetIngredientItem(std::uint32_t id); /* 00B8 */ ITEM_INFO item; diff --git a/Source/UI/UIItemReformWnd.h b/Source/UI/UIItemReformWnd.h index 6792a5979..4a5fa06c9 100644 --- a/Source/UI/UIItemReformWnd.h +++ b/Source/UI/UIItemReformWnd.h @@ -18,6 +18,10 @@ public: void Move(int x, int y) override; void Slot15(int width, int height) override; void Paint() override; + // INLINED + void Slot25(int, int) override {} + // INLINED + void Slot27(int, int) override {} void Slot28(int x, int y) override; void Slot31(int x, int y) override; void Slot33(int x, int y) override; diff --git a/Source/UI/UILapineBoxWnd.cpp b/Source/UI/UILapineBoxWnd.cpp index f419ead4b..24a12157d 100644 --- a/Source/UI/UILapineBoxWnd.cpp +++ b/Source/UI/UILapineBoxWnd.cpp @@ -43,7 +43,7 @@ UILapineBoxWnd::UILapineBoxWnd() // OFFSET: 0x006006D0 // FUNCTION: fn_04160 -void UIIngredientInfoWnd::Click(int, int) { +void UIIngredientInfoWnd::Slot26(int, int) { if (this->insufficient == 1) { static_cast(this->parent)->CanUseIngredient(this->item.unknown_0000[1]); return; @@ -99,7 +99,7 @@ void UIIngredientInfoWnd::Slot28(int x, int y) { // OFFSET: 0x00600770 // FUNCTION: fn_04161 -void UILapineBoxWnd::DropMaterial(int x, int y) { +void UILapineBoxWnd::Slot26(int x, int y) { alignas(ITEM_INFO) unsigned char storage[sizeof(ITEM_INFO)]; ITEM_INFO& item = *reinterpret_cast(storage); this->ReadMaterial(&item, x, y); @@ -115,7 +115,7 @@ void UILapineBoxWnd::DropMaterial(int x, int y) { // OFFSET: 0x00600870 // FUNCTION: fn_04163 -void UILapineBoxWnd::DragIngredient(int x, int y) { +void UILapineBoxWnd::Slot25(int x, int y) { if (y < 0x11) { UIFrameWnd::Slot25(x, y); } @@ -299,7 +299,7 @@ void UILapineBoxWnd::SetWaiting(unsigned char waiting) { // OFFSET: 0x00600C40 // FUNCTION: fn_04169 -void UILapineBoxWnd::NotifyWindowAt(int x, int y) { +void UILapineBoxWnd::Slot32(int x, int y) { alignas(ITEM_INFO) unsigned char storage[sizeof(ITEM_INFO)]; ITEM_INFO& item = *reinterpret_cast(storage); this->ReadMaterial(&item, x, y); diff --git a/Source/UI/UILapineScrollBar.h b/Source/UI/UILapineScrollBar.h index 5a4097056..65f814c7a 100644 --- a/Source/UI/UILapineScrollBar.h +++ b/Source/UI/UILapineScrollBar.h @@ -93,10 +93,10 @@ public: void Paint() override; int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override; int AddIngredient(std::uint32_t id, int quantity); - void DropMaterial(int x, int y); - void DragIngredient(int x, int y); + void Slot26(int x, int y) override; + void Slot25(int x, int y) override; void NotifyWindow(int unused, int alsoUnused); - void NotifyWindowAt(int x, int y); + void Slot32(int x, int y) override; void SetIngredient(int id); void AddMaterial(int id, int quantity); __declspec(noinline) void ReadMaterial(ITEM_INFO* out, int x, int y); diff --git a/Source/UI/UIMacroReport.cpp b/Source/UI/UIMacroReport.cpp index 8abe26dd7..4f0e6a087 100644 --- a/Source/UI/UIMacroReport.cpp +++ b/Source/UI/UIMacroReport.cpp @@ -12,6 +12,7 @@ #include "UI/Window/UIControl.h" #include "UI/Window/WindowManagerWindows.h" #include "Utility/Cipher/XorBytes.h" +#include "UI/Window/UIRegisterMgr.h" #include #include @@ -149,6 +150,14 @@ CUIFrameWnd* CreateMacroReport() { return new CUIMacroReport(); } +// OFFSET: 0x004955B0 +// FUNCTION: fn_45550 +static bool s_registered = [] { + std::function factory = CreateMacroReport; + Singleton::GetInstance()->Register(10005, factory); + return true; +}(); + // OFFSET: 0x00A44240 // FUNCTION: fn_16053 void CUIMacroReport::Slot15(int width, int height) { diff --git a/Source/UI/Window/UIHotKeyWnd.cpp b/Source/UI/Window/UIHotKeyWnd.cpp index 86e8b7cf9..fdf085d89 100644 --- a/Source/UI/Window/UIHotKeyWnd.cpp +++ b/Source/UI/Window/UIHotKeyWnd.cpp @@ -304,7 +304,7 @@ UIHotKeyWnd::HotkeyEntry UIHotKeyWnd::GetHotkey(int tab, int index, bool resolve // OFFSET: 0x009317E0 // FUNCTION: fn_12708 -void UIHotKeyWnd::ShowHotkeyTooltip(int x, int y) { +void UIHotKeyWnd::Slot28(int x, int y) { const int index = this->RowFromPoint(x, y); if (index <= -1) { return; diff --git a/Source/UI/Window/UIHotKeyWnd.h b/Source/UI/Window/UIHotKeyWnd.h index 4b25f0ab3..19b2097b9 100644 --- a/Source/UI/Window/UIHotKeyWnd.h +++ b/Source/UI/Window/UIHotKeyWnd.h @@ -30,7 +30,7 @@ public: void SaveHotkeys(); void SetHotkey(int tab, int index, HotkeyInfo info); HotkeyEntry GetHotkey(int tab, int index, bool resolve); - void ShowHotkeyTooltip(int x, int y); + void Slot28(int x, int y) override; void ReloadHotkeys(); bool AssignSelectedHotkey(int mode); int CheckHotkeyConflict(); diff --git a/Source/UI/Window/UIMessageBox.cpp b/Source/UI/Window/UIMessageBox.cpp index e9fbeb8ad..42bad382f 100644 --- a/Source/UI/Window/UIMessageBox.cpp +++ b/Source/UI/Window/UIMessageBox.cpp @@ -159,7 +159,7 @@ UIMakeCharWnd::UIMakeCharWnd() : UIFrameWnd(0), unknown_02C4(0), unknown_02C8(0), unknown_02CC(0), unknown_02D0(0), unknown_02D4(0), unknown_02D8(0) { this->geometry.unknown_0034 = 0; this->m_nameEdit = nullptr; - this->m_info.sex = static_cast(g_doramSex); + this->m_info.sex = static_cast(g_session.m_sex); const int* preset = reinterpret_cast(g_modeMgr.gameMode->SendMsg(10016, 0, 0, 0, 0)); this->m_info.stats[0] = static_cast(preset[0]); @@ -1452,7 +1452,8 @@ void UIPayConfirmWnd::Configure(const std::string& text, int itemId) { std::string resource(FindItemDescription(itemId).identifiedResource); if (!resource.empty()) { - this->m_image = reinterpret_cast(ResourceMgr::Instance().Load(std::format("유저인터페이스\\collection\\{}.bmp", resource))); + CBitmapRes* bitmap = static_cast(ResourceMgr::Instance().Load(std::format("유저인터페이스\\collection\\{}.bmp", resource))); + this->m_image = bitmap ? &bitmap->image : nullptr; } } diff --git a/Source/UI/Window/UIMileageWnd.cpp b/Source/UI/Window/UIMileageWnd.cpp index 389d9086a..f03c7752b 100644 --- a/Source/UI/Window/UIMileageWnd.cpp +++ b/Source/UI/Window/UIMileageWnd.cpp @@ -48,7 +48,7 @@ void UIMileageWnd::Paint() { std::string text; const std::string background = FormatOwnedString("유저인터페이스\\basic_interface\\mileage_bg%d.bmp", this->m_bonus); text = background; - this->DrawBitmap(0, 0, reinterpret_cast(ResourceMgr::Instance().Load(Resolve(text.c_str()))), true); + this->DrawBitmap(0, 0, static_cast(ResourceMgr::Instance().Load(Resolve(text.c_str()))), true); if (this->m_point >= 300) { text = std::string("-- : --"); diff --git a/Source/UI/Window/UINewMakeCharWnd.cpp b/Source/UI/Window/UINewMakeCharWnd.cpp index 9996e4792..41ee8b51c 100644 --- a/Source/UI/Window/UINewMakeCharWnd.cpp +++ b/Source/UI/Window/UINewMakeCharWnd.cpp @@ -63,7 +63,7 @@ UINewMakeCharWnd::UINewMakeCharWnd() this->unknown_0274 = 0; this->unknown_0276 = 0; this->m_costumeJob = 0; - this->m_sex = static_cast(g_doramSex); + this->m_sex = static_cast(g_session.m_sex); this->m_viewX = 500; this->m_viewY = 228; this->unknown_01FC = 0; diff --git a/Source/UI/Window/UINewSelectCharWnd.cpp b/Source/UI/Window/UINewSelectCharWnd.cpp index 4c3ca5080..1a3c35ce9 100644 --- a/Source/UI/Window/UINewSelectCharWnd.cpp +++ b/Source/UI/Window/UINewSelectCharWnd.cpp @@ -37,26 +37,6 @@ #include #include -// GLOBAL: gl_25006 -int g_sub_1319eb4 = 0; - -// GLOBAL: gl_25007 -int g_normalSlotCount; - -// GLOBAL: gl_25008 -int g_premiumSlotCount; - -// GLOBAL: gl_25009 -int g_billingSlotCount; - -// GLOBAL: gl_25010 -int g_producibleSlotCount; - -// GLOBAL: gl_25011 -int g_validSlotCount; - -// GLOBAL: gl_25012 -int g_doramSex; // GLOBAL: gl_25013 char g_selectedSlotIndex; @@ -107,7 +87,7 @@ UINewSelectCharWnd::UINewSelectCharWnd() : UIFrameWnd(0) { this->m_unknown118 = false; this->m_page = 0; this->m_pageSlot = 0; - this->m_totalCharacters = this->m_maxCharacters = g_normalSlotCount + g_premiumSlotCount + g_billingSlotCount; + this->m_totalCharacters = this->m_maxCharacters = g_session.m_normalSlotCount + g_session.m_premiumSlotCount + g_session.m_billingSlotCount; const int slotCount = std::max(static_cast(g_modeMgr.GetLoginMode())->GetMaxCharacterSlot() + 1, this->m_maxCharacters); this->m_pageCount = slotCount / this->m_slotsPerPage; @@ -401,7 +381,7 @@ void UINewSelectCharWnd::Slot15(int width, int height) { } if (character->sex == 'c') { - character->sex = static_cast(g_doramSex); + character->sex = static_cast(g_session.m_sex); } if (g_session.IsListedId(character->job, character->sex) == 1) { @@ -503,17 +483,17 @@ void UINewSelectCharWnd::Paint() { const CharacterInfo* info = reinterpret_cast(g_modeMgr.gameMode->SendMsg(8, slot, 0, 0, 0)); const int column = slot % this->m_slotsPerPage; - if (g_premiumSlotCount > 0 && slot >= g_normalSlotCount && slot < g_normalSlotCount + g_premiumSlotCount) { + if (g_session.m_premiumSlotCount > 0 && slot >= g_session.m_normalSlotCount && slot < g_session.m_normalSlotCount + g_session.m_premiumSlotCount) { this->DrawTextAt(column * 163 + 136, 50, "Premium ", 0, 1, 15, 0xFF, 0, 0); this->DrawTextAt(column * 163 + 142, 63, "Service", 0, 1, 15, 0xFF, 0, 0); - } else if (g_billingSlotCount > 0 && slot >= g_normalSlotCount + g_premiumSlotCount && slot < g_billingSlotCount + g_normalSlotCount + g_premiumSlotCount) { + } else if (g_session.m_billingSlotCount > 0 && slot >= g_session.m_normalSlotCount + g_session.m_premiumSlotCount && slot < g_session.m_billingSlotCount + g_session.m_normalSlotCount + g_session.m_premiumSlotCount) { this->DrawTextAt(column * 163 + 136, 50, "Billing ", 0, 1, 15, 0xFF, 0, 0); this->DrawTextAt(column * 163 + 142, 63, "Service", 0, 1, 15, 0xFF, 0, 0); } if (this->m_slotStatus[slot] == 0 && info) { const CharSlotInfo& slotInfo = this->m_charSlotInfos[slot]; - const int sex = info->sex == 99 ? g_doramSex : info->sex; + const int sex = info->sex == 99 ? static_cast(g_session.m_sex) : info->sex; FuncDrawWNDChar( this, slotInfo.x, slotInfo.y, sex, info->job, info->job, info->unknown_0058, info->head, info->accessory, info->accessory2, info->accessory3, info->robe, 0, 0, info->bodyStyle, info->headPalette, slotInfo.action, slotInfo.frame, this->m_lastTick @@ -529,7 +509,7 @@ void UINewSelectCharWnd::Paint() { } static_cast(this->m_slotButtons2[buttonIndex])->Enable(1); - if (slot >= g_producibleSlotCount ? this->m_slotStatus[slot] == 1 : this->m_slotStatus[slot] == 1 && slot >= g_validSlotCount) { + if (slot >= g_session.m_producibleSlotCount ? this->m_slotStatus[slot] == 1 : this->m_slotStatus[slot] == 1 && slot >= g_session.m_validSlotCount) { auto* button = static_cast(this->m_slotButtons2[buttonIndex]); button->SetDisabled(1); button->Invalidate(); @@ -621,7 +601,7 @@ int UINewSelectCharWnd::SendMsg(UIWindow* sender, int message, std::intptr_t arg } g_session.SetPlayerNameKey(reinterpret_cast(info->name)); - g_session.SetFlag(info->sex == 'c' ? static_cast(g_doramSex) : static_cast(info->sex)); + g_session.SetFlag(info->sex == 'c' ? static_cast(g_session.m_sex) : static_cast(info->sex)); this->m_unknown118 = true; const BlockedCharacterEntry* blocked = reinterpret_cast(&g_session.unknown_07F4[0x40]); for (int index = 0; index < g_session.unknown_59D0; ++index) { @@ -662,7 +642,7 @@ int UINewSelectCharWnd::SendMsg(UIWindow* sender, int message, std::intptr_t arg this->m_pageSlot = argument2; this->SendMsg(this->m_slotButtons2[argument2], 6, 0xCC, 0, 0, 0); } - if (this->m_slotStatus[static_cast(g_selectedSlotIndex)] == 1 && static_cast(g_selectedSlotIndex) < g_producibleSlotCount && + if (this->m_slotStatus[static_cast(g_selectedSlotIndex)] == 1 && static_cast(g_selectedSlotIndex) < g_session.m_producibleSlotCount && g_windowMgr.EnsureWindow(0x116) != nullptr) { g_windowMgr.CloseWindow(0x115); } @@ -793,7 +773,7 @@ int UINewSelectCharWnd::SendMsg(UIWindow* sender, int message, std::intptr_t arg if (this->m_slotStatus[index] == 1) { button->SetSlot(-1, index); this->m_characterWindows[column]->SetText("", 0); - if (index < static_cast(g_producibleSlotCount)) { + if (index < static_cast(g_session.m_producibleSlotCount)) { button->SendMsg(nullptr, 0x1AF, 0, 0, 0, 0); } else { button->SetDisabled(1); @@ -859,7 +839,7 @@ int UINewSelectCharWnd::SendMsg(UIWindow* sender, int message, std::intptr_t arg if (this->m_slotStatus[index] == 1) { button->SetSlot(-1, index); this->m_characterWindows[column]->SetText("", 0); - if (index < static_cast(g_producibleSlotCount)) { + if (index < static_cast(g_session.m_producibleSlotCount)) { button->SendMsg(nullptr, 0x1AF, 0, 0, 0, 0); } else { button->SetDisabled(1); @@ -1168,8 +1148,8 @@ void UINewSelectCharWnd::UpdateSlotButtons() { } static_cast(this->m_slotButtons2[index])->SetSlot(this->m_slotStatus[slot] ? -1 : slot, slot); - if (slot < g_producibleSlotCount && this->m_slotStatus[slot] == 1) { - if (slot < g_validSlotCount) { + if (slot < g_session.m_producibleSlotCount && this->m_slotStatus[slot] == 1) { + if (slot < g_session.m_validSlotCount) { this->m_slotButtons2[index]->SendMsg(nullptr, 431, 0, 0, 0, 0); } else { this->m_slotButtons2[index]->SendMsg(nullptr, 431, 1, 0, 0, 0); diff --git a/Source/UI/Window/UINewSelectCharWnd.h b/Source/UI/Window/UINewSelectCharWnd.h index 393eb60c8..e88fec8f4 100644 --- a/Source/UI/Window/UINewSelectCharWnd.h +++ b/Source/UI/Window/UINewSelectCharWnd.h @@ -13,8 +13,6 @@ class UIStaticText; class CUIControl; extern char g_selectedSlotIndex; -extern int g_doramSex; -extern int g_sub_1319eb4; struct CharSlotInfo { CharSlotInfo(); @@ -51,6 +49,8 @@ public: void Slot15(int width, int height) override; void Slot19() override; void Paint() override; + // INLINED + void Slot25(int, int) override {} int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override; void UpdateDeleteButtons(); diff --git a/Source/UI/Window/UIWindow.cpp b/Source/UI/Window/UIWindow.cpp index 252bb7b1f..3eabcd224 100644 --- a/Source/UI/Window/UIWindow.cpp +++ b/Source/UI/Window/UIWindow.cpp @@ -1,3 +1,4 @@ +#include "Client/Input/Mouse.h" #include "UI/Chat/UINewChatWnd.h" #include "Client/Application/Launcher.h" #include "Client/Input/InputCharset.h" @@ -2562,12 +2563,12 @@ void UINavigationV4Wnd::Paint() { } } - const int x = g_screenWidth - this->geometry.x; + const int x = g_mouse.x - this->geometry.x; if (x > 3 && x < 0x10d) { this->FillRegion(x, 0x2e, 2, 0x10a, 0xffaa2200); } - const int y = g_screenHeight - this->geometry.y; + const int y = g_mouse.y - this->geometry.y; if (y > 0x2e && y < 0x138) { this->FillRegion(3, y, 0x10a, 2, 0xffaa2200); } diff --git a/Source/UI/Window/UIWindowMgr.cpp b/Source/UI/Window/UIWindowMgr.cpp index 580aad66d..3a5a435a1 100644 --- a/Source/UI/Window/UIWindowMgr.cpp +++ b/Source/UI/Window/UIWindowMgr.cpp @@ -5384,7 +5384,7 @@ UIWindow* UIWindowMgr::EnsureWindow(int id) { this->unknown_0348 = window; window->SetSize(4, 4); window->Move(CenterOnViewportX(200), ScaleByScreenHeight(120)); - this->rendered.push_front(window); + this->rendered.insert(this->rendered.end(), window); this->unknown_0348->unknown_004C = 2; this->rendered.sort(layerGreater); } else { diff --git a/Source/UI/Window/WindowDialogs.cpp b/Source/UI/Window/WindowDialogs.cpp index ed393c041..01711fab4 100644 --- a/Source/UI/Window/WindowDialogs.cpp +++ b/Source/UI/Window/WindowDialogs.cpp @@ -169,7 +169,7 @@ int UIWindowMgr::Confirm( box->SendMsg(nullptr, 157, 1, 0, 0, 0); } - this->rendered.push_front(box); + this->rendered.insert(this->rendered.end(), box); if (this->inputWindow) { this->persistentWindows.insert(this->inputWindow->Root()); diff --git a/Source/Utility/JsonCppLoader.cpp b/Source/Utility/JsonCppLoader.cpp index fdebe90d4..8a20bfce6 100644 --- a/Source/Utility/JsonCppLoader.cpp +++ b/Source/Utility/JsonCppLoader.cpp @@ -79,10 +79,6 @@ void BsonDecodeOptionsConstruct(); void JsonDecodeOptionsConstruct(); void JsonOptionsCommonDestroy(); void JsonDefaultParsingHandler(); -void* __cdecl JsonDecodeBsonStream(JsonValue* out, std::ifstream* file, JsonCppLoaderBsonOptions* options); -void* __cdecl JsonDecodeBsonBuffer(JsonValue* out, const std::vector* buffer, JsonCppLoaderBsonOptions* options); -void* __cdecl JsonParseStream(JsonValue* out, std::ifstream* file, JsonCppLoaderJsonOptions* options, JsonCppLoaderJsonHandler handler); -void* __cdecl JsonParseString(JsonValue* out, const unsigned char* data, JsonCppLoaderJsonOptions* options, JsonCppLoaderJsonHandler handler); void JsonSwap(); void JsonDestroy(); void JsonCopyConstruct(); @@ -99,12 +95,28 @@ static JsonValue CopyNullJsonValue() { struct JsonCppLoaderParsedValue { JsonValue value; + // INLINED + JsonCppLoaderParsedValue& operator=(JsonCppLoaderParsedValue&& other) { + if (this != &other) { + reinterpret_cast(JsonSwap)(&this->value, &other.value); + } + + return *this; + } + // INLINED ~JsonCppLoaderParsedValue() { reinterpret_cast(JsonDestroy)(&this->value); } }; +extern "C" { +JsonCppLoaderParsedValue __cdecl JsonDecodeBsonStream(std::ifstream* file, JsonCppLoaderBsonOptions* options); +JsonCppLoaderParsedValue __cdecl JsonDecodeBsonBuffer(const std::vector* buffer, JsonCppLoaderBsonOptions* options); +JsonCppLoaderParsedValue __cdecl JsonParseStream(std::ifstream* file, JsonCppLoaderJsonOptions* options, JsonCppLoaderJsonHandler handler); +JsonCppLoaderParsedValue __cdecl JsonParseString(const unsigned char* data, JsonCppLoaderJsonOptions* options, JsonCppLoaderJsonHandler handler); +} + struct JsonCppLoaderJsonOptionsGuard { JsonCppLoaderJsonOptions* options; @@ -125,13 +137,7 @@ bool JsonCppLoader::LoadBson(const std::string& path) { JsonCppLoaderBsonOptions optionStorage; JsonCppLoaderBsonOptions* options = reinterpret_cast(BsonDecodeOptionsConstruct)(&optionStorage, 1); - { - JsonCppLoaderParsedValue parsed; - JsonValue* result = static_cast(JsonDecodeBsonStream(&parsed.value, &file, options)); - if (&this->document != result) { - reinterpret_cast(JsonSwap)(&this->document, result); - } - } + reinterpret_cast(this->document) = JsonDecodeBsonStream(&file, options); file.close(); } catch (const std::exception& exception) { this->Fail("error : JsonCppLoader::LoadBson failed (reason : %s)", exception.what()); @@ -152,13 +158,7 @@ bool JsonCppLoader::LoadJson(const std::string& path) { JsonCppLoaderJsonOptions optionStorage; JsonCppLoaderJsonOptionsGuard options{reinterpret_cast(JsonDecodeOptionsConstruct)(&optionStorage, 1)}; - { - JsonCppLoaderParsedValue parsed; - JsonValue* result = static_cast(JsonParseStream(&parsed.value, &file, options.options, JsonCppLoaderJsonHandler{})); - if (&this->document != result) { - reinterpret_cast(JsonSwap)(&this->document, result); - } - } + reinterpret_cast(this->document) = JsonParseStream(&file, options.options, JsonCppLoaderJsonHandler{}); file.close(); } catch (const std::exception& exception) { this->Fail("error : JsonCppLoader::LoadJson failed (reason : %s)", exception.what()); @@ -202,11 +202,7 @@ __declspec(noinline) bool JsonCppLoader::LoadBson(std::vector& bu try { JsonCppLoaderBsonOptions optionStorage; JsonCppLoaderBsonOptions* options = reinterpret_cast(BsonDecodeOptionsConstruct)(&optionStorage, 1); - JsonCppLoaderParsedValue parsed; - JsonValue* result = static_cast(JsonDecodeBsonBuffer(&parsed.value, &buffer, options)); - if (&this->document != result) { - reinterpret_cast(JsonSwap)(&this->document, result); - } + reinterpret_cast(this->document) = JsonDecodeBsonBuffer(&buffer, options); } catch (const std::exception& exception) { this->Fail("error : JsonCppLoader::LoadBson failed (reason : %s)", exception.what()); return false; @@ -231,11 +227,7 @@ __declspec(noinline) bool JsonCppLoader::LoadJson(std::vector& bu try { JsonCppLoaderJsonOptions optionStorage; JsonCppLoaderJsonOptionsGuard options{reinterpret_cast(JsonDecodeOptionsConstruct)(&optionStorage, 1)}; - JsonCppLoaderParsedValue parsed; - JsonValue* result = static_cast(JsonParseString(&parsed.value, buffer.data(), options.options, JsonCppLoaderJsonHandler{})); - if (&this->document != result) { - reinterpret_cast(JsonSwap)(&this->document, result); - } + reinterpret_cast(this->document) = JsonParseString(buffer.data(), options.options, JsonCppLoaderJsonHandler{}); } catch (const std::exception& exception) { this->Fail("error : JsonCppLoader::LoadJson failed (reason : %s)", exception.what()); return false;