summaryrefslogtreecommitdiff
path: root/src/deh_main.c
diff options
context:
space:
mode:
authorSimon Howard2014-03-16 02:23:14 -0400
committerSimon Howard2014-03-16 02:23:14 -0400
commitd73a64228a6502ce68e1c9fd1cc5197863a50c7e (patch)
tree9d06c190aebca18e3eee99c05dadb8d7489bb7a1 /src/deh_main.c
parent9f955ea5b1f124554d58733238dff4da1d9f54c4 (diff)
downloadchocolate-doom-d73a64228a6502ce68e1c9fd1cc5197863a50c7e.tar.gz
chocolate-doom-d73a64228a6502ce68e1c9fd1cc5197863a50c7e.tar.bz2
chocolate-doom-d73a64228a6502ce68e1c9fd1cc5197863a50c7e.zip
doom: Add -dehlump parameter to load DEHACKED lumps.
Lots of otherwise Vanilla-compatible WADs contain DEHACKED lumps. Allow these to be loaded by adding a -dehlump command line parameter. Thanks to Fabian Greffrath for the suggestion (fixes #349).
Diffstat (limited to 'src/deh_main.c')
-rw-r--r--src/deh_main.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/deh_main.c b/src/deh_main.c
index 4bb3e383..20858f32 100644
--- a/src/deh_main.c
+++ b/src/deh_main.c
@@ -348,16 +348,20 @@ int DEH_LoadFile(char *filename)
}
// Load dehacked file from WAD lump.
+// If allow_long is set, allow long strings and cheats just for this lump.
-int DEH_LoadLump(int lumpnum)
+int DEH_LoadLump(int lumpnum, boolean allow_long)
{
deh_context_t *context;
+ boolean long_strings, long_cheats;
- // If it's in a lump, it's probably designed for a modern source port,
- // so allow it to do long string and cheat replacements.
-
- deh_allow_long_strings = true;
- deh_allow_long_cheats = true;
+ if (allow_long)
+ {
+ long_strings = deh_allow_long_strings;
+ long_cheats = deh_allow_long_cheats;
+ deh_allow_long_strings = true;
+ deh_allow_long_cheats = true;
+ }
context = DEH_OpenLump(lumpnum);
@@ -371,10 +375,17 @@ int DEH_LoadLump(int lumpnum)
DEH_CloseFile(context);
+ // Restore old value of long flags.
+ if (allow_long)
+ {
+ deh_allow_long_strings = long_strings;
+ deh_allow_long_cheats = long_cheats;
+ }
+
return 1;
}
-int DEH_LoadLumpByName(char *name)
+int DEH_LoadLumpByName(char *name, boolean allow_long)
{
int lumpnum;
@@ -386,7 +397,7 @@ int DEH_LoadLumpByName(char *name)
return 0;
}
- return DEH_LoadLump(lumpnum);
+ return DEH_LoadLump(lumpnum, allow_long);
}
// Checks the command line for -deh argument