mirror of https://github.com/AxioDL/metaforce.git
Make CMain a polymorphic class
This commit is contained in:
parent
386e9445e5
commit
f721d0494e
|
@ -28,6 +28,7 @@
|
||||||
#include "Tweaks/CTweakGunRes.hpp"
|
#include "Tweaks/CTweakGunRes.hpp"
|
||||||
#include "Tweaks/CTweakPlayer.hpp"
|
#include "Tweaks/CTweakPlayer.hpp"
|
||||||
#include "Tweaks/CTweakCameraBob.hpp"
|
#include "Tweaks/CTweakCameraBob.hpp"
|
||||||
|
#include "Tweaks/CTweakSlideShow.hpp"
|
||||||
|
|
||||||
namespace DataSpec
|
namespace DataSpec
|
||||||
{
|
{
|
||||||
|
@ -321,6 +322,8 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK& pak, const PAK::En
|
||||||
return {ExtractTweak<CTweakPlayer>, nullptr, {_S(".yaml")}};
|
return {ExtractTweak<CTweakPlayer>, nullptr, {_S(".yaml")}};
|
||||||
if (!name.compare("CameraBob"))
|
if (!name.compare("CameraBob"))
|
||||||
return {ExtractTweak<CTweakCameraBob>, nullptr, {_S(".yaml")}};
|
return {ExtractTweak<CTweakCameraBob>, nullptr, {_S(".yaml")}};
|
||||||
|
if (!name.compare("SlideShow"))
|
||||||
|
return {ExtractTweak<CTweakSlideShow>, nullptr, {_S(".yaml")}};
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
#include "CArchitectureQueue.hpp"
|
#include "CArchitectureQueue.hpp"
|
||||||
#include "GameGlobalObjects.hpp"
|
#include "GameGlobalObjects.hpp"
|
||||||
#include "CGameState.hpp"
|
#include "CGameState.hpp"
|
||||||
|
#include "MP1/MP1.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
|
||||||
CIOWin::EMessageReturn CAudioStateWin::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue)
|
CIOWin::EMessageReturn CAudioStateWin::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
const EArchMsgType msgType = msg.GetType();
|
const EArchMsgType msgType = msg.GetType();
|
||||||
if (msgType == EArchMsgType::SetGameState)
|
if (msgType == EArchMsgType::SetGameState)
|
||||||
{
|
{
|
||||||
|
@ -19,14 +19,13 @@ CIOWin::EMessageReturn CAudioStateWin::OnMessage(const CArchitectureMessage& msg
|
||||||
}
|
}
|
||||||
else if (msgType == EArchMsgType::QuitGameplay)
|
else if (msgType == EArchMsgType::QuitGameplay)
|
||||||
{
|
{
|
||||||
if (g_GameState->GetWorldTransitionManager()->GetTransitionType() == CWorldTransManager::ETransType::Disabled ||
|
if (g_GameState->GetWorldTransitionManager()->GetTransType() == CWorldTransManager::ETransType::Disabled ||
|
||||||
g_Main->x12c_ != 0)
|
g_Main->GetFlowState() != MP1::CMain::EFlowState::Zero)
|
||||||
{
|
{
|
||||||
CSfxManager::SetChannel(CSfxManager::ESfxChannels::Zero);
|
CSfxManager::SetChannel(CSfxManager::ESfxChannels::Zero);
|
||||||
CSfxManager::KillAll(CSfxManager::ESfxChannels::One);
|
CSfxManager::KillAll(CSfxManager::ESfxChannels::One);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return EMessageReturn::Normal;
|
return EMessageReturn::Normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,9 @@ public:
|
||||||
static u16 kInternalInvalidSfxId;
|
static u16 kInternalInvalidSfxId;
|
||||||
static u32 kAllAreas;
|
static u32 kAllAreas;
|
||||||
|
|
||||||
|
static void SetChannel(ESfxChannels) {}
|
||||||
|
static void KillAll(ESfxChannels) {}
|
||||||
|
static void TurnOnChannel(ESfxChannels) {}
|
||||||
static ESfxChannels GetCurrentChannel() {return m_currentChannel;}
|
static ESfxChannels GetCurrentChannel() {return m_currentChannel;}
|
||||||
static void AddListener(ESfxChannels,
|
static void AddListener(ESfxChannels,
|
||||||
const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
||||||
|
@ -151,7 +154,6 @@ public:
|
||||||
static void RemoveEmitter(const CSfxHandle&) {}
|
static void RemoveEmitter(const CSfxHandle&) {}
|
||||||
static void PitchBend(const CSfxHandle&, s32) {}
|
static void PitchBend(const CSfxHandle&, s32) {}
|
||||||
static u16 TranslateSFXID(u16);
|
static u16 TranslateSFXID(u16);
|
||||||
|
|
||||||
static CSfxHandle SfxStop(const CSfxHandle& handle);
|
static CSfxHandle SfxStop(const CSfxHandle& handle);
|
||||||
static CSfxHandle SfxStart(u16 id, s16 vol, s16 pan, bool active, s16 prio, bool inArea, s32 areaId);
|
static CSfxHandle SfxStart(u16 id, s16 vol, s16 pan, bool active, s16 prio, bool inArea, s32 areaId);
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,6 +47,7 @@ add_library(RuntimeCommon
|
||||||
${WORLD_SOURCES}
|
${WORLD_SOURCES}
|
||||||
#CMemory.hpp CMemory.cpp
|
#CMemory.hpp CMemory.cpp
|
||||||
ITweak.hpp
|
ITweak.hpp
|
||||||
|
IMain.hpp
|
||||||
CMemoryCardSys.hpp
|
CMemoryCardSys.hpp
|
||||||
CScannableObjectInfo.hpp CScannableObjectInfo.cpp
|
CScannableObjectInfo.hpp CScannableObjectInfo.cpp
|
||||||
CSaveWorld.hpp CSaveWorld.cpp
|
CSaveWorld.hpp CSaveWorld.cpp
|
||||||
|
|
|
@ -4,10 +4,10 @@ namespace urde
|
||||||
{
|
{
|
||||||
namespace MP1
|
namespace MP1
|
||||||
{
|
{
|
||||||
class CMain* g_Main = nullptr;
|
|
||||||
class CGameArchitectureSupport* g_archSupport = nullptr;
|
class CGameArchitectureSupport* g_archSupport = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class IMain* g_Main = nullptr;
|
||||||
class CMemoryCardSys* g_MemoryCardSys = nullptr;
|
class CMemoryCardSys* g_MemoryCardSys = nullptr;
|
||||||
class IFactory* g_ResFactory = nullptr;
|
class IFactory* g_ResFactory = nullptr;
|
||||||
class CSimplePool* g_SimplePool = nullptr;
|
class CSimplePool* g_SimplePool = nullptr;
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
extern class IMain* g_Main;
|
||||||
namespace MP1
|
namespace MP1
|
||||||
{
|
{
|
||||||
extern class CMain* g_Main;
|
|
||||||
extern class CGameArchitectureSupport* g_archSupport;
|
extern class CGameArchitectureSupport* g_archSupport;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
#ifndef __URDE_IMAIN_HPP__
|
||||||
|
#define __URDE_IMAIN_HPP__
|
||||||
|
#include <boo/boo.hpp>
|
||||||
|
#include <boo/graphicsdev/GL.hpp>
|
||||||
|
#include <boo/audiodev/IAudioVoiceEngine.hpp>
|
||||||
|
#include <hecl/Runtime.hpp>
|
||||||
|
#include <amuse/amuse.hpp>
|
||||||
|
#include "RetroTypes.hpp"
|
||||||
|
|
||||||
|
namespace urde
|
||||||
|
{
|
||||||
|
class CStopWatch;
|
||||||
|
enum class EGameplayResult
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Win,
|
||||||
|
Lose,
|
||||||
|
Playing
|
||||||
|
};
|
||||||
|
|
||||||
|
class IMain
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum class EFlowState
|
||||||
|
{
|
||||||
|
Zero,
|
||||||
|
One,
|
||||||
|
Two,
|
||||||
|
Three,
|
||||||
|
Four,
|
||||||
|
Five,
|
||||||
|
Six,
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual void RegisterResourceTweaks() {}
|
||||||
|
virtual void ResetGameState()=0;
|
||||||
|
virtual void StreamNewGameState(CInputStream&) {}
|
||||||
|
virtual void CheckTweakManagerDebugOptions() {}
|
||||||
|
virtual void Init(const hecl::Runtime::FileStoreManager& storeMgr,
|
||||||
|
boo::IAudioVoiceEngine* voiceEngine,
|
||||||
|
amuse::IBackendVoiceAllocator& backend)=0;
|
||||||
|
virtual void Draw()=0;
|
||||||
|
virtual bool Proc()=0;
|
||||||
|
virtual void Shutdown()=0;
|
||||||
|
virtual bool CheckReset()=0;
|
||||||
|
virtual bool CheckTerminate()=0;
|
||||||
|
virtual void DrawDebugMetrics(double, CStopWatch&) {}
|
||||||
|
virtual void DoPreDrawMetrics(){}
|
||||||
|
virtual void FillInAssetIDs()=0;
|
||||||
|
virtual void LoadAudio()=0;
|
||||||
|
virtual void ShutdownSubsystems()=0;
|
||||||
|
virtual EGameplayResult GetGameplayResult() const=0;
|
||||||
|
virtual void SetGameplayResult(EGameplayResult wl)=0;
|
||||||
|
virtual EFlowState GetFlowState() const=0;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // __URDE_IMAIN_HPP__
|
|
@ -73,8 +73,9 @@ std::string CFrontEndUI::GetAttractMovieFileName(int idx)
|
||||||
|
|
||||||
std::string CFrontEndUI::GetNextAttractMovieFileName()
|
std::string CFrontEndUI::GetNextAttractMovieFileName()
|
||||||
{
|
{
|
||||||
GetAttractMovieFileName(xbc_nextAttract);
|
std::string ret = GetAttractMovieFileName(xbc_nextAttract);
|
||||||
xbc_nextAttract = (xbc_nextAttract + 1) % xc0_attractCount;
|
xbc_nextAttract = (xbc_nextAttract + 1) % xc0_attractCount;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFrontEndUI::SetCurrentMovie(EMenuMovie movie)
|
void CFrontEndUI::SetCurrentMovie(EMenuMovie movie)
|
||||||
|
|
|
@ -31,8 +31,8 @@ CMFGameLoader::CMFGameLoader() : CMFGameLoaderBase("CMFGameLoader")
|
||||||
{
|
{
|
||||||
switch (g_Main->GetFlowState())
|
switch (g_Main->GetFlowState())
|
||||||
{
|
{
|
||||||
case CMain::FlowState::Five:
|
case CMain::EFlowState::Five:
|
||||||
case CMain::FlowState::Six:
|
case CMain::EFlowState::Six:
|
||||||
{
|
{
|
||||||
ResId mlvlId = g_GameState->CurrentWorldAssetId();
|
ResId mlvlId = g_GameState->CurrentWorldAssetId();
|
||||||
// g_GameState->WorldTransitionManager()->
|
// g_GameState->WorldTransitionManager()->
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
|
|
||||||
#define MP1_USE_BOO 0
|
#define MP1_USE_BOO 0
|
||||||
|
|
||||||
#include <boo/boo.hpp>
|
#include "IMain.hpp"
|
||||||
#include <boo/graphicsdev/GL.hpp>
|
|
||||||
#include <boo/audiodev/IAudioVoiceEngine.hpp>
|
|
||||||
#include "CMemory.hpp"
|
#include "CMemory.hpp"
|
||||||
#include "CTweaks.hpp"
|
#include "CTweaks.hpp"
|
||||||
#include "CPlayMovie.hpp"
|
#include "CPlayMovie.hpp"
|
||||||
|
@ -35,30 +33,18 @@
|
||||||
#include "Audio/CAudioStateWin.hpp"
|
#include "Audio/CAudioStateWin.hpp"
|
||||||
#include "GameGlobalObjects.hpp"
|
#include "GameGlobalObjects.hpp"
|
||||||
#include "CArchitectureQueue.hpp"
|
#include "CArchitectureQueue.hpp"
|
||||||
#include "MP1.hpp"
|
|
||||||
#include "CTimeProvider.hpp"
|
#include "CTimeProvider.hpp"
|
||||||
#include "GuiSys/CTextExecuteBuffer.hpp"
|
#include "GuiSys/CTextExecuteBuffer.hpp"
|
||||||
|
|
||||||
#include "DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp"
|
#include "DataSpec/DNAMP1/Tweaks/CTweakPlayer.hpp"
|
||||||
#include "DataSpec/DNAMP1/Tweaks/CTweakGame.hpp"
|
#include "DataSpec/DNAMP1/Tweaks/CTweakGame.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
class CStopwatch;
|
|
||||||
class IFactory;
|
class IFactory;
|
||||||
class IObjectStore;
|
class IObjectStore;
|
||||||
|
|
||||||
namespace MP1
|
namespace MP1
|
||||||
{
|
{
|
||||||
|
|
||||||
enum class EGameplayResult
|
|
||||||
{
|
|
||||||
None,
|
|
||||||
Win,
|
|
||||||
Lose,
|
|
||||||
Playing
|
|
||||||
};
|
|
||||||
|
|
||||||
class CGameGlobalObjects
|
class CGameGlobalObjects
|
||||||
{
|
{
|
||||||
CMemoryCardSys x0_memoryCardSys;
|
CMemoryCardSys x0_memoryCardSys;
|
||||||
|
@ -159,9 +145,9 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
#if MP1_USE_BOO
|
#if MP1_USE_BOO
|
||||||
class CMain : public boo::IApplicationCallback
|
class CMain : public boo::IApplicationCallback, public IMain
|
||||||
#else
|
#else
|
||||||
class CMain
|
class CMain : public IMain
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if MP1_USE_BOO
|
#if MP1_USE_BOO
|
||||||
|
@ -177,17 +163,6 @@ class CMain
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
public:
|
|
||||||
enum class FlowState
|
|
||||||
{
|
|
||||||
Zero,
|
|
||||||
One,
|
|
||||||
Two,
|
|
||||||
Three,
|
|
||||||
Four,
|
|
||||||
Five,
|
|
||||||
Six,
|
|
||||||
};
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
struct BooSetter
|
struct BooSetter
|
||||||
|
@ -206,7 +181,7 @@ private:
|
||||||
CGameGlobalObjects x128_globalObjects;
|
CGameGlobalObjects x128_globalObjects;
|
||||||
std::unique_ptr<CGameArchitectureSupport> m_archSupport;
|
std::unique_ptr<CGameArchitectureSupport> m_archSupport;
|
||||||
|
|
||||||
FlowState x12c_ = FlowState::Five;
|
EFlowState x12c_flowState = EFlowState::Five;
|
||||||
|
|
||||||
u32 x130_[10] = { 1000000 };
|
u32 x130_[10] = { 1000000 };
|
||||||
|
|
||||||
|
@ -239,7 +214,7 @@ public:
|
||||||
boo::ITextureR* spareTex);
|
boo::ITextureR* spareTex);
|
||||||
void RegisterResourceTweaks();
|
void RegisterResourceTweaks();
|
||||||
void ResetGameState();
|
void ResetGameState();
|
||||||
void StreamNewGameState(CInputStream&);
|
void StreamNewGameState(CInputStream&) {}
|
||||||
void CheckTweakManagerDebugOptions() {}
|
void CheckTweakManagerDebugOptions() {}
|
||||||
|
|
||||||
//int RsMain(int argc, const boo::SystemChar* argv[]);
|
//int RsMain(int argc, const boo::SystemChar* argv[]);
|
||||||
|
@ -250,17 +225,17 @@ public:
|
||||||
void Draw();
|
void Draw();
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
bool CheckReset();
|
bool CheckReset() { return false; }
|
||||||
bool CheckTerminate() {return false;}
|
bool CheckTerminate() {return false;}
|
||||||
void DrawDebugMetrics(double, CStopwatch&) {}
|
void DrawDebugMetrics(double, CStopWatch&) {}
|
||||||
void DoPredrawMetrics() {}
|
void DoPredrawMetrics() {}
|
||||||
void FillInAssetIDs();
|
void FillInAssetIDs();
|
||||||
void LoadAudio();
|
void LoadAudio();
|
||||||
void ShutdownSubsystems();
|
void ShutdownSubsystems() {}
|
||||||
EGameplayResult GetGameplayResult() const {return xe4_gameplayResult;}
|
EGameplayResult GetGameplayResult() const {return xe4_gameplayResult;}
|
||||||
void SetGameplayResult(EGameplayResult wl) {xe4_gameplayResult = wl;}
|
void SetGameplayResult(EGameplayResult wl) {xe4_gameplayResult = wl;}
|
||||||
|
|
||||||
FlowState GetFlowState() const { return x12c_; }
|
EFlowState GetFlowState() const { return x12c_flowState; }
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "CAi.hpp"
|
#include "CAi.hpp"
|
||||||
#include "Character/CModelData.hpp"
|
#include "Character/CModelData.hpp"
|
||||||
#include "CStateManager.hpp"
|
#include "CStateManager.hpp"
|
||||||
|
#include "CStateMachine.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
@ -33,6 +34,8 @@ CAiTriggerFunc CAi::GetTrigerFunc(const char* func)
|
||||||
{
|
{
|
||||||
return m_FuncMap->GetTriggerFunc(func);
|
return m_FuncMap->GetTriggerFunc(func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CStateMachine*CAi::GetStateMachine() const { return x2c8_stateMachine.GetObj(); }
|
||||||
void CAi::CreateFuncLookup(CAiFuncMap* funcMap)
|
void CAi::CreateFuncLookup(CAiFuncMap* funcMap)
|
||||||
{
|
{
|
||||||
m_FuncMap = funcMap;
|
m_FuncMap = funcMap;
|
||||||
|
|
|
@ -37,7 +37,7 @@ public:
|
||||||
static CAiStateFunc GetStateFunc(const char* func);
|
static CAiStateFunc GetStateFunc(const char* func);
|
||||||
static CAiTriggerFunc GetTrigerFunc(const char* func);
|
static CAiTriggerFunc GetTrigerFunc(const char* func);
|
||||||
|
|
||||||
void GetStateMachine() {}
|
const CStateMachine* GetStateMachine() const;
|
||||||
|
|
||||||
virtual void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) {}
|
virtual void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) {}
|
||||||
virtual CHealthInfo HealthInfo(CStateManager&) { return x258_healthInfo; }
|
virtual CHealthInfo HealthInfo(CStateManager&) { return x258_healthInfo; }
|
||||||
|
|
Loading…
Reference in New Issue