GameExecutable: Put menus' extern variables into container.

This commit is contained in:
zcaliptium 2016-03-30 21:21:32 +03:00
parent 36c6eb19c0
commit ef788b5299
14 changed files with 679 additions and 759 deletions

View File

@ -23,6 +23,8 @@ CMGButton::CMGButton(void)
mg_iCursorPos = -1; mg_iCursorPos = -1;
mg_bRectangle = FALSE; mg_bRectangle = FALSE;
mg_bMental = 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->PutTextR(mg_strLabel, pixIL, pixJ, col);
pdp->PutText(mg_strText, pixIR, pixJ, col); pdp->PutText(mg_strText, pixIR, pixJ, col);
} } else {
else {
CTString str = mg_strText; CTString str = mg_strText;
if (pdp->dp_FontData->fd_bFixedWidth) { if (pdp->dp_FontData->fd_bFixedWidth) {
str = str.Undecorated(); str = str.Undecorated();
@ -131,8 +132,7 @@ void CMGButton::Render(CDrawPort *pdp)
str.TrimRight(iCursor); str.TrimRight(iCursor);
str.TrimLeft(iMaxLen); str.TrimLeft(iMaxLen);
iCursor = iMaxLen; iCursor = iMaxLen;
} } else {
else {
str.TrimRight(iMaxLen); str.TrimRight(iMaxLen);
} }
} }

View File

@ -5,6 +5,7 @@
#include <Engine/CurrentVersion.h> #include <Engine/CurrentVersion.h>
#include <GameMP/LCDDrawing.h> #include <GameMP/LCDDrawing.h>
#include "MGChangePlayer.h" #include "MGChangePlayer.h"
#include "GUI/Menus/MenuManager.h"
extern CSoundData *_psdPress; extern CSoundData *_psdPress;
@ -16,11 +17,11 @@ void CMGChangePlayer::OnActivate(void)
_iLocalPlayer = mg_iLocalPlayer; _iLocalPlayer = mg_iLocalPlayer;
if (_pGame->gm_aiMenuLocalPlayers[mg_iLocalPlayer] < 0) if (_pGame->gm_aiMenuLocalPlayers[mg_iLocalPlayer] < 0)
_pGame->gm_aiMenuLocalPlayers[mg_iLocalPlayer] = 0; _pGame->gm_aiMenuLocalPlayers[mg_iLocalPlayer] = 0;
gmPlayerProfile.gm_piCurrentPlayer = &_pGame->gm_aiMenuLocalPlayers[mg_iLocalPlayer]; _pGUIM->gmPlayerProfile.gm_piCurrentPlayer = &_pGame->gm_aiMenuLocalPlayers[mg_iLocalPlayer];
gmPlayerProfile.gm_pgmParentMenu = &gmSelectPlayersMenu; _pGUIM->gmPlayerProfile.gm_pgmParentMenu = &_pGUIM->gmSelectPlayersMenu;
extern BOOL _bPlayerMenuFromSinglePlayer; extern BOOL _bPlayerMenuFromSinglePlayer;
_bPlayerMenuFromSinglePlayer = FALSE; _bPlayerMenuFromSinglePlayer = FALSE;
ChangeToMenu(&gmPlayerProfile); ChangeToMenu(&_pGUIM->gmPlayerProfile);
} }
void CMGChangePlayer::SetPlayerText(void) void CMGChangePlayer::SetPlayerText(void)

View File

@ -5,6 +5,7 @@
#include <Engine/CurrentVersion.h> #include <Engine/CurrentVersion.h>
#include <GameMP/LCDDrawing.h> #include <GameMP/LCDDrawing.h>
#include "MGFileButton.h" #include "MGFileButton.h"
#include "GUI/Menus/MenuManager.h"
extern CSoundData *_psdPress; extern CSoundData *_psdPress;
@ -57,9 +58,9 @@ void CMGFileButton::DoSave(void)
void CMGFileButton::SaveYes(void) void CMGFileButton::SaveYes(void)
{ {
ASSERT(gmLoadSaveMenu.gm_bSave); ASSERT(_pGUIM->gmLoadSaveMenu.gm_bSave);
// call saving function // call saving function
BOOL bSucceeded = gmLoadSaveMenu.gm_pAfterFileChosen(mg_fnm); BOOL bSucceeded = _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen(mg_fnm);
// if saved // if saved
if (bSucceeded) { if (bSucceeded) {
// save the description too // save the description too
@ -69,17 +70,17 @@ void CMGFileButton::SaveYes(void)
void CMGFileButton::DoLoad(void) void CMGFileButton::DoLoad(void)
{ {
ASSERT(!gmLoadSaveMenu.gm_bSave); ASSERT(!_pGUIM->gmLoadSaveMenu.gm_bSave);
// if no file // if no file
if (!FileExists(mg_fnm)) { if (!FileExists(mg_fnm)) {
// do nothing // do nothing
return; return;
} }
if (gmLoadSaveMenu.gm_pgmNextMenu != NULL) { if (_pGUIM->gmLoadSaveMenu.gm_pgmNextMenu != NULL) {
gmLoadSaveMenu.gm_pgmParentMenu = gmLoadSaveMenu.gm_pgmNextMenu; _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = _pGUIM->gmLoadSaveMenu.gm_pgmNextMenu;
} }
// call loading function // call loading function
BOOL bSucceeded = gmLoadSaveMenu.gm_pAfterFileChosen(mg_fnm); BOOL bSucceeded = _pGUIM->gmLoadSaveMenu.gm_pAfterFileChosen(mg_fnm);
ASSERT(bSucceeded); ASSERT(bSucceeded);
} }
@ -101,7 +102,7 @@ void CMGFileButton::OnActivate(void)
IFeel_PlayEffect("Menu_press"); IFeel_PlayEffect("Menu_press");
// if loading // if loading
if (!gmLoadSaveMenu.gm_bSave) { if (!_pGUIM->gmLoadSaveMenu.gm_bSave) {
// load now // load now
DoLoad(); DoLoad();
// if saving // if saving
@ -109,7 +110,7 @@ void CMGFileButton::OnActivate(void)
else { else {
// switch to editing mode // switch to editing mode
BOOL bWasEmpty = mg_strText == EMPTYSLOTSTRING; BOOL bWasEmpty = mg_strText == EMPTYSLOTSTRING;
mg_strDes = gmLoadSaveMenu.gm_strSaveDes; mg_strDes = _pGUIM->gmLoadSaveMenu.gm_strSaveDes;
RefreshText(); RefreshText();
_strOrgDescription = _strTmpDescription = mg_strText; _strOrgDescription = _strTmpDescription = mg_strText;
if (bWasEmpty) { if (bWasEmpty) {
@ -124,7 +125,7 @@ void CMGFileButton::OnActivate(void)
BOOL CMGFileButton::OnKeyDown(int iVKey) BOOL CMGFileButton::OnKeyDown(int iVKey)
{ {
if (mg_iState == FBS_NORMAL) { 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 (iVKey == VK_F2) {
if (FileExistsForWriting(mg_fnm)) { if (FileExistsForWriting(mg_fnm)) {
// switch to renaming mode // switch to renaming mode
@ -143,8 +144,8 @@ BOOL CMGFileButton::OnKeyDown(int iVKey)
RemoveFile(mg_fnm.NoExt() + ".des"); RemoveFile(mg_fnm.NoExt() + ".des");
RemoveFile(mg_fnm.NoExt() + "Tbn.tex"); RemoveFile(mg_fnm.NoExt() + "Tbn.tex");
// refresh menu // refresh menu
gmLoadSaveMenu.EndMenu(); _pGUIM->gmLoadSaveMenu.EndMenu();
gmLoadSaveMenu.StartMenu(); _pGUIM->gmLoadSaveMenu.StartMenu();
OnSetFocus(); OnSetFocus();
} }
return TRUE; return TRUE;
@ -167,10 +168,9 @@ void CMGFileButton::OnSetFocus(void)
{ {
mg_iState = FBS_NORMAL; mg_iState = FBS_NORMAL;
if (gmLoadSaveMenu.gm_bAllowThumbnails && mg_bEnabled) { if (_pGUIM->gmLoadSaveMenu.gm_bAllowThumbnails && mg_bEnabled) {
SetThumbnail(mg_fnm); SetThumbnail(mg_fnm);
} } else {
else {
ClearThumbnail(); ClearThumbnail();
} }
pgmCurrentMenu->KillAllFocuses(); pgmCurrentMenu->KillAllFocuses();
@ -201,8 +201,8 @@ void CMGFileButton::OnStringChanged(void)
mg_strDes = _strTmpDescription + "\n" + mg_strInfo; mg_strDes = _strTmpDescription + "\n" + mg_strInfo;
SaveDescription(); SaveDescription();
// refresh menu // refresh menu
gmLoadSaveMenu.EndMenu(); _pGUIM->gmLoadSaveMenu.EndMenu();
gmLoadSaveMenu.StartMenu(); _pGUIM->gmLoadSaveMenu.StartMenu();
OnSetFocus(); OnSetFocus();
} }
} }

View File

@ -26,6 +26,7 @@ INDEX GetNewLoopValue(int iVKey, INDEX iCurrent, INDEX ctMembers)
CMGTrigger::CMGTrigger(void) CMGTrigger::CMGTrigger(void)
{ {
mg_pPreTriggerChange = NULL;
mg_pOnTriggerChange = NULL; mg_pOnTriggerChange = NULL;
mg_iCenterI = 0; mg_iCenterI = 0;
mg_bVisual = FALSE; mg_bVisual = FALSE;

View File

@ -5,6 +5,7 @@
#include "MenuPrinting.h" #include "MenuPrinting.h"
#include "MenuStuff.h" #include "MenuStuff.h"
#include "MPlayerProfile.h" #include "MPlayerProfile.h"
#include "GUI/Menus/MenuManager.h"
#define ADD_SELECT_PLAYER_MG( index, mg, mgprev, mgnext, me)\ #define ADD_SELECT_PLAYER_MG( index, mg, mgprev, mgnext, me)\
mg.mg_iIndex = index; \ mg.mg_iIndex = index; \
@ -190,20 +191,28 @@ void CPlayerProfileMenu::SelectPlayer(INDEX iPlayer)
gm_mgCrosshair.mg_iSelected = pps->ps_iCrossHairType + 1; gm_mgCrosshair.mg_iSelected = pps->ps_iCrossHairType + 1;
gm_mgCrosshair.ApplyCurrentSelection(); gm_mgCrosshair.ApplyCurrentSelection();
gm_mgWeaponSelect.mg_iSelected = pps->ps_iWeaponAutoSelect; gm_mgWeaponSelect.mg_iSelected = pps->ps_iWeaponAutoSelect;
gm_mgWeaponSelect.ApplyCurrentSelection(); gm_mgWeaponSelect.ApplyCurrentSelection();
gm_mgWeaponHide.mg_iSelected = (pps->ps_ulFlags&PSF_HIDEWEAPON) ? 1 : 0; gm_mgWeaponHide.mg_iSelected = (pps->ps_ulFlags&PSF_HIDEWEAPON) ? 1 : 0;
gm_mgWeaponHide.ApplyCurrentSelection(); gm_mgWeaponHide.ApplyCurrentSelection();
gm_mg3rdPerson.mg_iSelected = (pps->ps_ulFlags&PSF_PREFER3RDPERSON) ? 1 : 0; gm_mg3rdPerson.mg_iSelected = (pps->ps_ulFlags&PSF_PREFER3RDPERSON) ? 1 : 0;
gm_mg3rdPerson.ApplyCurrentSelection(); gm_mg3rdPerson.ApplyCurrentSelection();
gm_mgQuotes.mg_iSelected = (pps->ps_ulFlags&PSF_NOQUOTES) ? 0 : 1; gm_mgQuotes.mg_iSelected = (pps->ps_ulFlags&PSF_NOQUOTES) ? 0 : 1;
gm_mgQuotes.ApplyCurrentSelection(); gm_mgQuotes.ApplyCurrentSelection();
gm_mgAutoSave.mg_iSelected = (pps->ps_ulFlags&PSF_AUTOSAVE) ? 1 : 0; gm_mgAutoSave.mg_iSelected = (pps->ps_ulFlags&PSF_AUTOSAVE) ? 1 : 0;
gm_mgAutoSave.ApplyCurrentSelection(); gm_mgAutoSave.ApplyCurrentSelection();
gm_mgCompDoubleClick.mg_iSelected = (pps->ps_ulFlags&PSF_COMPSINGLECLICK) ? 0 : 1; gm_mgCompDoubleClick.mg_iSelected = (pps->ps_ulFlags&PSF_COMPSINGLECLICK) ? 0 : 1;
gm_mgCompDoubleClick.ApplyCurrentSelection(); gm_mgCompDoubleClick.ApplyCurrentSelection();
gm_mgViewBobbing.mg_iSelected = (pps->ps_ulFlags&PSF_NOBOBBING) ? 0 : 1; gm_mgViewBobbing.mg_iSelected = (pps->ps_ulFlags&PSF_NOBOBBING) ? 0 : 1;
gm_mgViewBobbing.ApplyCurrentSelection(); gm_mgViewBobbing.ApplyCurrentSelection();
gm_mgSharpTurning.mg_iSelected = (pps->ps_ulFlags&PSF_SHARPTURNING) ? 1 : 0; gm_mgSharpTurning.mg_iSelected = (pps->ps_ulFlags&PSF_SHARPTURNING) ? 1 : 0;
gm_mgSharpTurning.ApplyCurrentSelection(); gm_mgSharpTurning.ApplyCurrentSelection();
@ -250,7 +259,7 @@ void CPlayerProfileMenu::SelectPlayer(INDEX iPlayer)
void CPlayerProfileMenu::StartMenu(void) void CPlayerProfileMenu::StartMenu(void)
{ {
gmPlayerProfile.gm_pmgSelectedByDefault = &gm_mgNameField; _pGUIM->gmPlayerProfile.gm_pmgSelectedByDefault = &gm_mgNameField;
if (_gmRunningGameMode == GM_NONE || _gmRunningGameMode == GM_DEMO) { if (_gmRunningGameMode == GM_NONE || _gmRunningGameMode == GM_DEMO) {
for (INDEX i = 0; i<8; i++) { for (INDEX i = 0; i<8; i++) {

View File

@ -13,6 +13,7 @@
#include "LevelInfo.h" #include "LevelInfo.h"
#include "VarList.h" #include "VarList.h"
#include "FileInfo.h" #include "FileInfo.h"
#include "MenuManager.h"
#include "GUI/Components/MGArrow.h" #include "GUI/Components/MGArrow.h"
#include "GUI/Components/MGButton.h" #include "GUI/Components/MGButton.h"
@ -29,31 +30,6 @@
#include "GUI/Components/MGTrigger.h" #include "GUI/Components/MGTrigger.h"
#include "GUI/Components/MGVarButton.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 "MenuStuff.h"
#include "Menu_starters.h" #include "Menu_starters.h"
@ -185,33 +161,6 @@ CGameMenu *pgmCurrentMenu = NULL;
// global back button // global back button
CMGButton mgBack; 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 // -------- console variable adjustment menu
extern BOOL _bVarChanged = FALSE; extern BOOL _bVarChanged = FALSE;
@ -263,11 +212,11 @@ void StartMenus(char *str)
// stop all IFeel effects // stop all IFeel effects
IFeel_StopEffect(NULL); IFeel_StopEffect(NULL);
if (pgmCurrentMenu==&gmMainMenu || pgmCurrentMenu==&gmInGameMenu) { if (pgmCurrentMenu == &_pGUIM->gmMainMenu || pgmCurrentMenu == &_pGUIM->gmInGameMenu) {
if (_gmRunningGameMode==GM_NONE) { if (_gmRunningGameMode==GM_NONE) {
pgmCurrentMenu = &gmMainMenu; pgmCurrentMenu = &_pGUIM->gmMainMenu;
} else { } else {
pgmCurrentMenu = &gmInGameMenu; pgmCurrentMenu = &_pGUIM->gmInGameMenu;
} }
} }
@ -276,36 +225,36 @@ void StartMenus(char *str)
ChangeToMenu(pgmCurrentMenu); ChangeToMenu(pgmCurrentMenu);
} else { } else {
if (_gmRunningGameMode==GM_NONE) { if (_gmRunningGameMode==GM_NONE) {
ChangeToMenu(&gmMainMenu); ChangeToMenu(&_pGUIM->gmMainMenu);
} else { } else {
ChangeToMenu(&gmInGameMenu); ChangeToMenu(&_pGUIM->gmInGameMenu);
} }
} }
if (CTString(str)=="load") { if (CTString(str)=="load") {
StartCurrentLoadMenu(); StartCurrentLoadMenu();
gmLoadSaveMenu.gm_pgmParentMenu = NULL; _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = NULL;
} }
if (CTString(str)=="save") { if (CTString(str)=="save") {
StartCurrentSaveMenu(); StartCurrentSaveMenu();
gmLoadSaveMenu.gm_pgmParentMenu = NULL; _pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = NULL;
FixupBackButton(&gmLoadSaveMenu); FixupBackButton(&_pGUIM->gmLoadSaveMenu);
} }
if (CTString(str)=="controls") { if (CTString(str)=="controls") {
void StartControlsMenuFromOptions(void); void StartControlsMenuFromOptions(void);
StartControlsMenuFromOptions(); StartControlsMenuFromOptions();
gmControls.gm_pgmParentMenu = NULL; _pGUIM->gmControls.gm_pgmParentMenu = NULL;
FixupBackButton(&gmControls); FixupBackButton(&_pGUIM->gmControls);
} }
if (CTString(str)=="join") { if (CTString(str)=="join") {
void StartSelectPlayersMenuFromOpen(void); void StartSelectPlayersMenuFromOpen(void);
StartSelectPlayersMenuFromOpen(); StartSelectPlayersMenuFromOpen();
gmSelectPlayersMenu.gm_pgmParentMenu = &gmMainMenu; _pGUIM->gmSelectPlayersMenu.gm_pgmParentMenu = &_pGUIM->gmMainMenu;
FixupBackButton(&gmSelectPlayersMenu); FixupBackButton(&_pGUIM->gmSelectPlayersMenu);
} }
if (CTString(str)=="hiscore") { if (CTString(str)=="hiscore") {
ChangeToMenu( &gmHighScoreMenu); ChangeToMenu(&_pGUIM->gmHighScoreMenu);
gmHighScoreMenu.gm_pgmParentMenu = &gmMainMenu; _pGUIM->gmHighScoreMenu.gm_pgmParentMenu = &_pGUIM->gmMainMenu;
FixupBackButton(&gmHighScoreMenu); FixupBackButton(&_pGUIM->gmHighScoreMenu);
} }
bMenuActive = TRUE; bMenuActive = TRUE;
bMenuRendering = TRUE; bMenuRendering = TRUE;
@ -321,9 +270,9 @@ void StopMenus( BOOL bGoToRoot /*=TRUE*/)
bMenuActive = FALSE; bMenuActive = FALSE;
if (bGoToRoot) { if (bGoToRoot) {
if (_gmRunningGameMode==GM_NONE) { if (_gmRunningGameMode==GM_NONE) {
pgmCurrentMenu = &gmMainMenu; pgmCurrentMenu = &_pGUIM->gmMainMenu;
} else { } else {
pgmCurrentMenu = &gmInGameMenu; pgmCurrentMenu = &_pGUIM->gmInGameMenu;
} }
} }
} }
@ -331,13 +280,10 @@ void StopMenus( BOOL bGoToRoot /*=TRUE*/)
BOOL IsMenusInRoot(void) 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) void StopCurrentGame(void)
{ {
_pGame->StopGame(); _pGame->StopGame();
@ -348,20 +294,20 @@ void StopCurrentGame(void)
void DisabledFunction(void) void DisabledFunction(void)
{ {
gmDisabledFunction.gm_pgmParentMenu = pgmCurrentMenu; _pGUIM->gmDisabledFunction.gm_pgmParentMenu = pgmCurrentMenu;
gmDisabledFunction.gm_mgButton.mg_strText = TRANS("The feature is not available in this version!"); _pGUIM->gmDisabledFunction.gm_mgButton.mg_strText = TRANS("The feature is not available in this version!");
gmDisabledFunction.gm_mgTitle.mg_strText = TRANS("DISABLED"); _pGUIM->gmDisabledFunction.gm_mgTitle.mg_strText = TRANS("DISABLED");
ChangeToMenu( &gmDisabledFunction); ChangeToMenu(&_pGUIM->gmDisabledFunction);
} }
extern void InitVideoOptionsButtons(void); extern void InitVideoOptionsButtons(void);
extern void UpdateVideoOptionsButtons(INDEX i); extern void UpdateVideoOptionsButtons(INDEX i);
// ------------------------ Global menu function implementation // ------------------------ Global menu function implementation
void InitializeMenus(void) void InitializeMenus(void)
{ {
_pGUIM = new CMenuManager();
try { try {
// initialize and load corresponding fonts // initialize and load corresponding fonts
_fdSmall.Load_t( CTFILENAME( "Fonts\\Display3-narrow.fnt")); _fdSmall.Load_t( CTFILENAME( "Fonts\\Display3-narrow.fnt"));
@ -422,148 +368,148 @@ void InitializeMenus(void)
InitGameTypes(); InitGameTypes();
// ------------------- Initialize menus // ------------------- Initialize menus
gmConfirmMenu.Initialize_t(); _pGUIM->gmConfirmMenu.Initialize_t();
gmConfirmMenu.gm_strName="Confirm"; _pGUIM->gmConfirmMenu.gm_strName = "Confirm";
gmConfirmMenu.gm_pmgSelectedByDefault = &gmConfirmMenu.gm_mgConfirmYes; _pGUIM->gmConfirmMenu.gm_pmgSelectedByDefault = &_pGUIM->gmConfirmMenu.gm_mgConfirmYes;
gmConfirmMenu.gm_pgmParentMenu = NULL; _pGUIM->gmConfirmMenu.gm_pgmParentMenu = NULL;
InitActionsForConfirmMenu(); InitActionsForConfirmMenu();
gmMainMenu.Initialize_t(); _pGUIM->gmMainMenu.Initialize_t();
gmMainMenu.gm_strName="Main"; _pGUIM->gmMainMenu.gm_strName = "Main";
gmMainMenu.gm_pmgSelectedByDefault = &gmMainMenu.gm_mgSingle; _pGUIM->gmMainMenu.gm_pmgSelectedByDefault = &_pGUIM->gmMainMenu.gm_mgSingle;
gmMainMenu.gm_pgmParentMenu = NULL; _pGUIM->gmMainMenu.gm_pgmParentMenu = NULL;
InitActionsForMainMenu(); InitActionsForMainMenu();
gmInGameMenu.Initialize_t(); _pGUIM->gmInGameMenu.Initialize_t();
gmInGameMenu.gm_strName="InGame"; _pGUIM->gmInGameMenu.gm_strName = "InGame";
gmInGameMenu.gm_pmgSelectedByDefault = &gmInGameMenu.gm_mgQuickLoad; _pGUIM->gmInGameMenu.gm_pmgSelectedByDefault = &_pGUIM->gmInGameMenu.gm_mgQuickLoad;
gmInGameMenu.gm_pgmParentMenu = NULL; _pGUIM->gmInGameMenu.gm_pgmParentMenu = NULL;
InitActionsForInGameMenu(); InitActionsForInGameMenu();
gmSinglePlayerMenu.Initialize_t(); _pGUIM->gmSinglePlayerMenu.Initialize_t();
gmSinglePlayerMenu.gm_strName="SinglePlayer"; _pGUIM->gmSinglePlayerMenu.gm_strName = "SinglePlayer";
gmSinglePlayerMenu.gm_pmgSelectedByDefault = &gmSinglePlayerMenu.gm_mgNewGame; _pGUIM->gmSinglePlayerMenu.gm_pmgSelectedByDefault = &_pGUIM->gmSinglePlayerMenu.gm_mgNewGame;
gmSinglePlayerMenu.gm_pgmParentMenu = &gmMainMenu; _pGUIM->gmSinglePlayerMenu.gm_pgmParentMenu = &_pGUIM->gmMainMenu;
InitActionsForSinglePlayerMenu(); InitActionsForSinglePlayerMenu();
gmSinglePlayerNewMenu.Initialize_t(); _pGUIM->gmSinglePlayerNewMenu.Initialize_t();
gmSinglePlayerNewMenu.gm_strName="SinglePlayerNew"; _pGUIM->gmSinglePlayerNewMenu.gm_strName = "SinglePlayerNew";
gmSinglePlayerNewMenu.gm_pmgSelectedByDefault = &gmSinglePlayerNewMenu.gm_mgMedium; _pGUIM->gmSinglePlayerNewMenu.gm_pmgSelectedByDefault = &_pGUIM->gmSinglePlayerNewMenu.gm_mgMedium;
gmSinglePlayerNewMenu.gm_pgmParentMenu = &gmSinglePlayerMenu; _pGUIM->gmSinglePlayerNewMenu.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu;
InitActionsForSinglePlayerNewMenu(); InitActionsForSinglePlayerNewMenu();
gmDisabledFunction.Initialize_t(); _pGUIM->gmDisabledFunction.Initialize_t();
gmDisabledFunction.gm_strName="DisabledFunction"; _pGUIM->gmDisabledFunction.gm_strName = "DisabledFunction";
gmDisabledFunction.gm_pmgSelectedByDefault = &gmDisabledFunction.gm_mgButton; _pGUIM->gmDisabledFunction.gm_pmgSelectedByDefault = &_pGUIM->gmDisabledFunction.gm_mgButton;
gmDisabledFunction.gm_pgmParentMenu = NULL; _pGUIM->gmDisabledFunction.gm_pgmParentMenu = NULL;
gmPlayerProfile.Initialize_t(); _pGUIM->gmPlayerProfile.Initialize_t();
gmPlayerProfile.gm_strName="PlayerProfile"; _pGUIM->gmPlayerProfile.gm_strName = "PlayerProfile";
gmPlayerProfile.gm_pmgSelectedByDefault = &gmPlayerProfile.gm_mgNameField; _pGUIM->gmPlayerProfile.gm_pmgSelectedByDefault = &_pGUIM->gmPlayerProfile.gm_mgNameField;
InitActionsForPlayerProfileMenu(); InitActionsForPlayerProfileMenu();
gmControls.Initialize_t(); _pGUIM->gmControls.Initialize_t();
gmControls.gm_strName="Controls"; _pGUIM->gmControls.gm_strName = "Controls";
gmControls.gm_pmgSelectedByDefault = &gmControls.gm_mgButtons; _pGUIM->gmControls.gm_pmgSelectedByDefault = &_pGUIM->gmControls.gm_mgButtons;
InitActionsForControlsMenu(); InitActionsForControlsMenu();
// warning! parent menu has to be set inside button activate function from where // warning! parent menu has to be set inside button activate function from where
// Load/Save menu is called // Load/Save menu is called
gmLoadSaveMenu.Initialize_t(); _pGUIM->gmLoadSaveMenu.Initialize_t();
gmLoadSaveMenu.gm_strName="LoadSave"; _pGUIM->gmLoadSaveMenu.gm_strName = "LoadSave";
gmLoadSaveMenu.gm_pmgSelectedByDefault = &gmLoadSaveMenu.gm_amgButton[0]; _pGUIM->gmLoadSaveMenu.gm_pmgSelectedByDefault = &_pGUIM->gmLoadSaveMenu.gm_amgButton[0];
gmHighScoreMenu.Initialize_t(); _pGUIM->gmHighScoreMenu.Initialize_t();
gmHighScoreMenu.gm_strName="HighScore"; _pGUIM->gmHighScoreMenu.gm_strName = "HighScore";
gmHighScoreMenu.gm_pmgSelectedByDefault = &mgBack; _pGUIM->gmHighScoreMenu.gm_pmgSelectedByDefault = &mgBack;
gmCustomizeKeyboardMenu.Initialize_t(); _pGUIM->gmCustomizeKeyboardMenu.Initialize_t();
gmCustomizeKeyboardMenu.gm_strName="CustomizeKeyboard"; _pGUIM->gmCustomizeKeyboardMenu.gm_strName = "CustomizeKeyboard";
gmCustomizeKeyboardMenu.gm_pmgSelectedByDefault = &gmCustomizeKeyboardMenu.gm_mgKey[0]; _pGUIM->gmCustomizeKeyboardMenu.gm_pmgSelectedByDefault = &_pGUIM->gmCustomizeKeyboardMenu.gm_mgKey[0];
gmCustomizeKeyboardMenu.gm_pgmParentMenu = &gmControls; _pGUIM->gmCustomizeKeyboardMenu.gm_pgmParentMenu = &_pGUIM->gmControls;
gmCustomizeAxisMenu.Initialize_t(); _pGUIM->gmCustomizeAxisMenu.Initialize_t();
gmCustomizeAxisMenu.gm_strName="CustomizeAxis"; _pGUIM->gmCustomizeAxisMenu.gm_strName = "CustomizeAxis";
gmCustomizeAxisMenu.gm_pmgSelectedByDefault = &gmCustomizeAxisMenu.gm_mgActionTrigger; _pGUIM->gmCustomizeAxisMenu.gm_pmgSelectedByDefault = &_pGUIM->gmCustomizeAxisMenu.gm_mgActionTrigger;
gmCustomizeAxisMenu.gm_pgmParentMenu = &gmControls; _pGUIM->gmCustomizeAxisMenu.gm_pgmParentMenu = &_pGUIM->gmControls;
InitActionsForCustomizeAxisMenu(); InitActionsForCustomizeAxisMenu();
gmOptionsMenu.Initialize_t(); _pGUIM->gmOptionsMenu.Initialize_t();
gmOptionsMenu.gm_strName="Options"; _pGUIM->gmOptionsMenu.gm_strName = "Options";
gmOptionsMenu.gm_pmgSelectedByDefault = &gmOptionsMenu.gm_mgVideoOptions; _pGUIM->gmOptionsMenu.gm_pmgSelectedByDefault = &_pGUIM->gmOptionsMenu.gm_mgVideoOptions;
gmOptionsMenu.gm_pgmParentMenu = &gmMainMenu; _pGUIM->gmOptionsMenu.gm_pgmParentMenu = &_pGUIM->gmMainMenu;
InitActionsForOptionsMenu(); InitActionsForOptionsMenu();
gmVideoOptionsMenu.Initialize_t(); _pGUIM->gmVideoOptionsMenu.Initialize_t();
gmVideoOptionsMenu.gm_strName="VideoOptions"; _pGUIM->gmVideoOptionsMenu.gm_strName = "VideoOptions";
gmVideoOptionsMenu.gm_pmgSelectedByDefault = &gmVideoOptionsMenu.gm_mgDisplayAPITrigger; _pGUIM->gmVideoOptionsMenu.gm_pmgSelectedByDefault = &_pGUIM->gmVideoOptionsMenu.gm_mgDisplayAPITrigger;
gmVideoOptionsMenu.gm_pgmParentMenu = &gmOptionsMenu; _pGUIM->gmVideoOptionsMenu.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu;
InitActionsForVideoOptionsMenu(); InitActionsForVideoOptionsMenu();
gmAudioOptionsMenu.Initialize_t(); _pGUIM->gmAudioOptionsMenu.Initialize_t();
gmAudioOptionsMenu.gm_strName="AudioOptions"; _pGUIM->gmAudioOptionsMenu.gm_strName = "AudioOptions";
gmAudioOptionsMenu.gm_pmgSelectedByDefault = &gmAudioOptionsMenu.gm_mgFrequencyTrigger; _pGUIM->gmAudioOptionsMenu.gm_pmgSelectedByDefault = &_pGUIM->gmAudioOptionsMenu.gm_mgFrequencyTrigger;
gmAudioOptionsMenu.gm_pgmParentMenu = &gmOptionsMenu; _pGUIM->gmAudioOptionsMenu.gm_pgmParentMenu = &_pGUIM->gmOptionsMenu;
InitActionsForAudioOptionsMenu(); InitActionsForAudioOptionsMenu();
gmLevelsMenu.Initialize_t(); _pGUIM->gmLevelsMenu.Initialize_t();
gmLevelsMenu.gm_strName="Levels"; _pGUIM->gmLevelsMenu.gm_strName = "Levels";
gmLevelsMenu.gm_pmgSelectedByDefault = &gmLevelsMenu.gm_mgManualLevel[0]; _pGUIM->gmLevelsMenu.gm_pmgSelectedByDefault = &_pGUIM->gmLevelsMenu.gm_mgManualLevel[0];
gmLevelsMenu.gm_pgmParentMenu = &gmSinglePlayerMenu; _pGUIM->gmLevelsMenu.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu;
gmVarMenu.Initialize_t(); _pGUIM->gmVarMenu.Initialize_t();
gmVarMenu.gm_strName="Var"; _pGUIM->gmVarMenu.gm_strName = "Var";
gmVarMenu.gm_pmgSelectedByDefault = &gmVarMenu.gm_mgVar[0]; _pGUIM->gmVarMenu.gm_pmgSelectedByDefault = &_pGUIM->gmVarMenu.gm_mgVar[0];
gmVarMenu.gm_pgmParentMenu = &gmNetworkStartMenu; _pGUIM->gmVarMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkStartMenu;
InitActionsForVarMenu(); InitActionsForVarMenu();
gmServersMenu.Initialize_t(); _pGUIM->gmServersMenu.Initialize_t();
gmServersMenu.gm_strName="Servers"; _pGUIM->gmServersMenu.gm_strName = "Servers";
gmServersMenu.gm_pmgSelectedByDefault = &gmServersMenu.gm_mgList; _pGUIM->gmServersMenu.gm_pmgSelectedByDefault = &_pGUIM->gmServersMenu.gm_mgList;
gmServersMenu.gm_pgmParentMenu = &gmNetworkOpenMenu; _pGUIM->gmServersMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkOpenMenu;
InitActionsForServersMenu(); InitActionsForServersMenu();
gmNetworkMenu.Initialize_t(); _pGUIM->gmNetworkMenu.Initialize_t();
gmNetworkMenu.gm_strName="Network"; _pGUIM->gmNetworkMenu.gm_strName = "Network";
gmNetworkMenu.gm_pmgSelectedByDefault = &gmNetworkMenu.gm_mgJoin; _pGUIM->gmNetworkMenu.gm_pmgSelectedByDefault = &_pGUIM->gmNetworkMenu.gm_mgJoin;
gmNetworkMenu.gm_pgmParentMenu = &gmMainMenu; _pGUIM->gmNetworkMenu.gm_pgmParentMenu = &_pGUIM->gmMainMenu;
InitActionsForNetworkMenu(); InitActionsForNetworkMenu();
gmNetworkStartMenu.Initialize_t(); _pGUIM->gmNetworkStartMenu.Initialize_t();
gmNetworkStartMenu.gm_strName="NetworkStart"; _pGUIM->gmNetworkStartMenu.gm_strName = "NetworkStart";
gmNetworkStartMenu.gm_pmgSelectedByDefault = &gmNetworkStartMenu.gm_mgStart; _pGUIM->gmNetworkStartMenu.gm_pmgSelectedByDefault = &_pGUIM->gmNetworkStartMenu.gm_mgStart;
gmNetworkStartMenu.gm_pgmParentMenu = &gmNetworkMenu; _pGUIM->gmNetworkStartMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkMenu;
InitActionsForNetworkStartMenu(); InitActionsForNetworkStartMenu();
gmNetworkJoinMenu.Initialize_t(); _pGUIM->gmNetworkJoinMenu.Initialize_t();
gmNetworkJoinMenu.gm_strName="NetworkJoin"; _pGUIM->gmNetworkJoinMenu.gm_strName = "NetworkJoin";
gmNetworkJoinMenu.gm_pmgSelectedByDefault = &gmNetworkJoinMenu.gm_mgLAN; _pGUIM->gmNetworkJoinMenu.gm_pmgSelectedByDefault = &_pGUIM->gmNetworkJoinMenu.gm_mgLAN;
gmNetworkJoinMenu.gm_pgmParentMenu = &gmNetworkMenu; _pGUIM->gmNetworkJoinMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkMenu;
InitActionsForNetworkJoinMenu(); InitActionsForNetworkJoinMenu();
gmSelectPlayersMenu.gm_bAllowDedicated = FALSE; _pGUIM->gmSelectPlayersMenu.gm_bAllowDedicated = FALSE;
gmSelectPlayersMenu.gm_bAllowObserving = FALSE; _pGUIM->gmSelectPlayersMenu.gm_bAllowObserving = FALSE;
gmSelectPlayersMenu.Initialize_t(); _pGUIM->gmSelectPlayersMenu.Initialize_t();
gmSelectPlayersMenu.gm_strName="SelectPlayers"; _pGUIM->gmSelectPlayersMenu.gm_strName = "SelectPlayers";
gmSelectPlayersMenu.gm_pmgSelectedByDefault = &gmSelectPlayersMenu.gm_mgStart; _pGUIM->gmSelectPlayersMenu.gm_pmgSelectedByDefault = &_pGUIM->gmSelectPlayersMenu.gm_mgStart;
InitActionsForSelectPlayersMenu(); InitActionsForSelectPlayersMenu();
gmNetworkOpenMenu.Initialize_t(); _pGUIM->gmNetworkOpenMenu.Initialize_t();
gmNetworkOpenMenu.gm_strName="NetworkOpen"; _pGUIM->gmNetworkOpenMenu.gm_strName = "NetworkOpen";
gmNetworkOpenMenu.gm_pmgSelectedByDefault = &gmNetworkOpenMenu.gm_mgJoin; _pGUIM->gmNetworkOpenMenu.gm_pmgSelectedByDefault = &_pGUIM->gmNetworkOpenMenu.gm_mgJoin;
gmNetworkOpenMenu.gm_pgmParentMenu = &gmNetworkJoinMenu; _pGUIM->gmNetworkOpenMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkJoinMenu;
InitActionsForNetworkOpenMenu(); InitActionsForNetworkOpenMenu();
gmSplitScreenMenu.Initialize_t(); _pGUIM->gmSplitScreenMenu.Initialize_t();
gmSplitScreenMenu.gm_strName="SplitScreen"; _pGUIM->gmSplitScreenMenu.gm_strName = "SplitScreen";
gmSplitScreenMenu.gm_pmgSelectedByDefault = &gmSplitScreenMenu.gm_mgStart; _pGUIM->gmSplitScreenMenu.gm_pmgSelectedByDefault = &_pGUIM->gmSplitScreenMenu.gm_mgStart;
gmSplitScreenMenu.gm_pgmParentMenu = &gmMainMenu; _pGUIM->gmSplitScreenMenu.gm_pgmParentMenu = &_pGUIM->gmMainMenu;
InitActionsForSplitScreenMenu(); InitActionsForSplitScreenMenu();
gmSplitStartMenu.Initialize_t(); _pGUIM->gmSplitStartMenu.Initialize_t();
gmSplitStartMenu.gm_strName="SplitStart"; _pGUIM->gmSplitStartMenu.gm_strName = "SplitStart";
gmSplitStartMenu.gm_pmgSelectedByDefault = &gmSplitStartMenu.gm_mgStart; _pGUIM->gmSplitStartMenu.gm_pmgSelectedByDefault = &_pGUIM->gmSplitStartMenu.gm_mgStart;
gmSplitStartMenu.gm_pgmParentMenu = &gmSplitScreenMenu; _pGUIM->gmSplitStartMenu.gm_pgmParentMenu = &_pGUIM->gmSplitScreenMenu;
InitActionsForSplitStartMenu(); InitActionsForSplitStartMenu();
} }
catch( char *strError) catch( char *strError)
@ -575,7 +521,7 @@ void InitializeMenus(void)
void DestroyMenus( void) void DestroyMenus( void)
{ {
gmMainMenu.Destroy(); _pGUIM->gmMainMenu.Destroy();
pgmCurrentMenu = NULL; pgmCurrentMenu = NULL;
_pSoundStock->Release(_psdSelect); _pSoundStock->Release(_psdSelect);
_pSoundStock->Release(_psdPress); _pSoundStock->Release(_psdPress);
@ -597,7 +543,7 @@ void MenuGoToParent(void)
// if no game is running // if no game is running
} else { } else {
// go to main menu // go to main menu
ChangeToMenu( &gmMainMenu); ChangeToMenu(&_pGUIM->gmMainMenu);
} }
// if there is some parent menu // if there is some parent menu
} else { } else {
@ -632,7 +578,7 @@ void MenuOnKeyDown( int iVKey)
if(!bHandled) { if(!bHandled) {
// if escape or right mouse pressed // if escape or right mouse pressed
if(iVKey==VK_ESCAPE || iVKey==VK_RBUTTON) { if(iVKey==VK_ESCAPE || iVKey==VK_RBUTTON) {
if (pgmCurrentMenu==&gmLoadSaveMenu && gmLoadSaveMenu.gm_bNoEscape) { if (pgmCurrentMenu==&_pGUIM->gmLoadSaveMenu && _pGUIM->gmLoadSaveMenu.gm_bNoEscape) {
return; return;
} }
// go to parent menu if possible // go to parent menu if possible
@ -839,7 +785,7 @@ BOOL DoMenu( CDrawPort *pdp)
FLOAT fScaleH = (FLOAT)pixH / 480.0f; FLOAT fScaleH = (FLOAT)pixH / 480.0f;
PIX pixI0, pixJ0, pixI1, pixJ1; PIX pixI0, pixJ0, pixI1, pixJ1;
// put logo(s) to main menu (if logos exist) // put logo(s) to main menu (if logos exist)
if( pgmCurrentMenu==&gmMainMenu) if (pgmCurrentMenu == &_pGUIM->gmMainMenu)
{ {
if( _ptoLogoODI!=NULL) { if( _ptoLogoODI!=NULL) {
CTextureData &td = (CTextureData&)*_ptoLogoODI->GetData(); CTextureData &td = (CTextureData&)*_ptoLogoODI->GetData();
@ -877,7 +823,7 @@ BOOL DoMenu( CDrawPort *pdp)
dpMenu.PutTexture(&_toLogoMenuB, PIXaabbox2D( dpMenu.PutTexture(&_toLogoMenuB, PIXaabbox2D(
PIX2D( pixCenterI, pixHeightJ),PIX2D( pixCenterI+pixSizeI, pixHeightJ+pixSizeJ))); PIX2D( pixCenterI, pixHeightJ),PIX2D( pixCenterI+pixSizeI, pixHeightJ+pixSizeJ)));
} }
} else if (pgmCurrentMenu==&gmAudioOptionsMenu) { } else if (pgmCurrentMenu == &_pGUIM->gmAudioOptionsMenu) {
if( _ptoLogoEAX!=NULL) { if( _ptoLogoEAX!=NULL) {
CTextureData &td = (CTextureData&)*_ptoLogoEAX->GetData(); CTextureData &td = (CTextureData&)*_ptoLogoEAX->GetData();
const INDEX iSize = 95; const INDEX iSize = 95;

View File

@ -33,9 +33,6 @@ extern void PlayMenuSound(CSoundData *psd);
extern CListHead _lhServers; extern CListHead _lhServers;
extern class CPlayerProfileMenu gmPlayerProfile;
extern class CSelectPlayersMenu gmSelectPlayersMenu;
extern class CCustomizeAxisMenu gmCustomizeAxisMenu;
extern INDEX _iLocalPlayer; extern INDEX _iLocalPlayer;
enum GameMode { enum GameMode {
@ -57,7 +54,5 @@ extern CGameMenu *pgmCurrentMenu;
#include "MPlayerProfile.h" #include "MPlayerProfile.h"
#include "MSelectPlayers.h" #include "MSelectPlayers.h"
extern CLoadSaveMenu gmLoadSaveMenu;
#endif /* include-once check. */ #endif /* include-once check. */

View File

@ -0,0 +1,8 @@
/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */
#include "StdH.h"
#include <Engine/Build.h>
#include "MenuManager.h"
extern CMenuManager* _pGUIM = NULL;

View File

@ -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. */

View File

@ -3,68 +3,18 @@
#include "StdH.h" #include "StdH.h"
#include <Engine/Build.h> #include <Engine/Build.h>
#include "MenuManager.h"
#include "Menu_starters.h" #include "Menu_starters.h"
#include "MenuStuff.h" #include "MenuStuff.h"
#include "GUI/Components/MenuGadget.h" #include "GUI/Components/MenuGadget.h"
#include "LevelInfo.h" #include "LevelInfo.h"
#include "VarList.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 #define VOLUME_STEPS 50
extern CMenuGadget *_pmgLastActivatedGadget; extern CMenuGadget *_pmgLastActivatedGadget;
extern CMenuGadget *_pmgUnderCursor; 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 // functions to activate when user chose 'yes/no' on confirmation
void(*_pConfimedYes)(void) = NULL; void(*_pConfimedYes)(void) = NULL;
void(*_pConfimedNo)(void) = NULL; void(*_pConfimedNo)(void) = NULL;
@ -152,10 +102,10 @@ void ExitConfirm(void)
{ {
_pConfimedYes = &ExitGame; _pConfimedYes = &ExitGame;
_pConfimedNo = NULL; _pConfimedNo = NULL;
gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("ARE YOU SERIOUS?"); _pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("ARE YOU SERIOUS?");
gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; _pGUIM->gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu;
gmConfirmMenu.BeLarge(); _pGUIM->gmConfirmMenu.BeLarge();
ChangeToMenu(&gmConfirmMenu); ChangeToMenu(&_pGUIM->gmConfirmMenu);
} }
void StopConfirm(void) void StopConfirm(void)
@ -163,10 +113,10 @@ void StopConfirm(void)
extern void StopCurrentGame(void); extern void StopCurrentGame(void);
_pConfimedYes = &StopCurrentGame; _pConfimedYes = &StopCurrentGame;
_pConfimedNo = NULL; _pConfimedNo = NULL;
gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("ARE YOU SERIOUS?"); _pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("ARE YOU SERIOUS?");
gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; _pGUIM->gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu;
gmConfirmMenu.BeLarge(); _pGUIM->gmConfirmMenu.BeLarge();
ChangeToMenu(&gmConfirmMenu); ChangeToMenu(&_pGUIM->gmConfirmMenu);
} }
void ModLoadYes(void) 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); CPrintF(TRANS("Server is running a different MOD (%s).\nYou need to reload to connect.\n"), _fnmModSelected);
_pConfimedYes = &ModConnect; _pConfimedYes = &ModConnect;
_pConfimedNo = NULL; _pConfimedNo = NULL;
gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("CHANGE THE MOD?"); _pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("CHANGE THE MOD?");
gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; _pGUIM->gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu;
gmConfirmMenu.BeLarge(); _pGUIM->gmConfirmMenu.BeLarge();
ChangeToMenu(&gmConfirmMenu); ChangeToMenu(&_pGUIM->gmConfirmMenu);
} }
void SaveConfirm(void) void SaveConfirm(void)
@ -212,10 +162,10 @@ void SaveConfirm(void)
extern void OnFileSaveOK(void); extern void OnFileSaveOK(void);
_pConfimedYes = &OnFileSaveOK; _pConfimedYes = &OnFileSaveOK;
_pConfimedNo = NULL; _pConfimedNo = NULL;
gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("OVERWRITE?"); _pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("OVERWRITE?");
gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; _pGUIM->gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu;
gmConfirmMenu.BeLarge(); _pGUIM->gmConfirmMenu.BeLarge();
ChangeToMenu(&gmConfirmMenu); ChangeToMenu(&_pGUIM->gmConfirmMenu);
} }
void ExitAndSpawnExplorer(void) void ExitAndSpawnExplorer(void)
@ -230,11 +180,11 @@ void ModNotInstalled(void)
{ {
_pConfimedYes = &ExitAndSpawnExplorer; _pConfimedYes = &ExitAndSpawnExplorer;
_pConfimedNo = NULL; _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); TRANS("You don't have MOD '%s' installed.\nDo you want to visit its web site?"), (const char*)_fnmModSelected);
gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; _pGUIM->gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu;
gmConfirmMenu.BeSmall(); _pGUIM->gmConfirmMenu.BeSmall();
ChangeToMenu(&gmConfirmMenu); ChangeToMenu(&_pGUIM->gmConfirmMenu);
/* /*
gmDisabledFunction.gm_pgmParentMenu = pgmCurrentMenu; gmDisabledFunction.gm_pgmParentMenu = pgmCurrentMenu;
@ -251,10 +201,10 @@ extern void ModConfirm(void)
{ {
_pConfimedYes = &ModLoadYes; _pConfimedYes = &ModLoadYes;
_pConfimedNo = NULL; _pConfimedNo = NULL;
gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("LOAD THIS MOD?"); _pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("LOAD THIS MOD?");
gmConfirmMenu.gm_pgmParentMenu = &gmLoadSaveMenu; _pGUIM->gmConfirmMenu.gm_pgmParentMenu = &_pGUIM->gmLoadSaveMenu;
gmConfirmMenu.BeLarge(); _pGUIM->gmConfirmMenu.BeLarge();
ChangeToMenu(&gmConfirmMenu); ChangeToMenu(&_pGUIM->gmConfirmMenu);
} }
void VideoConfirm(void) void VideoConfirm(void)
@ -262,27 +212,27 @@ void VideoConfirm(void)
// FIXUP: keyboard focus lost when going from full screen to window mode // FIXUP: keyboard focus lost when going from full screen to window mode
// due to WM_MOUSEMOVE being sent // due to WM_MOUSEMOVE being sent
_bMouseUsedLast = FALSE; _bMouseUsedLast = FALSE;
_pmgUnderCursor = gmConfirmMenu.gm_pmgSelectedByDefault; _pmgUnderCursor = _pGUIM->gmConfirmMenu.gm_pmgSelectedByDefault;
_pConfimedYes = NULL; _pConfimedYes = NULL;
void RevertVideoSettings(void); void RevertVideoSettings(void);
_pConfimedNo = RevertVideoSettings; _pConfimedNo = RevertVideoSettings;
gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("KEEP THIS SETTING?"); _pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("KEEP THIS SETTING?");
gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; _pGUIM->gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu;
gmConfirmMenu.BeLarge(); _pGUIM->gmConfirmMenu.BeLarge();
ChangeToMenu(&gmConfirmMenu); ChangeToMenu(&_pGUIM->gmConfirmMenu);
} }
void CDConfirm(void(*pOk)(void)) void CDConfirm(void(*pOk)(void))
{ {
_pConfimedYes = pOk; _pConfimedYes = pOk;
_pConfimedNo = NULL; _pConfimedNo = NULL;
gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("PLEASE INSERT GAME CD?"); _pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("PLEASE INSERT GAME CD?");
if (pgmCurrentMenu != &gmConfirmMenu) { if (pgmCurrentMenu != &_pGUIM->gmConfirmMenu) {
gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu; _pGUIM->gmConfirmMenu.gm_pgmParentMenu = pgmCurrentMenu;
gmConfirmMenu.BeLarge(); _pGUIM->gmConfirmMenu.BeLarge();
ChangeToMenu(&gmConfirmMenu); ChangeToMenu(&_pGUIM->gmConfirmMenu);
} }
} }
@ -305,8 +255,8 @@ void ConfirmNo(void)
} }
void InitActionsForConfirmMenu() { void InitActionsForConfirmMenu() {
gmConfirmMenu.gm_mgConfirmYes.mg_pActivatedFunction = &ConfirmYes; _pGUIM->gmConfirmMenu.gm_mgConfirmYes.mg_pActivatedFunction = &ConfirmYes;
gmConfirmMenu.gm_mgConfirmNo.mg_pActivatedFunction = &ConfirmNo; _pGUIM->gmConfirmMenu.gm_mgConfirmNo.mg_pActivatedFunction = &ConfirmNo;
} }
// return TRUE if handled // return TRUE if handled
@ -320,7 +270,7 @@ BOOL CConfirmMenu::OnKeyDown(int iVKey)
} }
// ------------------------ CMainMenu implementation // ------------------------ CMainMenu implementation
#define CMENU gmMainMenu #define CMENU _pGUIM->gmMainMenu
void InitActionsForMainMenu() { void InitActionsForMainMenu() {
CMENU.gm_mgSingle.mg_pActivatedFunction = &StartSinglePlayerMenu; CMENU.gm_mgSingle.mg_pActivatedFunction = &StartSinglePlayerMenu;
@ -354,7 +304,7 @@ void StopRecordingDemo(void)
SetDemoStartStopRecText(); SetDemoStartStopRecText();
} }
#define CMENU gmInGameMenu #define CMENU _pGUIM->gmInGameMenu
void InitActionsForInGameMenu() { void InitActionsForInGameMenu() {
@ -394,7 +344,7 @@ extern void SetDemoStartStopRecText(void)
void StartSinglePlayerGame_Normal(void); void StartSinglePlayerGame_Normal(void);
void StartTechTest(void) void StartTechTest(void)
{ {
gmSinglePlayerNewMenu.gm_pgmParentMenu = &gmSinglePlayerMenu; _pGUIM->gmSinglePlayerNewMenu.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu;
extern CTString sam_strTechTestLevel; extern CTString sam_strTechTestLevel;
_pGame->gam_strCustomLevel = sam_strTechTestLevel; _pGame->gam_strCustomLevel = sam_strTechTestLevel;
StartSinglePlayerGame_Normal(); StartSinglePlayerGame_Normal();
@ -402,13 +352,13 @@ void StartTechTest(void)
void StartTraining(void) void StartTraining(void)
{ {
gmSinglePlayerNewMenu.gm_pgmParentMenu = &gmSinglePlayerMenu; _pGUIM->gmSinglePlayerNewMenu.gm_pgmParentMenu = &_pGUIM->gmSinglePlayerMenu;
extern CTString sam_strTrainingLevel; extern CTString sam_strTrainingLevel;
_pGame->gam_strCustomLevel = sam_strTrainingLevel; _pGame->gam_strCustomLevel = sam_strTrainingLevel;
ChangeToMenu(&gmSinglePlayerNewMenu); ChangeToMenu(&_pGUIM->gmSinglePlayerNewMenu);
} }
#define CMENU gmSinglePlayerMenu #define CMENU _pGUIM->gmSinglePlayerMenu
void InitActionsForSinglePlayerMenu() { void InitActionsForSinglePlayerMenu() {
CMENU.gm_mgNewGame.mg_pActivatedFunction = &StartSinglePlayerNewMenu; CMENU.gm_mgNewGame.mg_pActivatedFunction = &StartSinglePlayerNewMenu;
@ -500,7 +450,7 @@ void StartSinglePlayerGame_Mental(void)
} }
#define CMENU gmSinglePlayerNewMenu #define CMENU _pGUIM->gmSinglePlayerNewMenu
void InitActionsForSinglePlayerNewMenu() { void InitActionsForSinglePlayerNewMenu() {
CMENU.gm_mgTourist.mg_pActivatedFunction = &StartSinglePlayerGame_Tourist; CMENU.gm_mgTourist.mg_pActivatedFunction = &StartSinglePlayerGame_Tourist;
@ -514,7 +464,7 @@ void InitActionsForSinglePlayerNewMenu() {
#undef CMENU #undef CMENU
// ------------------------ CPlayerProfileMenu implementation // ------------------------ CPlayerProfileMenu implementation
#define CMENU gmPlayerProfile #define CMENU _pGUIM->gmPlayerProfile
void ChangeCrosshair(INDEX iNew) void ChangeCrosshair(INDEX iNew)
{ {
@ -611,7 +561,7 @@ extern void PPOnPlayerSelect(void)
{ {
ASSERT(_pmgLastActivatedGadget != NULL); ASSERT(_pmgLastActivatedGadget != NULL);
if (_pmgLastActivatedGadget->mg_bEnabled) { 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 #undef CMENU
// ------------------------ CControlsMenu implementation // ------------------------ CControlsMenu implementation
#define CMENU gmControls #define CMENU _pGUIM->gmControls
void InitActionsForControlsMenu() void InitActionsForControlsMenu()
{ {
@ -645,7 +595,7 @@ void InitActionsForControlsMenu()
#undef CMENU #undef CMENU
// ------------------------ CCustomizeAxisMenu implementation // ------------------------ CCustomizeAxisMenu implementation
#define CMENU gmCustomizeAxisMenu #define CMENU _pGUIM->gmCustomizeAxisMenu
void PreChangeAxis(INDEX iDummy) void PreChangeAxis(INDEX iDummy)
{ {
@ -665,7 +615,7 @@ void InitActionsForCustomizeAxisMenu() {
#undef CMENU #undef CMENU
// ------------------------ COptionsMenu implementation // ------------------------ COptionsMenu implementation
#define CMENU gmOptionsMenu #define CMENU _pGUIM->gmOptionsMenu
void InitActionsForOptionsMenu() void InitActionsForOptionsMenu()
{ {
@ -689,7 +639,7 @@ static INDEX sam_old_iGfxAPI;
static INDEX sam_old_iVideoSetup; // 0==speed, 1==normal, 2==quality, 3==custom static INDEX sam_old_iVideoSetup; // 0==speed, 1==normal, 2==quality, 3==custom
#define CMENU gmVideoOptionsMenu #define CMENU _pGUIM->gmVideoOptionsMenu
static void FillResolutionsList(void) static void FillResolutionsList(void)
{ {
@ -847,17 +797,17 @@ void ApplyVideoOptions(void)
sam_old_iGfxAPI = sam_iGfxAPI; sam_old_iGfxAPI = sam_iGfxAPI;
sam_old_iVideoSetup = sam_iVideoSetup; sam_old_iVideoSetup = sam_iVideoSetup;
BOOL bFullScreenMode = gmVideoOptionsMenu.gm_mgFullScreenTrigger.mg_iSelected == 1; BOOL bFullScreenMode = CMENU.gm_mgFullScreenTrigger.mg_iSelected == 1;
PIX pixWindowSizeI, pixWindowSizeJ; PIX pixWindowSizeI, pixWindowSizeJ;
ResolutionToSize(gmVideoOptionsMenu.gm_mgResolutionsTrigger.mg_iSelected, pixWindowSizeI, pixWindowSizeJ); ResolutionToSize(CMENU.gm_mgResolutionsTrigger.mg_iSelected, pixWindowSizeI, pixWindowSizeJ);
enum GfxAPIType gat = SwitchToAPI(gmVideoOptionsMenu.gm_mgDisplayAPITrigger.mg_iSelected); enum GfxAPIType gat = SwitchToAPI(CMENU.gm_mgDisplayAPITrigger.mg_iSelected);
enum DisplayDepth dd = SwitchToDepth(gmVideoOptionsMenu.gm_mgBitsPerPixelTrigger.mg_iSelected); enum DisplayDepth dd = SwitchToDepth(CMENU.gm_mgBitsPerPixelTrigger.mg_iSelected);
const INDEX iAdapter = gmVideoOptionsMenu.gm_mgDisplayAdaptersTrigger.mg_iSelected; const INDEX iAdapter = CMENU.gm_mgDisplayAdaptersTrigger.mg_iSelected;
// setup preferences // setup preferences
extern INDEX _iLastPreferences; extern INDEX _iLastPreferences;
if (sam_iVideoSetup == 3) _iLastPreferences = 3; 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 // force fullscreen mode if needed
CDisplayAdapter &da = _pGfx->gl_gaAPI[gat].ga_adaAdapter[iAdapter]; CDisplayAdapter &da = _pGfx->gl_gaAPI[gat].ga_adaAdapter[iAdapter];
@ -912,50 +862,52 @@ void InitActionsForVideoOptionsMenu()
#undef CMENU #undef CMENU
// ------------------------ CAudioOptionsMenu implementation // ------------------------ CAudioOptionsMenu implementation
#define CMENU _pGUIM->gmAudioOptionsMenu
extern void RefreshSoundFormat(void) extern void RefreshSoundFormat(void)
{ {
switch (_pSound->GetFormat()) switch (_pSound->GetFormat())
{ {
case CSoundLibrary::SF_NONE: {gmAudioOptionsMenu.gm_mgFrequencyTrigger.mg_iSelected = 0; break; } case CSoundLibrary::SF_NONE: {CMENU.gm_mgFrequencyTrigger.mg_iSelected = 0; break; }
case CSoundLibrary::SF_11025_16: {gmAudioOptionsMenu.gm_mgFrequencyTrigger.mg_iSelected = 1; break; } case CSoundLibrary::SF_11025_16: {CMENU.gm_mgFrequencyTrigger.mg_iSelected = 1; break; }
case CSoundLibrary::SF_22050_16: {gmAudioOptionsMenu.gm_mgFrequencyTrigger.mg_iSelected = 2; break; } case CSoundLibrary::SF_22050_16: {CMENU.gm_mgFrequencyTrigger.mg_iSelected = 2; break; }
case CSoundLibrary::SF_44100_16: {gmAudioOptionsMenu.gm_mgFrequencyTrigger.mg_iSelected = 3; break; } case CSoundLibrary::SF_44100_16: {CMENU.gm_mgFrequencyTrigger.mg_iSelected = 3; break; }
default: gmAudioOptionsMenu.gm_mgFrequencyTrigger.mg_iSelected = 0; default: CMENU.gm_mgFrequencyTrigger.mg_iSelected = 0;
} }
gmAudioOptionsMenu.gm_mgAudioAutoTrigger.mg_iSelected = Clamp(sam_bAutoAdjustAudio, 0, 1); CMENU.gm_mgAudioAutoTrigger.mg_iSelected = Clamp(sam_bAutoAdjustAudio, 0, 1);
gmAudioOptionsMenu.gm_mgAudioAPITrigger.mg_iSelected = Clamp(_pShell->GetINDEX("snd_iInterface"), 0L, 2L); CMENU.gm_mgAudioAPITrigger.mg_iSelected = Clamp(_pShell->GetINDEX("snd_iInterface"), 0L, 2L);
gmAudioOptionsMenu.gm_mgWaveVolume.mg_iMinPos = 0; CMENU.gm_mgWaveVolume.mg_iMinPos = 0;
gmAudioOptionsMenu.gm_mgWaveVolume.mg_iMaxPos = VOLUME_STEPS; CMENU.gm_mgWaveVolume.mg_iMaxPos = VOLUME_STEPS;
gmAudioOptionsMenu.gm_mgWaveVolume.mg_iCurPos = (INDEX)(_pShell->GetFLOAT("snd_fSoundVolume")*VOLUME_STEPS + 0.5f); CMENU.gm_mgWaveVolume.mg_iCurPos = (INDEX)(_pShell->GetFLOAT("snd_fSoundVolume")*VOLUME_STEPS + 0.5f);
gmAudioOptionsMenu.gm_mgWaveVolume.ApplyCurrentPosition(); CMENU.gm_mgWaveVolume.ApplyCurrentPosition();
gmAudioOptionsMenu.gm_mgMPEGVolume.mg_iMinPos = 0; CMENU.gm_mgMPEGVolume.mg_iMinPos = 0;
gmAudioOptionsMenu.gm_mgMPEGVolume.mg_iMaxPos = VOLUME_STEPS; CMENU.gm_mgMPEGVolume.mg_iMaxPos = VOLUME_STEPS;
gmAudioOptionsMenu.gm_mgMPEGVolume.mg_iCurPos = (INDEX)(_pShell->GetFLOAT("snd_fMusicVolume")*VOLUME_STEPS + 0.5f); CMENU.gm_mgMPEGVolume.mg_iCurPos = (INDEX)(_pShell->GetFLOAT("snd_fMusicVolume")*VOLUME_STEPS + 0.5f);
gmAudioOptionsMenu.gm_mgMPEGVolume.ApplyCurrentPosition(); CMENU.gm_mgMPEGVolume.ApplyCurrentPosition();
gmAudioOptionsMenu.gm_mgAudioAutoTrigger.ApplyCurrentSelection(); CMENU.gm_mgAudioAutoTrigger.ApplyCurrentSelection();
gmAudioOptionsMenu.gm_mgAudioAPITrigger.ApplyCurrentSelection(); CMENU.gm_mgAudioAPITrigger.ApplyCurrentSelection();
gmAudioOptionsMenu.gm_mgFrequencyTrigger.ApplyCurrentSelection(); CMENU.gm_mgFrequencyTrigger.ApplyCurrentSelection();
} }
void ApplyAudioOptions(void) void ApplyAudioOptions(void)
{ {
sam_bAutoAdjustAudio = gmAudioOptionsMenu.gm_mgAudioAutoTrigger.mg_iSelected; sam_bAutoAdjustAudio = CMENU.gm_mgAudioAutoTrigger.mg_iSelected;
if (sam_bAutoAdjustAudio) { if (sam_bAutoAdjustAudio) {
_pShell->Execute("include \"Scripts\\Addons\\SFX-AutoAdjust.ini\""); _pShell->Execute("include \"Scripts\\Addons\\SFX-AutoAdjust.ini\"");
} else { } 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 0: {_pSound->SetFormat(CSoundLibrary::SF_NONE); break; }
case 1: {_pSound->SetFormat(CSoundLibrary::SF_11025_16); break; } case 1: {_pSound->SetFormat(CSoundLibrary::SF_11025_16); break; }
case 2: {_pSound->SetFormat(CSoundLibrary::SF_22050_16); break; } case 2: {_pSound->SetFormat(CSoundLibrary::SF_22050_16); break; }
case 3: {_pSound->SetFormat(CSoundLibrary::SF_44100_16); break; } case 3: {_pSound->SetFormat(CSoundLibrary::SF_44100_16); break; }
default: _pSound->SetFormat(CSoundLibrary::SF_NONE); default: _pSound->SetFormat(CSoundLibrary::SF_NONE);
} }
} }
@ -963,8 +915,6 @@ void ApplyAudioOptions(void)
snd_iFormat = _pSound->GetFormat(); snd_iFormat = _pSound->GetFormat();
} }
#define CMENU gmAudioOptionsMenu
static void OnWaveVolumeChange(INDEX iCurPos) static void OnWaveVolumeChange(INDEX iCurPos)
{ {
_pShell->SetFLOAT("snd_fSoundVolume", iCurPos / FLOAT(VOLUME_STEPS)); _pShell->SetFLOAT("snd_fSoundVolume", iCurPos / FLOAT(VOLUME_STEPS));
@ -1015,7 +965,7 @@ void InitActionsForAudioOptionsMenu()
#undef CMENU #undef CMENU
// ------------------------ CVarMenu implementation // ------------------------ CVarMenu implementation
#define CMENU gmVarMenu #define CMENU _pGUIM->gmVarMenu
void VarApply(void) void VarApply(void)
{ {
@ -1032,23 +982,23 @@ void InitActionsForVarMenu() {
// ------------------------ CServersMenu implementation // ------------------------ CServersMenu implementation
extern void RefreshServerList(void) extern void RefreshServerList(void)
{ {
_pNetwork->EnumSessions(gmServersMenu.m_bInternet); _pNetwork->EnumSessions(_pGUIM->gmServersMenu.m_bInternet);
} }
void RefreshServerListManually(void) 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) void SortByColumn(int i)
{ {
if (gmServersMenu.gm_mgList.mg_iSort == i) { if (_pGUIM->gmServersMenu.gm_mgList.mg_iSort == i) {
gmServersMenu.gm_mgList.mg_bSortDown = !gmServersMenu.gm_mgList.mg_bSortDown; _pGUIM->gmServersMenu.gm_mgList.mg_bSortDown = !_pGUIM->gmServersMenu.gm_mgList.mg_bSortDown;
} }
else { 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); } void SortByServer(void) { SortByColumn(0); }
@ -1063,7 +1013,7 @@ extern CMGButton mgServerColumn[7];
extern CMGEdit mgServerFilter[7]; extern CMGEdit mgServerFilter[7];
void InitActionsForServersMenu() { void InitActionsForServersMenu() {
gmServersMenu.gm_mgRefresh.mg_pActivatedFunction = &RefreshServerList; _pGUIM->gmServersMenu.gm_mgRefresh.mg_pActivatedFunction = &RefreshServerList;
mgServerColumn[0].mg_pActivatedFunction = SortByServer; mgServerColumn[0].mg_pActivatedFunction = SortByServer;
mgServerColumn[1].mg_pActivatedFunction = SortByMap; mgServerColumn[1].mg_pActivatedFunction = SortByMap;
@ -1075,7 +1025,7 @@ void InitActionsForServersMenu() {
} }
// ------------------------ CNetworkMenu implementation // ------------------------ CNetworkMenu implementation
#define CMENU gmNetworkMenu #define CMENU _pGUIM->gmNetworkMenu
void InitActionsForNetworkMenu() void InitActionsForNetworkMenu()
{ {
@ -1088,7 +1038,7 @@ void InitActionsForNetworkMenu()
#undef CMENU #undef CMENU
// ------------------------ CNetworkJoinMenu implementation // ------------------------ CNetworkJoinMenu implementation
#define CMENU gmNetworkJoinMenu #define CMENU _pGUIM->gmNetworkJoinMenu
void InitActionsForNetworkJoinMenu() void InitActionsForNetworkJoinMenu()
{ {
@ -1103,15 +1053,15 @@ void InitActionsForNetworkJoinMenu()
extern void UpdateNetworkLevel(INDEX iDummy) extern void UpdateNetworkLevel(INDEX iDummy)
{ {
ValidateLevelForFlags(_pGame->gam_strCustomLevel, ValidateLevelForFlags(_pGame->gam_strCustomLevel,
GetSpawnFlagsForGameType(gmNetworkStartMenu.gm_mgGameType.mg_iSelected)); GetSpawnFlagsForGameType(_pGUIM->gmNetworkStartMenu.gm_mgGameType.mg_iSelected));
gmNetworkStartMenu.gm_mgLevel.mg_strText = FindLevelByFileName(_pGame->gam_strCustomLevel).li_strName; _pGUIM->gmNetworkStartMenu.gm_mgLevel.mg_strText = FindLevelByFileName(_pGame->gam_strCustomLevel).li_strName;
} }
void InitActionsForNetworkStartMenu() void InitActionsForNetworkStartMenu()
{ {
gmNetworkStartMenu.gm_mgLevel.mg_pActivatedFunction = &StartSelectLevelFromNetwork; _pGUIM->gmNetworkStartMenu.gm_mgLevel.mg_pActivatedFunction = &StartSelectLevelFromNetwork;
gmNetworkStartMenu.gm_mgGameOptions.mg_pActivatedFunction = &StartGameOptionsFromNetwork; _pGUIM->gmNetworkStartMenu.gm_mgGameOptions.mg_pActivatedFunction = &StartGameOptionsFromNetwork;
gmNetworkStartMenu.gm_mgStart.mg_pActivatedFunction = &StartSelectPlayersMenuFromNetwork; _pGUIM->gmNetworkStartMenu.gm_mgStart.mg_pActivatedFunction = &StartSelectPlayersMenuFromNetwork;
} }
// //
@ -1131,7 +1081,7 @@ void InitActionsForNetworkStartMenu()
gd.mg_iLocalPlayer = iplayer; gd.mg_iLocalPlayer = iplayer;
// ------------------------ CSelectPlayersMenu implementation // ------------------------ CSelectPlayersMenu implementation
#define CMENU gmSelectPlayersMenu #define CMENU _pGUIM->gmSelectPlayersMenu
INDEX FindUnusedPlayer(void) INDEX FindUnusedPlayer(void)
{ {
@ -1168,7 +1118,7 @@ extern void SelectPlayersFillMenu(void)
CMENU.gm_mgDedicated.mg_iSelected = 0; CMENU.gm_mgDedicated.mg_iSelected = 0;
} }
gmSelectPlayersMenu.gm_mgDedicated.ApplyCurrentSelection(); CMENU.gm_mgDedicated.ApplyCurrentSelection();
if (CMENU.gm_bAllowObserving && _pGame->gm_MenuSplitScreenCfg == CGame::SSC_OBSERVER) { if (CMENU.gm_bAllowObserving && _pGame->gm_MenuSplitScreenCfg == CGame::SSC_OBSERVER) {
CMENU.gm_mgObserver.mg_iSelected = 1; CMENU.gm_mgObserver.mg_iSelected = 1;
@ -1319,11 +1269,11 @@ void InitActionsForSelectPlayersMenu()
// ------------------------ CNetworkOpenMenu implementation // ------------------------ CNetworkOpenMenu implementation
void InitActionsForNetworkOpenMenu() void InitActionsForNetworkOpenMenu()
{ {
gmNetworkOpenMenu.gm_mgJoin.mg_pActivatedFunction = &StartSelectPlayersMenuFromOpen; _pGUIM->gmNetworkOpenMenu.gm_mgJoin.mg_pActivatedFunction = &StartSelectPlayersMenuFromOpen;
} }
// ------------------------ CSplitScreenMenu implementation // ------------------------ CSplitScreenMenu implementation
#define CMENU gmSplitScreenMenu #define CMENU _pGUIM->gmSplitScreenMenu
void InitActionsForSplitScreenMenu() void InitActionsForSplitScreenMenu()
{ {
@ -1335,7 +1285,7 @@ void InitActionsForSplitScreenMenu()
#undef CMENU #undef CMENU
// ------------------------ CSplitStartMenu implementation // ------------------------ CSplitStartMenu implementation
#define CMENU gmSplitStartMenu #define CMENU _pGUIM->gmSplitStartMenu
void InitActionsForSplitStartMenu() void InitActionsForSplitStartMenu()
{ {
@ -1347,8 +1297,8 @@ void InitActionsForSplitStartMenu()
extern void UpdateSplitLevel(INDEX iDummy) extern void UpdateSplitLevel(INDEX iDummy)
{ {
ValidateLevelForFlags(_pGame->gam_strCustomLevel, ValidateLevelForFlags(_pGame->gam_strCustomLevel,
GetSpawnFlagsForGameType(gmSplitStartMenu.gm_mgGameType.mg_iSelected)); GetSpawnFlagsForGameType(CMENU.gm_mgGameType.mg_iSelected));
gmSplitStartMenu.gm_mgLevel.mg_strText = FindLevelByFileName(_pGame->gam_strCustomLevel).li_strName; CMENU.gm_mgLevel.mg_strText = FindLevelByFileName(_pGame->gam_strCustomLevel).li_strName;
} }
#undef CMENU #undef CMENU

File diff suppressed because it is too large Load Diff

View File

@ -102,7 +102,7 @@ extern CTString sam_strModName = TRANS("- O P E N S O U R C E -");
#if _SE_DEMO #if _SE_DEMO
extern CTString sam_strFirstLevel = "Levels\\KarnakDemo.wld"; extern CTString sam_strFirstLevel = "Levels\\KarnakDemo.wld";
#else #else
extern CTString sam_strFirstLevel = "Levels\\LevelsMP\\1_0_InTheLastEpisode.wld.wld"; extern CTString sam_strFirstLevel = "Levels\\LevelsMP\\1_0_InTheLastEpisode.wld";
#endif #endif
extern CTString sam_strIntroLevel = "Levels\\LevelsMP\\Intro.wld"; extern CTString sam_strIntroLevel = "Levels\\LevelsMP\\Intro.wld";
extern CTString sam_strGameName = "serioussamse"; extern CTString sam_strGameName = "serioussamse";

View File

@ -202,6 +202,7 @@ copy Release\$(TargetName).map $(SolutionDir)..\Bin\ &gt;nul </Command>
<ClCompile Include="GUI\Menus\MCustomizeKeyboard.cpp" /> <ClCompile Include="GUI\Menus\MCustomizeKeyboard.cpp" />
<ClCompile Include="GUI\Menus\MDisabled.cpp" /> <ClCompile Include="GUI\Menus\MDisabled.cpp" />
<ClCompile Include="GUI\Menus\Menu.cpp" /> <ClCompile Include="GUI\Menus\Menu.cpp" />
<ClCompile Include="GUI\Menus\MenuManager.cpp" />
<ClCompile Include="GUI\Menus\MenuPrinting.cpp" /> <ClCompile Include="GUI\Menus\MenuPrinting.cpp" />
<ClCompile Include="GUI\Menus\MenuStuff.cpp" /> <ClCompile Include="GUI\Menus\MenuStuff.cpp" />
<ClCompile Include="GUI\Menus\Menu_actions.cpp" /> <ClCompile Include="GUI\Menus\Menu_actions.cpp" />
@ -251,6 +252,7 @@ copy Release\$(TargetName).map $(SolutionDir)..\Bin\ &gt;nul </Command>
<ClInclude Include="GUI\Menus\MCustomizeKeyboard.h" /> <ClInclude Include="GUI\Menus\MCustomizeKeyboard.h" />
<ClInclude Include="GUI\Menus\MDisabled.h" /> <ClInclude Include="GUI\Menus\MDisabled.h" />
<ClInclude Include="GUI\Menus\Menu.h" /> <ClInclude Include="GUI\Menus\Menu.h" />
<ClInclude Include="GUI\Menus\MenuManager.h" />
<ClInclude Include="GUI\Menus\MenuPrinting.h" /> <ClInclude Include="GUI\Menus\MenuPrinting.h" />
<ClInclude Include="GUI\Menus\MenuStuff.h" /> <ClInclude Include="GUI\Menus\MenuStuff.h" />
<ClInclude Include="GUI\Menus\Menu_starters.h" /> <ClInclude Include="GUI\Menus\Menu_starters.h" />

View File

@ -207,6 +207,9 @@
<ClCompile Include="GUI\Menus\Menu_actions.cpp"> <ClCompile Include="GUI\Menus\Menu_actions.cpp">
<Filter>Source Files\GUI\Menus</Filter> <Filter>Source Files\GUI\Menus</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="GUI\Menus\MenuManager.cpp">
<Filter>Source Files\GUI\Menus</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="CDCheck.h"> <ClInclude Include="CDCheck.h">
@ -392,6 +395,9 @@
<ClInclude Include="GUI\Menus\Menu_starters.h"> <ClInclude Include="GUI\Menus\Menu_starters.h">
<Filter>Header Files\GUI headers\Menus headers</Filter> <Filter>Header Files\GUI headers\Menus headers</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="GUI\Menus\MenuManager.h">
<Filter>Header Files\GUI headers\Menus headers</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="SeriousSam.rc"> <ResourceCompile Include="SeriousSam.rc">