Show mindelay to other players port from RR
This commit is contained in:
parent
583d34e98f
commit
ba2aecd0a1
5 changed files with 54 additions and 73 deletions
|
|
@ -5821,7 +5821,7 @@ static void UpdatePingTable(void)
|
|||
|
||||
if (server)
|
||||
{
|
||||
if (Playing() && !(gametime % 35)) // update once per second.
|
||||
if (Playing() && !(gametime % 8)) // Value chosen based on _my vibes man_
|
||||
PingUpdate();
|
||||
|
||||
fastest = 0;
|
||||
|
|
@ -5831,55 +5831,42 @@ static void UpdatePingTable(void)
|
|||
{
|
||||
if (playeringame[i] && playernode[i] > 0)
|
||||
{
|
||||
if (! server_lagless && playernode[i] > 0 && !players[i].spectator)
|
||||
{
|
||||
lag = GetLag(playernode[i]);
|
||||
realpingtable[i] += lag;
|
||||
// TicsToMilliseconds can't handle pings over 1000ms lol
|
||||
realpingtable[i] += GetLag(playernode[i]);
|
||||
|
||||
if (!players[i].spectator)
|
||||
{
|
||||
lag = playerpingtable[i];
|
||||
if (! fastest || lag < fastest)
|
||||
fastest = lag;
|
||||
}
|
||||
else
|
||||
{
|
||||
// TicsToMilliseconds can't handle pings over 1000ms lol
|
||||
realpingtable[i] += GetLag(playernode[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Don't gentleman below your mindelay
|
||||
if (fastest < (tic_t)cv_mindelay.value)
|
||||
fastest = (tic_t)cv_mindelay.value;
|
||||
|
||||
pingmeasurecount++;
|
||||
|
||||
if (server_lagless)
|
||||
lowest_lag = 0;
|
||||
else
|
||||
{
|
||||
lowest_lag = fastest;
|
||||
|
||||
if (fastest)
|
||||
lag = fastest;
|
||||
else
|
||||
lag = GetLag(0);
|
||||
// Don't gentleman below your mindelay
|
||||
if (lowest_lag < (tic_t)cv_mindelay.value)
|
||||
lowest_lag = (tic_t)cv_mindelay.value;
|
||||
|
||||
lag = ( realpingtable[0] + lag );
|
||||
pingmeasurecount++;
|
||||
|
||||
switch (playerpernode[0])
|
||||
{
|
||||
case 4:
|
||||
realpingtable[nodetoplayer4[0]] = lag;
|
||||
/*FALLTHRU*/
|
||||
case 3:
|
||||
realpingtable[nodetoplayer3[0]] = lag;
|
||||
/*FALLTHRU*/
|
||||
case 2:
|
||||
realpingtable[nodetoplayer2[0]] = lag;
|
||||
/*FALLTHRU*/
|
||||
case 1:
|
||||
realpingtable[nodetoplayer[0]] = lag;
|
||||
}
|
||||
switch (playerpernode[0])
|
||||
{
|
||||
case 4:
|
||||
playerdelaytable[nodetoplayer4[0]] = lowest_lag;
|
||||
/*FALLTHRU*/
|
||||
case 3:
|
||||
playerdelaytable[nodetoplayer3[0]] = lowest_lag;
|
||||
/*FALLTHRU*/
|
||||
case 2:
|
||||
playerdelaytable[nodetoplayer2[0]] = lowest_lag;
|
||||
/*FALLTHRU*/
|
||||
case 1:
|
||||
playerdelaytable[nodetoplayer[0]] = lowest_lag;
|
||||
}
|
||||
}
|
||||
else // We're a client, handle mindelay on the way out.
|
||||
|
|
|
|||
|
|
@ -2323,13 +2323,13 @@ PL_gfx_color (int pl)
|
|||
}
|
||||
|
||||
static const UINT8 *
|
||||
Ping_gfx_colormap (UINT32 lag, boolean gentleman)
|
||||
Ping_gfx_colormap (UINT32 ping, boolean gentleman)
|
||||
{
|
||||
const UINT8 *colormap = NULL;
|
||||
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, Ping_gfx_color(lag), GTC_CACHE);
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, Ping_gfx_color(ping), GTC_CACHE);
|
||||
|
||||
if (servermaxping && lag > servermaxping && hu_tick < 4)
|
||||
if (servermaxping && ping > servermaxping && hu_tick < 4)
|
||||
{
|
||||
// flash ping red if too high
|
||||
colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_RASPBERRY, GTC_CACHE);
|
||||
|
|
@ -2342,22 +2342,27 @@ Ping_gfx_colormap (UINT32 lag, boolean gentleman)
|
|||
return colormap;
|
||||
}
|
||||
|
||||
static UINT32
|
||||
Ping_conversion (UINT32 lag)
|
||||
{
|
||||
if (cv_pingmeasurement.value)
|
||||
{
|
||||
lag = (INT32)(lag * (1000.00f / TICRATE));
|
||||
}
|
||||
|
||||
return lag;
|
||||
}
|
||||
|
||||
//
|
||||
// HU_drawPing
|
||||
//
|
||||
void HU_drawPing(INT32 x, INT32 y, UINT32 lag, UINT32 pl, INT32 flags, boolean offline)
|
||||
void HU_drawPing(INT32 x, INT32 y, UINT32 ping, UINT32 mindelay, UINT32 pl, INT32 flags)
|
||||
{
|
||||
INT32 measureid = cv_pingmeasurement.value ? 1 : 0;
|
||||
INT32 gfxnum; // gfx to draw
|
||||
boolean drawlocal = (offline && cv_mindelay.value && lag <= (tic_t)cv_mindelay.value);
|
||||
UINT32 lag = max(ping, mindelay);
|
||||
|
||||
if (!server && lag <= (tic_t)cv_mindelay.value)
|
||||
{
|
||||
lag = cv_mindelay.value;
|
||||
drawlocal = true;
|
||||
}
|
||||
|
||||
gfxnum = Ping_gfx_num(lag);
|
||||
gfxnum = Ping_gfx_num(ping);
|
||||
|
||||
if (pl)
|
||||
{
|
||||
|
|
@ -2375,19 +2380,14 @@ void HU_drawPing(INT32 x, INT32 y, UINT32 lag, UINT32 pl, INT32 flags, boolean o
|
|||
|
||||
V_DrawScaledPatch(x+2, y, flags, pinggfx[gfxnum]);
|
||||
|
||||
if (cv_pingmeasurement.value)
|
||||
{
|
||||
lag = (INT32)(lag * (1000.00f / TICRATE));
|
||||
}
|
||||
|
||||
x = V_DrawPingNum(x + (measureid == 1 ? 11 - pingmeasure[measureid]->width : 10), y+11, flags, lag, Ping_gfx_colormap(lag,drawlocal));
|
||||
x = V_DrawPingNum(x + (measureid == 1 ? 11 - pingmeasure[measureid]->width : 10), y+11, flags, Ping_conversion(lag), Ping_gfx_colormap(ping, ping <= lag));
|
||||
|
||||
if (measureid == 0)
|
||||
V_DrawScaledPatch(x+1 - pingmeasure[measureid]->width, y+11, flags, pingmeasure[measureid]);
|
||||
}
|
||||
|
||||
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;
|
||||
INT32 w = BASEVIDWIDTH;
|
||||
|
|
@ -2400,16 +2400,10 @@ HU_drawMiniPing (INT32 x, INT32 y, UINT32 lag, INT32 flags)
|
|||
w /= 2;
|
||||
}
|
||||
|
||||
// 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];
|
||||
if (ping <= lag)
|
||||
patch = pinglocal[1]; // stone shoe
|
||||
else
|
||||
patch = mping[Ping_gfx_num(lag)];
|
||||
patch = mping[Ping_gfx_num(ping)];
|
||||
|
||||
if (( flags & V_SNAPTORIGHT ))
|
||||
x += ( w - SHORT (patch->width) );
|
||||
|
|
|
|||
|
|
@ -132,8 +132,8 @@ void HU_Drawer(void);
|
|||
char HU_dequeueChatChar(void);
|
||||
void HU_Erase(void);
|
||||
void HU_clearChatChars(void);
|
||||
void HU_drawPing(INT32 x, INT32 y, UINT32 lag, UINT32 pl, INT32 flags, boolean offline);
|
||||
void HU_drawMiniPing(INT32 x, INT32 y, UINT32 ping, INT32 flags);
|
||||
void HU_drawPing(INT32 x, INT32 y, UINT32 ping, UINT32 mindelay, UINT32 pl, INT32 flags);
|
||||
void HU_drawMiniPing (INT32 x, INT32 y, UINT32 ping, UINT32 lag, INT32 flags);
|
||||
|
||||
INT32 HU_CreateTeamScoresTbl(playersort_t *tab, UINT32 dmtotals[]);
|
||||
|
||||
|
|
|
|||
|
|
@ -2105,7 +2105,7 @@ void K_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, IN
|
|||
}
|
||||
else if (tab[i].num != serverplayer || !server_lagless)
|
||||
{
|
||||
HU_drawPing(x + ((i < 8) ? -17 : rightoffset + 11), y-4, playerpingtable[tab[i].num], playerpacketlosstable[tab[i].num], 0, false);
|
||||
HU_drawPing(x + ((i < 8) ? -17 : rightoffset + 11), y-4, playerpingtable[tab[i].num], playerdelaytable[tab[i].num], playerpacketlosstable[tab[i].num], 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4602,7 +4602,9 @@ void K_drawKartFreePlay(void)
|
|||
static void
|
||||
Draw_party_ping (int ss, INT32 snap)
|
||||
{
|
||||
HU_drawMiniPing(0, 0, playerpingtable[displayplayers[ss]], V_HUDTRANS|V_SPLITSCREEN|V_SNAPTOTOP|snap);
|
||||
UINT32 ping = playerpingtable[displayplayers[ss]];
|
||||
UINT32 mindelay = playerdelaytable[displayplayers[ss]];
|
||||
HU_drawMiniPing(0, 0, ping, max(ping, mindelay), V_HUDTRANS|V_SPLITSCREEN|V_SNAPTOTOP|snap);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -601,15 +601,13 @@ void SCR_DisplayTicRate(void)
|
|||
|
||||
void SCR_DisplayLocalPing(void)
|
||||
{
|
||||
boolean offline;
|
||||
|
||||
UINT32 mindelay = playerdelaytable[consoleplayer];
|
||||
UINT32 ping = playerpingtable[consoleplayer]; // consoleplayer's ping is everyone's ping in a splitnetgame :P
|
||||
UINT32 pl = playerpacketlosstable[consoleplayer];
|
||||
if (! r_splitscreen && ( cv_showping.value == 1 || (cv_showping.value == 2 && ping > servermaxping) )) // only show 2 (warning) if our ping is at a bad level
|
||||
if (( cv_showping.value == 1 || (cv_showping.value == 2 && ping > servermaxping) )) // only show 2 (warning) if our ping is at a bad level
|
||||
{
|
||||
INT32 dispy = cv_ticrate.value ? 160 : 181;
|
||||
offline = (consoleplayer == serverplayer);
|
||||
HU_drawPing(307, dispy, ping, pl, V_SNAPTORIGHT | V_SNAPTOBOTTOM | V_HUDTRANS, offline);
|
||||
HU_drawPing(307, dispy, ping, mindelay, pl, V_SNAPTORIGHT | V_SNAPTOBOTTOM | V_HUDTRANS);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue