]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_input.c
[04:31:11] <@LordHavoc> div0: 9179 (if (msecdelta <= 0) return;) wrecked connect...
[xonotic/darkplaces.git] / cl_input.c
index abe87409f180b2f771a2fe9c7f6a117d1046b76d..e58dad4b1b90bacb046cf3219f569aa78a7ad4fc 100644 (file)
@@ -1106,6 +1106,9 @@ void CL_ClientMovement_Physics_PM_Accelerate(cl_clientmovement_state_t *s, vec3_
        vec_t vel_straight, vel_z;
        vec3_t vel_perpend;
        vec_t addspeed;
+       vec_t savespeed;
+
+       savespeed = VectorLength2(s->velocity);
 
        vel_straight = DotProduct(s->velocity, wishdir);
        vel_z = s->velocity[2];
@@ -1117,7 +1120,18 @@ void CL_ClientMovement_Physics_PM_Accelerate(cl_clientmovement_state_t *s, vec3_
        if(wishspeed > 0)
                vel_straight = vel_straight + min(wishspeed, accel * s->cmd.frametime * wishspeed) * (1 - accelqw);
        
-       VectorScale(vel_perpend, 1 - s->cmd.frametime * wishspeed * sidefric, vel_perpend);
+       if(sidefric < 0 && VectorLength2(vel_perpend))
+       {
+               vec_t f, fmin;
+               f = 1 + s->cmd.frametime * wishspeed * sidefric;
+               fmin = (savespeed - vel_straight*vel_straight) / VectorLength2(vel_perpend);
+               if(fmin <= 0)
+                       VectorScale(vel_perpend, f, vel_perpend);
+               else
+                       VectorScale(vel_perpend, min(1.0f, max(fmin, f)), vel_perpend);
+       }
+       else
+               VectorScale(vel_perpend, 1 - s->cmd.frametime * wishspeed * sidefric, vel_perpend);
 
        VectorMA(vel_perpend, vel_straight, wishdir, s->velocity);
        s->velocity[2] += vel_z;
@@ -1338,6 +1352,7 @@ void CL_UpdateMoveVars(void)
        }
        else if (cl.stats[STAT_MOVEVARS_TICRATE])
        {
+               cl.movevars_ticrate = cl.statsf[STAT_MOVEVARS_TICRATE];
                cl.movevars_timescale = cl.statsf[STAT_MOVEVARS_TIMESCALE];
                cl.movevars_gravity = cl.statsf[STAT_MOVEVARS_GRAVITY];
                cl.movevars_stopspeed = cl.statsf[STAT_MOVEVARS_STOPSPEED] ;
@@ -1368,6 +1383,7 @@ void CL_UpdateMoveVars(void)
        }
        else
        {
+               cl.movevars_ticrate = slowmo.value / bound(1.0f, cl_netfps.value, 1000.0f);
                cl.movevars_timescale = slowmo.value;
                cl.movevars_gravity = sv_gravity.value;
                cl.movevars_stopspeed = cl_movement_stopspeed.value;
@@ -1655,12 +1671,17 @@ void CL_SendMove(void)
        // don't send too often or else network connections can get clogged by a
        // high renderer framerate
        packettime = 1.0 / bound(1, cl_netfps.value, 1000);
+       if (cl.movevars_timescale && cl.movevars_ticrate)
+       {
+               float maxtic = cl.movevars_ticrate / cl.movevars_timescale;
+               packettime = min(packettime, maxtic);
+       }
        // send input every frame in singleplayer
        if (cl.islocalgame)
                packettime = 0;
 
        // do not send if we do not have anything useful to send
-       if(msecdelta <= 0)
+       if(msecdelta <= 0 && cls.signon == SIGNONS && !cl.paused)
                return;
        // always send if buttons changed or an impulse is pending
        // even if it violates the rate limit!