1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-17 19:20:49 +00:00

Handle landing in the frame the jump is over (bug #5849)

This commit is contained in:
Alexei Kotov 2022-11-07 19:06:01 +03:00
parent a2053a625e
commit 9b8399c353
3 changed files with 10 additions and 7 deletions

View File

@ -7,6 +7,7 @@
Bug #5057: Weapon swing sound plays at same pitch whether it hits or misses Bug #5057: Weapon swing sound plays at same pitch whether it hits or misses
Bug #5129: Stuttering animation on Centurion Archer Bug #5129: Stuttering animation on Centurion Archer
Bug #5714: Touch spells cast using ExplodeSpell don't always explode Bug #5714: Touch spells cast using ExplodeSpell don't always explode
Bug #5849: Paralysis breaks landing
Bug #5977: Fatigueless NPCs' corpse underwater changes animation on game load Bug #5977: Fatigueless NPCs' corpse underwater changes animation on game load
Bug #6427: Enemy health bar disappears before damaging effect ends Bug #6427: Enemy health bar disappears before damaging effect ends
Bug #6661: Saved games that have no preview screenshot cause issues or crashes Bug #6661: Saved games that have no preview screenshot cause issues or crashes

View File

@ -2073,13 +2073,14 @@ namespace MWMechanics
} }
} }
bool inJump = false; bool wasInJump = mInJump;
mInJump = false;
if (!inwater && !flying && solid) if (!inwater && !flying && solid)
{ {
// In the air (either getting up —ascending part of jump— or falling). // In the air (either getting up —ascending part of jump— or falling).
if (!onground) if (!onground)
{ {
inJump = true; mInJump = true;
jumpstate = JumpState_InAir; jumpstate = JumpState_InAir;
static const float fJumpMoveBase = gmst.find("fJumpMoveBase")->mValue.getFloat(); static const float fJumpMoveBase = gmst.find("fJumpMoveBase")->mValue.getFloat();
@ -2097,7 +2098,7 @@ namespace MWMechanics
float z = cls.getJump(mPtr); float z = cls.getJump(mPtr);
if (z > 0.f) if (z > 0.f)
{ {
inJump = true; mInJump = true;
if (vec.x() == 0 && vec.y() == 0) if (vec.x() == 0 && vec.y() == 0)
vec.z() = z; vec.z() = z;
else else
@ -2110,9 +2111,9 @@ namespace MWMechanics
} }
} }
if (!inJump) if (!mInJump)
{ {
if (mJumpState == JumpState_InAir && !flying && solid) if (mJumpState == JumpState_InAir && !flying && solid && wasInJump)
{ {
float height = cls.getCreatureStats(mPtr).land(isPlayer); float height = cls.getCreatureStats(mPtr).land(isPlayer);
float healthLost = 0.f; float healthLost = 0.f;
@ -2274,7 +2275,7 @@ namespace MWMechanics
{ {
if (inwater) if (inwater)
idlestate = CharState_IdleSwim; idlestate = CharState_IdleSwim;
else if (sneak && !inJump) else if (sneak && !mInJump)
idlestate = CharState_IdleSneak; idlestate = CharState_IdleSneak;
else else
idlestate = CharState_Idle; idlestate = CharState_Idle;
@ -2288,7 +2289,7 @@ namespace MWMechanics
updateIdleStormState(inwater); updateIdleStormState(inwater);
} }
if (inJump) if (mInJump)
mMovementAnimationControlled = false; mMovementAnimationControlled = false;
if (isTurning()) if (isTurning())

View File

@ -160,6 +160,7 @@ namespace MWMechanics
JumpingState mJumpState{ JumpState_None }; JumpingState mJumpState{ JumpState_None };
std::string mCurrentJump; std::string mCurrentJump;
bool mInJump{ false };
int mWeaponType{ ESM::Weapon::None }; int mWeaponType{ ESM::Weapon::None };
std::string mCurrentWeapon; std::string mCurrentWeapon;