Fix displayed delay number for HU_drawPing and HU_drawMiniPing

This commit is contained in:
James R 2024-04-30 16:09:37 -07:00
parent 3e5f6466a0
commit bf381730bd
3 changed files with 26 additions and 31 deletions

View file

@ -2224,12 +2224,13 @@ PL_gfx_color (int pl)
// //
// HU_drawPing // HU_drawPing
// //
void HU_drawPing(fixed_t x, fixed_t y, UINT32 ping, UINT32 lag, UINT32 pl, INT32 flags, SINT8 toside) void HU_drawPing(fixed_t x, fixed_t y, UINT32 ping, UINT32 mindelay, UINT32 pl, INT32 flags, SINT8 toside)
{ {
const UINT8 *colormap = NULL; const UINT8 *colormap = NULL;
INT32 measureid = cv_pingmeasurement.value ? 1 : 0; INT32 measureid = cv_pingmeasurement.value ? 1 : 0;
INT32 gfxnum; // gfx to draw patch_t *gfx; // gfx to draw
fixed_t x2, y2; fixed_t x2, y2;
UINT32 lag = max(ping, mindelay);
x2 = x; x2 = x;
y2 = y + FRACUNIT; y2 = y + FRACUNIT;
@ -2262,39 +2263,33 @@ void HU_drawPing(fixed_t x, fixed_t y, UINT32 ping, UINT32 lag, UINT32 pl, INT32
} }
} }
gfxnum = Ping_gfx_num(ping); if (ping <= mindelay)
{
gfx = pinglocal[0];
}
else
{
gfx = pinggfx[Ping_gfx_num(ping)];
}
if (pl) if (pl)
{ {
V_DrawFill( V_DrawFill(
-pinggfx[gfxnum]->leftoffset + x/FRACUNIT + 2 - 1, -gfx->leftoffset + x/FRACUNIT + 2 - 1,
-pinggfx[gfxnum]->topoffset + y/FRACUNIT - 1, -gfx->topoffset + y/FRACUNIT - 1,
pinggfx[gfxnum]->width + 2, gfx->width + 2,
pinggfx[gfxnum]->height + 2, gfx->height + 2,
PL_gfx_color(pl) | flags PL_gfx_color(pl) | flags
); );
} }
if (ping <= lag) V_DrawFixedPatch(
{ x + (2 * FRACUNIT),
V_DrawFixedPatch( y,
x + (2 * FRACUNIT), FRACUNIT, flags,
y, gfx,
FRACUNIT, flags, NULL
pinglocal[0], );
NULL
);
}
else
{
V_DrawFixedPatch(
x + (2 * FRACUNIT),
y,
FRACUNIT, flags,
pinggfx[gfxnum],
NULL
);
}
if (measureid == 1) if (measureid == 1)
{ {
@ -2329,7 +2324,7 @@ void HU_drawPing(fixed_t x, fixed_t y, UINT32 ping, UINT32 lag, UINT32 pl, INT32
} }
void void
HU_drawMiniPing (INT32 x, INT32 y, UINT32 ping, UINT32 lag, INT32 flags) HU_drawMiniPing (INT32 x, INT32 y, UINT32 ping, UINT32 mindelay, INT32 flags)
{ {
patch_t *patch; patch_t *patch;
INT32 w = BASEVIDWIDTH; INT32 w = BASEVIDWIDTH;
@ -2339,7 +2334,7 @@ HU_drawMiniPing (INT32 x, INT32 y, UINT32 ping, UINT32 lag, INT32 flags)
w /= 2; w /= 2;
} }
if (ping <= lag) if (ping <= mindelay)
patch = pinglocal[1]; // stone shoe patch = pinglocal[1]; // stone shoe
else else
patch = mping[Ping_gfx_num(ping)]; patch = mping[Ping_gfx_num(ping)];

View file

@ -5537,7 +5537,7 @@ Draw_party_ping (int ss, INT32 snap)
{ {
UINT32 ping = playerpingtable[displayplayers[ss]]; UINT32 ping = playerpingtable[displayplayers[ss]];
UINT32 mindelay = playerdelaytable[displayplayers[ss]]; UINT32 mindelay = playerdelaytable[displayplayers[ss]];
HU_drawMiniPing(0, 0, ping, std::max(ping, mindelay), V_SPLITSCREEN|V_SNAPTOTOP|snap); HU_drawMiniPing(0, 0, ping, mindelay, V_SPLITSCREEN|V_SNAPTOTOP|snap);
} }
static void static void

View file

@ -583,7 +583,7 @@ void SCR_DisplayLocalPing(void)
INT32 dispy = cv_ticrate.value ? 170 : 181; INT32 dispy = cv_ticrate.value ? 170 : 181;
HU_drawPing(307 * FRACUNIT, dispy * FRACUNIT, ping, max(ping, mindelay), pl, V_SNAPTORIGHT | V_SNAPTOBOTTOM, 0); HU_drawPing(307 * FRACUNIT, dispy * FRACUNIT, ping, mindelay, pl, V_SNAPTORIGHT | V_SNAPTOBOTTOM, 0);
} }