2006-02-24 04:48:15 +00: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:
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// HEADER FILES ------------------------------------------------------------
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include <direct.h>
|
|
|
|
#define mkdir(a,b) _mkdir (a)
|
|
|
|
#else
|
|
|
|
#include <sys/stat.h>
|
2008-08-06 22:59:24 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_FPU_CONTROL
|
|
|
|
#include <fpu_control.h>
|
|
|
|
#endif
|
2008-08-06 18:26:25 +00:00
|
|
|
#include <float.h>
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2013-07-30 09:45:42 +00:00
|
|
|
#if defined(__unix__) || defined(__APPLE__)
|
2006-02-24 04:48:15 +00:00
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <time.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <assert.h>
|
2010-01-01 15:31:00 +00:00
|
|
|
#include <sys/stat.h>
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
#include "doomerrors.h"
|
|
|
|
|
|
|
|
#include "d_gui.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
#include "doomdef.h"
|
|
|
|
#include "doomstat.h"
|
|
|
|
#include "gstrings.h"
|
|
|
|
#include "w_wad.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "v_video.h"
|
2010-10-06 10:44:03 +00:00
|
|
|
#include "intermission/intermission.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "f_wipe.h"
|
|
|
|
#include "m_argv.h"
|
|
|
|
#include "m_misc.h"
|
2010-09-14 17:28:18 +00:00
|
|
|
#include "menu/menu.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "c_console.h"
|
|
|
|
#include "c_dispatch.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"
|
2011-07-07 15:37:47 +00:00
|
|
|
#include "r_utility.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "r_sky.h"
|
|
|
|
#include "d_main.h"
|
|
|
|
#include "d_dehacked.h"
|
|
|
|
#include "cmdlib.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "m_swap.h"
|
|
|
|
#include "v_text.h"
|
|
|
|
#include "gi.h"
|
|
|
|
#include "b_bot.h" //Added by MC:
|
|
|
|
#include "stats.h"
|
|
|
|
#include "gameconfigfile.h"
|
|
|
|
#include "sbar.h"
|
|
|
|
#include "decallib.h"
|
2006-05-14 14:30:13 +00:00
|
|
|
#include "version.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "v_text.h"
|
Note: I have not tried compiling these recent changes under Linux. I wouldn't
be surprised if it doesn't work.
- Reorganized the network startup loops so now they are event driven. There is
a single function that gets called to drive it, and it uses callbacks to
perform the different stages of the synchronization. This lets me have a nice,
responsive abort button instead of the previous unannounced hit-escape-to-
abort behavior, and I think the rearranged code is slightly easier to
understand too.
- Increased the number of bytes for version info during D_ArbitrateNetStart(),
in preparation for the day when NETGAMEVERSION requires more than one byte.
- I noticed an issue with Vista RC1 and the new fatal error setup. Even after
releasing a DirectDraw or Direct3D interface, the DWM can still use the
last image drawn using them when it composites the window. It doesn't always
do it but it does often enough that it is a real problem. At this point, I
don't know if it's a problem with the release version of Vista or not.
After messing around, I discovered the problem was caused by ~Win32Video()
hiding the window and then having it immediately shown soon after. The DWM
kept an image of the window to do the transition effect with, and then when
it didn't get a chance to do the transition, it didn't properly forget about
its saved image and kept plastering it on top of everything else
underneath.
- Added a network synchronization panel to the window during netgame startup.
- Fixed: PClass::CreateDerivedClass() must initialize StateList to NULL.
Otherwise, classic DECORATE definitions generate a big, fat crash.
- Resurrected the R_Init progress bar, now as a standard Windows control.
- Removed the sound failure dialog. The FMOD setup already defaulted to no
sound if initialization failed, so this only applies when snd_output is set
to "alternate" which now also falls back to no sound. In addition, it wasn't
working right, and I didn't feel like fixing it for the probably 0% of users
it affected.
- Fixed: The edit control used for logging output added text in reverse order
on Win9x.
- Went back to the roots and made graphics initialization one of the last
things to happen during setup. Now the startup text is visible again. More
importantly, the main window is no longer created invisible, which seems
to cause trouble with it not always appearing in the taskbar. The fatal
error dialog is now also embedded in the main window instead of being a
separate modal dialog, so you can play with the log window to see any
problems that might be reported there.
Rather than completely restoring the original startup order, I tried to
keep things as close to the way they were with early graphics startup. In
particular, V_Init() now creates a dummy screen so that things that need
screen dimensions can get them. It gets replaced by the real screen later
in I_InitGraphics(). Will need to check this under Linux to make sure it
didn't cause any problems there.
- Removed the following stubs that just called functions in Video:
- I_StartModeIterator()
- I_NextMode()
- I_DisplayType()
I_FullscreenChanged() was also removed, and a new fullscreen parameter
was added to IVideo::StartModeIterator(), since that's all it controlled.
- Renamed I_InitHardware() back to I_InitGraphics(), since that's all it's
initialized post-1.22.
SVN r416 (trunk)
2006-12-19 04:09:10 +00:00
|
|
|
#include "st_start.h"
|
2007-12-18 01:50:08 +00:00
|
|
|
#include "templates.h"
|
2007-12-20 20:22:31 +00:00
|
|
|
#include "teaminfo.h"
|
2008-01-11 21:04:22 +00:00
|
|
|
#include "hardware.h"
|
2008-01-16 04:43:50 +00:00
|
|
|
#include "sbarinfo.h"
|
2008-09-14 23:54:38 +00:00
|
|
|
#include "d_net.h"
|
|
|
|
#include "g_level.h"
|
|
|
|
#include "d_event.h"
|
2008-09-15 00:47:31 +00:00
|
|
|
#include "d_netinf.h"
|
2008-09-15 14:11:05 +00:00
|
|
|
#include "v_palette.h"
|
2008-12-28 09:49:15 +00:00
|
|
|
#include "m_cheat.h"
|
2009-02-05 02:55:28 +00:00
|
|
|
#include "compatibility.h"
|
2009-07-15 05:53:06 +00:00
|
|
|
#include "m_joy.h"
|
2010-01-01 15:31:00 +00:00
|
|
|
#include "sc_man.h"
|
2010-08-15 10:02:10 +00:00
|
|
|
#include "po_man.h"
|
2010-01-01 15:31:00 +00:00
|
|
|
#include "resourcefiles/resourcefile.h"
|
2011-07-07 15:37:47 +00:00
|
|
|
#include "r_renderer.h"
|
2012-05-10 03:48:36 +00:00
|
|
|
#include "p_local.h"
|
2011-07-07 15:37:47 +00:00
|
|
|
|
2008-01-11 22:38:10 +00:00
|
|
|
EXTERN_CVAR(Bool, hud_althud)
|
|
|
|
void DrawHUD();
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// MACROS ------------------------------------------------------------------
|
|
|
|
|
|
|
|
// TYPES -------------------------------------------------------------------
|
|
|
|
|
|
|
|
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
|
|
|
|
2010-09-18 16:08:10 +00:00
|
|
|
extern void ReadStatistics();
|
2006-02-24 04:48:15 +00:00
|
|
|
extern void M_RestoreMode ();
|
|
|
|
extern void M_SetDefaultMode ();
|
|
|
|
extern void R_ExecuteSetViewSize ();
|
|
|
|
extern void G_NewInit ();
|
2006-07-13 10:17:56 +00:00
|
|
|
extern void SetupPlayerClasses ();
|
2010-12-15 00:09:31 +00:00
|
|
|
extern void HUD_InitHud();
|
2010-10-15 15:13:53 +00:00
|
|
|
const FIWADInfo *D_FindIWAD(TArray<FString> &wadfiles, const char *iwad, const char *basewad);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
|
|
|
|
|
|
|
|
void D_CheckNetGame ();
|
|
|
|
void D_ProcessEvents ();
|
|
|
|
void G_BuildTiccmd (ticcmd_t* cmd);
|
|
|
|
void D_DoAdvanceDemo ();
|
2010-03-03 04:29:40 +00:00
|
|
|
void D_AddWildFile (TArray<FString> &wadfiles, const char *pattern);
|
2010-12-14 00:50:02 +00:00
|
|
|
void D_LoadWadSettings ();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
|
|
|
|
|
|
|
void D_DoomLoop ();
|
2006-04-17 13:53:34 +00:00
|
|
|
static const char *BaseFileSearch (const char *file, const char *ext, bool lookfirstinprogdir=false);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
|
|
|
|
|
|
|
EXTERN_CVAR (Float, turbo)
|
|
|
|
EXTERN_CVAR (Bool, freelook)
|
|
|
|
EXTERN_CVAR (Float, m_pitch)
|
|
|
|
EXTERN_CVAR (Float, m_yaw)
|
|
|
|
EXTERN_CVAR (Bool, invertmouse)
|
|
|
|
EXTERN_CVAR (Bool, lookstrafe)
|
2008-12-06 10:22:37 +00:00
|
|
|
EXTERN_CVAR (Int, screenblocks)
|
2008-12-28 09:49:15 +00:00
|
|
|
EXTERN_CVAR (Bool, sv_cheats)
|
2009-03-06 22:58:34 +00:00
|
|
|
EXTERN_CVAR (Bool, sv_unlimited_pickup)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
extern int testingmode;
|
2006-09-14 00:02:31 +00:00
|
|
|
extern bool setmodeneeded;
|
2006-02-24 04:48:15 +00:00
|
|
|
extern int NewWidth, NewHeight, NewBits, DisplayBits;
|
|
|
|
EXTERN_CVAR (Bool, st_scale)
|
2006-09-14 00:02:31 +00:00
|
|
|
extern bool gameisdead;
|
2006-04-16 19:09:36 +00:00
|
|
|
extern bool demorecording;
|
2006-02-24 04:48:15 +00:00
|
|
|
extern bool M_DemoNoPlay; // [RH] if true, then skip any demos in the loop
|
2006-05-03 14:54:48 +00:00
|
|
|
extern bool insave;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
// PUBLIC DATA DEFINITIONS -------------------------------------------------
|
|
|
|
|
2007-12-15 03:51:17 +00:00
|
|
|
CUSTOM_CVAR (Int, fraglimit, 0, CVAR_SERVERINFO)
|
|
|
|
{
|
|
|
|
// Check for the fraglimit being hit because the fraglimit is being
|
|
|
|
// lowered below somebody's current frag count.
|
|
|
|
if (deathmatch && self > 0)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < MAXPLAYERS; ++i)
|
|
|
|
{
|
|
|
|
if (playeringame[i] && self <= D_GetFragCount(&players[i]))
|
|
|
|
{
|
|
|
|
Printf ("%s\n", GStrings("TXT_FRAGLIMIT"));
|
|
|
|
G_ExitLevel (0, false);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
CVAR (Float, timelimit, 0.f, CVAR_SERVERINFO);
|
|
|
|
CVAR (Int, wipetype, 1, CVAR_ARCHIVE);
|
2008-04-11 04:59:23 +00:00
|
|
|
CVAR (Int, snd_drawoutput, 0, 0);
|
2010-09-26 07:46:34 +00:00
|
|
|
CUSTOM_CVAR (String, vid_cursor, "None", CVAR_ARCHIVE | CVAR_NOINITCALL)
|
|
|
|
{
|
|
|
|
bool res = false;
|
|
|
|
|
|
|
|
if (!stricmp(self, "None" ) && gameinfo.CursorPic.IsNotEmpty())
|
|
|
|
{
|
|
|
|
res = I_SetCursor(TexMan[gameinfo.CursorPic]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
res = I_SetCursor(TexMan[self]);
|
|
|
|
}
|
|
|
|
if (!res)
|
|
|
|
{
|
|
|
|
I_SetCursor(TexMan["cursor"]);
|
|
|
|
}
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
bool DrawFSHUD; // [RH] Draw fullscreen HUD?
|
2010-01-01 12:40:47 +00:00
|
|
|
TArray<FString> allwads;
|
2006-09-14 00:02:31 +00:00
|
|
|
bool devparm; // started game with -devparm
|
2006-12-29 03:38:37 +00:00
|
|
|
const char *D_DrawIcon; // [RH] Patch name of icon to draw on next refresh
|
|
|
|
int NoWipe; // [RH] Allow wipe? (Needs to be set each time)
|
2006-09-14 00:02:31 +00:00
|
|
|
bool singletics = false; // debug flag to cancel adaptiveness
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
FString startmap;
|
2006-09-14 00:02:31 +00:00
|
|
|
bool autostart;
|
2013-10-10 03:11:33 +00:00
|
|
|
FString StoredWarp;
|
2006-09-14 00:02:31 +00:00
|
|
|
bool advancedemo;
|
2006-02-24 04:48:15 +00:00
|
|
|
FILE *debugfile;
|
|
|
|
event_t events[MAXEVENTS];
|
|
|
|
int eventhead;
|
|
|
|
int eventtail;
|
|
|
|
gamestate_t wipegamestate = GS_DEMOSCREEN; // can be -1 to force a wipe
|
|
|
|
bool PageBlank;
|
|
|
|
FTexture *Page;
|
|
|
|
FTexture *Advisory;
|
2010-08-28 17:19:48 +00:00
|
|
|
bool nospriterename;
|
2010-09-24 14:27:52 +00:00
|
|
|
FStartupInfo DoomStartupInfo;
|
2010-12-15 11:45:39 +00:00
|
|
|
FString lastIWAD;
|
|
|
|
int restart = 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
cycle_t FrameCycles;
|
|
|
|
|
|
|
|
|
|
|
|
// PRIVATE DATA DEFINITIONS ------------------------------------------------
|
|
|
|
|
|
|
|
static int demosequence;
|
|
|
|
static int pagetic;
|
|
|
|
|
|
|
|
// CODE --------------------------------------------------------------------
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D_ProcessEvents
|
|
|
|
//
|
|
|
|
// Send all the events of the given timestamp down the responder chain.
|
|
|
|
// Events are asynchronous inputs generally generated by the game user.
|
|
|
|
// Events can be discarded if no responder claims them
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D_ProcessEvents (void)
|
|
|
|
{
|
|
|
|
event_t *ev;
|
|
|
|
|
|
|
|
// [RH] If testing mode, do not accept input until test is over
|
|
|
|
if (testingmode)
|
|
|
|
{
|
|
|
|
if (testingmode == 1)
|
|
|
|
{
|
|
|
|
M_SetDefaultMode ();
|
|
|
|
}
|
|
|
|
else if (testingmode <= I_GetTime(false))
|
|
|
|
{
|
|
|
|
M_RestoreMode ();
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (; eventtail != eventhead ; eventtail = (eventtail+1)&(MAXEVENTS-1))
|
|
|
|
{
|
|
|
|
ev = &events[eventtail];
|
2009-08-07 03:30:51 +00:00
|
|
|
if (ev->type == EV_None)
|
|
|
|
continue;
|
2009-07-15 05:53:06 +00:00
|
|
|
if (ev->type == EV_DeviceChange)
|
|
|
|
UpdateJoystickMenu(I_UpdateDeviceList());
|
2006-02-24 04:48:15 +00:00
|
|
|
if (C_Responder (ev))
|
|
|
|
continue; // console ate the event
|
|
|
|
if (M_Responder (ev))
|
|
|
|
continue; // menu ate the event
|
|
|
|
G_Responder (ev);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D_PostEvent
|
|
|
|
//
|
|
|
|
// Called by the I/O functions when input is detected.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D_PostEvent (const event_t *ev)
|
|
|
|
{
|
2009-07-15 05:53:06 +00:00
|
|
|
// Do not post duplicate consecutive EV_DeviceChange events.
|
|
|
|
if (ev->type == EV_DeviceChange && events[eventhead].type == EV_DeviceChange)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
events[eventhead] = *ev;
|
2011-07-07 15:37:47 +00:00
|
|
|
if (ev->type == EV_Mouse && !paused && menuactive == MENU_Off && ConsoleState != c_down && ConsoleState != c_falling
|
|
|
|
)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (Button_Mlook.bDown || freelook)
|
|
|
|
{
|
|
|
|
int look = int(ev->y * m_pitch * mouse_sensitivity * 16.0);
|
|
|
|
if (invertmouse)
|
|
|
|
look = -look;
|
|
|
|
G_AddViewPitch (look);
|
|
|
|
events[eventhead].y = 0;
|
|
|
|
}
|
|
|
|
if (!Button_Strafe.bDown && !lookstrafe)
|
|
|
|
{
|
|
|
|
G_AddViewAngle (int(ev->x * m_yaw * mouse_sensitivity * 8.0));
|
|
|
|
events[eventhead].x = 0;
|
|
|
|
}
|
|
|
|
if ((events[eventhead].x | events[eventhead].y) == 0)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
eventhead = (eventhead+1)&(MAXEVENTS-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
2009-08-07 03:30:51 +00:00
|
|
|
//
|
|
|
|
// D_RemoveNextCharEvent
|
|
|
|
//
|
|
|
|
// Removes the next EV_GUI_Char event in the input queue. Used by the menu,
|
|
|
|
// since it (generally) consumes EV_GUI_KeyDown events and not EV_GUI_Char
|
|
|
|
// events, and it needs to ensure that there is no left over input when it's
|
|
|
|
// done. If there are multiple EV_GUI_KeyDowns before the EV_GUI_Char, then
|
|
|
|
// there are dead chars involved, so those should be removed, too. We do
|
|
|
|
// this by changing the message type to EV_None rather than by actually
|
|
|
|
// removing the event from the queue.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D_RemoveNextCharEvent()
|
|
|
|
{
|
|
|
|
assert(events[eventtail].type == EV_GUI_Event && events[eventtail].subtype == EV_GUI_KeyDown);
|
|
|
|
for (int evnum = eventtail; evnum != eventhead; evnum = (evnum+1) & (MAXEVENTS-1))
|
|
|
|
{
|
|
|
|
event_t *ev = &events[evnum];
|
|
|
|
if (ev->type != EV_GUI_Event)
|
|
|
|
break;
|
|
|
|
if (ev->subtype == EV_GUI_KeyDown || ev->subtype == EV_GUI_Char)
|
|
|
|
{
|
|
|
|
ev->type = EV_None;
|
|
|
|
if (ev->subtype == EV_GUI_Char)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
2006-02-24 04:48:15 +00:00
|
|
|
//
|
|
|
|
// CVAR dmflags
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
CUSTOM_CVAR (Int, dmflags, 0, CVAR_SERVERINFO)
|
|
|
|
{
|
|
|
|
// In case DF_NO_FREELOOK was changed, reinitialize the sky
|
|
|
|
// map. (If no freelook, then no need to stretch the sky.)
|
2008-06-15 18:36:26 +00:00
|
|
|
if (sky1texture.isValid())
|
2006-02-24 04:48:15 +00:00
|
|
|
R_InitSkyMap ();
|
|
|
|
|
|
|
|
if (self & DF_NO_FREELOOK)
|
|
|
|
{
|
|
|
|
Net_WriteByte (DEM_CENTERVIEW);
|
|
|
|
}
|
|
|
|
// If nofov is set, force everybody to the arbitrator's FOV.
|
|
|
|
if ((self & DF_NO_FOV) && consoleplayer == Net_Arbitrator)
|
|
|
|
{
|
|
|
|
BYTE fov;
|
|
|
|
|
|
|
|
Net_WriteByte (DEM_FOV);
|
|
|
|
|
|
|
|
// If the game is started with DF_NO_FOV set, the arbitrator's
|
|
|
|
// DesiredFOV will not be set when this callback is run, so
|
|
|
|
// be sure not to transmit a 0 FOV.
|
|
|
|
fov = (BYTE)players[consoleplayer].DesiredFOV;
|
|
|
|
if (fov == 0)
|
|
|
|
{
|
|
|
|
fov = 90;
|
|
|
|
}
|
|
|
|
Net_WriteByte (fov);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CVAR (Flag, sv_nohealth, dmflags, DF_NO_HEALTH);
|
|
|
|
CVAR (Flag, sv_noitems, dmflags, DF_NO_ITEMS);
|
|
|
|
CVAR (Flag, sv_weaponstay, dmflags, DF_WEAPONS_STAY);
|
|
|
|
CVAR (Flag, sv_falldamage, dmflags, DF_FORCE_FALLINGHX);
|
|
|
|
CVAR (Flag, sv_oldfalldamage, dmflags, DF_FORCE_FALLINGZD);
|
|
|
|
CVAR (Flag, sv_samelevel, dmflags, DF_SAME_LEVEL);
|
|
|
|
CVAR (Flag, sv_spawnfarthest, dmflags, DF_SPAWN_FARTHEST);
|
|
|
|
CVAR (Flag, sv_forcerespawn, dmflags, DF_FORCE_RESPAWN);
|
|
|
|
CVAR (Flag, sv_noarmor, dmflags, DF_NO_ARMOR);
|
|
|
|
CVAR (Flag, sv_noexit, dmflags, DF_NO_EXIT);
|
|
|
|
CVAR (Flag, sv_infiniteammo, dmflags, DF_INFINITE_AMMO);
|
|
|
|
CVAR (Flag, sv_nomonsters, dmflags, DF_NO_MONSTERS);
|
|
|
|
CVAR (Flag, sv_monsterrespawn, dmflags, DF_MONSTERS_RESPAWN);
|
|
|
|
CVAR (Flag, sv_itemrespawn, dmflags, DF_ITEMS_RESPAWN);
|
|
|
|
CVAR (Flag, sv_fastmonsters, dmflags, DF_FAST_MONSTERS);
|
|
|
|
CVAR (Flag, sv_nojump, dmflags, DF_NO_JUMP);
|
2008-03-18 18:18:18 +00:00
|
|
|
CVAR (Flag, sv_allowjump, dmflags, DF_YES_JUMP);
|
2006-02-24 04:48:15 +00:00
|
|
|
CVAR (Flag, sv_nofreelook, dmflags, DF_NO_FREELOOK);
|
2014-07-26 08:15:07 +00:00
|
|
|
CVAR (Flag, sv_allowfreelook, dmflags, DF_YES_FREELOOK);
|
2006-02-24 04:48:15 +00:00
|
|
|
CVAR (Flag, sv_nofov, dmflags, DF_NO_FOV);
|
2006-04-11 16:27:41 +00:00
|
|
|
CVAR (Flag, sv_noweaponspawn, dmflags, DF_NO_COOP_WEAPON_SPAWN);
|
2006-05-14 14:30:13 +00:00
|
|
|
CVAR (Flag, sv_nocrouch, dmflags, DF_NO_CROUCH);
|
2008-03-18 18:18:18 +00:00
|
|
|
CVAR (Flag, sv_allowcrouch, dmflags, DF_YES_CROUCH);
|
2010-09-14 17:28:18 +00:00
|
|
|
CVAR (Flag, sv_cooploseinventory, dmflags, DF_COOP_LOSE_INVENTORY);
|
|
|
|
CVAR (Flag, sv_cooplosekeys, dmflags, DF_COOP_LOSE_KEYS);
|
|
|
|
CVAR (Flag, sv_cooploseweapons, dmflags, DF_COOP_LOSE_WEAPONS);
|
|
|
|
CVAR (Flag, sv_cooplosearmor, dmflags, DF_COOP_LOSE_ARMOR);
|
|
|
|
CVAR (Flag, sv_cooplosepowerups, dmflags, DF_COOP_LOSE_POWERUPS);
|
|
|
|
CVAR (Flag, sv_cooploseammo, dmflags, DF_COOP_LOSE_AMMO);
|
|
|
|
CVAR (Flag, sv_coophalveammo, dmflags, DF_COOP_HALVE_AMMO);
|
|
|
|
|
|
|
|
// Some (hopefully cleaner) interface to these settings.
|
|
|
|
CVAR (Mask, sv_crouch, dmflags, DF_NO_CROUCH|DF_YES_CROUCH);
|
|
|
|
CVAR (Mask, sv_jump, dmflags, DF_NO_JUMP|DF_YES_JUMP);
|
|
|
|
CVAR (Mask, sv_fallingdamage, dmflags, DF_FORCE_FALLINGHX|DF_FORCE_FALLINGZD);
|
2014-07-26 08:15:07 +00:00
|
|
|
CVAR (Mask, sv_freelook, dmflags, DF_NO_FREELOOK|DF_YES_FREELOOK);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// CVAR dmflags2
|
|
|
|
//
|
|
|
|
// [RH] From Skull Tag. Some of these were already done as separate cvars
|
|
|
|
// (such as bfgaiming), but I collected them here like Skull Tag does.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-12-28 09:49:15 +00:00
|
|
|
CUSTOM_CVAR (Int, dmflags2, 0, CVAR_SERVERINFO)
|
|
|
|
{
|
|
|
|
// Stop the automap if we aren't allowed to use it.
|
|
|
|
if ((self & DF2_NO_AUTOMAP) && automapactive)
|
|
|
|
AM_Stop ();
|
|
|
|
|
|
|
|
for (int i = 0; i < MAXPLAYERS; i++)
|
|
|
|
{
|
|
|
|
player_t *p = &players[i];
|
|
|
|
|
|
|
|
if (!playeringame[i])
|
|
|
|
continue;
|
|
|
|
|
|
|
|
// Revert our view to our own eyes if spying someone else.
|
|
|
|
if (self & DF2_DISALLOW_SPYING)
|
|
|
|
{
|
|
|
|
// The player isn't looking through its own eyes, so make it.
|
|
|
|
if (p->camera != p->mo)
|
|
|
|
{
|
|
|
|
p->camera = p->mo;
|
|
|
|
|
|
|
|
S_UpdateSounds (p->camera);
|
|
|
|
StatusBar->AttachToPlayer (p);
|
|
|
|
|
|
|
|
if (demoplayback || multiplayer)
|
|
|
|
StatusBar->ShowPlayerName ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Come out of chasecam mode if we're not allowed to use chasecam.
|
2014-10-24 21:02:02 +00:00
|
|
|
if (!(dmflags2 & DF2_CHASECAM) && CheckCheatmode(false))
|
2008-12-28 09:49:15 +00:00
|
|
|
{
|
|
|
|
// Take us out of chasecam mode only.
|
|
|
|
if (p->cheats & CF_CHASECAM)
|
|
|
|
cht_DoCheat (p, CHT_CHASECAM);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-09 02:53:38 +00:00
|
|
|
CVAR (Flag, sv_weapondrop, dmflags2, DF2_YES_WEAPONDROP);
|
|
|
|
CVAR (Flag, sv_noteamswitch, dmflags2, DF2_NO_TEAM_SWITCH);
|
|
|
|
CVAR (Flag, sv_doubleammo, dmflags2, DF2_YES_DOUBLEAMMO);
|
|
|
|
CVAR (Flag, sv_degeneration, dmflags2, DF2_YES_DEGENERATION);
|
|
|
|
CVAR (Flag, sv_nobfgaim, dmflags2, DF2_NO_FREEAIMBFG);
|
|
|
|
CVAR (Flag, sv_barrelrespawn, dmflags2, DF2_BARRELS_RESPAWN);
|
|
|
|
CVAR (Flag, sv_keepfrags, dmflags2, DF2_YES_KEEPFRAGS);
|
|
|
|
CVAR (Flag, sv_norespawn, dmflags2, DF2_NO_RESPAWN);
|
|
|
|
CVAR (Flag, sv_losefrag, dmflags2, DF2_YES_LOSEFRAG);
|
|
|
|
CVAR (Flag, sv_respawnprotect, dmflags2, DF2_YES_RESPAWN_INVUL);
|
|
|
|
CVAR (Flag, sv_samespawnspot, dmflags2, DF2_SAME_SPAWN_SPOT);
|
2008-12-28 09:49:15 +00:00
|
|
|
CVAR (Flag, sv_infiniteinventory, dmflags2, DF2_INFINITE_INVENTORY);
|
|
|
|
CVAR (Flag, sv_killallmonsters, dmflags2, DF2_KILL_MONSTERS);
|
|
|
|
CVAR (Flag, sv_noautomap, dmflags2, DF2_NO_AUTOMAP);
|
|
|
|
CVAR (Flag, sv_noautomapallies, dmflags2, DF2_NO_AUTOMAP_ALLIES);
|
|
|
|
CVAR (Flag, sv_disallowspying, dmflags2, DF2_DISALLOW_SPYING);
|
|
|
|
CVAR (Flag, sv_chasecam, dmflags2, DF2_CHASECAM);
|
|
|
|
CVAR (Flag, sv_disallowsuicide, dmflags2, DF2_NOSUICIDE);
|
|
|
|
CVAR (Flag, sv_noautoaim, dmflags2, DF2_NOAUTOAIM);
|
2010-05-30 07:47:08 +00:00
|
|
|
CVAR (Flag, sv_dontcheckammo, dmflags2, DF2_DONTCHECKAMMO);
|
2010-06-20 17:57:32 +00:00
|
|
|
CVAR (Flag, sv_killbossmonst, dmflags2, DF2_KILLBOSSMONST);
|
2011-07-07 21:55:55 +00:00
|
|
|
CVAR (Flag, sv_nocountendmonst, dmflags2, DF2_NOCOUNTENDMONST);
|
2014-07-26 08:15:07 +00:00
|
|
|
CVAR (Flag, sv_respawnsuper, dmflags2, DF2_RESPAWN_SUPER);
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// CVAR compatflags
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2011-11-01 02:58:52 +00:00
|
|
|
int i_compatflags, i_compatflags2; // internal compatflags composed from the compatflags CVAR and MAPINFO settings
|
|
|
|
int ii_compatflags, ii_compatflags2, ib_compatflags;
|
2006-06-03 12:30:11 +00:00
|
|
|
|
2009-01-25 21:59:38 +00:00
|
|
|
EXTERN_CVAR(Int, compatmode)
|
|
|
|
|
|
|
|
static int GetCompatibility(int mask)
|
|
|
|
{
|
|
|
|
if (level.info == NULL) return mask;
|
|
|
|
else return (mask & ~level.info->compatmask) | (level.info->compatflags & level.info->compatmask);
|
|
|
|
}
|
|
|
|
|
2011-11-01 02:58:52 +00:00
|
|
|
static int GetCompatibility2(int mask)
|
|
|
|
{
|
|
|
|
return (level.info == NULL) ? mask
|
|
|
|
: (mask & ~level.info->compatmask2) | (level.info->compatflags2 & level.info->compatmask2);
|
|
|
|
}
|
|
|
|
|
2006-06-03 12:30:11 +00:00
|
|
|
CUSTOM_CVAR (Int, compatflags, 0, CVAR_ARCHIVE|CVAR_SERVERINFO)
|
|
|
|
{
|
2010-08-15 10:02:10 +00:00
|
|
|
int old = i_compatflags;
|
2009-02-05 02:55:28 +00:00
|
|
|
i_compatflags = GetCompatibility(self) | ii_compatflags;
|
2011-11-01 02:58:52 +00:00
|
|
|
if ((old ^ i_compatflags) & COMPATF_POLYOBJ)
|
2010-08-15 10:02:10 +00:00
|
|
|
{
|
|
|
|
FPolyObj::ClearAllSubsectorLinks();
|
|
|
|
}
|
2009-01-25 21:59:38 +00:00
|
|
|
}
|
|
|
|
|
2011-11-01 02:58:52 +00:00
|
|
|
CUSTOM_CVAR (Int, compatflags2, 0, CVAR_ARCHIVE|CVAR_SERVERINFO)
|
|
|
|
{
|
|
|
|
i_compatflags2 = GetCompatibility2(self) | ii_compatflags2;
|
|
|
|
}
|
|
|
|
|
2009-03-15 01:41:53 +00:00
|
|
|
CUSTOM_CVAR(Int, compatmode, 0, CVAR_ARCHIVE|CVAR_NOINITCALL)
|
2009-01-25 21:59:38 +00:00
|
|
|
{
|
2011-11-01 02:58:52 +00:00
|
|
|
int v, w = 0;
|
2009-01-25 21:59:38 +00:00
|
|
|
|
|
|
|
switch (self)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case 0:
|
|
|
|
v = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: // Doom2.exe compatible with a few relaxed settings
|
2009-12-18 08:19:34 +00:00
|
|
|
v = COMPATF_SHORTTEX|COMPATF_STAIRINDEX|COMPATF_USEBLOCKING|COMPATF_NODOORLIGHT|COMPATF_SPRITESORT|
|
2010-05-29 07:07:39 +00:00
|
|
|
COMPATF_TRACE|COMPATF_MISSILECLIP|COMPATF_SOUNDTARGET|COMPATF_DEHHEALTH|COMPATF_CROSSDROPOFF|
|
|
|
|
COMPATF_LIGHT;
|
2012-05-05 22:53:16 +00:00
|
|
|
w= COMPATF2_FLOORMOVE;
|
2009-01-25 21:59:38 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: // same as 1 but stricter (NO_PASSMOBJ and INVISIBILITY are also set)
|
2009-12-18 08:19:34 +00:00
|
|
|
v = COMPATF_SHORTTEX|COMPATF_STAIRINDEX|COMPATF_USEBLOCKING|COMPATF_NODOORLIGHT|COMPATF_SPRITESORT|
|
2009-01-25 21:59:38 +00:00
|
|
|
COMPATF_TRACE|COMPATF_MISSILECLIP|COMPATF_SOUNDTARGET|COMPATF_NO_PASSMOBJ|COMPATF_LIMITPAIN|
|
2010-05-28 11:15:05 +00:00
|
|
|
COMPATF_DEHHEALTH|COMPATF_INVISIBILITY|COMPATF_CROSSDROPOFF|COMPATF_CORPSEGIBS|COMPATF_HITSCAN|
|
2011-05-13 03:29:48 +00:00
|
|
|
COMPATF_WALLRUN|COMPATF_NOTOSSDROPS|COMPATF_LIGHT|COMPATF_MASKEDMIDTEX;
|
2012-05-05 22:53:16 +00:00
|
|
|
w = COMPATF2_BADANGLES|COMPATF2_FLOORMOVE;
|
2009-01-25 21:59:38 +00:00
|
|
|
break;
|
|
|
|
|
2009-09-14 20:47:53 +00:00
|
|
|
case 3: // Boom compat mode
|
2010-05-14 20:27:57 +00:00
|
|
|
v = COMPATF_TRACE|COMPATF_SOUNDTARGET|COMPATF_BOOMSCROLL|COMPATF_MISSILECLIP;
|
2009-01-25 21:59:38 +00:00
|
|
|
break;
|
|
|
|
|
2009-09-14 20:47:53 +00:00
|
|
|
case 4: // Old ZDoom compat mode
|
2010-05-29 07:07:39 +00:00
|
|
|
v = COMPATF_SOUNDTARGET|COMPATF_LIGHT;
|
2009-01-25 21:59:38 +00:00
|
|
|
break;
|
2009-09-14 20:47:53 +00:00
|
|
|
|
|
|
|
case 5: // MBF compat mode
|
2010-05-14 20:27:57 +00:00
|
|
|
v = COMPATF_TRACE|COMPATF_SOUNDTARGET|COMPATF_BOOMSCROLL|COMPATF_MISSILECLIP|COMPATF_MUSHROOM|
|
2009-09-14 23:50:21 +00:00
|
|
|
COMPATF_MBFMONSTERMOVE|COMPATF_NOBLOCKFRIENDS;
|
2009-09-14 20:47:53 +00:00
|
|
|
break;
|
|
|
|
|
2011-12-06 08:36:28 +00:00
|
|
|
case 6: // Boom with some added settings to reenable some 'broken' behavior
|
2010-05-28 11:15:05 +00:00
|
|
|
v = COMPATF_TRACE|COMPATF_SOUNDTARGET|COMPATF_BOOMSCROLL|COMPATF_MISSILECLIP|COMPATF_NO_PASSMOBJ|
|
|
|
|
COMPATF_INVISIBILITY|COMPATF_CORPSEGIBS|COMPATF_HITSCAN|COMPATF_WALLRUN|COMPATF_NOTOSSDROPS;
|
|
|
|
break;
|
|
|
|
|
2009-01-25 21:59:38 +00:00
|
|
|
}
|
|
|
|
compatflags = v;
|
2011-11-01 02:58:52 +00:00
|
|
|
compatflags2 = w;
|
2006-06-03 12:30:11 +00:00
|
|
|
}
|
|
|
|
|
2011-11-01 02:58:52 +00:00
|
|
|
CVAR (Flag, compat_shortTex, compatflags, COMPATF_SHORTTEX);
|
|
|
|
CVAR (Flag, compat_stairs, compatflags, COMPATF_STAIRINDEX);
|
|
|
|
CVAR (Flag, compat_limitpain, compatflags, COMPATF_LIMITPAIN);
|
|
|
|
CVAR (Flag, compat_silentpickup, compatflags, COMPATF_SILENTPICKUP);
|
|
|
|
CVAR (Flag, compat_nopassover, compatflags, COMPATF_NO_PASSMOBJ);
|
|
|
|
CVAR (Flag, compat_soundslots, compatflags, COMPATF_MAGICSILENCE);
|
|
|
|
CVAR (Flag, compat_wallrun, compatflags, COMPATF_WALLRUN);
|
|
|
|
CVAR (Flag, compat_notossdrops, compatflags, COMPATF_NOTOSSDROPS);
|
|
|
|
CVAR (Flag, compat_useblocking, compatflags, COMPATF_USEBLOCKING);
|
|
|
|
CVAR (Flag, compat_nodoorlight, compatflags, COMPATF_NODOORLIGHT);
|
|
|
|
CVAR (Flag, compat_ravenscroll, compatflags, COMPATF_RAVENSCROLL);
|
|
|
|
CVAR (Flag, compat_soundtarget, compatflags, COMPATF_SOUNDTARGET);
|
|
|
|
CVAR (Flag, compat_dehhealth, compatflags, COMPATF_DEHHEALTH);
|
|
|
|
CVAR (Flag, compat_trace, compatflags, COMPATF_TRACE);
|
|
|
|
CVAR (Flag, compat_dropoff, compatflags, COMPATF_DROPOFF);
|
|
|
|
CVAR (Flag, compat_boomscroll, compatflags, COMPATF_BOOMSCROLL);
|
|
|
|
CVAR (Flag, compat_invisibility, compatflags, COMPATF_INVISIBILITY);
|
|
|
|
CVAR (Flag, compat_silentinstantfloors, compatflags, COMPATF_SILENT_INSTANT_FLOORS);
|
|
|
|
CVAR (Flag, compat_sectorsounds, compatflags, COMPATF_SECTORSOUNDS);
|
|
|
|
CVAR (Flag, compat_missileclip, compatflags, COMPATF_MISSILECLIP);
|
|
|
|
CVAR (Flag, compat_crossdropoff, compatflags, COMPATF_CROSSDROPOFF);
|
|
|
|
CVAR (Flag, compat_anybossdeath, compatflags, COMPATF_ANYBOSSDEATH);
|
|
|
|
CVAR (Flag, compat_minotaur, compatflags, COMPATF_MINOTAUR);
|
|
|
|
CVAR (Flag, compat_mushroom, compatflags, COMPATF_MUSHROOM);
|
|
|
|
CVAR (Flag, compat_mbfmonstermove, compatflags, COMPATF_MBFMONSTERMOVE);
|
|
|
|
CVAR (Flag, compat_corpsegibs, compatflags, COMPATF_CORPSEGIBS);
|
|
|
|
CVAR (Flag, compat_noblockfriends, compatflags, COMPATF_NOBLOCKFRIENDS);
|
|
|
|
CVAR (Flag, compat_spritesort, compatflags, COMPATF_SPRITESORT);
|
|
|
|
CVAR (Flag, compat_hitscan, compatflags, COMPATF_HITSCAN);
|
|
|
|
CVAR (Flag, compat_light, compatflags, COMPATF_LIGHT);
|
|
|
|
CVAR (Flag, compat_polyobj, compatflags, COMPATF_POLYOBJ);
|
|
|
|
CVAR (Flag, compat_maskedmidtex, compatflags, COMPATF_MASKEDMIDTEX);
|
|
|
|
CVAR (Flag, compat_badangles, compatflags2, COMPATF2_BADANGLES);
|
2012-05-05 22:53:16 +00:00
|
|
|
CVAR (Flag, compat_floormove, compatflags2, COMPATF2_FLOORMOVE);
|
2014-10-25 10:12:06 +00:00
|
|
|
CVAR (Flag, compat_soundcutoff, compatflags2, COMPATF2_SOUNDCUTOFF);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D_Display
|
|
|
|
//
|
|
|
|
// Draw current display, possibly wiping it from the previous
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2007-12-27 04:30:12 +00:00
|
|
|
|
2008-01-01 03:07:05 +00:00
|
|
|
void D_Display ()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
bool wipe;
|
2007-12-27 04:30:12 +00:00
|
|
|
bool hw2d;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-12-11 06:20:35 +00:00
|
|
|
if (nodrawers || screen == NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
return; // for comparative timing / profiling
|
|
|
|
|
2008-08-10 03:56:53 +00:00
|
|
|
cycle_t cycles;
|
|
|
|
|
2008-08-10 03:25:08 +00:00
|
|
|
cycles.Reset();
|
|
|
|
cycles.Clock();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
if (players[consoleplayer].camera == NULL)
|
|
|
|
{
|
|
|
|
players[consoleplayer].camera = players[consoleplayer].mo;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (viewactive)
|
|
|
|
{
|
|
|
|
R_SetFOV (players[consoleplayer].camera && players[consoleplayer].camera->player ?
|
|
|
|
players[consoleplayer].camera->player->FOV : 90.f);
|
|
|
|
}
|
|
|
|
|
|
|
|
// [RH] change the screen mode if needed
|
|
|
|
if (setmodeneeded)
|
|
|
|
{
|
|
|
|
// Change screen mode.
|
2008-01-11 21:04:22 +00:00
|
|
|
if (Video->SetResolution (NewWidth, NewHeight, NewBits))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
// Recalculate various view parameters.
|
|
|
|
setsizeneeded = true;
|
|
|
|
// Let the status bar know the screen size changed
|
|
|
|
if (StatusBar != NULL)
|
|
|
|
{
|
|
|
|
StatusBar->ScreenSizeChanged ();
|
|
|
|
}
|
|
|
|
// Refresh the console.
|
|
|
|
C_NewModeAdjust ();
|
|
|
|
// Reload crosshair if transitioned to a different size
|
2009-07-01 02:00:36 +00:00
|
|
|
ST_LoadCrosshair (true);
|
2009-04-16 03:02:08 +00:00
|
|
|
AM_NewResolution ();
|
2012-07-05 21:46:03 +00:00
|
|
|
// Reset the mouse cursor in case the bit depth changed
|
|
|
|
vid_cursor.Callback();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RenderTarget = screen;
|
|
|
|
|
|
|
|
// change the view size if needed
|
|
|
|
if (setsizeneeded && StatusBar != NULL)
|
|
|
|
{
|
|
|
|
R_ExecuteSetViewSize ();
|
|
|
|
}
|
|
|
|
setmodeneeded = false;
|
|
|
|
|
2008-01-01 03:07:05 +00:00
|
|
|
if (screen->Lock (false))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2013-02-27 03:10:25 +00:00
|
|
|
ST_SetNeedRefresh();
|
|
|
|
V_SetBorderNeedRefresh();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// [RH] Allow temporarily disabling wipes
|
|
|
|
if (NoWipe)
|
|
|
|
{
|
2013-02-27 03:10:25 +00:00
|
|
|
V_SetBorderNeedRefresh();
|
2006-02-24 04:48:15 +00:00
|
|
|
NoWipe--;
|
|
|
|
wipe = false;
|
|
|
|
wipegamestate = gamestate;
|
|
|
|
}
|
|
|
|
else if (gamestate != wipegamestate && gamestate != GS_FULLCONSOLE && gamestate != GS_TITLELEVEL)
|
|
|
|
{ // save the current screen if about to wipe
|
2013-02-27 03:10:25 +00:00
|
|
|
V_SetBorderNeedRefresh();
|
2010-10-06 10:44:03 +00:00
|
|
|
switch (wipegamestate)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-10-06 10:44:03 +00:00
|
|
|
default:
|
2007-12-30 04:18:39 +00:00
|
|
|
wipe = screen->WipeStartScreen (wipetype);
|
2010-10-06 10:44:03 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GS_FORCEWIPEFADE:
|
2007-12-30 04:18:39 +00:00
|
|
|
wipe = screen->WipeStartScreen (wipe_Fade);
|
2010-10-06 10:44:03 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GS_FORCEWIPEBURN:
|
|
|
|
wipe = screen->WipeStartScreen (wipe_Burn);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GS_FORCEWIPEMELT:
|
|
|
|
wipe = screen->WipeStartScreen (wipe_Melt);
|
|
|
|
break;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
wipegamestate = gamestate;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wipe = false;
|
|
|
|
}
|
|
|
|
|
2007-12-27 04:30:12 +00:00
|
|
|
hw2d = false;
|
|
|
|
|
2014-08-01 00:43:36 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-12-11 12:00:40 +00:00
|
|
|
unsigned int nowtime = I_FPSTime();
|
|
|
|
TexMan.UpdateAnimations(nowtime);
|
|
|
|
R_UpdateSky(nowtime);
|
2006-02-24 04:48:15 +00:00
|
|
|
switch (gamestate)
|
|
|
|
{
|
|
|
|
case GS_FULLCONSOLE:
|
2007-12-18 01:50:08 +00:00
|
|
|
screen->SetBlendingRect(0,0,0,0);
|
2008-01-02 05:21:48 +00:00
|
|
|
hw2d = screen->Begin2D(false);
|
2007-12-27 04:30:12 +00:00
|
|
|
C_DrawConsole (false);
|
2006-02-24 04:48:15 +00:00
|
|
|
M_Drawer ();
|
2008-01-01 03:07:05 +00:00
|
|
|
screen->Update ();
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
case GS_LEVEL:
|
|
|
|
case GS_TITLELEVEL:
|
|
|
|
if (!gametic)
|
|
|
|
break;
|
|
|
|
|
2008-01-02 05:21:48 +00:00
|
|
|
if (StatusBar != NULL)
|
2007-12-18 01:50:08 +00:00
|
|
|
{
|
2008-01-02 05:21:48 +00:00
|
|
|
float blend[4] = { 0, 0, 0, 0 };
|
|
|
|
StatusBar->BlendView (blend);
|
2007-12-18 01:50:08 +00:00
|
|
|
}
|
2008-01-02 05:21:48 +00:00
|
|
|
screen->SetBlendingRect(viewwindowx, viewwindowy,
|
- Ported vlinetallasm4 to AMD64 assembly. Even with the increased number of
registers AMD64 provides, this routine still needs to be written as self-
modifying code for maximum performance. The additional registers do allow
for further optimization over the x86 version by allowing all four pixels
to be in flight at the same time. The end result is that AMD64 ASM is about
2.18 times faster than AMD64 C and about 1.06 times faster than x86 ASM.
(For further comparison, AMD64 C and x86 C are practically the same for
this function.) Should I port any more assembly to AMD64, mvlineasm4 is the
most likely candidate, but it's not used enough at this point to bother.
Also, this may or may not work with Linux at the moment, since it doesn't
have the eh_handler metadata. Win64 is easier, since I just need to
structure the function prologue and epilogue properly and use some
assembler directives/macros to automatically generate the metadata. And
that brings up another point: You need YASM to assemble the AMD64 code,
because NASM doesn't support the Win64 metadata directives.
- Added an SSE version of DoBlending. This is strictly C intrinsics.
VC++ still throws around unneccessary register moves. GCC seems to be
pretty close to optimal, requiring only about 2 cycles/color. They're
both faster than my hand-written MMX routine, so I don't need to feel
bad about not hand-optimizing this for x64 builds.
- Removed an extra instruction from DoBlending_MMX, transposed two
instructions, and unrolled it once, shaving off about 80 cycles from the
time required to blend 256 palette entries. Why? Because I tried writing
a C version of the routine using compiler intrinsics and was appalled by
all the extra movq's VC++ added to the code. GCC was better, but still
generated extra instructions. I only wanted a C version because I can't
use inline assembly with VC++'s x64 compiler, and x64 assembly is a bit
of a pain. (It's a pain because Linux and Windows have different calling
conventions, and you need to maintain extra metadata for functions.) So,
the assembly version stays and the C version stays out.
- Removed all the pixel doubling r_detail modes, since the one platform they
were intended to assist (486) actually sees very little benefit from them.
- Rewrote CheckMMX in C and renamed it to CheckCPU.
- Fixed: CPUID function 0x80000005 is specified to return detailed L1 cache
only for AMD processors, so we must not use it on other architectures, or
we end up overwriting the L1 cache line size with 0 or some other number
we don't actually understand.
SVN r1134 (trunk)
2008-08-09 03:13:43 +00:00
|
|
|
viewwindowx + viewwidth, viewwindowy + viewheight);
|
2014-09-26 04:11:52 +00:00
|
|
|
|
2011-07-07 15:37:47 +00:00
|
|
|
Renderer->RenderView(&players[consoleplayer]);
|
2014-09-26 04:11:52 +00:00
|
|
|
|
2008-01-04 05:22:30 +00:00
|
|
|
if ((hw2d = screen->Begin2D(viewactive)))
|
|
|
|
{
|
|
|
|
// Redraw everything every frame when using 2D accel
|
2013-02-27 03:10:25 +00:00
|
|
|
ST_SetNeedRefresh();
|
|
|
|
V_SetBorderNeedRefresh();
|
2008-01-04 05:22:30 +00:00
|
|
|
}
|
2011-07-07 15:37:47 +00:00
|
|
|
Renderer->DrawRemainingPlayerSprites();
|
2009-09-20 03:50:05 +00:00
|
|
|
screen->DrawBlendingRect();
|
2006-02-24 04:48:15 +00:00
|
|
|
if (automapactive)
|
|
|
|
{
|
- Ported vlinetallasm4 to AMD64 assembly. Even with the increased number of
registers AMD64 provides, this routine still needs to be written as self-
modifying code for maximum performance. The additional registers do allow
for further optimization over the x86 version by allowing all four pixels
to be in flight at the same time. The end result is that AMD64 ASM is about
2.18 times faster than AMD64 C and about 1.06 times faster than x86 ASM.
(For further comparison, AMD64 C and x86 C are practically the same for
this function.) Should I port any more assembly to AMD64, mvlineasm4 is the
most likely candidate, but it's not used enough at this point to bother.
Also, this may or may not work with Linux at the moment, since it doesn't
have the eh_handler metadata. Win64 is easier, since I just need to
structure the function prologue and epilogue properly and use some
assembler directives/macros to automatically generate the metadata. And
that brings up another point: You need YASM to assemble the AMD64 code,
because NASM doesn't support the Win64 metadata directives.
- Added an SSE version of DoBlending. This is strictly C intrinsics.
VC++ still throws around unneccessary register moves. GCC seems to be
pretty close to optimal, requiring only about 2 cycles/color. They're
both faster than my hand-written MMX routine, so I don't need to feel
bad about not hand-optimizing this for x64 builds.
- Removed an extra instruction from DoBlending_MMX, transposed two
instructions, and unrolled it once, shaving off about 80 cycles from the
time required to blend 256 palette entries. Why? Because I tried writing
a C version of the routine using compiler intrinsics and was appalled by
all the extra movq's VC++ added to the code. GCC was better, but still
generated extra instructions. I only wanted a C version because I can't
use inline assembly with VC++'s x64 compiler, and x64 assembly is a bit
of a pain. (It's a pain because Linux and Windows have different calling
conventions, and you need to maintain extra metadata for functions.) So,
the assembly version stays and the C version stays out.
- Removed all the pixel doubling r_detail modes, since the one platform they
were intended to assist (486) actually sees very little benefit from them.
- Rewrote CheckMMX in C and renamed it to CheckCPU.
- Fixed: CPUID function 0x80000005 is specified to return detailed L1 cache
only for AMD processors, so we must not use it on other architectures, or
we end up overwriting the L1 cache line size with 0 or some other number
we don't actually understand.
SVN r1134 (trunk)
2008-08-09 03:13:43 +00:00
|
|
|
int saved_ST_Y = ST_Y;
|
|
|
|
if (hud_althud && viewheight == SCREENHEIGHT)
|
|
|
|
{
|
|
|
|
ST_Y = viewheight;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
AM_Drawer ();
|
2008-01-11 22:38:10 +00:00
|
|
|
ST_Y = saved_ST_Y;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-01-04 05:22:30 +00:00
|
|
|
if (!automapactive || viewactive)
|
2007-12-27 04:30:12 +00:00
|
|
|
{
|
2011-07-05 20:41:53 +00:00
|
|
|
V_RefreshViewBorder ();
|
2007-12-27 04:30:12 +00:00
|
|
|
}
|
2008-01-11 22:38:10 +00:00
|
|
|
|
2008-12-06 10:22:37 +00:00
|
|
|
if (hud_althud && viewheight == SCREENHEIGHT && screenblocks > 10)
|
2008-01-11 22:38:10 +00:00
|
|
|
{
|
2013-01-21 21:02:14 +00:00
|
|
|
StatusBar->DrawBottomStuff (HUD_AltHud);
|
2008-01-11 22:38:10 +00:00
|
|
|
if (DrawFSHUD || automapactive) DrawHUD();
|
2013-01-21 21:02:14 +00:00
|
|
|
StatusBar->Draw (HUD_AltHud);
|
|
|
|
StatusBar->DrawTopStuff (HUD_AltHud);
|
2008-01-11 22:38:10 +00:00
|
|
|
}
|
|
|
|
else
|
2008-12-06 10:22:37 +00:00
|
|
|
if (viewheight == SCREENHEIGHT && viewactive && screenblocks > 10)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2012-08-12 22:24:15 +00:00
|
|
|
EHudState state = DrawFSHUD ? HUD_Fullscreen : HUD_None;
|
|
|
|
StatusBar->DrawBottomStuff (state);
|
|
|
|
StatusBar->Draw (state);
|
|
|
|
StatusBar->DrawTopStuff (state);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-12 22:24:15 +00:00
|
|
|
StatusBar->DrawBottomStuff (HUD_StatusBar);
|
2006-02-24 04:48:15 +00:00
|
|
|
StatusBar->Draw (HUD_StatusBar);
|
|
|
|
StatusBar->DrawTopStuff (HUD_StatusBar);
|
|
|
|
}
|
|
|
|
CT_Drawer ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GS_INTERMISSION:
|
2007-12-18 01:50:08 +00:00
|
|
|
screen->SetBlendingRect(0,0,0,0);
|
2008-01-02 05:21:48 +00:00
|
|
|
hw2d = screen->Begin2D(false);
|
2006-02-24 04:48:15 +00:00
|
|
|
WI_Drawer ();
|
|
|
|
CT_Drawer ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GS_FINALE:
|
2007-12-18 01:50:08 +00:00
|
|
|
screen->SetBlendingRect(0,0,0,0);
|
2008-01-02 05:21:48 +00:00
|
|
|
hw2d = screen->Begin2D(false);
|
2006-02-24 04:48:15 +00:00
|
|
|
F_Drawer ();
|
|
|
|
CT_Drawer ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GS_DEMOSCREEN:
|
2007-12-18 01:50:08 +00:00
|
|
|
screen->SetBlendingRect(0,0,0,0);
|
2008-01-02 05:21:48 +00:00
|
|
|
hw2d = screen->Begin2D(false);
|
2006-02-24 04:48:15 +00:00
|
|
|
D_PageDrawer ();
|
|
|
|
CT_Drawer ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// draw pause pic
|
2014-11-10 13:19:24 +00:00
|
|
|
if ((paused || pauseext) && menuactive == MENU_Off)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
FTexture *tex;
|
|
|
|
int x;
|
2014-11-10 13:19:24 +00:00
|
|
|
FString pstring = "By ";
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2013-08-12 20:46:45 +00:00
|
|
|
tex = TexMan(gameinfo.PauseSign);
|
2009-08-11 20:40:09 +00:00
|
|
|
x = (SCREENWIDTH - tex->GetScaledWidth() * CleanXfac)/2 +
|
|
|
|
tex->GetScaledLeftOffset() * CleanXfac;
|
2006-02-24 04:48:15 +00:00
|
|
|
screen->DrawTexture (tex, x, 4, DTA_CleanNoMove, true, TAG_DONE);
|
2014-11-10 13:19:24 +00:00
|
|
|
if (paused && multiplayer)
|
|
|
|
{
|
|
|
|
pstring += players[paused - 1].userinfo.GetName();
|
|
|
|
screen->DrawText(SmallFont, CR_RED,
|
|
|
|
(screen->GetWidth() - SmallFont->StringWidth(pstring)*CleanXfac) / 2,
|
|
|
|
(tex->GetScaledHeight() * CleanYfac) + 4, pstring, DTA_CleanNoMove, true, TAG_DONE);
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// [RH] Draw icon, if any
|
|
|
|
if (D_DrawIcon)
|
|
|
|
{
|
2008-06-15 18:36:26 +00:00
|
|
|
FTextureID picnum = TexMan.CheckForTexture (D_DrawIcon, FTexture::TEX_MiscPatch);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
D_DrawIcon = NULL;
|
2008-06-15 18:36:26 +00:00
|
|
|
if (picnum.isValid())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
FTexture *tex = TexMan[picnum];
|
2009-08-11 20:40:09 +00:00
|
|
|
screen->DrawTexture (tex, 160 - tex->GetScaledWidth()/2, 100 - tex->GetScaledHeight()/2,
|
2006-02-24 04:48:15 +00:00
|
|
|
DTA_320x200, true, TAG_DONE);
|
|
|
|
}
|
|
|
|
NoWipe = 10;
|
|
|
|
}
|
|
|
|
|
2008-07-01 01:28:22 +00:00
|
|
|
if (snd_drawoutput)
|
2008-04-11 04:59:23 +00:00
|
|
|
{
|
|
|
|
GSnd->DrawWaveDebug(snd_drawoutput);
|
|
|
|
}
|
|
|
|
|
2008-01-01 03:07:05 +00:00
|
|
|
if (!wipe || NoWipe < 0)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2007-12-27 04:30:12 +00:00
|
|
|
NetUpdate (); // send out any new accumulation
|
2006-02-24 04:48:15 +00:00
|
|
|
// normal update
|
2007-12-27 04:30:12 +00:00
|
|
|
C_DrawConsole (hw2d); // draw console
|
|
|
|
M_Drawer (); // menu is drawn even on top of everything
|
2006-02-24 04:48:15 +00:00
|
|
|
FStat::PrintStat ();
|
2008-10-21 02:27:21 +00:00
|
|
|
screen->Update (); // page flip or blit buffer
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// wipe update
|
2008-10-21 02:27:21 +00:00
|
|
|
unsigned int wipestart, nowtime, diff;
|
2006-09-14 00:02:31 +00:00
|
|
|
bool done;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-07-05 03:32:44 +00:00
|
|
|
GSnd->SetSfxPaused(true, 1);
|
2008-10-21 02:27:21 +00:00
|
|
|
I_FreezeTime(true);
|
2007-12-30 04:18:39 +00:00
|
|
|
screen->WipeEndScreen ();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-10-21 02:27:21 +00:00
|
|
|
wipestart = I_MSTime();
|
|
|
|
NetUpdate(); // send out any new accumulation
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2008-10-21 02:27:21 +00:00
|
|
|
do
|
|
|
|
{
|
|
|
|
I_WaitVBL(2);
|
|
|
|
nowtime = I_MSTime();
|
|
|
|
diff = (nowtime - wipestart) * 40 / 1000; // Using 35 here feels too slow.
|
|
|
|
} while (diff < 1);
|
2006-02-24 04:48:15 +00:00
|
|
|
wipestart = nowtime;
|
2008-10-21 02:27:21 +00:00
|
|
|
done = screen->WipeDo (1);
|
2007-12-30 04:18:39 +00:00
|
|
|
C_DrawConsole (hw2d); // console and
|
|
|
|
M_Drawer (); // menu are drawn even on top of wipes
|
2006-02-24 04:48:15 +00:00
|
|
|
screen->Update (); // page flip or blit buffer
|
2008-10-21 02:27:21 +00:00
|
|
|
NetUpdate (); // [RH] not sure this is needed anymore
|
2006-02-24 04:48:15 +00:00
|
|
|
} while (!done);
|
2007-12-30 04:18:39 +00:00
|
|
|
screen->WipeCleanup();
|
2008-10-21 02:27:21 +00:00
|
|
|
I_FreezeTime(false);
|
2008-07-05 03:32:44 +00:00
|
|
|
GSnd->SetSfxPaused(false, 1);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-08-10 03:25:08 +00:00
|
|
|
cycles.Unclock();
|
2006-02-24 04:48:15 +00:00
|
|
|
FrameCycles = cycles;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D_ErrorCleanup ()
|
|
|
|
//
|
2010-12-15 11:45:39 +00:00
|
|
|
// Cleanup after a recoverable error or a restart
|
2006-02-24 04:48:15 +00:00
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D_ErrorCleanup ()
|
|
|
|
{
|
2011-07-15 13:26:36 +00:00
|
|
|
savegamerestore = false;
|
2006-02-24 04:48:15 +00:00
|
|
|
screen->Unlock ();
|
2008-03-28 00:38:17 +00:00
|
|
|
bglobal.RemoveAllBots (true);
|
2006-02-24 04:48:15 +00:00
|
|
|
D_QuitNetGame ();
|
- Added some hackery at the start of MouseRead_Win32() that prevents it from
yanking the mouse around if they keys haven't been read yet to combat the
same situation that causes the keyboard to return DIERR_NOTACQUIRED in
KeyRead(): The window is sort of in focus and sort of not. User.dll
considers it to be focused and it's drawn as such, but another focused
window is on top of it, and DirectInput doesn't see it as focused.
- Fixed: KeyRead() should handle DIERR_NOTACQUIRED errors the same way it
handles DIERR_INPUTLOST errors. This can happen if our window had the
focus stolen away from it before we tried to acquire the keyboard in
DI_Init2(). Strangely, MouseRead_DI() already did this.
- When a stack overflow occurs, report.txt now only includes the first and
last 16KB of the stack to make it more manageable.
- Limited StreamEditBinary() to the first 64KB of the file to keep it from
taking too long on large dumps.
- And now I know why gathering crash information in the same process that
crashed can be bad: Stack overflows. You get one spare page to play with
when the stack overflows. MiniDumpWriteDump() needs more than that and
causes an access violation when it runs out of leftover stack, silently
terminating the application. Windows XP x64 offers SetThreadStackGuarantee()
to increase this, but that isn't available on anything older, including
32-bit XP. To get around this, a new thread is created to write the mini
dump when the stack overflows.
- Changed A_Burnination() to be closer to Strife's.
- Fixed: When playing back demos, DoAddBot() can be called without an
associated call to SpawnBot(). So if the bot can't spawn, botnum can
go negative, which will cause problems later in DCajunMaster::Main()
when it sees that wanted_botnum (0) is higher than botnum (-1).
- Fixed: Stopping demo recording in multiplayer games should not abruptly
drop the recorder out of the game without notifying the other players.
In fact, there's no reason why it should drop them out of multiplayer at
all.
- Fixed: Earthquakes were unreliable in multiplayer games because
P_PredictPlayer() did not preserve the player's xviewshift.
- Fixed: PlayerIsGone() needs to stop any scripts that belong to the player
who left, in addition to executing disconnect scripts.
- Fixed: APlayerPawn::AddInventory() should also check for a NULL player->mo
in case the player left but somebody still has a reference to their actor.
- Fixed: DDrawFB::PaintToWindow() should simulate proper unlocking behavior
and set Buffer to NULL.
- Improved feedback for network game initialization with the console ticker.
- Moved i_net.cpp and i_net.h out of sdl/ and win32/ and into the main source
directory. They are identical, so keeping two copies of them is bad.
- Fixed: (At least with Creative's driver's,) EAX settings are global and not
per-application. So if you play a multiplayer ZDoom game on one computer
(or even another EAX-using application), ZDoom needs to restore the
environment when it regains focus.
- Maybe fixed: (See http://forum.zdoom.org/potato.php?t=10689) Apparently,
PacketGet can receive ECONNRESET from nodes that aren't in the game. It
should be safe to just ignore these packets.
- Fixed: PlayerIsGone() should set the gone player's camera to NULL in case
the player who left was player 0. This is because if a remaining player
receives a "recoverable" error, they will become player 0. Once that happens,
they game will try to update sounds through their camera and crash in
FMODSoundRenderer::UpdateListener() because the zones array is now NULL.
G_NewInit() should also clear all the player structures.
SVN r233 (trunk)
2006-06-30 02:13:26 +00:00
|
|
|
if (demorecording || demoplayback)
|
|
|
|
G_CheckDemoStatus ();
|
2006-02-24 04:48:15 +00:00
|
|
|
Net_ClearBuffers ();
|
|
|
|
G_NewInit ();
|
|
|
|
singletics = false;
|
|
|
|
playeringame[0] = 1;
|
|
|
|
players[0].playerstate = PST_LIVE;
|
|
|
|
gameaction = ga_fullconsole;
|
2009-05-26 01:56:35 +00:00
|
|
|
if (gamestate == GS_DEMOSCREEN)
|
|
|
|
{
|
|
|
|
menuactive = MENU_Off;
|
|
|
|
}
|
- Added some hackery at the start of MouseRead_Win32() that prevents it from
yanking the mouse around if they keys haven't been read yet to combat the
same situation that causes the keyboard to return DIERR_NOTACQUIRED in
KeyRead(): The window is sort of in focus and sort of not. User.dll
considers it to be focused and it's drawn as such, but another focused
window is on top of it, and DirectInput doesn't see it as focused.
- Fixed: KeyRead() should handle DIERR_NOTACQUIRED errors the same way it
handles DIERR_INPUTLOST errors. This can happen if our window had the
focus stolen away from it before we tried to acquire the keyboard in
DI_Init2(). Strangely, MouseRead_DI() already did this.
- When a stack overflow occurs, report.txt now only includes the first and
last 16KB of the stack to make it more manageable.
- Limited StreamEditBinary() to the first 64KB of the file to keep it from
taking too long on large dumps.
- And now I know why gathering crash information in the same process that
crashed can be bad: Stack overflows. You get one spare page to play with
when the stack overflows. MiniDumpWriteDump() needs more than that and
causes an access violation when it runs out of leftover stack, silently
terminating the application. Windows XP x64 offers SetThreadStackGuarantee()
to increase this, but that isn't available on anything older, including
32-bit XP. To get around this, a new thread is created to write the mini
dump when the stack overflows.
- Changed A_Burnination() to be closer to Strife's.
- Fixed: When playing back demos, DoAddBot() can be called without an
associated call to SpawnBot(). So if the bot can't spawn, botnum can
go negative, which will cause problems later in DCajunMaster::Main()
when it sees that wanted_botnum (0) is higher than botnum (-1).
- Fixed: Stopping demo recording in multiplayer games should not abruptly
drop the recorder out of the game without notifying the other players.
In fact, there's no reason why it should drop them out of multiplayer at
all.
- Fixed: Earthquakes were unreliable in multiplayer games because
P_PredictPlayer() did not preserve the player's xviewshift.
- Fixed: PlayerIsGone() needs to stop any scripts that belong to the player
who left, in addition to executing disconnect scripts.
- Fixed: APlayerPawn::AddInventory() should also check for a NULL player->mo
in case the player left but somebody still has a reference to their actor.
- Fixed: DDrawFB::PaintToWindow() should simulate proper unlocking behavior
and set Buffer to NULL.
- Improved feedback for network game initialization with the console ticker.
- Moved i_net.cpp and i_net.h out of sdl/ and win32/ and into the main source
directory. They are identical, so keeping two copies of them is bad.
- Fixed: (At least with Creative's driver's,) EAX settings are global and not
per-application. So if you play a multiplayer ZDoom game on one computer
(or even another EAX-using application), ZDoom needs to restore the
environment when it regains focus.
- Maybe fixed: (See http://forum.zdoom.org/potato.php?t=10689) Apparently,
PacketGet can receive ECONNRESET from nodes that aren't in the game. It
should be safe to just ignore these packets.
- Fixed: PlayerIsGone() should set the gone player's camera to NULL in case
the player who left was player 0. This is because if a remaining player
receives a "recoverable" error, they will become player 0. Once that happens,
they game will try to update sounds through their camera and crash in
FMODSoundRenderer::UpdateListener() because the zones array is now NULL.
G_NewInit() should also clear all the player structures.
SVN r233 (trunk)
2006-06-30 02:13:26 +00:00
|
|
|
insave = false;
|
2011-07-07 15:37:47 +00:00
|
|
|
Renderer->ErrorCleanup();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D_DoomLoop
|
|
|
|
//
|
|
|
|
// Manages timing and IO, calls all ?_Responder, ?_Ticker, and ?_Drawer,
|
|
|
|
// calls I_GetTime, I_StartFrame, and I_StartTic
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D_DoomLoop ()
|
|
|
|
{
|
|
|
|
int lasttic = 0;
|
|
|
|
|
2009-11-12 03:14:10 +00:00
|
|
|
// Clamp the timer to TICRATE until the playloop has been entered.
|
|
|
|
r_NoInterpolate = true;
|
2010-12-12 23:52:00 +00:00
|
|
|
Page = Advisory = NULL;
|
2009-11-12 03:14:10 +00:00
|
|
|
|
2010-09-26 07:46:34 +00:00
|
|
|
vid_cursor.Callback();
|
2010-09-14 17:28:18 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
// frame syncronous IO operations
|
|
|
|
if (gametic > lasttic)
|
|
|
|
{
|
|
|
|
lasttic = gametic;
|
|
|
|
I_StartFrame ();
|
|
|
|
}
|
|
|
|
|
|
|
|
// process one or more tics
|
|
|
|
if (singletics)
|
|
|
|
{
|
|
|
|
I_StartTic ();
|
|
|
|
D_ProcessEvents ();
|
|
|
|
G_BuildTiccmd (&netcmds[consoleplayer][maketic%BACKUPTICS]);
|
|
|
|
if (advancedemo)
|
|
|
|
D_DoAdvanceDemo ();
|
|
|
|
C_Ticker ();
|
|
|
|
M_Ticker ();
|
|
|
|
G_Ticker ();
|
2008-03-13 00:41:16 +00:00
|
|
|
// [RH] Use the consoleplayer's camera to update sounds
|
|
|
|
S_UpdateSounds (players[consoleplayer].camera); // move positional sounds
|
2006-02-24 04:48:15 +00:00
|
|
|
gametic++;
|
|
|
|
maketic++;
|
2008-03-12 02:56:11 +00:00
|
|
|
GC::CheckGC ();
|
2006-02-24 04:48:15 +00:00
|
|
|
Net_NewMakeTic ();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TryRunTics (); // will run at least one tic
|
|
|
|
}
|
|
|
|
// Update display, next frame, with current state.
|
|
|
|
I_StartTic ();
|
2008-01-01 03:07:05 +00:00
|
|
|
D_Display ();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
catch (CRecoverableError &error)
|
|
|
|
{
|
|
|
|
if (error.GetMessage ())
|
|
|
|
{
|
|
|
|
Printf (PRINT_BOLD, "\n%s\n", error.GetMessage());
|
|
|
|
}
|
|
|
|
D_ErrorCleanup ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D_PageTicker
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D_PageTicker (void)
|
|
|
|
{
|
|
|
|
if (--pagetic < 0)
|
|
|
|
D_AdvanceDemo ();
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D_PageDrawer
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D_PageDrawer (void)
|
|
|
|
{
|
|
|
|
if (Page != NULL)
|
|
|
|
{
|
|
|
|
screen->DrawTexture (Page, 0, 0,
|
2009-11-15 14:33:35 +00:00
|
|
|
DTA_Fullscreen, true,
|
2006-02-24 04:48:15 +00:00
|
|
|
DTA_Masked, false,
|
- Tried adding bilinear filtering support for paletted textures, but the
shader seems to be producing crappy output, so it's disabled for now.
Specifically, it produces distorted output at regular intervals for
textures that aren't power-of-2-sized, and it's still doing visible
filtering when the texture is rendered at its original size, so
obviously it's not doing something right.
- Fixed the use of power-of-2-sized native textures for smaller game
textures again.
- Fixed: D3DFB did not restore all the state it needed to after resetting
the device.
- Fixed: R_DrawTopBorder() must clip itself around the 3D view, since it's
now drawn later.
- With full software rendering, palette flashes once again effect the whole
screen.
Changes I neglected to put in the previous commit log:
- Moved the view border drawing into the 2D mode part. When using Begin2D()
now, the only part of the software buffer that gets updated to the screen
is the part with the actual 3D scene and only if you tell it to.
- Fixed a D3D memory leak on every frame in windowed mode and the same thing
for the screen wipes. Note to self: If it's an interface, be sure to
Release it, because it will be AddRef'ed before being returned to you.
- Moved the BlendView() call out of FBaseStatusBar::Draw() so that it can be
applied before copying the 3D scene to the screen underneath the 2D parts.
- Restored the console's darkening level to its old table-based amount.
- Fixed D3DFB::SetColorOverlay()'s incorrect calculations.
- Fixed the D3D screen wipes for letterboxed modes.
SVN r662 (trunk)
2008-01-03 05:39:36 +00:00
|
|
|
DTA_BilinearFilter, true,
|
2006-02-24 04:48:15 +00:00
|
|
|
TAG_DONE);
|
|
|
|
screen->FillBorder (NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-12-22 04:52:51 +00:00
|
|
|
screen->Clear (0, 0, SCREENWIDTH, SCREENHEIGHT, 0, 0);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (!PageBlank)
|
|
|
|
{
|
2008-11-27 17:43:36 +00:00
|
|
|
screen->DrawText (SmallFont, CR_WHITE, 0, 0, "Page graphic goes here", TAG_DONE);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (Advisory != NULL)
|
|
|
|
{
|
|
|
|
screen->DrawTexture (Advisory, 4, 160, DTA_320x200, true, TAG_DONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D_AdvanceDemo
|
|
|
|
//
|
|
|
|
// Called after each demo or intro demosequence finishes
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D_AdvanceDemo (void)
|
|
|
|
{
|
|
|
|
advancedemo = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D_DoStrifeAdvanceDemo
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D_DoStrifeAdvanceDemo ()
|
|
|
|
{
|
|
|
|
static const char *const fullVoices[6] =
|
|
|
|
{
|
|
|
|
"svox/pro1", "svox/pro2", "svox/pro3", "svox/pro4", "svox/pro5", "svox/pro6"
|
|
|
|
};
|
|
|
|
static const char *const teaserVoices[6] =
|
|
|
|
{
|
|
|
|
"svox/voc91", "svox/voc92", "svox/voc93", "svox/voc94", "svox/voc95", "svox/voc96"
|
|
|
|
};
|
|
|
|
const char *const *voices = gameinfo.flags & GI_SHAREWARE ? teaserVoices : fullVoices;
|
|
|
|
const char *pagename = NULL;
|
|
|
|
|
|
|
|
gamestate = GS_DEMOSCREEN;
|
|
|
|
PageBlank = false;
|
|
|
|
|
|
|
|
switch (demosequence)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case 0:
|
|
|
|
pagetic = 6 * TICRATE;
|
|
|
|
pagename = "TITLEPIC";
|
2006-06-19 15:31:10 +00:00
|
|
|
if (Wads.CheckNumForName ("d_logo", ns_music) < 0)
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // strife0.wad does not have d_logo
|
|
|
|
S_StartMusic ("");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
S_StartMusic ("d_logo");
|
|
|
|
}
|
|
|
|
C_HideConsole ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
// [RH] Strife fades to black and then to the Rogue logo, but
|
|
|
|
// I think it looks better if it doesn't fade.
|
|
|
|
pagetic = 10 * TICRATE/35;
|
|
|
|
pagename = ""; // PANEL0, but strife0.wad doesn't have it, so don't use it.
|
|
|
|
PageBlank = true;
|
2008-07-23 19:39:01 +00:00
|
|
|
S_Sound (CHAN_VOICE | CHAN_UI, "bishop/active", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
pagetic = 4 * TICRATE;
|
|
|
|
pagename = "RGELOGO";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
pagetic = 7 * TICRATE;
|
|
|
|
pagename = "PANEL1";
|
2008-07-23 19:39:01 +00:00
|
|
|
S_Sound (CHAN_VOICE | CHAN_UI, voices[0], 1, ATTN_NORM);
|
2010-01-22 05:17:57 +00:00
|
|
|
// The new Strife teaser has D_FMINTR.
|
|
|
|
// The full retail Strife has D_INTRO.
|
|
|
|
// And the old Strife teaser has both. (I do not know which one it actually uses, nor do I care.)
|
|
|
|
S_StartMusic (gameinfo.flags & GI_TEASER2 ? "d_fmintr" : "d_intro");
|
2006-02-24 04:48:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
pagetic = 9 * TICRATE;
|
|
|
|
pagename = "PANEL2";
|
2008-07-23 19:39:01 +00:00
|
|
|
S_Sound (CHAN_VOICE | CHAN_UI, voices[1], 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
pagetic = 12 * TICRATE;
|
|
|
|
pagename = "PANEL3";
|
2008-07-23 19:39:01 +00:00
|
|
|
S_Sound (CHAN_VOICE | CHAN_UI, voices[2], 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 6:
|
|
|
|
pagetic = 11 * TICRATE;
|
|
|
|
pagename = "PANEL4";
|
2008-07-23 19:39:01 +00:00
|
|
|
S_Sound (CHAN_VOICE | CHAN_UI, voices[3], 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 7:
|
|
|
|
pagetic = 10 * TICRATE;
|
|
|
|
pagename = "PANEL5";
|
2008-07-23 19:39:01 +00:00
|
|
|
S_Sound (CHAN_VOICE | CHAN_UI, voices[4], 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 8:
|
|
|
|
pagetic = 16 * TICRATE;
|
|
|
|
pagename = "PANEL6";
|
2008-07-23 19:39:01 +00:00
|
|
|
S_Sound (CHAN_VOICE | CHAN_UI, voices[5], 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 9:
|
|
|
|
pagetic = 6 * TICRATE;
|
|
|
|
pagename = "vellogo";
|
|
|
|
wipegamestate = GS_FORCEWIPEFADE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 10:
|
|
|
|
pagetic = 12 * TICRATE;
|
|
|
|
pagename = "CREDIT";
|
|
|
|
wipegamestate = GS_FORCEWIPEFADE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (demosequence++ > 10)
|
|
|
|
demosequence = 0;
|
|
|
|
if (demosequence == 9 && !(gameinfo.flags & GI_SHAREWARE))
|
|
|
|
demosequence = 10;
|
|
|
|
|
|
|
|
if (pagename)
|
|
|
|
{
|
|
|
|
if (Page != NULL)
|
|
|
|
{
|
|
|
|
Page->Unload ();
|
|
|
|
Page = NULL;
|
|
|
|
}
|
|
|
|
if (pagename[0])
|
|
|
|
{
|
|
|
|
Page = TexMan[pagename];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D_DoAdvanceDemo
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D_DoAdvanceDemo (void)
|
|
|
|
{
|
|
|
|
static char demoname[8] = "DEMO1";
|
|
|
|
static int democount = 0;
|
|
|
|
static int pagecount;
|
2014-05-13 10:44:17 +00:00
|
|
|
FString pagename;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2011-12-06 01:50:38 +00:00
|
|
|
advancedemo = false;
|
|
|
|
|
|
|
|
if (gameaction != ga_nothing)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
V_SetBlend (0,0,0,0);
|
|
|
|
players[consoleplayer].playerstate = PST_LIVE; // not reborn
|
|
|
|
usergame = false; // no save / end game here
|
|
|
|
paused = 0;
|
|
|
|
|
|
|
|
// [RH] If you want something more dynamic for your title, create a map
|
|
|
|
// and name it TITLEMAP. That map will be loaded and used as the title.
|
2006-06-19 15:31:10 +00:00
|
|
|
|
2008-04-05 12:14:33 +00:00
|
|
|
if (P_CheckMapData("TITLEMAP"))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
G_InitNew ("TITLEMAP", true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gameinfo.gametype == GAME_Strife)
|
|
|
|
{
|
|
|
|
D_DoStrifeAdvanceDemo ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (demosequence)
|
|
|
|
{
|
|
|
|
case 3:
|
|
|
|
if (gameinfo.advisoryTime)
|
|
|
|
{
|
|
|
|
Advisory = TexMan["ADVISOR"];
|
|
|
|
demosequence = 1;
|
|
|
|
pagetic = (int)(gameinfo.advisoryTime * TICRATE);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// fall through to case 1 if no advisory notice
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
Advisory = NULL;
|
|
|
|
if (!M_DemoNoPlay)
|
|
|
|
{
|
2013-02-27 03:10:25 +00:00
|
|
|
V_SetBorderNeedRefresh();
|
2006-02-24 04:48:15 +00:00
|
|
|
democount++;
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
mysnprintf (demoname + 4, countof(demoname) - 4, "%d", democount);
|
2006-02-24 04:48:15 +00:00
|
|
|
if (Wads.CheckNumForName (demoname) < 0)
|
|
|
|
{
|
|
|
|
demosequence = 0;
|
|
|
|
democount = 0;
|
|
|
|
// falls through to case 0 below
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
G_DeferedPlayDemo (demoname);
|
|
|
|
demosequence = 2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
case 0:
|
|
|
|
gamestate = GS_DEMOSCREEN;
|
2014-05-13 10:44:17 +00:00
|
|
|
pagename = gameinfo.TitlePage;
|
2006-02-24 04:48:15 +00:00
|
|
|
pagetic = (int)(gameinfo.titleTime * TICRATE);
|
2013-08-12 19:11:53 +00:00
|
|
|
S_ChangeMusic (gameinfo.titleMusic, gameinfo.titleOrder, false);
|
2006-02-24 04:48:15 +00:00
|
|
|
demosequence = 3;
|
|
|
|
pagecount = 0;
|
|
|
|
C_HideConsole ();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
pagetic = (int)(gameinfo.pageTime * TICRATE);
|
|
|
|
gamestate = GS_DEMOSCREEN;
|
2010-07-01 09:35:39 +00:00
|
|
|
if (gameinfo.creditPages.Size() > 0)
|
|
|
|
{
|
|
|
|
pagename = gameinfo.creditPages[pagecount];
|
|
|
|
pagecount = (pagecount+1) % gameinfo.creditPages.Size();
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
demosequence = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-07-17 23:00:38 +00:00
|
|
|
if (pagename.IsNotEmpty())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (Page != NULL)
|
|
|
|
{
|
|
|
|
Page->Unload ();
|
|
|
|
}
|
|
|
|
Page = TexMan[pagename];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D_StartTitle
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D_StartTitle (void)
|
|
|
|
{
|
|
|
|
gameaction = ga_nothing;
|
|
|
|
demosequence = -1;
|
|
|
|
D_AdvanceDemo ();
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Cmd_Endgame
|
|
|
|
//
|
|
|
|
// [RH] Quit the current game and go to fullscreen console
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
CCMD (endgame)
|
|
|
|
{
|
|
|
|
if (!netgame)
|
|
|
|
{
|
|
|
|
gameaction = ga_fullconsole;
|
|
|
|
demosequence = -1;
|
2014-11-01 04:47:29 +00:00
|
|
|
G_CheckDemoStatus();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-25 16:34:23 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// ParseCVarInfo
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void ParseCVarInfo()
|
|
|
|
{
|
|
|
|
int lump, lastlump = 0;
|
|
|
|
bool addedcvars = false;
|
|
|
|
|
|
|
|
while ((lump = Wads.FindLump("CVARINFO", &lastlump)) != -1)
|
|
|
|
{
|
|
|
|
FScanner sc(lump);
|
|
|
|
sc.SetCMode(true);
|
|
|
|
|
|
|
|
while (sc.GetToken())
|
|
|
|
{
|
|
|
|
FString cvarname;
|
|
|
|
char *cvardefault = NULL;
|
|
|
|
ECVarType cvartype = CVAR_Dummy;
|
2013-05-25 17:08:59 +00:00
|
|
|
int cvarflags = CVAR_MOD|CVAR_ARCHIVE;
|
2013-05-25 16:34:23 +00:00
|
|
|
FBaseCVar *cvar;
|
|
|
|
|
|
|
|
// Check for flag tokens.
|
|
|
|
while (sc.TokenType == TK_Identifier)
|
|
|
|
{
|
|
|
|
if (stricmp(sc.String, "server") == 0)
|
|
|
|
{
|
|
|
|
cvarflags |= CVAR_SERVERINFO;
|
|
|
|
}
|
|
|
|
else if (stricmp(sc.String, "user") == 0)
|
|
|
|
{
|
|
|
|
cvarflags |= CVAR_USERINFO;
|
|
|
|
}
|
|
|
|
else if (stricmp(sc.String, "noarchive") == 0)
|
|
|
|
{
|
2013-05-25 17:08:59 +00:00
|
|
|
cvarflags &= ~CVAR_ARCHIVE;
|
2013-05-25 16:34:23 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sc.ScriptError("Unknown cvar attribute '%s'", sc.String);
|
|
|
|
}
|
|
|
|
sc.MustGetAnyToken();
|
|
|
|
}
|
|
|
|
// Do some sanity checks.
|
|
|
|
if ((cvarflags & (CVAR_SERVERINFO|CVAR_USERINFO)) == 0 ||
|
|
|
|
(cvarflags & (CVAR_SERVERINFO|CVAR_USERINFO)) == (CVAR_SERVERINFO|CVAR_USERINFO))
|
|
|
|
{
|
|
|
|
sc.ScriptError("One of 'server' or 'user' must be specified");
|
|
|
|
}
|
|
|
|
// The next token must be the cvar type.
|
|
|
|
if (sc.TokenType == TK_Bool)
|
|
|
|
{
|
|
|
|
cvartype = CVAR_Bool;
|
|
|
|
}
|
|
|
|
else if (sc.TokenType == TK_Int)
|
|
|
|
{
|
|
|
|
cvartype = CVAR_Int;
|
|
|
|
}
|
|
|
|
else if (sc.TokenType == TK_Float)
|
|
|
|
{
|
|
|
|
cvartype = CVAR_Float;
|
|
|
|
}
|
|
|
|
else if (sc.TokenType == TK_Color)
|
|
|
|
{
|
|
|
|
cvartype = CVAR_Color;
|
|
|
|
}
|
|
|
|
else if (sc.TokenType == TK_String)
|
|
|
|
{
|
|
|
|
cvartype = CVAR_String;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sc.ScriptError("Bad cvar type '%s'", sc.String);
|
|
|
|
}
|
|
|
|
// The next token must be the cvar name.
|
|
|
|
sc.MustGetToken(TK_Identifier);
|
|
|
|
if (FindCVar(sc.String, NULL) != NULL)
|
|
|
|
{
|
|
|
|
sc.ScriptError("cvar '%s' already exists", sc.String);
|
|
|
|
}
|
|
|
|
cvarname = sc.String;
|
|
|
|
// A default value is optional and signalled by a '=' token.
|
|
|
|
if (sc.CheckToken('='))
|
|
|
|
{
|
|
|
|
switch (cvartype)
|
|
|
|
{
|
|
|
|
case CVAR_Bool:
|
|
|
|
if (!sc.CheckToken(TK_True) && !sc.CheckToken(TK_False))
|
|
|
|
{
|
|
|
|
sc.ScriptError("Expected true or false");
|
|
|
|
}
|
|
|
|
cvardefault = sc.String;
|
|
|
|
break;
|
|
|
|
case CVAR_Int:
|
|
|
|
sc.MustGetNumber();
|
|
|
|
cvardefault = sc.String;
|
|
|
|
break;
|
|
|
|
case CVAR_Float:
|
|
|
|
sc.MustGetFloat();
|
|
|
|
cvardefault = sc.String;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
sc.MustGetString();
|
|
|
|
cvardefault = sc.String;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Now create the cvar.
|
|
|
|
cvar = C_CreateCVar(cvarname, cvartype, cvarflags);
|
|
|
|
if (cvardefault != NULL)
|
|
|
|
{
|
|
|
|
UCVarValue val;
|
|
|
|
val.String = cvardefault;
|
|
|
|
cvar->SetGenericRepDefault(val, CVAR_String);
|
|
|
|
}
|
|
|
|
// To be like C and ACS, require a semicolon after everything.
|
|
|
|
sc.MustGetToken(';');
|
|
|
|
addedcvars = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Only load mod cvars from the config if we defined some, so we don't
|
|
|
|
// clutter up the cvar space when not playing mods with custom cvars.
|
|
|
|
if (addedcvars)
|
|
|
|
{
|
|
|
|
GameConfig->DoModSetup (gameinfo.ConfigName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D_AddFile
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2010-01-01 15:31:00 +00:00
|
|
|
bool D_AddFile (TArray<FString> &wadfiles, const char *file, bool check, int position)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (file == NULL)
|
|
|
|
{
|
2010-01-01 15:31:00 +00:00
|
|
|
return false;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2009-09-02 03:47:48 +00:00
|
|
|
if (check && !DirEntryExists (file))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
const char *f = BaseFileSearch (file, ".wad");
|
|
|
|
if (f == NULL)
|
|
|
|
{
|
|
|
|
Printf ("Can't find '%s'\n", file);
|
2010-01-01 15:31:00 +00:00
|
|
|
return false;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
file = f;
|
|
|
|
}
|
|
|
|
|
2010-01-01 12:40:47 +00:00
|
|
|
FString f = file;
|
|
|
|
FixPathSeperator(f);
|
2010-01-01 15:31:00 +00:00
|
|
|
if (position == -1) wadfiles.Push(f);
|
|
|
|
else wadfiles.Insert(position, f);
|
|
|
|
return true;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D_AddWildFile
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2010-01-01 12:40:47 +00:00
|
|
|
void D_AddWildFile (TArray<FString> &wadfiles, const char *value)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
const char *wadfile = BaseFileSearch (value, ".wad");
|
|
|
|
|
|
|
|
if (wadfile != NULL)
|
|
|
|
{
|
2010-01-01 12:40:47 +00:00
|
|
|
D_AddFile (wadfiles, wadfile);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // Try pattern matching
|
|
|
|
findstate_t findstate;
|
|
|
|
char path[PATH_MAX];
|
|
|
|
char *sep;
|
|
|
|
void *handle = I_FindFirst (value, &findstate);
|
|
|
|
|
|
|
|
strcpy (path, value);
|
|
|
|
sep = strrchr (path, '/');
|
|
|
|
if (sep == NULL)
|
|
|
|
{
|
|
|
|
sep = strrchr (path, '\\');
|
|
|
|
#ifdef _WIN32
|
|
|
|
if (sep == NULL && path[1] == ':')
|
|
|
|
{
|
|
|
|
sep = path + 1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
if (handle != ((void *)-1))
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
2008-02-12 05:54:03 +00:00
|
|
|
if (!(I_FindAttr(&findstate) & FA_DIREC))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-02-12 05:54:03 +00:00
|
|
|
if (sep == NULL)
|
|
|
|
{
|
2010-01-01 12:40:47 +00:00
|
|
|
D_AddFile (wadfiles, I_FindName (&findstate));
|
2008-02-12 05:54:03 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strcpy (sep+1, I_FindName (&findstate));
|
2010-01-01 12:40:47 +00:00
|
|
|
D_AddFile (wadfiles, path);
|
2008-02-12 05:54:03 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
} while (I_FindNext (handle, &findstate) == 0);
|
|
|
|
}
|
|
|
|
I_FindClose (handle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D_AddConfigWads
|
|
|
|
//
|
|
|
|
// Adds all files in the specified config file section.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2010-01-01 12:40:47 +00:00
|
|
|
void D_AddConfigWads (TArray<FString> &wadfiles, const char *section)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
if (GameConfig->SetSection (section))
|
|
|
|
{
|
|
|
|
const char *key;
|
|
|
|
const char *value;
|
|
|
|
FConfigFile::Position pos;
|
|
|
|
|
|
|
|
while (GameConfig->NextInSection (key, value))
|
|
|
|
{
|
|
|
|
if (stricmp (key, "Path") == 0)
|
|
|
|
{
|
|
|
|
// D_AddWildFile resets GameConfig's position, so remember it
|
|
|
|
GameConfig->GetPosition (pos);
|
2014-07-16 01:26:26 +00:00
|
|
|
D_AddWildFile (wadfiles, ExpandEnvVars(value));
|
2006-02-24 04:48:15 +00:00
|
|
|
// Reset GameConfig's position to get next wad
|
|
|
|
GameConfig->SetPosition (pos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D_AddDirectory
|
|
|
|
//
|
|
|
|
// Add all .wad files in a directory. Does not descend into subdirectories.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2010-01-01 12:40:47 +00:00
|
|
|
static void D_AddDirectory (TArray<FString> &wadfiles, const char *dir)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
char curdir[PATH_MAX];
|
|
|
|
|
|
|
|
if (getcwd (curdir, PATH_MAX))
|
|
|
|
{
|
|
|
|
char skindir[PATH_MAX];
|
|
|
|
findstate_t findstate;
|
|
|
|
void *handle;
|
|
|
|
size_t stuffstart;
|
|
|
|
|
|
|
|
stuffstart = strlen (dir);
|
|
|
|
memcpy (skindir, dir, stuffstart*sizeof(*dir));
|
|
|
|
skindir[stuffstart] = 0;
|
|
|
|
|
|
|
|
if (skindir[stuffstart-1] == '/')
|
|
|
|
{
|
|
|
|
skindir[--stuffstart] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!chdir (skindir))
|
|
|
|
{
|
|
|
|
skindir[stuffstart++] = '/';
|
|
|
|
if ((handle = I_FindFirst ("*.wad", &findstate)) != (void *)-1)
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if (!(I_FindAttr (&findstate) & FA_DIREC))
|
|
|
|
{
|
|
|
|
strcpy (skindir + stuffstart, I_FindName (&findstate));
|
2010-01-01 12:40:47 +00:00
|
|
|
D_AddFile (wadfiles, skindir);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
} while (I_FindNext (handle, &findstate) == 0);
|
|
|
|
I_FindClose (handle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
chdir (curdir);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// BaseFileSearch
|
|
|
|
//
|
|
|
|
// If a file does not exist at <file>, looks for it in the directories
|
|
|
|
// specified in the config file. Returns the path to the file, if found,
|
|
|
|
// or NULL if it could not be found.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2006-04-17 13:53:34 +00:00
|
|
|
static const char *BaseFileSearch (const char *file, const char *ext, bool lookfirstinprogdir)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
static char wad[PATH_MAX];
|
|
|
|
|
2006-04-17 13:53:34 +00:00
|
|
|
if (lookfirstinprogdir)
|
|
|
|
{
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
mysnprintf (wad, countof(wad), "%s%s%s", progdir.GetChars(), progdir[progdir.Len() - 1] != '/' ? "/" : "", file);
|
2009-09-02 03:47:48 +00:00
|
|
|
if (DirEntryExists (wad))
|
2006-04-17 13:53:34 +00:00
|
|
|
{
|
|
|
|
return wad;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-02 03:47:48 +00:00
|
|
|
if (DirEntryExists (file))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
mysnprintf (wad, countof(wad), "%s", file);
|
2006-05-11 05:00:35 +00:00
|
|
|
return wad;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (GameConfig->SetSection ("FileSearch.Directories"))
|
|
|
|
{
|
|
|
|
const char *key;
|
|
|
|
const char *value;
|
|
|
|
|
|
|
|
while (GameConfig->NextInSection (key, value))
|
|
|
|
{
|
|
|
|
if (stricmp (key, "Path") == 0)
|
|
|
|
{
|
2009-09-09 17:12:47 +00:00
|
|
|
FString dir;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-09-09 17:12:47 +00:00
|
|
|
dir = NicePath(value);
|
|
|
|
if (dir.IsNotEmpty())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2009-09-09 17:12:47 +00:00
|
|
|
mysnprintf (wad, countof(wad), "%s%s%s", dir.GetChars(), dir[dir.Len() - 1] != '/' ? "/" : "", file);
|
2009-09-02 03:47:48 +00:00
|
|
|
if (DirEntryExists (wad))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
return wad;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Retry, this time with a default extension
|
|
|
|
if (ext != NULL)
|
|
|
|
{
|
2006-05-03 22:45:01 +00:00
|
|
|
FString tmp = file;
|
2006-02-24 04:48:15 +00:00
|
|
|
DefaultExtension (tmp, ext);
|
2006-05-03 22:45:01 +00:00
|
|
|
return BaseFileSearch (tmp, NULL);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// ConsiderPatches
|
|
|
|
//
|
|
|
|
// Tries to add any deh/bex patches from the command line.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2010-03-03 04:29:40 +00:00
|
|
|
bool ConsiderPatches (const char *arg)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-03-03 04:29:40 +00:00
|
|
|
int i, argc;
|
|
|
|
FString *args;
|
|
|
|
const char *f;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2010-03-03 04:29:40 +00:00
|
|
|
argc = Args->CheckParmList(arg, &args);
|
|
|
|
for (i = 0; i < argc; ++i)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-03-03 04:29:40 +00:00
|
|
|
if ( (f = BaseFileSearch(args[i], ".deh")) ||
|
|
|
|
(f = BaseFileSearch(args[i], ".bex")) )
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-03-03 04:29:40 +00:00
|
|
|
D_LoadDehFile(f);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
2010-03-03 04:29:40 +00:00
|
|
|
return argc > 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D_MultiExec
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D_MultiExec (DArgs *list, bool usePullin)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < list->NumArgs(); ++i)
|
|
|
|
{
|
|
|
|
C_ExecFile (list->GetArg (i), usePullin);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-01 12:40:47 +00:00
|
|
|
static void GetCmdLineFiles(TArray<FString> &wadfiles)
|
|
|
|
{
|
2010-03-03 04:29:40 +00:00
|
|
|
FString *args;
|
|
|
|
int i, argc;
|
2010-01-01 12:40:47 +00:00
|
|
|
|
2010-03-03 04:29:40 +00:00
|
|
|
argc = Args->CheckParmList("-file", &args);
|
|
|
|
for (i = 0; i < argc; ++i)
|
|
|
|
{
|
|
|
|
D_AddWildFile(wadfiles, args[i]);
|
2010-01-01 12:40:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CopyFiles(TArray<FString> &to, TArray<FString> &from)
|
|
|
|
{
|
|
|
|
unsigned int ndx = to.Reserve(from.Size());
|
|
|
|
for(unsigned i=0;i<from.Size(); i++)
|
|
|
|
{
|
|
|
|
to[ndx+i] = from[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-01 15:31:00 +00:00
|
|
|
static FString ParseGameInfo(TArray<FString> &pwads, const char *fn, const char *data, int size)
|
|
|
|
{
|
|
|
|
FScanner sc;
|
|
|
|
FString iwad;
|
|
|
|
int pos = 0;
|
|
|
|
|
|
|
|
const char *lastSlash = strrchr (fn, '/');
|
|
|
|
|
|
|
|
sc.OpenMem("GAMEINFO", data, size);
|
|
|
|
while(sc.GetToken())
|
|
|
|
{
|
|
|
|
sc.TokenMustBe(TK_Identifier);
|
|
|
|
FString nextKey = sc.String;
|
|
|
|
sc.MustGetToken('=');
|
|
|
|
if (!nextKey.CompareNoCase("IWAD"))
|
|
|
|
{
|
|
|
|
sc.MustGetString();
|
|
|
|
iwad = sc.String;
|
|
|
|
}
|
|
|
|
else if (!nextKey.CompareNoCase("LOAD"))
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
2010-01-01 18:02:30 +00:00
|
|
|
sc.MustGetString();
|
2010-01-01 15:31:00 +00:00
|
|
|
|
|
|
|
// Try looking for the wad in the same directory as the .wad
|
|
|
|
// before looking for it in the current directory.
|
|
|
|
|
2014-01-26 13:32:44 +00:00
|
|
|
FString checkpath;
|
2010-01-01 15:31:00 +00:00
|
|
|
if (lastSlash != NULL)
|
|
|
|
{
|
2014-01-26 13:32:44 +00:00
|
|
|
checkpath = FString(fn, (lastSlash - fn) + 1);
|
2010-01-01 15:31:00 +00:00
|
|
|
checkpath += sc.String;
|
2014-01-26 13:32:44 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
checkpath = sc.String;
|
|
|
|
}
|
|
|
|
if (!FileExists(checkpath))
|
|
|
|
{
|
|
|
|
pos += D_AddFile(pwads, sc.String, true, pos);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pos += D_AddFile(pwads, checkpath, true, pos);
|
2010-01-01 15:31:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
while (sc.CheckToken(','));
|
|
|
|
}
|
2010-08-28 17:19:48 +00:00
|
|
|
else if (!nextKey.CompareNoCase("NOSPRITERENAME"))
|
|
|
|
{
|
2010-10-23 22:33:39 +00:00
|
|
|
sc.MustGetString();
|
|
|
|
nospriterename = sc.Compare("true");
|
2010-08-28 17:19:48 +00:00
|
|
|
}
|
2010-09-24 14:27:52 +00:00
|
|
|
else if (!nextKey.CompareNoCase("STARTUPTITLE"))
|
|
|
|
{
|
|
|
|
sc.MustGetString();
|
|
|
|
DoomStartupInfo.Name = sc.String;
|
|
|
|
}
|
|
|
|
else if (!nextKey.CompareNoCase("STARTUPCOLORS"))
|
|
|
|
{
|
|
|
|
sc.MustGetString();
|
|
|
|
DoomStartupInfo.FgColor = V_GetColor(NULL, sc.String);
|
|
|
|
sc.MustGetStringName(",");
|
|
|
|
sc.MustGetString();
|
|
|
|
DoomStartupInfo.BkColor = V_GetColor(NULL, sc.String);
|
|
|
|
}
|
2012-02-21 19:52:40 +00:00
|
|
|
else if (!nextKey.CompareNoCase("STARTUPTYPE"))
|
|
|
|
{
|
|
|
|
sc.MustGetString();
|
|
|
|
FString sttype = sc.String;
|
|
|
|
if (!sttype.CompareNoCase("DOOM"))
|
|
|
|
DoomStartupInfo.Type = FStartupInfo::DoomStartup;
|
|
|
|
else if (!sttype.CompareNoCase("HERETIC"))
|
|
|
|
DoomStartupInfo.Type = FStartupInfo::HereticStartup;
|
|
|
|
else if (!sttype.CompareNoCase("HEXEN"))
|
|
|
|
DoomStartupInfo.Type = FStartupInfo::HexenStartup;
|
|
|
|
else if (!sttype.CompareNoCase("STRIFE"))
|
|
|
|
DoomStartupInfo.Type = FStartupInfo::StrifeStartup;
|
|
|
|
else DoomStartupInfo.Type = FStartupInfo::DefaultStartup;
|
|
|
|
}
|
|
|
|
else if (!nextKey.CompareNoCase("STARTUPSONG"))
|
|
|
|
{
|
|
|
|
sc.MustGetString();
|
|
|
|
DoomStartupInfo.Song = sc.String;
|
|
|
|
}
|
2014-01-10 07:16:41 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// Silently ignore unknown properties
|
|
|
|
do
|
|
|
|
{
|
|
|
|
sc.MustGetAnyToken();
|
|
|
|
}
|
|
|
|
while(sc.CheckToken(','));
|
|
|
|
}
|
2010-01-01 15:31:00 +00:00
|
|
|
}
|
|
|
|
return iwad;
|
|
|
|
}
|
|
|
|
|
|
|
|
static FString CheckGameInfo(TArray<FString> & pwads)
|
|
|
|
{
|
|
|
|
DWORD t = I_FPSTime();
|
|
|
|
// scan the list of WADs backwards to find the last one that contains a GAMEINFO lump
|
|
|
|
for(int i=pwads.Size()-1; i>=0; i--)
|
|
|
|
{
|
|
|
|
bool isdir = false;
|
|
|
|
FileReader *wadinfo;
|
|
|
|
FResourceFile *resfile;
|
|
|
|
const char *filename = pwads[i];
|
|
|
|
|
|
|
|
// Does this exist? If so, is it a directory?
|
|
|
|
struct stat info;
|
|
|
|
if (stat(pwads[i], &info) != 0)
|
|
|
|
{
|
|
|
|
Printf(TEXTCOLOR_RED "Could not stat %s\n", filename);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
isdir = (info.st_mode & S_IFDIR) != 0;
|
|
|
|
|
|
|
|
if (!isdir)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
wadinfo = new FileReader(filename);
|
|
|
|
}
|
|
|
|
catch (CRecoverableError &)
|
|
|
|
{
|
|
|
|
// Didn't find file
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
resfile = FResourceFile::OpenResourceFile(filename, wadinfo, true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
resfile = FResourceFile::OpenDirectory(filename, true);
|
|
|
|
|
|
|
|
if (resfile != NULL)
|
|
|
|
{
|
|
|
|
DWORD cnt = resfile->LumpCount();
|
|
|
|
for(int i=cnt-1; i>=0; i--)
|
|
|
|
{
|
|
|
|
FResourceLump *lmp = resfile->GetLump(i);
|
|
|
|
|
|
|
|
if (lmp->Namespace == ns_global && !stricmp(lmp->Name, "GAMEINFO"))
|
|
|
|
{
|
|
|
|
// Found one!
|
|
|
|
FString iwad = ParseGameInfo(pwads, resfile->Filename, (const char*)lmp->CacheLump(), lmp->LumpSize);
|
|
|
|
delete resfile;
|
|
|
|
return iwad;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
delete resfile;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
t = I_FPSTime() - t;
|
|
|
|
Printf("Gameinfo scan took %d ms\n", t);
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
2010-10-15 15:40:16 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// Checks the IWAD for MAP01 and if found sets GI_MAPxx
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
static void SetMapxxFlag()
|
|
|
|
{
|
2010-10-16 22:40:27 +00:00
|
|
|
int lump_name = Wads.CheckNumForName("MAP01", ns_global, FWadCollection::IWAD_FILENUM);
|
2010-10-15 15:40:16 +00:00
|
|
|
int lump_wad = Wads.CheckNumForFullName("maps/map01.wad", FWadCollection::IWAD_FILENUM);
|
|
|
|
int lump_map = Wads.CheckNumForFullName("maps/map01.map", FWadCollection::IWAD_FILENUM);
|
|
|
|
|
|
|
|
if (lump_name >= 0 || lump_wad >= 0 || lump_map >= 0) gameinfo.flags |= GI_MAPxx;
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
2010-12-12 23:52:00 +00:00
|
|
|
// Initialize
|
2006-02-24 04:48:15 +00:00
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2010-12-12 23:52:00 +00:00
|
|
|
static void D_DoomInit()
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-06 22:59:24 +00:00
|
|
|
// Set the FPU precision to 53 significant bits. This is the default
|
|
|
|
// for Visual C++, but not for GCC, so some slight math variances
|
|
|
|
// might crop up if we leave it alone.
|
|
|
|
#if defined(_FPU_GETCW)
|
|
|
|
{
|
|
|
|
int cw;
|
|
|
|
_FPU_GETCW(cw);
|
|
|
|
cw = (cw & ~_FPU_EXTENDED) | _FPU_DOUBLE;
|
|
|
|
_FPU_SETCW(cw);
|
|
|
|
}
|
|
|
|
#elif defined(_PC_53)
|
- Ported vlinetallasm4 to AMD64 assembly. Even with the increased number of
registers AMD64 provides, this routine still needs to be written as self-
modifying code for maximum performance. The additional registers do allow
for further optimization over the x86 version by allowing all four pixels
to be in flight at the same time. The end result is that AMD64 ASM is about
2.18 times faster than AMD64 C and about 1.06 times faster than x86 ASM.
(For further comparison, AMD64 C and x86 C are practically the same for
this function.) Should I port any more assembly to AMD64, mvlineasm4 is the
most likely candidate, but it's not used enough at this point to bother.
Also, this may or may not work with Linux at the moment, since it doesn't
have the eh_handler metadata. Win64 is easier, since I just need to
structure the function prologue and epilogue properly and use some
assembler directives/macros to automatically generate the metadata. And
that brings up another point: You need YASM to assemble the AMD64 code,
because NASM doesn't support the Win64 metadata directives.
- Added an SSE version of DoBlending. This is strictly C intrinsics.
VC++ still throws around unneccessary register moves. GCC seems to be
pretty close to optimal, requiring only about 2 cycles/color. They're
both faster than my hand-written MMX routine, so I don't need to feel
bad about not hand-optimizing this for x64 builds.
- Removed an extra instruction from DoBlending_MMX, transposed two
instructions, and unrolled it once, shaving off about 80 cycles from the
time required to blend 256 palette entries. Why? Because I tried writing
a C version of the routine using compiler intrinsics and was appalled by
all the extra movq's VC++ added to the code. GCC was better, but still
generated extra instructions. I only wanted a C version because I can't
use inline assembly with VC++'s x64 compiler, and x64 assembly is a bit
of a pain. (It's a pain because Linux and Windows have different calling
conventions, and you need to maintain extra metadata for functions.) So,
the assembly version stays and the C version stays out.
- Removed all the pixel doubling r_detail modes, since the one platform they
were intended to assist (486) actually sees very little benefit from them.
- Rewrote CheckMMX in C and renamed it to CheckCPU.
- Fixed: CPUID function 0x80000005 is specified to return detailed L1 cache
only for AMD processors, so we must not use it on other architectures, or
we end up overwriting the L1 cache line size with 0 or some other number
we don't actually understand.
SVN r1134 (trunk)
2008-08-09 03:13:43 +00:00
|
|
|
// On the x64 architecture, changing the floating point precision is not supported.
|
|
|
|
#ifndef _WIN64
|
|
|
|
int cfp = _control87(_PC_53, _MCW_PC);
|
|
|
|
#endif
|
2008-08-06 22:59:24 +00:00
|
|
|
#endif
|
2008-03-12 02:56:11 +00:00
|
|
|
|
2010-05-25 02:30:05 +00:00
|
|
|
// Check response files before coalescing file parameters.
|
|
|
|
M_FindResponseFile ();
|
|
|
|
|
2010-03-03 04:29:40 +00:00
|
|
|
// Combine different file parameters with their pre-switch bits.
|
|
|
|
Args->CollectFiles("-deh", ".deh");
|
|
|
|
Args->CollectFiles("-bex", ".bex");
|
|
|
|
Args->CollectFiles("-exec", ".cfg");
|
|
|
|
Args->CollectFiles("-playdemo", ".lmp");
|
2010-05-25 02:30:05 +00:00
|
|
|
Args->CollectFiles("-file", NULL); // anything left goes after -file
|
2010-03-03 04:29:40 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
gamestate = GS_STARTUP;
|
|
|
|
|
|
|
|
SetLanguageIDs ();
|
|
|
|
|
2014-05-02 14:11:16 +00:00
|
|
|
const char *v = Args->CheckValue("-rngseed");
|
|
|
|
if (v)
|
|
|
|
{
|
|
|
|
rngseed = staticrngseed = atoi(v);
|
|
|
|
use_staticrng = true;
|
2014-05-02 14:48:52 +00:00
|
|
|
Printf("D_DoomInit: Static RNGseed %d set.\n", rngseed);
|
2014-05-02 14:11:16 +00:00
|
|
|
}
|
|
|
|
else
|
2014-05-02 15:24:51 +00:00
|
|
|
{
|
2014-05-02 14:11:16 +00:00
|
|
|
rngseed = I_MakeRNGSeed();
|
2014-05-02 15:24:51 +00:00
|
|
|
use_staticrng = false;
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
FRandom::StaticClearRandom ();
|
Note: I have not tried compiling these recent changes under Linux. I wouldn't
be surprised if it doesn't work.
- Reorganized the network startup loops so now they are event driven. There is
a single function that gets called to drive it, and it uses callbacks to
perform the different stages of the synchronization. This lets me have a nice,
responsive abort button instead of the previous unannounced hit-escape-to-
abort behavior, and I think the rearranged code is slightly easier to
understand too.
- Increased the number of bytes for version info during D_ArbitrateNetStart(),
in preparation for the day when NETGAMEVERSION requires more than one byte.
- I noticed an issue with Vista RC1 and the new fatal error setup. Even after
releasing a DirectDraw or Direct3D interface, the DWM can still use the
last image drawn using them when it composites the window. It doesn't always
do it but it does often enough that it is a real problem. At this point, I
don't know if it's a problem with the release version of Vista or not.
After messing around, I discovered the problem was caused by ~Win32Video()
hiding the window and then having it immediately shown soon after. The DWM
kept an image of the window to do the transition effect with, and then when
it didn't get a chance to do the transition, it didn't properly forget about
its saved image and kept plastering it on top of everything else
underneath.
- Added a network synchronization panel to the window during netgame startup.
- Fixed: PClass::CreateDerivedClass() must initialize StateList to NULL.
Otherwise, classic DECORATE definitions generate a big, fat crash.
- Resurrected the R_Init progress bar, now as a standard Windows control.
- Removed the sound failure dialog. The FMOD setup already defaulted to no
sound if initialization failed, so this only applies when snd_output is set
to "alternate" which now also falls back to no sound. In addition, it wasn't
working right, and I didn't feel like fixing it for the probably 0% of users
it affected.
- Fixed: The edit control used for logging output added text in reverse order
on Win9x.
- Went back to the roots and made graphics initialization one of the last
things to happen during setup. Now the startup text is visible again. More
importantly, the main window is no longer created invisible, which seems
to cause trouble with it not always appearing in the taskbar. The fatal
error dialog is now also embedded in the main window instead of being a
separate modal dialog, so you can play with the log window to see any
problems that might be reported there.
Rather than completely restoring the original startup order, I tried to
keep things as close to the way they were with early graphics startup. In
particular, V_Init() now creates a dummy screen so that things that need
screen dimensions can get them. It gets replaced by the real screen later
in I_InitGraphics(). Will need to check this under Linux to make sure it
didn't cause any problems there.
- Removed the following stubs that just called functions in Video:
- I_StartModeIterator()
- I_NextMode()
- I_DisplayType()
I_FullscreenChanged() was also removed, and a new fullscreen parameter
was added to IVideo::StartModeIterator(), since that's all it controlled.
- Renamed I_InitHardware() back to I_InitGraphics(), since that's all it's
initialized post-1.22.
SVN r416 (trunk)
2006-12-19 04:09:10 +00:00
|
|
|
|
|
|
|
Printf ("M_LoadDefaults: Load system defaults.\n");
|
2006-02-24 04:48:15 +00:00
|
|
|
M_LoadDefaults (); // load before initing other systems
|
|
|
|
|
2010-12-12 23:52:00 +00:00
|
|
|
}
|
2009-03-22 11:37:56 +00:00
|
|
|
|
2010-12-12 23:52:00 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// AddAutoloadFiles
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2010-12-12 23:52:00 +00:00
|
|
|
static void AddAutoloadFiles(const char *gamesection)
|
|
|
|
{
|
2009-04-14 09:06:03 +00:00
|
|
|
if (!(gameinfo.flags & GI_SHAREWARE) && !Args->CheckParm("-noautoload"))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-06-06 02:17:28 +00:00
|
|
|
FString file;
|
|
|
|
|
2006-11-27 21:51:36 +00:00
|
|
|
// [RH] zvox.wad - A wad I had intended to be automatically generated
|
|
|
|
// from Q2's pak0.pak so the female and cyborg player could have
|
|
|
|
// voices. I never got around to writing the utility to do it, though.
|
|
|
|
// And I probably never will now. But I know at least one person uses
|
|
|
|
// it for something else, so this gets to stay here.
|
2010-12-12 23:52:00 +00:00
|
|
|
const char *wad = BaseFileSearch ("zvox.wad", NULL);
|
2006-11-27 21:51:36 +00:00
|
|
|
if (wad)
|
2010-01-01 12:40:47 +00:00
|
|
|
D_AddFile (allwads, wad);
|
2006-11-27 21:51:36 +00:00
|
|
|
|
|
|
|
// [RH] Add any .wad files in the skins directory
|
2013-07-30 09:45:42 +00:00
|
|
|
#ifdef __unix__
|
2007-12-06 22:38:45 +00:00
|
|
|
file = SHARE_DIR;
|
2006-11-27 21:51:36 +00:00
|
|
|
#else
|
2007-12-06 22:38:45 +00:00
|
|
|
file = progdir;
|
2006-11-27 21:51:36 +00:00
|
|
|
#endif
|
2007-12-06 22:38:45 +00:00
|
|
|
file += "skins";
|
2010-01-01 12:40:47 +00:00
|
|
|
D_AddDirectory (allwads, file);
|
2009-02-08 02:52:43 +00:00
|
|
|
|
2013-07-30 09:45:42 +00:00
|
|
|
#ifdef __unix__
|
2009-02-08 02:52:43 +00:00
|
|
|
file = NicePath("~/" GAME_DIR "/skins");
|
2010-01-01 12:40:47 +00:00
|
|
|
D_AddDirectory (allwads, file);
|
2009-02-08 02:52:43 +00:00
|
|
|
#endif
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// Add common (global) wads
|
2010-01-01 12:40:47 +00:00
|
|
|
D_AddConfigWads (allwads, "Global.Autoload");
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Add game-specific wads
|
2010-10-15 15:13:53 +00:00
|
|
|
file = gameinfo.ConfigName;
|
2007-12-06 22:38:45 +00:00
|
|
|
file += ".Autoload";
|
2010-01-01 12:40:47 +00:00
|
|
|
D_AddConfigWads (allwads, file);
|
2007-12-06 22:38:45 +00:00
|
|
|
|
|
|
|
// Add IWAD-specific wads
|
2010-12-12 23:52:00 +00:00
|
|
|
if (gamesection != NULL)
|
2007-12-06 22:38:45 +00:00
|
|
|
{
|
2010-12-12 23:52:00 +00:00
|
|
|
file = gamesection;
|
2007-12-06 22:38:45 +00:00
|
|
|
file += ".Autoload";
|
2010-01-01 12:40:47 +00:00
|
|
|
D_AddConfigWads(allwads, file);
|
2007-12-06 22:38:45 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2010-12-12 23:52:00 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2010-12-12 23:52:00 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// CheckCmdLine
|
|
|
|
//
|
|
|
|
//==========================================================================
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2010-12-12 23:52:00 +00:00
|
|
|
static void CheckCmdLine()
|
|
|
|
{
|
|
|
|
int flags = dmflags;
|
|
|
|
int p;
|
|
|
|
const char *v;
|
2009-02-05 02:55:28 +00:00
|
|
|
|
2010-12-12 23:52:00 +00:00
|
|
|
Printf ("Checking cmd-line parameters...\n");
|
2008-03-12 02:56:11 +00:00
|
|
|
if (Args->CheckParm ("-nomonsters")) flags |= DF_NO_MONSTERS;
|
|
|
|
if (Args->CheckParm ("-respawn")) flags |= DF_MONSTERS_RESPAWN;
|
|
|
|
if (Args->CheckParm ("-fast")) flags |= DF_FAST_MONSTERS;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
devparm = !!Args->CheckParm ("-devparm");
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
if (Args->CheckParm ("-altdeath"))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
deathmatch = 1;
|
|
|
|
flags |= DF_ITEMS_RESPAWN;
|
|
|
|
}
|
2008-03-12 02:56:11 +00:00
|
|
|
else if (Args->CheckParm ("-deathmatch"))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
deathmatch = 1;
|
|
|
|
flags |= DF_WEAPONS_STAY | DF_ITEMS_RESPAWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
dmflags = flags;
|
|
|
|
|
|
|
|
// get skill / episode / map from parms
|
|
|
|
if (gameinfo.gametype != GAME_Hexen)
|
|
|
|
{
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
startmap = (gameinfo.flags & GI_MAPxx) ? "MAP01" : "E1M1";
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
startmap = "&wt@01";
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2013-10-10 03:11:33 +00:00
|
|
|
autostart = StoredWarp.IsNotEmpty();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
const char *val = Args->CheckValue ("-skill");
|
2006-02-24 04:48:15 +00:00
|
|
|
if (val)
|
|
|
|
{
|
|
|
|
gameskill = val[0] - '1';
|
|
|
|
autostart = true;
|
|
|
|
}
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
p = Args->CheckParm ("-warp");
|
|
|
|
if (p && p < Args->NumArgs() - 1)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int ep, map;
|
|
|
|
|
|
|
|
if (gameinfo.flags & GI_MAPxx)
|
|
|
|
{
|
|
|
|
ep = 1;
|
2008-03-12 02:56:11 +00:00
|
|
|
map = atoi (Args->GetArg(p+1));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-03-12 02:56:11 +00:00
|
|
|
ep = atoi (Args->GetArg(p+1));
|
|
|
|
map = p < Args->NumArgs() - 2 ? atoi (Args->GetArg(p+2)) : 10;
|
- Fixed compilation with mingw again.
- Added multiple-choice sound sequences. These overcome one of the major
deficiences of the Hexen-inherited SNDSEQ system while still being Hexen
compatible: Custom door sounds can now use different opening and closing
sequences, for both normal and blazing speeds.
- Added a serializer for TArray.
- Added a countof macro to doomtype.h. See the1's blog to find out why
it's implemented the way it is.
<http://blogs.msdn.com/the1/articles/210011.aspx>
- Added a new method to FRandom for getting random numbers larger than 255,
which lets me:
- Fixed: SNDSEQ delayrand commands could delay for no more than 255 tics.
- Fixed: If you're going to have sector_t.SoundTarget, then they need to
be included in the pointer cleanup scans.
- Ported back newer name code from 2.1.
- Fixed: Using -warp with only one parameter in Doom and Heretic to
select a map on episode 1 no longer worked.
- New: Loading a multiplayer save now restores the players based on
their names rather than on their connection order. Using connection
order was sensible when -net was the only way to start a network game,
but with -host/-join, it's not so nice. Also, if there aren't enough
players in the save, then the extra players will be spawned normally,
so you can continue a saved game with more players than you started it
with.
- Added some new SNDSEQ commands to make it possible to define Heretic's
ambient sounds in SNDSEQ: volumerel, volumerand, slot, randomsequence,
delayonce, and restart. With these, it is basically possible to obsolete
all of the $ambient SNDINFO commands.
- Fixed: Sound sequences would only execute one command each time they were
ticked.
- Fixed: No bounds checking was done on the volume sound sequences played at.
- Fixed: The tic parameter to playloop was useless and caused it to
act like a redundant playrepeat. I have removed all the logic that
caused playloop to play repeating sounds, and now it acts like an
infinite sequence of play/delay commands until the sequence is
stopped.
- Fixed: Sound sequences were ticked every frame, not every tic, so all
the delay commands were timed incorrectly and varied depending on your
framerate. Since this is useful for restarting looping sounds that got
cut off, I have not changed this. Instead, the delay commands now
record the tic when execution should resume, not the number of tics
left to delay.
SVN r57 (trunk)
2006-04-21 01:22:55 +00:00
|
|
|
if (map < 1 || map > 9)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
map = ep;
|
|
|
|
ep = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
startmap = CalcMapName (ep, map);
|
2006-02-24 04:48:15 +00:00
|
|
|
autostart = true;
|
|
|
|
}
|
|
|
|
|
2010-03-02 04:51:16 +00:00
|
|
|
// [RH] Hack to handle +map. The standard console command line handler
|
|
|
|
// won't be able to handle it, so we take it out of the command line and set
|
|
|
|
// it up like -warp.
|
|
|
|
FString mapvalue = Args->TakeValue("+map");
|
|
|
|
if (mapvalue.IsNotEmpty())
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-03-02 04:51:16 +00:00
|
|
|
if (!P_CheckMapData(mapvalue))
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-03-02 04:51:16 +00:00
|
|
|
Printf ("Can't find map %s\n", mapvalue.GetChars());
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-03-02 04:51:16 +00:00
|
|
|
startmap = mapvalue;
|
2006-02-24 04:48:15 +00:00
|
|
|
autostart = true;
|
|
|
|
}
|
|
|
|
}
|
2010-03-02 04:51:16 +00:00
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
if (devparm)
|
|
|
|
{
|
2009-01-28 05:29:41 +00:00
|
|
|
Printf ("%s", GStrings("D_DEVSTR"));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// turbo option // [RH] (now a cvar)
|
2010-03-03 04:29:40 +00:00
|
|
|
v = Args->CheckValue("-turbo");
|
|
|
|
if (v != NULL)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2010-03-03 04:29:40 +00:00
|
|
|
double amt = atof(v);
|
2010-03-02 04:51:16 +00:00
|
|
|
Printf ("turbo scale: %.0f%%\n", amt);
|
|
|
|
turbo = (float)amt;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
v = Args->CheckValue ("-timer");
|
2006-02-24 04:48:15 +00:00
|
|
|
if (v)
|
|
|
|
{
|
|
|
|
double time = strtod (v, NULL);
|
|
|
|
Printf ("Levels will end after %g minute%s.\n", time, time > 1 ? "s" : "");
|
|
|
|
timelimit = (float)time;
|
|
|
|
}
|
|
|
|
|
2008-03-12 02:56:11 +00:00
|
|
|
v = Args->CheckValue ("-avg");
|
2006-02-24 04:48:15 +00:00
|
|
|
if (v)
|
|
|
|
{
|
|
|
|
Printf ("Austin Virtual Gaming: Levels will end after 20 minutes\n");
|
|
|
|
timelimit = 20.f;
|
|
|
|
}
|
|
|
|
|
2007-03-06 01:33:18 +00:00
|
|
|
//
|
|
|
|
// Build status bar line!
|
|
|
|
//
|
|
|
|
if (deathmatch)
|
|
|
|
StartScreen->AppendStatusLine("DeathMatch...");
|
|
|
|
if (dmflags & DF_NO_MONSTERS)
|
|
|
|
StartScreen->AppendStatusLine("No Monsters...");
|
|
|
|
if (dmflags & DF_MONSTERS_RESPAWN)
|
|
|
|
StartScreen->AppendStatusLine("Respawning...");
|
|
|
|
if (autostart)
|
|
|
|
{
|
|
|
|
FString temp;
|
About a week's worth of changes here. As a heads-up, I wouldn't be
surprised if this doesn't build in Linux right now. The CMakeLists.txt
were checked with MinGW and NMake, but how they fair under Linux is an
unknown to me at this time.
- Converted most sprintf (and all wsprintf) calls to either mysnprintf or
FStrings, depending on the situation.
- Changed the strings in the wbstartstruct to be FStrings.
- Changed myvsnprintf() to output nothing if count is greater than INT_MAX.
This is so that I can use a series of mysnprintf() calls and advance the
pointer for each one. Once the pointer goes beyond the end of the buffer,
the count will go negative, but since it's an unsigned type it will be
seen as excessively huge instead. This should not be a problem, as there's
no reason for ZDoom to be using text buffers larger than 2 GB anywhere.
- Ripped out the disabled bit from FGameConfigFile::MigrateOldConfig().
- Changed CalcMapName() to return an FString instead of a pointer to a static
buffer.
- Changed startmap in d_main.cpp into an FString.
- Changed CheckWarpTransMap() to take an FString& as the first argument.
- Changed d_mapname in g_level.cpp into an FString.
- Changed DoSubstitution() in ct_chat.cpp to place the substitutions in an
FString.
- Fixed: The MAPINFO parser wrote into the string buffer to construct a map
name when given a Hexen map number. This was fine with the old scanner
code, but only a happy coincidence prevents it from crashing with the new
code
- Added the 'B' conversion specifier to StringFormat::VWorker() for printing
binary numbers.
- Added CMake support for building with MinGW, MSYS, and NMake. Linux support
is probably broken until I get around to booting into Linux again. Niceties
provided over the existing Makefiles they're replacing:
* All command-line builds can use the same build system, rather than having
a separate one for MinGW and another for Linux.
* Microsoft's NMake tool is supported as a target.
* Progress meters.
* Parallel makes work from a fresh checkout without needing to be primed
first with a single-threaded make.
* Porting to other architectures should be simplified, whenever that day
comes.
- Replaced the makewad tool with zipdir. This handles the dependency tracking
itself instead of generating an external makefile to do it, since I couldn't
figure out how to generate a makefile with an external tool and include it
with a CMake-generated makefile. Where makewad used a master list of files
to generate the package file, zipdir just zips the entire contents of one or
more directories.
- Added the gdtoa package from netlib's fp library so that ZDoom's printf-style
formatting can be entirely independant of the CRT.
SVN r1082 (trunk)
2008-07-23 04:57:26 +00:00
|
|
|
temp.Format ("Warp to map %s, Skill %d ", startmap.GetChars(), gameskill + 1);
|
2007-03-06 01:33:18 +00:00
|
|
|
StartScreen->AppendStatusLine(temp);
|
|
|
|
}
|
2010-12-12 23:52:00 +00:00
|
|
|
}
|
|
|
|
|
2012-06-16 03:10:38 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// FinalGC
|
|
|
|
//
|
|
|
|
// If this doesn't free everything, the debug CRT will let us know.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
static void FinalGC()
|
|
|
|
{
|
|
|
|
Args = NULL;
|
|
|
|
GC::FullGC();
|
|
|
|
GC::DelSoftRootHead(); // the soft root head will not be collected by a GC so we have to do it explicitly
|
|
|
|
}
|
|
|
|
|
2010-12-12 23:52:00 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// D_DoomMain
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void D_DoomMain (void)
|
|
|
|
{
|
|
|
|
int p;
|
|
|
|
const char *v;
|
|
|
|
const char *wad;
|
|
|
|
DArgs *execFiles;
|
|
|
|
TArray<FString> pwads;
|
|
|
|
FString *args;
|
|
|
|
int argcount;
|
|
|
|
|
2014-04-16 07:53:07 +00:00
|
|
|
// +logfile gets checked too late to catch the full startup log in the logfile so do some extra check for it here.
|
|
|
|
FString logfile = Args->TakeValue("+logfile");
|
2014-07-17 23:00:38 +00:00
|
|
|
if (logfile.IsNotEmpty())
|
2014-04-16 07:53:07 +00:00
|
|
|
{
|
|
|
|
execLogfile(logfile);
|
|
|
|
}
|
|
|
|
|
2010-12-12 23:52:00 +00:00
|
|
|
D_DoomInit();
|
|
|
|
PClass::StaticInit ();
|
2012-06-16 03:10:38 +00:00
|
|
|
atterm(FinalGC);
|
2010-12-12 23:52:00 +00:00
|
|
|
|
|
|
|
// [RH] Make sure zdoom.pk3 is always loaded,
|
|
|
|
// as it contains magic stuff we need.
|
|
|
|
|
|
|
|
wad = BaseFileSearch (BASEWAD, NULL, true);
|
|
|
|
if (wad == NULL)
|
|
|
|
{
|
|
|
|
I_FatalError ("Cannot find " BASEWAD);
|
|
|
|
}
|
|
|
|
FString basewad = wad;
|
|
|
|
|
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
// reinit from here
|
2010-12-12 23:52:00 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
do
|
|
|
|
{
|
|
|
|
if (restart)
|
|
|
|
{
|
|
|
|
C_InitConsole(SCREENWIDTH, SCREENHEIGHT, false);
|
|
|
|
}
|
|
|
|
nospriterename = false;
|
2010-12-12 23:52:00 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
// Load zdoom.pk3 alone so that we can get access to the internal gameinfos before
|
|
|
|
// the IWAD is known.
|
2010-12-12 23:52:00 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
GetCmdLineFiles(pwads);
|
|
|
|
FString iwad = CheckGameInfo(pwads);
|
2010-12-12 23:52:00 +00:00
|
|
|
|
2011-02-20 08:27:48 +00:00
|
|
|
// The IWAD selection dialogue does not show in fullscreen so if the
|
2010-12-15 11:45:39 +00:00
|
|
|
// restart is initiated without a defined IWAD assume for now that it's not going to change.
|
2014-07-17 23:00:38 +00:00
|
|
|
if (iwad.IsEmpty()) iwad = lastIWAD;
|
2010-12-12 23:52:00 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
FIWadManager *iwad_man = new FIWadManager;
|
|
|
|
const FIWADInfo *iwad_info = iwad_man->FindIWAD(allwads, iwad, basewad);
|
|
|
|
gameinfo.gametype = iwad_info->gametype;
|
|
|
|
gameinfo.flags = iwad_info->flags;
|
|
|
|
gameinfo.ConfigName = iwad_info->Configname;
|
|
|
|
lastIWAD = iwad;
|
2010-12-12 23:52:00 +00:00
|
|
|
|
2011-02-20 08:27:48 +00:00
|
|
|
if ((gameinfo.flags & GI_SHAREWARE) && pwads.Size() > 0)
|
|
|
|
{
|
|
|
|
I_FatalError ("You cannot -file with the shareware version. Register!");
|
|
|
|
}
|
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
FBaseCVar::DisableCallbacks();
|
|
|
|
GameConfig->DoGameSetup (gameinfo.ConfigName);
|
2010-12-12 23:52:00 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
AddAutoloadFiles(iwad_info->Autoname);
|
2010-12-12 23:52:00 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
// Run automatically executed files
|
|
|
|
execFiles = new DArgs;
|
|
|
|
GameConfig->AddAutoexec (execFiles, gameinfo.ConfigName);
|
|
|
|
D_MultiExec (execFiles, true);
|
2010-12-12 23:52:00 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
// Run .cfg files at the start of the command line.
|
|
|
|
execFiles = Args->GatherFiles ("-exec");
|
|
|
|
D_MultiExec (execFiles, true);
|
2010-12-12 23:52:00 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
CopyFiles(allwads, pwads);
|
2010-12-12 23:52:00 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
// Since this function will never leave we must delete this array here manually.
|
|
|
|
pwads.Clear();
|
|
|
|
pwads.ShrinkToFit();
|
2010-12-12 23:52:00 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
Printf ("W_Init: Init WADfiles.\n");
|
|
|
|
Wads.InitMultipleFiles (allwads);
|
|
|
|
allwads.Clear();
|
|
|
|
allwads.ShrinkToFit();
|
|
|
|
SetMapxxFlag();
|
2013-05-25 16:34:23 +00:00
|
|
|
|
|
|
|
// Now that wads are loaded, define mod-specific cvars.
|
|
|
|
ParseCVarInfo();
|
|
|
|
|
2013-10-09 01:18:35 +00:00
|
|
|
C_ExecCmdLineParams (); // [RH] do all +set commands on the command line
|
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
// [RH] Initialize localizable strings.
|
|
|
|
GStrings.LoadStrings (false);
|
2010-12-12 23:52:00 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
V_InitFontColors ();
|
2010-12-12 23:52:00 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
// [RH] Moved these up here so that we can do most of our
|
|
|
|
// startup output in a fullscreen console.
|
2010-12-12 23:52:00 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
CT_Init ();
|
2010-12-12 23:52:00 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
if (!restart)
|
|
|
|
{
|
|
|
|
Printf ("I_Init: Setting up machine state.\n");
|
|
|
|
I_Init ();
|
2011-07-07 15:37:47 +00:00
|
|
|
I_CreateRenderer();
|
2010-12-15 11:45:39 +00:00
|
|
|
}
|
2010-12-12 23:52:00 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
Printf ("V_Init: allocate screen.\n");
|
|
|
|
V_Init (!!restart);
|
2010-12-12 23:52:00 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
// Base systems have been inited; enable cvar callbacks
|
|
|
|
FBaseCVar::EnableCallbacks ();
|
2007-02-28 19:08:02 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
Printf ("S_Init: Setting up sound.\n");
|
|
|
|
S_Init ();
|
2010-03-31 23:33:18 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
Printf ("ST_Init: Init startup screen.\n");
|
2012-03-10 01:54:00 +00:00
|
|
|
if (!restart)
|
|
|
|
{
|
|
|
|
StartScreen = FStartupScreen::CreateInstance (TexMan.GuesstimateNumTextures() + 5);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
StartScreen = new FStartupScreen(0);
|
|
|
|
}
|
2007-02-28 19:08:02 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
ParseCompatibility();
|
2007-02-28 19:08:02 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
CheckCmdLine();
|
2008-09-21 18:02:38 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
// [RH] Load sound environments
|
|
|
|
S_ParseReverbDef ();
|
2007-12-20 20:22:31 +00:00
|
|
|
|
2012-08-22 22:36:06 +00:00
|
|
|
// [RH] Parse any SNDINFO lumps
|
|
|
|
Printf ("S_InitData: Load sound definitions.\n");
|
|
|
|
S_InitData ();
|
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
// [RH] Parse through all loaded mapinfo lumps
|
|
|
|
Printf ("G_ParseMapInfo: Load map definitions.\n");
|
|
|
|
G_ParseMapInfo (iwad_info->MapInfo);
|
|
|
|
ReadStatistics();
|
2007-02-28 19:08:02 +00:00
|
|
|
|
2012-08-30 03:00:37 +00:00
|
|
|
// MUSINFO must be parsed after MAPINFO
|
|
|
|
S_ParseMusInfo();
|
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
Printf ("Texman.Init: Init texture manager.\n");
|
|
|
|
TexMan.Init();
|
|
|
|
C_InitConback();
|
2010-09-14 17:28:18 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
// [CW] Parse any TEAMINFO lumps.
|
|
|
|
Printf ("ParseTeamInfo: Load team definitions.\n");
|
|
|
|
TeamLibrary.ParseTeamInfo ();
|
2007-02-28 19:08:02 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
FActorInfo::StaticInit ();
|
2007-02-28 19:08:02 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
// [GRB] Initialize player class list
|
|
|
|
SetupPlayerClasses ();
|
2007-02-28 19:08:02 +00:00
|
|
|
|
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
// [RH] Load custom key and weapon settings from WADs
|
|
|
|
D_LoadWadSettings ();
|
2007-02-28 19:08:02 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
// [GRB] Check if someone used clearplayerclasses but not addplayerclass
|
|
|
|
if (PlayerClasses.Size () == 0)
|
|
|
|
{
|
|
|
|
I_FatalError ("No player classes defined");
|
|
|
|
}
|
2007-02-28 19:08:02 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
StartScreen->Progress ();
|
2007-02-28 19:08:02 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
Printf ("R_Init: Init %s refresh subsystem.\n", gameinfo.ConfigName.GetChars());
|
|
|
|
StartScreen->LoadingStatus ("Loading graphics", 0x3f);
|
|
|
|
R_Init ();
|
|
|
|
|
|
|
|
Printf ("DecalLibrary: Load decals.\n");
|
|
|
|
DecalLibrary.ReadAllDecals ();
|
|
|
|
|
|
|
|
// [RH] Add any .deh and .bex files on the command line.
|
|
|
|
// If there are none, try adding any in the config file.
|
|
|
|
// Note that the command line overrides defaults from the config.
|
|
|
|
|
|
|
|
if ((ConsiderPatches("-deh") | ConsiderPatches("-bex")) == 0 &&
|
|
|
|
gameinfo.gametype == GAME_Doom && GameConfig->SetSection ("Doom.DefaultDehacked"))
|
2009-09-07 19:46:54 +00:00
|
|
|
{
|
2010-12-15 11:45:39 +00:00
|
|
|
const char *key;
|
|
|
|
const char *value;
|
|
|
|
|
|
|
|
while (GameConfig->NextInSection (key, value))
|
2007-02-28 19:08:02 +00:00
|
|
|
{
|
2010-12-15 11:45:39 +00:00
|
|
|
if (stricmp (key, "Path") == 0 && FileExists (value))
|
|
|
|
{
|
|
|
|
Printf ("Applying patch %s\n", value);
|
|
|
|
D_LoadDehFile(value);
|
|
|
|
}
|
2007-02-28 19:08:02 +00:00
|
|
|
}
|
|
|
|
}
|
2009-09-07 19:46:54 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
// Load embedded Dehacked patches
|
|
|
|
D_LoadDehLumps();
|
2009-09-07 19:46:54 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
// Create replacements for dehacked pickups
|
|
|
|
FinishDehPatch();
|
2007-02-28 19:08:02 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
FActorInfo::StaticSetActorNums ();
|
2007-02-28 19:08:02 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
//Added by MC:
|
|
|
|
bglobal.getspawned.Clear();
|
|
|
|
argcount = Args->CheckParmList("-bots", &args);
|
|
|
|
for (p = 0; p < argcount; ++p)
|
|
|
|
{
|
|
|
|
bglobal.getspawned.Push(args[p]);
|
|
|
|
}
|
|
|
|
bglobal.spawn_tries = 0;
|
|
|
|
bglobal.wanted_botnum = bglobal.getspawned.Size();
|
2007-02-28 19:08:02 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
Printf ("M_Init: Init menus.\n");
|
|
|
|
M_Init ();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
Printf ("P_Init: Init Playloop state.\n");
|
|
|
|
StartScreen->LoadingStatus ("Init game engine", 0x3f);
|
|
|
|
AM_StaticInit();
|
|
|
|
P_Init ();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
P_SetupWeapons_ntohton();
|
2008-03-19 09:53:23 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
//SBarInfo support.
|
|
|
|
SBarInfo::Load();
|
|
|
|
HUD_InitHud();
|
2008-01-16 04:43:50 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
// [RH] User-configurable startup strings. Because BOOM does.
|
|
|
|
static const char *startupString[5] = {
|
|
|
|
"STARTUP1", "STARTUP2", "STARTUP3", "STARTUP4", "STARTUP5"
|
|
|
|
};
|
|
|
|
for (p = 0; p < 5; ++p)
|
2010-12-12 23:52:00 +00:00
|
|
|
{
|
2010-12-15 11:45:39 +00:00
|
|
|
const char *str = GStrings[startupString[p]];
|
|
|
|
if (str != NULL && str[0] != '\0')
|
|
|
|
{
|
|
|
|
Printf ("%s\n", str);
|
|
|
|
}
|
2010-12-12 23:52:00 +00:00
|
|
|
}
|
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
if (!restart)
|
|
|
|
{
|
|
|
|
Printf ("D_CheckNetGame: Checking network game status.\n");
|
|
|
|
StartScreen->LoadingStatus ("Checking network game status.", 0x3f);
|
|
|
|
D_CheckNetGame ();
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
// [RH] Lock any cvars that should be locked now that we're
|
|
|
|
// about to begin the game.
|
|
|
|
FBaseCVar::EnableNoSet ();
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
delete iwad_man; // now we won't need this anymore
|
2010-10-15 15:13:53 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
// [RH] Run any saved commands from the command line or autoexec.cfg now.
|
|
|
|
gamestate = GS_FULLCONSOLE;
|
|
|
|
Net_NewMakeTic ();
|
|
|
|
DThinker::RunThinkers ();
|
|
|
|
gamestate = GS_STARTUP;
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
if (!restart)
|
|
|
|
{
|
|
|
|
// start the apropriate game based on parms
|
|
|
|
v = Args->CheckValue ("-record");
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
if (v)
|
|
|
|
{
|
|
|
|
G_RecordDemo (v);
|
|
|
|
autostart = true;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
delete StartScreen;
|
|
|
|
StartScreen = NULL;
|
2012-03-10 01:54:00 +00:00
|
|
|
S_Sound (CHAN_BODY, "misc/startupdone", 1, ATTN_NONE);
|
2009-03-18 05:02:32 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
if (Args->CheckParm("-norun"))
|
|
|
|
{
|
|
|
|
throw CNoRunExit();
|
|
|
|
}
|
2009-03-18 05:02:32 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
V_Init2();
|
2012-04-01 03:03:53 +00:00
|
|
|
UpdateJoystickMenu(NULL);
|
Note: I have not tried compiling these recent changes under Linux. I wouldn't
be surprised if it doesn't work.
- Reorganized the network startup loops so now they are event driven. There is
a single function that gets called to drive it, and it uses callbacks to
perform the different stages of the synchronization. This lets me have a nice,
responsive abort button instead of the previous unannounced hit-escape-to-
abort behavior, and I think the rearranged code is slightly easier to
understand too.
- Increased the number of bytes for version info during D_ArbitrateNetStart(),
in preparation for the day when NETGAMEVERSION requires more than one byte.
- I noticed an issue with Vista RC1 and the new fatal error setup. Even after
releasing a DirectDraw or Direct3D interface, the DWM can still use the
last image drawn using them when it composites the window. It doesn't always
do it but it does often enough that it is a real problem. At this point, I
don't know if it's a problem with the release version of Vista or not.
After messing around, I discovered the problem was caused by ~Win32Video()
hiding the window and then having it immediately shown soon after. The DWM
kept an image of the window to do the transition effect with, and then when
it didn't get a chance to do the transition, it didn't properly forget about
its saved image and kept plastering it on top of everything else
underneath.
- Added a network synchronization panel to the window during netgame startup.
- Fixed: PClass::CreateDerivedClass() must initialize StateList to NULL.
Otherwise, classic DECORATE definitions generate a big, fat crash.
- Resurrected the R_Init progress bar, now as a standard Windows control.
- Removed the sound failure dialog. The FMOD setup already defaulted to no
sound if initialization failed, so this only applies when snd_output is set
to "alternate" which now also falls back to no sound. In addition, it wasn't
working right, and I didn't feel like fixing it for the probably 0% of users
it affected.
- Fixed: The edit control used for logging output added text in reverse order
on Win9x.
- Went back to the roots and made graphics initialization one of the last
things to happen during setup. Now the startup text is visible again. More
importantly, the main window is no longer created invisible, which seems
to cause trouble with it not always appearing in the taskbar. The fatal
error dialog is now also embedded in the main window instead of being a
separate modal dialog, so you can play with the log window to see any
problems that might be reported there.
Rather than completely restoring the original startup order, I tried to
keep things as close to the way they were with early graphics startup. In
particular, V_Init() now creates a dummy screen so that things that need
screen dimensions can get them. It gets replaced by the real screen later
in I_InitGraphics(). Will need to check this under Linux to make sure it
didn't cause any problems there.
- Removed the following stubs that just called functions in Video:
- I_StartModeIterator()
- I_NextMode()
- I_DisplayType()
I_FullscreenChanged() was also removed, and a new fullscreen parameter
was added to IVideo::StartModeIterator(), since that's all it controlled.
- Renamed I_InitHardware() back to I_InitGraphics(), since that's all it's
initialized post-1.22.
SVN r416 (trunk)
2006-12-19 04:09:10 +00:00
|
|
|
|
2012-03-25 01:54:36 +00:00
|
|
|
v = Args->CheckValue ("-loadgame");
|
|
|
|
if (v)
|
|
|
|
{
|
|
|
|
FString file(v);
|
|
|
|
FixPathSeperator (file);
|
|
|
|
DefaultExtension (file, ".zds");
|
|
|
|
G_LoadGame (file);
|
|
|
|
}
|
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
v = Args->CheckValue("-playdemo");
|
|
|
|
if (v != NULL)
|
|
|
|
{
|
|
|
|
singledemo = true; // quit after one demo
|
|
|
|
G_DeferedPlayDemo (v);
|
|
|
|
D_DoomLoop (); // never returns
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
v = Args->CheckValue ("-timedemo");
|
|
|
|
if (v)
|
|
|
|
{
|
|
|
|
G_TimeDemo (v);
|
|
|
|
D_DoomLoop (); // never returns
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2011-04-17 17:27:31 +00:00
|
|
|
if (gameaction != ga_loadgame && gameaction != ga_loadgamehidecon)
|
2009-11-04 01:24:00 +00:00
|
|
|
{
|
2010-12-15 11:45:39 +00:00
|
|
|
if (autostart || netgame)
|
|
|
|
{
|
|
|
|
// Do not do any screenwipes when autostarting a game.
|
|
|
|
if (!Args->CheckParm("-warpwipe"))
|
|
|
|
{
|
|
|
|
NoWipe = TICRATE;
|
|
|
|
}
|
|
|
|
CheckWarpTransMap (startmap, true);
|
|
|
|
if (demorecording)
|
|
|
|
G_BeginRecording (startmap);
|
|
|
|
G_InitNew (startmap, false);
|
2013-10-10 03:11:33 +00:00
|
|
|
if (StoredWarp.IsNotEmpty())
|
|
|
|
{
|
|
|
|
AddCommandString(StoredWarp.LockBuffer());
|
|
|
|
StoredWarp = NULL;
|
|
|
|
}
|
2010-12-15 11:45:39 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
D_StartTitle (); // start up intro loop
|
|
|
|
}
|
2009-11-04 01:24:00 +00:00
|
|
|
}
|
2010-12-15 11:45:39 +00:00
|
|
|
else if (demorecording)
|
|
|
|
{
|
|
|
|
G_BeginRecording (NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
atterm (D_QuitNetGame); // killough
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-12-15 23:10:08 +00:00
|
|
|
// let the renderer reinitialize some stuff if needed
|
|
|
|
screen->GameRestart();
|
2010-12-15 11:45:39 +00:00
|
|
|
// These calls from inside V_Init2 are still necessary
|
|
|
|
C_NewModeAdjust();
|
|
|
|
M_InitVideoModesMenu();
|
2006-02-24 04:48:15 +00:00
|
|
|
D_StartTitle (); // start up intro loop
|
2010-12-15 11:45:39 +00:00
|
|
|
setmodeneeded = false; // This may be set to true here, but isn't needed for a restart
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
D_DoomLoop (); // never returns
|
|
|
|
}
|
2010-12-15 18:57:39 +00:00
|
|
|
catch (CRestartException &)
|
2010-12-15 11:45:39 +00:00
|
|
|
{
|
|
|
|
// Music and sound should be stopped first
|
|
|
|
S_StopMusic(true);
|
|
|
|
S_StopAllChannels ();
|
|
|
|
|
2010-12-16 08:05:00 +00:00
|
|
|
M_ClearMenus(); // close menu if open
|
|
|
|
F_EndFinale(); // If an intermission is active, end it now
|
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
// clean up game state
|
|
|
|
ST_Clear();
|
|
|
|
D_ErrorCleanup ();
|
|
|
|
P_FreeLevelData();
|
|
|
|
P_FreeExtraLevelData();
|
|
|
|
|
|
|
|
M_SaveDefaults(NULL); // save config before the restart
|
|
|
|
|
|
|
|
// delete all data that cannot be left until reinitialization
|
|
|
|
V_ClearFonts(); // must clear global font pointers
|
|
|
|
R_DeinitTranslationTables(); // some tables are initialized from outside the translation code.
|
|
|
|
gameinfo.~gameinfo_t();
|
|
|
|
new (&gameinfo) gameinfo_t; // Reset gameinfo
|
|
|
|
S_Shutdown(); // free all channels and delete playlist
|
|
|
|
C_ClearAliases(); // CCMDs won't be reinitialized so these need to be deleted here
|
2014-12-02 03:04:50 +00:00
|
|
|
DestroyCVarsFlagged(CVAR_MOD); // Delete any cvar left by mods
|
2010-12-15 11:45:39 +00:00
|
|
|
|
|
|
|
GC::FullGC(); // perform one final garbage collection before deleting the class data
|
|
|
|
PClass::ClearRuntimeData(); // clear all runtime generated class data
|
|
|
|
restart++;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
2010-12-15 11:45:39 +00:00
|
|
|
while (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// restart the game
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
CCMD(restart)
|
|
|
|
{
|
|
|
|
// remove command line args that would get in the way during restart
|
|
|
|
Args->RemoveArgs("-iwad");
|
|
|
|
Args->RemoveArgs("-deh");
|
|
|
|
Args->RemoveArgs("-bex");
|
|
|
|
Args->RemoveArgs("-playdemo");
|
|
|
|
Args->RemoveArgs("-file");
|
|
|
|
Args->RemoveArgs("-altdeath");
|
|
|
|
Args->RemoveArgs("-deathmatch");
|
|
|
|
Args->RemoveArgs("-skill");
|
|
|
|
Args->RemoveArgs("-savedir");
|
|
|
|
Args->RemoveArgs("-xlat");
|
|
|
|
Args->RemoveArgs("-oldsprites");
|
|
|
|
|
|
|
|
if (argv.argc() > 1)
|
|
|
|
{
|
|
|
|
for(int i=1;i<argv.argc(); i++)
|
|
|
|
{
|
|
|
|
Args->AppendArg(argv[i]);
|
|
|
|
}
|
2006-04-16 19:09:36 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
// initiate the restart
|
|
|
|
throw CRestartException();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2007-03-10 01:53:52 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// FStartupScreen Constructor
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
FStartupScreen::FStartupScreen(int max_progress)
|
|
|
|
{
|
|
|
|
MaxPos = max_progress;
|
|
|
|
CurPos = 0;
|
|
|
|
NotchPos = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// FStartupScreen Destructor
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
FStartupScreen::~FStartupScreen()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// FStartupScreen :: LoadingStatus
|
|
|
|
//
|
|
|
|
// Used by Heretic for the Loading Status "window."
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void FStartupScreen::LoadingStatus(const char *message, int colors)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// FStartupScreen :: AppendStatusLine
|
|
|
|
//
|
|
|
|
// Used by Heretic for the "status line" at the bottom of the screen.
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
void FStartupScreen::AppendStatusLine(const char *status)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-12-15 11:45:39 +00:00
|
|
|
|
|
|
|
void FStartupScreen::Progress(void) {}
|
|
|
|
void FStartupScreen::NetInit(char const *,int) {}
|
|
|
|
void FStartupScreen::NetProgress(int) {}
|
|
|
|
void FStartupScreen::NetMessage(char const *,...) {}
|
|
|
|
void FStartupScreen::NetDone(void) {}
|
|
|
|
bool FStartupScreen::NetLoop(bool (*)(void *),void *) { return false; }
|
|
|
|
|