]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Some minor changes to support movetype prediction
authorMario <mario@smbclan.net>
Thu, 17 Dec 2015 17:48:38 +0000 (03:48 +1000)
committerMario <mario@smbclan.net>
Thu, 17 Dec 2015 17:48:38 +0000 (03:48 +1000)
qcsrc/common/physics.qc
qcsrc/common/physics.qh
qcsrc/common/stats.qh
qcsrc/lib/csqcmodel/cl_player.qc

index ff54434a8389c881d5a939e1a61de2150eb0a32c..292da149192a689f1127610d597c05f73633acef 100644 (file)
@@ -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)
index 6ea77fda90c7be395b29e83d87fc533b4b89b107..1062b683073c98ab1942df2bbc872385a1b73100 100644 (file)
 .float lastflags;
 .float lastground;
 .float wasFlying;
+#ifdef SVQC
+.float spectatorspeed = _STAT(SPECTATORSPEED);
+#elif defined(CSQC)
 .float spectatorspeed;
+#endif
 
 .vector movement_old;
 .float buttons_old;
index e8320bda49db2078ed1437b3bfa99a1368d1e388..30044286653dd65789ffbe41b2c86bb70bc675f0 100644 (file)
@@ -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
index 3fdef9583aa3de66ac8131b045fdb707da35b859..a4d73c5dc6fc2be47575efb8867fc089f7f3a259 100644 (file)
@@ -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;