]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - cl_input.c
don't reject render entities from being added just because of
[xonotic/darkplaces.git] / cl_input.c
index 6e41506e3c1454eea7c8cccaa0c1c06fdfdd1dd8..f6d90d4f18b6fd14e2cef3eb6a1a7da134814f7a 100644 (file)
@@ -1127,7 +1127,7 @@ void CL_ClientMovement_Physics_PM_Accelerate(cl_clientmovement_state_t *s, vec3_
        if(sidefric < 0 && VectorLength2(vel_perpend))
        {
                vec_t f, fmin;
-               f = 1 + s->cmd.frametime * wishspeed * sidefric;
+               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);
@@ -1469,13 +1469,16 @@ void CL_ClientMovement_Replay(void)
                                s.cmd.canjump = cl.movecmd[i+1].canjump;
                        // if a move is more than 50ms, do it as two moves (matching qwsv)
                        //Con_Printf("%i ", s.cmd.msec);
-                       if (s.cmd.frametime > 0.05)
+                       if(s.cmd.frametime > 0.0005)
                        {
-                               s.cmd.frametime /= 2;
+                               if (s.cmd.frametime > 0.05)
+                               {
+                                       s.cmd.frametime /= 2;
+                                       CL_ClientMovement_PlayerMove(&s);
+                               }
                                CL_ClientMovement_PlayerMove(&s);
+                               cl.movecmd[i].canjump = s.cmd.canjump;
                        }
-                       CL_ClientMovement_PlayerMove(&s);
-                       cl.movecmd[i].canjump = s.cmd.canjump;
                }
                //Con_Printf("\n");
                CL_ClientMovement_UpdateStatus(&s);
@@ -1569,6 +1572,15 @@ void QW_MSG_WriteDeltaUsercmd(sizebuf_t *buf, usercmd_t *from, usercmd_t *to)
        MSG_WriteByte(buf, to->msec);
 }
 
+void CL_NewFrameReceived(int num)
+{
+       if (developer_networkentities.integer >= 10)
+               Con_Printf("recv: svc_entities %i\n", num);
+       cl.latestframenums[cl.latestframenumsposition] = num;
+       cl.latestsendnums[cl.latestframenumsposition] = cl.cmd.sequence;
+       cl.latestframenumsposition = (cl.latestframenumsposition + 1) % LATESTFRAMENUMS;
+}
+
 /*
 ==============
 CL_SendMove
@@ -1879,17 +1891,24 @@ void CL_SendMove(void)
 
        if (cls.protocol != PROTOCOL_QUAKEWORLD && buf.cursize)
        {
-               // ack the last few frame numbers
+               // ack entity frame numbers received since the last input was sent
                // (redundent to improve handling of client->server packet loss)
-               // for LATESTFRAMENUMS == 3 case this is 15 bytes
+               // if cl_netrepeatinput is 1 and client framerate matches server
+               // framerate, this is 10 bytes, if client framerate is lower this
+               // will be more...
+               int i, j;
+               int oldsequence = cl.cmd.sequence - bound(1, cl_netrepeatinput.integer + 1, 3);
+               if (oldsequence < 1)
+                       oldsequence = 1;
                for (i = 0;i < LATESTFRAMENUMS;i++)
                {
-                       if (cl.latestframenums[i] > 0)
+                       j = (cl.latestframenumsposition + i) % LATESTFRAMENUMS;
+                       if (cl.latestsendnums[j] >= oldsequence)
                        {
                                if (developer_networkentities.integer >= 10)
-                                       Con_Printf("send clc_ackframe %i\n", cl.latestframenums[i]);
+                                       Con_Printf("send clc_ackframe %i\n", cl.latestframenums[j]);
                                MSG_WriteByte(&buf, clc_ackframe);
-                               MSG_WriteLong(&buf, cl.latestframenums[i]);
+                               MSG_WriteLong(&buf, cl.latestframenums[j]);
                        }
                }
        }