From ca5873a2afdddf1df415869e81fd85e278903796 Mon Sep 17 00:00:00 2001 From: zcaliptium Date: Thu, 31 Mar 2016 19:21:46 +0300 Subject: [PATCH] GameExecutable: Some cleanup and reorder. Clean clean clean! --- Sources/SeriousSam/GUI/Menus/MConfirm.cpp | 10 + Sources/SeriousSam/GUI/Menus/Menu.cpp | 3 - Sources/SeriousSam/GUI/Menus/MenuActions.cpp | 113 +-- Sources/SeriousSam/GUI/Menus/MenuStarters.cpp | 928 +++++++++--------- 4 files changed, 513 insertions(+), 541 deletions(-) diff --git a/Sources/SeriousSam/GUI/Menus/MConfirm.cpp b/Sources/SeriousSam/GUI/Menus/MConfirm.cpp index 52267fe..6555cbb 100644 --- a/Sources/SeriousSam/GUI/Menus/MConfirm.cpp +++ b/Sources/SeriousSam/GUI/Menus/MConfirm.cpp @@ -66,4 +66,14 @@ void CConfirmMenu::BeSmall(void) gm_mgConfirmLabel.mg_iCenterI = -1; gm_mgConfirmYes.mg_boxOnScreen = BoxPopupYesSmall(); gm_mgConfirmNo.mg_boxOnScreen = BoxPopupNoSmall(); +} + +// return TRUE if handled +BOOL CConfirmMenu::OnKeyDown(int iVKey) +{ + if ((iVKey == VK_ESCAPE || iVKey == VK_RBUTTON) && gm_mgConfirmNo.mg_pActivatedFunction != NULL) { + gm_mgConfirmNo.OnActivate(); + return TRUE; + } + return CGameMenu::OnKeyDown(iVKey); } \ No newline at end of file diff --git a/Sources/SeriousSam/GUI/Menus/Menu.cpp b/Sources/SeriousSam/GUI/Menus/Menu.cpp index 8c99132..c383533 100644 --- a/Sources/SeriousSam/GUI/Menus/Menu.cpp +++ b/Sources/SeriousSam/GUI/Menus/Menu.cpp @@ -47,9 +47,6 @@ GameMode _gmMenuGameMode = GM_NONE; GameMode _gmRunningGameMode = GM_NONE; CListHead _lhServers; - -extern BOOL IsCDInDrive(void); - void OnPlayerSelect(void); // last tick done diff --git a/Sources/SeriousSam/GUI/Menus/MenuActions.cpp b/Sources/SeriousSam/GUI/Menus/MenuActions.cpp index f06e376..3a88f15 100644 --- a/Sources/SeriousSam/GUI/Menus/MenuActions.cpp +++ b/Sources/SeriousSam/GUI/Menus/MenuActions.cpp @@ -100,6 +100,8 @@ static void SizeToResolution(PIX pixSizeI, PIX pixSizeJ, INDEX &iRes) } // ------------------------ CConfirmMenu implementation +#define CMENU _pGUIM->gmConfirmMenu + CTFileName _fnmModSelected; CTString _strModURLSelected; CTString _strModServerSelected; @@ -114,10 +116,10 @@ void ExitConfirm(void) { _pConfimedYes = &ExitGame; _pConfimedNo = NULL; - _pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("ARE YOU SERIOUS?"); - _pGUIM->gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; - _pGUIM->gmConfirmMenu.BeLarge(); - ChangeToMenu(&_pGUIM->gmConfirmMenu); + CMENU.gm_mgConfirmLabel.mg_strText = TRANS("ARE YOU SERIOUS?"); + CMENU.gm_pgmParentMenu = pgmCurrentMenu; + CMENU.BeLarge(); + ChangeToMenu(&CMENU); } void StopCurrentGame(void) @@ -132,10 +134,10 @@ void StopConfirm(void) { _pConfimedYes = &StopCurrentGame; _pConfimedNo = NULL; - _pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("ARE YOU SERIOUS?"); - _pGUIM->gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; - _pGUIM->gmConfirmMenu.BeLarge(); - ChangeToMenu(&_pGUIM->gmConfirmMenu); + CMENU.gm_mgConfirmLabel.mg_strText = TRANS("ARE YOU SERIOUS?"); + CMENU.gm_pgmParentMenu = pgmCurrentMenu; + CMENU.BeLarge(); + ChangeToMenu(&CMENU); } void ModLoadYes(void) @@ -170,10 +172,10 @@ extern void ModConnectConfirm(void) CPrintF(TRANS("Server is running a different MOD (%s).\nYou need to reload to connect.\n"), _fnmModSelected); _pConfimedYes = &ModConnect; _pConfimedNo = NULL; - _pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("CHANGE THE MOD?"); - _pGUIM->gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; - _pGUIM->gmConfirmMenu.BeLarge(); - ChangeToMenu(&_pGUIM->gmConfirmMenu); + CMENU.gm_mgConfirmLabel.mg_strText = TRANS("CHANGE THE MOD?"); + CMENU.gm_pgmParentMenu = pgmCurrentMenu; + CMENU.BeLarge(); + ChangeToMenu(&CMENU); } void SaveConfirm(void) @@ -181,10 +183,10 @@ void SaveConfirm(void) extern void OnFileSaveOK(void); _pConfimedYes = &OnFileSaveOK; _pConfimedNo = NULL; - _pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("OVERWRITE?"); - _pGUIM->gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; - _pGUIM->gmConfirmMenu.BeLarge(); - ChangeToMenu(&_pGUIM->gmConfirmMenu); + CMENU.gm_mgConfirmLabel.mg_strText = TRANS("OVERWRITE?"); + CMENU.gm_pgmParentMenu = pgmCurrentMenu; + CMENU.BeLarge(); + ChangeToMenu(&CMENU); } void ExitAndSpawnExplorer(void) @@ -199,20 +201,11 @@ void ModNotInstalled(void) { _pConfimedYes = &ExitAndSpawnExplorer; _pConfimedNo = NULL; - _pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText.PrintF( + CMENU.gm_mgConfirmLabel.mg_strText.PrintF( TRANS("You don't have MOD '%s' installed.\nDo you want to visit its web site?"), (const char*)_fnmModSelected); - _pGUIM->gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; - _pGUIM->gmConfirmMenu.BeSmall(); - ChangeToMenu(&_pGUIM->gmConfirmMenu); - - /* - gmDisabledFunction.gm_pgmParentMenu = pgmCurrentMenu; - mgDisabledMenuButton.mg_strText.PrintF( - TRANS("You don't have MOD '%s' installed.\nPlease visit Croteam website for updates."), _fnmModSelected); - mgDisabledTitle.mg_strText = TRANS("MOD REQUIRED"); - _strModURLSelected - ChangeToMenu( &gmDisabledFunction); - */ + CMENU.gm_pgmParentMenu = pgmCurrentMenu; + CMENU.BeSmall(); + ChangeToMenu(&CMENU); } @@ -220,10 +213,10 @@ extern void ModConfirm(void) { _pConfimedYes = &ModLoadYes; _pConfimedNo = NULL; - _pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("LOAD THIS MOD?"); - _pGUIM->gmConfirmMenu.gm_pgmParentMenu = &_pGUIM->gmLoadSaveMenu; - _pGUIM->gmConfirmMenu.BeLarge(); - ChangeToMenu(&_pGUIM->gmConfirmMenu); + CMENU.gm_mgConfirmLabel.mg_strText = TRANS("LOAD THIS MOD?"); + CMENU.gm_pgmParentMenu = &_pGUIM->gmLoadSaveMenu; + CMENU.BeLarge(); + ChangeToMenu(&CMENU); } void VideoConfirm(void) @@ -231,27 +224,27 @@ void VideoConfirm(void) // FIXUP: keyboard focus lost when going from full screen to window mode // due to WM_MOUSEMOVE being sent _bMouseUsedLast = FALSE; - _pmgUnderCursor = _pGUIM->gmConfirmMenu.gm_pmgSelectedByDefault; + _pmgUnderCursor = CMENU.gm_pmgSelectedByDefault; _pConfimedYes = NULL; void RevertVideoSettings(void); _pConfimedNo = RevertVideoSettings; - _pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("KEEP THIS SETTING?"); - _pGUIM->gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; - _pGUIM->gmConfirmMenu.BeLarge(); - ChangeToMenu(&_pGUIM->gmConfirmMenu); + CMENU.gm_mgConfirmLabel.mg_strText = TRANS("KEEP THIS SETTING?"); + CMENU.gm_pgmParentMenu = pgmCurrentMenu; + CMENU.BeLarge(); + ChangeToMenu(&CMENU); } void CDConfirm(void(*pOk)(void)) { _pConfimedYes = pOk; _pConfimedNo = NULL; - _pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("PLEASE INSERT GAME CD?"); - if (pgmCurrentMenu != &_pGUIM->gmConfirmMenu) { - _pGUIM->gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; - _pGUIM->gmConfirmMenu.BeLarge(); - ChangeToMenu(&_pGUIM->gmConfirmMenu); + CMENU.gm_mgConfirmLabel.mg_strText = TRANS("PLEASE INSERT GAME CD?"); + if (pgmCurrentMenu != &CMENU) { + CMENU.gm_pgmParentMenu = pgmCurrentMenu; + CMENU.BeLarge(); + ChangeToMenu(&CMENU); } } @@ -274,19 +267,11 @@ void ConfirmNo(void) } void InitActionsForConfirmMenu() { - _pGUIM->gmConfirmMenu.gm_mgConfirmYes.mg_pActivatedFunction = &ConfirmYes; - _pGUIM->gmConfirmMenu.gm_mgConfirmNo.mg_pActivatedFunction = &ConfirmNo; + CMENU.gm_mgConfirmYes.mg_pActivatedFunction = &ConfirmYes; + CMENU.gm_mgConfirmNo.mg_pActivatedFunction = &ConfirmNo; } -// return TRUE if handled -BOOL CConfirmMenu::OnKeyDown(int iVKey) -{ - if (iVKey == VK_ESCAPE || iVKey == VK_RBUTTON) { - ConfirmNo(); - return TRUE; - } - return CGameMenu::OnKeyDown(iVKey); -} +#undef CMENU // ------------------------ CMainMenu implementation #define CMENU _pGUIM->gmMainMenu @@ -348,9 +333,7 @@ extern void SetDemoStartStopRecText(void) CMENU.gm_mgDemoRec.SetText(TRANS("STOP RECORDING")); CMENU.gm_mgDemoRec.mg_strTip = TRANS("stop current recording"); CMENU.gm_mgDemoRec.mg_pActivatedFunction = &StopRecordingDemo; - } - else - { + } else { CMENU.gm_mgDemoRec.SetText(TRANS("RECORD DEMO")); CMENU.gm_mgDemoRec.mg_strTip = TRANS("start recording current game"); CMENU.gm_mgDemoRec.mg_pActivatedFunction = &StartDemoSaveMenu; @@ -399,12 +382,6 @@ void InitActionsForSinglePlayerMenu() { // ------------------------ CSinglePlayerNewMenu implementation void StartSinglePlayerGame(void) { - /* if (!IsCDInDrive()) { - CDConfirm(StartSinglePlayerGame); - return; - } - */ - _pGame->gm_StartSplitScreenCfg = CGame::SSC_PLAY1; _pGame->gm_aiStartLocalPlayers[0] = _pGame->gm_iSinglePlayer; @@ -420,8 +397,7 @@ void StartSinglePlayerGame(void) { StopMenus(); _gmRunningGameMode = GM_SINGLE_PLAYER; - } - else { + } else { _gmRunningGameMode = GM_NONE; } } @@ -998,6 +974,7 @@ void InitActionsForVarMenu() { } #undef CMENU + // ------------------------ CServersMenu implementation extern void RefreshServerList(void) { @@ -1013,8 +990,7 @@ void SortByColumn(int i) { if (_pGUIM->gmServersMenu.gm_mgList.mg_iSort == i) { _pGUIM->gmServersMenu.gm_mgList.mg_bSortDown = !_pGUIM->gmServersMenu.gm_mgList.mg_bSortDown; - } - else { + } else { _pGUIM->gmServersMenu.gm_mgList.mg_bSortDown = FALSE; } _pGUIM->gmServersMenu.gm_mgList.mg_iSort = i; @@ -1233,8 +1209,7 @@ extern void SelectPlayersFillMenu(void) if (bHasPlayers && CMENU.gm_mgSplitScreenCfg.mg_iSelected >= 1) { CMENU.gm_mgNotes.mg_strText = TRANS("Make sure you set different controls for each player!"); - } - else { + } else { CMENU.gm_mgNotes.mg_strText = ""; } } diff --git a/Sources/SeriousSam/GUI/Menus/MenuStarters.cpp b/Sources/SeriousSam/GUI/Menus/MenuStarters.cpp index 07e337b..d8ec6f9 100644 --- a/Sources/SeriousSam/GUI/Menus/MenuStarters.cpp +++ b/Sources/SeriousSam/GUI/Menus/MenuStarters.cpp @@ -33,6 +33,7 @@ extern CTFileName _fnmModSelected; extern CTString _strModURLSelected; extern CTString _strModServerSelected; + void StartVideoOptionsMenu(void) { ChangeToMenu(&_pGUIM->gmVideoOptionsMenu); @@ -104,8 +105,465 @@ void StartSinglePlayerNewMenu(void) ChangeToMenu(&_pGUIM->gmSinglePlayerNewMenu); } +// game options var settings +void StartVarGameOptions(void) +{ + _pGUIM->gmVarMenu.gm_mgTitle.mg_strText = TRANS("GAME OPTIONS"); + _pGUIM->gmVarMenu.gm_fnmMenuCFG = CTFILENAME("Scripts\\Menu\\GameOptions.cfg"); + ChangeToMenu(&_pGUIM->gmVarMenu); +} + +void StartSinglePlayerGameOptions(void) +{ + _pGUIM->gmVarMenu.gm_mgTitle.mg_strText = TRANS("GAME OPTIONS"); + _pGUIM->gmVarMenu.gm_fnmMenuCFG = CTFILENAME("Scripts\\Menu\\SPOptions.cfg"); + ChangeToMenu(&_pGUIM->gmVarMenu); + _pGUIM->gmVarMenu.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu; +} + +void StartGameOptionsFromNetwork(void) +{ + StartVarGameOptions(); + _pGUIM->gmVarMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkStartMenu; +} + +void StartGameOptionsFromSplitScreen(void) +{ + StartVarGameOptions(); + _pGUIM->gmVarMenu.gm_pgmParentMenu = &_pGUIM->gmSplitStartMenu; +} + +// rendering options var settings +void StartRenderingOptionsMenu(void) +{ + _pGUIM->gmVarMenu.gm_mgTitle.mg_strText = TRANS("RENDERING OPTIONS"); + _pGUIM->gmVarMenu.gm_fnmMenuCFG = CTFILENAME("Scripts\\Menu\\RenderingOptions.cfg"); + _pGUIM->gmVarMenu.gm_pgmParentMenu = &_pGUIM->gmVideoOptionsMenu; + ChangeToMenu(&_pGUIM->gmVarMenu); +} + +void StartCustomizeKeyboardMenu(void) +{ + ChangeToMenu(&_pGUIM->gmCustomizeKeyboardMenu); +} + +void StartCustomizeAxisMenu(void) +{ + ChangeToMenu(&_pGUIM->gmCustomizeAxisMenu); +} + +void StartOptionsMenu(void) +{ + _pGUIM->gmOptionsMenu.gm_pgmParentMenu = pgmCurrentMenu; + ChangeToMenu(&_pGUIM->gmOptionsMenu); +} + +void StartCurrentLoadMenu() +{ + if (_gmRunningGameMode == GM_NETWORK) { + void StartNetworkLoadMenu(void); + StartNetworkLoadMenu(); + } else if (_gmRunningGameMode == GM_SPLIT_SCREEN) { + void StartSplitScreenLoadMenu(void); + StartSplitScreenLoadMenu(); + } else { + void StartSinglePlayerLoadMenu(void); + StartSinglePlayerLoadMenu(); + } +} + +void StartCurrentSaveMenu() +{ + if (_gmRunningGameMode == GM_NETWORK) { + void StartNetworkSaveMenu(void); + StartNetworkSaveMenu(); + } else if (_gmRunningGameMode == GM_SPLIT_SCREEN) { + void StartSplitScreenSaveMenu(void); + StartSplitScreenSaveMenu(); + } else { + void StartSinglePlayerSaveMenu(void); + StartSinglePlayerSaveMenu(); + } +} + +void StartCurrentQuickLoadMenu() +{ + if (_gmRunningGameMode == GM_NETWORK) { + void StartNetworkQuickLoadMenu(void); + StartNetworkQuickLoadMenu(); + } else if (_gmRunningGameMode == GM_SPLIT_SCREEN) { + void StartSplitScreenQuickLoadMenu(void); + StartSplitScreenQuickLoadMenu(); + } else { + void StartSinglePlayerQuickLoadMenu(void); + StartSinglePlayerQuickLoadMenu(); + } +} + +void StartChangePlayerMenuFromOptions(void) +{ + _bPlayerMenuFromSinglePlayer = FALSE; + _pGUIM->gmPlayerProfile.gm_piCurrentPlayer = &_pGame->gm_iSinglePlayer; + _pGUIM->gmPlayerProfile.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu; + ChangeToMenu(&_pGUIM->gmPlayerProfile); +} + +void StartChangePlayerMenuFromSinglePlayer(void) +{ + _iLocalPlayer = -1; + _bPlayerMenuFromSinglePlayer = TRUE; + _pGUIM->gmPlayerProfile.gm_piCurrentPlayer = &_pGame->gm_iSinglePlayer; + _pGUIM->gmPlayerProfile.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu; + ChangeToMenu(&_pGUIM->gmPlayerProfile); +} + +void StartControlsMenuFromPlayer(void) +{ + _pGUIM->gmControls.gm_pgmParentMenu = &_pGUIM->gmPlayerProfile; + ChangeToMenu(&_pGUIM->gmControls); +} + +void StartControlsMenuFromOptions(void) +{ + _pGUIM->gmControls.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu; + ChangeToMenu(&_pGUIM->gmControls); +} + +void StartHighScoreMenu(void) +{ + _pGUIM->gmHighScoreMenu.gm_pgmParentMenu = pgmCurrentMenu; + ChangeToMenu(&_pGUIM->gmHighScoreMenu); +} + +void StartSplitScreenGame(void) +{ + // _pGame->gm_MenuSplitScreenCfg = (enum CGame::SplitScreenCfg) mgSplitScreenCfg.mg_iSelected; + _pGame->gm_StartSplitScreenCfg = _pGame->gm_MenuSplitScreenCfg; + + _pGame->gm_aiStartLocalPlayers[0] = _pGame->gm_aiMenuLocalPlayers[0]; + _pGame->gm_aiStartLocalPlayers[1] = _pGame->gm_aiMenuLocalPlayers[1]; + _pGame->gm_aiStartLocalPlayers[2] = _pGame->gm_aiMenuLocalPlayers[2]; + _pGame->gm_aiStartLocalPlayers[3] = _pGame->gm_aiMenuLocalPlayers[3]; + + CTFileName fnWorld = _pGame->gam_strCustomLevel; + + _pGame->gm_strNetworkProvider = "Local"; + CUniversalSessionProperties sp; + _pGame->SetMultiPlayerSession(sp); + if (_pGame->NewGame(fnWorld.FileName(), fnWorld, sp)) + { + StopMenus(); + _gmRunningGameMode = GM_SPLIT_SCREEN; + } else { + _gmRunningGameMode = GM_NONE; + } +} + +void StartNetworkGame(void) +{ + // _pGame->gm_MenuSplitScreenCfg = (enum CGame::SplitScreenCfg) mgSplitScreenCfg.mg_iSelected; + _pGame->gm_StartSplitScreenCfg = _pGame->gm_MenuSplitScreenCfg; + + _pGame->gm_aiStartLocalPlayers[0] = _pGame->gm_aiMenuLocalPlayers[0]; + _pGame->gm_aiStartLocalPlayers[1] = _pGame->gm_aiMenuLocalPlayers[1]; + _pGame->gm_aiStartLocalPlayers[2] = _pGame->gm_aiMenuLocalPlayers[2]; + _pGame->gm_aiStartLocalPlayers[3] = _pGame->gm_aiMenuLocalPlayers[3]; + + CTFileName fnWorld = _pGame->gam_strCustomLevel; + + _pGame->gm_strNetworkProvider = "TCP/IP Server"; + CUniversalSessionProperties sp; + _pGame->SetMultiPlayerSession(sp); + if (_pGame->NewGame(_pGame->gam_strSessionName, fnWorld, sp)) + { + StopMenus(); + _gmRunningGameMode = GM_NETWORK; + // if starting a dedicated server + if (_pGame->gm_MenuSplitScreenCfg == CGame::SSC_DEDICATED) { + // pull down the console + extern INDEX sam_bToggleConsole; + sam_bToggleConsole = TRUE; + } + } else { + _gmRunningGameMode = GM_NONE; + } +} + +void JoinNetworkGame(void) +{ + // _pGame->gm_MenuSplitScreenCfg = (enum CGame::SplitScreenCfg) mgSplitScreenCfg.mg_iSelected; + _pGame->gm_StartSplitScreenCfg = _pGame->gm_MenuSplitScreenCfg; + + _pGame->gm_aiStartLocalPlayers[0] = _pGame->gm_aiMenuLocalPlayers[0]; + _pGame->gm_aiStartLocalPlayers[1] = _pGame->gm_aiMenuLocalPlayers[1]; + _pGame->gm_aiStartLocalPlayers[2] = _pGame->gm_aiMenuLocalPlayers[2]; + _pGame->gm_aiStartLocalPlayers[3] = _pGame->gm_aiMenuLocalPlayers[3]; + + _pGame->gm_strNetworkProvider = "TCP/IP Client"; + if (_pGame->JoinGame(CNetworkSession(_pGame->gam_strJoinAddress))) + { + StopMenus(); + _gmRunningGameMode = GM_NETWORK; + } else { + if (_pNetwork->ga_strRequiredMod != "") { + extern CTFileName _fnmModToLoad; + extern CTString _strModServerJoin; + char strModName[256] = { 0 }; + char strModURL[256] = { 0 }; + _pNetwork->ga_strRequiredMod.ScanF("%250[^\\]\\%s", &strModName, &strModURL); + _fnmModSelected = CTString(strModName); + _strModURLSelected = strModURL; + if (_strModURLSelected = "") { + _strModURLSelected = "http://www.croteam.com/mods/Old"; + } + _strModServerSelected.PrintF("%s:%s", _pGame->gam_strJoinAddress, _pShell->GetValue("net_iPort")); + extern void ModConnectConfirm(void); + ModConnectConfirm(); + } + _gmRunningGameMode = GM_NONE; + } +} + +// -------- Servers Menu Functions +#define CMENU _pGUIM->gmServersMenu + +void StartSelectServerLAN(void) +{ + CMENU.m_bInternet = FALSE; + ChangeToMenu(&CMENU); + CMENU.gm_pgmParentMenu = &_pGUIM->gmNetworkJoinMenu; +} + +void StartSelectServerNET(void) +{ + CMENU.m_bInternet = TRUE; + ChangeToMenu(&CMENU); + CMENU.gm_pgmParentMenu = &_pGUIM->gmNetworkJoinMenu; +} + +#undef CMENU + +// -------- Levels Menu Functions +#define CMENU _pGUIM->gmLevelsMenu + +void StartSelectLevelFromSingle(void) +{ + FilterLevels(GetSpawnFlagsForGameType(-1)); + _pAfterLevelChosen = StartSinglePlayerNewMenuCustom; + ChangeToMenu(&CMENU); + CMENU.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu; +} + +void StartSelectLevelFromSplit(void) +{ + FilterLevels(GetSpawnFlagsForGameType(_pGUIM->gmSplitStartMenu.gm_mgGameType.mg_iSelected)); + void StartSplitStartMenu(void); + _pAfterLevelChosen = StartSplitStartMenu; + ChangeToMenu(&CMENU); + CMENU.gm_pgmParentMenu = &_pGUIM->gmSplitStartMenu; +} + +void StartSelectLevelFromNetwork(void) +{ + FilterLevels(GetSpawnFlagsForGameType(_pGUIM->gmNetworkStartMenu.gm_mgGameType.mg_iSelected)); + void StartNetworkStartMenu(void); + _pAfterLevelChosen = StartNetworkStartMenu; + ChangeToMenu(&CMENU); + CMENU.gm_pgmParentMenu = &_pGUIM->gmNetworkStartMenu; +} + +#undef CMENU + +// -------- Players Selection Menu Functions +#define CMENU _pGUIM->gmSelectPlayersMenu + +void StartSelectPlayersMenuFromSplit(void) +{ + CMENU.gm_bAllowDedicated = FALSE; + CMENU.gm_bAllowObserving = FALSE; + CMENU.gm_mgStart.mg_pActivatedFunction = &StartSplitScreenGame; + CMENU.gm_pgmParentMenu = &_pGUIM->gmSplitStartMenu; + ChangeToMenu(&CMENU); +} + +void StartSelectPlayersMenuFromNetwork(void) +{ + CMENU.gm_bAllowDedicated = TRUE; + CMENU.gm_bAllowObserving = TRUE; + CMENU.gm_mgStart.mg_pActivatedFunction = &StartNetworkGame; + CMENU.gm_pgmParentMenu = &_pGUIM->gmNetworkStartMenu; + ChangeToMenu(&CMENU); +} + +void StartSelectPlayersMenuFromNetworkLoad(void) +{ + CMENU.gm_bAllowDedicated = FALSE; + CMENU.gm_bAllowObserving = TRUE; + CMENU.gm_mgStart.mg_pActivatedFunction = &StartNetworkLoadGame; + CMENU.gm_pgmParentMenu = &_pGUIM->gmLoadSaveMenu; + ChangeToMenu(&CMENU); +} + +void StartSelectPlayersMenuFromSplitScreenLoad(void) +{ + CMENU.gm_bAllowDedicated = FALSE; + CMENU.gm_bAllowObserving = FALSE; + CMENU.gm_mgStart.mg_pActivatedFunction = &StartSplitScreenGameLoad; + CMENU.gm_pgmParentMenu = &_pGUIM->gmLoadSaveMenu; + ChangeToMenu(&CMENU); +} + +void StartSelectPlayersMenuFromOpen(void) +{ + CMENU.gm_bAllowDedicated = FALSE; + CMENU.gm_bAllowObserving = TRUE; + CMENU.gm_mgStart.mg_pActivatedFunction = &JoinNetworkGame; + CMENU.gm_pgmParentMenu = &_pGUIM->gmNetworkOpenMenu; + ChangeToMenu(&CMENU); + + /*if (sam_strNetworkSettings=="")*/ { + void StartNetworkSettingsMenu(void); + StartNetworkSettingsMenu(); + _pGUIM->gmLoadSaveMenu.gm_bNoEscape = TRUE; + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkOpenMenu; + _pGUIM->gmLoadSaveMenu.gm_pgmNextMenu = &CMENU; + } +} + +void StartSelectPlayersMenuFromServers(void) +{ + CMENU.gm_bAllowDedicated = FALSE; + CMENU.gm_bAllowObserving = TRUE; + CMENU.gm_mgStart.mg_pActivatedFunction = &JoinNetworkGame; + CMENU.gm_pgmParentMenu = &_pGUIM->gmServersMenu; + ChangeToMenu(&CMENU); + + /*if (sam_strNetworkSettings=="")*/ { + void StartNetworkSettingsMenu(void); + StartNetworkSettingsMenu(); + _pGUIM->gmLoadSaveMenu.gm_bNoEscape = TRUE; + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = &_pGUIM->gmServersMenu; + _pGUIM->gmLoadSaveMenu.gm_pgmNextMenu = &CMENU; + } +} + +#undef CMENU + +// -------- Save/Load Menu Calling Functions #define CMENU _pGUIM->gmLoadSaveMenu +void StartPlayerModelLoadMenu(void) +{ + CMENU.gm_mgTitle.mg_strText = TRANS("CHOOSE MODEL"); + CMENU.gm_bAllowThumbnails = TRUE; + CMENU.gm_iSortType = LSSORT_FILEUP; + CMENU.gm_bSave = FALSE; + CMENU.gm_bManage = FALSE; + CMENU.gm_fnmDirectory = CTString("Models\\Player\\"); + CMENU.gm_fnmSelected = _strLastPlayerAppearance; + CMENU.gm_fnmExt = CTString(".amc"); + CMENU.gm_pAfterFileChosen = &LSLoadPlayerModel; + CMENU.gm_mgNotes.mg_strText = ""; + + CMENU.gm_pgmParentMenu = &_pGUIM->gmPlayerProfile; + ChangeToMenu(&CMENU); +} + +void StartControlsLoadMenu(void) +{ + CMENU.gm_mgTitle.mg_strText = TRANS("LOAD CONTROLS"); + CMENU.gm_bAllowThumbnails = FALSE; + CMENU.gm_iSortType = LSSORT_FILEUP; + CMENU.gm_bSave = FALSE; + CMENU.gm_bManage = FALSE; + CMENU.gm_fnmDirectory = CTString("Controls\\"); + CMENU.gm_fnmSelected = CTString(""); + CMENU.gm_fnmExt = CTString(".ctl"); + CMENU.gm_pAfterFileChosen = &LSLoadControls; + CMENU.gm_mgNotes.mg_strText = ""; + + CMENU.gm_pgmParentMenu = &_pGUIM->gmControls; + ChangeToMenu(&CMENU); +} + +void StartCustomLoadMenu(void) +{ + CMENU.gm_mgTitle.mg_strText = TRANS("ADVANCED OPTIONS"); + CMENU.gm_bAllowThumbnails = FALSE; + CMENU.gm_iSortType = LSSORT_NAMEUP; + CMENU.gm_bSave = FALSE; + CMENU.gm_bManage = FALSE; + CMENU.gm_fnmDirectory = CTString("Scripts\\CustomOptions\\"); + CMENU.gm_fnmSelected = CTString(""); + CMENU.gm_fnmExt = CTString(".cfg"); + CMENU.gm_pAfterFileChosen = &LSLoadCustom; + CMENU.gm_mgNotes.mg_strText = ""; + + CMENU.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu; + ChangeToMenu(&CMENU); +} + +void StartAddonsLoadMenu(void) +{ + CMENU.gm_mgTitle.mg_strText = TRANS("EXECUTE ADDON"); + CMENU.gm_bAllowThumbnails = FALSE; + CMENU.gm_iSortType = LSSORT_NAMEUP; + CMENU.gm_bSave = FALSE; + CMENU.gm_bManage = FALSE; + CMENU.gm_fnmDirectory = CTString("Scripts\\Addons\\"); + CMENU.gm_fnmSelected = CTString(""); + CMENU.gm_fnmExt = CTString(".ini"); + CMENU.gm_pAfterFileChosen = &LSLoadAddon; + CMENU.gm_mgNotes.mg_strText = ""; + + CMENU.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu; + ChangeToMenu(&CMENU); +} + +void StartModsLoadMenu(void) +{ + CMENU.gm_mgTitle.mg_strText = TRANS("CHOOSE MOD"); + CMENU.gm_bAllowThumbnails = TRUE; + CMENU.gm_iSortType = LSSORT_NAMEUP; + CMENU.gm_bSave = FALSE; + CMENU.gm_bManage = FALSE; + CMENU.gm_fnmDirectory = CTString("Mods\\"); + CMENU.gm_fnmSelected = CTString(""); + CMENU.gm_fnmExt = CTString(".des"); + CMENU.gm_pAfterFileChosen = &LSLoadMod; + + CMENU.gm_pgmParentMenu = &_pGUIM->gmMainMenu; + ChangeToMenu(&CMENU); +} + +void StartNetworkSettingsMenu(void) +{ + CMENU.gm_mgTitle.mg_strText = TRANS("CONNECTION SETTINGS"); + CMENU.gm_bAllowThumbnails = FALSE; + CMENU.gm_iSortType = LSSORT_FILEUP; + CMENU.gm_bSave = FALSE; + CMENU.gm_bManage = FALSE; + CMENU.gm_fnmDirectory = CTString("Scripts\\NetSettings\\"); + CMENU.gm_fnmSelected = sam_strNetworkSettings; + CMENU.gm_fnmExt = CTString(".ini"); + CMENU.gm_pAfterFileChosen = &LSLoadNetSettings; + if (sam_strNetworkSettings == "") { + CMENU.gm_mgNotes.mg_strText = TRANS( + "Before joining a network game,\n" + "you have to adjust your connection parameters.\n" + "Choose one option from the list.\n" + "If you have problems with connection, you can adjust\n" + "these parameters again from the Options menu.\n" + ); + } else { + CMENU.gm_mgNotes.mg_strText = ""; + } + + CMENU.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu; + ChangeToMenu(&CMENU); +} + + void StartSinglePlayerQuickLoadMenu(void) { _gmMenuGameMode = GM_SINGLE_PLAYER; @@ -333,475 +791,7 @@ void StartSplitScreenSaveMenu(void) #undef CMENU -// game options var settings -void StartVarGameOptions(void) -{ - _pGUIM->gmVarMenu.gm_mgTitle.mg_strText = TRANS("GAME OPTIONS"); - _pGUIM->gmVarMenu.gm_fnmMenuCFG = CTFILENAME("Scripts\\Menu\\GameOptions.cfg"); - ChangeToMenu(&_pGUIM->gmVarMenu); -} - -void StartSinglePlayerGameOptions(void) -{ - _pGUIM->gmVarMenu.gm_mgTitle.mg_strText = TRANS("GAME OPTIONS"); - _pGUIM->gmVarMenu.gm_fnmMenuCFG = CTFILENAME("Scripts\\Menu\\SPOptions.cfg"); - ChangeToMenu(&_pGUIM->gmVarMenu); - _pGUIM->gmVarMenu.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu; -} - -void StartGameOptionsFromNetwork(void) -{ - StartVarGameOptions(); - _pGUIM->gmVarMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkStartMenu; -} - -void StartGameOptionsFromSplitScreen(void) -{ - StartVarGameOptions(); - _pGUIM->gmVarMenu.gm_pgmParentMenu = &_pGUIM->gmSplitStartMenu; -} - -// rendering options var settings -void StartRenderingOptionsMenu(void) -{ - _pGUIM->gmVarMenu.gm_mgTitle.mg_strText = TRANS("RENDERING OPTIONS"); - _pGUIM->gmVarMenu.gm_fnmMenuCFG = CTFILENAME("Scripts\\Menu\\RenderingOptions.cfg"); - _pGUIM->gmVarMenu.gm_pgmParentMenu = &_pGUIM->gmVideoOptionsMenu; - ChangeToMenu(&_pGUIM->gmVarMenu); -} - -void StartCustomizeKeyboardMenu(void) -{ - ChangeToMenu(&_pGUIM->gmCustomizeKeyboardMenu); -} - -void StartCustomizeAxisMenu(void) -{ - ChangeToMenu(&_pGUIM->gmCustomizeAxisMenu); -} - -void StartOptionsMenu(void) -{ - _pGUIM->gmOptionsMenu.gm_pgmParentMenu = pgmCurrentMenu; - ChangeToMenu(&_pGUIM->gmOptionsMenu); -} - -void StartCurrentLoadMenu() -{ - if (_gmRunningGameMode == GM_NETWORK) { - void StartNetworkLoadMenu(void); - StartNetworkLoadMenu(); - } else if (_gmRunningGameMode == GM_SPLIT_SCREEN) { - void StartSplitScreenLoadMenu(void); - StartSplitScreenLoadMenu(); - } else { - void StartSinglePlayerLoadMenu(void); - StartSinglePlayerLoadMenu(); - } -} - -void StartCurrentSaveMenu() -{ - if (_gmRunningGameMode == GM_NETWORK) { - void StartNetworkSaveMenu(void); - StartNetworkSaveMenu(); - } else if (_gmRunningGameMode == GM_SPLIT_SCREEN) { - void StartSplitScreenSaveMenu(void); - StartSplitScreenSaveMenu(); - } else { - void StartSinglePlayerSaveMenu(void); - StartSinglePlayerSaveMenu(); - } -} - -void StartCurrentQuickLoadMenu() -{ - if (_gmRunningGameMode == GM_NETWORK) { - void StartNetworkQuickLoadMenu(void); - StartNetworkQuickLoadMenu(); - } else if (_gmRunningGameMode == GM_SPLIT_SCREEN) { - void StartSplitScreenQuickLoadMenu(void); - StartSplitScreenQuickLoadMenu(); - } else { - void StartSinglePlayerQuickLoadMenu(void); - StartSinglePlayerQuickLoadMenu(); - } -} - -void StartChangePlayerMenuFromOptions(void) -{ - _bPlayerMenuFromSinglePlayer = FALSE; - _pGUIM->gmPlayerProfile.gm_piCurrentPlayer = &_pGame->gm_iSinglePlayer; - _pGUIM->gmPlayerProfile.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu; - ChangeToMenu(&_pGUIM->gmPlayerProfile); -} - -void StartChangePlayerMenuFromSinglePlayer(void) -{ - _iLocalPlayer = -1; - _bPlayerMenuFromSinglePlayer = TRUE; - _pGUIM->gmPlayerProfile.gm_piCurrentPlayer = &_pGame->gm_iSinglePlayer; - _pGUIM->gmPlayerProfile.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu; - ChangeToMenu(&_pGUIM->gmPlayerProfile); -} - -void StartControlsMenuFromPlayer(void) -{ - _pGUIM->gmControls.gm_pgmParentMenu = &_pGUIM->gmPlayerProfile; - ChangeToMenu(&_pGUIM->gmControls); -} - -void StartControlsMenuFromOptions(void) -{ - _pGUIM->gmControls.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu; - ChangeToMenu(&_pGUIM->gmControls); -} - -void StartSelectLevelFromSingle(void) -{ - FilterLevels(GetSpawnFlagsForGameType(-1)); - _pAfterLevelChosen = StartSinglePlayerNewMenuCustom; - ChangeToMenu(&_pGUIM->gmLevelsMenu); - _pGUIM->gmLevelsMenu.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu; -} - -void StartHighScoreMenu(void) -{ - _pGUIM->gmHighScoreMenu.gm_pgmParentMenu = pgmCurrentMenu; - ChangeToMenu(&_pGUIM->gmHighScoreMenu); -} - -void StartSplitScreenGame(void) -{ - // _pGame->gm_MenuSplitScreenCfg = (enum CGame::SplitScreenCfg) mgSplitScreenCfg.mg_iSelected; - _pGame->gm_StartSplitScreenCfg = _pGame->gm_MenuSplitScreenCfg; - - _pGame->gm_aiStartLocalPlayers[0] = _pGame->gm_aiMenuLocalPlayers[0]; - _pGame->gm_aiStartLocalPlayers[1] = _pGame->gm_aiMenuLocalPlayers[1]; - _pGame->gm_aiStartLocalPlayers[2] = _pGame->gm_aiMenuLocalPlayers[2]; - _pGame->gm_aiStartLocalPlayers[3] = _pGame->gm_aiMenuLocalPlayers[3]; - - CTFileName fnWorld = _pGame->gam_strCustomLevel; - - _pGame->gm_strNetworkProvider = "Local"; - CUniversalSessionProperties sp; - _pGame->SetMultiPlayerSession(sp); - if (_pGame->NewGame(fnWorld.FileName(), fnWorld, sp)) - { - StopMenus(); - _gmRunningGameMode = GM_SPLIT_SCREEN; - } else { - _gmRunningGameMode = GM_NONE; - } -} - -#define CMENU _pGUIM->gmSelectPlayersMenu - -void StartSelectPlayersMenuFromSplit(void) -{ - CMENU.gm_bAllowDedicated = FALSE; - CMENU.gm_bAllowObserving = FALSE; - CMENU.gm_mgStart.mg_pActivatedFunction = &StartSplitScreenGame; - CMENU.gm_pgmParentMenu = &_pGUIM->gmSplitStartMenu; - ChangeToMenu(&CMENU); -} - -#undef CMENU - -void StartNetworkGame(void) -{ - // _pGame->gm_MenuSplitScreenCfg = (enum CGame::SplitScreenCfg) mgSplitScreenCfg.mg_iSelected; - _pGame->gm_StartSplitScreenCfg = _pGame->gm_MenuSplitScreenCfg; - - _pGame->gm_aiStartLocalPlayers[0] = _pGame->gm_aiMenuLocalPlayers[0]; - _pGame->gm_aiStartLocalPlayers[1] = _pGame->gm_aiMenuLocalPlayers[1]; - _pGame->gm_aiStartLocalPlayers[2] = _pGame->gm_aiMenuLocalPlayers[2]; - _pGame->gm_aiStartLocalPlayers[3] = _pGame->gm_aiMenuLocalPlayers[3]; - - CTFileName fnWorld = _pGame->gam_strCustomLevel; - - _pGame->gm_strNetworkProvider = "TCP/IP Server"; - CUniversalSessionProperties sp; - _pGame->SetMultiPlayerSession(sp); - if (_pGame->NewGame(_pGame->gam_strSessionName, fnWorld, sp)) - { - StopMenus(); - _gmRunningGameMode = GM_NETWORK; - // if starting a dedicated server - if (_pGame->gm_MenuSplitScreenCfg == CGame::SSC_DEDICATED) { - // pull down the console - extern INDEX sam_bToggleConsole; - sam_bToggleConsole = TRUE; - } - } else { - _gmRunningGameMode = GM_NONE; - } -} - -#define CMENU _pGUIM->gmSelectPlayersMenu - -void StartSelectPlayersMenuFromNetwork(void) -{ - CMENU.gm_bAllowDedicated = TRUE; - CMENU.gm_bAllowObserving = TRUE; - CMENU.gm_mgStart.mg_pActivatedFunction = &StartNetworkGame; - CMENU.gm_pgmParentMenu = &_pGUIM->gmNetworkStartMenu; - ChangeToMenu(&CMENU); -} - -#undef CMENU - -void JoinNetworkGame(void) -{ - // _pGame->gm_MenuSplitScreenCfg = (enum CGame::SplitScreenCfg) mgSplitScreenCfg.mg_iSelected; - _pGame->gm_StartSplitScreenCfg = _pGame->gm_MenuSplitScreenCfg; - - _pGame->gm_aiStartLocalPlayers[0] = _pGame->gm_aiMenuLocalPlayers[0]; - _pGame->gm_aiStartLocalPlayers[1] = _pGame->gm_aiMenuLocalPlayers[1]; - _pGame->gm_aiStartLocalPlayers[2] = _pGame->gm_aiMenuLocalPlayers[2]; - _pGame->gm_aiStartLocalPlayers[3] = _pGame->gm_aiMenuLocalPlayers[3]; - - _pGame->gm_strNetworkProvider = "TCP/IP Client"; - if (_pGame->JoinGame(CNetworkSession(_pGame->gam_strJoinAddress))) - { - StopMenus(); - _gmRunningGameMode = GM_NETWORK; - } else { - if (_pNetwork->ga_strRequiredMod != "") { - extern CTFileName _fnmModToLoad; - extern CTString _strModServerJoin; - char strModName[256] = { 0 }; - char strModURL[256] = { 0 }; - _pNetwork->ga_strRequiredMod.ScanF("%250[^\\]\\%s", &strModName, &strModURL); - _fnmModSelected = CTString(strModName); - _strModURLSelected = strModURL; - if (_strModURLSelected = "") { - _strModURLSelected = "http://www.croteam.com/mods/Old"; - } - _strModServerSelected.PrintF("%s:%s", _pGame->gam_strJoinAddress, _pShell->GetValue("net_iPort")); - extern void ModConnectConfirm(void); - ModConnectConfirm(); - } - _gmRunningGameMode = GM_NONE; - } -} - -#define CMENU _pGUIM->gmSelectPlayersMenu - -void StartSelectPlayersMenuFromOpen(void) -{ - CMENU.gm_bAllowDedicated = FALSE; - CMENU.gm_bAllowObserving = TRUE; - CMENU.gm_mgStart.mg_pActivatedFunction = &JoinNetworkGame; - CMENU.gm_pgmParentMenu = &_pGUIM->gmNetworkOpenMenu; - ChangeToMenu(&CMENU); - - /*if (sam_strNetworkSettings=="")*/ { - void StartNetworkSettingsMenu(void); - StartNetworkSettingsMenu(); - _pGUIM->gmLoadSaveMenu.gm_bNoEscape = TRUE; - _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkOpenMenu; - _pGUIM->gmLoadSaveMenu.gm_pgmNextMenu = &CMENU; - } -} -void StartSelectPlayersMenuFromServers(void) -{ - CMENU.gm_bAllowDedicated = FALSE; - CMENU.gm_bAllowObserving = TRUE; - CMENU.gm_mgStart.mg_pActivatedFunction = &JoinNetworkGame; - CMENU.gm_pgmParentMenu = &_pGUIM->gmServersMenu; - ChangeToMenu(&CMENU); - - /*if (sam_strNetworkSettings=="")*/ { - void StartNetworkSettingsMenu(void); - StartNetworkSettingsMenu(); - _pGUIM->gmLoadSaveMenu.gm_bNoEscape = TRUE; - _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = &_pGUIM->gmServersMenu; - _pGUIM->gmLoadSaveMenu.gm_pgmNextMenu = &CMENU; - } -} - -#undef CMENU - -void StartSelectServerLAN(void) -{ - _pGUIM->gmServersMenu.m_bInternet = FALSE; - ChangeToMenu(&_pGUIM->gmServersMenu); - _pGUIM->gmServersMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkJoinMenu; -} - -void StartSelectServerNET(void) -{ - _pGUIM->gmServersMenu.m_bInternet = TRUE; - ChangeToMenu(&_pGUIM->gmServersMenu); - _pGUIM->gmServersMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkJoinMenu; -} - -void StartSelectLevelFromSplit(void) -{ - FilterLevels(GetSpawnFlagsForGameType(_pGUIM->gmSplitStartMenu.gm_mgGameType.mg_iSelected)); - void StartSplitStartMenu(void); - _pAfterLevelChosen = StartSplitStartMenu; - ChangeToMenu(&_pGUIM->gmLevelsMenu); - _pGUIM->gmLevelsMenu.gm_pgmParentMenu = &_pGUIM->gmSplitStartMenu; -} - -void StartSelectLevelFromNetwork(void) -{ - FilterLevels(GetSpawnFlagsForGameType(_pGUIM->gmNetworkStartMenu.gm_mgGameType.mg_iSelected)); - void StartNetworkStartMenu(void); - _pAfterLevelChosen = StartNetworkStartMenu; - ChangeToMenu(&_pGUIM->gmLevelsMenu); - _pGUIM->gmLevelsMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkStartMenu; -} - -#define CMENU _pGUIM->gmSelectPlayersMenu - -void StartSelectPlayersMenuFromSplitScreen(void) -{ - CMENU.gm_bAllowDedicated = FALSE; - CMENU.gm_bAllowObserving = FALSE; - //CMENU.gm_mgStart.mg_pActivatedFunction = &StartSplitScreenGame; - CMENU.gm_pgmParentMenu = &_pGUIM->gmSplitScreenMenu; - ChangeToMenu(&CMENU); -} - -void StartSelectPlayersMenuFromNetworkLoad(void) -{ - CMENU.gm_bAllowDedicated = FALSE; - CMENU.gm_bAllowObserving = TRUE; - CMENU.gm_mgStart.mg_pActivatedFunction = &StartNetworkLoadGame; - CMENU.gm_pgmParentMenu = &_pGUIM->gmLoadSaveMenu; - ChangeToMenu(&CMENU); -} - -void StartSelectPlayersMenuFromSplitScreenLoad(void) -{ - CMENU.gm_bAllowDedicated = FALSE; - CMENU.gm_bAllowObserving = FALSE; - CMENU.gm_mgStart.mg_pActivatedFunction = &StartSplitScreenGameLoad; - CMENU.gm_pgmParentMenu = &_pGUIM->gmLoadSaveMenu; - ChangeToMenu(&CMENU); -} - -#undef CMENU - -// save/load menu calling functions -#define CMENU _pGUIM->gmLoadSaveMenu - -void StartPlayerModelLoadMenu(void) -{ - CMENU.gm_mgTitle.mg_strText = TRANS("CHOOSE MODEL"); - CMENU.gm_bAllowThumbnails = TRUE; - CMENU.gm_iSortType = LSSORT_FILEUP; - CMENU.gm_bSave = FALSE; - CMENU.gm_bManage = FALSE; - CMENU.gm_fnmDirectory = CTString("Models\\Player\\"); - CMENU.gm_fnmSelected = _strLastPlayerAppearance; - CMENU.gm_fnmExt = CTString(".amc"); - CMENU.gm_pAfterFileChosen = &LSLoadPlayerModel; - CMENU.gm_mgNotes.mg_strText = ""; - - CMENU.gm_pgmParentMenu = &_pGUIM->gmPlayerProfile; - ChangeToMenu(&CMENU); -} - -void StartControlsLoadMenu(void) -{ - CMENU.gm_mgTitle.mg_strText = TRANS("LOAD CONTROLS"); - CMENU.gm_bAllowThumbnails = FALSE; - CMENU.gm_iSortType = LSSORT_FILEUP; - CMENU.gm_bSave = FALSE; - CMENU.gm_bManage = FALSE; - CMENU.gm_fnmDirectory = CTString("Controls\\"); - CMENU.gm_fnmSelected = CTString(""); - CMENU.gm_fnmExt = CTString(".ctl"); - CMENU.gm_pAfterFileChosen = &LSLoadControls; - CMENU.gm_mgNotes.mg_strText = ""; - - CMENU.gm_pgmParentMenu = &_pGUIM->gmControls; - ChangeToMenu(&CMENU); -} - -void StartCustomLoadMenu(void) -{ - CMENU.gm_mgTitle.mg_strText = TRANS("ADVANCED OPTIONS"); - CMENU.gm_bAllowThumbnails = FALSE; - CMENU.gm_iSortType = LSSORT_NAMEUP; - CMENU.gm_bSave = FALSE; - CMENU.gm_bManage = FALSE; - CMENU.gm_fnmDirectory = CTString("Scripts\\CustomOptions\\"); - CMENU.gm_fnmSelected = CTString(""); - CMENU.gm_fnmExt = CTString(".cfg"); - CMENU.gm_pAfterFileChosen = &LSLoadCustom; - CMENU.gm_mgNotes.mg_strText = ""; - - CMENU.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu; - ChangeToMenu(&CMENU); -} - -void StartAddonsLoadMenu(void) -{ - CMENU.gm_mgTitle.mg_strText = TRANS("EXECUTE ADDON"); - CMENU.gm_bAllowThumbnails = FALSE; - CMENU.gm_iSortType = LSSORT_NAMEUP; - CMENU.gm_bSave = FALSE; - CMENU.gm_bManage = FALSE; - CMENU.gm_fnmDirectory = CTString("Scripts\\Addons\\"); - CMENU.gm_fnmSelected = CTString(""); - CMENU.gm_fnmExt = CTString(".ini"); - CMENU.gm_pAfterFileChosen = &LSLoadAddon; - CMENU.gm_mgNotes.mg_strText = ""; - - CMENU.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu; - ChangeToMenu(&CMENU); -} - -void StartModsLoadMenu(void) -{ - CMENU.gm_mgTitle.mg_strText = TRANS("CHOOSE MOD"); - CMENU.gm_bAllowThumbnails = TRUE; - CMENU.gm_iSortType = LSSORT_NAMEUP; - CMENU.gm_bSave = FALSE; - CMENU.gm_bManage = FALSE; - CMENU.gm_fnmDirectory = CTString("Mods\\"); - CMENU.gm_fnmSelected = CTString(""); - CMENU.gm_fnmExt = CTString(".des"); - CMENU.gm_pAfterFileChosen = &LSLoadMod; - - CMENU.gm_pgmParentMenu = &_pGUIM->gmMainMenu; - ChangeToMenu(&CMENU); -} - -void StartNetworkSettingsMenu(void) -{ - CMENU.gm_mgTitle.mg_strText = TRANS("CONNECTION SETTINGS"); - CMENU.gm_bAllowThumbnails = FALSE; - CMENU.gm_iSortType = LSSORT_FILEUP; - CMENU.gm_bSave = FALSE; - CMENU.gm_bManage = FALSE; - CMENU.gm_fnmDirectory = CTString("Scripts\\NetSettings\\"); - CMENU.gm_fnmSelected = sam_strNetworkSettings; - CMENU.gm_fnmExt = CTString(".ini"); - CMENU.gm_pAfterFileChosen = &LSLoadNetSettings; - if (sam_strNetworkSettings == "") { - CMENU.gm_mgNotes.mg_strText = TRANS( - "Before joining a network game,\n" - "you have to adjust your connection parameters.\n" - "Choose one option from the list.\n" - "If you have problems with connection, you can adjust\n" - "these parameters again from the Options menu.\n" - ); - } else { - CMENU.gm_mgNotes.mg_strText = ""; - } - - CMENU.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu; - ChangeToMenu(&CMENU); -} - -#undef CMENU - +// -------- Disabled Menu Calling Function void DisabledFunction(void) { _pGUIM->gmDisabledFunction.gm_pgmParentMenu = pgmCurrentMenu;