diff --git a/src/am_map.cpp b/src/am_map.cpp index 5cdf07c88..646dc28d5 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -1547,6 +1547,12 @@ void DAutomap::Ticker () if (!automapactive) return; + if ((primaryLevel->flags9 & LEVEL9_NOAUTOMAP)) + { + AM_ToggleMap(); + return; + } + amclock++; } @@ -3447,6 +3453,9 @@ void AM_ToggleMap() if (!primaryLevel || !primaryLevel->automap) return; + if (!automapactive && (primaryLevel->flags9 & LEVEL9_NOAUTOMAP)) + return; + if (!automapactive) { // Reset AM buttons diff --git a/src/console/c_cmds.cpp b/src/console/c_cmds.cpp index c5752c9b9..011f16140 100644 --- a/src/console/c_cmds.cpp +++ b/src/console/c_cmds.cpp @@ -667,6 +667,12 @@ UNSAFE_CCMD (load) UNSAFE_CCMD(save) { + if ((primaryLevel->flags9 & LEVEL9_NOUSERSAVE)) + { + Printf("%s\n", GStrings("SAVEDEAD")); + return; + } + if (argv.argc() < 2 || argv.argc() > 3 || argv[1][0] == 0) { Printf ("usage: save [description]\n"); diff --git a/src/g_game.cpp b/src/g_game.cpp index 3bf3569e8..9334176f2 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -2196,6 +2196,9 @@ CUSTOM_CVAR (Int, quicksaverotationcount, 4, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) void G_DoAutoSave () { + if ((primaryLevel->flags9 & LEVEL9_NOUSERSAVE)) + return; + FString description; FString file; // Keep up to four autosaves at a time diff --git a/src/g_levellocals.h b/src/g_levellocals.h index db5567554..89460fea3 100644 --- a/src/g_levellocals.h +++ b/src/g_levellocals.h @@ -607,6 +607,7 @@ public: uint32_t flags; uint32_t flags2; uint32_t flags3; + uint32_t flags9; uint32_t fadeto; // The color the palette fades to (usually black) uint32_t outsidefog; // The fog for sectors with sky ceilings diff --git a/src/gamedata/g_mapinfo.cpp b/src/gamedata/g_mapinfo.cpp index b87036be7..6d7a7f512 100644 --- a/src/gamedata/g_mapinfo.cpp +++ b/src/gamedata/g_mapinfo.cpp @@ -1693,6 +1693,9 @@ enum EMIType MITYPE_SETFLAG3, MITYPE_CLRFLAG3, MITYPE_SCFLAGS3, + MITYPE_SETFLAG9, + MITYPE_CLRFLAG9, + MITYPE_SCFLAGS9, MITYPE_COMPATFLAG, }; @@ -1790,6 +1793,8 @@ MapFlagHandlers[] = { "nolightfade", MITYPE_SETFLAG3, LEVEL3_NOLIGHTFADE, 0 }, { "nocoloredspritelighting", MITYPE_SETFLAG3, LEVEL3_NOCOLOREDSPRITELIGHTING, 0 }, { "forceworldpanning", MITYPE_SETFLAG3, LEVEL3_FORCEWORLDPANNING, 0 }, + { "nousersave", MITYPE_SETFLAG9, LEVEL9_NOUSERSAVE, 0 }, + { "noautomap", MITYPE_SETFLAG9, LEVEL9_NOAUTOMAP, 0 }, { "propermonsterfallingdamage", MITYPE_SETFLAG3, LEVEL3_PROPERMONSTERFALLINGDAMAGE, 0 }, { "disableshadowmap", MITYPE_SETFLAG3, LEVEL3_NOSHADOWMAP, 0 }, { "enableshadowmap", MITYPE_CLRFLAG3, LEVEL3_NOSHADOWMAP, 0 }, @@ -1948,6 +1953,29 @@ void FMapInfoParser::ParseMapDefinition(level_info_t &info) info.flags3 = (info.flags3 & handler->data2) | handler->data1; break; + case MITYPE_SETFLAG9: + if (!CheckAssign()) + { + info.flags9 |= handler->data1; + } + else + { + sc.MustGetNumber(); + if (sc.Number) info.flags9 |= handler->data1; + else info.flags9 &= ~handler->data1; + } + info.flags9 |= handler->data2; + break; + + case MITYPE_CLRFLAG9: + info.flags9 &= ~handler->data1; + info.flags9 |= handler->data2; + break; + + case MITYPE_SCFLAGS9: + info.flags9 = (info.flags9 & handler->data2) | handler->data1; + break; + case MITYPE_COMPATFLAG: { int set = 1; diff --git a/src/gamedata/g_mapinfo.h b/src/gamedata/g_mapinfo.h index f9e97e0c5..4a3f380e0 100644 --- a/src/gamedata/g_mapinfo.h +++ b/src/gamedata/g_mapinfo.h @@ -271,6 +271,10 @@ enum ELevelFlags : unsigned int LEVEL3_AVOIDMELEE = 0x00020000, // global flag needed for proper MBF support. LEVEL3_NOJUMPDOWN = 0x00040000, // only for MBF21. Inverse of MBF's dog_jumping flag. LEVEL3_LIGHTCREATED = 0x00080000, // a light had been created in the last frame + + // Deliberately skip ahead... + LEVEL9_NOUSERSAVE = 0x00000001, + LEVEL9_NOAUTOMAP = 0x00000002, }; @@ -343,6 +347,7 @@ struct level_info_t int32_t flags; uint32_t flags2; uint32_t flags3; + uint32_t flags9; FString Music; FString LevelName; diff --git a/src/menu/doommenu.cpp b/src/menu/doommenu.cpp index 5fd354202..1339d1230 100644 --- a/src/menu/doommenu.cpp +++ b/src/menu/doommenu.cpp @@ -68,6 +68,7 @@ #include "shiftstate.h" #include "s_music.h" #include "hwrenderer/scene/hw_drawinfo.h" +#include "g_levellocals.h" EXTERN_CVAR(Int, cl_gfxlocalization) EXTERN_CVAR(Bool, m_quickexit) @@ -183,6 +184,13 @@ bool M_SetSpecialMenu(FName& menu, int param) M_StartMessage (GStrings("SAVEDEAD"), 1); return false; } + + if ((primaryLevel->flags9 & LEVEL9_NOUSERSAVE)) + { + M_StartMessage(GStrings("SAVEDEAD"), 1); + return false; + } + break; case NAME_Quitmenu: @@ -404,6 +412,9 @@ CCMD (quicksave) return; } + if ((primaryLevel->flags9 & LEVEL9_NOUSERSAVE)) + return; + if (gamestate != GS_LEVEL) return; diff --git a/src/scripting/vmthunks.cpp b/src/scripting/vmthunks.cpp index d672a5192..1a796b443 100644 --- a/src/scripting/vmthunks.cpp +++ b/src/scripting/vmthunks.cpp @@ -2805,6 +2805,8 @@ DEFINE_FIELD_BIT(FLevelLocals, flags2, infinite_flight, LEVEL2_INFINITE_FLIGHT) DEFINE_FIELD_BIT(FLevelLocals, flags2, no_dlg_freeze, LEVEL2_CONV_SINGLE_UNFREEZE) DEFINE_FIELD_BIT(FLevelLocals, flags2, keepfullinventory, LEVEL2_KEEPFULLINVENTORY) DEFINE_FIELD_BIT(FLevelLocals, flags3, removeitems, LEVEL3_REMOVEITEMS) +DEFINE_FIELD_BIT(FLevelLocals, flags9, nousersave, LEVEL9_NOUSERSAVE) +DEFINE_FIELD_BIT(FLevelLocals, flags9, noautomap, LEVEL9_NOAUTOMAP) DEFINE_FIELD_X(Sector, sector_t, floorplane) DEFINE_FIELD_X(Sector, sector_t, ceilingplane) diff --git a/wadsrc/static/zscript/doombase.zs b/wadsrc/static/zscript/doombase.zs index 6ed46159a..0cca07c42 100644 --- a/wadsrc/static/zscript/doombase.zs +++ b/wadsrc/static/zscript/doombase.zs @@ -472,6 +472,9 @@ struct LevelLocals native native readonly int compatflags2; native readonly LevelInfo info; + native bool nousersave; + native bool noautomap; + native String GetUDMFString(int type, int index, Name key); native int GetUDMFInt(int type, int index, Name key); native double GetUDMFFloat(int type, int index, Name key);