diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c index 544c3b8cc8..f2956b9d3c 100644 --- a/src/heretic/d_main.c +++ b/src/heretic/d_main.c @@ -1188,6 +1188,13 @@ void D_DoomMain(void) } } + // [crispy] load version number from HHEVER lump if it exists. + // -hhever parm takes priority, even if it's invalid + if (W_CheckNumForName("HHEVER") != -1 && !M_ParmExists("-hhever")) + { + SetHHEVersionFromLump(W_CheckNumForName("HHEVER")); + } + if (W_CheckNumForName("HEHACKED") != -1) { DEH_LoadLumpByName("HEHACKED", true, true); diff --git a/src/heretic/deh_htic.c b/src/heretic/deh_htic.c index 94fb935cec..58d749f9c7 100644 --- a/src/heretic/deh_htic.c +++ b/src/heretic/deh_htic.c @@ -24,6 +24,8 @@ #include "deh_htic.h" #include "info.h" #include "m_argv.h" +#include "w_wad.h" // [crispy] +#include "z_zone.h" // [crispy] const char *deh_signatures[] = { @@ -80,6 +82,18 @@ static void SetHHEVersionByName(const char *name) } } +// [crispy] read an HHEVER lump if one exists +// let SetHHEVersionByName figure out if it's vaild or not +void SetHHEVersionFromLump(int lumpnum) +{ + char *data = NULL; + + data = W_CacheLumpNum(lumpnum, PU_CACHE); + SetHHEVersionByName(data); + + return; +} + // Initialize Heretic(HHE)-specific dehacked bits. void DEH_HereticInit(void) diff --git a/src/heretic/deh_htic.h b/src/heretic/deh_htic.h index 978d938156..8352973afc 100644 --- a/src/heretic/deh_htic.h +++ b/src/heretic/deh_htic.h @@ -45,6 +45,7 @@ void DEH_HereticInit(void); int DEH_MapHereticThingType(int type); int DEH_MapHereticFrameNumber(int frame); void DEH_SuggestHereticVersion(deh_hhe_version_t version); +void SetHHEVersionFromLump(int lumpnum); extern deh_hhe_version_t deh_hhe_version;