diff --git a/Source/UI/Items/UISwapEquipmentWnd.cpp b/Source/UI/Items/UISwapEquipmentWnd.cpp new file mode 100644 index 00000000..6ba03f73 --- /dev/null +++ b/Source/UI/Items/UISwapEquipmentWnd.cpp @@ -0,0 +1,76 @@ +#include "UI/Items/UISwapEquipmentWnd.h" + +#include "Client/Mode/CMode.h" +#include "Client/Mode/ModeDragState.h" +#include "Client/Mode/ModeMgr.h" +#include "Client/Session.h" +#include "Contents/Items/ItemInfo.h" +#include "UI/Window/UIWindowMgr.h" + +#include + +// OFFSET: 0x0082F990 +// FUNCTION: fn_10390 +void UISwapEquipmentWnd::Slot10(int x, int y, std::intptr_t value) { + const ModeDragState* drag = reinterpret_cast(value); + if (g_windowMgr.LookupWindow(10011)) { + UIWindow::Slot10(x, y, value); + return; + } + + CMode* mode = g_modeMgr.GetGameMode(); + ITEM_INFO item(0); + unsigned char equipped = 0; + switch (drag->source) { + case 1: + item = LookupClientItemByIdentity(g_session.m_inventoryItems, drag->id); + break; + case 2: + equipped = 1; + item = g_session.GetItem17F0(drag->slot); + break; + case 24: + equipped = 1; + item = g_session.GetItem2B50(drag->slot); + break; + } + + if (item.unknown_0000[1] > 0) { + switch (item.unknown_0000[0]) { + case 10: + case 16: + case 17: + case 19: + mode->SendMsg(302, drag->id, item.unknown_0000[2], 0, 0); + break; + default: + if (equipped == 1) { + mode->SendMsg(305, reinterpret_cast(&item), 0, 0, 0); + } else if (item.unknown_0000[2] != 0 && item.identified != 0 && item.unknown_0000[3] == 0) { + mode->SendMsg(302, drag->id, item.unknown_0000[2], 0, 0); + } + break; + } + } + + g_modeMgr.gameMode->SendMsg(18, 0, 0, 0, 0); +} + +// OFFSET: 0x00831860 +// FUNCTION: fn_10402 +void UISwapEquipmentWnd::SetSlotValue(int index, int value) { + switch (index) { + case 8: + this->unknown_00C8 = value; + break; + case 9: + this->unknown_00CC = value; + break; + case 0: + this->unknown_00C4 = value; + break; + case 2: + this->unknown_00D0 = value; + break; + } +} diff --git a/Source/UI/Items/UISwapEquipmentWnd.h b/Source/UI/Items/UISwapEquipmentWnd.h new file mode 100644 index 00000000..e3f3f3aa --- /dev/null +++ b/Source/UI/Items/UISwapEquipmentWnd.h @@ -0,0 +1,29 @@ +#ifndef RAGNAROK_SOURCE_UI_ITEMS_UISWAPEQUIPMENTWND_H +#define RAGNAROK_SOURCE_UI_ITEMS_UISWAPEQUIPMENTWND_H + +#include "UI/Window/UIFrameWnd.h" + +#include + +class UISwapBitmapButton; + +class UISwapEquipmentWnd : public UIFrameWnd { +public: + void Slot10(int x, int y, std::intptr_t value) override; + void SetSlotValue(int index, int value); + +protected: + /* 00B4 */ std::uint32_t unknown_00B4; + /* 00B8 */ UISwapBitmapButton* m_swapButton; + /* 00BC */ int unknown_00BC; + /* 00C0 */ std::uint32_t unknown_00C0; + /* 00C4 */ int unknown_00C4; + /* 00C8 */ int unknown_00C8; + /* 00CC */ int unknown_00CC; + /* 00D0 */ int unknown_00D0; + /* 00D4 */ int unknown_00D4; + /* 00D8 */ int unknown_00D8; + /* 00DC */ int unknown_00DC; +}; + +#endif diff --git a/Source/UI/StylingShop/UIStylingShopWnd.cpp b/Source/UI/StylingShop/UIStylingShopWnd.cpp index fe4a9b8f..9b50216b 100644 --- a/Source/UI/StylingShop/UIStylingShopWnd.cpp +++ b/Source/UI/StylingShop/UIStylingShopWnd.cpp @@ -206,3 +206,74 @@ void UIStylingShopWnd::Slot19() { void UIAccBitmapButton::Slot33(int, int) { this->parent->SendMsg(this, 101, this->geometry.id, this->m_argument, 0, 0); } + +// OFFSET: 0x0082CCB0 +// FUNCTION: fn_10366 +int UI2ndCostumeWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) { + if (message != 6) { + return UIWindow::SendMsg(sender, message, argument1, argument2, argument3, argument4); + } + + if (argument1 == 213) { + if (sender == this->m_showCheckBox) { + if (this->m_display && this->m_hideCheckBox && this->m_showCheckBox->geometry.unknown_0030 != 0) { + this->m_display->job = 1; + this->m_hideCheckBox->SetChecked(0); + this->m_showInfo->Invalidate(); + } + } else if (sender == this->m_hideCheckBox) { + if (this->m_display && this->m_showCheckBox && this->m_hideCheckBox->geometry.unknown_0030 != 0) { + this->m_display->job = 0; + this->m_showCheckBox->SetChecked(0); + this->m_showInfo->Invalidate(); + } + } else { + this->m_showInfo->Invalidate(); + } + } + + this->Invalidate(); + return 0; +} + +// OFFSET: 0x0082CD70 +// FUNCTION: fn_10367 +int UIAccessoryCusWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) { + if (message != 6) { + return UIWindow::SendMsg(sender, message, argument1, argument2, argument3, argument4); + } + + this->Invalidate(); + return 0; +} + +// OFFSET: 0x0082DC60 +// FUNCTION: fn_10373 +int UIShowInfoWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) { + if (message != 6) { + return UIWindow::SendMsg(sender, message, argument1, argument2, argument3, argument4); + } + + if (argument1 == 189) { + this->Invalidate(); + } + + return 0; +} + +// OFFSET: 0x0082DC90 +// FUNCTION: fn_10374 +int UISlotOfMyStyleWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) { + if (message != 6) { + return UIWindow::SendMsg(sender, message, argument1, argument2, argument3, argument4); + } + + this->Invalidate(); + return 0; +} + +// OFFSET: 0x0082E010 +// FUNCTION: fn_10376 +int UIStylingshopTabParentWnd::SendMsg(UIWindow*, int, std::intptr_t, std::intptr_t, std::intptr_t, std::intptr_t) { + return 0; +} diff --git a/Source/UI/StylingShop/UIStylingShopWnd.h b/Source/UI/StylingShop/UIStylingShopWnd.h index fcd719ad..f107d192 100644 --- a/Source/UI/StylingShop/UIStylingShopWnd.h +++ b/Source/UI/StylingShop/UIStylingShopWnd.h @@ -19,16 +19,22 @@ public: /* 0090 */ int job; }; +class UIShowInfoWnd : public UIWindow { +public: + int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override; +}; + class UIStylingshopTabParentWnd : public UIWindow { public: /* 007C */ UIDisplayCharacter* m_display; - /* 0080 */ int unknown_0080; + /* 0080 */ UIShowInfoWnd* m_showInfo; /* 0084 */ bool unknown_0084; /* 0085 */ bool unknown_0085; /* 0086 */ bool unknown_0086; void Slot15(int width, int height) 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; }; class UICostumeChangeWnd : public UIStylingshopTabParentWnd { @@ -45,14 +51,22 @@ public: void Slot19() override; }; -class UI2ndCostumeWnd : public UIWindow { +class UI2ndCostumeCheckBox; + +class UI2ndCostumeWnd : public UIStylingshopTabParentWnd { public: 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; + +protected: + /* 0088 */ UI2ndCostumeCheckBox* m_hideCheckBox; + /* 008C */ UI2ndCostumeCheckBox* m_showCheckBox; }; -class UIAccessoryCusWnd : public UIWindow { +class UIAccessoryCusWnd : public UIStylingshopTabParentWnd { public: 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; }; class UIAccessoryShowCase : public UIScrollWnd { @@ -70,9 +84,10 @@ public: void Paint() override; }; -class UISlotOfMyStyleWnd : public UIWindow { +class UISlotOfMyStyleWnd : public UIStylingshopTabParentWnd { public: 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; }; class UISlotForSelectWnd : public UIWindow { diff --git a/Source/UI/Text/NavigationLink.cpp b/Source/UI/Text/NavigationLink.cpp index b9a87318..dec8c9ac 100644 --- a/Source/UI/Text/NavigationLink.cpp +++ b/Source/UI/Text/NavigationLink.cpp @@ -76,6 +76,16 @@ static_assert(sizeof(LineCutter::UIText) == 0xB4); // GLOBAL: gl_24668 NavigationLinkParser* g_navigationLinkParser; +// OFFSET: 0x00831FE0 +// FUNCTION: fn_10404 +NavigationLinkParser::NavigationLinkParser() : m_ready(true) { +} + +// OFFSET: 0x00831FF0 +// FUNCTION: fn_10405 +NavigationLinkParser::~NavigationLinkParser() { +} + // OFFSET: 0x00833960 // FUNCTION: fn_10412 bool CreateNavigationLinkParser() { diff --git a/Source/UI/Text/NavigationLink.h b/Source/UI/Text/NavigationLink.h index 12e42913..f09c680c 100644 --- a/Source/UI/Text/NavigationLink.h +++ b/Source/UI/Text/NavigationLink.h @@ -4,7 +4,8 @@ #include struct NavigationLinkParser { - NavigationLinkParser() : m_ready(true) {} + NavigationLinkParser(); + ~NavigationLinkParser(); /* 0000 */ bool m_ready; }; diff --git a/data/compile.json b/data/compile.json index 04da5bba..2f8a9049 100644 --- a/data/compile.json +++ b/data/compile.json @@ -748,6 +748,7 @@ "Source/UI/Items/UIIllustWnd.cpp": 2, "Source/UI/Items/UIItemRepairWnd.cpp": 2, "Source/UI/Items/UIMakeTargetListWnd.cpp": 2, + "Source/UI/Items/UISwapEquipmentWnd.cpp": 2, "Source/UI/Items/UIWeaponRefineWnd.cpp": 2, "Source/UI/Layout/SnapMgr.cpp": 2, "Source/UI/Layout/SnapObject.cpp": 2,