metaforce/Runtime/MP1/CMainFlow.cpp

79 lines
2.2 KiB
C++
Raw Normal View History

2015-08-27 00:23:46 +00:00
#include "CMainFlow.hpp"
#include "MP1.hpp"
2015-08-27 00:23:46 +00:00
#include "CArchitectureQueue.hpp"
#include "CMFGame.hpp"
#include "CPlayMovie.hpp"
#include "CResFactory.hpp"
#include "CFrontEndUI.hpp"
#include "GameGlobalObjects.hpp"
2016-03-04 23:04:53 +00:00
namespace urde
2015-08-27 00:23:46 +00:00
{
namespace MP1
{
2015-08-27 00:27:32 +00:00
void CMainFlow::AdvanceGameState(CArchitectureQueue& queue)
{
switch (x14_gameState)
{
2015-11-21 01:16:07 +00:00
case EClientFlowStates::FrontEnd:
CMainFlow::SetGameState(EClientFlowStates::GameLoad, queue);
2015-08-27 00:27:32 +00:00
break;
2015-11-21 01:16:07 +00:00
case EClientFlowStates::Unspecified:
case EClientFlowStates::GameLoad:
CMainFlow::SetGameState(EClientFlowStates::MoviePlay, queue);
2015-08-27 00:27:32 +00:00
break;
2015-11-21 01:16:07 +00:00
case EClientFlowStates::MoviePlay:
CMainFlow::SetGameState(EClientFlowStates::FrontEnd, 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-11-21 01:16:07 +00:00
case EClientFlowStates::FrontEnd:
2015-08-27 00:23:46 +00:00
{
2016-08-15 20:58:07 +00:00
if (g_Main->GetGameplayResult() == EGameplayResult::None)
2015-08-27 00:23:46 +00:00
{
2016-08-15 20:58:07 +00:00
g_Main->SetGameplayResult(EGameplayResult::Playing);
2015-08-27 00:23:46 +00:00
break;
}
2016-04-15 03:02:21 +00:00
/* TODO: URDE handling
2015-08-27 00:23:46 +00:00
CResLoader& loader = g_ResFactory->GetLoader();
while (!loader.AreAllPaksLoaded())
loader.AsyncIdlePakLoading();
2016-04-15 03:02:21 +00:00
*/
2016-08-15 20:58:07 +00:00
g_Main->LoadAudio();
g_Main->RegisterResourceTweaks();
2016-08-05 23:48:53 +00:00
queue.Push(std::move(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11, new CFrontEndUI())));
2015-08-27 00:23:46 +00:00
break;
}
2015-11-21 01:16:07 +00:00
case EClientFlowStates::GameLoad:
2015-08-27 00:23:46 +00:00
{
2015-11-21 01:16:07 +00:00
queue.Push(std::move(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 10, 1000, new CMFGameLoader())));
2015-08-27 00:23:46 +00:00
break;
}
2015-11-21 01:16:07 +00:00
case EClientFlowStates::MoviePlay:
2015-08-27 00:23:46 +00:00
{
2016-08-15 20:58:07 +00:00
switch (g_Main->GetGameplayResult())
2015-08-27 00:23:46 +00:00
{
2015-11-21 01:16:07 +00:00
case EGameplayResult::Win:
queue.Push(std::move(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11, new CPlayMovie(CPlayMovie::EWhichMovie::WinGame))));
2015-08-27 00:23:46 +00:00
break;
2015-11-21 01:16:07 +00:00
case EGameplayResult::Lose:
queue.Push(std::move(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11, new CPlayMovie(CPlayMovie::EWhichMovie::LoseGame))));
2015-08-27 00:23:46 +00:00
break;
default: break;
}
break;
}
default: break;
}
}
}
}