packetloss/netgraph fixes.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2147 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2006-04-02 23:25:03 +00:00
parent 0f0bd47812
commit e78a6c43d5
3 changed files with 35 additions and 2 deletions

View File

@ -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

View File

@ -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");

View File

@ -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;
}
//=============================================================================