CFrontEndUI work

This commit is contained in:
Jack Andersen 2017-01-08 17:44:00 -10:00
parent ef43c3319b
commit 4c09493a3f
19 changed files with 938 additions and 376 deletions

View File

@ -61,6 +61,22 @@ bool CSaveWorldIntermediate::InitializePump()
return false; return false;
} }
bool CMemoryCardSys::HasSaveWorldMemory(ResId wldId) const
{
auto existingSearch =
std::find_if(xc_memoryWorlds.cbegin(), xc_memoryWorlds.cend(), [&](const auto& wld)
{ return wld.first == wldId; });
return existingSearch != xc_memoryWorlds.cend();
}
const CSaveWorldMemory& CMemoryCardSys::GetSaveWorldMemory(ResId wldId) const
{
auto existingSearch =
std::find_if(xc_memoryWorlds.cbegin(), xc_memoryWorlds.cend(), [&](const auto& wld)
{ return wld.first == wldId; });
return existingSearch->second;
}
CMemoryCardSys::CMemoryCardSys() CMemoryCardSys::CMemoryCardSys()
{ {
g_CardImagePaths[0] = ResolveDolphinCardPath(kabufuda::ECardSlot::SlotA); g_CardImagePaths[0] = ResolveDolphinCardPath(kabufuda::ECardSlot::SlotA);
@ -74,10 +90,7 @@ CMemoryCardSys::CMemoryCardSys()
{ {
if (tag.type == FOURCC('MLVL')) if (tag.type == FOURCC('MLVL'))
{ {
auto existingSearch = if (!HasSaveWorldMemory(tag.id))
std::find_if(xc_memoryWorlds.cbegin(), xc_memoryWorlds.cend(), [&](const auto& wld)
{ return wld.first == tag.id; });
if (existingSearch == xc_memoryWorlds.cend())
{ {
xc_memoryWorlds.emplace_back(tag.id, CSaveWorldMemory{}); xc_memoryWorlds.emplace_back(tag.id, CSaveWorldMemory{});
x1c_worldInter->emplace_back(tag.id, -1); x1c_worldInter->emplace_back(tag.id, -1);

View File

@ -32,6 +32,12 @@ public:
const TLockedToken<CStringTable>& GetWorldName() const { return x2c_worldName; } const TLockedToken<CStringTable>& GetWorldName() const { return x2c_worldName; }
const TLockedToken<CSaveWorld>& GetSaveWorld() const { return x3c_saveWorld; } const TLockedToken<CSaveWorld>& GetSaveWorld() const { return x3c_saveWorld; }
std::wstring GetFrontEndName() const
{
if (!x2c_worldName)
return {};
return x2c_worldName->GetString(0);
}
}; };
class CSaveWorldIntermediate class CSaveWorldIntermediate
@ -83,6 +89,10 @@ public:
const std::vector<CGameHintInfo::CGameHint>& GetHints() const { return x0_hints->GetHints(); } const std::vector<CGameHintInfo::CGameHint>& GetHints() const { return x0_hints->GetHints(); }
const std::vector<std::pair<ResId, CSaveWorldMemory>>& GetMemoryWorlds() const { return xc_memoryWorlds; } const std::vector<std::pair<ResId, CSaveWorldMemory>>& GetMemoryWorlds() const { return xc_memoryWorlds; }
const std::vector<std::pair<ResId, CSaveWorld::EScanCategory>>& GetScanStates() const { return x20_scanStates; } const std::vector<std::pair<ResId, CSaveWorld::EScanCategory>>& GetScanStates() const { return x20_scanStates; }
bool HasSaveWorldMemory(ResId wldId) const;
const CSaveWorldMemory& GetSaveWorldMemory(ResId wldId) const;
CMemoryCardSys(); CMemoryCardSys();
bool InitializePump(); bool InitializePump();

View File

@ -156,6 +156,7 @@ public:
return false; return false;
return xc8_curFrame == x28_thpHead.numFrames; return xc8_curFrame == x28_thpHead.numFrames;
} }
bool IsLooping() const { return xf4_24_loop; }
bool GetIsFullyCached() const {return xa0_bufferQueue.size() >= xf0_preLoadFrames;} bool GetIsFullyCached() const {return xa0_bufferQueue.size() >= xf0_preLoadFrames;}
float GetPlayedSeconds() const {return xdc_frameRem + xe8_curSeconds;} float GetPlayedSeconds() const {return xdc_frameRem + xe8_curSeconds;}
float GetTotalSeconds() const {return xe4_totalSeconds;} float GetTotalSeconds() const {return xe4_totalSeconds;}

View File

@ -30,7 +30,7 @@ void CGuiCompoundWidget::OnActiveChange()
CGuiWidget::OnActiveChange(); CGuiWidget::OnActiveChange();
} }
CGuiWidget* CGuiCompoundWidget::GetWorkerWidget(int id) CGuiWidget* CGuiCompoundWidget::GetWorkerWidget(int id) const
{ {
CGuiWidget* child = static_cast<CGuiWidget*>(GetChildObject()); CGuiWidget* child = static_cast<CGuiWidget*>(GetChildObject());
while (child) while (child)

View File

@ -14,7 +14,7 @@ public:
void OnVisibleChange(); void OnVisibleChange();
void OnActiveChange(); void OnActiveChange();
virtual CGuiWidget* GetWorkerWidget(int id); virtual CGuiWidget* GetWorkerWidget(int id) const;
}; };
} }

View File

@ -37,9 +37,9 @@ public:
void MultiplyO2P(const zeus::CTransform& xf); void MultiplyO2P(const zeus::CTransform& xf);
void AddChildObject(CGuiObject* obj, bool makeWorldLocal, bool atEnd); void AddChildObject(CGuiObject* obj, bool makeWorldLocal, bool atEnd);
CGuiObject* RemoveChildObject(CGuiObject* obj, bool makeWorldLocal); CGuiObject* RemoveChildObject(CGuiObject* obj, bool makeWorldLocal);
CGuiObject* GetParent() {return x70_parent;} CGuiObject* GetParent() const {return x70_parent;}
CGuiObject* GetChildObject() {return x74_child;} CGuiObject* GetChildObject() const {return x74_child;}
CGuiObject* GetNextSibling() {return x78_nextSibling;} CGuiObject* GetNextSibling() const {return x78_nextSibling;}
void RecalculateTransforms(); void RecalculateTransforms();
void Reorthogonalize(); void Reorthogonalize();
void SetO2WTransform(const zeus::CTransform& xf); void SetO2WTransform(const zeus::CTransform& xf);

View File

@ -1,8 +1,38 @@
#include "CGuiTableGroup.hpp" #include "CGuiTableGroup.hpp"
#include "Input/CFinalInput.hpp"
namespace urde namespace urde
{ {
bool CGuiTableGroup::CRepeatState::Update(float dt, bool state)
{
if (x0_timer == 0.f)
{
if (state)
{
x0_timer = 0.6f;
return true;
}
}
else
{
if (state)
{
x0_timer -= dt;
if (x0_timer <= 0.f)
{
x0_timer = 0.05f;
return true;
}
}
else
{
x0_timer = 0.f;
}
}
return false;
}
CGuiTableGroup::CGuiTableGroup(const CGuiWidgetParms& parms, int elementCount, CGuiTableGroup::CGuiTableGroup(const CGuiWidgetParms& parms, int elementCount,
int defaultSel, bool selectWraparound) int defaultSel, bool selectWraparound)
: CGuiCompoundWidget(parms), : CGuiCompoundWidget(parms),
@ -11,6 +41,205 @@ CGuiTableGroup::CGuiTableGroup(const CGuiWidgetParms& parms, int elementCount,
xd0_selectWraparound(selectWraparound) xd0_selectWraparound(selectWraparound)
{} {}
void CGuiTableGroup::ProcessUserInput(const CFinalInput& input)
{
if (input.PA())
{
DoAdvance();
}
else if (input.PB())
{
DoCancel();
}
else
{
bool decrement;
if (xd1_vertical)
decrement = (input.DLAUp() || input.DDPUp());
else
decrement = (input.DLALeft() || input.DDPLeft());
bool increment;
if (xd1_vertical)
increment = (input.DLADown() || input.DDPDown());
else
increment = (input.DLARight() || input.DDPRight());
if (xb8_decRepeat.Update(input.DeltaTime(), decrement) && decrement)
{
DoDecrement();
return;
}
if (xbc_incRepeat.Update(input.DeltaTime(), increment) && increment)
{
DoIncrement();
return;
}
}
}
bool CGuiTableGroup::IsWorkerSelectable(int idx) const
{
CGuiWidget* widget = GetWorkerWidget(idx);
if (widget)
return widget->GetIsSelectable();
return false;
}
void CGuiTableGroup::SelectWorker(int idx)
{
idx = zeus::clamp(0, idx, xc0_elementCount - 1);
if (idx < xc4_userSelection)
{
while (idx != xc4_userSelection)
DoSelectPrevRow();
}
else
{
while (idx != xc4_userSelection)
DoSelectNextRow();
}
}
void CGuiTableGroup::DeactivateWorker(CGuiWidget* widget)
{
widget->SetIsActive(false);
}
void CGuiTableGroup::ActivateWorker(CGuiWidget* widget)
{
widget->SetIsActive(true);
}
CGuiTableGroup::TableSelectReturn CGuiTableGroup::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;
}
CGuiTableGroup::TableSelectReturn CGuiTableGroup::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;
}
void CGuiTableGroup::DoSelectPrevRow()
{
DecrementSelectedRow();
DeactivateWorker(GetWorkerWidget(xc8_prevUserSelection));
ActivateWorker(GetWorkerWidget(xc4_userSelection));
}
void CGuiTableGroup::DoSelectNextRow()
{
IncrementSelectedRow();
DeactivateWorker(GetWorkerWidget(xc8_prevUserSelection));
ActivateWorker(GetWorkerWidget(xc4_userSelection));
}
void CGuiTableGroup::DoCancel()
{
if (xec_doMenuCancel)
xec_doMenuCancel(this);
}
void CGuiTableGroup::DoAdvance()
{
if (xd4_doMenuAdvance)
xd4_doMenuAdvance(this);
}
bool CGuiTableGroup::PreDecrement()
{
if (xd0_selectWraparound)
{
for (int sel = (xc4_userSelection + xc0_elementCount - 1) % xc0_elementCount;
sel != xc4_userSelection;
sel = (sel + xc0_elementCount - 1) % xc0_elementCount)
{
if (IsWorkerSelectable(sel))
{
SelectWorker(sel);
return true;
}
}
}
else
{
for (int sel = std::max(-1, xc4_userSelection - 1) ; sel >= 0 ; --sel)
{
if (IsWorkerSelectable(sel))
{
SelectWorker(sel);
return true;
}
}
}
return false;
}
void CGuiTableGroup::DoDecrement()
{
if (!PreDecrement())
return;
if (x104_doMenuSelChange)
x104_doMenuSelChange(this, xc4_userSelection);
}
bool CGuiTableGroup::PreIncrement()
{
if (xd0_selectWraparound)
{
for (int sel = (xc4_userSelection + 1) % xc0_elementCount;
sel != xc4_userSelection;
sel = (sel + 1) % xc0_elementCount)
{
if (IsWorkerSelectable(sel))
{
SelectWorker(sel);
return true;
}
}
}
else
{
for (int sel = std::min(xc0_elementCount, xc4_userSelection + 1) ; sel < xc0_elementCount ; ++sel)
{
if (IsWorkerSelectable(sel))
{
SelectWorker(sel);
return true;
}
}
}
return false;
}
void CGuiTableGroup::DoIncrement()
{
if (!PreIncrement())
return;
if (x104_doMenuSelChange)
x104_doMenuSelChange(this, xc4_userSelection);
}
CGuiTableGroup* CGuiTableGroup::Create(CGuiFrame* frame, CInputStream& in, bool flag) CGuiTableGroup* CGuiTableGroup::Create(CGuiFrame* frame, CInputStream& in, bool flag)
{ {
CGuiWidgetParms parms = ReadWidgetHeader(frame, in, flag); CGuiWidgetParms parms = ReadWidgetHeader(frame, in, flag);

View File

@ -9,10 +9,13 @@ namespace urde
class CGuiTableGroup : public CGuiCompoundWidget class CGuiTableGroup : public CGuiCompoundWidget
{ {
public: public:
struct SomeState class CRepeatState
{ {
float x0_ = 0.f; float x0_timer = 0.f;
public:
bool Update(float dt, bool state);
}; };
enum class TableSelectReturn enum class TableSelectReturn
{ {
Changed, Changed,
@ -21,17 +24,34 @@ public:
}; };
private: private:
SomeState xb8_; CRepeatState xb8_decRepeat;
SomeState xbc_; CRepeatState xbc_incRepeat;
int xc0_elementCount; int xc0_elementCount;
int xc4_userSelection; int xc4_userSelection;
int xc8_prevUserSelection; int xc8_prevUserSelection;
int xcc_defaultUserSelection; int xcc_defaultUserSelection;
bool xd0_selectWraparound; bool xd0_selectWraparound;
bool xd1_ = true; bool xd1_vertical = true;
std::function<void(CGuiTableGroup*)> xd4_doMenuAdvance; std::function<void(CGuiTableGroup*)> xd4_doMenuAdvance;
std::function<void(CGuiTableGroup*)> xec_doMenuCancel; std::function<void(CGuiTableGroup*)> xec_doMenuCancel;
std::function<void(CGuiTableGroup*)> x104_doMenuSelChange; std::function<void(CGuiTableGroup*, int)> x104_doMenuSelChange;
bool IsWorkerSelectable(int) const;
void SelectWorker(int);
void DeactivateWorker(CGuiWidget* widget);
void ActivateWorker(CGuiWidget* widget);
TableSelectReturn DecrementSelectedRow();
TableSelectReturn IncrementSelectedRow();
void DoSelectPrevRow();
void DoSelectNextRow();
void DoCancel();
void DoAdvance();
bool PreDecrement();
void DoDecrement();
bool PreIncrement();
void DoIncrement();
public: public:
CGuiTableGroup(const CGuiWidgetParms& parms, int, int, bool); CGuiTableGroup(const CGuiWidgetParms& parms, int, int, bool);
@ -47,7 +67,7 @@ public:
xec_doMenuCancel = std::move(cb); xec_doMenuCancel = std::move(cb);
} }
void SetMenuSelectionChangeCallback(std::function<void(CGuiTableGroup*)>&& cb) void SetMenuSelectionChangeCallback(std::function<void(CGuiTableGroup*, int)>&& cb)
{ {
x104_doMenuSelChange = std::move(cb); x104_doMenuSelChange = std::move(cb);
} }
@ -64,7 +84,7 @@ public:
} }
} }
void SetD1(bool v) { xd1_ = v; } void SetVertical(bool v) { xd1_vertical = v; }
void SetUserSelection(int sel) void SetUserSelection(int sel)
{ {
@ -72,32 +92,10 @@ public:
xc4_userSelection = sel; 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; } int GetUserSelection() const { return xc4_userSelection; }
void ProcessUserInput(const CFinalInput& input);
static CGuiTableGroup* Create(CGuiFrame* frame, CInputStream& in, bool); static CGuiTableGroup* Create(CGuiFrame* frame, CInputStream& in, bool);
}; };

View File

@ -54,6 +54,14 @@ float CGuiTextSupport::GetCurrentAnimationOverAge() const
return ret; return ret;
} }
float CGuiTextSupport::GetNumCharsTotal() const
{
if (CTextRenderBuffer* buf = GetCurrentPageRenderBuffer())
if (x50_typeEnable)
return buf->GetPrimitiveCount();
return 0.f;
}
float CGuiTextSupport::GetNumCharsPrinted() const float CGuiTextSupport::GetNumCharsPrinted() const
{ {
if (CTextRenderBuffer* buf = GetCurrentPageRenderBuffer()) if (CTextRenderBuffer* buf = GetCurrentPageRenderBuffer())

View File

@ -109,6 +109,7 @@ public:
const zeus::CColor& fontCol, const zeus::CColor& outlineCol, const zeus::CColor& fontCol, const zeus::CColor& outlineCol,
const zeus::CColor& geomCol, s32 extX, s32 extY, CSimplePool* store); const zeus::CColor& geomCol, s32 extX, s32 extY, CSimplePool* store);
float GetCurrentAnimationOverAge() const; float GetCurrentAnimationOverAge() const;
float GetNumCharsTotal() const;
float GetNumCharsPrinted() const; float GetNumCharsPrinted() const;
float GetTotalAnimationTime() const; float GetTotalAnimationTime() const;
bool IsAnimationDone() const; bool IsAnimationDone() const;

View File

@ -11,7 +11,7 @@ CGuiWidget::CGuiWidget(const CGuiWidgetParms& parms)
xac_drawFlags(parms.x14_drawFlags), xb0_frame(parms.x0_frame), xac_drawFlags(parms.x14_drawFlags), xb0_frame(parms.x0_frame),
xb6_24_pg(parms.xd_g), xb6_25_isVisible(parms.xa_defaultVisible), xb6_24_pg(parms.xd_g), xb6_25_isVisible(parms.xa_defaultVisible),
xb6_26_isActive(parms.xb_defaultActive), xb6_26_isActive(parms.xb_defaultActive),
xb6_27_(true), xb6_28_eventLock(false), xb6_27_isSelectable(true), xb6_28_eventLock(false),
xb6_29_cullFaces(parms.xc_cullFaces), xb6_30_(false), xb6_29_cullFaces(parms.xc_cullFaces), xb6_30_(false),
xb6_31_depthTest(true), xb7_24_depthWrite(false), xb7_25_(true) xb6_31_depthTest(true), xb7_24_depthWrite(false), xb7_25_(true)
{ {

View File

@ -79,7 +79,7 @@ protected:
bool xb6_24_pg : 1; bool xb6_24_pg : 1;
bool xb6_25_isVisible : 1; bool xb6_25_isVisible : 1;
bool xb6_26_isActive : 1; bool xb6_26_isActive : 1;
bool xb6_27_ : 1; bool xb6_27_isSelectable : 1;
bool xb6_28_eventLock : 1; bool xb6_28_eventLock : 1;
bool xb6_29_cullFaces : 1; bool xb6_29_cullFaces : 1;
bool xb6_30_ : 1; bool xb6_30_ : 1;
@ -116,8 +116,8 @@ public:
void ReapplyXform(); void ReapplyXform();
void SetIsVisible(bool); void SetIsVisible(bool);
void SetIsActive(bool); void SetIsActive(bool);
bool GetIsSelectable() const { return xb6_27_isSelectable; }
void SetB627(bool v) { xb6_27_ = v; } void SetIsSelectable(bool v) { xb6_27_isSelectable = v; }
void ParseBaseInfo(CGuiFrame* frame, CInputStream& in, const CGuiWidgetParms& parms); void ParseBaseInfo(CGuiFrame* frame, CInputStream& in, const CGuiWidgetParms& parms);
void AddChildWidget(CGuiWidget* widget, bool makeWorldLocal, bool atEnd); void AddChildWidget(CGuiWidget* widget, bool makeWorldLocal, bool atEnd);

File diff suppressed because it is too large Load Diff

View File

@ -41,23 +41,22 @@ class CFrontEndUI : public CIOWin
public: public:
enum class EPhase enum class EPhase
{ {
Zero, LoadDepsGroup,
One, LoadDeps,
Two, LoadFrames,
Three, LoadMovies,
Four, DisplayFrontEnd,
Five, ToPlayGame,
Six ExitFrontEnd
}; };
enum class EScreen enum class EScreen
{ {
Zero, OpenCredits,
One, Title,
Two, AttractMovie,
Three, FileSelect,
Four, FusionBonus,
Five, ToPlayGame
Six
}; };
enum class EMenuMovie enum class EMenuMovie
{ {
@ -90,8 +89,8 @@ public:
/* filename, world, playtime, date */ /* filename, world, playtime, date */
SGuiTextPair x4_textpanes[4]; SGuiTextPair x4_textpanes[4];
u32 x28_ = 0; u32 x28_curField = 0;
float x2c_ = ComputeRandom(); float x2c_chRate = ComputeRandom();
static float ComputeRandom() static float ComputeRandom()
{ {
@ -103,24 +102,24 @@ public:
{ {
enum class ESubMenu enum class ESubMenu
{ {
Zero, Root,
One, EraseGame,
Two, ExistingGamePopup,
Three NewGamePopup
}; };
enum class EAction enum class EAction
{ {
Zero, None,
One, GameOptions,
Two, FusionBonus,
Three SlideShow
}; };
u32 x0_rnd; u32 x0_rnd;
CSaveUI* x4_saveUI; CSaveUI* x4_saveUI;
ESubMenu x8_subMenu = ESubMenu::Zero; ESubMenu x8_subMenu = ESubMenu::Root;
EAction xc_action = EAction::Zero; EAction xc_action = EAction::None;
TLockedToken<CGuiFrame> x10_frme; TLockedToken<CGuiFrame> x10_frme;
CGuiFrame* x1c_loadedFrame = nullptr; CGuiFrame* x1c_loadedFrame = nullptr;
CGuiTableGroup* x20_tablegroup_fileselect = nullptr; CGuiTableGroup* x20_tablegroup_fileselect = nullptr;
@ -146,6 +145,7 @@ public:
void FinishedLoading(); void FinishedLoading();
bool PumpLoad(); bool PumpLoad();
bool IsTextDoneAnimating() const; bool IsTextDoneAnimating() const;
void Update(float dt);
EAction ProcessUserInput(const CFinalInput& input); EAction ProcessUserInput(const CFinalInput& input);
void Draw() const; void Draw() const;
@ -156,20 +156,21 @@ public:
void ActivateNewGamePopup(); void ActivateNewGamePopup();
void ResetFrame(); void ResetFrame();
void ActivateErase();
void ClearFrameContents(); void ClearFrameContents();
void SetupFrameContents(); void SetupFrameContents();
void DoPopupCancel(CGuiTableGroup* caller); void DoPopupCancel(CGuiTableGroup* caller);
void DoPopupAdvance(CGuiTableGroup* caller); void DoPopupAdvance(CGuiTableGroup* caller);
void DoFileMenuCancel(CGuiTableGroup* caller); void DoFileMenuCancel(CGuiTableGroup* caller);
void DoSelectionChange(CGuiTableGroup* caller); void DoSelectionChange(CGuiTableGroup* caller, int userSel);
void DoFileMenuAdvance(CGuiTableGroup* caller); void DoFileMenuAdvance(CGuiTableGroup* caller);
static SFileMenuOption FindFileSelectOption(CGuiFrame* frame, int idx); static SFileMenuOption FindFileSelectOption(CGuiFrame* frame, int idx);
static void StartTextAnimating(CGuiTextPane* text, const std::wstring& str, float chRate); static void StartTextAnimating(CGuiTextPane* text, const std::wstring& str, float chRate);
}; };
struct SGBASupportFrame struct SFusionBonusFrame
{ {
struct SGBALinkFrame struct SGBALinkFrame
{ {
@ -240,7 +241,7 @@ public:
bool x39_fusionNotComplete = false; bool x39_fusionNotComplete = false;
bool x3a_mpNotComplete = false; bool x3a_mpNotComplete = false;
SGBASupportFrame(); SFusionBonusFrame();
void FinishedLoading(); void FinishedLoading();
bool PumpLoad(); bool PumpLoad();
void SetTableColors(CGuiTableGroup* tbgp) const; void SetTableColors(CGuiTableGroup* tbgp) const;
@ -255,7 +256,7 @@ public:
} }
void DoCancel(CGuiTableGroup* caller); void DoCancel(CGuiTableGroup* caller);
void DoSelectionChange(CGuiTableGroup* caller); void DoSelectionChange(CGuiTableGroup* caller, int userSel);
void DoAdvance(CGuiTableGroup* caller); void DoAdvance(CGuiTableGroup* caller);
}; };
@ -263,11 +264,11 @@ public:
{ {
enum class EAction enum class EAction
{ {
Zero, None,
One, StartGame,
Two, FusionBonus,
Three, GameOptions,
Four SlideShow
}; };
u32 x0_rnd; u32 x0_rnd;
@ -280,11 +281,12 @@ public:
SFrontEndFrame(u32 rnd); SFrontEndFrame(u32 rnd);
void FinishedLoading(); void FinishedLoading();
bool PumpLoad(); bool PumpLoad();
void Update(float dt);
EAction ProcessUserInput(const CFinalInput& input); EAction ProcessUserInput(const CFinalInput& input);
void Draw() const; void Draw() const;
void DoCancel(CGuiTableGroup* caller); void DoCancel(CGuiTableGroup* caller);
void DoSelectionChange(CGuiTableGroup* caller); void DoSelectionChange(CGuiTableGroup* caller, int userSel);
void DoAdvance(CGuiTableGroup* caller); void DoAdvance(CGuiTableGroup* caller);
}; };
@ -339,31 +341,32 @@ public:
}; };
SOptionsFrontEndFrame(); SOptionsFrontEndFrame();
bool ProcessUserInput(const CFinalInput& input, CSaveUI* sui); bool ProcessUserInput(const CFinalInput& input, CSaveUI* sui);
void Update(float dt, CSaveUI* saveUi);
void Draw() const; void Draw() const;
}; };
bool IsSaveUIConditional() const bool CanShowSaveUI() const
{ {
if (x50_curScreen != EScreen::Three && x50_curScreen != EScreen::Four) if (x50_curScreen != EScreen::FileSelect && x50_curScreen != EScreen::FusionBonus)
return false; return false;
if (x54_nextScreen != EScreen::Three && x54_nextScreen != EScreen::Four) if (x54_nextScreen != EScreen::FileSelect && x54_nextScreen != EScreen::FusionBonus)
return false; return false;
return true; return true;
} }
private: private:
EPhase x14_phase = EPhase::Zero; EPhase x14_phase = EPhase::LoadDepsGroup;
u32 x18_rndA; u32 x18_rndA;
u32 x1c_rndB; u32 x1c_rndB;
TLockedToken<CDependencyGroup> x20_depsGroup; TLockedToken<CDependencyGroup> x20_depsGroup;
std::vector<CToken> x2c_deps; std::vector<CToken> x2c_deps;
TLockedToken<CTexture> x38_pressStart; TLockedToken<CTexture> x38_pressStart;
TLockedToken<CAudioGroupSet> x44_frontendAudioGrp; TLockedToken<CAudioGroupSet> x44_frontendAudioGrp;
EScreen x50_curScreen = EScreen::Zero; EScreen x50_curScreen = EScreen::OpenCredits;
EScreen x54_nextScreen = EScreen::Zero; EScreen x54_nextScreen = EScreen::OpenCredits;
float x58_movieSeconds = 0.f; float x58_fadeBlackTimer = 0.f;
bool x5c_movieSecondsNeeded = false; bool x5c_fadeBlackWithMovie = false;
float x60_ = 0.f; float x60_pressStartTime = 0.f;
float x64_pressStartAlpha = 0.f; float x64_pressStartAlpha = 0.f;
float x68_musicVol = 1.f; float x68_musicVol = 1.f;
u32 x6c_; u32 x6c_;
@ -373,15 +376,15 @@ private:
int xc0_attractCount = 0; int xc0_attractCount = 0;
std::unique_ptr<CMoviePlayer> xc4_attractMovie; std::unique_ptr<CMoviePlayer> xc4_attractMovie;
CMoviePlayer* xcc_curMoviePtr = nullptr; CMoviePlayer* xcc_curMoviePtr = nullptr;
bool xd0_ = false; bool xd0_playerSkipToTitle = false;
bool xd1_moviesLoaded = false; bool xd1_moviesLoaded = false;
bool xd2_ = false; bool xd2_deferSlideShow = false;
std::unique_ptr<CStaticAudioPlayer> xd4_audio1; std::unique_ptr<CStaticAudioPlayer> xd4_audio1;
std::unique_ptr<CStaticAudioPlayer> xd8_audio2; std::unique_ptr<CStaticAudioPlayer> xd8_audio2;
std::unique_ptr<CSaveUI> xdc_saveUI; std::unique_ptr<CSaveUI> xdc_saveUI;
std::unique_ptr<SNewFileSelectFrame> xe0_newFileSel; std::unique_ptr<SNewFileSelectFrame> xe0_frontendCardFrme;
std::unique_ptr<SGBASupportFrame> xe4_gbaSupportFrme; std::unique_ptr<SFusionBonusFrame> xe4_fusionBonusFrme;
std::unique_ptr<SFrontEndFrame> xe8_frontendFrme; std::unique_ptr<SFrontEndFrame> xe8_frontendNoCardFrme;
std::unique_ptr<SNesEmulatorFrame> xec_emuFrme; std::unique_ptr<SNesEmulatorFrame> xec_emuFrme;
std::unique_ptr<SOptionsFrontEndFrame> xf0_optionsFrme; std::unique_ptr<SOptionsFrontEndFrame> xf0_optionsFrme;
CStaticAudioPlayer* xf4_curAudio = nullptr; CStaticAudioPlayer* xf4_curAudio = nullptr;
@ -389,46 +392,33 @@ private:
CColoredQuadFilter m_fadeToBlack = {CCameraFilterPass::EFilterType::Blend}; CColoredQuadFilter m_fadeToBlack = {CCameraFilterPass::EFilterType::Blend};
std::experimental::optional<CTexturedQuadFilterAlpha> m_pressStartQuad; std::experimental::optional<CTexturedQuadFilterAlpha> m_pressStartQuad;
void SetMovieSecondsDeferred() void SetFadeBlackWithMovie()
{ {
x58_movieSeconds = 1000000.f; x58_fadeBlackTimer = 1000000.f;
x5c_movieSecondsNeeded = true; x5c_fadeBlackWithMovie = true;
} }
void SetMovieSeconds(float seconds) void SetFadeBlackTimer(float seconds)
{ {
x58_movieSeconds = seconds; x58_fadeBlackTimer = seconds;
x5c_movieSecondsNeeded = false; x5c_fadeBlackWithMovie = false;
} }
void TransitionToFive(); void TransitionToGame();
void UpdateMusicVolume(); void UpdateMusicVolume();
void FinishedLoadingDepsGroup(); void FinishedLoadingDepsGroup();
bool PumpLoad(); bool PumpLoad();
public: public:
CFrontEndUI(CArchitectureQueue& queue); CFrontEndUI(CArchitectureQueue& queue);
void OnSliderSelectionChange(CGuiSliderGroup* grp, float);
void OnCheckBoxSelectionChange(CGuiTableGroup* grp);
void OnOptionSubMenuCancel(CGuiTableGroup* grp);
void OnOptionsMenuCancel(CGuiTableGroup* grp);
void OnNewGameMenuCancel(CGuiTableGroup* grp);
void OnFileMenuCancel(CGuiTableGroup* grp);
void OnGenericMenuSelectionChange(CGuiTableGroup* grp, int, int);
void OnOptionsMenuAdvance(CGuiTableGroup* grp);
void OnNewGameMenuAdvance(CGuiTableGroup* grp);
void OnFileMenuAdvance(CGuiTableGroup* grp);
void OnMainMenuAdvance(CGuiTableGroup* grp);
void StartSlideShow(CArchitectureQueue& queue); void StartSlideShow(CArchitectureQueue& queue);
std::string GetAttractMovieFileName(int idx); std::string GetAttractMovieFileName(int idx);
std::string GetNextAttractMovieFileName(); std::string GetNextAttractMovieFileName();
void SetCurrentMovie(EMenuMovie movie); void SetCurrentMovie(EMenuMovie movie);
void StopAttractMovie(); void StopAttractMovie();
void StartAttractMovie(); void StartAttractMovie();
void UpdateMenuHighlights(CGuiTableGroup* grp);
void CompleteStateTransition();
bool CanBuild(const SObjectTag& tag);
void StartStateTransition(EScreen screen); void StartStateTransition(EScreen screen);
void CompleteStateTransition();
void HandleDebugMenuReturnValue(CGameDebug::EReturnValue val, CArchitectureQueue& queue); void HandleDebugMenuReturnValue(CGameDebug::EReturnValue val, CArchitectureQueue& queue);
void Draw() const; void Draw() const;
void UpdateMovies(float dt); void UpdateMovies(float dt);
@ -436,8 +426,6 @@ public:
void ProcessUserInput(const CFinalInput& input, CArchitectureQueue& queue); void ProcessUserInput(const CFinalInput& input, CArchitectureQueue& queue);
EMessageReturn Update(float dt, CArchitectureQueue& queue); EMessageReturn Update(float dt, CArchitectureQueue& queue);
EMessageReturn OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue); EMessageReturn OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue);
void StartGame();
void InitializeFrame();
}; };
} }

View File

@ -44,7 +44,7 @@ void CQuitScreen::FinishedLoading()
x14_tablegroup_quitgame->SetMenuAdvanceCallback( x14_tablegroup_quitgame->SetMenuAdvanceCallback(
std::bind(&CQuitScreen::DoAdvance, this, std::placeholders::_1)); std::bind(&CQuitScreen::DoAdvance, this, std::placeholders::_1));
x14_tablegroup_quitgame->SetMenuSelectionChangeCallback( x14_tablegroup_quitgame->SetMenuSelectionChangeCallback(
std::bind(&CQuitScreen::DoSelectionChange, this, std::placeholders::_1)); std::bind(&CQuitScreen::DoSelectionChange, this, std::placeholders::_1, std::placeholders::_2));
static_cast<CGuiTextPane*>(x10_loadedFrame->FindWidget("textpane_title"))->TextSupport()-> static_cast<CGuiTextPane*>(x10_loadedFrame->FindWidget("textpane_title"))->TextSupport()->
SetText(g_MainStringTable->GetString(Titles[int(x0_type)])); SetText(g_MainStringTable->GetString(Titles[int(x0_type)]));
@ -58,7 +58,7 @@ void CQuitScreen::FinishedLoading()
SetColors(); SetColors();
} }
void CQuitScreen::DoSelectionChange(CGuiTableGroup* caller) void CQuitScreen::DoSelectionChange(CGuiTableGroup* caller, int userSel)
{ {
SetColors(); SetColors();
CSfxManager::SfxStart(1424, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId); CSfxManager::SfxStart(1424, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);

View File

@ -42,7 +42,7 @@ class CQuitScreen
void SetColors(); void SetColors();
public: public:
void FinishedLoading(); void FinishedLoading();
void DoSelectionChange(CGuiTableGroup* caller); void DoSelectionChange(CGuiTableGroup* caller, int userSel);
void DoAdvance(CGuiTableGroup* caller); void DoAdvance(CGuiTableGroup* caller);
EQuitAction Update(float dt); EQuitAction Update(float dt);
void Draw(); void Draw();

View File

@ -125,7 +125,7 @@ bool CSaveUI::PumpLoad()
x58_tablegroup_choices->SetMenuAdvanceCallback( x58_tablegroup_choices->SetMenuAdvanceCallback(
std::bind(&CSaveUI::DoAdvance, this, std::placeholders::_1)); std::bind(&CSaveUI::DoAdvance, this, std::placeholders::_1));
x58_tablegroup_choices->SetMenuSelectionChangeCallback( x58_tablegroup_choices->SetMenuSelectionChangeCallback(
std::bind(&CSaveUI::DoSelectionChange, this, std::placeholders::_1)); std::bind(&CSaveUI::DoSelectionChange, this, std::placeholders::_1, std::placeholders::_2));
if (x0_saveCtx == ESaveContext::InGame) if (x0_saveCtx == ESaveContext::InGame)
x6c_cardDriver->StartCardProbe(); x6c_cardDriver->StartCardProbe();
@ -160,7 +160,7 @@ CSaveUI::EUIType CSaveUI::SelectUIType() const
{ {
if (x6c_cardDriver->x14_error == CMemoryCardDriver::EError::CardStillFull) if (x6c_cardDriver->x14_error == CMemoryCardDriver::EError::CardStillFull)
return EUIType::StillInsufficientSpace; return EUIType::StillInsufficientSpace;
return EUIType::SaveProgress; return EUIType::SaveReady;
} }
if (x6c_cardDriver->x14_error == CMemoryCardDriver::EError::CardBroken) if (x6c_cardDriver->x14_error == CMemoryCardDriver::EError::CardBroken)
@ -293,7 +293,7 @@ void CSaveUI::SetUIText()
opt0 = 16; // Continue opt0 = 16; // Continue
opt1 = 21; // Cancel opt1 = 21; // Cancel
break; break;
case EUIType::SaveProgress: case EUIType::SaveReady:
if (x0_saveCtx == ESaveContext::InGame) if (x0_saveCtx == ESaveContext::InGame)
{ {
msgB = 8; // Save progress? msgB = 8; // Save progress?
@ -330,10 +330,10 @@ void CSaveUI::SetUIText()
std::wstring opt3Str; std::wstring opt3Str;
x68_textpane_choice3->TextSupport()->SetText(opt3Str); x68_textpane_choice3->TextSupport()->SetText(opt3Str);
x5c_textpane_choice0->SetB627(opt0 != -1); x5c_textpane_choice0->SetIsSelectable(opt0 != -1);
x60_textpane_choice1->SetB627(opt1 != -1); x60_textpane_choice1->SetIsSelectable(opt1 != -1);
x64_textpane_choice2->SetB627(opt2 != -1); x64_textpane_choice2->SetIsSelectable(opt2 != -1);
x68_textpane_choice3->SetB627(false); x68_textpane_choice3->SetIsSelectable(false);
x58_tablegroup_choices->SetIsActive(opt0 != -1 || opt1 != -1 || opt2 != -1); x58_tablegroup_choices->SetIsActive(opt0 != -1 || opt1 != -1 || opt2 != -1);
SetUIColors(); SetUIColors();
@ -567,7 +567,7 @@ void CSaveUI::DoAdvance(CGuiTableGroup* caller)
} }
break; break;
case EUIType::SaveProgress: case EUIType::SaveReady:
if (x0_saveCtx == ESaveContext::InGame) if (x0_saveCtx == ESaveContext::InGame)
{ {
if (userSel == 0) if (userSel == 0)
@ -592,7 +592,7 @@ void CSaveUI::DoAdvance(CGuiTableGroup* caller)
CSfxManager::SfxStart(sfx, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId); CSfxManager::SfxStart(sfx, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);
} }
void CSaveUI::DoSelectionChange(CGuiTableGroup* caller) void CSaveUI::DoSelectionChange(CGuiTableGroup* caller, int userSel)
{ {
SetUIColors(); SetUIColors();
CSfxManager::SfxStart(x88_navMoveSfx, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId); CSfxManager::SfxStart(x88_navMoveSfx, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId);

View File

@ -46,14 +46,14 @@ public:
ProgressWillBeLost = 13, ProgressWillBeLost = 13,
NotOriginalCard = 14, NotOriginalCard = 14,
AllDataWillBeLost = 15, AllDataWillBeLost = 15,
SaveProgress = 16 SaveReady = 16
}; };
bool IsDrawConditional() bool IsHiddenFromFrontEnd()
{ {
switch (x10_uiType) switch (x10_uiType)
{ {
case EUIType::SaveProgress: case EUIType::SaveReady:
case EUIType::Empty: case EUIType::Empty:
case EUIType::BusyReading: case EUIType::BusyReading:
case EUIType::BusyWriting: case EUIType::BusyWriting:
@ -90,11 +90,11 @@ private:
bool x92_savingDisabled = false; bool x92_savingDisabled = false;
bool x93_inGame; bool x93_inGame;
void ResetCardDriver();
void ContinueWithoutSaving(); void ContinueWithoutSaving();
public: public:
static std::unique_ptr<CMemoryCardDriver> ConstructCardDriver(bool inGame); static std::unique_ptr<CMemoryCardDriver> ConstructCardDriver(bool inGame);
void ResetCardDriver();
CIOWin::EMessageReturn Update(float dt); CIOWin::EMessageReturn Update(float dt);
void SetInGame(bool v) { x93_inGame = v; } void SetInGame(bool v) { x93_inGame = v; }
bool PumpLoad(); bool PumpLoad();
@ -104,7 +104,7 @@ public:
void Draw() const; void Draw() const;
void DoAdvance(CGuiTableGroup* caller); void DoAdvance(CGuiTableGroup* caller);
void DoSelectionChange(CGuiTableGroup* caller); void DoSelectionChange(CGuiTableGroup* caller, int userSel);
void ProcessUserInput(const CFinalInput& input); void ProcessUserInput(const CFinalInput& input);
void StartGame(int idx); void StartGame(int idx);

View File

@ -261,7 +261,7 @@ public:
EGameplayResult GetGameplayResult() const { return xe4_gameplayResult; } EGameplayResult GetGameplayResult() const { return xe4_gameplayResult; }
void SetGameplayResult(EGameplayResult wl) { xe4_gameplayResult = wl; } void SetGameplayResult(EGameplayResult wl) { xe4_gameplayResult = wl; }
void SetManageCard(bool v) { x160_28_manageCard = v; } void SetManageCard(bool v) { x160_28_manageCard = v; }
bool GetBardBusy() const { return x160_31_cardBusy; } bool GetCardBusy() const { return x160_31_cardBusy; }
void SetCardBusy(bool v) { x160_31_cardBusy = v; } void SetCardBusy(bool v) { x160_31_cardBusy = v; }
EFlowState GetFlowState() const { return x12c_flowState; } EFlowState GetFlowState() const { return x12c_flowState; }