Load File: hide button when automaticmode!=1; fix team/skin double-click
1. Expose g_bAutomaticMode as gosScript variable so ConLobby can check it at init time. o_load_file.state is set to 3 (disabled/hidden) if automaticmode != 1 in options.ini. Button is fully visible and active only when the feature is intentionally enabled. Rebuild required: MW4.exe (Release + Profile). 2. Remove cur_team_val conditional for team/skin slot assignment. Previously, only one of o_team[k] or o_skins[k] was set depending on cur_team_val at click time, but MAIL_SET_ROOKIE_MISSION propagates the new game type asynchronously -- cur_team_val would not reflect the file's GameType until the next frame, requiring a second click. Fix: always set both o_team[k] and o_skins[k] unconditionally. The mission launch code uses whichever is relevant for the active mode; the other is harmlessly ignored. No rebuild (script-only).
This commit is contained in:
@@ -775,7 +775,8 @@ void MW4Shell::StartUp()
|
||||
gosScript_RegisterVariable("g_nRookieWeaponJam", &g_nRookieWeaponJam, GOSVAR_INT, 0, NULL);
|
||||
gosScript_RegisterVariable("g_nRookieAdvanceMode", &g_nRookieAdvanceMode, GOSVAR_INT, 0, NULL);
|
||||
gosScript_RegisterVariable("g_nRookieArmorMode", &g_nRookieArmorMode, GOSVAR_INT, 0, NULL);
|
||||
// [automaticmode] callbacks
|
||||
// [automaticmode] callbacks + g_bAutomaticMode variable for script visibility
|
||||
gosScript_RegisterVariable("g_bAutomaticMode", &g_bAutomaticMode, GOSVAR_INT, 0, NULL);
|
||||
gosScript_RegisterCallback("CTCL_LoadAutoFile", &CTCL_LoadAutoFile, GOSVAR_INT, 0, NULL);
|
||||
gosScript_RegisterCallback("CTCL_GetAutoSlotName", &CTCL_GetAutoSlotName, GOSVAR_INT, 0, NULL);
|
||||
gosScript_RegisterCallback("CTCL_GetAutoSlotMech", &CTCL_GetAutoSlotMech, GOSVAR_INT, 0, NULL);
|
||||
@@ -1186,11 +1187,12 @@ void MW4Shell::ShutDown()
|
||||
gosScript_UnregisterVariable("g_nRookieWeaponJam");
|
||||
gosScript_UnregisterVariable("g_nRookieAdvanceMode");
|
||||
gosScript_UnregisterVariable("g_nRookieArmorMode");
|
||||
// [automaticmode] callbacks
|
||||
// [automaticmode] callbacks + variable
|
||||
gosScript_UnregisterCallback("CTCL_GetAutoSlotInt");
|
||||
gosScript_UnregisterCallback("CTCL_GetAutoSlotMech");
|
||||
gosScript_UnregisterCallback("CTCL_GetAutoSlotName");
|
||||
gosScript_UnregisterCallback("CTCL_LoadAutoFile");
|
||||
gosScript_UnregisterVariable("g_bAutomaticMode");
|
||||
// MSL 5.06
|
||||
gosScript_UnregisterVariable("g_nBlackMech");
|
||||
gosScript_UnregisterVariable("g_nMechVariant");
|
||||
|
||||
@@ -1238,6 +1238,8 @@ main
|
||||
o_load_file.location = 467, 510, o_frame.location.z + 1
|
||||
o_load_file.state = 0 // initially enabled
|
||||
initialize(o_load_file)
|
||||
if ($$g_bAutomaticMode$$ != 1)
|
||||
o_load_file.state = 3 // hide when automaticmode is not active
|
||||
|
||||
// MSL Added default settings button
|
||||
object o_default = s_multistatepane
|
||||
@@ -1747,10 +1749,12 @@ main
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if cur_team_val > 0
|
||||
o_team[k].nselected = callback($$CTCL_GetAutoSlotInt$$, k, 1)
|
||||
else
|
||||
o_skins[k].nselected = callback($$CTCL_GetAutoSlotInt$$, k, 2)
|
||||
// Always set both team and skin unconditionally.
|
||||
// The game type may not have propagated to cur_team_val yet
|
||||
// (MAIL_SET_ROOKIE_MISSION is async); setting both is safe --
|
||||
// the launch code uses whichever is correct for the active mode.
|
||||
o_team[k].nselected = callback($$CTCL_GetAutoSlotInt$$, k, 1)
|
||||
o_skins[k].nselected = callback($$CTCL_GetAutoSlotInt$$, k, 2)
|
||||
o_decal[k].nselected = callback($$CTCL_GetAutoSlotInt$$, k, 3)
|
||||
initialize(o_mech_variant[k])
|
||||
if (ROSTER_top_of_list <= k) && (k < ROSTER_top_of_list + ROSTER_DISPLAY_COUNT)
|
||||
|
||||
Reference in New Issue
Block a user