metaforce/Runtime/MP1/CMainFlow.cpp

77 lines
2.0 KiB
C++
Raw Normal View History

2015-08-27 00:23:46 +00:00
#include "CMainFlow.hpp"
#include "CArchitectureQueue.hpp"
#include "CMFGame.hpp"
#include "CMain.hpp"
#include "CPlayMovie.hpp"
#include "CResFactory.hpp"
#include "CFrontEndUI.hpp"
#include "GameGlobalObjects.hpp"
namespace Retro
{
namespace MP1
{
2015-08-27 00:27:32 +00:00
void CMainFlow::AdvanceGameState(CArchitectureQueue& queue)
{
switch (x14_gameState)
{
2015-08-28 00:11:31 +00:00
case ClientFlowFrontEnd:
CMainFlow::SetGameState(ClientFlowGameLoad, queue);
2015-08-27 00:27:32 +00:00
break;
2015-08-28 00:11:31 +00:00
case ClientFlowUnspecified:
case ClientFlowGameLoad:
CMainFlow::SetGameState(ClientFlowMoviePlay, queue);
2015-08-27 00:27:32 +00:00
break;
2015-08-28 00:11:31 +00:00
case ClientFlowMoviePlay:
CMainFlow::SetGameState(ClientFlowFrontEnd, queue);
2015-08-27 00:27:32 +00:00
break;
}
}
2015-08-27 00:23:46 +00:00
void CMainFlow::SetGameState(EClientFlowStates state, CArchitectureQueue& queue)
{
switch (state)
{
2015-08-28 00:11:31 +00:00
case ClientFlowFrontEnd:
2015-08-27 00:23:46 +00:00
{
if (g_main->GetGameplayResult() == GameplayResultNone)
{
g_main->SetGameplayResult(GameplayResultPlaying);
break;
}
CResLoader& loader = g_ResFactory->GetLoader();
while (!loader.AreAllPaksLoaded())
loader.AsyncIdlePakLoading();
g_main->LoadAudio();
g_main->RegisterResourceTweaks();
queue.Push(std::move(MakeMsg::CreateCreateIOWin(TargetIOWinManager, 12, 11, new CFrontEndUI(queue))));
break;
}
2015-08-28 00:11:31 +00:00
case ClientFlowGameLoad:
2015-08-27 00:23:46 +00:00
{
queue.Push(std::move(MakeMsg::CreateCreateIOWin(TargetIOWinManager, 10, 1000, new CMFGameLoader())));
break;
}
2015-08-28 00:11:31 +00:00
case ClientFlowMoviePlay:
2015-08-27 00:23:46 +00:00
{
switch (g_main->GetGameplayResult())
{
case GameplayResultWin:
queue.Push(std::move(MakeMsg::CreateCreateIOWin(TargetIOWinManager, 12, 11, new CPlayMovie(CPlayMovie::MovieWinGame))));
break;
case GameplayResultLose:
queue.Push(std::move(MakeMsg::CreateCreateIOWin(TargetIOWinManager, 12, 11, new CPlayMovie(CPlayMovie::MovieLoseGame))));
break;
default: break;
}
break;
}
default: break;
}
}
}
}