mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-29 22:20:33 +00:00
Derive the value of MovementAnimationControlled instead of storing it.
This commit is contained in:
parent
7c28066268
commit
45a2b8042d
@ -353,6 +353,7 @@ namespace MWMechanics
|
||||
{
|
||||
clearStateAnimation(mCurrentMovement);
|
||||
mMovementState = CharState_None;
|
||||
mMovementAnimationHasMovement = false;
|
||||
}
|
||||
|
||||
void CharacterController::resetCurrentIdleState()
|
||||
@ -705,7 +706,7 @@ namespace MWMechanics
|
||||
if (!mCurrentMovement.empty() && movementAnimName == mCurrentMovement)
|
||||
mAnimation->getInfo(mCurrentMovement, &startpoint);
|
||||
|
||||
mMovementAnimationControlled = true;
|
||||
mMovementAnimationHasMovement = true;
|
||||
|
||||
clearStateAnimation(mCurrentMovement);
|
||||
mCurrentMovement = movementAnimName;
|
||||
@ -743,7 +744,7 @@ namespace MWMechanics
|
||||
bool sneaking = mMovementState == CharState_SneakForward || mMovementState == CharState_SneakBack
|
||||
|| mMovementState == CharState_SneakLeft || mMovementState == CharState_SneakRight;
|
||||
mMovementAnimSpeed = (sneaking ? 33.5452f : (isRunning() ? 222.857f : 154.064f));
|
||||
mMovementAnimationControlled = false;
|
||||
mMovementAnimationHasMovement = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -821,9 +822,6 @@ namespace MWMechanics
|
||||
mCurrentIdle = idleGroup;
|
||||
mAnimation->play(mCurrentIdle, priority, MWRender::Animation::BlendMask_All, false, 1.0f, "start", "stop",
|
||||
startPoint, numLoops, true);
|
||||
|
||||
// May still be false after recent turn or jump animations
|
||||
mMovementAnimationControlled = true;
|
||||
}
|
||||
|
||||
void CharacterController::refreshCurrentAnims(
|
||||
@ -855,7 +853,6 @@ namespace MWMechanics
|
||||
resetCurrentHitState();
|
||||
resetCurrentIdleState();
|
||||
resetCurrentJumpState();
|
||||
mMovementAnimationControlled = true;
|
||||
|
||||
mAnimation->play(mCurrentDeath, Priority_Death, MWRender::Animation::BlendMask_All, false, 1.0f, "start",
|
||||
"stop", startpoint, 0);
|
||||
@ -2312,9 +2309,6 @@ namespace MWMechanics
|
||||
updateIdleStormState(inwater);
|
||||
}
|
||||
|
||||
if (mInJump)
|
||||
mMovementAnimationControlled = false;
|
||||
|
||||
if (isTurning())
|
||||
{
|
||||
// Adjust animation speed from 1.0 to 1.5 multiplier
|
||||
@ -2350,7 +2344,7 @@ namespace MWMechanics
|
||||
}
|
||||
}
|
||||
|
||||
if (!mMovementAnimationControlled)
|
||||
if (!isMovementAnimationControlled())
|
||||
world->queueMovement(mPtr, vec);
|
||||
}
|
||||
|
||||
@ -2419,7 +2413,7 @@ namespace MWMechanics
|
||||
}
|
||||
|
||||
// Update movement
|
||||
if (mMovementAnimationControlled && mPtr.getClass().isActor())
|
||||
if (isMovementAnimationControlled() && mPtr.getClass().isActor())
|
||||
world->queueMovement(mPtr, moved);
|
||||
|
||||
mSkipAnim = false;
|
||||
@ -2580,6 +2574,17 @@ namespace MWMechanics
|
||||
return mAnimation->isPlaying(groupName);
|
||||
}
|
||||
|
||||
bool CharacterController::isMovementAnimationControlled() const
|
||||
{
|
||||
bool movementAnimationControlled = true;
|
||||
movementAnimationControlled = mIdleState != CharState_None;
|
||||
if (mMovementState != CharState_None)
|
||||
movementAnimationControlled = mMovementAnimationHasMovement;
|
||||
if (mInJump)
|
||||
movementAnimationControlled = false;
|
||||
return movementAnimationControlled;
|
||||
}
|
||||
|
||||
void CharacterController::clearAnimQueue(bool clearPersistAnims)
|
||||
{
|
||||
// Do not interrupt scripted animations, if we want to keep them
|
||||
|
@ -147,7 +147,7 @@ namespace MWMechanics
|
||||
std::string mCurrentMovement;
|
||||
float mMovementAnimSpeed{ 0.f };
|
||||
bool mAdjustMovementAnimSpeed{ false };
|
||||
bool mMovementAnimationControlled{ true };
|
||||
bool mMovementAnimationHasMovement{ false };
|
||||
|
||||
CharacterState mDeathState{ CharState_None };
|
||||
std::string mCurrentDeath;
|
||||
@ -272,6 +272,7 @@ namespace MWMechanics
|
||||
bool playGroup(std::string_view groupname, int mode, int count, bool persist = false);
|
||||
void skipAnim();
|
||||
bool isAnimPlaying(std::string_view groupName) const;
|
||||
bool isMovementAnimationControlled() const;
|
||||
|
||||
enum KillResult
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user