Warn about 9p+ games

This commit is contained in:
Antonio Martinez 2025-10-29 00:59:47 -04:00
parent 3d465337bb
commit c8ddd6e601
3 changed files with 55 additions and 8 deletions

View file

@ -752,7 +752,8 @@ void LiveStudioAudience_OnChange(void);
consvar_t cv_livestudioaudience = UnsavedNetVar("livestudioaudience", "Off").on_off().onchange(LiveStudioAudience_OnChange);
#endif
consvar_t cv_maxplayers = NetVar("maxplayers", "8").min_max(1, MAXPLAYERS);
void Maxplayers_OnChange(void);
consvar_t cv_maxplayers = NetVar("maxplayers", "8").min_max(1, MAXPLAYERS).onchange_noinit(Maxplayers_OnChange);
consvar_t cv_shuffleloser = NetVar("shuffleloser", "On").on_off();

View file

@ -630,7 +630,7 @@ boolean IsPlayerNameUnique(const char *name, INT32 playernum)
if (strcasecmp(name, player_names[ix]) == 0) // Are usernames equal?
return false;
}
return true;
}
@ -666,20 +666,20 @@ boolean IsPlayerNameGood(char *name)
for (ix = 0; ix < len; ix++)
if (!AllowedPlayerNameChar(name[ix]))
return false;
return true;
}
boolean EnsurePlayerNameIsGood(char *name, INT32 playernum)
{
size_t len = strlen(name);
// Check if a player is using a valid name.
if (!IsPlayerNameGood(name))
return false;
// Check if another player is currently using the name, case-insensitively.
if (!IsPlayerNameUnique(name, playernum))
if (!IsPlayerNameUnique(name, playernum))
{
// We shouldn't kick people out just because
// they joined the game with the same name
@ -7631,6 +7631,34 @@ void LiveStudioAudience_OnChange(void)
livestudioaudience_timer = 90;
}
static boolean maxplayers_warned = false;
static void M_MaxplayersSelect(INT32 choice)
{
if (choice == MA_YES)
{
maxplayers_warned = true;
return;
}
CV_StealthSetValue(&cv_maxplayers, 8);
}
void Maxplayers_OnChange(void);
void Maxplayers_OnChange(void)
{
if (cv_maxplayers.value <= 8 || maxplayers_warned)
return;
if (currentMenu == &PLAY_RaceDifficultyDef || currentMenu == &OPTIONS_ServerDef)
{
S_StartSound(NULL, sfx_s3k96);
M_StartMessage("Some advice...",
"Ring Racers was designed for \x82""8 or fewer players""\x80"".\n""\x80""Racing may be ""\x82""more frustrating""\x80"" in large games.\n""\x86""(Comeback tools can only work so hard!)",
M_MaxplayersSelect, MM_YESNO, "Bring on the imbalance...!", "Never mind!");
}
}
void Got_DiscordInfo(const UINT8 **p, INT32 playernum)
{
if (playernum != serverplayer /*&& !IsPlayerAdmin(playernum)*/)

View file

@ -477,6 +477,16 @@ void M_MPServerBrowserTick(void)
CL_TimeoutServerList();
}
static void M_ServerBrowserConfirm(INT32 choice)
{
if (choice != MA_YES)
return;
COM_BufAddText(va("connect node %d\n", serverlist[mpmenu.servernum].node));
M_PleaseWait();
}
// Input handler for server browser.
boolean M_ServerBrowserInputs(INT32 ch)
{
@ -516,9 +526,17 @@ boolean M_ServerBrowserInputs(INT32 ch)
{
M_SetMenuDelay(pid);
COM_BufAddText(va("connect node %d\n", serverlist[mpmenu.servernum].node));
M_PleaseWait();
if (serverlist[mpmenu.servernum].info.numberofplayer >= 8)
{
S_StartSound(NULL, sfx_s3k96);
M_StartMessage("Some advice...",
"Ring Racers was designed for \x82""8 or fewer players""\x80"".\n""\x80""Racing may be ""\x82""more frustrating""\x80"" in large games.\n""\x86""(Comeback tools can only work so hard!)",
M_ServerBrowserConfirm, MM_YESNO, "Bring on the imbalance...!", "Never mind!");
}
else
{
M_ServerBrowserConfirm(MA_YES);
}
return true;
}