Merge branch 'fix_anim_state' into 'master'

Fix AnimState initialization

See merge request OpenMW/openmw!4061
pull/3235/head
psi29a 8 months ago
commit 1e1fd28136

@ -142,45 +142,28 @@ namespace MWRender
struct AnimState struct AnimState
{ {
std::shared_ptr<AnimSource> mSource; std::shared_ptr<AnimSource> mSource;
float mStartTime; float mStartTime = 0;
float mLoopStartTime; float mLoopStartTime = 0;
float mLoopStopTime; float mLoopStopTime = 0;
float mStopTime; float mStopTime = 0;
typedef std::shared_ptr<float> TimePtr; std::shared_ptr<float> mTime = std::make_shared<float>(0);
TimePtr mTime; float mSpeedMult = 1;
float mSpeedMult;
bool mPlaying = false;
bool mPlaying; bool mLoopingEnabled = true;
bool mLoopingEnabled; uint32_t mLoopCount = 0;
uint32_t mLoopCount;
AnimPriority mPriority{ 0 };
AnimPriority mPriority; int mBlendMask = 0;
int mBlendMask; bool mAutoDisable = true;
bool mAutoDisable;
AnimState()
: mStartTime(0.0f)
, mLoopStartTime(0.0f)
, mLoopStopTime(0.0f)
, mStopTime(0.0f)
, mTime(new float)
, mSpeedMult(1.0f)
, mPlaying(false)
, mLoopingEnabled(true)
, mLoopCount(0)
, mPriority(0)
, mBlendMask(0)
, mAutoDisable(true)
{
}
~AnimState() = default;
float getTime() const { return *mTime; } float getTime() const { return *mTime; }
void setTime(float time) { *mTime = time; } void setTime(float time) { *mTime = time; }
bool shouldLoop() const { return getTime() >= mLoopStopTime && mLoopingEnabled && mLoopCount > 0; } bool shouldLoop() const { return getTime() >= mLoopStopTime && mLoopingEnabled && mLoopCount > 0; }
}; };
typedef std::map<std::string, AnimState, std::less<>> AnimStateMap; typedef std::map<std::string, AnimState, std::less<>> AnimStateMap;
AnimStateMap mStates; AnimStateMap mStates;

Loading…
Cancel
Save