Skip to content

Commit

Permalink
Add IWAD before merging PWADs in dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
bradharding committed Mar 8, 2014
1 parent 9f0d683 commit 641e84e
Showing 1 changed file with 27 additions and 22 deletions.
49 changes: 27 additions & 22 deletions src/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,45 +568,50 @@ boolean D_ChooseIWAD(void)
// more than one file was selected
else
{
LPSTR iwad = ofn.lpstrFile;
LPSTR pwad = ofn.lpstrFile;

wadfolder = strdup(szFile);

while (ofn.lpstrFile[0])
// find and add iwad first
while (iwad[0])
{
static char fullpath[MAX_PATH];

ofn.lpstrFile += lstrlen(ofn.lpstrFile) + 1;
sprintf(fullpath, "%s\\%s", wadfolder, ofn.lpstrFile);
iwad += lstrlen(iwad) + 1;
sprintf(fullpath, "%s\\%s", wadfolder, iwad);

// check if its an IWAD
if (!strcasecmp(ofn.lpstrFile, "DOOM.WAD")
|| !strcasecmp(ofn.lpstrFile, "DOOM1.WAD")
|| !strcasecmp(ofn.lpstrFile, "DOOM2.WAD")
|| !strcasecmp(ofn.lpstrFile, "PLUTONIA.WAD")
|| !strcasecmp(ofn.lpstrFile, "TNT.WAD")
if (!strcasecmp(iwad, "DOOM.WAD")
|| !strcasecmp(iwad, "DOOM1.WAD")
|| !strcasecmp(iwad, "DOOM2.WAD")
|| !strcasecmp(iwad, "PLUTONIA.WAD")
|| !strcasecmp(iwad, "TNT.WAD")
|| W_WadType(fullpath) == IWAD)
{
if (!iwadfound)
{
IdentifyIWADByName(ofn.lpstrFile);
IdentifyIWADByName(iwad);
if (D_AddFile(fullpath))
iwadfound = true;
}
}
}

// or a PWAD
else
{
if (strcasecmp(ofn.lpstrFile, "DOOMRETRO.WAD")
&& W_WadType(fullpath) == PWAD)
// merge any pwads
while (pwad[0])
{
static char fullpath[MAX_PATH];

pwad += lstrlen(pwad) + 1;
sprintf(fullpath, "%s\\%s", wadfolder, pwad);

if (strcasecmp(pwad, "DOOMRETRO.WAD") && W_WadType(fullpath) == PWAD)
if (W_MergeFile(fullpath))
{
if (W_MergeFile(fullpath))
{
modifiedgame = true;
if (!strcasecmp(ofn.lpstrFile, "NERVE.WAD"))
nerve = true;
}
modifiedgame = true;
if (!strcasecmp(pwad, "NERVE.WAD"))
nerve = true;
}
}
}
}

Expand Down

0 comments on commit 641e84e

Please sign in to comment.