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,
2017-11-13 06:19:18 +00:00
std::string_view 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);
}
std::experimental::optional<std::unique_ptr<IAnimReader>> CAnimTreeTimeScale::VSimplified()
2016-09-14 05:45:46 +00:00
{
return {};
}
}