From 1670801dba930b9fa9d6a2b4a953091970dc180a Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Wed, 8 Oct 2008 19:34:09 +0000 Subject: Replace hexen "shareware" variable with gamemode/gamemission. Use d_iwad.c code to find the IWAD file. Remove AddWADFile and use the w_wad.c API directly. Subversion-branch: /branches/raven-branch Subversion-revision: 1343 --- src/hexen/h2_main.c | 56 ++++++++++++++++++++++++----------------------------- 1 file changed, 25 insertions(+), 31 deletions(-) (limited to 'src/hexen/h2_main.c') diff --git a/src/hexen/h2_main.c b/src/hexen/h2_main.c index 4bdcc7d5..c6caf2e7 100644 --- a/src/hexen/h2_main.c +++ b/src/hexen/h2_main.c @@ -37,6 +37,8 @@ #include "h2def.h" #include "ct_chat.h" +#include "d_iwad.h" +#include "d_mode.h" #include "s_sound.h" #include "i_system.h" #include "m_argv.h" @@ -85,7 +87,6 @@ static void DrawMessage(void); static void PageDrawer(void); static void HandleArgs(void); static void CheckRecordFrom(void); -static void AddWADFile(char *file); static void DrawAndBlit(void); static void ExecOptionFILE(char **args, int tag); static void ExecOptionSCRIPTS(char **args, int tag); @@ -107,7 +108,9 @@ extern char *SavePath; // PUBLIC DATA DEFINITIONS ------------------------------------------------- -boolean shareware; // true if only episode 1 present +GameMode_t gamemode; +GameMission_t gamemission; +char *iwadfile; boolean nomonsters; // checkparm of -nomonsters boolean respawnparm; // checkparm of -respawn boolean randomclass; // checkparm of -randclass @@ -132,9 +135,12 @@ static int WarpMap; static int demosequence; static int pagetic; static char *pagename; -static char *wadfiles[MAXWADFILES] = { - "hexen.wad" + +static iwad_t iwads[] = { + { "hexen.wad", hexen }, + { NULL, none }, }; + static execOpt_t ExecOptions[] = { {"-file", ExecOptionFILE, 1, 0}, {"-scripts", ExecOptionSCRIPTS, 1, 0}, @@ -191,7 +197,7 @@ void D_DoomMain(void) autostart = false; startskill = sk_medium; startmap = 1; - shareware = false; // Always false for Hexen + gamemode = commercial; // Initialize subsystems @@ -212,8 +218,6 @@ void D_DoomMain(void) DoTimeBomb(); #endif -// ST_Message("W_Init: Init WADfiles.\n"); - ST_Message("Z_Init: Init zone memory allocation daemon.\n"); Z_Init(); @@ -222,6 +226,18 @@ void D_DoomMain(void) I_StartupJoystick(); #endif + ST_Message("W_Init: Init WADfiles.\n"); + + iwadfile = D_FindIWAD(iwads, &gamemission); + + if (iwadfile == NULL) + { + I_Error("Game mode indeterminate. No IWAD was found. Try specifying\n" + "one with the '-iwad' command line parameter."); + } + + W_AddFile(iwadfile); + HandleArgs(); ST_Message("MN_Init: Init menu system.\n"); @@ -416,7 +432,7 @@ static void ExecOptionFILE(char **args, int tag) p = M_CheckParm("-file"); while (++p != myargc && myargv[p][0] != '-') { - AddWADFile(myargv[p]); + W_AddFile(myargv[p]); } } @@ -432,7 +448,7 @@ static void ExecOptionPLAYDEMO(char **args, int tag) char file[256]; sprintf(file, "%s.lmp", args[1]); - AddWADFile(file); + W_AddFile(file); ST_Message("Playing demo %s.lmp.\n", args[1]); } @@ -795,28 +811,6 @@ static void CheckRecordFrom(void) H2_GameLoop(); // Never returns } -//========================================================================== -// -// AddWADFile -// -//========================================================================== - -static void AddWADFile(char *file) -{ - int i; - char *new; - - ST_Message("Adding external file: %s\n", file); - i = 0; - while (wadfiles[i]) - { - i++; - } - new = malloc(strlen(file) + 1); - strcpy(new, file); - wadfiles[i] = new; -} - #ifdef __WATCOMC__ /* void CleanExit(void) -- cgit v1.2.3