mirror of https://github.com/AxioDL/metaforce.git
various implementations
This commit is contained in:
parent
e1d45fd01c
commit
746eb46026
|
@ -30,8 +30,10 @@ set(HECL_DATASPEC_PUSHES
|
|||
add_subdirectory(hecl)
|
||||
add_subdirectory(NODLib)
|
||||
set(NODLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/NODLib/include)
|
||||
add_subdirectory(MathLib)
|
||||
set(MATHLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/MathLib/include)
|
||||
include_directories(${ATHENA_INCLUDE_DIR} ${LOG_VISOR_INCLUDE_DIR} ${HECL_INCLUDE_DIR}
|
||||
${NODLIB_INCLUDE_DIR}
|
||||
${NODLIB_INCLUDE_DIR} ${MATHLIB_INCLUDE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR})
|
||||
add_subdirectory(DataSpec)
|
||||
add_subdirectory(Runtime)
|
||||
|
|
2
MathLib
2
MathLib
|
@ -1 +1 @@
|
|||
Subproject commit 9d657895cb143fd37ab66658d2af8b5d3198257d
|
||||
Subproject commit 2e3512b80098eb0c3facd4fd3ab6433fe424c4f7
|
|
@ -8,6 +8,11 @@ namespace Retro
|
|||
|
||||
class CAudioStateWin : public CIOWin
|
||||
{
|
||||
public:
|
||||
CAudioStateWin() : CIOWin("CAudioStateWin") {}
|
||||
virtual bool OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define __RETRO_CAUDIOSYS_HPP__
|
||||
|
||||
#include "../GCNTypes.hpp"
|
||||
#include "CVector3f.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
@ -9,6 +10,18 @@ namespace Retro
|
|||
class CAudioSys
|
||||
{
|
||||
public:
|
||||
struct C3DEmitterParmData
|
||||
{
|
||||
CVector3f pos;
|
||||
CVector3f dir;
|
||||
float maxDist;
|
||||
float distComp;
|
||||
u32 flags;
|
||||
u16 sfxId;
|
||||
u8 maxVol;
|
||||
u8 minVol;
|
||||
u8 extra[2];
|
||||
};
|
||||
CAudioSys(u8,u8,u8,u8,u32)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
add_library(RuntimeCommonAudio
|
||||
CAudioSys.hpp CAudioSys.cpp
|
||||
CAudioStateWin.hpp CAudioStateWin.cpp)
|
||||
CAudioStateWin.hpp CAudioStateWin.cpp
|
||||
CSfxManager.hpp CSfxManager.cpp
|
||||
CSfxHandle.hpp CSfxHandle.cpp)
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef __RETRO_CSFXHANDLE_HPP__
|
||||
#define __RETRO_CSFXHANDLE_HPP__
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
class CSfxHandle
|
||||
{
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __RETRO_CSFXHANDLE_HPP__
|
|
@ -0,0 +1,133 @@
|
|||
#ifndef __RETRO_CSFXMANAGER_HPP__
|
||||
#define __RETRO_CSFXMANAGER_HPP__
|
||||
|
||||
#include <vector>
|
||||
#include "../RetroTypes.hpp"
|
||||
#include "CSfxHandle.hpp"
|
||||
#include "CVector3f.hpp"
|
||||
#include "CAudioSys.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
class CSfxManager
|
||||
{
|
||||
enum ESfxChannels
|
||||
{
|
||||
};
|
||||
|
||||
enum ESfxAudibility
|
||||
{
|
||||
Aud0,
|
||||
Aud1,
|
||||
Aud2,
|
||||
Aud3
|
||||
};
|
||||
|
||||
class CSfxChannel
|
||||
{
|
||||
};
|
||||
|
||||
class CBaseSfxWrapper
|
||||
{
|
||||
s16 m_rank;
|
||||
s16 m_prio;
|
||||
CSfxHandle m_handle;
|
||||
TAreaId m_area;
|
||||
bool m_useAcoustics:1;
|
||||
bool m_available:1;
|
||||
bool m_inArea:1;
|
||||
bool m_looped:1;
|
||||
bool m_playing:1;
|
||||
bool m_active:1;
|
||||
public:
|
||||
virtual ~CBaseSfxWrapper() {}
|
||||
virtual void SetActive(bool v) {m_active = v;}
|
||||
virtual void SetPlaying(bool v) {m_playing = v;}
|
||||
virtual void SetRank(short v) {m_rank = v;}
|
||||
virtual void SetInArea(bool v) {m_inArea = v;}
|
||||
virtual bool IsLooped() const {return m_looped;}
|
||||
virtual bool IsPlaying() const {return m_playing;}
|
||||
virtual bool IsActive() const {return m_active;}
|
||||
virtual bool IsInArea() const {return m_inArea;}
|
||||
virtual bool UseAcoustics() const {return m_useAcoustics;}
|
||||
virtual s16 GetRank() const {return m_rank;}
|
||||
virtual s16 GetPriority() const {return m_prio;}
|
||||
virtual TAreaId GetArea() const {return m_area;}
|
||||
virtual CSfxHandle GetSfxHandle() const {return m_handle;}
|
||||
virtual void Play()=0;
|
||||
virtual void Stop()=0;
|
||||
virtual bool Ready()=0;
|
||||
virtual ESfxAudibility GetAudible(const CVector3f&)=0;
|
||||
virtual u32 GetVoice() const=0;
|
||||
|
||||
void Release() {m_available = true;}
|
||||
bool Available() const {return m_available;}
|
||||
|
||||
CBaseSfxWrapper(bool looped, s16 prio, const CSfxHandle& handle, bool useAcoustics, TAreaId area)
|
||||
: m_rank(0), m_prio(prio), m_handle(handle), m_area(area), m_useAcoustics(useAcoustics),
|
||||
m_inArea(0), m_looped(looped), m_playing(0), m_active(0) {}
|
||||
};
|
||||
|
||||
class CSfxEmitterWrapper : public CBaseSfxWrapper
|
||||
{
|
||||
CAudioSys::C3DEmitterParmData m_parmData;
|
||||
u32 m_emitterHandle = -1;
|
||||
public:
|
||||
bool IsPlaying() const;
|
||||
void Play();
|
||||
void Stop();
|
||||
bool Ready();
|
||||
ESfxAudibility GetAudible(const CVector3f&);
|
||||
u32 GetVoice() const;
|
||||
|
||||
u32 GetHandle() const {return m_emitterHandle;}
|
||||
|
||||
CSfxEmitterWrapper(bool looped, s16 prio, const CAudioSys::C3DEmitterParmData& data,
|
||||
const CSfxHandle& handle, bool useAcoustics, TAreaId area)
|
||||
: CBaseSfxWrapper(looped, prio, handle, useAcoustics, area), m_parmData(data) {}
|
||||
};
|
||||
|
||||
class CSfxWrapper : public CBaseSfxWrapper
|
||||
{
|
||||
u16 m_sfxId;
|
||||
u32 m_voiceHandle = -1;
|
||||
s16 m_vol;
|
||||
s16 m_pan;
|
||||
public:
|
||||
bool IsPlaying() const;
|
||||
void Play();
|
||||
void Stop();
|
||||
bool Ready();
|
||||
ESfxAudibility GetAudible(const CVector3f&) {return Aud3;}
|
||||
u32 GetVoice() const {return m_voiceHandle;}
|
||||
|
||||
void SetVolume(s16 vol) {m_vol = vol;}
|
||||
|
||||
CSfxWrapper(bool looped, s16 prio, u16 sfxId, s16 vol, s16 pan,
|
||||
const CSfxHandle& handle, bool useAcoustics, TAreaId area)
|
||||
: CBaseSfxWrapper(looped, prio, handle, useAcoustics, area),
|
||||
m_sfxId(sfxId), m_vol(vol), m_pan(pan) {}
|
||||
};
|
||||
|
||||
static CSfxChannel m_channels[4];
|
||||
static rstl::reserved_vector<CSfxEmitterWrapper, 128> m_emitterWrapperPool;
|
||||
static rstl::reserved_vector<CSfxWrapper, 128> m_wrapperPool;
|
||||
static ESfxChannels m_currentChannel;
|
||||
static bool m_doUpdate;
|
||||
static void* m_sfxTranslationTable;
|
||||
static void* m_usedSounds;
|
||||
static bool m_muted;
|
||||
static bool m_auxProcessingEnabled;
|
||||
|
||||
static u16 kMaxPriority;
|
||||
static u16 kMedPriority;
|
||||
static u16 kInternalInvalidSfxId;
|
||||
static u32 kAllAreas;
|
||||
|
||||
static ESfxChannels GetCurrentChannel() {return m_currentChannel;}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __RETRO_CSFXMANAGER_HPP__
|
|
@ -0,0 +1,142 @@
|
|||
#ifndef __RETRO_CARCHITECTUREMESSAGE_HPP__
|
||||
#define __RETRO_CARCHITECTUREMESSAGE_HPP__
|
||||
|
||||
#include <memory>
|
||||
#include "GCNTypes.hpp"
|
||||
#include "Input/CFinalInput.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
class CIOWin;
|
||||
|
||||
enum EArchMsgTarget
|
||||
{
|
||||
TargetMainFlow = 0
|
||||
};
|
||||
|
||||
enum EArchMsgType
|
||||
{
|
||||
MsgDeleteIOWin = 0,
|
||||
MsgCreateIOWin = 1,
|
||||
MsgChangeIOWinPriority = 2,
|
||||
MsgTimerTick = 4,
|
||||
MsgUserInput = 5,
|
||||
MsgSetGameState = 6,
|
||||
MsgControllerStatus = 7,
|
||||
MsgQuitGameplay = 8,
|
||||
MsgUpdateBegin = 10,
|
||||
MsgFrameBegin = 11,
|
||||
};
|
||||
|
||||
struct IArchMsgParm
|
||||
{
|
||||
virtual ~IArchMsgParm() {}
|
||||
};
|
||||
|
||||
struct CArchMsgParmInt32 : IArchMsgParm
|
||||
{
|
||||
u32 m_parm;
|
||||
CArchMsgParmInt32(u32 parm) : m_parm(parm) {}
|
||||
};
|
||||
|
||||
struct CArchMsgParmInt32Int32VoidPtr : IArchMsgParm
|
||||
{
|
||||
u32 m_parm1;
|
||||
u32 m_parm2;
|
||||
const void* m_parm3;
|
||||
CArchMsgParmInt32Int32VoidPtr(u32 parm1, u32 parm2, const void* parm3)
|
||||
: m_parm1(parm1), m_parm2(parm2), m_parm3(parm3) {}
|
||||
};
|
||||
|
||||
struct CArchMsgParmNull : IArchMsgParm
|
||||
{
|
||||
};
|
||||
|
||||
struct CArchMsgParmReal32 : IArchMsgParm
|
||||
{
|
||||
float m_parm;
|
||||
CArchMsgParmReal32(float parm) : m_parm(parm) {}
|
||||
};
|
||||
|
||||
struct CArchMsgParmUserInput : IArchMsgParm
|
||||
{
|
||||
CFinalInput m_parm;
|
||||
CArchMsgParmUserInput(const CFinalInput& parm) : m_parm(parm) {}
|
||||
};
|
||||
|
||||
struct CArchMsgParmControllerStatus : IArchMsgParm
|
||||
{
|
||||
u16 m_parm1;
|
||||
bool m_parm2;
|
||||
CArchMsgParmControllerStatus(u16 a, bool b)
|
||||
: m_parm1(a), m_parm2(b) {}
|
||||
};
|
||||
|
||||
class CArchitectureMessage
|
||||
{
|
||||
EArchMsgTarget m_target;
|
||||
EArchMsgType m_type;
|
||||
std::unique_ptr<IArchMsgParm> m_parm;
|
||||
public:
|
||||
CArchitectureMessage(EArchMsgTarget target, EArchMsgType type, IArchMsgParm* parm)
|
||||
: m_target(target), m_type(type), m_parm(parm) {}
|
||||
|
||||
EArchMsgTarget GetTarget() const {return m_target;}
|
||||
EArchMsgType GetType() const {return m_type;}
|
||||
template <class T>
|
||||
const T* GetParm() const {return dynamic_cast<T*>(m_parm.get());}
|
||||
};
|
||||
|
||||
class MakeMsg
|
||||
{
|
||||
public:
|
||||
static CArchitectureMessage CreateQuitGameplay(EArchMsgTarget target)
|
||||
{
|
||||
return CArchitectureMessage(target, MsgQuitGameplay, new CArchMsgParmNull());
|
||||
}
|
||||
static CArchitectureMessage CreateControllerStatus(EArchMsgTarget target, u16 a, bool b)
|
||||
{
|
||||
return CArchitectureMessage(target, MsgControllerStatus, new CArchMsgParmControllerStatus(a, b));
|
||||
}
|
||||
static const CArchMsgParmInt32& GetParmNewGameflowState(const CArchitectureMessage& msg)
|
||||
{
|
||||
return *msg.GetParm<CArchMsgParmInt32>();
|
||||
}
|
||||
static const CArchMsgParmUserInput& GetParmUserInput(const CArchitectureMessage& msg)
|
||||
{
|
||||
return *msg.GetParm<CArchMsgParmUserInput>();
|
||||
}
|
||||
static CArchitectureMessage CreateUserInput(EArchMsgTarget target, const CFinalInput& input)
|
||||
{
|
||||
return CArchitectureMessage(target, MsgUserInput, new CArchMsgParmUserInput(input));
|
||||
}
|
||||
static const CArchMsgParmReal32& GetParmTimerTick(const CArchitectureMessage& msg)
|
||||
{
|
||||
return *msg.GetParm<CArchMsgParmReal32>();
|
||||
}
|
||||
static CArchitectureMessage CreateTimerTick(EArchMsgTarget target, float val)
|
||||
{
|
||||
return CArchitectureMessage(target, MsgTimerTick, new CArchMsgParmReal32(val));
|
||||
}
|
||||
static const CArchMsgParmInt32Int32VoidPtr& GetParmChangeIOWinPriority(const CArchitectureMessage& msg)
|
||||
{
|
||||
return *msg.GetParm<CArchMsgParmInt32Int32VoidPtr>();
|
||||
}
|
||||
static const CArchMsgParmInt32Int32VoidPtr& GetParmCreateIOWin(const CArchitectureMessage& msg)
|
||||
{
|
||||
return *msg.GetParm<CArchMsgParmInt32Int32VoidPtr>();
|
||||
}
|
||||
static CArchitectureMessage CreateCreateIOWin(EArchMsgTarget target, int pmin, int pmax, const CIOWin* iowin)
|
||||
{
|
||||
return CArchitectureMessage(target, MsgCreateIOWin, new CArchMsgParmInt32Int32VoidPtr(pmin, pmax, iowin));
|
||||
}
|
||||
static const CArchMsgParmInt32Int32VoidPtr& GetParmDeleteIOWin(const CArchitectureMessage& msg)
|
||||
{
|
||||
return *msg.GetParm<CArchMsgParmInt32Int32VoidPtr>();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __RETRO_CARCHITECTUREMESSAGE_HPP__
|
|
@ -0,0 +1,30 @@
|
|||
#ifndef __RETRO_CARCHITECTUREQUEUE_HPP__
|
||||
#define __RETRO_CARCHITECTUREQUEUE_HPP__
|
||||
|
||||
#include <list>
|
||||
#include "CArchitectureMessage.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
class CArchitectureQueue
|
||||
{
|
||||
std::list<CArchitectureMessage> m_list;
|
||||
public:
|
||||
void PushMessage(CArchitectureMessage&& msg)
|
||||
{
|
||||
m_list.push_back(std::move(msg));
|
||||
}
|
||||
const CArchitectureMessage& PeekMessage() const
|
||||
{
|
||||
return m_list.front();
|
||||
}
|
||||
void PopMessage()
|
||||
{
|
||||
m_list.pop_front();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __RETRO_CARCHITECTUREQUEUE_HPP__
|
|
@ -6,6 +6,13 @@ namespace Retro
|
|||
|
||||
class CGameOptions
|
||||
{
|
||||
char a = 0;
|
||||
char b = 0;
|
||||
char c = 128;
|
||||
char d = 128;
|
||||
char e = 255;
|
||||
char f = 255;
|
||||
bool g = true;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -3,4 +3,12 @@
|
|||
namespace Retro
|
||||
{
|
||||
|
||||
CGameState::CGameState(CInputStream& stream)
|
||||
: m_stateFlag(stream.readUint32Big()), m_playerState(stream), m_gameTime(stream.readFloatBig())
|
||||
{}
|
||||
|
||||
void CGameState::SetCurrentWorldId(unsigned int id, const std::string& name)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,20 +2,26 @@
|
|||
#define __RETRO_CGAMESTATE_HPP__
|
||||
|
||||
#include <memory>
|
||||
#include "CBasics.hpp"
|
||||
#include "CPlayerState.hpp"
|
||||
#include "CGameOptions.hpp"
|
||||
#include "CWorldTransManager.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
class CGameState
|
||||
{
|
||||
int m_stateFlag = -1;
|
||||
TOneStatic<CPlayerState> m_playerState;
|
||||
CWorldTransManager m_transManager;
|
||||
float m_gameTime = 0.0;
|
||||
CGameOptions m_gameOpts;
|
||||
public:
|
||||
CGameState()
|
||||
{
|
||||
}
|
||||
CGameState() {}
|
||||
CGameState(CInputStream& stream);
|
||||
void SetCurrentWorldId(unsigned int id, const std::string& name);
|
||||
CWorldTransManager& WorldTransitionManager() {return m_transManager;}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,23 @@
|
|||
#ifndef __RETRO_CIOWIN_HPP__
|
||||
#define __RETRO_CIOWIN_HPP__
|
||||
|
||||
#include <string>
|
||||
#include "CArchitectureMessage.hpp"
|
||||
#include "CArchitectureQueue.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
class CIOWin
|
||||
{
|
||||
const char* m_name;
|
||||
public:
|
||||
virtual ~CIOWin() {}
|
||||
CIOWin(const char* name) : m_name(name) {}
|
||||
virtual bool OnMessage(const CArchitectureMessage&, CArchitectureQueue&)=0;
|
||||
virtual bool GetIsContinueDraw() const {return true;}
|
||||
virtual void Draw() const {}
|
||||
virtual void PreDraw() const {}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
#include "CIOWinManager.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
bool CIOWinManager::OnIOWinMessage(const CArchitectureMessage& msg)
|
||||
{
|
||||
switch (msg.GetType())
|
||||
{
|
||||
case MsgChangeIOWinPriority:
|
||||
{
|
||||
const CArchMsgParmInt32Int32VoidPtr& parm = MakeMsg::GetParmChangeIOWinPriority(msg);
|
||||
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,11 +1,25 @@
|
|||
#ifndef __RETRO_CIOWINMANAGER_HPP__
|
||||
#define __RETRO_CIOWINMANAGER_HPP__
|
||||
|
||||
#include <memory>
|
||||
#include "CIOWin.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
class CIOWinManager
|
||||
{
|
||||
struct IOWinPQNode
|
||||
{
|
||||
std::shared_ptr<CIOWin> m_iowin;
|
||||
int m_prio;
|
||||
CIOWinManager::IOWinPQNode* m_prev;
|
||||
IOWinPQNode(std::weak_ptr<CIOWin> iowin, int prio,
|
||||
CIOWinManager::IOWinPQNode* prev)
|
||||
: m_iowin(iowin), m_prio(prio), m_prev(prev) {}
|
||||
std::shared_ptr<CIOWin> GetIOWin() const {return m_iowin;}
|
||||
};
|
||||
bool OnIOWinMessage(const CArchitectureMessage& msg);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef __RETRO_CMFGAME_HPP__
|
||||
#define __RETRO_CMFGAME_HPP__
|
||||
|
||||
#include "CIOWin.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
class CMFGameLoader : public CIOWin
|
||||
{
|
||||
public:
|
||||
CMFGameLoader() : CIOWin("CMFGameLoader") {}
|
||||
bool OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue);
|
||||
void Draw() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __RETRO_CMFGAME_HPP__
|
|
@ -0,0 +1,27 @@
|
|||
#include "CMainFlow.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
#include "CGameState.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
bool CMFGameLoader::OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue)
|
||||
{
|
||||
switch (msg.GetType())
|
||||
{
|
||||
case MsgTimerTick:
|
||||
{
|
||||
const CArchMsgParmReal32& tick = MakeMsg::GetParmTimerTick(msg);
|
||||
g_GameState->WorldTransitionManager();
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CMFGameLoader::Draw() const
|
||||
{
|
||||
g_GameState->WorldTransitionManager().Draw();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,11 +1,53 @@
|
|||
#ifndef __RETRO_CMAINFLOW_HPP__
|
||||
#define __RETRO_CMAINFLOW_HPP__
|
||||
|
||||
#include "CIOWin.hpp"
|
||||
#include "CMFGame.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
class CMainFlow
|
||||
enum EClientFlowStates
|
||||
{
|
||||
StateGameLoad = 13,
|
||||
};
|
||||
|
||||
class CMainFlow : public CIOWin
|
||||
{
|
||||
public:
|
||||
CMainFlow() : CIOWin("CMainFlow") {}
|
||||
void AdvanceGameState(CArchitectureQueue& queue)
|
||||
{
|
||||
}
|
||||
void SetGameState(EClientFlowStates state, CArchitectureQueue& queue)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case StateGameLoad:
|
||||
queue.PushMessage(std::move(MakeMsg::CreateCreateIOWin(TargetMainFlow, 10, 1000, new CMFGameLoader())));
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
bool OnMessage(const CArchitectureMessage& msg, CArchitectureQueue& queue)
|
||||
{
|
||||
switch (msg.GetType())
|
||||
{
|
||||
case MsgTimerTick:
|
||||
AdvanceGameState(queue);
|
||||
break;
|
||||
case MsgSetGameState:
|
||||
{
|
||||
CArchMsgParmInt32 state = MakeMsg::GetParmNewGameflowState(msg);
|
||||
SetGameState(EClientFlowStates(state.m_parm), queue);
|
||||
return true;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool GetIsContinueDraw() const {return false;}
|
||||
void Draw() const {}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -29,12 +29,16 @@ add_library(RuntimeCommon
|
|||
CSimplePool.hpp CSimplePool.cpp
|
||||
CAi.hpp CAi.cpp
|
||||
CGameOptions.hpp CGameOptions.cpp
|
||||
CStaticInterference.hpp CStaticInterference.cpp
|
||||
CStaticInterference.hpp
|
||||
CCRC32.hpp CCRC32.cpp
|
||||
CEntity.hpp CEntity.cpp
|
||||
IFactory.hpp
|
||||
ScriptObjectSupport.hpp ScriptObjectSupport.cpp
|
||||
CObjectList.hpp CObjectList.cpp
|
||||
CObjectList.hpp
|
||||
CMFGame.hpp CMFGame.cpp
|
||||
CMainFlow.hpp CMainFlow.cpp
|
||||
CArchitectureMessage.hpp
|
||||
CArchitectureQueue.hpp CArchitectureQueue.cpp
|
||||
GameGlobalObjects.hpp
|
||||
RetroTypes.hpp
|
||||
GCNTypes.hpp)
|
||||
|
|
|
@ -3,4 +3,10 @@
|
|||
namespace Retro
|
||||
{
|
||||
|
||||
CPlayerState::CPlayerState(CInputStream& stream)
|
||||
: m_staticIntf(5)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#define __RETRO_CPLAYERSTATE_HPP__
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
#include "CBasics.hpp"
|
||||
#include "CStaticInterference.hpp"
|
||||
|
||||
namespace Retro
|
||||
|
@ -12,13 +13,17 @@ class CPlayerState
|
|||
CStaticInterference m_staticIntf;
|
||||
class CPowerUp
|
||||
{
|
||||
int m_a;
|
||||
int m_b;
|
||||
int m_a = 0;
|
||||
int m_b = 0;
|
||||
public:
|
||||
CPowerUp() : m_a(-1), m_b(-1) {}
|
||||
CPowerUp() {}
|
||||
CPowerUp(int a, int b) : m_a(a), m_b(b) {}
|
||||
};
|
||||
CPowerUp m_powerups[29];
|
||||
|
||||
public:
|
||||
CPlayerState() : m_staticIntf(5) {}
|
||||
CPlayerState(CInputStream& stream);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
#include "CStaticInterference.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
}
|
|
@ -1,11 +1,73 @@
|
|||
#ifndef __RETRO_CSTATICINTERFERENCE_HPP__
|
||||
#define __RETRO_CSTATICINTERFERENCE_HPP__
|
||||
|
||||
#include <vector>
|
||||
#include "RetroTypes.hpp"
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
class CStateManager;
|
||||
|
||||
struct CStaticInterferenceSource
|
||||
{
|
||||
TUniqueId id;
|
||||
float magnitude;
|
||||
float timeLeft;
|
||||
};
|
||||
|
||||
class CStaticInterference
|
||||
{
|
||||
std::vector<CStaticInterferenceSource> m_sources;
|
||||
public:
|
||||
CStaticInterference(int sourceCount)
|
||||
{
|
||||
m_sources.reserve(sourceCount);
|
||||
}
|
||||
void AddSource(TUniqueId id, float magnitude, float duration)
|
||||
{
|
||||
for (CStaticInterferenceSource& src : m_sources)
|
||||
{
|
||||
if (src.id == id)
|
||||
{
|
||||
src.magnitude = magnitude;
|
||||
src.timeLeft = duration;
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_sources.push_back({id, magnitude, duration});
|
||||
}
|
||||
void Update(CStateManager&, float dt)
|
||||
{
|
||||
std::vector<CStaticInterferenceSource> newSources;
|
||||
newSources.reserve(m_sources.size());
|
||||
for (CStaticInterferenceSource& src : m_sources)
|
||||
{
|
||||
if (src.timeLeft >= 0.0)
|
||||
{
|
||||
src.timeLeft -= dt;
|
||||
newSources.push_back(src);
|
||||
}
|
||||
}
|
||||
m_sources = std::move(newSources);
|
||||
}
|
||||
float GetTotalInterference() const
|
||||
{
|
||||
float validAccum = 0.0;
|
||||
float invalidAccum = 0.0;
|
||||
for (const CStaticInterferenceSource& src : m_sources)
|
||||
{
|
||||
if (src.id == kInvalidUniqueId)
|
||||
invalidAccum += src.magnitude;
|
||||
else
|
||||
validAccum += src.magnitude;
|
||||
}
|
||||
if (validAccum > 0.80000001)
|
||||
validAccum = 0.80000001;
|
||||
validAccum += invalidAccum;
|
||||
if (validAccum > 1.0)
|
||||
return 1.0;
|
||||
return validAccum;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -3,4 +3,12 @@
|
|||
namespace Retro
|
||||
{
|
||||
|
||||
void CWorldTransManager::DrawEnabled() const
|
||||
{
|
||||
}
|
||||
|
||||
void CWorldTransManager::DrawDisabled() const
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,17 @@ namespace Retro
|
|||
|
||||
class CWorldTransManager
|
||||
{
|
||||
bool m_drawEnabled;
|
||||
public:
|
||||
void DrawEnabled() const;
|
||||
void DrawDisabled() const;
|
||||
void Draw() const
|
||||
{
|
||||
if (m_drawEnabled)
|
||||
DrawEnabled();
|
||||
else
|
||||
DrawDisabled();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef __RETRO_CFINALINPUT_HPP__
|
||||
#define __RETRO_CFINALINPUT_HPP__
|
||||
|
||||
namespace Retro
|
||||
{
|
||||
|
||||
class CFinalInput
|
||||
{
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __RETRO_CFINALINPUT_HPP__
|
|
@ -1,2 +1,3 @@
|
|||
add_library(RuntimeCommonInput
|
||||
CInputGenerator.hpp CInputGenerator.cpp)
|
||||
CInputGenerator.hpp CInputGenerator.cpp
|
||||
CFinalInput.hpp CFinalInput.cpp)
|
||||
|
|
|
@ -87,6 +87,7 @@ public:
|
|||
|
||||
class CGameArchitectureSupport
|
||||
{
|
||||
CArchitectureQueue m_archQueue;
|
||||
CAudioSys m_audioSys;
|
||||
CInputGenerator m_inputGenerator;
|
||||
CGuiSys m_guiSys;
|
||||
|
@ -100,13 +101,18 @@ public:
|
|||
: m_audioSys(0,0,0,0,0)
|
||||
{
|
||||
}
|
||||
bool Update()
|
||||
{
|
||||
bool finished = false;
|
||||
return finished;
|
||||
}
|
||||
};
|
||||
|
||||
class CMain : public COsContext
|
||||
{
|
||||
CMemorySys m_memSys;
|
||||
CTweaks m_tweaks;
|
||||
bool m_run = true;
|
||||
bool m_finished = false;
|
||||
public:
|
||||
CMain()
|
||||
: m_memSys(*this, CMemorySys::GetGameAllocator())
|
||||
|
@ -135,9 +141,9 @@ public:
|
|||
g_TweakManager->ReadFromMemoryCard("AudioTweaks");
|
||||
FillInAssetIDs();
|
||||
TOneStatic<CGameArchitectureSupport> archSupport(*this);
|
||||
while (m_run)
|
||||
while (!m_finished)
|
||||
{
|
||||
|
||||
m_finished = archSupport->Update();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef __RETRO_TYPES_HPP__
|
||||
#define __RETRO_TYPES_HPP__
|
||||
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include "GCNTypes.hpp"
|
||||
|
||||
|
@ -42,10 +43,24 @@ public:
|
|||
template<class T> u8 TOneStatic<T>::m_allocspace[sizeof(T)];
|
||||
template<class T> u32 TOneStatic<T>::m_refCount;
|
||||
|
||||
using TUniqueId = s16;
|
||||
using TUniqueId = u16;
|
||||
using TEditorId = u32;
|
||||
using TAreaId = u32;
|
||||
|
||||
#define kInvalidEditorId TEditorId(-1)
|
||||
#define kInvalidUniqueId TUniqueId(-1)
|
||||
#define kInvalidAreaId TAreaId(-1)
|
||||
|
||||
}
|
||||
|
||||
namespace rstl
|
||||
{
|
||||
template <class T, size_t N>
|
||||
class reserved_vector : public std::vector<T>
|
||||
{
|
||||
public:
|
||||
reserved_vector() {this->reserve(N);}
|
||||
};
|
||||
}
|
||||
|
||||
#endif // __RETRO_TYPES_HPP__
|
||||
|
|
Loading…
Reference in New Issue