From 279c0caea47a9dbcc39478253e65abceb8f0e668 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 22 Oct 2019 00:58:51 +0200 Subject: [PATCH] - autosave variables --- source/blood/src/menus.cpp | 15 --------------- source/common/gamecvars.cpp | 27 +++++++-------------------- source/common/gamecvars.h | 3 +++ source/duke3d/src/config.cpp | 3 --- source/duke3d/src/game.h | 3 --- source/duke3d/src/gamestructures.cpp | 4 ++-- source/duke3d/src/menus.cpp | 8 ++++---- source/duke3d/src/savegame.cpp | 4 ++-- source/rr/src/config.cpp | 3 --- source/rr/src/game.h | 3 --- source/rr/src/menus.cpp | 6 +++--- 11 files changed, 21 insertions(+), 58 deletions(-) diff --git a/source/blood/src/menus.cpp b/source/blood/src/menus.cpp index eb6bee374..30e4f7c76 100644 --- a/source/blood/src/menus.cpp +++ b/source/blood/src/menus.cpp @@ -1204,23 +1204,8 @@ static MenuEntry_t *MEL_ADVSOUND[] = { }; -static MenuOption_t MEO_SAVESETUP_AUTOSAVE = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &ud.autosave ); static MenuEntry_t ME_SAVESETUP_AUTOSAVE = MAKE_MENUENTRY( "Checkpoints:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_SAVESETUP_AUTOSAVE, Option ); -static MenuOption_t MEO_SAVESETUP_AUTOSAVEDELETION = MAKE_MENUOPTION( &MF_Redfont, &MEOS_NoYes, &ud.autosavedeletion ); -static MenuEntry_t ME_SAVESETUP_AUTOSAVEDELETION = MAKE_MENUENTRY( "Auto-Delete:", &MF_Redfont, &MEF_BigOptions_Apply, &MEO_SAVESETUP_AUTOSAVEDELETION, Option ); -static MenuRangeInt32_t MEO_SAVESETUP_MAXAUTOSAVES = MAKE_MENURANGE( &ud.maxautosaves, &MF_Redfont, 1, 10, 0, 10, 1 ); -static MenuEntry_t ME_SAVESETUP_MAXAUTOSAVES = MAKE_MENUENTRY( "Limit:", &MF_Redfont, &MEF_BigOptions_Apply, &MEO_SAVESETUP_MAXAUTOSAVES, RangeInt32 ); - -static MenuEntry_t ME_SAVESETUP_CLEANUP = MAKE_MENUENTRY( "Clean Up Saves", &MF_Redfont, &MEF_BigOptionsRt, &MEO_NULL, Link ); - -static MenuEntry_t *MEL_SAVESETUP[] = { - &ME_SAVESETUP_AUTOSAVE, - &ME_SAVESETUP_AUTOSAVEDELETION, - &ME_SAVESETUP_MAXAUTOSAVES, - &ME_SAVESETUP_CLEANUP, -}; - MAKE_MENU_TOP_ENTRYLINK( "Player Setup", MEF_CenterMenu, NETWORK_PLAYERSETUP, MENU_PLAYER ); MAKE_MENU_TOP_ENTRYLINK( "Join Game", MEF_CenterMenu, NETWORK_JOINGAME, MENU_NETJOIN ); diff --git a/source/common/gamecvars.cpp b/source/common/gamecvars.cpp index b458061d2..d1138010f 100644 --- a/source/common/gamecvars.cpp +++ b/source/common/gamecvars.cpp @@ -10,9 +10,12 @@ */ CVARD(Bool, cl_crosshair, true, CVAR_ARCHIVE, "enable/disable crosshair"); -CVARD(Bool, cl_automsg, false, CVAR_ARCHIVE, "enable/disable automatically sending messages to all players") +CVARD(Bool, cl_automsg, false, CVAR_ARCHIVE, "enable/disable automatically sending messages to all players") // Not implemented for Blood CVARD(Bool, cl_autorun, true, CVAR_ARCHIVE, "enable/disable autorun") CVARD(Bool, cl_runmode, true, CVAR_ARCHIVE, "enable/disable modernized run key operation") +CVARD(Bool, cl_autosave, true, CVAR_ARCHIVE, "enable/disable autosaves") // Not implemented for Blood (but looks like the other games never check it either.) +CVARD(Bool, cl_autosavedeletion, true, CVAR_ARCHIVE, "enable/disable automatic deletion of autosaves") // Not implemented for Blood +CVARD(Int, cl_maxautosaves, 8, CVAR_ARCHIVE, "number of autosaves to keep before deleting the oldest") // Not implemented for Blood CUSTOM_CVARD(Int, cl_autoaim, 1, CVAR_ARCHIVE, "enable/disable weapon autoaim") { @@ -29,24 +32,12 @@ bool G_CheckAutorun(bool button) #if 0 - { "cl_autorun", "enable/disable autorun", (void *)&ud.auto_run, CVAR_BOOL, 0, 1 }, - { "cl_autorun", "enable/disable autorun", (void *)&gAutoRun, CVAR_BOOL, 0, 1 }, - { "cl_runmode", "enable/disable modernized run key operation", (void *)&gRunKeyMode, CVAR_BOOL, 0, 1 }, - { "cl_runmode", "enable/disable modernized run key operation", (void *)&ud.runkey_mode, CVAR_BOOL, 0, 1 }, - // DN3D static osdcvardata_t cvars_game[] = { - - { "cl_autorun", "enable/disable autorun", (void *)&ud.auto_run, CVAR_BOOL, 0, 1 }, - - { "cl_autosave", "enable/disable autosaves", (void *) &ud.autosave, CVAR_BOOL, 0, 1 }, - { "cl_autosavedeletion", "enable/disable automatic deletion of autosaves", (void *) &ud.autosavedeletion, CVAR_BOOL, 0, 1 }, - { "cl_maxautosaves", "number of autosaves to keep before deleting the oldest", (void *) &ud.maxautosaves, CVAR_INT, 1, 100 }, - { "cl_autovote", "enable/disable automatic voting", (void *)&ud.autovote, CVAR_INT, 0, 2 }, { "cl_cheatmask", "configure what cheats show in the cheats menu", (void *)&cl_cheatmask, CVAR_UINT, 0, ~0 }, @@ -193,9 +184,9 @@ bool G_CheckAutorun(bool button) static osdcvardata_t cvars_game[] = { - { "cl_autosave", "enable/disable autosaves", (void *) &ud.autosave, CVAR_BOOL, 0, 1 }, - { "cl_autosavedeletion", "enable/disable automatic deletion of autosaves", (void *) &ud.autosavedeletion, CVAR_BOOL, 0, 1 }, - { "cl_maxautosaves", "number of autosaves to keep before deleting the oldest", (void *) &ud.maxautosaves, CVAR_INT, 1, 100 }, + { "cl_autosave", "enable/disable autosaves", (void *) &cl_autosave.Value, CVAR_BOOL, 0, 1 }, + { "cl_autosavedeletion", "enable/disable automatic deletion of autosaves", (void *) &cl_autosavedeletion.Value, CVAR_BOOL, 0, 1 }, + { "cl_maxautosaves", "number of autosaves to keep before deleting the oldest", (void *) &cl_maxautosaves.Value, CVAR_INT, 1, 100 }, { "cl_autovote", "enable/disable automatic voting", (void *)&ud.autovote, CVAR_INT, 0, 2 }, @@ -345,10 +336,6 @@ int32_t registerosdcommands(void) static osdcvardata_t cvars_game[] = { -// -// { "cl_autosave", "enable/disable autosaves", (void *) &ud.autosave, CVAR_BOOL, 0, 1 }, -// { "cl_autosavedeletion", "enable/disable automatic deletion of autosaves", (void *) &ud.autosavedeletion, CVAR_BOOL, 0, 1 }, -// { "cl_maxautosaves", "number of autosaves to keep before deleting the oldest", (void *) &ud.maxautosaves, CVAR_INT, 1, 100 }, // // { "cl_autovote", "enable/disable automatic voting", (void *)&ud.autovote, CVAR_INT, 0, 2 }, // diff --git a/source/common/gamecvars.h b/source/common/gamecvars.h index 9c5d487f9..5f6a1890d 100644 --- a/source/common/gamecvars.h +++ b/source/common/gamecvars.h @@ -5,6 +5,9 @@ EXTERN_CVAR(Bool, cl_automsg) EXTERN_CVAR(Int, cl_autoaim) EXTERN_CVAR(Bool, cl_autorun) EXTERN_CVAR(Bool, cl_runmode) +EXTERN_CVAR(Bool, cl_autosave) +EXTERN_CVAR(Bool, cl_autosavedeletion) +EXTERN_CVAR(Int, cl_maxautosaves) CUSTOM_CVARD(Int, cl_autoaim, 1, CVAR_ARCHIVE, "enable/disable weapon autoaim") { diff --git a/source/duke3d/src/config.cpp b/source/duke3d/src/config.cpp index c254637b9..cb469863e 100644 --- a/source/duke3d/src/config.cpp +++ b/source/duke3d/src/config.cpp @@ -254,8 +254,6 @@ void CONFIG_SetDefaults(void) ud.althud = 1; ud.angleinterpolation = 0; - ud.autosave = 1; - ud.autosavedeletion = 1; ud.autovote = 0; ud.brightness = 8; ud.camerasprite = -1; @@ -288,7 +286,6 @@ void CONFIG_SetDefaults(void) ud.levelstats = 0; ud.lockout = 0; ud.m_marker = 1; - ud.maxautosaves = 5; ud.menu_scrollbartilenum = -1; ud.menu_scrollbarz = 65536; ud.menu_scrollcursorz = 65536; diff --git a/source/duke3d/src/game.h b/source/duke3d/src/game.h index fbe275923..a9a80a3b6 100644 --- a/source/duke3d/src/game.h +++ b/source/duke3d/src/game.h @@ -202,9 +202,6 @@ typedef struct { int32_t default_volume, default_skill; - int32_t autosave; - int32_t autosavedeletion, maxautosaves; - int32_t returnvar[MAX_RETURN_VALUES-1]; uint32_t userbytever; diff --git a/source/duke3d/src/gamestructures.cpp b/source/duke3d/src/gamestructures.cpp index 15eca72de..9edd8aa46 100644 --- a/source/duke3d/src/gamestructures.cpp +++ b/source/duke3d/src/gamestructures.cpp @@ -1550,7 +1550,7 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum, int const lParm2) labelNum = ud.returnvar[lParm2 - 1]; break; case USERDEFS_USERBYTEVERSION: labelNum = ud.userbytever; break; - case USERDEFS_AUTOSAVE: labelNum = ud.autosave; break; + case USERDEFS_AUTOSAVE: labelNum = cl_autosave; break; case USERDEFS_DRAW_Y: labelNum = rotatesprite_y_offset; break; case USERDEFS_DRAW_YXASPECT: labelNum = rotatesprite_yxaspect; break; case USERDEFS_FOV: labelNum = ud.fov; break; @@ -1753,7 +1753,7 @@ void __fastcall VM_SetUserdef(int const labelNum, int const lParm2, int32_t cons ud.returnvar[lParm2 - 1] = iSet; break; case USERDEFS_USERBYTEVERSION: ud.userbytever = iSet; break; - case USERDEFS_AUTOSAVE: ud.autosave = iSet; break; + case USERDEFS_AUTOSAVE: cl_autosave = iSet; break; //!!! case USERDEFS_DRAW_Y: rotatesprite_y_offset = iSet; break; case USERDEFS_DRAW_YXASPECT: rotatesprite_yxaspect = iSet; break; case USERDEFS_FOV: ud.fov = iSet; break; diff --git a/source/duke3d/src/menus.cpp b/source/duke3d/src/menus.cpp index fb6447620..856d9cb45 100644 --- a/source/duke3d/src/menus.cpp +++ b/source/duke3d/src/menus.cpp @@ -1203,12 +1203,12 @@ static MenuEntry_t *MEL_ADVSOUND[] = { }; -static MenuOption_t MEO_SAVESETUP_AUTOSAVE = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &ud.autosave ); +static MenuOption_t MEO_SAVESETUP_AUTOSAVE = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &cl_autosave.Value ); static MenuEntry_t ME_SAVESETUP_AUTOSAVE = MAKE_MENUENTRY( "Checkpoints:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_SAVESETUP_AUTOSAVE, Option ); -static MenuOption_t MEO_SAVESETUP_AUTOSAVEDELETION = MAKE_MENUOPTION( &MF_Redfont, &MEOS_NoYes, &ud.autosavedeletion ); +static MenuOption_t MEO_SAVESETUP_AUTOSAVEDELETION = MAKE_MENUOPTION( &MF_Redfont, &MEOS_NoYes, &cl_autosavedeletion.Value ); static MenuEntry_t ME_SAVESETUP_AUTOSAVEDELETION = MAKE_MENUENTRY( "Auto-Delete:", &MF_Redfont, &MEF_BigOptions_Apply, &MEO_SAVESETUP_AUTOSAVEDELETION, Option ); -static MenuRangeInt32_t MEO_SAVESETUP_MAXAUTOSAVES = MAKE_MENURANGE( &ud.maxautosaves, &MF_Redfont, 1, 10, 0, 10, 1 ); +static MenuRangeInt32_t MEO_SAVESETUP_MAXAUTOSAVES = MAKE_MENURANGE( &cl_maxautosaves.Value, &MF_Redfont, 1, 10, 0, 10, 1 ); static MenuEntry_t ME_SAVESETUP_MAXAUTOSAVES = MAKE_MENUENTRY( "Limit:", &MF_Redfont, &MEF_BigOptions_Apply, &MEO_SAVESETUP_MAXAUTOSAVES, RangeInt32 ); static MenuEntry_t ME_SAVESETUP_CLEANUP = MAKE_MENUENTRY( "Clean Up Saves", &MF_Redfont, &MEF_BigOptionsRt, &MEO_NULL, Link ); @@ -2131,7 +2131,7 @@ static void Menu_Pre(MenuID_t cm) break; case MENU_SAVESETUP: - MenuEntry_DisableOnCondition(&ME_SAVESETUP_MAXAUTOSAVES, !ud.autosavedeletion); + MenuEntry_DisableOnCondition(&ME_SAVESETUP_MAXAUTOSAVES, !cl_autosavedeletion); break; case MENU_JOYSTICKSETUP: diff --git a/source/duke3d/src/savegame.cpp b/source/duke3d/src/savegame.cpp index a2d806251..2c56e544f 100644 --- a/source/duke3d/src/savegame.cpp +++ b/source/duke3d/src/savegame.cpp @@ -276,7 +276,7 @@ void ReadSaveGameHeaders(void) { ReadSaveGameHeaders_Internal(); - if (!ud.autosavedeletion) + if (!cl_autosavedeletion) return; bool didDelete = false; @@ -286,7 +286,7 @@ void ReadSaveGameHeaders(void) menusave_t & msv = g_menusaves[x]; if (!msv.isAutoSave) continue; - if (numautosaves >= ud.maxautosaves) + if (numautosaves >= cl_maxautosaves) { G_DeleteSave(msv.brief); didDelete = true; diff --git a/source/rr/src/config.cpp b/source/rr/src/config.cpp index 05312bbc1..0b100c344 100644 --- a/source/rr/src/config.cpp +++ b/source/rr/src/config.cpp @@ -307,9 +307,6 @@ void CONFIG_SetDefaults(void) ud.menu_scrollbartilenum = -1; ud.menu_scrollbarz = 65536; ud.menu_scrollcursorz = 65536; - ud.autosave = 1; - ud.autosavedeletion = 1; - ud.maxautosaves = 5; ud.fov = 90; ud.config.CheckForUpdates = 1; diff --git a/source/rr/src/game.h b/source/rr/src/game.h index e9689ba0f..a3a0caf96 100644 --- a/source/rr/src/game.h +++ b/source/rr/src/game.h @@ -181,9 +181,6 @@ typedef struct { int32_t default_volume, default_skill; - int32_t autosave; - int32_t autosavedeletion, maxautosaves; - //int32_t returnvar[MAX_RETURN_VALUES-1]; uint32_t userbytever; diff --git a/source/rr/src/menus.cpp b/source/rr/src/menus.cpp index c260b3f7b..7a4ce801e 100644 --- a/source/rr/src/menus.cpp +++ b/source/rr/src/menus.cpp @@ -1170,12 +1170,12 @@ static MenuEntry_t *MEL_CDPLAYER[] = { }; -static MenuOption_t MEO_SAVESETUP_AUTOSAVE = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &ud.autosave ); +static MenuOption_t MEO_SAVESETUP_AUTOSAVE = MAKE_MENUOPTION( &MF_Redfont, &MEOS_OffOn, &cl_autosave.Value ); static MenuEntry_t ME_SAVESETUP_AUTOSAVE = MAKE_MENUENTRY( "Autosaves:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_SAVESETUP_AUTOSAVE, Option ); -static MenuOption_t MEO_SAVESETUP_AUTOSAVEDELETION = MAKE_MENUOPTION( &MF_Redfont, &MEOS_NoYes, &ud.autosavedeletion ); +static MenuOption_t MEO_SAVESETUP_AUTOSAVEDELETION = MAKE_MENUOPTION( &MF_Redfont, &MEOS_NoYes, &cl_autosavedeletion.Value ); static MenuEntry_t ME_SAVESETUP_AUTOSAVEDELETION = MAKE_MENUENTRY( "Auto-Delete:", &MF_Redfont, &MEF_BigOptions_Apply, &MEO_SAVESETUP_AUTOSAVEDELETION, Option ); -static MenuRangeInt32_t MEO_SAVESETUP_MAXAUTOSAVES = MAKE_MENURANGE( &ud.maxautosaves, &MF_Redfont, 1, 10, 0, 10, 1 ); +static MenuRangeInt32_t MEO_SAVESETUP_MAXAUTOSAVES = MAKE_MENURANGE( &cl_maxautosaves.Value, &MF_Redfont, 1, 10, 0, 10, 1 ); static MenuEntry_t ME_SAVESETUP_MAXAUTOSAVES = MAKE_MENUENTRY( "Limit:", &MF_Redfont, &MEF_BigOptions_Apply, &MEO_SAVESETUP_MAXAUTOSAVES, RangeInt32 ); static MenuEntry_t ME_SAVESETUP_CLEANUP = MAKE_MENUENTRY( "Clean Up Saves", &MF_Redfont, &MEF_BigOptionsRt, &MEO_NULL, Link );