Switch all particle spawns to level.SpawnParticle().

This commit is contained in:
Mari the Deer 2022-12-05 14:13:47 +01:00
commit 7be1793900
5 changed files with 285 additions and 47 deletions

View file

@ -124,7 +124,7 @@ Mixin Class SWWMOverlapPickupSound
Class SWWMRespawnTimer : SWWMNonInteractiveActor
{
TextureID flaretex;
FSpawnParticleParams flare;
default
{
Args 0,3,2;
@ -155,13 +155,26 @@ Class SWWMRespawnTimer : SWWMNonInteractiveActor
double str = 1.-special2/double(special1);
int freq = int(clamp(30*(1.-str),3,30));
if ( (level.maptime+args[3])%freq ) return;
if ( !flaretex ) flaretex = TexMan.CheckForTexture("graphics/Particles/xflare.png");
if ( !flare.texture )
{
flare.color1 = Color(args[0]*85,args[1]*85,args[2]*85);
flare.texture = TexMan.CheckForTexture("graphics/Particles/xflare.png");
flare.style = STYLE_AddShaded;
flare.flags = SPF_FULLBRIGHT;
flare.fadestep = -1;
}
flare.pos = pos+(0,0,16);
int numpt = int(Random[ExploS](0,10)*str);
for ( int i=0; i<numpt; i++ )
{
double ang = FRandom[ExploS](0,360);
double pt = FRandom[ExploS](-90,90);
A_SpawnParticleEx(Color(args[0]*85,args[1]*85,args[2]*85),flaretex,STYLE_AddShaded,SPF_FULLBRIGHT,Random[ExploS](30,60),FRandom[ExploS](2.,3.),0,0,0,16,FRandom[ExploS](-.8,.8),FRandom[ExploS](-.8,.8),FRandom[ExploS](-.8,.8),0,0,0,FRandom[ExploS](.45,.9)*str,-1,FRandom[ExploS](-.04,-.02)*str);
flare.lifetime = Random[ExploS](30,60);
flare.size = FRandom[ExploS](2.,3.);
flare.vel = SWWMUtility.Vec3FromAngles(ang,pt)*FRandom[ExploS](0.,.8);
flare.startalpha = FRandom[ExploS](.45,.9)*str;
flare.sizestep = FRandom[ExploS](-.04,-.02)*str;
level.SpawnParticle(flare);
}
}
}

View file

@ -3408,7 +3408,7 @@ Class DivineSpriteEffect : Inventory
bool bHealDone;
Actor l, snd;
DynamicValueInterpolator AlphInter;
TextureID flaretex;
FSpawnParticleParams flare;
Property HealTimer : healtim;
@ -3453,15 +3453,28 @@ Class DivineSpriteEffect : Inventory
AlphInter.Update(Owner.Health);
double alph = clamp((AlphInter.GetValue()-1000.)/6000.,0.,1.);
double scl = clamp((AlphInter.GetValue()-1000.)/6000.,2.,4.);
if ( !flaretex ) flaretex = TexMan.CheckForTexture("graphics/Particles/xflare.png");
if ( !flare.texture )
{
flare.color1 = "White";
flare.texture = TexMan.CheckForTexture("graphics/Particles/xflare.png");
flare.style = STYLE_AddShaded;
flare.flags = SPF_FULLBRIGHT;
flare.lifetime = 30;
flare.fadestep = -1;
flare.accel = (0,0,.05);
}
flare.size = scl;
flare.sizestep = -scl/30.;
flare.startalpha = alph;
for ( int i=0; i<numpt; i++ )
{
double ang = FRandom[ExploS](0,360);
double pt = FRandom[ExploS](-90,90);
double dst = FRandom[ExploS](.25,.75)*Owner.height;
Vector3 dir = SWWMUtility.Vec3Fromangles(ang,pt);
Vector3 ppos = Owner.Vec3offset(0,0,Owner.height/2)+dir*dst;
A_SpawnParticleEx("White",flaretex,STYLE_AddShaded,SPF_FULLBRIGHT,30,scl,0,ppos.x,ppos.y,ppos.z,dir.x*.2,dir.y*.2,dir.z*.2,0,0,.05,alph,-1,-scl/30.);
flare.pos = Owner.Vec3Offset(0,0,Owner.height/2)+dir*dst;
flare.vel = dir*.2;
level.SpawnParticle(flare);
}
if ( bHealDone || (Owner.Health <= 0) )
{
@ -3492,7 +3505,6 @@ Class DivineSpriteEffect : Inventory
else if ( !(healcnt%5) )
{
Owner.GiveBody(500,10000);
SWWMHandler.DoFlash(Owner,Color(10,255,255,255),10);
Owner.A_StartSound("powerup/divinehit",CHAN_ITEMEXTRA,CHANF_OVERLAP);
}
}