From 27f8ea9f5a210f055f443ef34017dd2412feb326 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Wed, 3 Dec 2008 18:54:36 +0000 Subject: Centralise the list of IWAD files and use bitmasks to select which mission types are valid. Subversion-branch: /branches/raven-branch Subversion-revision: 1405 --- src/d_iwad.c | 66 +++++++++++++++++++++++++--------------------------- src/d_iwad.h | 10 ++++++-- src/doom/d_main.c | 21 +---------------- src/heretic/d_main.c | 8 +------ src/hexen/h2_main.c | 7 +----- 5 files changed, 43 insertions(+), 69 deletions(-) diff --git a/src/d_iwad.c b/src/d_iwad.c index a67a6d4f..e6ee2cf8 100644 --- a/src/d_iwad.c +++ b/src/d_iwad.c @@ -39,6 +39,19 @@ #include "w_wad.h" #include "z_zone.h" +static iwad_t iwads[] = +{ + { "doom2.wad", doom2 }, + { "plutonia.wad", pack_plut }, + { "tnt.wad", pack_tnt }, + { "doom.wad", doom }, + { "doom1.wad", doom }, + { "chex.wad", doom }, + { "heretic.wad", heretic }, + { "heretic1.wad", heretic }, + { "hexen.wad", hexen }, +}; + // Array of locations to search for IWAD files // // "128 IWAD search directories should be enough for anybody". @@ -320,16 +333,20 @@ static void CheckDOSDefaults(void) // Search a directory to try to find an IWAD // Returns the location of the IWAD if found, otherwise NULL. -static char *SearchDirectoryForIWAD(char *dir, iwad_t *iwads, - GameMission_t *mission) +static char *SearchDirectoryForIWAD(char *dir, int mask, GameMission_t *mission) { size_t i; - for (i=0; iwads[i].name != NULL; ++i) + for (i=0; i 0) - { - D_FindInstalledIWADs(iwads); - } - // print banner I_PrintBanner(PACKAGE_STRING); @@ -1123,7 +1104,7 @@ void D_DoomMain (void) DEH_Init(); #endif - iwadfile = D_FindIWAD(iwads, &gamemission); + iwadfile = D_FindIWAD(IWAD_MASK_DOOM, &gamemission); // None found? diff --git a/src/heretic/d_main.c b/src/heretic/d_main.c index b8edd430..bba09e65 100644 --- a/src/heretic/d_main.c +++ b/src/heretic/d_main.c @@ -455,12 +455,6 @@ void D_CheckRecordFrom(void) #define SHAREWAREWADNAME "heretic1.wad" -static iwad_t iwads[] = { - { "heretic.wad", heretic }, - { "heretic1.wad", heretic }, - { NULL, none }, -}; - char *iwadfile; char *basedefault = "heretic.cfg"; @@ -880,7 +874,7 @@ void D_DoomMain(void) printf("W_Init: Init WADfiles.\n"); - iwadfile = D_FindIWAD(iwads, &gamemission); + iwadfile = D_FindIWAD(IWAD_MASK_HERETIC, &gamemission); if (iwadfile == NULL) { diff --git a/src/hexen/h2_main.c b/src/hexen/h2_main.c index f7bc665e..72e323c5 100644 --- a/src/hexen/h2_main.c +++ b/src/hexen/h2_main.c @@ -136,11 +136,6 @@ static int demosequence; static int pagetic; static char *pagename; -static iwad_t iwads[] = { - { "hexen.wad", hexen }, - { NULL, none }, -}; - static execOpt_t ExecOptions[] = { {"-file", ExecOptionFILE, 1, 0}, {"-scripts", ExecOptionSCRIPTS, 1, 0}, @@ -272,7 +267,7 @@ void D_DoomMain(void) ST_Message("W_Init: Init WADfiles.\n"); - iwadfile = D_FindIWAD(iwads, &gamemission); + iwadfile = D_FindIWAD(IWAD_MASK_HEXEN, &gamemission); if (iwadfile == NULL) { -- cgit v1.2.3