Support 16 pilots + 1 cameraship in multiplayer

MW4Shell.cpp:
- CTCL_DefaultHostSetup (non-coop): replaced hardcoded
  Environment.NetworkMaxPlayers=16 with
  params->m_maxPlayers + (CTCL_GetTeslaCountAll() - CTCL_GetTeslaCount())
  so DirectPlay reserves one extra slot per installed cameraship.
  CTCL_GetTeslaCountAll() - CTCL_GetTeslaCount() = camera-only seat count.
- SetNetworkMissionParamater / PLAYER_LIMIT_PARAMETER: applied the same
  camera-slot formula when the host changes the player limit at runtime.
  Also restored the gos_NetServerCommands(gos_Commend_UpdateMaxPlayers)
  call (was accidentally dropped) and the missing break that caused
  fall-through into JOIN_IN_PROGRESS_PARAMETER.
- COOP branch: no change (capped at 9+bots; camera seats not needed there).

ConLobby.script:
- Raised the launch-guard cap from nTempPlayerCount > 16 to > 17,
  allowing the 17th connection (the cameraship) to not trigger the
  'Too many player/bots' error.
This commit is contained in:
2026-07-19 18:54:38 -05:00
parent 16fca6c4f1
commit f76dc05f46
2 changed files with 10 additions and 9 deletions
+8 -8
View File
@@ -1828,7 +1828,8 @@ int MW4Shell::SetNetworkMissionParamater(void * instance, int numParms, void **d
case PLAYER_LIMIT_PARAMETER:
params->m_playerLimit = INTPARM(1);
Min_Clamp(params->m_playerLimit, Network::GetInstance()->GetPlayerCount());
Environment.NetworkMaxPlayers = params->m_playerLimit;
// Add camera slots on top of the pilot limit so cameraships can still connect
Environment.NetworkMaxPlayers = params->m_playerLimit + (CTCL_GetTeslaCountAll() - CTCL_GetTeslaCount());
gos_NetServerCommands(gos_Commend_UpdateMaxPlayers,0);
break;
@@ -13307,17 +13308,16 @@ void CTCL_API CTCL_DefaultHostSetup(int nMode)
params->m_allowdecaltransfer = 0;
if (g_bCOOP) {
Environment.NetworkMaxPlayers = 16;
//if (CTCL_GetTeslaCount() < CTCL_GetTeslaCountAll()) {
// any cameraship installed... so 1 more player can join
//params->m_maxPlayers = 9;
//params->m_maxBots = 8;
//} else {
// Reserve extra DirectPlay slots for camera seats (tracked separately from pilots in CTCL)
// Original commented-out intent preserved and now implemented for non-COOP below
params->m_maxPlayers = 9;
params->m_maxBots = 8;
//}
} else {
params->m_maxPlayers = 16;
Environment.NetworkMaxPlayers = 16;
// Reserve extra DirectPlay slots for cameraships: they share the session but are tracked
// separately from pilot seats in CTCL (CTCL_GetTeslaCountAll - CTCL_GetTeslaCount = camera count).
// Without this, cameraship connection is rejected by DirectPlay because slot 17 doesn't exist.
Environment.NetworkMaxPlayers = params->m_maxPlayers + (CTCL_GetTeslaCountAll() - CTCL_GetTeslaCount());
params->m_maxBots = 16;
}
params->m_allow3rdPerson = 1;
@@ -2721,7 +2721,8 @@ main
}
}
// MSL 5.06
if nLaunchState == 0 && (nTempPlayerCount > 16)
// RT 07/19/26: raised cap from 16 to 17 to allow 16 pilots + 1 cameraship
if nLaunchState == 0 && (nTempPlayerCount > 17)
{
o_error_string.text = "Too many player/bots"
nLaunchState = -7