From 9eb8addc706c014ccc0fb72f44d55940a8a87e76 Mon Sep 17 00:00:00 2001 From: scrawl Date: Thu, 26 Jun 2014 17:26:33 +0200 Subject: [PATCH] Make flying creatures fall when paralyzed (Fixes #1494) --- apps/openmw/mwmechanics/character.cpp | 3 +++ apps/openmw/mwworld/worldimp.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index 5f8013b14a..5d5377669c 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -1395,6 +1395,9 @@ void CharacterController::update(float duration) if (mMovementAnimVelocity == 0) world->queueMovement(mPtr, vec); } + else + // We must always queue movement, even if there is none, to apply gravity. + world->queueMovement(mPtr, Ogre::Vector3(0.0f)); movement = vec; cls.getMovementSettings(mPtr).mPosition[0] = cls.getMovementSettings(mPtr).mPosition[1] = cls.getMovementSettings(mPtr).mPosition[2] = 0; diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 35042b3ff4..fdac643be3 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1764,6 +1764,9 @@ namespace MWWorld bool World::isFlying(const MWWorld::Ptr &ptr) const { + const MWMechanics::CreatureStats &stats = ptr.getClass().getCreatureStats(ptr); + bool isParalyzed = (stats.getMagicEffects().get(ESM::MagicEffect::Paralyze).mMagnitude > 0); + if(!ptr.getClass().isActor()) return false; @@ -1771,9 +1774,8 @@ namespace MWWorld return false; if (ptr.getClass().canFly(ptr)) - return true; + return !isParalyzed; - const MWMechanics::CreatureStats &stats = ptr.getClass().getCreatureStats(ptr); if(stats.getMagicEffects().get(ESM::MagicEffect::Levitate).mMagnitude > 0 && isLevitationEnabled()) return true;