metaforce/Runtime/Character/CAnimTreeTimeScale.cpp

56 lines
1.5 KiB
C++
Raw Normal View History

2016-09-14 05:45:46 +00:00
#include "CAnimTreeTimeScale.hpp"
namespace urde
{
2017-07-10 04:55:51 +00:00
CAnimTreeTimeScale::CAnimTreeTimeScale(const std::weak_ptr<CAnimTreeNode>& node, float scale,
const std::string& name)
2016-09-14 05:45:46 +00:00
: CAnimTreeSingleChild(node, name)
, x18_timeScale(new CConstantAnimationTimeScale(scale))
{
}
2017-07-10 04:55:51 +00:00
std::string CAnimTreeTimeScale::CreatePrimitiveName(const std::weak_ptr<CAnimTreeNode>&, float,
const CCharAnimTime&, float)
2016-09-14 05:45:46 +00:00
{
return {};
}
CCharAnimTime CAnimTreeTimeScale::GetRealLifeTime(const CCharAnimTime& time) const
{
CCharAnimTime timeRem = x14_child->VGetTimeRemaining();
CCharAnimTime tmp = std::min(timeRem, time);
if (x28_ > CCharAnimTime())
{
if (tmp < CCharAnimTime(x28_ * x20_))
2017-07-10 04:55:51 +00:00
return x18_timeScale->VTimeScaleIntegral(x20_.GetSeconds(),
(x20_ + tmp).GetSeconds());
2016-09-14 05:45:46 +00:00
else
{
2017-07-10 04:55:51 +00:00
CCharAnimTime integral =
x18_timeScale->VTimeScaleIntegral(x20_.GetSeconds(), x28_.GetSeconds());
2016-09-14 05:45:46 +00:00
if (integral > tmp)
2017-07-10 04:55:51 +00:00
return x18_timeScale->VFindUpperLimit(x20_.GetSeconds(), tmp.GetSeconds()) *
x20_.GetSeconds();
2016-09-14 05:45:46 +00:00
else
return integral + (integral * tmp);
}
}
return tmp;
}
void CAnimTreeTimeScale::VSetPhase(float phase)
{
x14_child->VSetPhase(phase);
}
2017-03-01 06:02:54 +00:00
std::pair<std::unique_ptr<IAnimReader>, bool> CAnimTreeTimeScale::VSimplified()
2016-09-14 05:45:46 +00:00
{
return {};
}
}