2019-10-15 14:13:27 +00:00
|
|
|
#include "Runtime/MP1/CLogBookScreen.hpp"
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
2019-10-15 14:22:47 +00:00
|
|
|
#include "Runtime/CPlayerState.hpp"
|
|
|
|
#include "Runtime/CStateManager.hpp"
|
2019-10-15 14:13:27 +00:00
|
|
|
#include "Runtime/GuiSys/CAuiImagePane.hpp"
|
|
|
|
#include "Runtime/GuiSys/CGuiModel.hpp"
|
|
|
|
#include "Runtime/GuiSys/CGuiTableGroup.hpp"
|
|
|
|
#include "Runtime/GuiSys/CGuiTextPane.hpp"
|
2019-10-15 14:22:47 +00:00
|
|
|
#include "Runtime/MP1/CArtifactDoll.hpp"
|
2019-10-15 14:13:27 +00:00
|
|
|
#include "Runtime/MP1/MP1.hpp"
|
2017-05-02 04:00:38 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce::MP1 {
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
CLogBookScreen::CLogBookScreen(const CStateManager& mgr, CGuiFrame& frame, const CStringTable& pauseStrg)
|
2020-04-21 07:22:41 +00:00
|
|
|
: CPauseScreenBase(mgr, frame, pauseStrg, true) {
|
2018-12-08 05:30:43 +00:00
|
|
|
x19c_scanCompletes.resize(5);
|
|
|
|
x200_viewScans.resize(5);
|
|
|
|
x258_artifactDoll = std::make_unique<CArtifactDoll>();
|
|
|
|
CMain::EnsureWorldPaksReady();
|
|
|
|
InitializeLogBook();
|
2017-05-13 04:57:24 +00:00
|
|
|
}
|
2017-05-02 04:00:38 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
CLogBookScreen::~CLogBookScreen() {
|
|
|
|
CArtifactDoll::CompleteArtifactHeadScan(x4_mgr);
|
|
|
|
for (CGuiModel* model : x144_model_titles)
|
|
|
|
model->SetLocalTransform(model->GetTransform());
|
|
|
|
CMain::EnsureWorldPakReady(g_GameState->CurrentWorldAssetId());
|
2017-05-13 04:57:24 +00:00
|
|
|
}
|
|
|
|
|
2021-06-05 05:27:52 +00:00
|
|
|
bool CLogBookScreen::IsScanComplete(CWorldSaveGameInfo::EScanCategory category, CAssetId scan,
|
2018-12-08 05:30:43 +00:00
|
|
|
const CPlayerState& playerState) {
|
2020-03-08 15:15:10 +00:00
|
|
|
const float time = playerState.GetScanTime(scan);
|
2021-06-05 05:27:52 +00:00
|
|
|
if (category == CWorldSaveGameInfo::EScanCategory::Artifact) {
|
2018-12-08 05:30:43 +00:00
|
|
|
return time >= 0.5f;
|
2020-03-08 15:15:10 +00:00
|
|
|
} else {
|
2018-12-08 05:30:43 +00:00
|
|
|
return time >= 1.f;
|
2020-03-08 15:15:10 +00:00
|
|
|
}
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CLogBookScreen::InitializeLogBook() {
|
2019-10-15 13:12:58 +00:00
|
|
|
for (size_t i = 0; i < x19c_scanCompletes.size(); ++i) {
|
2021-06-05 05:27:52 +00:00
|
|
|
x19c_scanCompletes[i].reserve(g_MemoryCardSys->GetScanCategoryCount(CWorldSaveGameInfo::EScanCategory(i + 1)));
|
2019-10-15 11:08:45 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
CPlayerState& playerState = *x4_mgr.GetPlayerState();
|
2019-10-15 11:08:45 +00:00
|
|
|
for (const auto& [scanId, scanCategory] : g_MemoryCardSys->GetScanStates()) {
|
2021-06-05 05:27:52 +00:00
|
|
|
if (scanCategory == CWorldSaveGameInfo::EScanCategory::None) {
|
2018-12-08 05:30:43 +00:00
|
|
|
continue;
|
2019-10-15 11:08:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const bool complete = IsScanComplete(scanCategory, scanId, playerState);
|
|
|
|
x19c_scanCompletes[int(scanCategory) - 1].emplace_back(scanId, complete);
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::sort(x19c_scanCompletes[4].begin(), x19c_scanCompletes[4].end(),
|
|
|
|
[](const std::pair<CAssetId, bool>& a, std::pair<CAssetId, bool>& b) {
|
|
|
|
return CArtifactDoll::GetArtifactHeadScanIndex(a.first) <
|
|
|
|
CArtifactDoll::GetArtifactHeadScanIndex(b.first);
|
|
|
|
});
|
|
|
|
|
|
|
|
auto viewIt = x200_viewScans.begin();
|
2019-10-15 11:08:45 +00:00
|
|
|
for (const std::vector<std::pair<CAssetId, bool>>& category : x19c_scanCompletes) {
|
|
|
|
const size_t viewScanCount = std::min(category.size(), size_t(5));
|
|
|
|
auto& viewScans = *viewIt++;
|
2018-12-08 05:30:43 +00:00
|
|
|
viewScans.reserve(viewScanCount);
|
2019-10-15 11:08:45 +00:00
|
|
|
|
|
|
|
for (size_t i = 0; i < viewScanCount; ++i) {
|
|
|
|
viewScans.emplace_back(g_SimplePool->GetObj({FOURCC('SCAN'), category[i].first}), TLockedToken<CStringTable>{});
|
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CLogBookScreen::UpdateRightTitles() {
|
2021-06-07 19:29:18 +00:00
|
|
|
const std::vector<std::pair<CAssetId, bool>>& category =
|
|
|
|
x19c_scanCompletes[x70_tablegroup_leftlog->GetUserSelection()];
|
2019-06-12 02:05:17 +00:00
|
|
|
for (size_t i = 0; i < xd8_textpane_titles.size(); ++i) {
|
2018-12-08 05:30:43 +00:00
|
|
|
std::u16string string;
|
2019-10-15 13:36:07 +00:00
|
|
|
const auto scanIndex = size_t(x18_firstViewRightSel) + i;
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (scanIndex < x1f0_curViewScans.size()) {
|
2019-10-15 13:36:07 +00:00
|
|
|
const auto& scan = x1f0_curViewScans[scanIndex];
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (scan.second && scan.second.IsLoaded()) {
|
|
|
|
if (category[scanIndex].second) {
|
2019-10-15 13:36:07 +00:00
|
|
|
if (scan.second->GetStringCount() > 1) {
|
2018-12-08 05:30:43 +00:00
|
|
|
string = scan.second->GetString(1);
|
2019-10-15 13:36:07 +00:00
|
|
|
} else {
|
2018-12-08 05:30:43 +00:00
|
|
|
string = u"No Title!";
|
2019-10-15 13:36:07 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
} else {
|
|
|
|
string = u"??????";
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2017-05-14 19:58:44 +00:00
|
|
|
|
2019-10-15 13:36:07 +00:00
|
|
|
if (string.empty()) {
|
2018-12-08 05:30:43 +00:00
|
|
|
string = u"........";
|
2019-10-15 13:36:07 +00:00
|
|
|
}
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
2019-10-15 13:36:07 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
xd8_textpane_titles[i]->TextSupport().SetText(string);
|
|
|
|
}
|
|
|
|
|
2019-10-15 13:36:07 +00:00
|
|
|
const int rightSelMod = x18_firstViewRightSel % 5;
|
|
|
|
const int rightSelRem = 5 - rightSelMod;
|
2019-06-12 02:05:17 +00:00
|
|
|
for (size_t i = 0; i < x144_model_titles.size(); ++i) {
|
2019-10-15 13:36:07 +00:00
|
|
|
const float zOff = float(((int(i) >= rightSelMod) ? rightSelRem - 5 : rightSelRem)) * x38_highlightPitch;
|
2018-12-08 05:30:43 +00:00
|
|
|
x144_model_titles[i]->SetLocalTransform(zeus::CTransform::Translate(0.f, 0.f, zOff) *
|
|
|
|
x144_model_titles[i]->GetTransform());
|
|
|
|
}
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CLogBookScreen::PumpArticleLoad() {
|
|
|
|
x260_24_loaded = true;
|
2019-10-15 13:40:05 +00:00
|
|
|
for (auto& category : x200_viewScans) {
|
|
|
|
for (auto& [scanInfo, stringTable] : category) {
|
|
|
|
if (scanInfo.IsLoaded()) {
|
|
|
|
if (!stringTable) {
|
|
|
|
stringTable = g_SimplePool->GetObj({FOURCC('STRG'), scanInfo->GetStringTableId()});
|
2018-12-08 05:30:43 +00:00
|
|
|
x260_24_loaded = false;
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
} else {
|
|
|
|
x260_24_loaded = false;
|
|
|
|
}
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int rem = 6;
|
2019-10-15 13:40:05 +00:00
|
|
|
for (auto& [scanInfo, stringTable] : x1f0_curViewScans) {
|
|
|
|
if (scanInfo.IsLoaded()) {
|
|
|
|
if (!stringTable) {
|
|
|
|
stringTable = g_SimplePool->GetObj({FOURCC('STRG'), scanInfo->GetStringTableId()});
|
|
|
|
stringTable.Lock();
|
2018-12-08 05:30:43 +00:00
|
|
|
--rem;
|
|
|
|
}
|
2019-10-15 13:40:05 +00:00
|
|
|
} else if (scanInfo.IsLocked()) {
|
2018-12-08 05:30:43 +00:00
|
|
|
--rem;
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
if (rem == 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x1f0_curViewScans.size()) {
|
|
|
|
int articleIdx = x18_firstViewRightSel;
|
|
|
|
while (rem > 0) {
|
|
|
|
x1f0_curViewScans[articleIdx].first.Lock();
|
|
|
|
articleIdx = NextSurroundingArticleIndex(articleIdx);
|
|
|
|
if (articleIdx == -1)
|
|
|
|
break;
|
|
|
|
--rem;
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2017-05-14 19:58:44 +00:00
|
|
|
|
2019-10-15 13:40:05 +00:00
|
|
|
for (const auto& [scanInfo, stringTable] : x1f0_curViewScans) {
|
|
|
|
if (!scanInfo.IsLoaded()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (!stringTable || !stringTable.IsLoaded()) {
|
|
|
|
continue;
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
2019-10-15 13:40:05 +00:00
|
|
|
|
|
|
|
UpdateRightTitles();
|
|
|
|
UpdateBodyText();
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
|
|
|
|
2021-06-05 05:27:52 +00:00
|
|
|
bool CLogBookScreen::IsScanCategoryReady(CWorldSaveGameInfo::EScanCategory category) const {
|
2019-10-15 14:00:10 +00:00
|
|
|
const CPlayerState& playerState = *x4_mgr.GetPlayerState();
|
|
|
|
const auto& scanState = g_MemoryCardSys->GetScanStates();
|
|
|
|
|
|
|
|
return std::any_of(scanState.cbegin(), scanState.cend(), [category, &playerState](const auto& state) {
|
|
|
|
if (state.second != category) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return IsScanComplete(state.second, state.first, playerState);
|
|
|
|
});
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CLogBookScreen::UpdateBodyText() {
|
|
|
|
if (x10_mode != EMode::TextScroll) {
|
|
|
|
x174_textpane_body->TextSupport().SetText(u"");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-10-15 14:05:50 +00:00
|
|
|
const TCachedToken<CStringTable>& str = x1f0_curViewScans[x1c_rightSel].second;
|
|
|
|
if (!str || !str.IsLoaded()) {
|
|
|
|
return;
|
|
|
|
}
|
2017-05-14 19:58:44 +00:00
|
|
|
|
2019-10-15 14:05:50 +00:00
|
|
|
std::u16string accumStr = str->GetString(0);
|
|
|
|
if (str->GetStringCount() > 2) {
|
|
|
|
accumStr += u"\n\n";
|
|
|
|
accumStr += str->GetString(2);
|
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2019-10-15 14:05:50 +00:00
|
|
|
if (IsArtifactCategorySelected()) {
|
|
|
|
const int headIdx = GetSelectedArtifactHeadScanIndex();
|
|
|
|
if (headIdx >= 0 && g_GameState->GetPlayerState()->HasPowerUp(CPlayerState::EItemType(headIdx + 29))) {
|
2020-04-16 10:25:59 +00:00
|
|
|
if (g_Main->IsUSA() && !g_Main->IsTrilogy()) {
|
2020-04-16 06:57:04 +00:00
|
|
|
accumStr = std::u16string(u"\n\n\n\n\n\n").append(g_MainStringTable->GetString(105));
|
2020-04-16 10:25:59 +00:00
|
|
|
} else {
|
2020-04-16 06:57:04 +00:00
|
|
|
accumStr = std::u16string(u"\n\n\n\n\n\n").append(g_MainStringTable->GetString(107));
|
2020-04-16 10:25:59 +00:00
|
|
|
}
|
2019-10-15 14:05:50 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2019-10-15 14:05:50 +00:00
|
|
|
|
|
|
|
x174_textpane_body->TextSupport().SetText(accumStr, true);
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CLogBookScreen::UpdateBodyImagesAndText() {
|
|
|
|
const CScannableObjectInfo* scan = x1f0_curViewScans[x1c_rightSel].first.GetObj();
|
|
|
|
for (CAuiImagePane* pane : xf0_imagePanes) {
|
|
|
|
pane->SetTextureID0(-1, g_SimplePool);
|
2019-02-24 07:15:54 +00:00
|
|
|
pane->SetAnimationParms(zeus::skZero2f, 0.f, 0.f);
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
|
2020-04-13 01:54:40 +00:00
|
|
|
for (size_t i = 0; i < CScannableObjectInfo::NumBuckets; ++i) {
|
2018-12-08 05:30:43 +00:00
|
|
|
const CScannableObjectInfo::SBucket& bucket = scan->GetBucket(i);
|
2020-04-13 01:54:40 +00:00
|
|
|
if (bucket.x8_imagePos == UINT32_MAX) {
|
2018-12-08 05:30:43 +00:00
|
|
|
continue;
|
2020-04-13 01:54:40 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
CAuiImagePane* pane = xf0_imagePanes[bucket.x8_imagePos];
|
|
|
|
if (bucket.x14_interval > 0.f) {
|
|
|
|
pane->SetAnimationParms(zeus::CVector2f(bucket.xc_size.x, bucket.xc_size.y), bucket.x14_interval,
|
|
|
|
bucket.x18_fadeDuration);
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
pane->SetTextureID0(bucket.x0_texture, g_SimplePool);
|
|
|
|
pane->SetFlashFactor(0.f);
|
|
|
|
}
|
2017-05-14 19:58:44 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x260_26_exitTextScroll = false;
|
|
|
|
UpdateBodyText();
|
|
|
|
}
|
2017-05-14 19:58:44 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
int CLogBookScreen::NextSurroundingArticleIndex(int cur) const {
|
|
|
|
if (cur < x18_firstViewRightSel) {
|
2019-10-15 13:36:07 +00:00
|
|
|
const int tmp = x18_firstViewRightSel + (x18_firstViewRightSel - cur + 6);
|
|
|
|
|
|
|
|
if (tmp >= int(x1f0_curViewScans.size())) {
|
2018-12-08 05:30:43 +00:00
|
|
|
return cur - 1;
|
2019-10-15 13:36:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return tmp;
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (cur < x18_firstViewRightSel + 6) {
|
2019-10-15 13:36:07 +00:00
|
|
|
if (cur + 1 < int(x1f0_curViewScans.size())) {
|
2018-12-08 05:30:43 +00:00
|
|
|
return cur + 1;
|
2019-10-15 13:36:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (x18_firstViewRightSel == 0) {
|
2018-12-08 05:30:43 +00:00
|
|
|
return -1;
|
2019-10-15 13:36:07 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
return x18_firstViewRightSel - 1;
|
|
|
|
}
|
|
|
|
|
2019-10-15 13:36:07 +00:00
|
|
|
const int tmp = x18_firstViewRightSel - (cur - (x18_firstViewRightSel + 5));
|
|
|
|
if (tmp >= 0) {
|
2018-12-08 05:30:43 +00:00
|
|
|
return tmp;
|
2019-10-15 13:36:07 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2019-10-15 13:36:07 +00:00
|
|
|
if (cur >= int(x1f0_curViewScans.size()) - 1) {
|
2018-12-08 05:30:43 +00:00
|
|
|
return -1;
|
2019-10-15 13:36:07 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
return cur + 1;
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
bool CLogBookScreen::IsArtifactCategorySelected() const { return x70_tablegroup_leftlog->GetUserSelection() == 4; }
|
2017-05-14 19:58:44 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
int CLogBookScreen::GetSelectedArtifactHeadScanIndex() const {
|
2019-10-15 13:36:07 +00:00
|
|
|
const auto& category = x19c_scanCompletes[x70_tablegroup_leftlog->GetUserSelection()];
|
|
|
|
|
|
|
|
if (x1c_rightSel < int(category.size())) {
|
2018-12-08 05:30:43 +00:00
|
|
|
return CArtifactDoll::GetArtifactHeadScanIndex(category[x1c_rightSel].first);
|
2019-10-15 13:36:07 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2017-05-14 19:58:44 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
bool CLogBookScreen::InputDisabled() const { return x25c_leavePauseState == ELeavePauseState::LeavingPause; }
|
2017-05-14 19:58:44 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CLogBookScreen::TransitioningAway() { x25c_leavePauseState = ELeavePauseState::LeavingPause; }
|
2017-05-13 04:57:24 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CLogBookScreen::Update(float dt, CRandom16& rand, CArchitectureQueue& archQueue) {
|
|
|
|
CPauseScreenBase::Update(dt, rand, archQueue);
|
|
|
|
x258_artifactDoll->Update(dt, x4_mgr);
|
|
|
|
PumpArticleLoad();
|
2017-05-02 04:00:38 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (x10_mode == EMode::TextScroll) {
|
|
|
|
if (x260_25_inTextScroll)
|
|
|
|
x254_viewInterp = std::min(x254_viewInterp + 4.f * dt, 1.f);
|
|
|
|
else
|
|
|
|
x254_viewInterp = std::max(0.f, x254_viewInterp - 4.f * dt);
|
2017-05-14 19:58:44 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (x254_viewInterp == 0.f && x25c_leavePauseState == ELeavePauseState::InPause)
|
|
|
|
ChangeMode(EMode::RightTable);
|
2019-01-21 04:10:34 +00:00
|
|
|
} else {
|
|
|
|
x254_viewInterp = std::max(0.f, x254_viewInterp - 4.f * dt);
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
|
2019-01-21 04:10:34 +00:00
|
|
|
zeus::CColor color(1.f, x254_viewInterp);
|
|
|
|
x74_basewidget_leftguages->SetColor(color);
|
|
|
|
x88_basewidget_rightguages->SetColor(color);
|
|
|
|
|
|
|
|
zeus::CColor invColor(1.f, 1.f - x254_viewInterp);
|
|
|
|
x70_tablegroup_leftlog->SetColor(invColor);
|
|
|
|
x84_tablegroup_rightlog->SetColor(invColor);
|
|
|
|
x17c_model_textalpha->SetColor(invColor);
|
|
|
|
x174_textpane_body->SetColor(color);
|
|
|
|
|
|
|
|
for (CAuiImagePane* pane : xf0_imagePanes)
|
|
|
|
pane->SetDeResFactor(1.f - x254_viewInterp);
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (x25c_leavePauseState == ELeavePauseState::LeavingPause && x254_viewInterp == 0.f)
|
|
|
|
x25c_leavePauseState = ELeavePauseState::LeftPause;
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CLogBookScreen::Touch() {
|
|
|
|
CPauseScreenBase::Touch();
|
|
|
|
x258_artifactDoll->Touch();
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CLogBookScreen::ProcessControllerInput(const CFinalInput& input) {
|
|
|
|
x260_25_inTextScroll = false;
|
|
|
|
if (x25c_leavePauseState == ELeavePauseState::LeftPause)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (x10_mode == EMode::TextScroll) {
|
|
|
|
int oldPage = x174_textpane_body->TextSupport().GetPageCounter();
|
|
|
|
int newPage = oldPage;
|
|
|
|
int pageCount = x174_textpane_body->TextSupport().GetTotalPageCount();
|
|
|
|
bool lastPage = (pageCount - 1) == oldPage;
|
|
|
|
if (pageCount != -1) {
|
2019-01-21 04:10:34 +00:00
|
|
|
if (input.PLAUp() || m_bodyUpClicked)
|
2018-12-08 05:30:43 +00:00
|
|
|
newPage = std::max(oldPage - 1, 0);
|
2019-01-21 04:10:34 +00:00
|
|
|
else if (input.PLADown() || m_bodyDownClicked ||
|
2021-06-07 19:29:18 +00:00
|
|
|
((input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter) || m_bodyClicked) && !lastPage))
|
2018-12-08 05:30:43 +00:00
|
|
|
newPage = std::min(oldPage + 1, pageCount - 1);
|
|
|
|
x174_textpane_body->TextSupport().SetPage(newPage);
|
|
|
|
if (oldPage != newPage)
|
|
|
|
CSfxManager::SfxStart(SFXui_pause_screen_next_page, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
x198_28_pulseTextArrowTop = newPage > 0;
|
|
|
|
x198_29_pulseTextArrowBottom = !lastPage;
|
|
|
|
} else {
|
|
|
|
x198_29_pulseTextArrowBottom = false;
|
|
|
|
x198_28_pulseTextArrowTop = false;
|
|
|
|
}
|
2017-05-14 19:58:44 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (!x260_26_exitTextScroll)
|
2021-06-07 19:29:18 +00:00
|
|
|
x260_26_exitTextScroll =
|
|
|
|
input.PB() || input.PSpecialKey(boo::ESpecialKey::Esc) ||
|
|
|
|
((input.PA() || input.PSpecialKey(boo::ESpecialKey::Enter) || m_bodyClicked) && lastPage);
|
2017-05-14 19:58:44 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (g_tweakGui->GetLatchArticleText())
|
|
|
|
x260_25_inTextScroll = !x260_26_exitTextScroll;
|
2017-05-14 19:58:44 +00:00
|
|
|
else
|
2018-12-08 05:30:43 +00:00
|
|
|
x260_25_inTextScroll = input.DA();
|
|
|
|
} else {
|
|
|
|
x198_29_pulseTextArrowBottom = false;
|
|
|
|
x198_28_pulseTextArrowTop = false;
|
|
|
|
}
|
2017-05-14 19:58:44 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (x25c_leavePauseState == ELeavePauseState::LeavingPause)
|
|
|
|
x260_25_inTextScroll = false;
|
2017-05-14 19:58:44 +00:00
|
|
|
|
2019-01-21 04:10:34 +00:00
|
|
|
CPauseScreenBase::ProcessMouseInput(input, 0.f);
|
2018-12-08 05:30:43 +00:00
|
|
|
CPauseScreenBase::ProcessControllerInput(input);
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CLogBookScreen::Draw(float transInterp, float totalAlpha, float yOff) {
|
2019-07-21 08:42:52 +00:00
|
|
|
SCOPED_GRAPHICS_DEBUG_GROUP("CInventoryScreen::Draw", zeus::skPurple);
|
2018-12-08 05:30:43 +00:00
|
|
|
CPauseScreenBase::Draw(transInterp, totalAlpha, yOff);
|
|
|
|
bool artifactSel = x10_mode == EMode::RightTable && IsArtifactCategorySelected();
|
|
|
|
x258_artifactDoll->Draw(transInterp * (1.f - x254_viewInterp), x4_mgr, artifactSel,
|
|
|
|
GetSelectedArtifactHeadScanIndex());
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
bool CLogBookScreen::VReady() const { return true; }
|
2017-05-02 04:00:38 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CLogBookScreen::VActivate() {
|
2019-10-15 13:12:58 +00:00
|
|
|
for (int i = 0; i < int(xa8_textpane_categories.size()); ++i) {
|
2021-06-05 05:27:52 +00:00
|
|
|
if (IsScanCategoryReady(CWorldSaveGameInfo::EScanCategory(i + 1))) {
|
2018-12-08 05:30:43 +00:00
|
|
|
xa8_textpane_categories[i]->TextSupport().SetText(xc_pauseStrg.GetString(i + 1));
|
|
|
|
} else {
|
|
|
|
xa8_textpane_categories[i]->TextSupport().SetText(u"??????");
|
|
|
|
x70_tablegroup_leftlog->GetWorkerWidget(i)->SetIsSelectable(false);
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2017-05-14 19:58:44 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x178_textpane_title->TextSupport().SetText(xc_pauseStrg.GetString(0));
|
2017-05-02 04:00:38 +00:00
|
|
|
|
2018-01-05 03:02:30 +00:00
|
|
|
#if 0
|
|
|
|
for (int i=5 ; i<5 ; ++i)
|
2017-05-14 19:58:44 +00:00
|
|
|
x70_tablegroup_leftlog->GetWorkerWidget(i)->SetIsSelectable(false);
|
2018-01-05 03:02:30 +00:00
|
|
|
#endif
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CLogBookScreen::RightTableSelectionChanged(int oldSel, int newSel) { UpdateRightTitles(); }
|
2017-05-14 19:58:44 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CLogBookScreen::ChangedMode(EMode oldMode) {
|
|
|
|
if (oldMode == EMode::TextScroll) {
|
|
|
|
x74_basewidget_leftguages->SetVisibility(false, ETraversalMode::Children);
|
|
|
|
x88_basewidget_rightguages->SetVisibility(false, ETraversalMode::Children);
|
|
|
|
UpdateBodyText();
|
|
|
|
x174_textpane_body->TextSupport().SetPage(0);
|
|
|
|
} else if (x10_mode == EMode::TextScroll) {
|
|
|
|
x74_basewidget_leftguages->SetVisibility(true, ETraversalMode::Children);
|
|
|
|
x88_basewidget_rightguages->SetVisibility(true, ETraversalMode::Children);
|
|
|
|
x260_25_inTextScroll = true;
|
|
|
|
UpdateBodyImagesAndText();
|
|
|
|
}
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CLogBookScreen::UpdateRightTable() {
|
|
|
|
CPauseScreenBase::UpdateRightTable();
|
2019-10-15 13:40:05 +00:00
|
|
|
|
|
|
|
const auto& category = x19c_scanCompletes[x70_tablegroup_leftlog->GetUserSelection()];
|
2018-12-08 05:30:43 +00:00
|
|
|
x1f0_curViewScans.clear();
|
|
|
|
x1f0_curViewScans.reserve(category.size());
|
2019-10-15 11:08:45 +00:00
|
|
|
for (const std::pair<CAssetId, bool>& scan : category) {
|
|
|
|
x1f0_curViewScans.emplace_back(g_SimplePool->GetObj({FOURCC('SCAN'), scan.first}), TLockedToken<CStringTable>{});
|
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
PumpArticleLoad();
|
|
|
|
UpdateRightTitles();
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
bool CLogBookScreen::ShouldLeftTableAdvance() const {
|
|
|
|
if (!x260_24_loaded || x1f0_curViewScans.empty())
|
|
|
|
return false;
|
2021-06-05 05:27:52 +00:00
|
|
|
return IsScanCategoryReady(CWorldSaveGameInfo::EScanCategory(x70_tablegroup_leftlog->GetUserSelection() + 1));
|
2017-05-14 19:58:44 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
bool CLogBookScreen::ShouldRightTableAdvance() const {
|
2019-10-15 13:40:05 +00:00
|
|
|
const auto& [info, stringTable] = x1f0_curViewScans[x1c_rightSel];
|
|
|
|
return info.IsLoaded() && stringTable.IsLoaded();
|
2017-05-02 04:00:38 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
u32 CLogBookScreen::GetRightTableCount() const { return x1f0_curViewScans.size(); }
|
2017-05-02 04:00:38 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce::MP1
|