From b80501b2c2eaa0f8495347ba41e21578929345f6 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Thu, 8 Mar 2018 03:55:12 +0000 Subject: [PATCH] Menus: Add "Save Setup" menu, currently for standalone builds only git-svn-id: https://svn.eduke32.com/eduke32@6742 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/config.cpp | 1 + source/duke3d/src/game.h | 2 ++ source/duke3d/src/gamedef.cpp | 1 + source/duke3d/src/gamedef.h | 1 + source/duke3d/src/gamestructures.cpp | 3 ++- source/duke3d/src/menus.cpp | 17 +++++++++++++++++ source/duke3d/src/menus.h | 1 + source/duke3d/src/osdcmds.cpp | 2 ++ 8 files changed, 27 insertions(+), 1 deletion(-) diff --git a/source/duke3d/src/config.cpp b/source/duke3d/src/config.cpp index 638670d04..b3ef522b7 100644 --- a/source/duke3d/src/config.cpp +++ b/source/duke3d/src/config.cpp @@ -281,6 +281,7 @@ void CONFIG_SetDefaults(void) ud.menu_scrollbartilenum = -1; ud.menu_scrollbarz = 65536; ud.menu_scrollcursorz = 65536; + ud.autosave = 1; ud.config.CheckForUpdates = 1; diff --git a/source/duke3d/src/game.h b/source/duke3d/src/game.h index 0789949d9..48ae14996 100644 --- a/source/duke3d/src/game.h +++ b/source/duke3d/src/game.h @@ -189,6 +189,8 @@ typedef struct { int32_t default_volume, default_skill; + int32_t autosave; + int32_t returnvar[MAX_RETURN_VALUES-1]; uint32_t userbytever; diff --git a/source/duke3d/src/gamedef.cpp b/source/duke3d/src/gamedef.cpp index 26750ec27..8459510ac 100644 --- a/source/duke3d/src/gamedef.cpp +++ b/source/duke3d/src/gamedef.cpp @@ -1308,6 +1308,7 @@ const memberlabel_t UserdefsLabels[]= { "menu_scrollcursorz", USERDEFS_MENU_SCROLLCURSORZ, 0, 0 }, { "return", USERDEFS_RETURN, LABEL_HASPARM2, MAX_RETURN_VALUES }, { "userbyteversion", USERDEFS_USERBYTEVERSION, 0, 0 }, + { "autosave", USERDEFS_AUTOSAVE, 0, 0 }, { NULL, -1, 0, 0 } // END OF LIST }; diff --git a/source/duke3d/src/gamedef.h b/source/duke3d/src/gamedef.h index 817768c09..4e210cdf2 100644 --- a/source/duke3d/src/gamedef.h +++ b/source/duke3d/src/gamedef.h @@ -602,6 +602,7 @@ enum UserdefsLabel_t USERDEFS_MENU_SCROLLCURSORZ, USERDEFS_RETURN, USERDEFS_USERBYTEVERSION, + USERDEFS_AUTOSAVE, USERDEFS_END }; diff --git a/source/duke3d/src/gamestructures.cpp b/source/duke3d/src/gamestructures.cpp index 98e1ec42e..adf7bcb5a 100644 --- a/source/duke3d/src/gamestructures.cpp +++ b/source/duke3d/src/gamestructures.cpp @@ -231,6 +231,7 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum, int32_t const lParm2) labelNum = ud.returnvar[lParm2-1]; break; case USERDEFS_USERBYTEVERSION: labelNum = ud.userbytever; break; + case USERDEFS_AUTOSAVE: labelNum = ud.autosave; break; default: labelNum = -1; break; } @@ -419,7 +420,7 @@ void __fastcall VM_SetUserdef(int32_t const labelNum, int32_t const lParm2, int3 else ud.returnvar[lParm2-1] = iSet; break; - case USERDEFS_USERBYTEVERSION: ud.userbytever = iSet; break; + case USERDEFS_AUTOSAVE: ud.autosave = iSet; break; default: break; } } diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index f32a87fca..764db4df1 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -385,6 +385,11 @@ static MenuEntry_t ME_SKILL_TEMPLATE = MAKE_MENUENTRY( NULL, &MF_Redfont, &MEF_C static MenuEntry_t ME_SKILL[MAXSKILLS]; static MenuEntry_t *MEL_SKILL[MAXSKILLS]; +#ifdef EDUKE32_SIMPLE_MENU +static MenuLink_t MEO_GAMESETUP_SAVESETUP = { MENU_SAVESETUP, MA_Advance, }; +static MenuEntry_t ME_GAMESETUP_SAVESETUP = MAKE_MENUENTRY( "Save setup", &MF_Redfont, &MEF_BigOptionsRt, &MEO_GAMESETUP_SAVESETUP, Link ); +#endif + #if defined STARTUP_SETUP_WINDOW && !defined EDUKE32_SIMPLE_MENU static MenuOption_t MEO_GAMESETUP_STARTWIN = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &ud.config.ForceSetup ); static MenuEntry_t ME_GAMESETUP_STARTWIN = MAKE_MENUENTRY( "Startup window:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_GAMESETUP_STARTWIN, Option ); @@ -681,6 +686,7 @@ static MenuEntry_t *MEL_OPTIONS[] = { &ME_OPTIONS_TOUCHSETUP, #endif #ifdef EDUKE32_SIMPLE_MENU + &ME_GAMESETUP_SAVESETUP, &ME_OPTIONS_CHEATS #endif }; @@ -1208,6 +1214,15 @@ static MenuEntry_t *MEL_ADVSOUND[] = { &ME_SOUND_RESTART, }; + +static MenuOption_t MEO_SAVESETUP_AUTOSAVE = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &ud.autosave ); +static MenuEntry_t ME_SAVESETUP_AUTOSAVE = MAKE_MENUENTRY( "Autosaves:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_SAVESETUP_AUTOSAVE, Option ); + +static MenuEntry_t *MEL_SAVESETUP[] = { + &ME_SAVESETUP_AUTOSAVE, +}; + + MAKE_MENU_TOP_ENTRYLINK( "Player Setup", MEF_CenterMenu, NETWORK_PLAYERSETUP, MENU_PLAYER ); MAKE_MENU_TOP_ENTRYLINK( "Join Game", MEF_CenterMenu, NETWORK_JOINGAME, MENU_NETJOIN ); MAKE_MENU_TOP_ENTRYLINK( "Host Game", MEF_CenterMenu, NETWORK_HOSTGAME, MENU_NETHOST ); @@ -1365,6 +1380,7 @@ static MenuMenu_t M_LOAD = MAKE_MENUMENU_CUSTOMSIZE( s_LoadGame, &MMF_LoadSave, static MenuMenu_t M_SAVE = MAKE_MENUMENU_CUSTOMSIZE( s_SaveGame, &MMF_LoadSave, MEL_SAVE ); static MenuMenu_t M_SOUND = MAKE_MENUMENU( "Sound Setup", &MMF_BigOptions, MEL_SOUND ); static MenuMenu_t M_ADVSOUND = MAKE_MENUMENU( "Advanced Sound", &MMF_BigOptions, MEL_ADVSOUND ); +static MenuMenu_t M_SAVESETUP = MAKE_MENUMENU( "Save Setup", &MMF_BigOptions, MEL_SAVESETUP ); static MenuMenu_t M_NETWORK = MAKE_MENUMENU( "Network Game", &MMF_Top_Joystick_Network, MEL_NETWORK ); static MenuMenu_t M_PLAYER = MAKE_MENUMENU( "Player Setup", &MMF_SmallOptions, MEL_PLAYER ); static MenuMenu_t M_MACROS = MAKE_MENUMENU( "Multiplayer Macros", &MMF_Macros, MEL_MACROS ); @@ -1459,6 +1475,7 @@ static Menu_t Menus[] = { { &M_SOUND, MENU_SOUND, MENU_OPTIONS, MA_Return, Menu }, { &M_SOUND, MENU_SOUND_INGAME, MENU_CLOSE, MA_Return, Menu }, { &M_ADVSOUND, MENU_ADVSOUND, MENU_SOUND, MA_Return, Menu }, + { &M_SAVESETUP, MENU_SAVESETUP, MENU_OPTIONS, MA_Return, Menu }, #ifdef EDUKE32_SIMPLE_MENU { &M_CHEATS, MENU_CHEATS, MENU_OPTIONS, MA_Return, Menu }, #else diff --git a/source/duke3d/src/menus.h b/source/duke3d/src/menus.h index b47bbf754..42add94a2 100644 --- a/source/duke3d/src/menus.h +++ b/source/duke3d/src/menus.h @@ -80,6 +80,7 @@ enum MenuIndex_t { MENU_SOUND = 700, MENU_SOUND_INGAME = 701, MENU_ADVSOUND = 702, + MENU_SAVESETUP = 750, MENU_CHEATS = 800, MENU_CHEATENTRY = 801, MENU_CHEAT_WARP = 802, diff --git a/source/duke3d/src/osdcmds.cpp b/source/duke3d/src/osdcmds.cpp index 3264545db..a6f9f9f1a 100644 --- a/source/duke3d/src/osdcmds.cpp +++ b/source/duke3d/src/osdcmds.cpp @@ -1721,6 +1721,8 @@ int32_t registerosdcommands(void) { "snd_reversestereo", "reverses the stereo channels", (void *)&ud.config.ReverseStereo, CVAR_BOOL, 0, 1 }, { "snd_speech", "enables/disables player speech", (void *)&ud.config.VoiceToggle, CVAR_INT, 0, 5 }, + { "sv_autosave", "enable/disable autosaves", (void *)&ud.autosave, CVAR_BOOL, 0, 1 }, + { "team","change team in multiplayer", (void *)&ud.team, CVAR_INT|CVAR_MULTI, 0, 3 }, #ifdef EDUKE32_TOUCH_DEVICES