diff --git a/zscript/biorifle.zsc b/zscript/biorifle.zsc index 00f4286..5058df1 100644 --- a/zscript/biorifle.zsc +++ b/zscript/biorifle.zsc @@ -662,12 +662,12 @@ Class BioRifle : UTWeapon { p = Spawn("BioGlob",origin); p.A_SetScale(1.0+invoker.charge*0.8); - UTMainHandler.DoSwing(self,(FRandom[GES](-0.6,-1.3),FRandom[GES](-0.9,-0.2)),1+invoker.charge*0.3,-0.1,3,SWING_Spring2,3); + UTMainHandler.DoSwing(self,(FRandom[GES](-0.6,-1.3),FRandom[GES](-0.9,-0.2)),1+invoker.charge*0.3,-0.1,3,SWING_Spring,3,2); } else { p = Spawn("BioGel",origin); - UTMainHandler.DoSwing(self,(FRandom[GES](-0.6,-1.3),FRandom[GES](-0.9,-0.2)),2,-0.5,2,SWING_Spring2,2); + UTMainHandler.DoSwing(self,(FRandom[GES](-0.6,-1.3),FRandom[GES](-0.9,-0.2)),2,-0.5,2,SWING_Spring,2,2); } p.angle = angle; p.pitch = BulletSlope(); @@ -697,7 +697,7 @@ Class BioRifle : UTWeapon { Weapon weap = Weapon(invoker); if ( !weap ) return; - UTMainHandler.DoSwing(self,(FRandom[GES](-1,1),FRandom[GES](-1,1)),0.02*invoker.charge,0,5,SWING_Spring2); + UTMainHandler.DoSwing(self,(FRandom[GES](-1,1),FRandom[GES](-1,1)),0.02*invoker.charge,0,5,SWING_Spring,0,2); if ( invoker.charge >= 5.1 ) return; if ( weap.Ammo1.Amount <= 0 ) return; if ( !weap.DepleteAmmo(weap.bAltFire,true,1) ) return; diff --git a/zscript/chainsaw.zsc b/zscript/chainsaw.zsc index 93a3e20..a1cc12f 100644 --- a/zscript/chainsaw.zsc +++ b/zscript/chainsaw.zsc @@ -238,13 +238,13 @@ Class UTChainsaw : UTWeapon CSWA A 0 { A_PlaySound("chainsaw/fire",CHAN_6); - UTMainHandler.DoSwing(self,(FRandom[Chainsaw](-0.8,-1.2),FRandom[Chainsaw](-0.4,-0.7)),0,1,5,SWING_Spring2,6); + UTMainHandler.DoSwing(self,(FRandom[Chainsaw](-0.8,-1.2),FRandom[Chainsaw](-0.4,-0.7)),0,1,5,SWING_Spring,6,3); } CSWA ABCDE 2 A_Vibrate(true); CSWA F 2 { A_Overlay(PSP_WEAPON+1,"AltFireSwipes"); - UTMainHandler.DoSwing(self,(FRandom[Chainsaw](0.8,1.2),FRandom[Chainsaw](0,0)),0,2,6,SWING_Spring2); + UTMainHandler.DoSwing(self,(FRandom[Chainsaw](0.8,1.2),0),0,2,6,SWING_Spring,1,3); } CSWA GHIJ 2; CSWA K 2 A_Vibrate(true); diff --git a/zscript/eightball.zsc b/zscript/eightball.zsc index 62b8d3c..aeae521 100644 --- a/zscript/eightball.zsc +++ b/zscript/eightball.zsc @@ -332,6 +332,8 @@ Class UTRocketLauncher : UTWeapon UTMainHandler.DoFlash(self,Color(64,255,0,0),1); A_AlertMonsters(); A_QuakeEx(2+num,2+num,2+num,6+num,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1+num*0.05); + for ( int i=0; i0)?Min(50,weap.Ammo1.Amount):50; invoker.FireEffect(); UTMainHandler.DoFlash(self,Color(32,128,255,128),1); - UTMainHandler.DoSwing(self,(FRandom[Pulse](-1,-1),FRandom[Pulse](-1,1)),0.1,-0.02,3,SWING_Spring2); + UTMainHandler.DoSwing(self,(FRandom[Pulse](-1,-1),FRandom[Pulse](-1,1)),0.1,-0.02,3,SWING_Spring,0,2); A_AlertMonsters(); Vector3 x, y, z; [x, y, z] = Matrix4.GetAxes(pitch,angle,roll); @@ -620,7 +620,7 @@ Class PulseGun : UTWeapon if ( !CVar.GetCVar('flak_pulsereload').GetBool() && (invoker.clipcount <=0) ) invoker.clipcount = (weap.Ammo1.Amount>0)?Min(50,weap.Ammo1.Amount):50; invoker.FireEffect(); UTMainHandler.DoFlash(self,Color(32,128,255,128),1); - UTMainHandler.DoSwing(self,(FRandom[Pulse](-1,-1),FRandom[Pulse](-1,1)),0.3,-0.1,2,SWING_Spring3); + UTMainHandler.DoSwing(self,(FRandom[Pulse](-1,-1),FRandom[Pulse](-1,1)),0.3,-0.1,2,SWING_Spring,0,3); A_AlertMonsters(); A_QuakeEx(1,1,1,2,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.05); A_Overlay(-2,"MuzzleFlash"); diff --git a/zscript/ripper.zsc b/zscript/ripper.zsc index 45c612b..9b8da4f 100644 --- a/zscript/ripper.zsc +++ b/zscript/ripper.zsc @@ -273,8 +273,16 @@ Class Ripper2 : UTWeapon invoker.FireEffect(); UTMainHandler.DoFlash(self,Color(8,0,255,255),1); A_AlertMonsters(); - if ( alt ) A_QuakeEx(3,3,3,8,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1); - else A_QuakeEx(1,1,1,5,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.08); + if ( alt ) + { + A_QuakeEx(3,3,3,8,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1); + UTMainHandler.DoSwing(self,(FRandom[Ripper](-0.3,-0.6),FRandom[Ripper](0.2,0.6)),3,-0.5,3,SWING_Spring,5,4); + } + else + { + A_QuakeEx(1,1,1,5,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.08); + UTMainHandler.DoSwing(self,(FRandom[Ripper](-0.3,-0.6),FRandom[Ripper](0.2,0.6)),1,-0.3,2,SWING_Spring,2,2); + } Vector3 x, y, z; [x, y, z] = Matrix4.GetAxes(pitch,angle,roll); Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+6.0*y-4.0*z; diff --git a/zscript/shockrifle.zsc b/zscript/shockrifle.zsc index 9128c09..004fab8 100644 --- a/zscript/shockrifle.zsc +++ b/zscript/shockrifle.zsc @@ -337,7 +337,7 @@ Class ShockBeam : Actor if ( target ) { target.TakeInventory('ShockAmmo',2); - UTMainHandler.DoSwing(target,(FRandom[ASMD](-0.1,-0.6),FRandom[ASMD](-0.1,0.5)),5,-1,3,SWING_Spring2,2); + UTMainHandler.DoSwing(target,(FRandom[ASMD](-0.1,-0.6),FRandom[ASMD](-0.1,0.5)),5,-1,3,SWING_Spring,3,6); } let b = t.Results.HitActor.target; UTMainHandler.DoBlast(b,250,70000); @@ -564,7 +564,7 @@ Class SuperShockBeam : Actor if ( target ) { target.TakeInventory('EnhancedShockAmmo',1); - UTMainHandler.DoSwing(target,(FRandom[ASMD](-0.1,-0.6),FRandom[ASMD](-0.1,0.5)),10,-2,3,SWING_Spring2,2); + UTMainHandler.DoSwing(target,(FRandom[ASMD](-0.1,-0.6),FRandom[ASMD](-0.1,0.5)),10,-2,3,SWING_Spring,3,6); } let b = t.Results.HitActor.target; UTMainHandler.DoBlast(b,400,70000); @@ -1004,7 +1004,7 @@ Class ShockRifle : UTWeapon A_PlaySound("shock/fire",CHAN_WEAPON); invoker.FireEffect(); UTMainHandler.DoFlash(self,Color(128,128,0,255),1); - UTMainHandler.DoSwing(self,(FRandom[ASMD](-0.1,-0.6),FRandom[ASMD](-0.1,0.5)),2,-0.3,3,SWING_Spring3); + UTMainHandler.DoSwing(self,(FRandom[ASMD](-0.1,-0.6),FRandom[ASMD](-0.1,0.5)),2,-0.3,3,SWING_Spring,0,4); A_AlertMonsters(); A_QuakeEx(2,2,2,4,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1); Vector3 x, y, z; @@ -1042,7 +1042,7 @@ Class ShockRifle : UTWeapon A_PlaySound("shock/altfire",CHAN_WEAPON); invoker.FireEffect(); UTMainHandler.DoFlash(self,Color(128,128,0,255),1); - UTMainHandler.DoSwing(self,(FRandom[ASMD](-0.1,-0.6),FRandom[ASMD](-0.1,0.5)),3,-0.4,3,SWING_Spring3); + UTMainHandler.DoSwing(self,(FRandom[ASMD](-0.1,-0.6),FRandom[ASMD](-0.1,0.5)),3,-0.4,3,SWING_Spring,0,4); A_AlertMonsters(); A_QuakeEx(2,2,2,8,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1); Vector3 x, y, z; @@ -1187,7 +1187,7 @@ Class EnhancedShockRifle : UTWeapon A_PlaySound("shock/fire",CHAN_WEAPON); invoker.FireEffect(); UTMainHandler.DoFlash(self,Color(128,255,128,0),1); - UTMainHandler.DoSwing(self,(FRandom[ASMD](-0.1,-0.6),FRandom[ASMD](-0.1,0.5)),4,-0.6,3,SWING_Spring3); + UTMainHandler.DoSwing(self,(FRandom[ASMD](-0.1,-0.6),FRandom[ASMD](-0.1,0.5)),4,-0.6,3,SWING_Spring,0,4); A_AlertMonsters(); A_QuakeEx(3,3,3,4,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.15); Vector3 x, y, z; @@ -1225,7 +1225,7 @@ Class EnhancedShockRifle : UTWeapon A_PlaySound("shock/altfire",CHAN_WEAPON); invoker.FireEffect(); UTMainHandler.DoFlash(self,Color(128,255,128,0),1); - UTMainHandler.DoSwing(self,(FRandom[ASMD](-0.1,-0.6),FRandom[ASMD](-0.1,0.5)),6,-0.8,3,SWING_Spring3); + UTMainHandler.DoSwing(self,(FRandom[ASMD](-0.1,-0.6),FRandom[ASMD](-0.1,0.5)),6,-0.8,3,SWING_Spring,0,4); A_AlertMonsters(); A_QuakeEx(3,3,3,4,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.15); Vector3 x, y, z; diff --git a/zscript/sniperrifle.zsc b/zscript/sniperrifle.zsc index 2d8a1c2..6951ef7 100644 --- a/zscript/sniperrifle.zsc +++ b/zscript/sniperrifle.zsc @@ -77,10 +77,17 @@ Class SniperRifle : UTWeapon UTMainHandler.DoFlash(self,Color(32,0,0,255),1); A_PlaySound("sniper/fire",CHAN_WEAPON); A_AlertMonsters(); - if ( zoomed ) A_QuakeEx(2,2,2,3,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.09); + if ( zoomed ) + { + A_QuakeEx(2,2,2,3,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.09); + for ( int i=0; i<3; i++ ) + UTMainHandler.DoSwing(self,(FRandom[Sniper](-0.3,0.05),FRandom[Sniper](-0.3,0.1)),2,-0.5,Random[Sniper](3,4),SWING_Spring,Random[Sniper](3,4),Random[Sniper](4,5)); + } else { A_QuakeEx(3,3,3,6,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.12); + for ( int i=0; i<3; i++ ) + UTMainHandler.DoSwing(self,(FRandom[Sniper](-0.3,0.05),FRandom[Sniper](-0.3,0.1)),4,-1,Random[Sniper](3,4),SWING_Spring,Random[Sniper](3,4),Random[Sniper](4,5)); A_Overlay(-2,"MuzzleFlash"); A_OverlayFlags(-2,PSPF_RENDERSTYLE|PSPF_FORCESTYLE,true); A_OverlayRenderstyle(-2,STYLE_Add); diff --git a/zscript/translocator.zsc b/zscript/translocator.zsc index 5afb97e..f1652ba 100644 --- a/zscript/translocator.zsc +++ b/zscript/translocator.zsc @@ -284,6 +284,7 @@ Class Translocator : UTWeapon if ( !weap ) return; A_PlaySound("transloc/throw",CHAN_WEAPON); invoker.FireEffect(); + UTMainHandler.DoSwing(self,(FRandom[Translocator](-0.2,0.4),FRandom[Translocator](-0.2,0.7)),2,-0.3,3,SWING_Spring,2,3); A_AlertMonsters(); Vector3 x, y, z; [x, y, z] = Matrix4.GetAxes(pitch,angle,roll); @@ -305,6 +306,7 @@ Class Translocator : UTWeapon if ( !weap ) return; A_PlaySound("transloc/return",CHAN_WEAPON); invoker.FireEffect(); + UTMainHandler.DoSwing(self,(FRandom[Translocator](-0.2,-0.4),FRandom[Translocator](-0.2,0.7)),3,-1,2,SWING_Spring,2,2); A_AlertMonsters(); if ( invoker.module && invoker.module.bAMBUSH ) { @@ -412,7 +414,7 @@ Class Translocator : UTWeapon TLCF A 0 A_JumpIf(invoker.module,"Return"); TLCF A 0 A_ThrowModule(); TLCF ABCDEFGH 1; - TLCF IJKLMNOPQRS 1 A_WeaponReady(); + TLCF IJKLMNOPQRS 1 A_WeaponReady(WRF_NOPRIMARY); Goto Idle; Return: TLCF A 0 A_ReturnModule(); diff --git a/zscript/utcommon.zsc b/zscript/utcommon.zsc index 53b6254..b9b3abe 100644 --- a/zscript/utcommon.zsc +++ b/zscript/utcommon.zsc @@ -1160,15 +1160,13 @@ Enum ESwingMode { SWING_Straight, // constant increment SWING_Spring, // bounces back after a delay - SWING_Spring2, // ... returning at half speed - SWING_Spring3, // ... returning at third speed }; Class Swinger : Thinker { Actor target; Vector2 dir; - double inc; + double inc, rmul; int steps, mode, delay; double str, tstr; int cnt, cstate; @@ -1178,8 +1176,6 @@ Class Swinger : Thinker STATE_Initial, STATE_Wait, STATE_Return, - STATE_ReturnSlow, - STATE_ReturnSlower, }; override void Tick() @@ -1195,7 +1191,7 @@ Class Swinger : Thinker { cnt = 0; str = tstr/steps; - cstate = (mode==SWING_Straight)?(-1):(delay>0)?STATE_Wait:(mode==SWING_Spring3)?STATE_ReturnSlower:(mode==SWING_Spring2)?STATE_ReturnSlow:STATE_Return; + cstate = (mode==SWING_Straight)?(-1):(delay>0)?STATE_Wait:STATE_Return; } else tstr += str; break; @@ -1203,31 +1199,13 @@ Class Swinger : Thinker if ( ++cnt >= delay ) { cnt = 0; - cstate = (mode==SWING_Spring3)?STATE_ReturnSlower:(mode==SWING_Spring2)?STATE_ReturnSlow:STATE_Return; + cstate = STATE_Return; } break; case STATE_Return: - target.A_SetAngle(target.angle-dir.x*str,SPF_INTERPOLATE); - target.A_SetPitch(target.pitch-dir.y*str,SPF_INTERPOLATE); - if ( ++cnt >= steps ) - { - cnt = 0; - cstate = -1; - } - break; - case STATE_ReturnSlow: - target.A_SetAngle(target.angle-dir.x*str/2.,SPF_INTERPOLATE); - target.A_SetPitch(target.pitch-dir.y*str/2.,SPF_INTERPOLATE); - if ( ++cnt >= steps*2 ) - { - cnt = 0; - cstate = -1; - } - break; - case STATE_ReturnSlower: - target.A_SetAngle(target.angle-dir.x*str/3.,SPF_INTERPOLATE); - target.A_SetPitch(target.pitch-dir.y*str/3.,SPF_INTERPOLATE); - if ( ++cnt >= steps*3 ) + target.A_SetAngle(target.angle-dir.x*str/rmul,SPF_INTERPOLATE); + target.A_SetPitch(target.pitch-dir.y*str/rmul,SPF_INTERPOLATE); + if ( ++cnt >= steps*rmul ) { cnt = 0; cstate = -1; @@ -1640,13 +1618,14 @@ Class UTMainHandler : StaticEventHandler Victim.vel += HitDirection*(MomentumTransfer/(Thinker.TICRATE*Victim.Mass)); } - static void DoSwing( Actor target, Vector2 dir, double initial, double inc, int steps, int mode = 0, int delay = 0 ) + static void DoSwing( Actor target, Vector2 dir, double initial, double inc, int steps, int mode = 0, int delay = 0, double rmul = 1.0 ) { let s = new("Swinger"); s.ChangeStatNum(Thinker.STAT_USER); s.target = target; s.dir = dir; s.inc = inc; + s.rmul = rmul; s.steps = steps; s.mode = mode; s.delay = delay; diff --git a/zscript/warheadlauncher.zsc b/zscript/warheadlauncher.zsc index e0cc08c..ab6d667 100644 --- a/zscript/warheadlauncher.zsc +++ b/zscript/warheadlauncher.zsc @@ -632,6 +632,8 @@ Class WarheadLauncher : UTWeapon A_PlaySound("warhead/fire",CHAN_WEAPON); invoker.FireEffect(); UTMainHandler.DoFlash(self,Color(128,255,128,128),1); + UTMainHandler.DoSwing(self,(FRandom[Warhead](0.6,1.2),FRandom[Warhead](0.2,0.5)),4,-1,3,SWING_Spring,2,5); + UTMainHandler.DoSwing(self,(FRandom[Warhead](0.2,0.5),FRandom[Warhead](-0.9,-1.5)),4,-0.6,5,SWING_Spring,3,3); A_AlertMonsters(); A_QuakeEx(6,6,6,20,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.2); Vector3 x, y, z;