2015-08-27 00:23:46 +00:00
|
|
|
#include "CMainFlow.hpp"
|
2016-03-04 05:28:20 +00:00
|
|
|
#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"
|
2017-02-12 03:17:18 +00:00
|
|
|
#include "CSaveGameScreen.hpp"
|
2017-01-17 01:23:19 +00:00
|
|
|
#include "CCredits.hpp"
|
|
|
|
#include "CPreFrontEnd.hpp"
|
|
|
|
#include "CStateSetterFlow.hpp"
|
|
|
|
#include "CNESEmulator.hpp"
|
2017-02-12 03:17:18 +00:00
|
|
|
#include "CQuitGameScreen.hpp"
|
2015-08-27 00:23:46 +00:00
|
|
|
|
2017-12-29 08:08:12 +00:00
|
|
|
namespace urde::MP1
|
2015-08-27 00:23:46 +00:00
|
|
|
{
|
|
|
|
|
2015-08-27 00:27:32 +00:00
|
|
|
void CMainFlow::AdvanceGameState(CArchitectureQueue& queue)
|
|
|
|
{
|
|
|
|
switch (x14_gameState)
|
|
|
|
{
|
2017-01-17 01:23:19 +00:00
|
|
|
case EClientFlowStates::Game:
|
2017-02-18 02:19:50 +00:00
|
|
|
SetGameState(EClientFlowStates::GameExit, queue);
|
2017-01-17 01:23:19 +00:00
|
|
|
break;
|
|
|
|
case EClientFlowStates::PreFrontEnd:
|
2017-02-18 02:19:50 +00:00
|
|
|
SetGameState(EClientFlowStates::FrontEnd, queue);
|
2016-09-16 20:18:03 +00:00
|
|
|
break;
|
2015-11-21 01:16:07 +00:00
|
|
|
case EClientFlowStates::FrontEnd:
|
2017-02-18 02:19:50 +00:00
|
|
|
SetGameState(EClientFlowStates::Game, queue);
|
2015-08-27 00:27:32 +00:00
|
|
|
break;
|
2017-01-17 01:23:19 +00:00
|
|
|
case EClientFlowStates::GameExit:
|
|
|
|
{
|
|
|
|
MP1::CMain* main = static_cast<MP1::CMain*>(g_Main);
|
2017-03-30 22:36:18 +00:00
|
|
|
if (main->GetFlowState() != EFlowState::None &&
|
|
|
|
main->GetFlowState() != EFlowState::StateSetter)
|
2017-01-17 01:23:19 +00:00
|
|
|
main->SetX30(true);
|
|
|
|
}
|
|
|
|
case EClientFlowStates::Unspecified:
|
2017-02-18 02:19:50 +00:00
|
|
|
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)
|
|
|
|
{
|
2017-01-17 01:23:19 +00:00
|
|
|
x14_gameState = state;
|
|
|
|
MP1::CMain* main = static_cast<MP1::CMain*>(g_Main);
|
|
|
|
|
2015-08-27 00:23:46 +00:00
|
|
|
switch (state)
|
|
|
|
{
|
2017-01-17 01:23:19 +00:00
|
|
|
case EClientFlowStates::GameExit:
|
2015-08-27 00:23:46 +00:00
|
|
|
{
|
2017-01-17 01:23:19 +00:00
|
|
|
switch (main->GetFlowState())
|
2015-08-27 00:23:46 +00:00
|
|
|
{
|
2017-03-30 22:36:18 +00:00
|
|
|
case EFlowState::WinBad:
|
|
|
|
case EFlowState::WinGood:
|
|
|
|
case EFlowState::WinBest:
|
2017-01-17 01:23:19 +00:00
|
|
|
queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11,
|
|
|
|
std::make_shared<CCredits>()));
|
2015-08-27 00:23:46 +00:00
|
|
|
break;
|
2017-03-30 22:36:18 +00:00
|
|
|
case EFlowState::LoseGame:
|
2017-01-17 01:23:19 +00:00
|
|
|
queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11,
|
2017-03-30 22:36:18 +00:00
|
|
|
std::make_shared<CPlayMovie>(CPlayMovie::EWhichMovie::LoseGame)));
|
2017-01-17 01:23:19 +00:00
|
|
|
break;
|
|
|
|
default: break;
|
2015-08-27 00:23:46 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2017-01-17 01:23:19 +00:00
|
|
|
case EClientFlowStates::PreFrontEnd:
|
2015-08-27 00:23:46 +00:00
|
|
|
{
|
2017-03-30 22:36:18 +00:00
|
|
|
if (main->GetFlowState() == EFlowState::None)
|
2017-01-17 01:23:19 +00:00
|
|
|
return;
|
|
|
|
queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11,
|
|
|
|
std::make_shared<CPreFrontEnd>()));
|
2015-08-27 00:23:46 +00:00
|
|
|
break;
|
|
|
|
}
|
2017-01-17 01:23:19 +00:00
|
|
|
case EClientFlowStates::FrontEnd:
|
2015-08-27 00:23:46 +00:00
|
|
|
{
|
2017-01-17 01:23:19 +00:00
|
|
|
std::shared_ptr<CIOWin> nextIOWin;
|
|
|
|
switch (main->GetFlowState())
|
2015-08-27 00:23:46 +00:00
|
|
|
{
|
2017-03-30 22:36:18 +00:00
|
|
|
case EFlowState::StateSetter:
|
2017-01-17 01:23:19 +00:00
|
|
|
nextIOWin = std::make_shared<CStateSetterFlow>();
|
2015-08-27 00:23:46 +00:00
|
|
|
break;
|
2017-03-30 22:36:18 +00:00
|
|
|
case EFlowState::WinBad:
|
|
|
|
case EFlowState::WinGood:
|
|
|
|
case EFlowState::WinBest:
|
|
|
|
case EFlowState::LoseGame:
|
|
|
|
case EFlowState::Default:
|
2017-01-17 01:23:19 +00:00
|
|
|
nextIOWin = std::make_shared<CFrontEndUI>();
|
2015-08-27 00:23:46 +00:00
|
|
|
break;
|
2017-01-17 01:23:19 +00:00
|
|
|
default: return;
|
2015-08-27 00:23:46 +00:00
|
|
|
}
|
2017-01-17 01:23:19 +00:00
|
|
|
|
|
|
|
queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 12, 11, std::move(nextIOWin)));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case EClientFlowStates::Game:
|
|
|
|
{
|
|
|
|
g_GameState->GameOptions().EnsureSettings();
|
2017-03-30 22:36:18 +00:00
|
|
|
main->SetFlowState(EFlowState::Default);
|
2017-01-17 01:23:19 +00:00
|
|
|
queue.Push(MakeMsg::CreateCreateIOWin(EArchMsgTarget::IOWinManager, 10, 1000,
|
|
|
|
std::make_shared<CMFGameLoader>()));
|
2015-08-27 00:23:46 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|