- scriptified and cleaned up the AltHUD's DrawCoordinates, DrawTime and DrawLatency functions.
Some backing functionality was moved elsewhere because scripting should not have access to low level system information.
This commit is contained in:
parent
4431ec06fd
commit
ddaab4d2ab
7 changed files with 258 additions and 170 deletions
|
|
@ -2851,6 +2851,34 @@ void Net_SkipCommand (int type, uint8_t **stream)
|
|||
*stream += skip;
|
||||
}
|
||||
|
||||
// This was taken out of shared_hud, because UI code shouldn't do low level calculations that may change if the backing implementation changes.
|
||||
int Net_GetLatency(int *ld, int *ad)
|
||||
{
|
||||
int i, localdelay = 0, arbitratordelay = 0;
|
||||
|
||||
for (i = 0; i < BACKUPTICS; i++) localdelay += netdelay[0][i];
|
||||
for (i = 0; i < BACKUPTICS; i++) arbitratordelay += netdelay[nodeforplayer[Net_Arbitrator]][i];
|
||||
arbitratordelay = ((arbitratordelay / BACKUPTICS) * ticdup) * (1000 / TICRATE);
|
||||
localdelay = ((localdelay / BACKUPTICS) * ticdup) * (1000 / TICRATE);
|
||||
int severity = 0;
|
||||
|
||||
if (MAX(localdelay, arbitratordelay) > 200)
|
||||
{
|
||||
severity = 1;
|
||||
}
|
||||
if (MAX(localdelay, arbitratordelay) > 400)
|
||||
{
|
||||
severity = 2;
|
||||
}
|
||||
if (MAX(localdelay, arbitratordelay) >= ((BACKUPTICS / 2 - 1) * ticdup) * (1000 / TICRATE))
|
||||
{
|
||||
severity = 3;
|
||||
}
|
||||
*ld = localdelay;
|
||||
*ad = arbitratordelay;
|
||||
return severity;
|
||||
}
|
||||
|
||||
// [RH] List "ping" times
|
||||
CCMD (pings)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue