From: Mario Date: Sun, 15 Sep 2019 06:09:28 +0000 (+1000) Subject: Make stepnormal available to the above functions, fixes some discrepancies in QC... X-Git-Tag: xonotic-v0.8.5~1284 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ba17f8c303822e20bf2de08d616b3884f00f9b1f;p=xonotic%2Fxonotic-data.pk3dir.git Make stepnormal available to the above functions, fixes some discrepancies in QC physics --- diff --git a/qcsrc/common/physics/movetypes/movetypes.qc b/qcsrc/common/physics/movetypes/movetypes.qc index 4539466a2..8eb2277d5 100644 --- a/qcsrc/common/physics/movetypes/movetypes.qc +++ b/qcsrc/common/physics/movetypes/movetypes.qc @@ -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) diff --git a/qcsrc/common/physics/movetypes/movetypes.qh b/qcsrc/common/physics/movetypes/movetypes.qh index 1eb2d95e4..51da5e730 100644 --- a/qcsrc/common/physics/movetypes/movetypes.qh +++ b/qcsrc/common/physics/movetypes/movetypes.qh @@ -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); diff --git a/qcsrc/common/physics/movetypes/step.qc b/qcsrc/common/physics/movetypes/step.qc index a41269f79..30ebe6afa 100644 --- a/qcsrc/common/physics/movetypes/step.qc +++ b/qcsrc/common/physics/movetypes/step.qc @@ -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 diff --git a/qcsrc/common/physics/movetypes/walk.qc b/qcsrc/common/physics/movetypes/walk.qc index 5c7ae9ee2..13224f8a3 100644 --- a/qcsrc/common/physics/movetypes/walk.qc +++ b/qcsrc/common/physics/movetypes/walk.qc @@ -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))