1 // Emacs style mode select -*- C++ -*-
2 //-----------------------------------------------------------------------------
6 // Copyright (C) 1993-1996 by id Software, Inc.
8 // This source is available for distribution and/or modification
9 // only under the terms of the DOOM Source Code License as
10 // published by id Software. All rights reserved.
12 // The source is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
18 // Revision 1.4 2001/05/04 00:20:56 falemagn
19 // removed the AROS specific defines that broke the yesterday's nightly building
21 // Revision 1.3 2001/04/05 20:40:25 stegerg
22 // No more need for a replacement getenv() function, as getenv
23 // is now available in c lib.
25 // Revision 1.2 2001/03/28 23:13:35 bernie
26 // use putchar() instead of printf() (this fixes a missing prototype warning).
28 // Revision 1.1 2000/02/29 18:21:04 stegerg
29 // Doom port based on ADoomPPC. Read README.AROS!
33 // DOOM main program (D_DoomMain) and game loop (D_DoomLoop),
34 // plus functions to determine game mode (shareware, registered),
35 // parse command line parameters, configure game parameters (turbo),
36 // and call the startup functions.
38 //-----------------------------------------------------------------------------
41 static const char rcsid
[] = "$Id$";
43 /*#ifdef AROS --- disabled now */
45 extern int I_Exists(char *name
);
46 /* extern char *I_GetEnv(char *name); */
47 extern void I_MakeDir(char *name
);
49 #define access(name,mode) (!(I_Exists(name))) */
50 /* #define getenv(name) (I_GetEnv(name)) */
51 #define mkdir(name,b) (I_MakeDir(name))*/
53 #include <aros/debug.h>
64 #include <sys/types.h>
103 /* DeHacked Patch !!! */
104 #include "dehacked.h"
110 // Not a globally visible function,
111 // just included for source reference,
112 // called by D_DoomMain, never exits.
113 // Manages timing and IO,
114 // calls all ?_Responder, ?_Ticker, and ?_Drawer,
115 // calls I_GetTime, I_StartFrame, and I_StartTic
117 void D_DoomLoop (void);
120 char* wadfiles
[MAXWADFILES
];
123 boolean devparm
; // started game with -devparm
124 boolean nomonsters
; // checkparm of -nomonsters
125 boolean respawnparm
; // checkparm of -respawn
126 boolean fastparm
; // checkparm of -fast
127 boolean rotatemap
; // checkparm of -rotatemap
128 boolean maponhu
; // checkparm of -maponhu
132 boolean singletics
= false; // debug flag to cancel adaptiveness
136 //extern int soundVolume;
137 //extern int sfxVolume;
138 //extern int musicVolume;
140 extern boolean inhelpscreens
;
141 extern boolean maponhu
;
155 char wadfile
[1024]; // primary wad file
156 char mapdir
[1024]; // directory of development maps
157 char basedefault
[1024]; // default file
160 void D_CheckNetGame (void);
161 void D_ProcessEvents (void);
162 void G_BuildTiccmd (ticcmd_t
* cmd
);
163 void D_DoAdvanceDemo (void);
169 // Events are asynchronous inputs generally generated by the game user.
170 // Events can be discarded if no responder claims them
172 event_t events
[MAXEVENTS
];
179 // Called by the I/O functions when input is detected
181 void D_PostEvent (event_t
* ev
)
183 events
[eventhead
++] = *ev
;
184 eventhead
= (eventhead
)&(MAXEVENTS
-1);
190 // Send all the events of the given timestamp down the responder chain
192 void D_ProcessEvents (void)
196 // IF STORE DEMO, DO NOT ACCEPT INPUT
197 if ( ( gamemode
== commercial
)
198 && (W_CheckNumForName("map01")<0) )
201 for ( ; eventtail
!= eventhead
; eventtail
++, eventtail
= (eventtail
)&(MAXEVENTS
-1) )
203 ev
= &events
[eventtail
];
204 if (M_Responder (ev
))
205 continue; // menu ate the event
215 // draw current display, possibly wiping it from the previous
218 // wipegamestate can be set to -1 to force a wipe on the next draw
219 gamestate_t wipegamestate
= GS_DEMOSCREEN
;
220 extern boolean setsizeneeded
;
221 extern int showMessages
;
222 void R_ExecuteSetViewSize (void);
224 void D_Display (void)
226 static boolean maponhustate
= false;
227 static boolean viewactivestate
= false;
228 static boolean menuactivestate
= false;
229 static boolean inhelpscreensstate
= false;
230 static boolean fullscreen
= false;
231 static gamestate_t oldgamestate
= -1;
232 static int borderdrawcount
;
242 return; // for comparative timing / profiling
246 // change the view size if needed
249 R_ExecuteSetViewSize ();
250 oldgamestate
= -1; // force background redraw
254 // force redraw border if we changed maponhu type
255 if (maponhu
> 0 && maponhustate
== 0)
257 oldgamestate
= -1; // force background redraw
261 // save the current screen if about to wipe
262 if (gamestate
!= wipegamestate
)
265 wipe_StartScreen(0, 0, SCREENWIDTH
, SCREENHEIGHT
);
270 // start updating gfx in screens[0] here
273 if (gamestate
== GS_LEVEL
&& gametic
)
276 // do buffered drawing
282 /* Map On Headup Patch - CDE - 97'
286 if (wipe
|| (viewheight
!= SCREENHEIGHT
&& fullscreen
) )
288 if (inhelpscreensstate
&& !inhelpscreens
)
289 redrawsbar
= true; // just put away the help screen
290 ST_Drawer (viewheight
== SCREENHEIGHT
, redrawsbar
);
291 fullscreen
= viewheight
== SCREENHEIGHT
;
294 case GS_INTERMISSION
:
307 // draw buffered stuff to screen
310 // draw the view directly
311 if (gamestate
== GS_LEVEL
&& (!automapactive
|| maponhu
) && gametic
)
312 R_RenderPlayerView (&players
[displayplayer
]);
314 /* Map On HeadUp Patch - CDE 98' */
315 if (gamestate
== GS_LEVEL
&& automapactive
)
318 if (gamestate
== GS_LEVEL
&& gametic
)
321 // clean up border stuff
322 if (gamestate
!= oldgamestate
&& gamestate
!= GS_LEVEL
)
323 I_SetPalette (W_CacheLumpName ("PLAYPAL",PU_CACHE
), 0);
325 // see if the border needs to be initially drawn
326 if (gamestate
== GS_LEVEL
&& oldgamestate
!= GS_LEVEL
)
328 viewactivestate
= false; // view was not active
329 R_FillBackScreen (); // draw the pattern into the back screen
332 // see if the border needs to be updated to the screen
333 if (gamestate
== GS_LEVEL
&& (maponhu
|| !automapactive
) /* && scaledviewwidth != 320 */)
335 if (menuactive
|| menuactivestate
|| !viewactivestate
)
339 R_DrawViewBorder (); // erase old menu stuff
344 maponhustate
= maponhu
; // CDE'98
345 menuactivestate
= menuactive
;
346 viewactivestate
= viewactive
;
347 inhelpscreensstate
= inhelpscreens
;
348 oldgamestate
= wipegamestate
= gamestate
;
357 V_DrawPatchDirect(viewwindowx
+(scaledviewwidth
-68)/2,
358 y
,0,W_CacheLumpName ("M_PAUSE", PU_CACHE
));
362 // menus go directly to the screen
363 M_Drawer (); // menu is drawn even on top of everything
364 NetUpdate (); // send out any new accumulation
370 I_FinishUpdate (); // page flip or blit buffer
375 wipe_EndScreen(0, 0, SCREENWIDTH
, SCREENHEIGHT
);
377 wipestart
= I_GetTime () - 1;
383 nowtime
= I_GetTime ();
384 tics
= nowtime
- wipestart
;
387 done
= wipe_ScreenWipe(wipe_Melt
388 , 0, 0, SCREENWIDTH
, SCREENHEIGHT
, tics
);
391 M_Drawer (); // menu is drawn even on top of wipes
392 I_FinishUpdate (); // page flip or blit buffer
401 extern boolean demorecording
;
403 void D_DoomLoop (void)
408 if (M_CheckParm ("-debugfile"))
411 sprintf (filename
,"debug%i.txt",consoleplayer
);
412 printf ("debug output to: %s\n",filename
);
413 debugfile
= fopen (filename
,"w");
419 // frame syncronous IO operations
422 // process one or more tics
427 G_BuildTiccmd (&netcmds
[consoleplayer
][maketic
%BACKUPTICS
]);
437 TryRunTics (); // will run at least one tic
440 S_UpdateSounds (players
[consoleplayer
].mo
);// move positional sounds
442 // Update display, next frame, with current state.
447 // Sound mixing for the buffer is snychronous.
450 // Synchronous sound output is explicitly called.
452 // Update sound output.
471 // Handles timing for warped projection
473 void D_PageTicker (void)
484 void D_PageDrawer (void)
486 V_DrawPatchInDirect (0,0, 0, W_CacheLumpName(pagename
, PU_CACHE
));
492 // Called after each demo or intro demosequence finishes
494 void D_AdvanceDemo (void)
501 // This cycles through the demo sequences.
502 // FIXME - version dependend demo numbers?
504 void D_DoAdvanceDemo (void)
506 players
[consoleplayer
].playerstate
= PST_LIVE
; // not reborn
508 usergame
= false; // no save / end game here
510 gameaction
= ga_nothing
;
512 if ( gamemode
== retail
)
513 demosequence
= (demosequence
+1)%7;
515 demosequence
= (demosequence
+1)%6;
517 switch (demosequence
)
520 if ( gamemode
== commercial
)
524 gamestate
= GS_DEMOSCREEN
;
525 pagename
= "TITLEPIC";
526 if ( gamemode
== commercial
)
527 S_StartMusic(mus_dm2ttl
);
529 S_StartMusic (mus_intro
);
532 G_DeferedPlayDemo ("demo1");
536 gamestate
= GS_DEMOSCREEN
;
540 G_DeferedPlayDemo ("demo2");
543 gamestate
= GS_DEMOSCREEN
;
544 if ( gamemode
== commercial
)
547 pagename
= "TITLEPIC";
548 S_StartMusic(mus_dm2ttl
);
554 if ( gamemode
== retail
)
561 G_DeferedPlayDemo ("demo3");
563 // THE DEFINITIVE DOOM Special Edition demo
565 G_DeferedPlayDemo ("demo4");
575 void D_StartTitle (void)
577 gameaction
= ga_nothing
;
585 // print title for every printed line
593 void D_AddFile (char *file
)
598 for (numwadfiles
= 0 ; wadfiles
[numwadfiles
] ; numwadfiles
++)
601 newfile
= malloc (strlen(file
)+1);
602 strcpy (newfile
, file
);
604 wadfiles
[numwadfiles
] = newfile
;
607 #if defined DEBUGGING || defined AROS
610 #define DIRSTRING "PROGDIR:"
615 // Checks availability of IWAD files by name,
616 // to determine whether registered/commercial features
617 // should be executed (notably loading PWAD's).
619 void IdentifyVersion (void)
633 static char home
[256];
634 static char doomwaddir
[256];
636 if (getenv ("DOOMWADDIR") != NULL
) {
637 strcpy (doomwaddir
, getenv("DOOMWADDIR"));
638 if (doomwaddir
[strlen(doomwaddir
)-1] != '/' && doomwaddir
[strlen(doomwaddir
)-1] != ':')
639 strcat (doomwaddir
, "/");
641 strcpy (doomwaddir
, DIRSTRING
);
642 p
= M_CheckParm ("-waddir");
644 strcpy(doomwaddir
, myargv
[p
+1]);
645 if (doomwaddir
[strlen(doomwaddir
)-1] != '/' && doomwaddir
[strlen(doomwaddir
)-1] != ':')
646 strcat (doomwaddir
, "/");
651 doom2wad
= malloc(strlen(doomwaddir
)+1+9+1);
652 sprintf(doom2wad
, "%sdoom2.wad", doomwaddir
);
655 doomuwad
= malloc(strlen(doomwaddir
)+1+8+1);
656 sprintf(doomuwad
, "%sdoomu.wad", doomwaddir
);
659 doomwad
= malloc(strlen(doomwaddir
)+1+8+1);
660 sprintf(doomwad
, "%sdoom.wad", doomwaddir
);
663 doom1wad
= malloc(strlen(doomwaddir
)+1+9+1);
664 sprintf(doom1wad
, "%sdoom1.wad", doomwaddir
);
667 // Insufficient malloc, caused spurious realloc errors.
668 plutoniawad
= malloc(strlen(doomwaddir
)+1+/*9*/12+1);
669 sprintf(plutoniawad
, "%splutonia.wad", doomwaddir
);
671 tntwad
= malloc(strlen(doomwaddir
)+1+9+1);
672 sprintf(tntwad
, "%stnt.wad", doomwaddir
);
676 doom2fwad
= malloc(strlen(doomwaddir
)+1+10+1);
677 sprintf(doom2fwad
, "%sdoom2f.wad", doomwaddir
);
679 #if defined __SASC || defined AROS
680 if (getenv ("HOME") != NULL
) {
681 strcpy (home
, getenv("HOME"));
682 if (home
[strlen(home
)-1] != '/' && home
[strlen(home
)-1] != ':')
687 home
= getenv("HOME");
689 I_Error("Please set $HOME to your home directory");
691 sprintf(basedefault
, "%s.doomrc", home
);
694 if (M_CheckParm ("-shdev"))
696 gamemode
= shareware
;
698 D_AddFile (DEVDATA
"doom1.wad");
699 D_AddFile (DEVMAPS
"data_se/texture1.lmp");
700 D_AddFile (DEVMAPS
"data_se/pnames.lmp");
701 strcpy (basedefault
,DEVDATA
"default.cfg");
705 if (M_CheckParm ("-regdev"))
707 gamemode
= registered
;
709 D_AddFile (DEVDATA
"doom.wad");
710 D_AddFile (DEVMAPS
"data_se/texture1.lmp");
711 D_AddFile (DEVMAPS
"data_se/texture2.lmp");
712 D_AddFile (DEVMAPS
"data_se/pnames.lmp");
713 strcpy (basedefault
,DEVDATA
"default.cfg");
717 if (M_CheckParm ("-comdev"))
719 gamemode
= commercial
;
723 D_AddFile (DEVDATA"plutonia.wad");
725 D_AddFile (DEVDATA"tnt.wad");
727 D_AddFile (DEVDATA
"doom2.wad");
729 D_AddFile (DEVMAPS
"cdata/texture1.lmp");
730 D_AddFile (DEVMAPS
"cdata/pnames.lmp");
731 strcpy (basedefault
,DEVDATA
"default.cfg");
735 if ( !access (doom2fwad
,R_OK
) )
737 gamemode
= commercial
;
739 // Let's handle languages in config files, okay?
741 printf("French version\n");
742 D_AddFile (doom2fwad
);
746 if ( !access (doom2wad
,R_OK
) )
748 gamemode
= commercial
;
749 D_AddFile (doom2wad
);
753 if ( !access (plutoniawad
, R_OK
) )
755 gamemode
= commercial
;
756 D_AddFile (plutoniawad
);
760 if ( !access ( tntwad
, R_OK
) )
762 gamemode
= commercial
;
767 if ( !access (doomuwad
,R_OK
) )
770 D_AddFile (doomuwad
);
774 if ( !access (doomwad
,R_OK
) )
776 gamemode
= registered
;
781 if ( !access (doom1wad
,R_OK
) )
783 gamemode
= shareware
;
784 D_AddFile (doom1wad
);
788 printf("Game mode indeterminate.\n");
789 gamemode
= indetermined
;
791 // We don't abort. Let's see what the PWAD contains.
793 //I_Error ("Game mode indeterminate\n");
797 // Find a Response File
799 void FindResponseFile (void)
803 for (i
= 1;i
< myargc
;i
++)
804 if (myargv
[i
][0] == '@')
816 // READ THE RESPONSE FILE INTO MEMORY
817 handle
= fopen (&myargv
[i
][1],"rb");
820 printf ("\nNo such response file!");
823 printf("Found response file %s!\n",&myargv
[i
][1]);
824 fseek (handle
,0,SEEK_END
);
825 size
= ftell(handle
);
826 fseek (handle
,0,SEEK_SET
);
827 file
= malloc (size
);
828 fread (file
,size
,1,handle
);
831 // KEEP ALL CMDLINE ARGS FOLLOWING @RESPONSEFILE ARG
832 for (index
= 0,k
= i
+1; k
< myargc
; k
++)
833 moreargs
[index
++] = myargv
[k
];
835 firstargv
= myargv
[0];
836 myargv
= malloc(sizeof(char *)*MAXARGVS
);
837 memset(myargv
,0,sizeof(char *)*MAXARGVS
);
838 myargv
[0] = firstargv
;
842 indexinfile
++; // SKIP PAST ARGV[0] (KEEP IT)
845 myargv
[indexinfile
++] = infile
+k
;
847 ((*(infile
+k
)>= ' '+1) && (*(infile
+k
)<='z')))
851 ((*(infile
+k
)<= ' ') || (*(infile
+k
)>'z')))
855 for (k
= 0;k
< index
;k
++)
856 myargv
[indexinfile
++] = moreargs
[k
];
857 myargc
= indexinfile
;
860 printf("%d command-line args:\n",myargc
);
861 for (k
=1;k
<myargc
;k
++)
862 printf("%s\n",myargv
[k
]);
872 void D_DoomMain (void)
880 setbuf (stdout
, NULL
);
882 modifiedgame
= false;
884 nomonsters
= M_CheckParm ("-nomonsters");
885 respawnparm
= M_CheckParm ("-respawn");
886 fastparm
= M_CheckParm ("-fast");
887 rotatemap
= M_CheckParm ("-rotatemap");
888 devparm
= M_CheckParm ("-devparm");
889 maponhu
= (M_CheckParm ("-maponhu") != 0);
891 if (M_CheckParm ("-altdeath"))
893 else if (M_CheckParm ("-deathmatch"))
901 "The Ultimate DOOM Startup v%i.%i"
903 VERSION
/100,VERSION
%100);
908 "DOOM Shareware Startup v%i.%i"
910 VERSION
/100,VERSION
%100);
915 "DOOM Registered Startup v%i.%i"
917 VERSION
/100,VERSION
%100);
922 "DOOM 2: Hell on Earth v%i.%i"
924 VERSION
/100,VERSION
%100);
930 "DOOM 2: Plutonia Experiment v%i.%i"
932 VERSION/100,VERSION%100);
937 "DOOM 2: TNT - Evilution v%i.%i"
939 VERSION/100,VERSION%100);
945 "Public DOOM - v%i.%i"
947 VERSION
/100,VERSION
%100);
951 printf ("%s\n",title
);
956 if (M_CheckParm("-cdrom"))
960 mkdir("c:\\doomdata");
962 mkdir("c:\\doomdata",0);
964 strcpy (basedefault
,"c:/doomdata/default.cfg");
968 if ( (p
=M_CheckParm ("-turbo")) )
971 extern int forwardmove
[2];
972 extern int sidemove
[2];
975 scale
= atoi (myargv
[p
+1]);
980 printf ("turbo scale: %i%%\n",scale
);
981 forwardmove
[0] = forwardmove
[0]*scale
/100;
982 forwardmove
[1] = forwardmove
[1]*scale
/100;
983 sidemove
[0] = sidemove
[0]*scale
/100;
984 sidemove
[1] = sidemove
[1]*scale
/100;
987 // add any files specified on the command line with -file wadfile
990 // convenience hack to allow -wart e m to add a wad file
991 // prepend a tilde to the filename so wadfile will be reloadable
992 p
= M_CheckParm ("-wart");
995 myargv
[p
][4] = 'p'; // big hack, change to -warp
997 // Map name handling.
1003 sprintf (file
,"~"DEVMAPS
"E%cM%c.wad",
1004 myargv
[p
+1][0], myargv
[p
+2][0]);
1005 printf("Warping to Episode %s, Map %s.\n",
1006 myargv
[p
+1],myargv
[p
+2]);
1011 p
= atoi (myargv
[p
+1]);
1013 sprintf (file
,"~"DEVMAPS
"cdata/map0%i.wad", p
);
1015 sprintf (file
,"~"DEVMAPS
"cdata/map%i.wad", p
);
1021 p
= M_CheckParm ("-file");
1024 // the parms after p are wadfile/lump names,
1025 // until end of parms or another - preceded parm
1026 modifiedgame
= true; // homebrew levels
1027 while (++p
!= myargc
&& myargv
[p
][0] != '-')
1028 D_AddFile (myargv
[p
]);
1031 /* DeHacked Patch !! */
1032 p
= M_CheckParm ("-deh");
1035 // the parms after p are wadfile/lump names,
1036 // until end of parms or another - preceded parm
1037 //modifiedgame = true; // homebrew levels
1038 while (++p
!= myargc
&& myargv
[p
][0] != '-')
1039 DE_AddDeh(myargv
[p
]);
1042 p
= M_CheckParm ("-playdemo");
1045 p
= M_CheckParm ("-timedemo");
1047 if (p
&& p
< myargc
-1)
1049 sprintf (file
,"%s.lmp", myargv
[p
+1]);
1051 printf("Playing demo %s.lmp.\n",myargv
[p
+1]);
1054 // get skill / episode / map from parms
1055 startskill
= sk_medium
;
1061 p
= M_CheckParm ("-skill");
1062 if (p
&& p
< myargc
-1)
1064 startskill
= myargv
[p
+1][0]-'1';
1068 p
= M_CheckParm ("-episode");
1069 if (p
&& p
< myargc
-1)
1071 startepisode
= myargv
[p
+1][0]-'0';
1076 p
= M_CheckParm ("-timer");
1077 if (p
&& p
< myargc
-1 && deathmatch
)
1080 time
= atoi(myargv
[p
+1]);
1081 printf("Levels will end after %d minute",time
);
1087 p
= M_CheckParm ("-avg");
1088 if (p
&& p
< myargc
-1 && deathmatch
)
1089 printf("Austin Virtual Gaming: Levels will end after 20 minutes\n");
1091 p
= M_CheckParm ("-warp");
1092 if (p
&& p
< myargc
-1)
1094 if (gamemode
== commercial
)
1095 startmap
= atoi (myargv
[p
+1]);
1098 startepisode
= myargv
[p
+1][0]-'0';
1099 startmap
= myargv
[p
+2][0]-'0';
1105 printf ("V_Init: allocate screens.\n");
1108 printf ("M_LoadDefaults: Load system defaults.\n");
1109 M_LoadDefaults (); // load before initing other systems
1111 printf ("Z_Init: Init zone memory allocation daemon. \n");
1114 printf ("W_Init: Init WADfiles.\n");
1115 W_InitMultipleFiles (wadfiles
);
1118 // Check for -file in shareware
1121 // These are the lumps that will be checked in IWAD,
1122 // if any one is not present, execution will be aborted.
1125 "e2m1","e2m2","e2m3","e2m4","e2m5","e2m6","e2m7","e2m8","e2m9",
1126 "e3m1","e3m3","e3m3","e3m4","e3m5","e3m6","e3m7","e3m8","e3m9",
1127 "dphoof","bfgga0","heada1","cybra1","spida1d1"
1131 if ( gamemode
== shareware
)
1132 I_Error("\nYou cannot -file with the shareware "
1133 "version. Register!");
1135 // Check for fake IWAD with right name,
1136 // but w/o all the lumps of the registered version.
1137 if (gamemode
== registered
)
1138 for (i
= 0;i
< 23; i
++)
1139 if (W_CheckNumForName(name
[i
])<0)
1140 I_Error("\nThis is not the registered version.");
1143 // Iff additonal PWAD files are used, print modified banner
1147 "===========================================================================\n"
1148 "ATTENTION: This version of DOOM has been modified. If you would like to\n"
1149 "get a copy of the original game, call 1-800-IDGAMES or see the readme file.\n"
1150 " You will not receive technical support for modified games.\n"
1151 " press enter to continue\n"
1152 "===========================================================================\n"
1158 // Check and print which version is executed.
1164 "===========================================================================\n"
1166 "===========================================================================\n"
1173 "===========================================================================\n"
1174 " Commercial product - do not distribute!\n"
1175 " Please report software piracy to the SPA: 1-800-388-PIR8\n"
1176 "===========================================================================\n"
1185 printf ("M_Init: Init miscellaneous info.\n");
1188 printf ("R_Init: Init DOOM refresh daemon - ");
1191 printf ("\nP_Init: Init Playloop state.\n");
1194 printf ("I_Init: Setting up machine state.\n");
1197 printf ("D_CheckNetGame: Checking network game status.\n");
1200 printf ("S_Init: Setting up sound.\n");
1201 S_Init (snd_SfxVolume
/* *8 */, snd_MusicVolume
/* *8*/ );
1203 printf ("HU_Init: Setting up heads up display.\n");
1206 printf ("ST_Init: Init status bar.\n");
1209 // check for a driver that wants intermission stats
1210 p
= M_CheckParm ("-statcopy");
1211 if (p
&& p
<myargc
-1)
1213 // for statistics driver
1214 extern void* statcopy
;
1216 statcopy
= (void*)atoi(myargv
[p
+1]);
1217 printf ("External statistics registered.\n");
1220 // start the apropriate game based on parms
1221 p
= M_CheckParm ("-record");
1223 if (p
&& p
< myargc
-1)
1225 G_RecordDemo (myargv
[p
+1]);
1229 p
= M_CheckParm ("-playdemo");
1230 if (p
&& p
< myargc
-1)
1232 singledemo
= true; // quit after one demo
1233 G_DeferedPlayDemo (myargv
[p
+1]);
1234 D_DoomLoop (); // never returns
1237 p
= M_CheckParm ("-timedemo");
1238 if (p
&& p
< myargc
-1)
1240 G_TimeDemo (myargv
[p
+1]);
1241 D_DoomLoop (); // never returns
1244 p
= M_CheckParm ("-loadgame");
1245 if (p
&& p
< myargc
-1)
1247 if (M_CheckParm("-cdrom"))
1248 sprintf(file
, "c:\\doomdata\\"SAVEGAMENAME
"%c.dsg",myargv
[p
+1][0]);
1250 sprintf(file
, SAVEGAMENAME
"%c.dsg",myargv
[p
+1][0]);
1255 if ( gameaction
!= ga_loadgame
)
1257 if (autostart
|| netgame
)
1258 G_InitNew (startskill
, startepisode
, startmap
);
1260 D_StartTitle (); // start up intro loop
1263 D_DoomLoop (); // never returns