diff options
-rw-r--r-- | src/d_iwad.c | 31 | ||||
-rw-r--r-- | src/d_iwad.h | 2 | ||||
-rw-r--r-- | src/d_main.c | 48 |
3 files changed, 66 insertions, 15 deletions
diff --git a/src/d_iwad.c b/src/d_iwad.c index f352f1c2..1b3c29f1 100644 --- a/src/d_iwad.c +++ b/src/d_iwad.c @@ -416,10 +416,10 @@ static void BuildIWADDirList(void) } // -// Searches IWAD search paths for an IWAD with a specific name. +// Searches WAD search paths for an WAD with a specific filename. // -char *D_FindIWADByName(char *name) +char *D_FindWADByName(char *name) { char *buf; int i; @@ -457,6 +457,29 @@ char *D_FindIWADByName(char *name) } // +// D_TryWADByName +// +// Searches for a WAD by its filename, or passes through the filename +// if not found. +// + +char *D_TryFindWADByName(char *filename) +{ + char *result; + + result = D_FindWADByName(filename); + + if (result != NULL) + { + return result; + } + else + { + return filename; + } +} + +// // FindIWAD // Checks availability of IWAD files by name, // to determine whether registered/commercial features @@ -490,7 +513,7 @@ char *D_FindIWAD(void) iwadfile = myargv[iwadparm + 1]; - result = D_FindIWADByName(iwadfile); + result = D_FindWADByName(iwadfile); if (result == NULL) { @@ -762,7 +785,7 @@ void D_FindInstalledIWADs(void) for (i=0; i<sizeof(iwads) / sizeof(*iwads); ++i) { - if (D_FindIWADByName(iwads[i].name) != NULL) + if (D_FindWADByName(iwads[i].name) != NULL) { result |= 1 << i; } diff --git a/src/d_iwad.h b/src/d_iwad.h index a0f1a0ba..281d3467 100644 --- a/src/d_iwad.h +++ b/src/d_iwad.h @@ -27,6 +27,8 @@ #ifndef __D_IWAD__ #define __D_IWAD__ +char *D_FindWADByName(char *filename); +char *D_TryFindWADByName(char *filename); char *D_FindIWAD(void); void D_SetSaveGameDir(void); void D_IdentifyVersion(void); diff --git a/src/d_main.c b/src/d_main.c index cdf5dc35..1d758cca 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -954,8 +954,12 @@ void D_DoomMain (void) { for (p = p + 1; p<myargc && myargv[p][0] != '-'; ++p) { - printf(" merging %s\n", myargv[p]); - W_MergeFile(myargv[p]); + char *filename; + + filename = D_TryFindWADByName(myargv[p]); + + printf(" merging %s\n", filename); + W_MergeFile(filename); } } @@ -976,8 +980,12 @@ void D_DoomMain (void) { for (p = p + 1; p<myargc && myargv[p][0] != '-'; ++p) { - printf(" performing NWT-style merge of %s\n", myargv[p]); - W_NWTDashMerge(myargv[p]); + char *filename; + + filename = D_TryFindWADByName(myargv[p]); + + printf(" performing NWT-style merge of %s\n", filename); + W_NWTDashMerge(filename); } } @@ -997,8 +1005,12 @@ void D_DoomMain (void) { for (p = p + 1; p<myargc && myargv[p][0] != '-'; ++p) { - printf(" merging flats from %s\n", myargv[p]); - W_NWTMergeFile(myargv[p], W_NWT_MERGE_FLATS); + char *filename; + + filename = D_TryFindWADByName(myargv[p]); + + printf(" merging flats from %s\n", filename); + W_NWTMergeFile(filename, W_NWT_MERGE_FLATS); } } @@ -1016,8 +1028,12 @@ void D_DoomMain (void) { for (p = p + 1; p<myargc && myargv[p][0] != '-'; ++p) { - printf(" merging sprites from %s\n", myargv[p]); - W_NWTMergeFile(myargv[p], W_NWT_MERGE_SPRITES); + char *filename; + + filename = D_TryFindWADByName(myargv[p]); + + printf(" merging sprites from %s\n", filename); + W_NWTMergeFile(filename, W_NWT_MERGE_SPRITES); } } @@ -1034,8 +1050,12 @@ void D_DoomMain (void) { for (p = p + 1; p<myargc && myargv[p][0] != '-'; ++p) { - printf(" merging sprites and flats from %s\n", myargv[p]); - W_NWTMergeFile(myargv[p], W_NWT_MERGE_SPRITES | W_NWT_MERGE_FLATS); + char *filename; + + filename = D_TryFindWADByName(myargv[p]); + + printf(" merging sprites and flats from %s\n", filename); + W_NWTMergeFile(filename, W_NWT_MERGE_SPRITES | W_NWT_MERGE_FLATS); } } @@ -1054,7 +1074,13 @@ void D_DoomMain (void) // until end of parms or another - preceded parm modifiedgame = true; // homebrew levels while (++p != myargc && myargv[p][0] != '-') - D_AddFile (myargv[p]); + { + char *filename; + + filename = D_TryFindWADByName(myargv[p]); + + D_AddFile(filename); + } } // Debug: |