shithub: choc

Download patch

ref: 4d4f74f576cbde74def4bef7e1fda8c3a69eb64f
parent: eb1ea531fdba58cddfd583a6e7cef81a10f87242
author: Simon Howard <fraggle@gmail.com>
date: Fri Sep 12 21:56:35 EDT 2014

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.

--- a/src/deh_main.c
+++ b/src/deh_main.c
@@ -211,6 +211,18 @@
 
 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 @@
     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 @@
         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?