]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_physics.qc
dd a var "speedclamp" (macro -DSPEEDCLAMP=...) to influence the strafe accel reductio...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_physics.qc
index e2feca927b94472af9ff963e1c01d141be5d2d01..b28073b9debc44f8beb4f7d2bd499c6538bdb8dc 100644 (file)
@@ -23,7 +23,7 @@ When you press the jump key
 */
 void PlayerJump (void)
 {
-       if(g_freezetag && self.freezetag_frozen)
+       if(self.freezetag_frozen)
                return; // no jumping in freezetag when frozen
 
        float mjumpheight;
@@ -61,7 +61,7 @@ void PlayerJump (void)
        if(!doublejump && self.multijump_ready && self.multijump_count < autocvar_g_multijump && self.velocity_z > autocvar_g_multijump_speed)
        {
                // doublejump = FALSE; // checked above in the if
-               if (autocvar_g_multijump > 0)
+               if (autocvar_g_multijump)
                {
                        if (autocvar_g_multijump_add == 0) // in this case we make the z velocity == jumpvelocity
                        {
@@ -93,7 +93,8 @@ void PlayerJump (void)
                                        self.velocity_y = wishdir_y * curspeed;
                                        // keep velocity_z unchanged!
                                }
-                               self.multijump_count += 1;
+                               if (autocvar_g_multijump > 0)
+                                       self.multijump_count += 1;
                        }
                }
                self.multijump_ready = FALSE; // require releasing and pressing the jump button again for the next jump
@@ -515,9 +516,20 @@ void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float acce
        float vel_xy_backward, vel_xy_forward;
        float speedclamp;
 
-       speedclamp = (accelqw < 0);
-       if(speedclamp)
+       if(accelqw < 0)
+       {
+#ifdef SPEEDCLAMP
+               speedclamp = SPEEDCLAMP;
+#else
+               speedclamp = 0.000001; // no strafe accel
+#endif
                accelqw = -accelqw;
+       }
+       else
+               speedclamp = 0;
+       // speedclamp usage:
+       // > 0: max acceleration in qu/s^2 in excess of regular (try 50, 100)
+       // < 0: max acceleration factor in excess of regular (try -0.1)
 
        if(autocvar_sv_gameplayfix_q2airaccelerate)
                wishspeed0 = wishspeed;
@@ -559,10 +571,13 @@ void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float acce
        
        vel_xy = vel_straight * wishdir + vel_perpend;
        
-       if(speedclamp)
+       if(speedclamp != 0)
        {
                // ensure we don't get too fast or decelerate faster than we should
-               vel_xy_current = min(vlen(vel_xy), vel_xy_forward);
+               if(speedclamp > 0)
+                       vel_xy_current = min(vlen(vel_xy), vel_xy_forward + frametime * speedclamp);
+               else
+                       vel_xy_current = min(vlen(vel_xy), vel_xy_current + (vel_xy_forward - vel_xy_current) * (1 - frametime * speedclamp));
                if(vel_xy_current > 0) // prevent division by zero
                        vel_xy = normalize(vel_xy) * vel_xy_current;
        }
@@ -666,6 +681,8 @@ void SV_PlayerPhysics()
        float buttons_prev;
        float not_allowed_to_move;
        string c;
+
+       WarpZone_PlayerPhysics_FixVAngle();
        
        maxspd_mod = 1;
        if(g_minstagib && (self.items & IT_INVINCIBLE))
@@ -796,8 +813,6 @@ void SV_PlayerPhysics()
                bot_think();
        }
        
-       MUTATOR_CALLHOOK(PlayerPhysics);
-
        self.items &~= IT_USING_JETPACK;
 
        if(self.classname == "player")
@@ -830,6 +845,13 @@ void SV_PlayerPhysics()
        if (self.movetype == MOVETYPE_NONE)
                return;
 
+       // when we get here, disableclientprediction cannot be 2
+       self.disableclientprediction = 0;
+       if(time < self.ladder_time)
+               self.disableclientprediction = 1;
+
+       MUTATOR_CALLHOOK(PlayerPhysics);
+
        maxspd_mod = 1;
 
        swampspd_mod = 1;
@@ -989,14 +1011,21 @@ void SV_PlayerPhysics()
                // on a spawnfunc_func_ladder or swimming in spawnfunc_func_water
                self.flags &~= FL_ONGROUND;
 
+               float g;
+               g = autocvar_sv_gravity * frametime;
+               if(self.gravity)
+                       g *= self.gravity;
+               if(autocvar_sv_gameplayfix_gravityunaffectedbyticrate)
+               {
+                       g *= 0.5;
+                       self.velocity_z += g;
+               }
+
                self.velocity = self.velocity * (1 - frametime * autocvar_sv_friction);
                makevectors(self.v_angle);
                //wishvel = v_forward * self.movement_x + v_right * self.movement_y + v_up * self.movement_z;
                wishvel = v_forward * self.movement_x + v_right * self.movement_y + '0 0 1' * self.movement_z;
-               if (self.gravity)
-                       self.velocity_z = self.velocity_z + self.gravity * autocvar_sv_gravity * frametime;
-               else
-                       self.velocity_z = self.velocity_z + autocvar_sv_gravity * frametime;
+               self.velocity_z += g;
                if (self.ladder_entity.classname == "func_water")
                {
                        f = vlen(wishvel);