Display server information before connecting to it #175
No files matched your search
+108
-5
@@ -87,6 +87,9 @@ boolean serverrunning = false;
|
||||
INT32 serverplayer = 0;
|
||||
char motd[254], server_context[8]; // Message of the Day, Unique Context (even without Mumble support)
|
||||
|
||||
plrinfo playerinfo[MAXPLAYERS];
|
||||
SINT8 joinnode = 0; // used for CL_VIEWSERVER
|
||||
|
||||
// Server specific vars
|
||||
UINT8 playernode[MAXPLAYERS];
|
||||
|
||||
@@ -1185,6 +1188,7 @@ typedef enum
|
||||
#endif
|
||||
CL_CONNECTED,
|
||||
CL_ABORTED,
|
||||
CL_VIEWSERVER,
|
||||
CL_ASKFULLFILELIST,
|
||||
CL_CONFIRMCONNECT,
|
||||
#ifdef HAVE_CURL
|
||||
@@ -1248,7 +1252,7 @@ static inline void CL_DrawConnectionStatus(void)
|
||||
if (!menuactive) // menu already draws its own fade
|
||||
V_DrawFadeScreen(0xFF00, 16); // force default
|
||||
|
||||
if (cl_mode != CL_DOWNLOADFILES && cl_mode != CL_LOADFILES && cl_mode != CL_CHECKFILES
|
||||
if (cl_mode != CL_DOWNLOADFILES && cl_mode != CL_LOADFILES && cl_mode != CL_CHECKFILES && cl_mode != CL_VIEWSERVER
|
||||
#ifdef HAVE_CURL
|
||||
&& cl_mode != CL_DOWNLOADHTTPFILES
|
||||
#endif
|
||||
@@ -1368,6 +1372,78 @@ static inline void CL_DrawConnectionStatus(void)
|
||||
V_DrawCenteredString(BASEVIDWIDTH/2, BASEVIDHEIGHT-24, V_20TRANS|V_MONOSPACE|MENUCAPS,
|
||||
va(" %2u/%2u Files",loadcompletednum,fileneedednum));
|
||||
}
|
||||
else if (cl_mode == CL_VIEWSERVER)
|
||||
{
|
||||
V_DrawFill(8, 16, BASEVIDWIDTH - 16, 54, 239);
|
||||
|
||||
V_DrawThinString(12 + 80, 18, V_ALLOWLOWERCASE, va("%s", serverlist[joinnode].info.servername));
|
||||
|
||||
const char *map = va("%sP", serverlist[joinnode].info.mapname);
|
||||
patch_t *current_map = W_LumpExists(map) ? W_CachePatchName(map, PU_CACHE) : W_CachePatchName("BLANKLVL", PU_CACHE);
|
||||
V_DrawSmallScaledPatch(10, 18, 0, current_map);
|
||||
|
||||
V_DrawThinString(12 + 80, 38, V_ALLOWLOWERCASE, va("%s", serverlist[joinnode].info.maptitle));
|
||||
V_DrawThinString(12 + 80, 48, V_ALLOWLOWERCASE, va("%s", Gametype_Names[serverlist[joinnode].info.gametype]));
|
||||
|
||||
if (fileneedednum > 0)
|
||||
{
|
||||
V_DrawThinString(12 + 80, 58, V_ALLOWLOWERCASE|V_ORANGEMAP, va("%i Addons", fileneedednum));
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawThinString(12 + 80, 58, V_ALLOWLOWERCASE|V_YELLOWMAP, "Vanilla");
|
||||
}
|
||||
|
||||
if (serverlist[joinnode].info.cheatsenabled)
|
||||
{
|
||||
V_DrawRightAlignedThinString(BASEVIDWIDTH - 12, 58, V_ALLOWLOWERCASE|V_GREENMAP, "Cheats");
|
||||
}
|
||||
|
||||
V_DrawFill(8, 72, BASEVIDWIDTH - 16, 112, 239);
|
||||
|
||||
V_DrawString(12, 74, V_ALLOWLOWERCASE|V_YELLOWMAP, "Players");
|
||||
V_DrawRightAlignedString(BASEVIDWIDTH - 12, 74, V_ALLOWLOWERCASE|V_YELLOWMAP, va("%i / %i", serverlist[joinnode].info.numberofplayer, serverlist[joinnode].info.maxplayer));
|
||||
|
||||
INT32 i;
|
||||
INT32 count = 0;
|
||||
INT32 x = 14;
|
||||
INT32 y = 84;
|
||||
INT32 statuscolor = 1;
|
||||
char player_name[MAXPLAYERNAME+1];
|
||||
if (serverlist[joinnode].info.numberofplayer > 0)
|
||||
{
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
{
|
||||
if (playerinfo[i].node < 255)
|
||||
{
|
||||
strncpy(player_name, playerinfo[i].name, MAXPLAYERNAME);
|
||||
V_DrawThinString(x + 10, y, V_ALLOWLOWERCASE|V_6WIDTHSPACE, player_name);
|
||||
|
||||
if (playerinfo[i].team == 0) { statuscolor = 184; } // playing
|
||||
if (playerinfo[i].data & 0x20) { statuscolor = 86; } // tag IT
|
||||
if (playerinfo[i].team == 1) { statuscolor = 128; } // ctf red team
|
||||
if (playerinfo[i].team == 2) { statuscolor = 232; } // ctf blue team
|
||||
if (playerinfo[i].team == 255) { statuscolor = 16; } // spectator or non-team
|
||||
|
||||
V_DrawFill(x, y, 7, 7, 31);
|
||||
V_DrawFill(x, y, 6, 6, statuscolor);
|
||||
|
||||
y += 9;
|
||||
count++;
|
||||
if ((count == 11) || (count == 22))
|
||||
{
|
||||
x += 104;
|
||||
y = 84;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Buttons
|
||||
V_DrawFill(8, BASEVIDHEIGHT - 14, BASEVIDWIDTH - 16, 12, 239);
|
||||
V_DrawThinString(16, BASEVIDHEIGHT - 12, V_ALLOWLOWERCASE, va("[%sESC%s] = Abort", "\x82", "\x80"));
|
||||
V_DrawRightAlignedThinString(BASEVIDWIDTH - 12, BASEVIDHEIGHT - 12, V_ALLOWLOWERCASE, va("[%sENTER%s] = Join", "\x82", "\x80"));
|
||||
}
|
||||
else if (filedownload.current != -1)
|
||||
{
|
||||
INT32 dldlength;
|
||||
@@ -2469,6 +2545,7 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
|
||||
if (i < 0)
|
||||
return true;
|
||||
}
|
||||
joinnode = i;
|
||||
|
||||
// Quit here rather than downloading files and being refused later.
|
||||
if (serverlist[i].info.numberofplayer >= serverlist[i].info.maxplayer)
|
||||
@@ -2495,7 +2572,7 @@ static boolean CL_ServerConnectionSearchTicker(tic_t *asksent)
|
||||
return true;
|
||||
}
|
||||
|
||||
cl_mode = CL_CHECKFILES;
|
||||
cl_mode = (cv_serverinfoscreen.value) ? CL_VIEWSERVER : CL_CHECKFILES;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2549,7 +2626,7 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
||||
|
||||
case CL_ASKFULLFILELIST:
|
||||
if (cl_lastcheckedfilecount == UINT16_MAX) // All files retrieved
|
||||
cl_mode = CL_CHECKFILES;
|
||||
cl_mode = (cv_serverinfoscreen.value) ? CL_VIEWSERVER : CL_CHECKFILES;
|
||||
else if (fileneedednum != cl_lastcheckedfilecount || I_GetTime() >= *asksent)
|
||||
{
|
||||
if (CL_AskFileList(fileneedednum))
|
||||
@@ -2715,6 +2792,15 @@ static boolean CL_ServerConnectionTicker(const char *tmpsave, tic_t *oldtic, tic
|
||||
D_ProcessEvents(); //needed for menu system to receive inputs
|
||||
|
||||
key = I_GetKey();
|
||||
|
||||
if (cl_mode == CL_VIEWSERVER)
|
||||
{
|
||||
if (key == KEY_ENTER || key == KEY_JOY1)
|
||||
cl_mode = CL_CHECKFILES;
|
||||
else if (key == KEY_ESCAPE || key == KEY_JOY1+1)
|
||||
cl_mode = CL_ABORTED;
|
||||
}
|
||||
|
||||
// Only ESC and non-keyboard keys abort connection
|
||||
if (!modeattacking && (key == KEY_ESCAPE || key == KEY_JOY1+1 || cl_mode == CL_ABORTED))
|
||||
{
|
||||
@@ -4142,6 +4228,8 @@ consvar_t cv_downloadspeed = {"downloadspeed", "300", CV_SAVE, downloadspeed_con
|
||||
static CV_PossibleValue_t connectawaittime_cons_t[] = {{1, "MIN"}, {60, "MAX"}, {0, "Inf"}, {0, NULL}};
|
||||
consvar_t cv_connectawaittime = {"connectawaittime", "5", CV_SAVE, connectawaittime_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_serverinfoscreen = {"serverinfoscreen", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
static void Got_AddPlayer(UINT8 **p, INT32 playernum);
|
||||
static void Got_RemovePlayer(UINT8 **p, INT32 playernum);
|
||||
|
||||
@@ -4909,6 +4997,16 @@ static void HandleServerInfo(SINT8 node)
|
||||
if (client && cl_mode > CL_SEARCHING && node == servernode)
|
||||
memcpy(connectedservername, netbuffer->u.serverinfo.servername, MAXSERVERNAME);
|
||||
}
|
||||
|
||||
|
||||
static void HandlePlayerInfo(SINT8 node)
|
||||
{
|
||||
(void)node;
|
||||
|
||||
INT32 i;
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
playerinfo[i] = netbuffer->u.playerinfo[i];
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SATURNPAK
|
||||
@@ -5197,6 +5295,10 @@ static void HandlePacketFromAwayNode(SINT8 node)
|
||||
|
||||
case PT_CLIENTCMD:
|
||||
break; // This is not an "unknown packet"
|
||||
|
||||
case PT_PLAYERINFO:
|
||||
HandlePlayerInfo(node);
|
||||
break;
|
||||
|
||||
case PT_SERVERTICS:
|
||||
// Do not remove my own server (we have just get a out of order packet)
|
||||
@@ -5789,8 +5891,9 @@ static void GetPackets(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (netbuffer->packettype == PT_PLAYERINFO)
|
||||
continue; // We do nothing with PLAYERINFO, that's for the MS browser.
|
||||
/*if (netbuffer->packettype == PT_PLAYERINFO)
|
||||
continue; // We do nothing with PLAYERINFO, that's for the MS browser. Not quite true anymore :p*/
|
||||
|
||||
|
||||
// We also count unknown packets, hence "<="
|
||||
if (netbuffer->packettype <= NUMPACKETTYPE)
|
||||
|
||||
@@ -577,6 +577,9 @@ extern boolean acceptnewnode;
|
||||
extern SINT8 servernode;
|
||||
extern char connectedservername[MAXSERVERNAME+1];
|
||||
|
||||
extern plrinfo playerinfo[MAXPLAYERS];
|
||||
extern SINT8 joinnode;
|
||||
|
||||
void Command_Ping_f(void);
|
||||
extern tic_t connectiontimeout;
|
||||
extern tic_t jointimeout;
|
||||
@@ -608,6 +611,8 @@ extern consvar_t cv_connectawaittime;
|
||||
|
||||
extern consvar_t cv_discordinvites;
|
||||
|
||||
extern consvar_t cv_serverinfoscreen;
|
||||
|
||||
// Used in d_net, the only dependence
|
||||
//tic_t ExpandTics(INT32 low, tic_t basetic);
|
||||
void D_ClientServerInit(void);
|
||||
|
||||
@@ -902,6 +902,7 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_netticbuffer);
|
||||
CV_RegisterVar(&cv_mindelay);
|
||||
CV_RegisterVar(&cv_gentlemens);
|
||||
CV_RegisterVar(&cv_serverinfoscreen);
|
||||
|
||||
#ifdef NETGAME_DEVMODE
|
||||
CV_RegisterVar(&cv_fishcake);
|
||||
|
||||
+15
-13
@@ -2188,29 +2188,30 @@ static menuitem_t OP_SaturnMenu[] =
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Minimum Input Delay", &cv_mindelay, 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Gentlemens Ping", &cv_gentlemens, 25},
|
||||
{IT_STRING | IT_CVAR, NULL, "Server Info Screen", &cv_serverinfoscreen, 30},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 35},
|
||||
{IT_STRING | IT_CVAR, NULL, "Skin Select Spinning Speed", &cv_skinselectspin, 40},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Colorized Speedlines", &cv_coloredspeedlines, 45},
|
||||
{IT_STRING | IT_CVAR, NULL, "Colorized Sneakertrails", &cv_coloredsneakertrail, 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Colorized Speedlines", &cv_coloredspeedlines, 50},
|
||||
{IT_STRING | IT_CVAR, NULL, "Colorized Sneakertrails", &cv_coloredsneakertrail, 55},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Player Blendeffects", &cv_playerblendeffects, 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Player Blendeffects", &cv_playerblendeffects, 65},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Bananadrag Jitter", &cv_bananajitter, 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Bananadrag Jitter", &cv_bananajitter, 75},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Midair Driftsparks", &cv_airsparks, 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Midair Driftsparks", &cv_airsparks, 85},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Show Localskin Menus", &cv_showlocalskinmenus, 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Show Localskin Menus", &cv_showlocalskinmenus, 95},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 100},
|
||||
{IT_STRING | IT_CVAR, NULL, "Uppercase Menu", &cv_menucaps, 105},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Keyboard Layout", &cv_keyboardlayout, 110},
|
||||
{IT_STRING | IT_CVAR, NULL, "Keyboard Layout", &cv_keyboardlayout, 115},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 120},
|
||||
{IT_STRING | IT_CVAR, NULL, "Less Midnight Channel Flicker", &cv_lessflicker, 125},
|
||||
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Saturn Hud...", &OP_SaturnHudDef, 130},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Sprite Distortion...", &OP_PlayerDistortDef, 135},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 140}, // uwu
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Saturn Hud...", &OP_SaturnHudDef, 135},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Sprite Distortion...", &OP_PlayerDistortDef, 140},
|
||||
{IT_SUBMENU|IT_STRING, NULL, "Saturn Credits", &OP_SaturnCreditsDef, 145}, // uwu
|
||||
};
|
||||
|
||||
static const char* OP_SaturnTooltips[] =
|
||||
@@ -2219,6 +2220,7 @@ static const char* OP_SaturnTooltips[] =
|
||||
"How long can the game wait before it kicks you out from the server\nconnecting screen.",
|
||||
"Practice for online play! 0 = instant response.",
|
||||
"Simulate online input delay when hosting a server.\nValue choosen by Player with the lowest ping",
|
||||
"Show a screen before joining a server displaying important information about it",
|
||||
"How much speen do you want?",
|
||||
"Colourize the speedlines in your skincolor if you go fast enough!",
|
||||
"Colourize the sneaker flame trails in your skincolor!",
|
||||
|
||||
Reference in new issue
Block a user