2015-08-22 01:58:41 +00:00
|
|
|
#include "CMFGame.hpp"
|
|
|
|
#include "CArchitectureQueue.hpp"
|
|
|
|
#include "GameGlobalObjects.hpp"
|
|
|
|
#include "CGameState.hpp"
|
2016-09-25 16:45:22 +00:00
|
|
|
#include "CStateManager.hpp"
|
|
|
|
#include "World/CPlayer.hpp"
|
2016-08-15 20:58:07 +00:00
|
|
|
#include "MP1.hpp"
|
2016-08-23 03:12:50 +00:00
|
|
|
#include "Character/CCharLayoutInfo.hpp"
|
2017-02-12 03:17:18 +00:00
|
|
|
#include "AutoMapper/CAutoMapper.hpp"
|
2015-08-22 01:58:41 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
namespace urde
|
2015-08-22 01:58:41 +00:00
|
|
|
{
|
2015-08-27 00:23:46 +00:00
|
|
|
namespace MP1
|
|
|
|
{
|
2015-08-22 01:58:41 +00:00
|
|
|
|
2016-09-15 07:26:35 +00:00
|
|
|
CMFGame::CMFGame(const std::weak_ptr<CStateManager>& stateMgr, const std::weak_ptr<CInGameGuiManager>& guiMgr,
|
|
|
|
const CArchitectureQueue&)
|
2017-01-25 04:40:19 +00:00
|
|
|
: CMFGameBase("CMFGame"), x14_stateManager(stateMgr.lock()), x18_guiManager(guiMgr.lock())
|
2016-09-15 07:26:35 +00:00
|
|
|
{
|
2017-01-25 04:40:19 +00:00
|
|
|
x2a_25_ = true;
|
2016-09-15 07:26:35 +00:00
|
|
|
//g_Main->x160_25_ = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
CIOWin::EMessageReturn CMFGame::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue)
|
|
|
|
{
|
|
|
|
return EMessageReturn::Normal;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMFGame::Draw() const
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
CMFGameLoader::CMFGameLoader() : CMFGameLoaderBase("CMFGameLoader")
|
2016-08-15 20:58:07 +00:00
|
|
|
{
|
2017-01-22 01:40:12 +00:00
|
|
|
CMain* m = static_cast<CMain*>(g_Main);
|
|
|
|
switch (m->GetFlowState())
|
2016-08-15 20:58:07 +00:00
|
|
|
{
|
2017-01-17 01:23:19 +00:00
|
|
|
case EFlowState::Five:
|
|
|
|
case EFlowState::Six:
|
2016-08-15 20:58:07 +00:00
|
|
|
{
|
|
|
|
ResId mlvlId = g_GameState->CurrentWorldAssetId();
|
2017-02-12 03:17:18 +00:00
|
|
|
if (g_MemoryCardSys->HasSaveWorldMemory(mlvlId))
|
|
|
|
{
|
|
|
|
const CSaveWorldMemory& savwMem = g_MemoryCardSys->GetSaveWorldMemory(mlvlId);
|
|
|
|
if (savwMem.GetWorldNameId() != -1)
|
|
|
|
{
|
|
|
|
ResId wtMgrFont = g_ResFactory->TranslateOriginalToNew(0xB7BBD0B4);
|
|
|
|
g_GameState->GetWorldTransitionManager()->EnableTransition(wtMgrFont,
|
|
|
|
savwMem.GetWorldNameId(),
|
|
|
|
1, false, 0.1f, 16.f, 1.f);
|
|
|
|
}
|
|
|
|
}
|
2016-08-15 20:58:07 +00:00
|
|
|
}
|
2017-02-12 03:17:18 +00:00
|
|
|
default: break;
|
2016-08-15 20:58:07 +00:00
|
|
|
}
|
2017-02-12 03:17:18 +00:00
|
|
|
|
|
|
|
if (g_GameState->CurrentWorldAssetId() == g_ResFactory->TranslateOriginalToNew(0x158EFE17) &&
|
|
|
|
g_GameState->CurrentWorldState().GetCurrentAreaId() == 0)
|
|
|
|
{
|
|
|
|
const SObjectTag* strgTag = g_ResFactory->GetResourceIdByName("STRG_IntroLevelLoad");
|
|
|
|
if (strgTag)
|
|
|
|
g_GameState->GetWorldTransitionManager()->EnableTransition(-1, strgTag->id,
|
|
|
|
0, false, 0.1f, 16.f, 1.f);
|
2016-08-15 20:58:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-09 07:45:04 +00:00
|
|
|
void CMFGameLoader::MakeLoadDependencyList()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-08-26 01:34:56 +00:00
|
|
|
CIOWin::EMessageReturn CMFGameLoader::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue)
|
2015-08-22 01:58:41 +00:00
|
|
|
{
|
2016-08-16 22:49:19 +00:00
|
|
|
std::shared_ptr<CWorldTransManager> wtMgr = g_GameState->GetWorldTransitionManager();
|
2016-08-15 20:58:07 +00:00
|
|
|
|
2015-08-22 01:58:41 +00:00
|
|
|
switch (msg.GetType())
|
|
|
|
{
|
2015-11-21 01:16:07 +00:00
|
|
|
case EArchMsgType::TimerTick:
|
2015-08-22 01:58:41 +00:00
|
|
|
{
|
|
|
|
const CArchMsgParmReal32& tick = MakeMsg::GetParmTimerTick(msg);
|
2016-10-09 07:45:04 +00:00
|
|
|
float dt = tick.x4_parm;
|
|
|
|
if (!x2c_24_initialized)
|
|
|
|
{
|
2017-02-12 03:17:18 +00:00
|
|
|
if (x1c_loadList.empty())
|
|
|
|
{
|
2016-10-09 07:45:04 +00:00
|
|
|
MakeLoadDependencyList();
|
2017-02-12 03:17:18 +00:00
|
|
|
wtMgr->StartTransition();
|
|
|
|
return EMessageReturn::Exit;
|
|
|
|
}
|
|
|
|
u32 loadingCount = 0;
|
|
|
|
for (CToken& tok : x1c_loadList)
|
|
|
|
{
|
|
|
|
tok.Lock();
|
|
|
|
if (!tok.IsLoaded())
|
|
|
|
++loadingCount;
|
|
|
|
}
|
|
|
|
wtMgr->Update(dt);
|
|
|
|
if (loadingCount)
|
|
|
|
return EMessageReturn::Exit;
|
|
|
|
x2c_24_initialized = true;
|
2016-10-09 07:45:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wtMgr->Update(dt);
|
|
|
|
}
|
2017-02-12 03:17:18 +00:00
|
|
|
|
|
|
|
if (!x14_stateMgr)
|
|
|
|
{
|
|
|
|
CWorldTransManager::WaitForModelsAndTextures();
|
|
|
|
CWorldState& wldState = g_GameState->CurrentWorldState();
|
|
|
|
x14_stateMgr = std::make_shared<CStateManager>(wldState.RelayTracker(),
|
|
|
|
wldState.MapWorldInfo(),
|
|
|
|
g_GameState->GetPlayerState(),
|
|
|
|
wtMgr,
|
|
|
|
wldState.GetLayerState());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x14_stateMgr->xb3c_initPhase != CStateManager::InitPhase::Done)
|
|
|
|
{
|
|
|
|
CWorldState& wldState = g_GameState->CurrentWorldState();
|
|
|
|
x14_stateMgr->InitializeState(wldState.GetWorldAssetId(),
|
|
|
|
wldState.GetCurrentAreaId(),
|
|
|
|
wldState.GetDesiredAreaAssetId());
|
|
|
|
return EMessageReturn::Exit;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!x18_guiMgr)
|
|
|
|
{
|
|
|
|
x18_guiMgr = std::make_shared<CInGameGuiManager>(*x14_stateMgr, queue);
|
|
|
|
}
|
|
|
|
}
|
2015-08-22 01:58:41 +00:00
|
|
|
}
|
2016-09-15 07:26:35 +00:00
|
|
|
default:
|
|
|
|
break;
|
2015-08-22 01:58:41 +00:00
|
|
|
}
|
2015-11-21 01:16:07 +00:00
|
|
|
return EMessageReturn::Exit;
|
2015-08-22 01:58:41 +00:00
|
|
|
}
|
|
|
|
|
2016-09-15 07:26:35 +00:00
|
|
|
void CMFGameLoader::Draw() const { g_GameState->GetWorldTransitionManager()->Draw(); }
|
2016-09-25 16:45:22 +00:00
|
|
|
|
|
|
|
void CMFGameLoader::Touch()
|
|
|
|
{
|
|
|
|
x14_stateMgr->TouchSky();
|
|
|
|
x14_stateMgr->TouchPlayerActor();
|
|
|
|
x14_stateMgr->Player()->Touch();
|
|
|
|
}
|
2015-08-22 01:58:41 +00:00
|
|
|
}
|
2015-08-27 00:23:46 +00:00
|
|
|
}
|