metaforce/Runtime/MP1/CMainFlow.cpp

117 lines
3.4 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-08-23 03:12:50 +00:00
#include "Character/CCharLayoutInfo.hpp"
#include "CSaveUI.hpp"
#include "CCredits.hpp"
#include "CPreFrontEnd.hpp"
#include "CStateSetterFlow.hpp"
#include "CNESEmulator.hpp"
#include "CQuitScreen.hpp"
2015-08-27 00:23:46 +00:00
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)
{
case EClientFlowStates::Game:
CMainFlow::SetGameState(EClientFlowStates::GameExit, queue);
break;
case EClientFlowStates::PreFrontEnd:
2016-09-16 20:18:03 +00:00
CMainFlow::SetGameState(EClientFlowStates::FrontEnd, queue);
break;
2015-11-21 01:16:07 +00:00
case EClientFlowStates::FrontEnd:
CMainFlow::SetGameState(EClientFlowStates::Game, queue);
2015-08-27 00:27:32 +00:00
break;
case EClientFlowStates::GameExit:
{
MP1::CMain* main = static_cast<MP1::CMain*>(g_Main);
if (main->GetFlowState() != EFlowState::Zero &&
main->GetFlowState() != EFlowState::Six)
main->SetX30(true);
}
case EClientFlowStates::Unspecified:
CMainFlow::SetGameState(EClientFlowStates::PreFrontEnd, 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)
{
x14_gameState = state;
MP1::CMain* main = static_cast<MP1::CMain*>(g_Main);
2015-08-27 00:23:46 +00:00
switch (state)
{
case EClientFlowStates::GameExit:
2015-08-27 00:23:46 +00:00
{
switch (main->GetFlowState())
2015-08-27 00:23:46 +00:00
{
case EFlowState::One:
case EFlowState::Two:
case EFlowState::Three:
queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11,
std::make_shared<CCredits>()));
2015-08-27 00:23:46 +00:00
break;
case EFlowState::Four:
queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11,
std::make_shared<CPlayMovie>(CPlayMovie::EWhichMovie::AfterCredits)));
break;
default: break;
2015-08-27 00:23:46 +00:00
}
break;
}
case EClientFlowStates::PreFrontEnd:
2015-08-27 00:23:46 +00:00
{
if (main->GetFlowState() == EFlowState::Zero)
return;
queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11,
std::make_shared<CPreFrontEnd>()));
2015-08-27 00:23:46 +00:00
break;
}
case EClientFlowStates::FrontEnd:
2015-08-27 00:23:46 +00:00
{
std::shared_ptr<CIOWin> nextIOWin;
switch (main->GetFlowState())
2015-08-27 00:23:46 +00:00
{
case EFlowState::Six:
nextIOWin = std::make_shared<CStateSetterFlow>();
2015-08-27 00:23:46 +00:00
break;
case EFlowState::One:
case EFlowState::Two:
case EFlowState::Three:
case EFlowState::Four:
case EFlowState::Five:
nextIOWin = std::make_shared<CFrontEndUI>();
2015-08-27 00:23:46 +00:00
break;
default: return;
2015-08-27 00:23:46 +00:00
}
queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11, std::move(nextIOWin)));
break;
}
case EClientFlowStates::Game:
{
g_GameState->GameOptions().EnsureSettings();
main->SetFlowState(EFlowState::Five);
queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 10, 1000,
std::make_shared<CMFGameLoader>()));
2015-08-27 00:23:46 +00:00
break;
}
default: break;
}
}
}
}