More AnimSourceReader imps

This commit is contained in:
Jack Andersen 2016-04-11 20:15:32 -10:00
parent faacffba77
commit 41f482daeb
24 changed files with 650 additions and 58 deletions

View File

@ -11,6 +11,8 @@
#include "Runtime/Graphics/CTexture.hpp"
#include "Runtime/Character/CCharLayoutInfo.hpp"
#include "Runtime/Character/CAnimCharacterSet.hpp"
#include "Runtime/Character/CAllFormatsAnimSource.hpp"
#include "Runtime/Character/CAnimPOIData.hpp"
#include "DataSpec/DNACommon/TXTR.hpp"
@ -33,6 +35,8 @@ ProjectResourceFactoryMP1::ProjectResourceFactoryMP1(hecl::ClientProcess& client
m_factoryMgr.AddFactory(FOURCC('CMDL'), FMemFactoryFunc(FModelFactory));
m_factoryMgr.AddFactory(FOURCC('CINF'), FFactoryFunc(FCharLayoutInfo));
m_factoryMgr.AddFactory(FOURCC('ANCS'), FFactoryFunc(FAnimCharacterSet));
m_factoryMgr.AddFactory(FOURCC('ANIM'), FFactoryFunc(AnimSourceFactory));
m_factoryMgr.AddFactory(FOURCC('EVNT'), FFactoryFunc(AnimPOIDataFactory));
}
void ProjectResourceFactoryMP1::IndexMP1Resources(hecl::Database::Project& proj)

View File

@ -1,5 +1,7 @@
#include "CAllFormatsAnimSource.hpp"
#include "logvisor/logvisor.hpp"
#include "CSimplePool.hpp"
#include "CAnimSourceReader.hpp"
namespace urde
{
@ -24,9 +26,36 @@ CAnimFormatUnion::CAnimFormatUnion(CInputStream& in, IObjectStore& store)
SubConstruct(x4_storage, x0_format, in, store);
}
CAnimFormatUnion::~CAnimFormatUnion()
{
switch (x0_format)
{
case EAnimFormat::Uncompressed:
reinterpret_cast<CAnimSource*>(x4_storage)->~CAnimSource();
default: break;
}
}
std::shared_ptr<CAnimSourceReaderBase>
CAllFormatsAnimSource::GetNewReader(const TLockedToken<CAllFormatsAnimSource>& tok,
const CCharAnimTime& startTime)
{
return std::make_shared<CAnimSourceReader>(tok, startTime);
}
CAllFormatsAnimSource::CAllFormatsAnimSource(CInputStream& in,
IObjectStore& store,
const SObjectTag& tag)
: CAnimFormatUnion(in, store), x74_tag(tag) {}
CFactoryFnReturn AnimSourceFactory(const SObjectTag& tag, CInputStream& in,
const CVParamTransfer& params)
{
CSimplePool* sp = static_cast<CSimplePool*>(
static_cast<TObjOwnerParam<IObjectStore*>*>(
params.GetObj())->GetParam());
return TToken<CAllFormatsAnimSource>::GetIObjObjectFor(
std::make_unique<CAllFormatsAnimSource>(in, *sp, tag));
}
}

View File

@ -4,10 +4,12 @@
#include "RetroTypes.hpp"
#include "zeus/CVector3f.hpp"
#include "CAnimSource.hpp"
#include "CFactoryMgr.hpp"
namespace urde
{
class IObjectStore;
class CAnimSourceReaderBase;
enum class EAnimFormat
{
@ -24,6 +26,7 @@ class CAnimFormatUnion
CInputStream& in, IObjectStore& store);
public:
CAnimFormatUnion(CInputStream& in, IObjectStore& store);
~CAnimFormatUnion();
operator CAnimSource&() {return *reinterpret_cast<CAnimSource*>(x4_storage);}
};
@ -33,8 +36,12 @@ class CAllFormatsAnimSource : public CAnimFormatUnion
SObjectTag x74_tag;
public:
CAllFormatsAnimSource(CInputStream& in, IObjectStore& store, const SObjectTag& tag);
static std::shared_ptr<CAnimSourceReaderBase> GetNewReader(const TLockedToken<CAllFormatsAnimSource>& tok,
const CCharAnimTime& startTime);
};
CFactoryFnReturn AnimSourceFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& params);
}
#endif // __PSHAG_CALLFORMATANIMSOURCE_HPP__

View File

@ -5,7 +5,30 @@ namespace urde
{
CAnimPOIData::CAnimPOIData(CInputStream& in)
: x0_version(in.readUint32Big())
{
u32 boolCount = in.readUint32Big();
x4_boolNodes.reserve(boolCount);
for (u32 i=0 ; i<boolCount ; ++i)
x4_boolNodes.emplace_back(in);
u32 int32Count = in.readUint32Big();
x14_int32Nodes.reserve(int32Count);
for (u32 i=0 ; i<int32Count ; ++i)
x14_int32Nodes.emplace_back(in);
u32 particleCount = in.readUint32Big();
x24_particleNodes.reserve(particleCount);
for (u32 i=0 ; i<particleCount ; ++i)
x24_particleNodes.emplace_back(in);
if (x0_version >= 2)
{
u32 soundCount = in.readUint32Big();
x34_soundNodes.reserve(soundCount);
for (u32 i=0 ; i<soundCount ; ++i)
x34_soundNodes.emplace_back(in);
}
}
CFactoryFnReturn AnimPOIDataFactory(const SObjectTag& tag, CInputStream& in,

View File

@ -12,6 +12,7 @@ namespace urde
class CAnimPOIData
{
u32 x0_version;
std::vector<CBoolPOINode> x4_boolNodes;
std::vector<CInt32POINode> x14_int32Nodes;
std::vector<CParticlePOINode> x24_particleNodes;

View File

@ -122,12 +122,11 @@ void CAnimSource::CalcAverageVelocity()
}
CAnimSource::CAnimSource(CInputStream& in, IObjectStore& store)
: x0_duration(in.readFloatBig()),
x4_(in.readUint32Big()),
: x0_duration(in),
x8_interval(in.readFloatBig()),
xc_(in.readUint32Big()),
x10_frameCount(in.readUint32Big()),
x1c_(in.readUint32Big()),
x1c_rootBone(in),
x20_rotationChannels(ReadIndexTable(in)),
x30_translationChannels(ReadIndexTable(in)),
x40_data(RotationAndOffsetStorage::CRotationAndOffsetVectors(in), x10_frameCount),
@ -210,10 +209,10 @@ zeus::CVector3f CAnimSource::GetOffset(const CSegId& seg, const CCharAnimTime& t
return {};
u32 frameIdx = unsigned(time / x8_interval);
float tmp = time - frameIdx * x8_interval;
if (std::fabs(tmp) < 0.00001f)
tmp = 0.f;
float t = ClampZeroToOne(tmp / x8_interval);
float remTime = time - frameIdx * x8_interval;
if (std::fabs(remTime) < 0.00001f)
remTime = 0.f;
float t = ClampZeroToOne(remTime / x8_interval);
const u32 floatsPerFrame = x40_data.x10_transPerFrame * 3 + x40_data.xc_rotPerFrame * 4;
const u32 rotFloatsPerFrame = x40_data.xc_rotPerFrame * 4;

View File

@ -5,6 +5,7 @@
#include "CCharAnimTime.hpp"
#include "zeus/CQuaternion.hpp"
#include "zeus/CVector3f.hpp"
#include "CSegId.hpp"
#include "CToken.hpp"
namespace urde
@ -48,12 +49,12 @@ public:
class CAnimSource
{
float x0_duration;
u32 x4_;
friend class CAnimSourceInfo;
CCharAnimTime x0_duration;
float x8_interval;
u32 xc_;
u32 x10_frameCount;
u32 x1c_;
CSegId x1c_rootBone;
std::vector<u8> x20_rotationChannels;
std::vector<u8> x30_translationChannels;
RotationAndOffsetStorage x40_data;
@ -77,6 +78,8 @@ public:
zeus::CQuaternion GetRotation(const CSegId& seg, const CCharAnimTime& time) const;
zeus::CVector3f GetOffset(const CSegId& seg, const CCharAnimTime& time) const;
bool HasOffset(const CSegId& seg) const;
const CCharAnimTime& GetDuration() const {return x0_duration;}
const CSegId& GetRootBoneId() const {return x1c_rootBone;}
};
}

View File

@ -1,18 +1,313 @@
#include "CAnimSourceReader.hpp"
#include "CBoolPOINode.hpp"
#include "CInt32POINode.hpp"
#include "CParticlePOINode.hpp"
#include "CSoundPOINode.hpp"
namespace urde
{
CAnimSourceInfo::CAnimSourceInfo(const TSubAnimTypeToken<CAnimSource>& token)
: x4_token(token) {}
bool CAnimSourceInfo::HasPOIData() const
{
return x4_token->x58_evntData;
}
const std::vector<CBoolPOINode>& CAnimSourceInfo::GetBoolPOIStream() const
{
return x4_token->GetBoolPOIStream();
}
const std::vector<CInt32POINode>& CAnimSourceInfo::GetInt32POIStream() const
{
return x4_token->GetInt32POIStream();
}
const std::vector<CParticlePOINode>& CAnimSourceInfo::GetParticlePOIStream() const
{
return x4_token->GetParticlePOIStream();
}
const std::vector<CSoundPOINode>& CAnimSourceInfo::GetSoundPOIStream() const
{
return x4_token->GetSoundPOIStream();
}
CCharAnimTime CAnimSourceInfo::GetAnimationDuration() const
{
return x4_token->GetDuration();
}
std::map<std::string, CParticleData::EParentedMode>
CAnimSourceReaderBase::GetUniqueParticlePOIs() const
{
const std::vector<CParticlePOINode>& particleNodes = x4_sourceInfo->GetParticlePOIStream();
std::map<std::string, CParticleData::EParentedMode> ret;
for (const CParticlePOINode& node : particleNodes)
ret[node.GetName()] = node.GetData().GetParentedMode();
return ret;
}
std::map<std::string, s32>
CAnimSourceReaderBase::GetUniqueInt32POIs() const
{
const std::vector<CInt32POINode>& int32Nodes = x4_sourceInfo->GetInt32POIStream();
std::map<std::string, s32> ret;
for (const CInt32POINode& node : int32Nodes)
ret[node.GetName()] = node.GetValue();
return ret;
}
std::map<std::string, bool>
CAnimSourceReaderBase::GetUniqueBoolPOIs() const
{
const std::vector<CBoolPOINode>& boolNodes = x4_sourceInfo->GetBoolPOIStream();
std::map<std::string, bool> ret;
for (const CBoolPOINode& node : boolNodes)
ret[node.GetName()] = node.GetValue();
return ret;
}
void CAnimSourceReaderBase::PostConstruct(const CCharAnimTime& time)
{
x14_passedBoolCount = 0;
x18_passedIntCount = 0;
x1c_passedParticleCount = 0;
x20_passedSoundCount = 0;
if (x4_sourceInfo->HasPOIData())
{
std::map<std::string, bool> boolPOIs = GetUniqueBoolPOIs();
std::map<std::string, s32> int32POIs = GetUniqueInt32POIs();
std::map<std::string, CParticleData::EParentedMode> particlePOIs = GetUniqueParticlePOIs();
x24_boolStates.reserve(boolPOIs.size());
for (const auto& poi : boolPOIs)
x24_boolStates.push_back(poi);
x34_int32States.reserve(int32POIs.size());
for (const auto& poi : int32POIs)
x34_int32States.push_back(poi);
x44_particleStates.reserve(particlePOIs.size());
for (const auto& poi : particlePOIs)
x44_particleStates.push_back(poi);
}
CCharAnimTime tmpTime = time;
if (tmpTime.GreaterThanZero())
{
while (tmpTime.GreaterThanZero())
{
SAdvancementResults res = VAdvanceView(tmpTime);
tmpTime = res.x0_remTime;
}
}
else if (x4_sourceInfo->HasPOIData())
{
UpdatePOIStates();
if (!time.GreaterThanZero())
{
x14_passedBoolCount = 0;
x18_passedIntCount = 0;
x1c_passedParticleCount = 0;
x20_passedSoundCount = 0;
}
}
}
void CAnimSourceReaderBase::UpdatePOIStates()
{
const std::vector<CBoolPOINode>& boolNodes = x4_sourceInfo->GetBoolPOIStream();
const std::vector<CInt32POINode>& int32Nodes = x4_sourceInfo->GetInt32POIStream();
const std::vector<CParticlePOINode>& particleNodes = x4_sourceInfo->GetParticlePOIStream();
const std::vector<CSoundPOINode>& soundNodes = x4_sourceInfo->GetSoundPOIStream();
for (const CBoolPOINode& node : boolNodes)
{
if (node.GetTime() > xc_curTime)
break;
if (node.GetIndex() != -1)
x24_boolStates[node.GetIndex()].second = node.GetValue();
++x14_passedBoolCount;
}
for (const CInt32POINode& node : int32Nodes)
{
if (node.GetTime() > xc_curTime)
break;
if (node.GetIndex() != -1)
x34_int32States[node.GetIndex()].second = node.GetValue();
++x18_passedIntCount;
}
for (const CParticlePOINode& node : particleNodes)
{
if (node.GetTime() > xc_curTime)
break;
if (node.GetIndex() != -1)
x44_particleStates[node.GetIndex()].second = node.GetData().GetParentedMode();
++x1c_passedParticleCount;
}
for (const CSoundPOINode& node : soundNodes)
{
if (node.GetTime() > xc_curTime)
break;
++x20_passedSoundCount;
}
}
u32 CAnimSourceReaderBase::VGetBoolPOIList(const CCharAnimTime& time,
CBoolPOINode* listOut,
u32 capacity, u32 iterator, u32 unk) const
{
if (x4_sourceInfo->HasPOIData())
{
const std::vector<CBoolPOINode>& boolNodes = x4_sourceInfo->GetBoolPOIStream();
return CBoolPOINode::_getPOIList(time, listOut, capacity, iterator, unk, boolNodes,
xc_curTime, *x4_sourceInfo, x14_passedBoolCount);
}
return 0;
}
u32 CAnimSourceReaderBase::VGetInt32POIList(const CCharAnimTime& time,
CInt32POINode* listOut,
u32 capacity, u32 iterator, u32 unk) const
{
if (x4_sourceInfo->HasPOIData())
{
const std::vector<CInt32POINode>& int32Nodes = x4_sourceInfo->GetInt32POIStream();
return CInt32POINode::_getPOIList(time, listOut, capacity, iterator, unk, int32Nodes,
xc_curTime, *x4_sourceInfo, x18_passedIntCount);
}
return 0;
}
u32 CAnimSourceReaderBase::VGetParticlePOIList(const CCharAnimTime& time,
CParticlePOINode* listOut,
u32 capacity, u32 iterator, u32 unk) const
{
if (x4_sourceInfo->HasPOIData())
{
const std::vector<CParticlePOINode>& particleNodes = x4_sourceInfo->GetParticlePOIStream();
return CParticlePOINode::_getPOIList(time, listOut, capacity, iterator, unk, particleNodes,
xc_curTime, *x4_sourceInfo, x1c_passedParticleCount);
}
return 0;
}
u32 CAnimSourceReaderBase::VGetSoundPOIList(const CCharAnimTime& time,
CSoundPOINode* listOut,
u32 capacity, u32 iterator, u32 unk) const
{
if (x4_sourceInfo->HasPOIData())
{
const std::vector<CSoundPOINode>& soundNodes = x4_sourceInfo->GetSoundPOIStream();
return CSoundPOINode::_getPOIList(time, listOut, capacity, iterator, unk, soundNodes,
xc_curTime, *x4_sourceInfo, x20_passedSoundCount);
}
return 0;
}
bool CAnimSourceReaderBase::VGetBoolPOIState(const char* name) const
{
for (const auto& node : x24_boolStates)
if (!node.first.compare(name))
return node.second;
return false;
}
s32 CAnimSourceReaderBase::VGetInt32POIState(const char* name) const
{
for (const auto& node : x34_int32States)
if (!node.first.compare(name))
return node.second;
return 0;
}
CParticleData::EParentedMode
CAnimSourceReaderBase::VGetParticlePOIState(const char* name) const
{
for (const auto& node : x44_particleStates)
if (!node.first.compare(name))
return node.second;
return CParticleData::EParentedMode::Initial;
}
CAnimSourceReaderBase::CAnimSourceReaderBase(std::unique_ptr<IAnimSourceInfo>&& sourceInfo,
const CCharAnimTime& time)
: x4_sourceInfo(std::move(sourceInfo)), xc_curTime(time) {}
SAdvancementResults CAnimSourceReader::VGetAdvancementResults(const CCharAnimTime& a,
const CCharAnimTime& b) const
{
}
void CAnimSourceReader::VSetPhase(float)
{
}
SAdvancementResults CAnimSourceReader::VReverseView(const CCharAnimTime& time)
{
}
std::shared_ptr<IAnimReader> CAnimSourceReader::VClone() const
{
}
void CAnimSourceReader::VGetSegStatementSet(const CSegIdList& list,
CSegStatementSet& setOut) const
{
}
void CAnimSourceReader::VGetSegStatementSet(const CSegIdList& list,
CSegStatementSet& setOut,
const CCharAnimTime& time) const
{
}
SAdvancementResults CAnimSourceReader::VAdvanceView(const CCharAnimTime& a)
{
}
CCharAnimTime CAnimSourceReader::VGetTimeRemaining() const
{
}
void CAnimSourceReader::VGetSteadyStateAnimInfo() const
{
}
bool CAnimSourceReader::VHasOffset(const CSegId& seg) const
{
}
zeus::CVector3f CAnimSourceReader::VGetOffset(const CSegId& seg) const
{
}
zeus::CVector3f CAnimSourceReader::VGetOffset(const CSegId& seg,
const CCharAnimTime& time) const
{
}
zeus::CQuaternion CAnimSourceReader::VGetRotation(const CSegId& seg) const
{
}
CAnimSourceReader::CAnimSourceReader(const TSubAnimTypeToken<CAnimSource>& source,
const CCharAnimTime& time)
: CAnimSourceReaderBase(std::make_unique<CAnimSourceInfo>(source), CCharAnimTime()),
x54_source(source)
{
CAnimSource* sourceData = x54_source.GetObj();
x64_duration = sourceData->GetDuration();
x6c_curRootOffset = sourceData->GetOffset(sourceData->GetRootBoneId(), time);
PostConstruct(time);
}
}

View File

@ -10,20 +10,18 @@ namespace urde
{
template <class T>
class TSubAnimTypeToken : public TCachedToken<T>
{
};
using TSubAnimTypeToken = TCachedToken<T>;
class IAnimSourceInfo
{
public:
virtual ~IAnimSourceInfo() = default;
virtual bool HasPOIData() const=0;
virtual void GetBoolPOIStream() const=0;
virtual void GetInt32POIStream() const=0;
virtual void GetParticlePOIStream() const=0;
virtual void GetSoundPOIStream() const=0;
virtual void GetAnimationDuration() const=0;
virtual const std::vector<CBoolPOINode>& GetBoolPOIStream() const=0;
virtual const std::vector<CInt32POINode>& GetInt32POIStream() const=0;
virtual const std::vector<CParticlePOINode>& GetParticlePOIStream() const=0;
virtual const std::vector<CSoundPOINode>& GetSoundPOIStream() const=0;
virtual CCharAnimTime GetAnimationDuration() const=0;
};
class CAnimSourceInfo : public IAnimSourceInfo
@ -32,31 +30,31 @@ class CAnimSourceInfo : public IAnimSourceInfo
public:
CAnimSourceInfo(const TSubAnimTypeToken<CAnimSource>& token);
bool HasPOIData() const;
void GetBoolPOIStream() const;
void GetInt32POIStream() const;
void GetParticlePOIStream() const;
void GetSoundPOIStream() const;
void GetAnimationDuration() const;
const std::vector<CBoolPOINode>& GetBoolPOIStream() const;
const std::vector<CInt32POINode>& GetInt32POIStream() const;
const std::vector<CParticlePOINode>& GetParticlePOIStream() const;
const std::vector<CSoundPOINode>& GetSoundPOIStream() const;
CCharAnimTime GetAnimationDuration() const;
};
class CAnimSourceReaderBase : public IAnimReader
{
std::unique_ptr<IAnimSourceInfo> x4_sourceInfo;
CCharAnimTime xc_curTime;
u32 x14_passedBoolCount;
u32 x18_passedIntCount;
u32 x1c_passedParticleCount;
u32 x20_passedSoundCount;
std::vector<std::pair<std::string, bool>> x24_boolPOIs;
std::vector<std::pair<std::string, s32>> x34_int32POIs;
std::vector<std::pair<std::string, CParticleData::EParentedMode>> x44_particlePOIs;
u32 x14_passedBoolCount = 0;
u32 x18_passedIntCount = 0;
u32 x1c_passedParticleCount = 0;
u32 x20_passedSoundCount = 0;
std::vector<std::pair<std::string, bool>> x24_boolStates;
std::vector<std::pair<std::string, s32>> x34_int32States;
std::vector<std::pair<std::string, CParticleData::EParentedMode>> x44_particleStates;
std::map<std::string, CParticleData::EParentedMode> GetUniqueParticlePOIs() const;
std::map<std::string, s32> GetUniqueInt32POIs() const;
std::map<std::string, bool> GetUniqueBoolPOIs() const;
void PostConstruct(const CCharAnimTime& time);
protected:
void PostConstruct(const CCharAnimTime& time);
void UpdatePOIStates();
public:
@ -67,16 +65,38 @@ public:
u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator, u32) const;
u32 VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator, u32) const;
u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator, u32) const;
void VGetBoolPOIState(const char*) const;
void VGetInt32POIState(const char*) const;
void VGetParticlePOIState(const char*) const;
bool VGetBoolPOIState(const char* name) const;
s32 VGetInt32POIState(const char* name) const;
CParticleData::EParentedMode VGetParticlePOIState(const char* name) const;
virtual zeus::CVector3f VGetOffset(const CSegId& seg, const CCharAnimTime& b) const=0;
virtual bool VSupportsReverseView() const=0;
virtual SAdvancementResults VReverseView(const CCharAnimTime& time)=0;
};
class CAnimSourceReader : public CAnimSourceReaderBase
{
TSubAnimTypeToken<CAnimSource> x54_source;
CCharAnimTime x64_duration;
zeus::CVector3f x6c_curRootOffset;
bool x78_ = false;
public:
CAnimSourceReader(const TSubAnimTypeToken<CAnimSource>& source, const CCharAnimTime& time);
SAdvancementResults VGetAdvancementResults(const CCharAnimTime& a, const CCharAnimTime& b) const;
bool VSupportsReverseView() const {return true;}
void VSetPhase(float);
SAdvancementResults VReverseView(const CCharAnimTime& time);
std::shared_ptr<IAnimReader> VClone() const;
void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut) const;
void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut, const CCharAnimTime& time) const;
SAdvancementResults VAdvanceView(const CCharAnimTime& a);
CCharAnimTime VGetTimeRemaining() const;
void VGetSteadyStateAnimInfo() const;
bool VHasOffset(const CSegId& seg) const;
zeus::CVector3f VGetOffset(const CSegId& seg) const;
zeus::CVector3f VGetOffset(const CSegId& seg, const CCharAnimTime& time) const;
zeus::CQuaternion VGetRotation(const CSegId& seg) const;
};
}

View File

@ -14,9 +14,9 @@ public:
u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator, u32) const;
u32 VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator, u32) const;
u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator, u32) const;
void VGetBoolPOIState(const char*) const;
void VGetInt32POIState(const char*) const;
void VGetParticlePOIState(const char*) const;
bool VGetBoolPOIState(const char* name) const;
s32 VGetInt32POIState(const char* name) const;
CParticleData::EParentedMode VGetParticlePOIState(const char* name) const;
void VSetPhase(float);
SAdvancementResults VGetAdvancementResults(const CCharAnimTime& a, const CCharAnimTime& b) const;
void Depth() const;

View File

@ -13,6 +13,11 @@ public:
CAnimTreeNode(const std::string& name) : x4_name(name) {}
bool IsCAnimTreeNode() const {return true;}
virtual void Depth() const=0;
virtual void VGetContributionOfHighestInfluence() const=0;
virtual u32 VGetNumChildren() const=0;
virtual std::shared_ptr<IAnimReader> VGetBestUnblendedChild() const=0;
void GetContributionOfHighestInfluence() const;
u32 GetNumChildren() const;
std::shared_ptr<IAnimReader> GetBestUnblendedChild() const;

View File

@ -21,11 +21,11 @@ bool CAnimTreeSingleChild::VHasOffset(const CSegId& seg) const
{
}
void CAnimTreeSingleChild::VGetOffset(const CSegId& seg) const
zeus::CVector3f CAnimTreeSingleChild::VGetOffset(const CSegId& seg) const
{
}
void CAnimTreeSingleChild::VGetRotation(const CSegId& seg) const
zeus::CQuaternion CAnimTreeSingleChild::VGetRotation(const CSegId& seg) const
{
}
@ -53,15 +53,15 @@ u32 CAnimTreeSingleChild::VGetSoundPOIList(const CCharAnimTime& time,
{
}
void CAnimTreeSingleChild::VGetBoolPOIState(const char*) const
bool CAnimTreeSingleChild::VGetBoolPOIState(const char* name) const
{
}
void CAnimTreeSingleChild::VGetInt32POIState(const char*) const
s32 CAnimTreeSingleChild::VGetInt32POIState(const char* name) const
{
}
void CAnimTreeSingleChild::VGetParticlePOIState(const char*) const
CParticleData::EParentedMode CAnimTreeSingleChild::VGetParticlePOIState(const char* name) const
{
}

View File

@ -15,15 +15,15 @@ public:
SAdvancementResults VAdvanceView(const CCharAnimTime& a);
CCharAnimTime VGetTimeRemaining() const;
bool VHasOffset(const CSegId& seg) const;
void VGetOffset(const CSegId& seg) const;
void VGetRotation(const CSegId& seg) const;
zeus::CVector3f VGetOffset(const CSegId& seg) const;
zeus::CQuaternion VGetRotation(const CSegId& seg) const;
u32 VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator, u32) const;
u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator, u32) const;
u32 VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator, u32) const;
u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator, u32) const;
void VGetBoolPOIState(const char*) const;
void VGetInt32POIState(const char*) const;
void VGetParticlePOIState(const char*) const;
bool VGetBoolPOIState(const char* name) const;
s32 VGetInt32POIState(const char* name) const;
CParticleData::EParentedMode VGetParticlePOIState(const char* name) const;
void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut) const;
void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut, const CCharAnimTime& time) const;
void VSetPhase(float);

View File

@ -1,4 +1,5 @@
#include "CBoolPOINode.hpp"
#include "CAnimSourceReader.hpp"
namespace urde
{
@ -9,4 +10,44 @@ CBoolPOINode::CBoolPOINode()
CBoolPOINode::CBoolPOINode(CInputStream& in)
: CPOINode(in), x38_val(in.readBool()) {}
CBoolPOINode CBoolPOINode::CopyNodeMinusStartTime(const CBoolPOINode& node,
const CCharAnimTime& startTime)
{
CBoolPOINode ret = node;
ret.x1c_time -= startTime;
return ret;
}
u32 CBoolPOINode::_getPOIList(const CCharAnimTime& time,
CBoolPOINode* listOut,
u32 capacity, u32 iterator, u32 unk1,
const std::vector<CBoolPOINode>& stream,
const CCharAnimTime& curTime,
const IAnimSourceInfo& animInfo, u32 passedCount)
{
u32 ret = 0;
if (animInfo.HasPOIData() && stream.size())
{
CCharAnimTime dur = animInfo.GetAnimationDuration();
CCharAnimTime targetTime = curTime + time;
if (targetTime >= dur)
targetTime = dur;
if (passedCount >= stream.size())
return ret;
CCharAnimTime nodeTime = stream[passedCount].GetTime();
while (nodeTime <= targetTime)
{
u32 idx = iterator + ret;
if (idx < capacity)
listOut[idx] = CopyNodeMinusStartTime(stream[passedCount], curTime);
++passedCount;
++ret;
nodeTime = stream[passedCount].GetTime();
}
}
return ret;
}
}

View File

@ -5,6 +5,7 @@
namespace urde
{
class IAnimSourceInfo;
class CBoolPOINode : public CPOINode
{
@ -13,6 +14,14 @@ public:
CBoolPOINode();
CBoolPOINode(CInputStream& in);
bool GetValue() const {return x38_val;}
static u32 _getPOIList(const CCharAnimTime& time,
CBoolPOINode* listOut,
u32 capacity, u32 iterator, u32 unk1,
const std::vector<CBoolPOINode>& stream,
const CCharAnimTime& curTime,
const IAnimSourceInfo& animInfo, u32 passedCount);
static CBoolPOINode CopyNodeMinusStartTime(const CBoolPOINode& node,
const CCharAnimTime& startTime);
};
}

View File

@ -1,4 +1,5 @@
#include "CInt32POINode.hpp"
#include "CAnimSourceReader.hpp"
namespace urde
{
@ -6,4 +7,44 @@ namespace urde
CInt32POINode::CInt32POINode(CInputStream& in)
: CPOINode(in), x38_val(in.readUint32Big()), x3c_boneName(in.readString()) {}
CInt32POINode CInt32POINode::CopyNodeMinusStartTime(const CInt32POINode& node,
const CCharAnimTime& startTime)
{
CInt32POINode ret = node;
ret.x1c_time -= startTime;
return ret;
}
u32 CInt32POINode::_getPOIList(const CCharAnimTime& time,
CInt32POINode* listOut,
u32 capacity, u32 iterator, u32 unk1,
const std::vector<CInt32POINode>& stream,
const CCharAnimTime& curTime,
const IAnimSourceInfo& animInfo, u32 passedCount)
{
u32 ret = 0;
if (animInfo.HasPOIData() && stream.size())
{
CCharAnimTime dur = animInfo.GetAnimationDuration();
CCharAnimTime targetTime = curTime + time;
if (targetTime >= dur)
targetTime = dur;
if (passedCount >= stream.size())
return ret;
CCharAnimTime nodeTime = stream[passedCount].GetTime();
while (nodeTime <= targetTime)
{
u32 idx = iterator + ret;
if (idx < capacity)
listOut[idx] = CopyNodeMinusStartTime(stream[passedCount], curTime);
++passedCount;
++ret;
nodeTime = stream[passedCount].GetTime();
}
}
return ret;
}
}

View File

@ -5,13 +5,25 @@
namespace urde
{
class IAnimSourceInfo;
class CInt32POINode : public CPOINode
{
u32 x38_val;
s32 x38_val;
std::string x3c_boneName;
public:
CInt32POINode(CInputStream& in);
s32 GetValue() const {return x38_val;}
const std::string& GetBoneName() const {return x3c_boneName;}
static u32 _getPOIList(const CCharAnimTime& time,
CInt32POINode* listOut,
u32 capacity, u32 iterator, u32 unk1,
const std::vector<CInt32POINode>& stream,
const CCharAnimTime& curTime,
const IAnimSourceInfo& animInfo, u32 passedCount);
static CInt32POINode CopyNodeMinusStartTime(const CInt32POINode& node,
const CCharAnimTime& startTime);
};
}

View File

@ -9,6 +9,7 @@ namespace urde
class CPOINode
{
protected:
u16 x4_ = 1;
std::string x8_name;
u16 x18_;
@ -25,6 +26,7 @@ public:
const std::string& GetName() const {return x8_name;}
const CCharAnimTime& GetTime() const {return x1c_time;}
u32 GetIndex() const {return x24_index;}
};
}

View File

@ -24,6 +24,7 @@ private:
EParentedMode x20_parentMode;
public:
CParticleData(CInputStream& in);
EParentedMode GetParentedMode() const {return x20_parentMode;}
};
}

View File

@ -1,4 +1,5 @@
#include "CParticlePOINode.hpp"
#include "CAnimSourceReader.hpp"
namespace urde
{
@ -6,4 +7,44 @@ namespace urde
CParticlePOINode::CParticlePOINode(CInputStream& in)
: CPOINode(in), x38_data(in) {}
CParticlePOINode CParticlePOINode::CopyNodeMinusStartTime(const CParticlePOINode& node,
const CCharAnimTime& startTime)
{
CParticlePOINode ret = node;
ret.x1c_time -= startTime;
return ret;
}
u32 CParticlePOINode::_getPOIList(const CCharAnimTime& time,
CParticlePOINode* listOut,
u32 capacity, u32 iterator, u32 unk1,
const std::vector<CParticlePOINode>& stream,
const CCharAnimTime& curTime,
const IAnimSourceInfo& animInfo, u32 passedCount)
{
u32 ret = 0;
if (animInfo.HasPOIData() && stream.size())
{
CCharAnimTime dur = animInfo.GetAnimationDuration();
CCharAnimTime targetTime = curTime + time;
if (targetTime >= dur)
targetTime = dur;
if (passedCount >= stream.size())
return ret;
CCharAnimTime nodeTime = stream[passedCount].GetTime();
while (nodeTime <= targetTime)
{
u32 idx = iterator + ret;
if (idx < capacity)
listOut[idx] = CopyNodeMinusStartTime(stream[passedCount], curTime);
++passedCount;
++ret;
nodeTime = stream[passedCount].GetTime();
}
}
return ret;
}
}

View File

@ -6,12 +6,23 @@
namespace urde
{
class IAnimSourceInfo;
class CParticlePOINode : public CPOINode
{
CParticleData x38_data;
public:
CParticlePOINode(CInputStream& in);
const CParticleData& GetData() const {return x38_data;}
static u32 _getPOIList(const CCharAnimTime& time,
CParticlePOINode* listOut,
u32 capacity, u32 iterator, u32 unk1,
const std::vector<CParticlePOINode>& stream,
const CCharAnimTime& curTime,
const IAnimSourceInfo& animInfo, u32 passedCount);
static CParticlePOINode CopyNodeMinusStartTime(const CParticlePOINode& node,
const CCharAnimTime& startTime);
};
}

View File

@ -1,4 +1,5 @@
#include "CSoundPOINode.hpp"
#include "CAnimSourceReader.hpp"
namespace urde
{
@ -16,4 +17,44 @@ CSoundPOINode::CSoundPOINode(const std::string& name, u16 a,
: CPOINode(name, a, time, b, c, d, e, f),
x38_sfxId(sfxId), x3c_falloff(falloff), x40_maxDist(maxDist) {}
CSoundPOINode CSoundPOINode::CopyNodeMinusStartTime(const CSoundPOINode& node,
const CCharAnimTime& startTime)
{
CSoundPOINode ret = node;
ret.x1c_time -= startTime;
return ret;
}
u32 CSoundPOINode::_getPOIList(const CCharAnimTime& time,
CSoundPOINode* listOut,
u32 capacity, u32 iterator, u32 unk1,
const std::vector<CSoundPOINode>& stream,
const CCharAnimTime& curTime,
const IAnimSourceInfo& animInfo, u32 passedCount)
{
u32 ret = 0;
if (animInfo.HasPOIData() && stream.size())
{
CCharAnimTime dur = animInfo.GetAnimationDuration();
CCharAnimTime targetTime = curTime + time;
if (targetTime >= dur)
targetTime = dur;
if (passedCount >= stream.size())
return ret;
CCharAnimTime nodeTime = stream[passedCount].GetTime();
while (nodeTime <= targetTime)
{
u32 idx = iterator + ret;
if (idx < capacity)
listOut[idx] = CopyNodeMinusStartTime(stream[passedCount], curTime);
++passedCount;
++ret;
nodeTime = stream[passedCount].GetTime();
}
}
return ret;
}
}

View File

@ -6,6 +6,7 @@
namespace urde
{
class IAnimSourceInfo;
class CSoundPOINode : public CPOINode
{
@ -17,6 +18,15 @@ public:
CSoundPOINode(const std::string& name, u16 a,
const CCharAnimTime& time, u32 b, bool c,
float d, u32 e, u32 f, u32 sfxId, float falloff, float maxDist);
static u32 _getPOIList(const CCharAnimTime& time,
CSoundPOINode* listOut,
u32 capacity, u32 iterator, u32 unk1,
const std::vector<CSoundPOINode>& stream,
const CCharAnimTime& curTime,
const IAnimSourceInfo& animInfo, u32 passedCount);
static CSoundPOINode CopyNodeMinusStartTime(const CSoundPOINode& node,
const CCharAnimTime& startTime);
};
}

View File

@ -5,6 +5,7 @@
#include "CCharAnimTime.hpp"
#include "zeus/CVector3f.hpp"
#include "zeus/CQuaternion.hpp"
#include "CParticleData.hpp"
namespace urde
{
@ -32,25 +33,21 @@ public:
virtual CCharAnimTime VGetTimeRemaining() const=0;
virtual void VGetSteadyStateAnimInfo() const=0;
virtual bool VHasOffset(const CSegId& seg) const=0;
virtual void VGetOffset(const CSegId& seg) const=0;
virtual void VGetRotation(const CSegId& seg) const=0;
virtual zeus::CVector3f VGetOffset(const CSegId& seg) const=0;
virtual zeus::CQuaternion VGetRotation(const CSegId& seg) const=0;
virtual u32 VGetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator, u32) const=0;
virtual u32 VGetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator, u32) const=0;
virtual u32 VGetParticlePOIList(const CCharAnimTime& time, CParticlePOINode* listOut, u32 capacity, u32 iterator, u32) const=0;
virtual u32 VGetSoundPOIList(const CCharAnimTime& time, CSoundPOINode* listOut, u32 capacity, u32 iterator, u32) const=0;
virtual void VGetBoolPOIState(const char*) const=0;
virtual void VGetInt32POIState(const char*) const=0;
virtual void VGetParticlePOIState(const char*) const=0;
virtual bool VGetBoolPOIState(const char*) const=0;
virtual s32 VGetInt32POIState(const char*) const=0;
virtual CParticleData::EParentedMode VGetParticlePOIState(const char*) const=0;
virtual void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut) const=0;
virtual void VGetSegStatementSet(const CSegIdList& list, CSegStatementSet& setOut, const CCharAnimTime& time) const=0;
virtual void VClone() const=0;
virtual std::shared_ptr<IAnimReader> VClone() const=0;
virtual std::shared_ptr<IAnimReader> VSimplified() {return {};}
virtual void VSetPhase(float)=0;
virtual SAdvancementResults VGetAdvancementResults(const CCharAnimTime& a, const CCharAnimTime& b) const;
virtual void Depth() const=0;
virtual void VGetContributionOfHighestInfluence() const=0;
virtual u32 VGetNumChildren() const=0;
virtual std::shared_ptr<IAnimReader> VGetBestUnblendedChild() const=0;
u32 GetBoolPOIList(const CCharAnimTime& time, CBoolPOINode* listOut, u32 capacity, u32 iterator, u32) const;
u32 GetInt32POIList(const CCharAnimTime& time, CInt32POINode* listOut, u32 capacity, u32 iterator, u32) const;