diff --git a/Source/UI/AdventureGuide/UIAdventureGuide.cpp b/Source/UI/AdventureGuide/UIAdventureGuide.cpp index 5cd665d3..cae7ef6c 100644 --- a/Source/UI/AdventureGuide/UIAdventureGuide.cpp +++ b/Source/UI/AdventureGuide/UIAdventureGuide.cpp @@ -2,7 +2,11 @@ #include "Contents/AdventureGuideMgr.h" #include "Contents/Items/ItemInfo.h" #include "Contents/MessageTable.h" +#include "Contents/NavigationManager.h" #include "Contents/RenewQuestMgr.h" +#include "Resource/ResourceMgr.h" +#include "Resource/Sprites/ActionResource.h" +#include "Resource/Sprites/SpriteResource.h" #include "UI/AdventureGuide/UIAdventureGuide.h" #include "UI/Lists/UIListBoxTemplate.h" #include "Render/Renderer.h" @@ -302,28 +306,27 @@ void CUIIntro::BindContents(CUITabInfo* item, const Guide_Intro::Contents& conte // OFFSET: 0x009DFAD0 // FUNCTION: fn_14359 void CUIQuestInfo::SetStatusLines(bool first, bool second, bool third) { - CUITextViewer* viewer = reinterpret_cast(this->unknown_00F4); - viewer->Clear(); + reinterpret_cast(this->unknown_00F4)->Clear(); if (first == true) { - viewer->SetTextColor(0xC86464u); - viewer->AddLine(FormatOwnedString(LookupMessage(0xFC2))); + reinterpret_cast(this->unknown_00F4)->SetTextColor(0xC86464u); + reinterpret_cast(this->unknown_00F4)->AddLine(FormatOwnedString(LookupMessage(0xFC2))); } else { - viewer->SetTextColor(0x6464C8u); - viewer->AddLine(FormatOwnedString(LookupMessage(0xFC3))); + reinterpret_cast(this->unknown_00F4)->SetTextColor(0x6464C8u); + reinterpret_cast(this->unknown_00F4)->AddLine(FormatOwnedString(LookupMessage(0xFC3))); } if (second == true) { - viewer->SetTextColor(0xC86464u); - viewer->AddLine(FormatOwnedString(LookupMessage(0xFC4))); + reinterpret_cast(this->unknown_00F4)->SetTextColor(0xC86464u); + reinterpret_cast(this->unknown_00F4)->AddLine(FormatOwnedString(LookupMessage(0xFC4))); } else { - viewer->SetTextColor(0x6464C8u); - viewer->AddLine(FormatOwnedString(LookupMessage(0xFC5))); + reinterpret_cast(this->unknown_00F4)->SetTextColor(0x6464C8u); + reinterpret_cast(this->unknown_00F4)->AddLine(FormatOwnedString(LookupMessage(0xFC5))); } if (third == true) { - viewer->SetTextColor(0xC86464u); - viewer->AddLine(FormatOwnedString(LookupMessage(0xFC6))); + reinterpret_cast(this->unknown_00F4)->SetTextColor(0xC86464u); + reinterpret_cast(this->unknown_00F4)->AddLine(FormatOwnedString(LookupMessage(0xFC6))); } else { - viewer->SetTextColor(0x6464C8u); - viewer->AddLine(FormatOwnedString(LookupMessage(0xFC7))); + reinterpret_cast(this->unknown_00F4)->SetTextColor(0x6464C8u); + reinterpret_cast(this->unknown_00F4)->AddLine(FormatOwnedString(LookupMessage(0xFC7))); } } @@ -604,4 +607,95 @@ void CUIItemInfo::Slot32(int, int) { } } +// OFFSET: 0x009DC720 +// FUNCTION: fn_14322 +void CUIMonster::BindMonster(CUIMonsterInfo* item, const CMonsterData& data) { + item->SetMonster(data.name); + reinterpret_cast(item->unknown_00F0)->Clear(); + for (const std::string& value : data.values) { + reinterpret_cast(item->unknown_00F0)->AddLine(value); + } +} + +// OFFSET: 0x009DFCB0 +// FUNCTION: fn_14360 +void CUIMonsterInfo::SetMonster(const std::string& title) { + CUITextViewer* details = reinterpret_cast(this->unknown_00EC); + details->Clear(); + + std::string name; + std::string spriteName; + int x = 0; + int size = 0; + int element = 0; + int elementLevel = 0; + int race = 0; + int type = 0; + if (!g_navigationManager.GetMobInfo(title, &name, &spriteName, &x, &size, &element, &elementLevel, &race, &type)) { + this->unknown_00E8->SetText(title.c_str(), title.size()); + return; + } + + this->unknown_00E8->SetText(name.c_str(), name.size()); + this->sprite = static_cast(ResourceMgr::Instance().Load(spriteName + ".spr")); + this->action = static_cast(ResourceMgr::Instance().Load(spriteName + ".act")); + + if (element == 1) { + details->AddLine(FormatOwnedString(LookupMessage(0x8D7), elementLevel)); + } else if (element == 2) { + details->AddLine(FormatOwnedString(LookupMessage(0x8D8), elementLevel)); + } else if (element == 3) { + details->AddLine(FormatOwnedString(LookupMessage(0x8D9), elementLevel)); + } else if (element == 4) { + details->AddLine(FormatOwnedString(LookupMessage(0x8DA), elementLevel)); + } else if (element == 5) { + details->AddLine(FormatOwnedString(LookupMessage(0x8DB), elementLevel)); + } else if (element == 6) { + details->AddLine(FormatOwnedString(LookupMessage(0x8DC), elementLevel)); + } else if (element == 7) { + details->AddLine(FormatOwnedString(LookupMessage(0x8DD), elementLevel)); + } else if (element == 8) { + details->AddLine(FormatOwnedString(LookupMessage(0x8DE), elementLevel)); + } else if (element == 9) { + details->AddLine(FormatOwnedString(LookupMessage(0x8DF), elementLevel)); + } else { + details->AddLine(FormatOwnedString(LookupMessage(0x8E0), elementLevel)); + } + + if (race == 1) { + details->AddLine(FormatOwnedString(LookupMessage(0x8E4))); + } else if (race == 2) { + details->AddLine(FormatOwnedString(LookupMessage(0x8E5))); + } else if (race == 3) { + details->AddLine(FormatOwnedString(LookupMessage(0x8E6))); + } else if (race == 4) { + details->AddLine(FormatOwnedString(LookupMessage(0x8E7))); + } else if (race == 5) { + details->AddLine(FormatOwnedString(LookupMessage(0x8E8))); + } else if (race == 6) { + details->AddLine(FormatOwnedString(LookupMessage(0x8E9))); + } else if (race == 7) { + details->AddLine(FormatOwnedString(LookupMessage(0x8EA))); + } else if (race == 8) { + details->AddLine(FormatOwnedString(LookupMessage(0x8EB))); + } else if (race == 9) { + details->AddLine(FormatOwnedString(LookupMessage(0x8EC))); + } else { + details->AddLine(FormatOwnedString(LookupMessage(0x8ED))); + } + + if (size == 1) { + details->AddLine(FormatOwnedString(LookupMessage(0x8E1))); + } else if (size == 2) { + details->AddLine(FormatOwnedString(LookupMessage(0x8E2))); + } else { + details->AddLine(FormatOwnedString(LookupMessage(0x8E3))); + } + + if (type == 0x12D) { + details->SetTextColor(0x6464FFu); + details->AddLine(FormatOwnedString(LookupMessage(0x8B6))); + } +} + } diff --git a/Source/UI/AdventureGuide/UIAdventureGuide.h b/Source/UI/AdventureGuide/UIAdventureGuide.h index d98f2555..6adb374d 100644 --- a/Source/UI/AdventureGuide/UIAdventureGuide.h +++ b/Source/UI/AdventureGuide/UIAdventureGuide.h @@ -73,6 +73,7 @@ public: void Slot54(int first, int second) override; void OnSelectMonster(CUIMonsterInfo* item, const CMonsterData& data); + void BindMonster(CUIMonsterInfo* item, const CMonsterData& data); /* 0084 */ UIWindow* unknown_0084; /* 0088 */ std::string unknown_0088; diff --git a/Source/UI/Lists/UIListBoxTemplate.h b/Source/UI/Lists/UIListBoxTemplate.h index 60944eeb..925146aa 100644 --- a/Source/UI/Lists/UIListBoxTemplate.h +++ b/Source/UI/Lists/UIListBoxTemplate.h @@ -34,6 +34,8 @@ public: }; class CUIStaticText; +class CSprRes; +class CActRes; template class CUIListBox; @@ -83,10 +85,13 @@ public: class CUIMonsterInfo : public CUIListItem { public: void Slot16() override; + void SetMonster(const std::string& title); /* 00E8 */ CUIStaticText* unknown_00E8; /* 00EC */ CUIStaticText* unknown_00EC; /* 00F0 */ CUIStaticText* unknown_00F0; + /* 00F4 */ CSprRes* sprite; + /* 00F8 */ CActRes* action; }; class CUIQuestInfo : public CUIListItem {