From 24aa743573464fabaf20db7b15c3f7c6bf18bbfe Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 1 Jan 2014 23:34:18 +0100 Subject: [PATCH] Add function for converting feet to game units --- apps/openmw/mwworld/worldimp.cpp | 13 ++++++++++--- apps/openmw/mwworld/worldimp.hpp | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index d2e8a21b79..c11de7753c 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -1325,7 +1325,8 @@ namespace MWWorld { float telekinesisRangeBonus = mPlayer->getPlayer().getClass().getCreatureStats(mPlayer->getPlayer()).getMagicEffects() - .get(ESM::MagicEffect::Telekinesis).mMagnitude * 22; + .get(ESM::MagicEffect::Telekinesis).mMagnitude; + telekinesisRangeBonus = feetToGameUnits(telekinesisRangeBonus); float activationDistance = getMaxActivationDistance() + telekinesisRangeBonus; @@ -2396,8 +2397,7 @@ namespace MWWorld if (!dist) return; - // TODO: "1 foot" = 20 game units? - dist *= 20; + dist = feetToGameUnits(dist); AddDetectedReference functor (out, ptr, type, dist*dist); @@ -2408,4 +2408,11 @@ namespace MWWorld cellStore->forEach(functor); } } + + float World::feetToGameUnits(float feet) + { + // Looks like there is no GMST for this. This factor was determined in experiments + // with the Telekinesis effect. + return feet * 22; + } } diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index 7e3b0befe2..1aecb6fb64 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -155,6 +155,8 @@ namespace MWWorld /// Called when \a object is moved to an inactive cell void objectLeftActiveCell (MWWorld::Ptr object, MWWorld::Ptr movedPtr); + float feetToGameUnits(float feet); + public: World (OEngine::Render::OgreRenderer& renderer,