2019-09-14 19:37:13 +00:00
|
|
|
#include "Runtime/MP1/CFrontEndUI.hpp"
|
|
|
|
|
2019-09-14 19:51:19 +00:00
|
|
|
#include <algorithm>
|
|
|
|
#include <array>
|
2017-12-29 08:08:12 +00:00
|
|
|
#include <ctime>
|
2021-06-30 18:20:45 +00:00
|
|
|
#include <fmt/xchar.h>
|
2015-08-27 00:23:46 +00:00
|
|
|
|
2019-09-14 19:37:13 +00:00
|
|
|
#include "NESEmulator/CNESEmulator.hpp"
|
|
|
|
|
|
|
|
#include "Runtime/CArchitectureMessage.hpp"
|
|
|
|
#include "Runtime/CArchitectureQueue.hpp"
|
|
|
|
#include "Runtime/CDependencyGroup.hpp"
|
|
|
|
#include "Runtime/CDvdFile.hpp"
|
|
|
|
#include "Runtime/CGameState.hpp"
|
|
|
|
#include "Runtime/CSimplePool.hpp"
|
|
|
|
#include "Runtime/GameGlobalObjects.hpp"
|
|
|
|
#include "Runtime/Audio/CAudioGroupSet.hpp"
|
|
|
|
#include "Runtime/Audio/CSfxManager.hpp"
|
|
|
|
#include "Runtime/Graphics/CMoviePlayer.hpp"
|
|
|
|
#include "Runtime/GuiSys/CGuiFrame.hpp"
|
|
|
|
#include "Runtime/GuiSys/CGuiModel.hpp"
|
|
|
|
#include "Runtime/GuiSys/CGuiSliderGroup.hpp"
|
|
|
|
#include "Runtime/GuiSys/CGuiTableGroup.hpp"
|
|
|
|
#include "Runtime/GuiSys/CGuiTextPane.hpp"
|
|
|
|
#include "Runtime/GuiSys/CGuiWidgetDrawParms.hpp"
|
|
|
|
#include "Runtime/GuiSys/CStringTable.hpp"
|
|
|
|
#include "Runtime/Input/RumbleFxTable.hpp"
|
|
|
|
#include "Runtime/MP1/CQuitGameScreen.hpp"
|
|
|
|
#include "Runtime/MP1/CSaveGameScreen.hpp"
|
|
|
|
#include "Runtime/MP1/CSlideShow.hpp"
|
|
|
|
#include "Runtime/MP1/MP1.hpp"
|
2015-08-27 00:23:46 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce::MP1 {
|
2019-09-14 19:45:14 +00:00
|
|
|
namespace {
|
2019-02-03 21:20:05 +00:00
|
|
|
#define FE_USE_SECONDS_IN_ELAPSED 1
|
|
|
|
|
2016-12-14 22:56:59 +00:00
|
|
|
/* Music volume constants */
|
2019-09-14 19:45:14 +00:00
|
|
|
constexpr float FE1_VOL = 0.7421875f;
|
|
|
|
constexpr float FE2_VOL = 0.7421875f;
|
2016-12-14 22:56:59 +00:00
|
|
|
|
2016-12-13 05:22:30 +00:00
|
|
|
/* L/R Stereo transition cues */
|
2019-09-14 19:51:19 +00:00
|
|
|
constexpr std::array<std::array<u16, 2>, 3> FETransitionBackSFX{{
|
2019-09-14 19:45:14 +00:00
|
|
|
{SFXfnt_transfore_00L, SFXfnt_transfore_00R},
|
|
|
|
{SFXfnt_transfore_01L, SFXfnt_transfore_01R},
|
|
|
|
{SFXfnt_transfore_02L, SFXfnt_transfore_02R},
|
2019-09-14 19:51:19 +00:00
|
|
|
}};
|
2016-12-13 05:22:30 +00:00
|
|
|
|
2019-09-14 19:51:19 +00:00
|
|
|
constexpr std::array<std::array<u16, 2>, 3> FETransitionForwardSFX{{
|
2019-09-14 19:45:14 +00:00
|
|
|
{SFXfnt_transback_00L, SFXfnt_transback_00R},
|
|
|
|
{SFXfnt_transback_01L, SFXfnt_transback_01R},
|
|
|
|
{SFXfnt_transback_02L, SFXfnt_transback_02R},
|
2019-09-14 19:51:19 +00:00
|
|
|
}};
|
2016-12-13 05:22:30 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
struct FEMovie {
|
|
|
|
const char* path;
|
|
|
|
bool loop;
|
2016-12-13 05:22:30 +00:00
|
|
|
};
|
|
|
|
|
2022-02-08 06:54:05 +00:00
|
|
|
constexpr std::array<FEMovie, 8> FEMovies{{
|
2016-12-13 05:22:30 +00:00
|
|
|
{"Video/00_first_start.thp", false},
|
|
|
|
{"Video/01_startloop.thp", true},
|
|
|
|
{"Video/02_start_fileselect_A.thp", false},
|
|
|
|
{"Video/03_fileselectloop.thp", true},
|
|
|
|
{"Video/04_fileselect_playgame_A.thp", false},
|
|
|
|
{"Video/06_fileselect_GBA.thp", false},
|
|
|
|
{"Video/07_GBAloop.thp", true},
|
|
|
|
{"Video/08_GBA_fileselect.thp", false},
|
2019-09-14 19:51:19 +00:00
|
|
|
}};
|
2016-12-13 05:22:30 +00:00
|
|
|
|
2022-02-19 13:04:45 +00:00
|
|
|
constexpr SObjectTag g_DefaultWorldTag = {FOURCC('MLVL'), 0x158efe17u};
|
2019-09-14 19:51:19 +00:00
|
|
|
|
|
|
|
constexpr std::array<float, 3> AudioFadeTimeA{
|
|
|
|
0.44f,
|
|
|
|
5.41f,
|
|
|
|
3.41f,
|
2016-12-13 05:22:30 +00:00
|
|
|
};
|
|
|
|
|
2019-09-14 19:51:19 +00:00
|
|
|
constexpr std::array<float, 3> AudioFadeTimeB{
|
|
|
|
4.2f,
|
|
|
|
6.1f,
|
|
|
|
6.1f,
|
|
|
|
};
|
|
|
|
|
|
|
|
constexpr std::array<CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EUIType, 10> NextLinkUI{
|
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EUIType::ConnectSocket,
|
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EUIType::PressStartAndSelect,
|
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EUIType::BeginLink,
|
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EUIType::Linking,
|
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EUIType::Empty,
|
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EUIType::TurnOffGBA,
|
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EUIType::Complete,
|
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EUIType::InsertPak,
|
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EUIType::Empty,
|
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EUIType::Empty,
|
|
|
|
};
|
|
|
|
|
|
|
|
constexpr std::array<CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EUIType, 10> PrevLinkUI{
|
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EUIType::Cancelled,
|
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EUIType::Cancelled,
|
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EUIType::Cancelled,
|
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EUIType::Cancelled,
|
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EUIType::Empty,
|
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EUIType::Cancelled,
|
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EUIType::Empty,
|
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EUIType::Cancelled,
|
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EUIType::Empty,
|
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EUIType::Empty,
|
|
|
|
};
|
2019-09-14 19:45:14 +00:00
|
|
|
} // Anonymous namespace
|
2016-09-16 20:18:03 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::PlayAdvanceSfx() {
|
|
|
|
CSfxManager::SfxStart(SFXfnt_advance_L, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
CSfxManager::SfxStart(SFXfnt_advance_R, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
2016-12-15 22:37:34 +00:00
|
|
|
}
|
|
|
|
|
2022-03-06 07:46:42 +00:00
|
|
|
CFrontEndUI::SNewFileSelectFrame::SNewFileSelectFrame(CSaveGameScreen* sui, u32 rnd) : x0_rnd(rnd), x4_saveUI(sui) {
|
2018-12-08 05:30:43 +00:00
|
|
|
x10_frme = g_SimplePool->GetObj("FRME_NewFileSelect");
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::SNewFileSelectFrame::FinishedLoading() {
|
2019-03-13 03:46:20 +00:00
|
|
|
x1c_loadedFrame->Reset();
|
2018-12-08 05:30:43 +00:00
|
|
|
x1c_loadedFrame->SetAspectConstraint(1.78f);
|
|
|
|
|
|
|
|
x20_tablegroup_fileselect = static_cast<CGuiTableGroup*>(x1c_loadedFrame->FindWidget("tablegroup_fileselect"));
|
|
|
|
x24_model_erase = static_cast<CGuiModel*>(x1c_loadedFrame->FindWidget("model_erase"));
|
|
|
|
xf8_model_erase_position = x24_model_erase->GetLocalPosition();
|
2020-04-17 12:53:22 +00:00
|
|
|
|
|
|
|
// TODO: Implement language menu
|
|
|
|
auto langPair = FindTextPanePair(x1c_loadedFrame, "textpane_lang");
|
|
|
|
if (langPair.x0_panes[0] != nullptr) {
|
|
|
|
langPair.x0_panes[0]->SetIsSelectable(false);
|
|
|
|
langPair.x0_panes[0]->SetIsVisible(false);
|
|
|
|
langPair.x0_panes[1]->SetIsSelectable(false);
|
|
|
|
langPair.x0_panes[1]->SetIsVisible(false);
|
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x28_textpane_erase = FindTextPanePair(x1c_loadedFrame, "textpane_erase");
|
|
|
|
x38_textpane_gba = FindTextPanePair(x1c_loadedFrame, "textpane_gba");
|
|
|
|
x30_textpane_cheats = FindTextPanePair(x1c_loadedFrame, "textpane_cheats");
|
|
|
|
x48_textpane_popupadvance = FindTextPanePair(x1c_loadedFrame, "textpane_popupadvance");
|
|
|
|
x50_textpane_popupcancel = FindTextPanePair(x1c_loadedFrame, "textpane_popupcancel");
|
|
|
|
x58_textpane_popupextra = FindTextPanePair(x1c_loadedFrame, "textpane_popupextra");
|
|
|
|
x40_tablegroup_popup = static_cast<CGuiTableGroup*>(x1c_loadedFrame->FindWidget("tablegroup_popup"));
|
|
|
|
x44_model_dash7 = static_cast<CGuiModel*>(x1c_loadedFrame->FindWidget("model_dash7"));
|
|
|
|
x60_textpane_cancel = static_cast<CGuiTextPane*>(x1c_loadedFrame->FindWidget("textpane_cancel"));
|
2020-04-16 10:25:59 +00:00
|
|
|
FindAndSetPairText(x1c_loadedFrame, "textpane_title",
|
|
|
|
g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 97 : 92));
|
2018-12-08 05:30:43 +00:00
|
|
|
CGuiTextPane* proceed = static_cast<CGuiTextPane*>(x1c_loadedFrame->FindWidget("textpane_proceed"));
|
|
|
|
if (proceed)
|
2020-04-16 10:25:59 +00:00
|
|
|
proceed->TextSupport().SetText(g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 85 : 79));
|
2018-12-08 05:30:43 +00:00
|
|
|
x40_tablegroup_popup->SetIsVisible(false);
|
|
|
|
x40_tablegroup_popup->SetIsActive(false);
|
|
|
|
x40_tablegroup_popup->SetVertical(false);
|
|
|
|
CGuiWidget* worker = x40_tablegroup_popup->GetWorkerWidget(2);
|
|
|
|
worker->SetIsSelectable(false);
|
|
|
|
worker->SetVisibility(false, ETraversalMode::Children);
|
|
|
|
|
2019-08-14 07:45:28 +00:00
|
|
|
x20_tablegroup_fileselect->SetMenuAdvanceCallback([this](CGuiTableGroup* caller) { DoFileMenuAdvance(caller); });
|
2018-12-08 05:30:43 +00:00
|
|
|
x20_tablegroup_fileselect->SetMenuSelectionChangeCallback(
|
2019-08-14 07:45:28 +00:00
|
|
|
[this](CGuiTableGroup* caller, int oldSel) { DoSelectionChange(caller, oldSel); });
|
|
|
|
x20_tablegroup_fileselect->SetMenuCancelCallback([this](CGuiTableGroup* caller) { DoFileMenuCancel(caller); });
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2019-08-14 07:45:28 +00:00
|
|
|
x40_tablegroup_popup->SetMenuAdvanceCallback([this](CGuiTableGroup* caller) { DoPopupAdvance(caller); });
|
2018-12-08 05:30:43 +00:00
|
|
|
x40_tablegroup_popup->SetMenuSelectionChangeCallback(
|
2019-08-14 07:45:28 +00:00
|
|
|
[this](CGuiTableGroup* caller, int oldSel) { DoSelectionChange(caller, oldSel); });
|
|
|
|
x40_tablegroup_popup->SetMenuCancelCallback([this](CGuiTableGroup* caller) { DoPopupCancel(caller); });
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2019-09-14 19:51:19 +00:00
|
|
|
for (size_t i = 0; i < x64_fileSelections.size(); ++i) {
|
|
|
|
x64_fileSelections[i] = FindFileSelectOption(x1c_loadedFrame, int(i));
|
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
x104_rowPitch =
|
|
|
|
(x64_fileSelections[1].x0_base->GetLocalPosition() - x64_fileSelections[0].x0_base->GetLocalPosition()).z();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CFrontEndUI::SNewFileSelectFrame::PumpLoad() {
|
|
|
|
if (x1c_loadedFrame)
|
|
|
|
return true;
|
|
|
|
if (x10_frme.IsLoaded()) {
|
|
|
|
if (x10_frme->GetIsFinishedLoading()) {
|
|
|
|
x1c_loadedFrame = x10_frme.GetObj();
|
|
|
|
FinishedLoading();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
2016-12-14 22:56:59 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
bool CFrontEndUI::SNewFileSelectFrame::IsTextDoneAnimating() const {
|
|
|
|
if (x64_fileSelections[0].x28_curField != 4)
|
|
|
|
return false;
|
|
|
|
if (x64_fileSelections[1].x28_curField != 4)
|
|
|
|
return false;
|
|
|
|
if (x64_fileSelections[2].x28_curField != 4)
|
2016-12-14 22:56:59 +00:00
|
|
|
return false;
|
2018-12-08 05:30:43 +00:00
|
|
|
if (!x28_textpane_erase.x0_panes[0]->GetTextSupport().IsAnimationDone())
|
|
|
|
return false;
|
|
|
|
return x38_textpane_gba.x0_panes[0]->GetTextSupport().IsAnimationDone();
|
2016-12-14 22:56:59 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SNewFileSelectFrame::Update(float dt) {
|
|
|
|
bool saveReady = x4_saveUI->GetUIType() == CSaveGameScreen::EUIType::SaveReady;
|
|
|
|
if (saveReady != x10c_saveReady) {
|
|
|
|
if (saveReady) {
|
|
|
|
ClearFrameContents();
|
|
|
|
} else if (x8_subMenu != ESubMenu::Root) {
|
|
|
|
ResetFrame();
|
|
|
|
DeactivateEraseGamePopup();
|
|
|
|
DeactivateNewGamePopup();
|
|
|
|
x8_subMenu = ESubMenu::Root;
|
2017-01-10 07:15:49 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
x10c_saveReady = saveReady;
|
|
|
|
}
|
|
|
|
if (x10c_saveReady)
|
|
|
|
SetupFrameContents();
|
2017-01-29 03:58:16 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x1c_loadedFrame->Update(dt);
|
2017-01-09 03:44:00 +00:00
|
|
|
}
|
|
|
|
|
2022-03-06 07:46:42 +00:00
|
|
|
CFrontEndUI::SNewFileSelectFrame::EAction CFrontEndUI::SNewFileSelectFrame::ProcessUserInput(const CFinalInput& input) {
|
2018-12-08 05:30:43 +00:00
|
|
|
xc_action = EAction::None;
|
2016-12-18 04:16:04 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (x8_subMenu != ESubMenu::EraseGamePopup)
|
|
|
|
x4_saveUI->ProcessUserInput(input);
|
2016-12-18 04:16:04 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (IsTextDoneAnimating())
|
|
|
|
x108_curTime = std::min(0.5f, x108_curTime + input.DeltaTime());
|
2016-12-18 04:16:04 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (x108_curTime < 0.5f)
|
2016-12-30 06:37:01 +00:00
|
|
|
return xc_action;
|
2016-12-18 04:16:04 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (x10c_saveReady) {
|
|
|
|
x1c_loadedFrame->ProcessUserInput(input);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x10d_needsEraseToggle) {
|
|
|
|
if (x40_tablegroup_popup->GetIsActive())
|
|
|
|
DeactivateEraseGamePopup();
|
2016-12-16 04:35:49 +00:00
|
|
|
else
|
2018-12-08 05:30:43 +00:00
|
|
|
ActivateEraseGamePopup();
|
|
|
|
x10d_needsEraseToggle = false;
|
|
|
|
}
|
2016-12-18 04:16:04 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (x10e_needsNewToggle) {
|
|
|
|
if (x40_tablegroup_popup->GetIsActive())
|
|
|
|
DeactivateNewGamePopup();
|
|
|
|
else
|
|
|
|
ActivateNewGamePopup();
|
|
|
|
x10e_needsNewToggle = false;
|
|
|
|
}
|
2016-12-18 04:16:04 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
return xc_action;
|
2016-12-16 04:35:49 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SNewFileSelectFrame::Draw() const {
|
|
|
|
if (x1c_loadedFrame && x10c_saveReady)
|
2020-04-26 05:15:02 +00:00
|
|
|
x1c_loadedFrame->Draw(CGuiWidgetDrawParms::Default());
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2016-12-18 04:16:04 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SNewFileSelectFrame::HandleActiveChange(CGuiTableGroup* active) {
|
|
|
|
if (!active)
|
|
|
|
return;
|
2016-12-18 04:16:04 +00:00
|
|
|
|
2019-02-24 07:15:54 +00:00
|
|
|
active->SetColors(zeus::skWhite, zeus::CColor{0.627450f, 0.627450f, 0.627450f, 0.784313f});
|
2016-12-18 04:16:04 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (active == x20_tablegroup_fileselect) {
|
|
|
|
x24_model_erase->SetLocalTransform(zeus::CTransform::Translate(
|
|
|
|
zeus::CVector3f{0.f, 0.f, active->GetUserSelection() * x104_rowPitch} + xf8_model_erase_position));
|
|
|
|
}
|
2016-12-18 04:16:04 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (x8_subMenu == ESubMenu::Root || x8_subMenu == ESubMenu::NewGamePopup)
|
|
|
|
x24_model_erase->SetIsVisible(false);
|
|
|
|
else
|
|
|
|
x24_model_erase->SetIsVisible(true);
|
|
|
|
}
|
2016-12-18 04:16:04 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SNewFileSelectFrame::DeactivateEraseGamePopup() {
|
|
|
|
x40_tablegroup_popup->SetIsActive(false);
|
|
|
|
x40_tablegroup_popup->SetIsVisible(false);
|
|
|
|
x20_tablegroup_fileselect->SetIsActive(true);
|
2016-12-18 04:16:04 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
HandleActiveChange(x20_tablegroup_fileselect);
|
2016-12-18 04:16:04 +00:00
|
|
|
|
2019-02-24 07:15:54 +00:00
|
|
|
x64_fileSelections[x20_tablegroup_fileselect->GetUserSelection()].x0_base->SetColor(zeus::skWhite);
|
2016-12-16 23:05:29 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SNewFileSelectFrame::ActivateEraseGamePopup() {
|
|
|
|
x40_tablegroup_popup->SetIsActive(true);
|
|
|
|
x40_tablegroup_popup->SetIsVisible(true);
|
|
|
|
x40_tablegroup_popup->SetLocalTransform(
|
|
|
|
zeus::CTransform::Translate(0.f, 0.f, x20_tablegroup_fileselect->GetUserSelection() * x104_rowPitch) *
|
|
|
|
x40_tablegroup_popup->GetTransform());
|
|
|
|
x20_tablegroup_fileselect->SetIsActive(false);
|
2016-12-18 04:16:04 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x8_subMenu = ESubMenu::EraseGamePopup;
|
|
|
|
HandleActiveChange(x40_tablegroup_popup);
|
2016-12-18 04:16:04 +00:00
|
|
|
|
2020-04-16 10:25:59 +00:00
|
|
|
x48_textpane_popupadvance.SetPairText(
|
|
|
|
g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 95 : 89));
|
|
|
|
x50_textpane_popupcancel.SetPairText(
|
|
|
|
g_MainStringTable->GetString(38)); // This string is unmodified in PAL/NTSCJ/Trilogy
|
2016-12-18 04:16:04 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x64_fileSelections[x20_tablegroup_fileselect->GetUserSelection()].x0_base->SetColor(zeus::CColor{1.f, 1.f, 1.f, 0.f});
|
|
|
|
x44_model_dash7->SetVisibility(false, ETraversalMode::Children);
|
2016-12-16 23:05:29 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SNewFileSelectFrame::DeactivateNewGamePopup() {
|
|
|
|
x40_tablegroup_popup->SetIsActive(false);
|
|
|
|
x40_tablegroup_popup->SetIsVisible(false);
|
|
|
|
x20_tablegroup_fileselect->SetIsActive(true);
|
2016-12-18 04:16:04 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
CGuiWidget* worker = x40_tablegroup_popup->GetWorkerWidget(2);
|
|
|
|
worker->SetIsSelectable(false);
|
|
|
|
worker->SetVisibility(false, ETraversalMode::Children);
|
2016-12-18 04:16:04 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x44_model_dash7->SetVisibility(false, ETraversalMode::Children);
|
2016-12-18 04:16:04 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
HandleActiveChange(x20_tablegroup_fileselect);
|
2016-12-18 04:16:04 +00:00
|
|
|
|
2019-02-24 07:15:54 +00:00
|
|
|
x64_fileSelections[x20_tablegroup_fileselect->GetUserSelection()].x0_base->SetColor(zeus::skWhite);
|
2018-12-08 05:30:43 +00:00
|
|
|
x60_textpane_cancel->TextSupport().SetText(u"");
|
2016-12-16 23:05:29 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SNewFileSelectFrame::ActivateNewGamePopup() {
|
|
|
|
x40_tablegroup_popup->SetIsActive(true);
|
|
|
|
x40_tablegroup_popup->SetIsVisible(true);
|
|
|
|
x40_tablegroup_popup->SetUserSelection(0);
|
|
|
|
x40_tablegroup_popup->SetLocalTransform(
|
|
|
|
zeus::CTransform::Translate(0.f, 0.f, x20_tablegroup_fileselect->GetUserSelection() * x104_rowPitch) *
|
|
|
|
x40_tablegroup_popup->GetTransform());
|
|
|
|
x20_tablegroup_fileselect->SetIsActive(false);
|
|
|
|
|
|
|
|
x8_subMenu = ESubMenu::NewGamePopup;
|
|
|
|
HandleActiveChange(x40_tablegroup_popup);
|
|
|
|
x64_fileSelections[x20_tablegroup_fileselect->GetUserSelection()].x0_base->SetColor(zeus::CColor{1.f, 1.f, 1.f, 0.f});
|
|
|
|
|
|
|
|
PlayAdvanceSfx();
|
|
|
|
|
|
|
|
if (g_GameState->SystemOptions().GetPlayerBeatNormalMode()) {
|
2020-04-16 10:25:59 +00:00
|
|
|
x48_textpane_popupadvance.SetPairText(
|
|
|
|
g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 102 : 96));
|
|
|
|
x50_textpane_popupcancel.SetPairText(
|
|
|
|
g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 94 : 88));
|
|
|
|
x58_textpane_popupextra.SetPairText(
|
|
|
|
g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 101 : 95));
|
2018-12-08 05:30:43 +00:00
|
|
|
CGuiWidget* worker = x40_tablegroup_popup->GetWorkerWidget(2);
|
|
|
|
worker->SetIsSelectable(true);
|
|
|
|
worker->SetVisibility(true, ETraversalMode::Children);
|
|
|
|
x44_model_dash7->SetVisibility(true, ETraversalMode::Children);
|
|
|
|
} else {
|
2020-04-16 10:25:59 +00:00
|
|
|
x48_textpane_popupadvance.SetPairText(
|
|
|
|
g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 67 : 61));
|
|
|
|
x50_textpane_popupcancel.SetPairText(
|
|
|
|
g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 94 : 88));
|
2018-12-08 05:30:43 +00:00
|
|
|
x44_model_dash7->SetVisibility(false, ETraversalMode::Children);
|
|
|
|
}
|
2020-04-16 10:25:59 +00:00
|
|
|
x60_textpane_cancel->TextSupport().SetText(
|
|
|
|
g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 82 : 76));
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::SNewFileSelectFrame::ResetFrame() {
|
|
|
|
x8_subMenu = ESubMenu::Root;
|
|
|
|
|
|
|
|
x38_textpane_gba.x0_panes[0]->SetIsSelectable(true);
|
2019-02-24 07:15:54 +00:00
|
|
|
x38_textpane_gba.x0_panes[0]->TextSupport().SetFontColor(zeus::skWhite);
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
x30_textpane_cheats.x0_panes[0]->SetIsSelectable(true);
|
2019-02-24 07:15:54 +00:00
|
|
|
x30_textpane_cheats.x0_panes[0]->TextSupport().SetFontColor(zeus::skWhite);
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
ClearFrameContents();
|
|
|
|
|
|
|
|
for (int i = 2; i >= 0; --i)
|
|
|
|
x20_tablegroup_fileselect->GetWorkerWidget(i)->SetIsSelectable(true);
|
|
|
|
x60_textpane_cancel->TextSupport().SetText(u"");
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::SNewFileSelectFrame::ActivateErase() {
|
|
|
|
x8_subMenu = ESubMenu::EraseGame;
|
|
|
|
x28_textpane_erase.x0_panes[0]->SetIsSelectable(false);
|
2019-02-24 07:15:54 +00:00
|
|
|
zeus::CColor color = zeus::skGrey;
|
2018-12-08 05:30:43 +00:00
|
|
|
color.a() = 0.5f;
|
|
|
|
x28_textpane_erase.x0_panes[0]->TextSupport().SetFontColor(color);
|
|
|
|
x38_textpane_gba.x0_panes[0]->TextSupport().SetFontColor(color);
|
|
|
|
x30_textpane_cheats.x0_panes[0]->TextSupport().SetFontColor(color);
|
|
|
|
x38_textpane_gba.x0_panes[0]->SetIsSelectable(false);
|
|
|
|
x30_textpane_cheats.x0_panes[0]->SetIsSelectable(false);
|
|
|
|
|
|
|
|
for (int i = 2; i >= 0; --i) {
|
|
|
|
SFileMenuOption& fileOpt = x64_fileSelections[i];
|
|
|
|
if (x4_saveUI->GetGameData(i)) {
|
|
|
|
fileOpt.x0_base->SetIsSelectable(true);
|
|
|
|
x20_tablegroup_fileselect->SetUserSelection(i);
|
|
|
|
} else {
|
|
|
|
fileOpt.x0_base->SetIsSelectable(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-16 10:25:59 +00:00
|
|
|
x60_textpane_cancel->TextSupport().SetText(
|
|
|
|
g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 82 : 76));
|
2018-12-08 05:30:43 +00:00
|
|
|
HandleActiveChange(x20_tablegroup_fileselect);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::SNewFileSelectFrame::ClearFrameContents() {
|
|
|
|
x108_curTime = 0.f;
|
|
|
|
bool hasSave = false;
|
2019-09-14 19:51:19 +00:00
|
|
|
for (size_t i = 0; i < x64_fileSelections.size(); ++i) {
|
|
|
|
if (x4_saveUI->GetGameData(int(i))) {
|
2018-12-08 05:30:43 +00:00
|
|
|
hasSave = true;
|
2019-09-14 19:51:19 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
SFileMenuOption& option = x64_fileSelections[i];
|
|
|
|
option.x2c_chRate = SFileMenuOption::ComputeRandom();
|
|
|
|
option.x28_curField = -1;
|
2019-09-14 19:51:19 +00:00
|
|
|
for (auto& panePair : option.x4_textpanes) {
|
|
|
|
panePair.SetPairText(u"");
|
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
|
2020-04-16 10:25:59 +00:00
|
|
|
StartTextAnimating(x28_textpane_erase.x0_panes[0], g_MainStringTable->GetString(38),
|
|
|
|
60.f); // This string is unmodified in PAL/NTSCJ/Trilogy
|
|
|
|
StartTextAnimating(x38_textpane_gba.x0_panes[0], g_MainStringTable->GetString(37),
|
|
|
|
60.f); // This string is unmodified in PAL/NTSCJ/Trilogy
|
|
|
|
StartTextAnimating(x30_textpane_cheats.x0_panes[0],
|
|
|
|
g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 96 : 90), 60.f);
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2020-04-16 10:25:59 +00:00
|
|
|
StartTextAnimating(x28_textpane_erase.x0_panes[1], g_MainStringTable->GetString(38),
|
|
|
|
60.f); // This string is unmodified in PAL/NTSCJ/Trilogy
|
|
|
|
StartTextAnimating(x38_textpane_gba.x0_panes[1], g_MainStringTable->GetString(37),
|
|
|
|
60.f); // This string is unmodified in PAL/NTSCJ/Trilogy
|
|
|
|
StartTextAnimating(x30_textpane_cheats.x0_panes[1],
|
|
|
|
g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 96 : 90), 60.f);
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
if (hasSave) {
|
|
|
|
x28_textpane_erase.x0_panes[0]->SetIsSelectable(true);
|
2019-02-24 07:15:54 +00:00
|
|
|
x28_textpane_erase.x0_panes[0]->TextSupport().SetFontColor(zeus::skWhite);
|
2018-12-08 05:30:43 +00:00
|
|
|
} else {
|
2017-01-09 03:44:00 +00:00
|
|
|
x28_textpane_erase.x0_panes[0]->SetIsSelectable(false);
|
2019-02-24 07:15:54 +00:00
|
|
|
zeus::CColor color = zeus::skGrey;
|
2018-12-08 01:49:15 +00:00
|
|
|
color.a() = 0.5f;
|
2017-05-31 21:26:50 +00:00
|
|
|
x28_textpane_erase.x0_panes[0]->TextSupport().SetFontColor(color);
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2016-12-16 23:05:29 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x20_tablegroup_fileselect->SetUserSelection(0);
|
|
|
|
CGuiTextPane* cheats = static_cast<CGuiTextPane*>(x20_tablegroup_fileselect->GetWorkerWidget(5));
|
|
|
|
if (CSlideShow::SlideShowGalleryFlags()) {
|
|
|
|
cheats->SetIsSelectable(true);
|
2019-02-24 07:15:54 +00:00
|
|
|
x30_textpane_cheats.x0_panes[0]->TextSupport().SetFontColor(zeus::skWhite);
|
2018-12-08 05:30:43 +00:00
|
|
|
} else {
|
|
|
|
cheats->SetIsSelectable(false);
|
2019-02-24 07:15:54 +00:00
|
|
|
zeus::CColor color = zeus::skGrey;
|
2018-12-08 05:30:43 +00:00
|
|
|
color.a() = 0.5f;
|
|
|
|
x30_textpane_cheats.x0_panes[0]->TextSupport().SetFontColor(color);
|
|
|
|
}
|
|
|
|
|
|
|
|
HandleActiveChange(x20_tablegroup_fileselect);
|
|
|
|
}
|
|
|
|
|
2020-04-16 10:25:59 +00:00
|
|
|
std::u16string GetTimeString(const CGameState::GameFileStateInfo* data) {
|
|
|
|
if (data) {
|
|
|
|
auto pt = std::div(data->x0_playTime, 3600);
|
|
|
|
#if FE_USE_SECONDS_IN_ELAPSED
|
|
|
|
return fmt::format(FMT_STRING(u"{:02d}:{:02d}:{:02d}"), pt.quot, pt.rem / 60, pt.rem % 60);
|
|
|
|
#else
|
|
|
|
return fmt::format(FMT_STRING(u"{:02d}:{:02d}"), pt.quot, pt.rem / 60);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
if (!g_Main->IsUSA() || g_Main->IsTrilogy())
|
|
|
|
return g_MainStringTable->GetString(53);
|
|
|
|
return g_MainStringTable->GetString(52);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::u16string GetElapsedString(const CGameState::GameFileStateInfo* data) {
|
|
|
|
if (!g_Main->IsUSA() || g_Main->IsTrilogy())
|
|
|
|
return g_MainStringTable->GetString(data ? 55 : 54);
|
|
|
|
|
|
|
|
return std::u16string(g_MainStringTable->GetString(data ? 54 : 53));
|
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SNewFileSelectFrame::SetupFrameContents() {
|
2019-09-14 19:51:19 +00:00
|
|
|
for (size_t i = 0; i < x64_fileSelections.size(); ++i) {
|
2018-12-08 05:30:43 +00:00
|
|
|
SFileMenuOption& option = x64_fileSelections[i];
|
2019-09-14 19:51:19 +00:00
|
|
|
if (option.x28_curField == 4) {
|
2018-12-08 05:30:43 +00:00
|
|
|
continue;
|
2019-09-14 19:51:19 +00:00
|
|
|
}
|
|
|
|
|
2019-06-12 02:05:17 +00:00
|
|
|
SGuiTextPair* pair = (option.x28_curField == UINT32_MAX) ? nullptr : &option.x4_textpanes[option.x28_curField];
|
2018-12-08 05:30:43 +00:00
|
|
|
if (!pair || pair->x0_panes[0]->GetTextSupport().GetNumCharsPrinted() >=
|
|
|
|
pair->x0_panes[0]->GetTextSupport().GetNumCharsTotal()) {
|
|
|
|
if (++option.x28_curField < 4) {
|
|
|
|
std::u16string str;
|
|
|
|
SGuiTextPair& populatePair = option.x4_textpanes[option.x28_curField];
|
2019-09-14 19:51:19 +00:00
|
|
|
const CGameState::GameFileStateInfo* data = x4_saveUI->GetGameData(int(i));
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
switch (option.x28_curField) {
|
|
|
|
case 0:
|
|
|
|
// Completion percent
|
|
|
|
if (data) {
|
2020-04-16 10:25:59 +00:00
|
|
|
int strIdx = (data->x20_hardMode ? 106 : 39);
|
|
|
|
if ((!g_Main->IsUSA() || g_Main->IsTrilogy()))
|
|
|
|
strIdx = (strIdx == 106 ? 100 : 40);
|
|
|
|
|
|
|
|
std::u16string fileStr = g_MainStringTable->GetString(strIdx + int(i));
|
2020-04-11 22:51:39 +00:00
|
|
|
str = fileStr + fmt::format(FMT_STRING(u" {:02d}%"), data->x18_itemPercent);
|
2018-12-08 05:30:43 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
str = g_MainStringTable->GetString(36);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
// World name
|
|
|
|
if (data) {
|
|
|
|
if (g_MemoryCardSys->HasSaveWorldMemory(data->x8_mlvlId)) {
|
|
|
|
const CSaveWorldMemory& wldMem = g_MemoryCardSys->GetSaveWorldMemory(data->x8_mlvlId);
|
|
|
|
str = wldMem.GetFrontEndName();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2020-04-16 10:25:59 +00:00
|
|
|
str = g_MainStringTable->GetString(51 + int(!g_Main->IsUSA() || g_Main->IsTrilogy()));
|
2018-12-08 05:30:43 +00:00
|
|
|
break;
|
2020-04-16 10:25:59 +00:00
|
|
|
case 2:
|
2019-02-03 21:20:05 +00:00
|
|
|
#if FE_USE_SECONDS_IN_ELAPSED
|
2020-04-16 10:25:59 +00:00
|
|
|
if (!g_Main->IsUSA() || g_Main->IsTrilogy()) {
|
|
|
|
str = GetElapsedString(data);
|
|
|
|
} else {
|
|
|
|
str = GetTimeString(data);
|
2019-02-03 21:20:05 +00:00
|
|
|
}
|
|
|
|
#else
|
2020-04-16 10:25:59 +00:00
|
|
|
if (!g_Main->IsUSA() || g_Main->IsTrilogy()) {
|
|
|
|
str = GetElapsedString(data);
|
|
|
|
} else {
|
|
|
|
str = GetTimeString(data);
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2020-04-16 10:25:59 +00:00
|
|
|
#endif
|
2018-12-08 05:30:43 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2020-04-16 10:25:59 +00:00
|
|
|
#if FE_USE_SECONDS_IN_ELAPSED
|
|
|
|
if (!g_Main->IsUSA() || g_Main->IsTrilogy()) {
|
|
|
|
str = GetTimeString(data);
|
|
|
|
} else {
|
|
|
|
str = std::u16string(u" ") + GetElapsedString(data);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
if (!g_Main->IsUSA() || g_Main->IsTrilogy()) {
|
|
|
|
str = GetTimeString(data);
|
|
|
|
} else {
|
|
|
|
str = std::u16string(u" ") + GetElapsedString(data);
|
|
|
|
}
|
2019-02-03 21:20:05 +00:00
|
|
|
#endif
|
2020-04-16 10:25:59 +00:00
|
|
|
break;
|
2016-12-16 23:05:29 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
default:
|
|
|
|
break;
|
2017-01-09 03:44:00 +00:00
|
|
|
}
|
2016-12-16 04:35:49 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
StartTextAnimating(populatePair.x0_panes[0], str, option.x2c_chRate);
|
|
|
|
StartTextAnimating(populatePair.x0_panes[1], str, option.x2c_chRate);
|
|
|
|
}
|
2016-12-16 23:05:29 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2016-12-16 23:05:29 +00:00
|
|
|
}
|
2016-12-16 04:35:49 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SNewFileSelectFrame::DoPopupCancel(CGuiTableGroup* caller) {
|
|
|
|
if (x8_subMenu == ESubMenu::EraseGamePopup) {
|
|
|
|
CSfxManager::SfxStart(SFXfnt_back, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
x8_subMenu = ESubMenu::EraseGame;
|
|
|
|
x10d_needsEraseToggle = true;
|
|
|
|
} else {
|
|
|
|
CSfxManager::SfxStart(SFXfnt_back, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
x8_subMenu = ESubMenu::Root;
|
|
|
|
x10e_needsNewToggle = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::SNewFileSelectFrame::DoPopupAdvance(CGuiTableGroup* caller) {
|
|
|
|
if (x8_subMenu == ESubMenu::EraseGamePopup) {
|
|
|
|
if (x40_tablegroup_popup->GetUserSelection() == 1) {
|
|
|
|
x4_saveUI->EraseGame(x20_tablegroup_fileselect->GetUserSelection());
|
|
|
|
ResetFrame();
|
|
|
|
} else
|
|
|
|
x8_subMenu = ESubMenu::EraseGame;
|
|
|
|
x10d_needsEraseToggle = true;
|
|
|
|
} else {
|
|
|
|
if (g_GameState->SystemOptions().GetPlayerBeatNormalMode()) {
|
|
|
|
if (x40_tablegroup_popup->GetUserSelection() == 1) {
|
|
|
|
PlayAdvanceSfx();
|
|
|
|
xc_action = EAction::GameOptions;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
g_GameState->SetHardMode(!x40_tablegroup_popup->GetUserSelection());
|
|
|
|
x4_saveUI->StartGame(x20_tablegroup_fileselect->GetUserSelection());
|
|
|
|
} else {
|
|
|
|
if (x40_tablegroup_popup->GetUserSelection() == 1) {
|
|
|
|
PlayAdvanceSfx();
|
|
|
|
xc_action = EAction::GameOptions;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
x4_saveUI->StartGame(x20_tablegroup_fileselect->GetUserSelection());
|
2016-12-16 23:05:29 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2016-12-16 04:35:49 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SNewFileSelectFrame::DoFileMenuCancel(CGuiTableGroup* caller) {
|
|
|
|
if (x8_subMenu == ESubMenu::EraseGame) {
|
|
|
|
CSfxManager::SfxStart(SFXfnt_back, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
ResetFrame();
|
|
|
|
}
|
2016-12-16 23:05:29 +00:00
|
|
|
}
|
2016-12-16 04:35:49 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SNewFileSelectFrame::DoSelectionChange(CGuiTableGroup* caller, int oldSel) {
|
|
|
|
HandleActiveChange(caller);
|
|
|
|
CSfxManager::SfxStart(SFXfnt_selection_change, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
2016-12-16 04:35:49 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SNewFileSelectFrame::DoFileMenuAdvance(CGuiTableGroup* caller) {
|
|
|
|
int userSel = x20_tablegroup_fileselect->GetUserSelection();
|
|
|
|
if (userSel < 3) {
|
|
|
|
if (x8_subMenu == ESubMenu::EraseGame) {
|
|
|
|
if (x4_saveUI->GetGameData(userSel)) {
|
2017-01-09 03:44:00 +00:00
|
|
|
PlayAdvanceSfx();
|
2018-12-08 05:30:43 +00:00
|
|
|
x10d_needsEraseToggle = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (x4_saveUI->GetGameData(userSel)) {
|
|
|
|
x4_saveUI->StartGame(userSel);
|
|
|
|
} else
|
|
|
|
x10e_needsNewToggle = true;
|
2017-01-01 06:46:52 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
} else if (userSel == 3) {
|
|
|
|
PlayAdvanceSfx();
|
|
|
|
ActivateErase();
|
|
|
|
} else if (userSel == 4) {
|
|
|
|
xc_action = EAction::FusionBonus;
|
|
|
|
} else if (userSel == 5) {
|
|
|
|
xc_action = EAction::SlideShow;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CFrontEndUI::SFileMenuOption CFrontEndUI::SNewFileSelectFrame::FindFileSelectOption(CGuiFrame* frame, int idx) {
|
|
|
|
SFileMenuOption ret;
|
2020-04-11 22:51:39 +00:00
|
|
|
ret.x0_base = frame->FindWidget(fmt::format(FMT_STRING("basewidget_file{}"), idx));
|
|
|
|
ret.x4_textpanes[0] = FindTextPanePair(frame, fmt::format(FMT_STRING("textpane_filename{}"), idx));
|
|
|
|
ret.x4_textpanes[1] = FindTextPanePair(frame, fmt::format(FMT_STRING("textpane_world{}"), idx));
|
|
|
|
ret.x4_textpanes[2] = FindTextPanePair(frame, fmt::format(FMT_STRING("textpane_playtime{}"), idx));
|
|
|
|
ret.x4_textpanes[3] = FindTextPanePair(frame, fmt::format(FMT_STRING("textpane_date{}"), idx));
|
2018-12-08 05:30:43 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::SNewFileSelectFrame::StartTextAnimating(CGuiTextPane* text, std::u16string_view str, float chRate) {
|
|
|
|
text->TextSupport().SetText(str);
|
|
|
|
text->TextSupport().SetTypeWriteEffectOptions(true, 0.1f, chRate);
|
|
|
|
}
|
|
|
|
|
2022-03-04 07:47:21 +00:00
|
|
|
CFrontEndUI::SFusionBonusFrame::SFusionBonusFrame() {
|
2022-02-23 08:18:50 +00:00
|
|
|
if (!g_Main->IsTrilogy()) {
|
|
|
|
x4_gbaSupport = std::make_unique<CGBASupport>();
|
|
|
|
xc_gbaScreen = g_SimplePool->GetObj("FRME_GBAScreen");
|
|
|
|
x18_gbaLink = g_SimplePool->GetObj("FRME_GBALink");
|
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::SetUIText(EUIType tp) {
|
|
|
|
int instructions = -1;
|
|
|
|
int yes = -1;
|
|
|
|
int no = -1;
|
|
|
|
|
|
|
|
bool cableVisible = false;
|
|
|
|
bool circleGcVisible = false;
|
|
|
|
bool circleGbaVisible = false;
|
|
|
|
bool circleStartVisible = false;
|
|
|
|
bool pakoutVisible = false;
|
|
|
|
bool gbaScreenVisible = false;
|
|
|
|
bool connectVisible = false;
|
|
|
|
|
|
|
|
switch (tp) {
|
|
|
|
case EUIType::InsertPak:
|
2020-04-16 10:25:59 +00:00
|
|
|
instructions = (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 73 : 67; // Insert Game Pak
|
|
|
|
no = (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 82 : 76;
|
|
|
|
yes = (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 83 : 77;
|
2018-12-08 05:30:43 +00:00
|
|
|
pakoutVisible = true;
|
|
|
|
circleGbaVisible = true;
|
|
|
|
break;
|
|
|
|
case EUIType::ConnectSocket:
|
2020-04-16 10:25:59 +00:00
|
|
|
instructions = (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 68 : 62; // Connect socket
|
|
|
|
no = (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 82 : 76;
|
|
|
|
yes = (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 83 : 77;
|
2018-12-08 05:30:43 +00:00
|
|
|
cableVisible = true;
|
|
|
|
circleGcVisible = true;
|
|
|
|
circleGbaVisible = true;
|
|
|
|
break;
|
|
|
|
case EUIType::PressStartAndSelect:
|
2020-04-16 10:25:59 +00:00
|
|
|
instructions = (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 74 : 68; // Hold start and select
|
|
|
|
no = (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 82 : 76;
|
|
|
|
yes = (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 83 : 77;
|
2018-12-08 05:30:43 +00:00
|
|
|
cableVisible = true;
|
|
|
|
circleStartVisible = true;
|
|
|
|
gbaScreenVisible = true;
|
|
|
|
break;
|
|
|
|
case EUIType::BeginLink:
|
2020-04-16 10:25:59 +00:00
|
|
|
instructions = (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 75 : 69; // Begin link?
|
|
|
|
no = (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 82 : 76;
|
|
|
|
yes = (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 83 : 77;
|
2018-12-08 05:30:43 +00:00
|
|
|
cableVisible = true;
|
|
|
|
gbaScreenVisible = true;
|
|
|
|
break;
|
|
|
|
case EUIType::TurnOffGBA:
|
2020-04-16 10:25:59 +00:00
|
|
|
instructions = (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 76 : 70; // Turn off GBA
|
|
|
|
no = (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 82 : 76;
|
|
|
|
yes = (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 83 : 77;
|
2018-12-08 05:30:43 +00:00
|
|
|
cableVisible = true;
|
|
|
|
gbaScreenVisible = true;
|
|
|
|
circleStartVisible = true;
|
|
|
|
break;
|
|
|
|
case EUIType::Linking:
|
|
|
|
x4_gbaSupport->StartLink();
|
2020-04-16 10:25:59 +00:00
|
|
|
instructions = (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 72 : 66; // Linking
|
2018-12-08 05:30:43 +00:00
|
|
|
cableVisible = true;
|
|
|
|
gbaScreenVisible = true;
|
|
|
|
connectVisible = true;
|
|
|
|
break;
|
|
|
|
case EUIType::LinkFailed:
|
2020-04-16 10:25:59 +00:00
|
|
|
instructions = (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 69 : 63; // Link failed
|
|
|
|
no = (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 82 : 76;
|
|
|
|
yes = (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 83 : 77;
|
2018-12-08 05:30:43 +00:00
|
|
|
cableVisible = true;
|
|
|
|
circleGcVisible = true;
|
|
|
|
circleGbaVisible = true;
|
|
|
|
circleStartVisible = true;
|
|
|
|
gbaScreenVisible = true;
|
|
|
|
break;
|
|
|
|
case EUIType::LinkCompleteOrLinking:
|
2020-04-16 10:25:59 +00:00
|
|
|
yes = (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 83 : 77;
|
|
|
|
instructions = x40_linkInProgress + (g_Main->IsUSA() && !g_Main->IsTrilogy() ? 71 : 65); // Complete or linking
|
2018-12-08 05:30:43 +00:00
|
|
|
cableVisible = true;
|
|
|
|
gbaScreenVisible = true;
|
|
|
|
break;
|
|
|
|
case EUIType::Complete:
|
|
|
|
case EUIType::Cancelled:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::u16string instructionsStr;
|
|
|
|
if (instructions != -1)
|
|
|
|
instructionsStr = g_MainStringTable->GetString(instructions);
|
|
|
|
xc_textpane_instructions.SetPairText(instructionsStr);
|
|
|
|
|
|
|
|
std::u16string yesStr;
|
|
|
|
if (yes != -1)
|
|
|
|
yesStr = g_MainStringTable->GetString(yes);
|
|
|
|
x14_textpane_yes->TextSupport().SetText(yesStr);
|
|
|
|
|
|
|
|
std::u16string noStr;
|
|
|
|
if (no != -1)
|
|
|
|
noStr = g_MainStringTable->GetString(no);
|
|
|
|
x18_textpane_no->TextSupport().SetText(noStr);
|
|
|
|
|
|
|
|
x1c_model_gc->SetVisibility(true, ETraversalMode::Children);
|
|
|
|
x20_model_gba->SetVisibility(true, ETraversalMode::Children);
|
|
|
|
x24_model_cable->SetVisibility(cableVisible, ETraversalMode::Children);
|
|
|
|
x28_model_circlegcport->SetVisibility(circleGcVisible, ETraversalMode::Children);
|
|
|
|
x2c_model_circlegbaport->SetVisibility(circleGbaVisible, ETraversalMode::Children);
|
|
|
|
x30_model_circlestartselect->SetVisibility(circleStartVisible, ETraversalMode::Children);
|
|
|
|
x34_model_pakout->SetVisibility(pakoutVisible, ETraversalMode::Children);
|
|
|
|
x38_model_gbascreen->SetVisibility(gbaScreenVisible, ETraversalMode::Children);
|
|
|
|
x3c_model_connect->SetVisibility(connectVisible, ETraversalMode::Children);
|
|
|
|
|
|
|
|
x0_uiType = tp;
|
|
|
|
}
|
|
|
|
|
2020-04-16 10:25:59 +00:00
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::EAction
|
2022-03-04 07:47:21 +00:00
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::ProcessUserInput(const CFinalInput& input, bool linkInProgress) {
|
2018-12-08 05:30:43 +00:00
|
|
|
if (linkInProgress != x40_linkInProgress) {
|
|
|
|
x40_linkInProgress = linkInProgress;
|
|
|
|
SetUIText(x0_uiType);
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (x0_uiType) {
|
|
|
|
case EUIType::InsertPak:
|
|
|
|
case EUIType::ConnectSocket:
|
|
|
|
case EUIType::PressStartAndSelect:
|
|
|
|
case EUIType::BeginLink:
|
|
|
|
case EUIType::LinkFailed:
|
|
|
|
case EUIType::LinkCompleteOrLinking:
|
|
|
|
case EUIType::TurnOffGBA:
|
2022-07-29 20:16:55 +00:00
|
|
|
if (input.PA() || input.PSpecialKey(ESpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary)) {
|
2018-12-08 05:30:43 +00:00
|
|
|
PlayAdvanceSfx();
|
2019-09-14 19:51:19 +00:00
|
|
|
SetUIText(NextLinkUI[size_t(x0_uiType)]);
|
2022-07-29 20:16:55 +00:00
|
|
|
} else if (input.PB() || input.PSpecialKey(ESpecialKey::Esc)) {
|
2019-09-14 19:51:19 +00:00
|
|
|
const EUIType prevUi = PrevLinkUI[size_t(x0_uiType)];
|
|
|
|
if (prevUi == EUIType::Empty) {
|
2017-01-01 06:46:52 +00:00
|
|
|
break;
|
2019-09-14 19:51:19 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
CSfxManager::SfxStart(SFXfnt_back, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
SetUIText(prevUi);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EUIType::Linking:
|
|
|
|
if (x4_gbaSupport->GetPhase() == CGBASupport::EPhase::Complete) {
|
|
|
|
if (x4_gbaSupport->IsFusionLinked())
|
|
|
|
g_GameState->SystemOptions().SetPlayerLinkedFusion(true);
|
|
|
|
if (x4_gbaSupport->IsFusionBeat())
|
|
|
|
g_GameState->SystemOptions().SetPlayerBeatFusion(true);
|
|
|
|
if (x4_gbaSupport->IsFusionLinked()) {
|
|
|
|
PlayAdvanceSfx();
|
|
|
|
SetUIText(EUIType::LinkCompleteOrLinking);
|
|
|
|
} else {
|
|
|
|
CSfxManager::SfxStart(SFXfnt_back, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
SetUIText(EUIType::LinkFailed);
|
|
|
|
}
|
|
|
|
} else if (x4_gbaSupport->GetPhase() == CGBASupport::EPhase::Failed) {
|
|
|
|
CSfxManager::SfxStart(SFXfnt_back, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
SetUIText(EUIType::LinkFailed);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EUIType::Complete:
|
|
|
|
return EAction::Complete;
|
|
|
|
case EUIType::Cancelled:
|
|
|
|
return EAction::Cancelled;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EAction::None;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::Update(float dt) {
|
|
|
|
x4_gbaSupport->Update(dt);
|
|
|
|
x8_frme->Update(dt);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::FinishedLoading() {
|
|
|
|
x8_frme->SetAspectConstraint(1.78f);
|
|
|
|
|
|
|
|
xc_textpane_instructions = FindTextPanePair(x8_frme, "textpane_instructions");
|
|
|
|
x14_textpane_yes = static_cast<CGuiTextPane*>(x8_frme->FindWidget("textpane_yes"));
|
|
|
|
x18_textpane_no = static_cast<CGuiTextPane*>(x8_frme->FindWidget("textpane_no"));
|
|
|
|
x1c_model_gc = static_cast<CGuiModel*>(x8_frme->FindWidget("model_gc"));
|
|
|
|
x20_model_gba = static_cast<CGuiModel*>(x8_frme->FindWidget("model_gba"));
|
|
|
|
x24_model_cable = static_cast<CGuiModel*>(x8_frme->FindWidget("model_cable"));
|
|
|
|
x28_model_circlegcport = static_cast<CGuiModel*>(x8_frme->FindWidget("model_circlegcport"));
|
|
|
|
x2c_model_circlegbaport = static_cast<CGuiModel*>(x8_frme->FindWidget("model_circlegbaport"));
|
|
|
|
x30_model_circlestartselect = static_cast<CGuiModel*>(x8_frme->FindWidget("model_circlestartselect"));
|
|
|
|
x34_model_pakout = static_cast<CGuiModel*>(x8_frme->FindWidget("model_pakout"));
|
|
|
|
x38_model_gbascreen = static_cast<CGuiModel*>(x8_frme->FindWidget("model_gbascreen"));
|
|
|
|
x3c_model_connect = static_cast<CGuiModel*>(x8_frme->FindWidget("model_connect"));
|
|
|
|
SetUIText(EUIType::InsertPak);
|
|
|
|
}
|
|
|
|
|
2020-04-26 05:15:02 +00:00
|
|
|
void CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::Draw() { x8_frme->Draw(CGuiWidgetDrawParms::Default()); }
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
CFrontEndUI::SFusionBonusFrame::SGBALinkFrame::SGBALinkFrame(CGuiFrame* linkFrame, CGBASupport* support,
|
2017-02-10 09:00:57 +00:00
|
|
|
bool linkInProgress)
|
2018-12-08 05:30:43 +00:00
|
|
|
: x4_gbaSupport(support), x8_frme(linkFrame), x40_linkInProgress(linkInProgress) {
|
|
|
|
support->InitializeSupport();
|
|
|
|
FinishedLoading();
|
2016-12-16 04:35:49 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SFusionBonusFrame::FinishedLoading() {
|
|
|
|
x24_loadedFrame->SetAspectConstraint(1.78f);
|
2017-01-01 06:46:52 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x28_tablegroup_options = static_cast<CGuiTableGroup*>(x24_loadedFrame->FindWidget("tablegroup_options"));
|
|
|
|
x2c_tablegroup_fusionsuit = static_cast<CGuiTableGroup*>(x24_loadedFrame->FindWidget("tablegroup_fusionsuit"));
|
|
|
|
x30_textpane_instructions = FindTextPanePair(x24_loadedFrame, "textpane_instructions");
|
2017-01-01 06:46:52 +00:00
|
|
|
|
2020-04-16 10:25:59 +00:00
|
|
|
FindAndSetPairText(x24_loadedFrame, "textpane_nes",
|
|
|
|
g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 66 : 60));
|
|
|
|
FindAndSetPairText(x24_loadedFrame, "textpane_fusionsuit",
|
|
|
|
g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 63 : 57));
|
|
|
|
FindAndSetPairText(x24_loadedFrame, "textpane_fusionsuitno",
|
|
|
|
g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 65 : 59));
|
|
|
|
FindAndSetPairText(x24_loadedFrame, "textpane_fusionsuityes",
|
|
|
|
g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 64 : 58));
|
|
|
|
FindAndSetPairText(x24_loadedFrame, "textpane_title",
|
|
|
|
g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 100 : 94));
|
2017-01-01 06:46:52 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
static_cast<CGuiTextPane*>(x24_loadedFrame->FindWidget("textpane_proceed"))
|
|
|
|
->TextSupport()
|
2020-04-16 10:25:59 +00:00
|
|
|
.SetText(g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 85 : 79));
|
2018-12-08 05:30:43 +00:00
|
|
|
static_cast<CGuiTextPane*>(x24_loadedFrame->FindWidget("textpane_cancel"))
|
|
|
|
->TextSupport()
|
2020-04-16 10:25:59 +00:00
|
|
|
.SetText(g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 82 : 76));
|
2018-02-03 00:35:19 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x2c_tablegroup_fusionsuit->SetIsActive(false);
|
|
|
|
x2c_tablegroup_fusionsuit->SetIsVisible(false);
|
|
|
|
x2c_tablegroup_fusionsuit->SetVertical(false);
|
|
|
|
x2c_tablegroup_fusionsuit->SetUserSelection(g_GameState->SystemOptions().GetPlayerFusionSuitActive());
|
2017-02-10 09:00:57 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
SetTableColors(x28_tablegroup_options);
|
|
|
|
SetTableColors(x2c_tablegroup_fusionsuit);
|
2017-01-01 06:46:52 +00:00
|
|
|
|
2019-08-14 07:45:28 +00:00
|
|
|
x28_tablegroup_options->SetMenuAdvanceCallback([this](CGuiTableGroup* caller) { DoAdvance(caller); });
|
2018-12-08 05:30:43 +00:00
|
|
|
x28_tablegroup_options->SetMenuSelectionChangeCallback(
|
2019-08-14 07:45:28 +00:00
|
|
|
[this](CGuiTableGroup* caller, int oldSel) { DoSelectionChange(caller, oldSel); });
|
|
|
|
x28_tablegroup_options->SetMenuCancelCallback([this](CGuiTableGroup* caller) { DoCancel(caller); });
|
2018-12-08 05:30:43 +00:00
|
|
|
x2c_tablegroup_fusionsuit->SetMenuSelectionChangeCallback(
|
2019-08-14 07:45:28 +00:00
|
|
|
[this](CGuiTableGroup* caller, int oldSel) { DoSelectionChange(caller, oldSel); });
|
2016-12-16 04:35:49 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
bool CFrontEndUI::SFusionBonusFrame::PumpLoad() {
|
|
|
|
if (x24_loadedFrame)
|
|
|
|
return true;
|
|
|
|
if (!xc_gbaScreen.IsLoaded())
|
|
|
|
return false;
|
|
|
|
if (!x18_gbaLink.IsLoaded())
|
|
|
|
return false;
|
|
|
|
if (!x4_gbaSupport->IsReady())
|
|
|
|
return false;
|
|
|
|
if (!xc_gbaScreen->GetIsFinishedLoading())
|
|
|
|
return false;
|
|
|
|
x24_loadedFrame = xc_gbaScreen.GetObj();
|
|
|
|
FinishedLoading();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::SFusionBonusFrame::SetTableColors(CGuiTableGroup* tbgp) const {
|
2019-02-24 07:15:54 +00:00
|
|
|
tbgp->SetColors(zeus::skWhite, zeus::CColor{0.627450f, 0.627450f, 0.627450f, 0.784313f});
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::SFusionBonusFrame::Update(float dt, CSaveGameScreen* saveUI) {
|
|
|
|
bool doDraw = !saveUI || saveUI->GetUIType() == CSaveGameScreen::EUIType::SaveReady;
|
|
|
|
|
|
|
|
if (doDraw != x38_lastDoDraw) {
|
|
|
|
x38_lastDoDraw = doDraw;
|
|
|
|
ResetCompletionFlags();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x0_gbaLinkFrame)
|
|
|
|
x0_gbaLinkFrame->Update(dt);
|
|
|
|
else if (x24_loadedFrame)
|
|
|
|
x24_loadedFrame->Update(dt);
|
|
|
|
|
|
|
|
bool showFusionSuit = (g_GameState->SystemOptions().GetPlayerLinkedFusion() &&
|
|
|
|
g_GameState->SystemOptions().GetPlayerBeatNormalMode()) ||
|
|
|
|
m_gbaOverride;
|
|
|
|
bool showFusionSuitProceed = showFusionSuit && x28_tablegroup_options->GetUserSelection() == 1;
|
|
|
|
x2c_tablegroup_fusionsuit->SetIsActive(showFusionSuitProceed);
|
|
|
|
x2c_tablegroup_fusionsuit->SetIsVisible(showFusionSuitProceed);
|
|
|
|
x24_loadedFrame->FindWidget("textpane_proceed")->SetIsVisible(showFusionSuitProceed);
|
|
|
|
|
|
|
|
std::u16string instructionStr;
|
2019-02-24 07:15:54 +00:00
|
|
|
x30_textpane_instructions.x0_panes[0]->TextSupport().SetFontColor(zeus::skWhite);
|
2018-12-08 05:30:43 +00:00
|
|
|
if (x28_tablegroup_options->GetUserSelection() == 1) {
|
|
|
|
/* Fusion Suit */
|
|
|
|
if (x3a_mpNotComplete)
|
2020-04-16 10:25:59 +00:00
|
|
|
instructionStr =
|
|
|
|
g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 80 : 74); // MP not complete
|
2018-12-08 05:30:43 +00:00
|
|
|
else if (!showFusionSuit)
|
2020-04-16 10:25:59 +00:00
|
|
|
instructionStr =
|
|
|
|
g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 78 : 72); // To enable fusion suit
|
2018-12-08 05:30:43 +00:00
|
|
|
} else {
|
|
|
|
/* NES Metroid */
|
|
|
|
if (x39_fusionNotComplete)
|
2020-04-16 10:25:59 +00:00
|
|
|
instructionStr = g_MainStringTable->GetString(
|
|
|
|
(g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 79 : 73); // You have not completed fusion
|
2018-12-08 05:30:43 +00:00
|
|
|
else if (!g_GameState->SystemOptions().GetPlayerBeatFusion())
|
2020-04-16 10:25:59 +00:00
|
|
|
instructionStr =
|
|
|
|
g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 77 : 71); // To play NES Metroid
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
x30_textpane_instructions.SetPairText(instructionStr);
|
|
|
|
}
|
|
|
|
|
2022-03-06 07:46:42 +00:00
|
|
|
CFrontEndUI::SFusionBonusFrame::EAction CFrontEndUI::SFusionBonusFrame::ProcessUserInput(const CFinalInput& input,
|
|
|
|
CSaveGameScreen* sui) {
|
2018-12-08 05:30:43 +00:00
|
|
|
x8_action = EAction::None;
|
|
|
|
|
|
|
|
if (sui)
|
|
|
|
sui->ProcessUserInput(input);
|
|
|
|
|
|
|
|
if (x38_lastDoDraw) {
|
|
|
|
if (x0_gbaLinkFrame) {
|
2022-03-04 07:47:21 +00:00
|
|
|
SGBALinkFrame::EAction action = x0_gbaLinkFrame->ProcessUserInput(input, sui);
|
2018-12-08 05:30:43 +00:00
|
|
|
if (action != SGBALinkFrame::EAction::None) {
|
|
|
|
x0_gbaLinkFrame.reset();
|
|
|
|
if (action == SGBALinkFrame::EAction::Complete) {
|
|
|
|
if (x28_tablegroup_options->GetUserSelection() == 0 && !g_GameState->SystemOptions().GetPlayerBeatFusion())
|
|
|
|
x39_fusionNotComplete = true;
|
|
|
|
else if (sui)
|
|
|
|
sui->SaveNESState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (x24_loadedFrame) {
|
|
|
|
CFinalInput useInput = input;
|
2022-07-29 20:16:55 +00:00
|
|
|
if (input.PZ() || input.PSpecialKey(ESpecialKey::Tab)) {
|
2018-12-08 05:30:43 +00:00
|
|
|
useInput.x2d_b28_PA = true;
|
|
|
|
m_gbaOverride = true;
|
|
|
|
}
|
|
|
|
x24_loadedFrame->ProcessUserInput(useInput);
|
2017-01-01 06:46:52 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2016-12-14 22:56:59 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
return x8_action;
|
2016-12-15 22:37:34 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SFusionBonusFrame::Draw() const {
|
|
|
|
if (!x38_lastDoDraw)
|
|
|
|
return;
|
|
|
|
if (x0_gbaLinkFrame)
|
|
|
|
x0_gbaLinkFrame->Draw();
|
|
|
|
else if (x24_loadedFrame)
|
2020-04-26 05:15:02 +00:00
|
|
|
x24_loadedFrame->Draw(CGuiWidgetDrawParms::Default());
|
2016-12-15 22:37:34 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SFusionBonusFrame::DoCancel(CGuiTableGroup* caller) {
|
|
|
|
x8_action = EAction::GoBack;
|
|
|
|
x28_tablegroup_options->SetUserSelection(0);
|
|
|
|
x2c_tablegroup_fusionsuit->SetIsActive(false);
|
|
|
|
x30_textpane_instructions.SetPairText(u"");
|
|
|
|
SetTableColors(x28_tablegroup_options);
|
2016-12-14 22:56:59 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SFusionBonusFrame::DoSelectionChange(CGuiTableGroup* caller, int oldSel) {
|
|
|
|
if (caller == x28_tablegroup_options) {
|
|
|
|
CSfxManager::SfxStart(SFXfnt_selection_change, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
ResetCompletionFlags();
|
|
|
|
} else {
|
|
|
|
CSfxManager::SfxStart(SFXfnt_enum_change, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
bool fusionActive = x2c_tablegroup_fusionsuit->GetUserSelection() == 1;
|
|
|
|
g_GameState->SystemOptions().SetPlayerFusionSuitActive(fusionActive);
|
|
|
|
g_GameState->GetPlayerState()->SetIsFusionEnabled(fusionActive);
|
|
|
|
}
|
|
|
|
SetTableColors(caller);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::SFusionBonusFrame::DoAdvance(CGuiTableGroup* caller) {
|
|
|
|
switch (x28_tablegroup_options->GetUserSelection()) {
|
|
|
|
case 1:
|
|
|
|
/* Fusion Suit */
|
|
|
|
if (x3a_mpNotComplete || m_gbaOverride) {
|
|
|
|
x3a_mpNotComplete = false;
|
|
|
|
PlayAdvanceSfx();
|
|
|
|
} else if (g_GameState->SystemOptions().GetPlayerBeatNormalMode()) {
|
|
|
|
if (g_GameState->SystemOptions().GetPlayerLinkedFusion())
|
|
|
|
return;
|
|
|
|
x0_gbaLinkFrame = std::make_unique<SGBALinkFrame>(x18_gbaLink.GetObj(), x4_gbaSupport.get(), false);
|
|
|
|
PlayAdvanceSfx();
|
|
|
|
} else {
|
|
|
|
x3a_mpNotComplete = true;
|
|
|
|
CSfxManager::SfxStart(SFXfnt_back, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
/* NES Metroid */
|
|
|
|
if (x39_fusionNotComplete && !m_gbaOverride) {
|
|
|
|
x39_fusionNotComplete = false;
|
|
|
|
PlayAdvanceSfx();
|
|
|
|
} else if (g_GameState->SystemOptions().GetPlayerBeatFusion() || m_gbaOverride) {
|
|
|
|
// x8_action = EAction::None;
|
|
|
|
CSfxManager::SfxStart(SFXfnt_back, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
x8_action = EAction::PlayNESMetroid;
|
|
|
|
} else {
|
|
|
|
x0_gbaLinkFrame = std::make_unique<SGBALinkFrame>(x18_gbaLink.GetObj(), x4_gbaSupport.get(), false);
|
|
|
|
PlayAdvanceSfx();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::SGuiTextPair::SetPairText(std::u16string_view str) {
|
|
|
|
x0_panes[0]->TextSupport().SetText(str);
|
|
|
|
x0_panes[1]->TextSupport().SetText(str);
|
|
|
|
}
|
|
|
|
|
2020-02-28 10:11:20 +00:00
|
|
|
CFrontEndUI::SGuiTextPair CFrontEndUI::FindTextPanePair(CGuiFrame* frame, std::string_view name) {
|
2018-12-08 05:30:43 +00:00
|
|
|
SGuiTextPair ret;
|
|
|
|
ret.x0_panes[0] = static_cast<CGuiTextPane*>(frame->FindWidget(name));
|
2020-04-11 22:51:39 +00:00
|
|
|
ret.x0_panes[1] = static_cast<CGuiTextPane*>(frame->FindWidget(fmt::format(FMT_STRING("{}b"), name)));
|
2018-12-08 05:30:43 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2020-02-28 10:11:20 +00:00
|
|
|
void CFrontEndUI::FindAndSetPairText(CGuiFrame* frame, std::string_view name, std::u16string_view str) {
|
2018-12-08 05:30:43 +00:00
|
|
|
CGuiTextPane* w1 = static_cast<CGuiTextPane*>(frame->FindWidget(name));
|
|
|
|
w1->TextSupport().SetText(str);
|
2020-04-11 22:51:39 +00:00
|
|
|
CGuiTextPane* w2 = static_cast<CGuiTextPane*>(frame->FindWidget(fmt::format(FMT_STRING("{}b"), name)));
|
2018-12-08 05:30:43 +00:00
|
|
|
w2->TextSupport().SetText(str);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::SFrontEndFrame::FinishedLoading() {
|
|
|
|
x14_loadedFrme->SetAspectConstraint(1.78f);
|
|
|
|
|
|
|
|
x18_tablegroup_mainmenu = static_cast<CGuiTableGroup*>(x14_loadedFrme->FindWidget("tablegroup_mainmenu"));
|
2021-06-07 19:29:18 +00:00
|
|
|
// TODO: HACK: Implement language menu so this isn't necessary
|
2020-04-17 12:53:22 +00:00
|
|
|
if (g_Main->IsUSA() && !g_Main->IsTrilogy()) {
|
|
|
|
x1c_gbaPair = FindTextPanePair(x14_loadedFrme, "textpane_gba");
|
|
|
|
} else {
|
|
|
|
x1c_gbaPair = FindTextPanePair(x14_loadedFrme, "textpane_lang");
|
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
x1c_gbaPair.SetPairText(g_MainStringTable->GetString(37));
|
2021-06-07 19:29:18 +00:00
|
|
|
// TODO: HACK: Implement language menu so this isn't necessary
|
2020-04-17 12:53:22 +00:00
|
|
|
if (g_Main->IsUSA() && !g_Main->IsTrilogy()) {
|
|
|
|
x24_cheatPair = FindTextPanePair(x14_loadedFrme, "textpane_cheats");
|
|
|
|
} else {
|
|
|
|
x24_cheatPair = FindTextPanePair(x14_loadedFrme, "textpane_options");
|
|
|
|
}
|
2020-04-16 10:25:59 +00:00
|
|
|
x24_cheatPair.SetPairText(g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 96 : 90));
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2020-04-16 10:25:59 +00:00
|
|
|
FindAndSetPairText(x14_loadedFrme, "textpane_start",
|
|
|
|
g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 67 : 61));
|
2021-06-07 19:29:18 +00:00
|
|
|
// TODO: HACK: Implement language menu so this isn't necessary
|
2020-04-17 12:53:22 +00:00
|
|
|
FindAndSetPairText(x14_loadedFrme, (g_Main->IsUSA() && !g_Main->IsTrilogy()) ? "textpane_options" : "textpane_gba",
|
2020-04-16 10:25:59 +00:00
|
|
|
g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 94 : 88));
|
|
|
|
FindAndSetPairText(x14_loadedFrme, "textpane_title",
|
|
|
|
g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 98 : 92));
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
CGuiTextPane* proceed = static_cast<CGuiTextPane*>(x14_loadedFrme->FindWidget("textpane_proceed"));
|
|
|
|
if (proceed)
|
2020-04-16 10:25:59 +00:00
|
|
|
proceed->TextSupport().SetText(g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 85 : 79));
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2019-08-14 07:45:28 +00:00
|
|
|
x18_tablegroup_mainmenu->SetMenuAdvanceCallback([this](CGuiTableGroup* caller) { DoAdvance(caller); });
|
2018-12-08 05:30:43 +00:00
|
|
|
x18_tablegroup_mainmenu->SetMenuSelectionChangeCallback(
|
2019-08-14 07:45:28 +00:00
|
|
|
[this](CGuiTableGroup* caller, int oldSel) { DoSelectionChange(caller, oldSel); });
|
|
|
|
x18_tablegroup_mainmenu->SetMenuCancelCallback([this](CGuiTableGroup* caller) { DoCancel(caller); });
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
HandleActiveChange(x18_tablegroup_mainmenu);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CFrontEndUI::SFrontEndFrame::PumpLoad() {
|
|
|
|
if (x14_loadedFrme)
|
|
|
|
return true;
|
|
|
|
if (x8_frme.IsLoaded()) {
|
|
|
|
if (CGuiFrame* frme = x8_frme.GetObj()) {
|
|
|
|
if (frme->GetIsFinishedLoading()) {
|
|
|
|
x14_loadedFrme = frme;
|
|
|
|
FinishedLoading();
|
2016-12-14 22:56:59 +00:00
|
|
|
return true;
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2016-12-14 22:56:59 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
return false;
|
2016-12-14 22:56:59 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SFrontEndFrame::Update(float dt) {
|
|
|
|
CGuiTextPane* imageGallery = static_cast<CGuiTextPane*>(x18_tablegroup_mainmenu->GetWorkerWidget(3));
|
2017-01-10 07:15:49 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (CSlideShow::SlideShowGalleryFlags()) {
|
|
|
|
imageGallery->SetIsSelectable(true);
|
2019-02-24 07:15:54 +00:00
|
|
|
x24_cheatPair.x0_panes[0]->TextSupport().SetFontColor(zeus::skWhite);
|
2018-12-08 05:30:43 +00:00
|
|
|
} else {
|
|
|
|
imageGallery->SetIsSelectable(false);
|
2019-02-24 07:15:54 +00:00
|
|
|
zeus::CColor color = zeus::skGrey;
|
2018-12-08 05:30:43 +00:00
|
|
|
color.a() = 0.5f;
|
|
|
|
x24_cheatPair.x0_panes[0]->TextSupport().SetFontColor(color);
|
|
|
|
}
|
2017-01-09 03:44:00 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x14_loadedFrme->Update(dt);
|
2017-01-09 03:44:00 +00:00
|
|
|
}
|
|
|
|
|
2022-03-06 07:46:42 +00:00
|
|
|
CFrontEndUI::SFrontEndFrame::EAction CFrontEndUI::SFrontEndFrame::ProcessUserInput(const CFinalInput& input) {
|
2018-12-08 05:30:43 +00:00
|
|
|
x4_action = EAction::None;
|
|
|
|
x14_loadedFrme->ProcessUserInput(input);
|
|
|
|
return x4_action;
|
2017-01-10 07:15:49 +00:00
|
|
|
}
|
2016-12-16 04:35:49 +00:00
|
|
|
|
2020-04-26 05:15:02 +00:00
|
|
|
void CFrontEndUI::SFrontEndFrame::Draw() const { x14_loadedFrme->Draw(CGuiWidgetDrawParms::Default()); }
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
void CFrontEndUI::SFrontEndFrame::HandleActiveChange(CGuiTableGroup* active) {
|
2019-02-24 07:15:54 +00:00
|
|
|
active->SetColors(zeus::skWhite, zeus::CColor{0.627450f, 0.627450f, 0.627450f, 0.784313f});
|
2016-12-16 04:35:49 +00:00
|
|
|
}
|
|
|
|
|
2020-04-16 10:25:59 +00:00
|
|
|
void CFrontEndUI::SFrontEndFrame::DoCancel(CGuiTableGroup* caller) { /* Intentionally empty */
|
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
void CFrontEndUI::SFrontEndFrame::DoSelectionChange(CGuiTableGroup* caller, int oldSel) {
|
|
|
|
CSfxManager::SfxStart(SFXfnt_selection_change, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
HandleActiveChange(caller);
|
2016-12-14 22:56:59 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SFrontEndFrame::DoAdvance(CGuiTableGroup* caller) {
|
|
|
|
switch (x18_tablegroup_mainmenu->GetUserSelection()) {
|
|
|
|
case 0:
|
|
|
|
CSfxManager::SfxStart(FETransitionForwardSFX[x0_rnd][0], 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
CSfxManager::SfxStart(FETransitionForwardSFX[x0_rnd][1], 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
x4_action = EAction::StartGame;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
x4_action = EAction::FusionBonus;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
PlayAdvanceSfx();
|
|
|
|
x4_action = EAction::GameOptions;
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
PlayAdvanceSfx();
|
|
|
|
x4_action = EAction::SlideShow;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2016-12-14 22:56:59 +00:00
|
|
|
}
|
|
|
|
|
2022-03-06 07:46:42 +00:00
|
|
|
CFrontEndUI::SFrontEndFrame::SFrontEndFrame(u32 rnd) : x0_rnd(rnd) {
|
2018-12-08 05:30:43 +00:00
|
|
|
x8_frme = g_SimplePool->GetObj("FRME_FrontEndPL");
|
|
|
|
}
|
|
|
|
|
|
|
|
CFrontEndUI::SNesEmulatorFrame::SNesEmulatorFrame() {
|
|
|
|
x4_nesEmu = std::make_unique<CNESEmulator>();
|
|
|
|
|
|
|
|
const SObjectTag* deface = g_ResFactory->GetResourceIdByName("FONT_Deface14B");
|
|
|
|
CGuiTextProperties props(false, true, EJustification::Left, EVerticalJustification::Center);
|
2020-04-16 10:25:59 +00:00
|
|
|
xc_textSupport = std::make_unique<CGuiTextSupport>(deface->id, props, zeus::skWhite, zeus::skBlack, zeus::skWhite, 0,
|
|
|
|
0, g_SimplePool, CGuiWidget::EGuiModelDrawFlags::Alpha);
|
2020-04-17 00:19:55 +00:00
|
|
|
xc_textSupport->SetText(g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 103 : 97));
|
2018-12-08 05:30:43 +00:00
|
|
|
xc_textSupport->AutoSetExtent();
|
|
|
|
xc_textSupport->ClearRenderBuffer();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::SNesEmulatorFrame::SetMode(EMode mode) {
|
|
|
|
switch (mode) {
|
|
|
|
case EMode::Emulator:
|
|
|
|
x8_quitScreen.reset();
|
|
|
|
break;
|
|
|
|
case EMode::SaveProgress:
|
|
|
|
x8_quitScreen = std::make_unique<CQuitGameScreen>(EQuitType::SaveProgress);
|
|
|
|
break;
|
|
|
|
case EMode::ContinuePlaying:
|
|
|
|
x8_quitScreen = std::make_unique<CQuitGameScreen>(EQuitType::ContinuePlaying);
|
|
|
|
break;
|
|
|
|
case EMode::QuitNESMetroid:
|
|
|
|
x8_quitScreen = std::make_unique<CQuitGameScreen>(EQuitType::QuitNESMetroid);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
x0_mode = mode;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::SNesEmulatorFrame::ProcessUserInput(const CFinalInput& input, CSaveGameScreen* sui) {
|
|
|
|
bool processInput = true;
|
|
|
|
if (sui && sui->GetUIType() != CSaveGameScreen::EUIType::SaveReady)
|
|
|
|
processInput = false;
|
|
|
|
if (sui)
|
|
|
|
sui->ProcessUserInput(input);
|
|
|
|
if (!processInput)
|
|
|
|
return;
|
|
|
|
|
|
|
|
switch (x0_mode) {
|
|
|
|
case EMode::Emulator:
|
|
|
|
x4_nesEmu->ProcessUserInput(input, 4);
|
2022-07-29 20:16:55 +00:00
|
|
|
if ((input.ControllerIdx() == 0 && input.PL()) || input.PSpecialKey(ESpecialKey::Esc))
|
2018-12-08 05:30:43 +00:00
|
|
|
SetMode(EMode::QuitNESMetroid);
|
|
|
|
break;
|
|
|
|
case EMode::SaveProgress:
|
|
|
|
case EMode::ContinuePlaying:
|
|
|
|
case EMode::QuitNESMetroid:
|
|
|
|
x8_quitScreen->ProcessUserInput(input);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CFrontEndUI::SNesEmulatorFrame::Update(float dt, CSaveGameScreen* saveUi) {
|
|
|
|
bool doUpdate = (saveUi && saveUi->GetUIType() != CSaveGameScreen::EUIType::SaveReady) ? false : true;
|
|
|
|
x10_remTime = std::max(x10_remTime - dt, 0.f);
|
|
|
|
|
2019-02-24 07:15:54 +00:00
|
|
|
zeus::CColor geomCol(zeus::skWhite);
|
2018-12-08 05:30:43 +00:00
|
|
|
geomCol.a() = std::min(x10_remTime, 1.f);
|
|
|
|
xc_textSupport->SetGeometryColor(geomCol);
|
|
|
|
if (xc_textSupport->GetIsTextSupportFinishedLoading()) {
|
2018-02-03 00:35:19 +00:00
|
|
|
xc_textSupport->AutoSetExtent();
|
|
|
|
xc_textSupport->ClearRenderBuffer();
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!doUpdate)
|
|
|
|
return false;
|
2016-12-14 22:56:59 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
switch (x0_mode) {
|
|
|
|
case EMode::Emulator: {
|
|
|
|
x4_nesEmu->Update();
|
|
|
|
if (!x4_nesEmu->IsGameOver())
|
|
|
|
x14_emulationSuspended = false;
|
|
|
|
if (x4_nesEmu->IsGameOver() && !x14_emulationSuspended) {
|
|
|
|
x14_emulationSuspended = true;
|
|
|
|
if (saveUi && !saveUi->IsSavingDisabled()) {
|
|
|
|
SetMode(EMode::SaveProgress);
|
2016-12-30 06:37:01 +00:00
|
|
|
break;
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
SetMode(EMode::ContinuePlaying);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (x4_nesEmu->GetPasswordEntryState() == CNESEmulator::EPasswordEntryState::NotEntered && saveUi)
|
|
|
|
x4_nesEmu->LoadPassword(g_GameState->SystemOptions().GetNESState());
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case EMode::SaveProgress: {
|
|
|
|
if (saveUi) {
|
|
|
|
EQuitAction action = x8_quitScreen->Update(dt);
|
|
|
|
if (action == EQuitAction::Yes) {
|
|
|
|
memmove(g_GameState->SystemOptions().GetNESState(), x4_nesEmu->GetPassword(), 18);
|
|
|
|
saveUi->SaveNESState();
|
|
|
|
SetMode(EMode::ContinuePlaying);
|
|
|
|
} else if (action == EQuitAction::No)
|
|
|
|
SetMode(EMode::ContinuePlaying);
|
|
|
|
} else
|
|
|
|
SetMode(EMode::ContinuePlaying);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case EMode::ContinuePlaying: {
|
|
|
|
EQuitAction action = x8_quitScreen->Update(dt);
|
|
|
|
if (action == EQuitAction::Yes)
|
|
|
|
SetMode(EMode::Emulator);
|
|
|
|
else if (action == EQuitAction::No)
|
|
|
|
return true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case EMode::QuitNESMetroid: {
|
|
|
|
EQuitAction action = x8_quitScreen->Update(dt);
|
|
|
|
if (action == EQuitAction::Yes)
|
|
|
|
return true;
|
|
|
|
else if (action == EQuitAction::No)
|
|
|
|
SetMode(EMode::Emulator);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::SNesEmulatorFrame::Draw(CSaveGameScreen* saveUi) const {
|
2019-02-24 07:15:54 +00:00
|
|
|
zeus::CColor mulColor = zeus::skWhite;
|
2018-12-08 05:30:43 +00:00
|
|
|
bool blackout = saveUi && saveUi->GetUIType() != CSaveGameScreen::EUIType::SaveReady;
|
|
|
|
|
|
|
|
if (blackout)
|
2019-02-24 07:15:54 +00:00
|
|
|
mulColor = zeus::skBlack;
|
2018-12-08 05:30:43 +00:00
|
|
|
else if (x8_quitScreen)
|
|
|
|
mulColor = zeus::CColor{0.376470f, 0.376470f, 0.376470f, 1.f};
|
|
|
|
|
|
|
|
x4_nesEmu->Draw(mulColor, x15_enableFiltering);
|
|
|
|
if (!blackout && x8_quitScreen)
|
|
|
|
x8_quitScreen->Draw();
|
|
|
|
|
|
|
|
if (x10_remTime >= 7.5f)
|
|
|
|
return;
|
|
|
|
if (x10_remTime <= 0.f)
|
|
|
|
return;
|
|
|
|
if (xc_textSupport->GetIsTextSupportFinishedLoading()) {
|
2022-02-27 22:46:15 +00:00
|
|
|
float aspect = CGraphics::GetViewportAspect() / 1.33f;
|
2018-12-08 05:30:43 +00:00
|
|
|
CGraphics::SetOrtho(-320.f * aspect, 320.f * aspect, 240.f, -240.f, -4096.f, 4096.f);
|
2019-02-24 07:15:54 +00:00
|
|
|
CGraphics::SetViewPointMatrix(zeus::CTransform());
|
2018-12-08 05:30:43 +00:00
|
|
|
CGraphics::SetModelMatrix(zeus::CTransform::Translate(-220.f, 0.f, -200.f));
|
|
|
|
xc_textSupport->Render();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-21 07:22:41 +00:00
|
|
|
CFrontEndUI::SOptionsFrontEndFrame::SOptionsFrontEndFrame() {
|
2018-12-08 05:30:43 +00:00
|
|
|
x4_frme = g_SimplePool->GetObj("FRME_OptionsFrontEnd");
|
|
|
|
x10_pauseScreen = g_SimplePool->GetObj("STRG_PauseScreen");
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::SOptionsFrontEndFrame::DoSliderChange(CGuiSliderGroup* caller, float value) {
|
|
|
|
if (x28_tablegroup_rightmenu->GetIsActive()) {
|
2017-01-13 00:16:26 +00:00
|
|
|
int leftSel = x24_tablegroup_leftmenu->GetUserSelection();
|
|
|
|
int rightSel = x28_tablegroup_rightmenu->GetUserSelection();
|
|
|
|
const auto& optionCategory = GameOptionsRegistry[leftSel];
|
|
|
|
const SGameOption& option = optionCategory.second[rightSel];
|
2018-12-08 05:30:43 +00:00
|
|
|
CGameOptions::SetOption(option.option, caller->GetGurVal());
|
|
|
|
}
|
|
|
|
}
|
2017-01-13 00:16:26 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SOptionsFrontEndFrame::DoMenuCancel(CGuiTableGroup* caller) {
|
|
|
|
if (x28_tablegroup_rightmenu == caller) {
|
|
|
|
DeactivateRightMenu();
|
|
|
|
x24_tablegroup_leftmenu->SetIsActive(true);
|
|
|
|
x28_tablegroup_rightmenu->SetIsActive(false);
|
|
|
|
x28_tablegroup_rightmenu->SetUserSelection(0);
|
|
|
|
SetTableColors(x28_tablegroup_rightmenu);
|
|
|
|
CSfxManager::SfxStart(SFXfnt_back, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
}
|
|
|
|
}
|
2017-01-13 00:16:26 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SOptionsFrontEndFrame::DoMenuSelectionChange(CGuiTableGroup* caller, int oldSel) {
|
|
|
|
SetTableColors(caller);
|
|
|
|
if (x24_tablegroup_leftmenu == caller) {
|
|
|
|
SetRightUIText();
|
|
|
|
CSfxManager::SfxStart(SFXfnt_selection_change, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
} else if (x28_tablegroup_rightmenu == caller) {
|
|
|
|
HandleRightSelectionChange();
|
|
|
|
CSfxManager::SfxStart(SFXfnt_selection_change, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
} else if (x2c_tablegroup_double == caller || x30_tablegroup_triple == caller) {
|
|
|
|
if (x28_tablegroup_rightmenu->GetIsActive()) {
|
|
|
|
int leftSel = x24_tablegroup_leftmenu->GetUserSelection();
|
|
|
|
int rightSel = x28_tablegroup_rightmenu->GetUserSelection();
|
|
|
|
const auto& optionCategory = GameOptionsRegistry[leftSel];
|
|
|
|
const SGameOption& option = optionCategory.second[rightSel];
|
|
|
|
CGameOptions::SetOption(option.option, caller->GetUserSelection());
|
|
|
|
CSfxManager::SfxStart(SFXfnt_enum_change, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
|
|
|
|
if (option.option == EGameOption::Rumble && caller->GetUserSelection() > 0) {
|
|
|
|
x40_rumbleGen.HardStopAll();
|
2022-03-20 04:19:43 +00:00
|
|
|
x40_rumbleGen.Rumble(RumbleFxTable[size_t(ERumbleFxId::PlayerBump)], 1.f, ERumblePriority::One, EIOPort::Player1);
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::SOptionsFrontEndFrame::DoLeftMenuAdvance(CGuiTableGroup* caller) {
|
|
|
|
if (caller == x24_tablegroup_leftmenu) {
|
|
|
|
HandleRightSelectionChange();
|
|
|
|
x28_tablegroup_rightmenu->SetUserSelection(0);
|
|
|
|
x24_tablegroup_leftmenu->SetIsActive(false);
|
|
|
|
x28_tablegroup_rightmenu->SetIsActive(true);
|
|
|
|
CSfxManager::SfxStart(SFXfnt_advance_L, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
CSfxManager::SfxStart(SFXfnt_advance_R, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::SOptionsFrontEndFrame::DeactivateRightMenu() {
|
|
|
|
x2c_tablegroup_double->SetIsActive(false);
|
|
|
|
x30_tablegroup_triple->SetIsActive(false);
|
|
|
|
x34_slidergroup_slider->SetIsActive(false);
|
|
|
|
x2c_tablegroup_double->SetVisibility(false, ETraversalMode::Children);
|
|
|
|
x30_tablegroup_triple->SetVisibility(false, ETraversalMode::Children);
|
|
|
|
x34_slidergroup_slider->SetVisibility(false, ETraversalMode::Children);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::SOptionsFrontEndFrame::HandleRightSelectionChange() {
|
|
|
|
DeactivateRightMenu();
|
|
|
|
int leftSel = x24_tablegroup_leftmenu->GetUserSelection();
|
|
|
|
int rightSel = x28_tablegroup_rightmenu->GetUserSelection();
|
|
|
|
const auto& optionCategory = GameOptionsRegistry[leftSel];
|
|
|
|
const SGameOption& option = optionCategory.second[rightSel];
|
|
|
|
|
|
|
|
switch (option.type) {
|
|
|
|
case EOptionType::Float:
|
|
|
|
x34_slidergroup_slider->SetIsActive(true);
|
|
|
|
x34_slidergroup_slider->SetVisibility(true, ETraversalMode::Children);
|
|
|
|
x34_slidergroup_slider->SetMinVal(option.minVal);
|
|
|
|
x34_slidergroup_slider->SetMaxVal(option.maxVal);
|
|
|
|
x34_slidergroup_slider->SetIncrement(option.increment);
|
|
|
|
x34_slidergroup_slider->SetCurVal(CGameOptions::GetOption(option.option));
|
|
|
|
x34_slidergroup_slider->SetLocalTransform(zeus::CTransform::Translate(0.f, 0.f, rightSel * x38_rowPitch) *
|
|
|
|
x34_slidergroup_slider->GetTransform());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EOptionType::DoubleEnum:
|
|
|
|
x2c_tablegroup_double->SetUserSelection(CGameOptions::GetOption(option.option));
|
|
|
|
x2c_tablegroup_double->SetIsVisible(true);
|
|
|
|
x2c_tablegroup_double->SetIsActive(true);
|
|
|
|
x2c_tablegroup_double->SetLocalTransform(zeus::CTransform::Translate(0.f, 0.f, rightSel * x38_rowPitch) *
|
|
|
|
x2c_tablegroup_double->GetTransform());
|
|
|
|
SetTableColors(x2c_tablegroup_double);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EOptionType::TripleEnum:
|
|
|
|
x30_tablegroup_triple->SetUserSelection(CGameOptions::GetOption(option.option));
|
|
|
|
x30_tablegroup_triple->SetIsVisible(true);
|
|
|
|
x30_tablegroup_triple->SetIsActive(true);
|
|
|
|
x30_tablegroup_triple->SetLocalTransform(zeus::CTransform::Translate(0.f, 0.f, rightSel * x38_rowPitch) *
|
|
|
|
x30_tablegroup_triple->GetTransform());
|
|
|
|
SetTableColors(x30_tablegroup_triple);
|
|
|
|
break;
|
2017-01-13 00:16:26 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2017-01-13 00:16:26 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SOptionsFrontEndFrame::SetRightUIText() {
|
2019-08-14 06:49:40 +00:00
|
|
|
const int userSel = x24_tablegroup_leftmenu->GetUserSelection();
|
2020-04-16 10:25:59 +00:00
|
|
|
const auto& options =
|
|
|
|
(g_Main->IsUSA() && !g_Main->IsTrilogy()) ? GameOptionsRegistry[userSel] : GameOptionsRegistryNew[userSel];
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < 5; ++i) {
|
2020-04-11 22:51:39 +00:00
|
|
|
std::string name = fmt::format(FMT_STRING("textpane_right{}"), i);
|
2019-08-14 06:49:40 +00:00
|
|
|
if (i < static_cast<int>(options.first)) {
|
2020-02-28 10:11:20 +00:00
|
|
|
FindTextPanePair(x1c_loadedFrame, name).SetPairText(x20_loadedPauseStrg->GetString(options.second[i].stringId));
|
2018-12-08 05:30:43 +00:00
|
|
|
x28_tablegroup_rightmenu->GetWorkerWidget(i)->SetIsSelectable(true);
|
|
|
|
} else {
|
2020-02-28 10:11:20 +00:00
|
|
|
FindTextPanePair(x1c_loadedFrame, name).SetPairText(u"");
|
2018-12-08 05:30:43 +00:00
|
|
|
x28_tablegroup_rightmenu->GetWorkerWidget(i)->SetIsSelectable(false);
|
2017-01-10 07:15:49 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2017-01-10 07:15:49 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SOptionsFrontEndFrame::SetTableColors(CGuiTableGroup* tbgp) const {
|
2019-02-24 07:15:54 +00:00
|
|
|
tbgp->SetColors(zeus::skWhite, zeus::CColor{0.627450f, 0.627450f, 0.627450f, 0.784313f});
|
2017-01-10 07:15:49 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SOptionsFrontEndFrame::FinishedLoading() {
|
|
|
|
x1c_loadedFrame->SetAspectConstraint(1.78f);
|
2017-01-30 04:16:20 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x24_tablegroup_leftmenu = static_cast<CGuiTableGroup*>(x1c_loadedFrame->FindWidget("tablegroup_leftmenu"));
|
|
|
|
x28_tablegroup_rightmenu = static_cast<CGuiTableGroup*>(x1c_loadedFrame->FindWidget("tablegroup_rightmenu"));
|
|
|
|
x2c_tablegroup_double = static_cast<CGuiTableGroup*>(x1c_loadedFrame->FindWidget("tablegroup_double"));
|
|
|
|
x30_tablegroup_triple = static_cast<CGuiTableGroup*>(x1c_loadedFrame->FindWidget("tablegroup_triple"));
|
|
|
|
x34_slidergroup_slider = static_cast<CGuiSliderGroup*>(x1c_loadedFrame->FindWidget("slidergroup_slider"));
|
2017-01-10 07:15:49 +00:00
|
|
|
|
2019-08-14 07:45:28 +00:00
|
|
|
x24_tablegroup_leftmenu->SetMenuAdvanceCallback([this](CGuiTableGroup* caller) { DoLeftMenuAdvance(caller); });
|
2018-12-08 05:30:43 +00:00
|
|
|
x24_tablegroup_leftmenu->SetMenuSelectionChangeCallback(
|
2019-08-14 07:45:28 +00:00
|
|
|
[this](CGuiTableGroup* caller, int oldSel) { DoMenuSelectionChange(caller, oldSel); });
|
2017-01-10 07:15:49 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x38_rowPitch = x24_tablegroup_leftmenu->GetWorkerWidget(1)->GetIdlePosition().z() -
|
|
|
|
x24_tablegroup_leftmenu->GetWorkerWidget(0)->GetIdlePosition().z();
|
2017-01-10 07:15:49 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x28_tablegroup_rightmenu->SetMenuSelectionChangeCallback(
|
2019-08-14 07:45:28 +00:00
|
|
|
[this](CGuiTableGroup* caller, int oldSel) { DoMenuSelectionChange(caller, oldSel); });
|
|
|
|
x28_tablegroup_rightmenu->SetMenuCancelCallback([this](CGuiTableGroup* caller) { DoMenuCancel(caller); });
|
2017-01-10 07:15:49 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x2c_tablegroup_double->SetMenuSelectionChangeCallback(
|
2019-08-14 07:45:28 +00:00
|
|
|
[this](CGuiTableGroup* caller, int oldSel) { DoMenuSelectionChange(caller, oldSel); });
|
|
|
|
x2c_tablegroup_double->SetMenuCancelCallback([this](CGuiTableGroup* caller) { DoMenuCancel(caller); });
|
2017-01-10 07:15:49 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x30_tablegroup_triple->SetMenuSelectionChangeCallback(
|
2019-08-14 07:45:28 +00:00
|
|
|
[this](CGuiTableGroup* caller, int oldSel) { DoMenuSelectionChange(caller, oldSel); });
|
|
|
|
x30_tablegroup_triple->SetMenuCancelCallback([this](CGuiTableGroup* caller) { DoMenuCancel(caller); });
|
2017-01-10 07:15:49 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x34_slidergroup_slider->SetSelectionChangedCallback(
|
2019-08-14 07:45:28 +00:00
|
|
|
[this](CGuiSliderGroup* caller, float value) { DoSliderChange(caller, value); });
|
2017-01-10 07:15:49 +00:00
|
|
|
|
2020-04-16 10:25:59 +00:00
|
|
|
FindTextPanePair(x1c_loadedFrame, "textpane_double0")
|
|
|
|
.SetPairText(x20_loadedPauseStrg->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 95 : 98)); // Off
|
|
|
|
FindTextPanePair(x1c_loadedFrame, "textpane_double1")
|
|
|
|
.SetPairText(x20_loadedPauseStrg->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 94 : 97)); // On
|
|
|
|
FindTextPanePair(x1c_loadedFrame, "textpane_triple0")
|
|
|
|
.SetPairText(x20_loadedPauseStrg->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 96 : 99)); // Mono
|
|
|
|
FindTextPanePair(x1c_loadedFrame, "textpane_triple1")
|
|
|
|
.SetPairText(x20_loadedPauseStrg->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 97 : 100)); // Stereo
|
|
|
|
FindTextPanePair(x1c_loadedFrame, "textpane_triple2")
|
|
|
|
.SetPairText(x20_loadedPauseStrg->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 98 : 101)); // Dolby
|
2017-01-10 07:15:49 +00:00
|
|
|
|
2020-04-16 10:25:59 +00:00
|
|
|
FindTextPanePair(x1c_loadedFrame, "textpane_title")
|
|
|
|
.SetPairText(g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 99 : 93)); // OPTIONS
|
2017-01-10 07:15:49 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (CGuiTextPane* proceed = static_cast<CGuiTextPane*>(x1c_loadedFrame->FindWidget("textpane_proceed")))
|
2020-04-16 10:25:59 +00:00
|
|
|
proceed->TextSupport().SetText(g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 85 : 79));
|
2017-01-10 07:15:49 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (CGuiTextPane* cancel = static_cast<CGuiTextPane*>(x1c_loadedFrame->FindWidget("textpane_cancel")))
|
2020-04-16 10:25:59 +00:00
|
|
|
cancel->TextSupport().SetText(g_MainStringTable->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy()) ? 82 : 76));
|
2017-01-10 07:15:49 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
// Visor, Display, Sound, Controller
|
|
|
|
for (int i = 0; i < 4; ++i) {
|
2020-04-11 22:51:39 +00:00
|
|
|
const std::string name = fmt::format(FMT_STRING("textpane_filename{}"), i);
|
2020-04-16 10:25:59 +00:00
|
|
|
FindTextPanePair(x1c_loadedFrame, name)
|
2020-04-16 10:35:51 +00:00
|
|
|
.SetPairText(x20_loadedPauseStrg->GetString((g_Main->IsUSA() && !g_Main->IsTrilogy() ? 16 : 18) + i));
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2017-01-10 07:15:49 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x2c_tablegroup_double->SetVertical(false);
|
|
|
|
x30_tablegroup_triple->SetVertical(false);
|
2017-01-10 07:15:49 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x24_tablegroup_leftmenu->SetIsActive(true);
|
|
|
|
x28_tablegroup_rightmenu->SetIsActive(false);
|
2017-01-10 07:15:49 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
SetTableColors(x24_tablegroup_leftmenu);
|
|
|
|
SetTableColors(x28_tablegroup_rightmenu);
|
|
|
|
SetTableColors(x2c_tablegroup_double);
|
|
|
|
SetTableColors(x30_tablegroup_triple);
|
2017-01-10 07:15:49 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
SetRightUIText();
|
|
|
|
DeactivateRightMenu();
|
2017-01-10 07:15:49 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
bool CFrontEndUI::SOptionsFrontEndFrame::PumpLoad() {
|
|
|
|
if (x1c_loadedFrame)
|
2016-12-30 18:38:01 +00:00
|
|
|
return true;
|
2018-12-08 05:30:43 +00:00
|
|
|
if (!x4_frme.IsLoaded())
|
|
|
|
return false;
|
|
|
|
if (!x10_pauseScreen.IsLoaded())
|
|
|
|
return false;
|
|
|
|
if (!x4_frme->GetIsFinishedLoading())
|
|
|
|
return false;
|
|
|
|
x1c_loadedFrame = x4_frme.GetObj();
|
|
|
|
x20_loadedPauseStrg = x10_pauseScreen.GetObj();
|
|
|
|
FinishedLoading();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CFrontEndUI::SOptionsFrontEndFrame::ProcessUserInput(const CFinalInput& input, CSaveGameScreen* sui) {
|
|
|
|
x134_25_exitOptions = false;
|
|
|
|
if (sui)
|
|
|
|
sui->ProcessUserInput(input);
|
|
|
|
if (x1c_loadedFrame && x134_24_visible) {
|
2022-07-29 20:16:55 +00:00
|
|
|
if ((input.PB() || input.PSpecialKey(ESpecialKey::Esc)) && x24_tablegroup_leftmenu->GetIsActive()) {
|
2018-12-08 05:30:43 +00:00
|
|
|
x134_25_exitOptions = true;
|
|
|
|
CSfxManager::SfxStart(SFXfnt_back, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
} else {
|
|
|
|
x1c_loadedFrame->ProcessUserInput(input);
|
|
|
|
int leftSel = x24_tablegroup_leftmenu->GetUserSelection();
|
|
|
|
int rightSel = x28_tablegroup_rightmenu->GetUserSelection();
|
|
|
|
CGameOptions::TryRestoreDefaults(input, leftSel, rightSel, true, false);
|
2017-01-13 00:16:26 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
return !x134_25_exitOptions;
|
2017-01-09 03:44:00 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SOptionsFrontEndFrame::Update(float dt, CSaveGameScreen* sui) {
|
|
|
|
x40_rumbleGen.Update(dt);
|
|
|
|
x134_24_visible = !sui || sui->GetUIType() == CSaveGameScreen::EUIType::SaveReady;
|
2016-09-16 20:18:03 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (!PumpLoad())
|
|
|
|
return;
|
2017-01-22 01:40:12 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x0_uiAlpha = std::min(1.f, x0_uiAlpha + dt);
|
|
|
|
x1c_loadedFrame->Update(dt);
|
2016-09-16 20:18:03 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
bool isSliding = x34_slidergroup_slider->GetState() != CGuiSliderGroup::EState::None;
|
|
|
|
if (x3c_sliderSfx.operator bool() != isSliding) {
|
|
|
|
if (isSliding) {
|
|
|
|
x3c_sliderSfx =
|
|
|
|
CSfxManager::SfxStart(SFXui_frontend_options_slider_change_lp, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
} else {
|
|
|
|
CSfxManager::SfxStop(x3c_sliderSfx);
|
|
|
|
x3c_sliderSfx.reset();
|
|
|
|
}
|
|
|
|
}
|
2016-08-05 23:48:53 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SOptionsFrontEndFrame::Draw() const {
|
|
|
|
if (x1c_loadedFrame && x134_24_visible) {
|
2019-02-24 07:15:54 +00:00
|
|
|
CGuiWidgetDrawParms params(x0_uiAlpha, zeus::skZero3f);
|
2018-12-08 05:30:43 +00:00
|
|
|
x1c_loadedFrame->Draw(params);
|
|
|
|
}
|
2016-09-16 20:18:03 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
CFrontEndUI::CFrontEndUI() : CIOWin("FrontEndUI") {
|
|
|
|
CMain* m = static_cast<CMain*>(g_Main);
|
2016-09-16 20:18:03 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
CRandom16 r(time(nullptr));
|
|
|
|
x18_rndA = r.Range(0, 2);
|
|
|
|
x1c_rndB = r.Range(0, 2);
|
2016-09-16 20:18:03 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x20_depsGroup = g_SimplePool->GetObj("FrontEnd_DGRP");
|
|
|
|
x38_pressStart = g_SimplePool->GetObj("TXTR_PressStart");
|
|
|
|
x44_frontendAudioGrp = g_SimplePool->GetObj("FrontEnd_AGSC");
|
2016-12-13 05:22:30 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
xdc_saveUI = std::make_unique<CSaveGameScreen>(ESaveContext::FrontEnd, g_GameState->GetCardSerial());
|
2016-12-13 05:22:30 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
m->ResetGameState();
|
2019-10-01 07:38:03 +00:00
|
|
|
g_GameState->SetCurrentWorldId(g_DefaultWorldTag.id);
|
2018-12-08 05:30:43 +00:00
|
|
|
g_GameState->GameOptions().ResetToDefaults();
|
|
|
|
g_GameState->WriteBackupBuf();
|
2016-12-13 05:22:30 +00:00
|
|
|
|
2020-02-28 10:11:20 +00:00
|
|
|
for (int i = 0; CDvdFile::FileExists(GetAttractMovieFileName(i)); ++i)
|
2018-12-08 05:30:43 +00:00
|
|
|
++xc0_attractCount;
|
2016-12-13 05:22:30 +00:00
|
|
|
}
|
2016-09-16 20:18:03 +00:00
|
|
|
|
2020-06-01 00:27:34 +00:00
|
|
|
CFrontEndUI::~CFrontEndUI() {
|
|
|
|
if (x14_phase >= EPhase::DisplayFrontEnd) {
|
2023-10-22 16:21:20 +00:00
|
|
|
//CAudioSys::RemoveAudioGroup(x44_frontendAudioGrp->GetAudioGroupData());
|
2020-06-01 00:27:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::StartSlideShow(CArchitectureQueue& queue) {
|
2023-10-22 16:21:20 +00:00
|
|
|
//xf4_curAudio->StopMixing();
|
2018-12-08 05:30:43 +00:00
|
|
|
queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11, std::make_shared<CSlideShow>()));
|
2016-12-13 05:22:30 +00:00
|
|
|
}
|
2016-09-16 20:18:03 +00:00
|
|
|
|
2020-04-16 10:25:59 +00:00
|
|
|
std::string CFrontEndUI::GetAttractMovieFileName(int idx) {
|
|
|
|
return fmt::format(FMT_STRING("Video/attract{}.thp"), idx);
|
|
|
|
}
|
2017-01-09 03:44:00 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
std::string CFrontEndUI::GetNextAttractMovieFileName() {
|
|
|
|
std::string ret = GetAttractMovieFileName(xbc_nextAttract);
|
|
|
|
xbc_nextAttract = (xbc_nextAttract + 1) % xc0_attractCount;
|
|
|
|
return ret;
|
2017-01-09 03:44:00 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::SetCurrentMovie(EMenuMovie movie) {
|
2019-09-14 19:51:19 +00:00
|
|
|
if (xb8_curMovie == movie) {
|
2018-12-08 05:30:43 +00:00
|
|
|
return;
|
2019-09-14 19:51:19 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
StopAttractMovie();
|
2022-02-23 08:18:50 +00:00
|
|
|
if (!g_Main->IsTrilogy()) {
|
|
|
|
if (xb8_curMovie != EMenuMovie::Stopped) {
|
|
|
|
xcc_curMoviePtr->SetPlayMode(CMoviePlayer::EPlayMode::Stopped);
|
|
|
|
xcc_curMoviePtr->Rewind();
|
|
|
|
}
|
2016-12-18 04:16:04 +00:00
|
|
|
|
2022-02-23 08:18:50 +00:00
|
|
|
xb8_curMovie = movie;
|
2016-12-13 05:22:30 +00:00
|
|
|
|
2022-02-23 08:18:50 +00:00
|
|
|
if (xb8_curMovie != EMenuMovie::Stopped) {
|
|
|
|
xcc_curMoviePtr = x70_menuMovies[size_t(xb8_curMovie)].get();
|
|
|
|
xcc_curMoviePtr->SetPlayMode(CMoviePlayer::EPlayMode::Playing);
|
|
|
|
} else {
|
|
|
|
xcc_curMoviePtr = nullptr;
|
|
|
|
}
|
2019-09-14 19:51:19 +00:00
|
|
|
}
|
2016-12-14 22:56:59 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::StopAttractMovie() {
|
|
|
|
if (!xc4_attractMovie)
|
|
|
|
return;
|
|
|
|
xc4_attractMovie.reset();
|
|
|
|
xcc_curMoviePtr = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::StartAttractMovie() {
|
|
|
|
if (xc4_attractMovie)
|
|
|
|
return;
|
|
|
|
SetCurrentMovie(EMenuMovie::Stopped);
|
|
|
|
xc4_attractMovie = std::make_unique<CMoviePlayer>(GetNextAttractMovieFileName().c_str(), 0.f, false, true);
|
|
|
|
xcc_curMoviePtr = xc4_attractMovie.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::StartStateTransition(EScreen screen) {
|
|
|
|
switch (x50_curScreen) {
|
|
|
|
case EScreen::Title:
|
|
|
|
if (screen != EScreen::FileSelect)
|
|
|
|
break;
|
|
|
|
SetCurrentMovie(EMenuMovie::StartFileSelectA);
|
2022-02-23 08:18:50 +00:00
|
|
|
SetFadeBlackTimer(!g_Main->IsTrilogy() ? xcc_curMoviePtr->GetTotalSeconds() : 5);
|
2018-12-08 05:30:43 +00:00
|
|
|
break;
|
|
|
|
case EScreen::FileSelect:
|
|
|
|
if (screen == EScreen::ToPlayGame) {
|
|
|
|
SetCurrentMovie(EMenuMovie::FileSelectPlayGameA);
|
2022-02-23 08:18:50 +00:00
|
|
|
SetFadeBlackTimer(!g_Main->IsTrilogy() ? xcc_curMoviePtr->GetTotalSeconds() : 5);
|
2018-12-08 05:30:43 +00:00
|
|
|
} else if (screen == EScreen::FusionBonus) {
|
|
|
|
SetCurrentMovie(EMenuMovie::FileSelectGBA);
|
2022-02-23 08:18:50 +00:00
|
|
|
SetFadeBlackTimer(!g_Main->IsTrilogy() ? xcc_curMoviePtr->GetTotalSeconds() : 5);
|
2018-12-08 05:30:43 +00:00
|
|
|
CSfxManager::SfxStart(SFXfnt_tofusion_L, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
CSfxManager::SfxStart(SFXfnt_tofusion_R, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case EScreen::FusionBonus:
|
|
|
|
if (screen == EScreen::ToPlayGame) {
|
|
|
|
SetCurrentMovie(EMenuMovie::GBAFileSelectB);
|
2022-02-23 08:18:50 +00:00
|
|
|
SetFadeBlackTimer(!g_Main->IsTrilogy() ? xcc_curMoviePtr->GetTotalSeconds() : 5);
|
2018-12-08 05:30:43 +00:00
|
|
|
} else if (screen == EScreen::FileSelect) {
|
|
|
|
SetCurrentMovie(EMenuMovie::GBAFileSelectA);
|
2022-02-23 08:18:50 +00:00
|
|
|
SetFadeBlackTimer(!g_Main->IsTrilogy() ? xcc_curMoviePtr->GetTotalSeconds() : 5);
|
2018-12-08 05:30:43 +00:00
|
|
|
CSfxManager::SfxStart(SFXfnt_fromfusion_L, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
CSfxManager::SfxStart(SFXfnt_fromfusion_R, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
}
|
2019-02-18 05:47:46 +00:00
|
|
|
break;
|
2018-12-08 05:30:43 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (screen) {
|
|
|
|
case EScreen::OpenCredits:
|
|
|
|
case EScreen::Title:
|
|
|
|
SetCurrentMovie(EMenuMovie::FirstStart);
|
2022-02-23 08:18:50 +00:00
|
|
|
SetFadeBlackTimer(!g_Main->IsTrilogy() ? xcc_curMoviePtr->GetTotalSeconds() : 5);
|
2018-12-08 05:30:43 +00:00
|
|
|
break;
|
|
|
|
case EScreen::AttractMovie:
|
|
|
|
StartAttractMovie();
|
|
|
|
SetFadeBlackWithMovie();
|
2019-02-18 05:47:46 +00:00
|
|
|
break;
|
2018-12-08 05:30:43 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
x54_nextScreen = screen;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::CompleteStateTransition() {
|
|
|
|
EScreen oldScreen = x50_curScreen;
|
|
|
|
x50_curScreen = x54_nextScreen;
|
|
|
|
|
|
|
|
switch (x50_curScreen) {
|
|
|
|
case EScreen::AttractMovie:
|
|
|
|
x54_nextScreen = EScreen::OpenCredits;
|
|
|
|
x50_curScreen = EScreen::OpenCredits;
|
|
|
|
xd0_playerSkipToTitle = false;
|
|
|
|
StartStateTransition(EScreen::Title);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EScreen::Title:
|
|
|
|
SetCurrentMovie(EMenuMovie::StartLoop);
|
|
|
|
SetFadeBlackTimer(30.f);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EScreen::FileSelect:
|
|
|
|
SetCurrentMovie(EMenuMovie::FileSelectLoop);
|
|
|
|
if (oldScreen == EScreen::Title) {
|
2023-10-22 16:21:20 +00:00
|
|
|
//xf4_curAudio->StopMixing();
|
|
|
|
//xf4_curAudio = xd8_audio2.get();
|
|
|
|
//xf4_curAudio->StartMixing();
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
if (xdc_saveUI)
|
|
|
|
xdc_saveUI->ResetCardDriver();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EScreen::FusionBonus:
|
|
|
|
SetCurrentMovie(EMenuMovie::GBALoop);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EScreen::ToPlayGame:
|
|
|
|
x14_phase = EPhase::ExitFrontEnd;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::HandleDebugMenuReturnValue(CGameDebug::EReturnValue val, CArchitectureQueue& queue) {}
|
|
|
|
|
2020-03-30 01:55:58 +00:00
|
|
|
void CFrontEndUI::Draw() {
|
|
|
|
if (x14_phase < EPhase::DisplayFrontEnd) {
|
2018-12-08 05:30:43 +00:00
|
|
|
return;
|
2020-03-30 01:55:58 +00:00
|
|
|
}
|
2019-07-21 08:42:52 +00:00
|
|
|
SCOPED_GRAPHICS_DEBUG_GROUP("CFrontEndUI::Draw", zeus::skGreen);
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
if (xec_emuFrme) {
|
|
|
|
xec_emuFrme->Draw(xdc_saveUI.get());
|
|
|
|
} else {
|
2022-03-04 07:47:21 +00:00
|
|
|
if ((xcc_curMoviePtr != nullptr)) {
|
2018-12-08 05:30:43 +00:00
|
|
|
/* Render movie */
|
2022-05-24 00:26:35 +00:00
|
|
|
xcc_curMoviePtr->DrawVideo();
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (x50_curScreen == EScreen::FileSelect && x54_nextScreen == EScreen::FileSelect) {
|
|
|
|
/* Render active FileSelect UI */
|
|
|
|
if (xf0_optionsFrme)
|
|
|
|
xf0_optionsFrme->Draw();
|
|
|
|
else if (xe0_frontendCardFrme)
|
|
|
|
xe0_frontendCardFrme->Draw();
|
|
|
|
else
|
|
|
|
xe8_frontendNoCardFrme->Draw();
|
|
|
|
} else if (x50_curScreen == EScreen::FusionBonus && x54_nextScreen == EScreen::FusionBonus) {
|
|
|
|
/* Render Fusion bonus UI */
|
|
|
|
xe4_fusionBonusFrme->Draw();
|
|
|
|
}
|
|
|
|
|
2022-02-08 06:54:05 +00:00
|
|
|
if (x64_pressStartAlpha > 0.f && x38_pressStart.IsLoaded()) {
|
2018-12-08 05:30:43 +00:00
|
|
|
/* Render "Press Start" */
|
2022-08-15 22:50:20 +00:00
|
|
|
CGraphics::SetTevOp(ERglTevStage::Stage0, CTevCombiners::kEnvModulate);
|
|
|
|
CGraphics::SetTevOp(ERglTevStage::Stage1, CTevCombiners::kEnvPassthru);
|
2022-03-06 07:46:42 +00:00
|
|
|
g_Renderer->SetBlendMode_AdditiveAlpha();
|
|
|
|
g_Renderer->SetDepthReadWrite(false, false);
|
|
|
|
const auto width = x38_pressStart->GetWidth();
|
|
|
|
const auto height = x38_pressStart->GetHeight();
|
|
|
|
CGraphics::Render2D(*x38_pressStart, 320 - width / 2, 72 - height / 2, width, height,
|
|
|
|
zeus::CColor{1.f, x64_pressStartAlpha});
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (xc0_attractCount > 0) {
|
|
|
|
/* Render fade-to-black into attract movie */
|
|
|
|
if (((x50_curScreen == EScreen::Title && x54_nextScreen == EScreen::Title) ||
|
|
|
|
x54_nextScreen == EScreen::AttractMovie) &&
|
|
|
|
x58_fadeBlackTimer < 1.f) {
|
|
|
|
/* To black */
|
2019-02-24 07:15:54 +00:00
|
|
|
zeus::CColor color = zeus::skBlack;
|
2018-12-08 05:30:43 +00:00
|
|
|
color.a() = 1.f - x58_fadeBlackTimer;
|
2022-05-02 23:42:59 +00:00
|
|
|
CCameraFilterPass::DrawFilter(EFilterType::Blend, EFilterShape::Fullscreen, color, nullptr, 1.f);
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (xd0_playerSkipToTitle) {
|
|
|
|
/* Render fade-through-black into title if player skips */
|
|
|
|
if (x50_curScreen == EScreen::OpenCredits && x54_nextScreen == EScreen::Title) {
|
|
|
|
/* To black */
|
2019-02-24 07:15:54 +00:00
|
|
|
zeus::CColor color = zeus::skBlack;
|
2018-12-08 05:30:43 +00:00
|
|
|
color.a() = zeus::clamp(0.f, 1.f - x58_fadeBlackTimer, 1.f);
|
2022-05-02 23:42:59 +00:00
|
|
|
CCameraFilterPass::DrawFilter(EFilterType::Blend, EFilterShape::Fullscreen, color, nullptr, 1.f);
|
2018-12-08 05:30:43 +00:00
|
|
|
} else if (x50_curScreen == EScreen::Title && x54_nextScreen == EScreen::Title) {
|
|
|
|
/* From black with 30-sec skip to title */
|
2019-02-24 07:15:54 +00:00
|
|
|
zeus::CColor color = zeus::skBlack;
|
2018-12-08 05:30:43 +00:00
|
|
|
color.a() = 1.f - zeus::clamp(0.f, 30.f - x58_fadeBlackTimer, 1.f);
|
2022-05-02 23:42:59 +00:00
|
|
|
CCameraFilterPass::DrawFilter(EFilterType::Blend, EFilterShape::Fullscreen, color, nullptr, 1.f);
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (xdc_saveUI) {
|
|
|
|
/* Render memory card feedback strings */
|
|
|
|
if ((CanShowSaveUI() && !xdc_saveUI->IsHiddenFromFrontEnd()) ||
|
|
|
|
((x50_curScreen == EScreen::FileSelect && x54_nextScreen == EScreen::FileSelect) ||
|
|
|
|
(x50_curScreen == EScreen::FusionBonus && x54_nextScreen == EScreen::FusionBonus)))
|
|
|
|
xdc_saveUI->Draw();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::UpdateMovies(float dt) {
|
|
|
|
if (xcc_curMoviePtr && x5c_fadeBlackWithMovie) {
|
|
|
|
/* Set fade-to-black timer to match attract movie */
|
|
|
|
x5c_fadeBlackWithMovie = false;
|
|
|
|
x58_fadeBlackTimer = xcc_curMoviePtr->GetTotalSeconds();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Advance playing menu movies */
|
|
|
|
for (auto& movie : x70_menuMovies)
|
|
|
|
if (movie)
|
|
|
|
movie->Update(dt);
|
|
|
|
|
|
|
|
/* Advance attract movie */
|
|
|
|
if (xc4_attractMovie)
|
|
|
|
xc4_attractMovie->Update(dt);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::FinishedLoadingDepsGroup() {
|
|
|
|
/* Transfer DGRP tokens into FrontEnd and lock */
|
|
|
|
const CDependencyGroup* dgrp = x20_depsGroup.GetObj();
|
|
|
|
x2c_deps.reserve(dgrp->GetObjectTagVector().size());
|
|
|
|
for (const SObjectTag& tag : dgrp->GetObjectTagVector()) {
|
|
|
|
x2c_deps.push_back(g_SimplePool->GetObj(tag));
|
|
|
|
x2c_deps.back().Lock();
|
|
|
|
}
|
|
|
|
x44_frontendAudioGrp.Lock();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CFrontEndUI::PumpLoad() {
|
|
|
|
/* Poll all tokens for load completion */
|
|
|
|
for (CToken& tok : x2c_deps)
|
|
|
|
if (!tok.IsLoaded())
|
|
|
|
return false;
|
|
|
|
if (!x44_frontendAudioGrp.IsLoaded())
|
|
|
|
return false;
|
2016-12-18 04:16:04 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
return true;
|
2016-12-14 22:56:59 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
bool CFrontEndUI::PumpMovieLoad() {
|
|
|
|
/* Prepare all FrontEnd movies and pause each */
|
2019-09-14 19:51:19 +00:00
|
|
|
if (xd1_moviesLoaded) {
|
2016-12-13 05:22:30 +00:00
|
|
|
return true;
|
2019-09-14 19:51:19 +00:00
|
|
|
}
|
2022-02-23 08:18:50 +00:00
|
|
|
if (g_Main->IsTrilogy()) {
|
|
|
|
return true;
|
|
|
|
}
|
2019-09-14 19:51:19 +00:00
|
|
|
|
|
|
|
for (size_t i = 0; i < x70_menuMovies.size(); ++i) {
|
|
|
|
if (x70_menuMovies[i] != nullptr) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
const FEMovie& movie = FEMovies[i];
|
|
|
|
std::string path = movie.path;
|
|
|
|
if (i == size_t(EMenuMovie::StartFileSelectA)) {
|
|
|
|
const auto pos = path.find("A.thp");
|
|
|
|
if (pos != std::string::npos) {
|
|
|
|
path[pos] = 'A' + x18_rndA;
|
|
|
|
}
|
|
|
|
} else if (i == size_t(EMenuMovie::FileSelectPlayGameA)) {
|
|
|
|
const auto pos = path.find("A.thp");
|
|
|
|
if (pos != std::string::npos) {
|
|
|
|
path[pos] = 'A' + x1c_rndB;
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
}
|
2019-09-14 19:51:19 +00:00
|
|
|
|
2022-02-23 08:18:50 +00:00
|
|
|
if (CDvdFile::FileExists(path)) {
|
|
|
|
x70_menuMovies[i] = std::make_unique<CMoviePlayer>(path.c_str(), 0.05f, movie.loop, false);
|
|
|
|
x70_menuMovies[i]->SetPlayMode(CMoviePlayer::EPlayMode::Stopped);
|
|
|
|
}
|
2019-09-14 19:51:19 +00:00
|
|
|
return false;
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2019-09-14 19:51:19 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
xd1_moviesLoaded = true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFrontEndUI::ProcessUserInput(const CFinalInput& input, CArchitectureQueue& queue) {
|
|
|
|
if (static_cast<CMain*>(g_Main)->GetCardBusy())
|
|
|
|
return;
|
|
|
|
if (input.ControllerIdx() > 1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (xec_emuFrme) {
|
|
|
|
/* NES emulator pre-empts user input if active */
|
|
|
|
xec_emuFrme->ProcessUserInput(input, xdc_saveUI.get());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Controllers other than first shall not pass */
|
|
|
|
if (x14_phase != EPhase::DisplayFrontEnd || input.ControllerIdx() != 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (x50_curScreen != x54_nextScreen) {
|
|
|
|
if (x54_nextScreen == EScreen::AttractMovie &&
|
2022-07-29 20:16:55 +00:00
|
|
|
(input.PStart() || input.PA() || input.PSpecialKey(ESpecialKey::Esc) ||
|
|
|
|
input.PSpecialKey(ESpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary))) {
|
2018-12-08 05:30:43 +00:00
|
|
|
/* Player wants to return to opening credits from attract movie */
|
|
|
|
SetFadeBlackTimer(std::min(1.f, x58_fadeBlackTimer));
|
|
|
|
PlayAdvanceSfx();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-07-29 20:16:55 +00:00
|
|
|
if (input.PA() || input.PStart() || input.PSpecialKey(ESpecialKey::Esc) ||
|
|
|
|
input.PSpecialKey(ESpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary)) {
|
2018-12-08 05:30:43 +00:00
|
|
|
if (x50_curScreen == EScreen::OpenCredits && x54_nextScreen == EScreen::Title && x58_fadeBlackTimer > 1.f) {
|
|
|
|
/* Player is too impatient to view opening credits */
|
|
|
|
xd0_playerSkipToTitle = true;
|
|
|
|
SetFadeBlackTimer(1.f);
|
2016-12-30 06:37:01 +00:00
|
|
|
return;
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (x50_curScreen == EScreen::Title) {
|
2022-07-29 20:16:55 +00:00
|
|
|
if (input.PStart() || input.PA() || input.PSpecialKey(ESpecialKey::Esc) ||
|
|
|
|
input.PSpecialKey(ESpecialKey::Enter) || input.PMouseButton(EMouseButton::Primary)) {
|
2018-12-08 05:30:43 +00:00
|
|
|
if (x58_fadeBlackTimer < 30.f - g_tweakGame->GetPressStartDelay()) {
|
|
|
|
/* Proceed to file select UI */
|
|
|
|
CSfxManager::SfxStart(FETransitionBackSFX[x18_rndA][0], 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
CSfxManager::SfxStart(FETransitionBackSFX[x18_rndA][1], 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
StartStateTransition(EScreen::FileSelect);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (x50_curScreen == EScreen::FileSelect && x54_nextScreen == EScreen::FileSelect) {
|
|
|
|
if (xf0_optionsFrme) {
|
|
|
|
/* Control options UI */
|
|
|
|
if (xf0_optionsFrme->ProcessUserInput(input, xdc_saveUI.get()))
|
|
|
|
return;
|
|
|
|
/* Exit options UI */
|
|
|
|
xf0_optionsFrme.reset();
|
2016-12-30 06:37:01 +00:00
|
|
|
return;
|
2018-12-08 05:30:43 +00:00
|
|
|
} else if (xe0_frontendCardFrme) {
|
|
|
|
/* Control FrontEnd with memory card */
|
2022-03-04 07:47:21 +00:00
|
|
|
switch (xe0_frontendCardFrme->ProcessUserInput(input)) {
|
2018-12-08 05:30:43 +00:00
|
|
|
case SNewFileSelectFrame::EAction::FusionBonus:
|
|
|
|
StartStateTransition(EScreen::FusionBonus);
|
|
|
|
return;
|
|
|
|
case SNewFileSelectFrame::EAction::GameOptions:
|
|
|
|
xf0_optionsFrme = std::make_unique<SOptionsFrontEndFrame>();
|
|
|
|
return;
|
|
|
|
case SNewFileSelectFrame::EAction::SlideShow:
|
|
|
|
xd2_deferSlideShow = true;
|
|
|
|
StartSlideShow(queue);
|
|
|
|
return;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Control FrontEnd without memory card */
|
2022-03-04 07:47:21 +00:00
|
|
|
switch (xe8_frontendNoCardFrme->ProcessUserInput(input)) {
|
2018-12-08 05:30:43 +00:00
|
|
|
case SFrontEndFrame::EAction::FusionBonus:
|
|
|
|
StartStateTransition(EScreen::FusionBonus);
|
|
|
|
return;
|
|
|
|
case SFrontEndFrame::EAction::GameOptions:
|
|
|
|
xf0_optionsFrme = std::make_unique<SOptionsFrontEndFrame>();
|
|
|
|
return;
|
|
|
|
case SFrontEndFrame::EAction::StartGame:
|
|
|
|
TransitionToGame();
|
|
|
|
return;
|
|
|
|
case SFrontEndFrame::EAction::SlideShow:
|
|
|
|
xd2_deferSlideShow = true;
|
|
|
|
StartSlideShow(queue);
|
|
|
|
return;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (x50_curScreen == EScreen::FusionBonus && x54_nextScreen == EScreen::FusionBonus) {
|
|
|
|
/* Control Fusion bonus UI */
|
2022-03-04 07:47:21 +00:00
|
|
|
switch (xe4_fusionBonusFrme->ProcessUserInput(input, xdc_saveUI.get())) {
|
2018-12-08 05:30:43 +00:00
|
|
|
case SFusionBonusFrame::EAction::GoBack:
|
|
|
|
StartStateTransition(EScreen::FileSelect);
|
2016-12-30 06:37:01 +00:00
|
|
|
return;
|
2018-12-08 05:30:43 +00:00
|
|
|
case SFusionBonusFrame::EAction::PlayNESMetroid:
|
2023-10-22 16:21:20 +00:00
|
|
|
//xf4_curAudio->StopMixing();
|
2018-12-08 05:30:43 +00:00
|
|
|
xec_emuFrme = std::make_unique<SNesEmulatorFrame>();
|
|
|
|
if (xdc_saveUI)
|
|
|
|
xdc_saveUI->SetInGame(true);
|
2016-12-30 06:37:01 +00:00
|
|
|
return;
|
2018-12-08 05:30:43 +00:00
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
2016-12-30 06:37:01 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2016-09-16 20:18:03 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::TransitionToGame() {
|
2019-09-14 19:51:19 +00:00
|
|
|
if (x14_phase >= EPhase::ToPlayGame) {
|
2018-12-08 05:30:43 +00:00
|
|
|
return;
|
2019-09-14 19:51:19 +00:00
|
|
|
}
|
2016-12-13 05:22:30 +00:00
|
|
|
|
2019-09-14 19:51:19 +00:00
|
|
|
const auto sfx = FETransitionForwardSFX[x1c_rndB];
|
2018-12-08 05:30:43 +00:00
|
|
|
CSfxManager::SfxStart(sfx[0], 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
|
|
|
CSfxManager::SfxStart(sfx[1], 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
|
2016-12-13 05:22:30 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
x14_phase = EPhase::ToPlayGame;
|
|
|
|
StartStateTransition(EScreen::ToPlayGame);
|
2016-12-13 05:22:30 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFrontEndUI::UpdateMusicVolume() {
|
|
|
|
float volMul = (xf4_curAudio == xd4_audio1.get()) ? FE1_VOL : FE2_VOL;
|
|
|
|
if (xf4_curAudio) {
|
|
|
|
float vol = volMul * x68_musicVol * (g_GameState->GameOptions().GetMusicVolume() / 127.f);
|
|
|
|
xf4_curAudio->SetVolume(vol);
|
|
|
|
}
|
2016-12-14 22:56:59 +00:00
|
|
|
}
|
2016-12-13 05:22:30 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
CIOWin::EMessageReturn CFrontEndUI::Update(float dt, CArchitectureQueue& queue) {
|
|
|
|
if (xdc_saveUI && x50_curScreen >= EScreen::FileSelect) {
|
|
|
|
switch (xdc_saveUI->Update(dt)) {
|
|
|
|
case EMessageReturn::Exit:
|
|
|
|
/* Memory card operation complete, transition to game */
|
|
|
|
TransitionToGame();
|
|
|
|
break;
|
|
|
|
case EMessageReturn::RemoveIOWinAndExit:
|
|
|
|
case EMessageReturn::RemoveIOWin:
|
|
|
|
/* No memory card available, fallback to non-save UI */
|
|
|
|
xe0_frontendCardFrme.reset();
|
|
|
|
xdc_saveUI.reset();
|
2019-02-18 05:47:46 +00:00
|
|
|
break;
|
2018-12-08 05:30:43 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set music fade volume */
|
|
|
|
UpdateMusicVolume();
|
|
|
|
|
|
|
|
switch (x14_phase) {
|
|
|
|
case EPhase::LoadDepsGroup:
|
|
|
|
/* Poll DGRP load */
|
|
|
|
if (!x20_depsGroup.IsLoaded())
|
|
|
|
return EMessageReturn::Exit;
|
|
|
|
FinishedLoadingDepsGroup();
|
|
|
|
x20_depsGroup.Unlock();
|
|
|
|
x14_phase = EPhase::LoadDeps;
|
2019-02-18 05:47:46 +00:00
|
|
|
[[fallthrough]];
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
case EPhase::LoadDeps:
|
|
|
|
/* Poll loading DGRP resources */
|
|
|
|
if (PumpLoad()) {
|
2022-03-04 07:47:21 +00:00
|
|
|
xe0_frontendCardFrme = std::make_unique<SNewFileSelectFrame>(xdc_saveUI.get(), x1c_rndB);
|
2022-02-23 08:18:50 +00:00
|
|
|
if (!g_Main->IsTrilogy()) {
|
2022-03-04 07:47:21 +00:00
|
|
|
xe4_fusionBonusFrme = std::make_unique<SFusionBonusFrame>();
|
2022-02-23 08:18:50 +00:00
|
|
|
}
|
2022-03-04 07:47:21 +00:00
|
|
|
xe8_frontendNoCardFrme = std::make_unique<SFrontEndFrame>(x1c_rndB);
|
2018-12-08 05:30:43 +00:00
|
|
|
x38_pressStart.GetObj();
|
2023-10-22 16:21:20 +00:00
|
|
|
//CAudioSys::AddAudioGroup(x44_frontendAudioGrp->GetAudioGroupData());
|
|
|
|
// xd4_audio1 = std::make_unique<CStaticAudioPlayer>("Audio/frontend_1.rsf", 416480, 1973664);
|
|
|
|
// xd8_audio2 = std::make_unique<CStaticAudioPlayer>("Audio/frontend_2.rsf", 273556, 1636980);
|
2018-12-08 05:30:43 +00:00
|
|
|
x14_phase = EPhase::LoadFrames;
|
|
|
|
}
|
|
|
|
if (x14_phase == EPhase::LoadDeps)
|
|
|
|
return EMessageReturn::Exit;
|
2019-02-18 05:47:46 +00:00
|
|
|
[[fallthrough]];
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
case EPhase::LoadFrames:
|
2022-02-23 08:18:50 +00:00
|
|
|
if (!g_Main->IsTrilogy() && !xe4_fusionBonusFrme->PumpLoad()) {
|
|
|
|
return EMessageReturn::Exit;
|
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
/* Poll loading music and FRME resources */
|
2023-10-23 00:18:27 +00:00
|
|
|
if (/*!xd4_audio1->IsReady() || !xd8_audio2->IsReady() || */ !xe0_frontendCardFrme->PumpLoad() ||
|
2022-02-23 08:18:50 +00:00
|
|
|
!xe8_frontendNoCardFrme->PumpLoad() || !xdc_saveUI->PumpLoad())
|
2018-12-08 05:30:43 +00:00
|
|
|
return EMessageReturn::Exit;
|
2023-10-22 16:21:20 +00:00
|
|
|
// xf4_curAudio = xd4_audio1.get();
|
|
|
|
// xf4_curAudio->StartMixing();
|
2018-12-08 05:30:43 +00:00
|
|
|
x14_phase = EPhase::LoadMovies;
|
2019-02-18 05:47:46 +00:00
|
|
|
[[fallthrough]];
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
case EPhase::LoadMovies: {
|
|
|
|
/* Poll loading movies */
|
|
|
|
bool moviesReady = true;
|
|
|
|
if (PumpMovieLoad()) {
|
|
|
|
/* Prime first frame of movies */
|
|
|
|
UpdateMovies(dt);
|
2019-09-14 19:51:19 +00:00
|
|
|
|
2022-02-23 08:18:50 +00:00
|
|
|
if (!g_Main->IsTrilogy()) {
|
|
|
|
moviesReady = std::all_of(x70_menuMovies.cbegin(), x70_menuMovies.cend(),
|
|
|
|
[](const auto& movie) { return movie->GetIsFullyCached(); });
|
|
|
|
} else {
|
|
|
|
moviesReady = true;
|
|
|
|
}
|
2019-09-14 19:51:19 +00:00
|
|
|
} else {
|
2018-12-08 05:30:43 +00:00
|
|
|
moviesReady = false;
|
2019-09-14 19:51:19 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
if (moviesReady) {
|
|
|
|
/* Ready to display FrontEnd */
|
|
|
|
x14_phase = EPhase::DisplayFrontEnd;
|
|
|
|
StartStateTransition(EScreen::Title);
|
2019-02-18 05:47:46 +00:00
|
|
|
} else {
|
2018-12-08 05:30:43 +00:00
|
|
|
return EMessageReturn::Exit;
|
2019-02-18 05:47:46 +00:00
|
|
|
}
|
|
|
|
[[fallthrough]];
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case EPhase::DisplayFrontEnd:
|
|
|
|
case EPhase::ToPlayGame:
|
|
|
|
/* Displaying frontend to user */
|
|
|
|
if (xec_emuFrme) {
|
|
|
|
/* Update just the emulator if active */
|
|
|
|
if (xec_emuFrme->Update(dt, xdc_saveUI.get())) {
|
|
|
|
/* Exit emulator */
|
|
|
|
xec_emuFrme.reset();
|
|
|
|
if (xdc_saveUI)
|
|
|
|
xdc_saveUI->SetInGame(false);
|
2023-10-22 16:21:20 +00:00
|
|
|
//xf4_curAudio->StartMixing();
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (xd2_deferSlideShow) {
|
|
|
|
/* Start mixing slideshow music */
|
|
|
|
xd2_deferSlideShow = false;
|
2023-10-22 16:21:20 +00:00
|
|
|
//xf4_curAudio->StartMixing();
|
2018-12-08 05:30:43 +00:00
|
|
|
if (xdc_saveUI)
|
|
|
|
xdc_saveUI->ResetCardDriver();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x50_curScreen == EScreen::FileSelect && x54_nextScreen == EScreen::FileSelect) {
|
|
|
|
/* Main FrontEnd UI tree active */
|
|
|
|
if (xf0_optionsFrme) {
|
|
|
|
bool optionsActive = true;
|
|
|
|
if (xdc_saveUI && xdc_saveUI->GetUIType() != CSaveGameScreen::EUIType::SaveReady)
|
|
|
|
optionsActive = false;
|
|
|
|
|
|
|
|
if (optionsActive) {
|
|
|
|
/* Update options UI */
|
|
|
|
xf0_optionsFrme->Update(dt, xdc_saveUI.get());
|
|
|
|
} else {
|
|
|
|
/* Save triggered; exit options UI here */
|
|
|
|
xf0_optionsFrme.reset();
|
|
|
|
}
|
|
|
|
} else if (xe0_frontendCardFrme) {
|
|
|
|
/* Update FrontEnd with memory card UI */
|
|
|
|
xe0_frontendCardFrme->Update(dt);
|
|
|
|
} else {
|
|
|
|
/* Update FrontEnd without memory card UI */
|
|
|
|
xe8_frontendNoCardFrme->Update(dt);
|
|
|
|
}
|
|
|
|
} else if (x50_curScreen == EScreen::FusionBonus && x54_nextScreen == EScreen::FusionBonus) {
|
|
|
|
/* Update Fusion bonus UI */
|
|
|
|
xe4_fusionBonusFrme->Update(dt, xdc_saveUI.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x50_curScreen != x54_nextScreen && xcc_curMoviePtr &&
|
|
|
|
(xcc_curMoviePtr->GetIsMovieFinishedPlaying() || xcc_curMoviePtr->IsLooping())) {
|
|
|
|
/* Movie-based transition complete */
|
|
|
|
CompleteStateTransition();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x58_fadeBlackTimer > 0.f && !x5c_fadeBlackWithMovie) {
|
|
|
|
SetFadeBlackTimer(std::max(0.f, x58_fadeBlackTimer - dt));
|
|
|
|
if (x58_fadeBlackTimer == 0.f) {
|
|
|
|
if (x50_curScreen == EScreen::Title && x54_nextScreen == EScreen::Title) {
|
|
|
|
if (xc0_attractCount > 0) {
|
|
|
|
/* Screen black, start attract movie */
|
|
|
|
StartStateTransition(EScreen::AttractMovie);
|
|
|
|
}
|
|
|
|
} else if (x54_nextScreen == EScreen::AttractMovie) {
|
|
|
|
/* Attract movie done, play open credits again */
|
|
|
|
CompleteStateTransition();
|
|
|
|
} else if (x50_curScreen != x54_nextScreen) {
|
|
|
|
/* Fade-based transition complete */
|
|
|
|
CompleteStateTransition();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Advance active movies */
|
|
|
|
UpdateMovies(dt);
|
|
|
|
|
|
|
|
if (x50_curScreen == EScreen::Title && x54_nextScreen == EScreen::Title) {
|
|
|
|
/* Update press-start pulsing */
|
|
|
|
if (x58_fadeBlackTimer < 30.f - g_tweakGame->GetPressStartDelay()) {
|
|
|
|
x60_pressStartTime = std::fmod(x60_pressStartTime + dt, 1.f);
|
|
|
|
if (x60_pressStartTime < 0.5f)
|
|
|
|
x64_pressStartAlpha = x60_pressStartTime / 0.5f;
|
2016-12-14 22:56:59 +00:00
|
|
|
else
|
2018-12-08 05:30:43 +00:00
|
|
|
x64_pressStartAlpha = (1.f - x60_pressStartTime) / 0.5f;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* Clear press-start pulsing */
|
|
|
|
x60_pressStartTime = 0.f;
|
|
|
|
x64_pressStartAlpha = 0.f;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x50_curScreen == EScreen::Title && x54_nextScreen == EScreen::FileSelect) {
|
|
|
|
/* Fade out title music */
|
2022-02-23 08:18:50 +00:00
|
|
|
if (!g_Main->IsTrilogy()) {
|
|
|
|
x68_musicVol =
|
|
|
|
1.f - zeus::clamp(0.f, (xcc_curMoviePtr->GetPlayedSeconds() - AudioFadeTimeA[x18_rndA]) / 2.5f, 1.f);
|
|
|
|
} else {
|
|
|
|
x68_musicVol -= dt;
|
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
} else if (x54_nextScreen == EScreen::ToPlayGame) {
|
|
|
|
/* Fade out menu music */
|
2022-02-23 08:18:50 +00:00
|
|
|
if (!g_Main->IsTrilogy()) {
|
|
|
|
float delay = AudioFadeTimeB[x1c_rndB];
|
|
|
|
x68_musicVol =
|
|
|
|
1.f -
|
|
|
|
zeus::clamp(
|
|
|
|
0.f, (xcc_curMoviePtr->GetPlayedSeconds() - delay) / (xcc_curMoviePtr->GetTotalSeconds() - delay), 1.f);
|
|
|
|
} else {
|
|
|
|
x68_musicVol -= dt;
|
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
} else {
|
|
|
|
/* Full music volume */
|
|
|
|
x68_musicVol = 1.f;
|
2016-12-14 22:56:59 +00:00
|
|
|
}
|
2016-12-13 05:22:30 +00:00
|
|
|
|
2016-09-16 20:18:03 +00:00
|
|
|
return EMessageReturn::Exit;
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
case EPhase::ExitFrontEnd:
|
|
|
|
/* Remove FrontEnd IOWin and begin updating next IOWin */
|
|
|
|
return EMessageReturn::RemoveIOWin;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EMessageReturn::Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
CIOWin::EMessageReturn CFrontEndUI::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue) {
|
|
|
|
switch (msg.GetType()) {
|
|
|
|
case EArchMsgType::UserInput: {
|
|
|
|
/* Forward user events */
|
|
|
|
const CArchMsgParmUserInput& input = MakeMsg::GetParmUserInput(msg);
|
|
|
|
ProcessUserInput(input.x4_parm, queue);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EArchMsgType::TimerTick: {
|
|
|
|
/* Forward frame events */
|
|
|
|
float dt = MakeMsg::GetParmTimerTick(msg).x4_parm;
|
|
|
|
return Update(dt, queue);
|
|
|
|
}
|
|
|
|
case EArchMsgType::QuitGameplay: {
|
|
|
|
/* Immediately exit FrontEnd */
|
|
|
|
x14_phase = EPhase::ExitFrontEnd;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return EMessageReturn::Normal;
|
|
|
|
}
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce::MP1
|