]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make stepnormal available to the above functions, fixes some discrepancies in QC...
authorMario <mario.mario@y7mail.com>
Sun, 15 Sep 2019 06:09:28 +0000 (16:09 +1000)
committerMario <mario.mario@y7mail.com>
Sun, 15 Sep 2019 06:09:28 +0000 (16:09 +1000)
qcsrc/common/physics/movetypes/movetypes.qc
qcsrc/common/physics/movetypes/movetypes.qh
qcsrc/common/physics/movetypes/step.qc
qcsrc/common/physics/movetypes/walk.qc

index 4539466a24feb9f10d97f6652f3eb31c519af490..8eb2277d54ad9cd2b98c2d9dc5d2199725245c7c 100644 (file)
@@ -34,8 +34,10 @@ void _Movetype_WallFriction(entity this, vector stepnormal)  // SV_WallFriction
 }
 
 vector planes[MAX_CLIP_PLANES];
-int _Movetype_FlyMove(entity this, float dt, bool applygravity, vector stepnormal, float stepheight) // SV_FlyMove
+int _Movetype_FlyMove(entity this, float dt, bool applygravity, bool applystepnormal, float stepheight) // SV_FlyMove
 {
+       move_stepnormal = '0 0 0';
+
        if(dt <= 0)
                return 0;
 
@@ -150,8 +152,8 @@ int _Movetype_FlyMove(entity this, float dt, bool applygravity, vector stepnorma
                        // step - return it to caller
                        blocked |= 2;
                        // save the trace for player extrafriction
-                       if(stepnormal)
-                               stepnormal = trace_plane_normal;
+                       if(applystepnormal)
+                               move_stepnormal = trace_plane_normal;
                }
 
                if(my_trace_fraction >= 0.001)
index 1eb2d95e47b8ab98c8ae6d96e4c24b6135f16b7a..51da5e730c1169de3b2552b93953d0b68b0720b2 100644 (file)
@@ -85,8 +85,11 @@ const int UNSTICK_FINE = 0;
 const int UNSTICK_FIXED = 1;
 const int UNSTICK_STUCK = 2;
 
+// set by _Movetype_FlyMove
+vector move_stepnormal;
+
 void _Movetype_WallFriction(entity this, vector stepnormal);
-int _Movetype_FlyMove(entity this, float dt, bool applygravity, vector stepnormal, float stepheight);
+int _Movetype_FlyMove(entity this, float dt, bool applygravity, bool applystepnormal, float stepheight);
 void _Movetype_CheckVelocity(entity this);
 void _Movetype_CheckWaterTransition(entity ent);
 void _Movetype_CheckStuck(entity this);
index a41269f79c562122fe8f01e6745cfa7df2180748..30ebe6afadf73a244831de58421d3afe60379066 100644 (file)
@@ -7,14 +7,14 @@ void _Movetype_Physics_Step(entity this, float dt) // SV_Physics_Step
                {
                        UNSET_ONGROUND(this);
                        _Movetype_CheckVelocity(this);
-                       _Movetype_FlyMove(this, dt, true, '0 0 0', 0);
+                       _Movetype_FlyMove(this, dt, true, false, 0);
                        _Movetype_LinkEdict(this, true);
                }
        }
        else
        {
                _Movetype_CheckVelocity(this);
-               _Movetype_FlyMove(this, dt, true, '0 0 0', 0);
+               _Movetype_FlyMove(this, dt, true, false, 0);
                _Movetype_LinkEdict(this, true);
 
                // TODO? movetypesteplandevent
index 5c7ae9ee2a6e2797e7c2b4db9f09d8a42e1c3548..13224f8a3443d022658aa9307dca2f522979d16f 100644 (file)
@@ -1,8 +1,6 @@
 #include "walk.qh"
 void _Movetype_Physics_Walk(entity this, float dt)  // SV_WalkMove
 {
-       vector stepnormal = '0 0 0';
-
        // if frametime is 0 (due to client sending the same timestamp twice), don't move
        if (dt <= 0)
                return;
@@ -28,7 +26,7 @@ void _Movetype_Physics_Walk(entity this, float dt)  // SV_WalkMove
                        this.pm_time -= dt;
        }
 
-       int clip = _Movetype_FlyMove(this, dt, applygravity, stepnormal, GAMEPLAYFIX_STEPMULTIPLETIMES(this) ? PHYS_STEPHEIGHT(this) : 0);
+       int clip = _Movetype_FlyMove(this, dt, applygravity, false, GAMEPLAYFIX_STEPMULTIPLETIMES(this) ? PHYS_STEPHEIGHT(this) : 0);
 
        if (GAMEPLAYFIX_DOWNTRACEONGROUND(this) && !(clip & 1))
        {
@@ -108,7 +106,7 @@ void _Movetype_Physics_Walk(entity this, float dt)  // SV_WalkMove
 
                // move forward
                this.velocity_z = 0;
-               clip = _Movetype_FlyMove(this, dt, applygravity, stepnormal, 0);
+               clip = _Movetype_FlyMove(this, dt, applygravity, true, 0);
                this.velocity_z += start_velocity.z;
                if (clip & 8)
                {
@@ -142,7 +140,7 @@ void _Movetype_Physics_Walk(entity this, float dt)  // SV_WalkMove
 
                // extra friction based on view angle
                if ((clip & 2) && PHYS_WALLFRICTION(this))
-                       _Movetype_WallFriction(this, stepnormal);
+                       _Movetype_WallFriction(this, move_stepnormal);
        }
        // don't do the down move if stepdown is disabled, moving upward, not in water, or the move started offground or ended onground
        else if (!GAMEPLAYFIX_STEPDOWN(this) || this.waterlevel >= 3 || start_velocity.z >= (1.0 / 32.0) || !oldonground || IS_ONGROUND(this))