diff --git a/engine/client/cl_input.c b/engine/client/cl_input.c index a67fd31ae..8147c9f79 100644 --- a/engine/client/cl_input.c +++ b/engine/client/cl_input.c @@ -1192,6 +1192,7 @@ void CL_SendCmd (float frametime) cmd = &cl.frames[i].cmd[plnum]; *cmd = independantphysics[plnum]; cl.frames[i].senttime = realtime; + cl.frames[i].receivedtime = -1; // we haven't gotten a reply yet memset(&independantphysics[plnum], 0, sizeof(independantphysics[plnum])); CLNQ_SendCmd (); @@ -1274,6 +1275,7 @@ void CL_SendCmd (float frametime) cmd = &cl.frames[i].cmd[plnum]; *cmd = independantphysics[plnum]; cl.frames[i].senttime = realtime; + cl.frames[i].receivedtime = -1; // we haven't gotten a reply yet memset(&independantphysics[plnum], 0, sizeof(independantphysics[plnum])); #ifdef Q2CLIENT diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 03065c85a..286ceea95 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -119,6 +119,7 @@ cvar_t allow_download_csprogs = SCVAR("allow_download_csprogs", "0"); cvar_t cl_muzzleflash = SCVAR("cl_muzzleflash", "1"); cvar_t cl_item_bobbing = SCVAR("cl_model_bobbing", "0"); +cvar_t cl_countpendingpl = SCVAR("cl_countpendingpl", "1"); cvar_t requiredownloads = SCVARF("requiredownloads","1", CVAR_ARCHIVE); cvar_t cl_standardchat = SCVARF("cl_standardchat", "0", CVAR_ARCHIVE); @@ -221,6 +222,7 @@ CL_Quit_f */ void CL_Quit_f (void) { + TP_ExecTrigger("f_quit"); Cbuf_Execute(); @@ -2672,6 +2674,7 @@ void CL_Init (void) host_mapname.name2 = "mapname"; Cvar_Register (&host_mapname, "Scripting"); + Cvar_Register (&cl_countpendingpl, cl_controlgroup); Cvar_Register (&cl_indepphysics, cl_controlgroup); Cvar_Register (&cl_antibunch, "evil hacks"); Cvar_Register (&hud_tracking_show, "statusbar"); diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 352bb1315..a0e577f6d 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -193,7 +193,7 @@ char *svc_nqstrings[] = "dpsvc_spawnstaticsound2" }; -extern cvar_t requiredownloads, cl_standardchat, msg_filter; +extern cvar_t requiredownloads, cl_standardchat, msg_filter, cl_countpendingpl; int oldparsecountmod; int parsecountmod; double parsecounttime; @@ -213,8 +213,13 @@ int CL_CalcNet (void) int a, i; frame_t *frame; int lost; + int percent; + int sent; + int pending; // char st[80]; + sent = NET_TIMINGS; + for (i=cls.netchan.outgoing_sequence-UPDATE_BACKUP+1 ; i <= cls.netchan.outgoing_sequence ; i++) @@ -224,6 +229,11 @@ int CL_CalcNet (void) packet_latency[i&NET_TIMINGSMASK] = 9999; // dropped else if (frame->receivedtime == -2) packet_latency[i&NET_TIMINGSMASK] = 10000; // choked + else if (frame->receivedtime == -3) + { + packet_latency[i&NET_TIMINGSMASK] = 9997; // c2spps + sent--; + } else if (frame->invalid) packet_latency[i&NET_TIMINGSMASK] = 9998; // invalid delta else @@ -237,7 +247,25 @@ int CL_CalcNet (void) if (packet_latency[i] == 9999) lost++; } - return lost * 100 / NET_TIMINGS; + + if (cl_countpendingpl.value) + { + pending = cls.netchan.outgoing_sequence - cls.netchan.incoming_sequence - 1; + lost -= pending; + sent -= pending; + + if (sent < 1) + percent = 100; + else + percent = lost * 100 / sent; + + if (lost && !percent) //if they have any confirmed lost packets, report at least 1% + percent = 1; + } + else + percent = lost * 100 / sent; + + return percent; } //=============================================================================