Add glow when using telekinesis on doors

coverity_scan^2
Allofich 9 years ago
parent 57138b416e
commit 123c626f2d

@ -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<ESM::MagicEffect>().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);

Loading…
Cancel
Save