From f76dc05f46a7c49c01ada6699fced56efa727cef Mon Sep 17 00:00:00 2001 From: RT Date: Sun, 19 Jul 2026 18:54:38 -0500 Subject: [PATCH] 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. --- Gameleap/code/mw4/Code/MW4/MW4Shell.cpp | 16 ++++++++-------- .../mw4/Content/ShellScripts/ConLobby.script | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Gameleap/code/mw4/Code/MW4/MW4Shell.cpp b/Gameleap/code/mw4/Code/MW4/MW4Shell.cpp index c5670abb..62ab4097 100644 --- a/Gameleap/code/mw4/Code/MW4/MW4Shell.cpp +++ b/Gameleap/code/mw4/Code/MW4/MW4Shell.cpp @@ -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; diff --git a/Gameleap/mw4/Content/ShellScripts/ConLobby.script b/Gameleap/mw4/Content/ShellScripts/ConLobby.script index 983efc6c..2dd68f7f 100644 --- a/Gameleap/mw4/Content/ShellScripts/ConLobby.script +++ b/Gameleap/mw4/Content/ShellScripts/ConLobby.script @@ -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