diff --git a/Source/UI/AdventureGuide/UIAdventureGuide.cpp b/Source/UI/AdventureGuide/UIAdventureGuide.cpp index e14200e1..382ae566 100644 --- a/Source/UI/AdventureGuide/UIAdventureGuide.cpp +++ b/Source/UI/AdventureGuide/UIAdventureGuide.cpp @@ -801,3 +801,100 @@ void AdventureGuide::CUIMonsterInfo::Paint() { CUIListItem::Paint(); this->DrawActionSprite(this->sprite, this->action, 16, 2, 124, 124, 0, true, nullptr); } + +namespace AdventureGuide { + +// OFFSET: 0x009C1550 +// FUNCTION: fn_13992 +CUIListBox* CUITab::CreateSubTabList() { + this->subTabs = new CUIListBox(*this->m_context); + this->subTabs->SetSize(98, 26); + this->subTabs->Move(0, 40); + this->subTabs->SetOnSelect([this](CUISubTab* subTab) { this->OnSelectSubTab(subTab); }); + + CUIListBox* list = this->subTabs; + { + const std::uint8_t disabledImageSource[] = { + 0x97, 0x50, 0x2D, 0xB5, 0x6F, 0x7B, 0x12, 0x78, 0x91, 0x1B, 0x2D, 0x83, 0x12, 0x0F, 0x8B, 0xF4, 0x33, 0x89, 0x88, 0x21, 0xDB, 0xC0, 0xA5, 0xD0, + 0x10, 0x8A, 0x84, 0x2B, 0xCA, 0xE9, 0xA3, 0xD4, 0x35, 0xA0, 0x8F, 0x3B, 0xC1, 0xEA, 0xA4, 0xC0, 0x35, 0xA0, 0x83, 0x20, 0xDD, 0xD8, 0xB6, 0xD9, + 0x79, 0x9D, 0x80, 0x3F, 0xAF}; + thread_local EncryptedName disabledImageName(disabledImageSource); + const std::string disabledImage(disabledImageName.Text()); + const std::uint8_t pressedImageSource[] = { + 0x11, 0x76, 0xD9, 0xE3, 0x6B, 0x95, 0x18, 0xAA, 0x17, 0x3D, 0xD9, 0xD5, 0x16, 0xE1, 0x81, 0x26, 0xB5, 0xAF, 0x7C, 0x77, 0xDF, 0x2E, 0xAF, 0x02, + 0x96, 0xAC, 0x70, 0x7D, 0xCE, 0x07, 0xA9, 0x06, 0xB3, 0x86, 0x7B, 0x6D, 0xC5, 0x04, 0xAE, 0x12, 0xB3, 0x86, 0x76, 0x6F, 0xCE, 0x29, 0xF3, 0x05, + 0xBC, 0xA9, 0x19}; + thread_local EncryptedName pressedImageName(pressedImageSource); + const std::string pressedImage(pressedImageName.Text()); + const std::uint8_t hoverImageSource[] = { + 0x33, 0xBA, 0xB3, 0xD9, 0xB9, 0x39, 0x36, 0x78, 0x35, 0xF1, 0xB3, 0xEF, 0xC4, 0x4D, 0xAF, 0xF4, 0x97, 0x63, 0x16, 0x4D, 0x0D, 0x82, 0x81, 0xD0, + 0xB4, 0x60, 0x1A, 0x47, 0x1C, 0xAB, 0x87, 0xD4, 0x91, 0x4A, 0x11, 0x57, 0x17, 0xA8, 0x80, 0xC0, 0x91, 0x4A, 0x03, 0x51, 0x1C, 0x84, 0x80, 0x9B, + 0x91, 0x78, 0x03, 0x23}; + thread_local EncryptedName hoverImageName(hoverImageSource); + const std::string hoverImage(hoverImageName.Text()); + const std::uint8_t normalImageSource[] = { + 0xC3, 0x9A, 0x59, 0x4F, 0x73, 0xB9, 0x0C, 0xA6, 0xC5, 0xD1, 0x59, 0x79, 0x0E, 0xCD, 0x95, 0x2A, 0x67, 0x43, 0xFC, 0xDB, 0xC7, 0x02, 0xBB, 0x0E, + 0x44, 0x40, 0xF0, 0xD1, 0xD6, 0x2B, 0xBD, 0x0A, 0x61, 0x6A, 0xFB, 0xC1, 0xDD, 0x28, 0xBA, 0x1E, 0x61, 0x6A, 0xF7, 0xDA, 0xC1, 0x1A, 0xA8, 0x07, + 0x2D, 0x57, 0xF4, 0xC5, 0xB3}; + thread_local EncryptedName normalImageName(normalImageSource); + const std::string normalImage(normalImageName.Text()); + list->SetImages(normalImage, hoverImage, pressedImage, disabledImage); + } + + this->subTabs->itemWidth = 98; + this->subTabs->rowHeight = 26; + this->subTabs->itemX = 0; + this->subTabs->itemY = 0; + this->subTabs->scrollBar->SetSize(9, 26); + this->subTabs->scrollBar->Move(89, 0); + this->subTabs->scrollBar->step = 20; + { + const std::uint8_t downImageSource[] = { + 0x77, 0x9C, 0xE5, 0xF3, 0x7B, 0xFB, 0x40, 0xCE, 0x71, 0xD7, 0xE5, 0xC5, 0x06, 0x8F, 0xD9, 0x42, 0xD3, 0x45, 0x40, 0x67, 0xCF, 0x40, 0xF7, 0x66, + 0xF0, 0x46, 0x4C, 0x6D, 0xDE, 0x69, 0xF6, 0x60, 0xC5, 0x5C, 0x49, 0x65, 0xE4, 0x54, 0xF7, 0x71, 0xD8, 0x44, 0x7A, 0x6D, 0xD4, 0x42, 0xEB, 0x2D, + 0xD5, 0x5E, 0x55, 0x09}; + thread_local EncryptedName downImageName(downImageSource); + const std::string downImage(downImageName.Text()); + const std::uint8_t upImageSource[] = { + 0xB9, 0x58, 0xD5, 0xCF, 0x6D, 0x9F, 0x58, 0x56, 0xBF, 0x13, 0xD5, 0xF9, 0x10, 0xEB, 0xC1, 0xDA, 0x1D, 0x81, 0x70, 0x5B, 0xD9, 0x24, 0xEF, 0xFE, + 0x3E, 0x82, 0x7C, 0x51, 0xC8, 0x0D, 0xEE, 0xF8, 0x0B, 0x98, 0x79, 0x59, 0xF2, 0x30, 0xEF, 0xE9, 0x16, 0x80, 0x4A, 0x40, 0xDD, 0x7F, 0xFF, 0xF6, + 0x09, 0xF7}; + thread_local EncryptedName upImageName(upImageSource); + const std::string upImage(upImageName.Text()); + this->subTabs->scrollBar->SetButtonImages(upImage, downImage); + } + { + const std::uint8_t backgroundImageSource[] = { + 0x13, 0xD8, 0x27, 0x93, 0x97, 0x09, 0xEE, 0x36, 0x15, 0x93, 0x27, 0xA5, 0xEA, 0x7D, 0x77, 0xBA, 0xB7, 0x01, 0x82, 0x07, 0x23, 0xB2, 0x59, 0x9E, + 0x94, 0x02, 0x8E, 0x0D, 0x32, 0x9B, 0x58, 0x98, 0xA1, 0x18, 0x8B, 0x05, 0x08, 0xA5, 0x4C, 0xA4, 0xBE, 0x1E, 0x83, 0x47, 0x35, 0xAA, 0x5B, 0xFB}; + thread_local EncryptedName backgroundImageName(backgroundImageSource); + const std::string backgroundImage(backgroundImageName.Text()); + this->subTabs->scrollBar->SetBackground(backgroundImage); + } + { + const std::uint8_t thumbBottomSource[] = { + 0xB3, 0x8E, 0x27, 0xBD, 0xEB, 0xB7, 0x7A, 0x46, 0xB5, 0xC5, 0x27, 0x8B, 0x96, 0xC3, 0xE3, 0xCA, 0x17, 0x57, 0x82, 0x29, 0x5F, 0x0C, 0xCD, 0xEE, + 0x34, 0x54, 0x8E, 0x23, 0x4E, 0x25, 0xCC, 0xE8, 0x01, 0x4E, 0x8B, 0x2B, 0x74, 0x0D, 0xD7, 0xFE, 0x1E, 0x43, 0xB8, 0x23, 0x44, 0x0E, 0xD1, 0xA5, + 0x11, 0x4C, 0x97, 0x47}; + thread_local EncryptedName thumbBottomName(thumbBottomSource); + const std::string thumbBottom(thumbBottomName.Text()); + const std::uint8_t thumbMiddleSource[] = { + 0xBD, 0xFC, 0x4F, 0x5B, 0x3F, 0x23, 0xAC, 0x10, 0xBB, 0xB7, 0x4F, 0x6D, 0x42, 0x57, 0x35, 0x9C, 0x19, 0x25, 0xEA, 0xCF, 0x8B, 0x98, 0x1B, 0xB8, + 0x3A, 0x26, 0xE6, 0xC5, 0x9A, 0xB1, 0x1A, 0xBE, 0x0F, 0x3C, 0xE3, 0xCD, 0xA0, 0x99, 0x01, 0xA8, 0x10, 0x31, 0xD0, 0xCC, 0x96, 0x89, 0x47, 0xBF, + 0x10, 0x23, 0x8F}; + thread_local EncryptedName thumbMiddleName(thumbMiddleSource); + const std::string thumbMiddle(thumbMiddleName.Text()); + const std::uint8_t thumbTopSource[] = { + 0x51, 0x86, 0xB9, 0xB9, 0x1B, 0xC7, 0x60, 0xBC, 0x57, 0xCD, 0xB9, 0x8F, 0x66, 0xB3, 0xF9, 0x30, 0xF5, 0x5F, 0x1C, 0x2D, 0xAF, 0x7C, 0xD7, 0x14, + 0xD6, 0x5C, 0x10, 0x27, 0xBE, 0x55, 0xD6, 0x12, 0xE3, 0x46, 0x15, 0x2F, 0x84, 0x7D, 0xCD, 0x04, 0xFC, 0x4B, 0x26, 0x36, 0xAB, 0x27, 0xC7, 0x1C, + 0xE1, 0x29}; + thread_local EncryptedName thumbTopName(thumbTopSource); + const std::string thumbTop(thumbTopName.Text()); + this->subTabs->scrollBar->SetThumbImages(thumbTop, thumbMiddle, thumbBottom); + } + + this->AddChild(this->subTabs); + return this->subTabs; +} + +} diff --git a/Source/UI/Lists/UIListBoxTemplate.h b/Source/UI/Lists/UIListBoxTemplate.h index 6d98e644..574d3f56 100644 --- a/Source/UI/Lists/UIListBoxTemplate.h +++ b/Source/UI/Lists/UIListBoxTemplate.h @@ -58,6 +58,7 @@ public: void SetSelected(bool selected) override; void OnSelectSubTab(CUISubTab* subTab); + CUIListBox* CreateSubTabList(); /* 00E8 */ unsigned char unknown_00E8[0x04]; /* 00EC */ CUIListBox* subTabs; @@ -160,6 +161,11 @@ struct Contents { template class CUIListBox : public CUIControl { public: + // INLINED + explicit CUIListBox(UIWindowContext& context) + : CUIControl(context), scrollBar(nullptr), itemWidth(0), rowHeight(0), itemX(0), itemY(0), selected(nullptr), locked(0) { + } + void Slot15(int width, int height) override; // OFFSET: 0x009D23B0 // OFFSET: 0x009D23C0 @@ -213,9 +219,29 @@ public: void SelectItem(CUIListItem* item); - /* 0084 */ unsigned char unknown_0084[0x2C]; + // INLINED + void SetOnSelect(std::function handler) { + this->onSelect = handler; + } + + // INLINED + 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(); + } + + /* 0084 */ CResPtr unknown_0084; + /* 0088 */ CResPtr unknown_0088; + /* 008C */ CResPtr unknown_008C; + /* 0090 */ std::map imageNames; + /* 0098 */ std::string disabledName; /* 00B0 */ CUIVScrollBar* scrollBar; - /* 00B4 */ unsigned char unknown_00B4[0x08]; + /* 00B4 */ int itemWidth; + /* 00B8 */ int rowHeight; /* 00BC */ int itemX; /* 00C0 */ int itemY; /* 00C4 */ std::list items;