@ -72,12 +72,12 @@ namespace MWMechanics
{
{
if ( effectInfo . mData . mRange = = ESM : : RT_Target )
if ( effectInfo . mData . mRange = = ESM : : RT_Target )
world - > spawnEffect (
world - > spawnEffect (
VFS: : Path : : toNormalized ( Misc: : ResourceHelpers : : correctMeshPath ( areaStatic - > mModel ) ) , texture ,
Misc: : ResourceHelpers : : correctMeshPath ( VFS : : Path : : Normalized ( areaStatic - > mModel ) ) , texture ,
mHitPosition , 1.0f ) ;
mHitPosition , 1.0f ) ;
continue ;
continue ;
}
}
else
else
world - > spawnEffect ( VFS: : Path : : toNormalized ( Misc: : ResourceHelpers : : correctMeshPath ( areaStatic - > mModel ) ) ,
world - > spawnEffect ( Misc: : ResourceHelpers : : correctMeshPath ( VFS : : Path : : Normalized ( areaStatic - > mModel ) ) ,
texture , mHitPosition , static_cast < float > ( effectInfo . mData . mArea * 2 ) ) ;
texture , mHitPosition , static_cast < float > ( effectInfo . mData . mArea * 2 ) ) ;
// Play explosion sound (make sure to use NoTrack, since we will delete the projectile now)
// Play explosion sound (make sure to use NoTrack, since we will delete the projectile now)
@ -487,7 +487,7 @@ namespace MWMechanics
void CastSpell : : playSpellCastingEffects ( const std : : vector < ESM : : IndexedENAMstruct > & effects ) const
void CastSpell : : playSpellCastingEffects ( const std : : vector < ESM : : IndexedENAMstruct > & effects ) const
{
{
const MWWorld : : ESMStore & store = * MWBase : : Environment : : get ( ) . getESMStore ( ) ;
const MWWorld : : ESMStore & store = * MWBase : : Environment : : get ( ) . getESMStore ( ) ;
std : : vector < std: : string > addedEffects ;
std : : vector < VFS: : Path : : Normalized > addedEffects ;
for ( const ESM : : IndexedENAMstruct & effectData : effects )
for ( const ESM : : IndexedENAMstruct & effectData : effects )
{
{
@ -500,17 +500,18 @@ namespace MWMechanics
else
else
castStatic = store . get < ESM : : Static > ( ) . find ( ESM : : RefId : : stringRefId ( " VFX_DefaultCast " ) ) ;
castStatic = store . get < ESM : : Static > ( ) . find ( ESM : : RefId : : stringRefId ( " VFX_DefaultCast " ) ) ;
VFS : : Path : : Normalized castStaticModel
= Misc : : ResourceHelpers : : correctMeshPath ( VFS : : Path : : Normalized ( castStatic - > mModel ) ) ;
// check if the effect was already added
// check if the effect was already added
if ( std : : find ( addedEffects . begin ( ) , addedEffects . end ( ) ,
if ( std : : find ( addedEffects . begin ( ) , addedEffects . end ( ) , castStaticModel ) ! = addedEffects . end ( ) )
Misc : : ResourceHelpers : : correctMeshPath ( castStatic - > mModel ) )
! = addedEffects . end ( ) )
continue ;
continue ;
MWRender : : Animation * animation = MWBase : : Environment : : get ( ) . getWorld ( ) - > getAnimation ( mCaster ) ;
MWRender : : Animation * animation = MWBase : : Environment : : get ( ) . getWorld ( ) - > getAnimation ( mCaster ) ;
if ( animation )
if ( animation )
{
{
animation - > addEffect ( Misc: : ResourceHelpers : : correctMeshPath ( castStatic - > mModel ) ,
animation - > addEffect ( castStaticModel. value ( ) , ESM : : MagicEffect : : indexToName ( effect - > mIndex ) , false , { } ,
ESM: : MagicEffect : : indexToName ( effect - > mIndex ) , false , { } , effect- > mParticle ) ;
effect- > mParticle ) ;
}
}
else
else
{
{
@ -539,15 +540,13 @@ namespace MWMechanics
scale * = npcScaleVec . z ( ) ;
scale * = npcScaleVec . z ( ) ;
}
}
scale = std : : max ( scale , 1.f ) ;
scale = std : : max ( scale , 1.f ) ;
MWBase : : Environment : : get ( ) . getWorld ( ) - > spawnEffect (
MWBase : : Environment : : get ( ) . getWorld ( ) - > spawnEffect ( castStaticModel , effect - > mParticle , pos , scale ) ;
VFS : : Path : : toNormalized ( Misc : : ResourceHelpers : : correctMeshPath ( castStatic - > mModel ) ) ,
effect - > mParticle , pos , scale ) ;
}
}
if ( animation & & ! mCaster . getClass ( ) . isActor ( ) )
if ( animation & & ! mCaster . getClass ( ) . isActor ( ) )
animation - > addSpellCastGlow ( effect - > getColor ( ) ) ;
animation - > addSpellCastGlow ( effect - > getColor ( ) ) ;
addedEffects . push_back ( Misc: : ResourceHelpers : : correctMeshPath ( castStatic - > m Model) ) ;
addedEffects . push_back ( std: : move ( castStatic Model) ) ;
MWBase : : SoundManager * sndMgr = MWBase : : Environment : : get ( ) . getSoundManager ( ) ;
MWBase : : SoundManager * sndMgr = MWBase : : Environment : : get ( ) . getSoundManager ( ) ;
if ( ! effect - > mCastSound . empty ( ) )
if ( ! effect - > mCastSound . empty ( ) )
@ -584,8 +583,12 @@ namespace MWMechanics
{
{
// Don't play particle VFX unless the effect is new or it should be looping.
// Don't play particle VFX unless the effect is new or it should be looping.
if ( playNonLooping | | loop )
if ( playNonLooping | | loop )
anim - > addEffect ( Misc : : ResourceHelpers : : correctMeshPath ( castStatic - > mModel ) ,
{
ESM : : MagicEffect : : indexToName ( magicEffect . mIndex ) , loop , { } , magicEffect . mParticle ) ;
const VFS : : Path : : Normalized castStaticModel
= Misc : : ResourceHelpers : : correctMeshPath ( VFS : : Path : : Normalized ( castStatic - > mModel ) ) ;
anim - > addEffect ( castStaticModel . value ( ) , ESM : : MagicEffect : : indexToName ( magicEffect . mIndex ) , loop , { } ,
magicEffect . mParticle ) ;
}
}
}
}
}
}
}