Fix Load File: separate Auto globals; fix team/FFA double-press

Issue 1 — double press to fix team/FFA display:
  cur_team_val is updated by ConLobbyMission's -9998 signal which was async.
  Fix: call SetNetworkMissionParamater(team_allowed, ...) directly in ConLobby
  before the slot loop, then re-read cur_team_val via CTCL_GetTeamParams.
  This is synchronous so the slot display is correct on the first click.
  New file keys: TeamAllowed=0/1, TeamCount=2 (default 2 teams).

Issue 2 — Default button broken after Load File click:
  CTCL_LoadAutoFile was overwriting g_nRookieGameType/g_szRookieMission etc.
  so the Default button loaded the last auto-file params instead of defaults.
  Fix: 14 new dedicated g_nAutoXxx/g_szAutoMission globals. CTCL_LoadAutoFile
  populates ONLY these. Rookie Mission globals are never touched.
  New MAIL_LOAD_AUTO_MISSION (-6666) sent to ConLobbyMission applies the Auto
  globals (mirrors MAIL_SET_ROOKIE_MISSION_PARAMS but uses g_nAutoXxx).
  ConLobby reads game type/mission from Auto globals directly into the
  ConLobbyMission dropdowns (@ConLobbyMission@o_game_options[N].nselected).

Files changed:
  MW4Shell.cpp: 16 new globals, StartUp/ShutDown registration, CTCL_LoadAutoFile
  ConLobby.script: MAIL_LOAD_AUTO_MISSION define, updated handler
  ConLobbyMission.script: MAIL_LOAD_AUTO_MISSION define + handler
  autoconfig-file-spec.html: document TeamAllowed + TeamCount fields
Rebuild required: MW4.exe (Release + Profile).
This commit is contained in:
2026-07-24 10:35:11 -05:00
parent 3f2d79a038
commit cd2fe73c88
4 changed files with 189 additions and 19 deletions
@@ -190,6 +190,7 @@
#define MAIL_PREVIOUS_MISSION -2222
#define MAIL_RECORD_MISSION -4444
#define MAIL_PREVIOUS_MISSION_PARAMS -5555
#define MAIL_LOAD_AUTO_MISSION -6666 // [automaticmode] sync with Multiplayer/ConLobbyMission.script
// MSL 5.06
// MSL ADD MECH
@@ -1682,9 +1683,29 @@ main
play press, 1
if callback($$CTCL_LoadAutoFile$$)
{
// Apply mission + game options via existing Rookie Mission flow
// Apply game options using dedicated Auto globals.
// Rookie Mission globals are NOT touched so the Default button keeps working.
int m
if exists(@ConLobbyMission@)
mail(MAIL_SET_ROOKIE_MISSION, @ConLobbyMission@)
{
@ConLobbyMission@o_game_options[0].nselected = $$g_nAutoGameType$$
for (m = 0; m < @ConLobbyMission@o_game_options[1].list_size; m++)
{
if equal$(@ConLobbyMission@o_game_options[1].list_item[m], $$g_szAutoMission$$)
{
@ConLobbyMission@o_game_options[1].nselected = m
break
}
}
mail(MAIL_LOAD_AUTO_MISSION, @ConLobbyMission@)
}
// Update team state synchronously so slot display is correct on the first click.
// MAIL_LOAD_AUTO_MISSION is async; setting team_allowed directly here lets
// CTCL_GetTeamParams return the correct cur_team_val before the slot loop runs.
callback($$SetNetworkMissionParamater$$, team_allowed, $$g_nAutoTeamAllowed$$)
if $$g_nAutoTeamAllowed$$
callback($$SetNetworkMissionParamater$$, num_of_teams, $$g_nAutoTeamCount$$)
cur_team_val = callback($$CTCL_GetTeamParams$$, cur_team_count[0])
// Clear all slots
o_cam_list.nselected = 0
for (k = 0; k < nRosterCount; k++)