CMainFlow improvements

This commit is contained in:
Luke Street 2022-12-07 00:52:23 -05:00
parent 67f01bc9cd
commit 58ea53f21d
4 changed files with 49 additions and 21 deletions

View File

@ -8,7 +8,9 @@ public:
CFrontEndUI();
EMessageReturn OnMessage(const CArchitectureMessage& message, CArchitectureQueue& queue);
private:
uchar pad[0xe4];
};
#endif // _CFRONTENDUI

View File

@ -30,4 +30,16 @@ private:
rstl::string x4_name;
};
#define kFrontEndUIMsgPriority 12
#define kFrontEndUIDrawPriority 11
#define kMFGameMsgPriority 10
#define kMFGameDrawPriority 1000
// namespace IOWinPriorities {
// static int kFrontEndUIMsgPriority = 12;
// static int kFrontEndUIDrawPriority = 11;
// static int kMFGameMsgPriority = 10;
// static int kMFGameDrawPriority = 1000;
// } // namespace IOWinPriorities
#endif // _CIOWIN

View File

@ -5,9 +5,9 @@
#include "rstl/reserved_vector.hpp"
#include "Kyoto/Alloc/CMemorySys.hpp"
#include "Kyoto/Basics/COsContext.hpp"
#include "Kyoto/Basics/CStopwatch.hpp"
#include "Kyoto/Alloc/CMemorySys.hpp"
#include "Kyoto/Streams/CInputStream.hpp"
#include "Kyoto/TReservedAverage.hpp"
#include "MetroidPrime/CGameArchitectureSupport.hpp"
@ -87,9 +87,7 @@ public:
x160_26_screenFading = v;
}
void SetX30(bool v) {
x160_30_ = v;
}
void SetX30(bool v) { x160_30_ = v; }
static void EnsureWorldPaksReady();
static void EnsureWorldPakReady(CAssetId id);

View File

@ -23,7 +23,7 @@ CIOWin::EMessageReturn CMainFlow::OnMessage(const CArchitectureMessage& msg,
break;
case kAM_SetGameState:
CArchMsgParmInt32 state = MakeMsg::GetParmNewGameflowState(msg);
SetGameState((EClientFlowStates)state.GetInt32(), queue);
SetGameState(static_cast< EClientFlowStates >(state.GetInt32()), queue);
return CIOWin::kMR_Exit;
}
@ -60,21 +60,31 @@ void CMainFlow::AdvanceGameState(CArchitectureQueue& queue) {
}
}
static inline bool IsCreditsMode(CMain::ERestartMode m) {
return m >= CMain::kRM_WinBad && m <= CMain::kRM_LoseGame;
}
void CMainFlow::SetGameState(EClientFlowStates state, CArchitectureQueue& queue) {
x14_gameState = state;
switch (x14_gameState) {
case kCFS_GameExit: {
switch (gpMain->GetRestartMode()) {
CMain::ERestartMode m = gpMain->GetRestartMode();
if (IsCreditsMode(m)) {
switch (m) {
case CMain::kRM_WinBad:
case CMain::kRM_WinGood:
case CMain::kRM_WinBest:
queue.Push(MakeMsg::CreateCreateIOWin(kAMT_IOWinManager, 12, 11, new CCredits()));
queue.Push(MakeMsg::CreateCreateIOWin(kAMT_IOWinManager, kFrontEndUIMsgPriority,
kFrontEndUIDrawPriority, new CCredits()));
break;
case CMain::kRM_LoseGame:
queue.Push(MakeMsg::CreateCreateIOWin(kAMT_IOWinManager, 12, 11,
default:
queue.Push(MakeMsg::CreateCreateIOWin(kAMT_IOWinManager, kFrontEndUIMsgPriority,
kFrontEndUIDrawPriority,
new CPlayMovie(CPlayMovie::kWM_LoseGame)));
break;
}
break;
default:
break;
}
@ -85,23 +95,29 @@ void CMainFlow::SetGameState(EClientFlowStates state, CArchitectureQueue& queue)
break;
}
queue.Push(MakeMsg::CreateCreateIOWin(kAMT_IOWinManager, 12, 11, new CPreFrontEnd()));
queue.Push(MakeMsg::CreateCreateIOWin(kAMT_IOWinManager, kFrontEndUIMsgPriority,
kFrontEndUIDrawPriority, new CPreFrontEnd()));
break;
}
case kCFS_FrontEnd:
if (gpMain->GetRestartMode() == CMain::kRM_None) {
break;
}
queue.Push(MakeMsg::CreateCreateIOWin(kAMT_IOWinManager, 12, 11,
gpMain->GetRestartMode() == CMain::kRM_StateSetter
? (CIOWin*)new CStateSetterFlow()
: (CIOWin*)new CFrontEndUI()));
CIOWin* ioWin;
if (gpMain->GetRestartMode() == CMain::kRM_StateSetter) {
ioWin = new CStateSetterFlow();
} else {
ioWin = new CFrontEndUI();
}
queue.Push(MakeMsg::CreateCreateIOWin(kAMT_IOWinManager, kFrontEndUIMsgPriority,
kFrontEndUIDrawPriority, ioWin));
break;
case kCFS_Game:
gpGameState->GameOptions().EnsureOptions();
CMFGameLoader* gameFlow = new CMFGameLoader();
CIOWin* gameFlow = new CMFGameLoader();
gpMain->SetRestartMode(CMain::kRM_Default);
queue.Push(MakeMsg::CreateCreateIOWin(kAMT_IOWinManager, 10, 1000, gameFlow));
queue.Push(MakeMsg::CreateCreateIOWin(kAMT_IOWinManager, kMFGameMsgPriority,
kMFGameDrawPriority, gameFlow));
break;
}
}