mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-10 07:12:03 +00:00
Display the current status of server querying in the server browser
While trying to contact servers: display how many servers are left. Once done: display the total number of servers available in game.
This commit is contained in:
parent
ed9d520b4e
commit
53ee6524b4
3 changed files with 33 additions and 7 deletions
|
@ -1953,9 +1953,9 @@ static void SendAskInfo(INT32 node)
|
|||
|
||||
serverelem_t serverlist[MAXSERVERLIST];
|
||||
UINT32 serverlistcount = 0;
|
||||
UINT32 serverlistultimatecount = 0;
|
||||
|
||||
static boolean resendserverlistnode[MAXNETNODES];
|
||||
static boolean resendserverlist;
|
||||
static tic_t serverlistepoch;
|
||||
|
||||
static void SL_ClearServerList(INT32 connectedserver)
|
||||
|
@ -2066,14 +2066,14 @@ void CL_QueryServerList (msg_server_t *server_list)
|
|||
}
|
||||
}
|
||||
|
||||
resendserverlist = true;
|
||||
serverlistultimatecount = i;
|
||||
}
|
||||
|
||||
#define SERVERLISTRESENDRATE NEWTICRATE
|
||||
|
||||
void CL_TimeoutServerList(void)
|
||||
{
|
||||
if (netgame && resendserverlist)
|
||||
if (netgame && serverlistultimatecount > serverlistcount)
|
||||
{
|
||||
const tic_t timediff = I_GetTime() - serverlistepoch;
|
||||
const tic_t timetoresend = timediff % SERVERLISTRESENDRATE;
|
||||
|
@ -2095,7 +2095,7 @@ void CL_TimeoutServerList(void)
|
|||
}
|
||||
|
||||
if (timedout)
|
||||
resendserverlist = false;
|
||||
serverlistultimatecount = serverlistcount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -502,6 +502,7 @@ typedef struct
|
|||
|
||||
extern serverelem_t serverlist[MAXSERVERLIST];
|
||||
extern UINT32 serverlistcount;
|
||||
extern UINT32 serverlistultimatecount;
|
||||
extern INT32 mapchangepending;
|
||||
|
||||
// Points inside doomcom
|
||||
|
|
31
src/m_menu.c
31
src/m_menu.c
|
@ -8594,6 +8594,32 @@ static void M_Refresh(INT32 choice)
|
|||
#endif/*MASTERSERVER*/
|
||||
}
|
||||
|
||||
static void M_DrawServerCountAndHorizontalBar(void)
|
||||
{
|
||||
const char *text;
|
||||
INT32 radius;
|
||||
INT32 center = BASEVIDWIDTH/2;
|
||||
|
||||
if (serverlistultimatecount > serverlistcount)
|
||||
{
|
||||
text = va("Pinging %d servers%.*s",
|
||||
serverlistultimatecount - serverlistcount,
|
||||
I_GetTime() / NEWTICRATE % 4, "...");
|
||||
}
|
||||
else
|
||||
{
|
||||
text = va("%d servers found", serverlistcount);
|
||||
}
|
||||
|
||||
radius = V_StringWidth(text, 0) / 2;
|
||||
|
||||
V_DrawCenteredString(center, currentMenu->y+28, 0, text);
|
||||
|
||||
// Horizontal line!
|
||||
V_DrawFill(1, currentMenu->y+32, center - radius - 2, 1, 0);
|
||||
V_DrawFill(center + radius + 2, currentMenu->y+32, BASEVIDWIDTH - 1, 1, 0);
|
||||
}
|
||||
|
||||
static void M_DrawConnectMenu(void)
|
||||
{
|
||||
UINT16 i;
|
||||
|
@ -8618,11 +8644,10 @@ static void M_DrawConnectMenu(void)
|
|||
mservflags = mservflags|highlightflags|V_30TRANS;
|
||||
else
|
||||
mservflags = mservflags|warningflags;
|
||||
V_DrawRightAlignedSmallString(BASEVIDWIDTH - currentMenu->x, currentMenu->y+14 + MP_ConnectMenu[mp_connect_page].alphaKey,
|
||||
V_DrawRightAlignedSmallString(BASEVIDWIDTH - currentMenu->x, currentMenu->y+3 + MP_ConnectMenu[mp_connect_refresh].alphaKey,
|
||||
mservflags, va("MS: %s", cv_masterserver.string));
|
||||
|
||||
// Horizontal line!
|
||||
V_DrawFill(1, currentMenu->y+32, 318, 1, 0);
|
||||
M_DrawServerCountAndHorizontalBar();
|
||||
|
||||
if (serverlistcount <= 0)
|
||||
V_DrawString(currentMenu->x,currentMenu->y+SERVERHEADERHEIGHT, 0, "No servers found");
|
||||
|
|
Loading…
Reference in a new issue