diff options
Diffstat (limited to 'src/deh_main.c')
-rw-r--r-- | src/deh_main.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/deh_main.c b/src/deh_main.c index 4ab9a8f3..55e26c70 100644 --- a/src/deh_main.c +++ b/src/deh_main.c @@ -33,6 +33,10 @@ extern char *deh_signatures[]; static boolean deh_initialized = false; +// If true, we can parse [STRINGS] sections in BEX format. + +boolean deh_allow_extended_strings = false; + // If true, we can do long string replacements. boolean deh_allow_long_strings = false; @@ -220,6 +224,16 @@ static void DEH_ParseComment(char *comment) { deh_allow_long_cheats = true; } + + // Allow magic comments to allow parsing [STRINGS] section + // that are usually only found in BEX format files. This allows + // for substitution of map and episode names when loading + // Freedoom/FreeDM IWADs. + + if (strstr(comment, "*allow-extended-strings*") != NULL) + { + deh_allow_extended_strings = true; + } } // Parses a dehacked file by reading from the context @@ -230,6 +244,7 @@ static void DEH_ParseContext(deh_context_t *context) char section_name[20]; void *tag = NULL; char *line; + deh_section_t *bexstr; // Read the header and check it matches the signature @@ -242,9 +257,13 @@ static void DEH_ParseContext(deh_context_t *context) for (;;) { + // extended string support required? + + bexstr = GetSectionByName("[STRINGS]"); + // read a new line - line = DEH_ReadLine(context, current_section == GetSectionByName("[STRINGS]")); + line = DEH_ReadLine(context, bexstr && current_section == bexstr); // end of file? |