GameExecutable: Move some stuff from Menu.cpp into files PART TWO

Menu.cpp is so large(>6000 lines). I'll separate it!
This commit is contained in:
zcaliptium 2016-03-14 02:46:30 +03:00
parent 189c343368
commit 220875d2de
11 changed files with 407 additions and 315 deletions

View File

@ -0,0 +1,18 @@
/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */
#include "StdH.h"
#include <Engine/CurrentVersion.h>
#include "MenuPrinting.h"
#include "MDisabled.h"
void CDisabledMenu::Initialize_t(void)
{
gm_mgTitle.mg_boxOnScreen = BoxTitle();
gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
gm_mgButton.mg_bfsFontSize = BFS_MEDIUM;
gm_mgButton.mg_boxOnScreen = BoxBigRow(0.0f);
gm_lhGadgets.AddTail(gm_mgButton.mg_lnNode);
gm_mgButton.mg_pActivatedFunction = NULL;
}

View File

@ -7,10 +7,15 @@
#endif #endif
#include "GameMenu.h" #include "GameMenu.h"
#include "MGButton.h"
#include "MGTitle.h"
class CDisabledMenu : public CGameMenu { class CDisabledMenu : public CGameMenu {
public: public:
CMGTitle gm_mgTitle;
CMGButton gm_mgButton;
void Initialize_t(void); void Initialize_t(void);
}; };

View File

@ -0,0 +1,101 @@
/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */
#include "StdH.h"
#include <Engine/CurrentVersion.h>
#include "MenuPrinting.h"
#include "LevelInfo.h"
#include "MLevels.h"
void CLevelsMenu::Initialize_t(void)
{
gm_mgTitle.mg_boxOnScreen = BoxTitle();
gm_mgTitle.mg_strText = TRANS("CHOOSE LEVEL");
gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
for (INDEX iLabel = 0; iLabel<LEVELS_ON_SCREEN; iLabel++)
{
INDEX iPrev = (LEVELS_ON_SCREEN + iLabel - 1) % LEVELS_ON_SCREEN;
INDEX iNext = (iLabel + 1) % LEVELS_ON_SCREEN;
// initialize label gadgets
gm_mgManualLevel[iLabel].mg_pmgUp = &gm_mgManualLevel[iPrev];
gm_mgManualLevel[iLabel].mg_pmgDown = &gm_mgManualLevel[iNext];
gm_mgManualLevel[iLabel].mg_boxOnScreen = BoxMediumRow(iLabel);
gm_mgManualLevel[iLabel].mg_pActivatedFunction = NULL; // never called!
gm_lhGadgets.AddTail(gm_mgManualLevel[iLabel].mg_lnNode);
}
gm_lhGadgets.AddTail(gm_mgArrowUp.mg_lnNode);
gm_lhGadgets.AddTail(gm_mgArrowDn.mg_lnNode);
gm_mgArrowUp.mg_adDirection = AD_UP;
gm_mgArrowDn.mg_adDirection = AD_DOWN;
gm_mgArrowUp.mg_boxOnScreen = BoxArrow(AD_UP);
gm_mgArrowDn.mg_boxOnScreen = BoxArrow(AD_DOWN);
gm_mgArrowUp.mg_pmgRight = gm_mgArrowUp.mg_pmgDown =
&gm_mgManualLevel[0];
gm_mgArrowDn.mg_pmgRight = gm_mgArrowDn.mg_pmgUp =
&gm_mgManualLevel[LEVELS_ON_SCREEN - 1];
gm_ctListVisible = LEVELS_ON_SCREEN;
gm_pmgArrowUp = &gm_mgArrowUp;
gm_pmgArrowDn = &gm_mgArrowDn;
gm_pmgListTop = &gm_mgManualLevel[0];
gm_pmgListBottom = &gm_mgManualLevel[LEVELS_ON_SCREEN - 1];
}
void CLevelsMenu::FillListItems(void)
{
// disable all items first
for (INDEX i = 0; i<LEVELS_ON_SCREEN; i++) {
gm_mgManualLevel[i].mg_bEnabled = FALSE;
gm_mgManualLevel[i].mg_strText = TRANS("<empty>");
gm_mgManualLevel[i].mg_iInList = -2;
}
BOOL bHasFirst = FALSE;
BOOL bHasLast = FALSE;
INDEX ctLabels = _lhFilteredLevels.Count();
INDEX iLabel = 0;
FOREACHINLIST(CLevelInfo, li_lnNode, _lhFilteredLevels, itli) {
CLevelInfo &li = *itli;
INDEX iInMenu = iLabel - gm_iListOffset;
if ((iLabel >= gm_iListOffset) &&
(iLabel<(gm_iListOffset + LEVELS_ON_SCREEN)))
{
bHasFirst |= (iLabel == 0);
bHasLast |= (iLabel == ctLabels - 1);
gm_mgManualLevel[iInMenu].mg_strText = li.li_strName;
gm_mgManualLevel[iInMenu].mg_fnmLevel = li.li_fnLevel;
gm_mgManualLevel[iInMenu].mg_bEnabled = TRUE;
gm_mgManualLevel[iInMenu].mg_iInList = iLabel;
}
iLabel++;
}
// enable/disable up/down arrows
gm_mgArrowUp.mg_bEnabled = !bHasFirst && ctLabels>0;
gm_mgArrowDn.mg_bEnabled = !bHasLast && ctLabels>0;
}
void CLevelsMenu::StartMenu(void)
{
// set default parameters for the list
gm_iListOffset = 0;
gm_ctListTotal = _lhFilteredLevels.Count();
gm_iListWantedItem = 0;
// for each level
INDEX i = 0;
FOREACHINLIST(CLevelInfo, li_lnNode, _lhFilteredLevels, itlid) {
CLevelInfo &lid = *itlid;
// if it is the chosen one
if (lid.li_fnLevel == _pGame->gam_strCustomLevel) {
// demand focus on it
gm_iListWantedItem = i;
break;
}
i++;
}
CGameMenu::StartMenu();
}

View File

@ -7,10 +7,17 @@
#endif #endif
#include "GameMenu.h" #include "GameMenu.h"
#include "MGArrow.h"
#include "MGLevelButton.h"
#include "MGTitle.h"
class CLevelsMenu : public CGameMenu { class CLevelsMenu : public CGameMenu {
public: public:
CMGTitle gm_mgTitle;
CMGLevelButton gm_mgManualLevel[LEVELS_ON_SCREEN];
CMGArrow gm_mgArrowUp;
CMGArrow gm_mgArrowDn;
void Initialize_t(void); void Initialize_t(void);
void FillListItems(void); void FillListItems(void);
void StartMenu(void); void StartMenu(void);

View File

@ -0,0 +1,87 @@
/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */
#include "StdH.h"
#include <Engine/CurrentVersion.h>
#include "MenuPrinting.h"
#include "MenuStuff.h"
#include "MSinglePlayerNew.h"
void CSinglePlayerNewMenu::Initialize_t(void)
{
// intialize single player new menu
gm_mgTitle.mg_strText = TRANS("NEW GAME");
gm_mgTitle.mg_boxOnScreen = BoxTitle();
gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
gm_mgTourist.mg_strText = TRANS("TOURIST");
gm_mgTourist.mg_bfsFontSize = BFS_LARGE;
gm_mgTourist.mg_boxOnScreen = BoxBigRow(0.0f);
gm_mgTourist.mg_strTip = TRANS("for non-FPS players");
gm_lhGadgets.AddTail(gm_mgTourist.mg_lnNode);
gm_mgTourist.mg_pmgUp = &gm_mgSerious;
gm_mgTourist.mg_pmgDown = &gm_mgEasy;
gm_mgTourist.mg_pActivatedFunction = NULL;
gm_mgEasy.mg_strText = TRANS("EASY");
gm_mgEasy.mg_bfsFontSize = BFS_LARGE;
gm_mgEasy.mg_boxOnScreen = BoxBigRow(1.0f);
gm_mgEasy.mg_strTip = TRANS("for unexperienced FPS players");
gm_lhGadgets.AddTail(gm_mgEasy.mg_lnNode);
gm_mgEasy.mg_pmgUp = &gm_mgTourist;
gm_mgEasy.mg_pmgDown = &gm_mgMedium;
gm_mgEasy.mg_pActivatedFunction = NULL;
gm_mgMedium.mg_strText = TRANS("NORMAL");
gm_mgMedium.mg_bfsFontSize = BFS_LARGE;
gm_mgMedium.mg_boxOnScreen = BoxBigRow(2.0f);
gm_mgMedium.mg_strTip = TRANS("for experienced FPS players");
gm_lhGadgets.AddTail(gm_mgMedium.mg_lnNode);
gm_mgMedium.mg_pmgUp = &gm_mgEasy;
gm_mgMedium.mg_pmgDown = &gm_mgHard;
gm_mgMedium.mg_pActivatedFunction = NULL;
gm_mgHard.mg_strText = TRANS("HARD");
gm_mgHard.mg_bfsFontSize = BFS_LARGE;
gm_mgHard.mg_boxOnScreen = BoxBigRow(3.0f);
gm_mgHard.mg_strTip = TRANS("for experienced Serious Sam players");
gm_lhGadgets.AddTail(gm_mgHard.mg_lnNode);
gm_mgHard.mg_pmgUp = &gm_mgMedium;
gm_mgHard.mg_pmgDown = &gm_mgSerious;
gm_mgHard.mg_pActivatedFunction = NULL;
gm_mgSerious.mg_strText = TRANS("SERIOUS");
gm_mgSerious.mg_bfsFontSize = BFS_LARGE;
gm_mgSerious.mg_boxOnScreen = BoxBigRow(4.0f);
gm_mgSerious.mg_strTip = TRANS("are you serious?");
gm_lhGadgets.AddTail(gm_mgSerious.mg_lnNode);
gm_mgSerious.mg_pmgUp = &gm_mgHard;
gm_mgSerious.mg_pmgDown = &gm_mgTourist;
gm_mgSerious.mg_pActivatedFunction = NULL;
gm_mgMental.mg_strText = TRANS("MENTAL");
gm_mgMental.mg_bfsFontSize = BFS_LARGE;
gm_mgMental.mg_boxOnScreen = BoxBigRow(5.0f);
gm_mgMental.mg_strTip = TRANS("you are not serious!");
gm_lhGadgets.AddTail(gm_mgMental.mg_lnNode);
gm_mgMental.mg_pmgUp = &gm_mgSerious;
gm_mgMental.mg_pmgDown = &gm_mgTourist;
gm_mgMental.mg_pActivatedFunction = NULL;
gm_mgMental.mg_bMental = TRUE;
}
void CSinglePlayerNewMenu::StartMenu(void)
{
CGameMenu::StartMenu();
extern INDEX sam_bMentalActivated;
if (sam_bMentalActivated) {
gm_mgMental.Appear();
gm_mgSerious.mg_pmgDown = &gm_mgMental;
gm_mgTourist.mg_pmgUp = &gm_mgMental;
} else {
gm_mgMental.Disappear();
gm_mgSerious.mg_pmgDown = &gm_mgTourist;
gm_mgTourist.mg_pmgUp = &gm_mgSerious;
}
}

View File

@ -7,10 +7,20 @@
#endif #endif
#include "GameMenu.h" #include "GameMenu.h"
#include "MGButton.h"
#include "MGTitle.h"
class CSinglePlayerNewMenu : public CGameMenu { class CSinglePlayerNewMenu : public CGameMenu {
public: public:
CMGTitle gm_mgTitle;
CMGButton gm_mgTourist;
CMGButton gm_mgEasy;
CMGButton gm_mgMedium;
CMGButton gm_mgHard;
CMGButton gm_mgSerious;
CMGButton gm_mgMental;
void Initialize_t(void); void Initialize_t(void);
void StartMenu(void); void StartMenu(void);
}; };

121
Sources/SeriousSam/MVar.cpp Normal file
View File

@ -0,0 +1,121 @@
/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */
#include "StdH.h"
#include <Engine/CurrentVersion.h>
#include "MenuPrinting.h"
#include "VarList.h"
#include "MVar.h"
extern BOOL _bVarChanged;
void CVarMenu::Initialize_t(void)
{
gm_mgTitle.mg_boxOnScreen = BoxTitle();
gm_mgTitle.mg_strText = "";
gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
for (INDEX iLabel = 0; iLabel<VARS_ON_SCREEN; iLabel++)
{
INDEX iPrev = (VARS_ON_SCREEN + iLabel - 1) % VARS_ON_SCREEN;
INDEX iNext = (iLabel + 1) % VARS_ON_SCREEN;
// initialize label gadgets
gm_mgVar[iLabel].mg_pmgUp = &gm_mgVar[iPrev];
gm_mgVar[iLabel].mg_pmgDown = &gm_mgVar[iNext];
gm_mgVar[iLabel].mg_pmgLeft = &gm_mgApply;
gm_mgVar[iLabel].mg_boxOnScreen = BoxMediumRow(iLabel);
gm_mgVar[iLabel].mg_pActivatedFunction = NULL; // never called!
gm_lhGadgets.AddTail(gm_mgVar[iLabel].mg_lnNode);
}
gm_mgApply.mg_boxOnScreen = BoxMediumRow(16.5f);
gm_mgApply.mg_bfsFontSize = BFS_LARGE;
gm_mgApply.mg_iCenterI = 1;
gm_mgApply.mg_pmgLeft =
gm_mgApply.mg_pmgRight =
gm_mgApply.mg_pmgUp =
gm_mgApply.mg_pmgDown = &gm_mgVar[0];
gm_mgApply.mg_strText = TRANS("APPLY");
gm_mgApply.mg_strTip = TRANS("apply changes");
gm_lhGadgets.AddTail(gm_mgApply.mg_lnNode);
gm_mgApply.mg_pActivatedFunction = NULL;
gm_lhGadgets.AddTail(gm_mgArrowUp.mg_lnNode);
gm_lhGadgets.AddTail(gm_mgArrowDn.mg_lnNode);
gm_mgArrowUp.mg_adDirection = AD_UP;
gm_mgArrowDn.mg_adDirection = AD_DOWN;
gm_mgArrowUp.mg_boxOnScreen = BoxArrow(AD_UP);
gm_mgArrowDn.mg_boxOnScreen = BoxArrow(AD_DOWN);
gm_mgArrowUp.mg_pmgRight = gm_mgArrowUp.mg_pmgDown =
&gm_mgVar[0];
gm_mgArrowDn.mg_pmgRight = gm_mgArrowDn.mg_pmgUp =
&gm_mgVar[VARS_ON_SCREEN - 1];
gm_ctListVisible = VARS_ON_SCREEN;
gm_pmgArrowUp = &gm_mgArrowUp;
gm_pmgArrowDn = &gm_mgArrowDn;
gm_pmgListTop = &gm_mgVar[0];
gm_pmgListBottom = &gm_mgVar[VARS_ON_SCREEN - 1];
}
void CVarMenu::FillListItems(void)
{
// disable all items first
for (INDEX i = 0; i<VARS_ON_SCREEN; i++) {
gm_mgVar[i].mg_bEnabled = FALSE;
gm_mgVar[i].mg_pvsVar = NULL;
gm_mgVar[i].mg_iInList = -2;
}
BOOL bHasFirst = FALSE;
BOOL bHasLast = FALSE;
INDEX ctLabels = _lhVarSettings.Count();
INDEX iLabel = 0;
FOREACHINLIST(CVarSetting, vs_lnNode, _lhVarSettings, itvs) {
CVarSetting &vs = *itvs;
INDEX iInMenu = iLabel - gm_iListOffset;
if ((iLabel >= gm_iListOffset) &&
(iLabel<(gm_iListOffset + VARS_ON_SCREEN)))
{
bHasFirst |= (iLabel == 0);
bHasLast |= (iLabel == ctLabels - 1);
gm_mgVar[iInMenu].mg_pvsVar = &vs;
gm_mgVar[iInMenu].mg_strTip = vs.vs_strTip;
gm_mgVar[iInMenu].mg_bEnabled = gm_mgVar[iInMenu].IsEnabled();
gm_mgVar[iInMenu].mg_iInList = iLabel;
}
iLabel++;
}
// enable/disable up/down arrows
gm_mgArrowUp.mg_bEnabled = !bHasFirst && ctLabels>0;
gm_mgArrowDn.mg_bEnabled = !bHasLast && ctLabels>0;
}
void CVarMenu::StartMenu(void)
{
LoadVarSettings(gm_fnmMenuCFG);
// set default parameters for the list
gm_iListOffset = 0;
gm_ctListTotal = _lhVarSettings.Count();
gm_iListWantedItem = 0;
CGameMenu::StartMenu();
}
void CVarMenu::EndMenu(void)
{
// disable all items first
for (INDEX i = 0; i<VARS_ON_SCREEN; i++) {
gm_mgVar[i].mg_bEnabled = FALSE;
gm_mgVar[i].mg_pvsVar = NULL;
gm_mgVar[i].mg_iInList = -2;
}
FlushVarSettings(FALSE);
_bVarChanged = FALSE;
}
void CVarMenu::Think(void)
{
gm_mgApply.mg_bEnabled = _bVarChanged;
extern void FixupBackButton(CGameMenu *pgm);
FixupBackButton(this);
}

View File

@ -7,11 +7,22 @@
#endif #endif
#include "GameMenu.h" #include "GameMenu.h"
#include "MGArrow.h"
#include "MGButton.h"
#include "MGTitle.h"
#include "MGVarButton.h"
class CVarMenu : public CGameMenu { class CVarMenu : public CGameMenu {
public: public:
CTFileName gm_fnmMenuCFG; CTFileName gm_fnmMenuCFG;
CMGTitle gm_mgTitle;
CMGVarButton gm_mgVar[LEVELS_ON_SCREEN];
CMGButton gm_mgApply;
CMGArrow gm_mgArrowUp;
CMGArrow gm_mgArrowDn;
void Initialize_t(void); void Initialize_t(void);
void FillListItems(void); void FillListItems(void);
void StartMenu(void); void StartMenu(void);

View File

@ -107,6 +107,9 @@ void InitActionsForConfirmMenu();
void InitActionsForMainMenu(); void InitActionsForMainMenu();
void InitActionsForInGameMenu(); void InitActionsForInGameMenu();
void InitActionsForSinglePlayerMenu(); void InitActionsForSinglePlayerMenu();
void InitActionsForSinglePlayerNewMenu();
void InitActionsForVarMenu();
// 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;
@ -296,32 +299,16 @@ CSinglePlayerMenu gmSinglePlayerMenu;
// -------- New single player menu // -------- New single player menu
CSinglePlayerNewMenu gmSinglePlayerNewMenu; CSinglePlayerNewMenu gmSinglePlayerNewMenu;
CMGTitle mgSingleNewTitle;
CMGButton mgSingleNewTourist;
CMGButton mgSingleNewEasy;
CMGButton mgSingleNewMedium;
CMGButton mgSingleNewHard;
CMGButton mgSingleNewSerious;
CMGButton mgSingleNewMental;
// -------- Disabled menu // -------- Disabled menu
CDisabledMenu gmDisabledFunction; CDisabledMenu gmDisabledFunction;
CMGTitle mgDisabledTitle;
CMGButton mgDisabledMenuButton;
// -------- Manual levels menu // -------- Manual levels menu
CLevelsMenu gmLevelsMenu; CLevelsMenu gmLevelsMenu;
CMGTitle mgLevelsTitle;
CMGLevelButton mgManualLevel[ LEVELS_ON_SCREEN];
CMGArrow mgLevelsArrowUp;
CMGArrow mgLevelsArrowDn;
// -------- console variable adjustment menu // -------- console variable adjustment menu
BOOL _bVarChanged = FALSE; extern BOOL _bVarChanged = FALSE;
CVarMenu gmVarMenu; CVarMenu gmVarMenu;
CMGTitle mgVarTitle;
CMGVarButton mgVar[LEVELS_ON_SCREEN];
CMGButton mgVarApply;
CMGArrow mgVarArrowUp;
CMGArrow mgVarArrowDn;
// -------- Player profile menu // -------- Player profile menu
CPlayerProfileMenu gmPlayerProfile; CPlayerProfileMenu gmPlayerProfile;
@ -1050,8 +1037,8 @@ void StartControlsMenuFromOptions(void)
void DisabledFunction(void) void DisabledFunction(void)
{ {
gmDisabledFunction.gm_pgmParentMenu = pgmCurrentMenu; gmDisabledFunction.gm_pgmParentMenu = pgmCurrentMenu;
mgDisabledMenuButton.mg_strText = TRANS("The feature is not available in this version!"); gmDisabledFunction.gm_mgButton.mg_strText = TRANS("The feature is not available in this version!");
mgDisabledTitle.mg_strText = TRANS("DISABLED"); gmDisabledFunction.gm_mgTitle.mg_strText = TRANS("DISABLED");
ChangeToMenu( &gmDisabledFunction); ChangeToMenu( &gmDisabledFunction);
} }
@ -1426,7 +1413,7 @@ BOOL LSLoadMod(const CTFileName &fnm)
BOOL LSLoadCustom(const CTFileName &fnm) BOOL LSLoadCustom(const CTFileName &fnm)
{ {
mgVarTitle.mg_strText = TRANS("ADVANCED OPTIONS"); gmVarMenu.gm_mgTitle.mg_strText = TRANS("ADVANCED OPTIONS");
// LoadStringVar(fnm.NoExt()+".des", mgVarTitle.mg_strText); // LoadStringVar(fnm.NoExt()+".des", mgVarTitle.mg_strText);
// mgVarTitle.mg_strText.OnlyFirstLine(); // mgVarTitle.mg_strText.OnlyFirstLine();
gmVarMenu.gm_fnmMenuCFG = fnm; gmVarMenu.gm_fnmMenuCFG = fnm;
@ -1817,13 +1804,13 @@ void StartSplitScreenSaveMenu(void)
// game options var settings // game options var settings
void StartVarGameOptions(void) void StartVarGameOptions(void)
{ {
mgVarTitle.mg_strText = TRANS("GAME OPTIONS"); gmVarMenu.gm_mgTitle.mg_strText = TRANS("GAME OPTIONS");
gmVarMenu.gm_fnmMenuCFG = CTFILENAME("Scripts\\Menu\\GameOptions.cfg"); gmVarMenu.gm_fnmMenuCFG = CTFILENAME("Scripts\\Menu\\GameOptions.cfg");
ChangeToMenu( &gmVarMenu); ChangeToMenu( &gmVarMenu);
} }
void StartSinglePlayerGameOptions(void) void StartSinglePlayerGameOptions(void)
{ {
mgVarTitle.mg_strText = TRANS("GAME OPTIONS"); gmVarMenu.gm_mgTitle.mg_strText = TRANS("GAME OPTIONS");
gmVarMenu.gm_fnmMenuCFG = CTFILENAME("Scripts\\Menu\\SPOptions.cfg"); gmVarMenu.gm_fnmMenuCFG = CTFILENAME("Scripts\\Menu\\SPOptions.cfg");
ChangeToMenu( &gmVarMenu); ChangeToMenu( &gmVarMenu);
gmVarMenu.gm_pgmParentMenu = &gmSinglePlayerMenu; gmVarMenu.gm_pgmParentMenu = &gmSinglePlayerMenu;
@ -1845,7 +1832,7 @@ void StartGameOptionsFromSplitScreen(void)
// rendering options var settings // rendering options var settings
void StartRenderingOptionsMenu(void) void StartRenderingOptionsMenu(void)
{ {
mgVarTitle.mg_strText = TRANS("RENDERING OPTIONS"); gmVarMenu.gm_mgTitle.mg_strText = TRANS("RENDERING OPTIONS");
gmVarMenu.gm_fnmMenuCFG = CTFILENAME("Scripts\\Menu\\RenderingOptions.cfg"); gmVarMenu.gm_fnmMenuCFG = CTFILENAME("Scripts\\Menu\\RenderingOptions.cfg");
gmVarMenu.gm_pgmParentMenu = &gmVideoOptionsMenu; gmVarMenu.gm_pgmParentMenu = &gmVideoOptionsMenu;
ChangeToMenu( &gmVarMenu); ChangeToMenu( &gmVarMenu);
@ -2210,12 +2197,13 @@ void InitializeMenus(void)
gmSinglePlayerNewMenu.Initialize_t(); gmSinglePlayerNewMenu.Initialize_t();
gmSinglePlayerNewMenu.gm_strName="SinglePlayerNew"; gmSinglePlayerNewMenu.gm_strName="SinglePlayerNew";
gmSinglePlayerNewMenu.gm_pmgSelectedByDefault = &mgSingleNewMedium; gmSinglePlayerNewMenu.gm_pmgSelectedByDefault = &gmSinglePlayerNewMenu.gm_mgMedium;
gmSinglePlayerNewMenu.gm_pgmParentMenu = &gmSinglePlayerMenu; gmSinglePlayerNewMenu.gm_pgmParentMenu = &gmSinglePlayerMenu;
InitActionsForSinglePlayerNewMenu();
gmDisabledFunction.Initialize_t(); gmDisabledFunction.Initialize_t();
gmDisabledFunction.gm_strName="DisabledFunction"; gmDisabledFunction.gm_strName="DisabledFunction";
gmDisabledFunction.gm_pmgSelectedByDefault = &mgDisabledMenuButton; gmDisabledFunction.gm_pmgSelectedByDefault = &gmDisabledFunction.gm_mgButton;
gmDisabledFunction.gm_pgmParentMenu = NULL; gmDisabledFunction.gm_pgmParentMenu = NULL;
gmPlayerProfile.Initialize_t(); gmPlayerProfile.Initialize_t();
@ -2263,13 +2251,14 @@ void InitializeMenus(void)
gmLevelsMenu.Initialize_t(); gmLevelsMenu.Initialize_t();
gmLevelsMenu.gm_strName="Levels"; gmLevelsMenu.gm_strName="Levels";
gmLevelsMenu.gm_pmgSelectedByDefault = &mgManualLevel[0]; gmLevelsMenu.gm_pmgSelectedByDefault = &gmLevelsMenu.gm_mgManualLevel[0];
gmLevelsMenu.gm_pgmParentMenu = &gmSinglePlayerMenu; gmLevelsMenu.gm_pgmParentMenu = &gmSinglePlayerMenu;
gmVarMenu.Initialize_t(); gmVarMenu.Initialize_t();
gmVarMenu.gm_strName="Var"; gmVarMenu.gm_strName="Var";
gmVarMenu.gm_pmgSelectedByDefault = &mgVar[0]; gmVarMenu.gm_pmgSelectedByDefault = &gmVarMenu.gm_mgVar[0];
gmVarMenu.gm_pgmParentMenu = &gmNetworkStartMenu; gmVarMenu.gm_pgmParentMenu = &gmNetworkStartMenu;
InitActionsForVarMenu();
gmServersMenu.Initialize_t(); gmServersMenu.Initialize_t();
gmServersMenu.gm_strName="Servers"; gmServersMenu.gm_strName="Servers";
@ -2769,7 +2758,7 @@ void MenuBack(void)
MenuGoToParent(); MenuGoToParent();
} }
void FixupBackButton(CGameMenu *pgm) extern void FixupBackButton(CGameMenu *pgm)
{ {
BOOL bResume = FALSE; BOOL bResume = FALSE;
@ -3259,93 +3248,16 @@ void InitActionsForSinglePlayerMenu() {
} }
// ------------------------ CSinglePlayerNewMenu implementation // ------------------------ CSinglePlayerNewMenu implementation
void CSinglePlayerNewMenu::Initialize_t(void) void InitActionsForSinglePlayerNewMenu() {
{ gmSinglePlayerNewMenu.gm_mgTourist.mg_pActivatedFunction = &StartSinglePlayerGame_Tourist;
// intialize single player new menu gmSinglePlayerNewMenu.gm_mgEasy.mg_pActivatedFunction = &StartSinglePlayerGame_Easy;
mgSingleNewTitle.mg_strText = TRANS("NEW GAME"); gmSinglePlayerNewMenu.gm_mgMedium.mg_pActivatedFunction = &StartSinglePlayerGame_Normal;
mgSingleNewTitle.mg_boxOnScreen = BoxTitle(); gmSinglePlayerNewMenu.gm_mgHard.mg_pActivatedFunction = &StartSinglePlayerGame_Hard;
gm_lhGadgets.AddTail( mgSingleNewTitle.mg_lnNode); gmSinglePlayerNewMenu.gm_mgSerious.mg_pActivatedFunction = &StartSinglePlayerGame_Serious;
gmSinglePlayerNewMenu.gm_mgMental.mg_pActivatedFunction = &StartSinglePlayerGame_Mental;
mgSingleNewTourist.mg_strText = TRANS("TOURIST");
mgSingleNewTourist.mg_bfsFontSize = BFS_LARGE;
mgSingleNewTourist.mg_boxOnScreen = BoxBigRow(0.0f);
mgSingleNewTourist.mg_strTip = TRANS("for non-FPS players");
gm_lhGadgets.AddTail( mgSingleNewTourist.mg_lnNode);
mgSingleNewTourist.mg_pmgUp = &mgSingleNewSerious;
mgSingleNewTourist.mg_pmgDown = &mgSingleNewEasy;
mgSingleNewTourist.mg_pActivatedFunction = &StartSinglePlayerGame_Tourist;
mgSingleNewEasy.mg_strText = TRANS("EASY");
mgSingleNewEasy.mg_bfsFontSize = BFS_LARGE;
mgSingleNewEasy.mg_boxOnScreen = BoxBigRow(1.0f);
mgSingleNewEasy.mg_strTip = TRANS("for unexperienced FPS players");
gm_lhGadgets.AddTail( mgSingleNewEasy.mg_lnNode);
mgSingleNewEasy.mg_pmgUp = &mgSingleNewTourist;
mgSingleNewEasy.mg_pmgDown = &mgSingleNewMedium;
mgSingleNewEasy.mg_pActivatedFunction = &StartSinglePlayerGame_Easy;
mgSingleNewMedium.mg_strText = TRANS("NORMAL");
mgSingleNewMedium.mg_bfsFontSize = BFS_LARGE;
mgSingleNewMedium.mg_boxOnScreen = BoxBigRow(2.0f);
mgSingleNewMedium.mg_strTip = TRANS("for experienced FPS players");
gm_lhGadgets.AddTail( mgSingleNewMedium.mg_lnNode);
mgSingleNewMedium.mg_pmgUp = &mgSingleNewEasy;
mgSingleNewMedium.mg_pmgDown = &mgSingleNewHard;
mgSingleNewMedium.mg_pActivatedFunction = &StartSinglePlayerGame_Normal;
mgSingleNewHard.mg_strText = TRANS("HARD");
mgSingleNewHard.mg_bfsFontSize = BFS_LARGE;
mgSingleNewHard.mg_boxOnScreen = BoxBigRow(3.0f);
mgSingleNewHard.mg_strTip = TRANS("for experienced Serious Sam players");
gm_lhGadgets.AddTail( mgSingleNewHard.mg_lnNode);
mgSingleNewHard.mg_pmgUp = &mgSingleNewMedium;
mgSingleNewHard.mg_pmgDown = &mgSingleNewSerious;
mgSingleNewHard.mg_pActivatedFunction = &StartSinglePlayerGame_Hard;
mgSingleNewSerious.mg_strText = TRANS("SERIOUS");
mgSingleNewSerious.mg_bfsFontSize = BFS_LARGE;
mgSingleNewSerious.mg_boxOnScreen = BoxBigRow(4.0f);
mgSingleNewSerious.mg_strTip = TRANS("are you serious?");
gm_lhGadgets.AddTail( mgSingleNewSerious.mg_lnNode);
mgSingleNewSerious.mg_pmgUp = &mgSingleNewHard;
mgSingleNewSerious.mg_pmgDown = &mgSingleNewTourist;
mgSingleNewSerious.mg_pActivatedFunction = &StartSinglePlayerGame_Serious;
mgSingleNewMental.mg_strText = TRANS("MENTAL");
mgSingleNewMental.mg_bfsFontSize = BFS_LARGE;
mgSingleNewMental.mg_boxOnScreen = BoxBigRow(5.0f);
mgSingleNewMental.mg_strTip = TRANS("you are not serious!");
gm_lhGadgets.AddTail( mgSingleNewMental.mg_lnNode);
mgSingleNewMental.mg_pmgUp = &mgSingleNewSerious;
mgSingleNewMental.mg_pmgDown = &mgSingleNewTourist;
mgSingleNewMental.mg_pActivatedFunction = &StartSinglePlayerGame_Mental;
mgSingleNewMental.mg_bMental = TRUE;
}
void CSinglePlayerNewMenu::StartMenu(void)
{
CGameMenu::StartMenu();
extern INDEX sam_bMentalActivated;
if (sam_bMentalActivated) {
mgSingleNewMental.Appear();
mgSingleNewSerious.mg_pmgDown = &mgSingleNewMental;
mgSingleNewTourist.mg_pmgUp = &mgSingleNewMental;
} else {
mgSingleNewMental.Disappear();
mgSingleNewSerious.mg_pmgDown = &mgSingleNewTourist;
mgSingleNewTourist.mg_pmgUp = &mgSingleNewSerious;
}
} }
void CDisabledMenu::Initialize_t(void) // ------------------------ CDisabledMenu implementation
{
mgDisabledTitle.mg_boxOnScreen = BoxTitle();
gm_lhGadgets.AddTail( mgDisabledTitle.mg_lnNode);
mgDisabledMenuButton.mg_bfsFontSize = BFS_MEDIUM;
mgDisabledMenuButton.mg_boxOnScreen = BoxBigRow(0.0f);
gm_lhGadgets.AddTail( mgDisabledMenuButton.mg_lnNode);
mgDisabledMenuButton.mg_pActivatedFunction = NULL;
}
void ChangeCrosshair(INDEX iNew) void ChangeCrosshair(INDEX iNew)
{ {
@ -4718,97 +4630,7 @@ void CAudioOptionsMenu::StartMenu(void)
CGameMenu::StartMenu(); CGameMenu::StartMenu();
} }
// ------------------------ CLevelsMenu implementation // ------------------------ CVarMenu implementation
void CLevelsMenu::FillListItems(void)
{
// disable all items first
for(INDEX i=0; i<LEVELS_ON_SCREEN; i++) {
mgManualLevel[i].mg_bEnabled = FALSE;
mgManualLevel[i].mg_strText = TRANS("<empty>");
mgManualLevel[i].mg_iInList = -2;
}
BOOL bHasFirst = FALSE;
BOOL bHasLast = FALSE;
INDEX ctLabels = _lhFilteredLevels.Count();
INDEX iLabel=0;
FOREACHINLIST(CLevelInfo, li_lnNode, _lhFilteredLevels, itli) {
CLevelInfo &li = *itli;
INDEX iInMenu = iLabel-gm_iListOffset;
if( (iLabel>=gm_iListOffset) &&
(iLabel<(gm_iListOffset+LEVELS_ON_SCREEN)) )
{
bHasFirst|=(iLabel==0);
bHasLast |=(iLabel==ctLabels-1);
mgManualLevel[iInMenu].mg_strText = li.li_strName;
mgManualLevel[iInMenu].mg_fnmLevel = li.li_fnLevel;
mgManualLevel[iInMenu].mg_bEnabled = TRUE;
mgManualLevel[iInMenu].mg_iInList = iLabel;
}
iLabel++;
}
// enable/disable up/down arrows
mgLevelsArrowUp.mg_bEnabled = !bHasFirst && ctLabels>0;
mgLevelsArrowDn.mg_bEnabled = !bHasLast && ctLabels>0;
}
void CLevelsMenu::Initialize_t(void)
{
mgLevelsTitle.mg_boxOnScreen = BoxTitle();
mgLevelsTitle.mg_strText = TRANS("CHOOSE LEVEL");
gm_lhGadgets.AddTail( mgLevelsTitle.mg_lnNode);
for( INDEX iLabel=0; iLabel<LEVELS_ON_SCREEN; iLabel++)
{
INDEX iPrev = (LEVELS_ON_SCREEN+iLabel-1)%LEVELS_ON_SCREEN;
INDEX iNext = (iLabel+1)%LEVELS_ON_SCREEN;
// initialize label gadgets
mgManualLevel[iLabel].mg_pmgUp = &mgManualLevel[iPrev];
mgManualLevel[iLabel].mg_pmgDown = &mgManualLevel[iNext];
mgManualLevel[iLabel].mg_boxOnScreen = BoxMediumRow(iLabel);
mgManualLevel[iLabel].mg_pActivatedFunction = NULL; // never called!
gm_lhGadgets.AddTail( mgManualLevel[iLabel].mg_lnNode);
}
gm_lhGadgets.AddTail( mgLevelsArrowUp.mg_lnNode);
gm_lhGadgets.AddTail( mgLevelsArrowDn.mg_lnNode);
mgLevelsArrowUp.mg_adDirection = AD_UP;
mgLevelsArrowDn.mg_adDirection = AD_DOWN;
mgLevelsArrowUp.mg_boxOnScreen = BoxArrow(AD_UP);
mgLevelsArrowDn.mg_boxOnScreen = BoxArrow(AD_DOWN);
mgLevelsArrowUp.mg_pmgRight = mgLevelsArrowUp.mg_pmgDown =
&mgManualLevel[0];
mgLevelsArrowDn.mg_pmgRight = mgLevelsArrowDn.mg_pmgUp =
&mgManualLevel[LEVELS_ON_SCREEN-1];
gm_ctListVisible = LEVELS_ON_SCREEN;
gm_pmgArrowUp = &mgLevelsArrowUp;
gm_pmgArrowDn = &mgLevelsArrowDn;
gm_pmgListTop = &mgManualLevel[0];
gm_pmgListBottom = &mgManualLevel[LEVELS_ON_SCREEN-1];
}
void CLevelsMenu::StartMenu(void)
{
// set default parameters for the list
gm_iListOffset = 0;
gm_ctListTotal = _lhFilteredLevels.Count();
gm_iListWantedItem = 0;
// for each level
INDEX i=0;
FOREACHINLIST(CLevelInfo, li_lnNode, _lhFilteredLevels, itlid) {
CLevelInfo &lid = *itlid;
// if it is the chosen one
if (lid.li_fnLevel == _pGame->gam_strCustomLevel) {
// demand focus on it
gm_iListWantedItem = i;
break;
}
i++;
}
CGameMenu::StartMenu();
}
void VarApply(void) void VarApply(void)
{ {
FlushVarSettings(TRUE); FlushVarSettings(TRUE);
@ -4816,114 +4638,8 @@ void VarApply(void)
gmVarMenu.StartMenu(); gmVarMenu.StartMenu();
} }
void CVarMenu::Initialize_t(void) void InitActionsForVarMenu() {
{ gmVarMenu.gm_mgApply.mg_pActivatedFunction = &VarApply;
mgVarTitle.mg_boxOnScreen = BoxTitle();
mgVarTitle.mg_strText = "";
gm_lhGadgets.AddTail( mgVarTitle.mg_lnNode);
for( INDEX iLabel=0; iLabel<VARS_ON_SCREEN; iLabel++)
{
INDEX iPrev = (VARS_ON_SCREEN+iLabel-1)%VARS_ON_SCREEN;
INDEX iNext = (iLabel+1)%VARS_ON_SCREEN;
// initialize label gadgets
mgVar[iLabel].mg_pmgUp = &mgVar[iPrev];
mgVar[iLabel].mg_pmgDown = &mgVar[iNext];
mgVar[iLabel].mg_pmgLeft = &mgVarApply;
mgVar[iLabel].mg_boxOnScreen = BoxMediumRow(iLabel);
mgVar[iLabel].mg_pActivatedFunction = NULL; // never called!
gm_lhGadgets.AddTail( mgVar[iLabel].mg_lnNode);
}
mgVarApply.mg_boxOnScreen = BoxMediumRow(16.5f);
mgVarApply.mg_bfsFontSize = BFS_LARGE;
mgVarApply.mg_iCenterI = 1;
mgVarApply.mg_pmgLeft =
mgVarApply.mg_pmgRight =
mgVarApply.mg_pmgUp =
mgVarApply.mg_pmgDown = &mgVar[0];
mgVarApply.mg_strText = TRANS("APPLY");
mgVarApply.mg_strTip = TRANS("apply changes");
gm_lhGadgets.AddTail( mgVarApply.mg_lnNode);
mgVarApply.mg_pActivatedFunction = &VarApply;
gm_lhGadgets.AddTail( mgVarArrowUp.mg_lnNode);
gm_lhGadgets.AddTail( mgVarArrowDn.mg_lnNode);
mgVarArrowUp.mg_adDirection = AD_UP;
mgVarArrowDn.mg_adDirection = AD_DOWN;
mgVarArrowUp.mg_boxOnScreen = BoxArrow(AD_UP);
mgVarArrowDn.mg_boxOnScreen = BoxArrow(AD_DOWN);
mgVarArrowUp.mg_pmgRight = mgVarArrowUp.mg_pmgDown =
&mgVar[0];
mgVarArrowDn.mg_pmgRight = mgVarArrowDn.mg_pmgUp =
&mgVar[VARS_ON_SCREEN-1];
gm_ctListVisible = VARS_ON_SCREEN;
gm_pmgArrowUp = &mgVarArrowUp;
gm_pmgArrowDn = &mgVarArrowDn;
gm_pmgListTop = &mgVar[0];
gm_pmgListBottom = &mgVar[VARS_ON_SCREEN-1];
}
void CVarMenu::FillListItems(void)
{
// disable all items first
for(INDEX i=0; i<VARS_ON_SCREEN; i++) {
mgVar[i].mg_bEnabled = FALSE;
mgVar[i].mg_pvsVar = NULL;
mgVar[i].mg_iInList = -2;
}
BOOL bHasFirst = FALSE;
BOOL bHasLast = FALSE;
INDEX ctLabels = _lhVarSettings.Count();
INDEX iLabel=0;
FOREACHINLIST(CVarSetting, vs_lnNode, _lhVarSettings, itvs) {
CVarSetting &vs = *itvs;
INDEX iInMenu = iLabel-gm_iListOffset;
if( (iLabel>=gm_iListOffset) &&
(iLabel<(gm_iListOffset+VARS_ON_SCREEN)) )
{
bHasFirst|=(iLabel==0);
bHasLast |=(iLabel==ctLabels-1);
mgVar[iInMenu].mg_pvsVar = &vs;
mgVar[iInMenu].mg_strTip = vs.vs_strTip;
mgVar[iInMenu].mg_bEnabled = mgVar[iInMenu].IsEnabled();
mgVar[iInMenu].mg_iInList = iLabel;
}
iLabel++;
}
// enable/disable up/down arrows
mgVarArrowUp.mg_bEnabled = !bHasFirst && ctLabels>0;
mgVarArrowDn.mg_bEnabled = !bHasLast && ctLabels>0;
}
void CVarMenu::StartMenu(void)
{
LoadVarSettings(gm_fnmMenuCFG);
// set default parameters for the list
gm_iListOffset = 0;
gm_ctListTotal = _lhVarSettings.Count();
gm_iListWantedItem = 0;
CGameMenu::StartMenu();
}
void CVarMenu::EndMenu(void)
{
// disable all items first
for(INDEX i=0; i<VARS_ON_SCREEN; i++) {
mgVar[i].mg_bEnabled = FALSE;
mgVar[i].mg_pvsVar = NULL;
mgVar[i].mg_iInList = -2;
}
FlushVarSettings(FALSE);
_bVarChanged = FALSE;
}
void CVarMenu::Think(void)
{
mgVarApply.mg_bEnabled = _bVarChanged;
FixupBackButton(this);
} }
// ------------------------ CServersMenu implementation // ------------------------ CServersMenu implementation

View File

@ -183,6 +183,7 @@ copy Release\$(TargetName).map $(SolutionDir)..\Bin\ &gt;nul </Command>
<ClCompile Include="LevelInfo.cpp" /> <ClCompile Include="LevelInfo.cpp" />
<ClCompile Include="MainWindow.cpp" /> <ClCompile Include="MainWindow.cpp" />
<ClCompile Include="MConfirm.cpp" /> <ClCompile Include="MConfirm.cpp" />
<ClCompile Include="MDisabled.cpp" />
<ClCompile Include="Menu.cpp"> <ClCompile Include="Menu.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">StdH.h</PrecompiledHeaderFile> <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">StdH.h</PrecompiledHeaderFile>
@ -210,8 +211,11 @@ copy Release\$(TargetName).map $(SolutionDir)..\Bin\ &gt;nul </Command>
<ClCompile Include="MGTrigger.cpp" /> <ClCompile Include="MGTrigger.cpp" />
<ClCompile Include="MGVarButton.cpp" /> <ClCompile Include="MGVarButton.cpp" />
<ClCompile Include="MInGame.cpp" /> <ClCompile Include="MInGame.cpp" />
<ClCompile Include="MLevels.cpp" />
<ClCompile Include="MMain.cpp" /> <ClCompile Include="MMain.cpp" />
<ClCompile Include="MSinglePlayer.cpp" /> <ClCompile Include="MSinglePlayer.cpp" />
<ClCompile Include="MSinglePlayerNew.cpp" />
<ClCompile Include="MVar.cpp" />
<ClCompile Include="SeriousSam.cpp"> <ClCompile Include="SeriousSam.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">StdH.h</PrecompiledHeaderFile> <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">StdH.h</PrecompiledHeaderFile>

View File

@ -132,6 +132,18 @@
<ClCompile Include="MSinglePlayer.cpp"> <ClCompile Include="MSinglePlayer.cpp">
<Filter>Source Files\Menus</Filter> <Filter>Source Files\Menus</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="MSinglePlayerNew.cpp">
<Filter>Source Files\Menus</Filter>
</ClCompile>
<ClCompile Include="MDisabled.cpp">
<Filter>Source Files\Menus</Filter>
</ClCompile>
<ClCompile Include="MLevels.cpp">
<Filter>Source Files\Menus</Filter>
</ClCompile>
<ClCompile Include="MVar.cpp">
<Filter>Source Files\Menus</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="CDCheck.h"> <ClInclude Include="CDCheck.h">