metaforce/Runtime/Character/CAnimSourceReader.hpp

104 lines
4.3 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2016-04-11 23:35:37 +00:00
#include "IAnimReader.hpp"
#include "CToken.hpp"
#include "CAnimSource.hpp"
#include "CParticleData.hpp"
namespace urde
{
class IAnimSourceInfo
{
public:
virtual ~IAnimSourceInfo() = default;
virtual bool HasPOIData() const=0;
2016-04-12 06:15:32 +00:00
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;
2016-04-11 23:35:37 +00:00
};
class CAnimSourceInfo : public IAnimSourceInfo
{
TSubAnimTypeToken<CAnimSource> x4_token;
public:
CAnimSourceInfo(const TSubAnimTypeToken<CAnimSource>& token);
bool HasPOIData() const;
2016-04-12 06:15:32 +00:00
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;
2016-04-11 23:35:37 +00:00
};
class CAnimSourceReaderBase : public IAnimReader
{
2016-04-16 03:24:25 +00:00
protected:
2016-04-11 23:35:37 +00:00
std::unique_ptr<IAnimSourceInfo> x4_sourceInfo;
CCharAnimTime xc_curTime;
2016-04-12 06:15:32 +00:00
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;
2016-04-11 23:35:37 +00:00
std::map<std::string, CParticleData::EParentedMode> GetUniqueParticlePOIs() const;
std::map<std::string, s32> GetUniqueInt32POIs() const;
std::map<std::string, bool> GetUniqueBoolPOIs() const;
protected:
2016-04-12 06:15:32 +00:00
void PostConstruct(const CCharAnimTime& time);
2016-04-11 23:35:37 +00:00
void UpdatePOIStates();
2016-04-16 03:24:25 +00:00
CAnimSourceReaderBase(std::unique_ptr<IAnimSourceInfo>&& sourceInfo,
const CAnimSourceReaderBase& other);
2016-04-11 23:35:37 +00:00
public:
CAnimSourceReaderBase(std::unique_ptr<IAnimSourceInfo>&& sourceInfo,
const CCharAnimTime& time);
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;
2016-04-12 06:15:32 +00:00
bool VGetBoolPOIState(const char* name) const;
s32 VGetInt32POIState(const char* name) const;
CParticleData::EParentedMode VGetParticlePOIState(const char* name) const;
using IAnimReader::VGetOffset;
2016-04-12 06:15:32 +00:00
virtual zeus::CVector3f VGetOffset(const CSegId& seg, const CCharAnimTime& b) const=0;
virtual bool VSupportsReverseView() const=0;
virtual SAdvancementResults VReverseView(const CCharAnimTime& time)=0;
const CCharAnimTime& GetCurTime() const { return xc_curTime; }
2016-04-11 23:35:37 +00:00
};
class CAnimSourceReader : public CAnimSourceReaderBase
{
TSubAnimTypeToken<CAnimSource> x54_source;
2016-04-16 03:24:25 +00:00
CSteadyStateAnimInfo x64_steadyStateInfo;
2016-04-11 23:35:37 +00:00
public:
CAnimSourceReader(const TSubAnimTypeToken<CAnimSource>& source, const CCharAnimTime& time);
2016-04-16 03:24:25 +00:00
CAnimSourceReader(const CAnimSourceReader& other);
2016-04-12 06:15:32 +00:00
SAdvancementResults VGetAdvancementResults(const CCharAnimTime& a, const CCharAnimTime& b) const;
bool VSupportsReverseView() const {return true;}
void VSetPhase(float);
SAdvancementResults VReverseView(const CCharAnimTime& time);
2017-03-01 06:02:54 +00:00
std::unique_ptr<IAnimReader> VClone() const;
2016-04-12 06:15:32 +00:00
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;
2016-04-16 03:24:25 +00:00
CSteadyStateAnimInfo VGetSteadyStateAnimInfo() const;
2016-04-12 06:15:32 +00:00
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;
2016-04-11 23:35:37 +00:00
};
}