forked from teamnwah/openmw-tes3coop
Fix vampirism magic effect not applying immediately (Fixes #1984)
This commit is contained in:
parent
03da21f088
commit
bc85bb32c2
5 changed files with 19 additions and 4 deletions
|
@ -1279,7 +1279,7 @@ void CharacterController::update(float duration)
|
||||||
const MWWorld::Class &cls = mPtr.getClass();
|
const MWWorld::Class &cls = mPtr.getClass();
|
||||||
Ogre::Vector3 movement(0.0f);
|
Ogre::Vector3 movement(0.0f);
|
||||||
|
|
||||||
updateVisibility();
|
updateMagicEffects();
|
||||||
|
|
||||||
if(!cls.isActor())
|
if(!cls.isActor())
|
||||||
{
|
{
|
||||||
|
@ -1777,7 +1777,7 @@ void CharacterController::updateContinuousVfx()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterController::updateVisibility()
|
void CharacterController::updateMagicEffects()
|
||||||
{
|
{
|
||||||
if (!mPtr.getClass().isActor())
|
if (!mPtr.getClass().isActor())
|
||||||
return;
|
return;
|
||||||
|
@ -1794,9 +1794,11 @@ void CharacterController::updateVisibility()
|
||||||
{
|
{
|
||||||
alpha *= std::max(0.2f, (100.f - chameleon)/100.f);
|
alpha *= std::max(0.2f, (100.f - chameleon)/100.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
mAnimation->setAlpha(alpha);
|
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();
|
float light = mPtr.getClass().getCreatureStats(mPtr).getMagicEffects().get(ESM::MagicEffect::Light).getMagnitude();
|
||||||
mAnimation->setLightEffect(light);
|
mAnimation->setLightEffect(light);
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,7 +190,7 @@ class CharacterController
|
||||||
|
|
||||||
void castSpell(const std::string& spellid);
|
void castSpell(const std::string& spellid);
|
||||||
|
|
||||||
void updateVisibility();
|
void updateMagicEffects();
|
||||||
|
|
||||||
void playDeath(float startpoint, CharacterState death);
|
void playDeath(float startpoint, CharacterState death);
|
||||||
void playRandomDeath(float startpoint = 0.0f);
|
void playRandomDeath(float startpoint = 0.0f);
|
||||||
|
|
|
@ -228,6 +228,7 @@ public:
|
||||||
virtual void preRender (Ogre::Camera* camera);
|
virtual void preRender (Ogre::Camera* camera);
|
||||||
|
|
||||||
virtual void setAlpha(float alpha) {}
|
virtual void setAlpha(float alpha) {}
|
||||||
|
virtual void setVampire(bool vampire) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void updatePtr(const MWWorld::Ptr &ptr);
|
void updatePtr(const MWWorld::Ptr &ptr);
|
||||||
|
|
|
@ -983,4 +983,14 @@ void NpcAnimation::equipmentChanged()
|
||||||
updateParts();
|
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
|
/// Make the NPC only partially visible
|
||||||
virtual void setAlpha(float alpha);
|
virtual void setAlpha(float alpha);
|
||||||
|
|
||||||
|
virtual void setVampire(bool vampire);
|
||||||
|
|
||||||
/// Prepare this animation for being rendered with \a camera (rotates billboard nodes)
|
/// Prepare this animation for being rendered with \a camera (rotates billboard nodes)
|
||||||
virtual void preRender (Ogre::Camera* camera);
|
virtual void preRender (Ogre::Camera* camera);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue