]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/physics/player.qc
Merge branch 'proraide/fix_fps' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / physics / player.qc
index 1fc9ccdf3cdbbc16cc0b92f074de9ead94600bc5..208b16c3b8f6473acde347790d82cd23d0425619 100644 (file)
@@ -4,7 +4,7 @@
 
 #ifdef SVQC
 
-#include "../../server/miscfunctions.qh"
+#include <server/miscfunctions.qh>
 #include "../triggers/trigger/viewloc.qh"
 
 // client side physics
@@ -107,7 +107,7 @@ void PM_ClientMovement_Unstick(entity this)
        #define X(unstick_offset) \
        { \
                vector neworigin = unstick_offset + this.origin; \
-               tracebox(neworigin, PL_CROUCH_MIN, PL_CROUCH_MAX, neworigin, MOVE_NORMAL, this); \
+               tracebox(neworigin, STAT(PL_CROUCH_MIN, NULL), STAT(PL_CROUCH_MAX, NULL), neworigin, MOVE_NORMAL, this); \
                if (!trace_startsolid) \
                { \
                        setorigin(this, neworigin); \
@@ -138,7 +138,7 @@ void PM_ClientMovement_UpdateStatus(entity this, bool ground)
                // wants to stand, if currently crouching we need to check for a low ceiling first
                if (IS_DUCKED(this))
                {
-                       tracebox(this.origin, PL_MIN, PL_MAX, this.origin, MOVE_NORMAL, this);
+                       tracebox(this.origin, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), this.origin, MOVE_NORMAL, this);
                        if (!trace_startsolid) UNSET_DUCKED(this);
                }
        }
@@ -560,7 +560,7 @@ void CheckWaterJump(entity this)
                #ifdef SVQC
                        PHYS_TELEPORT_TIME(this) = time + 2;    // safety net
                #elif defined(CSQC)
-                       pmove_waterjumptime = time + 2;
+                       pmove_waterjumptime = 2;
                #endif
                }
        }
@@ -1277,12 +1277,16 @@ bool IsFlying(entity this)
                return false;
        if(this.waterlevel >= WATERLEVEL_SWIMMING)
                return false;
-       //traceline(this.origin, this.origin - '0 0 48', MOVE_NORMAL, this);
-       //if(trace_fraction < 1)
-               //return false;
+       traceline(this.origin, this.origin - '0 0 48', MOVE_NORMAL, this);
+       if(trace_fraction < 1)
+               return false;
        return true;
 }
 
+#ifdef CSQC
+float autocvar_slowmo;
+#endif
+
 void PM_Main(entity this)
 {
        int buttons = PHYS_INPUT_BUTTON_MASK(this);
@@ -1321,6 +1325,9 @@ void PM_Main(entity this)
        if (this.PlayerPhysplug)
                if (this.PlayerPhysplug())
                        return;
+#elif defined(CSQC)
+       if(autocvar_slowmo != STAT(MOVEVARS_TIMESCALE))
+               cvar_set("slowmo", ftos(STAT(MOVEVARS_TIMESCALE)));
 #endif
 
 #ifdef SVQC
@@ -1405,7 +1412,7 @@ void PM_Main(entity this)
                        this.spectatorspeed = maxspeed_mod;
                if (this.impulse && this.impulse <= 19 || (this.impulse >= 200 && this.impulse <= 209) || (this.impulse >= 220 && this.impulse <= 229))
                {
-                       if (this.lastclassname != "player")
+                       if (this.lastclassname != STR_PLAYER)
                        {
                                if (this.impulse == 10 || this.impulse == 15 || this.impulse == 18 || (this.impulse >= 200 && this.impulse <= 209))
                                        this.spectatorspeed = bound(1, this.spectatorspeed + 0.5, 5);
@@ -1446,7 +1453,7 @@ void PM_Main(entity this)
        }
 #endif
 
-       if(PHYS_DEAD(this))
+       if(IS_DEAD(this))
        {
                // handle water here
                vector midpoint = ((this.absmin + this.absmax) * 0.5);
@@ -1472,8 +1479,10 @@ void PM_Main(entity this)
                PM_Footsteps(this);
        }
 
+#ifdef SVQC
        if(IsFlying(this))
                this.wasFlying = 1;
+#endif
 
        if (IS_PLAYER(this))
                CheckPlayerJump(this);
@@ -1482,10 +1491,17 @@ void PM_Main(entity this)
        {
                this.velocity_x = this.movedir.x;
                this.velocity_y = this.movedir.y;
-               if (time > PHYS_TELEPORT_TIME(this) || this.waterlevel == WATERLEVEL_NONE)
+               if (time > PHYS_TELEPORT_TIME(this) || this.waterlevel == WATERLEVEL_NONE
+               #ifdef CSQC
+                       || pmove_waterjumptime <= 0
+               #endif
+                       )
                {
                        this.flags &= ~FL_WATERJUMP;
                        PHYS_TELEPORT_TIME(this) = 0;
+               #ifdef CSQC
+                       pmove_waterjumptime = 0;
+               #endif
                }
        }