1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-06 09:39:49 +00:00

Fix first person swimming animations

This commit is contained in:
Capostrophic 2018-10-05 16:29:57 +03:00
parent 38758a9555
commit 34e45efac3

View File

@ -432,18 +432,24 @@ void CharacterController::refreshMovementAnims(const WeaponInfo* weap, Character
if(movestate != sMovementListEnd) if(movestate != sMovementListEnd)
{ {
movementAnimName = movestate->groupname; movementAnimName = movestate->groupname;
if(weap != sWeaponTypeListEnd && movementAnimName.find("swim") == std::string::npos) if(weap != sWeaponTypeListEnd)
{
std::string::size_type swimpos = movementAnimName.find("swim");
if (swimpos == std::string::npos)
{ {
if (mWeaponType == WeapType_Spell && (movement == CharState_TurnLeft || movement == CharState_TurnRight)) // Spellcasting stance turning is a special case if (mWeaponType == WeapType_Spell && (movement == CharState_TurnLeft || movement == CharState_TurnRight)) // Spellcasting stance turning is a special case
movementAnimName = weap->shortgroup + movementAnimName; movementAnimName = weap->shortgroup + movementAnimName;
else else
movementAnimName += weap->shortgroup; movementAnimName += weap->shortgroup;
}
if(!mAnimation->hasAnimation(movementAnimName)) if(!mAnimation->hasAnimation(movementAnimName))
{ {
movemask = MWRender::Animation::BlendMask_LowerBody; movemask = MWRender::Animation::BlendMask_LowerBody;
movementAnimName = movestate->groupname; movementAnimName = movestate->groupname;
if (swimpos == std::string::npos)
{
// Since we apply movement only for lower body, do not reset idle animations. // Since we apply movement only for lower body, do not reset idle animations.
// For upper body there will be idle animation. // For upper body there will be idle animation.
if (idle == CharState_None) if (idle == CharState_None)
@ -453,6 +459,11 @@ void CharacterController::refreshMovementAnims(const WeaponInfo* weap, Character
if (mWeaponType == WeapType_Crossbow) if (mWeaponType == WeapType_Crossbow)
movementAnimName += "1h"; movementAnimName += "1h";
} }
else if (idle == CharState_None)
{
idle = CharState_IdleSwim;
}
}
} }
} }