// // 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 }
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_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 }
void main(void) { int p; // // set network characteristics // doomcom.ticdup = 1; doomcom.extratics = 0; doomcom.numnodes = 2; doomcom.numplayers = 2; doomcom.drone = 0; printf("\n" "---------------------------------\n" #ifdef DOOM2 STR_DOOMSERIAL"\n" #else "DOOM SERIAL DEVICE DRIVER v1.4\n" #endif "---------------------------------\n"); myargc = _argc; myargv = _argv; FindResponseFile(); // // allow override of automatic player ordering to allow a slower computer // to be set as player 1 allways // // // establish communications // baudbits = 0x08; // default to 9600 if not specified on cmd line // or in modem.cfg if (CheckParm ("-dial") || CheckParm ("-answer") ) ReadModemCfg (); // may set baudbits // // allow command-line override of modem.cfg baud rate // if (CheckParm ("-9600")) baudbits = 0x0c; else if (CheckParm ("-14400")) baudbits = 0x08; else if (CheckParm ("-19200")) baudbits = 0x06; else if (CheckParm ("-38400")) baudbits = 0x03; else if (CheckParm ("-57600")) baudbits = 0x02; else if (CheckParm ("-115200")) baudbits = 0x01; InitPort (); if (CheckParm ("-dial")) Dial (); else if (CheckParm ("-answer")) Answer (); Connect (); // // launch DOOM // LaunchDOOM (); Error (NULL); }