diff --git a/Source/UI/Exchange/UIExchangeUI.cpp b/Source/UI/Exchange/UIExchangeUI.cpp new file mode 100644 index 00000000..a1f9f88a --- /dev/null +++ b/Source/UI/Exchange/UIExchangeUI.cpp @@ -0,0 +1,71 @@ +#include "UI/Exchange/UIExchangeUI.h" + +#include "Resource/ResourceMgr.h" +#include "Resource/SkinPalette.h" + +#include +#include +#include + +template void CUIListBoxEx::SetOnSelect(std::function); +template void CUIListBoxEx::SetBinder(std::function); +template void CUIListBoxEx::SetImages(const std::string&, const std::string&, const std::string&, + const std::string&); + +// OFFSET: 0x00A15150 +// FUNCTION: fn_15193 +template <> +void CUIListBoxEx::Paint() { + this->ClearSurface(0xFFFF00FF); +} + +// OFFSET: 0x00A15160 +// FUNCTION: fn_15194 +template <> +void CUIListBoxEx::Slot35(int value) { + if (!this->scrollBar->dragging && this->scrollBar->total > this->scrollBar->visible) { + this->scrollBar->Slot35(value); + } else if (this->parent) { + this->parent->Slot35(value); + } +} + +// OFFSET: 0x00A157C0 + +// OFFSET: 0x00A171A0 + +// OFFSET: 0x00A17530 +// FUNCTION: fn_15289 +void CUIExchangeUI::OnCheckChanged(bool) { +} + +// OFFSET: 0x00A17540 + +// OFFSET: 0x00A17670 +// FUNCTION: fn_15292 +void CUIExchangeUI::OnEditSubmit() { +} + +// OFFSET: 0x00A17680 +// FUNCTION: fn_15293 +void CUIExchangeUI::OnSelectFirstListItem(ExchangeUI::CUIItem*, const ExchangeUI::CItemData&) { +} + +// OFFSET: 0x00A176A0 +// FUNCTION: fn_15295 +void CUIExchangeUI::OnSelectSecondListItem(ExchangeUI::CUIItem*, const ExchangeUI::CItemData&) { +} + +// OFFSET: 0x00A176C0 +// FUNCTION: fn_15297 +void ExchangeUI::CUIItem::Paint() { + if (this->frozen) { + unsigned red = 0; + unsigned green = 0; + unsigned blue = 0; + SkinPaletteChannels(ResourceMgr::Instance(), 10, 6, red, green, blue); + this->ClearSurface(RGB(red, green, blue)); + } else { + this->ClearSurface(0xFFFFFFFF); + } +} diff --git a/Source/UI/Exchange/UIExchangeUI.h b/Source/UI/Exchange/UIExchangeUI.h new file mode 100644 index 00000000..775df700 --- /dev/null +++ b/Source/UI/Exchange/UIExchangeUI.h @@ -0,0 +1,45 @@ +#ifndef RAGNAROK_SOURCE_UI_EXCHANGE_UIEXCHANGEUI_H +#define RAGNAROK_SOURCE_UI_EXCHANGE_UIEXCHANGEUI_H + +#include "Contents/Items/ItemInfo.h" +#include "UI/FrameSkin.h" +#include "UI/Lists/UIListBoxTemplate.h" + +#include + +namespace ExchangeUI { +class CUIItem : public CUIListItem { +public: + void Paint() override; +}; + +class CItemData { +public: + /* 0000 */ ITEM_INFO item; + /* 00F8 */ int unknown_00F8; + /* 00FC */ bool unknown_00FC; +}; + +using CItemListBox = CUIListBoxEx; +} + +class CUIExchangeUI : public CUIFrameWnd { +public: + void OnCheckChanged(bool checked); + void OnEditSubmit(); + void OnSelectFirstListItem(ExchangeUI::CUIItem* item, const ExchangeUI::CItemData& data); + void OnSelectSecondListItem(ExchangeUI::CUIItem* item, const ExchangeUI::CItemData& data); +}; + +#if defined(_WIN32) && !defined(_WIN64) +static_assert(sizeof(ExchangeUI::CItemData) == 0x100); +static_assert(offsetof(ExchangeUI::CItemData, unknown_00FC) == 0xFC); +static_assert(offsetof(ExchangeUI::CItemListBox, imageNames) == 0x90); +static_assert(offsetof(ExchangeUI::CItemListBox, disabledName) == 0x98); +static_assert(offsetof(ExchangeUI::CItemListBox, scrollBar) == 0xB0); +static_assert(offsetof(ExchangeUI::CItemListBox, data) == 0xD4); +static_assert(offsetof(ExchangeUI::CItemListBox, onSelect) == 0xE8); +static_assert(offsetof(ExchangeUI::CItemListBox, binder) == 0x110); +#endif + +#endif diff --git a/Source/UI/Lists/UIListBoxTemplate.h b/Source/UI/Lists/UIListBoxTemplate.h index 3f737a63..2d1fd4cc 100644 --- a/Source/UI/Lists/UIListBoxTemplate.h +++ b/Source/UI/Lists/UIListBoxTemplate.h @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -184,6 +185,29 @@ public: this->UpdateScrollBar(); } + // OFFSET: 0x00A15450 + // FUNCTION: fn_15196 + void SetOnSelect(std::function handler) { + this->onSelect = handler; + } + + // OFFSET: 0x00A154C0 + // FUNCTION: fn_15197 + void SetBinder(std::function handler) { + this->binder = handler; + } + + // OFFSET: 0x00A15AA0 + // FUNCTION: fn_15201 + void SetImages(const std::string& normal, const std::string& hover, const std::string& pressed, const std::string& disabled) { + this->imageNames[0] = normal; + this->imageNames[1] = hover; + this->imageNames[2] = pressed; + this->disabledName = disabled; + this->Slot53(0); + this->Invalidate(); + } + // OFFSET: 0x009DD950 // OFFSET: 0x00A06300 // FUNCTION: fn_14344 @@ -259,7 +283,9 @@ public: } } - /* 0084 */ unsigned char unknown_0084[0x2C]; + /* 0084 */ unsigned char unknown_0084[0x0C]; + /* 0090 */ std::map imageNames; + /* 0098 */ std::string disabledName; /* 00B0 */ CUIVScrollBar* scrollBar; /* 00B4 */ int itemWidth; /* 00B8 */ int rowHeight; @@ -271,7 +297,8 @@ public: /* 00DC */ unsigned int selected; /* 00E0 */ unsigned char unknown_00E0; /* 00E1 */ unsigned char rebind; - /* 00E2 */ unsigned char unknown_00E2[0x2E]; + /* 00E2 */ unsigned char unknown_00E2[0x06]; + /* 00E8 */ std::function onSelect; /* 0110 */ std::function binder; }; diff --git a/data/compile.json b/data/compile.json index 2049d914..4ff8cc69 100644 --- a/data/compile.json +++ b/data/compile.json @@ -728,6 +728,7 @@ "Source/UI/Edit/UIEditLinks.cpp": 2, "Source/UI/Edit/UIEditVariants.cpp": 2, "Source/UI/Enchant/UIEnchantUI.cpp": 2, + "Source/UI/Exchange/UIExchangeUI.cpp": 2, "Source/UI/FrameSkin.cpp": 2, "Source/UI/GameSettings/GameSettingsUI.cpp": 2, "Source/UI/Gauges/UIPetInfoBarGraph.cpp": 2,