From e8b9a5537868372150eb436e6e060d86e871a078 Mon Sep 17 00:00:00 2001 From: Marisa the Magician Date: Mon, 5 Dec 2022 15:54:56 +0100 Subject: [PATCH] 4.10 support: - CORRECTPIXELSTRETCH where needed on models. - Replace CoordUtil.GetAxes with quaternion version. --- modeldef.boss | 3 +- modeldef.chainsaw | 5 +- modeldef.commando | 3 +- modeldef.eightball | 8 +++- modeldef.enforcer | 7 ++- modeldef.fcommando | 3 +- modeldef.flak | 16 +++++-- modeldef.ges | 6 ++- modeldef.impact | 3 +- modeldef.misc | 20 ++++++-- modeldef.pulse | 3 +- modeldef.ripper | 5 +- modeldef.sgirl | 3 +- modeldef.shock | 4 ++ modeldef.soldier | 8 ++-- modeldef.transloc | 1 + modeldef.warhead | 7 +++ zscript.txt | 3 +- zscript/biorifle.zsc | 2 +- zscript/chainsaw.zsc | 6 +-- zscript/dt_coordutil.zsc | 92 ------------------------------------- zscript/dt_utility.zsc | 7 +++ zscript/eightball.zsc | 4 +- zscript/enforcer.zsc | 10 ++-- zscript/flakcannon.zsc | 10 ++-- zscript/impacthammer.zsc | 6 +-- zscript/minigun.zsc | 4 +- zscript/powerups.zsc | 2 +- zscript/pulsegun.zsc | 12 ++--- zscript/ripper.zsc | 2 +- zscript/shockrifle.zsc | 10 ++-- zscript/sniperrifle.zsc | 2 +- zscript/translocator.zsc | 6 +-- zscript/utcommon.zsc | 16 +++---- zscript/uthud.zsc | 12 ++--- zscript/warheadlauncher.zsc | 6 +-- 36 files changed, 142 insertions(+), 175 deletions(-) delete mode 100644 zscript/dt_coordutil.zsc diff --git a/modeldef.boss b/modeldef.boss index 08ee76b..d482487 100644 --- a/modeldef.boss +++ b/modeldef.boss @@ -8,10 +8,11 @@ Model "UTPlayerTBoss" SurfaceSkin 0 3 "Boss/boss4.png" SurfaceSkin 0 5 "GunPick1.png" Scale 0.23 0.23 0.23 - Offset 0 -5 29 + Offset 0 -5 24 RollOffset -90 AngleOffset -90 IGNORETRANSLATION + CORRECTPIXELSTRETCH // Still FrameIndex PLAY A 0 373 FrameIndex PLAY B 0 374 diff --git a/modeldef.chainsaw b/modeldef.chainsaw index 1594976..00d7095 100644 --- a/modeldef.chainsaw +++ b/modeldef.chainsaw @@ -14,9 +14,10 @@ Model "UTChainsaw" Path "models" Model 1 "ChainSawPick_d.3d" Skin 1 "JChainSawPick1.png" - Offset -10.5 -0.7 6 + Offset -10.5 -0.7 5 Scale 0.14 0.14 0.14 RollOffset -90 + CORRECTPIXELSTRETCH FrameIndex CSWP B 1 0 @@ -105,4 +106,4 @@ Model "UTChainsaw" FrameIndex CSWD D 0 65 FrameIndex CSWD E 0 66 FrameIndex CSWD F 0 67 -} \ No newline at end of file +} diff --git a/modeldef.commando b/modeldef.commando index e8e6ab6..cefdc5c 100644 --- a/modeldef.commando +++ b/modeldef.commando @@ -8,10 +8,11 @@ Model "UTPlayerTMale1" SurfaceSkin 0 3 "Commando/cmdo4.png" SurfaceSkin 0 5 "GunPick1.png" Scale 0.23 0.23 0.23 - Offset 0 -5 29 + Offset 0 -5 24 RollOffset -90 AngleOffset -90 IGNORETRANSLATION + CORRECTPIXELSTRETCH // Still FrameIndex PLAY A 0 373 FrameIndex PLAY B 0 374 diff --git a/modeldef.eightball b/modeldef.eightball index 7e0de22..661f9b2 100644 --- a/modeldef.eightball +++ b/modeldef.eightball @@ -5,7 +5,8 @@ Model "UTRocketAmmo" Skin 0 "JRocketPack1.png" Scale 0.072 0.072 0.072 RollOffset -90 - ZOffset 7 + ZOffset 6 + CORRECTPIXELSTRETCH FrameIndex RPAK A 0 0 } @@ -15,9 +16,10 @@ Model "UTRocketAmmo2" Path "models" Model 0 "UTRocket_d.3d" Skin 0 "JuRocket1_.png" - Offset 0 1.233 6 + Offset 0 1.233 5 Scale 0.0822 0.0822 0.0822 RollOffset -90 + CORRECTPIXELSTRETCH FrameIndex RCKT A 0 0 } @@ -31,6 +33,7 @@ Model "UTGrenade" Scale 0.0822 0.0822 0.0822 USEACTORPITCH USEACTORROLL + CORRECTPIXELSTRETCH AngleOffset 90 FrameIndex RCKT A 0 0 @@ -44,6 +47,7 @@ Model "UTRocket" Scale 0.0822 0.0822 0.0822 USEACTORPITCH USEACTORROLL + CORRECTPIXELSTRETCH AngleOffset 90 FrameIndex RCKT B 0 1 diff --git a/modeldef.enforcer b/modeldef.enforcer index 87c6891..8c33717 100644 --- a/modeldef.enforcer +++ b/modeldef.enforcer @@ -19,7 +19,8 @@ Model "EnforcerMag" USEACTORPITCH USEACTORROLL USEROTATIONCENTER - Rotation-Center 0 0 1 + CORRECTPIXELSTRETCH + Rotation-Center 0 0 .5 FrameIndex PCAS A 0 0 } @@ -36,7 +37,8 @@ Model "UTCasing" USEACTORPITCH USEACTORROLL USEROTATIONCENTER - Rotation-Center 0 0 1 + CORRECTPIXELSTRETCH + Rotation-Center 0 0 .5 FrameIndex PCAS A 0 0 } @@ -50,6 +52,7 @@ Model "BulletImpact" USEACTORPITCH USEACTORROLL DONTCULLBACKFACES + CORRECTPIXELSTRETCH Skin 0 "Impact_a00.png" FrameIndex BIMP A 0 0 Skin 0 "Impact_a01.png" diff --git a/modeldef.fcommando b/modeldef.fcommando index d53557e..4c180e2 100644 --- a/modeldef.fcommando +++ b/modeldef.fcommando @@ -7,10 +7,11 @@ Model "UTPlayerTFemale1" SurfaceSkin 0 2 "FCommando/cmdo4.png" SurfaceSkin 0 4 "GunPick1.png" Scale 0.23 0.23 0.23 - Offset -2.5 3 36 + Offset -2.5 3 30 RollOffset -90 AngleOffset -90 IGNORETRANSLATION + CORRECTPIXELSTRETCH // Still FrameIndex PLAY A 0 359 FrameIndex PLAY B 0 360 diff --git a/modeldef.flak b/modeldef.flak index 17d775d..043169d 100644 --- a/modeldef.flak +++ b/modeldef.flak @@ -30,6 +30,7 @@ Model "FlakSlug" AngleOffset 180 PitchOffset 90 USEACTORPITCH + CORRECTPIXELSTRETCH FrameIndex FSLG A 0 0 } @@ -43,7 +44,8 @@ Model "FlakChunk" USEACTORPITCH USEACTORROLL USEROTATIONCENTER - Rotation-Center 0 0 2 + CORRECTPIXELSTRETCH + Rotation-Center 0 0 1 Skin 0 "chunk_a00.png" FrameIndex FCH1 A 0 0 @@ -80,7 +82,8 @@ Model "FlakChunk" USEACTORPITCH USEACTORROLL USEROTATIONCENTER - Rotation-Center 0 0 2 + CORRECTPIXELSTRETCH + Rotation-Center 0 0 1 Skin 1 "chunk_a00.png" FrameIndex FCH2 A 1 0 @@ -117,7 +120,8 @@ Model "FlakChunk" USEACTORPITCH USEACTORROLL USEROTATIONCENTER - Rotation-Center 0 0 2 + CORRECTPIXELSTRETCH + Rotation-Center 0 0 1 Skin 2 "chunk_a00.png" FrameIndex FCH3 A 2 0 @@ -154,7 +158,8 @@ Model "FlakChunk" USEACTORPITCH USEACTORROLL USEROTATIONCENTER - Rotation-Center 0 0 2 + CORRECTPIXELSTRETCH + Rotation-Center 0 0 1 Skin 3 "chunk_a00.png" FrameIndex FCH4 A 3 0 @@ -193,7 +198,8 @@ Model "FlakMag" USEACTORPITCH USEACTORROLL USEROTATIONCENTER - Rotation-Center 0 0 1 + CORRECTPIXELSTRETCH + Rotation-Center 0 0 .5 FrameIndex PCAS A 0 0 } diff --git a/modeldef.ges b/modeldef.ges index 958be9a..8c3dbf5 100644 --- a/modeldef.ges +++ b/modeldef.ges @@ -6,7 +6,8 @@ Model "BioAmmo" Scale 0.08 0.08 0.08 PitchOffset 180 RollOffset 90 - ZOffset 4 + CORRECTPIXELSTRETCH + ZOffset 3 FrameIndex BIOA A 0 0 } @@ -18,7 +19,8 @@ Model "BioAmmo2" Scale 0.08 0.08 0.08 PitchOffset 180 RollOffset 90 - ZOffset 4 + CORRECTPIXELSTRETCH + ZOffset 3 FrameIndex BIOA A 0 0 } diff --git a/modeldef.impact b/modeldef.impact index 1a7507b..1fa4c0f 100644 --- a/modeldef.impact +++ b/modeldef.impact @@ -3,6 +3,7 @@ Model "ImpactHammer" Path "models" Model 1 "ImpPick_d.3d" Skin 1 "JImpPick1.png" + CORRECTPIXELSTRETCH Scale 0.2 0.2 0.2 RollOffset -90 ZOffset 7.5 @@ -87,4 +88,4 @@ Model "ImpactHammer" FrameIndex IMPD C 0 53 FrameIndex IMPD D 0 54 FrameIndex IMPD E 0 55 -} \ No newline at end of file +} diff --git a/modeldef.misc b/modeldef.misc index 309a336..9dd1b6d 100644 --- a/modeldef.misc +++ b/modeldef.misc @@ -53,7 +53,8 @@ Model "UTHealthPack" SurfaceSkin 0 2 "fizzfull" Scale 0.2 0.2 0.2 RollOffset -90 - ZOffset 16 + ZOffset 13 + CORRECTPIXELSTRETCH FrameIndex HBOX A 0 0 } @@ -67,7 +68,8 @@ Model "ActHealthPack" SurfaceSkin 0 2 "fizzfull" Scale 0.2 0.2 0.2 RollOffset -90 - ZOffset 16 + ZOffset 13 + CORRECTPIXELSTRETCH FrameIndex HBOX A 0 0 } @@ -423,7 +425,8 @@ Model "UTChip" USEACTORPITCH USEACTORROLL USEROTATIONCENTER - Rotation-Center 0 0 0 + CORRECTPIXELSTRETCH + Rotation-Center 0 0 .5 ZOffset 1 FrameIndex CHIP A 0 0 @@ -503,6 +506,7 @@ Model "WaterRing" DONTCULLBACKFACES USEACTORPITCH USEACTORROLL + CORRECTPIXELSTRETCH FrameIndex RNGX A 0 0 FrameIndex RNGX B 0 1 @@ -520,6 +524,7 @@ Model "UTWaterSplash" USEACTORPITCH USEACTORROLL DONTCULLBACKFACES + CORRECTPIXELSTRETCH FrameIndex SPSH A 0 1 FrameIndex SPSH B 0 2 @@ -557,6 +562,7 @@ Model "UTWaterSplish" USEACTORPITCH USEACTORROLL DONTCULLBACKFACES + CORRECTPIXELSTRETCH FrameIndex SPSH A 0 1 FrameIndex SPSH B 0 2 @@ -595,6 +601,7 @@ Model "UTBloodSplash" USEACTORPITCH USEACTORROLL DONTCULLBACKFACES + CORRECTPIXELSTRETCH FrameIndex SPSH A 0 1 FrameIndex SPSH B 0 2 @@ -632,6 +639,7 @@ Model "UTBloodSplish" USEACTORPITCH USEACTORROLL DONTCULLBACKFACES + CORRECTPIXELSTRETCH FrameIndex SPSH A 0 1 FrameIndex SPSH B 0 2 @@ -670,6 +678,7 @@ Model "UTSlimeSplash" USEACTORPITCH USEACTORROLL DONTCULLBACKFACES + CORRECTPIXELSTRETCH FrameIndex SPSH A 0 1 FrameIndex SPSH B 0 2 @@ -707,6 +716,7 @@ Model "UTSlimeSplish" USEACTORPITCH USEACTORROLL DONTCULLBACKFACES + CORRECTPIXELSTRETCH FrameIndex SPSH A 0 1 FrameIndex SPSH B 0 2 @@ -745,6 +755,7 @@ Model "UTNukageSplash" USEACTORPITCH USEACTORROLL DONTCULLBACKFACES + CORRECTPIXELSTRETCH FrameIndex SPSH A 0 1 FrameIndex SPSH B 0 2 @@ -782,6 +793,7 @@ Model "UTNukageSplish" USEACTORPITCH USEACTORROLL DONTCULLBACKFACES + CORRECTPIXELSTRETCH FrameIndex SPSH A 0 1 FrameIndex SPSH B 0 2 @@ -820,6 +832,7 @@ Model "UTLavaSplash" USEACTORPITCH USEACTORROLL DONTCULLBACKFACES + CORRECTPIXELSTRETCH FrameIndex SPSH A 0 1 FrameIndex SPSH B 0 2 @@ -857,6 +870,7 @@ Model "UTLavaSplish" USEACTORPITCH USEACTORROLL DONTCULLBACKFACES + CORRECTPIXELSTRETCH FrameIndex SPSH A 0 1 FrameIndex SPSH B 0 2 diff --git a/modeldef.pulse b/modeldef.pulse index ac20b59..07e1203 100644 --- a/modeldef.pulse +++ b/modeldef.pulse @@ -65,7 +65,8 @@ Model "PulseMag" USEACTORPITCH USEACTORROLL USEROTATIONCENTER - Rotation-Center 0 0 2 + CORRECTPIXELSTRETCH + Rotation-Center 0 0 1 FrameIndex PCAS A 0 0 } diff --git a/modeldef.ripper b/modeldef.ripper index ea0922c..835d0c4 100644 --- a/modeldef.ripper +++ b/modeldef.ripper @@ -35,6 +35,7 @@ Model "Razor2" Scale 0.18 0.18 0.18 AngleOffset 90 USEACTORPITCH + CORRECTPIXELSTRETCH FrameIndex RAZB A 0 0 } @@ -50,6 +51,7 @@ Model "Razor2Trail" AngleOffset 90 USEACTORPITCH DONTCULLBACKFACES + CORRECTPIXELSTRETCH FrameIndex RAZB A 0 0 } @@ -65,6 +67,7 @@ Model "Razor2Alt" AngleOffset 90 USEACTORPITCH USEACTORROLL + CORRECTPIXELSTRETCH FrameIndex RAZB A 0 0 } @@ -157,4 +160,4 @@ Model "Ripper2" FrameIndex RZRD D 0 70 FrameIndex RZRD E 0 71 FrameIndex RZRD F 0 72 -} \ No newline at end of file +} diff --git a/modeldef.sgirl b/modeldef.sgirl index ed85712..8360fcb 100644 --- a/modeldef.sgirl +++ b/modeldef.sgirl @@ -8,10 +8,11 @@ Model "UTPlayerTFemale2" SurfaceSkin 0 3 "SGirl/army4.png" SurfaceSkin 0 5 "GunPick1.png" Scale 0.23 0.23 0.23 - Offset -2.5 3 36 + Offset -2.5 3 30 RollOffset -90 AngleOffset -90 IGNORETRANSLATION + CORRECTPIXELSTRETCH // Still FrameIndex PLAY A 0 359 FrameIndex PLAY B 0 360 diff --git a/modeldef.shock b/modeldef.shock index 0e2126f..7a0a386 100644 --- a/modeldef.shock +++ b/modeldef.shock @@ -35,6 +35,8 @@ Model "ShockRifleWave" Path "models" Model 0 "shockrwm_d.3d" Skin 0 "shocktt1.png" + CORRECTPIXELSTRETCH + RollOffset 90 Scale 0.5 0.5 0.5 FrameIndex SWAV A 0 0 @@ -46,6 +48,8 @@ Model "SuperShockRifleWave" Path "models" Model 0 "shockrwm_d.3d" Skin 0 "sshocktt1.png" + CORRECTPIXELSTRETCH + RollOffset 90 Scale 0.5 0.5 0.5 FrameIndex SWAV A 0 0 diff --git a/modeldef.soldier b/modeldef.soldier index bc96c7d..6f52e2e 100644 --- a/modeldef.soldier +++ b/modeldef.soldier @@ -8,10 +8,11 @@ Model "UTPlayerTMale2" SurfaceSkin 0 3 "Soldier/sldr4.png" SurfaceSkin 0 5 "GunPick1.png" Scale 0.23 0.23 0.23 - Offset 0 -5 29 + Offset 0 -5 24 RollOffset -90 AngleOffset -90 IGNORETRANSLATION + CORRECTPIXELSTRETCH // Still FrameIndex PLAY A 0 373 FrameIndex PLAY B 0 374 @@ -317,8 +318,9 @@ Model "TranslocatorAfterimage" SurfaceSkin 0 2 "Soldier/sldr3.png" SurfaceSkin 0 3 "Soldier/sldr4.png" SurfaceSkin 0 5 "GunPick1.png" - Scale 0.256 0.23 0.23 - Offset 0 -5 29 + CORRECTPIXELSTRETCH + Scale 0.23 0.23 0.23 + Offset 0 -5 24 RollOffset -90 AngleOffset -90 FrameIndex PLAY A 0 187 diff --git a/modeldef.transloc b/modeldef.transloc index 566961d..106f78f 100644 --- a/modeldef.transloc +++ b/modeldef.transloc @@ -6,6 +6,7 @@ Model "TranslocatorModule" Scale 0.056 0.056 0.056 ZOffset 5 USEACTORPITCH + CORRECTPIXELSTRETCH FrameIndex TMOD A 0 0 FrameIndex TMOD B 0 1 diff --git a/modeldef.warhead b/modeldef.warhead index dd2e017..b8b6236 100644 --- a/modeldef.warhead +++ b/modeldef.warhead @@ -35,6 +35,8 @@ Model "ShockWave" Path "models" Model 0 "shockwavem_d.3d" Skin 0 "shockt1.png" + CORRECTPIXELSTRETCH + RollOffset 90 Scale 1.0 1.0 1.0 FrameIndex RWAV A 0 0 @@ -51,6 +53,7 @@ Model "WarShell" PitchOffset -90 USEACTORPITCH USEACTORROLL + CORRECTPIXELSTRETCH FrameIndex WMIS A 0 0 } @@ -64,6 +67,7 @@ Model "GuidedWarShell" PitchOffset -90 USEACTORPITCH USEACTORROLL + CORRECTPIXELSTRETCH FrameIndex WMIS A 0 0 } @@ -78,6 +82,7 @@ Model "WarShell220" PitchOffset -90 USEACTORPITCH USEACTORROLL + CORRECTPIXELSTRETCH FrameIndex WMIS A 0 0 } @@ -91,6 +96,7 @@ Model "WarShell222" PitchOffset -90 USEACTORPITCH USEACTORROLL + CORRECTPIXELSTRETCH FrameIndex WMIS A 0 0 } @@ -101,6 +107,7 @@ Model "WarheadLauncher" Model 1 "whpick_d.3d" Skin 1 "jwhpick1.png" Scale 0.2 0.2 0.2 + CORRECTPIXELSTRETCH RollOffset -90 ZOffset 9 diff --git a/zscript.txt b/zscript.txt index 866887f..f05e18c 100644 --- a/zscript.txt +++ b/zscript.txt @@ -1,8 +1,7 @@ -version "4.9" +version "4.10" #include "zscript/dt_Gutamatics/Include.zsc" #include "zscript/dt_utility.zsc" -#include "zscript/dt_coordutil.zsc" #include "zscript/utcommon.zsc" #include "zscript/utgore.zsc" #include "zscript/impacthammer.zsc" diff --git a/zscript/biorifle.zsc b/zscript/biorifle.zsc index eae6441..674cf94 100644 --- a/zscript/biorifle.zsc +++ b/zscript/biorifle.zsc @@ -724,7 +724,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_CoordUtil.GetAxes(pitch,angle,roll); + [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll); Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+8*y-5*z); Actor p; if ( alt ) diff --git a/zscript/chainsaw.zsc b/zscript/chainsaw.zsc index 0557e9d..a7d0d83 100644 --- a/zscript/chainsaw.zsc +++ b/zscript/chainsaw.zsc @@ -131,7 +131,7 @@ Class UTChainsaw : UTWeapon invoker.FireEffect(); A_AlertMonsters(); Vector3 x, y, z; - [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); + [x, y, z] = dt_Utility.GetAxes(angle,pitch,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); @@ -179,7 +179,7 @@ Class UTChainsaw : UTWeapon if ( initial ) invoker.FireEffect(); A_AlertMonsters(); Vector3 x, y, z; - [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); + [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll); Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x-2*z); FLineTraceData d; double ang = (angle-60)+120*invoker.sawcnt; @@ -233,7 +233,7 @@ Class UTChainsaw : UTWeapon else A_QuakeEx(0,0,0,2,0,1,"",QF_RELATIVE,rollIntensity:0.2); if ( bAlt || Random[Chainsaw](0,2) ) return; Vector3 x, y, z; - [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); + [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll); Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),5*x+y-3*z); for ( int i=0; i<5; i++ ) { diff --git a/zscript/dt_coordutil.zsc b/zscript/dt_coordutil.zsc deleted file mode 100644 index f7dbd22..0000000 --- a/zscript/dt_coordutil.zsc +++ /dev/null @@ -1,92 +0,0 @@ -/* - Coordinate Utility helper class. - Reproduces the old UnrealScript Get(Un)Axes functions, providing XYZ axis - vectors relative to an euler rotation (defaults to left-handed coords). - - Copyright (c)2018-2022 Marisa the Magician, UnSX Team - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to - deal in the Software without restriction, including without limitation the - rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - sell copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - IN THE SOFTWARE. -*/ - -Class dt_CoordUtil -{ - // In Tim Sweeney's own words: "transform by a pitch-yaw-roll rotation" - static Vector3, Vector3, Vector3 GetUnAxes( double pitch, double yaw, double roll, bool rhand = false ) - { - Vector3 x = (1,0,0), y = (0,rhand?1:-1,0), z = (0,0,1); - 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, bool rhand = false ) - { - Vector3 x = (1,0,0), y = (0,rhand?1:-1,0), z = (0,0,1); - 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_utility.zsc b/zscript/dt_utility.zsc index 12245b7..211379c 100644 --- a/zscript/dt_utility.zsc +++ b/zscript/dt_utility.zsc @@ -64,4 +64,11 @@ Class dt_Utility { return (x+y*cos(angle)*spread+z*sin(angle)*spread).unit(); } + + static clearscope Vector3, Vector3, Vector3 GetAxes( double angle, double pitch, double roll ) + { + Vector3 x = (1,0,0), y = (0,-1,0), z = (0,0,1); + Quat r = Quat.FromAngles(angle,pitch,roll); + return r*x, r*y, r*z; + } } diff --git a/zscript/eightball.zsc b/zscript/eightball.zsc index 37d7825..29fd7f1 100644 --- a/zscript/eightball.zsc +++ b/zscript/eightball.zsc @@ -388,9 +388,9 @@ Class UTRocketLauncher : UTWeapon A_QuakeEx(2+num,2+num,2+num,6+num,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1+num*0.05); Vector3 x, y, z, x2, y2, z2; double a, s; - [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); + [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll); Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+3*y-3*z); - [x2, y2, z2] = dt_CoordUtil.GetAxes(BulletSlope(),angle,roll); + [x2, y2, z2] = dt_Utility.GetAxes(angle,BulletSlope(),roll); Actor p; if ( weap.bAltFire ) { diff --git a/zscript/enforcer.zsc b/zscript/enforcer.zsc index bd1a112..3766a04 100644 --- a/zscript/enforcer.zsc +++ b/zscript/enforcer.zsc @@ -34,7 +34,7 @@ Class EnforcerLight : DynamicLight if ( target.player ) { Vector3 x, y, z, origin; - [x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll); + [x, y, z] = dt_Utility.GetAxes(target.angle,target.pitch,target.roll); origin = level.Vec3Offset(target.Vec2OffsetZ(0,0,target.player.viewz),x*12); SetOrigin(origin,true); } @@ -378,13 +378,13 @@ Class Enforcer : UTWeapon A_OverlayRenderstyle(-2,STYLE_Add); } Vector3 x, y, z, x2, y2, z2; - [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); + [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll); Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x); int ydir = slave?-1:1; 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); + [x2, y2, z2] = dt_Utility.GetAxes(angle,BulletSlope(),roll); Vector3 dir = dt_Utility.ConeSpread(x2,y2,z2,a,s); FLineTraceData d; LineTrace(atan2(dir.y,dir.x),10000,asin(-dir.z),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d); @@ -634,7 +634,7 @@ Class Enforcer : UTWeapon UTPlayer(self).PlayReloading(); invoker.slavereload = (flak_enforcerreload&&invoker.slaveactive&&(invoker.slaveclipcount 1) && (d.HitType == TRACE_HitActor) ) @@ -122,7 +122,7 @@ Class ImpactHammer : UTWeapon invoker.FireEffect(); A_AlertMonsters(gameinfo.gametype&GAME_Strife?100:0); Vector3 x, y, z; - [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); + [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll); Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+3*y-4*z); double realcharge = min(1.5,invoker.chargesize); FLineTraceData d; @@ -187,7 +187,7 @@ Class ImpactHammer : UTWeapon A_AlertMonsters(gameinfo.gametype&GAME_Strife?100:0); 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); + [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll); 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); diff --git a/zscript/minigun.zsc b/zscript/minigun.zsc index 0f9d11d..3ff7408 100644 --- a/zscript/minigun.zsc +++ b/zscript/minigun.zsc @@ -117,10 +117,10 @@ Class Minigun : UTWeapon l.target = self; if ( !alt ) MinigunLight(l).cnt--; Vector3 x, y, z, x2, y2, z2; - [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); + [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll); 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); + [x2, y2, z2] = dt_Utility.GetAxes(angle,BulletSlope(),roll); Vector3 dir = dt_Utility.ConeSpread(x2,y2,z2,a,s); 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 fb00ecd..c8b0c85 100644 --- a/zscript/powerups.zsc +++ b/zscript/powerups.zsc @@ -576,7 +576,7 @@ Class UTVisionLight : DynamicLight return; } Vector3 x, y, z, origin; - [x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll); + [x, y, z] = dt_Utility.GetAxes(target.angle,target.pitch,target.roll); if ( target.player ) origin = target.Vec2OffsetZ(0,0,target.player.viewz); else origin = target.Vec3Offset(0,0,target.height/2); diff --git a/zscript/pulsegun.zsc b/zscript/pulsegun.zsc index b33be94..d5da63c 100644 --- a/zscript/pulsegun.zsc +++ b/zscript/pulsegun.zsc @@ -108,7 +108,7 @@ Class ViewPulseSpark : PulseSpark return; } Vector3 x, y, z; - [x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll); + [x, y, z] = dt_Utility.GetAxes(target.angle,target.pitch,target.roll); 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); @@ -540,7 +540,7 @@ Class StarterBolt : PulseBolt bRELATIVETOFLOOR = (target.pos.z <= target.floorz); // hack, but kinda works if ( target.player ) { - [x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll); + [x, y, z] = dt_Utility.GetAxes(target.angle,target.pitch,target.roll); 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); @@ -678,7 +678,7 @@ Class PulseGun : UTWeapon UTMainHandler.DoFlash(self,Color(32,128,255,128),1); A_AlertMonsters(); Vector3 x, y, z; - [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); + [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll); Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+4.1*y-2.7*z); for ( int i=0; i<4; i++ ) { @@ -743,7 +743,7 @@ Class PulseGun : UTWeapon A_OverlayRenderstyle(-2,STYLE_Add); Vector3 x, y, z; double a; - [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); + [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll); Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+3*y-1.8*z); origin = level.Vec3Offset(origin,dt_Utility.CircleOffset(y,z,invoker.sangle,2)); invoker.sangle += 100; @@ -776,7 +776,7 @@ Class PulseGun : UTWeapon invoker.special1 = 0; A_StartSound("pulse/bolt",CHAN_WEAPON,CHANF_LOOPING); Vector3 x, y, z, origin; - [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); + [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll); origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+4.1*y-2.7*z); invoker.beam = Spawn("StarterBolt",origin); invoker.beam.angle = angle; @@ -901,7 +901,7 @@ Class PulseGun : UTWeapon PGR2 A 1 { Vector3 x, y, z, origin; - [x,y,z] = dt_CoordUtil.GetAxes(pitch,angle,roll); + [x,y,z] = dt_Utility.GetAxes(angle,pitch,roll); origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),x*4.-y*6.-z*8.); let c = Spawn("PulseMag",origin); c.angle = angle; diff --git a/zscript/ripper.zsc b/zscript/ripper.zsc index 66badf4..1715837 100644 --- a/zscript/ripper.zsc +++ b/zscript/ripper.zsc @@ -256,7 +256,7 @@ Class Ripper2 : UTWeapon if ( alt ) A_QuakeEx(3,3,3,8,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1); else A_QuakeEx(1,1,1,5,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.08); Vector3 x, y, z; - [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); + [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll); Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+6*y-4*z); Actor p; if ( alt ) p = Spawn("Razor2Alt",origin); diff --git a/zscript/shockrifle.zsc b/zscript/shockrifle.zsc index e141549..77209bd 100644 --- a/zscript/shockrifle.zsc +++ b/zscript/shockrifle.zsc @@ -1036,7 +1036,7 @@ Class ViewShockSpark : ShockSpark return; } Vector3 x, y, z; - [x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll); + [x, y, z] = dt_Utility.GetAxes(target.angle,target.pitch,target.roll); 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); @@ -1069,7 +1069,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_CoordUtil.GetAxes(pitch,angle,roll); + [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll); Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+2*y-1.5*z); Actor p = Spawn("ShockBeam",origin); p.angle = angle; @@ -1106,7 +1106,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_CoordUtil.GetAxes(pitch,angle,roll); + [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll); Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+2*y-1.5*z); Actor p = Spawn("ShockBall",origin); p.angle = angle; @@ -1251,7 +1251,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_CoordUtil.GetAxes(pitch,angle,roll); + [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll); Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+2*y-1.5*z); Actor p = Spawn("SuperShockBeam",origin); p.angle = angle; @@ -1288,7 +1288,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_CoordUtil.GetAxes(pitch,angle,roll); + [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll); Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+2*y-1.5*z); Actor p = Spawn("SuperShockBall",origin); p.angle = angle; diff --git a/zscript/sniperrifle.zsc b/zscript/sniperrifle.zsc index ea2578a..1220737 100644 --- a/zscript/sniperrifle.zsc +++ b/zscript/sniperrifle.zsc @@ -95,7 +95,7 @@ Class SniperRifle : UTWeapon let l = Spawn("SniperLight",pos); l.target = self; Vector3 x, y, z; - [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); + [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll); Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x); if ( !zoomed ) origin = level.Vec3Offset(origin,y*4-z*2); FLineTraceData d; diff --git a/zscript/translocator.zsc b/zscript/translocator.zsc index 2da63ab..389c0f3 100644 --- a/zscript/translocator.zsc +++ b/zscript/translocator.zsc @@ -323,7 +323,7 @@ Class TranslocatorAfterimage : Actor angle = target.angle-90; roll = -90; Vector3 x, y, z; - [x, y, z] = dt_CoordUtil.GetAxes(0,angle,roll); + [x, y, z] = dt_Utility.GetAxes(angle,0,roll); int lump = Wads.CheckNumForFullname("models/TeleSoldier_a.3d"); String anivfile = Wads.ReadLump(lump); int numframes = anivfile.ByteAt(0); @@ -417,7 +417,7 @@ Class Translocator : UTWeapon invoker.FireEffect(); A_AlertMonsters(); Vector3 x, y, z; - [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); + [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll); Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x-8*y-12*z); let p = Spawn("TranslocatorModule",origin); p.target = self; @@ -592,7 +592,7 @@ Class OldTranslocator : Translocator invoker.FireEffect(); A_AlertMonsters(); Vector3 x, y, z; - [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); + [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll); Vector3 origin = (pos.x,pos.y,player.viewz)+15.0*x-10.0*y-4.0*z; let p = Spawn("OldTranslocatorModule",origin); p.target = self; diff --git a/zscript/utcommon.zsc b/zscript/utcommon.zsc index a09b272..d5ba9d7 100644 --- a/zscript/utcommon.zsc +++ b/zscript/utcommon.zsc @@ -103,7 +103,7 @@ Class UTPlayer : DoomPlayer Player.StartItem "ImpactHammer"; Player.StartItem "MiniAmmo", 30; Player.DamageScreenColor "FF 00 00"; - Player.ViewHeight 46; + Player.ViewHeight 44; Player.GruntSpeed 20; Player.Portrait "TNT1A0"; +NOMENU; @@ -610,7 +610,7 @@ Class UTPlayer : DoomPlayer Vector3 dir = (0,0,0); if ( vel.length() > double.epsilon ) dir = vel.unit(); Vector3 x, y; - [x, y] = dt_CoordUtil.GetAxes(pitch,angle,0); + [x, y] = dt_Utility.GetAxes(angle,pitch,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; @@ -639,7 +639,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_CoordUtil.GetAxes(pitch,angle,0); + [x, y] = dt_Utility.GetAxes(angle,pitch,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; @@ -2025,7 +2025,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_CoordUtil.GetAxes(dropper.pitch,dropper.angle,dropper.roll); + [x, y, z] = dt_Utility.GetAxes(dropper.angle,dropper.pitch,dropper.roll); vel = x*12.0; vel.z += 4.0; angle = dropper.angle; @@ -2215,7 +2215,7 @@ Class UTViewSpark : UTSpark return; } Vector3 x, y, z; - [x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll); + [x, y, z] = dt_Utility.GetAxes(target.angle,target.pitch,target.roll); 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); @@ -2462,7 +2462,7 @@ Class UTViewSmoke : UTSmoke return; } Vector3 x, y, z; - [x, y, z] = dt_CoordUtil.GetAxes(target.pitch,target.angle,target.roll); + [x, y, z] = dt_Utility.GetAxes(target.angle,target.pitch,target.roll); 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); @@ -2778,7 +2778,7 @@ Class UTParticleMesh : Actor pz[i] = az/4194304.; } Vector3 x, y, z; - [x, y, z] = dt_CoordUtil.GetAxes(pitch,angle,roll); + [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll); for ( int i=0; i