drawPing: Colored border packet loss indicator

This commit is contained in:
AJ Martinez 2024-03-18 18:08:48 -07:00
parent 858eecaef3
commit 50aadee23e

View file

@ -2188,16 +2188,14 @@ Ping_gfx_color (int lag)
static int static int
PL_gfx_color (int pl) PL_gfx_color (int pl)
{ {
if (pl == 0) if (pl <= 2)
return SKINCOLOR_JAWZ; return 72;
else if (pl <= 2)
return SKINCOLOR_MINT;
else if (pl <= 4) else if (pl <= 4)
return SKINCOLOR_GOLD; return 54;
else if (pl <= 6) else if (pl <= 6)
return SKINCOLOR_RASPBERRY; return 35;
else else
return SKINCOLOR_MAGENTA; return 181;
} }
// //
@ -2252,6 +2250,17 @@ void HU_drawPing(fixed_t x, fixed_t y, UINT32 lag, UINT32 pl, INT32 flags, boole
); );
} }
if (pl || true)
{
V_DrawFill(
x/FRACUNIT + 2 - 1,
y/FRACUNIT - 1,
pinggfx[gfxnum]->width + 2,
pinggfx[gfxnum]->height + 2,
PL_gfx_color(pl)
);
}
if (drawlocal) if (drawlocal)
{ {
V_DrawFixedPatch( V_DrawFixedPatch(
@ -2275,9 +2284,6 @@ void HU_drawPing(fixed_t x, fixed_t y, UINT32 lag, UINT32 pl, INT32 flags, boole
colormap = R_GetTranslationColormap(TC_RAINBOW, Ping_gfx_color(lag), GTC_CACHE); colormap = R_GetTranslationColormap(TC_RAINBOW, Ping_gfx_color(lag), GTC_CACHE);
if (pl)
V_DrawPingNum(x2, y2 + 8*FRACUNIT, flags, 100*(PACKETMEASUREWINDOW - pl)/PACKETMEASUREWINDOW, R_GetTranslationColormap(TC_RAINBOW, PL_gfx_color(pl), GTC_CACHE));
if (servermaxping && lag > servermaxping && hu_tick < 4) if (servermaxping && lag > servermaxping && hu_tick < 4)
{ {
// flash ping red if too high // flash ping red if too high