From 7db31ab58a8e97735bb9c16a7e79f6b99fbd1b61 Mon Sep 17 00:00:00 2001 From: Allofich Date: Tue, 23 Aug 2016 23:13:37 +0900 Subject: [PATCH] Correct telekinesis glow length --- apps/openmw/mwclass/door.cpp | 2 +- apps/openmw/mwrender/animation.cpp | 6 +++--- apps/openmw/mwrender/animation.hpp | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwclass/door.cpp b/apps/openmw/mwclass/door.cpp index 99d4a6011..7494d2b43 100644 --- a/apps/openmw/mwclass/door.cpp +++ b/apps/openmw/mwclass/door.cpp @@ -124,7 +124,7 @@ namespace MWClass int index = ESM::MagicEffect::effectStringToId("sEffectTelekinesis"); const ESM::MagicEffect *effect = store.get().find(index); - animation->addSpellCastGlow(effect); // TODO: Telekinesis glow should only be as long as the door animation + animation->addSpellCastGlow(effect, 1); // 1 second glow to match the time taken for a door opening or closing } // make key id lowercase diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index 32fa5e600..386a4a53b 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -1187,7 +1187,7 @@ namespace MWRender int mLowestUnusedTexUnit; }; - void Animation::addSpellCastGlow(const ESM::MagicEffect *effect) + void Animation::addSpellCastGlow(const ESM::MagicEffect *effect, float glowDuration) { osg::Vec4f glowColor(1,1,1,1); glowColor.x() = effect->mData.mRed / 255.f; @@ -1202,10 +1202,10 @@ namespace MWRender if (mGlowUpdater && mGlowUpdater->isPermanentGlowUpdater()) { mGlowUpdater->setColor(glowColor); - mGlowUpdater->setDuration(1.5); // Glow length measured from original engine as about 1.5 seconds + mGlowUpdater->setDuration(glowDuration); } else - addGlow(mObjectRoot, glowColor, 1.5); + addGlow(mObjectRoot, glowColor, glowDuration); } } diff --git a/apps/openmw/mwrender/animation.hpp b/apps/openmw/mwrender/animation.hpp index d0191d172..089d0d85b 100644 --- a/apps/openmw/mwrender/animation.hpp +++ b/apps/openmw/mwrender/animation.hpp @@ -360,7 +360,9 @@ public: void removeEffect (int effectId); void getLoopingEffects (std::vector& out) const; - void addSpellCastGlow(const ESM::MagicEffect *effect); + // Add a spell casting glow to an object. From measuring video taken from the original engine, + // the glow seems to be about 1.5 seconds except for telekinesis, which is 1 second. + void addSpellCastGlow(const ESM::MagicEffect *effect, float glowDuration = 1.5); virtual void updatePtr(const MWWorld::Ptr &ptr);