Portal awareness adjustments to various vector operations.

Got rid of the deprecated Matrix4.GetAxes method. Next step is to get rid of more stuff by migrating to libeye.
Mirrored Translocator model so it shows the actually detailed side. At some point in UT's development it got flipped around for some reason.
Weapon code cleanup (most noticeable on states).
Backported scope shader from Doomreal.
Added optional "dummied out" Sniper zoom sounds from a dubious source.
This commit is contained in:
Marisa the Magician 2019-09-28 17:14:55 +02:00
commit fb96c7523e
27 changed files with 445 additions and 777 deletions

View file

@ -43,3 +43,5 @@ server bool flak_dmsshock = false; // allow enhanced shock rifle on deathmatch
server noarchive bool flak_instagib = false; // instagib mode (only for dm) - this cvar has to be set from the command line server noarchive bool flak_instagib = false; // instagib mode (only for dm) - this cvar has to be set from the command line
user float flak_flashstrength = 1.0; // strength of screen flashes user float flak_flashstrength = 1.0; // strength of screen flashes
server bool flak_sawammo = false; // chainsaw uses fuel server bool flak_sawammo = false; // chainsaw uses fuel
user bool flak_zoomsound = false; // sniper rifle plays unused zoom sounds (annoying)
user bool flak_zoomshader = false; // sniper rifle has a scope shader

View file

@ -611,4 +611,9 @@ SkyBox "KGDaySky" fliptop
"graphics/SkySetB_left.png" "graphics/SkySetB_left.png"
"graphics/SkySetB_up.png" "graphics/SkySetB_up.png"
"graphics/SkySetB_down.png" "graphics/SkySetB_down.png"
} }
HardwareShader PostProcess scene
{
Name "UTRifleScope"
Shader "shaders/glsl/UTRifleScope.fp" 330
}

View file

@ -217,6 +217,8 @@ FLAK_UCORPS = "Corpses take damage (unstable)";
FLAK_DTEST = "Edit Kinsie's test map"; FLAK_DTEST = "Edit Kinsie's test map";
FLAK_FSTRENGTH = "Screen flash strength"; FLAK_FSTRENGTH = "Screen flash strength";
FLAK_SAWAMMO = "Chainsaw uses ammo"; FLAK_SAWAMMO = "Chainsaw uses ammo";
FLAK_ZSHADER = "Sniper scope shader";
FLAK_ZOOMSND = "Enable zoom sounds";
FLAK_TAUNTS = "Taunts"; FLAK_TAUNTS = "Taunts";
FLAK_TAUNT1 = "Victory 1"; FLAK_TAUNT1 = "Victory 1";
FLAK_TAUNT2 = "Victory 2"; FLAK_TAUNT2 = "Victory 2";
@ -438,6 +440,8 @@ FLAK_UCORPS = "Los cadáveres reciben daño (inestable)";
FLAK_DTEST = "Editar mapa de pruebas de Kinsie"; FLAK_DTEST = "Editar mapa de pruebas de Kinsie";
FLAK_FSTRENGTH = "Intensidad de destellos en pantalla"; FLAK_FSTRENGTH = "Intensidad de destellos en pantalla";
FLAK_SAWAMMO = "La motosierra usa combustible"; FLAK_SAWAMMO = "La motosierra usa combustible";
FLAK_ZSHADER = "Shader de mira de Rifle de Francotirador";
FLAK_ZOOMSND = "Habilitar sonidos de zoom";
FLAK_TAUNTS = "Provocaciones"; FLAK_TAUNTS = "Provocaciones";
FLAK_TAUNT1 = "Victoria 1"; FLAK_TAUNT1 = "Victoria 1";
FLAK_TAUNT2 = "Victoria 2"; FLAK_TAUNT2 = "Victoria 2";

View file

@ -28,6 +28,8 @@ OptionMenu "UTOptionMenu"
Option "$FLAK_RSWITCH", "flak_noswitchdeemer", "YesNo" Option "$FLAK_RSWITCH", "flak_noswitchdeemer", "YesNo"
Option "$FLAK_CSSHOCK", "flak_classicsshock", "YesNo" Option "$FLAK_CSSHOCK", "flak_classicsshock", "YesNo"
Option "$FLAK_SAWAMMO", "flak_sawammo", "YesNo" Option "$FLAK_SAWAMMO", "flak_sawammo", "YesNo"
Option "$FLAK_ZOOMSND", "flak_zoomsound", "YesNo"
Option "$FLAK_ZSHADER", "flak_zoomshader", "YesNo"
Option "$FLAK_RECOIL", "flak_swingers", "YesNo" Option "$FLAK_RECOIL", "flak_swingers", "YesNo"
Slider "$FLAK_RSTRENGTH", "flak_swingerstrength", 0.0, 1.0, 0.1, 1 Slider "$FLAK_RSTRENGTH", "flak_swingerstrength", 0.0, 1.0, 0.1, 1
Slider "$FLAK_FSTRENGTH", "flak_flashstrength", 0.0, 1.0, 0.1, 1 Slider "$FLAK_FSTRENGTH", "flak_flashstrength", 0.0, 1.0, 0.1, 1

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,14 @@
void main()
{
vec2 uv = TexCoord.st;
vec3 base = texture(InputTexture,uv).rgb;
vec2 p = vec2(.5)-uv;
vec2 sz = textureSize(InputTexture,0);
if ( sz.x > sz.y ) p.x *= sz.x/sz.y;
else p.y *= sz.y/sz.x;
vec3 col = texture(InputTexture,uv+p*pow(length(p),8.)*40.).rgb;
col = mix(col,max(col.r,max(col.g,col.b))*vec3(.2,.7,1.),vec3(.3));
float fade = 1.-clamp(pow(length(p)*2.,16.),0.,1.);
col *= fade;
FragColor = vec4(mix(base*.1,col,vec3(fade)),1.);
}

View file

@ -303,6 +303,8 @@ utrl/bounce hit1
sniper/select riflepck sniper/select riflepck
sniper/fire sniperf sniper/fire sniperf
sniper/zoomup zoomup
sniper/zoomdown zoomdown
warhead/explode warexplo warhead/explode warexplo
warhead/fly warfly warhead/fly warfly

BIN
sounds/zoomDOWN.ogg Normal file

Binary file not shown.

BIN
sounds/zoomUP.ogg Normal file

Binary file not shown.

View file

@ -116,7 +116,7 @@ Class BioHitbox : Actor
Destroy(); Destroy();
return; return;
} }
SetOrigin(target.pos-(0,0,height*0.5),true); SetOrigin(target.Vec3Offset(0,0,-height*0.5),true);
} }
override bool CanCollideWith( Actor other, bool passive ) override bool CanCollideWith( Actor other, bool passive )
{ {
@ -698,7 +698,7 @@ Class BioRifle : UTWeapon
Vector3 x, y, z; Vector3 x, y, z;
double a, s; double a, s;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+8.0*y-5.0*z; Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+8*y-5*z);
Actor p; Actor p;
if ( alt ) if ( alt )
{ {
@ -733,6 +733,7 @@ Class BioRifle : UTWeapon
Weapon weap = Weapon(invoker); Weapon weap = Weapon(invoker);
if ( !weap ) return; if ( !weap ) return;
invoker.charge = 0; invoker.charge = 0;
invoker.special1 = 0;
A_PlaySound("ges/charge",CHAN_WEAPON); A_PlaySound("ges/charge",CHAN_WEAPON);
invoker.bCharging = true; invoker.bCharging = true;
} }
@ -740,6 +741,12 @@ Class BioRifle : UTWeapon
{ {
Weapon weap = Weapon(invoker); Weapon weap = Weapon(invoker);
if ( !weap ) return; if ( !weap ) return;
if ( invoker.special1 > 0 )
{
invoker.special1--;
return;
}
invoker.special1 = 2;
UTMainHandler.DoSwing(self,(FRandom[GES](-1,1),FRandom[GES](-1,1)),0.02*invoker.charge,0,5,SWING_Spring,0,2); 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 ( invoker.charge >= 5.1 ) return;
if ( weap.Ammo1.Amount <= 0 ) return; if ( weap.Ammo1.Amount <= 0 ) return;
@ -788,63 +795,26 @@ Class BioRifle : UTWeapon
BIOF BCDEFGHI 1; BIOF BCDEFGHI 1;
Goto Idle; Goto Idle;
AltCheck: AltCheck:
TNT1 A 1; TNT1 A 1
TNT1 A 0 A_JumpIf(player.cmd.buttons&BT_ALTATTACK,"AltCheck"); {
TNT1 A 0 A_Overlay(PSP_WEAPON,"AltRelease"); if ( player.cmd.buttons&BT_ALTATTACK )
TNT1 A 1; return ResolveState(null);
player.SetPSprite(PSP_WEAPON,ResolveState("AltRelease"));
return ResolveState("Null");
}
Wait; Wait;
AltFire: AltFire:
BIOC A 0 A_Overlay(-9999,"AltCheck"); BIOC A 0 A_Overlay(-9999,"AltCheck");
BIOC A 4 A_BeginCharge(); BIOC A 4 A_BeginCharge();
BIOC B 5 A_ChargeUp(); BIOC BCDEFGHIJKLMNOPQRSTUVWXYZ 5 A_ChargeUp();
BIOC CD 5; BIC2 ABCDE 5 A_ChargeUp();
BIOC E 0 A_Refire(1);
Goto AltRelease;
BIOC E 5 A_ChargeUp();
BIOC FG 5;
BIOC H 0 A_Refire(1);
Goto AltRelease;
BIOC H 5 A_ChargeUp();
BIOC IJ 5;
BIOC K 0 A_Refire(1);
Goto AltRelease;
BIOC K 5 A_ChargeUp();
BIOC LM 5;
BIOC N 0 A_Refire(1);
Goto AltRelease;
BIOC N 5 A_ChargeUp();
BIOC OP 5;
BIOC Q 0 A_Refire(1);
Goto AltRelease;
BIOC Q 5 A_ChargeUp();
BIOC RS 5;
BIOC T 0 A_Refire(1);
Goto AltRelease;
BIOC T 5 A_ChargeUp();
BIOC UV 5;
BIOC W 0 A_Refire(1);
Goto AltRelease;
BIOC W 5 A_ChargeUp();
BIOC XY 5;
BIOC Z 0 A_Refire(1);
Goto AltRelease;
BIOC Z 5 A_ChargeUp();
BIC2 AB 5;
BIC2 C 0 A_Refire(1);
Goto AltRelease;
BIC2 C 5 A_ChargeUp();
BIC2 DE 5;
BIOM A 0 A_Refire(1);
Goto AltRelease;
AltHeld:
BIOM A 1; BIOM A 1;
BIOM A 0 A_Refire("AltHeld"); Wait;
AltRelease: AltRelease:
BIOE A 1 BIOE A 1
{ {
invoker.charge = min(5.1,invoker.charge+0.1); invoker.charge = min(5.1,invoker.charge+0.1);
A_Overlay(-9999,null); A_Overlay(-9999,null);
A_WeaponOffset(0,32); // fix sudden psprite lowering
if ( self is 'UTPlayer' ) if ( self is 'UTPlayer' )
UTPlayer(self).PlayAttacking3(); UTPlayer(self).PlayAttacking3();
} }

View file

@ -65,10 +65,9 @@ Class UTChainsaw : UTWeapon
double sawcnt; double sawcnt;
double ammocharge; double ammocharge;
override void Tick() override void DoEffect()
{ {
Super.Tick(); Super.Tick();
if ( !Owner ) return;
if ( flak_sawammo ) if ( flak_sawammo )
{ {
AmmoType1 = "ChainsawAmmo"; AmmoType1 = "ChainsawAmmo";
@ -127,41 +126,52 @@ Class UTChainsaw : UTWeapon
A_QuakeEx(2,2,2,2,0,1,"",QF_RELATIVE,rollIntensity:0.15); A_QuakeEx(2,2,2,2,0,1,"",QF_RELATIVE,rollIntensity:0.15);
UTMainHandler.DoSwing(self,(FRandom[Chainsaw](-1,1),FRandom[Chainsaw](-1,1)),0.6,-0.2,2,SWING_Spring); UTMainHandler.DoSwing(self,(FRandom[Chainsaw](-1,1),FRandom[Chainsaw](-1,1)),0.6,-0.2,2,SWING_Spring);
invoker.sawcnt += 1./TICRATE; invoker.sawcnt += 1./TICRATE;
if ( invoker.sawcnt < 0.15 ) return; if ( invoker.sawcnt > 0.15 )
invoker.sawcnt = 0;
invoker.FireEffect();
A_AlertMonsters();
Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x-4.0*z;
FLineTraceData d;
LineTrace(angle,90,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d);
if ( d.HitType == TRACE_HitActor )
{ {
int dmg = 20; invoker.sawcnt = 0;
dmg = d.HitActor.DamageMobj(invoker,self,dmg,'slashed',DMG_USEANGLE,atan2(d.HitDir.y,d.HitDir.x)); invoker.FireEffect();
d.HitActor.vel -= x*(500/d.HitActor.mass); A_AlertMonsters();
vel += x*(100/mass); Vector3 x, y, z;
if ( d.HitActor.player ) d.HitActor.A_QuakeEx(5,5,5,6,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.25); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
if ( d.HitActor.bNOBLOOD ) Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x-4*z);
FLineTraceData d;
LineTrace(angle,90,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d);
if ( d.HitType == TRACE_HitActor )
{
int dmg = 20;
dmg = d.HitActor.DamageMobj(invoker,self,dmg,'slashed',DMG_USEANGLE,atan2(d.HitDir.y,d.HitDir.x));
d.HitActor.vel -= x*(500/d.HitActor.mass);
vel += x*(100/mass);
if ( d.HitActor.player ) d.HitActor.A_QuakeEx(5,5,5,6,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.25);
if ( d.HitActor.bNOBLOOD )
{
let p = Spawn("SawImpact",d.HitLocation-d.HitDir*4);
p.angle = atan2(d.HitDir.y,d.HitDir.x);
p.pitch = asin(-d.HitDir.z);
}
else
{
d.HitActor.TraceBleed(dmg,invoker);
d.HitActor.SpawnBlood(d.HitLocation,atan2(d.HitDir.y,d.HitDir.x)+180,dmg);
}
}
else if ( d.HitType != TRACE_HitNone )
{ {
let p = Spawn("SawImpact",d.HitLocation-d.HitDir*4); let p = Spawn("SawImpact",d.HitLocation-d.HitDir*4);
p.angle = atan2(d.HitDir.y,d.HitDir.x); p.angle = atan2(d.HitDir.y,d.HitDir.x);
p.pitch = asin(-d.HitDir.z); p.pitch = asin(-d.HitDir.z);
} if ( d.HitType == TRACE_HitWall ) d.HitLine.RemoteActivate(self,d.LineSide,SPAC_Impact,d.HitLocation-d.HitDir*4);
else
{
d.HitActor.TraceBleed(dmg,invoker);
d.HitActor.SpawnBlood(d.HitLocation,atan2(d.HitDir.y,d.HitDir.x)+180,dmg);
} }
} }
else if ( d.HitType != TRACE_HitNone ) bool quitout = false;
if ( invoker.Ammo1 && (invoker.Ammo1.Amount <= 0) )
{ {
let p = Spawn("SawImpact",d.HitLocation-d.HitDir*4); A_StopSound(CHAN_6);
p.angle = atan2(d.HitDir.y,d.HitDir.x); A_PlaySound("chainsaw/lower",CHAN_WEAPON);
p.pitch = asin(-d.HitDir.z); quitout = true;
if ( d.HitType == TRACE_HitWall ) d.HitLine.RemoteActivate(self,d.LineSide,SPAC_Impact,d.HitLocation-d.HitDir*4);
} }
else if ( !(player.cmd.buttons&BT_ATTACK) ) quitout = true;
if ( quitout ) player.SetPSprite(PSP_WEAPON,ResolveState("Release"));
} }
action void A_SawSwipe( bool initial = false ) action void A_SawSwipe( bool initial = false )
{ {
@ -172,7 +182,7 @@ Class UTChainsaw : UTWeapon
A_AlertMonsters(); A_AlertMonsters();
Vector3 x, y, z; Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x-2.0*z; Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x-2*z);
FLineTraceData d; FLineTraceData d;
double ang = (angle-60)+120*invoker.sawcnt; double ang = (angle-60)+120*invoker.sawcnt;
LineTrace(ang,90,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d); LineTrace(ang,90,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d);
@ -226,7 +236,7 @@ Class UTChainsaw : UTWeapon
if ( bAlt || Random[Chainsaw](0,2) ) return; if ( bAlt || Random[Chainsaw](0,2) ) return;
Vector3 x, y, z; Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+5.0*x+1.0*y-3.0*z; Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),5*x+y-3*z);
for ( int i=0; i<5; i++ ) for ( int i=0; i<5; i++ )
{ {
let s = Spawn("UTViewSmoke",origin); let s = Spawn("UTViewSmoke",origin);
@ -238,21 +248,6 @@ Class UTChainsaw : UTWeapon
UTViewSmoke(s).vvel += (0,-0.2,0); UTViewSmoke(s).vvel += (0,-0.2,0);
} }
} }
action state A_SawRefire( statelabel flash = null )
{
if ( invoker.Ammo1 && (invoker.Ammo1.Amount <= 0) )
{
A_ClearRefire();
A_StopSound(CHAN_6);
A_PlaySound("chainsaw/lower",CHAN_WEAPON);
return ResolveState("Release");
}
else
{
A_Refire(flash);
return ResolveState(null);
}
}
Default Default
{ {
Tag "$T_CHAINSAW"; Tag "$T_CHAINSAW";
@ -326,45 +321,10 @@ Class UTChainsaw : UTWeapon
Fire: Fire:
CSWJ A 1 A_PlaySound("chainsaw/fire",CHAN_6,looping:true); CSWJ A 1 A_PlaySound("chainsaw/fire",CHAN_6,looping:true);
CSWJ BCDEF 1 A_Vibrate(); CSWJ BCDEF 1 A_Vibrate();
Goto Hold;
Hold: Hold:
CSWJ G 1 A_SawHit(); CSWJ GHIJKLMNOPQRS 1 A_SawHit();
CSWJ H 0 A_SawRefire(1); Loop;
Goto Release;
CSWJ H 1 A_SawHit();
CSWJ I 0 A_SawRefire(1);
Goto Release;
CSWJ I 1 A_SawHit();
CSWJ J 0 A_SawRefire(1);
Goto Release;
CSWJ J 1 A_SawHit();
CSWJ K 0 A_SawRefire(1);
Goto Release;
CSWJ K 1 A_SawHit();
CSWJ L 0 A_SawRefire(1);
Goto Release;
CSWJ L 1 A_SawHit();
CSWJ M 0 A_SawRefire(1);
Goto Release;
CSWJ M 1 A_SawHit();
CSWJ N 0 A_SawRefire(1);
Goto Release;
CSWJ N 1 A_SawHit();
CSWJ O 0 A_SawRefire(1);
Goto Release;
CSWJ O 1 A_SawHit();
CSWJ P 0 A_SawRefire(1);
Goto Release;
CSWJ P 1 A_SawHit();
CSWJ Q 0 A_SawRefire(1);
Goto Release;
CSWJ Q 1 A_SawHit();
CSWJ R 0 A_SawRefire(1);
Goto Release;
CSWJ R 1 A_SawHit();
CSWJ S 0 A_SawRefire(1);
Goto Release;
CSWJ S 1 A_SawHit();
CSWJ G 0 A_SawRefire("Hold");
Release: Release:
CSWJ FEDCBA 1 A_Vibrate(); CSWJ FEDCBA 1 A_Vibrate();
Goto Idle; Goto Idle;

View file

@ -105,20 +105,4 @@ Class dt_Matrix4
r.set(2,3,-1); r.set(2,3,-1);
return r; return r;
} }
// [deprecated] UE-like axes from rotation
// proper implementation moved to CoordUtil
static Vector3, Vector3, Vector3 getaxes( double pitch, double yaw, double roll )
{
Vector3 x = (1,0,0), y = (0,-1,0), z = (0,0,1); // y inverted for left-handed result
dt_Matrix4 mRoll = dt_Matrix4.rotate((1,0,0),roll);
dt_Matrix4 mPitch = dt_Matrix4.rotate((0,1,0),pitch);
dt_Matrix4 mYaw = dt_Matrix4.rotate((0,0,1),yaw);
dt_Matrix4 mRot = mRoll.mul(mYaw);
mRot = mRot.mul(mPitch);
x = mRot.vmat(x);
y = mRot.vmat(y);
z = mRot.vmat(z);
return x, y, z;
}
} }

View file

@ -371,7 +371,7 @@ Class UTRocketLauncher : UTWeapon
Vector3 x, y, z, x2, y2, z2; Vector3 x, y, z, x2, y2, z2;
double a, s; double a, s;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+3.0*y-3.0*z; Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+3*y-3*z);
[x2, y2, z2] = dt_CoordUtil.GetAxes(BulletSlope(),angle,roll); [x2, y2, z2] = dt_CoordUtil.GetAxes(BulletSlope(),angle,roll);
Actor p; Actor p;
if ( weap.bAltFire ) if ( weap.bAltFire )
@ -382,7 +382,7 @@ Class UTRocketLauncher : UTWeapon
a = FRandom[Eightball](0,360); a = FRandom[Eightball](0,360);
s = FRandom[Eightball](0,(num>1)?12:0); s = FRandom[Eightball](0,(num>1)?12:0);
Vector3 dir = (x2+cos(a)*y2*s*0.004+sin(a)*z2*s*0.004).unit(); Vector3 dir = (x2+cos(a)*y2*s*0.004+sin(a)*z2*s*0.004).unit();
p = Spawn("UTGrenade",origin+cos(a)*y*s+sin(a)*z*s); p = Spawn("UTGrenade",level.Vec3Offset(origin,cos(a)*y*s+sin(a)*z*s));
p.vel = x*(vel dot x)*0.4 + dir*p.speed*FRandom[Eightball](1.0,1.2); p.vel = x*(vel dot x)*0.4 + dir*p.speed*FRandom[Eightball](1.0,1.2);
p.vel.z += 3.5; p.vel.z += 3.5;
p.target = self; p.target = self;
@ -391,7 +391,7 @@ Class UTRocketLauncher : UTWeapon
else if ( num <= 1 ) else if ( num <= 1 )
{ {
// single rocket // single rocket
p = Spawn("UTRocket",origin+cos(a)*y*s+sin(a)*z*s); p = Spawn("UTRocket",level.Vec3Offset(origin,cos(a)*y*s+sin(a)*z*s));
p.vel = x2*p.speed; p.vel = x2*p.speed;
p.target = self; p.target = self;
p.tracer = invoker.LockedTarget; p.tracer = invoker.LockedTarget;
@ -404,7 +404,7 @@ Class UTRocketLauncher : UTWeapon
s = (num>1)?6:0; s = (num>1)?6:0;
for ( int i=0; i<num; i++ ) for ( int i=0; i<num; i++ )
{ {
p = Spawn("UTRocket",origin+cos(a)*y*s+sin(a)*z*s); p = Spawn("UTRocket",level.Vec3Offset(origin,cos(a)*y*s+sin(a)*z*s));
p.vel = x2*p.speed; p.vel = x2*p.speed;
p.target = self; p.target = self;
p.tracer = invoker.LockedTarget; p.tracer = invoker.LockedTarget;
@ -419,7 +419,7 @@ Class UTRocketLauncher : UTWeapon
s = -range*0.5; s = -range*0.5;
for ( int i=0; i<num; i++ ) for ( int i=0; i<num; i++ )
{ {
p = Spawn("UTRocket",origin+sin(s)*y); p = Spawn("UTRocket",level.Vec3Offset(origin,sin(s)*y));
p.vel = (x2+sin(s)*y2).unit()*p.speed; p.vel = (x2+sin(s)*y2).unit()*p.speed;
p.target = self; p.target = self;
p.tracer = invoker.LockedTarget; p.tracer = invoker.LockedTarget;
@ -526,221 +526,54 @@ Class UTRocketLauncher : UTWeapon
AltFire: AltFire:
// one is loaded already // one is loaded already
EBLI A 1 A_LoadRocket(false); EBLI A 1 A_LoadRocket(false);
EBLI A 2 A_JumpIf(!invoker.bAltFire&&invoker.bSingleRocket,"FireOne"); EBLI A 2 A_JumpIf((!invoker.bAltFire&&invoker.bSingleRocket)||(invoker.Ammo1.Amount<=0)||!(player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK)),"FireOne");
EBLI A 0 A_LoadedRefire(1); EBLI A 0; // no tween
Goto FireOne;
// load two // load two
EBLI A 2; EBR1 A 0 A_PlaySound("utrl/rotate",CHAN_6,0.1);
EBL1 A 0; EBR1 ABCDEFG 2 A_JumpIf(!(player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK)),"FireOne");
EBR1 A 2 A_PlaySound("utrl/rotate",CHAN_6,0.1); EBL2 A 0 A_PlaySound("utrl/load",CHAN_6);
EBR1 B 0 A_Refire(1); EBL2 ABCDEFG 3 A_JumpIf(!(player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK)),"FireOne");
Goto FireOne; EBR2 A 0
EBR1 B 2; {
EBR1 C 0 A_Refire(1); A_LoadRocket();
Goto FireOne; return A_JumpIf((invoker.Ammo1.Amount<=0)||!(player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK)),"FireTwo");
EBR1 C 2; }
EBR1 D 0 A_Refire(1);
Goto FireOne;
EBR1 D 2;
EBR1 E 0 A_Refire(1);
Goto FireOne;
EBR1 E 2;
EBR1 F 0 A_Refire(1);
Goto FireOne;
EBR1 F 2;
EBR1 G 0 A_Refire(1);
Goto FireOne;
EBR1 G 2;
EBL2 A 0 A_Refire(1);
Goto FireOne;
EBL2 A 3 A_PlaySound("utrl/load",CHAN_6);
EBL2 B 0 A_Refire(1);
Goto FireOne;
EBL2 B 3;
EBL2 C 0 A_Refire(1);
Goto FireOne;
EBL2 C 3;
EBL2 D 0 A_Refire(1);
Goto FireOne;
EBL2 D 3;
EBL2 E 0 A_Refire(1);
Goto FireOne;
EBL2 E 3;
EBL2 F 0 A_Refire(1);
Goto FireOne;
EBL2 F 3;
EBL2 G 0 A_Refire(1);
Goto FireOne;
EBL2 G 3 A_LoadRocket();
EBR2 A 0 A_LoadedRefire(1);
Goto FireTwo;
// load three // load three
EBR2 A 2 A_PlaySound("utrl/rotate",CHAN_6,0.1); EBR2 A 0 A_PlaySound("utrl/rotate",CHAN_6,0.1);
EBR2 B 0 A_Refire(1); EBR2 ABCDEFG 2 A_JumpIf(!(player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK)),"FireTwo");
Goto FireTwo; EBL3 A 0 A_PlaySound("utrl/load",CHAN_6);
EBR2 B 2; EBL3 ABCDEFG 3 A_JumpIf(!(player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK)),"FireTwo");
EBR2 C 0 A_Refire(1); EBR3 A 0
Goto FireTwo; {
EBR2 C 2; A_LoadRocket();
EBR2 D 0 A_Refire(1); return A_JumpIf((invoker.Ammo1.Amount<=0)||!(player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK)),"FireThree");
Goto FireTwo; }
EBR2 D 2;
EBR2 E 0 A_Refire(1);
Goto FireTwo;
EBR2 E 2;
EBR2 F 0 A_Refire(1);
Goto FireTwo;
EBR2 F 2;
EBR2 G 0 A_Refire(1);
Goto FireTwo;
EBR2 G 2;
EBL3 A 0 A_Refire(1);
Goto FireTwo;
EBL3 A 3 A_PlaySound("utrl/load",CHAN_6);
EBL3 B 0 A_Refire(1);
Goto FireTwo;
EBL3 B 3;
EBL3 C 0 A_Refire(1);
Goto FireTwo;
EBL3 C 3;
EBL3 D 0 A_Refire(1);
Goto FireTwo;
EBL3 D 3;
EBL3 E 0 A_Refire(1);
Goto FireTwo;
EBL3 E 3;
EBL3 F 0 A_Refire(1);
Goto FireTwo;
EBL3 F 3;
EBL3 G 0 A_Refire(1);
Goto FireTwo;
EBL3 G 3 A_LoadRocket();
EBR3 A 0 A_LoadedRefire(1);
Goto FireThree;
// load four // load four
EBR3 A 2 A_PlaySound("utrl/rotate",CHAN_6,0.1); EBR3 A 0 A_PlaySound("utrl/rotate",CHAN_6,0.1);
EBR3 B 0 A_Refire(1); EBR3 ABCDEFG 2 A_JumpIf(!(player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK)),"FireThree");
Goto FireThree; EBL4 A 0 A_PlaySound("utrl/load",CHAN_6);
EBR3 B 2; EBL4 ABCDEFG 3 A_JumpIf(!(player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK)),"FireThree");
EBR3 C 0 A_Refire(1); EBR4 A 0
Goto FireThree; {
EBR3 C 2; A_LoadRocket();
EBR3 D 0 A_Refire(1); return A_JumpIf((invoker.Ammo1.Amount<=0)||!(player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK)),"FireFour");
Goto FireThree; }
EBR3 D 2;
EBR3 E 0 A_Refire(1);
Goto FireThree;
EBR3 E 2;
EBR3 F 0 A_Refire(1);
Goto FireThree;
EBR3 F 2;
EBR3 G 0 A_Refire(1);
Goto FireThree;
EBR3 G 2;
EBL4 A 0 A_Refire(1);
Goto FireThree;
EBL4 A 3 A_PlaySound("utrl/load",CHAN_6);
EBL4 B 0 A_Refire(1);
Goto FireThree;
EBL4 B 3;
EBL4 C 0 A_Refire(1);
Goto FireThree;
EBL4 C 3;
EBL4 D 0 A_Refire(1);
Goto FireThree;
EBL4 D 3;
EBL4 E 0 A_Refire(1);
Goto FireThree;
EBL4 E 3;
EBL4 F 0 A_Refire(1);
Goto FireThree;
EBL4 F 3;
EBL4 G 0 A_Refire(1);
Goto FireThree;
EBL4 G 3 A_LoadRocket();
EBR4 A 0 A_LoadedRefire(1);
Goto FireFour;
// load five // load five
EBR4 A 2 A_PlaySound("utrl/rotate",CHAN_6,0.1); EBR4 A 0 A_PlaySound("utrl/rotate",CHAN_6,0.1);
EBR4 B 0 A_Refire(1); EBR4 ABCDEFG 2 A_JumpIf(!(player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK)),"FireFour");
Goto FireFour; EBL5 A 0 A_PlaySound("utrl/load",CHAN_6);
EBR4 B 2; EBL5 ABCDEFG 3 A_JumpIf(!(player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK)),"FireFour");
EBR4 C 0 A_Refire(1); EBR5 A 0
Goto FireFour; {
EBR4 C 2; A_LoadRocket();
EBR4 D 0 A_Refire(1); return A_JumpIf((invoker.Ammo1.Amount<=0)||!(player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK)),"FireFive");
Goto FireFour; }
EBR4 D 2;
EBR4 E 0 A_Refire(1);
Goto FireFour;
EBR4 E 2;
EBR4 F 0 A_Refire(1);
Goto FireFour;
EBR4 F 2;
EBR4 G 0 A_Refire(1);
Goto FireFour;
EBR4 G 2;
EBL5 A 0 A_Refire(1);
Goto FireFour;
EBL5 A 3 A_PlaySound("utrl/load",CHAN_6);
EBL5 B 0 A_Refire(1);
Goto FireFour;
EBL5 B 3;
EBL5 C 0 A_Refire(1);
Goto FireFour;
EBL5 C 3;
EBL5 D 0 A_Refire(1);
Goto FireFour;
EBL5 D 3;
EBL5 E 0 A_Refire(1);
Goto FireFour;
EBL5 E 3;
EBL5 F 0 A_Refire(1);
Goto FireFour;
EBL5 F 3;
EBL5 G 0 A_Refire(1);
Goto FireFour;
EBL5 G 3 A_LoadRocket();
EBR5 A 0 A_LoadedRefire(1);
Goto FireFive;
// load six // load six
EBR5 A 2 A_PlaySound("utrl/rotate",CHAN_6,0.1); EBR5 A 0 A_PlaySound("utrl/rotate",CHAN_6,0.1);
EBR5 B 0 A_Refire(1); EBR5 ABCDEFG 2 A_JumpIf(!(player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK)),"FireFive");
Goto FireFive; EBL6 A 0 A_PlaySound("utrl/load",CHAN_6);
EBR5 B 2; EBL6 ABCDEF 3 A_JumpIf(!(player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK)),"FireFive");
EBR5 C 0 A_Refire(1); EBL6 F 0 A_LoadRocket();
Goto FireFive;
EBR5 C 2;
EBR5 D 0 A_Refire(1);
Goto FireFive;
EBR5 D 2;
EBR5 E 0 A_Refire(1);
Goto FireFive;
EBR5 E 2;
EBR5 F 0 A_Refire(1);
Goto FireFive;
EBR5 F 2;
EBR5 G 0 A_Refire(1);
Goto FireFive;
EBR5 G 2;
EBL6 A 0 A_Refire(1);
Goto FireFive;
EBL6 A 3 A_PlaySound("utrl/load",CHAN_6);
EBL6 B 0 A_Refire(1);
Goto FireFive;
EBL6 B 3;
EBL6 C 0 A_Refire(1);
Goto FireFive;
EBL6 C 3;
EBL6 D 0 A_Refire(1);
Goto FireFive;
EBL6 D 3;
EBL6 E 0 A_Refire(1);
Goto FireFive;
EBL6 E 3;
EBL6 F 0 A_Refire(1);
Goto FireFive;
EBL6 F 3 A_LoadRocket();
Goto FireSix; Goto FireSix;
FireOne: FireOne:
EBF1 A 0 A_FireRockets(1); EBF1 A 0 A_FireRockets(1);

View file

@ -178,7 +178,6 @@ Class Enforcer : UTWeapon
int ClipCount, SlaveClipCount; int ClipCount, SlaveClipCount;
bool SlaveActive, SlaveDown, SlaveReload, SlaveAltFire; bool SlaveActive, SlaveDown, SlaveReload, SlaveAltFire;
int SlaveRefire; int SlaveRefire;
transient ui Font usmf;
double AltAccuracy; double AltAccuracy;
property ClipCount : ClipCount; property ClipCount : ClipCount;
@ -297,12 +296,12 @@ Class Enforcer : UTWeapon
if ( slave ) if ( slave )
{ {
invoker.slaveclipcount--; invoker.slaveclipcount--;
if ( !flak_enforcerreload && (invoker.slaveclipcount <=0) ) invoker.slaveclipcount = (weap.Ammo1.Amount>0)?Min(20,weap.Ammo1.Amount):20; if ( !flak_enforcerreload && (invoker.slaveclipcount <=0) ) invoker.slaveclipcount = Min(invoker.default.slaveclipcount,weap.Ammo1.Amount);
} }
else else
{ {
invoker.clipcount--; invoker.clipcount--;
if ( !flak_enforcerreload && (invoker.clipcount <=0) ) invoker.clipcount = (weap.Ammo1.Amount>0)?Min(20,weap.Ammo1.Amount):20; if ( !flak_enforcerreload && (invoker.clipcount <=0) ) invoker.clipcount = Min(invoker.default.clipcount,weap.Ammo1.Amount);
} }
invoker.FireEffect(); invoker.FireEffect();
UTMainHandler.DoFlash(self,Color(32,255,128,0),1); UTMainHandler.DoFlash(self,Color(32,255,128,0),1);
@ -327,10 +326,10 @@ Class Enforcer : UTWeapon
} }
Vector3 x, y, z, x2, y2, z2; Vector3 x, y, z, x2, y2, z2;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = pos+(0,0,player.viewheight)+10.0*x; Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x);
int ydir = slave?-1:1; int ydir = slave?-1:1;
if ( alt ) origin = origin-z*3.0+ydir*y*1.0; if ( alt ) origin = level.Vec3Offset(origin,-z*3+ydir*y);
else origin = origin-z*1.0+ydir*y*4.0; else origin = level.Vec3Offset(origin,-z+ydir*y*4);
double a = FRandom[Enforcer](0,360), s = FRandom[Enforcer](0,alt?invoker.altaccuracy:0.004); double a = FRandom[Enforcer](0,360), s = FRandom[Enforcer](0,alt?invoker.altaccuracy:0.004);
[x2, y2, z2] = dt_CoordUtil.GetAxes(BulletSlope(),angle,roll); [x2, y2, z2] = dt_CoordUtil.GetAxes(BulletSlope(),angle,roll);
Vector3 dir = (x2+y2*cos(a)*s+z2*sin(a)*s).unit(); Vector3 dir = (x2+y2*cos(a)*s+z2*sin(a)*s).unit();
@ -386,7 +385,7 @@ Class Enforcer : UTWeapon
s.target = self; s.target = self;
s.alpha *= 0.5; s.alpha *= 0.5;
} }
origin += x*8.0+ydir*y*6.0-z*2.0; origin = level.Vec3Offset(origin,x*8+ydir*y*6-z*2);
let c = Spawn("UTCasing",origin); let c = Spawn("UTCasing",origin);
c.vel = x*FRandom[Junk](-1.5,1.5)+y*ydir*FRandom[Junk](2,4)+z*FRandom[Junk](2,3); c.vel = x*FRandom[Junk](-1.5,1.5)+y*ydir*FRandom[Junk](2,4)+z*FRandom[Junk](2,3);
} }
@ -406,7 +405,14 @@ Class Enforcer : UTWeapon
override void OwnerDied() override void OwnerDied()
{ {
Super.OwnerDied(); Super.OwnerDied();
slaverefire = 0; slavereload = slaverefire = 0;
if ( Owner.player.ReadyWeapon != self ) return;
let psp = Owner.player.FindPSprite(2);
if ( psp )
{
slaveactive = false;
Owner.player.SetPSprite(2,ResolveState("LeftDeselect"));
}
} }
Default Default
@ -442,7 +448,10 @@ Class Enforcer : UTWeapon
{ {
invoker.slavedown = false; invoker.slavedown = false;
if ( !invoker.slaveactive && (CountInv("Enforcer") > 1) ) if ( !invoker.slaveactive && (CountInv("Enforcer") > 1) )
{
invoker.slavereload = invoker.slaverefire = 0;
A_Overlay(2,"LeftReady"); A_Overlay(2,"LeftReady");
}
} }
ENFS ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 A_WeaponReady(WRF_NOFIRE); ENFS ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 A_WeaponReady(WRF_NOFIRE);
Idle: Idle:
@ -471,22 +480,21 @@ Class Enforcer : UTWeapon
Dummy: Dummy:
TNT1 A 1 TNT1 A 1
{ {
if ( (invoker.clipcount <= 0) && (invoker.Ammo1.Amount > 0) ) A_Overlay(PSP_WEAPON,"Reload"); if ( (invoker.clipcount <= 0) && (invoker.Ammo1.Amount > 0) ) player.SetPSprite(PSP_WEAPON,ResolveState("Reload"));
else if ( flak_enforcerreload && ((invoker.clipcount < min(20,invoker.Ammo1.Amount)) || (invoker.slaveclipcount < min(20,invoker.Ammo1.Amount))) ) A_WeaponReady(WRF_ALLOWRELOAD); else if ( flak_enforcerreload && ((invoker.clipcount < min(invoker.default.clipcount,invoker.Ammo1.Amount)) || (invoker.slaveclipcount < min(invoker.default.slaveclipcount,invoker.Ammo1.Amount))) ) A_WeaponReady(WRF_ALLOWRELOAD);
else A_WeaponReady(); else A_WeaponReady();
if ( !invoker.slaveactive && (CountInv("Enforcer") > 1) ) A_Overlay(2,"LeftReady"); if ( !invoker.slaveactive && (CountInv("Enforcer") > 1) )
{
invoker.slavereload = invoker.slaverefire = 0;
A_Overlay(2,"LeftReady");
}
} }
Wait; Wait;
LeftDummy: LeftDummy:
TNT1 A 1 TNT1 A 1
{ {
if ( health <= 0 ) if ( flak_enforcerreload && invoker.slavereload ) player.SetPSprite(2,ResolveState("LeftReload"));
{ else if ( invoker.slavedown ) player.SetPSprite(2,ResolveState("LeftDeselect"));
invoker.slaveactive = false;
A_Overlay(2,"LeftDeselect");
}
else if ( flak_enforcerreload && invoker.slavereload ) A_Overlay(2,"LeftReload");
else if ( invoker.slavedown ) A_Overlay(2,"LeftDeselect");
else A_LeftWeaponReady(); else A_LeftWeaponReady();
} }
Wait; Wait;
@ -543,50 +551,68 @@ Class Enforcer : UTWeapon
Reload: Reload:
ENFR A 0 ENFR A 0
{ {
invoker.slavereload = ((player.cmd.buttons&BT_RELOAD)&&invoker.slaveactive&&(invoker.slaveclipcount < min(20,invoker.Ammo1.Amount)))||(invoker.slaveclipcount <= 0); if ( invoker.clipcount >= invoker.default.clipcount )
return A_JumpIf(invoker.clipcount>=min(20,invoker.Ammo1.Amount),"Idle"); {
invoker.slavereload = (invoker.slaveactive&&(invoker.slaveclipcount<min(invoker.default.slaveclipcount,invoker.Ammo1.Amount)));
return ResolveState("Idle");
}
return ResolveState(null);
} }
ENFR A 0 ENFR A 0
{ {
invoker.clipcount = Min(20,invoker.Ammo1.Amount); invoker.clipcount = 0;
A_Overlay(-9999,null); A_Overlay(-9999,null);
A_WeaponOffset(0,32); // fix sudden psprite lowering
A_PlaySound("enforcer/click",CHAN_WEAPON); A_PlaySound("enforcer/click",CHAN_WEAPON);
} }
ENFR ABCDEFGHIJKLMNOPQRSTUVWXYZ 1; ENFR ABCDEFGHIJKLMNOPQRSTUVWXYZ 1;
ENR2 AB 1; ENR2 AB 1;
ENR2 B 30 ENR2 B 30
{ {
invoker.clipcount = min(invoker.default.clipcount,invoker.Ammo1.Amount);
A_PlaySound("enforcer/reload",CHAN_WEAPON); A_PlaySound("enforcer/reload",CHAN_WEAPON);
if ( self is 'UTPlayer' ) if ( self is 'UTPlayer' )
UTPlayer(self).PlayReloading(); UTPlayer(self).PlayReloading();
invoker.slavereload = (invoker.slaveactive&&(invoker.slaveclipcount<min(invoker.default.slaveclipcount,invoker.Ammo1.Amount)));
} }
ENFS A 0 A_PlaySound("enforcer/select",CHAN_WEAPON); ENFS A 0 A_PlaySound("enforcer/select",CHAN_WEAPON);
Goto Ready; Goto Ready;
LeftReload: LeftReload:
2NFR A 0 2NFR A 0
{ {
invoker.slaveclipcount = Min(20,invoker.Ammo1.Amount); if ( invoker.slaveclipcount >= invoker.default.slaveclipcount )
invoker.slavereload = false; {
invoker.slavereload = 0;
return ResolveState("LeftIdle");
}
invoker.slaveclipcount = 0;
A_Overlay(-9998,null); A_Overlay(-9998,null);
A_PlaySound("enforcer/click",CHAN_6); A_PlaySound("enforcer/click",CHAN_6);
return ResolveState(null);
} }
2NFR ABCDEFGHIJKLMNOPQRSTUVWXYZ 1; 2NFR ABCDEFGHIJKLMNOPQRSTUVWXYZ 1;
2NR2 AB 1; 2NR2 AB 1;
2NR2 B 30 2NR2 B 30
{ {
invoker.slaveclipcount = min(invoker.default.slaveclipcount,invoker.Ammo1.Amount);
A_PlaySound("enforcer/reload",CHAN_6); A_PlaySound("enforcer/reload",CHAN_6);
if ( self is 'UTPlayer' ) if ( self is 'UTPlayer' )
UTPlayer(self).PlayReloading(); UTPlayer(self).PlayReloading();
invoker.slavereload = false;
} }
2NFS A 0 A_PlaySound("enforcer/select",CHAN_6); 2NFS A 0 A_PlaySound("enforcer/select",CHAN_6);
Goto LeftReady; Goto LeftReady;
Deselect: Deselect:
ENFI A 1 { invoker.slavedown = true; } ENFD A 0
ENFD A 0 A_Overlay(-9999,null); {
ENFD A 0 A_JumpIf(invoker.slaveactive,"Deselect"); A_Overlay(-9999,null);
invoker.slavedown = true;
}
ENFD ABDEGHJK 1; ENFD ABDEGHJK 1;
ENFD L 1 A_Lower(int.max); ENFD L 1
{
if ( !player.FindPSprite(2) )
A_Lower(int.max);
}
Wait; Wait;
LeftDeselect: LeftDeselect:
2NFD A 0 2NFD A 0

View file

@ -94,7 +94,7 @@ Class ChunkTrail : Actor
SetState(FindState("Death")+dist); SetState(FindState("Death")+dist);
return; return;
} }
SetOrigin(target.pos+(0,0,speed),true); SetOrigin(target.Vec3Offset(0,0,speed),true);
} }
States States
{ {
@ -117,17 +117,18 @@ Class FlakAccumulator : Thinker
override void Tick() override void Tick()
{ {
Super.Tick(); Super.Tick();
bool oldxd = inflictor.bEXTREMEDEATH;
int gibhealth = victim.GetGibHealth(); int gibhealth = victim.GetGibHealth();
// おまえはもう死んでいる // おまえはもう死んでいる
if ( victim.health-total <= gibhealth ) inflictor.bEXTREMEDEATH = true; if ( victim.health-total <= gibhealth ) inflictor.bEXTREMEDEATH = true;
// 何? // 何?
inflictor.bAMBUSH = true;
for ( int i=0; i<amounts.Size(); i++ ) for ( int i=0; i<amounts.Size(); i++ )
{ {
if ( !victim ) break; if ( !victim ) break;
victim.DamageMobj(inflictor,source,amounts[i],type,DMG_THRUSTLESS); victim.DamageMobj(inflictor,source,amounts[i],type,DMG_THRUSTLESS);
} }
inflictor.bEXTREMEDEATH = oldxd; inflictor.bAMBUSH = false;
inflictor.bEXTREMEDEATH = false;
Destroy(); Destroy();
} }
@ -175,6 +176,7 @@ Class FlakChunk : Actor
double lifetime, lifespeed; double lifetime, lifespeed;
int lifetics; int lifetics;
Vector3 oldvel; Vector3 oldvel;
Actor lasthit;
Default Default
{ {
Obituary "$O_FLAKCANNON"; Obituary "$O_FLAKCANNON";
@ -323,14 +325,11 @@ Class FlakChunk : Actor
yawvel = FRandom[Flak](50,100)*RandomPick[Flak](-1,1)*(vel.length()/speed); yawvel = FRandom[Flak](50,100)*RandomPick[Flak](-1,1)*(vel.length()/speed);
A_PlaySound("flak/bounce",volume:0.3); A_PlaySound("flak/bounce",volume:0.3);
A_AlertMonsters(); A_AlertMonsters();
if ( vel.length() < 5.0 ) ExplodeMissile(); if ( vel.length() < 5 ) ExplodeMissile();
} }
override int DoSpecialDamage( Actor target, int damage, Name damagetype ) override int DoSpecialDamage( Actor target, int damage, Name damagetype )
{ {
if ( bAMBUSH ) return damage; if ( bAMBUSH || (vel.length() <= 5) ) return damage;
if ( vel.length() <= 5.0 ) return -1;
FlakAccumulator.Accumulate(target,damage,self,self.target,damagetype);
bAMBUSH = true;
if ( !target.bNOBLOOD ) if ( !target.bNOBLOOD )
{ {
target.SpawnBlood(pos,AngleTo(target),damage); target.SpawnBlood(pos,AngleTo(target),damage);
@ -341,9 +340,26 @@ Class FlakChunk : Actor
} }
override int SpecialMissileHit( Actor victim ) override int SpecialMissileHit( Actor victim )
{ {
if ( bAMBUSH || (vel.length() <= 5) || ((victim == target) && !bHITOWNER) || (victim == lasthit) )
return 1;
// with this we can guarantee that the chunk won't just keep on dealing damage
// this is something I wish Unreal's boulders did
lasthit = victim;
// gather damage
FlakAccumulator.Accumulate(victim,GetMissileDamage(0,0),self,target,damagetype);
int amt = FlakAccumulator.GetAmount(victim); int amt = FlakAccumulator.GetAmount(victim);
// go through actors that are already gibbed // pass through if it's already dead
if ( victim.health-amt <= victim.GetGibHealth() ) return 1; if ( victim.health-amt <= 0 )
{
// bleed
if ( !victim.bNOBLOOD )
{
victim.SpawnBlood(pos,AngleTo(victim),damage);
A_PlaySound("flak/meat",volume:0.3);
A_AlertMonsters();
}
return 1;
}
return -1; return -1;
} }
States States
@ -388,7 +404,7 @@ Class FlakChunk : Actor
A_AlertMonsters(); A_AlertMonsters();
} }
XDeath: XDeath:
TNT1 A 2; // must exist for at least two tics so the accumulator doesn't break TNT1 A 2; // must exist for at least two tics so the accumulator gets the right inflictor
Stop; Stop;
Dummy: Dummy:
FCH1 ABCDEFGHIJKL -1; FCH1 ABCDEFGHIJKL -1;
@ -568,7 +584,7 @@ Class FlakLight : DynamicLight
Destroy(); Destroy();
return; return;
} }
if ( target.player ) SetOrigin(target.Vec3Offset(0,0,target.player.viewz-target.pos.z),true); if ( target.player ) SetOrigin(target.Vec2OffsetZ(0,0,target.player.viewz),true);
else SetOrigin(target.pos,true); else SetOrigin(target.pos,true);
if ( cnt++ > 2 ) Destroy(); if ( cnt++ > 2 ) Destroy();
} }
@ -596,7 +612,7 @@ Class FlakCannon : UTWeapon
Vector3 x, y, z; Vector3 x, y, z;
double a, s; double a, s;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+4.0*y-3.0*z; Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+4*y-3*z);
A_Overlay(-2,"MuzzleFlash"); A_Overlay(-2,"MuzzleFlash");
A_OverlayFlags(-2,PSPF_RENDERSTYLE|PSPF_FORCESTYLE,true); A_OverlayFlags(-2,PSPF_RENDERSTYLE|PSPF_FORCESTYLE,true);
A_OverlayRenderstyle(-2,STYLE_Add); A_OverlayRenderstyle(-2,STYLE_Add);
@ -655,7 +671,7 @@ Class FlakCannon : UTWeapon
Vector3 x, y, z; Vector3 x, y, z;
double a, s; double a, s;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+2.0*y-3.0*z; Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+2*y-3*z);
A_Overlay(-2,"MuzzleFlash"); A_Overlay(-2,"MuzzleFlash");
A_OverlayFlags(-2,PSPF_RENDERSTYLE|PSPF_FORCESTYLE,true); A_OverlayFlags(-2,PSPF_RENDERSTYLE|PSPF_FORCESTYLE,true);
A_OverlayRenderstyle(-2,STYLE_Add); A_OverlayRenderstyle(-2,STYLE_Add);

View file

@ -50,17 +50,29 @@ Class ImpactHammer : UTWeapon
invoker.count = 0; invoker.count = 0;
invoker.FireEffect(); // intentional UT behavior invoker.FireEffect(); // intentional UT behavior
} }
action void A_ChargeUp( int amt = 1 ) action void A_ChargeUp()
{ {
invoker.chargesize += (0.75*amt)/TICRATE; invoker.chargesize += .75/TICRATE;
invoker.count += double(amt)/TICRATE; invoker.count += 1./TICRATE;
if ( invoker.count > 0.2 ) if ( invoker.count > .2 )
{ {
invoker.count = 0; invoker.count = 0;
A_AlertMonsters(); A_AlertMonsters();
} }
A_QuakeEx(clamp(int(invoker.chargesize*3),0,3),clamp(int(invoker.chargesize*3),0,3),clamp(int(invoker.chargesize*3),0,3),amt+1,0,96,"",QF_RELATIVE,rollIntensity:clamp(invoker.chargesize*0.3,0,0.3)); A_QuakeEx(clamp(int(invoker.chargesize*3),0,3),clamp(int(invoker.chargesize*3),0,3),clamp(int(invoker.chargesize*3),0,3),2,0,96,"",QF_RELATIVE,rollIntensity:clamp(invoker.chargesize*0.3,0,0.3));
UTMainHandler.DoSwing(self,(FRandom[Impact](-1,1),FRandom[Impact](-1,1)),invoker.chargesize*0.1,0,1,SWING_Spring); UTMainHandler.DoSwing(self,(FRandom[Impact](-1,1),FRandom[Impact](-1,1)),invoker.chargesize*0.1,0,1,SWING_Spring);
if ( !(player.cmd.buttons&BT_ATTACK) )
{
player.SetPSprite(PSP_WEAPON,ResolveState("Release"));
return;
}
FLineTraceData d;
Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+3*y-4*z);
LineTrace(angle,40,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d);
if ( (invoker.chargesize > 1) && (d.HitType == TRACE_HitActor) )
player.SetPSprite(PSP_WEAPON,ResolveState("Release"));
} }
action void A_FireBlast() action void A_FireBlast()
{ {
@ -72,7 +84,7 @@ Class ImpactHammer : UTWeapon
A_AlertMonsters(); A_AlertMonsters();
Vector3 x, y, z; Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+3.0*y-4.0*z; Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+3*y-4*z);
double realcharge = min(1.5,invoker.chargesize); double realcharge = min(1.5,invoker.chargesize);
FLineTraceData d; FLineTraceData d;
LineTrace(angle,60,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d); LineTrace(angle,60,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d);
@ -137,7 +149,7 @@ Class ImpactHammer : UTWeapon
A_QuakeEx(2,2,2,6,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1); A_QuakeEx(2,2,2,6,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1);
Vector3 x, y, z; Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+3.0*y-4.0*z; Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+3*y-4*z);
FLineTraceData d; FLineTraceData d;
LineTrace(angle,120,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d); LineTrace(angle,120,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d);
double dscale = d.Distance/120.; double dscale = d.Distance/120.;
@ -187,20 +199,6 @@ Class ImpactHammer : UTWeapon
s.scale *= 0.4; s.scale *= 0.4;
} }
} }
action void A_ImpactRefire( statelabel flash = null )
{
FLineTraceData d;
Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+3.0*y-4.0*z;
LineTrace(angle,40,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d);
if ( (invoker.chargesize > 1) && (d.HitType == TRACE_HitActor) )
{
A_ClearRefire();
return;
}
A_Refire(flash);
}
override void DetachFromOwner() override void DetachFromOwner()
{ {
if ( Owner ) Owner.A_StopSound(CHAN_WEAPON); if ( Owner ) Owner.A_StopSound(CHAN_WEAPON);
@ -237,75 +235,55 @@ Class ImpactHammer : UTWeapon
A_WeaponReady(); A_WeaponReady();
} }
Wait; Wait;
Charging:
TNT1 A 1 A_ChargeUp();
Wait;
Fire: Fire:
IMPL A 0 IMPL A 0
{ {
A_ResetCharge(); A_ResetCharge();
A_Overlay(-9999,"Charging");
A_PlaySound("impact/pull",CHAN_WEAPON); A_PlaySound("impact/pull",CHAN_WEAPON);
} }
IMPL A 5 A_ChargeUp(5); IMPL ABCDE 5;
IMPL B 0 A_ImpactRefire(1); IMPR A 0 A_PlaySound("impact/loop",CHAN_WEAPON,looping:true);
Goto Release; Goto Hold;
IMPL B 5 A_ChargeUp(5);
IMPL C 0 A_ImpactRefire(1);
Goto Release;
IMPL C 5 A_ChargeUp(5);
IMPL D 0 A_ImpactRefire(1);
Goto Release;
IMPL D 5 A_ChargeUp(5);
IMPL E 0 A_ImpactRefire(1);
Goto Release;
IMPL E 5 A_ChargeUp(5);
IMPL E 0 A_ImpactRefire(1);
Goto Release;
IMPL E 0 A_PlaySound("impact/loop",CHAN_WEAPON,looping:true);
Hold: Hold:
IMPR A 1 A_ChargeUp(); IMPR ABCDEFGHIJ 1;
IMPR B 0 A_ImpactRefire(1); Loop;
Goto Release;
IMPR B 1 A_ChargeUp();
IMPR C 0 A_ImpactRefire(1);
Goto Release;
IMPR C 1 A_ChargeUp();
IMPR D 0 A_ImpactRefire(1);
Goto Release;
IMPR D 1 A_ChargeUp();
IMPR E 0 A_ImpactRefire(1);
Goto Release;
IMPR E 1 A_ChargeUp();
IMPR F 0 A_ImpactRefire(1);
Goto Release;
IMPR F 1 A_ChargeUp();
IMPR G 0 A_ImpactRefire(1);
Goto Release;
IMPR G 1 A_ChargeUp();
IMPR H 0 A_ImpactRefire(1);
Goto Release;
IMPR H 1 A_ChargeUp();
IMPR I 0 A_ImpactRefire(1);
Goto Release;
IMPR I 1 A_ChargeUp();
IMPR J 0 A_ImpactRefire(1);
Goto Release;
IMPR J 1 A_ChargeUp();
IMPR A 0 A_ImpactRefire("Hold");
Goto Release;
Release: Release:
IMPF A 0 IMPF A 0
{ {
A_Overlay(-9999,null);
if ( self is 'UTPlayer' ) if ( self is 'UTPlayer' )
UTPlayer(self).PlayAttacking3(); UTPlayer(self).PlayAttacking3();
A_FireBlast(); A_FireBlast();
} }
IMPF AABCCDEEFGGHIIJKKLMMNOOP 1; // this is why we need a model animation overhaul
IMPF A 2;
IMPF B 1;
IMPF C 2;
IMPF D 1;
IMPF E 2;
IMPF F 1;
IMPF G 2;
IMPF H 1;
IMPF I 2;
IMPF J 1;
IMPF K 2;
IMPF L 1;
IMPF M 2;
IMPF N 1;
IMPF O 2;
IMPF P 1;
Goto Idle; Goto Idle;
AltFire: AltFire:
IMPF A 0 A_FireAltBlast(); IMPF A 1 A_FireAltBlast();
IMPF ABCDEFGHIJKLMNOP 1; IMPF BCDEFGHIJKLMNOP 1;
Goto Idle; Goto Idle;
Deselect: Deselect:
IMPD A 0 A_StopSound(CHAN_WEAPON); IMPD A 2 A_StopSound(CHAN_WEAPON);
IMPD ABCDE 2; IMPD BCDE 2;
IMPD E 1 A_Lower(int.max); IMPD E 1 A_Lower(int.max);
Wait; Wait;
} }

View file

@ -56,7 +56,7 @@ Class MinigunTracer : Actor
return; return;
} }
dir = dir.unit(); dir = dir.unit();
SetOrigin(Vec3Offset(dir.x*160,dir.y*160,dir.z*160),true); SetOrigin(level.Vec3Offset(pos,dir*160),true);
angle = atan2(dir.y,dir.x); angle = atan2(dir.y,dir.x);
pitch = asin(-dir.z); pitch = asin(-dir.z);
roll += 60; roll += 60;
@ -103,7 +103,7 @@ Class Minigun : UTWeapon
if ( !alt ) MinigunLight(l).cnt--; if ( !alt ) MinigunLight(l).cnt--;
Vector3 x, y, z, x2, y2, z2; Vector3 x, y, z, x2, y2, z2;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = pos+(0,0,player.viewheight)+10.0*x+y*2.0-z*2.0; Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+y*2-z*2);
double a = FRandom[Minigun](0,360), s = FRandom[Minigun](0,alt?0.05:0.02); double a = FRandom[Minigun](0,360), s = FRandom[Minigun](0,alt?0.05:0.02);
[x2, y2, z2] = dt_CoordUtil.GetAxes(BulletSlope(),angle,roll); [x2, y2, z2] = dt_CoordUtil.GetAxes(BulletSlope(),angle,roll);
Vector3 dir = (x2+y2*cos(a)*s+z2*sin(a)*s).unit(); Vector3 dir = (x2+y2*cos(a)*s+z2*sin(a)*s).unit();
@ -155,7 +155,7 @@ Class Minigun : UTWeapon
} }
if ( !Random[Minigun](0,1) ) if ( !Random[Minigun](0,1) )
{ {
let t = Spawn("MinigunTracer",origin+x*20.0); let t = Spawn("MinigunTracer",level.Vec3Offset(origin,x*20));
t.angle = atan2(dir.y,dir.x); t.angle = atan2(dir.y,dir.x);
t.pitch = asin(-dir.z); t.pitch = asin(-dir.z);
MinigunTracer(t).dest = d.HitLocation; MinigunTracer(t).dest = d.HitLocation;
@ -169,37 +169,23 @@ Class Minigun : UTWeapon
UTViewSmoke(s).vvel += (FRandom[Minigun](0.2,0.8),FRandom[Minigun](-0.3,0.3),FRandom[Minigun](-0.3,0.3)); UTViewSmoke(s).vvel += (FRandom[Minigun](0.2,0.8),FRandom[Minigun](-0.3,0.3),FRandom[Minigun](-0.3,0.3));
s.target = self; s.target = self;
} }
origin += x*8.0+y*5.0-z*5.0; origin = level.Vec3Offset(origin,x*8+y*5-z*5);
let c = Spawn("UTCasing",origin); let c = Spawn("UTCasing",origin);
c.vel = x*FRandom[Junk](-1.5,1.5)+y*FRandom[Junk](2,4)+z*FRandom[Junk](2,3); c.vel = x*FRandom[Junk](-1.5,1.5)+y*FRandom[Junk](2,4)+z*FRandom[Junk](2,3);
c.Scale *= 0.5; c.Scale *= 0.5;
} }
action void A_MinigunRefire( statelabel flash = null, bool nounwind = false ) action void A_MinigunRefire()
{ {
Weapon weap = Weapon(invoker); Weapon weap = Weapon(invoker);
if ( !weap || !player ) return; if ( !weap || !player ) return;
if ( weap.Ammo1.Amount <= 0 ) if ( weap.Ammo1.Amount <= 0 )
{ {
if ( nounwind ) return;
A_ClearRefire(); A_ClearRefire();
player.setpsprite(PSP_WEAPON,weap.FindState("Unwind"));
return; return;
} }
if ( nounwind ) weap.bAltFire = !!(player.cmd.buttons&BT_ALTATTACK);
{ A_Refire("Hold");
if ( player.cmd.buttons&BT_ALTATTACK )
{
weap.bAltFire = true;
flash = "AltFire";
}
else
{
weap.bAltFire = false;
flash = "Fire";
}
}
A_Refire(flash);
} }
Default Default
@ -237,141 +223,38 @@ Class Minigun : UTWeapon
A_WeaponReady(); A_WeaponReady();
} }
Wait; Wait;
FireDummy:
TNT1 A 1
{
let weap = Weapon(invoker);
if ( !(player.cmd.buttons&(BT_ATTACK|BT_ALTATTACK)) || (weap.Ammo1.Amount <= 0) )
{
player.SetPSprite(PSP_WEAPON,invoker.FindState("Unwind"));
return ResolveState("Null");
}
return ResolveState(null);
}
Wait;
Fire: Fire:
AltFire: AltFire:
MGNI A 3 { invoker.bcnt = 5; } MGNI A 3 { invoker.bcnt = 5; }
Hold: Hold:
MGNF A 1
{
A_PlaySound("minigun/fire",CHAN_WEAPON,1.0,true);
A_FireBullet();
}
MGNF B 0 A_MinigunRefire(1);
Goto Unwind;
MGNF B 1 A_FireBullet();
MGNF C 0 A_MinigunRefire(1);
Goto Unwind;
MGNF C 1 A_FireBullet();
MGNF D 0 A_MinigunRefire(1);
Goto Unwind;
MGNF D 1 A_FireBullet();
MGNF E 0 A_MinigunRefire(1);
Goto Unwind;
MGNF E 1 A_FireBullet();
MGNF F 0 A_MinigunRefire(1);
Goto Unwind;
MGNF F 1 A_FireBullet();
MGNF G 0 A_MinigunRefire(1);
Goto Unwind;
MGNF G 1 A_FireBullet();
MGNF H 0 A_MinigunRefire(1);
Goto Unwind;
MGNF H 1 A_FireBullet();
MGNF I 0 A_MinigunRefire(1);
Goto Unwind;
MGNF I 1 A_FireBullet();
MGNF J 0 A_MinigunRefire(1);
Goto Unwind;
MGNF J 1 A_FireBullet();
MGNF K 0 A_MinigunRefire(1);
Goto Unwind;
MGNF K 1 A_FireBullet();
MGNF L 0 A_MinigunRefire(1);
Goto Unwind;
MGNF L 1 A_FireBullet();
MGNF M 0 A_MinigunRefire(1);
Goto Unwind;
MGNF M 1 A_FireBullet();
MGNF N 0 A_MinigunRefire(1);
Goto Unwind;
MGNF N 1 A_FireBullet();
MGNF O 0 A_MinigunRefire(1);
Goto Unwind;
MGNF O 1 A_FireBullet();
MGNF P 0 A_MinigunRefire(1);
Goto Unwind;
MGNF P 1 A_FireBullet();
MGNF Q 0 A_MinigunRefire(1);
Goto Unwind;
MGNF Q 1 A_FireBullet();
MGNF R 0 A_MinigunRefire(1);
Goto Unwind;
MGNF R 1 A_FireBullet();
MGNF S 0 A_MinigunRefire(1);
Goto Unwind;
MGNF S 1 A_FireBullet();
MGNF A 0 MGNF A 0
{ {
if ( invoker.bAltFire ) A_MinigunRefire(1); A_PlaySound("minigun/fire",CHAN_WEAPON,1.0,true);
else A_MinigunRefire("Hold"); A_Overlay(-9999,"FireDummy");
} }
Goto Unwind; MGNF ABCDEFGHIJKLMNOPQRS 1 A_FireBullet();
MGNF A 0 A_JumpIf(invoker.bAltFire,1);
Goto Hold+1;
AltHold: AltHold:
MGNF A 1 MGNF B 0 A_PlaySound("minigun/altfire",CHAN_WEAPON,1.0,true);
{ MGNF ADGJMPSCFILORBEHKNQ 1 A_FireBullet(true);
A_PlaySound("minigun/altfire",CHAN_WEAPON,1.0,true); Goto AltHold+1;
A_FireBullet(true);
}
MGNF D 0 A_MinigunRefire(1);
Goto Unwind;
MGNF D 1 A_FireBullet(true);
MGNF G 0 A_MinigunRefire(1);
Goto Unwind;
MGNF G 1 A_FireBullet(true);
MGNF J 0 A_MinigunRefire(1);
Goto Unwind;
MGNF J 1 A_FireBullet(true);
MGNF M 0 A_MinigunRefire(1);
Goto Unwind;
MGNF M 1 A_FireBullet(true);
MGNF P 0 A_MinigunRefire(1);
Goto Unwind;
MGNF P 1 A_FireBullet(true);
MGNF S 0 A_MinigunRefire(1);
Goto Unwind;
MGNF S 1 A_FireBullet(true);
MGNF C 0 A_MinigunRefire(1);
Goto Unwind;
MGNF C 1 A_FireBullet(true);
MGNF F 0 A_MinigunRefire(1);
Goto Unwind;
MGNF F 1 A_FireBullet(true);
MGNF I 0 A_MinigunRefire(1);
Goto Unwind;
MGNF I 1 A_FireBullet(true);
MGNF L 0 A_MinigunRefire(1);
Goto Unwind;
MGNF L 1 A_FireBullet(true);
MGNF O 0 A_MinigunRefire(1);
Goto Unwind;
MGNF O 1 A_FireBullet(true);
MGNF R 0 A_MinigunRefire(1);
Goto Unwind;
MGNF R 1 A_FireBullet(true);
MGNF B 0 A_MinigunRefire(1);
Goto Unwind;
MGNF B 1 A_FireBullet(true);
MGNF E 0 A_MinigunRefire(1);
Goto Unwind;
MGNF E 1 A_FireBullet(true);
MGNF H 0 A_MinigunRefire(1);
Goto Unwind;
MGNF H 1 A_FireBullet(true);
MGNF K 0 A_MinigunRefire(1);
Goto Unwind;
MGNF K 1 A_FireBullet(true);
MGNF N 0 A_MinigunRefire(1);
Goto Unwind;
MGNF N 1 A_FireBullet(true);
MGNF Q 0 A_MinigunRefire(1);
Goto Unwind;
MGNF Q 1 A_FireBullet(true);
MGNF A 0 A_MinigunRefire("AltHold");
Goto Unwind;
Unwind: Unwind:
MGNU A 0 A_PlaySound("minigun/unwind",CHAN_WEAPON); MGNU A 0 A_PlaySound("minigun/unwind",CHAN_WEAPON);
MGNU ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 A_MinigunRefire(null,true); MGNU ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 A_MinigunRefire();
MGU2 ABCDEFGHIJKLM 1 A_MinigunRefire(null,true); MGU2 ABCDEFGHIJKLM 1 A_MinigunRefire();
Goto Idle; Goto Idle;
Deselect: Deselect:
MGND A 1 A_StopSound(CHAN_WEAPON); MGND A 1 A_StopSound(CHAN_WEAPON);
@ -379,25 +262,11 @@ Class Minigun : UTWeapon
MGND J 1 A_Lower(int.max); MGND J 1 A_Lower(int.max);
Wait; Wait;
MuzzleFlash: MuzzleFlash:
TNT1 A 0 A_Jump(256,1,2,3,4,5,6,7,8,9); MMUZ # 2 Bright
Stop; {
MMUZ A 2 Bright; let psp = player.FindPSprite(OverlayID());
Stop; psp.frame = Random[Minigun](0,8);
MMUZ B 2 Bright; }
Stop;
MMUZ C 2 Bright;
Stop;
MMUZ D 2 Bright;
Stop;
MMUZ E 2 Bright;
Stop;
MMUZ F 2 Bright;
Stop;
MMUZ G 2 Bright;
Stop;
MMUZ H 2 Bright;
Stop;
MMUZ I 2 Bright;
Stop; Stop;
} }
} }

View file

@ -47,6 +47,7 @@ Class DamageAmpLight : DynamicLight
Class DamageAmplifier : Powerup Class DamageAmplifier : Powerup
{ {
Actor l; Actor l;
int lasteffect;
Default Default
{ {
@ -63,6 +64,7 @@ Class DamageAmplifier : Powerup
override void InitEffect() override void InitEffect()
{ {
Super.InitEffect(); Super.InitEffect();
lasteffect = int.min;
l = Spawn("DamageAmpLight",Owner.pos); l = Spawn("DamageAmpLight",Owner.pos);
l.target = Owner; l.target = Owner;
l.master = self; l.master = self;
@ -88,9 +90,11 @@ Class DamageAmplifier : Powerup
void FireEffect() void FireEffect()
{ {
if ( gametic < lasteffect ) return;
if ( EffectTics < 350 ) Owner.A_PlaySound("udamage/fire2",CHAN_7,1.0,false,0.25); if ( EffectTics < 350 ) Owner.A_PlaySound("udamage/fire2",CHAN_7,1.0,false,0.25);
else Owner.A_PlaySound("udamage/fire1",CHAN_7,1.0,false,0.25); else Owner.A_PlaySound("udamage/fire1",CHAN_7,1.0,false,0.25);
UTMainHandler.DoFlash(Owner,Color(96,238,0,255),10); UTMainHandler.DoFlash(Owner,Color(48,238,0,255),6);
lasteffect = gametic+5; // prevent excess flash
} }
override void ModifyDamage( int damage, Name damageType, out int newdamage, bool passive ) override void ModifyDamage( int damage, Name damageType, out int newdamage, bool passive )
@ -480,7 +484,7 @@ Class mkLight : DynamicLight
Destroy(); Destroy();
return; return;
} }
if ( target.player ) SetOrigin((target.pos.x,target.pos.y,target.player.viewz),true); if ( target.player ) SetOrigin(target.Vec2OffsetZ(0,0,target.player.viewz),true);
else SetOrigin(target.vec3Offset(0,0,target.height*0.75),true); else SetOrigin(target.vec3Offset(0,0,target.height*0.75),true);
A_SetAngle(target.angle,SPF_INTERPOLATE); A_SetAngle(target.angle,SPF_INTERPOLATE);
A_SetPitch(target.pitch,SPF_INTERPOLATE); A_SetPitch(target.pitch,SPF_INTERPOLATE);

View file

@ -88,8 +88,8 @@ Class ViewPulseSpark : PulseSpark
} }
Vector3 x, y, z; Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll); [x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll);
Vector3 origin = x*ofs.x+y*ofs.y+z*ofs.z+(0,0,target.player.viewz); Vector3 origin = level.Vec3Offset(target.Vec2OffsetZ(0,0,target.player.viewz),x*ofs.x+y*ofs.y+z*ofs.z);
SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true); SetOrigin(origin,true);
bInvisible = (players[consoleplayer].camera != target); bInvisible = (players[consoleplayer].camera != target);
if ( isFrozen() ) return; if ( isFrozen() ) return;
ofs += vvel; ofs += vvel;
@ -470,7 +470,7 @@ Class PulseBolt : Actor
{ {
bRELATIVETOFLOOR = parent.bRELATIVETOFLOOR; bRELATIVETOFLOOR = parent.bRELATIVETOFLOOR;
frame = parent.frame; frame = parent.frame;
SetOrigin(parent.Vec3Offset(x.x*beamsize,x.y*beamsize,x.z*beamsize),true); SetOrigin(level.Vec3Offset(parent.pos,x*beamsize),true);
A_SetAngle(parent.angle); A_SetAngle(parent.angle);
A_SetPitch(parent.pitch); A_SetPitch(parent.pitch);
CheckBeam(x); CheckBeam(x);
@ -514,7 +514,7 @@ Class StarterBolt : PulseBolt
if ( target.player ) if ( target.player )
{ {
[x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll); [x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll);
origin = target.Vec2OffsetZ(0,0,target.player.viewz)+8.0*x+4.1*y-2.7*z; origin = level.Vec3Offset(target.Vec2OffsetZ(0,0,target.player.viewz),8*x+4.1*y-2.7*z);
} }
else origin = target.Vec3Offset(0,0,target.missileheight); else origin = target.Vec3Offset(0,0,target.missileheight);
SetOrigin(origin,true); SetOrigin(origin,true);
@ -535,28 +535,31 @@ Class PulseGun : UTWeapon
Property ClipCount : clipcount; Property ClipCount : clipcount;
action void A_Reloading()
{
Weapon weap = Weapon(invoker);
if ( !weap ) return;
invoker.clipcount = Min(50,weap.Ammo1.Amount);
A_PlaySound("pulse/reload",CHAN_WEAPON);
}
action void A_DrainAmmo() action void A_DrainAmmo()
{ {
Weapon weap = Weapon(invoker); Weapon weap = Weapon(invoker);
if ( !weap ) return; if ( !weap ) return;
if ( weap.Ammo1.Amount <= 0 ) return; if ( (weap.Ammo1.Amount <= 0) || !(player.cmd.buttons&BT_ALTATTACK) )
{
player.SetPSprite(PSP_WEAPON,ResolveState("AltRelease"));
return;
}
if ( invoker.special1 > 0 )
{
invoker.special1--;
return;
}
invoker.special1 = 9;
if ( !weap.DepleteAmmo(weap.bAltFire,true,1) ) return; if ( !weap.DepleteAmmo(weap.bAltFire,true,1) ) return;
invoker.clipcount--; invoker.clipcount--;
if ( !flak_pulsereload && (invoker.clipcount <= 0) ) invoker.clipcount = (weap.Ammo1.Amount>0)?Min(50,weap.Ammo1.Amount):50; if ( !flak_pulsereload && (invoker.clipcount <= 0) ) invoker.clipcount = min(invoker.default.clipcount,weap.Ammo1.Amount);
invoker.FireEffect(); invoker.FireEffect();
UTMainHandler.DoFlash(self,Color(32,128,255,128),1); 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_Spring,0,2); UTMainHandler.DoSwing(self,(FRandom[Pulse](-1,1),FRandom[Pulse](-1,1)),0.1,-0.02,3,SWING_Spring,0,2);
A_AlertMonsters(); A_AlertMonsters();
Vector3 x, y, z; Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = Vec2OffsetZ(0,0,player.viewz)+10.0*x+4.1*y-2.7*z; Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+4.1*y-2.7*z);
for ( int i=0; i<4; i++ ) for ( int i=0; i<4; i++ )
{ {
let s = Spawn("UTViewSmoke",origin); let s = Spawn("UTViewSmoke",origin);
@ -576,38 +579,38 @@ Class PulseGun : UTWeapon
ViewPulseSpark(s).vvel += (FRandom[Pulse](0.2,0.8),FRandom[Pulse](-0.5,0.5),FRandom[Pulse](-0.5,0.5)); ViewPulseSpark(s).vvel += (FRandom[Pulse](0.2,0.8),FRandom[Pulse](-0.5,0.5),FRandom[Pulse](-0.5,0.5));
} }
} }
action void A_PulseRefire( statelabel flash = null, bool noreload = false ) action void A_PulseRefire()
{ {
Weapon weap = Weapon(invoker); Weapon weap = Weapon(invoker);
if ( !weap || !player ) return; if ( !weap || !player ) return;
if ( (invoker.clipcount <= 0) || (weap.Ammo1.Amount <= 0) ) if ( (invoker.clipcount <= 0) || (weap.Ammo1.Amount <= 0) )
{
if ( noreload ) return;
A_ClearRefire();
if ( weap.bAltFire ) player.setpsprite(PSP_WEAPON,weap.FindState("AltRelease"));
else player.setpsprite(PSP_WEAPON,weap.FindState("Release"));
return; return;
} if ( player.cmd.buttons&BT_ALTATTACK )
if ( noreload )
{ {
if ( player.cmd.buttons&BT_ALTATTACK ) weap.bAltFire = true;
{ player.SetPSprite(PSP_WEAPON,ResolveState("AltHold"));
weap.bAltFire = true; }
flash = "AltFire"; else if ( player.cmd.buttons&BT_ATTACK )
} {
else weap.bAltFire = false;
{ player.SetPSprite(PSP_WEAPON,ResolveState("Fire"));
weap.bAltFire = false;
flash = "Fire";
}
} }
A_Refire(flash);
} }
action void A_PulseFire() action void A_PulseFire()
{ {
Weapon weap = Weapon(invoker); Weapon weap = Weapon(invoker);
if ( !weap ) return; if ( !weap ) return;
if ( weap.Ammo1.Amount <= 0 ) return; if ( (weap.Ammo1.Amount <= 0) || !(player.cmd.buttons&BT_ATTACK) )
{
player.SetPSprite(PSP_WEAPON,ResolveState("Release"));
return;
}
if ( invoker.special1 > 0 )
{
invoker.special1--;
return;
}
invoker.special1 = 5;
if ( !weap.DepleteAmmo(weap.bAltFire,true,1) ) return; if ( !weap.DepleteAmmo(weap.bAltFire,true,1) ) return;
invoker.clipcount--; invoker.clipcount--;
if ( !flak_pulsereload && (invoker.clipcount <=0) ) invoker.clipcount = (weap.Ammo1.Amount>0)?Min(50,weap.Ammo1.Amount):50; if ( !flak_pulsereload && (invoker.clipcount <=0) ) invoker.clipcount = (weap.Ammo1.Amount>0)?Min(50,weap.Ammo1.Amount):50;
@ -622,8 +625,8 @@ Class PulseGun : UTWeapon
Vector3 x, y, z; Vector3 x, y, z;
double a; double a;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = Vec2OffsetZ(0,0,player.viewz)+10.0*x+3.0*y-1.8*z; Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+3*y-1.8*z);
origin += y*cos(invoker.sangle)*2.0+z*sin(invoker.sangle)*2.0; origin = level.Vec3Offset(origin,y*cos(invoker.sangle)*2+z*sin(invoker.sangle)*2);
invoker.sangle += 100; invoker.sangle += 100;
Actor p = Spawn("PulseBall",origin); Actor p = Spawn("PulseBall",origin);
p.angle = angle; p.angle = angle;
@ -633,7 +636,7 @@ Class PulseGun : UTWeapon
for ( int i=0; i<8; i++ ) for ( int i=0; i<8; i++ )
{ {
let s = Spawn("UTViewSmoke",origin); let s = Spawn("UTViewSmoke",origin);
UTViewSmoke(s).ofs = (10,3.0,-1.8); UTViewSmoke(s).ofs = (10,3,-1.8);
s.scale *= 1.8; s.scale *= 1.8;
s.target = self; s.target = self;
s.SetShade("206010"); s.SetShade("206010");
@ -644,17 +647,18 @@ Class PulseGun : UTWeapon
for ( int i=0; i<numpt; i++ ) for ( int i=0; i<numpt; i++ )
{ {
let s = Spawn("ViewPulseSpark",origin); let s = Spawn("ViewPulseSpark",origin);
ViewPulseSpark(s).ofs = (10,3.0,-1.8); ViewPulseSpark(s).ofs = (10,3,-1.8);
s.target = self; s.target = self;
ViewPulseSpark(s).vvel += (FRandom[Pulse](0.4,1.6),FRandom[Pulse](-1.2,1.2),FRandom[Pulse](-1.2,1.2)); ViewPulseSpark(s).vvel += (FRandom[Pulse](0.4,1.6),FRandom[Pulse](-1.2,1.2),FRandom[Pulse](-1.2,1.2));
} }
} }
action void A_StartBeam() action void A_StartBeam()
{ {
invoker.special1 = 0;
A_PlaySound("pulse/bolt",CHAN_WEAPON,1.0,true); A_PlaySound("pulse/bolt",CHAN_WEAPON,1.0,true);
Vector3 x, y, z, origin; Vector3 x, y, z, origin;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
origin = Vec2OffsetZ(0,0,player.viewz)+10.0*x+4.1*y-2.7*z; origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+4.1*y-2.7*z);
invoker.beam = Spawn("StarterBolt",origin); invoker.beam = Spawn("StarterBolt",origin);
invoker.beam.angle = angle; invoker.beam.angle = angle;
invoker.beam.pitch = BulletSlope(); invoker.beam.pitch = BulletSlope();
@ -669,10 +673,12 @@ Class PulseGun : UTWeapon
{ {
Super.OwnerDied(); Super.OwnerDied();
if ( beam ) beam.Destroy(); if ( beam ) beam.Destroy();
Owner.A_StopSound(CHAN_WEAPON);
} }
override void DetachFromOwner() override void DetachFromOwner()
{ {
if ( beam ) beam.Destroy(); if ( beam ) beam.Destroy();
Owner.A_StopSound(CHAN_WEAPON);
Super.DetachFromOwner(); Super.DetachFromOwner();
} }
override void OnDestroy() override void OnDestroy()
@ -710,7 +716,7 @@ Class PulseGun : UTWeapon
A_CheckReload(); A_CheckReload();
if ( flak_pulsereload ) if ( flak_pulsereload )
{ {
if ( (invoker.clipcount <= 0) && (invoker.Ammo1.Amount > 0) ) return A_Jump(255,"Reload"); if ( (invoker.clipcount <= 0) && (invoker.Ammo1.Amount > 0) ) return ResolveState("Reload");
A_WeaponReady(WRF_ALLOWRELOAD); A_WeaponReady(WRF_ALLOWRELOAD);
} }
else A_WeaponReady(); else A_WeaponReady();
@ -720,89 +726,61 @@ Class PulseGun : UTWeapon
PGNI ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 PGNI ABCDEFGHIJKLMNOPQRSTUVWXYZ 1
{ {
A_CheckReload(); A_CheckReload();
A_WeaponReady(WRF_ALLOWRELOAD); if ( flak_pulsereload )
{
if ( (invoker.clipcount <= 0) && (invoker.Ammo1.Amount > 0) ) return ResolveState("Reload");
A_WeaponReady(WRF_ALLOWRELOAD);
}
else A_WeaponReady();
return ResolveState(null);
} }
Goto Idle; Goto Idle;
Fire: Fire:
PGNI A 0 A_PlaySound("pulse/fire",CHAN_WEAPON,1.0,true); PGNI A 0
Hold: {
PGNF A 1 A_PulseFire(); invoker.special1 = 0;
PGNF BCDEF 1; A_PlaySound("pulse/fire",CHAN_WEAPON,1.0,true);
PNGF G 0 A_PulseRefire(1); }
Goto Release; PGNF ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 A_PulseFire();
PGNF G 1 A_PulseFire(); PGF2 ABCDEFGHIJKLMN 1 A_PulseFire();
PGNF HIJKL 1; Goto Fire+1;
PNGF M 0 A_PulseRefire(1);
Goto Release;
PGNF N 1 A_PulseFire();
PGNF OPQRS 1;
PNGF T 0 A_PulseRefire(1);
Goto Release;
PGNF U 1 A_PulseFire();
PGNF VWXYZ 1;
PGF2 A 0 A_PulseRefire(1);
Goto Release;
PGF2 A 1 A_PulseFire();
PGF2 BCDEF 1;
PGF2 G 0 A_PulseRefire(1);
Goto Release;
PGF2 H 1 A_PulseFire();
PGF2 IJKLM 1;
PGF2 N 0 A_PulseRefire();
Goto Release;
Release: Release:
PGNC A 0 A_PlaySound("pulse/down",CHAN_WEAPON); PGNC A 0 A_PlaySound("pulse/down",CHAN_WEAPON);
PGNC ABCDEFGHIJKLMNOPQRSTUVWXY 1 A_PulseRefire(null,true); PGNC ABCDEFGHIJKLMNOPQRSTUVWXY 1 A_PulseRefire();
PGNC Y 0; PGNC Y 0;
Goto Idle; Goto Idle;
AltFire: AltFire:
PGBS ABCDE 1; PGBS ABCDE 1;
PGBL A 0 A_StartBeam(); Goto AltHold;
AltHold: AltHold:
PGBL A 1 A_DrainAmmo(); PGBL A 0 A_StartBeam();
PGBL B 0 A_PulseRefire(1); PGBL ABCDEFGHIJ 1 A_DrainAmmo();
Goto AltRelease; Goto AltHold+1;
PGBL B 1;
PGBL C 0 A_PulseRefire(1);
Goto AltRelease;
PGBL C 1;
PGBL D 0 A_PulseRefire(1);
Goto AltRelease;
PGBL D 1;
PGBL E 0 A_PulseRefire(1);
Goto AltRelease;
PGBL E 1;
PGBL F 0 A_PulseRefire(1);
Goto AltRelease;
PGBL F 1;
PGBL G 0 A_PulseRefire(1);
Goto AltRelease;
PGBL G 1;
PGBL H 0 A_PulseRefire(1);
Goto AltRelease;
PGBL H 1;
PGBL I 0 A_PulseRefire(1);
Goto AltRelease;
PGBL I 1;
PGBL J 0 A_PulseRefire(1);
Goto AltRelease;
PGBL J 1;
PGBL A 0 A_PulseRefire();
AltRelease: AltRelease:
PGBE A 0 A_StopBeam(); PGBE A 0 A_StopBeam();
PGBE ABCDE 1 A_PulseRefire(null,true); PGBE ABCDE 1 A_PulseRefire();
Goto Idle; Goto Idle;
Reload: Reload:
PGNI A 1; PGNI A 1;
PGNI A 0 A_JumpIf(invoker.clipcount >= Min(50,invoker.Ammo1.Amount),"Idle"); PGNI A 0 A_JumpIf(invoker.clipcount >= Min(invoker.default.clipcount,invoker.Ammo1.Amount),"Idle");
PGNR A 1 PGNR A 1
{ {
A_Reloading(); A_PlaySound("pulse/reload",CHAN_WEAPON);
if ( self is 'UTPlayer' ) if ( self is 'UTPlayer' )
UTPlayer(self).PlayReloading(); UTPlayer(self).PlayReloading();
} }
PGNR BCDEFGHIJKLMNOPQRSTUVWXYZ 1; PGNR BCDEFGHIJKLMNO 1;
PGR2 ABCDEFGHIJKLMNOPQRSTUVWX 1; PGNR P 1
{
invoker.clipcount = 0;
}
PGNR QRSTUVWXYZ 1;
PGR2 ABCD 1;
PGR2 E 1
{
invoker.clipcount = Min(invoker.default.clipcount,invoker.Ammo1.Amount);
}
PGR2 FGHIJKLMNOPQRSTUVWX 1;
Goto Idle; Goto Idle;
Deselect: Deselect:
PGNS W 1 A_StopSound(CHAN_WEAPON); PGNS W 1 A_StopSound(CHAN_WEAPON);

View file

@ -261,7 +261,7 @@ Class Ripper2 : UTWeapon
} }
Vector3 x, y, z; Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+6.0*y-4.0*z; Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+6*y-4*z);
Actor p; Actor p;
if ( alt ) p = Spawn("Razor2Alt",origin); if ( alt ) p = Spawn("Razor2Alt",origin);
else p = Spawn("Razor2",origin); else p = Spawn("Razor2",origin);

View file

@ -1032,8 +1032,8 @@ Class ViewShockSpark : ShockSpark
} }
Vector3 x, y, z; Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll); [x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll);
Vector3 origin = x*ofs.x+y*ofs.y+z*ofs.z+(0,0,target.player.viewz); Vector3 origin = level.Vec3Offset(target.Vec2OffsetZ(0,0,target.player.viewz),x*ofs.x+y*ofs.y+z*ofs.z);
SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true); SetOrigin(origin,true);
bInvisible = (players[consoleplayer].camera != target); bInvisible = (players[consoleplayer].camera != target);
if ( isFrozen() ) return; if ( isFrozen() ) return;
ofs += vvel; ofs += vvel;
@ -1066,7 +1066,7 @@ Class ShockRifle : UTWeapon
A_QuakeEx(2,2,2,4,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1); A_QuakeEx(2,2,2,4,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1);
Vector3 x, y, z; Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+2.0*y-1.5*z; Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+2*y-1.5*z);
Actor p = Spawn("ShockBeam",origin); Actor p = Spawn("ShockBeam",origin);
p.angle = angle; p.angle = angle;
p.pitch = BulletSlope(); p.pitch = BulletSlope();
@ -1104,7 +1104,7 @@ Class ShockRifle : UTWeapon
A_QuakeEx(2,2,2,8,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1); A_QuakeEx(2,2,2,8,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1);
Vector3 x, y, z; Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+2.0*y-1.5*z; Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+2*y-1.5*z);
Actor p = Spawn("ShockBall",origin); Actor p = Spawn("ShockBall",origin);
p.angle = angle; p.angle = angle;
p.pitch = BulletSlope(); p.pitch = BulletSlope();
@ -1249,7 +1249,7 @@ Class EnhancedShockRifle : UTWeapon
A_QuakeEx(3,3,3,4,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.15); A_QuakeEx(3,3,3,4,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.15);
Vector3 x, y, z; Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+2.0*y-1.5*z; Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+2*y-1.5*z);
Actor p = Spawn("SuperShockBeam",origin); Actor p = Spawn("SuperShockBeam",origin);
p.angle = angle; p.angle = angle;
p.pitch = BulletSlope(); p.pitch = BulletSlope();
@ -1287,7 +1287,7 @@ Class EnhancedShockRifle : UTWeapon
A_QuakeEx(3,3,3,4,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.15); A_QuakeEx(3,3,3,4,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.15);
Vector3 x, y, z; Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+2.0*y-1.5*z; Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+2*y-1.5*z);
Actor p = Spawn("SuperShockBall",origin); Actor p = Spawn("SuperShockBall",origin);
p.angle = angle; p.angle = angle;
p.pitch = BulletSlope(); p.pitch = BulletSlope();

View file

@ -57,15 +57,20 @@ Class SniperRifle : UTWeapon
} }
override void PreRender( double lbottom ) override void PreRender( double lbottom )
{ {
if ( sniperzoom <= 1.0 ) return; if ( sniperzoom <= 1. ) return;
Screen.DrawTexture(reticle,false,320,240,DTA_VirtualWidth,640,DTA_VirtualHeight,480,DTA_LegacyRenderStyle,STYLE_Add); Screen.DrawTexture(reticle,false,320,240,DTA_VirtualWidth,640,DTA_VirtualHeight,480,DTA_LegacyRenderStyle,STYLE_Add);
if ( !zfont ) zfont = Font.GetFont('UTFont40'); if ( !zfont ) zfont = Font.GetFont('UTFont40');
Screen.DrawText(zfont,Font.FindFontColor('UGreen'),960,960,String.Format("X%.1f",sniperzoom),DTA_VirtualWidth,1600,DTA_VirtualHeight,1200,DTA_LegacyRenderStyle,STYLE_Add); Screen.DrawText(zfont,Font.FindFontColor('UGreen'),960,960,String.Format("X%.1f",sniperzoom),DTA_VirtualWidth,1600,DTA_VirtualHeight,1200,DTA_LegacyRenderStyle,STYLE_Add);
} }
override void Tick() override void RenderOverlay( RenderEvent e )
{ {
Super.Tick(); PlayerInfo p = players[consoleplayer];
if ( !Owner ) return; if ( (p.Camera != Owner) || (sniperzoom <= 1.) ) Shader.SetEnabled(p,"UTRifleScope",false);
else Shader.SetEnabled(p,"UTRifleScope",CVar.GetCVar('flak_zoomshader',p).GetBool());
}
override void DoEffect()
{
Super.DoEffect();
if ( sniperzoom > 1.0 ) crosshair = 99; if ( sniperzoom > 1.0 ) crosshair = 99;
else crosshair = 0; else crosshair = 0;
} }
@ -98,8 +103,8 @@ Class SniperRifle : UTWeapon
l.target = self; l.target = self;
Vector3 x, y, z; Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = Vec2OffsetZ(0,0,player.viewz)+10.0*x; Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x);
if ( !zoomed ) origin = origin+y*4.0-z*2.0; if ( !zoomed ) origin = level.Vec3Offset(origin,y*4-z*2);
FLineTraceData d; FLineTraceData d;
LineTrace(angle,10000,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d); LineTrace(angle,10000,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d);
if ( d.HitType == TRACE_HitActor ) if ( d.HitType == TRACE_HitActor )
@ -161,7 +166,7 @@ Class SniperRifle : UTWeapon
s.scale *= 1.8; s.scale *= 1.8;
s.alpha *= 0.3; s.alpha *= 0.3;
} }
origin += x*8.0+y*6.0-z*9.0; origin = level.Vec3Offset(origin,x*8+y*6-z*9);
let c = Spawn("UTCasing",origin); let c = Spawn("UTCasing",origin);
c.scale *= 1.25; c.scale *= 1.25;
c.vel = x*FRandom[Junk](-1.5,1.5)+y*FRandom[Junk](2,4)+z*FRandom[Junk](2,3); c.vel = x*FRandom[Junk](-1.5,1.5)+y*FRandom[Junk](2,4)+z*FRandom[Junk](2,3);
@ -241,7 +246,18 @@ Class SniperRifle : UTWeapon
TNT1 A 20 A_SniperFire(true); TNT1 A 20 A_SniperFire(true);
Goto ZoomedIdle; Goto ZoomedIdle;
AltFire: AltFire:
SRFI A 0 A_JumpIf(invoker.sniperzoom>1.0,"AltHold2"); SRFI A 0
{
if ( invoker.sniperzoom > 1. )
{
if ( CVar.GetCVar('flak_zoomsound',players[consoleplayer]).GetBool() && CheckLocalView() )
A_PlaySound("sniper/zoomdown",CHAN_WEAPON);
return ResolveState("AltHold2");
}
if ( CVar.GetCVar('flak_zoomsound',players[consoleplayer]).GetBool() && CheckLocalView() )
A_PlaySound("sniper/zoomup",CHAN_WEAPON);
return ResolveState(null);
}
AltHold: AltHold:
TNT1 A 1 TNT1 A 1
{ {
@ -256,7 +272,12 @@ Class SniperRifle : UTWeapon
SRFI A 0 A_Refire("AltHold2"); SRFI A 0 A_Refire("AltHold2");
Goto Idle; Goto Idle;
Deselect: Deselect:
SRFD A 0 A_ZoomFactor(invoker.sniperzoom=1.0,ZOOM_INSTANT); SRFD A 0
{
if ( (invoker.sniperzoom>1.0) && CVar.GetCVar('flak_zoomsound',players[consoleplayer]).GetBool() && CheckLocalView() )
A_PlaySound("sniper/zoomdown",CHAN_WEAPON);
A_ZoomFactor(invoker.sniperzoom=1.0,ZOOM_INSTANT);
}
SRFD ABCDEFG 1; SRFD ABCDEFG 1;
SRFD G 1 A_Lower(int.max); SRFD G 1 A_Lower(int.max);
Wait; Wait;

View file

@ -333,7 +333,7 @@ Class Translocator : UTWeapon
A_AlertMonsters(); A_AlertMonsters();
Vector3 x, y, z; Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x-8.0*y-12.0*z; Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x-8*y-12*z);
let p = Spawn("TranslocatorModule",origin); let p = Spawn("TranslocatorModule",origin);
p.target = self; p.target = self;
p.angle = angle; p.angle = angle;

View file

@ -1592,8 +1592,8 @@ Class UTViewSpark : UTSpark
} }
Vector3 x, y, z; Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll); [x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll);
Vector3 origin = x*ofs.x+y*ofs.y+z*ofs.z+(0,0,target.player.viewz); Vector3 origin = level.Vec3Offset(target.Vec2OffsetZ(0,0,target.player.viewz),x*ofs.x+y*ofs.y+z*ofs.z);
SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true); SetOrigin(origin,true);
bInvisible = (players[consoleplayer].camera != target); bInvisible = (players[consoleplayer].camera != target);
if ( isFrozen() ) return; if ( isFrozen() ) return;
ofs += vvel; ofs += vvel;
@ -1837,8 +1837,8 @@ Class UTViewSmoke : UTSmoke
} }
Vector3 x, y, z; Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll); [x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll);
Vector3 origin = x*ofs.x+y*ofs.y+z*ofs.z+(0,0,target.player.viewz); Vector3 origin = level.Vec3Offset(target.Vec2OffsetZ(0,0,target.player.viewz),x*ofs.x+y*ofs.y+z*ofs.z);
SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true); SetOrigin(origin,true);
bInvisible = (players[consoleplayer].camera != target); bInvisible = (players[consoleplayer].camera != target);
if ( isFrozen() ) return; if ( isFrozen() ) return;
ofs += vvel; ofs += vvel;

View file

@ -342,7 +342,7 @@ Class UTHud : BaseStatusBar
else if ( flak_enforcerreload && (cw is 'Enforcer') ) else if ( flak_enforcerreload && (cw is 'Enforcer') )
{ {
// draw clip(s) // draw clip(s)
double ch = Enforcer(cw).ClipCount/20.; double ch = Enforcer(cw).ClipCount/double(Enforcer(cw).default.ClipCount);
CurX = BaseX+6*hudsize*HScale; CurX = BaseX+6*hudsize*HScale;
CurY = BaseY+53*hudsize*HScale; CurY = BaseY+53*hudsize*HScale;
Vector2 ss; Vector2 ss;
@ -355,7 +355,7 @@ Class UTHud : BaseStatusBar
Screen.DrawTexture(AmmoBar,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_WindowRightF,ddw,DTA_Alpha,alpha); Screen.DrawTexture(AmmoBar,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_WindowRightF,ddw,DTA_Alpha,alpha);
if ( cw.Amount > 1 ) if ( cw.Amount > 1 )
{ {
ch = Enforcer(cw).SlaveClipCount/20.; ch = Enforcer(cw).SlaveClipCount/double(Enforcer(cw).default.SlaveClipCount);
CurY += 3*hudsize*HScale; CurY += 3*hudsize*HScale;
ss = (0.54,0.125)*hudsize*HScale; ss = (0.54,0.125)*hudsize*HScale;
dw = (Screen.GetWidth()/ss.x); dw = (Screen.GetWidth()/ss.x);
@ -369,7 +369,7 @@ Class UTHud : BaseStatusBar
else if ( flak_pulsereload && (cw is 'Pulsegun') ) else if ( flak_pulsereload && (cw is 'Pulsegun') )
{ {
// draw clip // draw clip
double ch = Pulsegun(cw).ClipCount/50.; double ch = Pulsegun(cw).ClipCount/double(Pulsegun(cw).default.ClipCount);
CurX = BaseX+6*hudsize*HScale; CurX = BaseX+6*hudsize*HScale;
CurY = BaseY+53*hudsize*HScale; CurY = BaseY+53*hudsize*HScale;
Vector2 ss = (0.54,0.3)*hudsize*HScale; Vector2 ss = (0.54,0.3)*hudsize*HScale;

View file

@ -140,7 +140,7 @@ Class WarheadHitbox : Actor
Destroy(); Destroy();
return; return;
} }
SetOrigin(target.pos-(0,0,height*0.5),true); SetOrigin(target.Vec3Offset(0,0,-height*0.5),true);
} }
States States
{ {
@ -175,7 +175,7 @@ Class WarheadLight : DynamicLight
return; return;
} }
Vector3 taildir = -(cos(target.angle)*cos(target.pitch),sin(target.angle)*cos(target.pitch),-sin(target.pitch)); Vector3 taildir = -(cos(target.angle)*cos(target.pitch),sin(target.angle)*cos(target.pitch),-sin(target.pitch));
SetOrigin(target.Vec3Offset(taildir.x*20,taildir.y*20,taildir.z*20),true); SetOrigin(level.Vec3Offset(pos,taildir*20),true);
args[LIGHT_INTENSITY] = Random[Warhead](6,8)*10; args[LIGHT_INTENSITY] = Random[Warhead](6,8)*10;
} }
} }
@ -649,7 +649,7 @@ Class WarheadLauncher : UTWeapon
Vector3 x, y, z; Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
vel -= x*10; vel -= x*10;
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+2.0*y-2.0*z; Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+2*y-2*z);
Actor p = Spawn("WarShell",origin); Actor p = Spawn("WarShell",origin);
p.angle = angle; p.angle = angle;
p.pitch = BulletSlope(); p.pitch = BulletSlope();
@ -663,7 +663,7 @@ Class WarheadLauncher : UTWeapon
Vector3 x, y, z; Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
vel -= x*0.2; vel -= x*0.2;
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+2.0*y-2.0*z; Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+2*y-2*z);
int numpt = Random[Warhead](10,20); int numpt = Random[Warhead](10,20);
for ( int i=0; i<numpt; i++ ) for ( int i=0; i<numpt; i++ )
{ {
@ -687,7 +687,7 @@ Class WarheadLauncher : UTWeapon
Vector3 x, y, z; Vector3 x, y, z;
[x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll);
vel -= x*10; vel -= x*10;
Vector3 origin = (pos.x,pos.y,player.viewz)+10.0*x+2.0*y-2.0*z; Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+2*y-2*z);
Actor p = Spawn("GuidedWarShell",origin); Actor p = Spawn("GuidedWarShell",origin);
p.angle = angle; p.angle = angle;
p.pitch = BulletSlope(); p.pitch = BulletSlope();