Switch around maxplayers and ingamecap

- ingamecap is now the new maxplayers
- The old maxplayers is now called maxconnections, but can mostly be left alone
- Insert into match race menu
This commit is contained in:
Sally Coolatta 2022-08-29 04:21:14 -04:00
parent b388890647
commit e8b179f7a1
10 changed files with 46 additions and 41 deletions

View file

@ -887,13 +887,13 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
netbuffer->u.serverinfo.leveltime = (tic_t)LONG(leveltime);
netbuffer->u.serverinfo.numberofplayer = (UINT8)D_NumPlayers();
netbuffer->u.serverinfo.maxplayer = (UINT8)(min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxplayers.value));
netbuffer->u.serverinfo.maxplayer = (UINT8)(min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxconnections.value));
if (!node)
netbuffer->u.serverinfo.refusereason = 0;
else if (!cv_allownewplayer.value)
netbuffer->u.serverinfo.refusereason = 1;
else if (D_NumPlayers() >= cv_maxplayers.value)
else if (D_NumPlayers() >= cv_maxconnections.value)
netbuffer->u.serverinfo.refusereason = 2;
else
netbuffer->u.serverinfo.refusereason = 0;
@ -1057,7 +1057,7 @@ static boolean SV_SendServerConfig(INT32 node)
netbuffer->u.servercfg.gametype = (UINT8)gametype;
netbuffer->u.servercfg.modifiedgame = (UINT8)modifiedgame;
netbuffer->u.servercfg.maxplayer = (UINT8)(min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxplayers.value));
netbuffer->u.servercfg.maxplayer = (UINT8)(min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxconnections.value));
netbuffer->u.servercfg.allownewplayer = cv_allownewplayer.value;
netbuffer->u.servercfg.discordinvites = (boolean)cv_discordinvites.value;
@ -3072,7 +3072,7 @@ consvar_t cv_joinnextround = CVAR_INIT ("joinnextround", "Off", CV_NETVAR, CV_On
#endif
static CV_PossibleValue_t maxplayers_cons_t[] = {{2, "MIN"}, {MAXPLAYERS, "MAX"}, {0, NULL}};
consvar_t cv_maxplayers = CVAR_INIT ("maxplayers", "8", CV_SAVE|CV_CALL, maxplayers_cons_t, Joinable_OnChange);
consvar_t cv_maxconnections = CVAR_INIT ("maxconnections", "16", CV_SAVE|CV_CALL, maxplayers_cons_t, Joinable_OnChange);
static CV_PossibleValue_t joindelay_cons_t[] = {{1, "MIN"}, {3600, "MAX"}, {0, "Off"}, {0, NULL}};
consvar_t cv_joindelay = CVAR_INIT ("joindelay", "10", CV_SAVE|CV_NETVAR, joindelay_cons_t, NULL);
@ -3108,7 +3108,7 @@ static void Joinable_OnChange(void)
if (!server)
return;
maxplayer = (UINT8)(min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxplayers.value));
maxplayer = (UINT8)(min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxconnections.value));
WRITEUINT8(p, maxplayer);
WRITEUINT8(p, cv_allownewplayer.value);
@ -3760,7 +3760,7 @@ static void HandleConnect(SINT8 node)
// Sal: Dedicated mode is INCREDIBLY hacked together.
// If a server filled out, then it'd overwrite the host and turn everyone into weird husks.....
// It's too much effort to legimately fix right now. Just prevent it from reaching that state.
UINT8 maxplayers = min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxplayers.value);
UINT8 maxplayers = min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxconnections.value);
if (bannednode && bannednode[node])
SV_SendRefuse(node, M_GetText("You have been banned\nfrom the server."));

View file

@ -445,7 +445,7 @@ extern tic_t servermaxping;
extern boolean server_lagless;
extern consvar_t cv_netticbuffer, cv_allownewplayer, cv_maxplayers, cv_joindelay;
extern consvar_t cv_netticbuffer, cv_allownewplayer, cv_maxconnections, cv_joindelay;
extern consvar_t cv_resynchattempts, cv_blamecfail;
extern consvar_t cv_maxsend, cv_noticedownload, cv_downloadspeed;

View file

@ -251,8 +251,8 @@ static consvar_t cv_dummyconsvar = CVAR_INIT ("dummyconsvar", "Off", CV_CALL|CV_
consvar_t cv_restrictskinchange = CVAR_INIT ("restrictskinchange", "Yes", CV_NETVAR|CV_CHEAT, CV_YesNo, NULL);
consvar_t cv_allowteamchange = CVAR_INIT ("allowteamchange", "Yes", CV_NETVAR, CV_YesNo, NULL);
static CV_PossibleValue_t ingamecap_cons_t[] = {{0, "MIN"}, {MAXPLAYERS-1, "MAX"}, {0, NULL}};
consvar_t cv_ingamecap = CVAR_INIT ("ingamecap", "0", CV_NETVAR, ingamecap_cons_t, NULL);
static CV_PossibleValue_t maxplayers_cons_t[] = {{1, "MIN"}, {MAXPLAYERS, "MAX"}, {0, NULL}};
consvar_t cv_maxplayers = CVAR_INIT ("maxplayers", "8", CV_NETVAR, maxplayers_cons_t, NULL);
consvar_t cv_startinglives = CVAR_INIT ("startinglives", "3", CV_NETVAR|CV_CHEAT|CV_NOSHOWHELP, startingliveslimit_cons_t, NULL);
@ -730,11 +730,11 @@ void D_RegisterServerCommands(void)
CV_RegisterVar(&cv_allowexitlevel);
CV_RegisterVar(&cv_restrictskinchange);
CV_RegisterVar(&cv_allowteamchange);
CV_RegisterVar(&cv_ingamecap);
CV_RegisterVar(&cv_maxplayers);
CV_RegisterVar(&cv_respawntime);
// d_clisrv
CV_RegisterVar(&cv_maxplayers);
CV_RegisterVar(&cv_maxconnections);
CV_RegisterVar(&cv_joindelay);
CV_RegisterVar(&cv_resynchattempts);
CV_RegisterVar(&cv_maxsend);

View file

@ -69,7 +69,7 @@ extern consvar_t cv_runscripts;
extern consvar_t cv_mute;
extern consvar_t cv_pause;
extern consvar_t cv_restrictskinchange, cv_allowteamchange, cv_ingamecap, cv_respawntime;
extern consvar_t cv_restrictskinchange, cv_allowteamchange, cv_maxplayers, cv_respawntime;
// SRB2kart items
extern consvar_t cv_superring, cv_sneaker, cv_rocketsneaker, cv_invincibility, cv_banana;

View file

@ -109,7 +109,7 @@ boolean K_AddBot(UINT8 skin, UINT8 difficulty, UINT8 *p)
void K_UpdateMatchRaceBots(void)
{
const UINT8 difficulty = cv_kartbot.value;
UINT8 pmax = min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxplayers.value);
UINT8 pmax = min((dedicated ? MAXPLAYERS-1 : MAXPLAYERS), cv_maxconnections.value);
UINT8 numplayers = 0;
UINT8 numbots = 0;
UINT8 numwaiting = 0;
@ -135,9 +135,9 @@ void K_UpdateMatchRaceBots(void)
}
}
if (cv_ingamecap.value > 0)
if (cv_maxplayers.value > 0)
{
pmax = min(pmax, cv_ingamecap.value);
pmax = min(pmax, cv_maxplayers.value);
}
for (i = 0; i < MAXPLAYERS; i++)

View file

@ -10515,7 +10515,7 @@ void K_CheckSpectateStatus(void)
if (!players[i].spectator)
{
numingame++;
if (cv_ingamecap.value && numingame >= cv_ingamecap.value) // DON'T allow if you've hit the in-game player cap
if (cv_maxplayers.value && numingame >= cv_maxplayers.value) // DON'T allow if you've hit the in-game player cap
return;
if (gamestate != GS_LEVEL) // Allow if you're not in a level
continue;
@ -10540,7 +10540,7 @@ void K_CheckSpectateStatus(void)
return;
// Organize by spectate wait timer
if (cv_ingamecap.value)
if (cv_maxplayers.value)
{
UINT8 oldrespawnlist[MAXPLAYERS];
memcpy(oldrespawnlist, respawnlist, numjoiners);
@ -10567,7 +10567,7 @@ void K_CheckSpectateStatus(void)
// Finally, we can de-spectate everyone!
for (i = 0; i < numjoiners; i++)
{
if (cv_ingamecap.value && numingame+i >= cv_ingamecap.value) // Hit the in-game player cap while adding people?
if (cv_maxplayers.value && numingame+i >= cv_maxplayers.value) // Hit the in-game player cap while adding people?
break;
//CONS_Printf("player %s is joining on tic %d\n", player_names[respawnlist[i]], leveltime);
P_SpectatorJoinGame(&players[respawnlist[i]]);

View file

@ -128,23 +128,26 @@ menuitem_t PLAY_RaceDifficulty[] =
// netgames
{IT_STRING | IT_CVAR, "Difficulty", "Select the game speed",
NULL, {.cvar = &cv_dummykartspeed}, 0, 0},
NULL, {.cvar = &cv_dummykartspeed}, 0, 0},
// DISABLE THAT OPTION OUTSIDE OF MATCH RACE
{IT_STRING2 | IT_CVAR, "CPU Players", "Enable or disable CPU players.", // 2 whitestring is used by the drawer to know to draw shitstring
{IT_STRING2 | IT_CVAR, "CPU", "Set the difficulty of CPU players.",
NULL, {.cvar = &cv_dummymatchbots}, 0, 0},
{IT_STRING2 | IT_CVAR, "Encore", "Enable or disable Encore mode", // 3
{IT_STRING2 | IT_CVAR, "Racers", "Sets the number of racers, including players and CPU.",
NULL, {.cvar = &cv_maxplayers}, 0, 0},
{IT_STRING2 | IT_CVAR, "Encore", "Enable or disable Encore mode",
NULL, {.cvar = &cv_dummygpencore}, 0, 0},
// For GP:
{IT_STRING | IT_CALL, "Cup Select", "Go on and select a cup!", NULL, {.routine = M_LevelSelectInit}, 2, GT_RACE}, // 4
{IT_STRING | IT_CALL, "Cup Select", "Go on and select a cup!", NULL, {.routine = M_LevelSelectInit}, 2, GT_RACE},
// For Match Race:
{IT_STRING | IT_CALL, "Map Select", "Go on and select a race track!", NULL, {.routine = M_LevelSelectInit}, 0, GT_RACE}, // 5
{IT_STRING | IT_CALL, "Map Select", "Go on and select a race track!", NULL, {.routine = M_LevelSelectInit}, 0, GT_RACE},
// For Match Race in NETGAMES:
{IT_STRING | IT_CALL, "Map Select", "Go on and select a race track!", NULL, {.routine =M_MPSetupNetgameMapSelect}, 0, GT_RACE}, // 6
{IT_STRING | IT_CALL, "Map Select", "Go on and select a race track!", NULL, {.routine = M_MPSetupNetgameMapSelect}, 0, GT_RACE},
{IT_STRING | IT_CALL, "Back", NULL, NULL, {.routine = M_GoBack}, 0, 0},
};
@ -357,7 +360,7 @@ menuitem_t PLAY_MP_Host[] =
NULL, {.cvar = &cv_advertise}, 0, 0},
{IT_STRING | IT_CVAR, "Max. Players", "Set how many players can play at once. Others will spectate.",
NULL, {.cvar = &cv_ingamecap}, 0, 0},
NULL, {.cvar = &cv_maxplayers}, 0, 0},
{IT_STRING | IT_CVAR, "Gamemode", "Are we racing? Or perhaps battling?",
NULL, {.cvar = &cv_dummygametype}, 0, 0},
@ -1144,12 +1147,12 @@ menuitem_t OPTIONS_Server[] =
{IT_SPACE | IT_NOTHING, NULL, NULL,
NULL, {NULL}, 0, 0},
{IT_STRING | IT_CVAR, "Ingame Max. Players", "How many players can play at once. 0 Allows everyone who joins.",
NULL, {.cvar = &cv_ingamecap}, 0, 0},
{IT_STRING | IT_CVAR, "Server Max. Players", "How many players can connect to the server.",
{IT_STRING | IT_CVAR, "Maximum Players", "How many players can play at once.",
NULL, {.cvar = &cv_maxplayers}, 0, 0},
{IT_STRING | IT_CVAR, "Maximum Connections", "How many players & spectators can connect to the server.",
NULL, {.cvar = &cv_maxconnections}, 0, 0},
{IT_STRING | IT_CVAR, "Allow Joining", "Sets whether players can connect to your server.",
NULL, {.cvar = &cv_allownewplayer}, 0, 0},

View file

@ -1627,7 +1627,7 @@ void M_DrawRaceDifficulty(void)
}
}
y += 12;
y += 10;
break;
}

View file

@ -3135,21 +3135,23 @@ void M_SetupDifficultySelect(INT32 choice)
PLAY_RaceDifficulty[4].status = IT_DISABLED;
PLAY_RaceDifficulty[5].status = IT_DISABLED;
PLAY_RaceDifficulty[6].status = IT_DISABLED;
PLAY_RaceDifficulty[7].status = IT_DISABLED;
if (choice) // Match Race
{
PLAY_RaceDifficulty[1].status = IT_STRING|IT_CVAR; // Kart Speed
PLAY_RaceDifficulty[2].status = IT_STRING2|IT_CVAR; // CPUs on/off use string2 to signify not to use the normal gm font drawer
PLAY_RaceDifficulty[3].status = IT_STRING2|IT_CVAR; // Encore on/off use string2 to signify not to use the normal gm font drawer
PLAY_RaceDifficulty[5].status = IT_STRING|IT_CALL; // Level Select (Match Race)
PLAY_RaceDifficulty[2].status = IT_STRING2|IT_CVAR; // CPUs on/off
PLAY_RaceDifficulty[3].status = IT_STRING2|IT_CVAR; // CPU amount
PLAY_RaceDifficulty[4].status = IT_STRING2|IT_CVAR; // Encore on/off
PLAY_RaceDifficulty[6].status = IT_STRING|IT_CALL; // Level Select (Match Race)
PLAY_RaceDifficultyDef.lastOn = 5; // Select cup select by default.
}
else // GP
{
PLAY_RaceDifficulty[0].status = IT_STRING|IT_CVAR; // Difficulty
PLAY_RaceDifficulty[3].status = IT_STRING2|IT_CVAR; // Encore on/off use string2 to signify not to use the normal gm font drawer
PLAY_RaceDifficulty[4].status = IT_STRING|IT_CALL; // Level Select (GP)
PLAY_RaceDifficulty[4].status = IT_STRING2|IT_CVAR; // Encore on/off
PLAY_RaceDifficulty[5].status = IT_STRING|IT_CALL; // Level Select (GP)
PLAY_RaceDifficultyDef.lastOn = 4; // Select cup select by default.
}
@ -3437,8 +3439,8 @@ void M_CupSelectHandler(INT32 choice)
memset(&grandprixinfo, 0, sizeof(struct grandprixinfo));
if (cv_maxplayers.value < ssplayers+1)
CV_SetValue(&cv_maxplayers, ssplayers+1);
if (cv_maxconnections.value < ssplayers+1)
CV_SetValue(&cv_maxconnections, ssplayers+1);
if (splitscreen != ssplayers)
{
@ -3599,8 +3601,8 @@ void M_LevelSelectHandler(INT32 choice)
/*if (levellist.choosemap == 0)
levellist.choosemap = G_RandMap(G_TOLFlag(levellist.newgametype), -1, 0, 0, false, NULL);*/
if (cv_maxplayers.value < ssplayers+1)
CV_SetValue(&cv_maxplayers, ssplayers+1);
if (cv_maxconnections.value < ssplayers+1)
CV_SetValue(&cv_maxconnections, ssplayers+1);
if (splitscreen != ssplayers)
{

View file

@ -1054,7 +1054,7 @@ static void ST_overlayDrawer(void)
else if (G_GametypeHasTeams())
itemtxt = M_GetText("Item - Join Team");
if (cv_ingamecap.value)
if (cv_maxplayers.value)
{
UINT8 numingame = 0;
UINT8 i;
@ -1063,7 +1063,7 @@ static void ST_overlayDrawer(void)
if (playeringame[i] && !players[i].spectator)
numingame++;
itemtxt = va("%s (%s: %d)", itemtxt, M_GetText("Slots left"), max(0, cv_ingamecap.value - numingame));
itemtxt = va("%s (%s: %d)", itemtxt, M_GetText("Slots left"), max(0, cv_maxplayers.value - numingame));
}
// SRB2kart: changed positions & text