diff --git a/DataSpec/DNAMP1/FRME.hpp b/DataSpec/DNAMP1/FRME.hpp index 3d7daca38..01daba316 100644 --- a/DataSpec/DNAMP1/FRME.hpp +++ b/DataSpec/DNAMP1/FRME.hpp @@ -164,12 +164,12 @@ struct FRME : BigDNA struct TBGPInfo : IWidgetInfo { DECL_DNA - Value unk1; + Value elementCount; Value unk2; Value unkEnum; - Value unk3; + Value defaultSelection; Value un4; - Value unk5; + Value selectWraparound; Value unk6; Value unkFloat1; Value unkFloat2; diff --git a/Runtime/CGameOptions.cpp b/Runtime/CGameOptions.cpp index 48aed1549..bbd83307a 100644 --- a/Runtime/CGameOptions.cpp +++ b/Runtime/CGameOptions.cpp @@ -24,7 +24,7 @@ CPersistentOptions::CPersistentOptions(CBitStreamReader& stream) xd0_25_ = stream.ReadEncoded(1); xd0_26_ = stream.ReadEncoded(1); xd0_27_ = stream.ReadEncoded(1); - xd0_28_ = stream.ReadEncoded(1); + xd0_28_hasFusion = stream.ReadEncoded(1); xd0_29_ = stream.ReadEncoded(1); xbc_ = stream.ReadEncoded(2); diff --git a/Runtime/CGameOptions.hpp b/Runtime/CGameOptions.hpp index 7741fd288..297e323d0 100644 --- a/Runtime/CGameOptions.hpp +++ b/Runtime/CGameOptions.hpp @@ -29,7 +29,7 @@ class CPersistentOptions bool xd0_25_; bool xd0_26_; bool xd0_27_; - bool xd0_28_; + bool xd0_28_hasFusion; bool xd0_29_; }; u16 _dummy = 0; @@ -40,6 +40,7 @@ public: CPersistentOptions(CBitStreamReader& stream); void SetCinematicState(ResId mlvlId, TEditorId cineId, bool state); + bool PlayerHasFusion() const { return xd0_28_hasFusion; } }; /** Options tracked per game session */ diff --git a/Runtime/GuiSys/CGuiFrame.cpp b/Runtime/GuiSys/CGuiFrame.cpp index 54cc4ddf4..906b6368f 100644 --- a/Runtime/GuiSys/CGuiFrame.cpp +++ b/Runtime/GuiSys/CGuiFrame.cpp @@ -131,7 +131,7 @@ void CGuiFrame::Initialize() { SortDrawOrder(); xc_headWidget->SetColor(xc_headWidget->xa4_color); - xc_headWidget->InitializeRecursive(); + xc_headWidget->DispatchInitialize(); } void CGuiFrame::LoadWidgetsInGame(CInputStream& in) @@ -157,6 +157,17 @@ void CGuiFrame::LoadWidgetsInGame(CInputStream& in) Initialize(); } +void CGuiFrame::ProcessUserInput(const CFinalInput& input) const +{ + if (x4_) + return; + for (CGuiWidget* widget : x2c_widgets) + { + if (widget->GetIsActive()) + widget->ProcessUserInput(input); + } +} + CGuiFrame* CGuiFrame::CreateFrame(ResId frmeId, CGuiSys& sys, CInputStream& in, CSimplePool* sp) { in.readInt32Big(); diff --git a/Runtime/GuiSys/CGuiFrame.hpp b/Runtime/GuiSys/CGuiFrame.hpp index c4d554b86..39ff3c636 100644 --- a/Runtime/GuiSys/CGuiFrame.hpp +++ b/Runtime/GuiSys/CGuiFrame.hpp @@ -56,6 +56,7 @@ public: void Draw(const CGuiWidgetDrawParms& parms) const; void Initialize(); void LoadWidgetsInGame(CInputStream& in); + void ProcessUserInput(const CFinalInput& input) const; CGuiWidgetIdDB& GetWidgetIdDB() {return x18_idDB;} diff --git a/Runtime/GuiSys/CGuiObject.cpp b/Runtime/GuiSys/CGuiObject.cpp index 1f5ff28c3..2b328a80d 100644 --- a/Runtime/GuiSys/CGuiObject.cpp +++ b/Runtime/GuiSys/CGuiObject.cpp @@ -163,4 +163,10 @@ void CGuiObject::SetO2WTransform(const zeus::CTransform& xf) RecalculateTransforms(); } +void CGuiObject::SetLocalTransform(const zeus::CTransform& xf) +{ + x4_localXF = xf; + RecalculateTransforms(); +} + } diff --git a/Runtime/GuiSys/CGuiObject.hpp b/Runtime/GuiSys/CGuiObject.hpp index 47764359c..960913205 100644 --- a/Runtime/GuiSys/CGuiObject.hpp +++ b/Runtime/GuiSys/CGuiObject.hpp @@ -23,7 +23,7 @@ public: virtual ~CGuiObject(); virtual void Update(float dt); virtual void Draw(const CGuiWidgetDrawParms& parms) const; - virtual bool Message()=0; + virtual void Initialize()=0; void MoveInWorld(const zeus::CVector3f& vec); const zeus::CVector3f& GetLocalPosition() const {return x4_localXF.origin;} @@ -43,6 +43,7 @@ public: void RecalculateTransforms(); void Reorthogonalize(); void SetO2WTransform(const zeus::CTransform& xf); + void SetLocalTransform(const zeus::CTransform& xf); }; } diff --git a/Runtime/GuiSys/CGuiTableGroup.cpp b/Runtime/GuiSys/CGuiTableGroup.cpp index f6d01f4d4..3307b631c 100644 --- a/Runtime/GuiSys/CGuiTableGroup.cpp +++ b/Runtime/GuiSys/CGuiTableGroup.cpp @@ -3,23 +3,24 @@ namespace urde { -CGuiTableGroup::CGuiTableGroup(const CGuiWidgetParms& parms, int a, int b, bool c) +CGuiTableGroup::CGuiTableGroup(const CGuiWidgetParms& parms, int elementCount, + int defaultSel, bool selectWraparound) : CGuiCompoundWidget(parms), - xc0_(a), xc4_(b), - xc8_(b), xcc_(b), - xd0_(c) + xc0_elementCount(elementCount), xc4_userSelection(defaultSel), + xc8_prevUserSelection(defaultSel), xcc_defaultUserSelection(defaultSel), + xd0_selectWraparound(selectWraparound) {} CGuiTableGroup* CGuiTableGroup::Create(CGuiFrame* frame, CInputStream& in, bool flag) { CGuiWidgetParms parms = ReadWidgetHeader(frame, in, flag); - int a = in.readInt16Big(); + int elementCount = in.readInt16Big(); in.readInt16Big(); in.readUint32Big(); - int b = in.readInt16Big(); + int defaultSel = in.readInt16Big(); in.readInt16Big(); - bool c = in.readBool(); + bool selectWraparound = in.readBool(); in.readBool(); in.readFloatBig(); in.readFloatBig(); @@ -30,7 +31,7 @@ CGuiTableGroup* CGuiTableGroup::Create(CGuiFrame* frame, CInputStream& in, bool in.readInt16Big(); in.readInt16Big(); - CGuiTableGroup* ret = new CGuiTableGroup(parms, a, b, c); + CGuiTableGroup* ret = new CGuiTableGroup(parms, elementCount, defaultSel, selectWraparound); ret->ParseBaseInfo(frame, in, parms); return ret; } diff --git a/Runtime/GuiSys/CGuiTableGroup.hpp b/Runtime/GuiSys/CGuiTableGroup.hpp index 0335be648..bc73827b2 100644 --- a/Runtime/GuiSys/CGuiTableGroup.hpp +++ b/Runtime/GuiSys/CGuiTableGroup.hpp @@ -13,15 +13,21 @@ public: { float x0_ = 0.f; }; + enum class TableSelectReturn + { + Changed, + Unchanged, + WrappedAround + }; private: SomeState xb8_; SomeState xbc_; - int xc0_; - int xc4_; - int xc8_; - int xcc_; - bool xd0_; + int xc0_elementCount; + int xc4_userSelection; + int xc8_prevUserSelection; + int xcc_defaultUserSelection; + bool xd0_selectWraparound; bool xd1_ = true; std::function xd4_doMenuAdvance; std::function xec_doMenuCancel; @@ -46,8 +52,52 @@ public: x104_doMenuSelChange = std::move(cb); } + void SetColors(const zeus::CColor& selected, const zeus::CColor& unselected) + { + int id = -1; + while (CGuiWidget* worker = GetWorkerWidget(++id)) + { + if (id == xc4_userSelection) + worker->SetColor(selected); + else + worker->SetColor(unselected); + } + } + void SetD1(bool v) { xd1_ = v; } + void SetUserSelection(int sel) + { + xc8_prevUserSelection = xc4_userSelection; + xc4_userSelection = sel; + } + + TableSelectReturn DecrementSelectedRow() + { + xc8_prevUserSelection = xc4_userSelection; + --xc4_userSelection; + if (xc4_userSelection < 0) + { + xc4_userSelection = xd0_selectWraparound ? xc0_elementCount - 1 : 0; + return xd0_selectWraparound ? TableSelectReturn::WrappedAround : TableSelectReturn::Unchanged; + } + return TableSelectReturn::Changed; + } + + TableSelectReturn IncrementSelectedRow() + { + xc8_prevUserSelection = xc4_userSelection; + ++xc4_userSelection; + if (xc4_userSelection >= xc0_elementCount) + { + xc4_userSelection = xd0_selectWraparound ? 0 : xc0_elementCount - 1; + return xd0_selectWraparound ? TableSelectReturn::WrappedAround : TableSelectReturn::Unchanged; + } + return TableSelectReturn::Changed; + } + + int GetUserSelection() const { return xc4_userSelection; } + static CGuiTableGroup* Create(CGuiFrame* frame, CInputStream& in, bool); }; diff --git a/Runtime/GuiSys/CGuiTextSupport.cpp b/Runtime/GuiSys/CGuiTextSupport.cpp index 135d375af..2acb1996a 100644 --- a/Runtime/GuiSys/CGuiTextSupport.cpp +++ b/Runtime/GuiSys/CGuiTextSupport.cpp @@ -53,6 +53,11 @@ float CGuiTextSupport::GetTotalAnimationTime() const return x60_renderBuf->GetPrimitiveCount() / x58_chRate; } +bool CGuiTextSupport::AnimationDone() const +{ + return x3c_curTime >= GetTotalAnimationTime(); +} + void CGuiTextSupport::SetTypeWriteEffectOptions(bool enable, float chFadeTime, float chRate) { x50_typeEnable = enable; diff --git a/Runtime/GuiSys/CGuiTextSupport.hpp b/Runtime/GuiSys/CGuiTextSupport.hpp index 5aef8b4e8..0265e24de 100644 --- a/Runtime/GuiSys/CGuiTextSupport.hpp +++ b/Runtime/GuiSys/CGuiTextSupport.hpp @@ -110,6 +110,7 @@ public: float GetCurrentAnimationOverAge() const; float GetNumCharsPrinted() const; float GetTotalAnimationTime() const; + bool AnimationDone() const; void SetTypeWriteEffectOptions(bool enable, float chFadeTime, float chRate); void Update(float dt); void ClearBuffer(); diff --git a/Runtime/GuiSys/CGuiWidget.cpp b/Runtime/GuiSys/CGuiWidget.cpp index 899e7ba37..704a9a9e3 100644 --- a/Runtime/GuiSys/CGuiWidget.cpp +++ b/Runtime/GuiSys/CGuiWidget.cpp @@ -47,9 +47,8 @@ CGuiWidget* CGuiWidget::Create(CGuiFrame* frame, CInputStream& in, bool flag) return ret; } -bool CGuiWidget::Message() +void CGuiWidget::Initialize() { - return false; } void CGuiWidget::ParseBaseInfo(CGuiFrame* frame, CInputStream& in, const CGuiWidgetParms& parms) @@ -89,7 +88,7 @@ void CGuiWidget::Update(float dt) } void CGuiWidget::Draw(const CGuiWidgetDrawParms&) const {} -void CGuiWidget::Initialize() {} +void CGuiWidget::ProcessUserInput(const CFinalInput& input) {} void CGuiWidget::Touch() const {} bool CGuiWidget::GetIsVisible() const @@ -219,15 +218,15 @@ bool CGuiWidget::GetIsFinishedLoading() const return GetIsFinishedLoadingWidgetSpecific(); } -void CGuiWidget::InitializeRecursive() +void CGuiWidget::DispatchInitialize() { Initialize(); CGuiWidget* ch = static_cast(GetChildObject()); if (ch) - ch->InitializeRecursive(); + ch->DispatchInitialize(); CGuiWidget* sib = static_cast(GetNextSibling()); if (sib) - sib->InitializeRecursive(); + sib->DispatchInitialize(); } void CGuiWidget::SetColor(const zeus::CColor& color) diff --git a/Runtime/GuiSys/CGuiWidget.hpp b/Runtime/GuiSys/CGuiWidget.hpp index f90b9e8e7..3733363b9 100644 --- a/Runtime/GuiSys/CGuiWidget.hpp +++ b/Runtime/GuiSys/CGuiWidget.hpp @@ -9,6 +9,7 @@ namespace urde { class CGuiFrame; class CGuiTextSupport; +class CFinalInput; enum class ETraversalMode { @@ -94,8 +95,8 @@ public: virtual void Update(float dt); virtual void Draw(const CGuiWidgetDrawParms& drawParms) const; - virtual bool Message(); virtual void Initialize(); + virtual void ProcessUserInput(const CFinalInput& input); virtual void Touch() const; virtual bool GetIsVisible() const; virtual bool GetIsActive() const; @@ -109,6 +110,7 @@ public: s16 GetParentId() const {return x72_parentId;} s16 GetWorkerId() const {return xb4_workerId;} const zeus::CTransform& GetTransform() const {return x74_transform;} + zeus::CTransform& GetTransform() {return x74_transform;} const zeus::CVector3f& GetIdlePosition() const {return x74_transform.origin;} void SetIdlePosition(const zeus::CVector3f& pos, bool reapply); void ReapplyXform(); @@ -125,7 +127,7 @@ public: void InitializeRGBAFactor(); CGuiWidget* FindWidget(s16 id); bool GetIsFinishedLoading() const; - void InitializeRecursive(); + void DispatchInitialize(); }; } diff --git a/Runtime/GuiSys/CSaveUI.cpp b/Runtime/GuiSys/CSaveUI.cpp index d29e20bd5..a65708f16 100644 --- a/Runtime/GuiSys/CSaveUI.cpp +++ b/Runtime/GuiSys/CSaveUI.cpp @@ -16,6 +16,11 @@ bool CSaveUI::PumpLoad() return false; } +void CSaveUI::ProcessUserInput(const CFinalInput& input) +{ + +} + CSaveUI::CSaveUI(u32 instIdx, u32 a, u32 b) : x0_instIdx(instIdx), x8_a(a), xc_b(b) { diff --git a/Runtime/GuiSys/CSaveUI.hpp b/Runtime/GuiSys/CSaveUI.hpp index 7bbde0dae..c3fd27a3c 100644 --- a/Runtime/GuiSys/CSaveUI.hpp +++ b/Runtime/GuiSys/CSaveUI.hpp @@ -11,6 +11,7 @@ class CTexture; class CStringTable; class CGuiFrame; class CSaveWorld; +class CFinalInput; struct CSaveUI { @@ -37,6 +38,7 @@ struct CSaveUI CIOWin::EMessageReturn Update(float dt); bool PumpLoad(); + void ProcessUserInput(const CFinalInput& input); CSaveUI(u32 inst, u32 a, u32 b); }; diff --git a/Runtime/Input/CFinalInput.hpp b/Runtime/Input/CFinalInput.hpp index d47dd6006..86c11601e 100644 --- a/Runtime/Input/CFinalInput.hpp +++ b/Runtime/Input/CFinalInput.hpp @@ -74,6 +74,7 @@ public: CFinalInput& operator|=(const CFinalInput& other); bool operator==(const CFinalInput& other) { return memcmp(this, &other, sizeof(CFinalInput)) == 0; } + float DeltaTime() const {return x0_dt;} u32 ControllerIdx() const {return x4_controllerIdx;} bool PStart() const {return x2e_b31_PStart;} diff --git a/Runtime/MP1/CFrontEndUI.cpp b/Runtime/MP1/CFrontEndUI.cpp index 4d7b19ec3..e8943549c 100644 --- a/Runtime/MP1/CFrontEndUI.cpp +++ b/Runtime/MP1/CFrontEndUI.cpp @@ -103,18 +103,18 @@ void CFrontEndUI::SNewFileSelectFrame::FinishedLoading() worker->SetVisibility(false, ETraversalMode::Children); x20_tablegroup_fileselect->SetMenuAdvanceCallback( - std::bind(&SNewFileSelectFrame::DoMenuAdvance, this, std::placeholders::_1)); + std::bind(&SNewFileSelectFrame::DoFileselectAdvance, this, std::placeholders::_1)); x20_tablegroup_fileselect->SetMenuSelectionChangeCallback( - std::bind(&SNewFileSelectFrame::DoMenuSelectionChange, this, std::placeholders::_1)); + std::bind(&SNewFileSelectFrame::DoSelectionChange, this, std::placeholders::_1)); x20_tablegroup_fileselect->SetMenuCancelCallback( - std::bind(&SNewFileSelectFrame::DoMenuAdvance, this, std::placeholders::_1)); + std::bind(&SNewFileSelectFrame::DoFileselectCancel, this, std::placeholders::_1)); x40_tablegroup_popup->SetMenuAdvanceCallback( - std::bind(&SNewFileSelectFrame::DoMenuAdvance, this, std::placeholders::_1)); + std::bind(&SNewFileSelectFrame::DoPopupAdvance, this, std::placeholders::_1)); x40_tablegroup_popup->SetMenuSelectionChangeCallback( - std::bind(&SNewFileSelectFrame::DoMenuSelectionChange, this, std::placeholders::_1)); + std::bind(&SNewFileSelectFrame::DoSelectionChange, this, std::placeholders::_1)); x40_tablegroup_popup->SetMenuCancelCallback( - std::bind(&SNewFileSelectFrame::DoMenuAdvance, this, std::placeholders::_1)); + std::bind(&SNewFileSelectFrame::DoPopupCancel, this, std::placeholders::_1)); for (int i=0 ; i<3 ; ++i) x64_fileSelections[i] = FindFileSelectOption(x1c_loadedFrame, i); @@ -138,12 +138,105 @@ bool CFrontEndUI::SNewFileSelectFrame::PumpLoad() return false; } -void CFrontEndUI::SNewFileSelectFrame::DoMenuSelectionChange(const CGuiTableGroup* caller) +bool CFrontEndUI::SNewFileSelectFrame::IsTextDoneAnimating() const +{ + if (x64_fileSelections[0].x28_ != 4) + return false; + if (x64_fileSelections[1].x28_ != 4) + return false; + if (x64_fileSelections[2].x28_ != 4) + return false; + if (!x28_textpane_erase.x0_panes[0]->GetTextSupport()->AnimationDone()) + return false; + return x38_.x0_panes[0]->GetTextSupport()->AnimationDone(); +} + +CFrontEndUI::SNewFileSelectFrame::EPhase +CFrontEndUI::SNewFileSelectFrame::ProcessUserInput(const CFinalInput& input) +{ + if (x8_ != 2) + x4_saveUI->ProcessUserInput(input); + if (IsTextDoneAnimating()) + x108_curTime = std::min(0.5f, x108_curTime + input.DeltaTime()); + if (x108_curTime < 0.5f) + return xc_phase; + if (x10c_inputEnable) + x1c_loadedFrame->ProcessUserInput(input); + if (x10d_needsToggle) + { + if (x40_tablegroup_popup->GetIsActive()) + DeactivatePopup(); + else + ActivatePopup(); + } + return xc_phase; +} + +void CFrontEndUI::SNewFileSelectFrame::HandleActiveChange(CGuiTableGroup* active) +{ + if (!active) + return; + active->SetColors(zeus::CColor::skWhite, + zeus::CColor{0.627450f, 0.627450f, 0.627450f, 0.784313f}); + + 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)); + + if (x8_ == 0 || x8_ == 3) + x24_model_erase->SetIsVisible(false); + else + x24_model_erase->SetIsVisible(true); +} + +void CFrontEndUI::SNewFileSelectFrame::DeactivatePopup() +{ + x40_tablegroup_popup->SetIsActive(false); + x40_tablegroup_popup->SetIsVisible(false); + x20_tablegroup_fileselect->SetIsActive(true); + HandleActiveChange(x20_tablegroup_fileselect); + x64_fileSelections[x20_tablegroup_fileselect->GetUserSelection()]. + x0_base->SetColor(zeus::CColor::skWhite); +} + +void CFrontEndUI::SNewFileSelectFrame::ActivatePopup() +{ + 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); + x8_ = 2; + HandleActiveChange(x40_tablegroup_popup); + x48_.SetPairText(g_MainStringTable->GetString(95)); + x50_.SetPairText(g_MainStringTable->GetString(38)); + 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); +} + +void CFrontEndUI::SNewFileSelectFrame::DoPopupCancel(const CGuiTableGroup* caller) { } -void CFrontEndUI::SNewFileSelectFrame::DoMenuAdvance(const CGuiTableGroup* caller) +void CFrontEndUI::SNewFileSelectFrame::DoPopupAdvance(const CGuiTableGroup* caller) +{ + +} + +void CFrontEndUI::SNewFileSelectFrame::DoFileselectCancel(const CGuiTableGroup* caller) +{ + +} + +void CFrontEndUI::SNewFileSelectFrame::DoSelectionChange(const CGuiTableGroup* caller) +{ + +} + +void CFrontEndUI::SNewFileSelectFrame::DoFileselectAdvance(const CGuiTableGroup* caller) { } @@ -157,10 +250,75 @@ CFrontEndUI::SGBASupportFrame::SGBASupportFrame() void CFrontEndUI::SGBASupportFrame::FinishedLoading() { + x28_tablegroup_options = static_cast(x24_loadedFrame->FindWidget("tablegroup_options")); + x2c_tablegroup_fusionsuit = static_cast(x24_loadedFrame->FindWidget("tablegroup_fusionsuit")); + x30_textpane_instructions = FindTextPanePair(x24_loadedFrame, "textpane_instructions"); + FindAndSetPairText(x24_loadedFrame, "textpane_nes", g_MainStringTable->GetString(66)); + FindAndSetPairText(x24_loadedFrame, "textpane_fusionsuit", g_MainStringTable->GetString(63)); + FindAndSetPairText(x24_loadedFrame, "textpane_fusionsuitno", g_MainStringTable->GetString(65)); + FindAndSetPairText(x24_loadedFrame, "textpane_fusionsuityes", g_MainStringTable->GetString(64)); + FindAndSetPairText(x24_loadedFrame, "textpane_title", g_MainStringTable->GetString(100)); + static_cast(x24_loadedFrame->FindWidget("textpane_proceed"))-> + TextSupport()->SetText(g_MainStringTable->GetString(85)); + static_cast(x24_loadedFrame->FindWidget("textpane_cancel"))-> + TextSupport()->SetText(g_MainStringTable->GetString(82)); + x2c_tablegroup_fusionsuit->SetIsActive(false); + x2c_tablegroup_fusionsuit->SetIsVisible(false); + x2c_tablegroup_fusionsuit->SetD1(false); + x2c_tablegroup_fusionsuit->SetUserSelection(g_GameState->SystemOptions().PlayerHasFusion()); + SetTableColors(x28_tablegroup_options); + SetTableColors(x2c_tablegroup_fusionsuit); + + x28_tablegroup_options->SetMenuAdvanceCallback( + std::bind(&SGBASupportFrame::DoOptionsAdvance, this, std::placeholders::_1)); + x28_tablegroup_options->SetMenuSelectionChangeCallback( + std::bind(&SGBASupportFrame::DoSelectionChange, this, std::placeholders::_1)); + x28_tablegroup_options->SetMenuCancelCallback( + std::bind(&SGBASupportFrame::DoOptionsCancel, this, std::placeholders::_1)); + x2c_tablegroup_fusionsuit->SetMenuSelectionChangeCallback( + std::bind(&SGBASupportFrame::DoSelectionChange, this, std::placeholders::_1)); } bool CFrontEndUI::SGBASupportFrame::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::SGBASupportFrame::SetTableColors(CGuiTableGroup* tbgp) const +{ + tbgp->SetColors(zeus::CColor::skWhite, + zeus::CColor{0.627450f, 0.627450f, 0.627450f, 0.784313f}); +} + +void CFrontEndUI::SGBASupportFrame::ProcessUserInput(const CFinalInput& input, CSaveUI* sui) +{ + +} + +void CFrontEndUI::SGBASupportFrame::DoOptionsCancel(const CGuiTableGroup* caller) +{ + +} + +void CFrontEndUI::SGBASupportFrame::DoSelectionChange(const CGuiTableGroup* caller) +{ + +} + +void CFrontEndUI::SGBASupportFrame::DoOptionsAdvance(const CGuiTableGroup* caller) { } @@ -201,13 +359,12 @@ void CFrontEndUI::SFrontEndFrame::FinishedLoading() if (proceed) proceed->TextSupport()->SetText(g_MainStringTable->GetString(85)); - /* These appear to be unused leftovers from the CGuiFrame scripting system */ x18_tablegroup_mainmenu->SetMenuAdvanceCallback( - std::bind(&SFrontEndFrame::DoMenuAdvance, this, std::placeholders::_1)); + std::bind(&SFrontEndFrame::DoAdvance, this, std::placeholders::_1)); x18_tablegroup_mainmenu->SetMenuSelectionChangeCallback( - std::bind(&SFrontEndFrame::DoMenuSelectionChange, this, std::placeholders::_1)); + std::bind(&SFrontEndFrame::DoSelectionChange, this, std::placeholders::_1)); x18_tablegroup_mainmenu->SetMenuCancelCallback( - std::bind(&SFrontEndFrame::DoMenuAdvance, this, std::placeholders::_1)); + std::bind(&SFrontEndFrame::DoCancel, this, std::placeholders::_1)); } bool CFrontEndUI::SFrontEndFrame::PumpLoad() @@ -229,11 +386,22 @@ bool CFrontEndUI::SFrontEndFrame::PumpLoad() return false; } -void CFrontEndUI::SFrontEndFrame::DoMenuSelectionChange(const CGuiTableGroup* caller) +void CFrontEndUI::SFrontEndFrame::ProcessUserInput(const CFinalInput& input) { + } -void CFrontEndUI::SFrontEndFrame::DoMenuAdvance(const CGuiTableGroup* caller) +void CFrontEndUI::SFrontEndFrame::DoCancel(const CGuiTableGroup* caller) +{ + +} + +void CFrontEndUI::SFrontEndFrame::DoSelectionChange(const CGuiTableGroup* caller) +{ + +} + +void CFrontEndUI::SFrontEndFrame::DoAdvance(const CGuiTableGroup* caller) { } diff --git a/Runtime/MP1/CFrontEndUI.hpp b/Runtime/MP1/CFrontEndUI.hpp index 3284a3e65..e3639a073 100644 --- a/Runtime/MP1/CFrontEndUI.hpp +++ b/Runtime/MP1/CFrontEndUI.hpp @@ -84,13 +84,30 @@ public: /* filename, world, playtime, date */ SGuiTextPair x4_textpanes[4]; + + u32 x28_ = 0; + float x2c_ = ComputeRandom(); + + static float ComputeRandom() + { + return rand() / float(RAND_MAX) * 30.f + 30.f; + } }; static SFileSelectOption FindFileSelectOption(CGuiFrame* frame, int idx); struct SNewFileSelectFrame { + enum class EPhase + { + Zero, + One, + Two + }; + u32 x0_rnd; CSaveUI* x4_saveUI; + u32 x8_ = 0; + EPhase xc_phase = EPhase::Zero; TLockedToken x10_frme; CGuiFrame* x1c_loadedFrame = nullptr; CGuiTableGroup* x20_tablegroup_fileselect = nullptr; @@ -107,16 +124,26 @@ public: SFileSelectOption x64_fileSelections[3]; zeus::CVector3f xf8_model_erase_position; float x104_rowPitch = 0.f; - float x108_ = 0.f; - bool x10c_ = false; - bool x10d_ = false; + float x108_curTime = 0.f; + bool x10c_inputEnable = false; + bool x10d_needsToggle = false; bool x10e_ = false; + SNewFileSelectFrame(CSaveUI* sui, u32 rnd); void FinishedLoading(); bool PumpLoad(); + bool IsTextDoneAnimating() const; + EPhase ProcessUserInput(const CFinalInput& input); - void DoMenuSelectionChange(const CGuiTableGroup* caller); - void DoMenuAdvance(const CGuiTableGroup* caller); + void HandleActiveChange(CGuiTableGroup* active); + void DeactivatePopup(); + void ActivatePopup(); + + void DoPopupCancel(const CGuiTableGroup* caller); + void DoPopupAdvance(const CGuiTableGroup* caller); + void DoFileselectCancel(const CGuiTableGroup* caller); + void DoSelectionChange(const CGuiTableGroup* caller); + void DoFileselectAdvance(const CGuiTableGroup* caller); }; struct SGBASupportFrame @@ -126,9 +153,9 @@ public: TLockedToken xc_gbaScreen; TLockedToken x18_gbaLink; CGuiFrame* x24_loadedFrame = nullptr; - CGuiWidget* x28_ = nullptr; - CGuiWidget* x2c_ = nullptr; - SGuiTextPair x30_; + CGuiTableGroup* x28_tablegroup_options = nullptr; + CGuiTableGroup* x2c_tablegroup_fusionsuit = nullptr; + SGuiTextPair x30_textpane_instructions; bool x38_ = false; bool x39_ = false; bool x3a_ = false; @@ -136,6 +163,12 @@ public: SGBASupportFrame(); void FinishedLoading(); bool PumpLoad(); + void SetTableColors(CGuiTableGroup* tbgp) const; + void ProcessUserInput(const CFinalInput& input, CSaveUI* sui); + + void DoOptionsCancel(const CGuiTableGroup* caller); + void DoSelectionChange(const CGuiTableGroup* caller); + void DoOptionsAdvance(const CGuiTableGroup* caller); }; struct SFrontEndFrame @@ -149,9 +182,11 @@ public: SFrontEndFrame(u32 rnd); void FinishedLoading(); bool PumpLoad(); + void ProcessUserInput(const CFinalInput& input); - void DoMenuSelectionChange(const CGuiTableGroup* caller); - void DoMenuAdvance(const CGuiTableGroup* caller); + void DoCancel(const CGuiTableGroup* caller); + void DoSelectionChange(const CGuiTableGroup* caller); + void DoAdvance(const CGuiTableGroup* caller); }; struct SFusionBonusFrame @@ -164,6 +199,7 @@ public: bool x15_ = true; SFusionBonusFrame(); + void ProcessUserInput(const CFinalInput& input, CSaveUI* sui); bool DoUpdateWithSaveUI(float dt, CSaveUI* saveUi); }; @@ -192,6 +228,7 @@ public: }; }; SOptionsFrontEndFrame(); + void ProcessUserInput(const CFinalInput& input, CSaveUI* sui); }; private: diff --git a/Runtime/MP1/CGBASupport.cpp b/Runtime/MP1/CGBASupport.cpp index a3d5b72b1..799d01c1a 100644 --- a/Runtime/MP1/CGBASupport.cpp +++ b/Runtime/MP1/CGBASupport.cpp @@ -22,5 +22,10 @@ CGBASupport::~CGBASupport() SharedInstance = nullptr; } +bool CGBASupport::IsReady() const +{ + return false; +} + } } diff --git a/Runtime/MP1/CGBASupport.hpp b/Runtime/MP1/CGBASupport.hpp index 2552f3592..a81f0e6e8 100644 --- a/Runtime/MP1/CGBASupport.hpp +++ b/Runtime/MP1/CGBASupport.hpp @@ -23,6 +23,7 @@ class CGBASupport : public CDvdFile public: CGBASupport(); ~CGBASupport(); + bool IsReady() const; }; }