Skip to content

Commit 80651fe

Browse files
Capostrophicpsi29a
authored andcommitted
Correct jumping velocity
1 parent a66b654 commit 80651fe

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

apps/openmw/mwclass/npc.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -935,8 +935,12 @@ namespace MWClass
935935

936936
const float normalizedEncumbrance = getNormalizedEncumbrance(ptr);
937937

938-
bool sneaking = MWBase::Environment::get().getMechanicsManager()->isSneaking(ptr) && stats.getStance(MWMechanics::CreatureStats::Stance_Sneak);
939-
bool running = MWBase::Environment::get().getMechanicsManager()->isRunning(ptr) && stats.getStance(MWMechanics::CreatureStats::Stance_Run);
938+
bool swimming = world->isSwimming(ptr);
939+
bool inair = !world->isOnGround(ptr) && !swimming && !world->isFlying(ptr);
940+
bool sneaking = stats.getStance(MWMechanics::CreatureStats::Stance_Sneak);
941+
sneaking = sneaking && (inair || MWBase::Environment::get().getMechanicsManager()->isSneaking(ptr));
942+
bool running = stats.getStance(MWMechanics::CreatureStats::Stance_Run);
943+
running = running && (inair || MWBase::Environment::get().getMechanicsManager()->isRunning(ptr));
940944

941945
float walkSpeed = gmst.fMinWalkSpeed->mValue.getFloat() + 0.01f*npcdata->mNpcStats.getAttribute(ESM::Attribute::Speed).getModified()*
942946
(gmst.fMaxWalkSpeed->mValue.getFloat() - gmst.fMinWalkSpeed->mValue.getFloat());
@@ -961,7 +965,7 @@ namespace MWClass
961965
flySpeed = std::max(0.0f, flySpeed);
962966
moveSpeed = flySpeed;
963967
}
964-
else if (world->isSwimming(ptr))
968+
else if (swimming)
965969
{
966970
float swimSpeed = walkSpeed;
967971
if(running)
@@ -971,7 +975,7 @@ namespace MWClass
971975
gmst.fSwimRunAthleticsMult->mValue.getFloat();
972976
moveSpeed = swimSpeed;
973977
}
974-
else if (running)
978+
else if (running && !sneaking)
975979
moveSpeed = runSpeed;
976980
else
977981
moveSpeed = walkSpeed;

0 commit comments

Comments
 (0)