1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-27 14:36:49 +00:00

More persist -> script language.

This commit is contained in:
Mads Buvik Sandvei 2023-10-25 21:05:07 +02:00
parent 426f5952a5
commit cf5b782c76
2 changed files with 8 additions and 9 deletions

View file

@ -827,7 +827,7 @@ namespace MWMechanics
void CharacterController::refreshCurrentAnims( void CharacterController::refreshCurrentAnims(
CharacterState idle, CharacterState movement, JumpingState jump, bool force) CharacterState idle, CharacterState movement, JumpingState jump, bool force)
{ {
// If the current animation is persistent, do not touch it // If the current animation is scripted, do not touch it
if (isScriptedAnimPlaying()) if (isScriptedAnimPlaying())
return; return;
@ -1481,7 +1481,7 @@ namespace MWMechanics
sndMgr->stopSound3D(mPtr, wolfRun); sndMgr->stopSound3D(mPtr, wolfRun);
} }
// Combat for actors with persistent animations obviously will be buggy // Combat for actors with scripted animations obviously will be buggy
if (isScriptedAnimPlaying()) if (isScriptedAnimPlaying())
return forcestateupdate; return forcestateupdate;
@ -2399,8 +2399,7 @@ namespace MWMechanics
} }
} }
bool isPersist = isScriptedAnimPlaying(); osg::Vec3f moved = mAnimation->runAnimation(mSkipAnim && !isScriptedAnimPlaying() ? 0.f : duration);
osg::Vec3f moved = mAnimation->runAnimation(mSkipAnim && !isPersist ? 0.f : duration);
if (duration > 0.0f) if (duration > 0.0f)
moved /= duration; moved /= duration;
else else
@ -2521,7 +2520,7 @@ namespace MWMechanics
if (!mAnimation || !mAnimation->hasAnimation(groupname)) if (!mAnimation || !mAnimation->hasAnimation(groupname))
return false; return false;
// We should not interrupt persistent animations by non-scripted ones // We should not interrupt scripted animations with non-scripted ones
if (isScriptedAnimPlaying() && !scripted) if (isScriptedAnimPlaying() && !scripted)
return true; return true;
@ -2612,13 +2611,13 @@ namespace MWMechanics
return movementAnimationControlled; return movementAnimationControlled;
} }
void CharacterController::clearAnimQueue(bool clearPersistAnims) void CharacterController::clearAnimQueue(bool clearScriptedAnims)
{ {
// Do not interrupt scripted animations, if we want to keep them // Do not interrupt scripted animations, if we want to keep them
if ((!isScriptedAnimPlaying() || clearPersistAnims) && !mAnimQueue.empty()) if ((!isScriptedAnimPlaying() || clearScriptedAnims) && !mAnimQueue.empty())
mAnimation->disable(mAnimQueue.front().mGroup); mAnimation->disable(mAnimQueue.front().mGroup);
if (clearPersistAnims) if (clearScriptedAnims)
{ {
mAnimQueue.clear(); mAnimQueue.clear();
return; return;

View file

@ -207,7 +207,7 @@ namespace MWMechanics
void refreshMovementAnims(CharacterState movement, bool force = false); void refreshMovementAnims(CharacterState movement, bool force = false);
void refreshIdleAnims(CharacterState idle, bool force = false); void refreshIdleAnims(CharacterState idle, bool force = false);
void clearAnimQueue(bool clearPersistAnims = false); void clearAnimQueue(bool clearScriptedAnims = false);
bool updateWeaponState(); bool updateWeaponState();
void updateIdleStormState(bool inwater) const; void updateIdleStormState(bool inwater) const;