diff --git a/cvarinfo.txt b/cvarinfo.txt index 3abdb8c..5d91fa1 100644 --- a/cvarinfo.txt +++ b/cvarinfo.txt @@ -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 user float flak_flashstrength = 1.0; // strength of screen flashes 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 diff --git a/gldefs.txt b/gldefs.txt index 86ea1da..64f0907 100644 --- a/gldefs.txt +++ b/gldefs.txt @@ -611,4 +611,9 @@ SkyBox "KGDaySky" fliptop "graphics/SkySetB_left.png" "graphics/SkySetB_up.png" "graphics/SkySetB_down.png" -} \ No newline at end of file +} +HardwareShader PostProcess scene +{ + Name "UTRifleScope" + Shader "shaders/glsl/UTRifleScope.fp" 330 +} diff --git a/language.txt b/language.txt index b0c6205..1008c29 100644 --- a/language.txt +++ b/language.txt @@ -217,6 +217,8 @@ FLAK_UCORPS = "Corpses take damage (unstable)"; FLAK_DTEST = "Edit Kinsie's test map"; FLAK_FSTRENGTH = "Screen flash strength"; FLAK_SAWAMMO = "Chainsaw uses ammo"; +FLAK_ZSHADER = "Sniper scope shader"; +FLAK_ZOOMSND = "Enable zoom sounds"; FLAK_TAUNTS = "Taunts"; FLAK_TAUNT1 = "Victory 1"; 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_FSTRENGTH = "Intensidad de destellos en pantalla"; 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_TAUNT1 = "Victoria 1"; FLAK_TAUNT2 = "Victoria 2"; diff --git a/menudef.txt b/menudef.txt index d6acc0b..b46eca3 100644 --- a/menudef.txt +++ b/menudef.txt @@ -28,6 +28,8 @@ OptionMenu "UTOptionMenu" Option "$FLAK_RSWITCH", "flak_noswitchdeemer", "YesNo" Option "$FLAK_CSSHOCK", "flak_classicsshock", "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" Slider "$FLAK_RSTRENGTH", "flak_swingerstrength", 0.0, 1.0, 0.1, 1 Slider "$FLAK_FSTRENGTH", "flak_flashstrength", 0.0, 1.0, 0.1, 1 diff --git a/models/Transloc_a.3d b/models/Transloc_a.3d index 2cadac9..1aca14a 100644 Binary files a/models/Transloc_a.3d and b/models/Transloc_a.3d differ diff --git a/models/Transloc_d.3d b/models/Transloc_d.3d index e39db70..e40e798 100644 Binary files a/models/Transloc_d.3d and b/models/Transloc_d.3d differ diff --git a/shaders/glsl/UTRifleScope.fp b/shaders/glsl/UTRifleScope.fp new file mode 100644 index 0000000..879e3c1 --- /dev/null +++ b/shaders/glsl/UTRifleScope.fp @@ -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.); +} diff --git a/sndinfo.txt b/sndinfo.txt index a2c738d..231762c 100644 --- a/sndinfo.txt +++ b/sndinfo.txt @@ -303,6 +303,8 @@ utrl/bounce hit1 sniper/select riflepck sniper/fire sniperf +sniper/zoomup zoomup +sniper/zoomdown zoomdown warhead/explode warexplo warhead/fly warfly diff --git a/sounds/zoomDOWN.ogg b/sounds/zoomDOWN.ogg new file mode 100644 index 0000000..d9a952b Binary files /dev/null and b/sounds/zoomDOWN.ogg differ diff --git a/sounds/zoomUP.ogg b/sounds/zoomUP.ogg new file mode 100644 index 0000000..18d3efd Binary files /dev/null and b/sounds/zoomUP.ogg differ diff --git a/zscript/biorifle.zsc b/zscript/biorifle.zsc index c7c2c61..3c26d83 100644 --- a/zscript/biorifle.zsc +++ b/zscript/biorifle.zsc @@ -116,7 +116,7 @@ Class BioHitbox : Actor Destroy(); 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 ) { @@ -698,7 +698,7 @@ Class BioRifle : UTWeapon Vector3 x, y, z; double a, s; [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; if ( alt ) { @@ -733,6 +733,7 @@ Class BioRifle : UTWeapon Weapon weap = Weapon(invoker); if ( !weap ) return; invoker.charge = 0; + invoker.special1 = 0; A_PlaySound("ges/charge",CHAN_WEAPON); invoker.bCharging = true; } @@ -740,6 +741,12 @@ Class BioRifle : UTWeapon { Weapon weap = Weapon(invoker); 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); if ( invoker.charge >= 5.1 ) return; if ( weap.Ammo1.Amount <= 0 ) return; @@ -788,63 +795,26 @@ Class BioRifle : UTWeapon BIOF BCDEFGHI 1; Goto Idle; AltCheck: - TNT1 A 1; - TNT1 A 0 A_JumpIf(player.cmd.buttons&BT_ALTATTACK,"AltCheck"); - TNT1 A 0 A_Overlay(PSP_WEAPON,"AltRelease"); - TNT1 A 1; + TNT1 A 1 + { + if ( player.cmd.buttons&BT_ALTATTACK ) + return ResolveState(null); + player.SetPSprite(PSP_WEAPON,ResolveState("AltRelease")); + return ResolveState("Null"); + } Wait; AltFire: BIOC A 0 A_Overlay(-9999,"AltCheck"); BIOC A 4 A_BeginCharge(); - BIOC B 5 A_ChargeUp(); - BIOC CD 5; - 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: + BIOC BCDEFGHIJKLMNOPQRSTUVWXYZ 5 A_ChargeUp(); + BIC2 ABCDE 5 A_ChargeUp(); BIOM A 1; - BIOM A 0 A_Refire("AltHeld"); + Wait; AltRelease: BIOE A 1 { invoker.charge = min(5.1,invoker.charge+0.1); A_Overlay(-9999,null); - A_WeaponOffset(0,32); // fix sudden psprite lowering if ( self is 'UTPlayer' ) UTPlayer(self).PlayAttacking3(); } diff --git a/zscript/chainsaw.zsc b/zscript/chainsaw.zsc index 7577b33..72a1d14 100644 --- a/zscript/chainsaw.zsc +++ b/zscript/chainsaw.zsc @@ -65,10 +65,9 @@ Class UTChainsaw : UTWeapon double sawcnt; double ammocharge; - override void Tick() + override void DoEffect() { Super.Tick(); - if ( !Owner ) return; if ( flak_sawammo ) { AmmoType1 = "ChainsawAmmo"; @@ -127,41 +126,52 @@ Class UTChainsaw : UTWeapon 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); invoker.sawcnt += 1./TICRATE; - if ( invoker.sawcnt < 0.15 ) return; - 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 ) + if ( invoker.sawcnt > 0.15 ) { - 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 ) + invoker.sawcnt = 0; + invoker.FireEffect(); + A_AlertMonsters(); + Vector3 x, y, z; + [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); + 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); 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); + if ( d.HitType == TRACE_HitWall ) d.HitLine.RemoteActivate(self,d.LineSide,SPAC_Impact,d.HitLocation-d.HitDir*4); } } - 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); - p.angle = atan2(d.HitDir.y,d.HitDir.x); - p.pitch = asin(-d.HitDir.z); - if ( d.HitType == TRACE_HitWall ) d.HitLine.RemoteActivate(self,d.LineSide,SPAC_Impact,d.HitLocation-d.HitDir*4); + A_StopSound(CHAN_6); + A_PlaySound("chainsaw/lower",CHAN_WEAPON); + quitout = true; } + else if ( !(player.cmd.buttons&BT_ATTACK) ) quitout = true; + if ( quitout ) player.SetPSprite(PSP_WEAPON,ResolveState("Release")); } action void A_SawSwipe( bool initial = false ) { @@ -172,7 +182,7 @@ Class UTChainsaw : UTWeapon 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-2.0*z; + Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x-2*z); FLineTraceData d; double ang = (angle-60)+120*invoker.sawcnt; 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; Vector3 x, y, z; [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++ ) { let s = Spawn("UTViewSmoke",origin); @@ -238,21 +248,6 @@ Class UTChainsaw : UTWeapon 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 { Tag "$T_CHAINSAW"; @@ -326,45 +321,10 @@ Class UTChainsaw : UTWeapon Fire: CSWJ A 1 A_PlaySound("chainsaw/fire",CHAN_6,looping:true); CSWJ BCDEF 1 A_Vibrate(); + Goto Hold; Hold: - CSWJ G 1 A_SawHit(); - CSWJ H 0 A_SawRefire(1); - 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"); + CSWJ GHIJKLMNOPQRS 1 A_SawHit(); + Loop; Release: CSWJ FEDCBA 1 A_Vibrate(); Goto Idle; diff --git a/zscript/dt_matrix.zsc b/zscript/dt_matrix.zsc index 3ce9ee6..685a954 100644 --- a/zscript/dt_matrix.zsc +++ b/zscript/dt_matrix.zsc @@ -105,20 +105,4 @@ Class dt_Matrix4 r.set(2,3,-1); 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; - } } diff --git a/zscript/eightball.zsc b/zscript/eightball.zsc index ca45cec..ffc84ff 100644 --- a/zscript/eightball.zsc +++ b/zscript/eightball.zsc @@ -371,7 +371,7 @@ Class UTRocketLauncher : UTWeapon Vector3 x, y, z, x2, y2, z2; double a, s; [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); Actor p; if ( weap.bAltFire ) @@ -382,7 +382,7 @@ Class UTRocketLauncher : UTWeapon a = FRandom[Eightball](0,360); s = FRandom[Eightball](0,(num>1)?12:0); 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.z += 3.5; p.target = self; @@ -391,7 +391,7 @@ Class UTRocketLauncher : UTWeapon else if ( num <= 1 ) { // 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.target = self; p.tracer = invoker.LockedTarget; @@ -404,7 +404,7 @@ Class UTRocketLauncher : UTWeapon s = (num>1)?6:0; for ( int i=0; i0)?Min(20,weap.Ammo1.Amount):20; + if ( !flak_enforcerreload && (invoker.slaveclipcount <=0) ) invoker.slaveclipcount = Min(invoker.default.slaveclipcount,weap.Ammo1.Amount); } else { 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(); UTMainHandler.DoFlash(self,Color(32,255,128,0),1); @@ -327,10 +326,10 @@ Class Enforcer : UTWeapon } Vector3 x, y, z, x2, y2, z2; [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; - if ( alt ) origin = origin-z*3.0+ydir*y*1.0; - else origin = origin-z*1.0+ydir*y*4.0; + if ( alt ) origin = level.Vec3Offset(origin,-z*3+ydir*y); + else origin = level.Vec3Offset(origin,-z+ydir*y*4); double a = FRandom[Enforcer](0,360), s = FRandom[Enforcer](0,alt?invoker.altaccuracy:0.004); [x2, y2, z2] = dt_CoordUtil.GetAxes(BulletSlope(),angle,roll); Vector3 dir = (x2+y2*cos(a)*s+z2*sin(a)*s).unit(); @@ -386,7 +385,7 @@ Class Enforcer : UTWeapon s.target = self; 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); 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() { 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 @@ -442,7 +448,10 @@ Class Enforcer : UTWeapon { invoker.slavedown = false; if ( !invoker.slaveactive && (CountInv("Enforcer") > 1) ) + { + invoker.slavereload = invoker.slaverefire = 0; A_Overlay(2,"LeftReady"); + } } ENFS ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 A_WeaponReady(WRF_NOFIRE); Idle: @@ -471,22 +480,21 @@ Class Enforcer : UTWeapon Dummy: TNT1 A 1 { - if ( (invoker.clipcount <= 0) && (invoker.Ammo1.Amount > 0) ) A_Overlay(PSP_WEAPON,"Reload"); - else if ( flak_enforcerreload && ((invoker.clipcount < min(20,invoker.Ammo1.Amount)) || (invoker.slaveclipcount < min(20,invoker.Ammo1.Amount))) ) A_WeaponReady(WRF_ALLOWRELOAD); + if ( (invoker.clipcount <= 0) && (invoker.Ammo1.Amount > 0) ) player.SetPSprite(PSP_WEAPON,ResolveState("Reload")); + 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(); - 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; LeftDummy: TNT1 A 1 { - if ( health <= 0 ) - { - 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"); + if ( flak_enforcerreload && invoker.slavereload ) player.SetPSprite(2,ResolveState("LeftReload")); + else if ( invoker.slavedown ) player.SetPSprite(2,ResolveState("LeftDeselect")); else A_LeftWeaponReady(); } Wait; @@ -543,50 +551,68 @@ Class Enforcer : UTWeapon Reload: ENFR A 0 { - invoker.slavereload = ((player.cmd.buttons&BT_RELOAD)&&invoker.slaveactive&&(invoker.slaveclipcount < min(20,invoker.Ammo1.Amount)))||(invoker.slaveclipcount <= 0); - return A_JumpIf(invoker.clipcount>=min(20,invoker.Ammo1.Amount),"Idle"); + if ( invoker.clipcount >= invoker.default.clipcount ) + { + invoker.slavereload = (invoker.slaveactive&&(invoker.slaveclipcount= invoker.default.slaveclipcount ) + { + invoker.slavereload = 0; + return ResolveState("LeftIdle"); + } + invoker.slaveclipcount = 0; A_Overlay(-9998,null); A_PlaySound("enforcer/click",CHAN_6); + return ResolveState(null); } 2NFR ABCDEFGHIJKLMNOPQRSTUVWXYZ 1; 2NR2 AB 1; 2NR2 B 30 { + invoker.slaveclipcount = min(invoker.default.slaveclipcount,invoker.Ammo1.Amount); A_PlaySound("enforcer/reload",CHAN_6); if ( self is 'UTPlayer' ) UTPlayer(self).PlayReloading(); + invoker.slavereload = false; } 2NFS A 0 A_PlaySound("enforcer/select",CHAN_6); Goto LeftReady; Deselect: - ENFI A 1 { invoker.slavedown = true; } - ENFD A 0 A_Overlay(-9999,null); - ENFD A 0 A_JumpIf(invoker.slaveactive,"Deselect"); + ENFD A 0 + { + A_Overlay(-9999,null); + invoker.slavedown = true; + } ENFD ABDEGHJK 1; - ENFD L 1 A_Lower(int.max); + ENFD L 1 + { + if ( !player.FindPSprite(2) ) + A_Lower(int.max); + } Wait; LeftDeselect: 2NFD A 0 diff --git a/zscript/flakcannon.zsc b/zscript/flakcannon.zsc index 2393f1d..4a23c0f 100644 --- a/zscript/flakcannon.zsc +++ b/zscript/flakcannon.zsc @@ -94,7 +94,7 @@ Class ChunkTrail : Actor SetState(FindState("Death")+dist); return; } - SetOrigin(target.pos+(0,0,speed),true); + SetOrigin(target.Vec3Offset(0,0,speed),true); } States { @@ -117,17 +117,18 @@ Class FlakAccumulator : Thinker override void Tick() { Super.Tick(); - bool oldxd = inflictor.bEXTREMEDEATH; int gibhealth = victim.GetGibHealth(); // おまえはもう死んでいる if ( victim.health-total <= gibhealth ) inflictor.bEXTREMEDEATH = true; // 何? + inflictor.bAMBUSH = true; for ( int i=0; i 2 ) Destroy(); } @@ -596,7 +612,7 @@ Class FlakCannon : UTWeapon Vector3 x, y, z; double a, s; [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_OverlayFlags(-2,PSPF_RENDERSTYLE|PSPF_FORCESTYLE,true); A_OverlayRenderstyle(-2,STYLE_Add); @@ -655,7 +671,7 @@ Class FlakCannon : UTWeapon Vector3 x, y, z; double a, s; [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_OverlayFlags(-2,PSPF_RENDERSTYLE|PSPF_FORCESTYLE,true); A_OverlayRenderstyle(-2,STYLE_Add); diff --git a/zscript/impacthammer.zsc b/zscript/impacthammer.zsc index bc98ea5..65e2a29 100644 --- a/zscript/impacthammer.zsc +++ b/zscript/impacthammer.zsc @@ -50,17 +50,29 @@ Class ImpactHammer : UTWeapon invoker.count = 0; invoker.FireEffect(); // intentional UT behavior } - action void A_ChargeUp( int amt = 1 ) + action void A_ChargeUp() { - invoker.chargesize += (0.75*amt)/TICRATE; - invoker.count += double(amt)/TICRATE; - if ( invoker.count > 0.2 ) + invoker.chargesize += .75/TICRATE; + invoker.count += 1./TICRATE; + if ( invoker.count > .2 ) { invoker.count = 0; 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); + 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() { @@ -72,7 +84,7 @@ Class ImpactHammer : UTWeapon 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+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); FLineTraceData 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); 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; + Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+3*y-4*z); FLineTraceData d; LineTrace(angle,120,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d); double dscale = d.Distance/120.; @@ -187,20 +199,6 @@ Class ImpactHammer : UTWeapon 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() { if ( Owner ) Owner.A_StopSound(CHAN_WEAPON); @@ -237,75 +235,55 @@ Class ImpactHammer : UTWeapon A_WeaponReady(); } Wait; + Charging: + TNT1 A 1 A_ChargeUp(); + Wait; Fire: IMPL A 0 { A_ResetCharge(); + A_Overlay(-9999,"Charging"); A_PlaySound("impact/pull",CHAN_WEAPON); } - IMPL A 5 A_ChargeUp(5); - IMPL B 0 A_ImpactRefire(1); - Goto Release; - 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); + IMPL ABCDE 5; + IMPR A 0 A_PlaySound("impact/loop",CHAN_WEAPON,looping:true); + Goto Hold; Hold: - IMPR A 1 A_ChargeUp(); - IMPR B 0 A_ImpactRefire(1); - 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; + IMPR ABCDEFGHIJ 1; + Loop; Release: IMPF A 0 { + A_Overlay(-9999,null); if ( self is 'UTPlayer' ) UTPlayer(self).PlayAttacking3(); 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; AltFire: - IMPF A 0 A_FireAltBlast(); - IMPF ABCDEFGHIJKLMNOP 1; + IMPF A 1 A_FireAltBlast(); + IMPF BCDEFGHIJKLMNOP 1; Goto Idle; Deselect: - IMPD A 0 A_StopSound(CHAN_WEAPON); - IMPD ABCDE 2; + IMPD A 2 A_StopSound(CHAN_WEAPON); + IMPD BCDE 2; IMPD E 1 A_Lower(int.max); Wait; } diff --git a/zscript/minigun.zsc b/zscript/minigun.zsc index 6785cd9..eca1419 100644 --- a/zscript/minigun.zsc +++ b/zscript/minigun.zsc @@ -56,7 +56,7 @@ Class MinigunTracer : Actor return; } 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); pitch = asin(-dir.z); roll += 60; @@ -103,7 +103,7 @@ Class Minigun : UTWeapon if ( !alt ) MinigunLight(l).cnt--; Vector3 x, y, z, x2, y2, z2; [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); [x2, y2, z2] = dt_CoordUtil.GetAxes(BulletSlope(),angle,roll); Vector3 dir = (x2+y2*cos(a)*s+z2*sin(a)*s).unit(); @@ -155,7 +155,7 @@ Class Minigun : UTWeapon } 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.pitch = asin(-dir.z); 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)); 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); c.vel = x*FRandom[Junk](-1.5,1.5)+y*FRandom[Junk](2,4)+z*FRandom[Junk](2,3); c.Scale *= 0.5; } - action void A_MinigunRefire( statelabel flash = null, bool nounwind = false ) + action void A_MinigunRefire() { Weapon weap = Weapon(invoker); if ( !weap || !player ) return; if ( weap.Ammo1.Amount <= 0 ) { - if ( nounwind ) return; A_ClearRefire(); - player.setpsprite(PSP_WEAPON,weap.FindState("Unwind")); return; } - if ( nounwind ) - { - if ( player.cmd.buttons&BT_ALTATTACK ) - { - weap.bAltFire = true; - flash = "AltFire"; - } - else - { - weap.bAltFire = false; - flash = "Fire"; - } - } - A_Refire(flash); + weap.bAltFire = !!(player.cmd.buttons&BT_ALTATTACK); + A_Refire("Hold"); } Default @@ -237,141 +223,38 @@ Class Minigun : UTWeapon A_WeaponReady(); } 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: AltFire: MGNI A 3 { invoker.bcnt = 5; } 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 { - if ( invoker.bAltFire ) A_MinigunRefire(1); - else A_MinigunRefire("Hold"); + A_PlaySound("minigun/fire",CHAN_WEAPON,1.0,true); + A_Overlay(-9999,"FireDummy"); } - Goto Unwind; + MGNF ABCDEFGHIJKLMNOPQRS 1 A_FireBullet(); + MGNF A 0 A_JumpIf(invoker.bAltFire,1); + Goto Hold+1; AltHold: - MGNF A 1 - { - A_PlaySound("minigun/altfire",CHAN_WEAPON,1.0,true); - 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; + MGNF B 0 A_PlaySound("minigun/altfire",CHAN_WEAPON,1.0,true); + MGNF ADGJMPSCFILORBEHKNQ 1 A_FireBullet(true); + Goto AltHold+1; Unwind: MGNU A 0 A_PlaySound("minigun/unwind",CHAN_WEAPON); - MGNU ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 A_MinigunRefire(null,true); - MGU2 ABCDEFGHIJKLM 1 A_MinigunRefire(null,true); + MGNU ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 A_MinigunRefire(); + MGU2 ABCDEFGHIJKLM 1 A_MinigunRefire(); Goto Idle; Deselect: MGND A 1 A_StopSound(CHAN_WEAPON); @@ -379,25 +262,11 @@ Class Minigun : UTWeapon MGND J 1 A_Lower(int.max); Wait; MuzzleFlash: - TNT1 A 0 A_Jump(256,1,2,3,4,5,6,7,8,9); - Stop; - MMUZ A 2 Bright; - Stop; - 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; + MMUZ # 2 Bright + { + let psp = player.FindPSprite(OverlayID()); + psp.frame = Random[Minigun](0,8); + } Stop; } } diff --git a/zscript/powerups.zsc b/zscript/powerups.zsc index 1a56ee3..781bcae 100644 --- a/zscript/powerups.zsc +++ b/zscript/powerups.zsc @@ -47,6 +47,7 @@ Class DamageAmpLight : DynamicLight Class DamageAmplifier : Powerup { Actor l; + int lasteffect; Default { @@ -63,6 +64,7 @@ Class DamageAmplifier : Powerup override void InitEffect() { Super.InitEffect(); + lasteffect = int.min; l = Spawn("DamageAmpLight",Owner.pos); l.target = Owner; l.master = self; @@ -88,9 +90,11 @@ Class DamageAmplifier : Powerup void FireEffect() { + if ( gametic < lasteffect ) return; 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); - 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 ) @@ -480,7 +484,7 @@ Class mkLight : DynamicLight Destroy(); 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); A_SetAngle(target.angle,SPF_INTERPOLATE); A_SetPitch(target.pitch,SPF_INTERPOLATE); diff --git a/zscript/pulsegun.zsc b/zscript/pulsegun.zsc index db30370..3bdd9b7 100644 --- a/zscript/pulsegun.zsc +++ b/zscript/pulsegun.zsc @@ -88,8 +88,8 @@ Class ViewPulseSpark : PulseSpark } Vector3 x, y, z; [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); - SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true); + Vector3 origin = level.Vec3Offset(target.Vec2OffsetZ(0,0,target.player.viewz),x*ofs.x+y*ofs.y+z*ofs.z); + SetOrigin(origin,true); bInvisible = (players[consoleplayer].camera != target); if ( isFrozen() ) return; ofs += vvel; @@ -470,7 +470,7 @@ Class PulseBolt : Actor { bRELATIVETOFLOOR = parent.bRELATIVETOFLOOR; 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_SetPitch(parent.pitch); CheckBeam(x); @@ -514,7 +514,7 @@ Class StarterBolt : PulseBolt if ( target.player ) { [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); SetOrigin(origin,true); @@ -535,28 +535,31 @@ Class PulseGun : UTWeapon 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() { Weapon weap = Weapon(invoker); 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; 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(); 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(); Vector3 x, y, z; [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++ ) { 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)); } } - action void A_PulseRefire( statelabel flash = null, bool noreload = false ) + action void A_PulseRefire() { Weapon weap = Weapon(invoker); if ( !weap || !player ) return; 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; - } - if ( noreload ) + if ( player.cmd.buttons&BT_ALTATTACK ) { - if ( player.cmd.buttons&BT_ALTATTACK ) - { - weap.bAltFire = true; - flash = "AltFire"; - } - else - { - weap.bAltFire = false; - flash = "Fire"; - } + weap.bAltFire = true; + player.SetPSprite(PSP_WEAPON,ResolveState("AltHold")); + } + else if ( player.cmd.buttons&BT_ATTACK ) + { + weap.bAltFire = false; + player.SetPSprite(PSP_WEAPON,ResolveState("Fire")); } - A_Refire(flash); } action void A_PulseFire() { Weapon weap = Weapon(invoker); 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; invoker.clipcount--; 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; double a; [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; - origin += y*cos(invoker.sangle)*2.0+z*sin(invoker.sangle)*2.0; + Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+3*y-1.8*z); + origin = level.Vec3Offset(origin,y*cos(invoker.sangle)*2+z*sin(invoker.sangle)*2); invoker.sangle += 100; Actor p = Spawn("PulseBall",origin); p.angle = angle; @@ -633,7 +636,7 @@ Class PulseGun : UTWeapon for ( int i=0; i<8; i++ ) { 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.target = self; s.SetShade("206010"); @@ -644,17 +647,18 @@ Class PulseGun : UTWeapon for ( int i=0; i 0) ) return A_Jump(255,"Reload"); + if ( (invoker.clipcount <= 0) && (invoker.Ammo1.Amount > 0) ) return ResolveState("Reload"); A_WeaponReady(WRF_ALLOWRELOAD); } else A_WeaponReady(); @@ -720,89 +726,61 @@ Class PulseGun : UTWeapon PGNI ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 { 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; Fire: - PGNI A 0 A_PlaySound("pulse/fire",CHAN_WEAPON,1.0,true); - Hold: - PGNF A 1 A_PulseFire(); - PGNF BCDEF 1; - PNGF G 0 A_PulseRefire(1); - Goto Release; - PGNF G 1 A_PulseFire(); - PGNF HIJKL 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; + PGNI A 0 + { + invoker.special1 = 0; + A_PlaySound("pulse/fire",CHAN_WEAPON,1.0,true); + } + PGNF ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 A_PulseFire(); + PGF2 ABCDEFGHIJKLMN 1 A_PulseFire(); + Goto Fire+1; Release: PGNC A 0 A_PlaySound("pulse/down",CHAN_WEAPON); - PGNC ABCDEFGHIJKLMNOPQRSTUVWXY 1 A_PulseRefire(null,true); + PGNC ABCDEFGHIJKLMNOPQRSTUVWXY 1 A_PulseRefire(); PGNC Y 0; Goto Idle; AltFire: PGBS ABCDE 1; - PGBL A 0 A_StartBeam(); + Goto AltHold; AltHold: - PGBL A 1 A_DrainAmmo(); - PGBL B 0 A_PulseRefire(1); - Goto AltRelease; - 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(); + PGBL A 0 A_StartBeam(); + PGBL ABCDEFGHIJ 1 A_DrainAmmo(); + Goto AltHold+1; AltRelease: PGBE A 0 A_StopBeam(); - PGBE ABCDE 1 A_PulseRefire(null,true); + PGBE ABCDE 1 A_PulseRefire(); Goto Idle; Reload: 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 { - A_Reloading(); + A_PlaySound("pulse/reload",CHAN_WEAPON); if ( self is 'UTPlayer' ) UTPlayer(self).PlayReloading(); } - PGNR BCDEFGHIJKLMNOPQRSTUVWXYZ 1; - PGR2 ABCDEFGHIJKLMNOPQRSTUVWX 1; + PGNR BCDEFGHIJKLMNO 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; Deselect: PGNS W 1 A_StopSound(CHAN_WEAPON); diff --git a/zscript/ripper.zsc b/zscript/ripper.zsc index fcb3fdf..a427487 100644 --- a/zscript/ripper.zsc +++ b/zscript/ripper.zsc @@ -261,7 +261,7 @@ Class Ripper2 : UTWeapon } Vector3 x, y, z; [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; if ( alt ) p = Spawn("Razor2Alt",origin); else p = Spawn("Razor2",origin); diff --git a/zscript/shockrifle.zsc b/zscript/shockrifle.zsc index ed88756..388f6ed 100644 --- a/zscript/shockrifle.zsc +++ b/zscript/shockrifle.zsc @@ -1032,8 +1032,8 @@ Class ViewShockSpark : ShockSpark } Vector3 x, y, z; [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); - SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true); + Vector3 origin = level.Vec3Offset(target.Vec2OffsetZ(0,0,target.player.viewz),x*ofs.x+y*ofs.y+z*ofs.z); + SetOrigin(origin,true); bInvisible = (players[consoleplayer].camera != target); if ( isFrozen() ) return; ofs += vvel; @@ -1066,7 +1066,7 @@ Class ShockRifle : UTWeapon A_QuakeEx(2,2,2,4,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1); Vector3 x, y, z; [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); p.angle = angle; 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); Vector3 x, y, z; [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); p.angle = angle; 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); Vector3 x, y, z; [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); p.angle = angle; 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); Vector3 x, y, z; [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); p.angle = angle; p.pitch = BulletSlope(); diff --git a/zscript/sniperrifle.zsc b/zscript/sniperrifle.zsc index 6391574..3e292dc 100644 --- a/zscript/sniperrifle.zsc +++ b/zscript/sniperrifle.zsc @@ -57,15 +57,20 @@ Class SniperRifle : UTWeapon } 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); 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); } - override void Tick() + override void RenderOverlay( RenderEvent e ) { - Super.Tick(); - if ( !Owner ) return; + PlayerInfo p = players[consoleplayer]; + 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; else crosshair = 0; } @@ -98,8 +103,8 @@ Class SniperRifle : UTWeapon l.target = self; Vector3 x, y, z; [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); - Vector3 origin = Vec2OffsetZ(0,0,player.viewz)+10.0*x; - if ( !zoomed ) origin = origin+y*4.0-z*2.0; + Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x); + if ( !zoomed ) origin = level.Vec3Offset(origin,y*4-z*2); FLineTraceData d; LineTrace(angle,10000,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d); if ( d.HitType == TRACE_HitActor ) @@ -161,7 +166,7 @@ Class SniperRifle : UTWeapon s.scale *= 1.8; 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); c.scale *= 1.25; 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); Goto ZoomedIdle; 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: TNT1 A 1 { @@ -256,7 +272,12 @@ Class SniperRifle : UTWeapon SRFI A 0 A_Refire("AltHold2"); Goto Idle; 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 G 1 A_Lower(int.max); Wait; diff --git a/zscript/translocator.zsc b/zscript/translocator.zsc index 01cd5b9..945eb2a 100644 --- a/zscript/translocator.zsc +++ b/zscript/translocator.zsc @@ -333,7 +333,7 @@ Class Translocator : UTWeapon 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-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); p.target = self; p.angle = angle; diff --git a/zscript/utcommon.zsc b/zscript/utcommon.zsc index 23d7584..78a5817 100644 --- a/zscript/utcommon.zsc +++ b/zscript/utcommon.zsc @@ -1592,8 +1592,8 @@ Class UTViewSpark : UTSpark } Vector3 x, y, z; [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); - SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true); + Vector3 origin = level.Vec3Offset(target.Vec2OffsetZ(0,0,target.player.viewz),x*ofs.x+y*ofs.y+z*ofs.z); + SetOrigin(origin,true); bInvisible = (players[consoleplayer].camera != target); if ( isFrozen() ) return; ofs += vvel; @@ -1837,8 +1837,8 @@ Class UTViewSmoke : UTSmoke } Vector3 x, y, z; [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); - SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true); + Vector3 origin = level.Vec3Offset(target.Vec2OffsetZ(0,0,target.player.viewz),x*ofs.x+y*ofs.y+z*ofs.z); + SetOrigin(origin,true); bInvisible = (players[consoleplayer].camera != target); if ( isFrozen() ) return; ofs += vvel; diff --git a/zscript/uthud.zsc b/zscript/uthud.zsc index 2d9dfd3..e6ed728 100644 --- a/zscript/uthud.zsc +++ b/zscript/uthud.zsc @@ -342,7 +342,7 @@ Class UTHud : BaseStatusBar else if ( flak_enforcerreload && (cw is 'Enforcer') ) { // draw clip(s) - double ch = Enforcer(cw).ClipCount/20.; + double ch = Enforcer(cw).ClipCount/double(Enforcer(cw).default.ClipCount); CurX = BaseX+6*hudsize*HScale; CurY = BaseY+53*hudsize*HScale; 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); if ( cw.Amount > 1 ) { - ch = Enforcer(cw).SlaveClipCount/20.; + ch = Enforcer(cw).SlaveClipCount/double(Enforcer(cw).default.SlaveClipCount); CurY += 3*hudsize*HScale; ss = (0.54,0.125)*hudsize*HScale; dw = (Screen.GetWidth()/ss.x); @@ -369,7 +369,7 @@ Class UTHud : BaseStatusBar else if ( flak_pulsereload && (cw is 'Pulsegun') ) { // draw clip - double ch = Pulsegun(cw).ClipCount/50.; + double ch = Pulsegun(cw).ClipCount/double(Pulsegun(cw).default.ClipCount); CurX = BaseX+6*hudsize*HScale; CurY = BaseY+53*hudsize*HScale; Vector2 ss = (0.54,0.3)*hudsize*HScale; diff --git a/zscript/warheadlauncher.zsc b/zscript/warheadlauncher.zsc index 5adf6b6..ca5c806 100644 --- a/zscript/warheadlauncher.zsc +++ b/zscript/warheadlauncher.zsc @@ -140,7 +140,7 @@ Class WarheadHitbox : Actor Destroy(); return; } - SetOrigin(target.pos-(0,0,height*0.5),true); + SetOrigin(target.Vec3Offset(0,0,-height*0.5),true); } States { @@ -175,7 +175,7 @@ Class WarheadLight : DynamicLight return; } 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; } } @@ -649,7 +649,7 @@ Class WarheadLauncher : UTWeapon Vector3 x, y, z; [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); 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); p.angle = angle; p.pitch = BulletSlope(); @@ -663,7 +663,7 @@ Class WarheadLauncher : UTWeapon Vector3 x, y, z; [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); 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); for ( int i=0; i