Skip to content

Commit

Permalink
don't let sideloaded PWADs replace default Doom 2 artwork
Browse files Browse the repository at this point in the history
Fixed #1223
  • Loading branch information
fabiangreffrath committed Sep 27, 2024
1 parent 35367e2 commit 4973f20
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions src/doom/d_pwad.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,13 @@ static void CheckLoadNerve (void)
static const lump_rename_t nerve_lumps [] = {
{"TITLEPIC", "NERVEPIC"},
{"INTERPIC", "NERVEINT"},
{"M_DOOM", "M_DOOM_N"},
{"DEMO1", "DEMO1N"},
{"DEMO2", "DEMO2N"},
{"DEMO3", "DEMO3N"},
{"RSKY1", "RSKY1N"},
{"RSKY2", "RSKY2N"},
{"RSKY3", "RSKY3N"},
};

// [crispy] don't load if another PWAD already provides MAP01
Expand Down Expand Up @@ -403,7 +410,7 @@ static void CheckLoadNerve (void)
{
j = W_CheckNumForName(nerve_lumps[i].name);

if (j != -1 && !strcasecmp(W_WadNameForLump(lumpinfo[j]), "NERVE.WAD"))
if (j != -1 && !strcasecmp(W_WadNameForLump(lumpinfo[j]), nerve_basename))
{
memcpy(lumpinfo[j]->name, nerve_lumps[i].new_name, 8);
}
Expand Down Expand Up @@ -457,6 +464,13 @@ static boolean CheckMasterlevelsLoaded (void)
static const lump_rename_t master_lumps [] = {
{"TITLEPIC", "MASTRPIC"},
{"INTERPIC", "MASTRINT"},
{"M_DOOM", "M_DOOM_M"},
{"DEMO1", "DEMO1M"},
{"DEMO2", "DEMO2M"},
{"DEMO3", "DEMO3M"},
{"RSKY1", "RSKY1M"},
{"RSKY2", "RSKY2M"},
{"RSKY3", "RSKY3M"},
};

// [crispy] auto-load the single MASTERLEVELS.WAD if available
Expand Down Expand Up @@ -507,7 +521,7 @@ static boolean CheckLoadMasterlevels (void)

M_snprintf(lumpname, 9, "CWILV%2.2d", i);
j = W_GetNumForName(lumpname);
if (!strcasecmp(W_WadNameForLump(lumpinfo[j]), "MASTERLEVELS.WAD"))
if (!strcasecmp(W_WadNameForLump(lumpinfo[j]), master_basename))
{
lumpinfo[j]->name[0] = 'M';
}
Expand All @@ -523,6 +537,17 @@ static boolean CheckLoadMasterlevels (void)
strcat(lumpinfo[j]->name, "M");
}

// [crispy] if MASTERLEVELS.WAD contains TITLEPIC and INTERPIC, rename them
for (i = 0; i < arrlen(master_lumps); i++)
{
j = W_CheckNumForName(master_lumps[i].name);

if (j != -1 && !strcasecmp(W_WadNameForLump(lumpinfo[j]), master_basename))
{
memcpy(lumpinfo[j]->name, master_lumps[i].new_name, 8);
}
}

// [crispy] load WAD and DEH files from autoload directories
if (!M_ParmExists("-noautoload"))
{
Expand Down

0 comments on commit 4973f20

Please sign in to comment.