From 7be1793900fdb9ea0829ed7a98eaab2fc97fc185 Mon Sep 17 00:00:00 2001 From: Marisa the Magician Date: Mon, 5 Dec 2022 14:13:47 +0100 Subject: [PATCH] Switch all particle spawns to level.SpawnParticle(). --- language.version | 4 +- zscript/items/swwm_baseitem.zsc | 19 +++- zscript/items/swwm_powerups.zsc | 22 +++- zscript/swwm_blod.zsc | 96 ++++++++++++++-- zscript/swwm_common_fx.zsc | 191 +++++++++++++++++++++++++++----- 5 files changed, 285 insertions(+), 47 deletions(-) diff --git a/language.version b/language.version index 880168e16..21886cac1 100644 --- a/language.version +++ b/language.version @@ -1,3 +1,3 @@ [default] -SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r659 \cu(Mon 5 Dec 09:53:37 CET 2022)\c-"; -SWWM_SHORTVER="\cw1.3pre r659 \cu(2022-12-05 09:53:37)\c-"; +SWWM_MODVER="\cyDEMOLITIONIST \cw1.3pre r660 \cu(Mon 5 Dec 14:13:47 CET 2022)\c-"; +SWWM_SHORTVER="\cw1.3pre r660 \cu(2022-12-05 14:13:47)\c-"; diff --git a/zscript/items/swwm_baseitem.zsc b/zscript/items/swwm_baseitem.zsc index 3f055aa03..7c5d3ab2f 100644 --- a/zscript/items/swwm_baseitem.zsc +++ b/zscript/items/swwm_baseitem.zsc @@ -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=.5; j-=.125 ) - A_SpawnParticleEx(b.fillcolor,pufftex[Random[Blood](0,7)],STYLE_Shaded,0,int(12*sstr),2.*str*FRandom[Blood](.6,1.4)*j,0,0,0,0,ndir.x*j,ndir.y*j,ndir.z*j,0,0,-.25,.75,-1,-.02*sstr*j); + { + puff.texture = pufftex[Random[Blood](0,7)]; + puff.lifetime = int(12*sstr); + puff.size = 2.*str*FRandom[Blood](.6,1.4)*j; + puff.vel = ndir*j; + puff.sizestep = -.02*sstr*j; + level.SpawnParticle(puff); + } } let s = Spawn("mkBloodSmoke",pos); s.SetShade(b.fillcolor); @@ -123,6 +137,7 @@ Class mkBloodDrop : SWWMNonInteractiveActor Sector tracksector; int trackplane; TextureID pufftex[8]; + FSpawnParticleParams puff; Default { @@ -216,11 +231,18 @@ Class mkBloodDrop : SWWMNonInteractiveActor Vector3 ndiff = level.Vec3Diff(newpos,pos); double ndist = ndiff.length(); ndiff /= ndist; + puff.lifetime = 10; + puff.startalpha = .5*alpha; + puff.sizestep = -1.*scale.x; + puff.accel = (0,0,-.5); for ( int i=0; i=.5; j-=.125 ) - A_SpawnParticleEx(fillcolor,pufftex[Random[Blood](0,7)],STYLE_Shaded,0,20,10.*scale.x*FRandom[Blood](.6,1.4)*j,0,0,0,0,ndir.x*j,ndir.y*j,ndir.z*j,0,0,-.25,.5*alpha,-1,-1.*scale.x*j); + { + puff.texture = pufftex[Random[Blood](0,7)]; + puff.size = 10.*scale.x*FRandom[Blood](.6,1.4)*j; + puff.pos = pos; + puff.vel = ndir*j; + puff.sizestep = -1.*scale.x*j; + level.SpawnParticle(puff); + } } Destroy(); return; @@ -279,11 +312,21 @@ Class mkBloodDrop : SWWMNonInteractiveActor A_SetRenderStyle(1.,STYLE_Shaded); frame = Random[Blood](5,8); int numpt = Random[Blood](4,8); + puff.lifetime = 20; + puff.startalpha = .5*alpha; + puff.pos = pos; + puff.accel = (0,0,-.25); for ( int i=0; i=.5; j-=.125 ) - A_SpawnParticleEx(fillcolor,pufftex[Random[Blood](0,7)],STYLE_Shaded,0,20,10.*scale.x*FRandom[Blood](.6,1.4)*j,0,0,0,0,ndir.x*j,ndir.y*j,ndir.z*j,0,0,-.25,.5*alpha,-1,-1.*scale.x*j); + { + puff.texture = pufftex[Random[Blood](0,7)]; + puff.size = 10.*scale.x*FRandom[Blood](.6,1.4)*j; + puff.vel = ndir*j; + puff.sizestep = -1.*scale.x*j; + level.SpawnParticle(puff); + } } vel *= 0; return; @@ -324,11 +367,21 @@ Class mkBloodDrop : SWWMNonInteractiveActor A_SetRenderStyle(1.,STYLE_Shaded); frame = Random[Blood](9,12); int numpt = Random[Blood](4,8); + puff.lifetime = 20; + puff.startalpha = .5*alpha; + puff.pos = pos; + puff.accel = (0,0,-.25); for ( int i=0; i=.5; j-=.125 ) - A_SpawnParticleEx(fillcolor,pufftex[Random[Blood](0,7)],STYLE_Shaded,0,20,10.*scale.x*FRandom[Blood](.6,1.4)*j,0,0,0,0,ndir.x*j,ndir.y*j,ndir.z*j,0,0,-.25,.5*alpha,-1,-1.*scale.x*j); + { + puff.texture = pufftex[Random[Blood](0,7)]; + puff.size = 10.*scale.x*FRandom[Blood](.6,1.4)*j; + puff.vel = ndir*j; + puff.sizestep = -1.*scale.x*j; + level.SpawnParticle(puff); + } } vel *= 0; return; @@ -347,11 +400,21 @@ Class mkBloodDrop : SWWMNonInteractiveActor TraceBleedAngle(20,atan2(walldir.y,walldir.x),0); A_StartSound("misc/blooddrop",volume:.1); int numpt = Random[Blood](4,8); + puff.lifetime = 20; + puff.startalpha = .5*alpha; + puff.pos = pos; + puff.accel = (0,0,-.25); for ( int i=0; i=.5; j-=.125 ) - A_SpawnParticleEx(fillcolor,pufftex[Random[Blood](0,7)],STYLE_Shaded,0,20,10.*scale.x*FRandom[Blood](.6,1.4)*j,0,0,0,0,ndir.x*j,ndir.y*j,ndir.z*j,0,0,-.25,.5*alpha,-1,-1.*scale.x*j); + { + puff.texture = pufftex[Random[Blood](0,7)]; + puff.size = 10.*scale.x*FRandom[Blood](.6,1.4)*j; + puff.vel = ndir*j; + puff.sizestep = -1.*scale.x*j; + level.SpawnParticle(puff); + } } Destroy(); return; @@ -377,6 +440,9 @@ Class mkBloodDrop : SWWMNonInteractiveActor { Super.PostBeginPlay(); for ( int i=0; i<8; i++ ) pufftex[i] = TexMan.CheckForTexture("graphics/Particles/xpuff"..i..".png"); + puff.color1 = fillcolor; + puff.style = STYLE_Shaded; + puff.fadestep = -1; SWWMHandler.QueueBlod(self); int jumps = Random[Blood](0,3); state dest = ResolveState("Spawn"); @@ -447,7 +513,6 @@ Class mkBloodSmoke2 : mkBloodSmoke } // flying gibs -// inspired by Lud's Universal Gibs Class mkFlyingGib : Actor { Mixin SWWMMissileFix; @@ -460,11 +525,16 @@ Class mkFlyingGib : Actor mkFlyingGib prevmeat, nextmeat; Vector3 oldpos; TextureID pufftex[8]; + FSpawnParticleParams puff; override void PostBeginPlay() { Super.PostBeginPlay(); for ( int i=0; i<8; i++ ) pufftex[i] = TexMan.CheckForTexture("graphics/Particles/xpuff"..i..".png"); + puff.style = STYLE_Shaded; + puff.lifetime = 40; + puff.accel = (0,0,-.25); + puff.fadestep = -1; frame = Random[Blood](0,5); double ang = FRandom[Gibs](0,360); double pt = FRandom[Gibs](-60,20); @@ -479,6 +549,7 @@ Class mkFlyingGib : Actor scale *= FRandom[Gibs](.5,1.5); if ( master && master.bloodcolor ) shadecol = Color(master.bloodcolor.r/2,master.bloodcolor.g/2,master.bloodcolor.b/2); else shadecol = Color(80,0,0); + puff.color1 = shadecol; bleeding = true; if ( Random[Blood](0,1) ) bXFlip = true; SWWMHandler.QueueMeat(self); @@ -515,8 +586,13 @@ Class mkFlyingGib : Actor for ( int i=0; i