mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-06 17:15:39 +00:00
Landing animation playback fixes
Cancel landing animation immediately after moving during the first frame of landing and due to turning animation
This commit is contained in:
parent
6a30897d63
commit
819101144d
1 changed files with 38 additions and 40 deletions
|
@ -2047,48 +2047,46 @@ void CharacterController::update(float duration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(mJumpState == JumpState_InAir && !inwater && !flying && solid)
|
|
||||||
{
|
|
||||||
jumpstate = JumpState_Landing;
|
|
||||||
vec.z() = 0.0f;
|
|
||||||
|
|
||||||
float height = cls.getCreatureStats(mPtr).land(isPlayer);
|
|
||||||
float healthLost = getFallDamage(mPtr, height);
|
|
||||||
|
|
||||||
if (healthLost > 0.0f)
|
|
||||||
{
|
|
||||||
const float fatigueTerm = cls.getCreatureStats(mPtr).getFatigueTerm();
|
|
||||||
|
|
||||||
// inflict fall damages
|
|
||||||
if (!godmode)
|
|
||||||
{
|
|
||||||
float realHealthLost = static_cast<float>(healthLost * (1.0f - 0.25f * fatigueTerm));
|
|
||||||
cls.onHit(mPtr, realHealthLost, true, MWWorld::Ptr(), MWWorld::Ptr(), osg::Vec3f(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
const float acrobaticsSkill = cls.getSkill(mPtr, ESM::Skill::Acrobatics);
|
|
||||||
if (healthLost > (acrobaticsSkill * fatigueTerm))
|
|
||||||
{
|
|
||||||
if (!godmode)
|
|
||||||
cls.getCreatureStats(mPtr).setKnockedDown(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// report acrobatics progression
|
|
||||||
if (isPlayer)
|
|
||||||
cls.skillUsageSucceeded(mPtr, ESM::Skill::Acrobatics, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mPtr.getClass().isNpc())
|
|
||||||
playLandingSound = true;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(mPtr.getClass().isNpc() && mJumpState == JumpState_InAir && !flying && solid)
|
if (mJumpState == JumpState_InAir && !flying && solid)
|
||||||
playLandingSound = true;
|
{
|
||||||
|
float height = cls.getCreatureStats(mPtr).land(isPlayer);
|
||||||
|
float healthLost = 0.f;
|
||||||
|
if (!inwater)
|
||||||
|
healthLost = getFallDamage(mPtr, height);
|
||||||
|
|
||||||
jumpstate = mAnimation->isPlaying(mCurrentJump) ? JumpState_Landing : JumpState_None;
|
if (healthLost > 0.0f)
|
||||||
|
{
|
||||||
|
const float fatigueTerm = cls.getCreatureStats(mPtr).getFatigueTerm();
|
||||||
|
|
||||||
|
// inflict fall damages
|
||||||
|
if (!godmode)
|
||||||
|
{
|
||||||
|
float realHealthLost = static_cast<float>(healthLost * (1.0f - 0.25f * fatigueTerm));
|
||||||
|
cls.onHit(mPtr, realHealthLost, true, MWWorld::Ptr(), MWWorld::Ptr(), osg::Vec3f(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
const float acrobaticsSkill = cls.getSkill(mPtr, ESM::Skill::Acrobatics);
|
||||||
|
if (healthLost > (acrobaticsSkill * fatigueTerm))
|
||||||
|
{
|
||||||
|
if (!godmode)
|
||||||
|
cls.getCreatureStats(mPtr).setKnockedDown(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// report acrobatics progression
|
||||||
|
if (isPlayer)
|
||||||
|
cls.skillUsageSucceeded(mPtr, ESM::Skill::Acrobatics, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mPtr.getClass().isNpc())
|
||||||
|
playLandingSound = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mAnimation->isPlaying(mCurrentJump))
|
||||||
|
jumpstate = JumpState_Landing;
|
||||||
|
|
||||||
vec.x() *= scale;
|
vec.x() *= scale;
|
||||||
vec.y() *= scale;
|
vec.y() *= scale;
|
||||||
|
@ -2126,7 +2124,7 @@ void CharacterController::update(float duration)
|
||||||
|
|
||||||
// It seems only bipedal actors use turning animations.
|
// It seems only bipedal actors use turning animations.
|
||||||
// Also do not use turning animations in the first-person view and when sneaking.
|
// Also do not use turning animations in the first-person view and when sneaking.
|
||||||
if (!sneak && jumpstate == JumpState_None && !isFirstPersonPlayer && mPtr.getClass().isBipedal(mPtr))
|
if (!sneak && !isFirstPersonPlayer && mPtr.getClass().isBipedal(mPtr))
|
||||||
{
|
{
|
||||||
if(effectiveRotation > rotationThreshold)
|
if(effectiveRotation > rotationThreshold)
|
||||||
movestate = inwater ? CharState_SwimTurnRight : CharState_TurnRight;
|
movestate = inwater ? CharState_SwimTurnRight : CharState_TurnRight;
|
||||||
|
|
Loading…
Reference in a new issue