From 7430a90e996f563c8893771f4ec0141a5a6e771e Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 18 Dec 2015 03:48:38 +1000 Subject: [PATCH] Some minor changes to support movetype prediction --- qcsrc/common/physics.qc | 8 +++++++- qcsrc/common/physics.qh | 4 ++++ qcsrc/common/stats.qh | 2 ++ qcsrc/lib/csqcmodel/cl_player.qc | 2 +- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/qcsrc/common/physics.qc b/qcsrc/common/physics.qc index ff54434a8..292da1491 100644 --- a/qcsrc/common/physics.qc +++ b/qcsrc/common/physics.qc @@ -121,6 +121,8 @@ void PM_ClientMovement_Unstick(entity this) void PM_ClientMovement_UpdateStatus(entity this, bool ground) { #ifdef CSQC + if(!IS_PLAYER(this)) + return; // make sure player is not stuck if(autocvar_cl_movement != 3) PM_ClientMovement_Unstick(this); @@ -1288,6 +1290,8 @@ void PM_Main(entity this) this.movement = PHYS_INPUT_MOVEVALUES(this); + this.spectatorspeed = STAT(SPECTATORSPEED); + vector oldv_angle = this.v_angle; vector oldangles = this.angles; // we need to save these, as they're abused by other code this.v_angle = PHYS_INPUT_ANGLES(this); @@ -1392,9 +1396,9 @@ void PM_Main(entity this) MUTATOR_CALLHOOK(PlayerPhysics, this); -#ifdef SVQC if (!IS_PLAYER(this)) { +#ifdef SVQC maxspeed_mod = autocvar_sv_spectator_speed_multiplier; if (!this.spectatorspeed) this.spectatorspeed = maxspeed_mod; @@ -1413,8 +1417,10 @@ void PM_Main(entity this) } // otherwise just clear this.impulse = 0; } +#endif maxspeed_mod = this.spectatorspeed; } +#ifdef SVQC float spd = max(PHYS_MAXSPEED(this), PHYS_MAXAIRSPEED(this)) * maxspeed_mod; if(this.speed != spd) diff --git a/qcsrc/common/physics.qh b/qcsrc/common/physics.qh index 6ea77fda9..1062b6830 100644 --- a/qcsrc/common/physics.qh +++ b/qcsrc/common/physics.qh @@ -12,7 +12,11 @@ .float lastflags; .float lastground; .float wasFlying; +#ifdef SVQC +.float spectatorspeed = _STAT(SPECTATORSPEED); +#elif defined(CSQC) .float spectatorspeed; +#endif .vector movement_old; .float buttons_old; diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index e8320bda4..300442866 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -244,6 +244,8 @@ REGISTER_STAT(DOM_PPS_PINK, float) REGISTER_STAT(TELEPORT_MAXSPEED, float, autocvar_g_teleport_maxspeed) REGISTER_STAT(TELEPORT_TELEFRAG_AVOID, int, autocvar_g_telefrags_avoid) +REGISTER_STAT(SPECTATORSPEED, float) + #ifdef SVQC #include "movetypes/movetypes.qh" #endif diff --git a/qcsrc/lib/csqcmodel/cl_player.qc b/qcsrc/lib/csqcmodel/cl_player.qc index 3fdef9583..a4d73c5dc 100644 --- a/qcsrc/lib/csqcmodel/cl_player.qc +++ b/qcsrc/lib/csqcmodel/cl_player.qc @@ -105,7 +105,7 @@ void CSQCPlayer_Unpredict(entity this) void CSQCPlayer_SetMinsMaxs(entity this) { - if (this.flags & FL_DUCKED) + if ((this.flags & FL_DUCKED) || !this.isplayermodel) { this.mins = PL_CROUCH_MIN; this.maxs = PL_CROUCH_MAX; -- 2.39.2