mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 21:49:55 +00:00
Play scripted animations even if SkipAnim is used
This commit is contained in:
parent
25bb7c1826
commit
f299be8158
2 changed files with 19 additions and 1 deletions
|
@ -2035,7 +2035,8 @@ void CharacterController::update(float duration)
|
||||||
world->queueMovement(mPtr, osg::Vec3f(0.f, 0.f, 0.f));
|
world->queueMovement(mPtr, osg::Vec3f(0.f, 0.f, 0.f));
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Vec3f moved = mAnimation->runAnimation(mSkipAnim ? 0.f : duration);
|
bool isPersist = isPersistentAnimPlaying();
|
||||||
|
osg::Vec3f moved = mAnimation->runAnimation(mSkipAnim && !isPersist ? 0.f : duration);
|
||||||
if(duration > 0.0f)
|
if(duration > 0.0f)
|
||||||
moved /= duration;
|
moved /= duration;
|
||||||
else
|
else
|
||||||
|
|
|
@ -1089,11 +1089,28 @@ namespace MWRender
|
||||||
|
|
||||||
osg::Vec3f Animation::runAnimation(float duration)
|
osg::Vec3f Animation::runAnimation(float duration)
|
||||||
{
|
{
|
||||||
|
// If we have scripted animations, play only them
|
||||||
|
bool hasScriptedAnims = false;
|
||||||
|
for (AnimStateMap::iterator stateiter = mStates.begin(); stateiter != mStates.end(); stateiter++)
|
||||||
|
{
|
||||||
|
if (stateiter->second.mPriority.contains(int(MWMechanics::Priority_Persistent)) && stateiter->second.mPlaying)
|
||||||
|
{
|
||||||
|
hasScriptedAnims = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
osg::Vec3f movement(0.f, 0.f, 0.f);
|
osg::Vec3f movement(0.f, 0.f, 0.f);
|
||||||
AnimStateMap::iterator stateiter = mStates.begin();
|
AnimStateMap::iterator stateiter = mStates.begin();
|
||||||
while(stateiter != mStates.end())
|
while(stateiter != mStates.end())
|
||||||
{
|
{
|
||||||
AnimState &state = stateiter->second;
|
AnimState &state = stateiter->second;
|
||||||
|
if (hasScriptedAnims && !state.mPriority.contains(int(MWMechanics::Priority_Persistent)))
|
||||||
|
{
|
||||||
|
++stateiter;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const NifOsg::TextKeyMap &textkeys = state.mSource->getTextKeys();
|
const NifOsg::TextKeyMap &textkeys = state.mSource->getTextKeys();
|
||||||
NifOsg::TextKeyMap::const_iterator textkey(textkeys.upper_bound(state.getTime()));
|
NifOsg::TextKeyMap::const_iterator textkey(textkeys.upper_bound(state.getTime()));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue