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

Menu.cpp is so large(>6000 lines). I'll separate it!
This commit is contained in:
zcaliptium 2016-03-14 03:59:44 +03:00
parent dceb552265
commit 899d297f7b
11 changed files with 350 additions and 233 deletions

View File

@ -0,0 +1,43 @@
/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */
#include "StdH.h"
#include <Engine/CurrentVersion.h>
#include "MenuPrinting.h"
#include "MenuStuff.h"
#include "MNetworkJoin.h"
void CNetworkJoinMenu::Initialize_t(void)
{
// title
gm_mgTitle.mg_boxOnScreen = BoxTitle();
gm_mgTitle.mg_strText = TRANS("JOIN GAME");
gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
gm_mgLAN.mg_bfsFontSize = BFS_LARGE;
gm_mgLAN.mg_boxOnScreen = BoxBigRow(1.0f);
gm_mgLAN.mg_pmgUp = &gm_mgOpen;
gm_mgLAN.mg_pmgDown = &gm_mgNET;
gm_mgLAN.mg_strText = TRANS("SEARCH LAN");
gm_mgLAN.mg_strTip = TRANS("search local network for servers");
gm_lhGadgets.AddTail(gm_mgLAN.mg_lnNode);
gm_mgLAN.mg_pActivatedFunction = NULL;
gm_mgNET.mg_bfsFontSize = BFS_LARGE;
gm_mgNET.mg_boxOnScreen = BoxBigRow(2.0f);
gm_mgNET.mg_pmgUp = &gm_mgLAN;
gm_mgNET.mg_pmgDown = &gm_mgOpen;
gm_mgNET.mg_strText = TRANS("SEARCH INTERNET");
gm_mgNET.mg_strTip = TRANS("search internet for servers");
gm_lhGadgets.AddTail(gm_mgNET.mg_lnNode);
gm_mgNET.mg_pActivatedFunction = NULL;
gm_mgOpen.mg_bfsFontSize = BFS_LARGE;
gm_mgOpen.mg_boxOnScreen = BoxBigRow(3.0f);
gm_mgOpen.mg_pmgUp = &gm_mgNET;
gm_mgOpen.mg_pmgDown = &gm_mgLAN;
gm_mgOpen.mg_strText = TRANS("SPECIFY SERVER");
gm_mgOpen.mg_strTip = TRANS("type in server address to connect to");
gm_lhGadgets.AddTail(gm_mgOpen.mg_lnNode);
gm_mgOpen.mg_pActivatedFunction = NULL;
}

View File

@ -7,10 +7,17 @@
#endif #endif
#include "GameMenu.h" #include "GameMenu.h"
#include "MGButton.h"
#include "MGTitle.h"
class CNetworkJoinMenu : public CGameMenu { class CNetworkJoinMenu : public CGameMenu {
public: public:
CMGTitle gm_mgTitle;
CMGButton gm_mgLAN;
CMGButton gm_mgNET;
CMGButton gm_mgOpen;
void Initialize_t(void); void Initialize_t(void);
}; };

View File

@ -0,0 +1,66 @@
/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */
#include "StdH.h"
#include <Engine/CurrentVersion.h>
#include "MenuPrinting.h"
#include "MenuStuff.h"
#include "MNetworkOpen.h"
void CNetworkOpenMenu::Initialize_t(void)
{
// intialize network join menu
gm_mgTitle.mg_boxOnScreen = BoxTitle();
gm_mgTitle.mg_strText = TRANS("JOIN");
gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
gm_mgAddressLabel.mg_strText = TRANS("Address:");
gm_mgAddressLabel.mg_boxOnScreen = BoxMediumLeft(1);
gm_mgAddressLabel.mg_iCenterI = -1;
gm_lhGadgets.AddTail(gm_mgAddressLabel.mg_lnNode);
gm_mgAddress.mg_strText = _pGame->gam_strJoinAddress;
gm_mgAddress.mg_ctMaxStringLen = 20;
gm_mgAddress.mg_pstrToChange = &_pGame->gam_strJoinAddress;
gm_mgAddress.mg_boxOnScreen = BoxMediumMiddle(1);
gm_mgAddress.mg_bfsFontSize = BFS_MEDIUM;
gm_mgAddress.mg_iCenterI = -1;
gm_mgAddress.mg_pmgUp = &gm_mgJoin;
gm_mgAddress.mg_pmgDown = &gm_mgPort;
gm_mgAddress.mg_strTip = TRANS("specify server address");
gm_lhGadgets.AddTail(gm_mgAddress.mg_lnNode);
gm_mgPortLabel.mg_strText = TRANS("Port:");
gm_mgPortLabel.mg_boxOnScreen = BoxMediumLeft(2);
gm_mgPortLabel.mg_iCenterI = -1;
gm_lhGadgets.AddTail(gm_mgPortLabel.mg_lnNode);
gm_mgPort.mg_strText = "";
gm_mgPort.mg_ctMaxStringLen = 10;
gm_mgPort.mg_pstrToChange = &gm_strPort;
gm_mgPort.mg_boxOnScreen = BoxMediumMiddle(2);
gm_mgPort.mg_bfsFontSize = BFS_MEDIUM;
gm_mgPort.mg_iCenterI = -1;
gm_mgPort.mg_pmgUp = &gm_mgAddress;
gm_mgPort.mg_pmgDown = &gm_mgJoin;
gm_mgPort.mg_strTip = TRANS("specify server address");
gm_lhGadgets.AddTail(gm_mgPort.mg_lnNode);
gm_mgJoin.mg_boxOnScreen = BoxMediumMiddle(3);
gm_mgJoin.mg_pmgUp = &gm_mgPort;
gm_mgJoin.mg_pmgDown = &gm_mgAddress;
gm_mgJoin.mg_strText = TRANS("Join");
gm_lhGadgets.AddTail(gm_mgJoin.mg_lnNode);
gm_mgJoin.mg_pActivatedFunction = NULL;
}
void CNetworkOpenMenu::StartMenu(void)
{
gm_strPort = _pShell->GetValue("net_iPort");
gm_mgPort.mg_strText = gm_strPort;
}
void CNetworkOpenMenu::EndMenu(void)
{
_pShell->SetValue("net_iPort", gm_strPort);
}

View File

@ -7,10 +7,21 @@
#endif #endif
#include "GameMenu.h" #include "GameMenu.h"
#include "MGButton.h"
#include "MGEdit.h"
#include "MGTitle.h"
class CNetworkOpenMenu : public CGameMenu { class CNetworkOpenMenu : public CGameMenu {
public: public:
CTString gm_strPort;
CMGTitle gm_mgTitle;
CMGButton gm_mgAddressLabel;
CMGEdit gm_mgAddress;
CMGButton gm_mgPortLabel;
CMGEdit gm_mgPort;
CMGButton gm_mgJoin;
void Initialize_t(void); void Initialize_t(void);
void StartMenu(void); void StartMenu(void);
void EndMenu(void); void EndMenu(void);

View File

@ -0,0 +1,46 @@
/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */
#include "StdH.h"
#include <Engine/CurrentVersion.h>
#include "MenuPrinting.h"
#include "MSplitScreen.h"
void CSplitScreenMenu::Initialize_t(void)
{
// intialize split screen menu
gm_mgTitle.mg_boxOnScreen = BoxTitle();
gm_mgTitle.mg_strText = TRANS("SPLIT SCREEN");
gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
gm_mgStart.mg_bfsFontSize = BFS_LARGE;
gm_mgStart.mg_boxOnScreen = BoxBigRow(0);
gm_mgStart.mg_pmgUp = &gm_mgLoad;
gm_mgStart.mg_pmgDown = &gm_mgQuickLoad;
gm_mgStart.mg_strText = TRANS("NEW GAME");
gm_mgStart.mg_strTip = TRANS("start new split-screen game");
gm_lhGadgets.AddTail(gm_mgStart.mg_lnNode);
gm_mgStart.mg_pActivatedFunction = NULL;
gm_mgQuickLoad.mg_bfsFontSize = BFS_LARGE;
gm_mgQuickLoad.mg_boxOnScreen = BoxBigRow(1);
gm_mgQuickLoad.mg_pmgUp = &gm_mgStart;
gm_mgQuickLoad.mg_pmgDown = &gm_mgLoad;
gm_mgQuickLoad.mg_strText = TRANS("QUICK LOAD");
gm_mgQuickLoad.mg_strTip = TRANS("load a quick-saved game (F9)");
gm_lhGadgets.AddTail(gm_mgQuickLoad.mg_lnNode);
gm_mgQuickLoad.mg_pActivatedFunction = NULL;
gm_mgLoad.mg_bfsFontSize = BFS_LARGE;
gm_mgLoad.mg_boxOnScreen = BoxBigRow(2);
gm_mgLoad.mg_pmgUp = &gm_mgQuickLoad;
gm_mgLoad.mg_pmgDown = &gm_mgStart;
gm_mgLoad.mg_strText = TRANS("LOAD");
gm_mgLoad.mg_strTip = TRANS("load a saved split-screen game");
gm_lhGadgets.AddTail(gm_mgLoad.mg_lnNode);
gm_mgLoad.mg_pActivatedFunction = NULL;
}
void CSplitScreenMenu::StartMenu(void)
{
CGameMenu::StartMenu();
}

View File

@ -7,10 +7,16 @@
#endif #endif
#include "GameMenu.h" #include "GameMenu.h"
#include "MGButton.h"
#include "MGTitle.h"
class CSplitScreenMenu : public CGameMenu { class CSplitScreenMenu : public CGameMenu {
public: public:
CMGTitle gm_mgTitle;
CMGButton gm_mgStart;
CMGButton gm_mgQuickLoad;
CMGButton gm_mgLoad;
void Initialize_t(void); void Initialize_t(void);
void StartMenu(void); void StartMenu(void);
}; };

View File

@ -0,0 +1,103 @@
/* Copyright (c) 2002-2012 Croteam Ltd. All rights reserved. */
#include "StdH.h"
#include <Engine/CurrentVersion.h>
#include "MenuPrinting.h"
#include "LevelInfo.h"
#include "MenuStuff.h"
#include "MSplitStart.h"
#define TRIGGER_MG(mg, y, up, down, text, astr) \
mg.mg_pmgUp = &up; \
mg.mg_pmgDown = &down; \
mg.mg_boxOnScreen = BoxMediumRow(y); \
gm_lhGadgets.AddTail(mg.mg_lnNode); \
mg.mg_astrTexts = astr; \
mg.mg_ctTexts = sizeof(astr) / sizeof(astr[0]); \
mg.mg_iSelected = 0; \
mg.mg_strLabel = text; \
mg.mg_strValue = astr[0];
extern INDEX ctGameTypeRadioTexts;
extern void UpdateSplitLevel(INDEX iDummy);
extern void SplitStartMenuSubInit(CSplitStartMenu* gm);
void CSplitStartMenu::Initialize_t(void)
{
// intialize split screen menu
gm_mgTitle.mg_boxOnScreen = BoxTitle();
gm_mgTitle.mg_strText = TRANS("START SPLIT SCREEN");
gm_lhGadgets.AddTail(gm_mgTitle.mg_lnNode);
// game type trigger
extern CTString astrGameTypeRadioTexts[20];
TRIGGER_MG(gm_mgGameType, 0,
gm_mgStart, gm_mgDifficulty, TRANS("Game type:"), astrGameTypeRadioTexts);
gm_mgGameType.mg_ctTexts = ctGameTypeRadioTexts;
gm_mgGameType.mg_strTip = TRANS("choose type of multiplayer game");
gm_mgGameType.mg_pOnTriggerChange = &UpdateSplitLevel;
// difficulty trigger
extern CTString astrDifficultyRadioTexts[6];
TRIGGER_MG(gm_mgDifficulty, 1,
gm_mgGameType, gm_mgLevel, TRANS("Difficulty:"), astrDifficultyRadioTexts);
gm_mgDifficulty.mg_strTip = TRANS("choose difficulty level");
// level name
gm_mgLevel.mg_strText = "";
gm_mgLevel.mg_strLabel = TRANS("Level:");
gm_mgLevel.mg_boxOnScreen = BoxMediumRow(2);
gm_mgLevel.mg_bfsFontSize = BFS_MEDIUM;
gm_mgLevel.mg_iCenterI = -1;
gm_mgLevel.mg_pmgUp = &gm_mgDifficulty;
gm_mgLevel.mg_pmgDown = &gm_mgOptions;
gm_mgLevel.mg_strTip = TRANS("choose the level to start");
gm_mgLevel.mg_pActivatedFunction = NULL;
gm_lhGadgets.AddTail(gm_mgLevel.mg_lnNode);
// options button
gm_mgOptions.mg_strText = TRANS("Game options");
gm_mgOptions.mg_boxOnScreen = BoxMediumRow(3);
gm_mgOptions.mg_bfsFontSize = BFS_MEDIUM;
gm_mgOptions.mg_iCenterI = 0;
gm_mgOptions.mg_pmgUp = &gm_mgLevel;
gm_mgOptions.mg_pmgDown = &gm_mgStart;
gm_mgOptions.mg_strTip = TRANS("adjust game rules");
gm_mgOptions.mg_pActivatedFunction = NULL;
gm_lhGadgets.AddTail(gm_mgOptions.mg_lnNode);
// start button
gm_mgStart.mg_bfsFontSize = BFS_LARGE;
gm_mgStart.mg_boxOnScreen = BoxBigRow(4);
gm_mgStart.mg_pmgUp = &gm_mgOptions;
gm_mgStart.mg_pmgDown = &gm_mgGameType;
gm_mgStart.mg_strText = TRANS("START");
gm_lhGadgets.AddTail(gm_mgStart.mg_lnNode);
gm_mgStart.mg_pActivatedFunction = NULL;
}
void CSplitStartMenu::StartMenu(void)
{
extern INDEX sam_bMentalActivated;
gm_mgDifficulty.mg_ctTexts = sam_bMentalActivated ? 6 : 5;
gm_mgGameType.mg_iSelected = Clamp(_pShell->GetINDEX("gam_iStartMode"), 0L, ctGameTypeRadioTexts - 1L);
gm_mgGameType.ApplyCurrentSelection();
gm_mgDifficulty.mg_iSelected = _pShell->GetINDEX("gam_iStartDifficulty") + 1;
gm_mgDifficulty.ApplyCurrentSelection();
// clamp maximum number of players to at least 4
_pShell->SetINDEX("gam_ctMaxPlayers", ClampDn(_pShell->GetINDEX("gam_ctMaxPlayers"), 4L));
UpdateSplitLevel(0);
CGameMenu::StartMenu();
}
void CSplitStartMenu::EndMenu(void)
{
_pShell->SetINDEX("gam_iStartDifficulty", gm_mgDifficulty.mg_iSelected - 1);
_pShell->SetINDEX("gam_iStartMode", gm_mgGameType.mg_iSelected);
CGameMenu::EndMenu();
}

View File

@ -7,10 +7,19 @@
#endif #endif
#include "GameMenu.h" #include "GameMenu.h"
#include "MGButton.h"
#include "MGTitle.h"
#include "MGTrigger.h"
class CSplitStartMenu : public CGameMenu { class CSplitStartMenu : public CGameMenu {
public: public:
CMGTitle gm_mgTitle;
CMGTrigger gm_mgGameType;
CMGTrigger gm_mgDifficulty;
CMGButton gm_mgLevel;
CMGButton gm_mgOptions;
CMGButton gm_mgStart;
void Initialize_t(void); void Initialize_t(void);
void StartMenu(void); void StartMenu(void);
void EndMenu(void); void EndMenu(void);

View File

@ -106,8 +106,12 @@ void (*_pAfterLevelChosen)(void);
void InitActionsForConfirmMenu(); void InitActionsForConfirmMenu();
void InitActionsForMainMenu(); void InitActionsForMainMenu();
void InitActionsForInGameMenu(); void InitActionsForInGameMenu();
void InitActionsForNetworkJoinMenu();
void InitActionsForNetworkOpenMenu();
void InitActionsForSinglePlayerMenu(); void InitActionsForSinglePlayerMenu();
void InitActionsForSinglePlayerNewMenu(); void InitActionsForSinglePlayerNewMenu();
void InitActionsForSplitScreenMenu();
void InitActionsForSplitStartMenu();
void InitActionsForVarMenu(); void InitActionsForVarMenu();
@ -257,14 +261,15 @@ CTString astrMaxPlayersRadioTexts[] = {
}; };
// here, we just reserve space for up to 16 different game types // here, we just reserve space for up to 16 different game types
// actual names are added later // actual names are added later
CTString astrGameTypeRadioTexts[] = { extern CTString astrGameTypeRadioTexts[] = {
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "",
}; };
INDEX ctGameTypeRadioTexts = 1;
CTString astrDifficultyRadioTexts[] = { extern INDEX ctGameTypeRadioTexts = 1;
extern CTString astrDifficultyRadioTexts[] = {
RADIOTRANS("Tourist"), RADIOTRANS("Tourist"),
RADIOTRANS("Easy"), RADIOTRANS("Easy"),
RADIOTRANS("Normal"), RADIOTRANS("Normal"),
@ -272,6 +277,7 @@ CTString astrDifficultyRadioTexts[] = {
RADIOTRANS("Serious"), RADIOTRANS("Serious"),
RADIOTRANS("Mental"), RADIOTRANS("Mental"),
}; };
CTString astrSplitScreenRadioTexts[] = { CTString astrSplitScreenRadioTexts[] = {
RADIOTRANS( "1"), RADIOTRANS( "1"),
RADIOTRANS( "2 - split screen"), RADIOTRANS( "2 - split screen"),
@ -457,10 +463,6 @@ CMGButton mgNetworkLoad;
// -------- Network join menu // -------- Network join menu
CNetworkJoinMenu gmNetworkJoinMenu; CNetworkJoinMenu gmNetworkJoinMenu;
CMGTitle mgNetworkJoinTitle;
CMGButton mgNetworkJoinLAN;
CMGButton mgNetworkJoinNET;
CMGButton mgNetworkJoinOpen;
// -------- Network start menu // -------- Network start menu
CNetworkStartMenu gmNetworkStartMenu; CNetworkStartMenu gmNetworkStartMenu;
@ -477,28 +479,12 @@ CMGButton mgNetworkStartStart;
// -------- Network open menu // -------- Network open menu
CNetworkOpenMenu gmNetworkOpenMenu; CNetworkOpenMenu gmNetworkOpenMenu;
CMGTitle mgNetworkOpenTitle;
CMGButton mgNetworkOpenAddressLabel;
CMGEdit mgNetworkOpenAddress;
CMGButton mgNetworkOpenPortLabel;
CMGEdit mgNetworkOpenPort;
CMGButton mgNetworkOpenJoin;
// -------- Split screen menu // -------- Split screen menu
CSplitScreenMenu gmSplitScreenMenu; CSplitScreenMenu gmSplitScreenMenu;
CMGTitle mgSplitScreenTitle;
CMGButton mgSplitScreenStart;
CMGButton mgSplitScreenQuickLoad;
CMGButton mgSplitScreenLoad;
// -------- Split screen start menu // -------- Split screen start menu
CSplitStartMenu gmSplitStartMenu; CSplitStartMenu gmSplitStartMenu;
CMGTitle mgSplitStartTitle;
CMGTrigger mgSplitGameType;
CMGTrigger mgSplitDifficulty;
CMGButton mgSplitLevel;
CMGButton mgSplitOptions;
CMGButton mgSplitStartStart;
// -------- Select players menu // -------- Select players menu
CSelectPlayersMenu gmSelectPlayersMenu; CSelectPlayersMenu gmSelectPlayersMenu;
@ -1285,7 +1271,7 @@ void StartSelectServerNET(void)
void StartSelectLevelFromSplit(void) void StartSelectLevelFromSplit(void)
{ {
FilterLevels(GetSpawnFlagsForGameType(mgSplitGameType.mg_iSelected)); FilterLevels(GetSpawnFlagsForGameType(gmSplitStartMenu.gm_mgGameType.mg_iSelected));
void StartSplitStartMenu(void); void StartSplitStartMenu(void);
_pAfterLevelChosen = StartSplitStartMenu; _pAfterLevelChosen = StartSplitStartMenu;
ChangeToMenu( &gmLevelsMenu); ChangeToMenu( &gmLevelsMenu);
@ -2277,8 +2263,9 @@ void InitializeMenus(void)
gmNetworkJoinMenu.Initialize_t(); gmNetworkJoinMenu.Initialize_t();
gmNetworkJoinMenu.gm_strName="NetworkJoin"; gmNetworkJoinMenu.gm_strName="NetworkJoin";
gmNetworkJoinMenu.gm_pmgSelectedByDefault = &mgNetworkJoinLAN; gmNetworkJoinMenu.gm_pmgSelectedByDefault = &gmNetworkJoinMenu.gm_mgLAN;
gmNetworkJoinMenu.gm_pgmParentMenu = &gmNetworkMenu; gmNetworkJoinMenu.gm_pgmParentMenu = &gmNetworkMenu;
InitActionsForNetworkJoinMenu();
gmSelectPlayersMenu.gm_bAllowDedicated = FALSE; gmSelectPlayersMenu.gm_bAllowDedicated = FALSE;
gmSelectPlayersMenu.gm_bAllowObserving = FALSE; gmSelectPlayersMenu.gm_bAllowObserving = FALSE;
@ -2288,18 +2275,21 @@ void InitializeMenus(void)
gmNetworkOpenMenu.Initialize_t(); gmNetworkOpenMenu.Initialize_t();
gmNetworkOpenMenu.gm_strName="NetworkOpen"; gmNetworkOpenMenu.gm_strName="NetworkOpen";
gmNetworkOpenMenu.gm_pmgSelectedByDefault = &mgNetworkOpenJoin; gmNetworkOpenMenu.gm_pmgSelectedByDefault = &gmNetworkOpenMenu.gm_mgJoin;
gmNetworkOpenMenu.gm_pgmParentMenu = &gmNetworkJoinMenu; gmNetworkOpenMenu.gm_pgmParentMenu = &gmNetworkJoinMenu;
InitActionsForNetworkOpenMenu();
gmSplitScreenMenu.Initialize_t(); gmSplitScreenMenu.Initialize_t();
gmSplitScreenMenu.gm_strName="SplitScreen"; gmSplitScreenMenu.gm_strName="SplitScreen";
gmSplitScreenMenu.gm_pmgSelectedByDefault = &mgSplitScreenStart; gmSplitScreenMenu.gm_pmgSelectedByDefault = &gmSplitScreenMenu.gm_mgStart;
gmSplitScreenMenu.gm_pgmParentMenu = &gmMainMenu; gmSplitScreenMenu.gm_pgmParentMenu = &gmMainMenu;
InitActionsForSplitScreenMenu();
gmSplitStartMenu.Initialize_t(); gmSplitStartMenu.Initialize_t();
gmSplitStartMenu.gm_strName="SplitStart"; gmSplitStartMenu.gm_strName="SplitStart";
gmSplitStartMenu.gm_pmgSelectedByDefault = &mgSplitStartStart; gmSplitStartMenu.gm_pmgSelectedByDefault = &gmSplitStartMenu.gm_mgStart;
gmSplitStartMenu.gm_pgmParentMenu = &gmSplitScreenMenu; gmSplitStartMenu.gm_pgmParentMenu = &gmSplitScreenMenu;
InitActionsForSplitStartMenu();
} }
catch( char *strError) catch( char *strError)
{ {
@ -4829,39 +4819,11 @@ void UpdateNetworkLevel(INDEX iDummy)
} }
// ------------------------ CNetworkJoinMenu implementation // ------------------------ CNetworkJoinMenu implementation
void CNetworkJoinMenu::Initialize_t(void) void InitActionsForNetworkJoinMenu()
{ {
// title gmNetworkJoinMenu.gm_mgLAN.mg_pActivatedFunction = &StartSelectServerLAN;
mgNetworkJoinTitle.mg_boxOnScreen = BoxTitle(); gmNetworkJoinMenu.gm_mgNET.mg_pActivatedFunction = &StartSelectServerNET;
mgNetworkJoinTitle.mg_strText = TRANS("JOIN GAME"); gmNetworkJoinMenu.gm_mgOpen.mg_pActivatedFunction = &StartNetworkOpenMenu;
gm_lhGadgets.AddTail( mgNetworkJoinTitle.mg_lnNode);
mgNetworkJoinLAN.mg_bfsFontSize = BFS_LARGE;
mgNetworkJoinLAN.mg_boxOnScreen = BoxBigRow(1.0f);
mgNetworkJoinLAN.mg_pmgUp = &mgNetworkJoinOpen;
mgNetworkJoinLAN.mg_pmgDown = &mgNetworkJoinNET;
mgNetworkJoinLAN.mg_strText = TRANS("SEARCH LAN");
mgNetworkJoinLAN.mg_strTip = TRANS("search local network for servers");
gm_lhGadgets.AddTail( mgNetworkJoinLAN.mg_lnNode);
mgNetworkJoinLAN.mg_pActivatedFunction = &StartSelectServerLAN;
mgNetworkJoinNET.mg_bfsFontSize = BFS_LARGE;
mgNetworkJoinNET.mg_boxOnScreen = BoxBigRow(2.0f);
mgNetworkJoinNET.mg_pmgUp = &mgNetworkJoinLAN;
mgNetworkJoinNET.mg_pmgDown = &mgNetworkJoinOpen;
mgNetworkJoinNET.mg_strText = TRANS("SEARCH INTERNET");
mgNetworkJoinNET.mg_strTip = TRANS("search internet for servers");
gm_lhGadgets.AddTail( mgNetworkJoinNET.mg_lnNode);
mgNetworkJoinNET.mg_pActivatedFunction = &StartSelectServerNET;
mgNetworkJoinOpen.mg_bfsFontSize = BFS_LARGE;
mgNetworkJoinOpen.mg_boxOnScreen = BoxBigRow(3.0f);
mgNetworkJoinOpen.mg_pmgUp = &mgNetworkJoinNET;
mgNetworkJoinOpen.mg_pmgDown = &mgNetworkJoinLAN;
mgNetworkJoinOpen.mg_strText = TRANS("SPECIFY SERVER");
mgNetworkJoinOpen.mg_strTip = TRANS("type in server address to connect to");
gm_lhGadgets.AddTail( mgNetworkJoinOpen.mg_lnNode);
mgNetworkJoinOpen.mg_pActivatedFunction = &StartNetworkOpenMenu;
} }
// ------------------------ CNetworkStartMenu implementation // ------------------------ CNetworkStartMenu implementation
@ -4891,6 +4853,7 @@ void CNetworkStartMenu::Initialize_t(void)
mgNetworkGameType.mg_ctTexts = ctGameTypeRadioTexts; mgNetworkGameType.mg_ctTexts = ctGameTypeRadioTexts;
mgNetworkGameType.mg_strTip = TRANS("choose type of multiplayer game"); mgNetworkGameType.mg_strTip = TRANS("choose type of multiplayer game");
mgNetworkGameType.mg_pOnTriggerChange = &UpdateNetworkLevel; mgNetworkGameType.mg_pOnTriggerChange = &UpdateNetworkLevel;
// difficulty trigger // difficulty trigger
TRIGGER_MG(mgNetworkDifficulty, 3, TRIGGER_MG(mgNetworkDifficulty, 3,
mgNetworkGameType, mgNetworkLevel, TRANS("Difficulty:"), astrDifficultyRadioTexts); mgNetworkGameType, mgNetworkLevel, TRANS("Difficulty:"), astrDifficultyRadioTexts);
@ -5022,6 +4985,7 @@ INDEX FindUnusedPlayer(void)
ASSERT(FALSE); ASSERT(FALSE);
return iPlayer; return iPlayer;
} }
void SelectPlayersFillMenu(void) void SelectPlayersFillMenu(void)
{ {
INDEX *ai = _pGame->gm_aiMenuLocalPlayers; INDEX *ai = _pGame->gm_aiMenuLocalPlayers;
@ -5150,6 +5114,7 @@ void SelectPlayersFillMenu(void)
mgSelectPlayersNotes.mg_strText = ""; mgSelectPlayersNotes.mg_strText = "";
} }
} }
void SelectPlayersApplyMenu(void) void SelectPlayersApplyMenu(void)
{ {
if (gmSelectPlayersMenu.gm_bAllowDedicated && mgDedicated.mg_iSelected) { if (gmSelectPlayersMenu.gm_bAllowDedicated && mgDedicated.mg_iSelected) {
@ -5255,187 +5220,32 @@ void CSelectPlayersMenu::EndMenu(void)
CGameMenu::EndMenu(); CGameMenu::EndMenu();
} }
CTString _strPort;
// ------------------------ CNetworkOpenMenu implementation // ------------------------ CNetworkOpenMenu implementation
void CNetworkOpenMenu::Initialize_t(void) void InitActionsForNetworkOpenMenu()
{ {
// intialize network join menu gmNetworkOpenMenu.gm_mgJoin.mg_pActivatedFunction = &StartSelectPlayersMenuFromOpen;
mgNetworkOpenTitle.mg_boxOnScreen = BoxTitle();
mgNetworkOpenTitle.mg_strText = TRANS("JOIN");
gm_lhGadgets.AddTail( mgNetworkOpenTitle.mg_lnNode);
mgNetworkOpenAddressLabel.mg_strText = TRANS("Address:");
mgNetworkOpenAddressLabel.mg_boxOnScreen = BoxMediumLeft(1);
mgNetworkOpenAddressLabel.mg_iCenterI = -1;
gm_lhGadgets.AddTail( mgNetworkOpenAddressLabel.mg_lnNode);
mgNetworkOpenAddress.mg_strText = _pGame->gam_strJoinAddress;
mgNetworkOpenAddress.mg_ctMaxStringLen = 20;
mgNetworkOpenAddress.mg_pstrToChange = &_pGame->gam_strJoinAddress;
mgNetworkOpenAddress.mg_boxOnScreen = BoxMediumMiddle(1);
mgNetworkOpenAddress.mg_bfsFontSize = BFS_MEDIUM;
mgNetworkOpenAddress.mg_iCenterI = -1;
mgNetworkOpenAddress.mg_pmgUp = &mgNetworkOpenJoin;
mgNetworkOpenAddress.mg_pmgDown = &mgNetworkOpenPort;
mgNetworkOpenAddress.mg_strTip = TRANS("specify server address");
gm_lhGadgets.AddTail( mgNetworkOpenAddress.mg_lnNode);
mgNetworkOpenPortLabel.mg_strText = TRANS("Port:");
mgNetworkOpenPortLabel.mg_boxOnScreen = BoxMediumLeft(2);
mgNetworkOpenPortLabel.mg_iCenterI = -1;
gm_lhGadgets.AddTail( mgNetworkOpenPortLabel.mg_lnNode);
mgNetworkOpenPort.mg_strText = "";
mgNetworkOpenPort.mg_ctMaxStringLen = 10;
mgNetworkOpenPort.mg_pstrToChange = &_strPort;
mgNetworkOpenPort.mg_boxOnScreen = BoxMediumMiddle(2);
mgNetworkOpenPort.mg_bfsFontSize = BFS_MEDIUM;
mgNetworkOpenPort.mg_iCenterI = -1;
mgNetworkOpenPort.mg_pmgUp = &mgNetworkOpenAddress;
mgNetworkOpenPort.mg_pmgDown = &mgNetworkOpenJoin;
mgNetworkOpenPort.mg_strTip = TRANS("specify server address");
gm_lhGadgets.AddTail( mgNetworkOpenPort.mg_lnNode);
mgNetworkOpenJoin.mg_boxOnScreen = BoxMediumMiddle(3);
mgNetworkOpenJoin.mg_pmgUp = &mgNetworkOpenPort;
mgNetworkOpenJoin.mg_pmgDown = &mgNetworkOpenAddress;
mgNetworkOpenJoin.mg_strText = TRANS("Join");
gm_lhGadgets.AddTail( mgNetworkOpenJoin.mg_lnNode);
mgNetworkOpenJoin.mg_pActivatedFunction = &StartSelectPlayersMenuFromOpen;
}
void CNetworkOpenMenu::StartMenu(void)
{
_strPort = _pShell->GetValue("net_iPort");
mgNetworkOpenPort.mg_strText = _strPort;
}
void CNetworkOpenMenu::EndMenu(void)
{
_pShell->SetValue("net_iPort", _strPort);
} }
// ------------------------ CSplitScreenMenu implementation // ------------------------ CSplitScreenMenu implementation
void CSplitScreenMenu::Initialize_t(void) void InitActionsForSplitScreenMenu()
{ {
// intialize split screen menu gmSplitScreenMenu.gm_mgStart.mg_pActivatedFunction = &StartSplitStartMenu;
mgSplitScreenTitle.mg_boxOnScreen = BoxTitle(); gmSplitScreenMenu.gm_mgQuickLoad.mg_pActivatedFunction = &StartSplitScreenQuickLoadMenu;
mgSplitScreenTitle.mg_strText = TRANS("SPLIT SCREEN"); gmSplitScreenMenu.gm_mgLoad.mg_pActivatedFunction = &StartSplitScreenLoadMenu;
gm_lhGadgets.AddTail( mgSplitScreenTitle.mg_lnNode);
mgSplitScreenStart.mg_bfsFontSize = BFS_LARGE;
mgSplitScreenStart.mg_boxOnScreen = BoxBigRow(0);
mgSplitScreenStart.mg_pmgUp = &mgSplitScreenLoad;
mgSplitScreenStart.mg_pmgDown = &mgSplitScreenQuickLoad;
mgSplitScreenStart.mg_strText = TRANS("NEW GAME");
mgSplitScreenStart.mg_strTip = TRANS("start new split-screen game");
gm_lhGadgets.AddTail( mgSplitScreenStart.mg_lnNode);
mgSplitScreenStart.mg_pActivatedFunction = &StartSplitStartMenu;
mgSplitScreenQuickLoad.mg_bfsFontSize = BFS_LARGE;
mgSplitScreenQuickLoad.mg_boxOnScreen = BoxBigRow(1);
mgSplitScreenQuickLoad.mg_pmgUp = &mgSplitScreenStart;
mgSplitScreenQuickLoad.mg_pmgDown = &mgSplitScreenLoad;
mgSplitScreenQuickLoad.mg_strText = TRANS("QUICK LOAD");
mgSplitScreenQuickLoad.mg_strTip = TRANS("load a quick-saved game (F9)");
gm_lhGadgets.AddTail( mgSplitScreenQuickLoad.mg_lnNode);
mgSplitScreenQuickLoad.mg_pActivatedFunction = &StartSplitScreenQuickLoadMenu;
mgSplitScreenLoad.mg_bfsFontSize = BFS_LARGE;
mgSplitScreenLoad.mg_boxOnScreen = BoxBigRow(2);
mgSplitScreenLoad.mg_pmgUp = &mgSplitScreenQuickLoad;
mgSplitScreenLoad.mg_pmgDown = &mgSplitScreenStart;
mgSplitScreenLoad.mg_strText = TRANS("LOAD");
mgSplitScreenLoad.mg_strTip = TRANS("load a saved split-screen game");
gm_lhGadgets.AddTail( mgSplitScreenLoad.mg_lnNode);
mgSplitScreenLoad.mg_pActivatedFunction = &StartSplitScreenLoadMenu;
}
void CSplitScreenMenu::StartMenu(void)
{
CGameMenu::StartMenu();
}
void UpdateSplitLevel(INDEX iDummy)
{
ValidateLevelForFlags(_pGame->gam_strCustomLevel,
GetSpawnFlagsForGameType(mgSplitGameType.mg_iSelected));
mgSplitLevel.mg_strText = FindLevelByFileName(_pGame->gam_strCustomLevel).li_strName;
} }
// ------------------------ CSplitStartMenu implementation // ------------------------ CSplitStartMenu implementation
void CSplitStartMenu::Initialize_t(void) void InitActionsForSplitStartMenu()
{ {
// intialize split screen menu gmSplitStartMenu.gm_mgLevel.mg_pActivatedFunction = &StartSelectLevelFromSplit;
mgSplitStartTitle.mg_boxOnScreen = BoxTitle(); gmSplitStartMenu.gm_mgOptions.mg_pActivatedFunction = &StartGameOptionsFromSplitScreen;
mgSplitStartTitle.mg_strText = TRANS("START SPLIT SCREEN"); gmSplitStartMenu.gm_mgStart.mg_pActivatedFunction = &StartSelectPlayersMenuFromSplit;
gm_lhGadgets.AddTail( mgSplitStartTitle.mg_lnNode);
// game type trigger
TRIGGER_MG(mgSplitGameType, 0,
mgSplitStartStart, mgSplitDifficulty, TRANS("Game type:"), astrGameTypeRadioTexts);
mgSplitGameType.mg_ctTexts = ctGameTypeRadioTexts;
mgSplitGameType.mg_strTip = TRANS("choose type of multiplayer game");
mgSplitGameType.mg_pOnTriggerChange = UpdateSplitLevel;
// difficulty trigger
TRIGGER_MG(mgSplitDifficulty, 1,
mgSplitGameType, mgSplitLevel, TRANS("Difficulty:"), astrDifficultyRadioTexts);
mgSplitDifficulty.mg_strTip = TRANS("choose difficulty level");
// level name
mgSplitLevel.mg_strText = "";
mgSplitLevel.mg_strLabel = TRANS("Level:");
mgSplitLevel.mg_boxOnScreen = BoxMediumRow(2);
mgSplitLevel.mg_bfsFontSize = BFS_MEDIUM;
mgSplitLevel.mg_iCenterI = -1;
mgSplitLevel.mg_pmgUp = &mgSplitDifficulty;
mgSplitLevel.mg_pmgDown = &mgSplitOptions;
mgSplitLevel.mg_strTip = TRANS("choose the level to start");
mgSplitLevel.mg_pActivatedFunction = &StartSelectLevelFromSplit;
gm_lhGadgets.AddTail( mgSplitLevel.mg_lnNode);
// options button
mgSplitOptions.mg_strText = TRANS("Game options");
mgSplitOptions.mg_boxOnScreen = BoxMediumRow(3);
mgSplitOptions.mg_bfsFontSize = BFS_MEDIUM;
mgSplitOptions.mg_iCenterI = 0;
mgSplitOptions.mg_pmgUp = &mgSplitLevel;
mgSplitOptions.mg_pmgDown = &mgSplitStartStart;
mgSplitOptions.mg_strTip = TRANS("adjust game rules");
mgSplitOptions.mg_pActivatedFunction = &StartGameOptionsFromSplitScreen;
gm_lhGadgets.AddTail( mgSplitOptions.mg_lnNode);
// start button
mgSplitStartStart.mg_bfsFontSize = BFS_LARGE;
mgSplitStartStart.mg_boxOnScreen = BoxBigRow(4);
mgSplitStartStart.mg_pmgUp = &mgSplitOptions;
mgSplitStartStart.mg_pmgDown = &mgSplitGameType;
mgSplitStartStart.mg_strText = TRANS("START");
gm_lhGadgets.AddTail( mgSplitStartStart.mg_lnNode);
mgSplitStartStart.mg_pActivatedFunction = &StartSelectPlayersMenuFromSplit;
} }
void CSplitStartMenu::StartMenu(void) extern void UpdateSplitLevel(INDEX iDummy)
{ {
extern INDEX sam_bMentalActivated; ValidateLevelForFlags(_pGame->gam_strCustomLevel,
mgSplitDifficulty.mg_ctTexts = sam_bMentalActivated?6:5; GetSpawnFlagsForGameType(gmSplitStartMenu.gm_mgGameType.mg_iSelected));
gmSplitStartMenu.gm_mgLevel.mg_strText = FindLevelByFileName(_pGame->gam_strCustomLevel).li_strName;
mgSplitGameType.mg_iSelected = Clamp(_pShell->GetINDEX("gam_iStartMode"), 0L, ctGameTypeRadioTexts-1L);
mgSplitGameType.ApplyCurrentSelection();
mgSplitDifficulty.mg_iSelected = _pShell->GetINDEX("gam_iStartDifficulty")+1;
mgSplitDifficulty.ApplyCurrentSelection();
// clamp maximum number of players to at least 4
_pShell->SetINDEX("gam_ctMaxPlayers", ClampDn(_pShell->GetINDEX("gam_ctMaxPlayers"), 4L));
UpdateSplitLevel(0);
CGameMenu::StartMenu();
}
void CSplitStartMenu::EndMenu(void)
{
_pShell->SetINDEX("gam_iStartDifficulty", mgSplitDifficulty.mg_iSelected-1);
_pShell->SetINDEX("gam_iStartMode", mgSplitGameType.mg_iSelected);
CGameMenu::EndMenu();
} }

View File

@ -213,8 +213,12 @@ copy Release\$(TargetName).map $(SolutionDir)..\Bin\ &gt;nul </Command>
<ClCompile Include="MInGame.cpp" /> <ClCompile Include="MInGame.cpp" />
<ClCompile Include="MLevels.cpp" /> <ClCompile Include="MLevels.cpp" />
<ClCompile Include="MMain.cpp" /> <ClCompile Include="MMain.cpp" />
<ClCompile Include="MNetworkJoin.cpp" />
<ClCompile Include="MNetworkOpen.cpp" />
<ClCompile Include="MSinglePlayer.cpp" /> <ClCompile Include="MSinglePlayer.cpp" />
<ClCompile Include="MSinglePlayerNew.cpp" /> <ClCompile Include="MSinglePlayerNew.cpp" />
<ClCompile Include="MSplitScreen.cpp" />
<ClCompile Include="MSplitStart.cpp" />
<ClCompile Include="MVar.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>

View File

@ -144,6 +144,18 @@
<ClCompile Include="MVar.cpp"> <ClCompile Include="MVar.cpp">
<Filter>Source Files\Menus</Filter> <Filter>Source Files\Menus</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="MSplitStart.cpp">
<Filter>Source Files\Menus</Filter>
</ClCompile>
<ClCompile Include="MSplitScreen.cpp">
<Filter>Source Files\Menus</Filter>
</ClCompile>
<ClCompile Include="MNetworkOpen.cpp">
<Filter>Source Files\Menus</Filter>
</ClCompile>
<ClCompile Include="MNetworkJoin.cpp">
<Filter>Source Files\Menus</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="CDCheck.h"> <ClInclude Include="CDCheck.h">