metaforce/Runtime/MP1/main.cpp

166 lines
4.0 KiB
C++
Raw Normal View History

2015-08-17 05:26:58 +00:00
#include <memory>
2015-08-18 22:51:54 +00:00
#include <boo/boo.hpp>
2015-08-17 05:26:58 +00:00
#include "CBasics.hpp"
#include "CMemoryCardSys.hpp"
2015-08-17 20:33:58 +00:00
#include "CResFactory.hpp"
#include "CSimplePool.hpp"
2015-08-17 23:46:41 +00:00
#include "Character/CAssetFactory.hpp"
#include "CAi.hpp"
#include "CGameState.hpp"
#include "CInGameTweakManager.hpp"
2015-08-18 05:54:43 +00:00
#include "Particle/CElementGen.hpp"
#include "Character/CAnimData.hpp"
#include "Particle/CDecalManager.hpp"
#include "Graphics/CBooRenderer.hpp"
#include "Audio/CAudioSys.hpp"
#include "Input/CInputGenerator.hpp"
#include "GuiSys/CGuiSys.hpp"
#include "CIOWinManager.hpp"
#include "GuiSys/CSplashScreen.hpp"
#include "CMainFlow.hpp"
#include "GuiSys/CConsoleOutputWindow.hpp"
#include "Audio/CAudioStateWin.hpp"
#include "GameGlobalObjects.hpp"
2015-08-22 01:58:41 +00:00
#include "CArchitectureQueue.hpp"
2015-08-27 00:23:46 +00:00
#include "CMain.hpp"
2015-08-17 05:26:58 +00:00
namespace Retro
2015-08-17 05:26:58 +00:00
{
2015-08-18 05:54:43 +00:00
CMemoryCardSys* g_MemoryCardSys = nullptr;
CResFactory* g_ResFactory = nullptr;
CSimplePool* g_SimplePool = nullptr;
CCharacterFactoryBuilder* g_CharFactoryBuilder = nullptr;
CAiFuncMap* g_AiFuncMap = nullptr;
CGameState* g_GameState = nullptr;
2015-08-27 00:23:46 +00:00
CInGameTweakManagerBase* g_TweakManager = nullptr;
2015-08-18 05:54:43 +00:00
CBooRenderer* g_Renderer = nullptr;
namespace MP1
{
2015-08-27 00:23:46 +00:00
class CMain* g_main = nullptr;
2015-08-18 05:54:43 +00:00
class CGameGlobalObjects
{
2015-08-18 22:51:54 +00:00
CMemoryCardSys m_memoryCardSys;
CResFactory m_resFactory;
CSimplePool m_simplePool;
CCharacterFactoryBuilder m_charFactoryBuilder;
CAiFuncMap m_aiFuncMap;
CGameState m_gameState;
CInGameTweakManager m_tweakManager;
std::unique_ptr<CBooRenderer> m_renderer;
2015-08-18 05:54:43 +00:00
void AddPaksAndFactories()
{
}
void LoadStringTable()
{
}
2015-08-18 22:51:54 +00:00
static CBooRenderer*
2015-08-28 00:11:31 +00:00
AllocateRenderer(IObjectStore& store,
2015-08-18 22:51:54 +00:00
CMemorySys& memSys, CResFactory& resFactory)
2015-08-18 05:54:43 +00:00
{
2015-08-28 00:11:31 +00:00
g_Renderer = new CBooRenderer(store, memSys, resFactory);
2015-08-18 22:51:54 +00:00
return g_Renderer;
2015-08-18 05:54:43 +00:00
}
2015-08-17 23:46:41 +00:00
2015-08-17 05:26:58 +00:00
public:
2015-08-18 05:54:43 +00:00
CGameGlobalObjects()
: m_simplePool(m_resFactory)
{
2015-08-18 22:51:54 +00:00
g_MemoryCardSys = &m_memoryCardSys;
g_ResFactory = &m_resFactory;
g_SimplePool = &m_simplePool;
g_CharFactoryBuilder = &m_charFactoryBuilder;
g_AiFuncMap = &m_aiFuncMap;
g_GameState = &m_gameState;
g_TweakManager = &m_tweakManager;
2015-08-18 05:54:43 +00:00
}
2015-08-28 00:11:31 +00:00
void PostInitialize(CMemorySys& memSys)
2015-08-18 05:54:43 +00:00
{
AddPaksAndFactories();
LoadStringTable();
2015-08-28 00:11:31 +00:00
m_renderer.reset(AllocateRenderer(m_simplePool, memSys, m_resFactory));
2015-08-18 05:54:43 +00:00
}
};
class CGameArchitectureSupport
{
2015-08-20 02:52:07 +00:00
CArchitectureQueue m_archQueue;
2015-08-18 22:51:54 +00:00
CAudioSys m_audioSys;
CInputGenerator m_inputGenerator;
CGuiSys m_guiSys;
CIOWinManager m_ioWinManager;
CSplashScreen m_splashScreen;
CMainFlow m_mainFlow;
CConsoleOutputWindow m_consoleWindow;
CAudioStateWin m_audioStateWin;
2015-08-18 05:54:43 +00:00
public:
2015-08-28 00:11:31 +00:00
CGameArchitectureSupport()
2015-08-18 05:54:43 +00:00
: m_audioSys(0,0,0,0,0)
2015-08-17 20:33:58 +00:00
{
}
2015-08-20 02:52:07 +00:00
bool Update()
{
bool finished = false;
return finished;
}
2015-08-17 05:26:58 +00:00
};
2015-08-27 00:23:46 +00:00
CMain::CMain()
2015-08-28 00:11:31 +00:00
: x6c_memSys(CMemorySys::GetGameAllocator())
2015-08-17 05:26:58 +00:00
{
2015-08-27 00:23:46 +00:00
g_main = this;
xe4_gameplayResult = GameplayResultPlaying;
}
void CMain::RegisterResourceTweaks()
{
}
void CMain::ResetGameState()
{
}
void CMain::InitializeSubsystems()
{
CElementGen::Initialize();
CAnimData::InitializeCache();
CDecalManager::Initialize();
}
void CMain::AddWorldPaks()
{
}
void CMain::FillInAssetIDs()
{
}
void CMain::LoadAudio()
{
}
int CMain::RsMain(int argc, const char* argv[])
{
TOneStatic<CGameGlobalObjects> globalObjs;
InitializeSubsystems();
2015-08-28 00:11:31 +00:00
globalObjs->PostInitialize(x6c_memSys);
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;
2015-08-27 00:23:46 +00:00
while (!xe8_finished)
2015-08-17 05:26:58 +00:00
{
2015-08-27 00:23:46 +00:00
xe8_finished = archSupport->Update();
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
}
}
2015-08-17 05:26:58 +00:00
int main(int argc, const char* argv[])
{
2015-08-28 00:11:31 +00:00
Retro::TOneStatic<Retro::MP1::CMain> main;
2015-08-18 22:51:54 +00:00
std::unique_ptr<boo::IApplication> app =
2015-08-28 00:11:31 +00:00
boo::ApplicationBootstrap(boo::IApplication::PLAT_AUTO, *main,
2015-08-18 22:51:54 +00:00
"mp1", "MP1", argc, argv);
2015-08-18 23:30:23 +00:00
return main->RsMain(argc, argv);
2015-08-17 05:26:58 +00:00
}