const IWADInfo *D_FindIWAD(TArray<FString> &wadfiles, const char *iwad, const char *basewad) { EIWADType iwadType = IdentifyVersion(wadfiles, iwad, basewad); gameiwad = iwadType; const IWADInfo *iwad_info = &IWADInfos[iwadType]; I_SetIWADInfo(iwad_info); return iwad_info; }
// // D_AddDefWads // void D_AddDefWads (std::string iwad) { // [RH] Make sure zdoom.wad is always loaded, // as it contains magic stuff we need. // [SL] Err... odamex.wad! std::string wad = BaseFileSearch ("odamex.wad"); if (wad.length()) wadfiles.push_back(wad); else I_FatalError ("Cannot find odamex.wad"); I_SetTitleString (IdentifyVersion(iwad).c_str()); }
const FIWADInfo *FIWadManager::FindIWAD(TArray<FString> &wadfiles, const char *iwad, const char *basewad) { int iwadType = IdentifyVersion(wadfiles, iwad, basewad); //gameiwad = iwadType; const FIWADInfo *iwad_info = &mIWads[iwadType]; if (DoomStartupInfo.Name.IsEmpty()) DoomStartupInfo.Name = iwad_info->Name; if (DoomStartupInfo.BkColor == 0 && DoomStartupInfo.FgColor == 0) { DoomStartupInfo.BkColor = iwad_info->BkColor; DoomStartupInfo.FgColor = iwad_info->FgColor; } I_SetIWADInfo(); return iwad_info; }
static void D_DoomMainSetup(void) { setbuf(stdout, NULL); M_LoadDefaults(); IdentifyVersion(); G_ReloadDefaults(); I_CalculateRes(640, 480); V_Init(); D_InitNetGame(); W_Init(); M_Init(); R_Init(); P_Init(); I_Init(); S_Init(snd_SfxVolume, snd_MusicVolume); HU_Init(); I_InitGraphics(); ST_Init(); G_InitNew(sk_none, 1, 1); }
// // D_DoomMain // void D_DoomMain (void) { int p; char file[256]; FindResponseFile (); IdentifyVersion (); setbuf (stdout, NULL); modifiedgame = false; nomonsters = M_CheckParm ("-nomonsters"); respawnparm = M_CheckParm ("-respawn"); fastparm = M_CheckParm ("-fast"); devparm = M_CheckParm ("-devparm"); if (M_CheckParm ("-altdeath")) deathmatch = 2; else if (M_CheckParm ("-deathmatch")) deathmatch = 1; switch ( gamemode ) { case retail: sprintf (title, " " "The Ultimate DOOM Startup v%i.%i" " ", VERSION_NUM/100,VERSION_NUM%100); break; case shareware: sprintf (title, " " "DOOM Shareware Startup v%i.%i" " ", VERSION_NUM/100,VERSION_NUM%100); break; case registered: sprintf (title, " " "DOOM Registered Startup v%i.%i" " ", VERSION_NUM/100,VERSION_NUM%100); break; case commercial: sprintf (title, " " "DOOM 2: Hell on Earth v%i.%i" " ", VERSION_NUM/100,VERSION_NUM%100); break; /*FIXME case pack_plut: sprintf (title, " " "DOOM 2: Plutonia Experiment v%i.%i" " ", VERSION_NUM/100,VERSION_NUM%100); break; case pack_tnt: sprintf (title, " " "DOOM 2: TNT - Evilution v%i.%i" " ", VERSION_NUM/100,VERSION_NUM%100); break; */ default: sprintf (title, " " "Public DOOM - v%i.%i" " ", VERSION_NUM/100,VERSION_NUM%100); break; } printf ("%s\n",title); if (devparm) printf(D_DEVSTR); // turbo option if ( (p=M_CheckParm ("-turbo")) ) { int scale = 200; extern int forwardmove[2]; extern int sidemove[2]; if (p<myargc-1) scale = atoi (myargv[p+1]); if (scale < 10) scale = 10; if (scale > 400) scale = 400; printf ("turbo scale: %i%%\n",scale); forwardmove[0] = forwardmove[0]*scale/100; forwardmove[1] = forwardmove[1]*scale/100; sidemove[0] = sidemove[0]*scale/100; sidemove[1] = sidemove[1]*scale/100; } // add any files specified on the command line with -file wadfile // to the wad list // // convenience hack to allow -wart e m to add a wad file // prepend a tilde to the filename so wadfile will be reloadable p = M_CheckParm ("-wart"); if (p) { myargv[p][4] = 'p'; // big hack, change to -warp // Map name handling. switch (gamemode ) { case shareware: case retail: case registered: sprintf (file,"~"DEVMAPS"E%cM%c.wad", myargv[p+1][0], myargv[p+2][0]); printf("Warping to Episode %s, Map %s.\n", myargv[p+1],myargv[p+2]); break; case commercial: default: p = atoi (myargv[p+1]); if (p<10) sprintf (file,"~"DEVMAPS"cdata/map0%i.wad", p); else sprintf (file,"~"DEVMAPS"cdata/map%i.wad", p); break; } D_AddFile (file); } p = M_CheckParm ("-file"); if (p) { // the parms after p are wadfile/lump names, // until end of parms or another - preceded parm modifiedgame = true; // homebrew levels while (++p != myargc && myargv[p][0] != '-') D_AddFile (myargv[p]); } p = M_CheckParm ("-playdemo"); if (!p) p = M_CheckParm ("-timedemo"); if (p && p < myargc-1) { sprintf (file,"%s.lmp", myargv[p+1]); D_AddFile (file); printf("Playing demo %s.lmp.\n",myargv[p+1]); } // get skill / episode / map from parms startskill = sk_medium; startepisode = 1; startmap = 1; autostart = false; p = M_CheckParm ("-skill"); if (p && p < myargc-1) { startskill = myargv[p+1][0]-'1'; autostart = true; } p = M_CheckParm ("-episode"); if (p && p < myargc-1) { startepisode = myargv[p+1][0]-'0'; startmap = 1; autostart = true; } p = M_CheckParm ("-timer"); if (p && p < myargc-1 && deathmatch) { int time; time = atoi(myargv[p+1]); printf("Levels will end after %d minute",time); if (time>1) printf("s"); printf(".\n"); } p = M_CheckParm ("-avg"); if (p && p < myargc-1 && deathmatch) printf("Austin Virtual Gaming: Levels will end after 20 minutes\n"); p = M_CheckParm ("-warp"); if (p && p < myargc-1) { if (gamemode == commercial) startmap = atoi (myargv[p+1]); else { startepisode = myargv[p+1][0]-'0'; startmap = myargv[p+2][0]-'0'; } autostart = true; } // init subsystems printf ("V_Init: allocate screens.\n"); V_Init (); printf ("M_LoadDefaults: Load system defaults.\n"); M_LoadDefaults (); // load before initing other systems printf ("Z_Init: Init zone memory allocation daemon. \n"); Z_Init (); printf ("W_Init: Init WADfiles.\n"); W_InitMultipleFiles (wadfiles); printf("added\n"); // Check for -file in shareware if (modifiedgame) { // These are the lumps that will be checked in IWAD, // if any one is not present, execution will be aborted. char name[23][8]= { "e2m1","e2m2","e2m3","e2m4","e2m5","e2m6","e2m7","e2m8","e2m9", "e3m1","e3m3","e3m3","e3m4","e3m5","e3m6","e3m7","e3m8","e3m9", "dphoof","bfgga0","heada1","cybra1","spida1d1" }; int i; if ( gamemode == shareware) I_Error("\nYou cannot -file with the shareware " "version. Register!"); // Check for fake IWAD with right name, // but w/o all the lumps of the registered version. if (gamemode == registered) for (i = 0;i < 23; i++) if (W_CheckNumForName(name[i])<0) I_Error("\nThis is not the registered version."); } // Iff additonal PWAD files are used, print modified banner if (modifiedgame) { /*m*/printf ( "===========================================================================\n" "ATTENTION: This version of DOOM has been modified. If you would like to\n" "get a copy of the original game, call 1-800-IDGAMES or see the readme file.\n" " You will not receive technical support for modified games.\n" " press enter to continue\n" "===========================================================================\n" ); } // Check and print which version is executed. switch ( gamemode ) { case shareware: case indetermined: printf ( "===========================================================================\n" " Shareware!\n" "===========================================================================\n" ); break; case registered: case retail: case commercial: printf ( "===========================================================================\n" " Commercial product - do not distribute!\n" " Please report software piracy to the SPA: 1-800-388-PIR8\n" "===========================================================================\n" ); break; default: // Ouch. break; } printf ("M_Init: Init miscellaneous info.\n"); M_Init (); printf ("R_Init: Init DOOM refresh daemon - "); R_Init (); printf ("\nP_Init: Init Playloop state.\n"); P_Init (); printf ("I_Init: Setting up machine state.\n"); I_Init (); printf ("D_CheckNetGame: Checking network game status.\n"); D_CheckNetGame (); printf ("S_Init: Setting up sound.\n"); S_Init (snd_SfxVolume /* *8 */, snd_MusicVolume /* *8*/ ); printf ("HU_Init: Setting up heads up display.\n"); HU_Init (); printf ("ST_Init: Init status bar.\n"); ST_Init (); // check for a driver that wants intermission stats p = M_CheckParm ("-statcopy"); if (p && p<myargc-1) { // for statistics driver extern void* statcopy; statcopy = (void*)atoi(myargv[p+1]); printf ("External statistics registered.\n"); } // start the apropriate game based on parms p = M_CheckParm ("-record"); if (p && p < myargc-1) { G_RecordDemo (myargv[p+1]); autostart = true; } p = M_CheckParm ("-playdemo"); if (p && p < myargc-1) { singledemo = true; // quit after one demo G_DeferedPlayDemo (myargv[p+1]); D_DoomLoop (); // never returns } p = M_CheckParm ("-timedemo"); if (p && p < myargc-1) { G_TimeDemo (myargv[p+1]); D_DoomLoop (); // never returns } p = M_CheckParm ("-loadgame"); if (p && p < myargc-1) { if (M_CheckParm("-cdrom")) sprintf(file, "c:\\doomdata\\"SAVEGAMENAME"%c.dsg",myargv[p+1][0]); else sprintf(file, SAVEGAMENAME"%c.dsg",myargv[p+1][0]); G_LoadGame (file); } if ( gameaction != ga_loadgame ) { if (autostart || netgame) G_InitNew (startskill, startepisode, startmap); else D_StartTitle (); // start up intro loop } D_DoomLoop (); // never returns }
// // D_SRB2Main // void D_SRB2Main(void) { INT32 p; char srb2[82]; // srb2 title banner char title[82]; INT32 pstartmap = 1; boolean autostart = false; // keep error messages until the final flush(stderr) #if !defined (PC_DOS) && !defined (_WIN32_WCE) && !defined(NOTERMIOS) if (setvbuf(stderr, NULL, _IOFBF, 1000)) I_OutputMsg("setvbuf didnt work\n"); #endif #ifdef GETTEXT // initialise locale code M_StartupLocale(); #endif // get parameters from a response file (eg: srb2 @parms.txt) M_FindResponseFile(); // MAINCFG is now taken care of where "OBJCTCFG" is handled G_LoadGameSettings(); // Test Dehacked lists DEH_Check(); // identify the main IWAD file to use IdentifyVersion(); #if !defined (_WIN32_WCE) && !defined(NOTERMIOS) setbuf(stdout, NULL); // non-buffered output #endif #if defined (_WIN32_WCE) //|| defined (_DEBUG) || defined (GP2X) devparm = !M_CheckParm("-nodebug"); #else devparm = M_CheckParm("-debug"); #endif // for dedicated server #if !defined (_WINDOWS) //already check in win_main.c dedicated = M_CheckParm("-dedicated") != 0; #endif strcpy(title, "Sonic Robo Blast 2"); strcpy(srb2, "Sonic Robo Blast 2"); D_MakeTitleString(srb2); #ifdef PC_DOS D_Titlebar(srb2, title); #endif #if defined (__OS2__) && !defined (SDL) // set PM window title snprintf(pmData->title, sizeof (pmData->title), "Sonic Robo Blast 2" VERSIONSTRING ": %s", title); pmData->title[sizeof (pmData->title) - 1] = '\0'; #endif if (devparm) CONS_Printf(M_GetText("Development mode ON.\n")); // default savegame strcpy(savegamename, SAVEGAMENAME"%u.ssg"); { const char *userhome = D_Home(); //Alam: path to home if (!userhome) { #if ((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__CYGWIN__) && !defined (DC) && !defined (PSP) && !defined(GP2X) I_Error("Please set $HOME to your home directory\n"); #elif defined (_WIN32_WCE) && 0 if (dedicated) snprintf(configfile, sizeof configfile, "/Storage Card/SRB2DEMO/d"CONFIGFILENAME); else snprintf(configfile, sizeof configfile, "/Storage Card/SRB2DEMO/"CONFIGFILENAME); #else if (dedicated) snprintf(configfile, sizeof configfile, "d"CONFIGFILENAME); else snprintf(configfile, sizeof configfile, CONFIGFILENAME); #endif } else { // use user specific config file #ifdef DEFAULTDIR snprintf(srb2home, sizeof srb2home, "%s" PATHSEP DEFAULTDIR, userhome); snprintf(downloaddir, sizeof downloaddir, "%s" PATHSEP "DOWNLOAD", srb2home); if (dedicated) snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, srb2home); else snprintf(configfile, sizeof configfile, "%s" PATHSEP CONFIGFILENAME, srb2home); // can't use sprintf since there is %u in savegamename strcatbf(savegamename, srb2home, PATHSEP); I_mkdir(srb2home, 0700); #else snprintf(srb2home, sizeof srb2home, "%s", userhome); snprintf(downloaddir, sizeof downloaddir, "%s", userhome); if (dedicated) snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, userhome); else snprintf(configfile, sizeof configfile, "%s" PATHSEP CONFIGFILENAME, userhome); // can't use sprintf since there is %u in savegamename strcatbf(savegamename, userhome, PATHSEP); #endif } configfile[sizeof configfile - 1] = '\0'; #ifdef _arch_dreamcast strcpy(downloaddir, "/ram"); // the dreamcast's TMP #endif } // rand() needs seeded regardless of password srand((unsigned int)time(NULL)); if (M_CheckParm("-password") && M_IsNextParm()) D_SetPassword(M_GetNextParm()); else { size_t z; char junkpw[25]; for (z = 0; z < 24; z++) junkpw[z] = (char)(rand() & 64)+32; junkpw[24] = '\0'; D_SetPassword(junkpw); } // add any files specified on the command line with -file wadfile // to the wad list if (!(M_CheckParm("-connect"))) { if (M_CheckParm("-file")) { // the parms after p are wadfile/lump names, // until end of parms or another - preceded parm while (M_IsNextParm()) { const char *s = M_GetNextParm(); if (s) // Check for NULL? { if (!W_VerifyNMUSlumps(s)) G_SetGameModified(true); D_AddFile(s); } } } } // get map from parms if (M_CheckParm("-server") || dedicated) netgame = server = true; if (M_CheckParm("-warp") && M_IsNextParm()) { const char *word = M_GetNextParm(); if (fastncmp(word, "MAP", 3)) pstartmap = M_MapNumber(word[3], word[4]); else pstartmap = atoi(word); // Don't check if lump exists just yet because the wads haven't been loaded! // Just do a basic range check here. if (pstartmap < 1 || pstartmap > NUMMAPS) I_Error("Cannot warp to map %d (out of range)\n", pstartmap); else { if (!M_CheckParm("-server")) G_SetGameModified(true); autostart = true; } } CONS_Printf("Z_Init(): Init zone memory allocation daemon. \n"); Z_Init(); // adapt tables to SRB2's needs, including extra slots for dehacked file support P_PatchInfoTables(); //---------------------------------------------------- READY TIME // we need to check for dedicated before initialization of some subsystems CONS_Printf("I_StartupTimer()...\n"); I_StartupTimer(); // Make backups of some SOCcable tables. P_BackupTables(); // Setup default unlockable conditions M_SetupDefaultConditionSets(); // load wad, including the main wad file CONS_Printf("W_InitMultipleFiles(): Adding IWAD and main PWADs.\n"); if (!W_InitMultipleFiles(startupwadfiles)) #ifdef _DEBUG CONS_Error("A WAD file was not found or not valid.\nCheck the log to see which ones.\n"); #else I_Error("A WAD file was not found or not valid.\nCheck the log to see which ones.\n"); #endif D_CleanFile(); #if 1 // md5s last updated 3/15/14 // Yes, you read that right, that's the day of release. // Aren't we batshit insane? // Check MD5s of autoloaded files W_VerifyFileMD5(0, "ac309fb3c7d4b5b685e2cd26beccf0e8"); // srb2.srb/srb2.wad W_VerifyFileMD5(1, "a894044b555dfcc71865cee16a996e88"); // zones.dta W_VerifyFileMD5(2, "4c410c1de6e0440cc5b2858dcca80c3e"); // player.dta W_VerifyFileMD5(3, "85901ad4bf94637e5753d2ac2c03ea26"); // rings.dta W_VerifyFileMD5(4, "c529930ee5aed6dbe33625dc8075520b"); // patch.dta // don't check music.dta because people like to modify it, and it doesn't matter if they do // ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for. #endif mainwads = 5; // there are 5 wads not to unload cht_Init(); //---------------------------------------------------- READY SCREEN // we need to check for dedicated before initialization of some subsystems CONS_Printf("I_StartupGraphics()...\n"); I_StartupGraphics(); //--------------------------------------------------------- CONSOLE // setup loading screen SCR_Startup(); // we need the font of the console CONS_Printf("HU_Init(): Setting up heads up display.\n"); HU_Init(); COM_Init(); // libogc has a CON_Init function, we must rename SRB2's CON_Init in WII/libogc #ifndef _WII CON_Init(); #else CON_InitWii(); #endif D_RegisterServerCommands(); D_RegisterClientCommands(); // be sure that this is called before D_CheckNetGame R_RegisterEngineStuff(); S_RegisterSoundStuff(); I_RegisterSysCommands(); //--------------------------------------------------------- CONFIG.CFG M_FirstLoadConfig(); // WARNING : this do a "COM_BufExecute()" G_LoadGameData(); #if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL) VID_PrepareModeList(); // Regenerate Modelist according to cv_fullscreen #endif // set user default mode or mode set at cmdline SCR_CheckDefaultMode(); wipegamestate = gamestate; P_InitMapHeaders(); savedata.lives = 0; // flag this as not-used //------------------------------------------------ COMMAND LINE PARAMS // Initialize CD-Audio if (M_CheckParm("-usecd") && !dedicated) I_InitCD(); if (M_CheckParm("-noupload")) COM_BufAddText("downloading 0\n"); CONS_Printf("M_Init(): Init miscellaneous info.\n"); M_Init(); CONS_Printf("R_Init(): Init SRB2 refresh daemon.\n"); R_Init(); // setting up sound CONS_Printf("S_Init(): Setting up sound.\n"); if (M_CheckParm("-nosound")) nosound = true; if (M_CheckParm("-nomusic")) // combines -nomidimusic and -nodigmusic nomidimusic = nodigimusic = true; else { if (M_CheckParm("-nomidimusic")) nomidimusic = true; ; // WARNING: DOS version initmusic in I_StartupSound if (M_CheckParm("-nodigmusic")) nodigimusic = true; // WARNING: DOS version initmusic in I_StartupSound } I_StartupSound(); I_InitMusic(); S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value); CONS_Printf("ST_Init(): Init status bar.\n"); ST_Init(); if (M_CheckParm("-room")) { if (!M_IsNextParm()) I_Error("usage: -room <room_id>\nCheck the Master Server's webpage for room ID numbers.\n"); #ifdef UPDATE_ALERT GetMODVersion_Console(); #endif ms_RoomId = atoi(M_GetNextParm()); } // init all NETWORK CONS_Printf("D_CheckNetGame(): Checking network game status.\n"); if (D_CheckNetGame()) autostart = true; // check for a driver that wants intermission stats // start the apropriate game based on parms if (M_CheckParm("-metal")) { G_RecordMetal(); autostart = true; } else if (M_CheckParm("-record") && M_IsNextParm()) { G_RecordDemo(M_GetNextParm()); autostart = true; } // user settings come before "+" parameters. if (dedicated) COM_ImmedExecute(va("exec \"%s"PATHSEP"adedserv.cfg\"\n", srb2home)); else COM_ImmedExecute(va("exec \"%s"PATHSEP"autoexec.cfg\" -noerror\n", srb2home)); if (!autostart) M_PushSpecialParameters(); // push all "+" parameters at the command buffer // demo doesn't need anymore to be added with D_AddFile() p = M_CheckParm("-playdemo"); if (!p) p = M_CheckParm("-timedemo"); if (p && M_IsNextParm()) { char tmp[MAX_WADPATH]; // add .lmp to identify the EXTERNAL demo file // it is NOT possible to play an internal demo using -playdemo, // rather push a playdemo command.. to do. strcpy(tmp, M_GetNextParm()); // get spaced filename or directory while (M_IsNextParm()) { strcat(tmp, " "); strcat(tmp, M_GetNextParm()); } FIL_DefaultExtension(tmp, ".lmp"); CONS_Printf(M_GetText("Playing demo %s.\n"), tmp); if (M_CheckParm("-playdemo")) { singledemo = true; // quit after one demo G_DeferedPlayDemo(tmp); } else G_TimeDemo(tmp); G_SetGamestate(GS_NULL); wipegamestate = GS_NULL; return; } if (M_CheckParm("-ultimatemode")) { autostart = true; ultimatemode = true; } if (autostart || netgame || M_CheckParm("+connect") || M_CheckParm("-connect")) { gameaction = ga_nothing; CV_ClearChangedFlags(); // Do this here so if you run SRB2 with eg +timelimit 5, the time limit counts // as having been modified for the first game. M_PushSpecialParameters(); // push all "+" parameter at the command buffer if (M_CheckParm("-gametype") && M_IsNextParm()) { // from Command_Map_f INT32 j; INT16 newgametype = -1; const char *sgametype = M_GetNextParm(); for (j = 0; gametype_cons_t[j].strvalue; j++) if (!strcasecmp(gametype_cons_t[j].strvalue, sgametype)) { newgametype = (INT16)gametype_cons_t[j].value; break; } if (!gametype_cons_t[j].strvalue) // reached end of the list with no match { j = atoi(sgametype); // assume they gave us a gametype number, which is okay too if (j >= 0 && j < NUMGAMETYPES) newgametype = (INT16)j; } if (newgametype != -1) { j = gametype; gametype = newgametype; D_GameTypeChanged(j); } } if (server && !M_CheckParm("+map") && !M_CheckParm("+connect") && !M_CheckParm("-connect")) { // Prevent warping to nonexistent levels if (W_CheckNumForName(G_BuildMapName(pstartmap)) == LUMPERROR) I_Error("Could not warp to %s (map not found)\n", G_BuildMapName(pstartmap)); // Prevent warping to locked levels // ... unless you're in a dedicated server. Yes, technically this means you can view any level by // running a dedicated server and joining it yourself, but that's better than making dedicated server's // lives hell. else if (!dedicated && M_MapLocked(pstartmap)) I_Error("You need to unlock this level before you can warp to it!\n"); else D_MapChange(pstartmap, gametype, ultimatemode, true, 0, false, false); } } else if (M_CheckParm("-skipintro")) { CON_ToggleOff(); CON_ClearHUD(); F_StartTitleScreen(); } else F_StartIntro(); // Tails 03-03-2002 if (dedicated && server) { pagename = "TITLESKY"; levelstarttic = gametic; G_SetGamestate(GS_LEVEL); if (!P_SetupLevel(false)) I_Quit(); // fail so reset game stuff } }
// // D_AddDefWads // void D_AddDefWads (std::string iwad) { { // [RH] Make sure zdoom.wad is always loaded, // as it contains magic stuff we need. std::string wad = BaseFileSearch ("odamex.wad"); if (wad.length()) wadfiles.push_back(wad); else I_FatalError ("Cannot find odamex.wad"); } I_SetTitleString (IdentifyVersion(iwad).c_str()); // [RH] Add any .wad files in the skins directory /*#ifndef UNIX // denis - fixme - 1) _findnext not implemented on linux or osx, use opendir 2) server does not need skins, does it? { char curdir[256]; if (getcwd (curdir, 256)) { char skindir[256]; findstate_t findstate; // denis - fixme - win32 dependency == BAD!!! this is solved in later csdooms with BaseFileSearch - that could be implemented better with posix opendir stuff long handle; int stuffstart; std::string pd = progdir; if(pd[pd.length() - 1] != '/') pd += '/'; stuffstart = sprintf (skindir, "%sskins", pd.c_str()); if (!chdir (skindir)) { skindir[stuffstart++] = '/'; if ((handle = I_FindFirst ("*.wad", &findstate)) != -1) { do { if (!(I_FindAttr (&findstate) & FA_DIREC)) { strcpy (skindir + stuffstart, I_FindName (&findstate)); wadfiles.push_back(skindir); } } while (I_FindNext (handle, &findstate) == 0); I_FindClose (handle); } } const char *home = getenv ("HOME"); if (home) { stuffstart = sprintf (skindir, "%s%s.odamex/skins", home, home[strlen(home)-1] == '/' ? "" : "/"); if (!chdir (skindir)) { skindir[stuffstart++] = '/'; if ((handle = I_FindFirst ("*.wad", &findstate)) != -1) { do { if (!(I_FindAttr (&findstate) & FA_DIREC)) { strcpy (skindir + stuffstart, I_FindName (&findstate)); wadfiles.push_back(skindir); } } while (I_FindNext (handle, &findstate) == 0); I_FindClose (handle); } } } chdir (curdir); } } #endif*/ modifiedgame = false; }
static void D_DoomMainSetup(void) { int p,slot; L_SetupConsoleMasks(); setbuf(stdout,NULL); // proff 04/05/2000: Added support for include response files /* proff 2001/7/1 - Moved up, so -config can be in response files */ { boolean rsp_found; int i; do { rsp_found=false; for (i=0; i<myargc; i++) if (myargv[i][0]=='@') rsp_found=true; FindResponseFile(); } while (rsp_found==true); } lprintf(LO_INFO,"M_LoadDefaults: Load system defaults.\n"); M_LoadDefaults(); // load before initing other systems // figgi 09/18/00-- added switch to force classic bsp nodes if (M_CheckParm ("-forceoldbsp")) { extern boolean forceOldBsp; forceOldBsp = true; } DoLooseFiles(); // Ty 08/29/98 - handle "loose" files on command line IdentifyVersion(); // e6y: DEH files preloaded in wrong order // http://sourceforge.net/tracker/index.php?func=detail&aid=1418158&group_id=148658&atid=772943 // The dachaked stuff has been moved below an autoload // jff 1/24/98 set both working and command line value of play parms nomonsters = clnomonsters = M_CheckParm ("-nomonsters"); respawnparm = clrespawnparm = M_CheckParm ("-respawn"); fastparm = clfastparm = M_CheckParm ("-fast"); // jff 1/24/98 end of set to both working and command line value devparm = M_CheckParm ("-devparm"); if (M_CheckParm ("-altdeath")) deathmatch = 2; else if (M_CheckParm ("-deathmatch")) deathmatch = 1; { // CPhipps - localise title variable // print title for every printed line // cph - code cleaned and made smaller const char* doomverstr; switch ( gamemode ) { case retail: doomverstr = "The Ultimate DOOM"; break; case shareware: doomverstr = "DOOM Shareware"; break; case registered: doomverstr = "DOOM Registered"; break; case commercial: // Ty 08/27/98 - fixed gamemode vs gamemission switch (gamemission) { case pack_plut: doomverstr = "DOOM 2: Plutonia Experiment"; break; case pack_tnt: doomverstr = "DOOM 2: TNT - Evilution"; break; default: doomverstr = "DOOM 2: Hell on Earth"; break; } break; default: doomverstr = "Public DOOM"; break; } /* cphipps - the main display. This shows the build date, copyright, and game type */ lprintf(LO_ALWAYS,"PrBoom (built %s), playing: %s\n" "PrBoom is released under the GNU General Public license v2.0.\n" "You are welcome to redistribute it under certain conditions.\n" "It comes with ABSOLUTELY NO WARRANTY. See the file COPYING for details.\n", version_date, doomverstr); } if (devparm) //jff 9/3/98 use logical output routine lprintf(LO_CONFIRM,"%s",D_DEVSTR); // turbo option if ((p=M_CheckParm ("-turbo"))) { int scale = 200; extern int forwardmove[2]; extern int sidemove[2]; if (p<myargc-1) scale = atoi(myargv[p+1]); if (scale < 10) scale = 10; if (scale > 400) scale = 400; //jff 9/3/98 use logical output routine lprintf (LO_CONFIRM,"turbo scale: %i%%\n",scale); forwardmove[0] = forwardmove[0]*scale/100; forwardmove[1] = forwardmove[1]*scale/100; sidemove[0] = sidemove[0]*scale/100; sidemove[1] = sidemove[1]*scale/100; } modifiedgame = false; // get skill / episode / map from parms startskill = sk_none; // jff 3/24/98 was sk_medium, just note not picked startepisode = 1; startmap = 1; autostart = false; if ((p = M_CheckParm ("-skill")) && p < myargc-1) { startskill = myargv[p+1][0]-'1'; autostart = true; } if ((p = M_CheckParm ("-episode")) && p < myargc-1) { startepisode = myargv[p+1][0]-'0'; startmap = 1; autostart = true; } if ((p = M_CheckParm ("-timer")) && p < myargc-1 && deathmatch) { int time = atoi(myargv[p+1]); //jff 9/3/98 use logical output routine lprintf(LO_CONFIRM,"Levels will end after %d minute%s.\n", time, time>1 ? "s" : ""); } if ((p = M_CheckParm ("-avg")) && p < myargc-1 && deathmatch) //jff 9/3/98 use logical output routine lprintf(LO_CONFIRM,"Austin Virtual Gaming: Levels will end after 20 minutes\n"); if ((p = M_CheckParm ("-warp")) || // killough 5/2/98 (p = M_CheckParm ("-wart"))) // Ty 08/29/98 - moved this check later so we can have -warp alone: && p < myargc-1) { startmap = 0; // Ty 08/29/98 - allow "-warp x" to go to first map in wad(s) autostart = true; // Ty 08/29/98 - move outside the decision tree if (gamemode == commercial) { if (p < myargc-1) startmap = atoi(myargv[p+1]); // Ty 08/29/98 - add test if last parm } else // 1/25/98 killough: fix -warp xxx from crashing Doom 1 / UD { if (p < myargc-2) { startepisode = atoi(myargv[++p]); startmap = atoi(myargv[p+1]); } } } // Ty 08/29/98 - later we'll check for startmap=0 and autostart=true // as a special case that -warp * was used. Actually -warp with any // non-numeric will do that but we'll only document "*" //jff 1/22/98 add command line parms to disable sound and music { int nosound = M_CheckParm("-nosound"); nomusicparm = nosound || M_CheckParm("-nomusic"); nosfxparm = nosound || M_CheckParm("-nosfx"); } //jff end of sound/music command line parms // killough 3/2/98: allow -nodraw -noblit generally nodrawers = M_CheckParm ("-nodraw"); noblit = M_CheckParm ("-noblit"); //proff 11/22/98: Added setting of viewangleoffset p = M_CheckParm("-viewangle"); if (p) { viewangleoffset = atoi(myargv[p+1]); viewangleoffset = viewangleoffset<0 ? 0 : (viewangleoffset>7 ? 7 : viewangleoffset); viewangleoffset = (8-viewangleoffset) * ANG45; } // init subsystems G_ReloadDefaults(); // killough 3/4/98: set defaults just loaded. // jff 3/24/98 this sets startskill if it was -1 // Video stuff if ((p = M_CheckParm("-width"))) if (myargv[p+1]) desired_screenwidth = atoi(myargv[p+1]); if ((p = M_CheckParm("-height"))) if (myargv[p+1]) desired_screenheight = atoi(myargv[p+1]); if ((p = M_CheckParm("-fullscreen"))) use_fullscreen = 1; if ((p = M_CheckParm("-nofullscreen"))) use_fullscreen = 0; // e6y // New command-line options for setting a window (-window) // or fullscreen (-nowindow) mode temporarily which is not saved in cfg. // It works like "-geom" switch desired_fullscreen = use_fullscreen; if ((p = M_CheckParm("-window"))) desired_fullscreen = 0; if ((p = M_CheckParm("-nowindow"))) desired_fullscreen = 1; { // -geometry handling, change screen size for this session only // e6y: new code by me int w, h; if (!(p = M_CheckParm("-geom"))) p = M_CheckParm("-geometry"); if (!(p && (p+1<myargc) && sscanf(myargv[p+1], "%dx%d", &w, &h) == 2)) { w = desired_screenwidth; h = desired_screenheight; } I_CalculateRes(w, h); } #ifdef GL_DOOM // proff 04/05/2000: for GL-specific switches gld_InitCommandLine(); #endif //jff 9/3/98 use logical output routine lprintf(LO_INFO,"V_Init: allocate screens.\n"); V_Init(); // CPhipps - autoloading of wads // Designed to be general, instead of specific to boomlump.wad // Some people might find this useful // cph - support MBF -noload parameter if (!M_CheckParm("-noload")) { int i; for (i=0; i<MAXLOADFILES*2; i++) { const char *fname = (i < MAXLOADFILES) ? wad_files[i] : deh_files[i - MAXLOADFILES]; char *fpath; if (!(fname && *fname)) continue; // Filename is now stored as a zero terminated string fpath = I_FindFile(fname, (i < MAXLOADFILES) ? ".wad" : ".bex"); if (!fpath) lprintf(LO_WARN, "Failed to autoload %s\n", fname); else { if (i >= MAXLOADFILES) ProcessDehFile(fpath, D_dehout(), 0); else { D_AddFile(fpath,source_auto_load); } modifiedgame = true; free(fpath); } } } // e6y: DEH files preloaded in wrong order // http://sourceforge.net/tracker/index.php?func=detail&aid=1418158&group_id=148658&atid=772943 // The dachaked stuff has been moved from above // ty 03/09/98 do dehacked stuff // Note: do this before any other since it is expected by // the deh patch author that this is actually part of the EXE itself // Using -deh in BOOM, others use -dehacked. // Ty 03/18/98 also allow .bex extension. .bex overrides if both exist. D_BuildBEXTables(); // haleyjd p = M_CheckParm ("-deh"); if (p) { char file[PATH_MAX+1]; // cph - localised // the parms after p are deh/bex file names, // until end of parms or another - preceded parm // Ty 04/11/98 - Allow multiple -deh files in a row while (++p != myargc && *myargv[p] != '-') { AddDefaultExtension(strcpy(file, myargv[p]), ".bex"); if (access(file, F_OK)) // nope { AddDefaultExtension(strcpy(file, myargv[p]), ".deh"); if (access(file, F_OK)) // still nope I_Error("D_DoomMainSetup: Cannot find .deh or .bex file named %s",myargv[p]); } // during the beta we have debug output to dehout.txt ProcessDehFile(file,D_dehout(),0); } } // ty 03/09/98 end of do dehacked stuff // add any files specified on the command line with -file wadfile // to the wad list // killough 1/31/98, 5/2/98: reload hack removed, -wart same as -warp now. if ((p = M_CheckParm ("-file"))) { // the parms after p are wadfile/lump names, // until end of parms or another - preceded parm modifiedgame = true; // homebrew levels while (++p != myargc && *myargv[p] != '-') D_AddFile(myargv[p],source_pwad); } if (!(p = M_CheckParm("-playdemo")) || p >= myargc-1) { /* killough */ if ((p = M_CheckParm ("-fastdemo")) && p < myargc-1) /* killough */ fastdemo = true; // run at fastest speed possible else p = M_CheckParm ("-timedemo"); } if (p && p < myargc-1) { char file[PATH_MAX+1]; // cph - localised strcpy(file,myargv[p+1]); AddDefaultExtension(file,".lmp"); // killough D_AddFile (file,source_lmp); //jff 9/3/98 use logical output routine lprintf(LO_CONFIRM,"Playing demo %s\n",file); if ((p = M_CheckParm ("-ffmap")) && p < myargc-1) { ffmap = atoi(myargv[p+1]); } } // internal translucency set to config file value // phares general_translucency = default_translucency; // phares // 1/18/98 killough: Z_Init() call moved to i_main.c // CPhipps - move up netgame init //jff 9/3/98 use logical output routine lprintf(LO_INFO,"D_InitNetGame: Checking for network game.\n"); D_InitNetGame(); //jff 9/3/98 use logical output routine lprintf(LO_INFO,"W_Init: Init WADfiles.\n"); W_Init(); // CPhipps - handling of wadfiles init changed lprintf(LO_INFO,"\n"); // killough 3/6/98: add a newline, by popular demand :) // e6y // option to disable automatic loading of dehacked-in-wad lump if (!M_CheckParm ("-nodeh")) if ((p = W_CheckNumForName("DEHACKED")) != -1) // cph - add dehacked-in-a-wad support ProcessDehFile(NULL, D_dehout(), p); V_InitColorTranslation(); //jff 4/24/98 load color translation lumps // killough 2/22/98: copyright / "modified game" / SPA banners removed // Ty 04/08/98 - Add 5 lines of misc. data, only if nonblank // The expectation is that these will be set in a .bex file //jff 9/3/98 use logical output routine if (*startup1) lprintf(LO_INFO,"%s",startup1); if (*startup2) lprintf(LO_INFO,"%s",startup2); if (*startup3) lprintf(LO_INFO,"%s",startup3); if (*startup4) lprintf(LO_INFO,"%s",startup4); if (*startup5) lprintf(LO_INFO,"%s",startup5); // End new startup strings //jff 9/3/98 use logical output routine lprintf(LO_INFO,"M_Init: Init miscellaneous info.\n"); M_Init(); #ifdef HAVE_NET // CPhipps - now wait for netgame start D_CheckNetGame(); #endif //jff 9/3/98 use logical output routine lprintf(LO_INFO,"R_Init: Init DOOM refresh daemon - "); R_Init(); //jff 9/3/98 use logical output routine lprintf(LO_INFO,"\nP_Init: Init Playloop state.\n"); P_Init(); //jff 9/3/98 use logical output routine lprintf(LO_INFO,"I_Init: Setting up machine state.\n"); I_Init(); //jff 9/3/98 use logical output routine lprintf(LO_INFO,"S_Init: Setting up sound.\n"); S_Init(snd_SfxVolume /* *8 */, snd_MusicVolume /* *8*/ ); //jff 9/3/98 use logical output routine lprintf(LO_INFO,"HU_Init: Setting up heads up display.\n"); HU_Init(); if (!(M_CheckParm("-nodraw") && M_CheckParm("-nosound"))) I_InitGraphics(); //jff 9/3/98 use logical output routine lprintf(LO_INFO,"ST_Init: Init status bar.\n"); ST_Init(); idmusnum = -1; //jff 3/17/98 insure idmus number is blank // CPhipps - auto screenshots if ((p = M_CheckParm("-autoshot")) && (p < myargc-2)) if ((auto_shot_count = auto_shot_time = atoi(myargv[p+1]))) auto_shot_fname = myargv[p+2]; // start the apropriate game based on parms // killough 12/98: // Support -loadgame with -record and reimplement -recordfrom. if ((slot = M_CheckParm("-recordfrom")) && (p = slot+2) < myargc) G_RecordDemo(myargv[p]); else { slot = M_CheckParm("-loadgame"); if ((p = M_CheckParm("-record")) && ++p < myargc) { autostart = true; G_RecordDemo(myargv[p]); } } if ((p = M_CheckParm ("-checksum")) && ++p < myargc) { P_RecordChecksum (myargv[p]); } if ((p = M_CheckParm ("-fastdemo")) && ++p < myargc) { // killough fastdemo = true; // run at fastest speed possible timingdemo = true; // show stats after quit G_DeferedPlayDemo(myargv[p]); singledemo = true; // quit after one demo } else if ((p = M_CheckParm("-timedemo")) && ++p < myargc) { singletics = true; timingdemo = true; // show stats after quit G_DeferedPlayDemo(myargv[p]); singledemo = true; // quit after one demo } else if ((p = M_CheckParm("-playdemo")) && ++p < myargc) { G_DeferedPlayDemo(myargv[p]); singledemo = true; // quit after one demo } if (slot && ++slot < myargc) { slot = atoi(myargv[slot]); // killough 3/16/98: add slot info G_LoadGame(slot, true); // killough 5/15/98: add command flag // cph - no filename } else if (!singledemo) { /* killough 12/98 */ if (autostart || netgame) { G_InitNew(startskill, startepisode, startmap); if (demorecording) G_BeginRecording(); } else D_StartTitle(); // start up intro loop } }
// // D_SRB2Main // void D_SRB2Main(void) { INT32 p; char srb2[82]; // srb2 title banner char title[82]; INT32 pstartmap = 1; boolean autostart = false; // keep error messages until the final flush(stderr) #if !defined (PC_DOS) && !defined (_WIN32_WCE) && !defined(NOTERMIOS) if (setvbuf(stderr, NULL, _IOFBF, 1000)) DEBPRINT("setvbuf didnt work\n"); #endif #ifdef GETTEXT // initialise locale code M_StartupLocale(); #endif // get parameters from a response file (eg: srb2 @parms.txt) M_FindResponseFile(); // MAINCFG is now taken care of where "OBJCTCFG" is handled G_LoadGameSettings(); // identify the main IWAD file to use IdentifyVersion(); #if !defined (_WIN32_WCE) && !defined(NOTERMIOS) setbuf(stdout, NULL); // non-buffered output #endif #if defined (_WIN32_WCE) //|| defined (_DEBUG) || defined (GP2X) devparm = !M_CheckParm("-nodebug"); #else devparm = M_CheckParm("-debug"); #endif // for dedicated server #if !defined (_WINDOWS) //already check in win_main.c dedicated = M_CheckParm("-dedicated") != 0; #endif strcpy(title, "Sonic Robo Blast 2"); strcpy(srb2, "Sonic Robo Blast 2"); D_MakeTitleString(srb2); #ifdef PC_DOS D_Titlebar(srb2, title); #else CONS_Printf("SRB2"VERSIONSTRING"\n"); #endif #if defined (__OS2__) && !defined (SDL) // set PM window title snprintf(pmData->title, sizeof (pmData->title), "Sonic Robo Blast 2" VERSIONSTRING ": %s", title); pmData->title[sizeof (pmData->title) - 1] = '\0'; #endif if (devparm) CONS_Printf("%s", M_GetText("Development mode ON.\n")); // default savegame strcpy(savegamename, SAVEGAMENAME"%u.ssg"); { const char *userhome = D_Home(); //Alam: path to home if (!userhome) { #if ((defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)) && !defined (__CYGWIN__) && !defined (DC) && !defined (PSP) && !defined(GP2X) I_Error("%s", M_GetText("Please set $HOME to your home directory\n")); #elif defined (_WIN32_WCE) && 0 if (dedicated) snprintf(configfile, sizeof configfile, "/Storage Card/SRB2DEMO/d"CONFIGFILENAME); else snprintf(configfile, sizeof configfile, "/Storage Card/SRB2DEMO/"CONFIGFILENAME); #else if (dedicated) snprintf(configfile, sizeof configfile, "d"CONFIGFILENAME); else snprintf(configfile, sizeof configfile, CONFIGFILENAME); #endif } else { // use user specific config file #ifdef DEFAULTDIR snprintf(srb2home, sizeof srb2home, "%s" PATHSEP DEFAULTDIR, userhome); snprintf(downloaddir, sizeof downloaddir, "%s" PATHSEP "DOWNLOAD", srb2home); if (dedicated) snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, srb2home); else snprintf(configfile, sizeof configfile, "%s" PATHSEP CONFIGFILENAME, srb2home); // can't use sprintf since there is %u in savegamename strcatbf(savegamename, srb2home, PATHSEP); I_mkdir(srb2home, 0700); #else snprintf(srb2home, sizeof srb2home, "%s", userhome); snprintf(downloaddir, sizeof downloaddir, "%s", userhome); if (dedicated) snprintf(configfile, sizeof configfile, "%s" PATHSEP "d"CONFIGFILENAME, userhome); else snprintf(configfile, sizeof configfile, "%s" PATHSEP CONFIGFILENAME, userhome); // can't use sprintf since there is %u in savegamename strcatbf(savegamename, userhome, PATHSEP); #endif } configfile[sizeof configfile - 1] = '\0'; #ifdef _arch_dreamcast strcpy(downloaddir, "/ram"); // the dreamcast's TMP #endif } if (M_CheckParm("-password") && M_IsNextParm()) { const char *pw = M_GetNextParm(); strncpy(adminpassword, pw, 8); if (strlen(pw) < 8) { size_t z; for (z = strlen(pw); z < 8; z++) adminpassword[z] = 'a'; } } else { size_t z; srand((unsigned int)time(NULL)); for (z = 0; z < 8; z++) adminpassword[z] = (char)(rand() & 127); } adminpassword[8] = '\0'; // add any files specified on the command line with -file wadfile // to the wad list if (!(M_CheckParm("-connect"))) { if (M_CheckParm("-file")) { // the parms after p are wadfile/lump names, // until end of parms or another - preceded parm while (M_IsNextParm()) { const char *s = M_GetNextParm(); if (s) // Check for NULL? { if (!W_VerifyNMUSlumps(s)) modifiedgame = true; D_AddFile(s); } } } } // get map from parms if (M_CheckParm("-server") || dedicated) netgame = server = true; if (M_CheckParm("-warp") && M_IsNextParm()) { pstartmap = atoi(M_GetNextParm()); if (!M_CheckParm("-server")) modifiedgame = true; autostart = true; savemoddata = false; } CONS_Printf("%s", M_GetText("Z_Init: Init zone memory allocation daemon. \n")); Z_Init(); // adapt tables to SRB2's needs, including extra slots for dehacked file support P_PatchInfoTables(); CONS_Printf("%s", M_GetText("W_Init: Init WADfiles.\n")); //---------------------------------------------------- READY TIME // we need to check for dedicated before initialization of some subsystems CONS_Printf("I_StartupTimer...\n"); I_StartupTimer(); // Make backups of some SOCcable tables. P_BackupTables(); // load wad, including the main wad file if (!W_InitMultipleFiles(startupwadfiles)) #ifdef _DEBUG CONS_Error(M_GetText("A WAD file was not found or not valid\n")); #else I_Error("%s", M_GetText("A WAD file was not found or not valid\n")); #endif D_CleanFile(); // Check MD5s of autoloaded files W_VerifyFileMD5(0, "1f698dd35bcedb04631568a84a97d72b"); // srb2.srb W_VerifyFileMD5(1, "86ae3f9179c64358d1c88060e41bd415"); // zones.dta W_VerifyFileMD5(2, "f699d4702b9b505db621e5ad5af4f352"); // sonic.plr W_VerifyFileMD5(3, "dfbbc38080485c70a84a57bb734ceee9"); // tails.plr W_VerifyFileMD5(4, "1ea958e2aee87b6995226a120ba3eaac"); // knux.plr W_VerifyFileMD5(5, "8f702416c15060cd3c53c71b91116914"); // rings.wpn W_VerifyFileMD5(6, "6b1cf9b41e41a46ac58606dc6e7c9e05"); // drill.dta W_VerifyFileMD5(7, "8d080c050ecf03691562aa7b60156fec"); // soar.dta // don't check music.dta because people like to modify it, and it doesn't matter if they do // ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for. mainwads = 8; // there are 8 wads not to unload /* TODO: incorporate this! CONS_Printf("%s", "===========================================================================\n" " Sonic Robo Blast II!\n" " by Sonic Team Junior\n" " http://www.srb2.org\n" " This is a modified version. Go to our site for the original.\n" "===========================================================================\n"); */ // Check and print which version is executed. CONS_Printf("%s", "===========================================================================\n" " We hope you enjoy this game as\n" " much as we did making it!\n" " ...wait. =P\n" "===========================================================================\n"); cht_Init(); //---------------------------------------------------- READY SCREEN // we need to check for dedicated before initialization of some subsystems CONS_Printf("I_StartupGraphics...\n"); I_StartupGraphics(); //--------------------------------------------------------- CONSOLE // setup loading screen SCR_Startup(); // we need the font of the console CONS_Printf("%s", M_GetText("HU_Init: Setting up heads up display.\n")); HU_Init(); COM_Init(); // libogc has a CON_Init function, we must rename SRB2's CON_Init in WII/libogc #ifndef _WII CON_Init(); #else CON_InitWii(); #endif D_RegisterServerCommands(); D_RegisterClientCommands(); // be sure that this is called before D_CheckNetGame R_RegisterEngineStuff(); S_RegisterSoundStuff(); I_RegisterSysCommands(); //--------------------------------------------------------- CONFIG.CFG M_FirstLoadConfig(); // WARNING : this do a "COM_BufExecute()" if (!M_CheckParm("-resetdata")) G_LoadGameData(); #if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (SDL) VID_PrepareModeList(); // Regenerate Modelist according to cv_fullscreen #endif // set user default mode or mode set at cmdline SCR_CheckDefaultMode(); wipegamestate = gamestate; P_InitMapHeaders(); savedata.lives = 0; // flag this as not-used //------------------------------------------------ COMMAND LINE PARAMS // Initialize CD-Audio if (M_CheckParm("-usecd") && !dedicated) I_InitCD(); if (M_CheckParm("-nodownloading")) COM_BufAddText("downloading 0\n"); CONS_Printf("%s", M_GetText("M_Init: Init miscellaneous info.\n")); M_Init(); CONS_Printf("%s", M_GetText("R_Init: Init SRB2 refresh daemon - ")); R_Init(); // setting up sound CONS_Printf("%s", M_GetText("S_Init: Setting up sound.\n")); if (M_CheckParm("-nosound")) nosound = true; if (M_CheckParm("-nomusic")) // combines -nomidimusic and -nodigmusic nomidimusic = nodigimusic = true; else { if (M_CheckParm("-nomidimusic")) nomidimusic = true; ; // WARNING: DOS version initmusic in I_StartupSound if (M_CheckParm("-nodigmusic")) nodigimusic = true; // WARNING: DOS version initmusic in I_StartupSound } I_StartupSound(); I_InitMusic(); S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value); CONS_Printf("%s", M_GetText("ST_Init: Init status bar.\n")); ST_Init(); if (M_CheckParm("-internetserver")) CV_SetValue(&cv_internetserver, 1); // init all NETWORK CONS_Printf("%s", M_GetText("D_CheckNetGame: Checking network game status.\n")); if (D_CheckNetGame()) autostart = true; // check for a driver that wants intermission stats // start the apropriate game based on parms if (M_CheckParm("-record") && M_IsNextParm()) { G_RecordDemo(M_GetNextParm()); autostart = true; } p = M_CheckParm("-timetic"); if (p) CV_Set(&cv_timetic, "On"); if (!autostart) M_PushSpecialParameters(); // push all "+" parameters at the command buffer // demo doesn't need anymore to be added with D_AddFile() p = M_CheckParm("-playdemo"); if (!p) p = M_CheckParm("-timedemo"); if (p && M_IsNextParm()) { char tmp[MAX_WADPATH]; // add .lmp to identify the EXTERNAL demo file // it is NOT possible to play an internal demo using -playdemo, // rather push a playdemo command.. to do. strcpy(tmp, M_GetNextParm()); // get spaced filename or directory while (M_IsNextParm()) { strcat(tmp, " "); strcat(tmp, M_GetNextParm()); } FIL_DefaultExtension(tmp, ".lmp"); CONS_Printf(M_GetText("Playing demo %s.\n"), tmp); if (M_CheckParm("-playdemo")) { singledemo = true; // quit after one demo G_DeferedPlayDemo(tmp); } else G_TimeDemo(tmp); G_SetGamestate(GS_NULL); wipegamestate = GS_NULL; return; } if (M_CheckParm("-ultimatemode")) { autostart = true; ultimatemode = true; } if (autostart || netgame || M_CheckParm("+connect") || M_CheckParm("-connect")) { gameaction = ga_nothing; CV_ClearChangedFlags(); // Do this here so if you run SRB2 with eg +timelimit 5, the time limit counts // as having been modified for the first game. M_PushSpecialParameters(); // push all "+" parameter at the command buffer if (M_CheckParm("-gametype") && M_IsNextParm()) { // from Command_Map_f INT32 j; INT16 newgametype = -1; const char *sgametype = M_GetNextParm(); for (j = 0; gametype_cons_t[j].strvalue; j++) if (!strcasecmp(gametype_cons_t[j].strvalue, sgametype)) { if (gametype_cons_t[j].value == GTF_TEAMMATCH) { newgametype = GT_MATCH; CV_SetValue(&cv_matchtype, 1); } else if (gametype_cons_t[j].value == GTF_CLASSICRACE) { newgametype = GT_RACE; CV_SetValue(&cv_racetype, 1); } else if (gametype_cons_t[j].value == GTF_HIDEANDSEEK) { newgametype = GT_TAG; CV_SetValue(&cv_tagtype, 1); } else newgametype = (INT16)gametype_cons_t[j].value; break; } if (!gametype_cons_t[j].strvalue) // reached end of the list with no match { j = atoi(sgametype); // assume they gave us a gametype number, which is okay too if (j >= 0 && j < NUMGAMETYPES) newgametype = (INT16)j; } if (newgametype != -1) { j = gametype; gametype = newgametype; D_GameTypeChanged(j); } } if (server && !M_CheckParm("+map") && !M_CheckParm("+connect") && !M_CheckParm("-connect")) { D_MapChange(pstartmap, gametype, ultimatemode, 1, 0, false, false); } } else F_StartIntro(); // Tails 03-03-2002 if (dedicated && server) { pagename = "TITLESKY"; levelstarttic = gametic; G_SetGamestate(GS_LEVEL); if (!P_SetupLevel(gamemap, false)) I_Quit(); // fail so reset game stuff } }
// // D_DoomMain // void D_DoomMain(void) { IdentifyVersion(); modifiedgame = false; nomonsters = M_CheckParm("-nomonsters") != 0; respawnparm = M_CheckParm("-respawn") != 0; fastparm = M_CheckParm("-fast") != 0; switch (gamemode) { case retail: sprintf_s(title, " " "The Ultimate DOOM Startup v%i.%i" " ", VERSION / 100, VERSION % 100); break; case shareware: sprintf_s(title, " " "DOOM Shareware Startup v%i.%i" " ", VERSION / 100, VERSION % 100); break; case registered: sprintf_s(title, " " "DOOM Registered Startup v%i.%i" " ", VERSION / 100, VERSION % 100); break; case commercial: sprintf_s(title, " " "DOOM 2: Hell on Earth v%i.%i" " ", VERSION / 100, VERSION % 100); break; /*FIXME case pack_plut: sprintf (title, " " "DOOM 2: Plutonia Experiment v%i.%i" " ", VERSION/100,VERSION%100); break; case pack_tnt: sprintf (title, " " "DOOM 2: TNT - Evilution v%i.%i" " ", VERSION/100,VERSION%100); break; */ default: sprintf_s(title, " " "Public DOOM - v%i.%i" " ", VERSION / 100, VERSION % 100); break; } doomCallbacks->Printf("%s\n", title); // get skill / episode / map from parms startskill = sk_medium; startepisode = 1; startmap = 1; autostart = false; // init subsystems doomCallbacks->Printf("V_Init: allocate screens.\n"); V_Init(); doomCallbacks->Printf("M_LoadDefaults: Load system defaults.\n"); M_LoadDefaults(); // load before initing other systems doomCallbacks->Printf("Z_Init: Init zone memory allocation daemon. \n"); Z_Init(); doomCallbacks->Printf("W_Init: Init WADfiles.\n"); W_InitMultipleFiles(wadfiles); // Check for -file in shareware if (modifiedgame) { // These are the lumps that will be checked in IWAD, // if any one is not present, execution will be aborted. char name[23][16] = { "e2m1", "e2m2", "e2m3", "e2m4", "e2m5", "e2m6", "e2m7", "e2m8", "e2m9", "e3m1", "e3m3", "e3m3", "e3m4", "e3m5", "e3m6", "e3m7", "e3m8", "e3m9", "dphoof", "bfgga0", "heada1", "cybra1", "spida1d1" }; int i; if (gamemode == shareware) I_Error("\nYou cannot -file with the shareware " "version. Register!"); // Check for fake IWAD with right name, // but w/o all the lumps of the registered version. if (gamemode == registered) for (i = 0; i < 23; i++) if (W_CheckNumForName(name[i]) < 0) I_Error("\nThis is not the registered version."); } // Iff additonal PWAD files are used, print modified banner if (modifiedgame) { doomCallbacks->Printf( "===========================================================================\n" "ATTENTION: This version of DOOM has been modified. If you would like to\n" "get a copy of the original game, call 1-800-IDGAMES or see the readme file.\n" " You will not receive technical support for modified games.\n" " press enter to continue\n" "===========================================================================\n" ); getchar(); } // Check and print which version is executed. switch (gamemode) { case shareware: case indetermined: doomCallbacks->Printf( "===========================================================================\n" " Shareware!\n" "===========================================================================\n" ); break; case registered: case retail: case commercial: doomCallbacks->Printf( "===========================================================================\n" " Commercial product - do not distribute!\n" " Please report software piracy to the SPA: 1-800-388-PIR8\n" "===========================================================================\n" ); break; default: // Ouch. break; } doomCallbacks->Printf("M_Init: Init miscellaneous info.\n"); M_Init(); doomCallbacks->Printf("R_Init: Init DOOM refresh daemon - "); R_Init(); doomCallbacks->Printf("\nP_Init: Init Playloop state.\n"); P_Init(); doomCallbacks->Printf("D_CheckNetGame: Checking network game status.\n"); D_CheckNetGame(); doomCallbacks->Printf("S_Init: Setting up sound.\n"); S_Init(snd_SfxVolume * 8, snd_MusicVolume * 8); doomCallbacks->Printf("HU_Init: Setting up heads up display.\n"); HU_Init(); doomCallbacks->Printf("ST_Init: Init status bar.\n"); ST_Init(); if (gameaction != ga_loadgame) { if (autostart || netgame) G_InitNew(startskill, startepisode, startmap); else D_StartTitle(); // start up intro loop } }
// // D_DoomMain // void D_DoomMain (void) { int p; char file[256]; FindResponseFile (); IdentifyVersion (); setbuf (stdout, NULL); modifiedgame = false; nomonsters = M_CheckParm ("-nomonsters"); respawnparm = M_CheckParm ("-respawn"); fastparm = M_CheckParm ("-fast"); devparm = M_CheckParm ("-devparm"); if (M_CheckParm ("-altdeath")) deathmatch = 2; else if (M_CheckParm ("-deathmatch")) deathmatch = 1; switch ( gamemode ) { case retail: sprintf (title, " " "The Ultimate DOOM Startup v%i.%i" " ", VERSION/100,VERSION%100); break; case shareware: sprintf (title, " " "DOOM Shareware Startup v%i.%i" " ", VERSION/100,VERSION%100); break; case registered: sprintf (title, " " "DOOM Registered Startup v%i.%i" " ", VERSION/100,VERSION%100); break; case commercial: sprintf (title, " " "DOOM 2: Hell on Earth v%i.%i" " ", VERSION/100,VERSION%100); break; /*FIXME case pack_plut: sprintf (title, " " "DOOM 2: Plutonia Experiment v%i.%i" " ", VERSION/100,VERSION%100); break; case pack_tnt: sprintf (title, " " "DOOM 2: TNT - Evilution v%i.%i" " ", VERSION/100,VERSION%100); break; */ default: sprintf (title, " " "Public DOOM - v%i.%i" " ", VERSION/100,VERSION%100); break; } printf ("%s\n",title); if (devparm) printf(D_DEVSTR); if (M_CheckParm("-cdrom")) { printf(D_CDROM); mkdir("c:\\doomdata",0); strcpy (basedefault,"c:/doomdata/default.cfg"); } // turbo option if ( (p=M_CheckParm ("-turbo")) ) { int scale = 200; extern int forwardmove[2]; extern int sidemove[2]; if (p<myargc-1) scale = atoi (myargv[p+1]); if (scale < 10) scale = 10; if (scale > 400) scale = 400; printf ("turbo scale: %i%%\n",scale); forwardmove[0] = forwardmove[0]*scale/100; forwardmove[1] = forwardmove[1]*scale/100; sidemove[0] = sidemove[0]*scale/100; sidemove[1] = sidemove[1]*scale/100; } // add any files specified on the command line with -file wadfile // to the wad list // // convenience hack to allow -wart e m to add a wad file // prepend a tilde to the filename so wadfile will be reloadable p = M_CheckParm ("-wart"); if (p) { myargv[p][4] = 'p'; // big hack, change to -warp // Map name handling. switch (gamemode ) { case shareware: case retail: case registered: sprintf (file,"~"DEVMAPS"E%cM%c.wad", myargv[p+1][0], myargv[p+2][0]); printf("Warping to Episode %s, Map %s.\n", myargv[p+1],myargv[p+2]); break; case commercial: default: p = atoi (myargv[p+1]); if (p<10) sprintf (file,"~"DEVMAPS"cdata/map0%i.wad", p); else sprintf (file,"~"DEVMAPS"cdata/map%i.wad", p); break; } D_AddFile (file); } p = M_CheckParm ("-file"); if (p) { // the parms after p are wadfile/lump names, // until end of parms or another - preceded parm modifiedgame = true; // homebrew levels while (++p != myargc && myargv[p][0] != '-') D_AddFile (myargv[p]); } p = M_CheckParm ("-playdemo"); if (!p) p = M_CheckParm ("-timedemo"); if (p && p < myargc-1) { sprintf (file,"%s.lmp", myargv[p+1]); W_AddFileAs (file,"D#DEMO"); printf("Playing demo %s.lmp.\n",myargv[p+1]); } // get skill / episode / map from parms startskill = sk_medium; startepisode = 1; startmap = 1; autostart = false; p = M_CheckParm ("-skill"); if (p && p < myargc-1) { startskill = myargv[p+1][0]-'1'; autostart = true; } p = M_CheckParm ("-episode"); if (p && p < myargc-1) { startepisode = myargv[p+1][0]-'0'; startmap = 1; autostart = true; } p = M_CheckParm ("-timer"); if (p && p < myargc-1 && deathmatch) { int time; time = atoi(myargv[p+1]); printf("Levels will end after %d minute",time); if (time>1) printf("s"); printf(".\n"); } p = M_CheckParm ("-avg"); if (p && p < myargc-1 && deathmatch) printf("Austin Virtual Gaming: Levels will end after 20 minutes\n"); p = M_CheckParm ("-warp"); if (p && p < myargc-1) { if (gamemode == commercial) startmap = atoi (myargv[p+1]); else { startepisode = myargv[p+1][0]-'0'; startmap = myargv[p+2][0]-'0'; } autostart = true; } // init subsystems printf ("V_Init: allocate screens.\n"); V_Init (); printf ("M_LoadDefaults: Load system defaults.\n"); M_LoadDefaults (); // load before initing other systems printf ("Z_Init: Init zone memory allocation daemon. \n"); Z_Init (); printf ("W_Init: Init WADfiles.\n"); W_InitMultipleFiles (wadfiles); // Check and print which version is executed. switch ( gamemode ) { case shareware: case indetermined: printf ( "===========================================================================\n" " Shareware!\n" "===========================================================================\n" ); break; case registered: case retail: case commercial: printf ( "===========================================================================\n" " Commercial product - do not distribute!\n" " Please report software piracy to the SPA: 1-800-388-PIR8\n" "===========================================================================\n" ); break; default: // Ouch. break; } B_InitLumps(); printf ("M_Init: Init miscellaneous info.\n"); M_Init (); printf ("R_Init: Init DOOM refresh daemon - "); R_Init (); printf ("\nP_Init: Init Playloop state.\n"); P_Init (); printf ("I_Init: Setting up machine state.\n"); I_Init (); printf ("D_CheckNetGame: Checking network game status.\n"); D_CheckNetGame (); printf ("S_Init: Setting up sound.\n"); S_Init (snd_SfxVolume /* *8 */, snd_MusicVolume /* *8*/ ); printf ("HU_Init: Setting up heads up display.\n"); HU_Init (); printf ("ST_Init: Init status bar.\n"); ST_Init (); // check for a driver that wants intermission stats p = M_CheckParm ("-statcopy"); if (p && p<myargc-1) { // for statistics driver extern char* statcopy; statcopy = myargv[p+1]; printf ("External statistics registered.\n"); } // start the apropriate game based on parms p = M_CheckParm ("-record"); if (p && p < myargc-1) { G_RecordDemo (myargv[p+1]); autostart = true; } p = M_CheckParm("-fastforward"); if (p && p < myargc-1) { fastforward = atoi(myargv[p+1]); } p = M_CheckParm ("-playdemo"); if (p && p < myargc-1) { singledemo = true; // quit after one demo G_DeferedPlayDemo ("D#DEMO"); D_DoomLoop (); // never returns } p = M_CheckParm ("-timedemo"); if (p && p < myargc-1) { G_TimeDemo (myargv[p+1]); D_DoomLoop (); // never returns } p = M_CheckParm ("-loadgame"); if (p && p < myargc-1) { if (M_CheckParm("-cdrom")) sprintf(file, "c:\\doomdata\\"SAVEGAMENAME"%c.dsg",myargv[p+1][0]); else sprintf(file, SAVEGAMENAME"%c.dsg",myargv[p+1][0]); G_LoadGame (file); } if ( gameaction != ga_loadgame ) { if (autostart || netgame) G_InitNew (startskill, startepisode, startmap); else D_StartTitle (); // start up intro loop } D_DoomLoop (); // never returns }
bool D_DoomMainSetup(void) { int p; setbuf(stdout,NULL); // proff 04/05/2000: Added support for include response files /* proff 2001/7/1 - Moved up, so -config can be in response files */ { boolean rsp_found; int i; do { rsp_found=FALSE; for (i=0; i<myargc; i++) if (myargv[i][0]=='@') rsp_found=TRUE; if (!FindResponseFile()) goto failed; } while (rsp_found==TRUE); } lprintf(LO_INFO,"M_LoadDefaults: Load system defaults.\n"); M_LoadDefaults(); // load before initing other systems // figgi 09/18/00-- added switch to force classic bsp nodes if (M_CheckParm ("-forceoldbsp")) { extern boolean forceOldBsp; forceOldBsp = TRUE; } D_BuildBEXTables(); // haleyjd DoLooseFiles(); // Ty 08/29/98 - handle "loose" files on command line if (!IdentifyVersion()) goto failed; // Load prboom.wad after IWAD but before everything else { char *data_wad_path = I_FindFile(PACKAGE ".wad", ".wad"); if (!data_wad_path) { I_Error(PACKAGE ".wad not found - cannot continue"); goto failed; } D_AddFile(data_wad_path, source_pre); free(data_wad_path); } // e6y: DEH files preloaded in wrong order // http://sourceforge.net/tracker/index.php?func=detail&aid=1418158&group_id=148658&atid=772943 // The dachaked stuff has been moved below an autoload // jff 1/24/98 set both working and command line value of play parms nomonsters = clnomonsters = M_CheckParm ("-nomonsters"); respawnparm = clrespawnparm = M_CheckParm ("-respawn"); fastparm = clfastparm = M_CheckParm ("-fast"); // jff 1/24/98 end of set to both working and command line value if (M_CheckParm ("-altdeath")) deathmatch = 2; else if (M_CheckParm ("-deathmatch")) deathmatch = 1; { // CPhipps - localise title variable // print title for every printed line // cph - code cleaned and made smaller const char* doomverstr; switch ( gamemode ) { case retail: doomverstr = "The Ultimate DOOM"; break; case shareware: doomverstr = "DOOM Shareware"; break; case registered: doomverstr = "DOOM Registered"; break; case commercial: // Ty 08/27/98 - fixed gamemode vs gamemission switch (gamemission) { case pack_plut: doomverstr = "DOOM 2: Plutonia Experiment"; break; case pack_tnt: doomverstr = "DOOM 2: TNT - Evilution"; break; default: doomverstr = "DOOM 2: Hell on Earth"; break; } break; default: doomverstr = "Public DOOM"; break; } /* cphipps - the main display. This shows the build date, copyright, and game type */ lprintf(LO_ALWAYS,"PrBoom, playing: %s\n" "PrBoom is released under the GNU General Public license v2.0.\n" "You are welcome to redistribute it under certain conditions.\n" "It comes with ABSOLUTELY NO WARRANTY. See the file COPYING for details.\n", doomverstr); } modifiedgame = FALSE; // get skill / episode / map from parms startskill = sk_none; // jff 3/24/98 was sk_medium, just note not picked startepisode = 1; startmap = 1; autostart = FALSE; if ((p = M_CheckParm ("-skill")) && p < myargc-1) { startskill = myargv[p+1][0]-'1'; autostart = TRUE; } if ((p = M_CheckParm ("-episode")) && p < myargc-1) { startepisode = myargv[p+1][0]-'0'; startmap = 1; autostart = TRUE; } if ((p = M_CheckParm ("-warp")) || // killough 5/2/98 (p = M_CheckParm ("-wart"))) // Ty 08/29/98 - moved this check later so we can have -warp alone: && p < myargc-1) { startmap = 0; // Ty 08/29/98 - allow "-warp x" to go to first map in wad(s) autostart = TRUE; // Ty 08/29/98 - move outside the decision tree if (gamemode == commercial) { if (p < myargc-1) startmap = atoi(myargv[p+1]); // Ty 08/29/98 - add test if last parm } else // 1/25/98 killough: fix -warp xxx from crashing Doom 1 / UD { if (p < myargc-2) { startepisode = atoi(myargv[++p]); startmap = atoi(myargv[p+1]); } } } // Ty 08/29/98 - later we'll check for startmap=0 and autostart=TRUE // as a special case that -warp * was used. Actually -warp with any // non-numeric will do that but we'll only document "*" //jff 1/22/98 add command line parms to disable sound and music { int nosound = M_CheckParm("-nosound"); nomusicparm = nosound || M_CheckParm("-nomusic"); nosfxparm = nosound || M_CheckParm("-nosfx"); } //jff end of sound/music command line parms //proff 11/22/98: Added setting of viewangleoffset p = M_CheckParm("-viewangle"); if (p) { viewangleoffset = atoi(myargv[p+1]); viewangleoffset = viewangleoffset<0 ? 0 : (viewangleoffset>7 ? 7 : viewangleoffset); viewangleoffset = (8-viewangleoffset) * ANG45; } // init subsystems G_ReloadDefaults(); // killough 3/4/98: set defaults just loaded. // jff 3/24/98 this sets startskill if it was -1 //jff 9/3/98 use logical output routine lprintf(LO_INFO,"V_Init: allocate screens.\n"); V_Init(); // CPhipps - autoloading of wads // Designed to be general, instead of specific to boomlump.wad // Some people might find this useful // cph - support MBF -noload parameter if (!M_CheckParm("-noload")) { // only autoloaded wads here - autoloaded patches moved down below W_Init int i; for (i=0; i<MAXLOADFILES; i++) { const char *fname = wad_files[i]; char *fpath; if (!(fname && *fname)) continue; // Filename is now stored as a zero terminated string fpath = I_FindFile(fname, ".wad"); if (!fpath) lprintf(LO_WARN, "Failed to autoload %s\n", fname); else { D_AddFile(fpath,source_auto_load); modifiedgame = TRUE; free(fpath); } } } // add any files specified on the command line with -file wadfile // to the wad list // killough 1/31/98, 5/2/98: reload hack removed, -wart same as -warp now. if ((p = M_CheckParm ("-file"))) { // the parms after p are wadfile/lump names, // until end of parms or another - preceded parm modifiedgame = TRUE; // homebrew levels while (++p != myargc && *myargv[p] != '-') D_AddFile(myargv[p],source_pwad); } if (p && p < myargc-1) { char file[PATH_MAX+1]; // cph - localised strcpy(file,myargv[p+1]); AddDefaultExtension(file,".lmp"); // killough D_AddFile (file,source_lmp); //jff 9/3/98 use logical output routine lprintf(LO_CONFIRM,"Playing demo %s\n",file); if ((p = M_CheckParm ("-ffmap")) && p < myargc-1) { ffmap = atoi(myargv[p+1]); } } // 1/18/98 killough: Z_Init() call moved to i_main.c // CPhipps - move up netgame init //jff 9/3/98 use logical output routine lprintf(LO_INFO,"D_InitNetGame: Checking for network game.\n"); D_InitNetGame(); //jff 9/3/98 use logical output routine lprintf(LO_INFO,"W_Init: Init WADfiles.\n"); W_Init(); // CPhipps - handling of wadfiles init changed lprintf(LO_INFO,"\n"); // killough 3/6/98: add a newline, by popular demand :) // e6y // option to disable automatic loading of dehacked-in-wad lump if (!M_CheckParm ("-nodeh")) // MBF-style DeHackEd in wad support: load all lumps, not just the last one for (p = -1; (p = W_ListNumFromName("DEHACKED", p)) >= 0; ) // Split loading DEHACKED lumps into IWAD/autoload and PWADs/others if (lumpinfo[p].source == source_iwad || lumpinfo[p].source == source_pre || lumpinfo[p].source == source_auto_load) ProcessDehFile(NULL, D_dehout(), p); // cph - add dehacked-in-a-wad support if (bfgedition) { int lump = (W_CheckNumForName)("BFGDEH", ns_prboom); if (lump != -1) { ProcessDehFile(NULL, D_dehout(), lump); } } if (!M_CheckParm("-noload")) { // now do autoloaded dehacked patches, after IWAD patches but before PWAD int i; for (i=0; i<MAXLOADFILES; i++) { const char *fname = deh_files[i]; char *fpath; if (!(fname && *fname)) continue; // Filename is now stored as a zero terminated string fpath = I_FindFile(fname, ".bex"); if (!fpath) lprintf(LO_WARN, "Failed to autoload %s\n", fname); else { ProcessDehFile(fpath, D_dehout(), 0); // this used to set modifiedgame here, but patches shouldn't free(fpath); } } } if (!M_CheckParm ("-nodeh")) for (p = -1; (p = W_ListNumFromName("DEHACKED", p)) >= 0; ) if (!(lumpinfo[p].source == source_iwad || lumpinfo[p].source == source_pre || lumpinfo[p].source == source_auto_load)) ProcessDehFile(NULL, D_dehout(), p); // Load command line dehacked patches after WAD dehacked patches // e6y: DEH files preloaded in wrong order // http://sourceforge.net/tracker/index.php?func=detail&aid=1418158&group_id=148658&atid=772943 // ty 03/09/98 do dehacked stuff // Using -deh in BOOM, others use -dehacked. // Ty 03/18/98 also allow .bex extension. .bex overrides if both exist. p = M_CheckParm ("-deh"); if (p) { char file[PATH_MAX+1]; // cph - localised // the parms after p are deh/bex file names, // until end of parms or another - preceded parm // Ty 04/11/98 - Allow multiple -deh files in a row while (++p != myargc && *myargv[p] != '-') { int stillnotfound = 1; FILE *fp; AddDefaultExtension(strcpy(file, myargv[p]), ".bex"); fp = fopen(file, "rb"); if (fp == NULL) stillnotfound = 1; else stillnotfound = 0; fclose(fp); if (stillnotfound) // nope { AddDefaultExtension(strcpy(file, myargv[p]), ".deh"); fp = fopen(file, "rb"); if (fp == NULL) // still nope I_Error("D_DoomMainSetup: Cannot find .deh or .bex file named %s", myargv[p]); fclose(fp); } // during the beta we have debug output to dehout.txt ProcessDehFile(file,D_dehout(),0); } } V_InitColorTranslation(); //jff 4/24/98 load color translation lumps // killough 2/22/98: copyright / "modified game" / SPA banners removed // Ty 04/08/98 - Add 5 lines of misc. data, only if nonblank // The expectation is that these will be set in a .bex file //jff 9/3/98 use logical output routine if (*startup1) lprintf(LO_INFO,"%s",startup1); if (*startup2) lprintf(LO_INFO,"%s",startup2); if (*startup3) lprintf(LO_INFO,"%s",startup3); if (*startup4) lprintf(LO_INFO,"%s",startup4); if (*startup5) lprintf(LO_INFO,"%s",startup5); // End new startup strings //jff 9/3/98 use logical output routine lprintf(LO_INFO,"M_Init: Init miscellaneous info.\n"); M_Init(); #ifdef HAVE_NET // CPhipps - now wait for netgame start D_CheckNetGame(); #endif //jff 9/3/98 use logical output routine lprintf(LO_INFO,"R_Init: Init DOOM refresh daemon - "); R_Init(); //jff 9/3/98 use logical output routine lprintf(LO_INFO,"\nP_Init: Init Playloop state.\n"); P_Init(); //jff 9/3/98 use logical output routine lprintf(LO_INFO,"I_Init: Setting up machine state.\n"); I_Init(); //jff 9/3/98 use logical output routine lprintf(LO_INFO,"S_Init: Setting up sound.\n"); S_Init(snd_SfxVolume /* *8 */, snd_MusicVolume /* *8*/ ); //jff 9/3/98 use logical output routine lprintf(LO_INFO,"HU_Init: Setting up heads up display.\n"); HU_Init(); if (!(M_CheckParm("-nodraw") && M_CheckParm("-nosound"))) I_InitGraphics(); //jff 9/3/98 use logical output routine lprintf(LO_INFO,"ST_Init: Init status bar.\n"); ST_Init(); idmusnum = -1; //jff 3/17/98 insure idmus number is blank // start the apropriate game based on parms // killough 12/98: if ((p = M_CheckParm ("-checksum")) && ++p < myargc) { P_RecordChecksum (myargv[p]); } #if 0 if (slot && ++slot < myargc) { slot = atoi(myargv[slot]); // killough 3/16/98: add slot info G_LoadGame(slot, TRUE); // killough 5/15/98: add command flag // cph - no filename } else #endif #ifdef HAVE_NET if (autostart || netgame) #else if (autostart) #endif { // sets first map and first episode if unknown GetFirstMap(&startepisode, &startmap); G_InitNew(startskill, startepisode, startmap); } else D_StartTitle(); // start up intro loop return true; failed: return false; }
// // D_DoomMain // void D_DoomMain(void) { int p; char file[256]; // *** PID BEGIN *** // Pointer to environment variable string to determine username. char *whoami = NULL; // Value to check whether there were any userlist-related flags // given on the command line. Used to determine whether to // set up default userlist parameters. boolean userlist_arg_given = false; // *** PID END *** FindResponseFile(); IdentifyVersion(); // add xdoom.wad with the extensions // *** PID BEGIN *** // Ok, this doesn't have to do with psdoom, but an abort message here // would be good if we can't find xdoom.wad. If this weren't here, // the game crashes later on with a more obscure error message. if (!access(xdoomwad, R_OK)) { D_AddFile(xdoomwad); } else { I_Error("Cannot load mandatory xdoom.wad\n"); } // old code: // if (!access(xdoomwad, R_OK)) // D_AddFile(xdoomwad); // If the command-line flag to suppress auto-loading of custom // ps management levels is *not* there, load the appropriate level. if ( !M_CheckParm("-nopslev") ) { // Add psdoom1.wad if this is registered (Doom 1) or retail (Ultimite Doom). // If we loaded it, set the flag to true so we can place the monsters in the // correct positions. if ( gamemode == registered || gamemode == retail ){ if (!access(psdoom1wad, R_OK)) { D_AddFile(psdoom1wad); ps_level_loaded = true; } } // Add psdoom2.wad if this is commercial (Doom 2) and not an add-on pack. // If we loaded it, set the flag to true so we can place the monsters in the // correct positions. if ( gamemode == commercial && gamemission == doom2 ) { if (!access(psdoom2wad, R_OK)) { D_AddFile(psdoom2wad); ps_level_loaded = true; } } } // end if auto-load suppression flag isn't there // *** PID END *** setbuf(stdout, NULL); modifiedgame = false; nomonsters = M_CheckParm("-nomonsters"); // *** PID BEGIN *** // This keeps a 'no monsters' that is persistant across new games // and level warps. if ( (nomonstersperiod = M_CheckParm("-nomonsters.") ) ) { nomonsters = true; } // This makes items respawn as in -altdeath (ie. no dropped items, // no invis, no invun) respawnitems = M_CheckParm("-respawnitems"); // Get flag to determine whether to run the 'ps' portion of the program. nopsmon = M_CheckParm("-nopsmon"); // Get flag to determine whether to execute the actual re-nice and kill // of processes. nopsact = M_CheckParm("-nopsact"); // Get flag to determine whether pid monsters can be hurt and killed by // things other than a player. They can be hurt if this flag is true. nopssafety = M_CheckParm("-nopssafety"); // Get flag to tell if we show all users' processes. userlist_arg_given // is assigned so we don't set defaults later on since we specified // at least one user-related option. psallusers = userlist_arg_given = M_CheckParm("-psallusers"); // Set up list of users whose processes to include. p = M_CheckParm("-psuser"); if (p) { // Keeps track if any specific usernames are given. If not, // use the current user's name. boolean user_name_given = false; userlist_arg_given = true; // Don't set defaults later on... // the parms after p are user names, // until end of parms or another - preceded parm while (++p != myargc && myargv[p][0] != '-') { user_name_given = true; add_to_ps_userlist(psuser, myargv[p]); } // If there were no arguments to the -psuser flag, // add current username to the list if ( !user_name_given ) { if ( whoami == NULL ) { // Need to get username // Get username of the person running the program. // PSDOOMUSER, LOGNAME, USER, and USERNAME in the environment // are checked with getenv(), in that order. If none of // these are set, abort with a message to set one of them. if ( (whoami=getenv("PSDOOMUSER")) == NULL ) if ( (whoami=getenv("LOGNAME")) == NULL ) if ( (whoami=getenv("USER")) == NULL ) if ( (whoami=getenv("USERNAME")) == NULL ) { // Error! Need to have at least one of these set in // the environment so we can determine current username. I_Error("Could not determine your username.\nNeed to have PSDOOMUSER, LOGNAME, USER, or USERNAME set in the environment.\n"); } } // end 'if whoami is not set' add_to_ps_userlist(psuser, whoami); } // end 'if we default in current username' } // end -psuser // Set up list of users whose processes to exclude. p = M_CheckParm("-psnotuser"); if (p) { // Keeps track if any specific usernames are given. If not, // use the current user's name. boolean user_name_given = false; userlist_arg_given = true; // Don't set defaults later on... // the parms after p are user names, // until end of parms or another - preceded parm while (++p != myargc && myargv[p][0] != '-') { user_name_given = true; add_to_ps_userlist(psnotuser, myargv[p]); } // If there were no arguments to the -psnotuser flag, // add current username to the list if ( !user_name_given ) { if ( whoami == NULL ) { // Need to get username // Get username of the person running the program. // PSDOOMUSER, LOGNAME, USER, and USERNAME in the environment // are checked with getenv(), in that order. If none of // these are set, abort with a message to set one of them. if ( (whoami=getenv("PSDOOMUSER")) == NULL ) if ( (whoami=getenv("LOGNAME")) == NULL ) if ( (whoami=getenv("USER")) == NULL ) if ( (whoami=getenv("USERNAME")) == NULL ) { // Error! Need to have at least one of these set in // the environment so we can determine current username. I_Error("Could not determine your username.\nNeed to have PSDOOMUSER, LOGNAME, USER, or USERNAME set in the environment.\n"); } } // end 'if whoami is not set' add_to_ps_userlist(psnotuser, whoami); } // end 'if we default in the current username' } // end -psnotuser // If none of the user-related flags were given on the command line, // set defaults depending on whether the current user is root or not. if ( !userlist_arg_given ) { if ( whoami == NULL ) { // Need to get username // Get username of the person running the program. // PSDOOMUSER, LOGNAME, USER, and USERNAME in the environment // are checked with getenv(), in that order. If none of // these are set, abort with a message to set one of them. if ( (whoami=getenv("PSDOOMUSER")) == NULL ) if ( (whoami=getenv("LOGNAME")) == NULL ) if ( (whoami=getenv("USER")) == NULL ) if ( (whoami=getenv("USERNAME")) == NULL ) { // Error! Need to have at least one of these set in // the environment so we can determine current username. I_Error("Could not determine your username.\nNeed to have PSDOOMUSER, LOGNAME, USER, or USERNAME set in the environment.\n"); } } // end 'if whoami is not set' if ( !strcmp(whoami,"root") ) { // username is "root". show all user processes. psallusers = true; } else { // username is not "root". show only current user's processes. add_to_ps_userlist(psuser, whoami); } } // end if !userlist_arg_given // *** PID END *** respawnparm = M_CheckParm("-respawn"); fastparm = M_CheckParm("-fast"); devparm = M_CheckParm("-devparm"); nosound = M_CheckParm("-nosound"); nomusic = M_CheckParm("-nomusic"); cdaudio = M_CheckParm("-cdaudio"); showkey = M_CheckParm("-showkeysym"); notranslu = M_CheckParm("-notrans"); noendtxt = M_CheckParm("-noendtxt"); if (M_CheckParm("-altdeath")) deathmatch = 2; else if (M_CheckParm("-deathmatch")) deathmatch = 1; else if (M_CheckParm("-altcoop")) altcoop = 1; stripextbits = M_CheckParm("-stripextbits"); // remember state of smoke trails in the state tables smoketrail = states[S_ROCKET].action; switch (gamemode) { case retail: sprintf(title, " " "The Ultimate DOOM Startup v%i.%i" " ", VERSION/100,VERSION%100); break; case shareware: sprintf(title, " " "DOOM Shareware Startup v%i.%i" " ", VERSION/100,VERSION%100); break; case registered: sprintf(title, " " "DOOM Registered Startup v%i.%i" " ", VERSION/100,VERSION%100); break; case commercial: switch (gamemission) { case doom2: sprintf(title, " " "DOOM 2: Hell on Earth v%i.%i" " ", VERSION/100,VERSION%100); break; case pack_plut: sprintf(title, " " "DOOM 2: Plutonia Experiment v%i.%i" " ", VERSION/100,VERSION%100); break; case pack_tnt: sprintf(title, " " "DOOM 2: TNT - Evilution v%i.%i" " ", VERSION/100,VERSION%100); break; default: sprintf(title, " " "Unknown Title"); break; } break; default: sprintf(title, " " "Public DOOM - v%i.%i" " ", VERSION/100,VERSION%100); break; } printf("%s\n",title); // *** PID BEGIN *** printf(" psDooM version - %s\n", PSVERSION); printf(" based on:\n"); // *** PID END *** printf(" XDoom build %i\n\n", BUILD); // *** PID BEGIN *** printf("\tpsDooM is released under the GNU General Public License 2.0.\n"); // old code: // printf("\tXDoom is released under the GNU General Public License 2.0.\n"); // *** PID END *** printf("\tYou are welcome to redistribute it under certain conditions.\n"); printf("\tIt comes with ABSOLUTELY NO WARRANTY. See file COPYING for" " details.\n\n"); if (devparm) printf(D_DEVSTR); // turbo option if ((p = M_CheckParm("-turbo"))) { int scale = 200; extern int forwardmove[2]; extern int sidemove[2]; if (p < myargc - 1) scale = atoi(myargv[p + 1]); if (scale < 10) scale = 10; if (scale > 400) scale = 400; printf("turbo scale: %i%%\n", scale); forwardmove[0] = forwardmove[0] *scale / 100; forwardmove[1] = forwardmove[1] *scale / 100; sidemove[0] = sidemove[0] * scale / 100; sidemove[1] = sidemove[1] * scale / 100; } // add any files specified on the command line with -file wadfile // to the wad list // // convenience hack to allow -wart e m to add a wad file // prepend a tilde to the filename so wadfile will be reloadable p = M_CheckParm("-wart"); if (p) { myargv[p][4] = 'p'; // big hack, change to -warp // Map name handling. switch (gamemode) { case shareware: case retail: case registered: sprintf(file, "~"DEVMAPS"E%cM%c.wad", myargv[p + 1][0], myargv[p + 2][0]); printf("Warping to Episode %s, Map %s.\n", myargv[p + 1], myargv[p + 2]); break; case commercial: default: p = atoi(myargv[p + 1]); if (p < 10) sprintf(file, "~"DEVMAPS"cdata/map0%i.wad", p); else sprintf(file, "~"DEVMAPS"cdata/map%i.wad", p); break; } D_AddFile(file); } p = M_CheckParm("-file"); if (p) { // the parms after p are wadfile/lump names, // until end of parms or another - preceded parm modifiedgame = true; // homebrew levels while (++p != myargc && myargv[p][0] != '-') D_AddFile(myargv[p]); } p = M_CheckParm("-playdemo"); if (!p) { p = M_CheckParm("-timedemo"); if (p) { #ifndef SNDSERV nosound = true; #endif noendtxt = true; } } if (p && p < myargc - 1) { sprintf(file,"%s.lmp", myargv[p + 1]); D_AddFile(file); printf("Playing demo %s.lmp.\n", myargv[p + 1]); } // get skill / episode / map from parms startskill = sk_medium; startepisode = 1; startmap = 1; autostart = false; p = M_CheckParm("-skill"); if (p && p < myargc - 1) { startskill = myargv[p + 1][0] - '1'; autostart = true; } p = M_CheckParm("-episode"); if (p && p < myargc - 1) { startepisode = myargv[p + 1][0] - '0'; startmap = 1; autostart = true; } p = M_CheckParm("-timer"); if (p && p < myargc - 1 && deathmatch) { int time = atoi(myargv[p + 1]); printf("Levels will end after %d minute", time); if (time > 1) printf("s"); printf(".\n"); } p = M_CheckParm("-avg"); if (p && p < myargc - 1 && deathmatch) printf("Austin Virtual Gaming: Levels will end after 20 minutes\n"); p = M_CheckParm("-warp"); if (p && p < myargc - 1) { if (gamemode == commercial) startmap = atoi(myargv[p + 1]); else { startepisode = myargv[p + 1][0] - '0'; startmap = myargv[p + 2][0] - '0'; } autostart = true; } // init subsystems printf("V_Init: allocate screens.\n"); V_Init(); printf("M_LoadDefaults: Load system defaults.\n"); M_LoadDefaults(); // load before initing other systems printf("Z_Init: Init zone memory allocation daemon. \n"); Z_Init(); printf("W_Init: Init WADfiles.\n"); W_InitMultipleFiles(wadfiles); // Check for Ultimate Doom if (gamemode == registered) { if (W_CheckNumForName("e4m1") != -1) { gamemode = retail; printf("=== This is Ultimate Doom! ===\n"); } } // Check for -file in shareware if (modifiedgame) { // These are the lumps that will be checked in IWAD, // if any one is not present, execution will be aborted. char name[23][8] = { "e2m1","e2m2","e2m3","e2m4","e2m5","e2m6","e2m7","e2m8","e2m9", "e3m1","e3m3","e3m3","e3m4","e3m5","e3m6","e3m7","e3m8","e3m9", "dphoof","bfgga0","heada1","cybra1","spida1d1" }; int i; if (gamemode == shareware) I_Error("\nYou cannot -file with the shareware version. Register!"); // Check for fake IWAD with right name, // but w/o all the lumps of the registered version. if (gamemode == registered) for (i = 0; i < 23; i++) if (W_CheckNumForName(name[i]) < 0) I_Error("\nThis is not the registered version."); } #if 0 // If additional PWAD files are used, print modified banner if (modifiedgame) { printf ( "===========================================================================\n" "ATTENTION: This version of DOOM has been modified. If you would like to\n" "get a copy of the original game, call 1-800-IDGAMES or see the readme file.\n" " You will not receive technical support for modified games.\n" " press enter to continue\n" "===========================================================================\n" ); getchar(); } #endif #if 0 // Check and print which version is executed. switch (gamemode) { case shareware: case indetermined: printf( "===========================================================================\n" " Shareware!\n" "===========================================================================\n" ); break; case registered: case retail: case commercial: printf( "===========================================================================\n" " Commercial product - do not distribute!\n" " Please report software piracy to the SPA: 1-800-388-PIR8\n" "===========================================================================\n" ); break; default: // Ouch. break; } #endif printf("M_Init: Init miscellaneous info.\n"); M_Init(); printf("R_Init: Init DOOM refresh daemon - "); R_Init(); printf("\nP_Init: Init Playloop state.\n"); P_Init(); printf("I_Init: Setting up machine state.\n"); I_Init(); printf("D_CheckNetGame: Checking network game status.\n"); D_CheckNetGame(); if (!nosound) { printf("S_Init: Setting up sound.\n"); S_Init(snd_SfxVolume, snd_MusicVolume, snd_CdVolume); } printf("HU_Init: Setting up heads up display.\n"); HU_Init(); printf("ST_Init: Init status bar.\n"); ST_Init(); // check for a driver that wants intermission stats p = M_CheckParm("-statcopy"); if (p && p < myargc - 1) { // for statistics driver extern void *statcopy; statcopy = (void*)atoi(myargv[p + 1]); printf("External statistics registered.\n"); } // start the apropriate game based on parms p = M_CheckParm("-record"); if (p && p < myargc - 1) { G_RecordDemo(myargv[p + 1]); autostart = true; } p = M_CheckParm("-playdemo"); if (p && p < myargc - 1) { singledemo = true; // quit after one demo G_DeferedPlayDemo(myargv[p+1]); D_DoomLoop(); // never returns } p = M_CheckParm("-timedemo"); if (p && p < myargc - 1) { G_TimeDemo(myargv[p + 1]); D_DoomLoop(); // never returns } p = M_CheckParm("-loadgame"); if (p && p < myargc - 1) { // *** PID BEGIN *** // Make a ~/.psdoom directory for savegames, configs, etc. sprintf(file, "%s/.psdoom/"SAVEGAMENAME"%c.dsg", home, myargv[p + 1][0]); // old code: // sprintf(file, "%s/.xdoom/"SAVEGAMENAME"%c.dsg", home, // myargv[p + 1][0]); // *** PID END *** G_LoadGame(file); } if (gameaction != ga_loadgame) { if (autostart || netgame) G_InitNew(startskill, startepisode, startmap); else D_StartTitle(); // start up intro loop } D_DoomLoop(); // never returns }