mirror of
https://github.com/ptitSeb/Serious-Engine
synced 2024-12-25 15:14:51 +01:00
GameExecutable: Some cleanup for menu code.
This commit is contained in:
parent
de240b4ad7
commit
1f0da8a443
|
@ -6,8 +6,6 @@
|
|||
#include "MenuStuff.h"
|
||||
#include "MControls.h"
|
||||
|
||||
extern void ControlsMenuOn();
|
||||
extern void ControlsMenuOff();
|
||||
extern CTFileName _fnmControlsToCustomize;
|
||||
|
||||
|
||||
|
|
|
@ -6,9 +6,6 @@
|
|||
#include "MenuStuff.h"
|
||||
#include "MCustomizeAxis.h"
|
||||
|
||||
extern void ControlsMenuOn();
|
||||
extern void ControlsMenuOff();
|
||||
|
||||
|
||||
void CCustomizeAxisMenu::Initialize_t(void)
|
||||
{
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
#include "StdH.h"
|
||||
#include <Engine/CurrentVersion.h>
|
||||
#include "MenuPrinting.h"
|
||||
#include "MenuStuff.h"
|
||||
#include "MCustomizeKeyboard.h"
|
||||
|
||||
extern void ControlsMenuOn();
|
||||
extern void ControlsMenuOff();
|
||||
|
||||
|
||||
void CCustomizeKeyboardMenu::FillListItems(void)
|
||||
{
|
||||
|
|
|
@ -44,8 +44,6 @@ void OnPlayerSelect(void);
|
|||
TIME _tmMenuLastTickDone = -1;
|
||||
// all possible menu entities
|
||||
CListHead lhMenuEntities;
|
||||
// controls that are currently customized
|
||||
CTFileName _fnmControlsToCustomize = CTString("");
|
||||
|
||||
extern CTString _strLastPlayerAppearance = "";
|
||||
extern CTString sam_strNetworkSettings;
|
||||
|
@ -55,34 +53,8 @@ void (*_pAfterLevelChosen)(void);
|
|||
|
||||
// functions for init actions
|
||||
|
||||
|
||||
void FixupBackButton(CGameMenu *pgm);
|
||||
|
||||
extern void ControlsMenuOn()
|
||||
{
|
||||
_pGame->SavePlayersAndControls();
|
||||
try {
|
||||
_pGame->gm_ctrlControlsExtra.Load_t(_fnmControlsToCustomize);
|
||||
} catch( char *strError) {
|
||||
WarningMessage(strError);
|
||||
}
|
||||
}
|
||||
|
||||
extern void ControlsMenuOff()
|
||||
{
|
||||
try {
|
||||
if (_pGame->gm_ctrlControlsExtra.ctrl_lhButtonActions.Count()>0) {
|
||||
_pGame->gm_ctrlControlsExtra.Save_t(_fnmControlsToCustomize);
|
||||
}
|
||||
} catch( char *strError) {
|
||||
FatalError(strError);
|
||||
}
|
||||
FORDELETELIST( CButtonAction, ba_lnNode, _pGame->gm_ctrlControlsExtra.ctrl_lhButtonActions, itAct) {
|
||||
delete &itAct.Current();
|
||||
}
|
||||
_pGame->LoadPlayersAndControls();
|
||||
}
|
||||
|
||||
// mouse cursor position
|
||||
extern PIX _pixCursorPosI = 0;
|
||||
extern PIX _pixCursorPosJ = 0;
|
||||
|
@ -244,32 +216,11 @@ void StopMenus( BOOL bGoToRoot /*=TRUE*/)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
BOOL IsMenusInRoot(void)
|
||||
{
|
||||
return pgmCurrentMenu == NULL || pgmCurrentMenu == &_pGUIM->gmMainMenu || pgmCurrentMenu == &_pGUIM->gmInGameMenu;
|
||||
}
|
||||
|
||||
// ---------------------- When activated functions
|
||||
void StopCurrentGame(void)
|
||||
{
|
||||
_pGame->StopGame();
|
||||
_gmRunningGameMode=GM_NONE;
|
||||
StopMenus(TRUE);
|
||||
StartMenus("");
|
||||
}
|
||||
|
||||
void DisabledFunction(void)
|
||||
{
|
||||
_pGUIM->gmDisabledFunction.gm_pgmParentMenu = pgmCurrentMenu;
|
||||
_pGUIM->gmDisabledFunction.gm_mgButton.mg_strText = TRANS("The feature is not available in this version!");
|
||||
_pGUIM->gmDisabledFunction.gm_mgTitle.mg_strText = TRANS("DISABLED");
|
||||
ChangeToMenu(&_pGUIM->gmDisabledFunction);
|
||||
}
|
||||
|
||||
extern void InitVideoOptionsButtons(void);
|
||||
extern void UpdateVideoOptionsButtons(INDEX i);
|
||||
|
||||
// ------------------------ Global menu function implementation
|
||||
void InitializeMenus(void)
|
||||
{
|
||||
|
@ -485,7 +436,6 @@ void InitializeMenus(void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void DestroyMenus( void)
|
||||
{
|
||||
_pGUIM->gmMainMenu.Destroy();
|
||||
|
|
|
@ -108,9 +108,16 @@ void ExitConfirm(void)
|
|||
ChangeToMenu(&_pGUIM->gmConfirmMenu);
|
||||
}
|
||||
|
||||
void StopCurrentGame(void)
|
||||
{
|
||||
_pGame->StopGame();
|
||||
_gmRunningGameMode = GM_NONE;
|
||||
StopMenus(TRUE);
|
||||
StartMenus("");
|
||||
}
|
||||
|
||||
void StopConfirm(void)
|
||||
{
|
||||
extern void StopCurrentGame(void);
|
||||
_pConfimedYes = &StopCurrentGame;
|
||||
_pConfimedNo = NULL;
|
||||
_pGUIM->gmConfirmMenu.gm_mgConfirmLabel.mg_strText = TRANS("ARE YOU SERIOUS?");
|
||||
|
@ -1064,22 +1071,6 @@ void InitActionsForNetworkStartMenu()
|
|||
_pGUIM->gmNetworkStartMenu.gm_mgStart.mg_pActivatedFunction = &StartSelectPlayersMenuFromNetwork;
|
||||
}
|
||||
|
||||
//
|
||||
#define ADD_GADGET( gd, box, up, dn, lf, rt, txt) \
|
||||
gd.mg_boxOnScreen = box; \
|
||||
gd.mg_pmgUp = up; \
|
||||
gd.mg_pmgDown = dn; \
|
||||
gd.mg_pmgLeft = lf; \
|
||||
gd.mg_pmgRight = rt; \
|
||||
gd.mg_strText = txt; \
|
||||
gm_lhGadgets.AddTail(gd.mg_lnNode);
|
||||
|
||||
#define SET_CHGPLR( gd, iplayer, bnone, bauto, pmgit) \
|
||||
gd.mg_pmgInfoTable = pmgit; \
|
||||
gd.mg_bResetToNone = bnone; \
|
||||
gd.mg_bAutomatic = bauto; \
|
||||
gd.mg_iLocalPlayer = iplayer;
|
||||
|
||||
// ------------------------ CSelectPlayersMenu implementation
|
||||
#define CMENU _pGUIM->gmSelectPlayersMenu
|
||||
|
||||
|
|
|
@ -483,15 +483,19 @@ void StartSplitScreenGame(void)
|
|||
}
|
||||
}
|
||||
|
||||
#define CMENU _pGUIM->gmSelectPlayersMenu
|
||||
|
||||
void StartSelectPlayersMenuFromSplit(void)
|
||||
{
|
||||
_pGUIM->gmSelectPlayersMenu.gm_bAllowDedicated = FALSE;
|
||||
_pGUIM->gmSelectPlayersMenu.gm_bAllowObserving = FALSE;
|
||||
_pGUIM->gmSelectPlayersMenu.gm_mgStart.mg_pActivatedFunction = &StartSplitScreenGame;
|
||||
_pGUIM->gmSelectPlayersMenu.gm_pgmParentMenu = &_pGUIM->gmSplitStartMenu;
|
||||
ChangeToMenu(&_pGUIM->gmSelectPlayersMenu);
|
||||
CMENU.gm_bAllowDedicated = FALSE;
|
||||
CMENU.gm_bAllowObserving = FALSE;
|
||||
CMENU.gm_mgStart.mg_pActivatedFunction = &StartSplitScreenGame;
|
||||
CMENU.gm_pgmParentMenu = &_pGUIM->gmSplitStartMenu;
|
||||
ChangeToMenu(&CMENU);
|
||||
}
|
||||
|
||||
#undef CMENU
|
||||
|
||||
void StartNetworkGame(void)
|
||||
{
|
||||
// _pGame->gm_MenuSplitScreenCfg = (enum CGame::SplitScreenCfg) mgSplitScreenCfg.mg_iSelected;
|
||||
|
@ -522,15 +526,19 @@ void StartNetworkGame(void)
|
|||
}
|
||||
}
|
||||
|
||||
#define CMENU _pGUIM->gmSelectPlayersMenu
|
||||
|
||||
void StartSelectPlayersMenuFromNetwork(void)
|
||||
{
|
||||
_pGUIM->gmSelectPlayersMenu.gm_bAllowDedicated = TRUE;
|
||||
_pGUIM->gmSelectPlayersMenu.gm_bAllowObserving = TRUE;
|
||||
_pGUIM->gmSelectPlayersMenu.gm_mgStart.mg_pActivatedFunction = &StartNetworkGame;
|
||||
_pGUIM->gmSelectPlayersMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkStartMenu;
|
||||
ChangeToMenu(&_pGUIM->gmSelectPlayersMenu);
|
||||
CMENU.gm_bAllowDedicated = TRUE;
|
||||
CMENU.gm_bAllowObserving = TRUE;
|
||||
CMENU.gm_mgStart.mg_pActivatedFunction = &StartNetworkGame;
|
||||
CMENU.gm_pgmParentMenu = &_pGUIM->gmNetworkStartMenu;
|
||||
ChangeToMenu(&CMENU);
|
||||
}
|
||||
|
||||
#undef CMENU
|
||||
|
||||
void JoinNetworkGame(void)
|
||||
{
|
||||
// _pGame->gm_MenuSplitScreenCfg = (enum CGame::SplitScreenCfg) mgSplitScreenCfg.mg_iSelected;
|
||||
|
@ -566,39 +574,43 @@ void JoinNetworkGame(void)
|
|||
}
|
||||
}
|
||||
|
||||
#define CMENU _pGUIM->gmSelectPlayersMenu
|
||||
|
||||
void StartSelectPlayersMenuFromOpen(void)
|
||||
{
|
||||
_pGUIM->gmSelectPlayersMenu.gm_bAllowDedicated = FALSE;
|
||||
_pGUIM->gmSelectPlayersMenu.gm_bAllowObserving = TRUE;
|
||||
_pGUIM->gmSelectPlayersMenu.gm_mgStart.mg_pActivatedFunction = &JoinNetworkGame;
|
||||
_pGUIM->gmSelectPlayersMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkOpenMenu;
|
||||
ChangeToMenu(&_pGUIM->gmSelectPlayersMenu);
|
||||
CMENU.gm_bAllowDedicated = FALSE;
|
||||
CMENU.gm_bAllowObserving = TRUE;
|
||||
CMENU.gm_mgStart.mg_pActivatedFunction = &JoinNetworkGame;
|
||||
CMENU.gm_pgmParentMenu = &_pGUIM->gmNetworkOpenMenu;
|
||||
ChangeToMenu(&CMENU);
|
||||
|
||||
/*if (sam_strNetworkSettings=="")*/ {
|
||||
void StartNetworkSettingsMenu(void);
|
||||
StartNetworkSettingsMenu();
|
||||
_pGUIM->gmLoadSaveMenu.gm_bNoEscape = TRUE;
|
||||
_pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = &_pGUIM->gmNetworkOpenMenu;
|
||||
_pGUIM->gmLoadSaveMenu.gm_pgmNextMenu = &_pGUIM->gmSelectPlayersMenu;
|
||||
_pGUIM->gmLoadSaveMenu.gm_pgmNextMenu = &CMENU;
|
||||
}
|
||||
}
|
||||
void StartSelectPlayersMenuFromServers(void)
|
||||
{
|
||||
_pGUIM->gmSelectPlayersMenu.gm_bAllowDedicated = FALSE;
|
||||
_pGUIM->gmSelectPlayersMenu.gm_bAllowObserving = TRUE;
|
||||
_pGUIM->gmSelectPlayersMenu.gm_mgStart.mg_pActivatedFunction = &JoinNetworkGame;
|
||||
_pGUIM->gmSelectPlayersMenu.gm_pgmParentMenu = &_pGUIM->gmServersMenu;
|
||||
ChangeToMenu(&_pGUIM->gmSelectPlayersMenu);
|
||||
CMENU.gm_bAllowDedicated = FALSE;
|
||||
CMENU.gm_bAllowObserving = TRUE;
|
||||
CMENU.gm_mgStart.mg_pActivatedFunction = &JoinNetworkGame;
|
||||
CMENU.gm_pgmParentMenu = &_pGUIM->gmServersMenu;
|
||||
ChangeToMenu(&CMENU);
|
||||
|
||||
/*if (sam_strNetworkSettings=="")*/ {
|
||||
void StartNetworkSettingsMenu(void);
|
||||
StartNetworkSettingsMenu();
|
||||
_pGUIM->gmLoadSaveMenu.gm_bNoEscape = TRUE;
|
||||
_pGUIM->gmLoadSaveMenu.gm_pgmParentMenu = &_pGUIM->gmServersMenu;
|
||||
_pGUIM->gmLoadSaveMenu.gm_pgmNextMenu = &_pGUIM->gmSelectPlayersMenu;
|
||||
_pGUIM->gmLoadSaveMenu.gm_pgmNextMenu = &CMENU;
|
||||
}
|
||||
}
|
||||
|
||||
#undef CMENU
|
||||
|
||||
void StartSelectServerLAN(void)
|
||||
{
|
||||
_pGUIM->gmServersMenu.m_bInternet = FALSE;
|
||||
|
@ -776,4 +788,12 @@ void StartNetworkSettingsMenu(void)
|
|||
ChangeToMenu(&CMENU);
|
||||
}
|
||||
|
||||
#undef CMENU
|
||||
#undef CMENU
|
||||
|
||||
void DisabledFunction(void)
|
||||
{
|
||||
_pGUIM->gmDisabledFunction.gm_pgmParentMenu = pgmCurrentMenu;
|
||||
_pGUIM->gmDisabledFunction.gm_mgButton.mg_strText = TRANS("The feature is not available in this version!");
|
||||
_pGUIM->gmDisabledFunction.gm_mgTitle.mg_strText = TRANS("DISABLED");
|
||||
ChangeToMenu(&_pGUIM->gmDisabledFunction);
|
||||
}
|
|
@ -63,5 +63,6 @@ void StartAddonsLoadMenu(void);
|
|||
void StartModsLoadMenu(void);
|
||||
void StartNetworkSettingsMenu(void);
|
||||
void StartSinglePlayerMenu(void);
|
||||
void DisabledFunction(void);
|
||||
|
||||
#endif /* include-once check. */
|
|
@ -8,6 +8,7 @@
|
|||
#include "MenuManager.h"
|
||||
#include "MenuStartersAF.h"
|
||||
#include "MenuStarters.h"
|
||||
#include "MenuStuff.h"
|
||||
|
||||
CTFileName _fnDemoToPlay;
|
||||
CTFileName _fnGameToLoad;
|
||||
|
@ -94,9 +95,6 @@ BOOL LSLoadPlayerModel(const CTFileName &fnm)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
extern void ControlsMenuOn();
|
||||
extern void ControlsMenuOff();
|
||||
|
||||
BOOL LSLoadControls(const CTFileName &fnm)
|
||||
{
|
||||
try {
|
||||
|
|
|
@ -261,4 +261,34 @@ enum DisplayDepth SwitchToDepth(INDEX i)
|
|||
case 2: return DD_32BIT;
|
||||
default: ASSERT(FALSE); return DD_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
// controls that are currently customized
|
||||
CTFileName _fnmControlsToCustomize = CTString("");
|
||||
|
||||
void ControlsMenuOn()
|
||||
{
|
||||
_pGame->SavePlayersAndControls();
|
||||
try {
|
||||
_pGame->gm_ctrlControlsExtra.Load_t(_fnmControlsToCustomize);
|
||||
}
|
||||
catch (char *strError) {
|
||||
WarningMessage(strError);
|
||||
}
|
||||
}
|
||||
|
||||
void ControlsMenuOff()
|
||||
{
|
||||
try {
|
||||
if (_pGame->gm_ctrlControlsExtra.ctrl_lhButtonActions.Count()>0) {
|
||||
_pGame->gm_ctrlControlsExtra.Save_t(_fnmControlsToCustomize);
|
||||
}
|
||||
}
|
||||
catch (char *strError) {
|
||||
FatalError(strError);
|
||||
}
|
||||
FORDELETELIST(CButtonAction, ba_lnNode, _pGame->gm_ctrlControlsExtra.ctrl_lhButtonActions, itAct) {
|
||||
delete &itAct.Current();
|
||||
}
|
||||
_pGame->LoadPlayersAndControls();
|
||||
}
|
|
@ -52,4 +52,7 @@ enum GfxAPIType SwitchToAPI(INDEX i);
|
|||
INDEX DepthToSwitch(enum DisplayDepth dd);
|
||||
enum DisplayDepth SwitchToDepth(INDEX i);
|
||||
|
||||
void ControlsMenuOn();
|
||||
void ControlsMenuOff();
|
||||
|
||||
#endif /* include-once check. */
|
Loading…
Reference in New Issue
Block a user