Final batch of swingers implemented.

This commit is contained in:
Marisa the Magician 2018-09-15 16:11:37 +02:00
commit 816ccd7b37
14 changed files with 62 additions and 52 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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; i<num; i++ )
UTMainHandler.DoSwing(self,(FRandom[Eightball](0.4,-0.8),FRandom[Eightball](-0.5,0.5)),1,-0.2,Random[Eightball](3,4),SWING_Spring,Random[Eightball](2,5),Random[Eightball](2,4));
Vector3 x, y, z, x2, y2, z2;
double a, s;
[x, y, z] = Matrix4.GetAxes(pitch,angle,roll);

View file

@ -291,7 +291,7 @@ Class Enforcer : UTWeapon
else A_Overlay(-3,"LeftMuzzleFlash");
A_OverlayFlags(-3,PSPF_RENDERSTYLE|PSPF_FORCESTYLE,true);
A_OverlayRenderstyle(-3,STYLE_Add);
UTMainHandler.DoSwing(self,(FRandom[Enforcer](0.5,0.2),FRandom[Enforcer](-0.3,0.2)),2,0,1,SWING_Spring2);
UTMainHandler.DoSwing(self,(FRandom[Enforcer](0.5,0.2),FRandom[Enforcer](-0.3,0.2)),2,0,1,SWING_Spring,0,2);
}
else
{
@ -299,7 +299,7 @@ Class Enforcer : UTWeapon
else A_Overlay(-2,"MuzzleFlash");
A_OverlayFlags(-2,PSPF_RENDERSTYLE|PSPF_FORCESTYLE,true);
A_OverlayRenderstyle(-2,STYLE_Add);
UTMainHandler.DoSwing(self,(FRandom[Enforcer](-0.2,-0.5),FRandom[Enforcer](-0.3,0.2)),2,0,1,SWING_Spring2);
UTMainHandler.DoSwing(self,(FRandom[Enforcer](-0.2,-0.5),FRandom[Enforcer](-0.3,0.2)),2,0,1,SWING_Spring,0,2);
}
Vector3 x, y, z, x2, y2, z2;
[x, y, z] = Matrix4.GetAxes(pitch,angle,roll);

View file

@ -510,6 +510,7 @@ Class FlakCannon : UTWeapon
A_PlaySound("flak/fire",CHAN_WEAPON);
invoker.FireEffect();
UTMainHandler.DoFlash(self,Color(160,255,96,0),1);
UTMainHandler.DoSwing(self,(FRandom[Flak](-0.3,-0.8),FRandom[Flak](-0.5,0.5)),4,-1.5,2,SWING_Spring,2,2);
A_AlertMonsters();
A_QuakeEx(1,1,1,3,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.05);
Vector3 x, y, z;
@ -559,6 +560,7 @@ Class FlakCannon : UTWeapon
A_PlaySound("flak/altfire",CHAN_WEAPON);
invoker.FireEffect();
UTMainHandler.DoFlash(self,Color(128,255,96,0),1);
UTMainHandler.DoSwing(self,(FRandom[Flak](-0.4,-0.8),FRandom[Flak](0.4,0.8)),4,-1,3,SWING_Spring,3,5);
A_AlertMonsters();
A_QuakeEx(2,2,2,6,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1);
Vector3 x, y, z;

View file

@ -67,7 +67,7 @@ Class ImpactHammer : UTWeapon
if ( !weap ) return;
A_PlaySound("impact/release",CHAN_WEAPON);
invoker.FireEffect();
UTMainHandler.DoSwing(self,(FRandom[Impact](-0.3,-1.5),FRandom[Impact](-1.2,-0.4)),3,-0.8,3,SWING_Spring2,3);
UTMainHandler.DoSwing(self,(FRandom[Impact](-0.3,-1.5),FRandom[Impact](-1.2,-0.4)),3,-0.8,3,SWING_Spring,3,2);
A_AlertMonsters();
Vector3 x, y, z;
[x, y, z] = Matrix4.GetAxes(pitch,angle,roll);
@ -129,7 +129,7 @@ Class ImpactHammer : UTWeapon
if ( !weap ) return;
A_PlaySound("impact/fire",CHAN_WEAPON);
invoker.FireEffect();
UTMainHandler.DoSwing(self,(FRandom[Impact](-0.3,-1.5),FRandom[Impact](-1.2,-0.4)),2,-0.6,2,SWING_Spring2,1);
UTMainHandler.DoSwing(self,(FRandom[Impact](-0.3,-1.5),FRandom[Impact](-1.2,-0.4)),2,-0.6,2,SWING_Spring,1,2);
A_AlertMonsters();
A_QuakeEx(2,2,2,6,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1);
Vector3 x, y, z;

View file

@ -86,8 +86,16 @@ Class Minigun : UTWeapon
invoker.FireEffect();
UTMainHandler.DoFlash(self,Color(32,255,255,0),1);
A_AlertMonsters();
if ( alt ) A_QuakeEx(2,2,2,8,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.12);
else A_QuakeEx(1,1,1,8,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.08);
if ( alt )
{
A_QuakeEx(2,2,2,8,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.12);
UTMainHandler.DoSwing(self,(FRandom[Minigun](-1,1),FRandom[Minigun](-1,1)),0.5,0,1,SWING_Spring,0,3);
}
else
{
A_QuakeEx(1,1,1,8,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.08);
UTMainHandler.DoSwing(self,(FRandom[Minigun](-1,1),FRandom[Minigun](-1,1)),0.3,0,1,SWING_Spring,0,3);
}
let l = Spawn("MinigunLight",pos);
l.target = self;
if ( !alt ) MinigunLight(l).cnt--;

View file

@ -559,7 +559,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.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");

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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();

View file

@ -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;

View file

@ -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;