diff options
author | Simon Howard | 2008-07-26 15:45:52 +0000 |
---|---|---|
committer | Simon Howard | 2008-07-26 15:45:52 +0000 |
commit | 6e8d5f118991efdc040f367b208f32219457bb39 (patch) | |
tree | 722c50adc1aeee3b1c13160f8d6a46b364725bdc | |
parent | fa03d0eb682e3838c4cebf62e3c24e3e6a7982b8 (diff) | |
download | chocolate-doom-6e8d5f118991efdc040f367b208f32219457bb39.tar.gz chocolate-doom-6e8d5f118991efdc040f367b208f32219457bb39.tar.bz2 chocolate-doom-6e8d5f118991efdc040f367b208f32219457bb39.zip |
Allow magic comments in dehacked files that disable the DOS dehacked
text replacement limit, so that we can use a dehacked patch to emulate
chex.exe.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 1158
-rw-r--r-- | src/deh_main.c | 25 | ||||
-rw-r--r-- | src/deh_main.h | 2 | ||||
-rw-r--r-- | src/deh_text.c | 3 |
3 files changed, 29 insertions, 1 deletions
diff --git a/src/deh_main.c b/src/deh_main.c index 7b08ebf4..e4ae7251 100644 --- a/src/deh_main.c +++ b/src/deh_main.c @@ -59,6 +59,10 @@ extern deh_section_t deh_section_thing; // deh_weapon.c: extern deh_section_t deh_section_weapon; +// If true, we can do long string replacements. + +boolean deh_allow_long_strings = false; + // // List of section types: // @@ -226,6 +230,24 @@ static boolean CheckSignatures(deh_context_t *context) return false; } +// Parses a comment string in a dehacked file. + +static void DEH_ParseComment(char *comment) +{ + // Allow comments containing this special value to allow string + // replacements longer than those permitted by DOS dehacked. + // This allows us to use a dehacked patch for doing string + // replacements for emulating Chex Quest. + // + // If you use this, your dehacked patch may not work in Vanilla + // Doom. + + if (strstr(comment, "*allow-long-strings*") != NULL) + { + deh_allow_long_strings = true; + } +} + // Parses a dehacked file by reading from the context static void DEH_ParseContext(deh_context_t *context) @@ -241,6 +263,8 @@ static void DEH_ParseContext(deh_context_t *context) { DEH_Error(context, "This is not a valid dehacked patch file!"); } + + deh_allow_long_strings = false; // Read the file @@ -262,6 +286,7 @@ static void DEH_ParseContext(deh_context_t *context) { // comment + DEH_ParseComment(line); continue; } diff --git a/src/deh_main.h b/src/deh_main.h index b1460a07..de6e8296 100644 --- a/src/deh_main.h +++ b/src/deh_main.h @@ -58,5 +58,7 @@ char *DEH_String(char *s); #endif +extern boolean deh_allow_long_strings; + #endif /* #ifndef DEH_MAIN_H */ diff --git a/src/deh_text.c b/src/deh_text.c index b4f7278e..ff5e2d70 100644 --- a/src/deh_text.c +++ b/src/deh_text.c @@ -31,6 +31,7 @@ #include "deh_defs.h" #include "deh_io.h" +#include "deh_main.h" typedef struct { @@ -194,7 +195,7 @@ static void *DEH_TextStart(deh_context_t *context, char *line) // Only allow string replacements that are possible in Vanilla Doom. // Chocolate Doom is unforgiving! - if (tolen > TXT_MaxStringLength(fromlen)) + if (!deh_allow_long_strings && tolen > TXT_MaxStringLength(fromlen)) { DEH_Error(context, "Replacement string is longer than the maximum " "possible in doom.exe"); |