diff --git a/Readme.md b/Readme.md index 0bb4412..2a63c19 100644 --- a/Readme.md +++ b/Readme.md @@ -49,6 +49,8 @@ This mod requires GZDoom 4.0.0 or later. toggled) - UT-like weapon dropping style - UT player classes (sound only, no models yet) + - Heretic compatibility + - Spanish localization ## In progress @@ -56,8 +58,12 @@ This mod requires GZDoom 4.0.0 or later. - Add some more effects - Lava/Slime footstep sounds? - UT gore system (toggleable) - - Heretic compatibility - - Localization in all languages supported by the original game + - French localization + - Italian localization + +## Ideas + + - Chainsaw balancing (maybe give it ammo?) ## Future plans @@ -74,6 +80,7 @@ This mod requires GZDoom 4.0.0 or later. - Port some of my UT weapon mods (and maybe also some of my personal faves by others, such as Psi Weapon Dreams) - Hexen compatibility ??? + - Relics? ## Known bugs diff --git a/graphics/hud/HFlash.png b/graphics/hud/HFlash.png index 64c5186..9f5193d 100644 Binary files a/graphics/hud/HFlash.png and b/graphics/hud/HFlash.png differ diff --git a/graphics/hud/IFlash.png b/graphics/hud/IFlash.png new file mode 100644 index 0000000..8604630 Binary files /dev/null and b/graphics/hud/IFlash.png differ diff --git a/graphics/hud/IconRip.png b/graphics/hud/IconRip.png index f8fb388..d764493 100644 Binary files a/graphics/hud/IconRip.png and b/graphics/hud/IconRip.png differ diff --git a/graphics/hud/ItemBelt.png b/graphics/hud/ItemBelt.png new file mode 100644 index 0000000..1f32ca3 Binary files /dev/null and b/graphics/hud/ItemBelt.png differ diff --git a/graphics/hud/ItemBoot.png b/graphics/hud/ItemBoot.png new file mode 100644 index 0000000..fdc67f3 Binary files /dev/null and b/graphics/hud/ItemBoot.png differ diff --git a/graphics/hud/ItemBox.png b/graphics/hud/ItemBox.png new file mode 100644 index 0000000..4e562da Binary files /dev/null and b/graphics/hud/ItemBox.png differ diff --git a/graphics/hud/ItemHbox.png b/graphics/hud/ItemHbox.png new file mode 100644 index 0000000..f8087aa Binary files /dev/null and b/graphics/hud/ItemHbox.png differ diff --git a/graphics/hud/ItemHbxb.png b/graphics/hud/ItemHbxb.png new file mode 100644 index 0000000..ce07f1a Binary files /dev/null and b/graphics/hud/ItemHbxb.png differ diff --git a/graphics/hud/ItemInvs.png b/graphics/hud/ItemInvs.png new file mode 100644 index 0000000..2518ef8 Binary files /dev/null and b/graphics/hud/ItemInvs.png differ diff --git a/graphics/hud/ItemLite.png b/graphics/hud/ItemLite.png new file mode 100644 index 0000000..15b082e Binary files /dev/null and b/graphics/hud/ItemLite.png differ diff --git a/graphics/hud/ItemMbox.png b/graphics/hud/ItemMbox.png new file mode 100644 index 0000000..0727518 Binary files /dev/null and b/graphics/hud/ItemMbox.png differ diff --git a/graphics/hud/ItemUdmg.png b/graphics/hud/ItemUdmg.png new file mode 100644 index 0000000..1860c73 Binary files /dev/null and b/graphics/hud/ItemUdmg.png differ diff --git a/graphics/hud/ItmArrw1.png b/graphics/hud/ItmArrw1.png new file mode 100644 index 0000000..2fdfd79 Binary files /dev/null and b/graphics/hud/ItmArrw1.png differ diff --git a/graphics/hud/ItmArrw2.png b/graphics/hud/ItmArrw2.png new file mode 100644 index 0000000..51e99d1 Binary files /dev/null and b/graphics/hud/ItmArrw2.png differ diff --git a/graphics/hud/ItmSel.png b/graphics/hud/ItmSel.png new file mode 100644 index 0000000..463b957 Binary files /dev/null and b/graphics/hud/ItmSel.png differ diff --git a/graphics/hud/ManArmo.png b/graphics/hud/ManArmo.png index bef822f..f0dc46c 100644 Binary files a/graphics/hud/ManArmo.png and b/graphics/hud/ManArmo.png differ diff --git a/graphics/hud/UseTrn2.png b/graphics/hud/UseTrn2.png index dbb8868..195c010 100644 Binary files a/graphics/hud/UseTrn2.png and b/graphics/hud/UseTrn2.png differ diff --git a/graphics/hud/WomanArm.png b/graphics/hud/WomanArm.png index 0062baa..5eed79e 100644 Binary files a/graphics/hud/WomanArm.png and b/graphics/hud/WomanArm.png differ diff --git a/graphics/hud/WomanBlt.png b/graphics/hud/WomanBlt.png index 6b548e5..2524087 100644 Binary files a/graphics/hud/WomanBlt.png and b/graphics/hud/WomanBlt.png differ diff --git a/modeldef.misc b/modeldef.misc index adcdfa1..d917b22 100644 --- a/modeldef.misc +++ b/modeldef.misc @@ -58,6 +58,20 @@ Model "UTHealthPack" FrameIndex HBOX A 0 0 } +Model "ActHealthPack" +{ + Path "models" + Model 0 "hbox_d.3d" + // indices start at 1 for this mesh + SurfaceSkin 0 1 "jhbox1.png" + SurfaceSkin 0 2 "fizzfull" + Scale 0.2 0.24 0.2 + RollOffset -90 + ZOffset 16 + + FrameIndex HBOX A 0 0 +} + Model "UTHealthBox" { Path "models" @@ -72,6 +86,20 @@ Model "UTHealthBox" FrameIndex HBOX B 0 0 } +Model "ActHealthBox" +{ + Path "models" + Model 0 "hboxbeta_d.3d" + // indices start at 1 for this mesh + SurfaceSkin 0 1 "jhboxbeta1.png" + SurfaceSkin 0 2 "fizzside" + SurfaceSkin 0 3 "fizzfull" + Scale 0.08 0.08 0.096 + ZOffset 4 + + FrameIndex HBOX B 0 0 +} + Model "UTMedBox" { Path "models" @@ -85,6 +113,19 @@ Model "UTMedBox" FrameIndex HBOX C 0 0 } +Model "ActMedBox" +{ + Path "models" + Model 0 "MedBox_d.3d" + // indices start at 1 for this mesh + SurfaceSkin 0 1 "JMedBox1.png" + SurfaceSkin 0 2 "fizzfull" + Scale 0.06 0.06 0.072 + ZOffset 5 + + FrameIndex HBOX C 0 0 +} + Model "UTHealthBonus" { Path "models" @@ -147,6 +188,18 @@ Model "UTShieldBelt" FrameIndex BELT A 0 0 } +Model "ActShieldBelt" +{ + Path "models" + Model 0 "ShieldBeltMeshM_d.3d" + Skin 0 "AUbelt1.png" + Scale 0.1 0.1 0.12 + AngleOffset -90 + ZOffset 4 + + FrameIndex BELT A 0 0 +} + Model "UDamage" { Path "models" @@ -159,6 +212,18 @@ Model "UDamage" FrameIndex UDAM A 0 0 } +Model "ActUDamage" +{ + Path "models" + Model 0 "UDamage_d.3d" + Skin 0 "GoldSkin2.png" + Scale 0.16 0.16 0.192 + ZOffset 24 + ROTATING + + FrameIndex UDAM A 0 0 +} + Model "UTRedSkull" { Path "models" @@ -300,6 +365,18 @@ Model "UTInvisibilityX" FrameIndex INVS A 0 0 } +Model "ActInvisibility" +{ + Path "models" + Model 0 "invis2M_d.3d" + // indices start at 1 for this mesh + SurfaceSkin 0 1 "jinvis.png" + Scale 0.1 0.1 0.12 + ZOffset 9 + + FrameIndex INVS A 0 0 +} + Model "UTMapRevealer" { Path "models" @@ -322,6 +399,17 @@ Model "UTJumpBoots" FrameIndex JBUT A 0 0 } +Model "ActJumpBoots" +{ + Path "models" + Model 0 "jboot_d.3d" + Skin 0 "Jlboot2.png" + Scale 0.09 0.09 0.108 + ZOffset 7 + + FrameIndex JBUT A 0 0 +} + Model "Searchlight" { Path "models" @@ -334,6 +422,18 @@ Model "Searchlight" FrameIndex SLIT A 0 0 } +Model "ActSearchlight" +{ + Path "models" + Model 0 "BigFlash_d.3d" + Skin 0 "JBigFlash1.png" + Scale 0.07 0.07 0.084 + AngleOffset -90 + ZOffset 9 + + FrameIndex SLIT A 0 0 +} + Model "UTChip" { Path "models" diff --git a/sndinfo.txt b/sndinfo.txt index 695cf30..7882490 100644 --- a/sndinfo.txt +++ b/sndinfo.txt @@ -193,6 +193,7 @@ udamage/fire1 ampfire udamage/fire2 ampfire2 udamage/drain ampout trans/pickup voicesnd +lite/pickup fshlite1 misc/gibbed1 gib1 misc/gibbed2 gib2 misc/gibbed3 gib3 diff --git a/sounds/FSHLITE1.ogg b/sounds/FSHLITE1.ogg new file mode 100644 index 0000000..0a88291 Binary files /dev/null and b/sounds/FSHLITE1.ogg differ diff --git a/zscript/biorifle.zsc b/zscript/biorifle.zsc index d4a4be4..c209851 100644 --- a/zscript/biorifle.zsc +++ b/zscript/biorifle.zsc @@ -138,6 +138,7 @@ Class BioLight : DynamicLight Destroy(); return; } + SetOrigin(target.pos,true); args[LIGHT_INTENSITY] = int(8*target.Scale.x); } } @@ -657,7 +658,7 @@ Class BioRifle : UTWeapon else A_QuakeEx(1,1,1,5,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.05); Vector3 x, y, z; double a, s; - [x, y, z] = dt_Matrix4.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; Actor p; if ( alt ) @@ -686,6 +687,7 @@ Class BioRifle : UTWeapon s.A_SetRenderStyle(0.5,STYLE_AddShaded); UTViewSmoke(s).vvel += (FRandom[GES](0.8,1.6),FRandom[GES](-0.5,0.5),FRandom[GES](-0.5,0.5)); } + invoker.charge = 0; } action void A_BeginCharge() { @@ -736,6 +738,7 @@ Class BioRifle : UTWeapon Idle: BIOI A 1 { + invoker.charge = 0; invoker.bCharging = false; A_CheckReload(); A_WeaponReady(); diff --git a/zscript/chainsaw.zsc b/zscript/chainsaw.zsc index cd63a15..ac1a2da 100644 --- a/zscript/chainsaw.zsc +++ b/zscript/chainsaw.zsc @@ -53,7 +53,7 @@ Class UTChainsaw : UTWeapon invoker.FireEffect(); A_AlertMonsters(); Vector3 x, y, z; - [x, y, z] = dt_Matrix4.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*z; FLineTraceData d; LineTrace(angle,90,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d); @@ -91,7 +91,7 @@ Class UTChainsaw : UTWeapon if ( initial ) invoker.FireEffect(); A_AlertMonsters(); Vector3 x, y, z; - [x, y, z] = dt_Matrix4.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; FLineTraceData d; double ang = (angle-60)+120*invoker.sawcnt; @@ -141,7 +141,7 @@ Class UTChainsaw : UTWeapon UTMainHandler.DoSwing(self,(FRandom[Chainsaw](-1,1),FRandom[Chainsaw](-1,1)),0.25,-0.1,2,SWING_Spring); if ( bAlt || Random[Chainsaw](0,2) ) return; Vector3 x, y, z; - [x, y, z] = dt_Matrix4.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; for ( int i=0; i<5; i++ ) { diff --git a/zscript/compat.zsc b/zscript/compat.zsc index ef72c6b..f2ece86 100644 --- a/zscript/compat.zsc +++ b/zscript/compat.zsc @@ -47,12 +47,135 @@ Class UTHereticBlueKey : KeyBlue } } -// TODO Base class for items that can be activated from the inventory bar +// Base class for items that can be activated from the inventory bar Class UTActivatable : Inventory { + Class GiveItem; + + Property GiveItem: GiveItem; + + override bool Use( bool pickup ) + { + if ( !Owner ) return true; + let i = GetDefaultByType(GiveItem); + if ( Owner.GiveInventory(GiveItem,i.Amount) ) + { + Owner.A_PlaySound(i.PickupSound,CHAN_ITEM); + return true; + } + return false; + } + Default { +INVENTORY.INVBAR; + Inventory.DefMaxAmount; + Inventory.PickupSound "misc/p_pkup"; + Inventory.UseSound ""; + } +} + +Class ActUDamage : UTActivatable +{ + Default + { + Tag "$T_UDAMAGE"; + Inventory.Icon "ItemUdmg"; + Inventory.PickupMessage "$I_UDAMAGE"; + +COUNTITEM; + +INVENTORY.BIGPOWERUP; + UTActivatable.GiveItem "UDamage"; + Inventory.RespawnTics 4200; + } + States + { + Spawn: + UDAM A -1; + Stop; + } +} + +Class ActShieldBelt : UTActivatable +{ + Default + { + Tag "$T_SHIELDBELT"; + Inventory.Icon "ItemBelt"; + Inventory.PickupMessage "$I_SHIELDBELT"; + +COUNTITEM; + +INVENTORY.BIGPOWERUP; + UTActivatable.GiveItem "UTShieldBelt"; + Inventory.RespawnTics 2100; + } + States + { + Spawn: + BELT A -1; + Stop; + } +} + +Class ActInvisibility : UTActivatable +{ + Default + { + Tag "$T_INVISIBILITY"; + Inventory.Icon "ItemInvs"; + Inventory.PickupMessage "$I_INVISIBILITY"; + +COUNTITEM; + +INVENTORY.BIGPOWERUP; + UTActivatable.GiveItem "UTInvisibility"; + Inventory.RespawnTics 4200; + } + override void PostBeginPlay() + { + Super.PostBeginPlay(); + tracer = Spawn("UTInvisibilityX",pos); + tracer.angle = angle; + tracer.target = self; + } + States + { + Spawn: + INVS A -1; + Stop; + } +} + +Class ActJumpBoots : UTActivatable +{ + Default + { + Tag "$T_JUMPBOOTS"; + Inventory.Icon "ItemBoot"; + Inventory.PickupMessage "$I_JUMPBOOTS"; + UTActivatable.GiveItem "UTJumpBoots"; + Inventory.RespawnTics 1050; + } + States + { + Spawn: + JBUT A -1; + Stop; + } +} + +Class ActSearchlight : UTActivatable +{ + Default + { + Tag "$T_SEARCHLIGHT"; + Inventory.Icon "ItemLite"; + Inventory.PickupMessage "$I_SEARCHLIGHT"; + +COUNTITEM; + UTActivatable.GiveItem "Searchlight"; + Inventory.RespawnTics 1050; + } + States + { + Spawn: + SLIT A -1; + Stop; } } @@ -61,6 +184,71 @@ Class UTActivatableHealth : HealthPickup { Default { + +INVENTORY.INVBAR; + Inventory.DefMaxAmount; + Inventory.PickupSound "misc/p_pkup"; + Inventory.UseSound "misc/ut_heal"; + HealthPickup.Autouse 1; + } +} + +Class ActHealthPack : UTActivatableHealth +{ + Default + { + Tag "$T_SUPERHEALTH"; + Inventory.Icon "ItemHbox"; + Inventory.PickupMessage "$I_SUPERHEALTH"; + +COUNTITEM; + Health 100; + Inventory.UseSound "misc/ut_keg"; + Inventory.RespawnTics 3500; + HealthPickup.Autouse 2; + } + override bool Use( bool pickup ) + { + return Owner.GiveBody(health,200); + } + States + { + Spawn: + HBOX A -1; + Stop; + } +} + +Class ActHealthBox : UTActivatableHealth +{ + Default + { + Tag "$T_HEALTHBOX"; + Inventory.Icon "ItemHbxb"; + Inventory.PickupMessage "$I_HEALTHBOX"; + Health 50; + } + States + { + Spawn: + HBOX B -1; + Stop; + } +} + +Class ActMedBox : UTActivatableHealth +{ + Default + { + Tag "$T_MEDBOX"; + Inventory.Icon "ItemMbox"; + Inventory.PickupMessage "$I_MEDBOX"; + Health 20; + Inventory.RespawnTics 700; + } + States + { + Spawn: + HBOX C -1; + Stop; } } diff --git a/zscript/dt_coordutil.zsc b/zscript/dt_coordutil.zsc index 709a425..8b40d72 100644 --- a/zscript/dt_coordutil.zsc +++ b/zscript/dt_coordutil.zsc @@ -69,4 +69,68 @@ Class dt_CoordUtil } else return ((screenpos.x+1)*Screen.getWidth(),(-screenpos.y+1)*Screen.getHeight())*0.5, (screenpos.z<=1.0); } + + // In Tim Sweeney's own words: "transform by a pitch-yaw-roll rotation" + static Vector3, Vector3, Vector3 GetUnAxes( 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 + Vector3 a, b, c; + // pitch and roll in gzdoom work in reverse compared to UE + pitch = -pitch; + roll = -roll; + // yaw + a = (cos(yaw),sin(yaw),0); + b = (-sin(yaw),cos(yaw),0); + c = (0,0,1); + x = (x dot a, x dot b, x dot c); + y = (y dot a, y dot b, y dot c); + z = (z dot a, z dot b, z dot c); + // pitch + a = (cos(pitch),0,sin(pitch)); + b = (0,1,0); + c = (-sin(pitch),0,cos(pitch)); + x = (x dot a, x dot b, x dot c); + y = (y dot a, y dot b, y dot c); + z = (z dot a, z dot b, z dot c); + // roll + a = (1,0,0); + b = (0,cos(roll),-sin(roll)); + c = (0,sin(roll),cos(roll)); + x = (x dot a, x dot b, x dot c); + y = (y dot a, y dot b, y dot c); + z = (z dot a, z dot b, z dot c); + return x, y, z; + } + + // In Tim Sweeney's own words: "detransform by a pitch-yaw-roll rotation" + 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 + Vector3 a, b, c; + // pitch and roll in gzdoom work in reverse compared to UE + pitch = -pitch; + roll = -roll; + // inverse roll + a = (1,0,0); + b = (0,cos(roll),sin(roll)); + c = (0,-sin(roll),cos(roll)); + x = (x dot a, x dot b, x dot c); + y = (y dot a, y dot b, y dot c); + z = (z dot a, z dot b, z dot c); + // inverse pitch + a = (cos(pitch),0,-sin(pitch)); + b = (0,1,0); + c = (sin(pitch),0,cos(pitch)); + x = (x dot a, x dot b, x dot c); + y = (y dot a, y dot b, y dot c); + z = (z dot a, z dot b, z dot c); + // inverse yaw + a = (cos(yaw),-sin(yaw),0); + b = (sin(yaw),cos(yaw),0); + c = (0,0,1); + x = (x dot a, x dot b, x dot c); + y = (y dot a, y dot b, y dot c); + z = (z dot a, z dot b, z dot c); + return x, y, z; + } } diff --git a/zscript/dt_matrix.zsc b/zscript/dt_matrix.zsc index 7a15095..3ce9ee6 100644 --- a/zscript/dt_matrix.zsc +++ b/zscript/dt_matrix.zsc @@ -106,7 +106,8 @@ Class dt_Matrix4 return r; } - // UE-like axes from rotation + // [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 diff --git a/zscript/eightball.zsc b/zscript/eightball.zsc index a096afb..2aa3a03 100644 --- a/zscript/eightball.zsc +++ b/zscript/eightball.zsc @@ -337,6 +337,7 @@ Class UTRocketLauncher : UTWeapon invoker.LockedOn = false; } if ( checktarget && !weap.bAltFire ) A_CheckTarget(); + invoker.special1++; } // refire that is ignored if there's no ammo @@ -353,6 +354,7 @@ Class UTRocketLauncher : UTWeapon { Weapon weap = Weapon(invoker); if ( !weap ) return; + invoker.special1 = 0; if ( weap.bAltFire ) A_PlaySound("utrl/altfire",CHAN_WEAPON); else A_PlaySound("utrl/fire",CHAN_WEAPON); invoker.FireEffect(); @@ -363,9 +365,9 @@ Class UTRocketLauncher : UTWeapon UTMainHandler.DoSwing(self,(FRandom[Eightball](0.4,-0.8),FRandom[Eightball](-0.5,0.5)),1,-0.2,Random[Eightball](3,4),SWING_Spring,Random[Eightball](2,5),Random[Eightball](2,4)); Vector3 x, y, z, x2, y2, z2; double a, s; - [x, y, z] = dt_Matrix4.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; - [x2, y2, z2] = dt_Matrix4.GetAxes(BulletSlope(),angle,roll); + [x2, y2, z2] = dt_CoordUtil.GetAxes(BulletSlope(),angle,roll); Actor p; if ( weap.bAltFire ) { @@ -490,6 +492,7 @@ Class UTRocketLauncher : UTWeapon EBLI A 1 { invoker.locktics = 0; + invoker.special1 = 0; A_CheckReload(); A_WeaponReady(WRF_ALLOWRELOAD); } diff --git a/zscript/enforcer.zsc b/zscript/enforcer.zsc index be00ece..5f05fb8 100644 --- a/zscript/enforcer.zsc +++ b/zscript/enforcer.zsc @@ -175,14 +175,6 @@ Class Enforcer : UTWeapon property ClipCount : ClipCount; property SlaveClipCount : SlaveClipCount; - override void PostRender( double lbottom ) - { - if ( !flak_enforcerreload ) return; - if ( !usmf ) usmf = Font.GetFont('USMALLFONT'); - if ( Amount > 1 ) Screen.DrawText(usmf,Font.FindFontColor('UGreen'),Screen.GetWidth()*0.01,lbottom-Screen.GetHeight()*0.01-usmf.GetHeight()*2,String.Format("%s: %2d / 20\n%s: %2d / 20",StringTable.Localize("$M_LCLIP"),slaveclipcount,StringTable.Localize("$M_RCLIP"),clipcount)); - else Screen.DrawText(usmf,Font.FindFontColor('UGreen'),Screen.GetWidth()*0.01,lbottom-Screen.GetHeight()*0.01-usmf.GetHeight(),String.Format("%s: %2d / 20",StringTable.Localize("$M_CLIP"),clipcount)); - } - override bool HandlePickup( Inventory item ) { if ( item.GetClass() == GetClass() ) @@ -324,14 +316,14 @@ Class Enforcer : UTWeapon UTMainHandler.DoSwing(self,(FRandom[Enforcer](-0.2,-0.5),FRandom[Enforcer](-0.3,0.2)),2,0,1,SWING_Spring,0,2); } Vector3 x, y, z, x2, y2, z2; - [x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll); + [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); Vector3 origin = pos+(0,0,player.viewheight)+10.0*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; double a = FRandom[Enforcer](0,360), s = FRandom[Enforcer](0,alt?0.08:0.004); if ( invoker.SlaveActive ) s *= 3; - [x2, y2, z2] = dt_Matrix4.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(); FLineTraceData d; LineTrace(atan2(dir.y,dir.x),10000,asin(-dir.z),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d); diff --git a/zscript/flakcannon.zsc b/zscript/flakcannon.zsc index 7514a7d..b1642c6 100644 --- a/zscript/flakcannon.zsc +++ b/zscript/flakcannon.zsc @@ -55,6 +55,7 @@ Class ChunkLight : DynamicLight Destroy(); return; } + SetOrigin(target.pos,true); if ( isFrozen() ) return; args[LIGHT_RED] = int(255*(10-target.frame)*0.1); args[LIGHT_GREEN] = int(224*(10-target.frame)*0.1); @@ -460,7 +461,7 @@ Class FlakSlug : Actor Spawn("SlugLight",pos); Vector3 x, y, z; double a, s; - [x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll); + [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); Actor p; Vector3 spawnofs; if ( BlockingMobj ) spawnofs = level.Vec3Diff(pos,BlockingMobj.Vec3Offset(0,0,BlockingMobj.height/2)).unit()*8; @@ -564,12 +565,12 @@ Class FlakCannon : UTWeapon A_QuakeEx(1,1,1,3,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.05); Vector3 x, y, z; double a, s; - [x, y, z] = dt_Matrix4.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; A_Overlay(-2,"MuzzleFlash"); A_OverlayFlags(-2,PSPF_RENDERSTYLE|PSPF_FORCESTYLE,true); A_OverlayRenderstyle(-2,STYLE_Add); - [x, y, z] = dt_Matrix4.GetAxes(BulletSlope(),angle,roll); + [x, y, z] = dt_CoordUtil.GetAxes(BulletSlope(),angle,roll); Vector3 offsets[8]; // vanilla adds these to each chunk offsets[0] = (0,0,0); offsets[1] = -z; @@ -623,7 +624,7 @@ Class FlakCannon : UTWeapon A_QuakeEx(2,2,2,6,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1); Vector3 x, y, z; double a, s; - [x, y, z] = dt_Matrix4.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; A_Overlay(-2,"MuzzleFlash"); A_OverlayFlags(-2,PSPF_RENDERSTYLE|PSPF_FORCESTYLE,true); diff --git a/zscript/impacthammer.zsc b/zscript/impacthammer.zsc index 9f215dc..f3cfe2f 100644 --- a/zscript/impacthammer.zsc +++ b/zscript/impacthammer.zsc @@ -70,7 +70,7 @@ Class ImpactHammer : UTWeapon UTMainHandler.DoSwing(self,(FRandom[Impact](-0.3,-1.5),FRandom[Impact](-1.2,-0.4)),3,-0.8,3,SWING_Spring,3,2); A_AlertMonsters(); Vector3 x, y, z; - [x, y, z] = dt_Matrix4.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; double realcharge = min(1.5,invoker.chargesize); FLineTraceData d; @@ -122,6 +122,8 @@ Class ImpactHammer : UTWeapon s.vel = pvel; s.scale *= 0.4; } + invoker.chargesize = 0; + invoker.count = 0; } action void A_FireAltBlast() { @@ -133,7 +135,7 @@ Class ImpactHammer : UTWeapon A_AlertMonsters(); A_QuakeEx(2,2,2,6,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1); Vector3 x, y, z; - [x, y, z] = dt_Matrix4.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; FLineTraceData d; LineTrace(angle,120,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d); @@ -188,7 +190,7 @@ Class ImpactHammer : UTWeapon { FLineTraceData d; Vector3 x, y, z; - [x, y, z] = dt_Matrix4.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; LineTrace(angle,40,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d); if ( (invoker.chargesize > 1) && (d.HitType == TRACE_HitActor) ) @@ -227,7 +229,12 @@ Class ImpactHammer : UTWeapon Ready: IMPS ABCDEFGHIJKLMNOPQ 1 A_WeaponReady(WRF_NOFIRE); Idle: - IMPI A 1 A_WeaponReady(); + IMPI A 1 + { + invoker.chargesize = 0; + invoker.count = 0; + A_WeaponReady(); + } Wait; Fire: IMPL A 0 diff --git a/zscript/minigun.zsc b/zscript/minigun.zsc index 0dffaea..fc22f02 100644 --- a/zscript/minigun.zsc +++ b/zscript/minigun.zsc @@ -101,10 +101,10 @@ Class Minigun : UTWeapon l.target = self; if ( !alt ) MinigunLight(l).cnt--; Vector3 x, y, z, x2, y2, z2; - [x, y, z] = dt_Matrix4.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; double a = FRandom[Minigun](0,360), s = FRandom[Minigun](0,alt?0.05:0.02); - [x2, y2, z2] = dt_Matrix4.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(); FLineTraceData d; LineTrace(atan2(dir.y,dir.x),10000,asin(-dir.z),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d); diff --git a/zscript/powerups.zsc b/zscript/powerups.zsc index c5450c3..62fe05a 100644 --- a/zscript/powerups.zsc +++ b/zscript/powerups.zsc @@ -404,6 +404,8 @@ Class Searchlight : Inventory Inventory.MaxAmount 200; Inventory.InterHubAmount 0; Inventory.PickupMessage "$I_SEARCHLIGHT"; + Inventory.PickupSound "lite/pickup"; + Inventory.RespawnTics 1050; } override bool Use( bool pickup ) diff --git a/zscript/pulsegun.zsc b/zscript/pulsegun.zsc index 7e04133..7b04517 100644 --- a/zscript/pulsegun.zsc +++ b/zscript/pulsegun.zsc @@ -87,7 +87,7 @@ Class ViewPulseSpark : PulseSpark return; } Vector3 x, y, z; - [x, y, z] = dt_Matrix4.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); SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true); bInvisible = (players[consoleplayer].camera != target); @@ -517,7 +517,7 @@ Class StarterBolt : PulseBolt bRELATIVETOFLOOR = (target.pos.z <= target.floorz); // hack, but kinda works if ( target.player ) { - [x, y, z] = dt_Matrix4.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; } else origin = target.Vec3Offset(0,0,target.missileheight); @@ -539,13 +539,6 @@ Class PulseGun : UTWeapon Property ClipCount : clipcount; - override void PostRender( double lbottom ) - { - if ( !flak_pulsereload ) return; - if ( !usmf ) usmf = Font.GetFont('USMALLFONT'); - Screen.DrawText(usmf,Font.FindFontColor('UGreen'),Screen.GetWidth()*0.01,lbottom-Screen.GetHeight()*0.01-usmf.GetHeight(),String.Format("%s: %2d / 50",StringTable.Localize("$M_CLIP"),clipcount)); - } - action void A_Reloading() { Weapon weap = Weapon(invoker); @@ -566,7 +559,7 @@ Class PulseGun : UTWeapon 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_Matrix4.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; for ( int i=0; i<4; i++ ) { @@ -632,7 +625,7 @@ Class PulseGun : UTWeapon A_OverlayRenderstyle(-2,STYLE_Add); Vector3 x, y, z; double a; - [x, y, z] = dt_Matrix4.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; origin += y*cos(invoker.sangle)*2.0+z*sin(invoker.sangle)*2.0; invoker.sangle += 100; @@ -664,7 +657,7 @@ Class PulseGun : UTWeapon { A_PlaySound("pulse/bolt",CHAN_WEAPON,1.0,true); Vector3 x, y, z, origin; - [x, y, z] = dt_Matrix4.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; invoker.beam = Spawn("StarterBolt",origin); invoker.beam.angle = angle; diff --git a/zscript/ripper.zsc b/zscript/ripper.zsc index 1cb0560..3245f65 100644 --- a/zscript/ripper.zsc +++ b/zscript/ripper.zsc @@ -282,7 +282,7 @@ Class Ripper2 : UTWeapon UTMainHandler.DoSwing(self,(FRandom[Ripper](-0.3,-0.6),FRandom[Ripper](0.2,0.6)),1,-0.3,2,SWING_Spring,2,2); } Vector3 x, y, z; - [x, y, z] = dt_Matrix4.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; Actor p; if ( alt ) p = Spawn("Razor2Alt",origin); diff --git a/zscript/shockrifle.zsc b/zscript/shockrifle.zsc index cfdd0ca..69d5838 100644 --- a/zscript/shockrifle.zsc +++ b/zscript/shockrifle.zsc @@ -981,7 +981,7 @@ Class ViewShockSpark : ShockSpark return; } Vector3 x, y, z; - [x, y, z] = dt_Matrix4.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); SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true); bInvisible = (players[consoleplayer].camera != target); @@ -1015,7 +1015,7 @@ Class ShockRifle : UTWeapon A_AlertMonsters(); A_QuakeEx(2,2,2,4,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1); Vector3 x, y, z; - [x, y, z] = dt_Matrix4.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; Actor p = Spawn("ShockBeam",origin); p.angle = angle; @@ -1053,7 +1053,7 @@ Class ShockRifle : UTWeapon A_AlertMonsters(); A_QuakeEx(2,2,2,8,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1); Vector3 x, y, z; - [x, y, z] = dt_Matrix4.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; Actor p = Spawn("ShockBall",origin); p.angle = angle; @@ -1198,7 +1198,7 @@ Class EnhancedShockRifle : UTWeapon A_AlertMonsters(); A_QuakeEx(3,3,3,4,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.15); Vector3 x, y, z; - [x, y, z] = dt_Matrix4.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; Actor p = Spawn("SuperShockBeam",origin); p.angle = angle; @@ -1236,7 +1236,7 @@ Class EnhancedShockRifle : UTWeapon A_AlertMonsters(); A_QuakeEx(3,3,3,4,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.15); Vector3 x, y, z; - [x, y, z] = dt_Matrix4.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; Actor p = Spawn("SuperShockBall",origin); p.angle = angle; diff --git a/zscript/sniperrifle.zsc b/zscript/sniperrifle.zsc index bce628f..e847328 100644 --- a/zscript/sniperrifle.zsc +++ b/zscript/sniperrifle.zsc @@ -97,7 +97,7 @@ Class SniperRifle : UTWeapon let l = Spawn("SniperLight",pos); l.target = self; Vector3 x, y, z; - [x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll); + [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; FLineTraceData d; diff --git a/zscript/translocator.zsc b/zscript/translocator.zsc index bbdfee4..ca6baaa 100644 --- a/zscript/translocator.zsc +++ b/zscript/translocator.zsc @@ -330,7 +330,7 @@ Class Translocator : UTWeapon UTMainHandler.DoSwing(self,(FRandom[Translocator](-0.2,0.4),FRandom[Translocator](-0.2,0.7)),2,-0.3,3,SWING_Spring,2,3); A_AlertMonsters(); Vector3 x, y, z; - [x, y, z] = dt_Matrix4.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; let p = Spawn("TranslocatorModule",origin); p.target = self; diff --git a/zscript/utcommon.zsc b/zscript/utcommon.zsc index 42328aa..c17dfce 100644 --- a/zscript/utcommon.zsc +++ b/zscript/utcommon.zsc @@ -34,6 +34,7 @@ Class UTPlayer : DoomPlayer const groundfriction = 8.; const fluidfriction = 1.2; const terminalvelocity = 2500.; + const slantnormal = 0.7; // slope sliding will have to be handled eventually, but currently due to how much is hardcoded this is impossible Default { @@ -395,7 +396,7 @@ Class UTPlayer : DoomPlayer Vector3 dir = (0,0,0); if ( vel.length() > double.epsilon ) dir = vel.unit(); Vector3 x, y; - [x, y] = dt_Matrix4.GetAxes(pitch,angle,0); + [x, y] = dt_CoordUtil.GetAxes(pitch,angle,0); acceleration3 = x*player.cmd.forwardmove+y*player.cmd.sidemove; if ( player.cmd.buttons&BT_JUMP ) acceleration3.z = 0x500; else if ( player.cmd.buttons&BT_CROUCH ) acceleration3.z = -0x500; @@ -424,7 +425,7 @@ Class UTPlayer : DoomPlayer if ( vel.length() > double.epsilon ) dir = vel.unit(); double doomfriction = clamp(GetFriction()/ORIG_FRICTION,0.0,1.0); Vector3 x, y; - [x, y] = dt_Matrix4.GetAxes(pitch,angle,0); + [x, y] = dt_CoordUtil.GetAxes(pitch,angle,0); acceleration3 = x*player.cmd.forwardmove+y*player.cmd.sidemove; if ( player.cmd.buttons&BT_JUMP ) acceleration3.z = 0x500; else if ( player.cmd.buttons&BT_CROUCH ) acceleration3.z = -0x500; @@ -785,7 +786,7 @@ Class UTWeapon : Weapon Vector2 hofs = RotateVector((dropper.radius,0),dropper.angle); SetOrigin(dropper.Vec3Offset(hofs.x,hofs.y,dropper.height*0.5),false); Vector3 x, y, z; - [x, y, z] = dt_Matrix4.GetAxes(dropper.pitch,dropper.angle,dropper.roll); + [x, y, z] = dt_CoordUtil.GetAxes(dropper.pitch,dropper.angle,dropper.roll); vel = x*12.0; vel.z += 4.0; angle = dropper.angle; @@ -956,7 +957,7 @@ Class UTViewSpark : UTSpark return; } Vector3 x, y, z; - [x, y, z] = dt_Matrix4.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); SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true); bInvisible = (players[consoleplayer].camera != target); @@ -1201,7 +1202,7 @@ Class UTViewSmoke : UTSmoke return; } Vector3 x, y, z; - [x, y, z] = dt_Matrix4.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); SetOrigin(target.Vec2OffsetZ(origin.x,origin.y,origin.z),true); bInvisible = (players[consoleplayer].camera != target); @@ -1609,13 +1610,19 @@ Class UTMainHandler : EventHandler else e.Replacement = 'RifleAmmo'; } else if ( e.Replacee == 'InvulnerabilitySphere' ) e.Replacement = (!deathmatch||flak_dmsshock)?'EnhancedShockRifle':'UDamage'; - else if ( (e.Replacee == 'Berserk') || (e.Replacee == 'ArtiTomeOfPower') || (e.Replacee == 'ArtiEgg') ) e.Replacement = 'UDamage'; - else if ( (e.Replacee == 'Soulsphere') || (e.Replacee == 'ArtiSuperHealth') ) e.Replacement = 'UTHealthPack'; - else if ( (e.Replacee == 'Megasphere') || (e.Replacee == 'ArtiInvulnerability') ) e.Replacement = 'UTShieldBelt'; + else if ( e.Replacee == 'Berserk' ) e.Replacement = 'UDamage'; + else if ( (e.Replacee == 'ArtiTomeOfPower') || (e.Replacee == 'ArtiEgg') ) e.Replacement = 'ActUDamage'; + else if ( e.Replacee == 'Soulsphere' ) e.Replacement = 'UTHealthPack'; + else if ( e.Replacee == 'ArtiSuperHealth' ) e.Replacement = 'ActHealthPack'; + else if ( e.Replacee == 'Megasphere' ) e.Replacement = 'UTShieldBelt'; + else if ( e.Replacee == 'ArtiInvulnerability' ) e.Replacement = 'ActShieldBelt'; else if ( (e.Replacee == 'Allmap') || (e.Replacee == 'SuperMap') ) e.Replacement = 'UTMapRevealer'; - else if ( (e.Replacee == 'BlurSphere') || (e.Replacee == 'ArtiInvisibility') ) e.Replacement = 'UTInvisibility'; - else if ( (e.Replacee == 'Infrared') || (e.Replacee == 'ArtiTorch') ) e.Replacement = 'Searchlight'; - else if ( (e.Replacee == 'RadSuit') || (e.Replacee == 'ArtiFly') ) e.Replacement = 'UTJumpBoots'; + else if ( e.Replacee == 'BlurSphere' ) e.Replacement = 'UTInvisibility'; + else if ( e.Replacee == 'ArtiInvisibility' ) e.Replacement = 'ActInvisibility'; + else if ( e.Replacee == 'Infrared' ) e.Replacement = 'Searchlight'; + else if ( e.Replacee == 'ArtiTorch' ) e.Replacement = 'ActSearchlight'; + else if ( e.Replacee == 'RadSuit' ) e.Replacement = 'UTJumpBoots'; + else if ( e.Replacee == 'ArtiFly' ) e.Replacement = 'ActJumpBoots'; else if ( (e.Replacee == 'Backpack') || (e.Replacee == 'BagOfHolding') ) e.Replacement = 'UTBackpack'; else if ( (e.Replacee == 'ArmorBonus') || (e.Replacee == 'ArtiTimeBomb') ) e.Replacement = 'UTArmorBonus'; else if ( (e.Replacee == 'HealthBonus') || (e.Replacee == 'CrystalVial') ) e.Replacement = 'UTHealthBonus'; @@ -1625,16 +1632,16 @@ Class UTMainHandler : EventHandler else if ( e.Replacee == 'Medikit' ) e.Replacement = 'UTHealthBox'; else if ( e.Replacee == 'ArtiHealth' ) { - if ( !Random[Replacements](0,3) ) e.Replacement = 'UTHealthBox'; - else e.Replacement = 'UTMedBox'; + if ( !Random[Replacements](0,3) ) e.Replacement = 'ActHealthBox'; + else e.Replacement = 'ActMedBox'; } else if ( e.Replacee == 'ArtiTeleport' ) { // I have no idea what to replace this with, so just have some random stuff if ( Random[Replacements](0,1) ) e.Replacement = 'UTBackpack'; - else if ( Random[Replacements](0,1) ) e.Replacement = 'UTShieldBelt'; - else if ( Random[Replacements](0,1) ) e.Replacement = 'UTHealthPack'; - else e.Replacement = 'UDamage'; + else if ( Random[Replacements](0,1) ) e.Replacement = 'ActShieldBelt'; + else if ( Random[Replacements](0,1) ) e.Replacement = 'ActHealthPack'; + else e.Replacement = 'ActUDamage'; } else if ( e.Replacee == 'RedCard' ) e.Replacement = 'UTRedKey'; else if ( e.Replacee == 'BlueCard' ) e.Replacement = 'UTBlueKey'; @@ -1674,7 +1681,7 @@ Class UTMainHandler : EventHandler // just replace the -noflat- with a better scaled version and change the sky if ( !flak_doomtest ) { - if ( (level.GetChecksum() ~== "FBC3B6622A8B74AE06DE01E70007AC33") || (level.GetChecksum() ~== "D8206A3414DA967F2159473B5791139E") ) + if ( (level.GetChecksum() ~== "959A613006CC3AA912C4A22908B7566A") || (level.GetChecksum() ~== "75319AE5D2DBA214C5D394BF69DF32F4") ) { Level.ReplaceTextures("-noflat-","DefTex",0); TextureID skytx = TexMan.CheckForTexture("BlueSky",TexMan.Type_Any); @@ -1683,7 +1690,7 @@ Class UTMainHandler : EventHandler return; } // prettify Kinsie's test map for a more Unreal feel - if ( level.GetChecksum() ~== "FBC3B6622A8B74AE06DE01E70007AC33" ) + if ( level.GetChecksum() ~== "959A613006CC3AA912C4A22908B7566A" ) { TextureID deftex = TexMan.CheckForTexture("-noflat-",TexMan.Type_Any); TextureID skytx = TexMan.CheckForTexture("KGDaySky",TexMan.Type_Any); @@ -1703,13 +1710,13 @@ Class UTMainHandler : EventHandler level.sectors[i].SetTexture(1,skyflatnum); if ( level.sectors[i].GetTexture(0) == deftex ) { - level.sectors[i].SetTexture(0,(i==47)?baseceil:baseflor); + level.sectors[i].SetTexture(0,((i==47)||((i>=256)&&(i<=260)))?baseceil:baseflor); level.sectors[i].SetXScale(0,2.); level.sectors[i].SetYScale(0,2.); } if ( level.sectors[i].GetTexture(1) == deftex ) { - level.sectors[i].SetTexture(1,(i==47)?baseflor:baseceil); + level.sectors[i].SetTexture(1,((i==47)||((i>=256)&&(i<=260)))?baseflor:baseceil); level.sectors[i].SetXScale(1,2.); level.sectors[i].SetYScale(1,2.); } @@ -1780,7 +1787,7 @@ Class UTMainHandler : EventHandler AddAmbient((3584,736,64),"testamb/slime",0.4,2.4); AddAmbient((3584,512,64),"testamb/lava",0.8,2.4); } - else if ( level.GetChecksum() ~== "D8206A3414DA967F2159473B5791139E" ) + else if ( level.GetChecksum() ~== "75319AE5D2DBA214C5D394BF69DF32F4" ) { TextureID deftex = TexMan.CheckForTexture("-noflat-",TexMan.Type_Any); TextureID skytx = TexMan.CheckForTexture("KGDaySky",TexMan.Type_Any); @@ -1800,13 +1807,13 @@ Class UTMainHandler : EventHandler level.sectors[i].SetTexture(1,skyflatnum); if ( level.sectors[i].GetTexture(0) == deftex ) { - level.sectors[i].SetTexture(0,(i==47)?baseceil:baseflor); + level.sectors[i].SetTexture(0,((i==47)||((i>=144)&&(i<=148)))?baseceil:baseflor); level.sectors[i].SetXScale(0,2.); level.sectors[i].SetYScale(0,2.); } if ( level.sectors[i].GetTexture(1) == deftex ) { - level.sectors[i].SetTexture(1,(i==47)?baseflor:baseceil); + level.sectors[i].SetTexture(1,((i==47)||((i>=144)&&(i<=148)))?baseflor:baseceil); level.sectors[i].SetXScale(1,2.); level.sectors[i].SetYScale(1,2.); } diff --git a/zscript/uthud.zsc b/zscript/uthud.zsc index f2ae27c..cad6ab1 100644 --- a/zscript/uthud.zsc +++ b/zscript/uthud.zsc @@ -23,12 +23,12 @@ Class ViewTracer : LineTracer Class UTHud : BaseStatusBar { - TextureID AmmoBar, Boxes[4], Keys[5], BigNum[12], Flash, Slots[10], Icons[14], Uses[14], Man[5], Woman[5], Boss[5], WeaponBox, IconTloc2, UseTloc2; + TextureID AmmoBar, Boxes[4], Keys[5], BigNum[12], Flash, Slots[10], Icons[14], Uses[14], Man[5], Woman[5], Boss[5], WeaponBox, IconTloc2, UseTloc2, ItemBox, ItemSel, ItemFlash, ItemArrow[2], LastItem; Class IconClasses[14]; double HScale; Color tintcolor, bgcolor; int opacity; - int lastfrag, lastfragcnt, lastpickup, lastslot; + int lastfrag, lastfragcnt, lastpickup, lastslot, lastamount; ViewTracer vtracer; Actor lastseen; int lastseentic; @@ -145,6 +145,11 @@ Class UTHud : BaseStatusBar Boss[3] = TexMan.CheckForTexture("BossBot",TexMan.Type_Any); Boss[4] = TexMan.CheckForTexture("BossBlt",TexMan.Type_Any); WeaponBox = TexMan.CheckForTexture("WpSel",TexMan.Type_Any); + ItemBox = TexMan.CheckForTexture("ItemBox",TexMan.Type_Any); + ItemSel = TexMan.CheckForTexture("ItmSel",TexMan.Type_Any); + ItemFlash = TexMan.CheckForTexture("IFlash",TexMan.Type_Any); + ItemArrow[0] = TexMan.CheckForTexture("ItmArrw1",TexMan.Type_Any); + ItemArrow[1] = TexMan.CheckForTexture("ItmArrw2",TexMan.Type_Any); } override void Draw( int state, double TicFrac ) @@ -189,7 +194,7 @@ Class UTHud : BaseStatusBar { BeginHUD(); FracTic = TicFrac; - DrawUTHUD(); + DrawUTHUD(lbottom); } if ( (CPlayer.ReadyWeapon is 'UTWeapon') ) UTWeapon(CPlayer.ReadyWeapon).PostRender(lbottom); @@ -200,25 +205,25 @@ Class UTHud : BaseStatusBar return Color(a.a,int(a.r*(1.-x)+b.r*x),int(a.g*(1.-x)+b.g*x),int(a.b*(1.-x)+b.b*x)); } - private void UTDrawTintedTex( TextureID tx, double sx = 1.0, int opacity = -1, Color tint = Color("Black") ) + private void UTDrawTintedTex( TextureID tx, double sx = 1.0, int opacity = -1, Color tint = Color("Black"), bool flip = false ) { double ss = (HScale*sx); double dw = (Screen.GetWidth()/ss), dh = (Screen.GetHeight()/ss); double dx = CurX/ss, dy = CurY/ss; if ( opacity == -1 ) opacity = self.opacity; - if ( opacity >= 16 ) Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_FillColor,bgcolor); + if ( opacity >= 16 ) Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_FillColor,bgcolor,DTA_TopOffset,0,DTA_LeftOffset,0); double alpha = clamp(opacity/15.,0.0,1.0); - Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,alpha,DTA_LegacyRenderStyle,STYLE_AddShaded,DTA_FillColor,(tint!="Black")?tint:tintcolor); + Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,alpha,DTA_LegacyRenderStyle,STYLE_AddShaded,DTA_FillColor,(tint!="Black")?tint:tintcolor,DTA_TopOffset,0,DTA_LeftOffset,0,DTA_FlipX,flip); } - private void UTDrawPlainTex( TextureID tx, double sx = 1.0, int opacity = -1 ) + private void UTDrawPlainTex( TextureID tx, double sx = 1.0, int opacity = -1, bool flip = false ) { double ss = (HScale*sx); double dw = (Screen.GetWidth()/ss), dh = (Screen.GetHeight()/ss); double dx = CurX/ss, dy = CurY/ss; if ( opacity == -1 ) opacity = self.opacity; - if ( opacity >= 16 ) Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_FillColor,bgcolor); + if ( opacity >= 16 ) Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_FillColor,bgcolor,DTA_TopOffset,0,DTA_LeftOffset,0,DTA_FlipX,flip); double alpha = clamp(opacity/15.,0.0,1.0); - Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,alpha); + Screen.DrawTexture(tx,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,alpha,DTA_TopOffset,0,DTA_LeftOffset,0,DTA_FlipX,flip); } private bool UTDrawWeaponIcon( Weapon w, bool use, double sx = 1.0 ) @@ -255,9 +260,9 @@ Class UTHud : BaseStatusBar double flen = 3*step; double len = digits.length()*step; double alpha = clamp((opacity+7)/15.,0.0,1.0); - for ( int i=0; i 15 ) Screen.DrawTexture(BigNum[11],false,CurX/ss,CurY/ss,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_FillColor,bgcolor); @@ -266,9 +271,9 @@ Class UTHud : BaseStatusBar } for ( int i=0; i 15 ) Screen.DrawTexture(BigNum[digits.CharCodeAt(i)-0x30],false,CurX/ss,CurY/ss,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_FillColor,bgcolor); - Screen.DrawTexture(BigNum[digits.CharCodeAt(i)-0x30],false,CurX/ss,CurY/ss,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,alpha,DTA_LegacyRenderStyle,STYLE_AddShaded,DTA_FillColor,DrawColor); - CurX += ((i 15 ) Screen.DrawTexture(BigNum[digits.ByteAt(i)-0x30],false,CurX/ss,CurY/ss,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_FillColor,bgcolor); + Screen.DrawTexture(BigNum[digits.ByteAt(i)-0x30],false,CurX/ss,CurY/ss,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_Alpha,alpha,DTA_LegacyRenderStyle,STYLE_AddShaded,DTA_FillColor,DrawColor); + CurX += ((i1)?0.125:0.3)*hudsize*HScale; + double dw = (Screen.GetWidth()/ss.x), dh = (Screen.GetHeight()/ss.y); + double dx = CurX/ss.x, dy = CurY/ss.y; + Vector2 bs = TexMan.GetScaledSize(AmmoBar); + double ddw = bs.x*ch; + double alpha = clamp((opacity+7)/15.,0.0,1.0); + 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.; + CurY += 3*hudsize*HScale; + ss = (0.54,0.125)*hudsize*HScale; + dw = (Screen.GetWidth()/ss.x); + dh = (Screen.GetHeight()/ss.y); + dx = CurX/ss.x; + dy = CurY/ss.y; + ddw = bs.x*ch; + Screen.DrawTexture(AmmoBar,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_WindowRightF,ddw,DTA_Alpha,alpha); + } + } + else if ( flak_pulsereload && (cw is 'Pulsegun') ) + { + // draw clip + double ch = Pulsegun(cw).ClipCount/50.; + CurX = BaseX+6*hudsize*HScale; + CurY = BaseY+53*hudsize*HScale; + Vector2 ss = (0.54,0.3)*hudsize*HScale; + double dw = (Screen.GetWidth()/ss.x), dh = (Screen.GetHeight()/ss.y); + double dx = CurX/ss.x, dy = CurY/ss.y; + Vector2 bs = TexMan.GetScaledSize(AmmoBar); + double ddw = bs.x*ch; + double alpha = clamp((opacity+7)/15.,0.0,1.0); + Screen.DrawTexture(AmmoBar,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_WindowRightF,ddw,DTA_Alpha,alpha); + } + else if ( cw is 'ImpactHammer' ) + { + double ch = min(ImpactHammer(cw).chargesize,1.5)/1.5; + CurX = BaseX+6*hudsize*HScale; + CurY = BaseY+53*hudsize*HScale; + Vector2 ss = (0.54,0.3)*hudsize*HScale; + double dw = (Screen.GetWidth()/ss.x), dh = (Screen.GetHeight()/ss.y); + double dx = CurX/ss.x, dy = CurY/ss.y; + Vector2 bs = TexMan.GetScaledSize(AmmoBar); + double ddw = bs.x*ch; + double alpha = clamp((opacity+7)/15.,0.0,1.0); + Screen.DrawTexture(AmmoBar,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_WindowRightF,ddw,DTA_Alpha,alpha); + } + else if ( cw is 'BioRifle' ) + { + double ch = min(BioRifle(cw).charge,5.1)/5.1; + CurX = BaseX+6*hudsize*HScale; + CurY = BaseY+53*hudsize*HScale; + Vector2 ss = (0.54,0.3)*hudsize*HScale; + double dw = (Screen.GetWidth()/ss.x), dh = (Screen.GetHeight()/ss.y); + double dx = CurX/ss.x, dy = CurY/ss.y; + Vector2 bs = TexMan.GetScaledSize(AmmoBar); + double ddw = bs.x*ch; + double alpha = clamp((opacity+7)/15.,0.0,1.0); + Screen.DrawTexture(AmmoBar,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_WindowRightF,ddw,DTA_Alpha,alpha); + } + else if ( cw is 'UTRocketLauncher' ) + { + double ch = cw.special1/6.; + CurX = BaseX+6*hudsize*HScale; + CurY = BaseY+53*hudsize*HScale; + Vector2 ss = (0.54,0.3)*hudsize*HScale; + double dw = (Screen.GetWidth()/ss.x), dh = (Screen.GetHeight()/ss.y); + double dx = CurX/ss.x, dy = CurY/ss.y; + Vector2 bs = TexMan.GetScaledSize(AmmoBar); + double ddw = bs.x*ch; + double alpha = clamp((opacity+7)/15.,0.0,1.0); + Screen.DrawTexture(AmmoBar,false,dx,dy,DTA_VirtualWidthF,dw,DTA_VirtualHeightF,dh,DTA_KeepRatio,true,DTA_WindowRightF,ddw,DTA_Alpha,alpha); + } } private void DrawStatus() { @@ -609,9 +691,108 @@ Class UTHud : BaseStatusBar } } + private void DrawInventory( double lbottom ) + { + if ( isInventoryBarVisible() ) + { + CPlayer.mo.InvFirst = ValidateInvFirst(5); + if ( !CPlayer.mo.InvFirst ) return; + // draw the boxes + double BaseX, BaseY; + BaseX = CurX = (Screen.GetWidth()-64*5*hudsize*HScale)/2.; + BaseY = CurY = Screen.GetHeight()-224*hudsize*HScale; + for ( int i=0; i<5; i++ ) + { + UTDrawTintedTex(ItemBox,hudsize); + CurX += 64*hudsize*HScale; + } + int i = 0; + Inventory itm; + for ( itm=CPlayer.mo.InvFirst; (itm && (i < 5)); itm=itm.NextInv() ) + { + CurX = BaseX+2*hudsize*HScale; + CurY = BaseY+2*hudsize*HScale; + // if item doesn't fit 60x60, scale + Vector2 scl = TexMan.GetScaledSize(itm.Icon); + double mscl = max(scl.x,scl.y)/60.; + UTDrawTintedTex(itm.Icon,hudsize*mscl); + // amount if >1 + if ( itm.Amount > 1 ) + { + CurX = BaseX+32*hudsize*HScale; + CurY = BaseY+40*hudsize*HScale; + DrawColor = WhiteColor; + UTDrawBigNum(itm.Amount,hudsize*0.5); + } + // selection box if current item + if ( itm == CPlayer.mo.InvSel ) + { + CurX = BaseX; + CurY = BaseY; + UTDrawPlainTex(ItemSel,hudsize,opacity+7); + } + BaseX += 64*hudsize*HScale; + i++; + } + // draw arrows + CurY = Screen.GetHeight()-204*hudsize*HScale; + CurX = (Screen.GetWidth()-(64*5+40)*hudsize*HScale)/2.; + UTDrawTintedTex(ItemArrow[CPlayer.mo.InvFirst!=CPlayer.mo.FirstInv()],hudsize,flip:true); + CurX = (Screen.GetWidth()+(64*5+8)*hudsize*HScale)/2.; + UTDrawTintedTex(ItemArrow[!!itm],hudsize); + } + else if ( CPlayer.mo.InvSel || artiflashtick ) + { + // flashie + if ( artiflashtick ) + { + DrawColor = GoldColor; + CurX = -32*hudsize*HScale; + CurY = lbottom-96*hudsize*HScale; + UTDrawTintedTex(ItemFlash,hudsize,min(opacity,15),DrawColor); + } + // position 64x64 box + CurX = 0; + CurY = lbottom-64*hudsize*HScale; + UTDrawTintedTex(ItemBox,hudsize); + if ( artiflashtick ) + { + Vector2 scl = TexMan.GetScaledSize(LastItem); + double mscl = max(scl.x,scl.y)/60.; + CurX += 2*hudsize*HScale; + CurY += 2*hudsize*HScale; + UTDrawTintedTex(LastItem,hudsize*mscl); + if ( LastAmount <= 1 ) return; + CurX = 32*hudsize*HScale; + CurY = lbottom-24*hudsize*HScale; + DrawColor = WhiteColor; + UTDrawBigNum(LastAmount,hudsize*0.5); + return; + } + if ( !CPlayer.mo.InvSel ) return; + // if item doesn't fit 60x60, scale + Vector2 scl = TexMan.GetScaledSize(CPlayer.mo.InvSel.Icon); + double mscl = max(scl.x,scl.y)/60.; + CurX += 2*hudsize*HScale; + CurY += 2*hudsize*HScale; + UTDrawTintedTex(CPlayer.mo.InvSel.Icon,hudsize*mscl); + // amount if >1 + if ( CPlayer.mo.InvSel.Amount <= 1 ) return; + CurX = 32*hudsize*HScale; + CurY = lbottom-24*hudsize*HScale; + DrawColor = WhiteColor; + UTDrawBigNum(CPlayer.mo.InvSel.Amount,hudsize*0.5); + } + } + override void Tick() { Super.Tick(); + if ( CPlayer.mo.InvSel && !artiflashtick ) + { + LastItem = CPlayer.mo.InvSel.Icon; + LastAmount = CPlayer.mo.InvSel.Amount-1; + } if ( deathmatch||teamplay ) { if ( CPlayer.fragcount != lastfragcnt ) lastfrag = level.time; @@ -629,7 +810,7 @@ Class UTHud : BaseStatusBar lastseentic = level.time; } - private void DrawUTHUD() + private void DrawUTHUD( double lbottom ) { // Display Weapons if ( showweapons ) DrawWeapons(); @@ -641,6 +822,8 @@ Class UTHud : BaseStatusBar DrawStatus(); // Display Keys DrawKeys(); + // Inventory Bar + DrawInventory(lbottom); // Display Identification Info if ( CPlayer == players[consoleplayer] && showinfo ) DrawIdentifyInfo(); } diff --git a/zscript/warheadlauncher.zsc b/zscript/warheadlauncher.zsc index 89992c3..4c90b0d 100644 --- a/zscript/warheadlauncher.zsc +++ b/zscript/warheadlauncher.zsc @@ -660,7 +660,7 @@ Class WarheadLauncher : UTWeapon A_AlertMonsters(); A_QuakeEx(6,6,6,20,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.2); Vector3 x, y, z; - [x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll); + [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; Actor p = Spawn("WarShell",origin); @@ -674,7 +674,7 @@ Class WarheadLauncher : UTWeapon Weapon weap = Weapon(invoker); if ( !weap ) return; Vector3 x, y, z; - [x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll); + [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; int numpt = Random[Warhead](10,20); @@ -698,7 +698,7 @@ Class WarheadLauncher : UTWeapon A_AlertMonsters(); A_QuakeEx(6,6,6,20,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.2); Vector3 x, y, z; - [x, y, z] = dt_Matrix4.GetAxes(pitch,angle,roll); + [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; Actor p = Spawn("GuidedWarShell",origin);