2016-04-13 06:07:23 +00:00
|
|
|
#ifndef __URDE_MP1_HPP__
|
|
|
|
#define __URDE_MP1_HPP__
|
2015-08-27 00:23:46 +00:00
|
|
|
|
2016-04-15 20:42:40 +00:00
|
|
|
#define MP1_USE_BOO 0
|
|
|
|
|
2015-08-28 00:11:31 +00:00
|
|
|
#include <boo/boo.hpp>
|
2016-04-15 20:42:40 +00:00
|
|
|
#include <boo/graphicsdev/GL.hpp>
|
|
|
|
#include <boo/audiodev/IAudioVoiceEngine.hpp>
|
2015-08-27 00:23:46 +00:00
|
|
|
#include "CMemory.hpp"
|
|
|
|
#include "CTweaks.hpp"
|
|
|
|
#include "CPlayMovie.hpp"
|
2015-11-02 18:45:39 +00:00
|
|
|
#include "IOStreams.hpp"
|
2016-04-15 20:42:40 +00:00
|
|
|
#include "CBasics.hpp"
|
|
|
|
#include "CMemoryCardSys.hpp"
|
|
|
|
#include "CResFactory.hpp"
|
|
|
|
#include "CSimplePool.hpp"
|
|
|
|
#include "Character/CAssetFactory.hpp"
|
2016-04-16 23:48:29 +00:00
|
|
|
#include "World/CAi.hpp"
|
2016-04-15 20:42:40 +00:00
|
|
|
#include "CGameState.hpp"
|
|
|
|
#include "CInGameTweakManager.hpp"
|
|
|
|
#include "Particle/CElementGen.hpp"
|
|
|
|
#include "Character/CAnimData.hpp"
|
|
|
|
#include "Particle/CDecalManager.hpp"
|
|
|
|
#include "Particle/CGenDescription.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 "GuiSys/CTextParser.hpp"
|
|
|
|
#include "Audio/CAudioStateWin.hpp"
|
|
|
|
#include "GameGlobalObjects.hpp"
|
|
|
|
#include "CArchitectureQueue.hpp"
|
|
|
|
#include "MP1.hpp"
|
|
|
|
#include "CTimeProvider.hpp"
|
|
|
|
#include "GuiSys/CTextExecuteBuffer.hpp"
|
|
|
|
|
|
|
|
#include "DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp"
|
|
|
|
#include "DataSpec/DNAMP1/Tweaks/CTweakGame.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
|
|
|
{
|
|
|
|
class CStopwatch;
|
2016-04-15 20:42:40 +00:00
|
|
|
class IFactory;
|
|
|
|
class IObjectStore;
|
2015-08-27 00:23:46 +00:00
|
|
|
|
|
|
|
namespace MP1
|
|
|
|
{
|
|
|
|
|
2015-11-21 01:16:07 +00:00
|
|
|
enum class EGameplayResult
|
2015-08-27 00:23:46 +00:00
|
|
|
{
|
2015-11-21 01:16:07 +00:00
|
|
|
None,
|
|
|
|
Win,
|
|
|
|
Lose,
|
|
|
|
Playing
|
2015-08-27 00:23:46 +00:00
|
|
|
};
|
|
|
|
|
2016-04-15 20:42:40 +00:00
|
|
|
class CGameGlobalObjects
|
2015-11-02 18:45:39 +00:00
|
|
|
{
|
2016-04-15 20:42:40 +00:00
|
|
|
CMemoryCardSys x0_memoryCardSys;
|
|
|
|
IFactory& x20_resFactory;
|
|
|
|
CSimplePool& x114_simplePool;
|
|
|
|
CCharacterFactoryBuilder x14c_charFactoryBuilder;
|
|
|
|
CAiFuncMap x188_aiFuncMap;
|
|
|
|
CGameState x1a8_gameState;
|
|
|
|
CInGameTweakManager x1c0_tweakManager;
|
|
|
|
std::unique_ptr<CBooRenderer> m_renderer;
|
|
|
|
|
|
|
|
void LoadStringTable()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
static CBooRenderer*
|
|
|
|
AllocateRenderer(IObjectStore& store, IFactory& resFactory)
|
|
|
|
{
|
|
|
|
g_Renderer = new CBooRenderer(store, resFactory);
|
|
|
|
return g_Renderer;
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
2016-08-17 06:18:18 +00:00
|
|
|
CGameGlobalObjects(IFactory& resFactory,
|
|
|
|
CSimplePool& objStore)
|
2016-04-15 20:42:40 +00:00
|
|
|
: x20_resFactory(resFactory), x114_simplePool(objStore)
|
|
|
|
{
|
|
|
|
g_MemoryCardSys = &x0_memoryCardSys;
|
|
|
|
g_ResFactory = &x20_resFactory;
|
|
|
|
g_SimplePool = &x114_simplePool;
|
|
|
|
g_CharFactoryBuilder = &x14c_charFactoryBuilder;
|
|
|
|
g_AiFuncMap = &x188_aiFuncMap;
|
|
|
|
g_GameState = &x1a8_gameState;
|
|
|
|
g_TweakManager = &x1c0_tweakManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
void PostInitialize()
|
|
|
|
{
|
|
|
|
LoadStringTable();
|
|
|
|
m_renderer.reset(AllocateRenderer(x114_simplePool, x20_resFactory));
|
|
|
|
}
|
2015-11-02 18:45:39 +00:00
|
|
|
};
|
|
|
|
|
2016-04-15 20:42:40 +00:00
|
|
|
#if MP1_USE_BOO
|
|
|
|
class CGameArchitectureSupport : public boo::IWindowCallback
|
|
|
|
#else
|
|
|
|
class CGameArchitectureSupport
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
CArchitectureQueue m_archQueue;
|
|
|
|
CAudioSys m_audioSys;
|
|
|
|
CInputGenerator m_inputGenerator;
|
|
|
|
CGuiSys m_guiSys;
|
|
|
|
CIOWinManager m_ioWinManager;
|
|
|
|
CSplashScreen m_splashScreen;
|
|
|
|
CMainFlow m_mainFlow;
|
|
|
|
CConsoleOutputWindow m_consoleWindow;
|
|
|
|
CAudioStateWin m_audioStateWin;
|
|
|
|
boo::SWindowRect m_windowRect;
|
|
|
|
bool m_rectIsDirty;
|
|
|
|
|
|
|
|
void mouseDown(const boo::SWindowCoord &coord, boo::EMouseButton button, boo::EModifierKey mods)
|
|
|
|
{ m_inputGenerator.mouseDown(coord, button, mods); }
|
|
|
|
void mouseUp(const boo::SWindowCoord &coord, boo::EMouseButton button, boo::EModifierKey mods)
|
|
|
|
{ m_inputGenerator.mouseUp(coord, button, mods); }
|
|
|
|
void mouseMove(const boo::SWindowCoord &coord)
|
|
|
|
{ m_inputGenerator.mouseMove(coord); }
|
|
|
|
void scroll(const boo::SWindowCoord &coord, const boo::SScrollDelta &scroll)
|
|
|
|
{ m_inputGenerator.scroll(coord, scroll); }
|
|
|
|
void charKeyDown(unsigned long charCode, boo::EModifierKey mods, bool isRepeat)
|
|
|
|
{ m_inputGenerator.charKeyDown(charCode, mods, isRepeat); }
|
|
|
|
void charKeyUp(unsigned long charCode, boo::EModifierKey mods)
|
|
|
|
{ m_inputGenerator.charKeyUp(charCode, mods); }
|
|
|
|
void specialKeyDown(boo::ESpecialKey key, boo::EModifierKey mods, bool isRepeat)
|
|
|
|
{ m_inputGenerator.specialKeyDown(key, mods, isRepeat); }
|
|
|
|
void specialKeyUp(boo::ESpecialKey key, boo::EModifierKey mods)
|
|
|
|
{ m_inputGenerator.specialKeyUp(key, mods); }
|
|
|
|
void modKeyDown(boo::EModifierKey mod, bool isRepeat)
|
|
|
|
{ m_inputGenerator.modKeyDown(mod, isRepeat);}
|
|
|
|
void modKeyUp(boo::EModifierKey mod)
|
|
|
|
{ m_inputGenerator.modKeyUp(mod); }
|
|
|
|
|
|
|
|
void destroyed() { m_archQueue.Push(std::move(MakeMsg::CreateApplicationExit(EArchMsgTarget::ArchitectureSupport))); }
|
|
|
|
|
|
|
|
void resized(const boo::SWindowRect &rect)
|
|
|
|
{
|
|
|
|
m_windowRect = rect;
|
|
|
|
m_rectIsDirty = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
CGameArchitectureSupport()
|
|
|
|
: m_audioSys(0,0,0,0,0),
|
|
|
|
m_inputGenerator(0.0f /*g_tweakPlayer->GetLeftLogicalThreshold()*/,
|
|
|
|
0.0f /*g_tweakPlayer->GetRightLogicalThreshold()*/),
|
|
|
|
m_guiSys(*g_ResFactory, *g_SimplePool, CGuiSys::EUsageMode::Zero)
|
|
|
|
{
|
|
|
|
g_GuiSys = &m_guiSys;
|
|
|
|
m_inputGenerator.startScanning();
|
|
|
|
}
|
|
|
|
bool Update()
|
|
|
|
{
|
|
|
|
bool finished = false;
|
|
|
|
m_inputGenerator.Update(1.0 / 60.0, m_archQueue);
|
|
|
|
|
2016-09-02 17:50:03 +00:00
|
|
|
g_GameState->GetWorldTransitionManager()->TouchModels();
|
|
|
|
int unk = 0;
|
|
|
|
m_archQueue.Push(std::move(MakeMsg::CreateFrameBegin(EArchMsgTarget::Game, unk)));
|
|
|
|
|
|
|
|
m_ioWinManager.PumpMessages(m_archQueue);
|
|
|
|
|
|
|
|
/*
|
2016-04-16 03:24:25 +00:00
|
|
|
while (m_archQueue)
|
2016-04-15 20:42:40 +00:00
|
|
|
{
|
|
|
|
CArchitectureMessage msg = m_archQueue.Pop();
|
|
|
|
if (msg.GetTarget() == EArchMsgTarget::ArchitectureSupport)
|
|
|
|
{
|
|
|
|
if (msg.GetType() == EArchMsgType::ApplicationExit)
|
|
|
|
finished = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (msg.GetTarget() == EArchMsgTarget::Game && msg.GetType() == EArchMsgType::UserInput)
|
|
|
|
{
|
|
|
|
const CArchMsgParmUserInput* input = msg.GetParm<CArchMsgParmUserInput>();
|
|
|
|
if (input->x4_parm.DStart())
|
|
|
|
m_archQueue.Push(std::move(MakeMsg::CreateApplicationExit(EArchMsgTarget::ArchitectureSupport)));
|
|
|
|
}
|
|
|
|
}
|
2016-09-02 17:50:03 +00:00
|
|
|
*/
|
2016-04-15 20:42:40 +00:00
|
|
|
return finished;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isRectDirty() { return m_rectIsDirty; }
|
|
|
|
const boo::SWindowRect& getWindowRect()
|
|
|
|
{
|
|
|
|
m_rectIsDirty = false;
|
|
|
|
return m_windowRect;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#if MP1_USE_BOO
|
2015-08-28 00:11:31 +00:00
|
|
|
class CMain : public boo::IApplicationCallback
|
2016-04-15 20:42:40 +00:00
|
|
|
#else
|
|
|
|
class CMain
|
|
|
|
#endif
|
2016-03-04 05:28:20 +00:00
|
|
|
{
|
2016-04-15 20:42:40 +00:00
|
|
|
#if MP1_USE_BOO
|
2015-11-02 18:45:39 +00:00
|
|
|
boo::IWindow* mainWindow;
|
|
|
|
int appMain(boo::IApplication* app);
|
2015-08-28 00:11:31 +00:00
|
|
|
void appQuitting(boo::IApplication*)
|
2015-11-09 03:43:11 +00:00
|
|
|
{ xe8_b24_finished = true; }
|
2015-08-28 00:11:31 +00:00
|
|
|
void appFilesOpen(boo::IApplication*, const std::vector<std::string>& paths)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "OPENING: ");
|
|
|
|
for (const std::string& path : paths)
|
|
|
|
fprintf(stderr, "%s ", path.c_str());
|
|
|
|
fprintf(stderr, "\n");
|
|
|
|
}
|
2016-04-15 20:42:40 +00:00
|
|
|
#endif
|
2016-08-15 20:58:07 +00:00
|
|
|
public:
|
|
|
|
enum class FlowState
|
|
|
|
{
|
|
|
|
Zero,
|
|
|
|
One,
|
|
|
|
Two,
|
|
|
|
Three,
|
|
|
|
Four,
|
|
|
|
Five,
|
|
|
|
Six,
|
|
|
|
};
|
|
|
|
private:
|
2015-08-28 00:11:31 +00:00
|
|
|
|
2016-08-17 06:18:18 +00:00
|
|
|
struct BooSetter
|
|
|
|
{
|
|
|
|
BooSetter(boo::IGraphicsDataFactory* factory,
|
|
|
|
boo::IGraphicsCommandQueue* cmdQ,
|
|
|
|
boo::ITextureR* spareTex);
|
|
|
|
} m_booSetter;
|
|
|
|
|
2016-04-15 20:42:40 +00:00
|
|
|
//CMemorySys x6c_memSys;
|
2015-08-27 00:23:46 +00:00
|
|
|
CTweaks x70_tweaks;
|
|
|
|
EGameplayResult xe4_gameplayResult;
|
2015-09-17 19:50:43 +00:00
|
|
|
bool xe8_b24_finished = false;
|
2015-08-28 00:11:31 +00:00
|
|
|
|
2016-04-15 20:42:40 +00:00
|
|
|
/* urde addition: these are simply initialized along with everything else */
|
2016-08-15 20:58:07 +00:00
|
|
|
CGameGlobalObjects x128_globalObjects;
|
2016-04-15 20:42:40 +00:00
|
|
|
CGameArchitectureSupport m_archSupport;
|
|
|
|
|
2016-08-15 20:58:07 +00:00
|
|
|
FlowState x12c_ = FlowState::Five;
|
|
|
|
|
|
|
|
u32 x130_[10] = { 1000000 };
|
|
|
|
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
bool x160_24_ : 1;
|
|
|
|
bool x160_25_ : 1;
|
|
|
|
bool x160_26_ : 1;
|
|
|
|
bool x160_27_ : 1;
|
|
|
|
bool x160_28_ : 1;
|
|
|
|
bool x160_29_ : 1;
|
|
|
|
bool x160_30_ : 1;
|
|
|
|
bool x160_31_ : 1;
|
|
|
|
bool x161_24_ : 1;
|
|
|
|
};
|
|
|
|
u16 _dummy = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
u32 x164_ = 0;
|
|
|
|
|
2016-08-17 06:18:18 +00:00
|
|
|
void InitializeSubsystems(const hecl::Runtime::FileStoreManager& storeMgr,
|
2016-04-15 20:42:40 +00:00
|
|
|
boo::IAudioVoiceEngine* voiceEngine);
|
|
|
|
|
2015-08-27 00:23:46 +00:00
|
|
|
public:
|
2016-08-17 06:18:18 +00:00
|
|
|
CMain(IFactory& resFactory, CSimplePool& resStore,
|
|
|
|
boo::IGraphicsDataFactory* gfxFactory,
|
|
|
|
boo::IGraphicsCommandQueue* cmdQ,
|
|
|
|
boo::ITextureR* spareTex);
|
2015-08-27 00:23:46 +00:00
|
|
|
void RegisterResourceTweaks();
|
|
|
|
void ResetGameState();
|
|
|
|
void StreamNewGameState(CInputStream&);
|
|
|
|
void CheckTweakManagerDebugOptions() {}
|
2016-04-15 20:42:40 +00:00
|
|
|
|
|
|
|
//int RsMain(int argc, const boo::SystemChar* argv[]);
|
2016-08-17 06:18:18 +00:00
|
|
|
void Init(const hecl::Runtime::FileStoreManager& storeMgr,
|
2016-04-15 20:42:40 +00:00
|
|
|
boo::IAudioVoiceEngine* voiceEngine);
|
|
|
|
bool Proc();
|
|
|
|
void Shutdown();
|
|
|
|
|
2015-08-27 00:23:46 +00:00
|
|
|
bool CheckReset();
|
|
|
|
bool CheckTerminate() {return false;}
|
|
|
|
void DrawDebugMetrics(double, CStopwatch&) {}
|
|
|
|
void DoPredrawMetrics() {}
|
|
|
|
void FillInAssetIDs();
|
|
|
|
void LoadAudio();
|
|
|
|
void ShutdownSubsystems();
|
|
|
|
EGameplayResult GetGameplayResult() const {return xe4_gameplayResult;}
|
|
|
|
void SetGameplayResult(EGameplayResult wl) {xe4_gameplayResult = wl;}
|
2016-08-15 20:58:07 +00:00
|
|
|
|
|
|
|
FlowState GetFlowState() const { return x12c_; }
|
2015-08-27 00:23:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-13 06:07:23 +00:00
|
|
|
#endif // __URDE_MP1_HPP__
|