Fix vampirism magic effect not applying immediately (Fixes #1984)

moveref
scrawl 10 years ago
parent 03da21f088
commit bc85bb32c2

@ -1279,7 +1279,7 @@ void CharacterController::update(float duration)
const MWWorld::Class &cls = mPtr.getClass();
Ogre::Vector3 movement(0.0f);
updateVisibility();
updateMagicEffects();
if(!cls.isActor())
{
@ -1777,7 +1777,7 @@ void CharacterController::updateContinuousVfx()
}
}
void CharacterController::updateVisibility()
void CharacterController::updateMagicEffects()
{
if (!mPtr.getClass().isActor())
return;
@ -1794,9 +1794,11 @@ void CharacterController::updateVisibility()
{
alpha *= std::max(0.2f, (100.f - chameleon)/100.f);
}
mAnimation->setAlpha(alpha);
bool vampire = mPtr.getClass().getCreatureStats(mPtr).getMagicEffects().get(ESM::MagicEffect::Vampirism).getMagnitude() > 0.0f;
mAnimation->setVampire(vampire);
float light = mPtr.getClass().getCreatureStats(mPtr).getMagicEffects().get(ESM::MagicEffect::Light).getMagnitude();
mAnimation->setLightEffect(light);
}

@ -190,7 +190,7 @@ class CharacterController
void castSpell(const std::string& spellid);
void updateVisibility();
void updateMagicEffects();
void playDeath(float startpoint, CharacterState death);
void playRandomDeath(float startpoint = 0.0f);

@ -228,6 +228,7 @@ public:
virtual void preRender (Ogre::Camera* camera);
virtual void setAlpha(float alpha) {}
virtual void setVampire(bool vampire) {}
public:
void updatePtr(const MWWorld::Ptr &ptr);

@ -983,4 +983,14 @@ void NpcAnimation::equipmentChanged()
updateParts();
}
void NpcAnimation::setVampire(bool vampire)
{
if (mNpcType == Type_Werewolf) // we can't have werewolf vampires, can we
return;
if ((mNpcType == Type_Vampire) != vampire)
{
rebuild();
}
}
}

@ -168,6 +168,8 @@ public:
/// Make the NPC only partially visible
virtual void setAlpha(float alpha);
virtual void setVampire(bool vampire);
/// Prepare this animation for being rendered with \a camera (rotates billboard nodes)
virtual void preRender (Ogre::Camera* camera);
};

Loading…
Cancel
Save