Add Sfall AutoQuickSave (#305)

This commit is contained in:
c6 2023-06-16 09:01:44 +04:00 committed by GitHub
parent 0ffcb107af
commit cf98070cd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 0 deletions

View File

@ -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");

View File

@ -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, "");

View File

@ -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