diff options
author | Simon Howard | 2011-02-12 18:42:10 +0000 |
---|---|---|
committer | Simon Howard | 2011-02-12 18:42:10 +0000 |
commit | 516a7028994df6718289a7e3db4d07a45c95466b (patch) | |
tree | cf974cb4bd38b8e9d0101a41263b42b8c87e96c7 /src/doom/d_main.c | |
parent | a15ba75736d15409876c1f0a44fffc99adf1c192 (diff) | |
parent | a9996b41e954d85fde5ec5188bbf6a7f4df88011 (diff) | |
download | chocolate-doom-516a7028994df6718289a7e3db4d07a45c95466b.tar.gz chocolate-doom-516a7028994df6718289a7e3db4d07a45c95466b.tar.bz2 chocolate-doom-516a7028994df6718289a7e3db4d07a45c95466b.zip |
Merge from raven-branch. FEATURE_MULTIPLAYER has been disabled
temporarily until the netgame changes on raven-branch are finished.
Subversion-branch: /branches/strife-branch
Subversion-revision: 2259
Diffstat (limited to 'src/doom/d_main.c')
-rw-r--r-- | src/doom/d_main.c | 191 |
1 files changed, 117 insertions, 74 deletions
diff --git a/src/doom/d_main.c b/src/doom/d_main.c index f3a4b037..2f116f1e 100644 --- a/src/doom/d_main.c +++ b/src/doom/d_main.c @@ -122,8 +122,6 @@ int startmap; boolean autostart; int startloadgame; -FILE* debugfile; - boolean advancedemo; // Store demo, do not accept any inputs @@ -424,14 +422,6 @@ void D_DoomLoop (void) if (demorecording) G_BeginRecording (); - if (M_CheckParm ("-debugfile")) - { - char filename[20]; - sprintf (filename,"debug%i.txt",consoleplayer); - printf ("debug output to: %s\n",filename); - debugfile = fopen (filename,"w"); - } - TryRunTics(); I_SetWindowTitle(gamedescription); @@ -457,9 +447,12 @@ void D_DoomLoop (void) // process one or more tics if (singletics) { + static ticcmd_t cmds[MAXPLAYERS]; + I_StartTic (); D_ProcessEvents (); - G_BuildTiccmd (&netcmds[consoleplayer][maketic%BACKUPTICS]); + netcmds = cmds; + G_BuildTiccmd(&cmds[consoleplayer]); if (advancedemo) D_DoAdvanceDemo (); M_Ticker (); @@ -533,7 +526,13 @@ void D_DoAdvanceDemo (void) paused = false; gameaction = ga_nothing; - if (gamemode == retail && gameversion != exe_chex) + // The Ultimate Doom executable changed the demo sequence to add + // a DEMO4 demo. Final Doom was based on Ultimate, so also + // includes this change; however, the Final Doom IWADs do not + // include a DEMO4 lump, so the game bombs out with an error + // when it reaches this point in the demo sequence. + + if (gameversion == exe_ultimate || gameversion == exe_final) demosequence = (demosequence+1)%7; else demosequence = (demosequence+1)%6; @@ -608,8 +607,12 @@ void D_StartTitle (void) // These are from the original source: some of them are perhaps // not used in any dehacked patches -static char *banners[] = +static char *banners[] = { + // doom2.wad + " " + "DOOM 2: Hell on Earth v%i.%i" + " ", // doom1.wad " " "DOOM Shareware Startup v%i.%i" @@ -626,10 +629,6 @@ static char *banners[] = " " "The Ultimate DOOM Startup v%i.%i" " ", - // doom2.wad - " " - "DOOM 2: Hell on Earth v%i.%i" - " ", // tnt.wad " " "DOOM 2: TNT - Evilution v%i.%i" @@ -830,6 +829,18 @@ static boolean CheckChex(char *iwadname) chex_iwadname)); } +// Check if the IWAD file is the Hacx IWAD. +// Returns true if this is hacx.wad. + +static boolean CheckHacx(char *iwadname) +{ + char *hacx_iwadname = "hacx.wad"; + + return (strlen(iwadname) > strlen(hacx_iwadname) + && !strcasecmp(iwadname + strlen(iwadname) - strlen(hacx_iwadname), + hacx_iwadname)); +} + // print title for every printed line char title[128]; @@ -900,6 +911,7 @@ static struct GameVersion_t version; } gameversions[] = { {"Doom 1.9", "1.9", exe_doom_1_9}, + {"Hacx", "hacx", exe_hacx}, {"Ultimate Doom", "ultimate", exe_ultimate}, {"Final Doom", "final", exe_final}, {"Chex Quest", "chex", exe_chex}, @@ -921,9 +933,9 @@ static void InitGameVersion(void) // "ultimate" and "final". // - p = M_CheckParm("-gameversion"); + p = M_CheckParmWithArgs("-gameversion", 1); - if (p > 0) + if (p) { for (i=0; gameversions[i].description != NULL; ++i) { @@ -957,6 +969,12 @@ static void InitGameVersion(void) gameversion = exe_chex; } + else if (CheckHacx(iwadfile)) + { + // hacx exe: identified by iwad filename + + gameversion = exe_hacx; + } else if (gamemode == shareware || gamemode == registered) { // original @@ -1057,6 +1075,20 @@ static void D_Endoom(void) I_Endoom(endoom); } +static void LoadHacxDeh(void) +{ + // If this is the HACX IWAD, we need to load the DEHACKED lump. + + if (gameversion == exe_hacx) + { + if (!DEH_LoadLumpByName("DEHACKED")) + { + I_Error("DEHACKED lump not found. Please check that this is the " + "Hacx v1.2 IWAD."); + } + } +} + // // D_DoomMain // @@ -1094,6 +1126,21 @@ void D_DoomMain (void) } //! + // @category net + // + // Query the Internet master server for a global list of active + // servers. + // + + if (M_CheckParm("-search")) + { + printf("\nSearching for servers on Internet ...\n"); + p = NET_MasterQuery(NET_QueryPrintCallback, NULL); + printf("\n%i server(s) found.\n", p); + exit(0); + } + + //! // @arg <address> // @category net // @@ -1101,11 +1148,12 @@ void D_DoomMain (void) // address. // - p = M_CheckParm("-query"); + p = M_CheckParmWithArgs("-query", 1); - if (p > 0) + if (p) { NET_QueryAddress(myargv[p+1]); + exit(0); } //! @@ -1114,8 +1162,13 @@ void D_DoomMain (void) // Search the local LAN for running servers. // - if (M_CheckParm("-search")) - NET_LANQuery(); + if (M_CheckParm("-localsearch")) + { + printf("\nSearching for servers on local LAN ...\n"); + p = NET_LANQuery(NET_QueryPrintCallback, NULL); + printf("\n%i server(s) found.\n", p); + exit(0); + } #endif @@ -1265,40 +1318,32 @@ void D_DoomMain (void) D_AddFile(iwadfile); modifiedgame = W_ParseCommandLine(); - // add any files specified on the command line with -file wadfile - // to the wad list + //! + // @arg <files> + // @vanilla // - // 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"); + // Load the specified PWAD files. + // + + p = M_CheckParmWithArgs("-file", 1); if (p) { - myargv[p][4] = 'p'; // big hack, change to -warp + // 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] != '-') + { + char *filename; - // 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); + filename = D_TryFindWADByName(myargv[p]); + + D_AddFile(filename); + } } + // Debug: +// W_PrintDirectory(); + //! // @arg <demo> // @category demo @@ -1307,7 +1352,7 @@ void D_DoomMain (void) // Play back the demo named demo.lmp. // - p = M_CheckParm ("-playdemo"); + p = M_CheckParmWithArgs ("-playdemo", 1); if (!p) { @@ -1319,11 +1364,11 @@ void D_DoomMain (void) // Play back the demo named demo.lmp, determining the framerate // of the screen. // - p = M_CheckParm ("-timedemo"); + p = M_CheckParmWithArgs("-timedemo", 1); } - if (p && p < myargc-1) + if (p) { if (!strcasecmp(myargv[p+1] + strlen(myargv[p+1]) - 4, ".lmp")) { @@ -1362,6 +1407,7 @@ void D_DoomMain (void) D_IdentifyVersion(); InitGameVersion(); LoadChexDeh(); + LoadHacxDeh(); D_SetGameDescription(); SetSaveGameDir(iwadfile); @@ -1404,9 +1450,9 @@ void D_DoomMain (void) // 0 disables all monsters. // - p = M_CheckParm ("-skill"); + p = M_CheckParmWithArgs("-skill", 1); - if (p && p < myargc-1) + if (p) { startskill = myargv[p+1][0]-'1'; autostart = true; @@ -1419,9 +1465,9 @@ void D_DoomMain (void) // Start playing on episode n (1-4) // - p = M_CheckParm ("-episode"); + p = M_CheckParmWithArgs("-episode", 1); - if (p && p < myargc-1) + if (p) { startepisode = myargv[p+1][0]-'0'; startmap = 1; @@ -1438,12 +1484,11 @@ void D_DoomMain (void) // For multiplayer games: exit each level after n minutes. // - p = M_CheckParm ("-timer"); + p = M_CheckParmWithArgs("-timer", 1); - if (p && p < myargc-1 && deathmatch) + if (p) { timelimit = atoi(myargv[p+1]); - printf("timer: %i\n", timelimit); } //! @@ -1455,10 +1500,8 @@ void D_DoomMain (void) p = M_CheckParm ("-avg"); - if (p && p < myargc-1 && deathmatch) + if (p) { - DEH_printf("Austin Virtual Gaming: Levels will end " - "after 20 minutes\n"); timelimit = 20; } @@ -1470,9 +1513,9 @@ void D_DoomMain (void) // (Doom 2) // - p = M_CheckParm ("-warp"); + p = M_CheckParmWithArgs("-warp", 1); - if (p && p < myargc-1) + if (p) { if (gamemode == commercial) startmap = atoi (myargv[p+1]); @@ -1516,9 +1559,9 @@ void D_DoomMain (void) // Load the game in slot s. // - p = M_CheckParm ("-loadgame"); + p = M_CheckParmWithArgs("-loadgame", 1); - if (p && p < myargc-1) + if (p) { startloadgame = atoi(myargv[p+1]); } @@ -1588,24 +1631,24 @@ void D_DoomMain (void) // Record a demo named x.lmp. // - p = M_CheckParm ("-record"); + p = M_CheckParmWithArgs("-record", 1); - if (p && p < myargc-1) + if (p) { G_RecordDemo (myargv[p+1]); autostart = true; } - p = M_CheckParm ("-playdemo"); - if (p && p < myargc-1) + p = M_CheckParmWithArgs("-playdemo", 1); + if (p) { singledemo = true; // quit after one demo G_DeferedPlayDemo (demolumpname); D_DoomLoop (); // never returns } - p = M_CheckParm ("-timedemo"); - if (p && p < myargc-1) + p = M_CheckParmWithArgs("-timedemo", 1); + if (p) { G_TimeDemo (demolumpname); D_DoomLoop (); // never returns |