shithub: choc

Download patch

ref: 8980e849e5b03ae4dd6c264c6c152bc461daa9ef
parent: 93bbda69b51835fd9177deca0c706001ccb0a2a8
author: Simon Howard <[email protected]>
date: Sun Sep 14 14:14:46 EDT 2008

Add -nocheat command line parameter to disable applying cheats from
dehacked files.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 1227

--- a/src/deh_cheat.c
+++ b/src/deh_cheat.c
@@ -120,7 +120,10 @@
             break;
         }
 
-        cheat->seq->sequence[i] = unsvalue[i];
+	if (deh_apply_cheats)
+	{
+	    cheat->seq->sequence[i] = unsvalue[i];
+	}
         ++i;
 
         // Absolute limit - don't exceed
@@ -132,7 +135,10 @@
         }
     }
 
-    cheat->seq->sequence[i] = '\0';
+    if (deh_apply_cheats)
+    {
+        cheat->seq->sequence[i] = '\0';
+    }
 }
 
 deh_section_t deh_section_cheat =
--- a/src/deh_main.c
+++ b/src/deh_main.c
@@ -67,6 +67,10 @@
 
 boolean deh_allow_long_cheats = false;
 
+// If false, dehacked cheat replacements are ignored.
+
+boolean deh_apply_cheats = true;
+
 //
 // List of section types:
 //
@@ -380,6 +384,17 @@
     int p;
 
     InitialiseSections();
+
+    //!
+    // @category mod
+    //
+    // Ignore cheats in dehacked files.
+    //
+
+    if (M_CheckParm("-nocheats") > 0) 
+    {
+	deh_apply_cheats = false;
+    }
 
     //!
     // @arg <files>
--- a/src/deh_main.h
+++ b/src/deh_main.h
@@ -61,6 +61,7 @@
 
 extern boolean deh_allow_long_strings;
 extern boolean deh_allow_long_cheats;
+extern boolean deh_apply_cheats;
 
 #endif /* #ifndef DEH_MAIN_H */