mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
HUD: fix delay indicator online
- As a bonus, the mindelay setting of other players is now visible to everyone
This commit is contained in:
parent
64a4bcad34
commit
8103bd21c1
6 changed files with 61 additions and 67 deletions
|
|
@ -6305,39 +6305,30 @@ static void UpdatePingTable(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't gentleman below your mindelay
|
|
||||||
if (fastest < (tic_t)cv_mindelay.value)
|
|
||||||
fastest = (tic_t)cv_mindelay.value;
|
|
||||||
|
|
||||||
pingmeasurecount++;
|
|
||||||
|
|
||||||
if (server_lagless)
|
if (server_lagless)
|
||||||
lowest_lag = 0;
|
lowest_lag = 0;
|
||||||
else
|
else
|
||||||
{
|
|
||||||
lowest_lag = fastest;
|
lowest_lag = fastest;
|
||||||
|
|
||||||
if (fastest)
|
// Don't gentleman below your mindelay
|
||||||
lag = fastest;
|
if (lowest_lag < (tic_t)cv_mindelay.value)
|
||||||
else
|
lowest_lag = (tic_t)cv_mindelay.value;
|
||||||
lag = GetLag(0);
|
|
||||||
|
|
||||||
lag = ( realpingtable[0] + lag );
|
pingmeasurecount++;
|
||||||
|
|
||||||
switch (playerpernode[0])
|
switch (playerpernode[0])
|
||||||
{
|
{
|
||||||
case 4:
|
case 4:
|
||||||
realpingtable[nodetoplayer4[0]] = lag;
|
playerdelaytable[nodetoplayer4[0]] = lowest_lag;
|
||||||
/*FALLTHRU*/
|
/*FALLTHRU*/
|
||||||
case 3:
|
case 3:
|
||||||
realpingtable[nodetoplayer3[0]] = lag;
|
playerdelaytable[nodetoplayer3[0]] = lowest_lag;
|
||||||
/*FALLTHRU*/
|
/*FALLTHRU*/
|
||||||
case 2:
|
case 2:
|
||||||
realpingtable[nodetoplayer2[0]] = lag;
|
playerdelaytable[nodetoplayer2[0]] = lowest_lag;
|
||||||
/*FALLTHRU*/
|
/*FALLTHRU*/
|
||||||
case 1:
|
case 1:
|
||||||
realpingtable[nodetoplayer[0]] = lag;
|
playerdelaytable[nodetoplayer[0]] = lowest_lag;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // We're a client, handle mindelay on the way out.
|
else // We're a client, handle mindelay on the way out.
|
||||||
|
|
|
||||||
|
|
@ -2183,6 +2183,31 @@ Ping_gfx_color (int lag)
|
||||||
return SKINCOLOR_MAGENTA;
|
return SKINCOLOR_MAGENTA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const UINT8 *
|
||||||
|
Ping_gfx_colormap (UINT32 ping, UINT32 lag)
|
||||||
|
{
|
||||||
|
const UINT8 *colormap = R_GetTranslationColormap(TC_RAINBOW, Ping_gfx_color(lag), GTC_CACHE);
|
||||||
|
|
||||||
|
if (servermaxping && ping > servermaxping && hu_tick < 4)
|
||||||
|
{
|
||||||
|
// flash ping red if too high
|
||||||
|
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_WHITE, GTC_CACHE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return colormap;
|
||||||
|
}
|
||||||
|
|
||||||
|
static UINT32
|
||||||
|
Ping_conversion (UINT32 lag)
|
||||||
|
{
|
||||||
|
if (cv_pingmeasurement.value)
|
||||||
|
{
|
||||||
|
lag = (INT32)(lag * (1000.00f / TICRATE));
|
||||||
|
}
|
||||||
|
|
||||||
|
return lag;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
PL_gfx_color (int pl)
|
PL_gfx_color (int pl)
|
||||||
{
|
{
|
||||||
|
|
@ -2199,20 +2224,13 @@ PL_gfx_color (int pl)
|
||||||
//
|
//
|
||||||
// HU_drawPing
|
// HU_drawPing
|
||||||
//
|
//
|
||||||
void HU_drawPing(fixed_t x, fixed_t y, UINT32 lag, UINT32 pl, INT32 flags, boolean offline, SINT8 toside)
|
void HU_drawPing(fixed_t x, fixed_t y, UINT32 ping, UINT32 lag, UINT32 pl, INT32 flags, SINT8 toside)
|
||||||
{
|
{
|
||||||
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
|
INT32 gfxnum; // gfx to draw
|
||||||
boolean drawlocal = (offline && cv_mindelay.value && lag <= (tic_t)cv_mindelay.value);
|
|
||||||
fixed_t x2, y2;
|
fixed_t x2, y2;
|
||||||
|
|
||||||
if (!server && lag <= (tic_t)cv_mindelay.value)
|
|
||||||
{
|
|
||||||
lag = cv_mindelay.value;
|
|
||||||
drawlocal = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
x2 = x;
|
x2 = x;
|
||||||
y2 = y + FRACUNIT;
|
y2 = y + FRACUNIT;
|
||||||
|
|
||||||
|
|
@ -2244,7 +2262,7 @@ void HU_drawPing(fixed_t x, fixed_t y, UINT32 lag, UINT32 pl, INT32 flags, boole
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxnum = Ping_gfx_num(lag);
|
gfxnum = Ping_gfx_num(ping);
|
||||||
|
|
||||||
if (pl)
|
if (pl)
|
||||||
{
|
{
|
||||||
|
|
@ -2257,7 +2275,7 @@ void HU_drawPing(fixed_t x, fixed_t y, UINT32 lag, UINT32 pl, INT32 flags, boole
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drawlocal)
|
if (ping <= lag)
|
||||||
{
|
{
|
||||||
V_DrawFixedPatch(
|
V_DrawFixedPatch(
|
||||||
x + (2 * FRACUNIT),
|
x + (2 * FRACUNIT),
|
||||||
|
|
@ -2289,23 +2307,12 @@ 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 = Ping_gfx_colormap(ping, lag);
|
||||||
|
|
||||||
if (servermaxping && lag > servermaxping && hu_tick < 4)
|
|
||||||
{
|
|
||||||
// flash ping red if too high
|
|
||||||
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_WHITE, GTC_CACHE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cv_pingmeasurement.value)
|
|
||||||
{
|
|
||||||
lag = (INT32)(lag * (1000.00f / TICRATE));
|
|
||||||
}
|
|
||||||
|
|
||||||
x2 = V_DrawPingNum(
|
x2 = V_DrawPingNum(
|
||||||
x2,
|
x2,
|
||||||
y2,
|
y2,
|
||||||
flags, lag,
|
flags, Ping_conversion(lag),
|
||||||
colormap
|
colormap
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -2322,7 +2329,7 @@ void HU_drawPing(fixed_t x, fixed_t y, UINT32 lag, UINT32 pl, INT32 flags, boole
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
HU_drawMiniPing (INT32 x, INT32 y, UINT32 lag, INT32 flags)
|
HU_drawMiniPing (INT32 x, INT32 y, UINT32 ping, UINT32 lag, INT32 flags)
|
||||||
{
|
{
|
||||||
patch_t *patch;
|
patch_t *patch;
|
||||||
INT32 w = BASEVIDWIDTH;
|
INT32 w = BASEVIDWIDTH;
|
||||||
|
|
@ -2332,16 +2339,10 @@ HU_drawMiniPing (INT32 x, INT32 y, UINT32 lag, INT32 flags)
|
||||||
w /= 2;
|
w /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This looks kinda dumb, but basically:
|
if (ping <= lag)
|
||||||
// Servers with mindelay set modify the ping table.
|
patch = pinglocal[1]; // stone shoe
|
||||||
// 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];
|
|
||||||
else
|
else
|
||||||
patch = mping[Ping_gfx_num(lag)];
|
patch = mping[Ping_gfx_num(ping)];
|
||||||
|
|
||||||
if (( flags & V_SNAPTORIGHT ))
|
if (( flags & V_SNAPTORIGHT ))
|
||||||
x += ( w - SHORT (patch->width) );
|
x += ( w - SHORT (patch->width) );
|
||||||
|
|
|
||||||
|
|
@ -156,8 +156,8 @@ void HU_TickSongCredits(void);
|
||||||
char HU_dequeueChatChar(void);
|
char HU_dequeueChatChar(void);
|
||||||
void HU_Erase(void);
|
void HU_Erase(void);
|
||||||
void HU_clearChatChars(void);
|
void HU_clearChatChars(void);
|
||||||
void HU_drawPing(fixed_t x, fixed_t y, UINT32 ping, UINT32 packetloss, INT32 flags, boolean offline, SINT8 toside); // Lat': Ping drawer for scoreboard.
|
void HU_drawPing(fixed_t x, fixed_t y, UINT32 ping, UINT32 lag, UINT32 packetloss, INT32 flags, SINT8 toside); // Lat': Ping drawer for scoreboard.
|
||||||
void HU_drawMiniPing(INT32 x, INT32 y, UINT32 ping, INT32 flags);
|
void HU_drawMiniPing(INT32 x, INT32 y, UINT32 ping, UINT32 lag, INT32 flags);
|
||||||
|
|
||||||
// CECHO interface.
|
// CECHO interface.
|
||||||
void HU_ClearCEcho(void);
|
void HU_ClearCEcho(void);
|
||||||
|
|
|
||||||
|
|
@ -5535,7 +5535,9 @@ void K_drawKartFreePlay(void)
|
||||||
static void
|
static void
|
||||||
Draw_party_ping (int ss, INT32 snap)
|
Draw_party_ping (int ss, INT32 snap)
|
||||||
{
|
{
|
||||||
HU_drawMiniPing(0, 0, playerpingtable[displayplayers[ss]], V_SPLITSCREEN|V_SNAPTOTOP|snap);
|
UINT32 ping = playerpingtable[displayplayers[ss]];
|
||||||
|
UINT32 mindelay = playerdelaytable[displayplayers[ss]];
|
||||||
|
HU_drawMiniPing(0, 0, ping, std::max(ping, mindelay), V_SPLITSCREEN|V_SNAPTOTOP|snap);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -577,13 +577,13 @@ void SCR_DisplayLocalPing(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UINT32 mindelay = playerdelaytable[consoleplayer];
|
||||||
UINT32 ping = playerpingtable[consoleplayer];
|
UINT32 ping = playerpingtable[consoleplayer];
|
||||||
UINT32 pl = playerpacketlosstable[consoleplayer];
|
UINT32 pl = playerpacketlosstable[consoleplayer];
|
||||||
|
|
||||||
INT32 dispy = cv_ticrate.value ? 170 : 181;
|
INT32 dispy = cv_ticrate.value ? 170 : 181;
|
||||||
boolean offline = (consoleplayer == serverplayer);
|
|
||||||
|
|
||||||
HU_drawPing(307 * FRACUNIT, dispy * FRACUNIT, ping, pl, V_SNAPTORIGHT | V_SNAPTOBOTTOM, offline, 0);
|
HU_drawPing(307 * FRACUNIT, dispy * FRACUNIT, ping, max(ping, mindelay), pl, V_SNAPTORIGHT | V_SNAPTOBOTTOM, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -716,14 +716,14 @@ void Y_PlayerStandingsDrawer(y_data_t *standings, INT32 xoffset)
|
||||||
kp_cpu
|
kp_cpu
|
||||||
);*/
|
);*/
|
||||||
}
|
}
|
||||||
else if (pnum != serverplayer || !server_lagless)
|
else
|
||||||
{
|
{
|
||||||
HU_drawPing(
|
HU_drawPing(
|
||||||
(x2 - 2) * FRACUNIT, (y-2) * FRACUNIT,
|
(x2 - 2) * FRACUNIT, (y-2) * FRACUNIT,
|
||||||
playerpingtable[pnum],
|
playerpingtable[pnum],
|
||||||
|
playerdelaytable[pnum],
|
||||||
playerpacketlosstable[pnum],
|
playerpacketlosstable[pnum],
|
||||||
0,
|
0,
|
||||||
false,
|
|
||||||
(datarightofcolumn ? 1 : -1)
|
(datarightofcolumn ? 1 : -1)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue