From c5a79e45e3e59d7c29d2ec5933a71191c28b1a71 Mon Sep 17 00:00:00 2001 From: Marisa Kirisame Date: Sat, 9 Jun 2018 22:53:39 +0200 Subject: [PATCH] Biorifle sludge now properly follows wall, ceiling and floor movement. Redeemer shockwaves properly respect actor mass and the DONTTHRUST flag. All weapons and projectiles have had their knockback adjusted. --- Readme.md | 4 +-- zscript/biorifle.zsc | 57 ++++++++++++++++++++++++++++++++++++- zscript/eightball.zsc | 1 + zscript/enforcer.zsc | 1 + zscript/flakcannon.zsc | 1 + zscript/minigun.zsc | 1 + zscript/ripper.zsc | 1 + zscript/shockrifle.zsc | 8 +++++- zscript/sniperrifle.zsc | 1 + zscript/utcommon.zsc | 1 + zscript/warheadlauncher.zsc | 2 +- 11 files changed, 73 insertions(+), 5 deletions(-) diff --git a/Readme.md b/Readme.md index 6df7f86..b935e9b 100644 --- a/Readme.md +++ b/Readme.md @@ -46,11 +46,12 @@ This mod requires GZDoom 3.4.0 or later. ## In progress - General polishing and bugfixing - - Make biorifle sludge follow ceiling and wall movement (this might be hard) - Add some more effects - Additional particle effects on explosions - Smoke on spent casings [DONE] - View-space particles for weapon fire [WIP] + - Done: Enforcer, Biorifle + - Remaining: Shock Rifle, Pulsegun, Minigun, Flak Cannon, Rocket Launcher, Sniper rifle, Chainsaw - Visual recoil affecting aim (time to recycle SM's A_Swing once again) - Additional model optimization and cleanup - Trim out unused animations (this one is going to be very time-consuming) @@ -72,7 +73,6 @@ This mod requires GZDoom 3.4.0 or later. - Sometimes the slave enforcer has its psprite "lower" slightly while the main enforcer is reloading. No idea what causes this (Could be bobbing-related) - - Sludge doesn't react to ceiling and wall movement - Pulse gun beams behave oddly when the player is moving or looking up and down. This might just be a rendering interpolation glitch, as usual - Translocator allows telefragging of other players in coop. diff --git a/zscript/biorifle.zsc b/zscript/biorifle.zsc index 97114bc..e916f49 100644 --- a/zscript/biorifle.zsc +++ b/zscript/biorifle.zsc @@ -118,6 +118,10 @@ Class BioHitbox : Actor } SetOrigin(target.pos-(0,0,height*0.5),true); } + override bool CanCollideWith( Actor other, bool passive ) + { + return !target.bNoGravity; // don't "intercept" while flying (doesn't seem to work, but at least I tried) + } } Class BioLight : DynamicLight @@ -179,6 +183,9 @@ Class BioGel : Actor int deadtimer, dttimer; Line atline; int atside; + int atpart; + secplane atplane; + double atz; int rollvel, pitchvel, yawvel; Vector3 normal; @@ -218,6 +225,30 @@ Class BioGel : Actor yawvel *= 0.98; } } + if ( deadtimer > -2 ) + { + if ( atline ) // attempt to follow the movement of the line + { + if ( atpart == 1 ) + { + if ( atline.flags&Line.ML_DONTPEGTOP ) SetOrigin(Vec2OffsetZ(0,0,atz+atline.sidedef[atside].sector.GetPlaneTexZ(1)),true); + else SetOrigin(Vec2OffsetZ(0,0,atz+atline.sidedef[atside?0:1].sector.GetPlaneTexZ(1)),true); + } + else if ( atpart == -1 ) + { + if ( atline.flags&Line.ML_DONTPEGBOTTOM ) SetOrigin(Vec2OffsetZ(0,0,atz+atline.sidedef[atside].sector.GetPlaneTexZ(0)),true); + else SetOrigin(Vec2OffsetZ(0,0,atz+atline.sidedef[atside?0:1].sector.GetPlaneTexZ(0)),true); + } + else if ( atline.flags&Line.ML_DONTPEGBOTTOM ) SetOrigin(Vec2OffsetZ(0,0,atz+atline.sidedef[atside].sector.GetPlaneTexZ(0)),true); + else SetOrigin(Vec2OffsetZ(0,0,atz+atline.sidedef[atside].sector.GetPlaneTexZ(1)),true); + if ( (pos.z > ceilingz) || (pos.z < floorz) ) deadtimer = min(deadtimer,0); + } + else if ( atplane ) // attempt to follow the movement of the plane + { + SetOrigin(Vec2OffsetZ(0,0,atz+cursector.GetPlaneTexZ(atpart)),true); + if ( ceilingz-floorz <= 2 ) deadtimer = min(deadtimer,0); + } + } if ( !InStateSequence(CurState,FindState("XDeath")) && ((!bNOGRAVITY && !Random[GES](0,2)) || !Random[GES](0,10)) ) { int numpt = Min(20,Scale.x*2)+Random[GES](-1,1); @@ -266,6 +297,23 @@ Class BioGel : Actor Vector3 orig = (BlockingLine.v1.p.x,BlockingLine.v1.p.y,0); Vector3 onwall = pos-(normal dot (pos-orig))*normal; SetOrigin(onwall+normal*0.5,false); + // attempt to guess line part (upper/mid/lower) + if ( !atline.sidedef[1] ) atpart = 0; // mid + else if ( atline.sidedef[atside?0:1].sector.ceilingplane.ZAtPoint(pos.xy) < pos.z ) atpart = 1; // upper + else if ( atline.sidedef[atside?0:1].sector.floorplane.ZAtPoint(pos.xy) > pos.z ) atpart = -1; // lower + else atpart = 0; + if ( atpart == 1 ) + { + if ( atline.flags&Line.ML_DONTPEGTOP ) atz = pos.z-atline.sidedef[atside].sector.GetPlaneTexZ(1); + else atz = pos.z-atline.sidedef[atside?0:1].sector.GetPlaneTexZ(1); + } + else if ( atpart == -1 ) + { + if ( atline.flags&Line.ML_DONTPEGBOTTOM ) atz = pos.z-atline.sidedef[atside].sector.GetPlaneTexZ(0); + else atz = pos.z-atline.sidedef[atside?0:1].sector.GetPlaneTexZ(0); + } + else if ( atline.flags&Line.ML_DONTPEGBOTTOM ) atz = pos.z-atline.sidedef[atside].sector.GetPlaneTexZ(0); + else atz = pos.z-atline.sidedef[atside].sector.GetPlaneTexZ(1); angle = atan2(normal.y,normal.x); pitch = 0; roll = 180; // otherwise it slides upwards (UT changes roll like this too) @@ -274,20 +322,26 @@ Class BioGel : Actor } else if ( pos.z <= floorz+4 ) { + atplane = cursector.floorplane; + atpart = 0; normal = cursector.floorplane.Normal; pitch = asin(-normal.z); angle = atan2(normal.y,normal.x); roll = FRandom[GES](0,360); SetOrigin((pos.x,pos.y,floorz)+normal*0.5,false); + atz = pos.z-cursector.GetPlaneTexZ(0); hittype = HIT_FLOOR; } else if ( pos.z >= ceilingz-8 ) { + atplane = cursector.ceilingplane; + atpart = 1; normal = cursector.ceilingplane.Normal; pitch = asin(-normal.z); angle = atan2(normal.y,normal.x); roll = FRandom[GES](0,360); SetOrigin((pos.x,pos.y,ceilingz)+normal*0.5,false); + atz = pos.z-cursector.GetPlaneTexZ(1); if ( waterlevel > 0 ) hittype = HIT_FLOOR; else if ( normal dot (0,0,-1) > 0.7 ) hittype = HIT_CEILING; @@ -327,7 +381,7 @@ Class BioGel : Actor if ( invoker.b ) invoker.b.Destroy(); let s = Spawn("BioXLight",pos); s.args[3] *= Scale.x; - invoker.deadtimer = -1; + invoker.deadtimer = -2; if ( invoker.atline ) invoker.atline.RemoteActivate(target,invoker.atside,SPAC_Impact,pos); A_Explode(Random[GES](20,40)*Scale.x,Min(150,Scale.x*25)); A_PlaySound("ges/explode",CHAN_VOICE); @@ -361,6 +415,7 @@ Class BioGel : Actor Height 3; Scale 2; Speed 18; + ProjectileKickback 220; PROJECTILE; -NOGRAVITY; +SKYEXPLODE; diff --git a/zscript/eightball.zsc b/zscript/eightball.zsc index 412454c..2620dbe 100644 --- a/zscript/eightball.zsc +++ b/zscript/eightball.zsc @@ -110,6 +110,7 @@ Class UTRocket : Actor Radius 2; Height 2; Speed 18; + ProjectileKickback 400; PROJECTILE; +SKYEXPLODE; +EXPLODEONWATER; diff --git a/zscript/enforcer.zsc b/zscript/enforcer.zsc index 5e385a6..fa86c09 100644 --- a/zscript/enforcer.zsc +++ b/zscript/enforcer.zsc @@ -385,6 +385,7 @@ Class Enforcer : UTWeapon replaces Pistol Weapon.AmmoType2 "MiniAmmo"; Weapon.AmmoUse2 1; Weapon.AmmoGive 30; + Weapon.Kickback 180; Enforcer.ClipCount 20; Enforcer.SlaveClipCount 20; } diff --git a/zscript/flakcannon.zsc b/zscript/flakcannon.zsc index 070ecee..2f917d1 100644 --- a/zscript/flakcannon.zsc +++ b/zscript/flakcannon.zsc @@ -363,6 +363,7 @@ Class FlakSlug : Actor Radius 2; Height 2; Speed 40; + ProjectileKickback 320; PROJECTILE; -NOGRAVITY; +SKYEXPLODE; diff --git a/zscript/minigun.zsc b/zscript/minigun.zsc index d5d2bde..07cb1c5 100644 --- a/zscript/minigun.zsc +++ b/zscript/minigun.zsc @@ -205,6 +205,7 @@ Class Minigun : UTWeapon Weapon.AmmoType2 "MiniAmmo"; Weapon.AmmoUse2 1; Weapon.AmmoGive 50; + Weapon.Kickback 180; } States { diff --git a/zscript/ripper.zsc b/zscript/ripper.zsc index 202abea..a5a01d0 100644 --- a/zscript/ripper.zsc +++ b/zscript/ripper.zsc @@ -186,6 +186,7 @@ Class Razor2Alt : Razor2 DamageFunction Random[Ripper](40,60); DamageType 'RipperAltDealth'; BounceType "None"; + ProjectileKickback 350; -CANBOUNCEWATER; +EXPLODEONWATER; } diff --git a/zscript/shockrifle.zsc b/zscript/shockrifle.zsc index 15d6685..16e72f7 100644 --- a/zscript/shockrifle.zsc +++ b/zscript/shockrifle.zsc @@ -32,7 +32,7 @@ Class ShockBeamTracer : LineTracer } else if ( (Results.HitType == TRACE_HitWall) && (Results.Tier == TIER_Middle) ) { - if ( !Results.HitLine.sidedef[1] || (Results.HitLine.Flags&Line.ML_BlockHitscan) ) + if ( !Results.HitLine.sidedef[1] || (Results.HitLine.Flags&(Line.ML_BlockHitscan|Line.ML_BlockEverything)) ) return TRACE_Stop; return TRACE_Skip; } @@ -260,6 +260,7 @@ Class ShockBeam : Actor Radius 0.1; Height 0; Scale 0.4; + ProjectileKickback 250; +NOGRAVITY; +NOCLIP; +DONTSPLASH; @@ -781,6 +782,10 @@ Class ShockHitbox : Actor } SetOrigin(target.pos-(0,0,height*0.5),true); } + override bool CanCollideWith( Actor other, bool passive ) + { + return ((other is 'ShockBeam') || (other is 'SuperShockBeam')); + } } Class ShockBall : Actor @@ -827,6 +832,7 @@ Class ShockBall : Actor Height 2; Scale 0.4; Speed 20; + ProjectileKickback 250; PROJECTILE; +FORCEXYBILLBOARD; +SKYEXPLODE; diff --git a/zscript/sniperrifle.zsc b/zscript/sniperrifle.zsc index ef00727..b22624c 100644 --- a/zscript/sniperrifle.zsc +++ b/zscript/sniperrifle.zsc @@ -138,6 +138,7 @@ Class SniperRifle : UTWeapon Weapon.AmmoType2 "RifleAmmo"; Weapon.AmmoUse2 1; Weapon.AmmoGive 8; + Weapon.Kickback 250; } States { diff --git a/zscript/utcommon.zsc b/zscript/utcommon.zsc index 691703c..fc7bf73 100644 --- a/zscript/utcommon.zsc +++ b/zscript/utcommon.zsc @@ -252,6 +252,7 @@ Class UTWeapon : Weapon Weapon.BobSpeed 1.5; Weapon.BobRangeX 0.2; Weapon.BobRangeY 0.4; + Weapon.YAdjust 0; +WEAPON.NOALERT; } } diff --git a/zscript/warheadlauncher.zsc b/zscript/warheadlauncher.zsc index fbe3e22..14fa0aa 100644 --- a/zscript/warheadlauncher.zsc +++ b/zscript/warheadlauncher.zsc @@ -68,7 +68,7 @@ Class ShockWave : Actor double moscale = max(0,1100-0.22*dist); if ( (dist > olddmgradius) || (dir dot a.vel < 0) ) { - a.vel += dir*(moscale/a.mass+20); + if ( !a.bDONTTHRUST ) a.vel += dir*((moscale+20)/a.mass); a.DamageMobj(self,target,moscale,'RedeemerDeath',DMG_THRUSTLESS); } }