mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-22 04:23:53 +00:00
Fix some animations not playing properly
Default movement animation speed multiplier should be 1, not 0. Only randomize death1...death5 for NPCs.
This commit is contained in:
parent
e5e9c83ed5
commit
e2e278d06d
1 changed files with 22 additions and 13 deletions
|
@ -208,11 +208,11 @@ void CharacterController::refreshCurrentAnims(CharacterState idle, CharacterStat
|
||||||
mCurrentMovement = movement;
|
mCurrentMovement = movement;
|
||||||
if(!mCurrentMovement.empty())
|
if(!mCurrentMovement.empty())
|
||||||
{
|
{
|
||||||
float vel, speed = 0.0f;
|
float vel, speedmult = 1.0f;
|
||||||
if(mMovementSpeed > 0.0f && (vel=mAnimation->getVelocity(mCurrentMovement)) > 1.0f)
|
if(mMovementSpeed > 0.0f && (vel=mAnimation->getVelocity(mCurrentMovement)) > 1.0f)
|
||||||
speed = mMovementSpeed / vel;
|
speedmult = mMovementSpeed / vel;
|
||||||
mAnimation->play(mCurrentMovement, Priority_Movement, movegroup, false,
|
mAnimation->play(mCurrentMovement, Priority_Movement, movegroup, false,
|
||||||
speed, "start", "stop", 0.0f, ~0ul);
|
speedmult, "start", "stop", 0.0f, ~0ul);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -640,20 +640,29 @@ void CharacterController::forceStateUpdate()
|
||||||
|
|
||||||
void CharacterController::kill()
|
void CharacterController::kill()
|
||||||
{
|
{
|
||||||
static const CharacterState deathstates[] = {
|
|
||||||
CharState_Death1, CharState_Death2, CharState_Death3, CharState_Death4, CharState_Death5
|
|
||||||
};
|
|
||||||
|
|
||||||
if(mDeathState != CharState_None)
|
if(mDeathState != CharState_None)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mDeathState = deathstates[(int)(rand()/((double)RAND_MAX+1.0)*5.0)];
|
if(mPtr.getTypeName() == typeid(ESM::NPC).name())
|
||||||
const StateInfo *state = std::find_if(sStateList, sStateListEnd, FindCharState(mDeathState));
|
{
|
||||||
if(state == sStateListEnd)
|
static const CharacterState deathstates[] = {
|
||||||
throw std::runtime_error("Failed to find character state "+Ogre::StringConverter::toString(mDeathState));
|
CharState_Death1, CharState_Death2, CharState_Death3, CharState_Death4, CharState_Death5
|
||||||
|
};
|
||||||
|
|
||||||
mCurrentDeath = state->groupname;
|
mDeathState = deathstates[(int)(rand()/((double)RAND_MAX+1.0)*5.0)];
|
||||||
if(mAnimation && !mAnimation->getInfo(mCurrentDeath))
|
const StateInfo *state = std::find_if(sStateList, sStateListEnd, FindCharState(mDeathState));
|
||||||
|
if(state == sStateListEnd)
|
||||||
|
throw std::runtime_error("Failed to find character state "+Ogre::StringConverter::toString(mDeathState));
|
||||||
|
|
||||||
|
mCurrentDeath = state->groupname;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mDeathState = CharState_Death1;
|
||||||
|
mCurrentDeath = "death1";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mAnimation)
|
||||||
mAnimation->play(mCurrentDeath, Priority_Death, MWRender::Animation::Group_All,
|
mAnimation->play(mCurrentDeath, Priority_Death, MWRender::Animation::Group_All,
|
||||||
false, 1.0f, "start", "stop", 0.0f, 0);
|
false, 1.0f, "start", "stop", 0.0f, 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue