mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Snapping for showping, so it doesn't jump way up on non-green
This commit is contained in:
parent
2584241a44
commit
22421b1031
3 changed files with 13 additions and 12 deletions
|
@ -2322,13 +2322,14 @@ void HU_Erase(void)
|
||||||
//
|
//
|
||||||
// HU_drawPing
|
// HU_drawPing
|
||||||
//
|
//
|
||||||
void HU_drawPing(INT32 x, INT32 y, UINT32 ping, boolean notext)
|
void HU_drawPing(INT32 x, INT32 y, UINT32 ping, boolean notext, INT32 flags)
|
||||||
{
|
{
|
||||||
UINT8 numbars = 1; // how many ping bars do we draw?
|
UINT8 numbars = 1; // how many ping bars do we draw?
|
||||||
UINT8 barcolor = 35; // color we use for the bars (green, yellow or red)
|
UINT8 barcolor = 35; // color we use for the bars (green, yellow or red)
|
||||||
SINT8 i = 0;
|
SINT8 i = 0;
|
||||||
SINT8 yoffset = 6;
|
SINT8 yoffset = 6;
|
||||||
INT32 dx = x+1 - (V_SmallStringWidth(va("%dms", ping), V_ALLOWLOWERCASE)/2);
|
INT32 dx = x+1 - (V_SmallStringWidth(va("%dms", ping),
|
||||||
|
V_ALLOWLOWERCASE|flags)/2);
|
||||||
|
|
||||||
if (ping < 128)
|
if (ping < 128)
|
||||||
{
|
{
|
||||||
|
@ -2342,13 +2343,13 @@ void HU_drawPing(INT32 x, INT32 y, UINT32 ping, boolean notext)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!notext || vid.width >= 640) // how sad, we're using a shit resolution.
|
if (!notext || vid.width >= 640) // how sad, we're using a shit resolution.
|
||||||
V_DrawSmallString(dx, y+4, V_ALLOWLOWERCASE, va("%dms", ping));
|
V_DrawSmallString(dx, y+4, V_ALLOWLOWERCASE|flags, va("%dms", ping));
|
||||||
|
|
||||||
for (i=0; (i<3); i++) // Draw the ping bar
|
for (i=0; (i<3); i++) // Draw the ping bar
|
||||||
{
|
{
|
||||||
V_DrawFill(x+2 *(i-1), y+yoffset-4, 2, 8-yoffset, 31);
|
V_DrawFill(x+2 *(i-1), y+yoffset-4, 2, 8-yoffset, 31|flags);
|
||||||
if (i < numbars)
|
if (i < numbars)
|
||||||
V_DrawFill(x+2 *(i-1), y+yoffset-3, 1, 8-yoffset-1, barcolor);
|
V_DrawFill(x+2 *(i-1), y+yoffset-3, 1, 8-yoffset-1, barcolor|flags);
|
||||||
|
|
||||||
yoffset -= 2;
|
yoffset -= 2;
|
||||||
}
|
}
|
||||||
|
@ -2379,7 +2380,7 @@ void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, I
|
||||||
if (!splitscreen) // don't draw it on splitscreen,
|
if (!splitscreen) // don't draw it on splitscreen,
|
||||||
{
|
{
|
||||||
if (!(tab[i].num == serverplayer))
|
if (!(tab[i].num == serverplayer))
|
||||||
HU_drawPing(x+ 253, y+2, playerpingtable[tab[i].num], false);
|
HU_drawPing(x+ 253, y+2, playerpingtable[tab[i].num], false, 0);
|
||||||
//else
|
//else
|
||||||
// V_DrawSmallString(x+ 246, y+4, V_YELLOWMAP, "SERVER");
|
// V_DrawSmallString(x+ 246, y+4, V_YELLOWMAP, "SERVER");
|
||||||
}
|
}
|
||||||
|
@ -2578,7 +2579,7 @@ static void HU_Draw32TeamTabRankings(playersort_t *tab, INT32 whiteplayer)
|
||||||
if (!splitscreen)
|
if (!splitscreen)
|
||||||
{
|
{
|
||||||
if (!(tab[i].num == serverplayer))
|
if (!(tab[i].num == serverplayer))
|
||||||
HU_drawPing(x+ 135, y+3, playerpingtable[tab[i].num], true);
|
HU_drawPing(x+ 135, y+3, playerpingtable[tab[i].num], true, 0);
|
||||||
//else
|
//else
|
||||||
//V_DrawSmallString(x+ 129, y+4, V_YELLOWMAP, "HOST");
|
//V_DrawSmallString(x+ 129, y+4, V_YELLOWMAP, "HOST");
|
||||||
}
|
}
|
||||||
|
@ -2702,7 +2703,7 @@ void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer)
|
||||||
if (!splitscreen)
|
if (!splitscreen)
|
||||||
{
|
{
|
||||||
if (!(tab[i].num == serverplayer))
|
if (!(tab[i].num == serverplayer))
|
||||||
HU_drawPing(x+ 113, y+2, playerpingtable[tab[i].num], false);
|
HU_drawPing(x+ 113, y+2, playerpingtable[tab[i].num], false, 0);
|
||||||
//else
|
//else
|
||||||
// V_DrawSmallString(x+ 94, y+4, V_YELLOWMAP, "SERVER");
|
// V_DrawSmallString(x+ 94, y+4, V_YELLOWMAP, "SERVER");
|
||||||
}
|
}
|
||||||
|
@ -2733,7 +2734,7 @@ void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scoreline
|
||||||
|
|
||||||
strlcpy(name, tab[i].name, 7);
|
strlcpy(name, tab[i].name, 7);
|
||||||
if (!(tab[i].num == serverplayer))
|
if (!(tab[i].num == serverplayer))
|
||||||
HU_drawPing(x+ 113, y+2, playerpingtable[tab[i].num], false);
|
HU_drawPing(x+ 113, y+2, playerpingtable[tab[i].num], false, 0);
|
||||||
//else
|
//else
|
||||||
// V_DrawSmallString(x+ 94, y+4, V_YELLOWMAP, "SERVER");
|
// V_DrawSmallString(x+ 94, y+4, V_YELLOWMAP, "SERVER");
|
||||||
|
|
||||||
|
@ -2841,7 +2842,7 @@ static void HU_Draw32TabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scor
|
||||||
if (!splitscreen) // don't draw it on splitscreen,
|
if (!splitscreen) // don't draw it on splitscreen,
|
||||||
{
|
{
|
||||||
if (!(tab[i].num == serverplayer))
|
if (!(tab[i].num == serverplayer))
|
||||||
HU_drawPing(x+ 135, y+3, playerpingtable[tab[i].num], true);
|
HU_drawPing(x+ 135, y+3, playerpingtable[tab[i].num], true, 0);
|
||||||
//else
|
//else
|
||||||
// V_DrawSmallString(x+ 129, y+4, V_YELLOWMAP, "HOST");
|
// V_DrawSmallString(x+ 129, y+4, V_YELLOWMAP, "HOST");
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ void HU_Drawer(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(INT32 x, INT32 y, UINT32 ping, boolean notext); // Lat': Ping drawer for scoreboard.
|
void HU_drawPing(INT32 x, INT32 y, UINT32 ping, boolean notext, INT32 flags); // Lat': Ping drawer for scoreboard.
|
||||||
void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer);
|
void HU_DrawTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer);
|
||||||
void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer);
|
void HU_DrawTeamTabRankings(playersort_t *tab, INT32 whiteplayer);
|
||||||
void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer);
|
void HU_DrawDualTabRankings(INT32 x, INT32 y, playersort_t *tab, INT32 scorelines, INT32 whiteplayer);
|
||||||
|
|
|
@ -434,7 +434,7 @@ void SCR_DisplayLocalPing(void)
|
||||||
if (cv_showping.value == 1 || (cv_showping.value == 2 && servermaxping && ping > servermaxping)) // only show 2 (warning) if our ping is at a bad level
|
if (cv_showping.value == 1 || (cv_showping.value == 2 && servermaxping && ping > servermaxping)) // only show 2 (warning) if our ping is at a bad level
|
||||||
{
|
{
|
||||||
INT32 dispy = cv_ticrate.value ? 181 : 190;
|
INT32 dispy = cv_ticrate.value ? 181 : 190;
|
||||||
HU_drawPing(307, dispy, ping, true);
|
HU_drawPing(307, dispy, ping, true, V_SNAPTORIGHT | V_SNAPTOBOTTOM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue