Allow netgame clients to display and be affected by mindelay

This commit is contained in:
AJ Martinez 2022-09-20 21:21:51 -07:00
parent bd83a9f3b1
commit 8525dfb502
2 changed files with 20 additions and 1 deletions

View file

@ -5725,6 +5725,11 @@ static void UpdatePingTable(void)
} }
} }
} }
else // We're a client, handle mindelay on the way out.
{
if ((neededtic - gametic) < (tic_t)cv_mindelay.value)
lowest_lag = cv_mindelay.value - (neededtic - gametic);
}
} }
static void RenewHolePunch(void) static void RenewHolePunch(void)

View file

@ -2375,6 +2375,12 @@ void HU_drawPing(INT32 x, INT32 y, UINT32 lag, INT32 flags, boolean offline)
INT32 gfxnum; // gfx to draw INT32 gfxnum; // gfx to draw
boolean drawlocal = (offline && cv_mindelay.value && lag <= (tic_t)cv_mindelay.value); boolean drawlocal = (offline && cv_mindelay.value && lag <= (tic_t)cv_mindelay.value);
if (!server && lag <= (tic_t)cv_mindelay.value)
{
lag = cv_mindelay.value;
drawlocal = true;
}
gfxnum = Ping_gfx_num(lag); gfxnum = Ping_gfx_num(lag);
if (measureid == 1) if (measureid == 1)
@ -2415,7 +2421,15 @@ HU_drawMiniPing (INT32 x, INT32 y, UINT32 lag, INT32 flags)
w /= 2; w /= 2;
} }
if (cv_mindelay.value && (tic_t)cv_mindelay.value <= lag) CONS_Printf("mindelay %d / lag %d\n", cv_mindelay.value, lag);
// This looks kinda dumb, but basically:
// Servers with mindelay set modify the ping table.
// Clients with mindelay unset don't, because they can't.
// Both are affected by mindelay, but a client's lag value is pre-adjustment.
if (server && cv_mindelay.value && (tic_t)cv_mindelay.value <= lag)
patch = pinglocal[1];
else if (!server && cv_mindelay.value && (tic_t)cv_mindelay.value >= lag)
patch = pinglocal[1]; patch = pinglocal[1];
else else
patch = mping[Ping_gfx_num(lag)]; patch = mping[Ping_gfx_num(lag)];