diff options
author | Simon Howard | 2014-09-13 01:56:35 -0400 |
---|---|---|
committer | Simon Howard | 2014-09-13 01:56:35 -0400 |
commit | 4d4f74f576cbde74def4bef7e1fda8c3a69eb64f (patch) | |
tree | 692272a14e9b961e89f4cc4e0864f57b52c21564 | |
parent | eb1ea531fdba58cddfd583a6e7cef81a10f87242 (diff) | |
download | chocolate-doom-4d4f74f576cbde74def4bef7e1fda8c3a69eb64f.tar.gz chocolate-doom-4d4f74f576cbde74def4bef7e1fda8c3a69eb64f.tar.bz2 chocolate-doom-4d4f74f576cbde74def4bef7e1fda8c3a69eb64f.zip |
dehacked: Fix BEX string expansions.
The Dehacked code must pass a special flag to DEH_ReadLine() when
parsing the [STRINGS] section, so that lines can be escaped onto
following lines. However, this flag value was calculated incorrectly.
The BEX [STRINGS] section cannot be looked up at the start of
parsing a Dehacked file, because GetSectionByName() will return
NULL for it (extended strings are not available yet). Instead,
simplify the logic to look at the name of the current section and
check that way.
-rw-r--r-- | src/deh_main.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/deh_main.c b/src/deh_main.c index be1e5611..e201ce38 100644 --- a/src/deh_main.c +++ b/src/deh_main.c @@ -211,6 +211,18 @@ static boolean CheckSignatures(deh_context_t *context) static void DEH_ParseComment(char *comment) { + // + // Welcome, to the super-secret Chocolate Doom-specific Dehacked + // overrides function. + // + // Putting these magic comments into your Dehacked lumps will + // allow you to go beyond the normal limits of Vanilla Dehacked. + // Because of this, these comments are deliberately undocumented, + // and if you're using them you should be aware that your mod + // is not compatible with Vanilla Doom and you're probably a + // very naughty person. + // + // 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 @@ -251,9 +263,9 @@ static void DEH_ParseContext(deh_context_t *context) deh_section_t *current_section = NULL; char section_name[20]; void *tag = NULL; + boolean extended; char *line; - deh_section_t *bexstr; - + // Read the header and check it matches the signature if (!CheckSignatures(context)) @@ -261,17 +273,15 @@ static void DEH_ParseContext(deh_context_t *context) DEH_Error(context, "This is not a valid dehacked patch file!"); } - // extended string support required? - - bexstr = GetSectionByName("[STRINGS]"); - // Read the file - - for (;;) + + for (;;) { - // read a new line - - line = DEH_ReadLine(context, bexstr && current_section == bexstr); + // Read the next line. We only allow the special extended parsing + // for the BEX [STRINGS] section. + extended = current_section != NULL + && !strcasecmp(current_section->name, "[STRINGS]"); + line = DEH_ReadLine(context, extended); // end of file? |