CMainFlow improvements

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

View File

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

View File

@ -30,4 +30,16 @@ private:
rstl::string x4_name; 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 #endif // _CIOWIN

View File

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

View File

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