From a239724316b6b91528434631d1506b022d80985b Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Sat, 26 Oct 2024 07:54:52 +0300 Subject: [PATCH] Revise storm wind effect on velocity (bug #8206) --- CHANGELOG.md | 1 + apps/openmw/mwphysics/movementsolver.cpp | 13 ++++--------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab4a74f468..ac9affcbb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -198,6 +198,7 @@ Bug #8172: Openmw-cs crashes when viewing `Dantooine, Sea` Bug #8187: Intervention effects should use Chebyshev distance to determine the closest marker Bug #8191: NiRollController does not work for sheath meshes + Bug #8206: Moving away from storm wind origin should make you faster Bug #8207: Using hand-to-hand while sneaking plays the critical hit sound when the target is not getting hurt Feature #1415: Infinite fall failsafe Feature #2566: Handle NAM9 records for manual cell references diff --git a/apps/openmw/mwphysics/movementsolver.cpp b/apps/openmw/mwphysics/movementsolver.cpp index 05b9f44654..554cd7586a 100644 --- a/apps/openmw/mwphysics/movementsolver.cpp +++ b/apps/openmw/mwphysics/movementsolver.cpp @@ -178,15 +178,10 @@ namespace MWPhysics // Now that we have the effective movement vector, apply wind forces to it if (worldData.mIsInStorm && velocity.length() > 0) { - osg::Vec3f stormDirection = worldData.mStormDirection; - float angleDegrees = osg::RadiansToDegrees( - std::acos(stormDirection * velocity / (stormDirection.length() * velocity.length()))); - static const float fStromWalkMult = MWBase::Environment::get() - .getESMStore() - ->get() - .find("fStromWalkMult") - ->mValue.getFloat(); - velocity *= 1.f - (fStromWalkMult * (angleDegrees / 180.f)); + const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore(); + const float fStromWalkMult = store.get().find("fStromWalkMult")->mValue.getFloat(); + const float angleCos = worldData.mStormDirection * velocity / velocity.length(); + velocity *= 1.f + fStromWalkMult * angleCos; } Stepper stepper(collisionWorld, actor.mCollisionObject);