diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..41944d6
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,19 @@
+Copyright (c) 2018-2023 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.
diff --git a/Readme.md b/Readme.md
index b1223e4..2f8b26c 100644
--- a/Readme.md
+++ b/Readme.md
@@ -2,7 +2,7 @@
What began as a test for importing UT vertex meshes has turned into an actual full UT weapon and item mod.
-This mod requires GZDoom 4.9 or later.
+This mod requires GZDoom 4.11 or later.
Four years have passed since all of this started, in 2018. It took four years for some of the planned features to finally be possible. A lot of time sure has passed, huh?
@@ -51,6 +51,7 @@ Four years have passed since all of this started, in 2018. It took four years fo
- Scaling/Customization options for the HUD
- UT-like player movement physics
- UT-like weapon dropping style
+ - UT-like weapon and view bobbing
- UT player classes
- Heretic compatibility
- Spanish localization
@@ -69,7 +70,7 @@ Four years have passed since all of this started, in 2018. It took four years fo
## What Didn't Make It
- - Third person weapon models (all players currently look like they're holding a Quadshot, features for this are not in 4.9)
+ - Third person weapon models (all players currently look like they're holding a Quadshot, features for this are not in 4.11)
- Additional player classes (Skaarj Hybrid, Nali, War Cow), including those that use skeletal models (Xan Mk2, War Boss)
- Relics
diff --git a/zscript.txt b/zscript.txt
index f05e18c..adeac22 100644
--- a/zscript.txt
+++ b/zscript.txt
@@ -1,4 +1,15 @@
-version "4.10"
+version "4.11"
+
+/*
+ Doom Tournament main codebase
+
+ Save for the third party Gutamatics library, all code here is
+ (C)2018-2023 Marisa the Magician, UnSX Team, and is released under the
+ terms of the MIT license (see LICENSE.txt).
+
+ No proprietary code by Epic Games has been copied, with or without
+ modification, in the process of developing this project.
+*/
#include "zscript/dt_Gutamatics/Include.zsc"
#include "zscript/dt_utility.zsc"
diff --git a/zscript/LGPL3.txt b/zscript/LGPL3.txt
deleted file mode 100644
index 0a04128..0000000
--- a/zscript/LGPL3.txt
+++ /dev/null
@@ -1,165 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
diff --git a/zscript/biorifle.zsc b/zscript/biorifle.zsc
index 674cf94..02f780e 100644
--- a/zscript/biorifle.zsc
+++ b/zscript/biorifle.zsc
@@ -722,10 +722,7 @@ Class BioRifle : UTWeapon
A_AlertMonsters();
if ( alt ) A_QuakeEx(1+int(0.5*invoker.charge),1+int(0.5*invoker.charge),1+int(0.5*invoker.charge),5+int(1.2*invoker.charge),0,64,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.05+0.01*invoker.charge);
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_Utility.GetAxes(angle,pitch,roll);
- Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+8*y-5*z);
+ Vector3 origin = dt_Utility.GetFireOffset(self,10,8,-5);
Actor p;
if ( alt )
{
@@ -793,6 +790,7 @@ Class BioRifle : UTWeapon
Weapon.AmmoGive 25;
UTWeapon.DropAmmo 5;
UTWeapon.NameColor "00 FF 00";
+ UTWeapon.BobDamping .9;
}
States
{
diff --git a/zscript/chainsaw.zsc b/zscript/chainsaw.zsc
index a7d0d83..bf3d0e2 100644
--- a/zscript/chainsaw.zsc
+++ b/zscript/chainsaw.zsc
@@ -131,8 +131,8 @@ Class UTChainsaw : UTWeapon
invoker.FireEffect();
A_AlertMonsters();
Vector3 x, y, z;
- [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll);
- Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x-4*z);
+ [x, y, z] = dt_Utility.GetPlayerAxes(self);
+ Vector3 origin = dt_Utility.GetFireOffset(self,10,0,-4);
FLineTraceData d;
LineTrace(angle,90,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d);
if ( d.HitType == TRACE_HitActor )
@@ -179,8 +179,8 @@ Class UTChainsaw : UTWeapon
if ( initial ) invoker.FireEffect();
A_AlertMonsters();
Vector3 x, y, z;
- [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll);
- Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x-2*z);
+ [x, y, z] = dt_Utility.GetPlayerAxes(self);
+ Vector3 origin = dt_Utility.GetFireOffset(self,10,0,-2);
FLineTraceData d;
double ang = (angle-60)+120*invoker.sawcnt;
LineTrace(ang,90,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d);
@@ -232,9 +232,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_Utility.GetAxes(angle,pitch,roll);
- Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),5*x+y-3*z);
+ Vector3 origin = dt_Utility.GetFireOffset(self,5,1,-3);
for ( int i=0; i<5; i++ )
{
let s = Spawn("UTViewSmoke",origin);
@@ -254,6 +252,7 @@ Class UTChainsaw : UTWeapon
Weapon.UpSound "chainsaw/select";
Weapon.SlotNumber 1;
Weapon.SelectionOrder 9;
+ UTWeapon.BobDamping .4;
+WEAPON.MELEEWEAPON;
+FORCEPAIN;
+NOEXTREMEDEATH;
diff --git a/zscript/dt_utility.zsc b/zscript/dt_utility.zsc
index 211379c..675bc8e 100644
--- a/zscript/dt_utility.zsc
+++ b/zscript/dt_utility.zsc
@@ -71,4 +71,81 @@ Class dt_Utility
Quat r = Quat.FromAngles(angle,pitch,roll);
return r*x, r*y, r*z;
}
+
+ // included here until Gutamatics updates to use native quaternions
+ static double, double, double ToAngles( Quat q )
+ {
+ double angle = 0., pitch = 0., roll = 0.;
+ double stest = q.z*q.x-q.w*q.y;
+ double angY = 2.*(q.w*q.z+q.x*q.y);
+ double angX = 1.-2.*(q.y*q.y+q.z*q.z);
+ if ( stest < -.4999995 )
+ {
+ angle = atan2(angY,angX);
+ pitch = 90.;
+ roll = dt_GM_GlobalMaths.Normalize180(angle+(2.*atan2(q.x,q.w)));
+ }
+ else if ( stest > .4999995 )
+ {
+ angle = atan2(angY,angX);
+ pitch = -90.;
+ roll = dt_GM_GlobalMaths.Normalize180(angle+(2.*atan2(q.x,q.w)));
+ }
+ else
+ {
+ angle = atan2(angY,angX);
+ pitch = -asin(2.*stest);
+ roll = atan2(2.*(q.w*q.x+q.y*q.z),1.-2.*(q.x*q.x+q.y*q.y));
+ }
+ return angle, pitch, roll;
+ }
+
+ // for aiming and shooting
+ static Vector3 GetPlayerViewDir( Actor player )
+ {
+ Quat r = Quat.FromAngles(player.angle,player.pitch,player.roll);
+ return r*(1,0,0);
+ }
+ static play Vector3 GetPlayerAimDir( Actor player )
+ {
+ FTranslatedLineTarget t;
+ double pitch = player.BulletSlope(t);
+ Quat r;
+ if ( !t.linetarget ) r = Quat.FromAngles(player.angle,player.pitch,player.roll);
+ else r = Quat.FromAngles(player.angle,pitch,player.roll);
+ return r*(1,0,0);
+ }
+ static Vector3, Vector3, Vector3 GetPlayerAxes( Actor player )
+ {
+ Quat r = Quat.FromAngles(player.angle,player.pitch,player.roll);
+ return r*(1,0,0), r*(0,-1,0), r*(0,0,1);
+ }
+ static play Vector3, Vector3, Vector3 GetPlayerAxesAutoAimed( Actor player )
+ {
+ FTranslatedLineTarget t;
+ double pitch = player.BulletSlope(t);
+ Quat r;
+ if ( !t.linetarget ) r = Quat.FromAngles(player.angle,player.pitch,player.roll);
+ else r = Quat.FromAngles(player.angle,pitch,player.roll);
+ return r*(1,0,0), r*(0,-1,0), r*(0,0,1);
+ }
+ static Vector3 GetPlayerEye( Actor player )
+ {
+ if ( !player.viewpos )
+ return player.Vec2OffsetZ(0,0,player.player.viewz);
+ if ( player.viewpos.flags&VPSF_ABSOLUTEPOS )
+ return player.viewpos.offset;
+ Vector3 origin = player.Vec2OffsetZ(0,0,player.player.viewz);
+ if ( player.viewpos.flags&VPSF_ABSOLUTEOFFSET )
+ return level.Vec3Offset(origin,player.viewpos.offset);
+ Quat r = Quat.FromAngles(player.angle,player.pitch,player.roll);
+ return level.Vec3Offset(origin,r*player.viewpos.offset);
+ }
+ static Vector3 GetFireOffset( Actor player, double x, double y, double z )
+ {
+ Vector3 origin = GetPlayerEye(player);
+ Quat r = Quat.FromAngles(player.angle,player.pitch,player.roll);
+ return level.Vec3Offset(origin,r*(x,-y,z));
+ }
+
}
diff --git a/zscript/eightball.zsc b/zscript/eightball.zsc
index 29fd7f1..49abb0c 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_Utility.GetAxes(angle,pitch,roll);
- Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+3*y-3*z);
- [x2, y2, z2] = dt_Utility.GetAxes(angle,BulletSlope(),roll);
+ [x, y, z] = dt_Utility.GetPlayerAxes(self);
+ Vector3 origin = dt_Utility.GetFireOffset(self,10,3,-3);
+ [x2, y2, z2] = dt_Utility.GetPlayerAxesAutoAimed(self);
Actor p;
if ( weap.bAltFire )
{
@@ -469,8 +469,8 @@ Class UTRocketLauncher : UTWeapon
while ( a = Actor(t.Next()) )
{
if ( !a.bSHOOTABLE || (a.Health <= 0) || a.bKilled || !a.bIsMonster || a.bCorpse || (a == self) || isTeammate(a) || !CheckSight(a) ) continue;
- Vector3 viewdir = dt_Utility.Vec3FromAngle(angle,pitch);
- Vector3 reldir = level.Vec3Diff(Vec2OffsetZ(0,0,player.viewz),a.Vec2OffsetZ(0,0,a.pos.z+a.height*0.5));
+ Vector3 viewdir = dt_Utility.GetPlayerViewDir(self);
+ Vector3 reldir = level.Vec3Diff(dt_Utility.GetPlayerEye(self),a.Vec2OffsetZ(0,0,a.pos.z+a.height*0.5));
double reldist = reldir.length();
if ( reldist > 2000 ) continue;
if ( reldir.unit() dot viewdir < 0.99 ) continue;
@@ -507,6 +507,7 @@ Class UTRocketLauncher : UTWeapon
Weapon.AmmoGive 6;
UTWeapon.DropAmmo 3;
UTWeapon.NameColor "FF 00 00";
+ UTWeapon.BobDamping .35;
}
States
{
diff --git a/zscript/enforcer.zsc b/zscript/enforcer.zsc
index 3766a04..26e0d37 100644
--- a/zscript/enforcer.zsc
+++ b/zscript/enforcer.zsc
@@ -33,9 +33,7 @@ Class EnforcerLight : DynamicLight
}
if ( target.player )
{
- Vector3 x, y, z, origin;
- [x, y, z] = dt_Utility.GetAxes(target.angle,target.pitch,target.roll);
- origin = level.Vec3Offset(target.Vec2OffsetZ(0,0,target.player.viewz),x*12);
+ Vector3 origin = dt_Utility.GetFireOffset(target,12,0,0);
SetOrigin(origin,true);
}
else SetOrigin(target.pos,true);
@@ -378,13 +376,13 @@ Class Enforcer : UTWeapon
A_OverlayRenderstyle(-2,STYLE_Add);
}
Vector3 x, y, z, x2, y2, z2;
- [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll);
- Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x);
+ [x, y, z] = dt_Utility.GetPlayerAxes(self);
int ydir = slave?-1:1;
- if ( alt ) origin = level.Vec3Offset(origin,-z*3+ydir*y);
- else origin = level.Vec3Offset(origin,-z+ydir*y*4);
+ Vector3 origin;
+ if ( alt ) origin = dt_Utility.GetFireOffset(self,10,ydir,-3);
+ else origin = dt_Utility.GetFireOffset(self,10,4*ydir,-1);
double a = FRandom[Enforcer](0,360), s = FRandom[Enforcer](0,alt?invoker.altaccuracy:0.004);
- [x2, y2, z2] = dt_Utility.GetAxes(angle,BulletSlope(),roll);
+ [x2, y2, z2] = dt_Utility.GetPlayerAxesAutoAimed(self);
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);
@@ -488,6 +486,7 @@ Class Enforcer : UTWeapon
Weapon.Kickback 180;
UTWeapon.DropAmmo 10;
UTWeapon.NameColor "C8 C8 FF";
+ UTWeapon.BobDamping 1.2;
Enforcer.ClipCount 20;
Enforcer.SlaveClipCount 20;
}
@@ -507,7 +506,8 @@ Class Enforcer : UTWeapon
invoker.slavedown = false;
if ( !invoker.slaveactive && (CountInv("Enforcer") > 1) )
{
- invoker.slavereload = invoker.slaverefire = 0;
+ invoker.slavereload = false;
+ invoker.slaverefire = 0;
A_Overlay(2,"LeftReady");
}
}
@@ -634,8 +634,8 @@ Class Enforcer : UTWeapon
UTPlayer(self).PlayReloading();
invoker.slavereload = (flak_enforcerreload&&invoker.slaveactive&&(invoker.slaveclipcount 2 ) Destroy();
}
@@ -683,12 +683,11 @@ 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_Utility.GetAxes(angle,pitch,roll);
- Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+4*y-3*z);
+ Vector3 origin = dt_Utility.GetFireOffset(self,10,4,-3);
A_Overlay(-2,"MuzzleFlash");
A_OverlayFlags(-2,PSPF_RENDERSTYLE|PSPF_FORCESTYLE,true);
A_OverlayRenderstyle(-2,STYLE_Add);
- [x, y, z] = dt_Utility.GetAxes(angle,BulletSlope(),roll);
+ [x, y, z] = dt_Utility.GetPlayerAxesAutoAimed(self);
Vector3 offsets[8]; // vanilla adds these to each chunk
offsets[0] = (0,0,0);
offsets[1] = -z;
@@ -741,8 +740,8 @@ 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_Utility.GetAxes(angle,pitch,roll);
- Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+2*y-3*z);
+ [x, y, z] = dt_Utility.GetPlayerAxes(self);
+ Vector3 origin = dt_Utility.GetFireOffset(self,10,2,-3);
A_Overlay(-2,"MuzzleFlash");
A_OverlayFlags(-2,PSPF_RENDERSTYLE|PSPF_FORCESTYLE,true);
A_OverlayRenderstyle(-2,STYLE_Add);
@@ -789,6 +788,7 @@ Class FlakCannon : UTWeapon
Weapon.AmmoGive 10;
UTWeapon.DropAmmo 5;
UTWeapon.NameColor "FF 60 00";
+ UTWeapon.BobDamping .3;
}
States
{
@@ -828,8 +828,8 @@ Class FlakCannon : UTWeapon
FLKF J 4
{
Vector3 x, y, z, origin;
- [x,y,z] = dt_Utility.GetAxes(angle,pitch,roll);
- origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),x*4.+y*3.-z*8.);
+ [x,y,z] = dt_Utility.GetPlayerAxes(self);
+ origin = dt_Utility.GetFireOffset(self,4,3,-8);
let c = Spawn("FlakMag",origin);
c.angle = angle;
c.pitch = pitch;
diff --git a/zscript/impacthammer.zsc b/zscript/impacthammer.zsc
index 043d6f1..300fc44 100644
--- a/zscript/impacthammer.zsc
+++ b/zscript/impacthammer.zsc
@@ -106,9 +106,7 @@ Class ImpactHammer : UTWeapon
return;
}
FLineTraceData d;
- Vector3 x, y, z;
- [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll);
- Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+3*y-4*z);
+ Vector3 origin = dt_Utility.GetFireOffset(self,10,3,-4);
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"));
@@ -121,9 +119,8 @@ Class ImpactHammer : UTWeapon
A_StartSound("impact/release",CHAN_WEAPON);
invoker.FireEffect();
A_AlertMonsters(gameinfo.gametype&GAME_Strife?100:0);
- Vector3 x, y, z;
- [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll);
- Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+3*y-4*z);
+ Vector3 x = dt_Utility.GetPlayerViewDir(self);
+ Vector3 origin = dt_Utility.GetFireOffset(self,10,3,-4);
double realcharge = min(1.5,invoker.chargesize);
FLineTraceData d;
LineTrace(angle,60,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d);
@@ -187,8 +184,8 @@ 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_Utility.GetAxes(angle,pitch,roll);
- Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+3*y-4*z);
+ [x, y, z] = dt_Utility.GetPlayerAxes(self);
+ Vector3 origin = dt_Utility.GetFireOffset(self,10,3,-4);
FLineTraceData d;
LineTrace(angle,120,BulletSlope(),TRF_ABSPOSITION,origin.z,origin.x,origin.y,d);
double dscale = d.Distance/120.;
@@ -250,6 +247,7 @@ Class ImpactHammer : UTWeapon
Weapon.SelectionOrder 9;
+WEAPON.MELEEWEAPON;
UTWeapon.NameColor "FF C0 00";
+ UTWeapon.BobDamping 1.1;
}
States
{
diff --git a/zscript/minigun.zsc b/zscript/minigun.zsc
index 3ff7408..01f5f9b 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_Utility.GetAxes(angle,pitch,roll);
- Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+y*2-z*2);
+ [x, y, z] = dt_Utility.GetPlayerAxes(self);
+ Vector3 origin = dt_Utility.GetFireOffset(self,10,2,-2);
double a = FRandom[Minigun](0,360), s = FRandom[Minigun](0,alt?0.05:0.02);
- [x2, y2, z2] = dt_Utility.GetAxes(angle,BulletSlope(),roll);
+ [x2, y2, z2] = dt_Utility.GetPlayerAxesAutoAimed(self);
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);
@@ -223,6 +223,7 @@ Class Minigun : UTWeapon
Weapon.Kickback 180;
UTWeapon.DropAmmo 20;
UTWeapon.NameColor "FF FF 00";
+ UTWeapon.BobDamping .65;
}
States
{
diff --git a/zscript/powerups.zsc b/zscript/powerups.zsc
index c8b0c85..ad1dbfa 100644
--- a/zscript/powerups.zsc
+++ b/zscript/powerups.zsc
@@ -53,7 +53,7 @@ Class DamageAmpLight : DynamicLight
return;
}
if ( target.player )
- SetOrigin(target.Vec2OffsetZ(0,0,target.player.viewz),true);
+ SetOrigin(dt_Utility.GetPlayerEye(target),true);
else SetOrigin(target.Vec3Offset(0,0,target.height/2),true);
args[LIGHT_INTENSITY] = Random[UDamage](10,12)*8;
bDORMANT = Powerup(master).isBlinking();
@@ -160,7 +160,7 @@ Class UTInvulLight : DynamicLight
return;
}
if ( target.player )
- SetOrigin(target.Vec2OffsetZ(0,0,target.player.viewz),true);
+ SetOrigin(dt_Utility.GetPlayerEye(target),true);
else SetOrigin(target.Vec3Offset(0,0,target.height/2),true);
args[LIGHT_INTENSITY] = Random[UInvuln](10,12)*8;
bDORMANT = Powerup(master).isBlinking();
@@ -575,10 +575,8 @@ Class UTVisionLight : DynamicLight
Destroy();
return;
}
- Vector3 x, y, z, origin;
- [x, y, z] = dt_Utility.GetAxes(target.angle,target.pitch,target.roll);
- if ( target.player )
- origin = target.Vec2OffsetZ(0,0,target.player.viewz);
+ Vector3 origin;
+ if ( target.player ) origin = dt_Utility.GetPlayerEye(target);
else origin = target.Vec3Offset(0,0,target.height/2);
SetOrigin(origin,true);
angle = target.angle;
diff --git a/zscript/pulsegun.zsc b/zscript/pulsegun.zsc
index d5da63c..da2bb89 100644
--- a/zscript/pulsegun.zsc
+++ b/zscript/pulsegun.zsc
@@ -107,9 +107,7 @@ Class ViewPulseSpark : PulseSpark
Destroy();
return;
}
- Vector3 x, y, z;
- [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);
+ Vector3 origin = dt_Utility.GetFireOffset(target,ofs.x,ofs.y,ofs.z);
SetOrigin(origin,true);
bInvisible = (players[consoleplayer].camera != target);
if ( isFrozen() ) return;
@@ -536,13 +534,9 @@ Class StarterBolt : PulseBolt
Destroy();
return;
}
- Vector3 x, y, z, origin;
+ Vector3 origin;
bRELATIVETOFLOOR = (target.pos.z <= target.floorz); // hack, but kinda works
- if ( target.player )
- {
- [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);
- }
+ if ( target.player ) origin = dt_Utility.GetFireOffset(target,8,4.1,-2.7);
else origin = target.Vec3Offset(0,0,target.missileheight);
SetOrigin(origin,true);
A_SetAngle(target.angle);
@@ -677,9 +671,7 @@ Class PulseGun : UTWeapon
invoker.FireEffect();
UTMainHandler.DoFlash(self,Color(32,128,255,128),1);
A_AlertMonsters();
- Vector3 x, y, z;
- [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);
+ Vector3 origin = dt_Utility.GetFireOffset(self,10,4.1,-2.7);
for ( int i=0; i<4; i++ )
{
let s = Spawn("UTViewSmoke",origin);
@@ -743,8 +735,8 @@ Class PulseGun : UTWeapon
A_OverlayRenderstyle(-2,STYLE_Add);
Vector3 x, y, z;
double a;
- [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);
+ [x, y, z] = dt_Utility.GetPlayerAxes(self);
+ Vector3 origin = dt_Utility.GetFireOffset(self,10,3,-1.8);
origin = level.Vec3Offset(origin,dt_Utility.CircleOffset(y,z,invoker.sangle,2));
invoker.sangle += 100;
Actor p = Spawn("PulseBall",origin);
@@ -775,9 +767,7 @@ Class PulseGun : UTWeapon
{
invoker.special1 = 0;
A_StartSound("pulse/bolt",CHAN_WEAPON,CHANF_LOOPING);
- Vector3 x, y, z, origin;
- [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);
+ Vector3 origin = dt_Utility.GetFireOffset(self,10,4.1,-2.7);
invoker.beam = Spawn("StarterBolt",origin);
invoker.beam.angle = angle;
invoker.beam.pitch = BulletSlope();
@@ -818,6 +808,7 @@ Class PulseGun : UTWeapon
PulseGun.ClipCount 50;
UTWeapon.DropAmmo 15;
UTWeapon.NameColor "80 FF 80";
+ UTWeapon.BobDamping .4;
}
States
{
@@ -901,8 +892,8 @@ Class PulseGun : UTWeapon
PGR2 A 1
{
Vector3 x, y, z, origin;
- [x,y,z] = dt_Utility.GetAxes(angle,pitch,roll);
- origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),x*4.-y*6.-z*8.);
+ [x,y,z] = dt_Utility.GetPlayerAxes(self);
+ origin = dt_Utility.GetFireOffset(self,4,-6,-8);
let c = Spawn("PulseMag",origin);
c.angle = angle;
c.pitch = pitch;
diff --git a/zscript/ripper.zsc b/zscript/ripper.zsc
index 1715837..507562f 100644
--- a/zscript/ripper.zsc
+++ b/zscript/ripper.zsc
@@ -241,6 +241,7 @@ Class Ripper2 : UTWeapon
Weapon.AmmoGive 10;
UTWeapon.DropAmmo 5;
UTWeapon.NameColor "00 FF FF";
+ UTWeapon.BobDamping .35;
}
action void A_RazorFire( bool alt = false )
{
@@ -255,9 +256,7 @@ Class Ripper2 : UTWeapon
A_AlertMonsters();
if ( alt ) A_QuakeEx(3,3,3,8,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.1);
else A_QuakeEx(1,1,1,5,0,1,"",QF_RELATIVE|QF_SCALEDOWN,rollIntensity:0.08);
- Vector3 x, y, z;
- [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll);
- Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+6*y-4*z);
+ Vector3 origin = dt_Utility.GetFireOffset(self,10,6,-4);
Actor p;
if ( alt ) p = Spawn("Razor2Alt",origin);
else p = Spawn("Razor2",origin);
diff --git a/zscript/shockrifle.zsc b/zscript/shockrifle.zsc
index 77209bd..3d0af44 100644
--- a/zscript/shockrifle.zsc
+++ b/zscript/shockrifle.zsc
@@ -1035,9 +1035,7 @@ Class ViewShockSpark : ShockSpark
Destroy();
return;
}
- Vector3 x, y, z;
- [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);
+ Vector3 origin = dt_Utility.GetFireOffset(target,ofs.x,ofs.y,ofs.z);
SetOrigin(origin,true);
bInvisible = (players[consoleplayer].camera != target);
if ( isFrozen() ) return;
@@ -1068,9 +1066,7 @@ Class ShockRifle : UTWeapon
UTMainHandler.DoFlash(self,Color(128,128,0,255),1);
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_Utility.GetAxes(angle,pitch,roll);
- Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+2*y-1.5*z);
+ Vector3 origin = dt_Utility.GetFireOffset(self,10,2,-1.5);
Actor p = Spawn("ShockBeam",origin);
p.angle = angle;
p.pitch = BulletSlope();
@@ -1105,9 +1101,7 @@ Class ShockRifle : UTWeapon
UTMainHandler.DoFlash(self,Color(128,128,0,255),1);
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_Utility.GetAxes(angle,pitch,roll);
- Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+2*y-1.5*z);
+ Vector3 origin = dt_Utility.GetFireOffset(self,10,2,-1.5);
Actor p = Spawn("ShockBall",origin);
p.angle = angle;
p.pitch = BulletSlope();
@@ -1147,6 +1141,7 @@ Class ShockRifle : UTWeapon
Weapon.AmmoGive 20;
UTWeapon.DropAmmo 5;
UTWeapon.NameColor "80 00 FF";
+ UTWeapon.BobDamping .4;
}
States
{
@@ -1250,9 +1245,7 @@ Class EnhancedShockRifle : UTWeapon
UTMainHandler.DoFlash(self,Color(128,255,128,0),1);
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_Utility.GetAxes(angle,pitch,roll);
- Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+2*y-1.5*z);
+ Vector3 origin = dt_Utility.GetFireOffset(self,10,2,-1.5);
Actor p = Spawn("SuperShockBeam",origin);
p.angle = angle;
p.pitch = BulletSlope();
@@ -1287,9 +1280,7 @@ Class EnhancedShockRifle : UTWeapon
UTMainHandler.DoFlash(self,Color(128,255,128,0),1);
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_Utility.GetAxes(angle,pitch,roll);
- Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+2*y-1.5*z);
+ Vector3 origin = dt_Utility.GetFireOffset(self,10,2,-1.5);
Actor p = Spawn("SuperShockBall",origin);
p.angle = angle;
p.pitch = BulletSlope();
@@ -1334,6 +1325,7 @@ Class EnhancedShockRifle : UTWeapon
Weapon.AmmoGive 50;
UTWeapon.DropAmmo 5;
UTWeapon.NameColor "80 00 FF";
+ UTWeapon.BobDamping .4;
+WEAPON.AMMO_OPTIONAL;
+WEAPON.ALT_AMMO_OPTIONAL;
+WEAPON.CHEATNOTWEAPON;
diff --git a/zscript/sniperrifle.zsc b/zscript/sniperrifle.zsc
index 1220737..c3e6ad3 100644
--- a/zscript/sniperrifle.zsc
+++ b/zscript/sniperrifle.zsc
@@ -95,9 +95,10 @@ Class SniperRifle : UTWeapon
let l = Spawn("SniperLight",pos);
l.target = self;
Vector3 x, y, z;
- [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);
+ [x, y, z] = dt_Utility.GetPlayerAxes(self);
+ Vector3 origin;
+ if ( zoomed ) origin = dt_Utility.GetFireOffset(self,10,0,0);
+ else origin = dt_Utility.GetFireOffset(self,10,4,-2);
FLineTraceData d;
double pt = BulletSlope();
LineTrace(angle,10000,pt,TRF_ABSPOSITION,origin.z,origin.x,origin.y,d);
@@ -189,6 +190,7 @@ Class SniperRifle : UTWeapon
Weapon.Kickback 250;
UTWeapon.DropAmmo 2;
UTWeapon.NameColor "00 00 FF";
+ UTWeapon.BobDamping .35;
+NOEXTREMEDEATH;
}
States
diff --git a/zscript/translocator.zsc b/zscript/translocator.zsc
index 389c0f3..bbc3797 100644
--- a/zscript/translocator.zsc
+++ b/zscript/translocator.zsc
@@ -416,9 +416,7 @@ Class Translocator : UTWeapon
A_StartSound("transloc/throw",CHAN_WEAPON);
invoker.FireEffect();
A_AlertMonsters();
- Vector3 x, y, z;
- [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll);
- Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x-8*y-12*z);
+ Vector3 origin = dt_Utility.GetFireOffset(self,10,-8,-12);
let p = Spawn("TranslocatorModule",origin);
p.target = self;
p.angle = angle;
@@ -591,9 +589,7 @@ Class OldTranslocator : Translocator
A_StartSound("transloc/throw",CHAN_WEAPON);
invoker.FireEffect();
A_AlertMonsters();
- Vector3 x, y, z;
- [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;
+ Vector3 origin = dt_Utility.GetFireOffset(self,10,-10,-4);
let p = Spawn("OldTranslocatorModule",origin);
p.target = self;
p.angle = angle;
diff --git a/zscript/utcommon.zsc b/zscript/utcommon.zsc
index d5ba9d7..8b4999a 100644
--- a/zscript/utcommon.zsc
+++ b/zscript/utcommon.zsc
@@ -83,6 +83,9 @@ Class UTPlayer : DoomPlayer
VOICE_Boss
};
+ double bobtime, oldbobtime, oldbob;
+ Vector3 oldwalkbob, walkbob;
+
const groundspeed = 400.;
const swimspeed = 200.;
const baseaccelrate = 2048.;
@@ -353,87 +356,97 @@ Class UTPlayer : DoomPlayer
return 734.2969*fin*fin-1485.0868*fin+750.7899;
}
+ virtual clearscope Vector3 GetWeaponBob( double ticfrac )
+ {
+ Vector3 bob = (oldwalkbob*(1.-ticfrac)+walkbob*ticfrac);
+ double bobdamping = .95;
+ if ( player.ReadyWeapon is 'UTWeapon' )
+ bobdamping = UTWeapon(player.ReadyWeapon).bobdamping;
+ Vector3 weaponbob = bobdamping*bob;
+ return weaponbob;
+ }
+
+ override Vector3, Vector3 BobWeapon3D( double ticfrac )
+ {
+ Quat r = Quat.FromAngles(angle,pitch,roll);
+ r.xyz = -r.xyz;
+ Vector3 bob = r*GetWeaponBob(ticfrac);
+ return (bob.y,bob.z,bob.x), (0,0,0);
+ }
+
+ // we can't reproduce this 1:1 with unreal due to some math quirks between engines
+ virtual void CheckBob( double bob )
+ {
+ oldbobtime = bobtime;
+ double vel2d = vel.xy.length();
+ Vector3 x, y, z;
+ [x, y, z] = dt_Utility.GetPlayerAxes(self);
+ if ( vel2d < .25 ) bobtime += .2/GameTicRate;
+ else bobtime += (.3+.7*(vel2d/5.))/GameTicRate;
+ oldwalkbob = walkbob;
+ walkbob = y*sin(bobtime*180.)*bob*.2;
+ walkbob.z = sin(bobtime*360.)*bob*.15;
+ walkbob *= clamp(viewbob,0.,1.5);
+ SetViewPos(walkbob,VPSF_ABSOLUTEOFFSET);
+ }
+
override void CalcHeight()
{
- if ( !flak_utmovement || !player || (player.mo != self) )
+ if ( !player || (player.mo != self) )
{
Super.CalcHeight();
return;
}
- double angle, bob;
- bool still = false;
- // no bobbing while:
- // - using noclip2 (equivalent to unreal's ghost cheat)
- // - flying
- // - swimming
- // - falling
- if ( !bNoGravity && player.onground && (waterlevel < 2) )
- {
- player.bob = player.Vel dot player.Vel;
- if ( player.bob == 0 ) still = true;
- else
- {
- player.bob *= player.GetMoveBob();
- if ( player.bob > MAXBOB ) player.bob = MAXBOB;
- }
- }
+ double defviewh = viewheight+player.crouchviewdelta;
+ oldbob = player.bob;
+ if ( bFlyCheat || (player.cheats&CF_NOCLIP2) )
+ player.bob = 0.;
else
- {
- // this still doesn't help because fly bob is hardcoded
- player.bob = 0;
- }
- double defaultviewheight = ViewHeight+player.crouchviewdelta;
+ player.bob = min((player.vel dot player.vel)*player.GetMoveBob(),MAXBOB);
if ( player.cheats&CF_NOVELOCITY )
{
- player.viewz = pos.z+defaultviewheight;
- if ( player.viewz > ceilingz-4 ) player.viewz = ceilingz-4;
+ player.viewz = pos.z+defviewh;
+ if ( player.viewz > ceilingz-4 )
+ player.viewz = ceilingz-4;
+ oldwalkbob = walkbob = (0,0,0);
+ SetViewPos((0,0,0),VPSF_ABSOLUTEOFFSET);
return;
}
- if ( still )
- {
- if ( player.health > 0 )
- {
- angle = Level.maptime/(120*TICRATE/35.)*360.;
- bob = player.GetStillBob()*sin(angle);
- }
- else bob = 0;
- }
- else
- {
- angle = Level.maptime/(20*TICRATE/35.)*360.;
- bob = player.bob*sin(angle)*((waterlevel>1)?0.25:0.5);
- }
- // move viewheight
+ // adjust viewheight
if ( player.playerstate == PST_LIVE )
{
player.viewheight += player.deltaviewheight;
- if ( player.viewheight > defaultviewheight )
+ if ( player.viewheight > defviewh )
{
- player.viewheight = defaultviewheight;
- player.deltaviewheight = 0;
+ player.viewheight = defviewh;
+ player.deltaviewheight = 0.;
}
- else if ( player.viewheight < (defaultviewheight/2) )
+ else if ( player.viewheight < (defviewh/2.) )
{
- player.viewheight = defaultviewheight/2;
- if ( player.deltaviewheight <= 0 )
- player.deltaviewheight = 1/65536.;
+ player.viewheight = defviewh/2.;
+ if ( player.deltaviewheight <= 0. )
+ player.deltaviewheight = 1./65536.;
}
if ( player.deltaviewheight )
{
- player.deltaviewheight += 0.25;
+ player.deltaviewheight += .25;
if ( !player.deltaviewheight )
- player.deltaviewheight = 1/65536.;
+ player.deltaviewheight = 1./65536.;
}
}
- if ( player.morphTics ) bob = 0;
- player.viewz = pos.z+player.viewheight+(bob*clamp(ViewBob,0.,1.5)); // [SP] Allow DECORATE changes to view bobbing speed.
+ // apply bobbing
+ CheckBob(player.morphtics?0.:player.bob);
+ // set up viewz
+ player.viewz = pos.z+player.viewheight;
// handle smooth step down (hacky but looks ok)
player.viewz += ssup;
- ssup = max(0,(ssup*0.7)-0.25);
+ ssup = max(0,(ssup*.7)-.25);
if ( floorclip && (player.playerstate != PST_DEAD) && (pos.z <= floorz) )
- player.viewz -= Floorclip;
- if ( player.viewz > ceilingz-4 ) player.viewz = ceilingz-4;
- if ( player.viewz < floorz+4 ) player.viewz = floorz+4;
+ player.viewz -= floorclip;
+ if ( player.viewz > ceilingz-4 )
+ player.viewz = ceilingz-4;
+ if ( player.viewz < floorz+4 )
+ player.viewz = floorz+4;
}
override void MovePlayer()
@@ -533,7 +546,7 @@ Class UTPlayer : DoomPlayer
player.cheats &= ~CF_REVERTPLEASE;
player.camera = player.mo;
}
- player.vel *= 0;
+ player.vel *= .8;
player.jumptics = -2;
}
else
@@ -569,8 +582,8 @@ Class UTPlayer : DoomPlayer
if ( acceleration.length() <= double.epsilon ) PlayIdle();
else PlayRunning();
}
- if ( tempslide ) player.vel *= 0;
- else player.vel = vel.xy;
+ if ( tempslide ) player.vel *= .8;
+ else player.vel = player.vel*.8+vel.xy*.2;
}
}
else if ( !bNoGravity && (waterlevel < 1) )
@@ -600,7 +613,7 @@ Class UTPlayer : DoomPlayer
}
else vel.xy = vel.xy+acceleration/TICRATE;
if ( vel.length() > terminalvelocity/TICRATE ) vel = vel.unit()*(terminalvelocity/TICRATE);
- player.vel *= 0;
+ player.vel *= .8;
player.jumptics = -2;
if ( !(player.cheats & CF_PREDICTING) ) PlayIdle();
}
@@ -627,7 +640,7 @@ Class UTPlayer : DoomPlayer
else maxvel = groundspeed/TICRATE;
maxvel *= fs;
if ( vel.length() > maxvel ) vel = vel.unit()*maxvel;
- player.vel *= 0;
+ player.vel *= .8;
player.jumptics = -2;
if ( !(player.cheats & CF_PREDICTING) ) PlayIdle();
}
@@ -669,7 +682,7 @@ Class UTPlayer : DoomPlayer
}
maxvel *= fs*doomfriction;
if ( vel.length() > maxvel ) vel = vel.unit()*maxvel;
- player.vel = vel.xy;
+ player.vel = player.vel*.8+vel.xy*.2;
player.jumptics = -2;
if ( !(player.cheats & CF_PREDICTING) )
{
@@ -1877,9 +1890,11 @@ Class UTWeapon : Weapon
bool bExtraPickup;
transient int lastnoammotic;
Color NameColor;
+ double bobdamping;
Property DropAmmo: DropAmmo;
Property NameColor: NameColor;
+ Property BobDamping: BobDamping;
// Drawstuffs under HUD
virtual ui void PreRender( double lbottom ) {}
@@ -2025,7 +2040,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_Utility.GetAxes(dropper.angle,dropper.pitch,dropper.roll);
+ [x, y, z] = dt_Utility.GetPlayerAxes(dropper);
vel = x*12.0;
vel.z += 4.0;
angle = dropper.angle;
@@ -2056,6 +2071,7 @@ Class UTWeapon : Weapon
Weapon.BobRangeY 0.4;
Weapon.YAdjust 0;
UTWeapon.NameColor "FF FF FF";
+ UTWeapon.BobDamping .96;
+WEAPON.NOALERT;
}
}
@@ -2214,9 +2230,7 @@ Class UTViewSpark : UTSpark
Destroy();
return;
}
- Vector3 x, y, z;
- [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);
+ Vector3 origin = dt_Utility.GetFireOffset(target,ofs.x,ofs.y,ofs.z);
SetOrigin(origin,true);
bInvisible = (players[consoleplayer].camera != target);
if ( isFrozen() ) return;
@@ -2461,9 +2475,7 @@ Class UTViewSmoke : UTSmoke
Destroy();
return;
}
- Vector3 x, y, z;
- [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);
+ Vector3 origin = dt_Utility.GetFireOffset(target,ofs.x,ofs.y,ofs.z);
SetOrigin(origin,true);
bInvisible = (players[consoleplayer].camera != target);
if ( isFrozen() ) return;
diff --git a/zscript/uthud.zsc b/zscript/uthud.zsc
index e88e102..7d0b83a 100644
--- a/zscript/uthud.zsc
+++ b/zscript/uthud.zsc
@@ -1156,7 +1156,8 @@ Class UTHud : BaseStatusBar
lastfragcnt = CPlayer.killcount;
}
vtracer.ignore = CPlayer.mo;
- vtracer.trace(CPlayer.mo.Vec2OffsetZ(0,0,CPlayer.viewz),CPlayer.mo.CurSector,dt_Utility.Vec3FromAngle(CPlayer.mo.angle,CPlayer.mo.pitch),1000,0);
+ Vector3 origin = dt_Utility.GetPlayerEye(CPlayer.mo);
+ vtracer.trace(origin,level.PointInSector(origin.xy),dt_Utility.GetPlayerViewDir(CPlayer.mo),1000,0);
if ( vtracer.Results.HitType != TRACE_HitActor ) return;
lastseen = vtracer.Results.HitActor;
lastseentic = level.time;
diff --git a/zscript/warheadlauncher.zsc b/zscript/warheadlauncher.zsc
index 5b5beb0..68e00b2 100644
--- a/zscript/warheadlauncher.zsc
+++ b/zscript/warheadlauncher.zsc
@@ -445,11 +445,11 @@ Class GuidedWarShell : WarShell
guideangle = lagangle2*0.95+lagangle*0.05;
guidepitch = lagpitch2*0.95+lagpitch*0.05;
guideroll = lagroll2*0.95+lagroll*0.05;
- dt_GM_Quaternion orient = dt_GM_Quaternion.createFromAngles(angle,pitch,roll);
- dt_GM_Quaternion angles = dt_GM_Quaternion.createFromAngles(guideangle,guidepitch,guideroll);
- orient = orient.multiplyQuat(angles);
+ Quat orient = Quat.FromAngles(angle,pitch,roll);
+ Quat angles = Quat.FromAngles(guideangle,guidepitch,guideroll);
+ orient *= angles;
double nangle, npitch, nroll;
- [nangle, npitch, nroll] = orient.toAngles();
+ [nangle, npitch, nroll] = dt_Utility.ToAngles(orient);
angle = nangle;
pitch = npitch;
roll = nroll;
@@ -650,10 +650,8 @@ Class WarheadLauncher : UTWeapon
UTMainHandler.DoFlash(self,Color(128,255,128,128),1);
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_Utility.GetAxes(angle,pitch,roll);
- vel -= x*10;
- Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+2*y-2*z);
+ vel -= dt_Utility.GetPlayerViewDir(self)*10;
+ Vector3 origin = dt_Utility.GetFireOffset(self,10,2,-2);
Actor p = Spawn("WarShell",origin);
p.angle = angle;
p.pitch = BulletSlope();
@@ -665,9 +663,9 @@ Class WarheadLauncher : UTWeapon
Weapon weap = Weapon(invoker);
if ( !weap ) return;
Vector3 x, y, z;
- [x, y, z] = dt_Utility.GetAxes(angle,pitch,roll);
+ [x, y, z] = dt_Utility.GetPlayerAxes(self);
vel -= x*0.2;
- Vector3 origin = level.Vec3Offset(Vec2OffsetZ(0,0,player.viewz),10*x+2*y-2*z);
+ Vector3 origin = dt_Utility.GetFireOffset(self,10,2,-2);
int numpt = Random[Warhead](10,20);
for ( int i=0; i