mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 08:53:52 +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;
|
||||
if(!mCurrentMovement.empty())
|
||||
{
|
||||
float vel, speed = 0.0f;
|
||||
float vel, speedmult = 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,
|
||||
speed, "start", "stop", 0.0f, ~0ul);
|
||||
speedmult, "start", "stop", 0.0f, ~0ul);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -640,20 +640,29 @@ void CharacterController::forceStateUpdate()
|
|||
|
||||
void CharacterController::kill()
|
||||
{
|
||||
static const CharacterState deathstates[] = {
|
||||
CharState_Death1, CharState_Death2, CharState_Death3, CharState_Death4, CharState_Death5
|
||||
};
|
||||
|
||||
if(mDeathState != CharState_None)
|
||||
return;
|
||||
|
||||
mDeathState = deathstates[(int)(rand()/((double)RAND_MAX+1.0)*5.0)];
|
||||
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));
|
||||
if(mPtr.getTypeName() == typeid(ESM::NPC).name())
|
||||
{
|
||||
static const CharacterState deathstates[] = {
|
||||
CharState_Death1, CharState_Death2, CharState_Death3, CharState_Death4, CharState_Death5
|
||||
};
|
||||
|
||||
mCurrentDeath = state->groupname;
|
||||
if(mAnimation && !mAnimation->getInfo(mCurrentDeath))
|
||||
mDeathState = deathstates[(int)(rand()/((double)RAND_MAX+1.0)*5.0)];
|
||||
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,
|
||||
false, 1.0f, "start", "stop", 0.0f, 0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue