summaryrefslogtreecommitdiff
path: root/src/doom
diff options
context:
space:
mode:
Diffstat (limited to 'src/doom')
-rw-r--r--src/doom/d_main.c2
-rw-r--r--src/doom/deh_cheat.c10
-rw-r--r--src/doom/deh_io.c13
-rw-r--r--src/doom/deh_main.c15
-rw-r--r--src/doom/deh_main.h1
5 files changed, 31 insertions, 10 deletions
diff --git a/src/doom/d_main.c b/src/doom/d_main.c
index 67a22a50..3188ece3 100644
--- a/src/doom/d_main.c
+++ b/src/doom/d_main.c
@@ -510,7 +510,7 @@ void D_DoAdvanceDemo (void)
paused = false;
gameaction = ga_nothing;
- if ( gamemode == retail )
+ if (gamemode == retail && gameversion != exe_chex)
demosequence = (demosequence+1)%7;
else
demosequence = (demosequence+1)%6;
diff --git a/src/doom/deh_cheat.c b/src/doom/deh_cheat.c
index d4ea9113..b953c8a8 100644
--- a/src/doom/deh_cheat.c
+++ b/src/doom/deh_cheat.c
@@ -121,7 +121,10 @@ static void DEH_CheatParseLine(deh_context_t *context, char *line, void *tag)
break;
}
- cheat->seq->sequence[i] = unsvalue[i];
+ if (deh_apply_cheats)
+ {
+ cheat->seq->sequence[i] = unsvalue[i];
+ }
++i;
// Absolute limit - don't exceed
@@ -133,7 +136,10 @@ static void DEH_CheatParseLine(deh_context_t *context, char *line, void *tag)
}
}
- cheat->seq->sequence[i] = '\0';
+ if (deh_apply_cheats)
+ {
+ cheat->seq->sequence[i] = '\0';
+ }
}
deh_section_t deh_section_cheat =
diff --git a/src/doom/deh_io.c b/src/doom/deh_io.c
index 77cc40a1..3386a6fa 100644
--- a/src/doom/deh_io.c
+++ b/src/doom/deh_io.c
@@ -142,7 +142,7 @@ char *DEH_ReadLine(deh_context_t *context)
int c;
int pos;
- for (pos=0; ; ++pos)
+ for (pos = 0;;)
{
c = DEH_GetChar(context);
@@ -153,11 +153,6 @@ char *DEH_ReadLine(deh_context_t *context)
return NULL;
}
- if (c == '\0')
- {
- return NULL;
- }
-
// cope with lines of any length: increase the buffer size
if (pos >= context->readbuffer_size)
@@ -172,9 +167,13 @@ char *DEH_ReadLine(deh_context_t *context)
context->readbuffer[pos] = '\0';
break;
}
- else
+ else if (c != '\0')
{
+ // normal character; don't allow NUL characters to be
+ // added.
+
context->readbuffer[pos] = (char) c;
+ ++pos;
}
}
diff --git a/src/doom/deh_main.c b/src/doom/deh_main.c
index 9d528b0a..59e63ea3 100644
--- a/src/doom/deh_main.c
+++ b/src/doom/deh_main.c
@@ -69,6 +69,10 @@ boolean deh_allow_long_strings = false;
boolean deh_allow_long_cheats = false;
+// If false, dehacked cheat replacements are ignored.
+
+boolean deh_apply_cheats = true;
+
//
// List of section types:
//
@@ -384,6 +388,17 @@ void DEH_Init(void)
InitialiseSections();
//!
+ // @category mod
+ //
+ // Ignore cheats in dehacked files.
+ //
+
+ if (M_CheckParm("-nocheats") > 0)
+ {
+ deh_apply_cheats = false;
+ }
+
+ //!
// @arg <files>
// @category mod
//
diff --git a/src/doom/deh_main.h b/src/doom/deh_main.h
index 8a0587ff..f9cb44ca 100644
--- a/src/doom/deh_main.h
+++ b/src/doom/deh_main.h
@@ -48,6 +48,7 @@ void DEH_Checksum(md5_digest_t digest);
extern boolean deh_allow_long_strings;
extern boolean deh_allow_long_cheats;
+extern boolean deh_apply_cheats;
#endif /* #ifndef DEH_MAIN_H */