From 483b37bb3f960a367222bd9b9c9425a6ed4bdc19 Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Thu, 12 Dec 2019 15:20:23 +0300 Subject: [PATCH] Disallow resting if the fall height hasn't been reset (bug #4802) --- CHANGELOG.md | 1 + apps/openmw/mwmechanics/creaturestats.cpp | 5 +++++ apps/openmw/mwmechanics/creaturestats.hpp | 1 + apps/openmw/mwworld/worldimp.cpp | 4 +++- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5acc8b4f5..d55452e42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,7 @@ Bug #4787: Sneaking makes 1st person walking/bobbing animation super-slow Bug #4797: Player sneaking and running stances are not accounted for when in air Bug #4800: Standing collisions are not updated immediately when an object is teleported without a cell change + Bug #4802: You can rest before taking falling damage from landing from a jump Bug #4803: Stray special characters before begin statement break script compilation Bug #4804: Particle system with the "Has Sizes = false" causes an exception Bug #4805: NPC movement speed calculations do not take race Weight into account diff --git a/apps/openmw/mwmechanics/creaturestats.cpp b/apps/openmw/mwmechanics/creaturestats.cpp index 236587669..1c377540a 100644 --- a/apps/openmw/mwmechanics/creaturestats.cpp +++ b/apps/openmw/mwmechanics/creaturestats.cpp @@ -426,6 +426,11 @@ namespace MWMechanics mFallHeight += height; } + float CreatureStats::getFallHeight() const + { + return mFallHeight; + } + float CreatureStats::land(bool isPlayer) { if (isPlayer) diff --git a/apps/openmw/mwmechanics/creaturestats.hpp b/apps/openmw/mwmechanics/creaturestats.hpp index 6ec4cc3a1..7c4a83db1 100644 --- a/apps/openmw/mwmechanics/creaturestats.hpp +++ b/apps/openmw/mwmechanics/creaturestats.hpp @@ -115,6 +115,7 @@ namespace MWMechanics bool needToRecalcDynamicStats(); void setNeedRecalcDynamicStats(bool val); + float getFallHeight() const; void addToFallHeight(float height); /// Reset the fall height diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 704ffe6f9..2ac27f0b7 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -2513,7 +2513,9 @@ namespace MWWorld if (isUnderwater(currentCell, playerPos) || isWalkingOnWater(player)) return Rest_PlayerIsUnderwater; - if ((actor->getCollisionMode() && !mPhysics->isOnSolidGround(player)) || isFlying(player)) + float fallHeight = player.getClass().getCreatureStats(player).getFallHeight(); + float epsilon = 1e-4; + if ((actor->getCollisionMode() && (!mPhysics->isOnSolidGround(player) || fallHeight >= epsilon)) || isFlying(player)) return Rest_PlayerIsInAir; if((currentCell->getCell()->mData.mFlags&ESM::Cell::NoSleep) || player.getClass().getNpcStats(player).isWerewolf())