From 123c626f2d6bf32326e3a2f843ca904d9cdfc0d5 Mon Sep 17 00:00:00 2001 From: Allofich Date: Wed, 3 Aug 2016 02:45:42 +0900 Subject: [PATCH] Add glow when using telekinesis on doors --- apps/openmw/mwclass/door.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/apps/openmw/mwclass/door.cpp b/apps/openmw/mwclass/door.cpp index a54b64897..effdcf547 100644 --- a/apps/openmw/mwclass/door.cpp +++ b/apps/openmw/mwclass/door.cpp @@ -25,6 +25,7 @@ #include "../mwrender/objects.hpp" #include "../mwrender/renderinginterface.hpp" +#include "../mwrender/animation.hpp" #include "../mwmechanics/actorutil.hpp" @@ -112,6 +113,24 @@ namespace MWClass bool hasKey = false; std::string keyName; + if (actor == MWBase::Environment::get().getWorld()->getPlayerPtr() && // assuming player is using telekinesis + MWBase::Environment::get().getWorld()->getDistanceToFacedObject() > + MWBase::Environment::get().getWorld()->getMaxActivationDistance()) + { + MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(ptr); + + const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); + const ESM::MagicEffect *effect; + effect = store.get().find(59); + + osg::Vec4f glowcolor(1,1,1,1); + glowcolor.x() = effect->mData.mRed / 255.f; + glowcolor.y() = effect->mData.mGreen / 255.f; + glowcolor.z() = effect->mData.mBlue / 255.f; + + animation->addSpellCastGlow(glowcolor); // TODO: Telekinesis glow should only be as long as the door animation + } + // make key id lowercase std::string keyId = ptr.getCellRef().getKey(); Misc::StringUtils::lowerCaseInPlace(keyId);