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

doom: apply "specal treatment" to Nerve_demo.wad #1022

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
45 changes: 28 additions & 17 deletions src/doom/d_pwad.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,19 @@ static boolean CheckNerveLoaded (void)

if ((i = W_GetNumForName("MAP01")) != -1 &&
(j = W_GetNumForName("MAP09")) != -1 &&
!strcasecmp(W_WadNameForLump(lumpinfo[i]), "NERVE.WAD") &&
!strcasecmp(W_WadNameForLump(lumpinfo[j]), "NERVE.WAD"))
(!strcasecmp(W_WadNameForLump(lumpinfo[i]), "NERVE.WAD") ||
!strcasecmp(W_WadNameForLump(lumpinfo[i]), "Nerve_demo.wad")) &&
(!strcasecmp(W_WadNameForLump(lumpinfo[j]), "NERVE.WAD") ||
!strcasecmp(W_WadNameForLump(lumpinfo[j]), "Nerve_demo.wad")))
{
gamemission = pack_nerve;

// [crispy] if NERVE.WAD does not contain TITLEPIC, use INTERPIC instead
i = W_GetNumForName("INTERPIC");
j = W_GetNumForName("TITLEPIC");
if (W_IsIWADLump(lumpinfo[i]) &&
strcasecmp(W_WadNameForLump(lumpinfo[j]), "NERVE.WAD"))
strcasecmp(W_WadNameForLump(lumpinfo[j]), "NERVE.WAD") &&
strcasecmp(W_WadNameForLump(lumpinfo[j]), "Nerve_demo.wad"))
{
DEH_AddStringReplacement ("TITLEPIC", "INTERPIC");
}
Expand All @@ -218,9 +221,14 @@ static boolean CheckNerveLoaded (void)
static void CheckLoadNerve (void)
{
const char *nerve_basename;
char *autoload_dir;
char *dirname, *autoload_dir;
int i, j;

const char *const nerve_wads[] = {
"NERVE.WAD",
"Nerve_demo.wad"
};

static const struct {
const char *name;
const char new_name[8];
Expand All @@ -236,23 +244,26 @@ static void CheckLoadNerve (void)
return;
}

if (strrchr(iwadfile, DIR_SEPARATOR) != NULL)
{
char *dir;
dir = M_DirName(iwadfile);
crispy->havenerve = M_StringJoin(dir, DIR_SEPARATOR_S, "NERVE.WAD", NULL);
free(dir);
}
else
// [crispy] load NERVE.WAD
dirname = M_DirName(iwadfile);
for (i = 0; i < arrlen(nerve_wads); i++)
{
crispy->havenerve = M_StringDuplicate("NERVE.WAD");
}
crispy->havenerve = M_StringJoin(dirname, DIR_SEPARATOR_S, nerve_wads[i], NULL);

if (M_FileExists(crispy->havenerve))
{
break;
}

if (!M_FileExists(crispy->havenerve))
{
free(crispy->havenerve);
crispy->havenerve = D_FindWADByName("NERVE.WAD");
crispy->havenerve = D_FindWADByName(nerve_wads[i]);

if (crispy->havenerve)
{
break;
}
}
free(dirname);

if (crispy->havenerve == NULL)
{
Expand Down