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