metaforce/Runtime/Character/CAdditiveAnimPlayback.hpp

70 lines
2.0 KiB
C++
Raw Normal View History

2016-04-16 03:24:25 +00:00
#ifndef __URDE_CADDITIVEANIMPLAYBACK_HPP__
#define __URDE_CADDITIVEANIMPLAYBACK_HPP__
#include "RetroTypes.hpp"
namespace urde
{
class CAnimTreeNode;
class CAdditiveAnimationInfo;
class CSegIdList;
class CCharLayoutInfo;
class CSegStatementSet;
class CAdditiveAnimationInfo
{
float x0_fadeInDur = 0.f;
float x4_fadeOutDur = 0.f;
2016-04-16 03:24:25 +00:00
public:
void read(CInputStream& in)
{
x0_fadeInDur = in.readFloatBig();
x4_fadeOutDur = in.readFloatBig();
2016-04-16 03:24:25 +00:00
}
CAdditiveAnimationInfo() = default;
CAdditiveAnimationInfo(CInputStream& in) {read(in);}
float GetFadeInDuration() const {return x0_fadeInDur;}
float GetFadeOutDuration() const {return x4_fadeOutDur;}
2016-04-16 03:24:25 +00:00
};
2017-03-01 06:02:54 +00:00
enum class EAdditivePlaybackPhase
{
None,
FadingIn,
FadingOut,
FadedIn,
FadedOut
};
2016-04-16 03:24:25 +00:00
class CAdditiveAnimPlayback
{
CAdditiveAnimationInfo x0_info;
std::shared_ptr<CAnimTreeNode> x8_anim;
float xc_targetWeight;
float x10_curWeight = 0.f;
2016-09-04 02:27:35 +00:00
bool x14_active;
float x18_weightTimer = 0.f;
EAdditivePlaybackPhase x1c_phase = EAdditivePlaybackPhase::FadingIn;
2018-05-17 00:04:07 +00:00
bool x20_needsFadeOut = false;
2016-04-16 03:24:25 +00:00
public:
2016-09-04 02:27:35 +00:00
CAdditiveAnimPlayback(const std::weak_ptr<CAnimTreeNode>& anim, float weight, bool active,
2018-05-17 00:04:07 +00:00
const CAdditiveAnimationInfo& info, bool fadeOut);
2016-04-16 03:24:25 +00:00
void AddToSegStatementSet(const CSegIdList& list, const CCharLayoutInfo&, CSegStatementSet&) const;
void Update(float dt);
void FadeOut();
void SetWeight(float w);
float GetTargetWeight() const {return xc_targetWeight;}
2016-09-04 02:27:35 +00:00
bool IsActive() const {return x14_active;}
2017-03-01 06:02:54 +00:00
void SetActive(bool active) {x14_active = active;}
const std::shared_ptr<CAnimTreeNode>& GetAnim() const {return x8_anim;}
2017-03-01 06:02:54 +00:00
std::shared_ptr<CAnimTreeNode>& GetAnim() {return x8_anim;}
EAdditivePlaybackPhase GetPhase() const {return x1c_phase;}
2018-05-17 00:04:07 +00:00
void SetNeedsFadeOut(bool b) {x20_needsFadeOut = b;}
bool NeedsFadeOut() const {return x20_needsFadeOut;}
2016-04-16 03:24:25 +00:00
};
}
#endif // __URDE_CADDITIVEANIMPLAYBACK_HPP__