2016-04-11 23:35:37 +00:00
|
|
|
#include "CAnimSourceReader.hpp"
|
2016-04-12 06:15:32 +00:00
|
|
|
#include "CBoolPOINode.hpp"
|
|
|
|
#include "CInt32POINode.hpp"
|
|
|
|
#include "CParticlePOINode.hpp"
|
|
|
|
#include "CSoundPOINode.hpp"
|
2017-11-27 05:06:53 +00:00
|
|
|
#include "CFBStreamedAnimReader.hpp"
|
2016-04-11 23:35:37 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
|
2016-04-12 06:15:32 +00:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2018-11-21 00:51:15 +00:00
|
|
|
std::set<std::pair<std::string, s32>>
|
2016-04-12 06:15:32 +00:00
|
|
|
CAnimSourceReaderBase::GetUniqueParticlePOIs() const
|
|
|
|
{
|
|
|
|
const std::vector<CParticlePOINode>& particleNodes = x4_sourceInfo->GetParticlePOIStream();
|
2018-11-21 00:51:15 +00:00
|
|
|
std::set<std::pair<std::string, s32>> ret;
|
2016-04-12 06:15:32 +00:00
|
|
|
for (const CParticlePOINode& node : particleNodes)
|
2018-11-21 00:51:15 +00:00
|
|
|
if (node.GetUnique())
|
|
|
|
ret.insert(std::make_pair(std::string(node.GetString()), node.GetIndex()));
|
2016-04-12 06:15:32 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-11-21 00:51:15 +00:00
|
|
|
std::set<std::pair<std::string, s32>>
|
2016-04-12 06:15:32 +00:00
|
|
|
CAnimSourceReaderBase::GetUniqueInt32POIs() const
|
|
|
|
{
|
|
|
|
const std::vector<CInt32POINode>& int32Nodes = x4_sourceInfo->GetInt32POIStream();
|
2018-11-21 00:51:15 +00:00
|
|
|
std::set<std::pair<std::string, s32>> ret;
|
2016-04-12 06:15:32 +00:00
|
|
|
for (const CInt32POINode& node : int32Nodes)
|
2018-11-21 00:51:15 +00:00
|
|
|
if (node.GetUnique())
|
|
|
|
ret.insert(std::make_pair(std::string(node.GetString()), node.GetIndex()));
|
2016-04-12 06:15:32 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-11-21 00:51:15 +00:00
|
|
|
std::set<std::pair<std::string, s32>>
|
2016-04-12 06:15:32 +00:00
|
|
|
CAnimSourceReaderBase::GetUniqueBoolPOIs() const
|
|
|
|
{
|
|
|
|
const std::vector<CBoolPOINode>& boolNodes = x4_sourceInfo->GetBoolPOIStream();
|
2018-11-21 00:51:15 +00:00
|
|
|
std::set<std::pair<std::string, s32>> ret;
|
2016-04-12 06:15:32 +00:00
|
|
|
for (const CBoolPOINode& node : boolNodes)
|
2018-11-21 00:51:15 +00:00
|
|
|
if (node.GetUnique())
|
|
|
|
ret.insert(std::make_pair(std::string(node.GetString()), node.GetIndex()));
|
2016-04-12 06:15:32 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CAnimSourceReaderBase::PostConstruct(const CCharAnimTime& time)
|
|
|
|
{
|
|
|
|
x14_passedBoolCount = 0;
|
|
|
|
x18_passedIntCount = 0;
|
|
|
|
x1c_passedParticleCount = 0;
|
|
|
|
x20_passedSoundCount = 0;
|
|
|
|
|
|
|
|
if (x4_sourceInfo->HasPOIData())
|
|
|
|
{
|
2018-11-21 00:51:15 +00:00
|
|
|
std::set<std::pair<std::string, s32>> boolPOIs = GetUniqueBoolPOIs();
|
|
|
|
std::set<std::pair<std::string, s32>> int32POIs = GetUniqueInt32POIs();
|
|
|
|
std::set<std::pair<std::string, s32>> particlePOIs = GetUniqueParticlePOIs();
|
2016-04-12 06:15:32 +00:00
|
|
|
|
2018-11-21 00:51:15 +00:00
|
|
|
x24_boolStates.resize(boolPOIs.size());
|
|
|
|
x34_int32States.resize(int32POIs.size());
|
|
|
|
x44_particleStates.resize(particlePOIs.size());
|
2016-04-12 06:15:32 +00:00
|
|
|
|
2018-11-21 00:51:15 +00:00
|
|
|
for (const auto& poi : boolPOIs)
|
|
|
|
x24_boolStates[poi.second] = std::make_pair(poi.first, false);
|
2016-04-12 06:15:32 +00:00
|
|
|
for (const auto& poi : int32POIs)
|
2018-11-21 00:51:15 +00:00
|
|
|
x34_int32States[poi.second] = std::make_pair(poi.first, 0);
|
2016-04-12 06:15:32 +00:00
|
|
|
for (const auto& poi : particlePOIs)
|
2018-11-21 00:51:15 +00:00
|
|
|
x44_particleStates[poi.second] = std::make_pair(poi.first, CParticleData::EParentedMode::Initial);
|
2016-04-12 06:15:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
2018-05-13 04:09:11 +00:00
|
|
|
while (x14_passedBoolCount < boolNodes.size() &&
|
|
|
|
boolNodes[x14_passedBoolCount].GetTime() <= xc_curTime)
|
2016-04-12 06:15:32 +00:00
|
|
|
{
|
2018-05-13 04:09:11 +00:00
|
|
|
auto& node = boolNodes[x14_passedBoolCount];
|
|
|
|
if (node.GetIndex() >= 0)
|
2016-04-12 06:15:32 +00:00
|
|
|
x24_boolStates[node.GetIndex()].second = node.GetValue();
|
|
|
|
++x14_passedBoolCount;
|
|
|
|
}
|
|
|
|
|
2018-05-13 04:09:11 +00:00
|
|
|
while (x18_passedIntCount < int32Nodes.size() &&
|
|
|
|
int32Nodes[x18_passedIntCount].GetTime() <= xc_curTime)
|
2016-04-12 06:15:32 +00:00
|
|
|
{
|
2018-05-13 04:09:11 +00:00
|
|
|
auto& node = int32Nodes[x18_passedIntCount];
|
|
|
|
if (node.GetIndex() >= 0)
|
2016-04-12 06:15:32 +00:00
|
|
|
x34_int32States[node.GetIndex()].second = node.GetValue();
|
|
|
|
++x18_passedIntCount;
|
|
|
|
}
|
|
|
|
|
2018-05-13 04:09:11 +00:00
|
|
|
while (x1c_passedParticleCount < particleNodes.size() &&
|
|
|
|
particleNodes[x1c_passedParticleCount].GetTime() <= xc_curTime)
|
2016-04-12 06:15:32 +00:00
|
|
|
{
|
2018-05-13 04:09:11 +00:00
|
|
|
auto& node = particleNodes[x1c_passedParticleCount];
|
|
|
|
if (node.GetIndex() >= 0)
|
2016-04-28 04:52:41 +00:00
|
|
|
x44_particleStates[node.GetIndex()].second = node.GetParticleData().GetParentedMode();
|
2016-04-12 06:15:32 +00:00
|
|
|
++x1c_passedParticleCount;
|
|
|
|
}
|
|
|
|
|
2018-05-13 04:09:11 +00:00
|
|
|
while (x20_passedSoundCount < soundNodes.size() &&
|
|
|
|
soundNodes[x20_passedSoundCount].GetTime() <= xc_curTime)
|
2016-04-12 06:15:32 +00:00
|
|
|
{
|
|
|
|
++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();
|
2016-08-27 21:19:55 +00:00
|
|
|
return _getPOIList(time, listOut, capacity, iterator, unk, boolNodes,
|
|
|
|
xc_curTime, *x4_sourceInfo, x14_passedBoolCount);
|
2016-04-12 06:15:32 +00:00
|
|
|
}
|
|
|
|
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();
|
2016-08-27 21:19:55 +00:00
|
|
|
return _getPOIList(time, listOut, capacity, iterator, unk, int32Nodes,
|
|
|
|
xc_curTime, *x4_sourceInfo, x18_passedIntCount);
|
2016-04-12 06:15:32 +00:00
|
|
|
}
|
|
|
|
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();
|
2016-08-27 21:19:55 +00:00
|
|
|
return _getPOIList(time, listOut, capacity, iterator, unk, particleNodes,
|
|
|
|
xc_curTime, *x4_sourceInfo, x1c_passedParticleCount);
|
2016-04-12 06:15:32 +00:00
|
|
|
}
|
|
|
|
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();
|
2016-08-27 21:19:55 +00:00
|
|
|
return _getPOIList(time, listOut, capacity, iterator, unk, soundNodes,
|
|
|
|
xc_curTime, *x4_sourceInfo, x20_passedSoundCount);
|
2016-04-12 06:15:32 +00:00
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2016-04-11 23:35:37 +00:00
|
|
|
CAnimSourceReaderBase::CAnimSourceReaderBase(std::unique_ptr<IAnimSourceInfo>&& sourceInfo,
|
|
|
|
const CCharAnimTime& time)
|
|
|
|
: x4_sourceInfo(std::move(sourceInfo)), xc_curTime(time) {}
|
|
|
|
|
2016-04-16 03:24:25 +00:00
|
|
|
CAnimSourceReaderBase::CAnimSourceReaderBase(std::unique_ptr<IAnimSourceInfo>&& sourceInfo,
|
|
|
|
const CAnimSourceReaderBase& other)
|
|
|
|
: x4_sourceInfo(std::move(sourceInfo)),
|
|
|
|
xc_curTime(other.xc_curTime),
|
|
|
|
x14_passedBoolCount(other.x14_passedBoolCount),
|
|
|
|
x18_passedIntCount(other.x18_passedIntCount),
|
|
|
|
x1c_passedParticleCount(other.x1c_passedParticleCount),
|
|
|
|
x20_passedSoundCount(other.x20_passedSoundCount),
|
|
|
|
x24_boolStates(other.x24_boolStates),
|
|
|
|
x34_int32States(other.x34_int32States),
|
|
|
|
x44_particleStates(other.x44_particleStates)
|
|
|
|
{}
|
|
|
|
|
|
|
|
SAdvancementResults CAnimSourceReader::VGetAdvancementResults(const CCharAnimTime& dt,
|
|
|
|
const CCharAnimTime& startOff) const
|
|
|
|
{
|
|
|
|
SAdvancementResults ret;
|
|
|
|
CCharAnimTime accum = xc_curTime + startOff;
|
|
|
|
|
|
|
|
if (xc_curTime + startOff >= x54_source->GetDuration())
|
|
|
|
{
|
|
|
|
ret.x0_remTime = dt;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
else if (dt.EqualsZero())
|
|
|
|
{
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CCharAnimTime prevTime = accum;
|
|
|
|
accum += dt;
|
|
|
|
CCharAnimTime remTime;
|
|
|
|
if (accum > x54_source->GetDuration())
|
|
|
|
{
|
|
|
|
remTime = accum - x54_source->GetDuration();
|
|
|
|
accum = x54_source->GetDuration();
|
|
|
|
}
|
|
|
|
|
|
|
|
zeus::CQuaternion ra = x54_source->GetRotation(3, prevTime).inverse();
|
|
|
|
zeus::CQuaternion rb = x54_source->GetRotation(3, accum);
|
|
|
|
ret.x0_remTime = remTime;
|
|
|
|
ret.x8_deltas.xc_rotDelta = rb * ra;
|
|
|
|
|
|
|
|
if (x54_source->HasOffset(3))
|
|
|
|
{
|
|
|
|
zeus::CVector3f ta = x54_source->GetOffset(3, prevTime);
|
|
|
|
zeus::CVector3f tb = x54_source->GetOffset(3, accum);
|
|
|
|
ret.x8_deltas.x0_posDelta = zeus::CMatrix3f(rb) * (tb - ta);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2016-04-12 06:15:32 +00:00
|
|
|
}
|
|
|
|
|
2016-04-16 03:24:25 +00:00
|
|
|
void CAnimSourceReader::VSetPhase(float phase)
|
2016-04-12 06:15:32 +00:00
|
|
|
{
|
2017-07-10 04:55:51 +00:00
|
|
|
xc_curTime = phase * x54_source->GetDuration().GetSeconds();
|
2016-04-16 03:24:25 +00:00
|
|
|
if (x54_source->GetPOIData())
|
|
|
|
{
|
|
|
|
UpdatePOIStates();
|
|
|
|
if (!xc_curTime.GreaterThanZero())
|
|
|
|
{
|
|
|
|
x14_passedBoolCount = 0;
|
|
|
|
x18_passedIntCount = 0;
|
|
|
|
x1c_passedParticleCount = 0;
|
|
|
|
x20_passedSoundCount = 0;
|
|
|
|
}
|
|
|
|
}
|
2016-04-12 06:15:32 +00:00
|
|
|
}
|
|
|
|
|
2016-04-16 03:24:25 +00:00
|
|
|
SAdvancementResults CAnimSourceReader::VReverseView(const CCharAnimTime& dt)
|
2016-04-12 06:15:32 +00:00
|
|
|
{
|
2016-04-16 03:24:25 +00:00
|
|
|
SAdvancementResults ret;
|
|
|
|
|
|
|
|
if (xc_curTime.EqualsZero())
|
|
|
|
{
|
|
|
|
ret.x0_remTime = dt;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
else if (dt.EqualsZero())
|
|
|
|
{
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CCharAnimTime prevTime = xc_curTime;
|
|
|
|
xc_curTime -= dt;
|
|
|
|
CCharAnimTime remTime;
|
|
|
|
if (xc_curTime < CCharAnimTime())
|
|
|
|
{
|
|
|
|
remTime = CCharAnimTime() - xc_curTime;
|
|
|
|
xc_curTime = CCharAnimTime();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x54_source->GetPOIData())
|
|
|
|
UpdatePOIStates();
|
|
|
|
|
|
|
|
zeus::CQuaternion ra = x54_source->GetRotation(3, prevTime).inverse();
|
|
|
|
zeus::CQuaternion rb = x54_source->GetRotation(3, xc_curTime);
|
|
|
|
ret.x0_remTime = remTime;
|
|
|
|
ret.x8_deltas.xc_rotDelta = rb * ra;
|
|
|
|
|
|
|
|
if (x54_source->HasOffset(3))
|
|
|
|
{
|
|
|
|
zeus::CVector3f ta = x54_source->GetOffset(3, prevTime);
|
|
|
|
zeus::CVector3f tb = x54_source->GetOffset(3, xc_curTime);
|
|
|
|
ret.x8_deltas.x0_posDelta = zeus::CMatrix3f(rb) * (tb - ta);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2016-04-12 06:15:32 +00:00
|
|
|
}
|
|
|
|
|
2017-03-01 06:02:54 +00:00
|
|
|
std::unique_ptr<IAnimReader> CAnimSourceReader::VClone() const
|
2016-04-12 06:15:32 +00:00
|
|
|
{
|
2017-03-01 06:02:54 +00:00
|
|
|
return std::make_unique<CAnimSourceReader>(*this);
|
2016-04-12 06:15:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CAnimSourceReader::VGetSegStatementSet(const CSegIdList& list,
|
|
|
|
CSegStatementSet& setOut) const
|
|
|
|
{
|
2016-04-16 03:24:25 +00:00
|
|
|
x54_source->GetSegStatementSet(list, setOut, xc_curTime);
|
2016-04-12 06:15:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CAnimSourceReader::VGetSegStatementSet(const CSegIdList& list,
|
|
|
|
CSegStatementSet& setOut,
|
|
|
|
const CCharAnimTime& time) const
|
|
|
|
{
|
2016-04-16 03:24:25 +00:00
|
|
|
x54_source->GetSegStatementSet(list, setOut, time);
|
2016-04-12 06:15:32 +00:00
|
|
|
}
|
|
|
|
|
2016-04-16 03:24:25 +00:00
|
|
|
SAdvancementResults CAnimSourceReader::VAdvanceView(const CCharAnimTime& dt)
|
2016-04-12 06:15:32 +00:00
|
|
|
{
|
2016-04-16 03:24:25 +00:00
|
|
|
SAdvancementResults ret;
|
|
|
|
|
|
|
|
if (xc_curTime >= x54_source->GetDuration())
|
|
|
|
{
|
|
|
|
ret.x0_remTime = dt;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
else if (dt.EqualsZero())
|
|
|
|
{
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CCharAnimTime prevTime = xc_curTime;
|
|
|
|
xc_curTime += dt;
|
|
|
|
CCharAnimTime remTime;
|
|
|
|
if (xc_curTime > x54_source->GetDuration())
|
|
|
|
{
|
|
|
|
remTime = xc_curTime - x54_source->GetDuration();
|
|
|
|
xc_curTime = x54_source->GetDuration();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x54_source->GetPOIData())
|
|
|
|
UpdatePOIStates();
|
|
|
|
|
|
|
|
zeus::CQuaternion ra = x54_source->GetRotation(3, prevTime).inverse();
|
|
|
|
zeus::CQuaternion rb = x54_source->GetRotation(3, xc_curTime);
|
|
|
|
ret.x0_remTime = remTime;
|
|
|
|
ret.x8_deltas.xc_rotDelta = rb * ra;
|
|
|
|
|
|
|
|
if (x54_source->HasOffset(3))
|
|
|
|
{
|
|
|
|
zeus::CVector3f ta = x54_source->GetOffset(3, prevTime);
|
|
|
|
zeus::CVector3f tb = x54_source->GetOffset(3, xc_curTime);
|
|
|
|
ret.x8_deltas.x0_posDelta = zeus::CMatrix3f(rb) * (tb - ta);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2016-04-12 06:15:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CCharAnimTime CAnimSourceReader::VGetTimeRemaining() const
|
|
|
|
{
|
2016-04-16 03:24:25 +00:00
|
|
|
return x54_source->GetDuration() - xc_curTime;
|
2016-04-12 06:15:32 +00:00
|
|
|
}
|
|
|
|
|
2016-04-16 03:24:25 +00:00
|
|
|
CSteadyStateAnimInfo CAnimSourceReader::VGetSteadyStateAnimInfo() const
|
2016-04-12 06:15:32 +00:00
|
|
|
{
|
2016-04-16 03:24:25 +00:00
|
|
|
return x64_steadyStateInfo;
|
2016-04-12 06:15:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CAnimSourceReader::VHasOffset(const CSegId& seg) const
|
|
|
|
{
|
2016-04-16 03:24:25 +00:00
|
|
|
return x54_source->HasOffset(seg);
|
2016-04-12 06:15:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
zeus::CVector3f CAnimSourceReader::VGetOffset(const CSegId& seg) const
|
|
|
|
{
|
2016-04-16 03:24:25 +00:00
|
|
|
return x54_source->GetOffset(seg, xc_curTime);
|
2016-04-12 06:15:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
zeus::CVector3f CAnimSourceReader::VGetOffset(const CSegId& seg,
|
|
|
|
const CCharAnimTime& time) const
|
|
|
|
{
|
2016-04-16 03:24:25 +00:00
|
|
|
return x54_source->GetOffset(seg, time);
|
2016-04-12 06:15:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
zeus::CQuaternion CAnimSourceReader::VGetRotation(const CSegId& seg) const
|
|
|
|
{
|
2016-04-16 03:24:25 +00:00
|
|
|
return x54_source->GetRotation(seg, xc_curTime);
|
2016-04-12 06:15:32 +00:00
|
|
|
}
|
|
|
|
|
2016-04-11 23:35:37 +00:00
|
|
|
CAnimSourceReader::CAnimSourceReader(const TSubAnimTypeToken<CAnimSource>& source,
|
|
|
|
const CCharAnimTime& time)
|
2018-01-05 03:02:30 +00:00
|
|
|
: CAnimSourceReaderBase(std::make_unique<CAnimSourceInfo>(source), {}),
|
2016-08-27 21:16:44 +00:00
|
|
|
x54_source(source), x64_steadyStateInfo(false, source->GetDuration(),
|
|
|
|
source->GetOffset(source->GetRootBoneId(), time))
|
2016-04-11 23:35:37 +00:00
|
|
|
{
|
2016-04-12 06:15:32 +00:00
|
|
|
PostConstruct(time);
|
2016-04-11 23:35:37 +00:00
|
|
|
}
|
|
|
|
|
2016-04-16 03:24:25 +00:00
|
|
|
CAnimSourceReader::CAnimSourceReader(const CAnimSourceReader& other)
|
|
|
|
: CAnimSourceReaderBase(std::make_unique<CAnimSourceInfo>(other.x54_source), other),
|
|
|
|
x54_source(other.x54_source), x64_steadyStateInfo(other.x64_steadyStateInfo)
|
|
|
|
{}
|
|
|
|
|
2016-04-12 06:15:32 +00:00
|
|
|
|
2016-04-11 23:35:37 +00:00
|
|
|
}
|