diff --git a/src/loadsave.cc b/src/loadsave.cc index e5d8db6..e05dc85 100644 --- a/src/loadsave.cc +++ b/src/loadsave.cc @@ -45,6 +45,7 @@ #include "random.h" #include "scripts.h" #include "settings.h" +#include "sfall_config.h" #include "sfall_global_scripts.h" #include "sfall_global_vars.h" #include "skill.h" @@ -328,6 +329,9 @@ static int gLoadSaveWindowOldFont; static FrmImage _loadsaveFrmImages[LOAD_SAVE_FRM_COUNT]; +static int quickSaveSlots = 0; +static bool autoQuickSaveSlots = false; + // 0x47B7E4 void _InitLoadSave() { @@ -338,6 +342,11 @@ void _InitLoadSave() _MapDirErase("MAPS\\", "SAV"); _MapDirErase(PROTO_DIR_NAME "\\" CRITTERS_DIR_NAME "\\", PROTO_FILE_EXT); _MapDirErase(PROTO_DIR_NAME "\\" ITEMS_DIR_NAME "\\", PROTO_FILE_EXT); + + configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_AUTO_QUICK_SAVE, &quickSaveSlots); + if (quickSaveSlots > 0 && quickSaveSlots <= 10) { + autoQuickSaveSlots = true; + } } // 0x47B85C @@ -359,7 +368,18 @@ int lsgSaveGame(int mode) _ls_error_code = 0; _patches = settings.system.master_patches_path.c_str(); + // SFALL: skip slot selection if auto quicksave is enabled + if (autoQuickSaveSlots) { + _quick_done = true; + } + if (mode == LOAD_SAVE_MODE_QUICK && _quick_done) { + // SFALL: cycle through first N slots for quicksaving + if (autoQuickSaveSlots) { + if (++_slot_cursor >= quickSaveSlots) { + _slot_cursor = 0; + } + } snprintf(_gmpath, sizeof(_gmpath), "%s\\%s%.2d\\", "SAVEGAME", "SLOT", _slot_cursor + 1); strcat(_gmpath, "SAVE.DAT"); diff --git a/src/sfall_config.cc b/src/sfall_config.cc index b85a83b..353bb37 100644 --- a/src/sfall_config.cc +++ b/src/sfall_config.cc @@ -57,6 +57,7 @@ bool sfallConfigInit(int argc, char** argv) configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MOVIE_TIMER_ARTIMER2, 180); configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MOVIE_TIMER_ARTIMER3, 270); configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_MOVIE_TIMER_ARTIMER4, 360); + configSetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_AUTO_QUICK_SAVE, 0); configSetString(&gSfallConfig, SFALL_CONFIG_SCRIPTS_KEY, SFALL_CONFIG_INI_CONFIG_FOLDER, ""); configSetString(&gSfallConfig, SFALL_CONFIG_SCRIPTS_KEY, SFALL_CONFIG_GLOBAL_SCRIPT_PATHS, ""); diff --git a/src/sfall_config.h b/src/sfall_config.h index 1f786ce..da2c298 100644 --- a/src/sfall_config.h +++ b/src/sfall_config.h @@ -71,6 +71,7 @@ namespace fallout { #define SFALL_CONFIG_NUMBERS_IS_DIALOG_KEY "NumbersInDialogue" #define SFALL_CONFIG_INI_CONFIG_FOLDER "IniConfigFolder" #define SFALL_CONFIG_GLOBAL_SCRIPT_PATHS "GlobalScriptPaths" +#define SFALL_CONFIG_AUTO_QUICK_SAVE "AutoQuickSave" #define SFALL_CONFIG_BURST_MOD_DEFAULT_CENTER_MULTIPLIER 1 #define SFALL_CONFIG_BURST_MOD_DEFAULT_CENTER_DIVISOR 3