diff --git a/Source/UI/AdventureGuide/UIAdventureGuide.cpp b/Source/UI/AdventureGuide/UIAdventureGuide.cpp index a630c599..e2ac68b4 100644 --- a/Source/UI/AdventureGuide/UIAdventureGuide.cpp +++ b/Source/UI/AdventureGuide/UIAdventureGuide.cpp @@ -4,6 +4,7 @@ #include "Contents/MessageTable.h" #include "Contents/NavigationManager.h" #include "Contents/RenewQuestMgr.h" +#include "Contents/TipBoxTitles.h" #include "Resource/ResourceMgr.h" #include "Resource/Sprites/ActionResource.h" #include "Resource/Sprites/SpriteResource.h" @@ -20,6 +21,7 @@ #include #include #include +#include #include namespace { @@ -548,6 +550,8 @@ void CUIItemInfo::Slot16() { this->unknown_00F8->scrollBar->SetHidden(1); } +// OFFSET: 0x009DEF40 + // OFFSET: 0x009DD210 // FUNCTION: fn_14335 void CUIMonster::Slot16() { @@ -605,6 +609,40 @@ void CUIIntro::BindContents(CUITabInfo* item, const Guide_Intro::Contents& conte item->unknown_00EC->SetText(contents.second.c_str(), contents.second.size()); } +// OFFSET: 0x009E0350 +// FUNCTION: fn_14361 +void CUIQuestInfo::SetTitle(int id) { + CUITextViewer* viewer = reinterpret_cast(this->unknown_00EC); + viewer->Clear(); + + const TipBoxEntry& entry = g_itemTagOwner->GetTip(id); + if (entry.title.empty() || entry.paragraphs.empty()) { + viewer->AddLine(std::to_string(id)); + return; + } + + std::string text = entry.title; + std::cmatch match; + if (std::regex_search(text.c_str(), text.c_str() + text.size(), match, std::regex("Q(.+)\\(")) && match.size() > 1) { + text = match[1].str(); + } + + text.erase(0, text.find_first_not_of(" \r\n\t\v\f")); + text.erase(text.find_last_not_of(" \r\n\t\v\f") + 1); + viewer->SetBold(1); + viewer->AddLine(text); + + text = entry.paragraphs[0]; + if (std::regex_search(text.c_str(), text.c_str() + text.size(), match, std::regex("\n"))) { + text = match.prefix().str(); + } + + text.erase(0, text.find_first_not_of(" \r\n\t\v\f")); + text.erase(text.find_last_not_of(" \r\n\t\v\f") + 1); + viewer->SetBold(0); + viewer->AddLine(text); +} + // OFFSET: 0x009DFAD0 // FUNCTION: fn_14359 void CUIQuestInfo::SetStatusLines(bool first, bool second, bool third) { diff --git a/Source/UI/Lists/UIListBoxTemplate.h b/Source/UI/Lists/UIListBoxTemplate.h index 9dce9300..d623795e 100644 --- a/Source/UI/Lists/UIListBoxTemplate.h +++ b/Source/UI/Lists/UIListBoxTemplate.h @@ -84,6 +84,8 @@ public: void Slot16() override; void Slot32(int x, int y) override; + void SetDescription(int type, const std::vector& description); + /* 00E8 */ unsigned char unknown_00E8[0x08]; /* 00F0 */ CUIStaticText* unknown_00F0; /* 00F4 */ CUIStaticText* unknown_00F4; @@ -112,6 +114,7 @@ class CUIQuestInfo : public CUIListItem { public: explicit CUIQuestInfo(UIWindowContext& context); void Slot16() override; + void SetTitle(int id); void SetStatusLines(bool first, bool second, bool third); void SetViewerLines(const std::vector& lines);