Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heretic: Use HHEVER lump to set HHE version for HEHACKED lumps #1173

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/heretic/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 14 additions & 0 deletions src/heretic/deh_htic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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[] =
{
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/heretic/deh_htic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading