From 044279960c60ad4ec2f957416d8031c8a6375072 Mon Sep 17 00:00:00 2001 From: nashmuhandes Date: Sat, 15 Jul 2023 22:03:58 +0800 Subject: [PATCH] Add MAPINFO NoAutoSaveOnEnter - this fully disables autosaves when a map is just entered (ignoring the user's autosave preference). --- src/g_level.cpp | 6 ++++++ src/gamedata/g_mapinfo.cpp | 1 + src/gamedata/g_mapinfo.h | 1 + wadsrc/static/zscript/constants.zs | 1 + 4 files changed, 9 insertions(+) diff --git a/src/g_level.cpp b/src/g_level.cpp index ebd08022f..75b73bed8 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1509,6 +1509,12 @@ void FLevelLocals::DoLoadLevel(const FString &nextmapname, int position, bool au DoDeferedScripts (); // [RH] Do script actions that were triggered on another map. + // [Nash] allow modder control of autosaving + if (flags9 & LEVEL9_NOAUTOSAVEONENTER) + { + autosave = false; + } + // [RH] Always save the game when entering a new if (autosave && !savegamerestore && disableautosave < 1) { diff --git a/src/gamedata/g_mapinfo.cpp b/src/gamedata/g_mapinfo.cpp index 79b0017d9..f446e84ea 100644 --- a/src/gamedata/g_mapinfo.cpp +++ b/src/gamedata/g_mapinfo.cpp @@ -1796,6 +1796,7 @@ MapFlagHandlers[] = { "forceworldpanning", MITYPE_SETFLAG3, LEVEL3_FORCEWORLDPANNING, 0 }, { "nousersave", MITYPE_SETFLAG9, LEVEL9_NOUSERSAVE, 0 }, { "noautomap", MITYPE_SETFLAG9, LEVEL9_NOAUTOMAP, 0 }, + { "noautosaveonenter", MITYPE_SETFLAG9, LEVEL9_NOAUTOSAVEONENTER, 0 }, { "propermonsterfallingdamage", MITYPE_SETFLAG3, LEVEL3_PROPERMONSTERFALLINGDAMAGE, 0 }, { "disableshadowmap", MITYPE_SETFLAG3, LEVEL3_NOSHADOWMAP, 0 }, { "enableshadowmap", MITYPE_CLRFLAG3, LEVEL3_NOSHADOWMAP, 0 }, diff --git a/src/gamedata/g_mapinfo.h b/src/gamedata/g_mapinfo.h index 4a3f380e0..a2d96e8da 100644 --- a/src/gamedata/g_mapinfo.h +++ b/src/gamedata/g_mapinfo.h @@ -275,6 +275,7 @@ enum ELevelFlags : unsigned int // Deliberately skip ahead... LEVEL9_NOUSERSAVE = 0x00000001, LEVEL9_NOAUTOMAP = 0x00000002, + LEVEL9_NOAUTOSAVEONENTER = 0x00000004, // don't make an autosave when entering a map }; diff --git a/wadsrc/static/zscript/constants.zs b/wadsrc/static/zscript/constants.zs index db8526203..8efc4e7e8 100644 --- a/wadsrc/static/zscript/constants.zs +++ b/wadsrc/static/zscript/constants.zs @@ -1382,6 +1382,7 @@ enum ELevelFlags LEVEL9_NOUSERSAVE = 0x00000001, LEVEL9_NOAUTOMAP = 0x00000002, + LEVEL9_NOAUTOSAVEONENTER = 0x00000004, // don't make an autosave when entering a map }; // [RH] Compatibility flags.