2016-03-04 05:28:20 +00:00
|
|
|
#include "MP1.hpp"
|
2016-07-21 05:21:45 +00:00
|
|
|
#include "Graphics/Shaders/CModelShaders.hpp"
|
2016-07-22 19:46:30 +00:00
|
|
|
#include "Graphics/Shaders/CThermalColdFilter.hpp"
|
2016-08-03 21:53:03 +00:00
|
|
|
#include "Graphics/Shaders/CThermalHotFilter.hpp"
|
2016-07-29 17:38:44 +00:00
|
|
|
#include "Graphics/Shaders/CSpaceWarpFilter.hpp"
|
2015-08-29 01:30:47 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
namespace urde
|
2015-08-17 05:26:58 +00:00
|
|
|
{
|
2016-07-22 19:46:30 +00:00
|
|
|
URDE_DECL_SPECIALIZE_SHADER(CThermalColdFilter)
|
2016-08-03 21:53:03 +00:00
|
|
|
URDE_DECL_SPECIALIZE_SHADER(CThermalHotFilter)
|
2016-07-29 17:38:44 +00:00
|
|
|
URDE_DECL_SPECIALIZE_SHADER(CSpaceWarpFilter)
|
2015-08-18 05:54:43 +00:00
|
|
|
|
2015-08-17 22:05:00 +00:00
|
|
|
namespace MP1
|
|
|
|
{
|
2015-08-27 00:23:46 +00:00
|
|
|
class CMain* g_main = nullptr;
|
2015-08-17 22:05:00 +00:00
|
|
|
|
2016-04-15 20:42:40 +00:00
|
|
|
CMain::CMain(IFactory& resFactory, CSimplePool& resStore)
|
|
|
|
: m_globalObjects(resFactory, resStore)
|
2015-08-17 05:26:58 +00:00
|
|
|
{
|
2015-08-27 00:23:46 +00:00
|
|
|
g_main = this;
|
2015-11-21 01:16:07 +00:00
|
|
|
xe4_gameplayResult = EGameplayResult::Playing;
|
2015-08-27 00:23:46 +00:00
|
|
|
}
|
2016-04-15 20:42:40 +00:00
|
|
|
|
2015-08-27 00:23:46 +00:00
|
|
|
void CMain::RegisterResourceTweaks()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void CMain::ResetGameState()
|
|
|
|
{
|
|
|
|
}
|
2015-11-02 18:45:39 +00:00
|
|
|
|
2016-04-15 20:42:40 +00:00
|
|
|
void CMain::InitializeSubsystems(boo::IGraphicsDataFactory* factory,
|
|
|
|
boo::IGraphicsCommandQueue* cc,
|
|
|
|
boo::ITextureR* renderTex,
|
|
|
|
const hecl::Runtime::FileStoreManager& storeMgr,
|
|
|
|
boo::IAudioVoiceEngine* voiceEngine)
|
2015-08-27 00:23:46 +00:00
|
|
|
{
|
2016-04-15 20:42:40 +00:00
|
|
|
CGraphics::InitializeBoo(factory, cc, renderTex);
|
|
|
|
CModelShaders::Initialize(storeMgr, factory);
|
2016-07-22 19:46:30 +00:00
|
|
|
TShader<CThermalColdFilter>::Initialize();
|
2016-08-03 21:53:03 +00:00
|
|
|
TShader<CThermalHotFilter>::Initialize();
|
2016-07-29 17:38:44 +00:00
|
|
|
TShader<CSpaceWarpFilter>::Initialize();
|
2016-04-15 20:42:40 +00:00
|
|
|
CMoviePlayer::Initialize();
|
|
|
|
CLineRenderer::Initialize();
|
2015-08-27 00:23:46 +00:00
|
|
|
CElementGen::Initialize();
|
|
|
|
CAnimData::InitializeCache();
|
|
|
|
CDecalManager::Initialize();
|
|
|
|
}
|
2015-11-02 18:45:39 +00:00
|
|
|
|
2015-08-27 00:23:46 +00:00
|
|
|
void CMain::FillInAssetIDs()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void CMain::LoadAudio()
|
|
|
|
{
|
|
|
|
}
|
2015-11-02 18:45:39 +00:00
|
|
|
|
2016-04-15 20:42:40 +00:00
|
|
|
void CMain::Init(boo::IGraphicsDataFactory* factory,
|
|
|
|
boo::IGraphicsCommandQueue* cc,
|
|
|
|
boo::ITextureR* renderTex,
|
|
|
|
const hecl::Runtime::FileStoreManager& storeMgr,
|
|
|
|
boo::IAudioVoiceEngine* voiceEngine)
|
|
|
|
{
|
|
|
|
InitializeSubsystems(factory, cc, renderTex, storeMgr, voiceEngine);
|
|
|
|
m_globalObjects.PostInitialize();
|
|
|
|
x70_tweaks.RegisterTweaks();
|
|
|
|
//g_TweakManager->ReadFromMemoryCard("AudioTweaks");
|
|
|
|
FillInAssetIDs();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CMain::Proc()
|
|
|
|
{
|
|
|
|
xe8_b24_finished = m_archSupport.Update();
|
|
|
|
return xe8_b24_finished;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMain::Shutdown()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#if MP1_USE_BOO
|
|
|
|
|
2015-11-02 18:45:39 +00:00
|
|
|
int CMain::appMain(boo::IApplication* app)
|
2015-08-27 00:23:46 +00:00
|
|
|
{
|
2016-03-04 23:04:53 +00:00
|
|
|
zeus::detectCPU();
|
2016-02-24 03:20:07 +00:00
|
|
|
mainWindow = app->newWindow(_S("Metroid Prime 1 Reimplementation vZygote"), 1);
|
2015-11-02 18:45:39 +00:00
|
|
|
mainWindow->showWindow();
|
2015-08-27 00:23:46 +00:00
|
|
|
TOneStatic<CGameGlobalObjects> globalObjs;
|
|
|
|
InitializeSubsystems();
|
2016-04-15 20:42:40 +00:00
|
|
|
globalObjs->PostInitialize();
|
2015-08-27 00:23:46 +00:00
|
|
|
x70_tweaks.RegisterTweaks();
|
|
|
|
AddWorldPaks();
|
|
|
|
g_TweakManager->ReadFromMemoryCard("AudioTweaks");
|
|
|
|
FillInAssetIDs();
|
2015-08-28 00:11:31 +00:00
|
|
|
TOneStatic<CGameArchitectureSupport> archSupport;
|
2016-02-20 06:45:36 +00:00
|
|
|
mainWindow->setCallback(archSupport.GetAllocSpace());
|
2015-11-02 18:45:39 +00:00
|
|
|
|
|
|
|
boo::IGraphicsCommandQueue* gfxQ = mainWindow->getCommandQueue();
|
2016-02-20 10:26:43 +00:00
|
|
|
boo::SWindowRect windowRect = mainWindow->getWindowFrame();
|
2016-03-30 19:16:01 +00:00
|
|
|
boo::ITextureR* renderTex;
|
|
|
|
boo::GraphicsDataToken data = mainWindow->getMainContextDataFactory()->commitTransaction(
|
|
|
|
[&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
|
|
|
{
|
|
|
|
renderTex = ctx.newRenderTexture(windowRect.size[0], windowRect.size[1], true, true);
|
|
|
|
return true;
|
|
|
|
});
|
2016-02-20 05:49:47 +00:00
|
|
|
float rgba[4] = { 0.2f, 0.2f, 0.2f, 1.0f};
|
2015-11-02 18:45:39 +00:00
|
|
|
gfxQ->setClearColor(rgba);
|
|
|
|
|
2015-09-17 19:50:43 +00:00
|
|
|
while (!xe8_b24_finished)
|
2015-08-17 05:26:58 +00:00
|
|
|
{
|
2015-09-17 19:50:43 +00:00
|
|
|
xe8_b24_finished = archSupport->Update();
|
2015-11-02 18:45:39 +00:00
|
|
|
|
2016-02-20 10:26:43 +00:00
|
|
|
if (archSupport->isRectDirty())
|
|
|
|
{
|
|
|
|
const boo::SWindowRect& windowRect = archSupport->getWindowRect();
|
|
|
|
gfxQ->resizeRenderTexture(renderTex,
|
|
|
|
windowRect.size[0],
|
|
|
|
windowRect.size[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
gfxQ->setRenderTarget(renderTex);
|
|
|
|
gfxQ->clearTarget();
|
|
|
|
gfxQ->resolveDisplay(renderTex);
|
2015-11-02 18:45:39 +00:00
|
|
|
gfxQ->execute();
|
2016-02-20 12:40:58 +00:00
|
|
|
mainWindow->waitForRetrace();
|
2015-08-17 05:26:58 +00:00
|
|
|
}
|
2015-08-27 00:23:46 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2015-08-17 05:26:58 +00:00
|
|
|
|
2016-04-15 20:42:40 +00:00
|
|
|
#endif
|
|
|
|
|
2015-08-17 22:05:00 +00:00
|
|
|
}
|
|
|
|
}
|