mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-16 17:42:31 +00:00
Restore vertical movement reset for various movement states (#7833)
Note getJump already handles incapacitation states (dead/paralyzed/KO)
This commit is contained in:
parent
6e81927d60
commit
7873714103
@ -2144,6 +2144,10 @@ namespace MWMechanics
|
|||||||
|
|
||||||
bool wasInJump = mInJump;
|
bool wasInJump = mInJump;
|
||||||
mInJump = false;
|
mInJump = false;
|
||||||
|
const float jumpHeight = cls.getJump(mPtr);
|
||||||
|
if (jumpHeight <= 0.f || sneak || inwater || flying || !solid)
|
||||||
|
vec.z() = 0.f;
|
||||||
|
|
||||||
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).
|
||||||
@ -2162,20 +2166,16 @@ namespace MWMechanics
|
|||||||
vec.z() = 0.0f;
|
vec.z() = 0.0f;
|
||||||
}
|
}
|
||||||
// Started a jump.
|
// Started a jump.
|
||||||
else if (mJumpState != JumpState_InAir && vec.z() > 0.f && !sneak)
|
else if (mJumpState != JumpState_InAir && vec.z() > 0.f)
|
||||||
{
|
|
||||||
float z = cls.getJump(mPtr);
|
|
||||||
if (z > 0.f)
|
|
||||||
{
|
{
|
||||||
mInJump = true;
|
mInJump = true;
|
||||||
if (vec.x() == 0 && vec.y() == 0)
|
if (vec.x() == 0 && vec.y() == 0)
|
||||||
vec.z() = z;
|
vec.z() = jumpHeight;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
osg::Vec3f lat(vec.x(), vec.y(), 0.0f);
|
osg::Vec3f lat(vec.x(), vec.y(), 0.0f);
|
||||||
lat.normalize();
|
lat.normalize();
|
||||||
vec = osg::Vec3f(lat.x(), lat.y(), 1.0f) * z * 0.707f;
|
vec = osg::Vec3f(lat.x(), lat.y(), 1.0f) * jumpHeight * 0.707f;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user