2007-01-28 05:53:06 +03:00
|
|
|
// Emacs style mode select -*- C++ -*-
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// $Id:$
|
|
|
|
//
|
|
|
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
|
|
//
|
|
|
|
// This source is available for distribution and/or modification
|
|
|
|
// only under the terms of the DOOM Source Code License as
|
|
|
|
// published by id Software. All rights reserved.
|
|
|
|
//
|
|
|
|
// The source is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
// $Log:$
|
|
|
|
//
|
|
|
|
// DESCRIPTION:
|
2007-02-09 01:53:29 +03:00
|
|
|
// DOOM main program (D_DoomMain) and game loop (D_DoomLoop),
|
|
|
|
// plus functions to determine game mode (shareware, registered),
|
|
|
|
// parse command line parameters, configure game parameters (turbo),
|
|
|
|
// and call the startup functions.
|
2007-01-28 05:53:06 +03:00
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
static const char rcsid[] = "$Id: d_main.c,v 1.8 1997/02/03 22:45:09 b1 Exp $";
|
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
#define BGCOLOR 7
|
|
|
|
#define FGCOLOR 8
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
#define R_OK 4
|
|
|
|
|
2007-01-28 05:53:06 +03:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#include "doomdef.h"
|
|
|
|
#include "doomstat.h"
|
|
|
|
|
|
|
|
#include "dstrings.h"
|
|
|
|
#include "sounds.h"
|
|
|
|
|
|
|
|
#include "z_zone.h"
|
|
|
|
#include "w_wad.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "v_video.h"
|
|
|
|
|
|
|
|
#include "f_finale.h"
|
|
|
|
#include "f_wipe.h"
|
|
|
|
|
|
|
|
#include "m_argv.h"
|
|
|
|
#include "m_misc.h"
|
|
|
|
#include "m_menu.h"
|
|
|
|
|
|
|
|
#include "i_system.h"
|
|
|
|
#include "i_sound.h"
|
|
|
|
#include "i_video.h"
|
|
|
|
|
|
|
|
#include "g_game.h"
|
|
|
|
|
|
|
|
#include "hu_stuff.h"
|
|
|
|
#include "wi_stuff.h"
|
|
|
|
#include "st_stuff.h"
|
|
|
|
#include "am_map.h"
|
|
|
|
|
|
|
|
#include "p_setup.h"
|
|
|
|
#include "r_local.h"
|
|
|
|
|
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
|
2007-01-28 05:53:06 +03:00
|
|
|
#include "d_main.h"
|
2007-02-09 01:53:29 +03:00
|
|
|
//#include "kolibri.h"
|
|
|
|
|
|
|
|
|
|
|
|
extern int access(char *file, int mode);
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
//
|
|
|
|
// D-DoomLoop()
|
|
|
|
// Not a globally visible function,
|
|
|
|
// just included for source reference,
|
|
|
|
// called by D_DoomMain, never exits.
|
|
|
|
// Manages timing and IO,
|
|
|
|
// calls all ?_Responder, ?_Ticker, and ?_Drawer,
|
|
|
|
// calls I_GetTime, I_StartFrame, and I_StartTic
|
|
|
|
//
|
|
|
|
void D_DoomLoop (void);
|
|
|
|
|
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
char* wadfiles[MAXWADFILES];
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
boolean devparm; // started game with -devparm
|
|
|
|
boolean nomonsters; // checkparm of -nomonsters
|
|
|
|
boolean respawnparm; // checkparm of -respawn
|
|
|
|
boolean fastparm; // checkparm of -fast
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
boolean drone;
|
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
boolean singletics = false; // debug flag to cancel adaptiveness
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//extern int soundVolume;
|
2007-02-09 01:53:29 +03:00
|
|
|
//extern int sfxVolume;
|
|
|
|
//extern int musicVolume;
|
2007-01-28 05:53:06 +03:00
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
extern boolean inhelpscreens;
|
2007-01-28 05:53:06 +03:00
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
skill_t startskill;
|
2007-01-28 05:53:06 +03:00
|
|
|
int startepisode;
|
2007-02-09 01:53:29 +03:00
|
|
|
int startmap;
|
|
|
|
boolean autostart;
|
2007-01-28 05:53:06 +03:00
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
FILE* debugfile;
|
2007-01-28 05:53:06 +03:00
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
boolean advancedemo;
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
char wadfile[1024]; // primary wad file
|
|
|
|
char mapdir[1024]; // directory of development maps
|
|
|
|
char basedefault[1024]; // default file
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
|
|
|
|
void D_CheckNetGame (void);
|
|
|
|
void D_ProcessEvents (void);
|
|
|
|
void G_BuildTiccmd (ticcmd_t* cmd);
|
|
|
|
void D_DoAdvanceDemo (void);
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// EVENT HANDLING
|
|
|
|
//
|
|
|
|
// Events are asynchronous inputs generally generated by the game user.
|
|
|
|
// Events can be discarded if no responder claims them
|
|
|
|
//
|
|
|
|
event_t events[MAXEVENTS];
|
|
|
|
int eventhead;
|
2007-02-09 01:53:29 +03:00
|
|
|
int eventtail;
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// D_PostEvent
|
|
|
|
// Called by the I/O functions when input is detected
|
|
|
|
//
|
|
|
|
void D_PostEvent (event_t* ev)
|
|
|
|
{
|
|
|
|
events[eventhead] = *ev;
|
|
|
|
eventhead = (++eventhead)&(MAXEVENTS-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// D_ProcessEvents
|
|
|
|
// Send all the events of the given timestamp down the responder chain
|
|
|
|
//
|
|
|
|
void D_ProcessEvents (void)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
event_t* ev;
|
|
|
|
|
2007-01-28 05:53:06 +03:00
|
|
|
// IF STORE DEMO, DO NOT ACCEPT INPUT
|
|
|
|
if ( ( gamemode == commercial )
|
2007-02-09 01:53:29 +03:00
|
|
|
&& (W_CheckNumForName("map01")<0) )
|
2007-01-28 05:53:06 +03:00
|
|
|
return;
|
2007-02-09 01:53:29 +03:00
|
|
|
|
2007-01-28 05:53:06 +03:00
|
|
|
for ( ; eventtail != eventhead ; eventtail = (++eventtail)&(MAXEVENTS-1) )
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
ev = &events[eventtail];
|
|
|
|
if (M_Responder (ev))
|
|
|
|
continue; // menu ate the event
|
|
|
|
G_Responder (ev);
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// D_Display
|
|
|
|
// draw current display, possibly wiping it from the previous
|
|
|
|
//
|
|
|
|
|
|
|
|
// wipegamestate can be set to -1 to force a wipe on the next draw
|
|
|
|
gamestate_t wipegamestate = GS_DEMOSCREEN;
|
|
|
|
extern boolean setsizeneeded;
|
|
|
|
extern int showMessages;
|
|
|
|
void R_ExecuteSetViewSize (void);
|
|
|
|
|
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
// #define XXX(n) __libclog_printf("d_main.c: %u\n",n)
|
2007-01-28 05:53:06 +03:00
|
|
|
#define XXX(n)
|
|
|
|
|
|
|
|
void D_Display (void)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
static boolean viewactivestate = false;
|
|
|
|
static boolean menuactivestate = false;
|
|
|
|
static boolean inhelpscreensstate = false;
|
|
|
|
static boolean fullscreen = false;
|
|
|
|
static gamestate_t oldgamestate = -1;
|
|
|
|
static int borderdrawcount;
|
|
|
|
int nowtime;
|
|
|
|
int tics;
|
|
|
|
int wipestart;
|
|
|
|
int y;
|
|
|
|
boolean done;
|
|
|
|
boolean wipe;
|
|
|
|
boolean redrawsbar;
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
if (nodrawers)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(0);
|
|
|
|
return; // for comparative timing / profiling
|
|
|
|
}
|
2007-01-28 05:53:06 +03:00
|
|
|
redrawsbar = false;
|
|
|
|
|
|
|
|
// change the view size if needed
|
|
|
|
if (setsizeneeded)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(1);
|
|
|
|
R_ExecuteSetViewSize ();
|
|
|
|
XXX(2);
|
|
|
|
oldgamestate = -1; // force background redraw
|
|
|
|
borderdrawcount = 3;
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// save the current screen if about to wipe
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(3);
|
2007-01-28 05:53:06 +03:00
|
|
|
if (gamestate != wipegamestate)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
wipe = true;
|
|
|
|
wipe_StartScreen(0, 0, SCREENWIDTH, SCREENHEIGHT);
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
else
|
2007-02-09 01:53:29 +03:00
|
|
|
wipe = false;
|
|
|
|
XXX(6);
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
if (gamestate == GS_LEVEL && gametic)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
HU_Erase();
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
// do buffered drawing
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(9);
|
2007-01-28 05:53:06 +03:00
|
|
|
switch (gamestate)
|
|
|
|
{
|
|
|
|
case GS_LEVEL:
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(10);
|
|
|
|
if (!gametic)
|
|
|
|
break;
|
|
|
|
if (automapactive)
|
|
|
|
AM_Drawer ();
|
|
|
|
if (wipe || (viewheight != 200 && fullscreen) )
|
|
|
|
redrawsbar = true;
|
|
|
|
if (inhelpscreensstate && !inhelpscreens)
|
|
|
|
redrawsbar = true; // just put away the help screen
|
|
|
|
ST_Drawer (viewheight == 200, redrawsbar );
|
|
|
|
fullscreen = viewheight == 200;
|
|
|
|
break;
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
case GS_INTERMISSION:
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(11);
|
|
|
|
WI_Drawer ();
|
|
|
|
break;
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
case GS_FINALE:
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(12);
|
|
|
|
F_Drawer ();
|
|
|
|
break;
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
case GS_DEMOSCREEN:
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(13);
|
|
|
|
D_PageDrawer ();
|
|
|
|
XXX(14);
|
|
|
|
break;
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// draw buffered stuff to screen
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(15);
|
2007-01-28 05:53:06 +03:00
|
|
|
I_UpdateNoBlit ();
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(16);
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
// draw the view directly
|
|
|
|
if (gamestate == GS_LEVEL && !automapactive && gametic)
|
2007-02-09 01:53:29 +03:00
|
|
|
R_RenderPlayerView (&players[displayplayer]);
|
|
|
|
XXX(17);
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
if (gamestate == GS_LEVEL && gametic)
|
2007-02-09 01:53:29 +03:00
|
|
|
HU_Drawer ();
|
|
|
|
XXX(18);
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
// clean up border stuff
|
|
|
|
if (gamestate != oldgamestate && gamestate != GS_LEVEL)
|
2007-02-09 01:53:29 +03:00
|
|
|
I_SetPalette (W_CacheLumpName ("PLAYPAL",PU_CACHE));
|
|
|
|
XXX(19);
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
// see if the border needs to be initially drawn
|
|
|
|
if (gamestate == GS_LEVEL && oldgamestate != GS_LEVEL)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(20);
|
|
|
|
viewactivestate = false; // view was not active
|
|
|
|
R_FillBackScreen (); // draw the pattern into the back screen
|
|
|
|
XXX(21);
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(22);
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
// see if the border needs to be updated to the screen
|
|
|
|
if (gamestate == GS_LEVEL && !automapactive && scaledviewwidth != 320)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(23);
|
|
|
|
if (menuactive || menuactivestate || !viewactivestate)
|
|
|
|
borderdrawcount = 3;
|
|
|
|
if (borderdrawcount)
|
|
|
|
{
|
|
|
|
XXX(24);
|
|
|
|
R_DrawViewBorder (); // erase old menu stuff
|
|
|
|
XXX(25);
|
|
|
|
borderdrawcount--;
|
|
|
|
}
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
}
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(26);
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
menuactivestate = menuactive;
|
|
|
|
viewactivestate = viewactive;
|
|
|
|
inhelpscreensstate = inhelpscreens;
|
|
|
|
oldgamestate = wipegamestate = gamestate;
|
|
|
|
|
|
|
|
// draw pause pic
|
|
|
|
if (paused)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
if (automapactive)
|
|
|
|
y = 4;
|
|
|
|
else
|
|
|
|
y = viewwindowy+4;
|
|
|
|
V_DrawPatchDirect(viewwindowx+(scaledviewwidth-68)/2,
|
|
|
|
y,0,W_CacheLumpName ("M_PAUSE", PU_CACHE));
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// menus go directly to the screen
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(27);
|
2007-01-28 05:53:06 +03:00
|
|
|
M_Drawer (); // menu is drawn even on top of everything
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(28);
|
2007-01-28 05:53:06 +03:00
|
|
|
NetUpdate (); // send out any new accumulation
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(29);
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
|
|
|
|
// normal update
|
|
|
|
if (!wipe)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(30);
|
|
|
|
I_FinishUpdate (); // page flip or blit buffer
|
|
|
|
XXX(31);
|
|
|
|
return;
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(32);
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
// wipe update
|
|
|
|
wipe_EndScreen(0, 0, SCREENWIDTH, SCREENHEIGHT);
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(33);
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
wipestart = I_GetTime () - 1;
|
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(34);
|
2007-01-28 05:53:06 +03:00
|
|
|
do
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
do
|
|
|
|
{
|
|
|
|
nowtime = I_GetTime ();
|
|
|
|
tics = nowtime - wipestart;
|
|
|
|
} while (!tics);
|
|
|
|
wipestart = nowtime;
|
|
|
|
XXX(35);
|
|
|
|
done = wipe_ScreenWipe(wipe_Melt
|
|
|
|
, 0, 0, SCREENWIDTH, SCREENHEIGHT, tics);
|
|
|
|
XXX(36);
|
|
|
|
I_UpdateNoBlit ();
|
|
|
|
XXX(37);
|
|
|
|
M_Drawer (); // menu is drawn even on top of wipes
|
|
|
|
XXX(38);
|
|
|
|
I_FinishUpdate (); // page flip or blit buffer
|
|
|
|
XXX(39);
|
2007-01-28 05:53:06 +03:00
|
|
|
} while (!done);
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(40);
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// D_DoomLoop
|
|
|
|
//
|
|
|
|
extern boolean demorecording;
|
|
|
|
|
|
|
|
void D_DoomLoop (void)
|
|
|
|
{
|
|
|
|
if (demorecording)
|
2007-02-09 01:53:29 +03:00
|
|
|
G_BeginRecording ();
|
|
|
|
|
2007-01-28 05:53:06 +03:00
|
|
|
if (M_CheckParm ("-debugfile"))
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
char filename[32];
|
|
|
|
sprintf (filename,"debug%i.txt",consoleplayer);
|
|
|
|
debugfile = fopen (filename,"w");
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
2007-02-09 01:53:29 +03:00
|
|
|
|
2007-01-28 05:53:06 +03:00
|
|
|
I_InitGraphics ();
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
// frame syncronous IO operations
|
|
|
|
XXX(100);
|
|
|
|
I_StartFrame ();
|
|
|
|
XXX(101);
|
|
|
|
|
|
|
|
// process one or more tics
|
|
|
|
if (singletics)
|
|
|
|
{
|
|
|
|
I_StartTic ();
|
|
|
|
|
|
|
|
D_ProcessEvents ();
|
|
|
|
|
|
|
|
G_BuildTiccmd (&netcmds[consoleplayer][maketic%BACKUPTICS]);
|
|
|
|
|
|
|
|
if (advancedemo)
|
|
|
|
{
|
|
|
|
D_DoAdvanceDemo ();
|
|
|
|
};
|
|
|
|
M_Ticker ();
|
|
|
|
G_Ticker ();
|
|
|
|
gametic++;
|
|
|
|
maketic++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
TryRunTics (); // will run at least one tic
|
|
|
|
|
|
|
|
S_UpdateSounds (players[consoleplayer].mo);// move positional sounds
|
|
|
|
|
|
|
|
D_Display ();
|
2007-02-25 12:21:19 +03:00
|
|
|
// I_UpdateSound();
|
2007-02-09 01:53:29 +03:00
|
|
|
XXX(105);
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// DEMO LOOP
|
|
|
|
//
|
|
|
|
int demosequence;
|
|
|
|
int pagetic;
|
|
|
|
char *pagename;
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// D_PageTicker
|
|
|
|
// Handles timing for warped projection
|
|
|
|
//
|
|
|
|
void D_PageTicker (void)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
if (--pagetic < 0)
|
|
|
|
D_AdvanceDemo ();
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// D_PageDrawer
|
|
|
|
//
|
|
|
|
void D_PageDrawer (void)
|
|
|
|
{
|
|
|
|
V_DrawPatch (0,0, 0, W_CacheLumpName(pagename, PU_CACHE));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// D_AdvanceDemo
|
|
|
|
// Called after each demo or intro demosequence finishes
|
|
|
|
//
|
|
|
|
void D_AdvanceDemo (void)
|
|
|
|
{
|
|
|
|
advancedemo = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// This cycles through the demo sequences.
|
|
|
|
// FIXME - version dependend demo numbers?
|
|
|
|
//
|
|
|
|
void D_DoAdvanceDemo (void)
|
|
|
|
{
|
|
|
|
players[consoleplayer].playerstate = PST_LIVE; // not reborn
|
|
|
|
advancedemo = false;
|
|
|
|
usergame = false; // no save / end game here
|
|
|
|
paused = false;
|
|
|
|
gameaction = ga_nothing;
|
|
|
|
|
|
|
|
if ( gamemode == retail )
|
|
|
|
demosequence = (demosequence+1)%7;
|
|
|
|
else
|
|
|
|
demosequence = (demosequence+1)%6;
|
|
|
|
|
|
|
|
switch (demosequence)
|
|
|
|
{
|
|
|
|
case 0:
|
2007-02-09 01:53:29 +03:00
|
|
|
if ( gamemode == commercial )
|
|
|
|
pagetic = 35 * 11;
|
|
|
|
else
|
|
|
|
pagetic = 170;
|
|
|
|
gamestate = GS_DEMOSCREEN;
|
|
|
|
pagename = "TITLEPIC";
|
|
|
|
// if ( gamemode == commercial )
|
|
|
|
// S_StartMusic(mus_dm2ttl);
|
|
|
|
// else
|
|
|
|
// S_StartMusic (mus_intro);
|
|
|
|
break;
|
2007-01-28 05:53:06 +03:00
|
|
|
case 1:
|
2007-02-09 01:53:29 +03:00
|
|
|
G_DeferedPlayDemo ("demo1");
|
|
|
|
break;
|
2007-01-28 05:53:06 +03:00
|
|
|
case 2:
|
2007-02-09 01:53:29 +03:00
|
|
|
pagetic = 200;
|
|
|
|
gamestate = GS_DEMOSCREEN;
|
|
|
|
pagename = "CREDIT";
|
|
|
|
break;
|
2007-01-28 05:53:06 +03:00
|
|
|
case 3:
|
2007-02-09 01:53:29 +03:00
|
|
|
G_DeferedPlayDemo ("demo2");
|
|
|
|
break;
|
2007-01-28 05:53:06 +03:00
|
|
|
case 4:
|
2007-02-09 01:53:29 +03:00
|
|
|
gamestate = GS_DEMOSCREEN;
|
|
|
|
if ( gamemode == commercial)
|
|
|
|
{
|
|
|
|
pagetic = 35 * 11;
|
|
|
|
pagename = "TITLEPIC";
|
|
|
|
// S_StartMusic(mus_dm2ttl);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pagetic = 200;
|
|
|
|
|
|
|
|
if ( gamemode == retail )
|
|
|
|
pagename = "CREDIT";
|
|
|
|
else
|
|
|
|
pagename = "HELP2";
|
|
|
|
}
|
|
|
|
break;
|
2007-01-28 05:53:06 +03:00
|
|
|
case 5:
|
2007-02-09 01:53:29 +03:00
|
|
|
G_DeferedPlayDemo ("demo3");
|
|
|
|
break;
|
2007-01-28 05:53:06 +03:00
|
|
|
// THE DEFINITIVE DOOM Special Edition demo
|
|
|
|
case 6:
|
2007-02-09 01:53:29 +03:00
|
|
|
G_DeferedPlayDemo ("demo4");
|
|
|
|
break;
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// D_StartTitle
|
|
|
|
//
|
|
|
|
void D_StartTitle (void)
|
|
|
|
{
|
|
|
|
gameaction = ga_nothing;
|
|
|
|
demosequence = -1;
|
|
|
|
D_AdvanceDemo ();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// print title for every printed line
|
|
|
|
char title[128];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// D_AddFile
|
|
|
|
//
|
|
|
|
void D_AddFile (char *file)
|
|
|
|
{
|
|
|
|
int numwadfiles;
|
|
|
|
char *newfile;
|
2007-02-09 01:53:29 +03:00
|
|
|
|
2007-01-28 05:53:06 +03:00
|
|
|
for (numwadfiles = 0 ; wadfiles[numwadfiles] ; numwadfiles++)
|
2007-02-09 01:53:29 +03:00
|
|
|
;
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
newfile = malloc (strlen(file)+1);
|
|
|
|
strcpy (newfile, file);
|
2007-02-09 01:53:29 +03:00
|
|
|
|
2007-01-28 05:53:06 +03:00
|
|
|
wadfiles[numwadfiles] = newfile;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// IdentifyVersion
|
|
|
|
// Checks availability of IWAD files by name,
|
|
|
|
// to determine whether registered/commercial features
|
|
|
|
// should be executed (notably loading PWAD's).
|
|
|
|
//
|
|
|
|
void IdentifyVersion (void)
|
|
|
|
{
|
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
char* doom1wad;
|
|
|
|
char* doomwad;
|
|
|
|
char* doomuwad;
|
|
|
|
char* doom2wad;
|
2007-01-28 05:53:06 +03:00
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
char* doom2fwad;
|
|
|
|
char* plutoniawad;
|
|
|
|
char* tntwad;
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
char *home;
|
|
|
|
char *doomwaddir;
|
2007-01-29 23:02:19 +03:00
|
|
|
// doomwaddir = getenv("DOOMWADDIR");
|
|
|
|
// if (!doomwaddir)
|
2007-02-09 01:53:29 +03:00
|
|
|
doomwaddir = ".";
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
// Commercial.
|
|
|
|
doom2wad = malloc(strlen(doomwaddir)+1+9+1);
|
|
|
|
sprintf(doom2wad, "%s/doom2.wad", doomwaddir);
|
|
|
|
// Retail.
|
|
|
|
doomuwad = malloc(strlen(doomwaddir)+1+8+1);
|
|
|
|
sprintf(doomuwad, "%s/doomu.wad", doomwaddir);
|
|
|
|
|
|
|
|
// Registered.
|
|
|
|
doomwad = malloc(strlen(doomwaddir)+1+8+1);
|
|
|
|
sprintf(doomwad, "%s/doom.wad", doomwaddir);
|
|
|
|
|
|
|
|
// Shareware.
|
|
|
|
doom1wad = malloc(strlen(doomwaddir)+1+9+1);
|
|
|
|
sprintf(doom1wad, "%s/doom1.wad", doomwaddir);
|
|
|
|
|
|
|
|
// Bug, dear Shawn.
|
|
|
|
// Insufficient malloc, caused spurious realloc errors.
|
|
|
|
plutoniawad = malloc(strlen(doomwaddir)+1+/*9*/12+1);
|
2007-02-09 01:53:29 +03:00
|
|
|
sprintf(plutoniawad, "%splutonia.wad", doomwaddir);
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
tntwad = malloc(strlen(doomwaddir)+1+9+1);
|
|
|
|
sprintf(tntwad, "%s/tnt.wad", doomwaddir);
|
|
|
|
|
|
|
|
// French stuff.
|
|
|
|
doom2fwad = malloc(strlen(doomwaddir)+1+10+1);
|
|
|
|
sprintf(doom2fwad, "%s/doom2f.wad", doomwaddir);
|
|
|
|
|
2007-01-29 23:02:19 +03:00
|
|
|
// home = getenv("HOME");
|
|
|
|
// if (!home)
|
2007-02-09 01:53:29 +03:00
|
|
|
home = ".";
|
2007-01-28 05:53:06 +03:00
|
|
|
sprintf(basedefault, "%s/doomrc.txt", home);
|
|
|
|
|
|
|
|
if (M_CheckParm ("-shdev"))
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
gamemode = shareware;
|
|
|
|
devparm = true;
|
|
|
|
D_AddFile (DEVDATA"doom1.wad");
|
|
|
|
D_AddFile (DEVMAPS"data_se/texture1.lmp");
|
|
|
|
D_AddFile (DEVMAPS"data_se/pnames.lmp");
|
|
|
|
strcpy (basedefault,DEVDATA"default.cfg");
|
|
|
|
return;
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (M_CheckParm ("-regdev"))
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
gamemode = registered;
|
|
|
|
devparm = true;
|
|
|
|
D_AddFile (DEVDATA"doom.wad");
|
|
|
|
D_AddFile (DEVMAPS"data_se/texture1.lmp");
|
|
|
|
D_AddFile (DEVMAPS"data_se/texture2.lmp");
|
|
|
|
D_AddFile (DEVMAPS"data_se/pnames.lmp");
|
|
|
|
strcpy (basedefault,DEVDATA"default.cfg");
|
|
|
|
return;
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (M_CheckParm ("-comdev"))
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
gamemode = commercial;
|
|
|
|
devparm = true;
|
|
|
|
/* I don't bother
|
|
|
|
if(plutonia)
|
|
|
|
D_AddFile (DEVDATA"plutonia.wad");
|
|
|
|
else if(tnt)
|
|
|
|
D_AddFile (DEVDATA"tnt.wad");
|
|
|
|
else*/
|
|
|
|
D_AddFile (DEVDATA"doom2.wad");
|
|
|
|
|
|
|
|
D_AddFile (DEVMAPS"cdata/texture1.lmp");
|
|
|
|
D_AddFile (DEVMAPS"cdata/pnames.lmp");
|
|
|
|
strcpy (basedefault,DEVDATA"default.cfg");
|
|
|
|
return;
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( !access (doom2fwad,R_OK) )
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
gamemode = commercial;
|
|
|
|
// C'est ridicule!
|
|
|
|
// Let's handle languages in config files, okay?
|
|
|
|
language = french;
|
|
|
|
D_AddFile (doom2fwad);
|
|
|
|
return;
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( !access (doom2wad,R_OK) )
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
gamemode = commercial;
|
|
|
|
D_AddFile (doom2wad);
|
|
|
|
return;
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( !access (plutoniawad, R_OK ) )
|
|
|
|
{
|
|
|
|
gamemode = commercial;
|
|
|
|
D_AddFile (plutoniawad);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !access ( tntwad, R_OK ) )
|
|
|
|
{
|
|
|
|
gamemode = commercial;
|
|
|
|
D_AddFile (tntwad);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !access (doomuwad,R_OK) )
|
|
|
|
{
|
|
|
|
gamemode = retail;
|
|
|
|
D_AddFile (doomuwad);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !access (doomwad,R_OK) )
|
|
|
|
{
|
|
|
|
gamemode = registered;
|
|
|
|
D_AddFile (doomwad);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !access (doom1wad,R_OK) )
|
|
|
|
{
|
|
|
|
gamemode = shareware;
|
|
|
|
D_AddFile (doom1wad);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
printf("Game mode indeterminate.\n");
|
2007-01-28 05:53:06 +03:00
|
|
|
gamemode = indetermined;
|
|
|
|
|
|
|
|
// We don't abort. Let's see what the PWAD contains.
|
|
|
|
//exit(1);
|
|
|
|
//I_Error ("Game mode indeterminate\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// Find a Response File
|
|
|
|
//
|
|
|
|
void FindResponseFile (void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
#define MAXARGVS 100
|
2007-02-09 01:53:29 +03:00
|
|
|
|
2007-01-28 05:53:06 +03:00
|
|
|
for (i = 1;i < myargc;i++)
|
2007-02-09 01:53:29 +03:00
|
|
|
if (myargv[i][0] == '@')
|
|
|
|
{
|
|
|
|
FILE * handle;
|
|
|
|
int size;
|
|
|
|
int k;
|
|
|
|
int index;
|
|
|
|
int indexinfile;
|
|
|
|
char *infile;
|
|
|
|
char *file;
|
|
|
|
char *moreargs[20];
|
|
|
|
char *firstargv;
|
|
|
|
|
|
|
|
// READ THE RESPONSE FILE INTO MEMORY
|
|
|
|
handle = fopen (&myargv[i][1],"rb");
|
|
|
|
if (!handle)
|
|
|
|
{
|
|
|
|
// __libclog_printf ("\nNo such response file!");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
// __libclog_printf("Found response file %s!\n",&myargv[i][1]);
|
|
|
|
// fseek (handle,0,SEEK_END);
|
|
|
|
// size = ftell(handle);
|
|
|
|
// fseek (handle,0,SEEK_SET);
|
|
|
|
// file = malloc (size);
|
|
|
|
// fread (file,size,1,handle);
|
|
|
|
// fclose (handle);
|
|
|
|
|
|
|
|
// KEEP ALL CMDLINE ARGS FOLLOWING @RESPONSEFILE ARG
|
|
|
|
for (index = 0,k = i+1; k < myargc; k++)
|
|
|
|
moreargs[index++] = myargv[k];
|
|
|
|
|
|
|
|
firstargv = myargv[0];
|
|
|
|
myargv = malloc(sizeof(char *)*MAXARGVS);
|
|
|
|
memset(myargv,0,sizeof(char *)*MAXARGVS);
|
|
|
|
myargv[0] = firstargv;
|
|
|
|
|
|
|
|
infile = file;
|
|
|
|
indexinfile = k = 0;
|
|
|
|
indexinfile++; // SKIP PAST ARGV[0] (KEEP IT)
|
|
|
|
do
|
|
|
|
{
|
|
|
|
myargv[indexinfile++] = infile+k;
|
|
|
|
while(k < size &&
|
|
|
|
((*(infile+k)>= ' '+1) && (*(infile+k)<='z')))
|
|
|
|
k++;
|
|
|
|
*(infile+k) = 0;
|
|
|
|
while(k < size &&
|
|
|
|
((*(infile+k)<= ' ') || (*(infile+k)>'z')))
|
|
|
|
k++;
|
|
|
|
} while(k < size);
|
|
|
|
|
|
|
|
for (k = 0;k < index;k++)
|
|
|
|
myargv[indexinfile++] = moreargs[k];
|
|
|
|
myargc = indexinfile;
|
|
|
|
|
|
|
|
// DISPLAY ARGS
|
|
|
|
// __libclog_printf("%d command-line args:\n",myargc);
|
|
|
|
// for (k=1;k<myargc;k++)
|
|
|
|
// __libclog_printf("%s\n",myargv[k]);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// D_DoomMain
|
|
|
|
//
|
|
|
|
void D_DoomMain (void)
|
|
|
|
{
|
|
|
|
int p;
|
|
|
|
char file[256];
|
|
|
|
|
|
|
|
FindResponseFile ();
|
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
IdentifyVersion ();
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
modifiedgame = false;
|
2007-02-09 01:53:29 +03:00
|
|
|
|
2007-01-28 05:53:06 +03:00
|
|
|
nomonsters = M_CheckParm ("-nomonsters");
|
|
|
|
respawnparm = M_CheckParm ("-respawn");
|
|
|
|
fastparm = M_CheckParm ("-fast");
|
|
|
|
devparm = M_CheckParm ("-devparm");
|
|
|
|
if (M_CheckParm ("-altdeath"))
|
2007-02-09 01:53:29 +03:00
|
|
|
deathmatch = 2;
|
2007-01-28 05:53:06 +03:00
|
|
|
else if (M_CheckParm ("-deathmatch"))
|
2007-02-09 01:53:29 +03:00
|
|
|
deathmatch = 1;
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
switch ( gamemode )
|
|
|
|
{
|
|
|
|
case retail:
|
2007-02-09 01:53:29 +03:00
|
|
|
sprintf (title,
|
|
|
|
" "
|
|
|
|
"The Ultimate DOOM Startup v%i.%i"
|
|
|
|
" ",
|
|
|
|
VERSION_NUM/100,VERSION_NUM%100);
|
|
|
|
break;
|
2007-01-28 05:53:06 +03:00
|
|
|
case shareware:
|
2007-02-09 01:53:29 +03:00
|
|
|
sprintf (title,
|
|
|
|
" "
|
|
|
|
"DOOM Shareware Startup v%i.%i"
|
|
|
|
" ",
|
|
|
|
VERSION_NUM/100,VERSION_NUM%100);
|
|
|
|
break;
|
2007-01-28 05:53:06 +03:00
|
|
|
case registered:
|
2007-02-09 01:53:29 +03:00
|
|
|
sprintf (title,
|
|
|
|
" "
|
|
|
|
"DOOM Registered Startup v%i.%i"
|
|
|
|
" ",
|
|
|
|
VERSION_NUM/100,VERSION_NUM%100);
|
|
|
|
break;
|
2007-01-28 05:53:06 +03:00
|
|
|
case commercial:
|
2007-02-09 01:53:29 +03:00
|
|
|
sprintf (title,
|
|
|
|
" "
|
|
|
|
"DOOM 2: Hell on Earth v%i.%i"
|
|
|
|
" ",
|
|
|
|
VERSION_NUM/100,VERSION_NUM%100);
|
|
|
|
break;
|
2007-01-28 05:53:06 +03:00
|
|
|
/*FIXME
|
|
|
|
case pack_plut:
|
2007-02-09 01:53:29 +03:00
|
|
|
sprintf (title,
|
|
|
|
" "
|
|
|
|
"DOOM 2: Plutonia Experiment v%i.%i"
|
|
|
|
" ",
|
|
|
|
VERSION_NUM/100,VERSION_NUM%100);
|
|
|
|
break;
|
2007-01-28 05:53:06 +03:00
|
|
|
case pack_tnt:
|
2007-02-09 01:53:29 +03:00
|
|
|
sprintf (title,
|
|
|
|
" "
|
|
|
|
"DOOM 2: TNT - Evilution v%i.%i"
|
|
|
|
" ",
|
|
|
|
VERSION_NUM/100,VERSION_NUM%100);
|
|
|
|
break;
|
2007-01-28 05:53:06 +03:00
|
|
|
*/
|
|
|
|
default:
|
2007-02-09 01:53:29 +03:00
|
|
|
sprintf (title,
|
|
|
|
" "
|
|
|
|
"Public DOOM - v%i.%i"
|
|
|
|
" ",
|
|
|
|
VERSION_NUM/100,VERSION_NUM%100);
|
|
|
|
break;
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// __libclog_printf ("%s\n",title);
|
|
|
|
|
|
|
|
if (devparm)
|
2007-02-09 01:53:29 +03:00
|
|
|
printf(D_DEVSTR);
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
// turbo option
|
|
|
|
if ( (p=M_CheckParm ("-turbo")) )
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
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;
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
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]);
|
|
|
|
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);
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
2007-02-09 01:53:29 +03:00
|
|
|
|
2007-01-28 05:53:06 +03:00
|
|
|
p = M_CheckParm ("-file");
|
|
|
|
if (p)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
// 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]);
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
p = M_CheckParm ("-playdemo");
|
|
|
|
|
|
|
|
if (!p)
|
2007-02-09 01:53:29 +03:00
|
|
|
p = M_CheckParm ("-timedemo");
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
if (p && p < myargc-1)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
sprintf (file,"%s.lmp", myargv[p+1]);
|
|
|
|
D_AddFile (file);
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// get skill / episode / map from parms
|
|
|
|
startskill = sk_medium;
|
|
|
|
startepisode = 1;
|
|
|
|
startmap = 1;
|
|
|
|
autostart = false;
|
2007-02-09 01:53:29 +03:00
|
|
|
|
2007-01-28 05:53:06 +03:00
|
|
|
p = M_CheckParm ("-skill");
|
|
|
|
if (p && p < myargc-1)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
startskill = myargv[p+1][0]-'1';
|
|
|
|
autostart = true;
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
p = M_CheckParm ("-episode");
|
|
|
|
if (p && p < myargc-1)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
startepisode = myargv[p+1][0]-'0';
|
|
|
|
startmap = 1;
|
|
|
|
autostart = true;
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
2007-02-09 01:53:29 +03:00
|
|
|
|
2007-01-28 05:53:06 +03:00
|
|
|
p = M_CheckParm ("-timer");
|
|
|
|
if (p && p < myargc-1 && deathmatch)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
int time;
|
|
|
|
time = atoi(myargv[p+1]);
|
|
|
|
if (time>1)
|
|
|
|
printf("s");
|
|
|
|
printf(".\n");
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
p = M_CheckParm ("-avg");
|
|
|
|
if (p && p < myargc-1 && deathmatch)
|
2007-02-09 01:53:29 +03:00
|
|
|
printf("Austin Virtual Gaming: Levels will end after 20 minutes\n");
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
p = M_CheckParm ("-warp");
|
|
|
|
if (p && p < myargc-1)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
if (gamemode == commercial)
|
|
|
|
startmap = atoi (myargv[p+1]);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
startepisode = myargv[p+1][0]-'0';
|
|
|
|
startmap = myargv[p+2][0]-'0';
|
|
|
|
}
|
|
|
|
autostart = true;
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
2007-02-09 01:53:29 +03:00
|
|
|
|
|
|
|
|
2007-01-28 05:53:06 +03:00
|
|
|
// init subsystems
|
2007-02-09 01:53:29 +03:00
|
|
|
printf ("V_Init: allocate screens.\n\r");
|
2007-01-28 05:53:06 +03:00
|
|
|
V_Init ();
|
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
printf ("M_LoadDefaults: Load system defaults.\n\r");
|
2007-01-28 05:53:06 +03:00
|
|
|
M_LoadDefaults (); // load before initing other systems
|
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
printf ("Z_Init: Init zone memory allocation daemon. \n\r");
|
2007-01-28 05:53:06 +03:00
|
|
|
Z_Init ();
|
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
printf ("W_Init: Init WADfiles.\n\r");
|
2007-01-28 05:53:06 +03:00
|
|
|
W_InitMultipleFiles (wadfiles);
|
|
|
|
|
|
|
|
// Check for -file in shareware
|
|
|
|
if (modifiedgame)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
// 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("\n\rYou 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("\n\rThis is not the registered version.");
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Iff additonal PWAD files are used, print modified banner
|
|
|
|
if (modifiedgame)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
// //printf (
|
|
|
|
// "===========================================================================\n\r"
|
|
|
|
// "ATTENTION: This version of DOOM has been modified. If you would like to\n\r"
|
|
|
|
// "get a copy of the original game, call 1-800-IDGAMES or see the readme file.\n\r"
|
|
|
|
// " You will not receive technical support for modified games.\n\r"
|
|
|
|
// " press enter to continue\n\r"
|
|
|
|
// "===========================================================================\n\r"
|
|
|
|
// );
|
|
|
|
// getchar ();
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
2007-02-09 01:53:29 +03:00
|
|
|
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
// Check and print which version is executed.
|
|
|
|
switch ( gamemode )
|
|
|
|
{
|
|
|
|
case shareware:
|
|
|
|
case indetermined:
|
2007-02-09 01:53:29 +03:00
|
|
|
// //printf (
|
|
|
|
// "===========================================================================\n\r"
|
|
|
|
// " Shareware!\n\r"
|
|
|
|
// "===========================================================================\n\r"
|
|
|
|
// );
|
|
|
|
break;
|
2007-01-28 05:53:06 +03:00
|
|
|
case registered:
|
|
|
|
case retail:
|
|
|
|
case commercial:
|
2007-02-09 01:53:29 +03:00
|
|
|
// //printf (
|
|
|
|
// "===========================================================================\n\r"
|
|
|
|
// " Commercial product - do not distribute!\n\r"
|
|
|
|
// " Please report software piracy to the SPA: 1-800-388-PIR8\n\r"
|
|
|
|
// "===========================================================================\n\r"
|
|
|
|
// );
|
|
|
|
break;
|
|
|
|
|
2007-01-28 05:53:06 +03:00
|
|
|
default:
|
2007-02-09 01:53:29 +03:00
|
|
|
// Ouch.
|
|
|
|
break;
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
printf ("M_Init: Init miscellaneous info.\n\r");
|
2007-01-28 05:53:06 +03:00
|
|
|
M_Init ();
|
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
printf ("R_Init: Init DOOM refresh daemon - \n\r");
|
2007-01-28 05:53:06 +03:00
|
|
|
R_Init ();
|
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
printf ("\nP_Init: Init Playloop state.\n\r");
|
2007-01-28 05:53:06 +03:00
|
|
|
P_Init ();
|
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
printf ("I_Init: Setting up machine state.\n\r");
|
2007-01-28 05:53:06 +03:00
|
|
|
I_Init ();
|
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
printf ("D_CheckNetGame: Checking network game status.\n\r");
|
2007-01-28 05:53:06 +03:00
|
|
|
D_CheckNetGame ();
|
|
|
|
|
2007-02-13 07:00:47 +03:00
|
|
|
printf ("S_Init: Setting up sound.\n\r");
|
|
|
|
S_Init (snd_SfxVolume /* *8 */, snd_MusicVolume /* *8*/ );
|
2007-01-28 05:53:06 +03:00
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
printf ("HU_Init: Setting up heads up display.\n\r");
|
2007-01-28 05:53:06 +03:00
|
|
|
HU_Init ();
|
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
printf ("ST_Init: Init status bar.\n\r");
|
2007-01-28 05:53:06 +03:00
|
|
|
ST_Init ();
|
|
|
|
|
|
|
|
// check for a driver that wants intermission stats
|
|
|
|
p = M_CheckParm ("-statcopy");
|
|
|
|
if (p && p<myargc-1)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
// for statistics driver
|
|
|
|
extern void* statcopy;
|
2007-01-28 05:53:06 +03:00
|
|
|
|
2007-02-09 01:53:29 +03:00
|
|
|
statcopy = (void*)atoi(myargv[p+1]);
|
|
|
|
//printf ("External statistics registered.\n\r");
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// start the apropriate game based on parms
|
|
|
|
p = M_CheckParm ("-record");
|
|
|
|
|
|
|
|
if (p && p < myargc-1)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
G_RecordDemo (myargv[p+1]);
|
|
|
|
autostart = true;
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
2007-02-09 01:53:29 +03:00
|
|
|
|
2007-01-28 05:53:06 +03:00
|
|
|
p = M_CheckParm ("-playdemo");
|
|
|
|
if (p && p < myargc-1)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
singledemo = true; // quit after one demo
|
|
|
|
G_DeferedPlayDemo (myargv[p+1]);
|
|
|
|
D_DoomLoop (); // never returns
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
2007-02-09 01:53:29 +03:00
|
|
|
|
2007-01-28 05:53:06 +03:00
|
|
|
p = M_CheckParm ("-timedemo");
|
|
|
|
if (p && p < myargc-1)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
G_TimeDemo (myargv[p+1]);
|
|
|
|
D_DoomLoop (); // never returns
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
2007-02-09 01:53:29 +03:00
|
|
|
|
2007-01-28 05:53:06 +03:00
|
|
|
p = M_CheckParm ("-loadgame");
|
|
|
|
if (p && p < myargc-1)
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
if (M_CheckParm("-cdrom"))
|
2007-06-22 14:29:55 +04:00
|
|
|
sprintf(file, "c:\\doomdata\\doomsav%c.dsg",myargv[p+1][0]);
|
2007-02-09 01:53:29 +03:00
|
|
|
else
|
2007-06-22 14:29:55 +04:00
|
|
|
sprintf(file, "doomsav%c.dsg",myargv[p+1][0]);
|
2007-02-09 01:53:29 +03:00
|
|
|
G_LoadGame (file);
|
2007-01-28 05:53:06 +03:00
|
|
|
}
|
2007-02-09 01:53:29 +03:00
|
|
|
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
if ( gameaction != ga_loadgame )
|
|
|
|
{
|
2007-02-09 01:53:29 +03:00
|
|
|
if (autostart || netgame)
|
|
|
|
G_InitNew (startskill, startepisode, startmap);
|
|
|
|
else
|
|
|
|
D_StartTitle (); // start up intro loop
|
2007-01-28 05:53:06 +03:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
D_DoomLoop (); // never returns
|
|
|
|
}
|