X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=cl_input.c;h=f6d90d4f18b6fd14e2cef3eb6a1a7da134814f7a;hb=92b2013a87c2bd0e3733f0667e2b633db5ebccba;hp=57f403660b79a3c5468658db1cb12f0f4db34eb6;hpb=1853eea67e36124dd9b21ab1464467a43340433a;p=xonotic%2Fdarkplaces.git diff --git a/cl_input.c b/cl_input.c index 57f40366..f6d90d4f 100644 --- a/cl_input.c +++ b/cl_input.c @@ -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); @@ -1572,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 @@ -1882,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]); } } }