Various CStateManager additions and camera stubs

This commit is contained in:
Jack Andersen 2016-04-16 11:49:47 -10:00
parent e51a657ec1
commit 042030934b
44 changed files with 778 additions and 124 deletions

View File

@ -7,6 +7,7 @@
namespace urde
{
class CStateManager;
class IVisitor;
struct SConnection
{
@ -34,12 +35,14 @@ protected:
public:
virtual ~CEntity() {}
CEntity(TUniqueId uid, const CEntityInfo& info, bool active);
virtual void Accept(IVisitor&)=0;
virtual void PreThink(float, CStateManager&) {}
virtual void Think(float, CStateManager&) {}
virtual void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr);
virtual bool GetActive() const {return m_active;}
virtual void SetActive(bool active) {m_active = active;}
TUniqueId GetUniqueId() const {return m_uid;}
void SendScriptMsgs(EScriptObjectState state, CStateManager& stateMgr, EScriptObjectMessage msg);
};

View File

@ -13,7 +13,7 @@ namespace urde
class CGameState
{
int m_stateFlag = -1;
TOneStatic<CPlayerState> m_playerState;
CPlayerState m_playerState;
CWorldTransManager m_transManager;
float m_gameTime = 0.0;
CGameOptions m_gameOpts;

View File

@ -4,6 +4,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${BOO_INCLUDE_DIR}
add_subdirectory(Audio)
add_subdirectory(Character)
add_subdirectory(Graphics)
add_subdirectory(Camera)
add_subdirectory(GuiSys)
add_subdirectory(Input)
add_subdirectory(Particle)
@ -48,7 +49,9 @@ add_library(RuntimeCommon
IFactory.hpp
IObjFactory.hpp
ScriptObjectSupport.hpp ScriptObjectSupport.cpp
CObjectList.hpp
CObjectList.hpp CObjectList.cpp
GameObjectLists.hpp GameObjectLists.cpp
CSortedLists.hpp CSortedLists.cpp
CArchitectureMessage.hpp
CArchitectureQueue.hpp CArchitectureQueue.cpp
IObj.hpp

66
Runtime/CObjectList.cpp Normal file
View File

@ -0,0 +1,66 @@
#include "CObjectList.hpp"
namespace urde
{
CObjectList::CObjectList(EGameObjectList listEnum)
: m_listEnum(listEnum)
{}
void CObjectList::AddObject(CEntity& entity)
{
if (IsQualified())
{
if (m_lastId != -1)
m_list[m_lastId].next = entity.GetUniqueId() & 0x3ff;
TUniqueId prevLast = m_lastId;
m_lastId = entity.GetUniqueId() & 0x3ff;
SObjectListEntry& newEnt = m_list[m_lastId];
newEnt.entity = &entity;
newEnt.prev = prevLast;
newEnt.next = -1;
++m_count;
}
}
void CObjectList::RemoveObject(TUniqueId uid)
{
uid = uid & 0x3ff;
SObjectListEntry& ent = m_list[uid];
if (!ent.entity || ent.entity->GetUniqueId() != uid)
return;
if (uid == m_lastId)
{
m_lastId = ent.prev;
if (ent.prev != -1)
m_list[ent.prev].next = -1;
}
else
{
if (ent.prev != -1)
m_list[ent.prev].next = -1;
m_list[ent.next].prev = -1;
}
ent.entity = nullptr;
ent.prev = -1;
ent.next = -1;
--m_count;
}
const CEntity* CObjectList::GetObjectById(TUniqueId uid) const
{
if (!uid)
return nullptr;
return m_list[uid & 0x3ff].entity;
}
CEntity* CObjectList::GetObjectById(TUniqueId uid)
{
if (!uid)
return nullptr;
return m_list[uid & 0x3ff].entity;
}
bool CObjectList::IsQualified() {return true;}
}

View File

@ -32,65 +32,13 @@ class CObjectList
TUniqueId m_lastId = -1;
u16 m_count = 0;
public:
CObjectList(EGameObjectList listEnum)
: m_listEnum(listEnum)
{}
CObjectList(EGameObjectList listEnum);
void AddObject(CEntity& entity)
{
if (IsQualified())
{
if (m_lastId != -1)
m_list[m_lastId].next = entity.m_uid & 0x3ff;
TUniqueId prevLast = m_lastId;
m_lastId = entity.m_uid & 0x3ff;
SObjectListEntry& newEnt = m_list[m_lastId];
newEnt.entity = &entity;
newEnt.prev = prevLast;
newEnt.next = -1;
++m_count;
}
}
void RemoveObject(TUniqueId uid)
{
uid = uid & 0x3ff;
SObjectListEntry& ent = m_list[uid];
if (!ent.entity || ent.entity->m_uid != uid)
return;
if (uid == m_lastId)
{
m_lastId = ent.prev;
if (ent.prev != -1)
m_list[ent.prev].next = -1;
}
else
{
if (ent.prev != -1)
m_list[ent.prev].next = -1;
m_list[ent.next].prev = -1;
}
ent.entity = nullptr;
ent.prev = -1;
ent.next = -1;
--m_count;
}
const CEntity* GetObjectById(TUniqueId uid) const
{
if (!uid)
return nullptr;
return m_list[uid & 0x3ff].entity;
}
CEntity* GetObjectById(TUniqueId uid)
{
if (!uid)
return nullptr;
return m_list[uid & 0x3ff].entity;
}
virtual bool IsQualified() {return true;}
void AddObject(CEntity& entity);
void RemoveObject(TUniqueId uid);
const CEntity* GetObjectById(TUniqueId uid) const;
CEntity* GetObjectById(TUniqueId uid);
virtual bool IsQualified();
};
}

18
Runtime/CSortedLists.cpp Normal file
View File

@ -0,0 +1,18 @@
#include "CSortedLists.hpp"
namespace urde
{
CSortedListManager::CSortedListManager()
{
Reset();
}
void CSortedListManager::Reset()
{
std::fill(std::begin(x0_nodes), std::end(x0_nodes), SNode());
for (int i=0 ; i<6 ; ++i)
xb000_sortedLists[i].Reset();
}
}

38
Runtime/CSortedLists.hpp Normal file
View File

@ -0,0 +1,38 @@
#ifndef __URDE_CSORTEDLISTS_HPP__
#define __URDE_CSORTEDLISTS_HPP__
#include "RetroTypes.hpp"
#include "zeus/CAABox.hpp"
namespace urde
{
struct SSortedList
{
TUniqueId x0_ids[1024];
void Reset() {std::fill(std::begin(x0_ids), std::end(x0_ids), -1);}
SSortedList() {Reset();}
};
class CSortedListManager
{
struct SNode
{
u32 x0_ = 0;
zeus::CAABox x4_box = zeus::CAABox::skNullBox;
u32 x1c_;
u32 x20_;
u32 x24_;
u32 x28_ = -1;
bool x2a_ = false;
};
SNode x0_nodes[1024];
SSortedList xb000_sortedLists[6];
public:
CSortedListManager();
void Reset();
};
}
#endif // __URDE_CSORTEDLISTS_HPP__

View File

@ -3,6 +3,13 @@
namespace urde
{
CStateManager::CStateManager(const std::weak_ptr<CScriptMailbox>&,
const std::weak_ptr<CMapWorldInfo>&,
const std::weak_ptr<CPlayerState>&,
const std::weak_ptr<CWorldTransManager>&)
{
}
void CStateManager::SendScriptMsg(TUniqueId uid, TEditorId eid, EScriptObjectMessage msg, EScriptObjectState state)
{
}

View File

@ -4,6 +4,8 @@
#include <memory>
#include "CBasics.hpp"
#include "ScriptObjectSupport.hpp"
#include "GameObjectLists.hpp"
#include "Camera/CCameraManager.hpp"
namespace urde
{
@ -11,10 +13,27 @@ class CScriptMailbox;
class CMapWorldInfo;
class CPlayerState;
class CWorldTransManager;
class CObjectList;
class CStateManager
{
TUniqueId x8_idArr[1024] = {};
std::unique_ptr<CObjectList> x80c_allObjs;
std::unique_ptr<CActorList> x814_allObjs;
std::unique_ptr<CPhysicsActorList> x81c_allObjs;
std::unique_ptr<CGameCameraList> x824_allObjs;
std::unique_ptr<CGameLightList> x82c_allObjs;
std::unique_ptr<CListeningAiList> x834_allObjs;
std::unique_ptr<CAiWaypointList> x83c_allObjs;
std::unique_ptr<CPlatformAndDoorList> x844_allObjs;
std::list<u32> x858_;
// x86c_stateManagerContainer;
std::shared_ptr<CPlayerState> x8b8_playerState;
public:
CStateManager(const std::weak_ptr<CScriptMailbox>&,
const std::weak_ptr<CMapWorldInfo>&,
@ -31,6 +50,7 @@ public:
}
void SendScriptMsg(TUniqueId uid, TEditorId eid, EScriptObjectMessage msg, EScriptObjectState state);
TUniqueId AllocateUniqueId();
};
}

View File

View File

@ -0,0 +1,17 @@
#ifndef __URDE_CBALLCAMERA_HPP__
#define __URDE_CBALLCAMERA_HPP__
#include "CGameCamera.hpp"
namespace urde
{
class CBallCamera : public CGameCamera
{
public:
CBallCamera(TUniqueId, TUniqueId, const zeus::CTransform& xf, float, float, float, float);
};
}
#endif // __URDE_CBALLCAMERA_HPP__

View File

@ -0,0 +1,10 @@
#include "CCameraManager.hpp"
namespace urde
{
CCameraManager::CCameraManager(TUniqueId id)
{
}
}

View File

@ -0,0 +1,39 @@
#ifndef __URDE_CCAMERAMANAGER_HPP__
#define __URDE_CCAMERAMANAGER_HPP__
#include "RetroTypes.hpp"
#include "zeus/CVector3f.hpp"
namespace urde
{
class CFirstPersonCamera;
class CBallCamera;
class CStateManager;
class CCameraManager
{
TUniqueId x0_id;
std::vector<TUniqueId> x4_cineCameras;
CFirstPersonCamera* x7c_fpCamera;
CBallCamera* x80_ballCamera;
public:
CCameraManager(TUniqueId id);
void SetSpecialCameras(CFirstPersonCamera& fp, CBallCamera& ball)
{
x7c_fpCamera = &fp;
x80_ballCamera = &ball;
}
bool IsInCinematicCamera() const {return x4_cineCameras.size() != 0;}
zeus::CVector3f GetGlobalCameraTranslation(const CStateManager& stateMgr) const;
zeus::CTransform GetGlobalCameraTransform(const CStateManager& stateMgr) const;
void RemoveCameraShaker(int);
void AddCinemaCamera(TUniqueId, CStateManager& stateMgr);
void SetInsideFluid(bool, TUniqueId);
void Update(float dt, CStateManager& stateMgr);
};
}
#endif // __URDE_CCAMERAMANAGER_HPP__

View File

View File

@ -0,0 +1,18 @@
#ifndef __URDE_CCINEMATICCAMERA_HPP__
#define __URDE_CCINEMATICCAMERA_HPP__
#include "CGameCamera.hpp"
namespace urde
{
class CCinematicCamera : public CGameCamera
{
public:
CCinematicCamera(TUniqueId, const std::string& name, const CEntityInfo& info,
const zeus::CTransform& xf, bool, float, float, float, float, float, u32);
};
}
#endif // __URDE_CCINEMATICCAMERA_HPP__

View File

View File

@ -0,0 +1,17 @@
#ifndef __URDE_CFIRSTPERSONCAMERA_HPP__
#define __URDE_CFIRSTPERSONCAMERA_HPP__
#include "CGameCamera.hpp"
namespace urde
{
class CFirstPersonCamera : public CGameCamera
{
public:
CFirstPersonCamera(TUniqueId, const zeus::CTransform& xf, TUniqueId, float, float, float, float, float);
};
}
#endif // __URDE_CFIRSTPERSONCAMERA_HPP__

View File

View File

@ -0,0 +1,16 @@
#ifndef __URDE_CGAMECAMERA_HPP__
#define __URDE_CGAMECAMERA_HPP__
#include "CActor.hpp"
namespace urde
{
class CGameCamera : public CActor
{
public:
};
}
#endif // __URDE_CGAMECAMERA_HPP__

View File

@ -0,0 +1,7 @@
add_library(RuntimeCommonCamera
CCameraManager.hpp CCameraManager.cpp
CGameCamera.hpp CGameCamera.cpp
CFirstPersonCamera.hpp CFirstPersonCamera.cpp
CBallCamera.hpp CBallCamera.cpp
CPathCamera.hpp CPathCamera.cpp
CCinematicCamera.hpp CCinematicCamera.cpp)

View File

View File

@ -0,0 +1,23 @@
#ifndef __URDE_CPATHCAMERA_HPP__
#define __URDE_CPATHCAMERA_HPP__
#include "CGameCamera.hpp"
namespace urde
{
class CPathCamera : public CGameCamera
{
public:
enum class EInitialSplinePosition
{
};
CPathCamera(TUniqueId, const std::string& name, const CEntityInfo& info,
const zeus::CTransform& xf, bool, bool, bool, bool, bool,
float, float, float, float, float, float, float, u32,
EInitialSplinePosition);
};
}
#endif // __URDE_CPATHCAMERA_HPP__

View File

@ -1,33 +1,114 @@
#include "CAdditiveAnimPlayback.hpp"
#include "CSegStatementSet.hpp"
#include "CCharLayoutInfo.hpp"
#include "CAnimTreeNode.hpp"
namespace urde
{
CAdditiveAnimPlayback::CAdditiveAnimPlayback(const std::weak_ptr<CAnimTreeNode>& anim, float weight, bool a,
const CAdditiveAnimationInfo& info, bool b)
: x0_info(info), x8_anim(anim), xc_weight(weight), x14_a(a)
CAdditiveAnimPlayback::CAdditiveAnimPlayback(const std::weak_ptr<CAnimTreeNode>& anim,
float weight, bool a, const CAdditiveAnimationInfo& info, bool b)
: x0_info(info), x8_anim(anim.lock()), xc_targetWeight(weight), x14_a(a)
{
if (!a && b)
x20_ = true;
}
void CAdditiveAnimPlayback::AddToSegStatementSet(const CSegIdList& list,
const CCharLayoutInfo&,
CSegStatementSet&) const
const CCharLayoutInfo& layout,
CSegStatementSet& setOut) const
{
CSegStatementSet stackSet;
x8_anim->VGetSegStatementSet(list, stackSet);
for (const CSegId& id : list.GetList())
{
CAnimPerSegmentData& data = stackSet.x4_segData[id];
data.x10_offset = layout.GetFromParentUnrotated(id);
data.x1c_hasOffset = true;
}
setOut.Add(list, layout, stackSet, x10_curWeight);
}
void CAdditiveAnimPlayback::Update(float dt)
{
switch (x1c_phase)
{
case EAdditivePlaybackPhase::FadingIn:
{
float a = x0_info.GetFadeInDuration();
float b = x18_weightTimer + dt;
x18_weightTimer = std::min(b, a);
if (a > 0.f)
x10_curWeight = x18_weightTimer / a * xc_targetWeight;
else
x10_curWeight = xc_targetWeight;
if (std::fabs(x10_curWeight - xc_targetWeight) < 0.00001f)
x1c_phase = EAdditivePlaybackPhase::FadedIn;
break;
}
case EAdditivePlaybackPhase::FadingOut:
{
float a = x18_weightTimer - dt;
x18_weightTimer = std::max(a, 0.f);
if (x0_info.GetFadeOutDuration() > 0.f)
x10_curWeight = x18_weightTimer / x0_info.GetFadeOutDuration() * xc_targetWeight;
else
x10_curWeight = 0.f;
if (std::fabs(x10_curWeight) < 0.00001f)
x1c_phase = EAdditivePlaybackPhase::FadedOut;
}
default: break;
}
}
void CAdditiveAnimPlayback::FadeOut()
{
switch (x1c_phase)
{
case EAdditivePlaybackPhase::FadedOut:
case EAdditivePlaybackPhase::FadedIn:
x18_weightTimer = x0_info.GetFadeOutDuration();
break;
case EAdditivePlaybackPhase::FadingIn:
x18_weightTimer = x18_weightTimer / x0_info.GetFadeInDuration() * x0_info.GetFadeOutDuration();
default: break;
}
if (x0_info.GetFadeOutDuration() > 0.f)
x1c_phase = EAdditivePlaybackPhase::FadingOut;
else
x1c_phase = EAdditivePlaybackPhase::FadedOut;
x10_curWeight = 0.f;
}
void CAdditiveAnimPlayback::SetWeight(float w)
{
xc_targetWeight = w;
switch (x1c_phase)
{
case EAdditivePlaybackPhase::FadingIn:
{
if (x0_info.GetFadeInDuration() > 0.f)
x10_curWeight = x18_weightTimer / x0_info.GetFadeInDuration() * xc_targetWeight;
else
x10_curWeight = xc_targetWeight;
break;
}
case EAdditivePlaybackPhase::FadingOut:
{
if (x0_info.GetFadeOutDuration() > 0.f)
x10_curWeight = x18_weightTimer / x0_info.GetFadeOutDuration() * xc_targetWeight;
else
x10_curWeight = xc_targetWeight;
break;
}
default:
x10_curWeight = xc_targetWeight;
break;
}
}
}

View File

@ -13,37 +13,39 @@ class CSegStatementSet;
class CAdditiveAnimationInfo
{
float x0_a = 0.f;
float x4_b = 0.f;
float x0_fadeInDur = 0.f;
float x4_fadeOutDur = 0.f;
public:
void read(CInputStream& in)
{
x0_a = in.readFloatBig();
x4_b = in.readFloatBig();
x0_fadeInDur = in.readFloatBig();
x4_fadeOutDur = in.readFloatBig();
}
CAdditiveAnimationInfo() = default;
CAdditiveAnimationInfo(CInputStream& in) {read(in);}
float GetFadeInDuration() const {return x0_fadeInDur;}
float GetFadeOutDuration() const {return x4_fadeOutDur;}
};
class CAdditiveAnimPlayback
{
public:
enum class EAdditivePlaybackState
enum class EAdditivePlaybackPhase
{
Zero,
One,
Two,
Three,
Four
None,
FadingIn,
FadingOut,
FadedIn,
FadedOut
};
private:
CAdditiveAnimationInfo x0_info;
std::weak_ptr<CAnimTreeNode> x8_anim;
float xc_weight;
float x10_ = 0.f;
std::shared_ptr<CAnimTreeNode> x8_anim;
float xc_targetWeight;
float x10_curWeight = 0.f;
bool x14_a;
float x18_ = 0.f;
EAdditivePlaybackState x1c_ = EAdditivePlaybackState::One;
float x18_weightTimer = 0.f;
EAdditivePlaybackPhase x1c_phase = EAdditivePlaybackPhase::FadingIn;
bool x20_ = false;
public:
CAdditiveAnimPlayback(const std::weak_ptr<CAnimTreeNode>& anim, float weight, bool a,
@ -53,6 +55,9 @@ public:
void Update(float dt);
void FadeOut();
void SetWeight(float w);
float GetTargetWeight() const {return xc_targetWeight;}
bool GetA() const {return x14_a;}
const std::shared_ptr<CAnimTreeNode>& GetAnim() const {return x8_anim;}
};
}

View File

@ -6,10 +6,20 @@
#include "CAnimationManager.hpp"
#include "CTransitionManager.hpp"
#include "CAdditiveAnimPlayback.hpp"
#include "CBoolPOINode.hpp"
#include "CInt32POINode.hpp"
#include "CParticlePOINode.hpp"
#include "CSoundPOINode.hpp"
#include "CParticleGenInfo.hpp"
#include "IAnimReader.hpp"
#include "CAnimTreeNode.hpp"
namespace urde
{
rstl::reserved_vector<CBoolPOINode, 8>CAnimData::g_BoolPOINodes;
rstl::reserved_vector<CInt32POINode, 16> CAnimData::g_Int32POINodes;
rstl::reserved_vector<CParticlePOINode, 20> CAnimData::g_ParticlePOINodes;
rstl::reserved_vector<CSoundPOINode, 20> CAnimData::g_SoundPOINodes;
void CAnimData::FreeCache()
{
@ -45,6 +55,14 @@ CAnimData::CAnimData(ResId id,
{
if (iceModel)
xe4_iceModelData = *iceModel;
g_BoolPOINodes.resize(8);
g_Int32POINodes.resize(16);
g_ParticlePOINodes.resize(20);
g_SoundPOINodes.resize(20);
x108_aabb = xd8_modelData->GetModel()->GetAABB();
x120_particleDB.CacheParticleDesc(xc_charInfo.GetParticleResData());
}
ResId CAnimData::GetEventResourceIdForAnimResourceId(ResId id) const
@ -54,12 +72,34 @@ ResId CAnimData::GetEventResourceIdForAnimResourceId(ResId id) const
void CAnimData::AddAdditiveSegData(const CSegIdList& list, CSegStatementSet& stSet)
{
for (std::pair<u32, CAdditiveAnimPlayback>& additive : x1044_additiveAnims)
if (additive.second.GetTargetWeight() > 0.00001f)
additive.second.AddToSegStatementSet(list, *xcc_layoutData.GetObj(), stSet);
}
void CAnimData::AdvanceAdditiveAnims(float)
static void AdvanceAnimationTree(std::weak_ptr<CAnimTreeNode>& anim, const CCharAnimTime& dt)
{
}
void CAnimData::AdvanceAdditiveAnims(float dt)
{
CCharAnimTime time(dt);
for (std::pair<u32, CAdditiveAnimPlayback>& additive : x1044_additiveAnims)
{
if (additive.second.GetA())
{
while (time.GreaterThanZero() && std::fabs(time) >= 0.00001f)
{
//additive.second.GetAnim()->GetInt32POIList(time, );
}
}
else
{
}
}
}
void CAnimData::UpdateAdditiveAnims(float)
{
}

View File

@ -37,6 +37,10 @@ class CAnimTreeNode;
class CSegIdList;
class CSegStatementSet;
class CAdditiveAnimPlayback;
class CBoolPOINode;
class CInt32POINode;
class CParticlePOINode;
class CSoundPOINode;
struct SAdvancementDeltas;
class CAnimData
@ -99,6 +103,11 @@ class CAnimData
u32 x1040_ = 0;
rstl::reserved_vector<std::pair<u32, CAdditiveAnimPlayback>, 8> x1044_additiveAnims;
static rstl::reserved_vector<CBoolPOINode, 8> g_BoolPOINodes;
static rstl::reserved_vector<CInt32POINode, 16> g_Int32POINodes;
static rstl::reserved_vector<CParticlePOINode, 20> g_ParticlePOINodes;
static rstl::reserved_vector<CSoundPOINode, 20> g_SoundPOINodes;
public:
CAnimData(ResId,
const CCharacterInfo& character,

View File

@ -10,6 +10,7 @@
#include "CAnimData.hpp"
#include "CAdditiveAnimPlayback.hpp"
#include "GameGlobalObjects.hpp"
#include "CParticleGenInfo.hpp"
#include "Graphics/CSkinnedModel.hpp"
namespace urde

View File

@ -47,6 +47,8 @@ public:
ResId GetIceModelId() const {return xa8_cmdlOverlay;}
ResId GetIceSkinRulesId() const {return xac_cskrOverlay;}
const CParticleResData& GetParticleResData() const {return x44_partRes;}
};
}

View File

@ -4,6 +4,9 @@
namespace urde
{
CInt32POINode::CInt32POINode()
: CPOINode("root", 2, CCharAnimTime(), -1, false, 1.f, -1, 0), x38_val(0), x3c_boneName("root") {}
CInt32POINode::CInt32POINode(CInputStream& in)
: CPOINode(in), x38_val(in.readUint32Big()), x3c_boneName(in.readString()) {}

View File

@ -12,6 +12,7 @@ class CInt32POINode : public CPOINode
s32 x38_val;
std::string x3c_boneName;
public:
CInt32POINode();
CInt32POINode(CInputStream& in);
s32 GetValue() const {return x38_val;}
const std::string& GetBoneName() const {return x3c_boneName;}

View File

@ -61,6 +61,7 @@ add_library(RuntimeCommonCharacter
CTimeScaleFunctions.hpp CTimeScaleFunctions.cpp
CParticleData.hpp CParticleData.cpp
CParticleDatabase.hpp CParticleDatabase.cpp
CParticleGenInfo.hpp CParticleGenInfo.cpp
CAnimPOIData.hpp CAnimPOIData.cpp
CPOINode.hpp CPOINode.cpp
CBoolPOINode.hpp CBoolPOINode.cpp

View File

@ -17,12 +17,13 @@ public:
ContinuousSystem
};
private:
u32 x0_duration;
u32 x0_duration = 0;
SObjectTag x4_particle;
std::string xc_boneName;
float x1c_scale;
EParentedMode x20_parentMode;
std::string xc_boneName = "root";
float x1c_scale = 1.f;
EParentedMode x20_parentMode = EParentedMode::Initial;
public:
CParticleData() = default;
CParticleData(CInputStream& in);
EParentedMode GetParentedMode() const {return x20_parentMode;}
};

View File

@ -0,0 +1,10 @@
#include "CParticleDatabase.hpp"
namespace urde
{
void CParticleDatabase::CacheParticleDesc(const CCharacterInfo::CParticleResData& desc)
{
}
}

View File

@ -1,11 +1,19 @@
#ifndef __URDE_CPARTICLEDATABASE_HPP__
#define __URDE_CPARTICLEDATABASE_HPP__
#include "CCharacterInfo.hpp"
#include "CParticleGenInfo.hpp"
#include <map>
namespace urde
{
class CParticleDatabase
{
std::map<std::string, std::unique_ptr<CParticleGenInfo>> x3c_;
public:
void CacheParticleDesc(const CCharacterInfo::CParticleResData& desc);
void SetModulationColorAllActiveEffects(const zeus::CColor& color);
};
}

View File

@ -0,0 +1,103 @@
#include "CParticleGenInfo.hpp"
#include "Particle/CParticleGen.hpp"
namespace urde
{
CParticleGenInfo::CParticleGenInfo(const SObjectTag& part, int frameCount, const std::string& boneName,
const zeus::CVector3f& scale, CParticleData::EParentedMode parentMode,
int a)
: x4_part(part), xc_seconds(frameCount / 60.f), x10_boneName(boneName), x28_parentMode(parentMode),
x2c_a(a), x30_particleScale(scale)
{}
static TUniqueId _initializeLight(const std::weak_ptr<CParticleGen>& system,
CStateManager& stateMgr, int lightId)
{
std::shared_ptr<CParticleGen> systemRef = system.lock();
if (systemRef->SystemHasLight())
{
}
return kInvalidUniqueId;
}
CParticleGenInfoGeneric::CParticleGenInfoGeneric(const SObjectTag& part,
const std::weak_ptr<CParticleGen>& system,
int frameCount, const std::string& boneName,
const zeus::CVector3f& scale,
CParticleData::EParentedMode parentMode,
int a, CStateManager& stateMgr, int lightId)
: CParticleGenInfo(part, frameCount, boneName, scale, parentMode, a), x80_system(system)
{
if (lightId == -1)
x84_lightId = kInvalidUniqueId;
else
x84_lightId = _initializeLight(system, stateMgr, lightId);
}
void CParticleGenInfoGeneric::AddToRenderer()
{
}
void CParticleGenInfoGeneric::Render()
{
}
void CParticleGenInfoGeneric::Update(float dt, CStateManager& stateMgr)
{
}
void CParticleGenInfoGeneric::SetOrientation(const zeus::CTransform& xf, CStateManager& stateMgr)
{
}
void CParticleGenInfoGeneric::SetTranslation(const zeus::CVector3f& trans, CStateManager& stateMgr)
{
}
void CParticleGenInfoGeneric::SetGlobalOrientation(const zeus::CTransform& xf, CStateManager& stateMgr)
{
}
void CParticleGenInfoGeneric::SetGlobalTranslation(const zeus::CVector3f& trans, CStateManager& stateMgr)
{
}
void CParticleGenInfoGeneric::SetGlobalScale(const zeus::CVector3f& scale)
{
}
void CParticleGenInfoGeneric::SetParticleEmission(bool, CStateManager& stateMgr)
{
}
bool CParticleGenInfoGeneric::IsSystemDeletable() const
{
}
zeus::CAABox CParticleGenInfoGeneric::GetBounds() const
{
}
bool CParticleGenInfoGeneric::HasActiveParticles() const
{
}
void CParticleGenInfoGeneric::DestroyParticles()
{
}
bool CParticleGenInfoGeneric::HasLight() const
{
}
TUniqueId CParticleGenInfoGeneric::GetLightId() const
{
}
void CParticleGenInfoGeneric::SetModulationColor(const zeus::CColor& color)
{
}
}

View File

@ -0,0 +1,82 @@
#ifndef __URDE_CPARTICLEGENINFO_HPP__
#define __URDE_CPARTICLEGENINFO_HPP__
#include "RetroTypes.hpp"
#include "CParticleData.hpp"
#include "zeus/CVector3f.hpp"
#include "zeus/CAABox.hpp"
namespace urde
{
struct SObjectTag;
class CParticleGen;
class CStateManager;
class CParticleGenInfo
{
SObjectTag x4_part;
float xc_seconds;
std::string x10_boneName;
float x20_ = 0.f;
bool x24_ = false;
CParticleData::EParentedMode x28_parentMode;
int x2c_a;
zeus::CVector3f x30_particleScale;
float x3c_ = 0.f;
bool x40_ = false;
zeus::CTransform x44_;
zeus::CVector3f x74_;
public:
CParticleGenInfo(const SObjectTag& part, int frameCount, const std::string& boneName,
const zeus::CVector3f&, CParticleData::EParentedMode parentMode, int a);
virtual ~CParticleGenInfo() = default;
virtual void AddToRenderer()=0;
virtual void Render()=0;
virtual void Update(float dt, CStateManager& stateMgr)=0;
virtual void SetOrientation(const zeus::CTransform& xf, CStateManager& stateMgr)=0;
virtual void SetTranslation(const zeus::CVector3f& trans, CStateManager& stateMgr)=0;
virtual void SetGlobalOrientation(const zeus::CTransform& xf, CStateManager& stateMgr)=0;
virtual void SetGlobalTranslation(const zeus::CVector3f& trans, CStateManager& stateMgr)=0;
virtual void SetGlobalScale(const zeus::CVector3f& scale)=0;
virtual void SetParticleEmission(bool, CStateManager& stateMgr)=0;
virtual bool IsSystemDeletable() const=0;
virtual zeus::CAABox GetBounds() const=0;
virtual bool HasActiveParticles() const=0;
virtual void DestroyParticles()=0;
virtual bool HasLight() const=0;
virtual TUniqueId GetLightId() const=0;
virtual void SetModulationColor(const zeus::CColor& color)=0;
};
class CParticleGenInfoGeneric : public CParticleGenInfo
{
std::shared_ptr<CParticleGen> x80_system;
TUniqueId x84_lightId;
public:
CParticleGenInfoGeneric(const SObjectTag& part, const std::weak_ptr<CParticleGen>& system,
int, const std::string& boneName, const zeus::CVector3f& scale,
CParticleData::EParentedMode parentMode, int a, CStateManager& stateMgr,
int lightId);
void AddToRenderer();
void Render();
void Update(float dt, CStateManager& stateMgr);
void SetOrientation(const zeus::CTransform& xf, CStateManager& stateMgr);
void SetTranslation(const zeus::CVector3f& trans, CStateManager& stateMgr);
void SetGlobalOrientation(const zeus::CTransform& xf, CStateManager& stateMgr);
void SetGlobalTranslation(const zeus::CVector3f& trans, CStateManager& stateMgr);
void SetGlobalScale(const zeus::CVector3f& scale);
void SetParticleEmission(bool, CStateManager& stateMgr);
bool IsSystemDeletable() const;
zeus::CAABox GetBounds() const;
bool HasActiveParticles() const;
void DestroyParticles();
bool HasLight() const;
TUniqueId GetLightId() const;
void SetModulationColor(const zeus::CColor& color);
};
}
#endif // __URDE_CPARTICLEGENINFO_HPP__

View File

@ -4,6 +4,9 @@
namespace urde
{
CParticlePOINode::CParticlePOINode()
: CPOINode("root", 5, CCharAnimTime(), -1, false, 1.f, -1, 0) {}
CParticlePOINode::CParticlePOINode(CInputStream& in)
: CPOINode(in), x38_data(in) {}

View File

@ -12,6 +12,7 @@ class CParticlePOINode : public CPOINode
{
CParticleData x38_data;
public:
CParticlePOINode();
CParticlePOINode(CInputStream& in);
const CParticleData& GetData() const {return x38_data;}

View File

@ -4,6 +4,13 @@
namespace urde
{
CSoundPOINode::CSoundPOINode()
: CPOINode("root", 8, CCharAnimTime(), -1, false, 1.f, -1, 0),
x38_sfxId(0),
x3c_falloff(0.f),
x40_maxDist(0.f)
{}
CSoundPOINode::CSoundPOINode(CInputStream& in)
: CPOINode(in),
x38_sfxId(in.readUint32Big()),

View File

@ -14,6 +14,7 @@ class CSoundPOINode : public CPOINode
float x3c_falloff;
float x40_maxDist;
public:
CSoundPOINode();
CSoundPOINode(CInputStream& in);
CSoundPOINode(const std::string& name, u16 a,
const CCharAnimTime& time, u32 b, bool c,

View File

@ -0,0 +1,27 @@
#include "GameObjectLists.hpp"
namespace urde
{
CActorList::CActorList()
: CObjectList(EGameObjectList::Actor) {}
CPhysicsActorList::CPhysicsActorList()
: CObjectList(EGameObjectList::PhysicsActor) {}
CGameCameraList::CGameCameraList()
: CObjectList(EGameObjectList::GameCamera) {}
CListeningAiList::CListeningAiList()
: CObjectList(EGameObjectList::ListeningAi) {}
CAiWaypointList::CAiWaypointList()
: CObjectList(EGameObjectList::AiWaypoint) {}
CPlatformAndDoorList::CPlatformAndDoorList()
: CObjectList(EGameObjectList::PlatformAndDoor) {}
CGameLightList::CGameLightList()
: CObjectList(EGameObjectList::GameLight) {}
}

View File

@ -0,0 +1,53 @@
#ifndef __URDE_GAMEOBJECTLISTS_HPP__
#define __URDE_GAMEOBJECTLISTS_HPP__
#include "CObjectList.hpp"
namespace urde
{
class CActorList : public CObjectList
{
public:
CActorList();
};
class CPhysicsActorList : public CObjectList
{
public:
CPhysicsActorList();
};
class CGameCameraList : public CObjectList
{
public:
CGameCameraList();
};
class CListeningAiList : public CObjectList
{
public:
CListeningAiList();
};
class CAiWaypointList : public CObjectList
{
public:
CAiWaypointList();
};
class CPlatformAndDoorList : public CObjectList
{
public:
CPlatformAndDoorList();
};
class CGameLightList : public CObjectList
{
public:
CGameLightList();
};
}
#endif // __URDE_GAMEOBJECTLISTS_HPP__

View File

@ -31,44 +31,9 @@ struct SObjectTag
}
};
/**
* @brief singleton static-allocator
*/
template<class T>
class TOneStatic
{
static u8 m_allocspace[sizeof(T)];
static u32 m_refCount;
public:
static T* GetAllocSpace() {return (T*)m_allocspace;}
static u32& ReferenceCount() {return m_refCount;}
T* operator->() const {return (T*)m_allocspace;}
T& operator*() const {return *(T*)m_allocspace;}
void* operator new(size_t) = delete;
void operator delete(void*) = delete;
template<typename U = T>
TOneStatic(typename std::enable_if<!std::is_default_constructible<U>::value>::type* = 0)
{++m_refCount;}
template<typename U = T>
TOneStatic(typename std::enable_if<std::is_default_constructible<U>::value>::type* = 0)
{++m_refCount; new (m_allocspace) T();}
template<typename... Args> TOneStatic(Args&&... args)
{++m_refCount; new (m_allocspace) T(std::forward<Args>(args)...);}
~TOneStatic() {--m_refCount;}
template<typename... Args> void reset(Args&&... args)
{new (m_allocspace) T(std::forward<Args>(args)...);}
};
template<class T> u8 TOneStatic<T>::m_allocspace[sizeof(T)];
template<class T> u32 TOneStatic<T>::m_refCount;
using TUniqueId = u16;
using TEditorId = u32;
using TAreaId = u32;
using TUniqueId = s16;
using TEditorId = s32;
using TAreaId = s32;
#define kInvalidEditorId TEditorId(-1)
#define kInvalidUniqueId TUniqueId(-1)

@ -1 +1 @@
Subproject commit 36cd3fbf9dafdd9c83268593dfcd905edea32a9a
Subproject commit 4c668ed85828e2ac11c160a2536dce60bc62657d