From a74be6937150a81eb301d5dcb8fbb1e21eafb2dc Mon Sep 17 00:00:00 2001 From: PaulyB <43163391+3saster@users.noreply.github.com> Date: Wed, 13 Nov 2019 03:58:27 -0800 Subject: [PATCH] Added 'NoKeyboardCheats' option to IWADINFO This is useful for IWADs that do not want to use the hardcoded engine cheats. This can still be overriden with the 'allcheats' CVAR --- src/d_iwad.cpp | 4 ++++ src/d_main.cpp | 1 + src/d_main.h | 1 + src/gamedata/gi.h | 1 + src/st_stuff.cpp | 2 +- 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/d_iwad.cpp b/src/d_iwad.cpp index b1a63da18..bb957b73e 100644 --- a/src/d_iwad.cpp +++ b/src/d_iwad.cpp @@ -128,6 +128,10 @@ void FIWadManager::ParseIWadInfo(const char *fn, const char *data, int datasize, sc.MustGetString(); iwad->MapInfo = sc.String; } + else if (sc.Compare("NoKeyboardCheats")) + { + iwad->nokeyboardcheats = true; + } else if (sc.Compare("Compatibility")) { sc.MustGetStringName("="); diff --git a/src/d_main.cpp b/src/d_main.cpp index 0f25c583c..d12b93ad5 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -2480,6 +2480,7 @@ static int D_DoomMain_Internal (void) if (!iwad_info) return 0; // user exited the selection popup via cancel button. gameinfo.gametype = iwad_info->gametype; gameinfo.flags = iwad_info->flags; + gameinfo.nokeyboardcheats = iwad_info->nokeyboardcheats; gameinfo.ConfigName = iwad_info->Configname; lastIWAD = iwad; diff --git a/src/d_main.h b/src/d_main.h index 16468f5da..5fea9f034 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -107,6 +107,7 @@ struct FIWADInfo EGameType gametype = GAME_Doom; // which game are we playing? int StartupType = FStartupInfo::DefaultStartup; // alternate startup type FString MapInfo; // Base mapinfo to load + bool nokeyboardcheats = false; // disable keyboard cheats TArray Load; // Wads to be loaded with this one. TArray Lumps; // Lump names for identification TArray DeleteLumps; // Lumps which must be deleted from the directory. diff --git a/src/gamedata/gi.h b/src/gamedata/gi.h index 676630211..8a57cfbd5 100644 --- a/src/gamedata/gi.h +++ b/src/gamedata/gi.h @@ -111,6 +111,7 @@ struct gameinfo_t FString ConfigName; FString TitlePage; + bool nokeyboardcheats; bool drawreadthis; bool noloopfinalemusic; bool intermissioncounter; diff --git a/src/st_stuff.cpp b/src/st_stuff.cpp index 511232f17..59e28d590 100644 --- a/src/st_stuff.cpp +++ b/src/st_stuff.cpp @@ -309,7 +309,7 @@ bool ST_Responder (event_t *ev) { bool eat = false; - if (nocheats || !!cl_blockcheats) + if (nocheats || !!cl_blockcheats || (gameinfo.nokeyboardcheats && !allcheats)) { return false; }