mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-10-31 20:26:48 +00:00 
			
		
		
		
	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(); | ||||
|     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…
	
		Reference in a new issue