Let the menu progs know when we're actually in a single/multi-player game.

It seems that the maxclients serverinfo key lies to the client, so we work
around that by setting our own
This commit is contained in:
Marco Cawthorne 2021-01-23 12:56:22 +01:00
parent 9f13450b01
commit dbb53d151a
4 changed files with 13 additions and 2 deletions

View file

@ -89,6 +89,12 @@ CSQC_Init(float apilevel, string enginename, float engineversion)
Sentences_Init();
Decals_Init();
Way_Init();
/* let the menu know we're a multi or a singleplayer game */
if (serverkeyfloat("sv_playerslots") == 1)
cvar_set("_menu_singleplayer", "1");
else
cvar_set("_menu_singleplayer", "0");
}
/* Rendering Caches */

View file

@ -15,6 +15,7 @@
*/
var int autocvar_menu_intro = TRUE;
var int autocvar__menu_singleplayer;
#define KEY_UNKNOWN -1
#define KEY_GAME 0

View file

@ -293,7 +293,7 @@ menu_multiplayer_draw(void)
{
Header_Draw(HEAD_MULTI);
if (clientstate() == 2 && !g_background) {
if (!autocvar__menu_singleplayer && clientstate() == 2 && !g_background) {
Widget_Draw(fn_multiplayer2);
WLabel_Static(215, 148, m_reslbl[IDS_MULTI_RESUMEHELP], 10, 10, col_help,
@ -357,7 +357,7 @@ menu_multiplayer_input(float evtype, float scanx, float chary, float devid)
if (g_connectstatus)
return;
if (clientstate() == 2 && !g_background)
if (!autocvar__menu_singleplayer && clientstate() == 2 && !g_background)
Widget_Input(fn_multiplayer2, evtype, scanx, chary, devid);
else
Widget_Input(fn_multiplayer, evtype, scanx, chary, devid);

View file

@ -416,6 +416,10 @@ void initents(void)
} else {
forceinfokey(world, "background", "0");
}
/* the maxclients serverinfo key? yeah, that one lies to the client. so
* let's add our own that we can actually trust. */
forceinfokey(world, "sv_playerslots", cvar_string("sv_playerslots"));
}
/*