mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 22:27:43 +00:00
CAnimSourceReader imps
This commit is contained in:
@@ -241,61 +241,210 @@ CAnimSourceReaderBase::CAnimSourceReaderBase(std::unique_ptr<IAnimSourceInfo>&&
|
||||
const CCharAnimTime& time)
|
||||
: x4_sourceInfo(std::move(sourceInfo)), xc_curTime(time) {}
|
||||
|
||||
SAdvancementResults CAnimSourceReader::VGetAdvancementResults(const CCharAnimTime& a,
|
||||
const CCharAnimTime& b) const
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
void CAnimSourceReader::VSetPhase(float)
|
||||
void CAnimSourceReader::VSetPhase(float phase)
|
||||
{
|
||||
xc_curTime = phase * x54_source->GetDuration();
|
||||
if (x54_source->GetPOIData())
|
||||
{
|
||||
UpdatePOIStates();
|
||||
if (!xc_curTime.GreaterThanZero())
|
||||
{
|
||||
x14_passedBoolCount = 0;
|
||||
x18_passedIntCount = 0;
|
||||
x1c_passedParticleCount = 0;
|
||||
x20_passedSoundCount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SAdvancementResults CAnimSourceReader::VReverseView(const CCharAnimTime& time)
|
||||
SAdvancementResults CAnimSourceReader::VReverseView(const CCharAnimTime& dt)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<IAnimReader> CAnimSourceReader::VClone() const
|
||||
{
|
||||
return std::make_shared<CAnimSourceReader>(*this);
|
||||
}
|
||||
|
||||
void CAnimSourceReader::VGetSegStatementSet(const CSegIdList& list,
|
||||
CSegStatementSet& setOut) const
|
||||
{
|
||||
x54_source->GetSegStatementSet(list, setOut, xc_curTime);
|
||||
}
|
||||
|
||||
void CAnimSourceReader::VGetSegStatementSet(const CSegIdList& list,
|
||||
CSegStatementSet& setOut,
|
||||
const CCharAnimTime& time) const
|
||||
{
|
||||
x54_source->GetSegStatementSet(list, setOut, time);
|
||||
}
|
||||
|
||||
SAdvancementResults CAnimSourceReader::VAdvanceView(const CCharAnimTime& a)
|
||||
SAdvancementResults CAnimSourceReader::VAdvanceView(const CCharAnimTime& dt)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
CCharAnimTime CAnimSourceReader::VGetTimeRemaining() const
|
||||
{
|
||||
return x54_source->GetDuration() - xc_curTime;
|
||||
}
|
||||
|
||||
void CAnimSourceReader::VGetSteadyStateAnimInfo() const
|
||||
CSteadyStateAnimInfo CAnimSourceReader::VGetSteadyStateAnimInfo() const
|
||||
{
|
||||
return x64_steadyStateInfo;
|
||||
}
|
||||
|
||||
bool CAnimSourceReader::VHasOffset(const CSegId& seg) const
|
||||
{
|
||||
return x54_source->HasOffset(seg);
|
||||
}
|
||||
|
||||
zeus::CVector3f CAnimSourceReader::VGetOffset(const CSegId& seg) const
|
||||
{
|
||||
return x54_source->GetOffset(seg, xc_curTime);
|
||||
}
|
||||
|
||||
zeus::CVector3f CAnimSourceReader::VGetOffset(const CSegId& seg,
|
||||
const CCharAnimTime& time) const
|
||||
{
|
||||
return x54_source->GetOffset(seg, time);
|
||||
}
|
||||
|
||||
zeus::CQuaternion CAnimSourceReader::VGetRotation(const CSegId& seg) const
|
||||
{
|
||||
return x54_source->GetRotation(seg, xc_curTime);
|
||||
}
|
||||
|
||||
CAnimSourceReader::CAnimSourceReader(const TSubAnimTypeToken<CAnimSource>& source,
|
||||
@@ -304,10 +453,15 @@ CAnimSourceReader::CAnimSourceReader(const TSubAnimTypeToken<CAnimSource>& sourc
|
||||
x54_source(source)
|
||||
{
|
||||
CAnimSource* sourceData = x54_source.GetObj();
|
||||
x64_duration = sourceData->GetDuration();
|
||||
x6c_curRootOffset = sourceData->GetOffset(sourceData->GetRootBoneId(), time);
|
||||
x64_steadyStateInfo.x64_duration = sourceData->GetDuration();
|
||||
x64_steadyStateInfo.x6c_curRootOffset = sourceData->GetOffset(sourceData->GetRootBoneId(), time);
|
||||
PostConstruct(time);
|
||||
}
|
||||
|
||||
CAnimSourceReader::CAnimSourceReader(const CAnimSourceReader& other)
|
||||
: CAnimSourceReaderBase(std::make_unique<CAnimSourceInfo>(other.x54_source), other),
|
||||
x54_source(other.x54_source), x64_steadyStateInfo(other.x64_steadyStateInfo)
|
||||
{}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user