diff --git a/Sources/SeriousSam/GUI/Components/MGButton.cpp b/Sources/SeriousSam/GUI/Components/MGButton.cpp index 49fc985..13b98b2 100644 --- a/Sources/SeriousSam/GUI/Components/MGButton.cpp +++ b/Sources/SeriousSam/GUI/Components/MGButton.cpp @@ -23,6 +23,8 @@ CMGButton::CMGButton(void) mg_iCursorPos = -1; mg_bRectangle = FALSE; mg_bMental = FALSE; + mg_bEditing = FALSE; + mg_bHighlighted = FALSE; } @@ -120,8 +122,7 @@ void CMGButton::Render(CDrawPort *pdp) pdp->PutTextR(mg_strLabel, pixIL, pixJ, col); pdp->PutText(mg_strText, pixIR, pixJ, col); - } - else { + } else { CTString str = mg_strText; if (pdp->dp_FontData->fd_bFixedWidth) { str = str.Undecorated(); @@ -131,8 +132,7 @@ void CMGButton::Render(CDrawPort *pdp) str.TrimRight(iCursor); str.TrimLeft(iMaxLen); iCursor = iMaxLen; - } - else { + } else { str.TrimRight(iMaxLen); } } diff --git a/Sources/SeriousSam/GUI/Components/MGChangePlayer.cpp b/Sources/SeriousSam/GUI/Components/MGChangePlayer.cpp index 8a466a5..f2bc89b 100644 --- a/Sources/SeriousSam/GUI/Components/MGChangePlayer.cpp +++ b/Sources/SeriousSam/GUI/Components/MGChangePlayer.cpp @@ -5,6 +5,7 @@ #include #include #include "MGChangePlayer.h" +#include "GUI/Menus/MenuManager.h" extern CSoundData *_psdPress; @@ -16,11 +17,11 @@ void CMGChangePlayer::OnActivate(void) _iLocalPlayer = mg_iLocalPlayer; if (_pGame->gm_aiMenuLocalPlayers[mg_iLocalPlayer] < 0) _pGame->gm_aiMenuLocalPlayers[mg_iLocalPlayer] = 0; - gmPlayerProfile.gm_piCurrentPlayer = &_pGame->gm_aiMenuLocalPlayers[mg_iLocalPlayer]; - gmPlayerProfile.gm_pgmParentMenu = &gmSelectPlayersMenu; + _pGUIM->gmPlayerProfile.gm_piCurrentPlayer = &_pGame->gm_aiMenuLocalPlayers[mg_iLocalPlayer]; + _pGUIM->gmPlayerProfile.gm_pgmParentMenu = &_pGUIM->gmSelectPlayersMenu; extern BOOL _bPlayerMenuFromSinglePlayer; _bPlayerMenuFromSinglePlayer = FALSE; - ChangeToMenu(&gmPlayerProfile); + ChangeToMenu(&_pGUIM->gmPlayerProfile); } void CMGChangePlayer::SetPlayerText(void) diff --git a/Sources/SeriousSam/GUI/Components/MGFileButton.cpp b/Sources/SeriousSam/GUI/Components/MGFileButton.cpp index 421f2c4..3fe7cbb 100644 --- a/Sources/SeriousSam/GUI/Components/MGFileButton.cpp +++ b/Sources/SeriousSam/GUI/Components/MGFileButton.cpp @@ -5,6 +5,7 @@ #include #include #include "MGFileButton.h" +#include "GUI/Menus/MenuManager.h" extern CSoundData *_psdPress; @@ -57,9 +58,9 @@ void CMGFileButton::DoSave(void) void CMGFileButton::SaveYes(void) { - ASSERT(gmLoadSaveMenu.gm_bSave); + ASSERT(_pGUIM->gmLoadSaveMenu.gm_bSave); // call saving function - BOOL bSucceeded = gmLoadSaveMenu.gm_pAfterFileChosen(mg_fnm); + BOOL bSucceeded = _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen(mg_fnm); // if saved if (bSucceeded) { // save the description too @@ -69,17 +70,17 @@ void CMGFileButton::SaveYes(void) void CMGFileButton::DoLoad(void) { - ASSERT(!gmLoadSaveMenu.gm_bSave); + ASSERT(!_pGUIM->gmLoadSaveMenu.gm_bSave); // if no file if (!FileExists(mg_fnm)) { // do nothing return; } - if (gmLoadSaveMenu.gm_pgmNextMenu != NULL) { - gmLoadSaveMenu.gm_pgmParentMenu = gmLoadSaveMenu.gm_pgmNextMenu; + if (_pGUIM->gmLoadSaveMenu.gm_pgmNextMenu != NULL) { + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = _pGUIM->gmLoadSaveMenu.gm_pgmNextMenu; } // call loading function - BOOL bSucceeded = gmLoadSaveMenu.gm_pAfterFileChosen(mg_fnm); + BOOL bSucceeded = _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen(mg_fnm); ASSERT(bSucceeded); } @@ -101,7 +102,7 @@ void CMGFileButton::OnActivate(void) IFeel_PlayEffect("Menu_press"); // if loading - if (!gmLoadSaveMenu.gm_bSave) { + if (!_pGUIM->gmLoadSaveMenu.gm_bSave) { // load now DoLoad(); // if saving @@ -109,7 +110,7 @@ void CMGFileButton::OnActivate(void) else { // switch to editing mode BOOL bWasEmpty = mg_strText == EMPTYSLOTSTRING; - mg_strDes = gmLoadSaveMenu.gm_strSaveDes; + mg_strDes = _pGUIM->gmLoadSaveMenu.gm_strSaveDes; RefreshText(); _strOrgDescription = _strTmpDescription = mg_strText; if (bWasEmpty) { @@ -124,7 +125,7 @@ void CMGFileButton::OnActivate(void) BOOL CMGFileButton::OnKeyDown(int iVKey) { if (mg_iState == FBS_NORMAL) { - if (gmLoadSaveMenu.gm_bSave || gmLoadSaveMenu.gm_bManage) { + if (_pGUIM->gmLoadSaveMenu.gm_bSave || _pGUIM->gmLoadSaveMenu.gm_bManage) { if (iVKey == VK_F2) { if (FileExistsForWriting(mg_fnm)) { // switch to renaming mode @@ -143,8 +144,8 @@ BOOL CMGFileButton::OnKeyDown(int iVKey) RemoveFile(mg_fnm.NoExt() + ".des"); RemoveFile(mg_fnm.NoExt() + "Tbn.tex"); // refresh menu - gmLoadSaveMenu.EndMenu(); - gmLoadSaveMenu.StartMenu(); + _pGUIM->gmLoadSaveMenu.EndMenu(); + _pGUIM->gmLoadSaveMenu.StartMenu(); OnSetFocus(); } return TRUE; @@ -167,10 +168,9 @@ void CMGFileButton::OnSetFocus(void) { mg_iState = FBS_NORMAL; - if (gmLoadSaveMenu.gm_bAllowThumbnails && mg_bEnabled) { + if (_pGUIM->gmLoadSaveMenu.gm_bAllowThumbnails && mg_bEnabled) { SetThumbnail(mg_fnm); - } - else { + } else { ClearThumbnail(); } pgmCurrentMenu->KillAllFocuses(); @@ -201,8 +201,8 @@ void CMGFileButton::OnStringChanged(void) mg_strDes = _strTmpDescription + "\n" + mg_strInfo; SaveDescription(); // refresh menu - gmLoadSaveMenu.EndMenu(); - gmLoadSaveMenu.StartMenu(); + _pGUIM->gmLoadSaveMenu.EndMenu(); + _pGUIM->gmLoadSaveMenu.StartMenu(); OnSetFocus(); } } diff --git a/Sources/SeriousSam/GUI/Components/MGTrigger.cpp b/Sources/SeriousSam/GUI/Components/MGTrigger.cpp index 443619b..a580463 100644 --- a/Sources/SeriousSam/GUI/Components/MGTrigger.cpp +++ b/Sources/SeriousSam/GUI/Components/MGTrigger.cpp @@ -26,6 +26,7 @@ INDEX GetNewLoopValue(int iVKey, INDEX iCurrent, INDEX ctMembers) CMGTrigger::CMGTrigger(void) { + mg_pPreTriggerChange = NULL; mg_pOnTriggerChange = NULL; mg_iCenterI = 0; mg_bVisual = FALSE; diff --git a/Sources/SeriousSam/GUI/Menus/MPlayerProfile.cpp b/Sources/SeriousSam/GUI/Menus/MPlayerProfile.cpp index 24f5bff..6e981cb 100644 --- a/Sources/SeriousSam/GUI/Menus/MPlayerProfile.cpp +++ b/Sources/SeriousSam/GUI/Menus/MPlayerProfile.cpp @@ -5,6 +5,7 @@ #include "MenuPrinting.h" #include "MenuStuff.h" #include "MPlayerProfile.h" +#include "GUI/Menus/MenuManager.h" #define ADD_SELECT_PLAYER_MG( index, mg, mgprev, mgnext, me)\ mg.mg_iIndex = index; \ @@ -190,20 +191,28 @@ void CPlayerProfileMenu::SelectPlayer(INDEX iPlayer) gm_mgCrosshair.mg_iSelected = pps->ps_iCrossHairType + 1; gm_mgCrosshair.ApplyCurrentSelection(); + gm_mgWeaponSelect.mg_iSelected = pps->ps_iWeaponAutoSelect; gm_mgWeaponSelect.ApplyCurrentSelection(); + gm_mgWeaponHide.mg_iSelected = (pps->ps_ulFlags&PSF_HIDEWEAPON) ? 1 : 0; gm_mgWeaponHide.ApplyCurrentSelection(); + gm_mg3rdPerson.mg_iSelected = (pps->ps_ulFlags&PSF_PREFER3RDPERSON) ? 1 : 0; gm_mg3rdPerson.ApplyCurrentSelection(); + gm_mgQuotes.mg_iSelected = (pps->ps_ulFlags&PSF_NOQUOTES) ? 0 : 1; gm_mgQuotes.ApplyCurrentSelection(); + gm_mgAutoSave.mg_iSelected = (pps->ps_ulFlags&PSF_AUTOSAVE) ? 1 : 0; gm_mgAutoSave.ApplyCurrentSelection(); + gm_mgCompDoubleClick.mg_iSelected = (pps->ps_ulFlags&PSF_COMPSINGLECLICK) ? 0 : 1; gm_mgCompDoubleClick.ApplyCurrentSelection(); + gm_mgViewBobbing.mg_iSelected = (pps->ps_ulFlags&PSF_NOBOBBING) ? 0 : 1; gm_mgViewBobbing.ApplyCurrentSelection(); + gm_mgSharpTurning.mg_iSelected = (pps->ps_ulFlags&PSF_SHARPTURNING) ? 1 : 0; gm_mgSharpTurning.ApplyCurrentSelection(); @@ -250,7 +259,7 @@ void CPlayerProfileMenu::SelectPlayer(INDEX iPlayer) void CPlayerProfileMenu::StartMenu(void) { - gmPlayerProfile.gm_pmgSelectedByDefault = &gm_mgNameField; + _pGUIM->gmPlayerProfile.gm_pmgSelectedByDefault = &gm_mgNameField; if (_gmRunningGameMode == GM_NONE || _gmRunningGameMode == GM_DEMO) { for (INDEX i = 0; i<8; i++) { diff --git a/Sources/SeriousSam/GUI/Menus/Menu.cpp b/Sources/SeriousSam/GUI/Menus/Menu.cpp index ad908ee..4cb5c9b 100644 --- a/Sources/SeriousSam/GUI/Menus/Menu.cpp +++ b/Sources/SeriousSam/GUI/Menus/Menu.cpp @@ -13,6 +13,7 @@ #include "LevelInfo.h" #include "VarList.h" #include "FileInfo.h" +#include "MenuManager.h" #include "GUI/Components/MGArrow.h" #include "GUI/Components/MGButton.h" @@ -29,31 +30,6 @@ #include "GUI/Components/MGTrigger.h" #include "GUI/Components/MGVarButton.h" -#include "MAudioOptions.h" -#include "MConfirm.h" -#include "MControls.h" -#include "MCustomizeAxis.h" -#include "MCustomizeKeyboard.h" -#include "MCredits.h" -#include "MDisabled.h" -#include "MHighScore.h" -#include "MInGame.h" -#include "MLevels.h" -#include "MMain.h" -#include "MNetwork.h" -#include "MNetworkJoin.h" -#include "MNetworkOpen.h" -#include "MNetworkStart.h" -#include "MOptions.h" -#include "MRenderingOptions.h" -#include "MServers.h" -#include "MSinglePlayer.h" -#include "MSinglePlayerNew.h" -#include "MSplitScreen.h" -#include "MSplitStart.h" -#include "MVar.h" -#include "MVideoOptions.h" - #include "MenuStuff.h" #include "Menu_starters.h" @@ -185,33 +161,6 @@ CGameMenu *pgmCurrentMenu = NULL; // global back button CMGButton mgBack; -// Menus -CConfirmMenu gmConfirmMenu; -CMainMenu gmMainMenu; -CInGameMenu gmInGameMenu; -CSinglePlayerMenu gmSinglePlayerMenu; -CSinglePlayerNewMenu gmSinglePlayerNewMenu; -CDisabledMenu gmDisabledFunction; -CLevelsMenu gmLevelsMenu; -CVarMenu gmVarMenu; -CPlayerProfileMenu gmPlayerProfile; -CControlsMenu gmControls; -CLoadSaveMenu gmLoadSaveMenu; -CHighScoreMenu gmHighScoreMenu; -CCustomizeKeyboardMenu gmCustomizeKeyboardMenu; -CServersMenu gmServersMenu; -CCustomizeAxisMenu gmCustomizeAxisMenu; -COptionsMenu gmOptionsMenu; -CVideoOptionsMenu gmVideoOptionsMenu; -CAudioOptionsMenu gmAudioOptionsMenu; -CNetworkMenu gmNetworkMenu; -CNetworkJoinMenu gmNetworkJoinMenu; -CNetworkStartMenu gmNetworkStartMenu; -CNetworkOpenMenu gmNetworkOpenMenu; -CSplitScreenMenu gmSplitScreenMenu; -CSplitStartMenu gmSplitStartMenu; -CSelectPlayersMenu gmSelectPlayersMenu; - // -------- console variable adjustment menu extern BOOL _bVarChanged = FALSE; @@ -263,11 +212,11 @@ void StartMenus(char *str) // stop all IFeel effects IFeel_StopEffect(NULL); - if (pgmCurrentMenu==&gmMainMenu || pgmCurrentMenu==&gmInGameMenu) { + if (pgmCurrentMenu == &_pGUIM->gmMainMenu || pgmCurrentMenu == &_pGUIM->gmInGameMenu) { if (_gmRunningGameMode==GM_NONE) { - pgmCurrentMenu = &gmMainMenu; + pgmCurrentMenu = &_pGUIM->gmMainMenu; } else { - pgmCurrentMenu = &gmInGameMenu; + pgmCurrentMenu = &_pGUIM->gmInGameMenu; } } @@ -276,36 +225,36 @@ void StartMenus(char *str) ChangeToMenu(pgmCurrentMenu); } else { if (_gmRunningGameMode==GM_NONE) { - ChangeToMenu(&gmMainMenu); + ChangeToMenu(&_pGUIM->gmMainMenu); } else { - ChangeToMenu(&gmInGameMenu); + ChangeToMenu(&_pGUIM->gmInGameMenu); } } if (CTString(str)=="load") { StartCurrentLoadMenu(); - gmLoadSaveMenu.gm_pgmParentMenu = NULL; + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = NULL; } if (CTString(str)=="save") { StartCurrentSaveMenu(); - gmLoadSaveMenu.gm_pgmParentMenu = NULL; - FixupBackButton(&gmLoadSaveMenu); + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = NULL; + FixupBackButton(&_pGUIM->gmLoadSaveMenu); } if (CTString(str)=="controls") { void StartControlsMenuFromOptions(void); StartControlsMenuFromOptions(); - gmControls.gm_pgmParentMenu = NULL; - FixupBackButton(&gmControls); + _pGUIM->gmControls.gm_pgmParentMenu = NULL; + FixupBackButton(&_pGUIM->gmControls); } if (CTString(str)=="join") { void StartSelectPlayersMenuFromOpen(void); StartSelectPlayersMenuFromOpen(); - gmSelectPlayersMenu.gm_pgmParentMenu = &gmMainMenu; - FixupBackButton(&gmSelectPlayersMenu); + _pGUIM->gmSelectPlayersMenu.gm_pgmParentMenu = &_pGUIM->gmMainMenu; + FixupBackButton(&_pGUIM->gmSelectPlayersMenu); } if (CTString(str)=="hiscore") { - ChangeToMenu( &gmHighScoreMenu); - gmHighScoreMenu.gm_pgmParentMenu = &gmMainMenu; - FixupBackButton(&gmHighScoreMenu); + ChangeToMenu(&_pGUIM->gmHighScoreMenu); + _pGUIM->gmHighScoreMenu.gm_pgmParentMenu = &_pGUIM->gmMainMenu; + FixupBackButton(&_pGUIM->gmHighScoreMenu); } bMenuActive = TRUE; bMenuRendering = TRUE; @@ -321,9 +270,9 @@ void StopMenus( BOOL bGoToRoot /*=TRUE*/) bMenuActive = FALSE; if (bGoToRoot) { if (_gmRunningGameMode==GM_NONE) { - pgmCurrentMenu = &gmMainMenu; + pgmCurrentMenu = &_pGUIM->gmMainMenu; } else { - pgmCurrentMenu = &gmInGameMenu; + pgmCurrentMenu = &_pGUIM->gmInGameMenu; } } } @@ -331,13 +280,10 @@ void StopMenus( BOOL bGoToRoot /*=TRUE*/) BOOL IsMenusInRoot(void) { - return pgmCurrentMenu==NULL || pgmCurrentMenu==&gmMainMenu || pgmCurrentMenu==&gmInGameMenu; + return pgmCurrentMenu == NULL || pgmCurrentMenu == &_pGUIM->gmMainMenu || pgmCurrentMenu == &_pGUIM->gmInGameMenu; } -// ---------------------- When activated functions - - - +// ---------------------- When activated functions void StopCurrentGame(void) { _pGame->StopGame(); @@ -348,20 +294,20 @@ void StopCurrentGame(void) void DisabledFunction(void) { - gmDisabledFunction.gm_pgmParentMenu = pgmCurrentMenu; - gmDisabledFunction.gm_mgButton.mg_strText = TRANS("The feature is not available in this version!"); - gmDisabledFunction.gm_mgTitle.mg_strText = TRANS("DISABLED"); - ChangeToMenu( &gmDisabledFunction); + _pGUIM->gmDisabledFunction.gm_pgmParentMenu = pgmCurrentMenu; + _pGUIM->gmDisabledFunction.gm_mgButton.mg_strText = TRANS("The feature is not available in this version!"); + _pGUIM->gmDisabledFunction.gm_mgTitle.mg_strText = TRANS("DISABLED"); + ChangeToMenu(&_pGUIM->gmDisabledFunction); } extern void InitVideoOptionsButtons(void); extern void UpdateVideoOptionsButtons(INDEX i); - - // ------------------------ Global menu function implementation void InitializeMenus(void) { + _pGUIM = new CMenuManager(); + try { // initialize and load corresponding fonts _fdSmall.Load_t( CTFILENAME( "Fonts\\Display3-narrow.fnt")); @@ -422,148 +368,148 @@ void InitializeMenus(void) InitGameTypes(); // ------------------- Initialize menus - gmConfirmMenu.Initialize_t(); - gmConfirmMenu.gm_strName="Confirm"; - gmConfirmMenu.gm_pmgSelectedByDefault = &gmConfirmMenu.gm_mgConfirmYes; - gmConfirmMenu.gm_pgmParentMenu = NULL; + _pGUIM->gmConfirmMenu.Initialize_t(); + _pGUIM->gmConfirmMenu.gm_strName = "Confirm"; + _pGUIM->gmConfirmMenu.gm_pmgSelectedByDefault = &_pGUIM->gmConfirmMenu.gm_mgConfirmYes; + _pGUIM->gmConfirmMenu.gm_pgmParentMenu = NULL; InitActionsForConfirmMenu(); - gmMainMenu.Initialize_t(); - gmMainMenu.gm_strName="Main"; - gmMainMenu.gm_pmgSelectedByDefault = &gmMainMenu.gm_mgSingle; - gmMainMenu.gm_pgmParentMenu = NULL; + _pGUIM->gmMainMenu.Initialize_t(); + _pGUIM->gmMainMenu.gm_strName = "Main"; + _pGUIM->gmMainMenu.gm_pmgSelectedByDefault = &_pGUIM->gmMainMenu.gm_mgSingle; + _pGUIM->gmMainMenu.gm_pgmParentMenu = NULL; InitActionsForMainMenu(); - gmInGameMenu.Initialize_t(); - gmInGameMenu.gm_strName="InGame"; - gmInGameMenu.gm_pmgSelectedByDefault = &gmInGameMenu.gm_mgQuickLoad; - gmInGameMenu.gm_pgmParentMenu = NULL; + _pGUIM->gmInGameMenu.Initialize_t(); + _pGUIM->gmInGameMenu.gm_strName = "InGame"; + _pGUIM->gmInGameMenu.gm_pmgSelectedByDefault = &_pGUIM->gmInGameMenu.gm_mgQuickLoad; + _pGUIM->gmInGameMenu.gm_pgmParentMenu = NULL; InitActionsForInGameMenu(); - gmSinglePlayerMenu.Initialize_t(); - gmSinglePlayerMenu.gm_strName="SinglePlayer"; - gmSinglePlayerMenu.gm_pmgSelectedByDefault = &gmSinglePlayerMenu.gm_mgNewGame; - gmSinglePlayerMenu.gm_pgmParentMenu = &gmMainMenu; + _pGUIM->gmSinglePlayerMenu.Initialize_t(); + _pGUIM->gmSinglePlayerMenu.gm_strName = "SinglePlayer"; + _pGUIM->gmSinglePlayerMenu.gm_pmgSelectedByDefault = &_pGUIM->gmSinglePlayerMenu.gm_mgNewGame; + _pGUIM->gmSinglePlayerMenu.gm_pgmParentMenu = &_pGUIM->gmMainMenu; InitActionsForSinglePlayerMenu(); - gmSinglePlayerNewMenu.Initialize_t(); - gmSinglePlayerNewMenu.gm_strName="SinglePlayerNew"; - gmSinglePlayerNewMenu.gm_pmgSelectedByDefault = &gmSinglePlayerNewMenu.gm_mgMedium; - gmSinglePlayerNewMenu.gm_pgmParentMenu = &gmSinglePlayerMenu; + _pGUIM->gmSinglePlayerNewMenu.Initialize_t(); + _pGUIM->gmSinglePlayerNewMenu.gm_strName = "SinglePlayerNew"; + _pGUIM->gmSinglePlayerNewMenu.gm_pmgSelectedByDefault = &_pGUIM->gmSinglePlayerNewMenu.gm_mgMedium; + _pGUIM->gmSinglePlayerNewMenu.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu; InitActionsForSinglePlayerNewMenu(); - gmDisabledFunction.Initialize_t(); - gmDisabledFunction.gm_strName="DisabledFunction"; - gmDisabledFunction.gm_pmgSelectedByDefault = &gmDisabledFunction.gm_mgButton; - gmDisabledFunction.gm_pgmParentMenu = NULL; + _pGUIM->gmDisabledFunction.Initialize_t(); + _pGUIM->gmDisabledFunction.gm_strName = "DisabledFunction"; + _pGUIM->gmDisabledFunction.gm_pmgSelectedByDefault = &_pGUIM->gmDisabledFunction.gm_mgButton; + _pGUIM->gmDisabledFunction.gm_pgmParentMenu = NULL; - gmPlayerProfile.Initialize_t(); - gmPlayerProfile.gm_strName="PlayerProfile"; - gmPlayerProfile.gm_pmgSelectedByDefault = &gmPlayerProfile.gm_mgNameField; + _pGUIM->gmPlayerProfile.Initialize_t(); + _pGUIM->gmPlayerProfile.gm_strName = "PlayerProfile"; + _pGUIM->gmPlayerProfile.gm_pmgSelectedByDefault = &_pGUIM->gmPlayerProfile.gm_mgNameField; InitActionsForPlayerProfileMenu(); - gmControls.Initialize_t(); - gmControls.gm_strName="Controls"; - gmControls.gm_pmgSelectedByDefault = &gmControls.gm_mgButtons; + _pGUIM->gmControls.Initialize_t(); + _pGUIM->gmControls.gm_strName = "Controls"; + _pGUIM->gmControls.gm_pmgSelectedByDefault = &_pGUIM->gmControls.gm_mgButtons; InitActionsForControlsMenu(); // warning! parent menu has to be set inside button activate function from where // Load/Save menu is called - gmLoadSaveMenu.Initialize_t(); - gmLoadSaveMenu.gm_strName="LoadSave"; - gmLoadSaveMenu.gm_pmgSelectedByDefault = &gmLoadSaveMenu.gm_amgButton[0]; + _pGUIM->gmLoadSaveMenu.Initialize_t(); + _pGUIM->gmLoadSaveMenu.gm_strName = "LoadSave"; + _pGUIM->gmLoadSaveMenu.gm_pmgSelectedByDefault = &_pGUIM->gmLoadSaveMenu.gm_amgButton[0]; - gmHighScoreMenu.Initialize_t(); - gmHighScoreMenu.gm_strName="HighScore"; - gmHighScoreMenu.gm_pmgSelectedByDefault = &mgBack; + _pGUIM->gmHighScoreMenu.Initialize_t(); + _pGUIM->gmHighScoreMenu.gm_strName = "HighScore"; + _pGUIM->gmHighScoreMenu.gm_pmgSelectedByDefault = &mgBack; - gmCustomizeKeyboardMenu.Initialize_t(); - gmCustomizeKeyboardMenu.gm_strName="CustomizeKeyboard"; - gmCustomizeKeyboardMenu.gm_pmgSelectedByDefault = &gmCustomizeKeyboardMenu.gm_mgKey[0]; - gmCustomizeKeyboardMenu.gm_pgmParentMenu = &gmControls; + _pGUIM->gmCustomizeKeyboardMenu.Initialize_t(); + _pGUIM->gmCustomizeKeyboardMenu.gm_strName = "CustomizeKeyboard"; + _pGUIM->gmCustomizeKeyboardMenu.gm_pmgSelectedByDefault = &_pGUIM->gmCustomizeKeyboardMenu.gm_mgKey[0]; + _pGUIM->gmCustomizeKeyboardMenu.gm_pgmParentMenu = &_pGUIM->gmControls; - gmCustomizeAxisMenu.Initialize_t(); - gmCustomizeAxisMenu.gm_strName="CustomizeAxis"; - gmCustomizeAxisMenu.gm_pmgSelectedByDefault = &gmCustomizeAxisMenu.gm_mgActionTrigger; - gmCustomizeAxisMenu.gm_pgmParentMenu = &gmControls; + _pGUIM->gmCustomizeAxisMenu.Initialize_t(); + _pGUIM->gmCustomizeAxisMenu.gm_strName = "CustomizeAxis"; + _pGUIM->gmCustomizeAxisMenu.gm_pmgSelectedByDefault = &_pGUIM->gmCustomizeAxisMenu.gm_mgActionTrigger; + _pGUIM->gmCustomizeAxisMenu.gm_pgmParentMenu = &_pGUIM->gmControls; InitActionsForCustomizeAxisMenu(); - gmOptionsMenu.Initialize_t(); - gmOptionsMenu.gm_strName="Options"; - gmOptionsMenu.gm_pmgSelectedByDefault = &gmOptionsMenu.gm_mgVideoOptions; - gmOptionsMenu.gm_pgmParentMenu = &gmMainMenu; + _pGUIM->gmOptionsMenu.Initialize_t(); + _pGUIM->gmOptionsMenu.gm_strName = "Options"; + _pGUIM->gmOptionsMenu.gm_pmgSelectedByDefault = &_pGUIM->gmOptionsMenu.gm_mgVideoOptions; + _pGUIM->gmOptionsMenu.gm_pgmParentMenu = &_pGUIM->gmMainMenu; InitActionsForOptionsMenu(); - gmVideoOptionsMenu.Initialize_t(); - gmVideoOptionsMenu.gm_strName="VideoOptions"; - gmVideoOptionsMenu.gm_pmgSelectedByDefault = &gmVideoOptionsMenu.gm_mgDisplayAPITrigger; - gmVideoOptionsMenu.gm_pgmParentMenu = &gmOptionsMenu; + _pGUIM->gmVideoOptionsMenu.Initialize_t(); + _pGUIM->gmVideoOptionsMenu.gm_strName = "VideoOptions"; + _pGUIM->gmVideoOptionsMenu.gm_pmgSelectedByDefault = &_pGUIM->gmVideoOptionsMenu.gm_mgDisplayAPITrigger; + _pGUIM->gmVideoOptionsMenu.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu; InitActionsForVideoOptionsMenu(); - gmAudioOptionsMenu.Initialize_t(); - gmAudioOptionsMenu.gm_strName="AudioOptions"; - gmAudioOptionsMenu.gm_pmgSelectedByDefault = &gmAudioOptionsMenu.gm_mgFrequencyTrigger; - gmAudioOptionsMenu.gm_pgmParentMenu = &gmOptionsMenu; + _pGUIM->gmAudioOptionsMenu.Initialize_t(); + _pGUIM->gmAudioOptionsMenu.gm_strName = "AudioOptions"; + _pGUIM->gmAudioOptionsMenu.gm_pmgSelectedByDefault = &_pGUIM->gmAudioOptionsMenu.gm_mgFrequencyTrigger; + _pGUIM->gmAudioOptionsMenu.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu; InitActionsForAudioOptionsMenu(); - gmLevelsMenu.Initialize_t(); - gmLevelsMenu.gm_strName="Levels"; - gmLevelsMenu.gm_pmgSelectedByDefault = &gmLevelsMenu.gm_mgManualLevel[0]; - gmLevelsMenu.gm_pgmParentMenu = &gmSinglePlayerMenu; + _pGUIM->gmLevelsMenu.Initialize_t(); + _pGUIM->gmLevelsMenu.gm_strName = "Levels"; + _pGUIM->gmLevelsMenu.gm_pmgSelectedByDefault = &_pGUIM->gmLevelsMenu.gm_mgManualLevel[0]; + _pGUIM->gmLevelsMenu.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu; - gmVarMenu.Initialize_t(); - gmVarMenu.gm_strName="Var"; - gmVarMenu.gm_pmgSelectedByDefault = &gmVarMenu.gm_mgVar[0]; - gmVarMenu.gm_pgmParentMenu = &gmNetworkStartMenu; + _pGUIM->gmVarMenu.Initialize_t(); + _pGUIM->gmVarMenu.gm_strName = "Var"; + _pGUIM->gmVarMenu.gm_pmgSelectedByDefault = &_pGUIM->gmVarMenu.gm_mgVar[0]; + _pGUIM->gmVarMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkStartMenu; InitActionsForVarMenu(); - gmServersMenu.Initialize_t(); - gmServersMenu.gm_strName="Servers"; - gmServersMenu.gm_pmgSelectedByDefault = &gmServersMenu.gm_mgList; - gmServersMenu.gm_pgmParentMenu = &gmNetworkOpenMenu; + _pGUIM->gmServersMenu.Initialize_t(); + _pGUIM->gmServersMenu.gm_strName = "Servers"; + _pGUIM->gmServersMenu.gm_pmgSelectedByDefault = &_pGUIM->gmServersMenu.gm_mgList; + _pGUIM->gmServersMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkOpenMenu; InitActionsForServersMenu(); - gmNetworkMenu.Initialize_t(); - gmNetworkMenu.gm_strName="Network"; - gmNetworkMenu.gm_pmgSelectedByDefault = &gmNetworkMenu.gm_mgJoin; - gmNetworkMenu.gm_pgmParentMenu = &gmMainMenu; + _pGUIM->gmNetworkMenu.Initialize_t(); + _pGUIM->gmNetworkMenu.gm_strName = "Network"; + _pGUIM->gmNetworkMenu.gm_pmgSelectedByDefault = &_pGUIM->gmNetworkMenu.gm_mgJoin; + _pGUIM->gmNetworkMenu.gm_pgmParentMenu = &_pGUIM->gmMainMenu; InitActionsForNetworkMenu(); - gmNetworkStartMenu.Initialize_t(); - gmNetworkStartMenu.gm_strName="NetworkStart"; - gmNetworkStartMenu.gm_pmgSelectedByDefault = &gmNetworkStartMenu.gm_mgStart; - gmNetworkStartMenu.gm_pgmParentMenu = &gmNetworkMenu; + _pGUIM->gmNetworkStartMenu.Initialize_t(); + _pGUIM->gmNetworkStartMenu.gm_strName = "NetworkStart"; + _pGUIM->gmNetworkStartMenu.gm_pmgSelectedByDefault = &_pGUIM->gmNetworkStartMenu.gm_mgStart; + _pGUIM->gmNetworkStartMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkMenu; InitActionsForNetworkStartMenu(); - gmNetworkJoinMenu.Initialize_t(); - gmNetworkJoinMenu.gm_strName="NetworkJoin"; - gmNetworkJoinMenu.gm_pmgSelectedByDefault = &gmNetworkJoinMenu.gm_mgLAN; - gmNetworkJoinMenu.gm_pgmParentMenu = &gmNetworkMenu; + _pGUIM->gmNetworkJoinMenu.Initialize_t(); + _pGUIM->gmNetworkJoinMenu.gm_strName = "NetworkJoin"; + _pGUIM->gmNetworkJoinMenu.gm_pmgSelectedByDefault = &_pGUIM->gmNetworkJoinMenu.gm_mgLAN; + _pGUIM->gmNetworkJoinMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkMenu; InitActionsForNetworkJoinMenu(); - gmSelectPlayersMenu.gm_bAllowDedicated = FALSE; - gmSelectPlayersMenu.gm_bAllowObserving = FALSE; - gmSelectPlayersMenu.Initialize_t(); - gmSelectPlayersMenu.gm_strName="SelectPlayers"; - gmSelectPlayersMenu.gm_pmgSelectedByDefault = &gmSelectPlayersMenu.gm_mgStart; + _pGUIM->gmSelectPlayersMenu.gm_bAllowDedicated = FALSE; + _pGUIM->gmSelectPlayersMenu.gm_bAllowObserving = FALSE; + _pGUIM->gmSelectPlayersMenu.Initialize_t(); + _pGUIM->gmSelectPlayersMenu.gm_strName = "SelectPlayers"; + _pGUIM->gmSelectPlayersMenu.gm_pmgSelectedByDefault = &_pGUIM->gmSelectPlayersMenu.gm_mgStart; InitActionsForSelectPlayersMenu(); - gmNetworkOpenMenu.Initialize_t(); - gmNetworkOpenMenu.gm_strName="NetworkOpen"; - gmNetworkOpenMenu.gm_pmgSelectedByDefault = &gmNetworkOpenMenu.gm_mgJoin; - gmNetworkOpenMenu.gm_pgmParentMenu = &gmNetworkJoinMenu; + _pGUIM->gmNetworkOpenMenu.Initialize_t(); + _pGUIM->gmNetworkOpenMenu.gm_strName = "NetworkOpen"; + _pGUIM->gmNetworkOpenMenu.gm_pmgSelectedByDefault = &_pGUIM->gmNetworkOpenMenu.gm_mgJoin; + _pGUIM->gmNetworkOpenMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkJoinMenu; InitActionsForNetworkOpenMenu(); - gmSplitScreenMenu.Initialize_t(); - gmSplitScreenMenu.gm_strName="SplitScreen"; - gmSplitScreenMenu.gm_pmgSelectedByDefault = &gmSplitScreenMenu.gm_mgStart; - gmSplitScreenMenu.gm_pgmParentMenu = &gmMainMenu; + _pGUIM->gmSplitScreenMenu.Initialize_t(); + _pGUIM->gmSplitScreenMenu.gm_strName = "SplitScreen"; + _pGUIM->gmSplitScreenMenu.gm_pmgSelectedByDefault = &_pGUIM->gmSplitScreenMenu.gm_mgStart; + _pGUIM->gmSplitScreenMenu.gm_pgmParentMenu = &_pGUIM->gmMainMenu; InitActionsForSplitScreenMenu(); - gmSplitStartMenu.Initialize_t(); - gmSplitStartMenu.gm_strName="SplitStart"; - gmSplitStartMenu.gm_pmgSelectedByDefault = &gmSplitStartMenu.gm_mgStart; - gmSplitStartMenu.gm_pgmParentMenu = &gmSplitScreenMenu; + _pGUIM->gmSplitStartMenu.Initialize_t(); + _pGUIM->gmSplitStartMenu.gm_strName = "SplitStart"; + _pGUIM->gmSplitStartMenu.gm_pmgSelectedByDefault = &_pGUIM->gmSplitStartMenu.gm_mgStart; + _pGUIM->gmSplitStartMenu.gm_pgmParentMenu = &_pGUIM->gmSplitScreenMenu; InitActionsForSplitStartMenu(); } catch( char *strError) @@ -575,7 +521,7 @@ void InitializeMenus(void) void DestroyMenus( void) { - gmMainMenu.Destroy(); + _pGUIM->gmMainMenu.Destroy(); pgmCurrentMenu = NULL; _pSoundStock->Release(_psdSelect); _pSoundStock->Release(_psdPress); @@ -597,7 +543,7 @@ void MenuGoToParent(void) // if no game is running } else { // go to main menu - ChangeToMenu( &gmMainMenu); + ChangeToMenu(&_pGUIM->gmMainMenu); } // if there is some parent menu } else { @@ -632,7 +578,7 @@ void MenuOnKeyDown( int iVKey) if(!bHandled) { // if escape or right mouse pressed if(iVKey==VK_ESCAPE || iVKey==VK_RBUTTON) { - if (pgmCurrentMenu==&gmLoadSaveMenu && gmLoadSaveMenu.gm_bNoEscape) { + if (pgmCurrentMenu==&_pGUIM->gmLoadSaveMenu && _pGUIM->gmLoadSaveMenu.gm_bNoEscape) { return; } // go to parent menu if possible @@ -839,7 +785,7 @@ BOOL DoMenu( CDrawPort *pdp) FLOAT fScaleH = (FLOAT)pixH / 480.0f; PIX pixI0, pixJ0, pixI1, pixJ1; // put logo(s) to main menu (if logos exist) - if( pgmCurrentMenu==&gmMainMenu) + if (pgmCurrentMenu == &_pGUIM->gmMainMenu) { if( _ptoLogoODI!=NULL) { CTextureData &td = (CTextureData&)*_ptoLogoODI->GetData(); @@ -877,7 +823,7 @@ BOOL DoMenu( CDrawPort *pdp) dpMenu.PutTexture(&_toLogoMenuB, PIXaabbox2D( PIX2D( pixCenterI, pixHeightJ),PIX2D( pixCenterI+pixSizeI, pixHeightJ+pixSizeJ))); } - } else if (pgmCurrentMenu==&gmAudioOptionsMenu) { + } else if (pgmCurrentMenu == &_pGUIM->gmAudioOptionsMenu) { if( _ptoLogoEAX!=NULL) { CTextureData &td = (CTextureData&)*_ptoLogoEAX->GetData(); const INDEX iSize = 95; diff --git a/Sources/SeriousSam/GUI/Menus/Menu.h b/Sources/SeriousSam/GUI/Menus/Menu.h index 42091d4..ab4535b 100644 --- a/Sources/SeriousSam/GUI/Menus/Menu.h +++ b/Sources/SeriousSam/GUI/Menus/Menu.h @@ -33,9 +33,6 @@ extern void PlayMenuSound(CSoundData *psd); extern CListHead _lhServers; -extern class CPlayerProfileMenu gmPlayerProfile; -extern class CSelectPlayersMenu gmSelectPlayersMenu; -extern class CCustomizeAxisMenu gmCustomizeAxisMenu; extern INDEX _iLocalPlayer; enum GameMode { @@ -57,7 +54,5 @@ extern CGameMenu *pgmCurrentMenu; #include "MPlayerProfile.h" #include "MSelectPlayers.h" -extern CLoadSaveMenu gmLoadSaveMenu; - #endif /* include-once check. */ \ No newline at end of file diff --git a/Sources/SeriousSam/GUI/Menus/MenuManager.cpp b/Sources/SeriousSam/GUI/Menus/MenuManager.cpp new file mode 100644 index 0000000..4a28b52 --- /dev/null +++ b/Sources/SeriousSam/GUI/Menus/MenuManager.cpp @@ -0,0 +1,8 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */ + +#include "StdH.h" +#include + +#include "MenuManager.h" + +extern CMenuManager* _pGUIM = NULL; \ No newline at end of file diff --git a/Sources/SeriousSam/GUI/Menus/MenuManager.h b/Sources/SeriousSam/GUI/Menus/MenuManager.h new file mode 100644 index 0000000..ca3ba28 --- /dev/null +++ b/Sources/SeriousSam/GUI/Menus/MenuManager.h @@ -0,0 +1,67 @@ +/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */ + +#ifndef SE_INCL_MENUMANAGER_H +#define SE_INCL_MENUMANAGER_H +#ifdef PRAGMA_ONCE +#pragma once +#endif + +#include "MAudioOptions.h" +#include "MConfirm.h" +#include "MControls.h" +#include "MCustomizeAxis.h" +#include "MCustomizeKeyboard.h" +#include "MCredits.h" +#include "MDisabled.h" +#include "MHighScore.h" +#include "MInGame.h" +#include "MLevels.h" +#include "MMain.h" +#include "MNetwork.h" +#include "MNetworkJoin.h" +#include "MNetworkOpen.h" +#include "MNetworkStart.h" +#include "MOptions.h" +#include "MRenderingOptions.h" +#include "MServers.h" +#include "MSinglePlayer.h" +#include "MSinglePlayerNew.h" +#include "MSplitScreen.h" +#include "MSplitStart.h" +#include "MVar.h" +#include "MVideoOptions.h" + + +class CMenuManager { +public: + CConfirmMenu gmConfirmMenu; + CMainMenu gmMainMenu; + CInGameMenu gmInGameMenu; + CSinglePlayerMenu gmSinglePlayerMenu; + CSinglePlayerNewMenu gmSinglePlayerNewMenu; + CDisabledMenu gmDisabledFunction; + CLevelsMenu gmLevelsMenu; + CVarMenu gmVarMenu; + CPlayerProfileMenu gmPlayerProfile; + CControlsMenu gmControls; + CLoadSaveMenu gmLoadSaveMenu; + CHighScoreMenu gmHighScoreMenu; + CCustomizeKeyboardMenu gmCustomizeKeyboardMenu; + CServersMenu gmServersMenu; + CCustomizeAxisMenu gmCustomizeAxisMenu; + COptionsMenu gmOptionsMenu; + CVideoOptionsMenu gmVideoOptionsMenu; + CAudioOptionsMenu gmAudioOptionsMenu; + CNetworkMenu gmNetworkMenu; + CNetworkJoinMenu gmNetworkJoinMenu; + CNetworkStartMenu gmNetworkStartMenu; + CNetworkOpenMenu gmNetworkOpenMenu; + CSplitScreenMenu gmSplitScreenMenu; + CSplitStartMenu gmSplitStartMenu; + CSelectPlayersMenu gmSelectPlayersMenu; +}; + +extern CMenuManager *_pGUIM; // TODO: Make singleton! + + +#endif /* include-once check. */ \ No newline at end of file diff --git a/Sources/SeriousSam/GUI/Menus/Menu_actions.cpp b/Sources/SeriousSam/GUI/Menus/Menu_actions.cpp index 67dd2bc..e5a12fd 100644 --- a/Sources/SeriousSam/GUI/Menus/Menu_actions.cpp +++ b/Sources/SeriousSam/GUI/Menus/Menu_actions.cpp @@ -3,68 +3,18 @@ #include "StdH.h" #include +#include "MenuManager.h" #include "Menu_starters.h" #include "MenuStuff.h" #include "GUI/Components/MenuGadget.h" #include "LevelInfo.h" #include "VarList.h" -#include "MAudioOptions.h" -#include "MConfirm.h" -#include "MControls.h" -#include "MCustomizeAxis.h" -#include "MCustomizeKeyboard.h" -#include "MCredits.h" -#include "MDisabled.h" -#include "MHighScore.h" -#include "MInGame.h" -#include "MLevels.h" -#include "MMain.h" -#include "MNetwork.h" -#include "MNetworkJoin.h" -#include "MNetworkOpen.h" -#include "MNetworkStart.h" -#include "MOptions.h" -#include "MRenderingOptions.h" -#include "MServers.h" -#include "MSinglePlayer.h" -#include "MSinglePlayerNew.h" -#include "MSplitScreen.h" -#include "MSplitStart.h" -#include "MVar.h" -#include "MVideoOptions.h" - #define VOLUME_STEPS 50 extern CMenuGadget *_pmgLastActivatedGadget; extern CMenuGadget *_pmgUnderCursor; -extern CConfirmMenu gmConfirmMenu; -extern CMainMenu gmMainMenu; -extern CInGameMenu gmInGameMenu; -extern CSinglePlayerMenu gmSinglePlayerMenu; -extern CSinglePlayerNewMenu gmSinglePlayerNewMenu; -extern CDisabledMenu gmDisabledFunction; -extern CLevelsMenu gmLevelsMenu; -extern CVarMenu gmVarMenu; -extern CPlayerProfileMenu gmPlayerProfile; -extern CControlsMenu gmControls; -extern CLoadSaveMenu gmLoadSaveMenu; -extern CHighScoreMenu gmHighScoreMenu; -extern CCustomizeKeyboardMenu gmCustomizeKeyboardMenu; -extern CServersMenu gmServersMenu; -extern CCustomizeAxisMenu gmCustomizeAxisMenu; -extern COptionsMenu gmOptionsMenu; -extern CVideoOptionsMenu gmVideoOptionsMenu; -extern CAudioOptionsMenu gmAudioOptionsMenu; -extern CNetworkMenu gmNetworkMenu; -extern CNetworkJoinMenu gmNetworkJoinMenu; -extern CNetworkStartMenu gmNetworkStartMenu; -extern CNetworkOpenMenu gmNetworkOpenMenu; -extern CSplitScreenMenu gmSplitScreenMenu; -extern CSplitStartMenu gmSplitStartMenu; -extern CSelectPlayersMenu gmSelectPlayersMenu; - // functions to activate when user chose 'yes/no' on confirmation void(*_pConfimedYes)(void) = NULL; void(*_pConfimedNo)(void) = NULL; @@ -152,10 +102,10 @@ void ExitConfirm(void) { _pConfimedYes = &ExitGame; _pConfimedNo = NULL; - gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("ARE YOU SERIOUS?"); - gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; - gmConfirmMenu.BeLarge(); - ChangeToMenu(&gmConfirmMenu); + _pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("ARE YOU SERIOUS?"); + _pGUIM->gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; + _pGUIM->gmConfirmMenu.BeLarge(); + ChangeToMenu(&_pGUIM->gmConfirmMenu); } void StopConfirm(void) @@ -163,10 +113,10 @@ void StopConfirm(void) extern void StopCurrentGame(void); _pConfimedYes = &StopCurrentGame; _pConfimedNo = NULL; - gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("ARE YOU SERIOUS?"); - gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; - gmConfirmMenu.BeLarge(); - ChangeToMenu(&gmConfirmMenu); + _pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("ARE YOU SERIOUS?"); + _pGUIM->gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; + _pGUIM->gmConfirmMenu.BeLarge(); + ChangeToMenu(&_pGUIM->gmConfirmMenu); } void ModLoadYes(void) @@ -201,10 +151,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; - gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("CHANGE THE MOD?"); - gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; - gmConfirmMenu.BeLarge(); - ChangeToMenu(&gmConfirmMenu); + _pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("CHANGE THE MOD?"); + _pGUIM->gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; + _pGUIM->gmConfirmMenu.BeLarge(); + ChangeToMenu(&_pGUIM->gmConfirmMenu); } void SaveConfirm(void) @@ -212,10 +162,10 @@ void SaveConfirm(void) extern void OnFileSaveOK(void); _pConfimedYes = &OnFileSaveOK; _pConfimedNo = NULL; - gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("OVERWRITE?"); - gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; - gmConfirmMenu.BeLarge(); - ChangeToMenu(&gmConfirmMenu); + _pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("OVERWRITE?"); + _pGUIM->gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; + _pGUIM->gmConfirmMenu.BeLarge(); + ChangeToMenu(&_pGUIM->gmConfirmMenu); } void ExitAndSpawnExplorer(void) @@ -230,11 +180,11 @@ void ModNotInstalled(void) { _pConfimedYes = &ExitAndSpawnExplorer; _pConfimedNo = NULL; - gmConfirmMenu.gm_mgConfirmLabel.mg_strText.PrintF( + _pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText.PrintF( TRANS("You don't have MOD '%s' installed.\nDo you want to visit its web site?"), (const char*)_fnmModSelected); - gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; - gmConfirmMenu.BeSmall(); - ChangeToMenu(&gmConfirmMenu); + _pGUIM->gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; + _pGUIM->gmConfirmMenu.BeSmall(); + ChangeToMenu(&_pGUIM->gmConfirmMenu); /* gmDisabledFunction.gm_pgmParentMenu = pgmCurrentMenu; @@ -251,10 +201,10 @@ extern void ModConfirm(void) { _pConfimedYes = &ModLoadYes; _pConfimedNo = NULL; - gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("LOAD THIS MOD?"); - gmConfirmMenu.gm_pgmParentMenu = &gmLoadSaveMenu; - gmConfirmMenu.BeLarge(); - ChangeToMenu(&gmConfirmMenu); + _pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("LOAD THIS MOD?"); + _pGUIM->gmConfirmMenu.gm_pgmParentMenu = &_pGUIM->gmLoadSaveMenu; + _pGUIM->gmConfirmMenu.BeLarge(); + ChangeToMenu(&_pGUIM->gmConfirmMenu); } void VideoConfirm(void) @@ -262,27 +212,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 = gmConfirmMenu.gm_pmgSelectedByDefault; + _pmgUnderCursor = _pGUIM->gmConfirmMenu.gm_pmgSelectedByDefault; _pConfimedYes = NULL; void RevertVideoSettings(void); _pConfimedNo = RevertVideoSettings; - gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("KEEP THIS SETTING?"); - gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; - gmConfirmMenu.BeLarge(); - ChangeToMenu(&gmConfirmMenu); + _pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("KEEP THIS SETTING?"); + _pGUIM->gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; + _pGUIM->gmConfirmMenu.BeLarge(); + ChangeToMenu(&_pGUIM->gmConfirmMenu); } void CDConfirm(void(*pOk)(void)) { _pConfimedYes = pOk; _pConfimedNo = NULL; - gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("PLEASE INSERT GAME CD?"); - if (pgmCurrentMenu != &gmConfirmMenu) { - gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; - gmConfirmMenu.BeLarge(); - ChangeToMenu(&gmConfirmMenu); + _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); } } @@ -305,8 +255,8 @@ void ConfirmNo(void) } void InitActionsForConfirmMenu() { - gmConfirmMenu.gm_mgConfirmYes.mg_pActivatedFunction = &ConfirmYes; - gmConfirmMenu.gm_mgConfirmNo.mg_pActivatedFunction = &ConfirmNo; + _pGUIM->gmConfirmMenu.gm_mgConfirmYes.mg_pActivatedFunction = &ConfirmYes; + _pGUIM->gmConfirmMenu.gm_mgConfirmNo.mg_pActivatedFunction = &ConfirmNo; } // return TRUE if handled @@ -320,7 +270,7 @@ BOOL CConfirmMenu::OnKeyDown(int iVKey) } // ------------------------ CMainMenu implementation -#define CMENU gmMainMenu +#define CMENU _pGUIM->gmMainMenu void InitActionsForMainMenu() { CMENU.gm_mgSingle.mg_pActivatedFunction = &StartSinglePlayerMenu; @@ -354,7 +304,7 @@ void StopRecordingDemo(void) SetDemoStartStopRecText(); } -#define CMENU gmInGameMenu +#define CMENU _pGUIM->gmInGameMenu void InitActionsForInGameMenu() { @@ -394,7 +344,7 @@ extern void SetDemoStartStopRecText(void) void StartSinglePlayerGame_Normal(void); void StartTechTest(void) { - gmSinglePlayerNewMenu.gm_pgmParentMenu = &gmSinglePlayerMenu; + _pGUIM->gmSinglePlayerNewMenu.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu; extern CTString sam_strTechTestLevel; _pGame->gam_strCustomLevel = sam_strTechTestLevel; StartSinglePlayerGame_Normal(); @@ -402,13 +352,13 @@ void StartTechTest(void) void StartTraining(void) { - gmSinglePlayerNewMenu.gm_pgmParentMenu = &gmSinglePlayerMenu; + _pGUIM->gmSinglePlayerNewMenu.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu; extern CTString sam_strTrainingLevel; _pGame->gam_strCustomLevel = sam_strTrainingLevel; - ChangeToMenu(&gmSinglePlayerNewMenu); + ChangeToMenu(&_pGUIM->gmSinglePlayerNewMenu); } -#define CMENU gmSinglePlayerMenu +#define CMENU _pGUIM->gmSinglePlayerMenu void InitActionsForSinglePlayerMenu() { CMENU.gm_mgNewGame.mg_pActivatedFunction = &StartSinglePlayerNewMenu; @@ -500,7 +450,7 @@ void StartSinglePlayerGame_Mental(void) } -#define CMENU gmSinglePlayerNewMenu +#define CMENU _pGUIM->gmSinglePlayerNewMenu void InitActionsForSinglePlayerNewMenu() { CMENU.gm_mgTourist.mg_pActivatedFunction = &StartSinglePlayerGame_Tourist; @@ -514,7 +464,7 @@ void InitActionsForSinglePlayerNewMenu() { #undef CMENU // ------------------------ CPlayerProfileMenu implementation -#define CMENU gmPlayerProfile +#define CMENU _pGUIM->gmPlayerProfile void ChangeCrosshair(INDEX iNew) { @@ -611,7 +561,7 @@ extern void PPOnPlayerSelect(void) { ASSERT(_pmgLastActivatedGadget != NULL); if (_pmgLastActivatedGadget->mg_bEnabled) { - gmPlayerProfile.SelectPlayer(((CMGButton *)_pmgLastActivatedGadget)->mg_iIndex); + _pGUIM->gmPlayerProfile.SelectPlayer(((CMGButton *)_pmgLastActivatedGadget)->mg_iIndex); } } @@ -633,7 +583,7 @@ void InitActionsForPlayerProfileMenu() #undef CMENU // ------------------------ CControlsMenu implementation -#define CMENU gmControls +#define CMENU _pGUIM->gmControls void InitActionsForControlsMenu() { @@ -645,7 +595,7 @@ void InitActionsForControlsMenu() #undef CMENU // ------------------------ CCustomizeAxisMenu implementation -#define CMENU gmCustomizeAxisMenu +#define CMENU _pGUIM->gmCustomizeAxisMenu void PreChangeAxis(INDEX iDummy) { @@ -665,7 +615,7 @@ void InitActionsForCustomizeAxisMenu() { #undef CMENU // ------------------------ COptionsMenu implementation -#define CMENU gmOptionsMenu +#define CMENU _pGUIM->gmOptionsMenu void InitActionsForOptionsMenu() { @@ -689,7 +639,7 @@ static INDEX sam_old_iGfxAPI; static INDEX sam_old_iVideoSetup; // 0==speed, 1==normal, 2==quality, 3==custom -#define CMENU gmVideoOptionsMenu +#define CMENU _pGUIM->gmVideoOptionsMenu static void FillResolutionsList(void) { @@ -847,17 +797,17 @@ void ApplyVideoOptions(void) sam_old_iGfxAPI = sam_iGfxAPI; sam_old_iVideoSetup = sam_iVideoSetup; - BOOL bFullScreenMode = gmVideoOptionsMenu.gm_mgFullScreenTrigger.mg_iSelected == 1; + BOOL bFullScreenMode = CMENU.gm_mgFullScreenTrigger.mg_iSelected == 1; PIX pixWindowSizeI, pixWindowSizeJ; - ResolutionToSize(gmVideoOptionsMenu.gm_mgResolutionsTrigger.mg_iSelected, pixWindowSizeI, pixWindowSizeJ); - enum GfxAPIType gat = SwitchToAPI(gmVideoOptionsMenu.gm_mgDisplayAPITrigger.mg_iSelected); - enum DisplayDepth dd = SwitchToDepth(gmVideoOptionsMenu.gm_mgBitsPerPixelTrigger.mg_iSelected); - const INDEX iAdapter = gmVideoOptionsMenu.gm_mgDisplayAdaptersTrigger.mg_iSelected; + ResolutionToSize(CMENU.gm_mgResolutionsTrigger.mg_iSelected, pixWindowSizeI, pixWindowSizeJ); + enum GfxAPIType gat = SwitchToAPI(CMENU.gm_mgDisplayAPITrigger.mg_iSelected); + enum DisplayDepth dd = SwitchToDepth(CMENU.gm_mgBitsPerPixelTrigger.mg_iSelected); + const INDEX iAdapter = CMENU.gm_mgDisplayAdaptersTrigger.mg_iSelected; // setup preferences extern INDEX _iLastPreferences; if (sam_iVideoSetup == 3) _iLastPreferences = 3; - sam_iVideoSetup = gmVideoOptionsMenu.gm_mgDisplayPrefsTrigger.mg_iSelected; + sam_iVideoSetup = CMENU.gm_mgDisplayPrefsTrigger.mg_iSelected; // force fullscreen mode if needed CDisplayAdapter &da = _pGfx->gl_gaAPI[gat].ga_adaAdapter[iAdapter]; @@ -912,50 +862,52 @@ void InitActionsForVideoOptionsMenu() #undef CMENU // ------------------------ CAudioOptionsMenu implementation +#define CMENU _pGUIM->gmAudioOptionsMenu + extern void RefreshSoundFormat(void) { switch (_pSound->GetFormat()) { - case CSoundLibrary::SF_NONE: {gmAudioOptionsMenu.gm_mgFrequencyTrigger.mg_iSelected = 0; break; } - case CSoundLibrary::SF_11025_16: {gmAudioOptionsMenu.gm_mgFrequencyTrigger.mg_iSelected = 1; break; } - case CSoundLibrary::SF_22050_16: {gmAudioOptionsMenu.gm_mgFrequencyTrigger.mg_iSelected = 2; break; } - case CSoundLibrary::SF_44100_16: {gmAudioOptionsMenu.gm_mgFrequencyTrigger.mg_iSelected = 3; break; } - default: gmAudioOptionsMenu.gm_mgFrequencyTrigger.mg_iSelected = 0; + case CSoundLibrary::SF_NONE: {CMENU.gm_mgFrequencyTrigger.mg_iSelected = 0; break; } + case CSoundLibrary::SF_11025_16: {CMENU.gm_mgFrequencyTrigger.mg_iSelected = 1; break; } + case CSoundLibrary::SF_22050_16: {CMENU.gm_mgFrequencyTrigger.mg_iSelected = 2; break; } + case CSoundLibrary::SF_44100_16: {CMENU.gm_mgFrequencyTrigger.mg_iSelected = 3; break; } + default: CMENU.gm_mgFrequencyTrigger.mg_iSelected = 0; } - gmAudioOptionsMenu.gm_mgAudioAutoTrigger.mg_iSelected = Clamp(sam_bAutoAdjustAudio, 0, 1); - gmAudioOptionsMenu.gm_mgAudioAPITrigger.mg_iSelected = Clamp(_pShell->GetINDEX("snd_iInterface"), 0L, 2L); + CMENU.gm_mgAudioAutoTrigger.mg_iSelected = Clamp(sam_bAutoAdjustAudio, 0, 1); + CMENU.gm_mgAudioAPITrigger.mg_iSelected = Clamp(_pShell->GetINDEX("snd_iInterface"), 0L, 2L); - gmAudioOptionsMenu.gm_mgWaveVolume.mg_iMinPos = 0; - gmAudioOptionsMenu.gm_mgWaveVolume.mg_iMaxPos = VOLUME_STEPS; - gmAudioOptionsMenu.gm_mgWaveVolume.mg_iCurPos = (INDEX)(_pShell->GetFLOAT("snd_fSoundVolume")*VOLUME_STEPS + 0.5f); - gmAudioOptionsMenu.gm_mgWaveVolume.ApplyCurrentPosition(); + CMENU.gm_mgWaveVolume.mg_iMinPos = 0; + CMENU.gm_mgWaveVolume.mg_iMaxPos = VOLUME_STEPS; + CMENU.gm_mgWaveVolume.mg_iCurPos = (INDEX)(_pShell->GetFLOAT("snd_fSoundVolume")*VOLUME_STEPS + 0.5f); + CMENU.gm_mgWaveVolume.ApplyCurrentPosition(); - gmAudioOptionsMenu.gm_mgMPEGVolume.mg_iMinPos = 0; - gmAudioOptionsMenu.gm_mgMPEGVolume.mg_iMaxPos = VOLUME_STEPS; - gmAudioOptionsMenu.gm_mgMPEGVolume.mg_iCurPos = (INDEX)(_pShell->GetFLOAT("snd_fMusicVolume")*VOLUME_STEPS + 0.5f); - gmAudioOptionsMenu.gm_mgMPEGVolume.ApplyCurrentPosition(); + CMENU.gm_mgMPEGVolume.mg_iMinPos = 0; + CMENU.gm_mgMPEGVolume.mg_iMaxPos = VOLUME_STEPS; + CMENU.gm_mgMPEGVolume.mg_iCurPos = (INDEX)(_pShell->GetFLOAT("snd_fMusicVolume")*VOLUME_STEPS + 0.5f); + CMENU.gm_mgMPEGVolume.ApplyCurrentPosition(); - gmAudioOptionsMenu.gm_mgAudioAutoTrigger.ApplyCurrentSelection(); - gmAudioOptionsMenu.gm_mgAudioAPITrigger.ApplyCurrentSelection(); - gmAudioOptionsMenu.gm_mgFrequencyTrigger.ApplyCurrentSelection(); + CMENU.gm_mgAudioAutoTrigger.ApplyCurrentSelection(); + CMENU.gm_mgAudioAPITrigger.ApplyCurrentSelection(); + CMENU.gm_mgFrequencyTrigger.ApplyCurrentSelection(); } void ApplyAudioOptions(void) { - sam_bAutoAdjustAudio = gmAudioOptionsMenu.gm_mgAudioAutoTrigger.mg_iSelected; + sam_bAutoAdjustAudio = CMENU.gm_mgAudioAutoTrigger.mg_iSelected; if (sam_bAutoAdjustAudio) { _pShell->Execute("include \"Scripts\\Addons\\SFX-AutoAdjust.ini\""); } else { - _pShell->SetINDEX("snd_iInterface", gmAudioOptionsMenu.gm_mgAudioAPITrigger.mg_iSelected); + _pShell->SetINDEX("snd_iInterface", CMENU.gm_mgAudioAPITrigger.mg_iSelected); - switch (gmAudioOptionsMenu.gm_mgFrequencyTrigger.mg_iSelected) + switch (CMENU.gm_mgFrequencyTrigger.mg_iSelected) { - case 0: {_pSound->SetFormat(CSoundLibrary::SF_NONE); break; } - case 1: {_pSound->SetFormat(CSoundLibrary::SF_11025_16); break; } - case 2: {_pSound->SetFormat(CSoundLibrary::SF_22050_16); break; } - case 3: {_pSound->SetFormat(CSoundLibrary::SF_44100_16); break; } - default: _pSound->SetFormat(CSoundLibrary::SF_NONE); + case 0: {_pSound->SetFormat(CSoundLibrary::SF_NONE); break; } + case 1: {_pSound->SetFormat(CSoundLibrary::SF_11025_16); break; } + case 2: {_pSound->SetFormat(CSoundLibrary::SF_22050_16); break; } + case 3: {_pSound->SetFormat(CSoundLibrary::SF_44100_16); break; } + default: _pSound->SetFormat(CSoundLibrary::SF_NONE); } } @@ -963,8 +915,6 @@ void ApplyAudioOptions(void) snd_iFormat = _pSound->GetFormat(); } -#define CMENU gmAudioOptionsMenu - static void OnWaveVolumeChange(INDEX iCurPos) { _pShell->SetFLOAT("snd_fSoundVolume", iCurPos / FLOAT(VOLUME_STEPS)); @@ -1015,7 +965,7 @@ void InitActionsForAudioOptionsMenu() #undef CMENU // ------------------------ CVarMenu implementation -#define CMENU gmVarMenu +#define CMENU _pGUIM->gmVarMenu void VarApply(void) { @@ -1032,23 +982,23 @@ void InitActionsForVarMenu() { // ------------------------ CServersMenu implementation extern void RefreshServerList(void) { - _pNetwork->EnumSessions(gmServersMenu.m_bInternet); + _pNetwork->EnumSessions(_pGUIM->gmServersMenu.m_bInternet); } void RefreshServerListManually(void) { - ChangeToMenu(&gmServersMenu); // this refreshes the list and sets focuses + ChangeToMenu(&_pGUIM->gmServersMenu); // this refreshes the list and sets focuses } void SortByColumn(int i) { - if (gmServersMenu.gm_mgList.mg_iSort == i) { - gmServersMenu.gm_mgList.mg_bSortDown = !gmServersMenu.gm_mgList.mg_bSortDown; + if (_pGUIM->gmServersMenu.gm_mgList.mg_iSort == i) { + _pGUIM->gmServersMenu.gm_mgList.mg_bSortDown = !_pGUIM->gmServersMenu.gm_mgList.mg_bSortDown; } else { - gmServersMenu.gm_mgList.mg_bSortDown = FALSE; + _pGUIM->gmServersMenu.gm_mgList.mg_bSortDown = FALSE; } - gmServersMenu.gm_mgList.mg_iSort = i; + _pGUIM->gmServersMenu.gm_mgList.mg_iSort = i; } void SortByServer(void) { SortByColumn(0); } @@ -1063,7 +1013,7 @@ extern CMGButton mgServerColumn[7]; extern CMGEdit mgServerFilter[7]; void InitActionsForServersMenu() { - gmServersMenu.gm_mgRefresh.mg_pActivatedFunction = &RefreshServerList; + _pGUIM->gmServersMenu.gm_mgRefresh.mg_pActivatedFunction = &RefreshServerList; mgServerColumn[0].mg_pActivatedFunction = SortByServer; mgServerColumn[1].mg_pActivatedFunction = SortByMap; @@ -1075,7 +1025,7 @@ void InitActionsForServersMenu() { } // ------------------------ CNetworkMenu implementation -#define CMENU gmNetworkMenu +#define CMENU _pGUIM->gmNetworkMenu void InitActionsForNetworkMenu() { @@ -1088,7 +1038,7 @@ void InitActionsForNetworkMenu() #undef CMENU // ------------------------ CNetworkJoinMenu implementation -#define CMENU gmNetworkJoinMenu +#define CMENU _pGUIM->gmNetworkJoinMenu void InitActionsForNetworkJoinMenu() { @@ -1103,15 +1053,15 @@ void InitActionsForNetworkJoinMenu() extern void UpdateNetworkLevel(INDEX iDummy) { ValidateLevelForFlags(_pGame->gam_strCustomLevel, - GetSpawnFlagsForGameType(gmNetworkStartMenu.gm_mgGameType.mg_iSelected)); - gmNetworkStartMenu.gm_mgLevel.mg_strText = FindLevelByFileName(_pGame->gam_strCustomLevel).li_strName; + GetSpawnFlagsForGameType(_pGUIM->gmNetworkStartMenu.gm_mgGameType.mg_iSelected)); + _pGUIM->gmNetworkStartMenu.gm_mgLevel.mg_strText = FindLevelByFileName(_pGame->gam_strCustomLevel).li_strName; } void InitActionsForNetworkStartMenu() { - gmNetworkStartMenu.gm_mgLevel.mg_pActivatedFunction = &StartSelectLevelFromNetwork; - gmNetworkStartMenu.gm_mgGameOptions.mg_pActivatedFunction = &StartGameOptionsFromNetwork; - gmNetworkStartMenu.gm_mgStart.mg_pActivatedFunction = &StartSelectPlayersMenuFromNetwork; + _pGUIM->gmNetworkStartMenu.gm_mgLevel.mg_pActivatedFunction = &StartSelectLevelFromNetwork; + _pGUIM->gmNetworkStartMenu.gm_mgGameOptions.mg_pActivatedFunction = &StartGameOptionsFromNetwork; + _pGUIM->gmNetworkStartMenu.gm_mgStart.mg_pActivatedFunction = &StartSelectPlayersMenuFromNetwork; } // @@ -1131,7 +1081,7 @@ void InitActionsForNetworkStartMenu() gd.mg_iLocalPlayer = iplayer; // ------------------------ CSelectPlayersMenu implementation -#define CMENU gmSelectPlayersMenu +#define CMENU _pGUIM->gmSelectPlayersMenu INDEX FindUnusedPlayer(void) { @@ -1168,7 +1118,7 @@ extern void SelectPlayersFillMenu(void) CMENU.gm_mgDedicated.mg_iSelected = 0; } - gmSelectPlayersMenu.gm_mgDedicated.ApplyCurrentSelection(); + CMENU.gm_mgDedicated.ApplyCurrentSelection(); if (CMENU.gm_bAllowObserving && _pGame->gm_MenuSplitScreenCfg == CGame::SSC_OBSERVER) { CMENU.gm_mgObserver.mg_iSelected = 1; @@ -1319,11 +1269,11 @@ void InitActionsForSelectPlayersMenu() // ------------------------ CNetworkOpenMenu implementation void InitActionsForNetworkOpenMenu() { - gmNetworkOpenMenu.gm_mgJoin.mg_pActivatedFunction = &StartSelectPlayersMenuFromOpen; + _pGUIM->gmNetworkOpenMenu.gm_mgJoin.mg_pActivatedFunction = &StartSelectPlayersMenuFromOpen; } // ------------------------ CSplitScreenMenu implementation -#define CMENU gmSplitScreenMenu +#define CMENU _pGUIM->gmSplitScreenMenu void InitActionsForSplitScreenMenu() { @@ -1335,7 +1285,7 @@ void InitActionsForSplitScreenMenu() #undef CMENU // ------------------------ CSplitStartMenu implementation -#define CMENU gmSplitStartMenu +#define CMENU _pGUIM->gmSplitStartMenu void InitActionsForSplitStartMenu() { @@ -1347,8 +1297,8 @@ void InitActionsForSplitStartMenu() extern void UpdateSplitLevel(INDEX iDummy) { ValidateLevelForFlags(_pGame->gam_strCustomLevel, - GetSpawnFlagsForGameType(gmSplitStartMenu.gm_mgGameType.mg_iSelected)); - gmSplitStartMenu.gm_mgLevel.mg_strText = FindLevelByFileName(_pGame->gam_strCustomLevel).li_strName; + GetSpawnFlagsForGameType(CMENU.gm_mgGameType.mg_iSelected)); + CMENU.gm_mgLevel.mg_strText = FindLevelByFileName(_pGame->gam_strCustomLevel).li_strName; } #undef CMENU \ No newline at end of file diff --git a/Sources/SeriousSam/GUI/Menus/Menu_starters.cpp b/Sources/SeriousSam/GUI/Menus/Menu_starters.cpp index f34e4fe..a1259d1 100644 --- a/Sources/SeriousSam/GUI/Menus/Menu_starters.cpp +++ b/Sources/SeriousSam/GUI/Menus/Menu_starters.cpp @@ -3,35 +3,11 @@ #include "StdH.h" #include +#include "MenuManager.h" #include "Menu_starters.h" #include "MenuStuff.h" #include "LevelInfo.h" -#include "MAudioOptions.h" -#include "MConfirm.h" -#include "MControls.h" -#include "MCustomizeAxis.h" -#include "MCustomizeKeyboard.h" -#include "MCredits.h" -#include "MDisabled.h" -#include "MHighScore.h" -#include "MInGame.h" -#include "MLevels.h" -#include "MMain.h" -#include "MNetwork.h" -#include "MNetworkJoin.h" -#include "MNetworkOpen.h" -#include "MNetworkStart.h" -#include "MOptions.h" -#include "MRenderingOptions.h" -#include "MServers.h" -#include "MSinglePlayer.h" -#include "MSinglePlayerNew.h" -#include "MSplitScreen.h" -#include "MSplitStart.h" -#include "MVar.h" -#include "MVideoOptions.h" - extern void(*_pAfterLevelChosen)(void); extern BOOL _bPlayerMenuFromSinglePlayer; @@ -45,97 +21,70 @@ extern CTString _strModServerSelected; CTFileName _fnDemoToPlay; CTFileName _fnGameToLoad; -extern CConfirmMenu gmConfirmMenu; -extern CMainMenu gmMainMenu; -extern CInGameMenu gmInGameMenu; -extern CSinglePlayerMenu gmSinglePlayerMenu; -extern CSinglePlayerNewMenu gmSinglePlayerNewMenu; -extern CDisabledMenu gmDisabledFunction; -extern CLevelsMenu gmLevelsMenu; -extern CVarMenu gmVarMenu; -extern CPlayerProfileMenu gmPlayerProfile; -extern CControlsMenu gmControls; -extern CLoadSaveMenu gmLoadSaveMenu; -extern CHighScoreMenu gmHighScoreMenu; -extern CCustomizeKeyboardMenu gmCustomizeKeyboardMenu; -extern CServersMenu gmServersMenu; -extern CCustomizeAxisMenu gmCustomizeAxisMenu; -extern COptionsMenu gmOptionsMenu; -extern CVideoOptionsMenu gmVideoOptionsMenu; -extern CAudioOptionsMenu gmAudioOptionsMenu; -extern CNetworkMenu gmNetworkMenu; -extern CNetworkJoinMenu gmNetworkJoinMenu; -extern CNetworkStartMenu gmNetworkStartMenu; -extern CNetworkOpenMenu gmNetworkOpenMenu; -extern CSplitScreenMenu gmSplitScreenMenu; -extern CSplitStartMenu gmSplitStartMenu; -extern CSelectPlayersMenu gmSelectPlayersMenu; - - void StartVideoOptionsMenu(void) { - ChangeToMenu(&gmVideoOptionsMenu); + ChangeToMenu(&_pGUIM->gmVideoOptionsMenu); } void StartAudioOptionsMenu(void) { - ChangeToMenu(&gmAudioOptionsMenu); + ChangeToMenu(&_pGUIM->gmAudioOptionsMenu); } void StartNetworkMenu(void) { - ChangeToMenu(&gmNetworkMenu); + ChangeToMenu(&_pGUIM->gmNetworkMenu); } void StartNetworkJoinMenu(void) { - ChangeToMenu(&gmNetworkJoinMenu); + ChangeToMenu(&_pGUIM->gmNetworkJoinMenu); } void StartNetworkStartMenu(void) { - ChangeToMenu(&gmNetworkStartMenu); + ChangeToMenu(&_pGUIM->gmNetworkStartMenu); } void StartNetworkOpenMenu(void) { - ChangeToMenu(&gmNetworkOpenMenu); + ChangeToMenu(&_pGUIM->gmNetworkOpenMenu); } void StartSplitScreenMenu(void) { - ChangeToMenu(&gmSplitScreenMenu); + ChangeToMenu(&_pGUIM->gmSplitScreenMenu); } void StartSplitStartMenu(void) { - ChangeToMenu(&gmSplitStartMenu); + ChangeToMenu(&_pGUIM->gmSplitStartMenu); } void StartSinglePlayerNewMenuCustom(void) { - gmSinglePlayerNewMenu.gm_pgmParentMenu = &gmLevelsMenu; - ChangeToMenu(&gmSinglePlayerNewMenu); + _pGUIM->gmSinglePlayerNewMenu.gm_pgmParentMenu = &_pGUIM->gmLevelsMenu; + ChangeToMenu(&_pGUIM->gmSinglePlayerNewMenu); } static void SetQuickLoadNotes(void) { if (_pShell->GetINDEX("gam_iQuickSaveSlots") <= 8) { - gmLoadSaveMenu.gm_mgNotes.mg_strText = TRANS( + _pGUIM->gmLoadSaveMenu.gm_mgNotes.mg_strText = TRANS( "In-game QuickSave shortcuts:\n" "F6 - save a new QuickSave\n" "F9 - load the last QuickSave\n"); } else { - gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; + _pGUIM->gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; } } void StartSinglePlayerNewMenu(void) { - gmSinglePlayerNewMenu.gm_pgmParentMenu = &gmSinglePlayerMenu; + _pGUIM->gmSinglePlayerNewMenu.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu; extern CTString sam_strFirstLevel; _pGame->gam_strCustomLevel = sam_strFirstLevel; - ChangeToMenu(&gmSinglePlayerNewMenu); + ChangeToMenu(&_pGUIM->gmSinglePlayerNewMenu); } BOOL LSLoadSinglePlayer(const CTFileName &fnm) @@ -150,8 +99,7 @@ BOOL LSLoadSinglePlayer(const CTFileName &fnm) if (_pGame->LoadGame(fnm)) { StopMenus(); _gmRunningGameMode = GM_SINGLE_PLAYER; - } - else { + } else { _gmRunningGameMode = GM_NONE; } return TRUE; @@ -184,8 +132,7 @@ void StartDemoPlay(void) StopMenus(); if (_pGame->gm_csConsoleState != CS_OFF) _pGame->gm_csConsoleState = CS_TURNINGOFF; _gmRunningGameMode = GM_DEMO; - } - else { + } else { _gmRunningGameMode = GM_NONE; } } @@ -203,7 +150,7 @@ BOOL LSLoadPlayerModel(const CTFileName &fnm) // get base filename CTString strBaseName = fnm.FileName(); // set it for current player - CPlayerCharacter &pc = _pGame->gm_apcPlayers[*gmPlayerProfile.gm_piCurrentPlayer]; + CPlayerCharacter &pc = _pGame->gm_apcPlayers[*_pGUIM->gmPlayerProfile.gm_piCurrentPlayer]; CPlayerSettings *pps = (CPlayerSettings *)pc.pc_aubAppearance; memset(pps->ps_achModelFile, 0, sizeof(pps->ps_achModelFile)); strncpy(pps->ps_achModelFile, strBaseName, sizeof(pps->ps_achModelFile)); @@ -250,12 +197,12 @@ BOOL LSLoadMod(const CTFileName &fnm) BOOL LSLoadCustom(const CTFileName &fnm) { - gmVarMenu.gm_mgTitle.mg_strText = TRANS("ADVANCED OPTIONS"); + _pGUIM->gmVarMenu.gm_mgTitle.mg_strText = TRANS("ADVANCED OPTIONS"); // LoadStringVar(fnm.NoExt()+".des", mgVarTitle.mg_strText); // mgVarTitle.mg_strText.OnlyFirstLine(); - gmVarMenu.gm_fnmMenuCFG = fnm; - gmVarMenu.gm_pgmParentMenu = &gmLoadSaveMenu; - ChangeToMenu(&gmVarMenu); + _pGUIM->gmVarMenu.gm_fnmMenuCFG = fnm; + _pGUIM->gmVarMenu.gm_pgmParentMenu = &_pGUIM->gmLoadSaveMenu; + ChangeToMenu(&_pGUIM->gmVarMenu); return TRUE; } @@ -297,38 +244,38 @@ void StartSinglePlayerQuickLoadMenu(void) { _gmMenuGameMode = GM_SINGLE_PLAYER; - gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("QUICK LOAD"); - gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; - gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN; - gmLoadSaveMenu.gm_bSave = FALSE; - gmLoadSaveMenu.gm_bManage = TRUE; - gmLoadSaveMenu.gm_fnmDirectory.PrintF("SaveGame\\Player%d\\Quick\\", _pGame->gm_iSinglePlayer); - gmLoadSaveMenu.gm_fnmSelected = CTString(""); - gmLoadSaveMenu.gm_fnmExt = CTString(".sav"); - gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadSinglePlayer; + _pGUIM->gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("QUICK LOAD"); + _pGUIM->gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; + _pGUIM->gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN; + _pGUIM->gmLoadSaveMenu.gm_bSave = FALSE; + _pGUIM->gmLoadSaveMenu.gm_bManage = TRUE; + _pGUIM->gmLoadSaveMenu.gm_fnmDirectory.PrintF("SaveGame\\Player%d\\Quick\\", _pGame->gm_iSinglePlayer); + _pGUIM->gmLoadSaveMenu.gm_fnmSelected = CTString(""); + _pGUIM->gmLoadSaveMenu.gm_fnmExt = CTString(".sav"); + _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadSinglePlayer; SetQuickLoadNotes(); - gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu; - ChangeToMenu(&gmLoadSaveMenu); + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu; + ChangeToMenu(&_pGUIM->gmLoadSaveMenu); } void StartSinglePlayerLoadMenu(void) { _gmMenuGameMode = GM_SINGLE_PLAYER; - gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("LOAD"); - gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; - gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN; - gmLoadSaveMenu.gm_bSave = FALSE; - gmLoadSaveMenu.gm_bManage = TRUE; - gmLoadSaveMenu.gm_fnmDirectory.PrintF("SaveGame\\Player%d\\", _pGame->gm_iSinglePlayer); - gmLoadSaveMenu.gm_fnmSelected = CTString(""); - gmLoadSaveMenu.gm_fnmExt = CTString(".sav"); - gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadSinglePlayer; - gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; + _pGUIM->gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("LOAD"); + _pGUIM->gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; + _pGUIM->gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN; + _pGUIM->gmLoadSaveMenu.gm_bSave = FALSE; + _pGUIM->gmLoadSaveMenu.gm_bManage = TRUE; + _pGUIM->gmLoadSaveMenu.gm_fnmDirectory.PrintF("SaveGame\\Player%d\\", _pGame->gm_iSinglePlayer); + _pGUIM->gmLoadSaveMenu.gm_fnmSelected = CTString(""); + _pGUIM->gmLoadSaveMenu.gm_fnmExt = CTString(".sav"); + _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadSinglePlayer; + _pGUIM->gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; - gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu; - ChangeToMenu(&gmLoadSaveMenu); + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu; + ChangeToMenu(&_pGUIM->gmLoadSaveMenu); } void StartSinglePlayerSaveMenu(void) @@ -340,40 +287,40 @@ void StartSinglePlayerSaveMenu(void) return; } _gmMenuGameMode = GM_SINGLE_PLAYER; - gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("SAVE"); - gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; - gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN; - gmLoadSaveMenu.gm_bSave = TRUE; - gmLoadSaveMenu.gm_bManage = TRUE; - gmLoadSaveMenu.gm_fnmDirectory.PrintF("SaveGame\\Player%d\\", _pGame->gm_iSinglePlayer); - gmLoadSaveMenu.gm_fnmSelected = CTString(""); - gmLoadSaveMenu.gm_fnmBaseName = CTString("SaveGame"); - gmLoadSaveMenu.gm_fnmExt = CTString(".sav"); - gmLoadSaveMenu.gm_pAfterFileChosen = &LSSaveAnyGame; - gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; - gmLoadSaveMenu.gm_strSaveDes = _pGame->GetDefaultGameDescription(TRUE); + _pGUIM->gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("SAVE"); + _pGUIM->gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; + _pGUIM->gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN; + _pGUIM->gmLoadSaveMenu.gm_bSave = TRUE; + _pGUIM->gmLoadSaveMenu.gm_bManage = TRUE; + _pGUIM->gmLoadSaveMenu.gm_fnmDirectory.PrintF("SaveGame\\Player%d\\", _pGame->gm_iSinglePlayer); + _pGUIM->gmLoadSaveMenu.gm_fnmSelected = CTString(""); + _pGUIM->gmLoadSaveMenu.gm_fnmBaseName = CTString("SaveGame"); + _pGUIM->gmLoadSaveMenu.gm_fnmExt = CTString(".sav"); + _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen = &LSSaveAnyGame; + _pGUIM->gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; + _pGUIM->gmLoadSaveMenu.gm_strSaveDes = _pGame->GetDefaultGameDescription(TRUE); - gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu; - ChangeToMenu(&gmLoadSaveMenu); + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu; + ChangeToMenu(&_pGUIM->gmLoadSaveMenu); } void StartDemoLoadMenu(void) { _gmMenuGameMode = GM_DEMO; - gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("PLAY DEMO"); - gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; - gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN; - gmLoadSaveMenu.gm_bSave = FALSE; - gmLoadSaveMenu.gm_bManage = TRUE; - gmLoadSaveMenu.gm_fnmDirectory = CTString("Demos\\"); - gmLoadSaveMenu.gm_fnmSelected = CTString(""); - gmLoadSaveMenu.gm_fnmExt = CTString(".dem"); - gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadDemo; - gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; + _pGUIM->gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("PLAY DEMO"); + _pGUIM->gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; + _pGUIM->gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN; + _pGUIM->gmLoadSaveMenu.gm_bSave = FALSE; + _pGUIM->gmLoadSaveMenu.gm_bManage = TRUE; + _pGUIM->gmLoadSaveMenu.gm_fnmDirectory = CTString("Demos\\"); + _pGUIM->gmLoadSaveMenu.gm_fnmSelected = CTString(""); + _pGUIM->gmLoadSaveMenu.gm_fnmExt = CTString(".dem"); + _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadDemo; + _pGUIM->gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; - gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu; - ChangeToMenu(&gmLoadSaveMenu); + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu; + ChangeToMenu(&_pGUIM->gmLoadSaveMenu); } void StartDemoSaveMenu(void) @@ -381,59 +328,59 @@ void StartDemoSaveMenu(void) if (_gmRunningGameMode == GM_NONE) return; _gmMenuGameMode = GM_DEMO; - gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("RECORD DEMO"); - gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; - gmLoadSaveMenu.gm_iSortType = LSSORT_FILEUP; - gmLoadSaveMenu.gm_bSave = TRUE; - gmLoadSaveMenu.gm_bManage = TRUE; - gmLoadSaveMenu.gm_fnmDirectory = CTString("Demos\\"); - gmLoadSaveMenu.gm_fnmSelected = CTString(""); - gmLoadSaveMenu.gm_fnmBaseName = CTString("Demo"); - gmLoadSaveMenu.gm_fnmExt = CTString(".dem"); - gmLoadSaveMenu.gm_pAfterFileChosen = &LSSaveDemo; - gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; - gmLoadSaveMenu.gm_strSaveDes = _pGame->GetDefaultGameDescription(FALSE); + _pGUIM->gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("RECORD DEMO"); + _pGUIM->gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; + _pGUIM->gmLoadSaveMenu.gm_iSortType = LSSORT_FILEUP; + _pGUIM->gmLoadSaveMenu.gm_bSave = TRUE; + _pGUIM->gmLoadSaveMenu.gm_bManage = TRUE; + _pGUIM->gmLoadSaveMenu.gm_fnmDirectory = CTString("Demos\\"); + _pGUIM->gmLoadSaveMenu.gm_fnmSelected = CTString(""); + _pGUIM->gmLoadSaveMenu.gm_fnmBaseName = CTString("Demo"); + _pGUIM->gmLoadSaveMenu.gm_fnmExt = CTString(".dem"); + _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen = &LSSaveDemo; + _pGUIM->gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; + _pGUIM->gmLoadSaveMenu.gm_strSaveDes = _pGame->GetDefaultGameDescription(FALSE); - gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu; - ChangeToMenu(&gmLoadSaveMenu); + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu; + ChangeToMenu(&_pGUIM->gmLoadSaveMenu); } void StartNetworkQuickLoadMenu(void) { _gmMenuGameMode = GM_NETWORK; - gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("QUICK LOAD"); - gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; - gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN; - gmLoadSaveMenu.gm_bSave = FALSE; - gmLoadSaveMenu.gm_bManage = TRUE; - gmLoadSaveMenu.gm_fnmDirectory = CTString("SaveGame\\Network\\Quick\\"); - gmLoadSaveMenu.gm_fnmSelected = CTString(""); - gmLoadSaveMenu.gm_fnmExt = CTString(".sav"); - gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadNetwork; + _pGUIM->gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("QUICK LOAD"); + _pGUIM->gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; + _pGUIM->gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN; + _pGUIM->gmLoadSaveMenu.gm_bSave = FALSE; + _pGUIM->gmLoadSaveMenu.gm_bManage = TRUE; + _pGUIM->gmLoadSaveMenu.gm_fnmDirectory = CTString("SaveGame\\Network\\Quick\\"); + _pGUIM->gmLoadSaveMenu.gm_fnmSelected = CTString(""); + _pGUIM->gmLoadSaveMenu.gm_fnmExt = CTString(".sav"); + _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadNetwork; SetQuickLoadNotes(); - gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu; - ChangeToMenu(&gmLoadSaveMenu); + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu; + ChangeToMenu(&_pGUIM->gmLoadSaveMenu); } void StartNetworkLoadMenu(void) { _gmMenuGameMode = GM_NETWORK; - gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("LOAD"); - gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; - gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN; - gmLoadSaveMenu.gm_bSave = FALSE; - gmLoadSaveMenu.gm_bManage = TRUE; - gmLoadSaveMenu.gm_fnmDirectory = CTString("SaveGame\\Network\\"); - gmLoadSaveMenu.gm_fnmSelected = CTString(""); - gmLoadSaveMenu.gm_fnmExt = CTString(".sav"); - gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadNetwork; - gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; + _pGUIM->gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("LOAD"); + _pGUIM->gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; + _pGUIM->gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN; + _pGUIM->gmLoadSaveMenu.gm_bSave = FALSE; + _pGUIM->gmLoadSaveMenu.gm_bManage = TRUE; + _pGUIM->gmLoadSaveMenu.gm_fnmDirectory = CTString("SaveGame\\Network\\"); + _pGUIM->gmLoadSaveMenu.gm_fnmSelected = CTString(""); + _pGUIM->gmLoadSaveMenu.gm_fnmExt = CTString(".sav"); + _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadNetwork; + _pGUIM->gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; - gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu; - ChangeToMenu(&gmLoadSaveMenu); + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu; + ChangeToMenu(&_pGUIM->gmLoadSaveMenu); } void StartNetworkSaveMenu(void) @@ -441,59 +388,59 @@ void StartNetworkSaveMenu(void) if (_gmRunningGameMode != GM_NETWORK) return; _gmMenuGameMode = GM_NETWORK; - gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("SAVE"); - gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; - gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN; - gmLoadSaveMenu.gm_bSave = TRUE; - gmLoadSaveMenu.gm_bManage = TRUE; - gmLoadSaveMenu.gm_fnmDirectory = CTString("SaveGame\\Network\\"); - gmLoadSaveMenu.gm_fnmSelected = CTString(""); - gmLoadSaveMenu.gm_fnmBaseName = CTString("SaveGame"); - gmLoadSaveMenu.gm_fnmExt = CTString(".sav"); - gmLoadSaveMenu.gm_pAfterFileChosen = &LSSaveAnyGame; - gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; - gmLoadSaveMenu.gm_strSaveDes = _pGame->GetDefaultGameDescription(TRUE); + _pGUIM->gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("SAVE"); + _pGUIM->gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; + _pGUIM->gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN; + _pGUIM->gmLoadSaveMenu.gm_bSave = TRUE; + _pGUIM->gmLoadSaveMenu.gm_bManage = TRUE; + _pGUIM->gmLoadSaveMenu.gm_fnmDirectory = CTString("SaveGame\\Network\\"); + _pGUIM->gmLoadSaveMenu.gm_fnmSelected = CTString(""); + _pGUIM->gmLoadSaveMenu.gm_fnmBaseName = CTString("SaveGame"); + _pGUIM->gmLoadSaveMenu.gm_fnmExt = CTString(".sav"); + _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen = &LSSaveAnyGame; + _pGUIM->gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; + _pGUIM->gmLoadSaveMenu.gm_strSaveDes = _pGame->GetDefaultGameDescription(TRUE); - gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu; - ChangeToMenu(&gmLoadSaveMenu); + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu; + ChangeToMenu(&_pGUIM->gmLoadSaveMenu); } void StartSplitScreenQuickLoadMenu(void) { _gmMenuGameMode = GM_SPLIT_SCREEN; - gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("QUICK LOAD"); - gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; - gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN; - gmLoadSaveMenu.gm_bSave = FALSE; - gmLoadSaveMenu.gm_bManage = TRUE; - gmLoadSaveMenu.gm_fnmDirectory = CTString("SaveGame\\SplitScreen\\Quick\\"); - gmLoadSaveMenu.gm_fnmSelected = CTString(""); - gmLoadSaveMenu.gm_fnmExt = CTString(".sav"); - gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadSplitScreen; + _pGUIM->gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("QUICK LOAD"); + _pGUIM->gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; + _pGUIM->gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN; + _pGUIM->gmLoadSaveMenu.gm_bSave = FALSE; + _pGUIM->gmLoadSaveMenu.gm_bManage = TRUE; + _pGUIM->gmLoadSaveMenu.gm_fnmDirectory = CTString("SaveGame\\SplitScreen\\Quick\\"); + _pGUIM->gmLoadSaveMenu.gm_fnmSelected = CTString(""); + _pGUIM->gmLoadSaveMenu.gm_fnmExt = CTString(".sav"); + _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadSplitScreen; SetQuickLoadNotes(); - gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu; - ChangeToMenu(&gmLoadSaveMenu); + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu; + ChangeToMenu(&_pGUIM->gmLoadSaveMenu); } void StartSplitScreenLoadMenu(void) { _gmMenuGameMode = GM_SPLIT_SCREEN; - gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("LOAD"); - gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; - gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN; - gmLoadSaveMenu.gm_bSave = FALSE; - gmLoadSaveMenu.gm_bManage = TRUE; - gmLoadSaveMenu.gm_fnmDirectory = CTString("SaveGame\\SplitScreen\\"); - gmLoadSaveMenu.gm_fnmSelected = CTString(""); - gmLoadSaveMenu.gm_fnmExt = CTString(".sav"); - gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadSplitScreen; - gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; + _pGUIM->gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("LOAD"); + _pGUIM->gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; + _pGUIM->gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN; + _pGUIM->gmLoadSaveMenu.gm_bSave = FALSE; + _pGUIM->gmLoadSaveMenu.gm_bManage = TRUE; + _pGUIM->gmLoadSaveMenu.gm_fnmDirectory = CTString("SaveGame\\SplitScreen\\"); + _pGUIM->gmLoadSaveMenu.gm_fnmSelected = CTString(""); + _pGUIM->gmLoadSaveMenu.gm_fnmExt = CTString(".sav"); + _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadSplitScreen; + _pGUIM->gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; - gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu; - ChangeToMenu(&gmLoadSaveMenu); + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu; + ChangeToMenu(&_pGUIM->gmLoadSaveMenu); } void StartSplitScreenSaveMenu(void) @@ -501,74 +448,74 @@ void StartSplitScreenSaveMenu(void) if (_gmRunningGameMode != GM_SPLIT_SCREEN) return; _gmMenuGameMode = GM_SPLIT_SCREEN; - gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("SAVE"); - gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; - gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN; - gmLoadSaveMenu.gm_bSave = TRUE; - gmLoadSaveMenu.gm_bManage = TRUE; - gmLoadSaveMenu.gm_fnmDirectory = CTString("SaveGame\\SplitScreen\\"); - gmLoadSaveMenu.gm_fnmSelected = CTString(""); - gmLoadSaveMenu.gm_fnmBaseName = CTString("SaveGame"); - gmLoadSaveMenu.gm_fnmExt = CTString(".sav"); - gmLoadSaveMenu.gm_pAfterFileChosen = &LSSaveAnyGame; - gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; - gmLoadSaveMenu.gm_strSaveDes = _pGame->GetDefaultGameDescription(TRUE); + _pGUIM->gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("SAVE"); + _pGUIM->gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; + _pGUIM->gmLoadSaveMenu.gm_iSortType = LSSORT_FILEDN; + _pGUIM->gmLoadSaveMenu.gm_bSave = TRUE; + _pGUIM->gmLoadSaveMenu.gm_bManage = TRUE; + _pGUIM->gmLoadSaveMenu.gm_fnmDirectory = CTString("SaveGame\\SplitScreen\\"); + _pGUIM->gmLoadSaveMenu.gm_fnmSelected = CTString(""); + _pGUIM->gmLoadSaveMenu.gm_fnmBaseName = CTString("SaveGame"); + _pGUIM->gmLoadSaveMenu.gm_fnmExt = CTString(".sav"); + _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen = &LSSaveAnyGame; + _pGUIM->gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; + _pGUIM->gmLoadSaveMenu.gm_strSaveDes = _pGame->GetDefaultGameDescription(TRUE); - gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu; - ChangeToMenu(&gmLoadSaveMenu); + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = pgmCurrentMenu; + ChangeToMenu(&_pGUIM->gmLoadSaveMenu); } // game options var settings void StartVarGameOptions(void) { - gmVarMenu.gm_mgTitle.mg_strText = TRANS("GAME OPTIONS"); - gmVarMenu.gm_fnmMenuCFG = CTFILENAME("Scripts\\Menu\\GameOptions.cfg"); - ChangeToMenu(&gmVarMenu); + _pGUIM->gmVarMenu.gm_mgTitle.mg_strText = TRANS("GAME OPTIONS"); + _pGUIM->gmVarMenu.gm_fnmMenuCFG = CTFILENAME("Scripts\\Menu\\GameOptions.cfg"); + ChangeToMenu(&_pGUIM->gmVarMenu); } void StartSinglePlayerGameOptions(void) { - gmVarMenu.gm_mgTitle.mg_strText = TRANS("GAME OPTIONS"); - gmVarMenu.gm_fnmMenuCFG = CTFILENAME("Scripts\\Menu\\SPOptions.cfg"); - ChangeToMenu(&gmVarMenu); - gmVarMenu.gm_pgmParentMenu = &gmSinglePlayerMenu; + _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(); - gmVarMenu.gm_pgmParentMenu = &gmNetworkStartMenu; + _pGUIM->gmVarMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkStartMenu; } void StartGameOptionsFromSplitScreen(void) { StartVarGameOptions(); - gmVarMenu.gm_pgmParentMenu = &gmSplitStartMenu; + _pGUIM->gmVarMenu.gm_pgmParentMenu = &_pGUIM->gmSplitStartMenu; } // rendering options var settings void StartRenderingOptionsMenu(void) { - gmVarMenu.gm_mgTitle.mg_strText = TRANS("RENDERING OPTIONS"); - gmVarMenu.gm_fnmMenuCFG = CTFILENAME("Scripts\\Menu\\RenderingOptions.cfg"); - gmVarMenu.gm_pgmParentMenu = &gmVideoOptionsMenu; - ChangeToMenu(&gmVarMenu); + _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(&gmCustomizeKeyboardMenu); + ChangeToMenu(&_pGUIM->gmCustomizeKeyboardMenu); } void StartCustomizeAxisMenu(void) { - ChangeToMenu(&gmCustomizeAxisMenu); + ChangeToMenu(&_pGUIM->gmCustomizeAxisMenu); } void StartOptionsMenu(void) { - gmOptionsMenu.gm_pgmParentMenu = pgmCurrentMenu; - ChangeToMenu(&gmOptionsMenu); + _pGUIM->gmOptionsMenu.gm_pgmParentMenu = pgmCurrentMenu; + ChangeToMenu(&_pGUIM->gmOptionsMenu); } void StartCurrentLoadMenu() @@ -576,12 +523,10 @@ void StartCurrentLoadMenu() if (_gmRunningGameMode == GM_NETWORK) { void StartNetworkLoadMenu(void); StartNetworkLoadMenu(); - } - else if (_gmRunningGameMode == GM_SPLIT_SCREEN) { + } else if (_gmRunningGameMode == GM_SPLIT_SCREEN) { void StartSplitScreenLoadMenu(void); StartSplitScreenLoadMenu(); - } - else { + } else { void StartSinglePlayerLoadMenu(void); StartSinglePlayerLoadMenu(); } @@ -592,12 +537,10 @@ void StartCurrentSaveMenu() if (_gmRunningGameMode == GM_NETWORK) { void StartNetworkSaveMenu(void); StartNetworkSaveMenu(); - } - else if (_gmRunningGameMode == GM_SPLIT_SCREEN) { + } else if (_gmRunningGameMode == GM_SPLIT_SCREEN) { void StartSplitScreenSaveMenu(void); StartSplitScreenSaveMenu(); - } - else { + } else { void StartSinglePlayerSaveMenu(void); StartSinglePlayerSaveMenu(); } @@ -608,12 +551,10 @@ void StartCurrentQuickLoadMenu() if (_gmRunningGameMode == GM_NETWORK) { void StartNetworkQuickLoadMenu(void); StartNetworkQuickLoadMenu(); - } - else if (_gmRunningGameMode == GM_SPLIT_SCREEN) { + } else if (_gmRunningGameMode == GM_SPLIT_SCREEN) { void StartSplitScreenQuickLoadMenu(void); StartSplitScreenQuickLoadMenu(); - } - else { + } else { void StartSinglePlayerQuickLoadMenu(void); StartSinglePlayerQuickLoadMenu(); } @@ -622,44 +563,44 @@ void StartCurrentQuickLoadMenu() void StartChangePlayerMenuFromOptions(void) { _bPlayerMenuFromSinglePlayer = FALSE; - gmPlayerProfile.gm_piCurrentPlayer = &_pGame->gm_iSinglePlayer; - gmPlayerProfile.gm_pgmParentMenu = &gmOptionsMenu; - ChangeToMenu(&gmPlayerProfile); + _pGUIM->gmPlayerProfile.gm_piCurrentPlayer = &_pGame->gm_iSinglePlayer; + _pGUIM->gmPlayerProfile.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu; + ChangeToMenu(&_pGUIM->gmPlayerProfile); } void StartChangePlayerMenuFromSinglePlayer(void) { _iLocalPlayer = -1; _bPlayerMenuFromSinglePlayer = TRUE; - gmPlayerProfile.gm_piCurrentPlayer = &_pGame->gm_iSinglePlayer; - gmPlayerProfile.gm_pgmParentMenu = &gmSinglePlayerMenu; - ChangeToMenu(&gmPlayerProfile); + _pGUIM->gmPlayerProfile.gm_piCurrentPlayer = &_pGame->gm_iSinglePlayer; + _pGUIM->gmPlayerProfile.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu; + ChangeToMenu(&_pGUIM->gmPlayerProfile); } void StartControlsMenuFromPlayer(void) { - gmControls.gm_pgmParentMenu = &gmPlayerProfile; - ChangeToMenu(&gmControls); + _pGUIM->gmControls.gm_pgmParentMenu = &_pGUIM->gmPlayerProfile; + ChangeToMenu(&_pGUIM->gmControls); } void StartControlsMenuFromOptions(void) { - gmControls.gm_pgmParentMenu = &gmOptionsMenu; - ChangeToMenu(&gmControls); + _pGUIM->gmControls.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu; + ChangeToMenu(&_pGUIM->gmControls); } void StartSelectLevelFromSingle(void) { FilterLevels(GetSpawnFlagsForGameType(-1)); _pAfterLevelChosen = StartSinglePlayerNewMenuCustom; - ChangeToMenu(&gmLevelsMenu); - gmLevelsMenu.gm_pgmParentMenu = &gmSinglePlayerMenu; + ChangeToMenu(&_pGUIM->gmLevelsMenu); + _pGUIM->gmLevelsMenu.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu; } void StartHighScoreMenu(void) { - gmHighScoreMenu.gm_pgmParentMenu = pgmCurrentMenu; - ChangeToMenu(&gmHighScoreMenu); + _pGUIM->gmHighScoreMenu.gm_pgmParentMenu = pgmCurrentMenu; + ChangeToMenu(&_pGUIM->gmHighScoreMenu); } void StartSplitScreenGame(void) @@ -681,19 +622,18 @@ void StartSplitScreenGame(void) { StopMenus(); _gmRunningGameMode = GM_SPLIT_SCREEN; - } - else { + } else { _gmRunningGameMode = GM_NONE; } } void StartSelectPlayersMenuFromSplit(void) { - gmSelectPlayersMenu.gm_bAllowDedicated = FALSE; - gmSelectPlayersMenu.gm_bAllowObserving = FALSE; - gmSelectPlayersMenu.gm_mgStart.mg_pActivatedFunction = &StartSplitScreenGame; - gmSelectPlayersMenu.gm_pgmParentMenu = &gmSplitStartMenu; - ChangeToMenu(&gmSelectPlayersMenu); + _pGUIM->gmSelectPlayersMenu.gm_bAllowDedicated = FALSE; + _pGUIM->gmSelectPlayersMenu.gm_bAllowObserving = FALSE; + _pGUIM->gmSelectPlayersMenu.gm_mgStart.mg_pActivatedFunction = &StartSplitScreenGame; + _pGUIM->gmSelectPlayersMenu.gm_pgmParentMenu = &_pGUIM->gmSplitStartMenu; + ChangeToMenu(&_pGUIM->gmSelectPlayersMenu); } void StartNetworkGame(void) @@ -721,19 +661,18 @@ void StartNetworkGame(void) extern INDEX sam_bToggleConsole; sam_bToggleConsole = TRUE; } - } - else { + } else { _gmRunningGameMode = GM_NONE; } } void StartSelectPlayersMenuFromNetwork(void) { - gmSelectPlayersMenu.gm_bAllowDedicated = TRUE; - gmSelectPlayersMenu.gm_bAllowObserving = TRUE; - gmSelectPlayersMenu.gm_mgStart.mg_pActivatedFunction = &StartNetworkGame; - gmSelectPlayersMenu.gm_pgmParentMenu = &gmNetworkStartMenu; - ChangeToMenu(&gmSelectPlayersMenu); + _pGUIM->gmSelectPlayersMenu.gm_bAllowDedicated = TRUE; + _pGUIM->gmSelectPlayersMenu.gm_bAllowObserving = TRUE; + _pGUIM->gmSelectPlayersMenu.gm_mgStart.mg_pActivatedFunction = &StartNetworkGame; + _pGUIM->gmSelectPlayersMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkStartMenu; + ChangeToMenu(&_pGUIM->gmSelectPlayersMenu); } void JoinNetworkGame(void) @@ -751,8 +690,7 @@ void JoinNetworkGame(void) { StopMenus(); _gmRunningGameMode = GM_NETWORK; - } - else { + } else { if (_pNetwork->ga_strRequiredMod != "") { extern CTFileName _fnmModToLoad; extern CTString _strModServerJoin; @@ -774,81 +712,80 @@ void JoinNetworkGame(void) void StartSelectPlayersMenuFromOpen(void) { - gmSelectPlayersMenu.gm_bAllowDedicated = FALSE; - gmSelectPlayersMenu.gm_bAllowObserving = TRUE; - gmSelectPlayersMenu.gm_mgStart.mg_pActivatedFunction = &JoinNetworkGame; - gmSelectPlayersMenu.gm_pgmParentMenu = &gmNetworkOpenMenu; - ChangeToMenu(&gmSelectPlayersMenu); + _pGUIM->gmSelectPlayersMenu.gm_bAllowDedicated = FALSE; + _pGUIM->gmSelectPlayersMenu.gm_bAllowObserving = TRUE; + _pGUIM->gmSelectPlayersMenu.gm_mgStart.mg_pActivatedFunction = &JoinNetworkGame; + _pGUIM->gmSelectPlayersMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkOpenMenu; + ChangeToMenu(&_pGUIM->gmSelectPlayersMenu); /*if (sam_strNetworkSettings=="")*/ { void StartNetworkSettingsMenu(void); StartNetworkSettingsMenu(); - gmLoadSaveMenu.gm_bNoEscape = TRUE; - gmLoadSaveMenu.gm_pgmParentMenu = &gmNetworkOpenMenu; - gmLoadSaveMenu.gm_pgmNextMenu = &gmSelectPlayersMenu; + _pGUIM->gmLoadSaveMenu.gm_bNoEscape = TRUE; + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkOpenMenu; + _pGUIM->gmLoadSaveMenu.gm_pgmNextMenu = &_pGUIM->gmSelectPlayersMenu; } } void StartSelectPlayersMenuFromServers(void) { - gmSelectPlayersMenu.gm_bAllowDedicated = FALSE; - gmSelectPlayersMenu.gm_bAllowObserving = TRUE; - gmSelectPlayersMenu.gm_mgStart.mg_pActivatedFunction = &JoinNetworkGame; - gmSelectPlayersMenu.gm_pgmParentMenu = &gmServersMenu; - ChangeToMenu(&gmSelectPlayersMenu); + _pGUIM->gmSelectPlayersMenu.gm_bAllowDedicated = FALSE; + _pGUIM->gmSelectPlayersMenu.gm_bAllowObserving = TRUE; + _pGUIM->gmSelectPlayersMenu.gm_mgStart.mg_pActivatedFunction = &JoinNetworkGame; + _pGUIM->gmSelectPlayersMenu.gm_pgmParentMenu = &_pGUIM->gmServersMenu; + ChangeToMenu(&_pGUIM->gmSelectPlayersMenu); /*if (sam_strNetworkSettings=="")*/ { void StartNetworkSettingsMenu(void); StartNetworkSettingsMenu(); - gmLoadSaveMenu.gm_bNoEscape = TRUE; - gmLoadSaveMenu.gm_pgmParentMenu = &gmServersMenu; - gmLoadSaveMenu.gm_pgmNextMenu = &gmSelectPlayersMenu; + _pGUIM->gmLoadSaveMenu.gm_bNoEscape = TRUE; + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = &_pGUIM->gmServersMenu; + _pGUIM->gmLoadSaveMenu.gm_pgmNextMenu = &_pGUIM->gmSelectPlayersMenu; } } void StartSelectServerLAN(void) { - gmServersMenu.m_bInternet = FALSE; - ChangeToMenu(&gmServersMenu); - gmServersMenu.gm_pgmParentMenu = &gmNetworkJoinMenu; + _pGUIM->gmServersMenu.m_bInternet = FALSE; + ChangeToMenu(&_pGUIM->gmServersMenu); + _pGUIM->gmServersMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkJoinMenu; } void StartSelectServerNET(void) { - gmServersMenu.m_bInternet = TRUE; - ChangeToMenu(&gmServersMenu); - gmServersMenu.gm_pgmParentMenu = &gmNetworkJoinMenu; + _pGUIM->gmServersMenu.m_bInternet = TRUE; + ChangeToMenu(&_pGUIM->gmServersMenu); + _pGUIM->gmServersMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkJoinMenu; } void StartSelectLevelFromSplit(void) { - FilterLevels(GetSpawnFlagsForGameType(gmSplitStartMenu.gm_mgGameType.mg_iSelected)); + FilterLevels(GetSpawnFlagsForGameType(_pGUIM->gmSplitStartMenu.gm_mgGameType.mg_iSelected)); void StartSplitStartMenu(void); _pAfterLevelChosen = StartSplitStartMenu; - ChangeToMenu(&gmLevelsMenu); - gmLevelsMenu.gm_pgmParentMenu = &gmSplitStartMenu; + ChangeToMenu(&_pGUIM->gmLevelsMenu); + _pGUIM->gmLevelsMenu.gm_pgmParentMenu = &_pGUIM->gmSplitStartMenu; } void StartSelectLevelFromNetwork(void) { - FilterLevels(GetSpawnFlagsForGameType(gmNetworkStartMenu.gm_mgGameType.mg_iSelected)); + FilterLevels(GetSpawnFlagsForGameType(_pGUIM->gmNetworkStartMenu.gm_mgGameType.mg_iSelected)); void StartNetworkStartMenu(void); _pAfterLevelChosen = StartNetworkStartMenu; - ChangeToMenu(&gmLevelsMenu); - gmLevelsMenu.gm_pgmParentMenu = &gmNetworkStartMenu; + ChangeToMenu(&_pGUIM->gmLevelsMenu); + _pGUIM->gmLevelsMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkStartMenu; } void StartSelectPlayersMenuFromSplitScreen(void) { - gmSelectPlayersMenu.gm_bAllowDedicated = FALSE; - gmSelectPlayersMenu.gm_bAllowObserving = FALSE; + _pGUIM->gmSelectPlayersMenu.gm_bAllowDedicated = FALSE; + _pGUIM->gmSelectPlayersMenu.gm_bAllowObserving = FALSE; // gmSelectPlayersMenu.gm_mgStart.mg_pActivatedFunction = &StartSplitScreenGame; - gmSelectPlayersMenu.gm_pgmParentMenu = &gmSplitScreenMenu; - ChangeToMenu(&gmSelectPlayersMenu); + _pGUIM->gmSelectPlayersMenu.gm_pgmParentMenu = &_pGUIM->gmSplitScreenMenu; + ChangeToMenu(&_pGUIM->gmSelectPlayersMenu); } void StartNetworkLoadGame(void) { - // _pGame->gm_MenuSplitScreenCfg = (enum CGame::SplitScreenCfg) mgSplitScreenCfg.mg_iSelected; _pGame->gm_StartSplitScreenCfg = _pGame->gm_MenuSplitScreenCfg; @@ -862,19 +799,18 @@ void StartNetworkLoadGame(void) { StopMenus(); _gmRunningGameMode = GM_NETWORK; - } - else { + } else { _gmRunningGameMode = GM_NONE; } } void StartSelectPlayersMenuFromNetworkLoad(void) { - gmSelectPlayersMenu.gm_bAllowDedicated = FALSE; - gmSelectPlayersMenu.gm_bAllowObserving = TRUE; - gmSelectPlayersMenu.gm_mgStart.mg_pActivatedFunction = &StartNetworkLoadGame; - gmSelectPlayersMenu.gm_pgmParentMenu = &gmLoadSaveMenu; - ChangeToMenu(&gmSelectPlayersMenu); + _pGUIM->gmSelectPlayersMenu.gm_bAllowDedicated = FALSE; + _pGUIM->gmSelectPlayersMenu.gm_bAllowObserving = TRUE; + _pGUIM->gmSelectPlayersMenu.gm_mgStart.mg_pActivatedFunction = &StartNetworkLoadGame; + _pGUIM->gmSelectPlayersMenu.gm_pgmParentMenu = &_pGUIM->gmLoadSaveMenu; + ChangeToMenu(&_pGUIM->gmSelectPlayersMenu); } void StartSplitScreenGameLoad(void) @@ -898,127 +834,126 @@ void StartSplitScreenGameLoad(void) void StartSelectPlayersMenuFromSplitScreenLoad(void) { - gmSelectPlayersMenu.gm_bAllowDedicated = FALSE; - gmSelectPlayersMenu.gm_bAllowObserving = FALSE; - gmSelectPlayersMenu.gm_mgStart.mg_pActivatedFunction = &StartSplitScreenGameLoad; - gmSelectPlayersMenu.gm_pgmParentMenu = &gmLoadSaveMenu; - ChangeToMenu(&gmSelectPlayersMenu); + _pGUIM->gmSelectPlayersMenu.gm_bAllowDedicated = FALSE; + _pGUIM->gmSelectPlayersMenu.gm_bAllowObserving = FALSE; + _pGUIM->gmSelectPlayersMenu.gm_mgStart.mg_pActivatedFunction = &StartSplitScreenGameLoad; + _pGUIM->gmSelectPlayersMenu.gm_pgmParentMenu = &_pGUIM->gmLoadSaveMenu; + ChangeToMenu(&_pGUIM->gmSelectPlayersMenu); } // save/load menu calling functions void StartPlayerModelLoadMenu(void) { - gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("CHOOSE MODEL"); - gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; - gmLoadSaveMenu.gm_iSortType = LSSORT_FILEUP; - gmLoadSaveMenu.gm_bSave = FALSE; - gmLoadSaveMenu.gm_bManage = FALSE; - gmLoadSaveMenu.gm_fnmDirectory = CTString("Models\\Player\\"); - gmLoadSaveMenu.gm_fnmSelected = _strLastPlayerAppearance; - gmLoadSaveMenu.gm_fnmExt = CTString(".amc"); - gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadPlayerModel; - gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; + _pGUIM->gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("CHOOSE MODEL"); + _pGUIM->gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; + _pGUIM->gmLoadSaveMenu.gm_iSortType = LSSORT_FILEUP; + _pGUIM->gmLoadSaveMenu.gm_bSave = FALSE; + _pGUIM->gmLoadSaveMenu.gm_bManage = FALSE; + _pGUIM->gmLoadSaveMenu.gm_fnmDirectory = CTString("Models\\Player\\"); + _pGUIM->gmLoadSaveMenu.gm_fnmSelected = _strLastPlayerAppearance; + _pGUIM->gmLoadSaveMenu.gm_fnmExt = CTString(".amc"); + _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadPlayerModel; + _pGUIM->gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; - gmLoadSaveMenu.gm_pgmParentMenu = &gmPlayerProfile; - ChangeToMenu(&gmLoadSaveMenu); + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = &_pGUIM->gmPlayerProfile; + ChangeToMenu(&_pGUIM->gmLoadSaveMenu); } void StartControlsLoadMenu(void) { - gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("LOAD CONTROLS"); - gmLoadSaveMenu.gm_bAllowThumbnails = FALSE; - gmLoadSaveMenu.gm_iSortType = LSSORT_FILEUP; - gmLoadSaveMenu.gm_bSave = FALSE; - gmLoadSaveMenu.gm_bManage = FALSE; - gmLoadSaveMenu.gm_fnmDirectory = CTString("Controls\\"); - gmLoadSaveMenu.gm_fnmSelected = CTString(""); - gmLoadSaveMenu.gm_fnmExt = CTString(".ctl"); - gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadControls; - gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; + _pGUIM->gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("LOAD CONTROLS"); + _pGUIM->gmLoadSaveMenu.gm_bAllowThumbnails = FALSE; + _pGUIM->gmLoadSaveMenu.gm_iSortType = LSSORT_FILEUP; + _pGUIM->gmLoadSaveMenu.gm_bSave = FALSE; + _pGUIM->gmLoadSaveMenu.gm_bManage = FALSE; + _pGUIM->gmLoadSaveMenu.gm_fnmDirectory = CTString("Controls\\"); + _pGUIM->gmLoadSaveMenu.gm_fnmSelected = CTString(""); + _pGUIM->gmLoadSaveMenu.gm_fnmExt = CTString(".ctl"); + _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadControls; + _pGUIM->gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; - gmLoadSaveMenu.gm_pgmParentMenu = &gmControls; - ChangeToMenu(&gmLoadSaveMenu); + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = &_pGUIM->gmControls; + ChangeToMenu(&_pGUIM->gmLoadSaveMenu); } void StartCustomLoadMenu(void) { - gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("ADVANCED OPTIONS"); - gmLoadSaveMenu.gm_bAllowThumbnails = FALSE; - gmLoadSaveMenu.gm_iSortType = LSSORT_NAMEUP; - gmLoadSaveMenu.gm_bSave = FALSE; - gmLoadSaveMenu.gm_bManage = FALSE; - gmLoadSaveMenu.gm_fnmDirectory = CTString("Scripts\\CustomOptions\\"); - gmLoadSaveMenu.gm_fnmSelected = CTString(""); - gmLoadSaveMenu.gm_fnmExt = CTString(".cfg"); - gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadCustom; - gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; + _pGUIM->gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("ADVANCED OPTIONS"); + _pGUIM->gmLoadSaveMenu.gm_bAllowThumbnails = FALSE; + _pGUIM->gmLoadSaveMenu.gm_iSortType = LSSORT_NAMEUP; + _pGUIM->gmLoadSaveMenu.gm_bSave = FALSE; + _pGUIM->gmLoadSaveMenu.gm_bManage = FALSE; + _pGUIM->gmLoadSaveMenu.gm_fnmDirectory = CTString("Scripts\\CustomOptions\\"); + _pGUIM->gmLoadSaveMenu.gm_fnmSelected = CTString(""); + _pGUIM->gmLoadSaveMenu.gm_fnmExt = CTString(".cfg"); + _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadCustom; + _pGUIM->gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; - gmLoadSaveMenu.gm_pgmParentMenu = &gmOptionsMenu; - ChangeToMenu(&gmLoadSaveMenu); + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu; + ChangeToMenu(&_pGUIM->gmLoadSaveMenu); } void StartAddonsLoadMenu(void) { - gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("EXECUTE ADDON"); - gmLoadSaveMenu.gm_bAllowThumbnails = FALSE; - gmLoadSaveMenu.gm_iSortType = LSSORT_NAMEUP; - gmLoadSaveMenu.gm_bSave = FALSE; - gmLoadSaveMenu.gm_bManage = FALSE; - gmLoadSaveMenu.gm_fnmDirectory = CTString("Scripts\\Addons\\"); - gmLoadSaveMenu.gm_fnmSelected = CTString(""); - gmLoadSaveMenu.gm_fnmExt = CTString(".ini"); - gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadAddon; - gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; + _pGUIM->gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("EXECUTE ADDON"); + _pGUIM->gmLoadSaveMenu.gm_bAllowThumbnails = FALSE; + _pGUIM->gmLoadSaveMenu.gm_iSortType = LSSORT_NAMEUP; + _pGUIM->gmLoadSaveMenu.gm_bSave = FALSE; + _pGUIM->gmLoadSaveMenu.gm_bManage = FALSE; + _pGUIM->gmLoadSaveMenu.gm_fnmDirectory = CTString("Scripts\\Addons\\"); + _pGUIM->gmLoadSaveMenu.gm_fnmSelected = CTString(""); + _pGUIM->gmLoadSaveMenu.gm_fnmExt = CTString(".ini"); + _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadAddon; + _pGUIM->gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; - gmLoadSaveMenu.gm_pgmParentMenu = &gmOptionsMenu; - ChangeToMenu(&gmLoadSaveMenu); + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu; + ChangeToMenu(&_pGUIM->gmLoadSaveMenu); } void StartModsLoadMenu(void) { - gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("CHOOSE MOD"); - gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; - gmLoadSaveMenu.gm_iSortType = LSSORT_NAMEUP; - gmLoadSaveMenu.gm_bSave = FALSE; - gmLoadSaveMenu.gm_bManage = FALSE; - gmLoadSaveMenu.gm_fnmDirectory = CTString("Mods\\"); - gmLoadSaveMenu.gm_fnmSelected = CTString(""); - gmLoadSaveMenu.gm_fnmExt = CTString(".des"); - gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadMod; + _pGUIM->gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("CHOOSE MOD"); + _pGUIM->gmLoadSaveMenu.gm_bAllowThumbnails = TRUE; + _pGUIM->gmLoadSaveMenu.gm_iSortType = LSSORT_NAMEUP; + _pGUIM->gmLoadSaveMenu.gm_bSave = FALSE; + _pGUIM->gmLoadSaveMenu.gm_bManage = FALSE; + _pGUIM->gmLoadSaveMenu.gm_fnmDirectory = CTString("Mods\\"); + _pGUIM->gmLoadSaveMenu.gm_fnmSelected = CTString(""); + _pGUIM->gmLoadSaveMenu.gm_fnmExt = CTString(".des"); + _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadMod; - gmLoadSaveMenu.gm_pgmParentMenu = &gmMainMenu; - ChangeToMenu(&gmLoadSaveMenu); + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = &_pGUIM->gmMainMenu; + ChangeToMenu(&_pGUIM->gmLoadSaveMenu); } void StartNetworkSettingsMenu(void) { - gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("CONNECTION SETTINGS"); - gmLoadSaveMenu.gm_bAllowThumbnails = FALSE; - gmLoadSaveMenu.gm_iSortType = LSSORT_FILEUP; - gmLoadSaveMenu.gm_bSave = FALSE; - gmLoadSaveMenu.gm_bManage = FALSE; - gmLoadSaveMenu.gm_fnmDirectory = CTString("Scripts\\NetSettings\\"); - gmLoadSaveMenu.gm_fnmSelected = sam_strNetworkSettings; - gmLoadSaveMenu.gm_fnmExt = CTString(".ini"); - gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadNetSettings; + _pGUIM->gmLoadSaveMenu.gm_mgTitle.mg_strText = TRANS("CONNECTION SETTINGS"); + _pGUIM->gmLoadSaveMenu.gm_bAllowThumbnails = FALSE; + _pGUIM->gmLoadSaveMenu.gm_iSortType = LSSORT_FILEUP; + _pGUIM->gmLoadSaveMenu.gm_bSave = FALSE; + _pGUIM->gmLoadSaveMenu.gm_bManage = FALSE; + _pGUIM->gmLoadSaveMenu.gm_fnmDirectory = CTString("Scripts\\NetSettings\\"); + _pGUIM->gmLoadSaveMenu.gm_fnmSelected = sam_strNetworkSettings; + _pGUIM->gmLoadSaveMenu.gm_fnmExt = CTString(".ini"); + _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen = &LSLoadNetSettings; if (sam_strNetworkSettings == "") { - gmLoadSaveMenu.gm_mgNotes.mg_strText = TRANS( + _pGUIM->gmLoadSaveMenu.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 { - gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; + } else { + _pGUIM->gmLoadSaveMenu.gm_mgNotes.mg_strText = ""; } - gmLoadSaveMenu.gm_pgmParentMenu = &gmOptionsMenu; - ChangeToMenu(&gmLoadSaveMenu); + _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu; + ChangeToMenu(&_pGUIM->gmLoadSaveMenu); } void StartSinglePlayerMenu(void) { - ChangeToMenu(&gmSinglePlayerMenu); + ChangeToMenu(&_pGUIM->gmSinglePlayerMenu); } \ No newline at end of file diff --git a/Sources/SeriousSam/SeriousSam.cpp b/Sources/SeriousSam/SeriousSam.cpp index 2211f75..6e47fc2 100644 --- a/Sources/SeriousSam/SeriousSam.cpp +++ b/Sources/SeriousSam/SeriousSam.cpp @@ -102,7 +102,7 @@ extern CTString sam_strModName = TRANS("- O P E N S O U R C E -"); #if _SE_DEMO extern CTString sam_strFirstLevel = "Levels\\KarnakDemo.wld"; #else - extern CTString sam_strFirstLevel = "Levels\\LevelsMP\\1_0_InTheLastEpisode.wld.wld"; + extern CTString sam_strFirstLevel = "Levels\\LevelsMP\\1_0_InTheLastEpisode.wld"; #endif extern CTString sam_strIntroLevel = "Levels\\LevelsMP\\Intro.wld"; extern CTString sam_strGameName = "serioussamse"; diff --git a/Sources/SeriousSam/SeriousSam.vcxproj b/Sources/SeriousSam/SeriousSam.vcxproj index 393bb7a..7acbeac 100644 --- a/Sources/SeriousSam/SeriousSam.vcxproj +++ b/Sources/SeriousSam/SeriousSam.vcxproj @@ -202,6 +202,7 @@ copy Release\$(TargetName).map $(SolutionDir)..\Bin\ >nul + @@ -251,6 +252,7 @@ copy Release\$(TargetName).map $(SolutionDir)..\Bin\ >nul + diff --git a/Sources/SeriousSam/SeriousSam.vcxproj.filters b/Sources/SeriousSam/SeriousSam.vcxproj.filters index e2fb6dc..e56f422 100644 --- a/Sources/SeriousSam/SeriousSam.vcxproj.filters +++ b/Sources/SeriousSam/SeriousSam.vcxproj.filters @@ -207,6 +207,9 @@ Source Files\GUI\Menus + + Source Files\GUI\Menus + @@ -392,6 +395,9 @@ Header Files\GUI headers\Menus headers + + Header Files\GUI headers\Menus headers +