diff --git a/Source/UI/AdventureGuide/UIAdventureGuide.cpp b/Source/UI/AdventureGuide/UIAdventureGuide.cpp index 52def3a5..6d1c3fe8 100644 --- a/Source/UI/AdventureGuide/UIAdventureGuide.cpp +++ b/Source/UI/AdventureGuide/UIAdventureGuide.cpp @@ -17,6 +17,7 @@ #include "UI/Window/UIWindowMgr.h" #include "Utility/Cipher/XorBytes.h" #include "Utility/Text/FormatString.h" +#include "Utility/Text/StringUtil.h" #include "Contents/Items/ItemDescription.h" #include #include @@ -61,6 +62,7 @@ template void CUIListBoxEx::UpdateScrollBar(); template void CUIListBox::UpdateScrollBar(); template <> __declspec(noinline) void CUIListBox::SelectItem(CUIListItem* item); +template <> AdventureGuide::CUISubTab* CUIListBox::CreateItem(); // OFFSET: 0x009C28B0 // OFFSET: 0x009C2980 @@ -1990,3 +1992,57 @@ CUIAdventureGuide::CUIAdventureGuide() CUIAdventureGuide* CreateAdventureGuide() { return new CUIAdventureGuide(); } + +// OFFSET: 0x009DB280 +// FUNCTION: fn_14306 +template <> +AdventureGuide::CUISubTab* CUIListBox::CreateItem() { + AdventureGuide::CUISubTab* item = new AdventureGuide::CUISubTab(*this->m_context); + item->SetSize(this->itemWidth, this->rowHeight); + item->Show(0); + CResPtr* images = reinterpret_cast*>(reinterpret_cast(this) + 0x80); + item->SetImageResources(images[0], images[1], images[2], images[3]); + item->onHover = [this](CUIListItem* listItem) { + for (AdventureGuide::CUISubTab* other : this->items) { + other->SetHighlighted(other == listItem); + } + }; + item->onPress = [this](CUIListItem* listItem) { + this->SelectItem(listItem); + }; + this->AddChild(item); + this->items.push_back(item); + this->UpdateScrollBar(); + this->Invalidate(); + return item; +} + +namespace AdventureGuide { + +// OFFSET: 0x009DB720 +// FUNCTION: fn_14309 +void CUIItem::RequestNavigation() { + std::string name; + int x = -1; + int y = -1; + std::vector parts = Split(this->unknown_008C, ","); + if (parts.size() > 2) { + name = parts[0]; + x = std::atoi(parts[1].c_str()); + y = std::atoi(parts[2].c_str()); + } + + if (x != -1 && y != -1) { + g_navigationManager.sub_B99030(name, 0, 5, false, x, y, 1002); + } else { + g_navigationManager.sub_B99030(name, 1, 5, false, -1, -1, 1002); + } +} + +// OFFSET: 0x009DB8F0 + +// OFFSET: 0x009DBB80 + +// OFFSET: 0x009DBCB0 + +} diff --git a/Source/UI/AdventureGuide/UIAdventureGuide.h b/Source/UI/AdventureGuide/UIAdventureGuide.h index fa1beaee..d588ee14 100644 --- a/Source/UI/AdventureGuide/UIAdventureGuide.h +++ b/Source/UI/AdventureGuide/UIAdventureGuide.h @@ -96,6 +96,8 @@ public: void Slot54(int type, int id) override; void BindItem(CUIItemInfo* item, const CItemData& data); void OnSelectItem(CUIItemInfo* item, const CItemData& data); + void RequestNavigation(); + void SearchNavigation(); /* 0084 */ UIWindow* unknown_0084; /* 0088 */ UIWindow* unknown_0088; @@ -135,6 +137,8 @@ public: void Slot54(int type, int id) override; void OnSelectQuest(CUIQuestInfo* item, const CQuestInfo& data); + void RequestNavigation(); + void SearchNavigation(); /* 0084 */ UIWindow* unknown_0084; /* 0088 */ UIWindow* unknown_0088;