* Updated to ZDoom r3038 (IWAD selection dialog already fixed in previous commit):

- Added DavidPH's submission for specifying vertex heights directly in UDMF.
- Move static AM color initialization into the AM_StaticInit function.
- Move D_LoadWadSettings to keysections.cpp.
- Made some more data reloadable.
- Data structures filled by P_SetupLevel should be cleared before loading the level. They can remain non-empty in case of an error. There's probably more to fix here...
- Fixed: MidiDevices and MusicAliases were not cleared before reloading local SNDINFOs.
- Fixed signed/unsigned warnings in AddSwitchPair for real (GCC really allows -1u? MSVC prints a warning for that.)
- Fixed: GCC compiler warnings.
- Zipdir will no longer store files ending in '~' on Linux.
- Added st_oldouch which restores the old ouch face behavior of only showing when health increases by 20 while taking damage.
- Changed some data init code to delete the data it wants to initialize first. 
- The 'savebuffer' variable still existed?
- Changed AInventory::Destroy to NULL SendItemUse and SendItemDrop if they point to the destroyed object. Although unlikely it can't be ruled out completely that this can happen with delayed CCMDs.
- Fixed: Starting a new game did not clear the hub statistics array.
- Cleaned up D_DoomMain a little. It's still far too large though.
- Added explicit initialization of console background texture instead of letting C_InitConsole doing it as needed.
- Added 'clearaliases' CCMD.
- Init bot specific actor properties right after parsing DECORATE, not when spawning the first bot (which is too late.)
- Changed automap initialization so that static data only gets initialized once upon startup instead of each time a level starts.
- Initialize AUTOPAGE only once when the level starts, not each time the automap is switched on.
- Cleaned up switch code and fixed several problems:
  * savegames stored an index in the switch table and performed no validation when loading a savegame.
  * setting of a random switch animation duration was broken.
  * separated the 2 values stored in the Time variable into 2 separate variables.
  * defining a switch with one texture already belonging to another switch could leave broken definitions in the switch table.
- Added function for serializing switch and door animation pointers.
- Bumped min. savegame versions due to changes to DButtonThinker and removed all current savegame compatibility code.

git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@1128 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
gez 2010-12-14 22:53:44 +00:00
parent d0338ea7a0
commit e6750550a5
63 changed files with 668 additions and 630 deletions

View file

@ -1,5 +1,5 @@
=============================================================================== ===============================================================================
Universal Doom Map Format ZDoom extensions v1.10 - 25.04.2010 Universal Doom Map Format ZDoom extensions v1.15 - 14.12.2010
Copyright (c) 2008 Christoph Oelckers. Copyright (c) 2008 Christoph Oelckers.
@ -84,6 +84,12 @@ field to 'strifeally', even for the 'Doom' namespace.
In addition to the standard fields, ZDoom defines the following: In addition to the standard fields, ZDoom defines the following:
Note: All <bool> fields default to false unless mentioned otherwise. Note: All <bool> fields default to false unless mentioned otherwise.
vertex
{
zfloor = <float>; // Floor height at this vertex. Only applies to triangular sectors
zceiling = <float>; // Ceiling height at this vertex. Only applies to triangular sectors
}
linedef linedef
{ {
alpha = <float>; // Translucency of this line, default is 1.0 alpha = <float>; // Translucency of this line, default is 1.0
@ -283,6 +289,9 @@ Added 'hidden' sector property.
1.14 19.09.2010 1.14 19.09.2010
Added 'countsecret' actor property. Added 'countsecret' actor property.
1.15 14.12.2010
Added vertex floor and ceiling height properties
=============================================================================== ===============================================================================
EOF EOF
=============================================================================== ===============================================================================

View file

@ -529,7 +529,12 @@ struct FDropItem
class FDropItemPtrArray : public TArray<FDropItem *> class FDropItemPtrArray : public TArray<FDropItem *>
{ {
public: public:
~FDropItemPtrArray(); ~FDropItemPtrArray()
{
Clear();
}
void Clear();
}; };
extern FDropItemPtrArray DropItemList; extern FDropItemPtrArray DropItemList;

View file

@ -64,6 +64,12 @@
#include "po_man.h" #include "po_man.h"
#include "a_keys.h" #include "a_keys.h"
//=============================================================================
//
// Automap colors
//
//=============================================================================
struct AMColor struct AMColor
{ {
int Index; int Index;
@ -119,6 +125,12 @@ static BYTE RavenPaletteVals[11*3] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
}; };
//=============================================================================
//
// globals
//
//=============================================================================
#define MAPBITS 12 #define MAPBITS 12
#define MapDiv SafeDivScale12 #define MapDiv SafeDivScale12
#define MapMul MulScale12 #define MapMul MulScale12
@ -287,28 +299,28 @@ struct islope_t
// A line drawing of the player pointing right, // A line drawing of the player pointing right,
// starting from the middle. // starting from the middle.
// //
TArray<mline_t> MapArrow; static TArray<mline_t> MapArrow;
TArray<mline_t> CheatMapArrow; static TArray<mline_t> CheatMapArrow;
TArray<mline_t> CheatKey; static TArray<mline_t> CheatKey;
#define R (MAPUNIT) #define R (MAPUNIT)
// [RH] Avoid lots of warnings without compiler-specific #pragmas // [RH] Avoid lots of warnings without compiler-specific #pragmas
#define L(a,b,c,d) { {(fixed_t)((a)*R),(fixed_t)((b)*R)}, {(fixed_t)((c)*R),(fixed_t)((d)*R)} } #define L(a,b,c,d) { {(fixed_t)((a)*R),(fixed_t)((b)*R)}, {(fixed_t)((c)*R),(fixed_t)((d)*R)} }
mline_t triangle_guy[] = { static mline_t triangle_guy[] = {
L (-.867,-.5, .867,-.5), L (-.867,-.5, .867,-.5),
L (.867,-.5, 0,1), L (.867,-.5, 0,1),
L (0,1, -.867,-.5) L (0,1, -.867,-.5)
}; };
#define NUMTRIANGLEGUYLINES (sizeof(triangle_guy)/sizeof(mline_t)) #define NUMTRIANGLEGUYLINES (sizeof(triangle_guy)/sizeof(mline_t))
mline_t thintriangle_guy[] = { static mline_t thintriangle_guy[] = {
L (-.5,-.7, 1,0), L (-.5,-.7, 1,0),
L (1,0, -.5,.7), L (1,0, -.5,.7),
L (-.5,.7, -.5,-.7) L (-.5,.7, -.5,-.7)
}; };
#define NUMTHINTRIANGLEGUYLINES (sizeof(thintriangle_guy)/sizeof(mline_t)) #define NUMTHINTRIANGLEGUYLINES (sizeof(thintriangle_guy)/sizeof(mline_t))
mline_t square_guy[] = { static mline_t square_guy[] = {
L (0,1,1,0), L (0,1,1,0),
L (1,0,0,-1), L (1,0,0,-1),
L (0,-1,-1,0), L (0,-1,-1,0),
@ -332,8 +344,6 @@ CUSTOM_CVAR (Int, am_cheat, 0, 0)
static int grid = 0; static int grid = 0;
static int leveljuststarted = 1; // kluge until AM_LevelInit() is called
bool automapactive = false; bool automapactive = false;
// location of window on screen // location of window on screen
@ -515,16 +525,41 @@ void AM_ParseArrow(TArray<mline_t> &Arrow, const char *lumpname)
} }
} }
void AM_InitArrows() void AM_StaticInit()
{ {
MapArrow.Clear(); MapArrow.Clear();
CheatMapArrow.Clear(); CheatMapArrow.Clear();
CheatKey.Clear();
if (gameinfo.mMapArrow.IsNotEmpty()) AM_ParseArrow(MapArrow, gameinfo.mMapArrow); if (gameinfo.mMapArrow.IsNotEmpty()) AM_ParseArrow(MapArrow, gameinfo.mMapArrow);
if (gameinfo.mCheatMapArrow.IsNotEmpty()) AM_ParseArrow(CheatMapArrow, gameinfo.mCheatMapArrow); if (gameinfo.mCheatMapArrow.IsNotEmpty()) AM_ParseArrow(CheatMapArrow, gameinfo.mCheatMapArrow);
AM_ParseArrow(CheatKey, "maparrows/key.txt"); AM_ParseArrow(CheatKey, "maparrows/key.txt");
if (MapArrow.Size() == 0) I_FatalError("No automap arrow defined"); if (MapArrow.Size() == 0) I_FatalError("No automap arrow defined");
char namebuf[9];
for (int i = 0; i < 10; i++)
{
mysnprintf (namebuf, countof(namebuf), "AMMNUM%d", i);
marknums[i] = TexMan.CheckForTexture (namebuf, FTexture::TEX_MiscPatch);
}
markpointnum = 0;
mapback.SetInvalid();
static DWORD *lastpal = NULL;
//static int lastback = -1;
DWORD *palette;
palette = (DWORD *)GPalette.BaseColors;
int i, j;
for (i = j = 0; i < 11; i++, j += 3)
{
DoomColors[i].FromRGB(DoomPaletteVals[j], DoomPaletteVals[j+1], DoomPaletteVals[j+2]);
StrifeColors[i].FromRGB(StrifePaletteVals[j], StrifePaletteVals[j+1], StrifePaletteVals[j+2]);
RavenColors[i].FromRGB(RavenPaletteVals[j], RavenPaletteVals[j+1], RavenPaletteVals[j+2]);
}
} }
//============================================================================= //=============================================================================
@ -858,24 +893,6 @@ void AM_initVariables ()
static void AM_initColors (bool overlayed) static void AM_initColors (bool overlayed)
{ {
static DWORD *lastpal = NULL;
//static int lastback = -1;
DWORD *palette;
palette = (DWORD *)GPalette.BaseColors;
if (lastpal != palette)
{
int i, j;
for (i = j = 0; i < 11; i++, j += 3)
{
DoomColors[i].FromRGB(DoomPaletteVals[j], DoomPaletteVals[j+1], DoomPaletteVals[j+2]);
StrifeColors[i].FromRGB(StrifePaletteVals[j], StrifePaletteVals[j+1], StrifePaletteVals[j+2]);
RavenColors[i].FromRGB(RavenPaletteVals[j], RavenPaletteVals[j+1], RavenPaletteVals[j+2]);
}
}
if (overlayed) if (overlayed)
{ {
YourColor.FromCVar (am_ovyourcolor); YourColor.FromCVar (am_ovyourcolor);
@ -1000,30 +1017,6 @@ static void AM_initColors (bool overlayed)
break; break;
} }
lastpal = palette;
}
//=============================================================================
//
//
//
//=============================================================================
void AM_loadPics ()
{
int i;
char namebuf[9];
for (i = 0; i < 10; i++)
{
mysnprintf (namebuf, countof(namebuf), "AMMNUM%d", i);
marknums[i] = TexMan.CheckForTexture (namebuf, FTexture::TEX_MiscPatch);
}
const char *autopage = level.info->mapbg[0] == 0? "AUTOPAGE" : (const char*)&level.info->mapbg[0];
mapback = TexMan.CheckForTexture(autopage, FTexture::TEX_MiscPatch);
} }
//============================================================================= //=============================================================================
@ -1048,9 +1041,8 @@ bool AM_clearMarks ()
void AM_LevelInit () void AM_LevelInit ()
{ {
if (MapArrow.Size() == 0) AM_InitArrows(); const char *autopage = level.info->mapbg[0] == 0? "AUTOPAGE" : (const char*)&level.info->mapbg[0];
mapback = TexMan.CheckForTexture(autopage, FTexture::TEX_MiscPatch);
leveljuststarted = 0;
AM_clearMarks(); AM_clearMarks();
@ -1088,7 +1080,6 @@ void AM_Start ()
if (!stopped) AM_Stop(); if (!stopped) AM_Stop();
stopped = false; stopped = false;
AM_initVariables(); AM_initVariables();
AM_loadPics();
} }

View file

@ -25,6 +25,9 @@
struct event_t; struct event_t;
class FArchive; class FArchive;
void AM_StaticInit();
// Called by main loop. // Called by main loop.
bool AM_Responder (event_t* ev, bool last); bool AM_Responder (event_t* ev, bool last);

View file

@ -105,11 +105,6 @@ FArchive &operator<< (FArchive &arc, botskill_t &skill)
// This is intentionally not in the weapon definition anymore. // This is intentionally not in the weapon definition anymore.
void InitBotStuff() void InitBotStuff()
{ {
static bool done = false;
if (done) return;
done = true;
static struct BotInit static struct BotInit
{ {
const char *type; const char *type;

View file

@ -63,8 +63,6 @@ Everything that is changed is marked (maybe commented) with "Added by MC"
static FRandom pr_botspawn ("BotSpawn"); static FRandom pr_botspawn ("BotSpawn");
void InitBotStuff();
//Externs //Externs
FCajunMaster bglobal; FCajunMaster bglobal;
@ -321,7 +319,6 @@ bool FCajunMaster::SpawnBot (const char *name, int color)
waitingforspawn[playernumber] = true; waitingforspawn[playernumber] = true;
InitBotStuff();
Net_WriteByte (DEM_ADDBOT); Net_WriteByte (DEM_ADDBOT);
Net_WriteByte (playernumber); Net_WriteByte (playernumber);
{ {

View file

@ -94,7 +94,7 @@ extern FBaseCVar *CVars;
extern FConsoleCommand *Commands[FConsoleCommand::HASH_SIZE]; extern FConsoleCommand *Commands[FConsoleCommand::HASH_SIZE];
int ConCols, PhysRows; int ConCols, PhysRows;
bool vidactive = false, gotconback = false; bool vidactive = false;
bool cursoron = false; bool cursoron = false;
int ConBottom, ConScroll, RowAdjust; int ConBottom, ConScroll, RowAdjust;
int CursorTicker; int CursorTicker;
@ -232,7 +232,7 @@ CUSTOM_CVAR (Int, msgmidcolor2, 4, CVAR_ARCHIVE)
static void maybedrawnow (bool tick, bool force) static void maybedrawnow (bool tick, bool force)
{ {
// FIXME: Does not work right with hw2d // FIXME: Does not work right with hw2d
if (ConsoleDrawing || !gotconback || screen == NULL || screen->IsLocked () || screen->Accel2D) if (ConsoleDrawing || screen == NULL || screen->IsLocked () || screen->Accel2D || ConFont == NULL)
{ {
return; return;
} }
@ -297,12 +297,8 @@ void DequeueConsoleText ()
EnqueuedTextTail = &EnqueuedText; EnqueuedTextTail = &EnqueuedText;
} }
void C_InitConsole (int width, int height, bool ingame) void C_InitConback()
{ {
if ( (vidactive = ingame) )
{
if (!gotconback)
{
conback = TexMan.CheckForTexture ("CONBACK", FTexture::TEX_MiscPatch); conback = TexMan.CheckForTexture ("CONBACK", FTexture::TEX_MiscPatch);
if (!conback.isValid()) if (!conback.isValid())
@ -316,13 +312,13 @@ void C_InitConsole (int width, int height, bool ingame)
conshade = 0; conshade = 0;
conline = false; conline = false;
} }
}
gotconback = true; void C_InitConsole (int width, int height, bool ingame)
} {
}
int cwidth, cheight; int cwidth, cheight;
vidactive = ingame;
if (ConFont != NULL) if (ConFont != NULL)
{ {
cwidth = ConFont->GetCharWidth ('M'); cwidth = ConFont->GetCharWidth ('M');

View file

@ -53,6 +53,7 @@ extern int ConBottom;
// Initialize the console // Initialize the console
void C_InitConsole (int width, int height, bool ingame); void C_InitConsole (int width, int height, bool ingame);
void C_DeinitConsole (); void C_DeinitConsole ();
void C_InitConback();
// Adjust the console for a new screen mode // Adjust the console for a new screen mode
void C_NewModeAdjust (void); void C_NewModeAdjust (void);

View file

@ -1211,6 +1211,30 @@ void C_ArchiveAliases (FConfigFile *f)
} }
} }
void C_ClearAliases ()
{
int bucket;
FConsoleCommand *alias;
for (bucket = 0; bucket < FConsoleCommand::HASH_SIZE; bucket++)
{
alias = Commands[bucket];
while (alias)
{
FConsoleCommand *next = alias->m_Next;
if (alias->IsAlias())
static_cast<FConsoleAlias *>(alias)->SafeDelete();
alias = next;
}
}
}
CCMD(clearaliases)
{
C_ClearAliases();
}
// This is called only by the ini parser. // This is called only by the ini parser.
void C_SetAlias (const char *name, const char *cmd) void C_SetAlias (const char *name, const char *cmd)
{ {

View file

@ -58,6 +58,7 @@ int C_ExecFile (const char *cmd, bool usePullin);
void C_ArchiveAliases (FConfigFile *f); void C_ArchiveAliases (FConfigFile *f);
void C_SetAlias (const char *name, const char *cmd); void C_SetAlias (const char *name, const char *cmd);
void C_ClearAliases ();
// build a single string out of multiple strings // build a single string out of multiple strings
FString BuildString (int argc, char **argv); FString BuildString (int argc, char **argv);

View file

@ -143,6 +143,9 @@ void ParseCompatibility()
int i, x; int i, x;
unsigned int j; unsigned int j;
BCompatMap.Clear();
CompatParams.Clear();
// The contents of this file are not cumulative, as it should not // The contents of this file are not cumulative, as it should not
// be present in user-distributed maps. // be present in user-distributed maps.
FScanner sc(Wads.GetNumForFullName("compatibility.txt")); FScanner sc(Wads.GetNumForFullName("compatibility.txt"));

View file

@ -549,6 +549,7 @@ int FIWadManager::IdentifyVersion (TArray<FString> &wadfiles, const char *iwad,
exit (0); exit (0);
// zdoom.pk3 must always be the first file loaded and the IWAD second. // zdoom.pk3 must always be the first file loaded and the IWAD second.
wadfiles.Clear();
D_AddFile (wadfiles, zdoom_wad); D_AddFile (wadfiles, zdoom_wad);
if (mIWads[wads[pickwad].Type].preload >= 0) if (mIWads[wads[pickwad].Type].preload >= 0)

View file

@ -131,6 +131,7 @@ void D_ProcessEvents ();
void G_BuildTiccmd (ticcmd_t* cmd); void G_BuildTiccmd (ticcmd_t* cmd);
void D_DoAdvanceDemo (); void D_DoAdvanceDemo ();
void D_AddWildFile (TArray<FString> &wadfiles, const char *pattern); void D_AddWildFile (TArray<FString> &wadfiles, const char *pattern);
void D_LoadWadSettings ();
// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- // PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
@ -926,6 +927,7 @@ void D_DoomLoop ()
// Clamp the timer to TICRATE until the playloop has been entered. // Clamp the timer to TICRATE until the playloop has been entered.
r_NoInterpolate = true; r_NoInterpolate = true;
Page = Advisory = NULL;
vid_cursor.Callback(); vid_cursor.Callback();
@ -1562,80 +1564,6 @@ bool ConsiderPatches (const char *arg)
return argc > 0; return argc > 0;
} }
//==========================================================================
//
// D_LoadWadSettings
//
// Parses any loaded KEYCONF lumps. These are restricted console scripts
// that can only execute the alias, defaultbind, addkeysection,
// addmenukey, weaponsection, and addslotdefault commands.
//
//==========================================================================
void D_LoadWadSettings ()
{
char cmd[4096];
int lump, lastlump = 0;
ParsingKeyConf = true;
while ((lump = Wads.FindLump ("KEYCONF", &lastlump)) != -1)
{
FMemLump data = Wads.ReadLump (lump);
const char *eof = (char *)data.GetMem() + Wads.LumpLength (lump);
const char *conf = (char *)data.GetMem();
while (conf < eof)
{
size_t i;
// Fetch a line to execute
for (i = 0; conf + i < eof && conf[i] != '\n'; ++i)
{
cmd[i] = conf[i];
}
cmd[i] = 0;
conf += i;
if (*conf == '\n')
{
conf++;
}
// Comments begin with //
char *stop = cmd + i - 1;
char *comment = cmd;
int inQuote = 0;
if (*stop == '\r')
*stop-- = 0;
while (comment < stop)
{
if (*comment == '\"')
{
inQuote ^= 1;
}
else if (!inQuote && *comment == '/' && *(comment + 1) == '/')
{
break;
}
comment++;
}
if (comment == cmd)
{ // Comment at line beginning
continue;
}
else if (comment < stop)
{ // Comment in middle of line
*comment = 0;
}
AddCommandString (cmd);
}
}
ParsingKeyConf = false;
}
//========================================================================== //==========================================================================
// //
// D_MultiExec // D_MultiExec
@ -1818,20 +1746,12 @@ static void SetMapxxFlag()
//========================================================================== //==========================================================================
// //
// D_DoomMain // Initialize
// //
//========================================================================== //==========================================================================
void D_DoomMain (void) static void D_DoomInit()
{ {
int p, flags;
const char *v;
const char *wad;
DArgs *execFiles;
TArray<FString> pwads;
FString *args;
int argcount;
// Set the FPU precision to 53 significant bits. This is the default // Set the FPU precision to 53 significant bits. This is the default
// for Visual C++, but not for GCC, so some slight math variances // for Visual C++, but not for GCC, so some slight math variances
// might crop up if we leave it alone. // might crop up if we leave it alone.
@ -1859,7 +1779,6 @@ void D_DoomMain (void)
Args->CollectFiles("-playdemo", ".lmp"); Args->CollectFiles("-playdemo", ".lmp");
Args->CollectFiles("-file", NULL); // anything left goes after -file Args->CollectFiles("-file", NULL); // anything left goes after -file
PClass::StaticInit ();
atterm (C_DeinitConsole); atterm (C_DeinitConsole);
gamestate = GS_STARTUP; gamestate = GS_STARTUP;
@ -1872,30 +1791,16 @@ void D_DoomMain (void)
Printf ("M_LoadDefaults: Load system defaults.\n"); Printf ("M_LoadDefaults: Load system defaults.\n");
M_LoadDefaults (); // load before initing other systems M_LoadDefaults (); // load before initing other systems
// [RH] Make sure zdoom.pk3 is always loaded, }
// as it contains magic stuff we need.
wad = BaseFileSearch (BASEWAD, NULL, true); //==========================================================================
if (wad == NULL) //
{ // AddAutoloadFiles
I_FatalError ("Cannot find " BASEWAD); //
} //==========================================================================
FString basewad = wad;
// Load zdoom.pk3 alone so that we can get access to the internal gameinfos before
// the IWAD is known.
GetCmdLineFiles(pwads);
FString iwad = CheckGameInfo(pwads);
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;
GameConfig->DoGameSetup (gameinfo.ConfigName);
static void AddAutoloadFiles(const char *gamesection)
{
if (!(gameinfo.flags & GI_SHAREWARE) && !Args->CheckParm("-noautoload")) if (!(gameinfo.flags & GI_SHAREWARE) && !Args->CheckParm("-noautoload"))
{ {
FString file; FString file;
@ -1905,7 +1810,7 @@ void D_DoomMain (void)
// voices. I never got around to writing the utility to do it, though. // 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 // And I probably never will now. But I know at least one person uses
// it for something else, so this gets to stay here. // it for something else, so this gets to stay here.
wad = BaseFileSearch ("zvox.wad", NULL); const char *wad = BaseFileSearch ("zvox.wad", NULL);
if (wad) if (wad)
D_AddFile (allwads, wad); D_AddFile (allwads, wad);
@ -1932,66 +1837,28 @@ void D_DoomMain (void)
D_AddConfigWads (allwads, file); D_AddConfigWads (allwads, file);
// Add IWAD-specific wads // Add IWAD-specific wads
if (iwad_info->Autoname != NULL) if (gamesection != NULL)
{ {
file = iwad_info->Autoname; file = gamesection;
file += ".Autoload"; file += ".Autoload";
D_AddConfigWads(allwads, file); D_AddConfigWads(allwads, file);
} }
} }
}
// Run automatically executed files //==========================================================================
execFiles = new DArgs; //
GameConfig->AddAutoexec (execFiles, gameinfo.ConfigName); // CheckCmdLine
D_MultiExec (execFiles, true); //
//==========================================================================
// Run .cfg files at the start of the command line. static void CheckCmdLine()
execFiles = Args->GatherFiles ("-exec"); {
D_MultiExec (execFiles, true); int flags = dmflags;
int p;
const char *v;
C_ExecCmdLineParams (); // [RH] do all +set commands on the command line Printf ("Checking cmd-line parameters...\n");
CopyFiles(allwads, pwads);
// Since this function will never leave we must delete this array here manually.
pwads.Clear();
pwads.ShrinkToFit();
Printf ("W_Init: Init WADfiles.\n");
Wads.InitMultipleFiles (allwads);
allwads.Clear();
allwads.ShrinkToFit();
SetMapxxFlag();
// [RH] Initialize localizable strings.
GStrings.LoadStrings (false);
V_InitFontColors ();
// [RH] Moved these up here so that we can do most of our
// startup output in a fullscreen console.
CT_Init ();
Printf ("I_Init: Setting up machine state.\n");
I_Init ();
Printf ("V_Init: allocate screen.\n");
V_Init ();
// Base systems have been inited; enable cvar callbacks
FBaseCVar::EnableCallbacks ();
Printf ("S_Init: Setting up sound.\n");
S_Init ();
Printf ("ST_Init: Init startup screen.\n");
StartScreen = FStartupScreen::CreateInstance (TexMan.GuesstimateNumTextures() + 5);
ParseCompatibility();
Printf ("P_Init: Checking cmd-line parameters...\n");
flags = dmflags;
if (Args->CheckParm ("-nomonsters")) flags |= DF_NO_MONSTERS; if (Args->CheckParm ("-nomonsters")) flags |= DF_NO_MONSTERS;
if (Args->CheckParm ("-respawn")) flags |= DF_MONSTERS_RESPAWN; if (Args->CheckParm ("-respawn")) flags |= DF_MONSTERS_RESPAWN;
if (Args->CheckParm ("-fast")) flags |= DF_FAST_MONSTERS; if (Args->CheckParm ("-fast")) flags |= DF_FAST_MONSTERS;
@ -2126,6 +1993,104 @@ void D_DoomMain (void)
temp.Format ("Warp to map %s, Skill %d ", startmap.GetChars(), gameskill + 1); temp.Format ("Warp to map %s, Skill %d ", startmap.GetChars(), gameskill + 1);
StartScreen->AppendStatusLine(temp); StartScreen->AppendStatusLine(temp);
} }
}
//==========================================================================
//
// D_DoomMain
//
//==========================================================================
void D_DoomMain (void)
{
int p;
const char *v;
const char *wad;
DArgs *execFiles;
TArray<FString> pwads;
FString *args;
int argcount;
D_DoomInit();
PClass::StaticInit ();
// [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;
// Load zdoom.pk3 alone so that we can get access to the internal gameinfos before
// the IWAD is known.
GetCmdLineFiles(pwads);
FString iwad = CheckGameInfo(pwads);
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;
GameConfig->DoGameSetup (gameinfo.ConfigName);
AddAutoloadFiles(iwad_info->Autoname);
// Run automatically executed files
execFiles = new DArgs;
GameConfig->AddAutoexec (execFiles, gameinfo.ConfigName);
D_MultiExec (execFiles, true);
// Run .cfg files at the start of the command line.
execFiles = Args->GatherFiles ("-exec");
D_MultiExec (execFiles, true);
C_ExecCmdLineParams (); // [RH] do all +set commands on the command line
CopyFiles(allwads, pwads);
// Since this function will never leave we must delete this array here manually.
pwads.Clear();
pwads.ShrinkToFit();
Printf ("W_Init: Init WADfiles.\n");
Wads.InitMultipleFiles (allwads);
allwads.Clear();
allwads.ShrinkToFit();
SetMapxxFlag();
// [RH] Initialize localizable strings.
GStrings.LoadStrings (false);
V_InitFontColors ();
// [RH] Moved these up here so that we can do most of our
// startup output in a fullscreen console.
CT_Init ();
Printf ("I_Init: Setting up machine state.\n");
I_Init ();
Printf ("V_Init: allocate screen.\n");
V_Init ();
// Base systems have been inited; enable cvar callbacks
FBaseCVar::EnableCallbacks ();
Printf ("S_Init: Setting up sound.\n");
S_Init ();
Printf ("ST_Init: Init startup screen.\n");
StartScreen = FStartupScreen::CreateInstance (TexMan.GuesstimateNumTextures() + 5);
ParseCompatibility();
CheckCmdLine();
// [RH] Load sound environments // [RH] Load sound environments
S_ParseReverbDef (); S_ParseReverbDef ();
@ -2141,6 +2106,7 @@ void D_DoomMain (void)
Printf ("Texman.Init: Init texture manager.\n"); Printf ("Texman.Init: Init texture manager.\n");
TexMan.Init(); TexMan.Init();
C_InitConback();
// [CW] Parse any TEAMINFO lumps. // [CW] Parse any TEAMINFO lumps.
Printf ("ParseTeamInfo: Load team definitions.\n"); Printf ("ParseTeamInfo: Load team definitions.\n");
@ -2199,20 +2165,8 @@ void D_DoomMain (void)
FActorInfo::StaticSetActorNums (); FActorInfo::StaticSetActorNums ();
// [RH] User-configurable startup strings. Because BOOM does.
static const char *startupString[5] = {
"STARTUP1", "STARTUP2", "STARTUP3", "STARTUP4", "STARTUP5"
};
for (p = 0; p < 5; ++p)
{
const char *str = GStrings[startupString[p]];
if (str != NULL && str[0] != '\0')
{
Printf ("%s\n", str);
}
}
//Added by MC: //Added by MC:
bglobal.getspawned.Clear();
argcount = Args->CheckParmList("-bots", &args); argcount = Args->CheckParmList("-bots", &args);
for (p = 0; p < argcount; ++p) for (p = 0; p < argcount; ++p)
{ {
@ -2226,6 +2180,7 @@ void D_DoomMain (void)
Printf ("P_Init: Init Playloop state.\n"); Printf ("P_Init: Init Playloop state.\n");
StartScreen->LoadingStatus ("Init game engine", 0x3f); StartScreen->LoadingStatus ("Init game engine", 0x3f);
AM_StaticInit();
P_Init (); P_Init ();
P_SetupWeapons_ntohton(); P_SetupWeapons_ntohton();
@ -2233,6 +2188,19 @@ void D_DoomMain (void)
//SBarInfo support. //SBarInfo support.
SBarInfo::Load(); SBarInfo::Load();
// [RH] User-configurable startup strings. Because BOOM does.
static const char *startupString[5] = {
"STARTUP1", "STARTUP2", "STARTUP3", "STARTUP4", "STARTUP5"
};
for (p = 0; p < 5; ++p)
{
const char *str = GStrings[startupString[p]];
if (str != NULL && str[0] != '\0')
{
Printf ("%s\n", str);
}
}
Printf ("D_CheckNetGame: Checking network game status.\n"); Printf ("D_CheckNetGame: Checking network game status.\n");
StartScreen->LoadingStatus ("Checking network game status.", 0x3f); StartScreen->LoadingStatus ("Checking network game status.", 0x3f);
D_CheckNetGame (); D_CheckNetGame ();

View file

@ -835,11 +835,9 @@ FArchive &operator<< (FArchive &arc, userinfo_t &info)
{ {
arc.Read (&info.netname, sizeof(info.netname)); arc.Read (&info.netname, sizeof(info.netname));
} }
arc << info.team << info.aimdist << info.color << info.skin << info.gender << info.neverswitch; arc << info.team << info.aimdist << info.color
if (SaveVersion >= 2193) << info.skin << info.gender << info.neverswitch
{ << info.colorset;
arc << info.colorset;
}
return arc; return arc;
} }

View file

@ -347,6 +347,16 @@ void FDecalLib::ReadAllDecals ()
int lump, lastlump = 0; int lump, lastlump = 0;
unsigned int i; unsigned int i;
for(unsigned i=0;i<Animators.Size(); i++)
{
delete Animators[i];
}
Animators.Clear();
FDecalCombinerAnim::AnimatorList.Clear();
DecalTranslations.Clear();
DecalLibrary.Clear();
while ((lump = Wads.FindLump ("DECALDEF", &lastlump)) != -1) while ((lump = Wads.FindLump ("DECALDEF", &lastlump)) != -1)
{ {
FScanner sc(lump); FScanner sc(lump);

View file

@ -540,11 +540,6 @@ void DObject::SerializeUserVars(FArchive &arc)
DWORD count, j; DWORD count, j;
int *varloc; int *varloc;
if (SaveVersion < 1933)
{
return;
}
symt = &GetClass()->Symbols; symt = &GetClass()->Symbols;
if (arc.IsStoring()) if (arc.IsStoring())

View file

@ -291,7 +291,11 @@ template<> inline FArchive &operator<< <FFont> (FArchive &arc, FFont* &font)
} }
struct FStrifeDialogueNode; struct FStrifeDialogueNode;
struct FSwitchDef;
struct FDoorAnimation;
template<> FArchive &operator<< (FArchive &arc, FStrifeDialogueNode *&node); template<> FArchive &operator<< (FArchive &arc, FStrifeDialogueNode *&node);
template<> FArchive &operator<< (FArchive &arc, FSwitchDef* &sw);
template<> FArchive &operator<< (FArchive &arc, FDoorAnimation* &da);

View file

@ -180,8 +180,6 @@ wbstartstruct_t wminfo; // parms for world map / intermission
short consistancy[MAXPLAYERS][BACKUPTICS]; short consistancy[MAXPLAYERS][BACKUPTICS];
BYTE* savebuffer;
#define MAXPLMOVE (forwardmove[1]) #define MAXPLMOVE (forwardmove[1])

View file

@ -85,6 +85,8 @@ void G_AddViewAngle (int yaw);
class AActor; class AActor;
extern AActor *bodyque[BODYQUESIZE]; extern AActor *bodyque[BODYQUESIZE];
extern int bodyqueslot; extern int bodyqueslot;
class AInventory;
extern const AInventory *SendItemUse, *SendItemDrop;
#endif #endif

View file

@ -76,7 +76,7 @@ struct FHubInfo
}; };
TArray<FHubInfo> hubdata; static TArray<FHubInfo> hubdata;
void G_LeavingHub(int mode, cluster_info_t * cluster, wbstartstruct_t * wbs) void G_LeavingHub(int mode, cluster_info_t * cluster, wbstartstruct_t * wbs)
{ {
@ -182,3 +182,8 @@ void G_ReadHubInfo (PNGHandle *png)
G_SerializeHub(arc); G_SerializeHub(arc);
} }
} }
void G_ClearHubInfo()
{
hubdata.Clear();
}

View file

@ -119,7 +119,6 @@ bool savegamerestore;
extern int mousex, mousey; extern int mousex, mousey;
extern bool sendpause, sendsave, sendturn180, SendLand; extern bool sendpause, sendsave, sendturn180, SendLand;
extern const AInventory *SendItemUse, *SendItemDrop;
void *statcopy; // for statistics driver void *statcopy; // for statistics driver
@ -309,6 +308,7 @@ void G_InitNew (const char *mapname, bool bTitleLevel)
bool wantFast; bool wantFast;
int i; int i;
G_ClearHubInfo();
if (!savegamerestore) if (!savegamerestore)
{ {
G_ClearSnapshots (); G_ClearSnapshots ();

View file

@ -514,6 +514,7 @@ void G_UnSnapshotLevel (bool keepPlayers);
struct PNGHandle; struct PNGHandle;
void G_ReadSnapshots (PNGHandle *png); void G_ReadSnapshots (PNGHandle *png);
void G_WriteSnapshots (FILE *file); void G_WriteSnapshots (FILE *file);
void G_ClearHubInfo();
enum ESkillProperty enum ESkillProperty
{ {

View file

@ -1803,8 +1803,13 @@ void DeinitIntermissions();
static void ClearMapinfo() static void ClearMapinfo()
{ {
wadclusterinfos.Clear();
wadlevelinfos.Clear();
ClearEpisodes(); ClearEpisodes();
AllSkills.Clear();
DefaultSkill = -1;
DeinitIntermissions(); DeinitIntermissions();
level.info = NULL;
} }
//========================================================================== //==========================================================================
@ -1820,6 +1825,7 @@ void G_ParseMapInfo (const char *basemapinfo)
int lump, lastlump = 0; int lump, lastlump = 0;
level_info_t gamedefaults; level_info_t gamedefaults;
ClearMapinfo();
atterm(ClearMapinfo); atterm(ClearMapinfo);
// Parse the default MAPINFO for the current game. This lump *MUST* come from zdoom.pk3. // Parse the default MAPINFO for the current game. This lump *MUST* come from zdoom.pk3.

View file

@ -16,6 +16,7 @@
#include "a_specialspot.h" #include "a_specialspot.h"
#include "thingdef/thingdef.h" #include "thingdef/thingdef.h"
#include "g_level.h" #include "g_level.h"
#include "g_game.h"
#include "doomstat.h" #include "doomstat.h"
static FRandom pr_restore ("RestorePos"); static FRandom pr_restore ("RestorePos");
@ -1033,6 +1034,10 @@ void AInventory::Destroy ()
} }
Inventory = NULL; Inventory = NULL;
Super::Destroy (); Super::Destroy ();
// Although contrived it can theoretically happen that these variables still got a pointer to this item
if (SendItemUse == this) SendItemUse = NULL;
if (SendItemDrop == this) SendItemDrop = NULL;
} }
//=========================================================================== //===========================================================================

View file

@ -55,16 +55,8 @@ void DEarthquake::Serialize (FArchive &arc)
{ {
Super::Serialize (arc); Super::Serialize (arc);
arc << m_Spot << m_Intensity << m_Countdown arc << m_Spot << m_Intensity << m_Countdown
<< m_TremorRadius << m_DamageRadius; << m_TremorRadius << m_DamageRadius
<< m_QuakeSFX;
if (SaveVersion >= 1912)
{
arc << m_QuakeSFX;
}
else
{
m_QuakeSFX = "world/quake";
}
} }
//========================================================================== //==========================================================================

View file

@ -70,11 +70,6 @@ void ASkyViewpoint::Serialize (FArchive &arc)
{ {
Super::Serialize (arc); Super::Serialize (arc);
arc << bInSkybox << bAlways << Mate; arc << bInSkybox << bAlways << Mate;
if (SaveVersion < 2992)
{
fixed_t eatme;
arc << eatme;
}
} }
void ASkyViewpoint::Destroy () void ASkyViewpoint::Destroy ()

View file

@ -335,6 +335,7 @@ bool FMugShot::SetState(const char *state_name, bool wait_till_done, bool reset)
// //
//=========================================================================== //===========================================================================
CVAR(Bool,st_oldouch,false,CVAR_ARCHIVE)
int FMugShot::UpdateState(player_t *player, StateFlags stateflags) int FMugShot::UpdateState(player_t *player, StateFlags stateflags)
{ {
int i; int i;
@ -357,9 +358,10 @@ int FMugShot::UpdateState(player_t *player, StateFlags stateflags)
} }
} }
bool ouch = (!st_oldouch && FaceHealth - player->health > ST_MUCHPAIN) || (st_oldouch && player->health - FaceHealth > ST_MUCHPAIN);
if (player->damagecount && if (player->damagecount &&
// Now go in if pain is disabled but we think ouch will be shown (and ouch is not disabled!) // Now go in if pain is disabled but we think ouch will be shown (and ouch is not disabled!)
(!(stateflags & DISABLEPAIN) || (((FaceHealth != -1 && FaceHealth - player->health > ST_MUCHPAIN) || bOuchActive) && !(stateflags & DISABLEOUCH)))) (!(stateflags & DISABLEPAIN) || (((FaceHealth != -1 && ouch) || bOuchActive) && !(stateflags & DISABLEOUCH))))
{ {
int damage_angle = 1; int damage_angle = 1;
if (player->attacker && player->attacker != player->mo) if (player->attacker && player->attacker != player->mo)
@ -391,7 +393,7 @@ int FMugShot::UpdateState(player_t *player, StateFlags stateflags)
} }
} }
bool use_ouch = false; bool use_ouch = false;
if (((FaceHealth != -1 && FaceHealth - player->health > ST_MUCHPAIN) || bOuchActive) && !(stateflags & DISABLEOUCH)) if (((FaceHealth != -1 && ouch) || bOuchActive) && !(stateflags & DISABLEOUCH))
{ {
use_ouch = true; use_ouch = true;
full_state_name = "ouch."; full_state_name = "ouch.";
@ -418,7 +420,7 @@ int FMugShot::UpdateState(player_t *player, StateFlags stateflags)
else else
{ {
bool use_ouch = false; bool use_ouch = false;
if (((FaceHealth != -1 && player->health - FaceHealth > ST_MUCHPAIN) || bOuchActive) && !(stateflags & DISABLEOUCH)) if (((FaceHealth != -1 && ouch) || bOuchActive) && !(stateflags & DISABLEOUCH))
{ {
use_ouch = true; use_ouch = true;
full_state_name = "ouch."; full_state_name = "ouch.";

View file

@ -77,7 +77,7 @@ static gameborder_t StrifeBorder =
// Custom GAMEINFO ------------------------------------------------------------ // Custom GAMEINFO ------------------------------------------------------------
const char* GameInfoBoarders[] = const char* GameInfoBorders[] =
{ {
"DoomBorder", "DoomBorder",
"HereticBorder", "HereticBorder",
@ -219,7 +219,7 @@ void FMapInfoParser::ParseGameInfo()
{ {
if(sc.CheckToken(TK_Identifier)) if(sc.CheckToken(TK_Identifier))
{ {
switch(sc.MustMatchString(GameInfoBoarders)) switch(sc.MustMatchString(GameInfoBorders))
{ {
default: default:
gameinfo.border = &DoomBorder; gameinfo.border = &DoomBorder;

View file

@ -52,6 +52,8 @@
#include "g_level.h" #include "g_level.h"
extern void LoadActors (); extern void LoadActors ();
extern void InitBotStuff();
extern void ClearStrifeTypes();
//========================================================================== //==========================================================================
@ -100,6 +102,7 @@ int GetSpriteIndex(const char * spritename)
void FActorInfo::StaticInit () void FActorInfo::StaticInit ()
{ {
sprites.Clear();
if (sprites.Size() == 0) if (sprites.Size() == 0)
{ {
spritedef_t temp; spritedef_t temp;
@ -120,7 +123,9 @@ void FActorInfo::StaticInit ()
} }
Printf ("LoadActors: Load actor definitions.\n"); Printf ("LoadActors: Load actor definitions.\n");
ClearStrifeTypes();
LoadActors (); LoadActors ();
InitBotStuff();
} }
//========================================================================== //==========================================================================

View file

@ -41,6 +41,7 @@
#include "c_bind.h" #include "c_bind.h"
#include "c_dispatch.h" #include "c_dispatch.h"
#include "gameconfigfile.h" #include "gameconfigfile.h"
#include "w_wad.h"
TArray<FKeySection> KeySections; TArray<FKeySection> KeySections;
@ -141,3 +142,78 @@ CCMD (addmenukey)
} }
} }
//==========================================================================
//
// D_LoadWadSettings
//
// Parses any loaded KEYCONF lumps. These are restricted console scripts
// that can only execute the alias, defaultbind, addkeysection,
// addmenukey, weaponsection, and addslotdefault commands.
//
//==========================================================================
void D_LoadWadSettings ()
{
char cmd[4096];
int lump, lastlump = 0;
ParsingKeyConf = true;
KeySections.Clear();
while ((lump = Wads.FindLump ("KEYCONF", &lastlump)) != -1)
{
FMemLump data = Wads.ReadLump (lump);
const char *eof = (char *)data.GetMem() + Wads.LumpLength (lump);
const char *conf = (char *)data.GetMem();
while (conf < eof)
{
size_t i;
// Fetch a line to execute
for (i = 0; conf + i < eof && conf[i] != '\n'; ++i)
{
cmd[i] = conf[i];
}
cmd[i] = 0;
conf += i;
if (*conf == '\n')
{
conf++;
}
// Comments begin with //
char *stop = cmd + i - 1;
char *comment = cmd;
int inQuote = 0;
if (*stop == '\r')
*stop-- = 0;
while (comment < stop)
{
if (*comment == '\"')
{
inQuote ^= 1;
}
else if (!inQuote && *comment == '/' && *(comment + 1) == '/')
{
break;
}
comment++;
}
if (comment == cmd)
{ // Comment at line beginning
continue;
}
else if (comment < stop)
{ // Comment in middle of line
*comment = 0;
}
AddCommandString (cmd);
}
}
ParsingKeyConf = false;
}

View file

@ -70,7 +70,6 @@ CVAR(Int, m_show_backbutton, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
DMenu *DMenu::CurrentMenu; DMenu *DMenu::CurrentMenu;
int DMenu::MenuTime; int DMenu::MenuTime;
FListMenuDescriptor *MainMenu;
FGameStartup GameStartupInfo; FGameStartup GameStartupInfo;
EMenuState menuactive; EMenuState menuactive;
bool M_DemoNoPlay; bool M_DemoNoPlay;

View file

@ -280,6 +280,8 @@ xx(Communicator)
// Textmap properties // Textmap properties
//xx(X) //xx(X)
//xx(Y) //xx(Y)
xx(ZFloor)
xx(ZCeiling)
xx(Height) xx(Height)
//xx(Tid) //xx(Tid)
//xx(Angle) //xx(Angle)

View file

@ -145,6 +145,11 @@ void SetStrifeType(int convid, const PClass *Class)
StrifeTypes[convid] = Class; StrifeTypes[convid] = Class;
} }
void ClearStrifeTypes()
{
StrifeTypes.Clear();
}
void SetConversation(int convid, const PClass *Class, int dlgindex) void SetConversation(int convid, const PClass *Class, int dlgindex)
{ {
if (convid != -1) if (convid != -1)

View file

@ -639,13 +639,6 @@ void DAnimatedDoor::Serialize (FArchive &arc)
{ {
Super::Serialize (arc); Super::Serialize (arc);
FTextureID basetex;
if (arc.IsStoring())
{
basetex = m_DoorAnim->BaseTexture;
}
arc << m_Line1 << m_Line2 arc << m_Line1 << m_Line2
<< m_Frame << m_Frame
<< m_Timer << m_Timer
@ -653,20 +646,8 @@ void DAnimatedDoor::Serialize (FArchive &arc)
<< m_Status << m_Status
<< m_Speed << m_Speed
<< m_Delay << m_Delay
<< basetex; << m_DoorAnim
if (SaveVersion < 2336) << m_SetBlocking1 << m_SetBlocking2;
{
m_SetBlocking1 = m_SetBlocking2 = true;
}
else
{
arc << m_SetBlocking1 << m_SetBlocking2;
}
if (arc.IsLoading())
{
m_DoorAnim = TexMan.FindAnimatedDoor (basetex);
}
} }
DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay, FDoorAnimation *anim) DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay, FDoorAnimation *anim)

View file

@ -258,18 +258,9 @@ void AActor::Serialize (FArchive &arc)
<< args[0] << args[1] << args[2] << args[3] << args[4] << args[0] << args[1] << args[2] << args[3] << args[4]
<< goal << goal
<< waterlevel << waterlevel
<< MinMissileChance; << MinMissileChance
if (SaveVersion >= 2826) << SpawnFlags
{ << Inventory
arc << SpawnFlags;
}
else
{
WORD w;
arc << w;
SpawnFlags = w;
}
arc << Inventory
<< InventoryID << InventoryID
<< id << id
<< FloatBobPhase << FloatBobPhase
@ -281,12 +272,9 @@ void AActor::Serialize (FArchive &arc)
<< ActiveSound << ActiveSound
<< UseSound << UseSound
<< BounceSound << BounceSound
<< WallBounceSound; << WallBounceSound
if (SaveVersion >= 2234) << CrushPainSound
{ << Speed
arc << CrushPainSound;
}
arc << Speed
<< FloatSpeed << FloatSpeed
<< Mass << Mass
<< PainChance << PainChance
@ -313,83 +301,14 @@ void AActor::Serialize (FArchive &arc)
<< pushfactor << pushfactor
<< Species << Species
<< Score << Score
<< Tag; << Tag
if (SaveVersion >= 1904) << lastpush << lastbump
{ << PainThreshold
arc << lastpush << lastbump; << DamageFactor
} << WeaveIndexXY << WeaveIndexZ
<< PoisonDamageReceived << PoisonDurationReceived << PoisonPeriodReceived << Poisoner
if (SaveVersion >= 1900) << PoisonDamage << PoisonDuration << PoisonPeriod
{ << ConversationRoot << Conversation;
arc << PainThreshold;
}
if (SaveVersion >= 1914)
{
arc << DamageFactor;
}
if (SaveVersion > 2036)
{
arc << WeaveIndexXY << WeaveIndexZ;
}
else
{
int index;
if (SaveVersion < 2036)
{
index = special2;
}
else
{
arc << index;
}
// A_BishopMissileWeave and A_CStaffMissileSlither stored the weaveXY
// value in different parts of the index.
if (this->IsKindOf(PClass::FindClass("BishopFX")))
{
WeaveIndexXY = index >> 16;
WeaveIndexZ = index;
}
else
{
WeaveIndexXY = index;
WeaveIndexZ = 0;
}
}
if (SaveVersion >= 2450)
{
arc << PoisonDamageReceived << PoisonDurationReceived << PoisonPeriodReceived << Poisoner;
arc << PoisonDamage << PoisonDuration << PoisonPeriod;
}
// Skip past uservar array in old savegames
if (SaveVersion < 1933)
{
int foo;
for (int i = 0; i < 10; ++i)
arc << foo;
}
if (SaveVersion > 2560)
{
arc << ConversationRoot << Conversation;
}
else // old code which uses relative indexing.
{
int convnum;
convnum = arc.ReadCount();
if (GetConversation(GetClass()->TypeName) == -1)
{
Conversation = NULL;
ConversationRoot = -1;
}
else
{
// This cannot be restored anymore.
I_Error("Cannot load old savegames with active dialogues");
}
}
if (arc.IsLoading ()) if (arc.IsLoading ())
{ {
@ -5667,12 +5586,13 @@ void FreeDropItemChain(FDropItem *chain)
} }
} }
FDropItemPtrArray::~FDropItemPtrArray() void FDropItemPtrArray::Clear()
{ {
for (unsigned int i = 0; i < Size(); ++i) for (unsigned int i = 0; i < Size(); ++i)
{ {
FreeDropItemChain ((*this)[i]); FreeDropItemChain ((*this)[i]);
} }
TArray<FDropItem *>::Clear();
} }
int StoreDropItemChain(FDropItem *chain) int StoreDropItemChain(FDropItem *chain)

View file

@ -861,15 +861,7 @@ void P_MovePsprites (player_t *player)
FArchive &operator<< (FArchive &arc, pspdef_t &def) FArchive &operator<< (FArchive &arc, pspdef_t &def)
{ {
arc << def.state << def.tics << def.sx << def.sy; arc << def.state << def.tics << def.sx << def.sy
if (SaveVersion >= 2295) << def.sprite << def.frame;
{
arc << def.sprite << def.frame;
}
else
{
def.sprite = def.state->sprite;
def.frame = def.state->Frame;
}
return arc; return arc;
} }

View file

@ -347,16 +347,8 @@ void P_SerializeWorld (FArchive &arc)
<< sec->interpolations[0] << sec->interpolations[0]
<< sec->interpolations[1] << sec->interpolations[1]
<< sec->interpolations[2] << sec->interpolations[2]
<< sec->interpolations[3]; << sec->interpolations[3]
<< sec->SeqName;
if (SaveVersion < 2492)
{
sec->SeqName = NAME_None;
}
else
{
arc << sec->SeqName;
}
sec->e->Serialize(arc); sec->e->Serialize(arc);
if (arc.IsStoring ()) if (arc.IsStoring ())
@ -445,15 +437,7 @@ FArchive &operator<< (FArchive &arc, sector_t::splane &p)
{ {
arc << p.xform.xoffs << p.xform.yoffs << p.xform.xscale << p.xform.yscale arc << p.xform.xoffs << p.xform.yoffs << p.xform.xscale << p.xform.yscale
<< p.xform.angle << p.xform.base_yoffs << p.xform.base_angle << p.xform.angle << p.xform.base_yoffs << p.xform.base_angle
<< p.Flags << p.Light << p.Texture << p.TexZ; << p.Flags << p.Light << p.Texture << p.TexZ << p.alpha;
if (SaveVersion >= 2992)
{
arc << p.alpha;
}
else
{
p.alpha = FRACUNIT;
}
return arc; return arc;
} }
@ -615,15 +599,6 @@ void P_SerializeSubsectors(FArchive &arc)
} }
else else
{ {
if (SaveVersion < 2609)
{
if (hasglnodes)
{
RecalculateDrawnSubsectors();
}
return;
}
arc << num_verts << num_subs << num_nodes; arc << num_verts << num_subs << num_nodes;
if (num_verts != numvertexes || if (num_verts != numvertexes ||
num_subs != numsubsectors || num_subs != numsubsectors ||

View file

@ -106,6 +106,8 @@ bool P_IsBuildMap(MapData *map);
// //
int numvertexes; int numvertexes;
vertex_t* vertexes; vertex_t* vertexes;
int numvertexdatas;
vertexdata_t* vertexdatas;
int numsegs; int numsegs;
seg_t* segs; seg_t* segs;
@ -795,6 +797,7 @@ void P_LoadVertexes (MapData * map)
// Determine number of vertices: // Determine number of vertices:
// total lump length / vertex record length. // total lump length / vertex record length.
numvertexes = map->MapLumps[ML_VERTEXES].Size / sizeof(mapvertex_t); numvertexes = map->MapLumps[ML_VERTEXES].Size / sizeof(mapvertex_t);
numvertexdatas = 0;
if (numvertexes == 0) if (numvertexes == 0)
{ {
@ -803,6 +806,7 @@ void P_LoadVertexes (MapData * map)
// Allocate memory for buffer. // Allocate memory for buffer.
vertexes = new vertex_t[numvertexes]; vertexes = new vertex_t[numvertexes];
vertexdatas = NULL;
map->Seek(ML_VERTEXES); map->Seek(ML_VERTEXES);
@ -3533,6 +3537,7 @@ void P_FreeExtraLevelData()
delete node; delete node;
node = next; node = next;
} }
FBlockNode::FreeBlocks = NULL;
} }
{ {
msecnode_t *node = headsecnode; msecnode_t *node = headsecnode;
@ -3571,8 +3576,11 @@ void P_SetupLevel (char *lumpname, int position)
wminfo.partime = 180; wminfo.partime = 180;
MapThingsConverted.Clear();
linemap.Clear();
FCanvasTextureInfo::EmptyList (); FCanvasTextureInfo::EmptyList ();
R_FreePastViewers (); R_FreePastViewers ();
P_ClearUDMFKeys();
if (!savegamerestore) if (!savegamerestore)
{ {

View file

@ -309,6 +309,27 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt)
mt->type = 0; mt->type = 0;
} }
} }
for(int i = 0; i < numvertexdatas; i++)
{
if (vertexdatas[i].flags & VERTEXFLAG_ZCeilingEnabled)
{
vt_heights[1][i] = vertexdatas[i].zCeiling;
vt_found = true;
}
if (vertexdatas[i].flags & VERTEXFLAG_ZFloorEnabled)
{
vt_heights[0][i] = vertexdatas[i].zFloor;
vt_found = true;
}
}
// If vertexdata_t is ever extended for non-slope usage, this will obviously have to be deferred or removed.
delete[] vertexdatas;
vertexdatas = NULL;
numvertexdatas = 0;
if (vt_found) if (vt_found)
{ {
for (int i = 0; i < numsectors; i++) for (int i = 0; i < numsectors; i++)

View file

@ -861,7 +861,6 @@ bool FStateDefinitions::AddStates(FState *state, const char *framechars)
int FStateDefinitions::FinishStates (FActorInfo *actor, AActor *defaults) int FStateDefinitions::FinishStates (FActorInfo *actor, AActor *defaults)
{ {
static int c=0;
int count = StateArray.Size(); int count = StateArray.Size();
if (count > 0) if (count > 0)

View file

@ -56,17 +56,18 @@ class DActiveButton : public DThinker
DECLARE_CLASS (DActiveButton, DThinker) DECLARE_CLASS (DActiveButton, DThinker)
public: public:
DActiveButton (); DActiveButton ();
DActiveButton (side_t *, int, WORD switchnum, fixed_t x, fixed_t y, bool flippable); DActiveButton (side_t *, int, FSwitchDef *, fixed_t x, fixed_t y, bool flippable);
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
void Tick (); void Tick ();
side_t *m_Side; side_t *m_Side;
SBYTE m_Part; SBYTE m_Part;
WORD m_SwitchDef;
WORD m_Frame;
WORD m_Timer;
bool bFlippable; bool bFlippable;
bool bReturning;
FSwitchDef *m_SwitchDef;
SDWORD m_Frame;
DWORD m_Timer;
fixed_t m_X, m_Y; // Location of timer sound fixed_t m_X, m_Y; // Location of timer sound
protected: protected:
@ -81,8 +82,7 @@ protected:
// //
//========================================================================== //==========================================================================
static bool P_StartButton (side_t *side, int Where, int switchnum, static bool P_StartButton (side_t *side, int Where, FSwitchDef *Switch, fixed_t x, fixed_t y, bool useagain)
fixed_t x, fixed_t y, bool useagain)
{ {
DActiveButton *button; DActiveButton *button;
TThinkerIterator<DActiveButton> iterator; TThinkerIterator<DActiveButton> iterator;
@ -97,7 +97,7 @@ static bool P_StartButton (side_t *side, int Where, int switchnum,
} }
} }
new DActiveButton (side, Where, switchnum, x, y, useagain); new DActiveButton (side, Where, Switch, x, y, useagain);
return true; return true;
} }
@ -168,15 +168,15 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno)
if (open.range <= 0) if (open.range <= 0)
goto onesided; goto onesided;
if ((TexMan.FindSwitch (side->GetTexture(side_t::top))) != -1) if ((TexMan.FindSwitch (side->GetTexture(side_t::top))) != NULL)
{ {
return (user->z + user->height >= open.top); return (user->z + user->height >= open.top);
} }
else if ((TexMan.FindSwitch (side->GetTexture(side_t::bottom))) != -1) else if ((TexMan.FindSwitch (side->GetTexture(side_t::bottom))) != NULL)
{ {
return (user->z <= open.bottom); return (user->z <= open.bottom);
} }
else if ((line->flags & (ML_3DMIDTEX)) || (TexMan.FindSwitch (side->GetTexture(side_t::mid))) != -1) else if ((line->flags & (ML_3DMIDTEX)) || (TexMan.FindSwitch (side->GetTexture(side_t::mid))) != NULL)
{ {
// 3DMIDTEX lines will force a mid texture check if no switch is found on this line // 3DMIDTEX lines will force a mid texture check if no switch is found on this line
// to keep compatibility with Eternity's implementation. // to keep compatibility with Eternity's implementation.
@ -202,18 +202,17 @@ bool P_ChangeSwitchTexture (side_t *side, int useAgain, BYTE special, bool *ques
{ {
int texture; int texture;
int sound; int sound;
int i;
FSwitchDef *Switch; FSwitchDef *Switch;
if ((i = TexMan.FindSwitch (side->GetTexture(side_t::top))) != -1) if ((Switch = TexMan.FindSwitch (side->GetTexture(side_t::top))) != NULL)
{ {
texture = side_t::top; texture = side_t::top;
} }
else if ((i = TexMan.FindSwitch (side->GetTexture(side_t::bottom))) != -1) else if ((Switch = TexMan.FindSwitch (side->GetTexture(side_t::bottom))) != NULL)
{ {
texture = side_t::bottom; texture = side_t::bottom;
} }
else if ((i = TexMan.FindSwitch (side->GetTexture(side_t::mid))) != -1) else if ((Switch = TexMan.FindSwitch (side->GetTexture(side_t::mid))) != NULL)
{ {
texture = side_t::mid; texture = side_t::mid;
} }
@ -225,7 +224,6 @@ bool P_ChangeSwitchTexture (side_t *side, int useAgain, BYTE special, bool *ques
} }
return false; return false;
} }
Switch = TexMan.GetSwitch(i);
// EXIT SWITCH? // EXIT SWITCH?
if (Switch->Sound != 0) if (Switch->Sound != 0)
@ -252,10 +250,10 @@ bool P_ChangeSwitchTexture (side_t *side, int useAgain, BYTE special, bool *ques
pt[0] = line->v1->x + (line->dx >> 1); pt[0] = line->v1->x + (line->dx >> 1);
pt[1] = line->v1->y + (line->dy >> 1); pt[1] = line->v1->y + (line->dy >> 1);
side->SetTexture(texture, Switch->u[0].Texture); side->SetTexture(texture, Switch->frames[0].Texture);
if (useAgain || Switch->NumFrames > 1) if (useAgain || Switch->NumFrames > 1)
{ {
playsound = P_StartButton (side, texture, i, pt[0], pt[1], !!useAgain); playsound = P_StartButton (side, texture, Switch, pt[0], pt[1], !!useAgain);
} }
else else
{ {
@ -289,9 +287,11 @@ DActiveButton::DActiveButton ()
m_X = 0; m_X = 0;
m_Y = 0; m_Y = 0;
bFlippable = false; bFlippable = false;
bReturning = false;
m_Frame = 0;
} }
DActiveButton::DActiveButton (side_t *side, int Where, WORD switchnum, DActiveButton::DActiveButton (side_t *side, int Where, FSwitchDef *Switch,
fixed_t x, fixed_t y, bool useagain) fixed_t x, fixed_t y, bool useagain)
{ {
m_Side = side; m_Side = side;
@ -299,9 +299,10 @@ DActiveButton::DActiveButton (side_t *side, int Where, WORD switchnum,
m_X = x; m_X = x;
m_Y = y; m_Y = y;
bFlippable = useagain; bFlippable = useagain;
bReturning = false;
m_SwitchDef = switchnum; m_SwitchDef = Switch;
m_Frame = 65535; m_Frame = -1;
AdvanceFrame (); AdvanceFrame ();
} }
@ -313,18 +314,8 @@ DActiveButton::DActiveButton (side_t *side, int Where, WORD switchnum,
void DActiveButton::Serialize (FArchive &arc) void DActiveButton::Serialize (FArchive &arc)
{ {
SDWORD sidenum;
Super::Serialize (arc); Super::Serialize (arc);
if (arc.IsStoring ()) arc << m_Side << m_Part << m_SwitchDef << m_Frame << m_Timer << bFlippable << m_X << m_Y << bReturning;
{
sidenum = m_Side ? SDWORD(m_Side - sides) : -1;
}
arc << sidenum << m_Part << m_SwitchDef << m_Frame << m_Timer << bFlippable << m_X << m_Y;
if (arc.IsLoading ())
{
m_Side = sidenum >= 0 ? sides + sidenum : NULL;
}
} }
//========================================================================== //==========================================================================
@ -335,16 +326,23 @@ void DActiveButton::Serialize (FArchive &arc)
void DActiveButton::Tick () void DActiveButton::Tick ()
{ {
if (m_SwitchDef == NULL)
{
// We lost our definition due to a bad savegame.
Destroy();
return;
}
FSwitchDef *def = bReturning? m_SwitchDef->PairDef : m_SwitchDef;
if (--m_Timer == 0) if (--m_Timer == 0)
{ {
FSwitchDef *def = TexMan.GetSwitch(m_SwitchDef);
if (m_Frame == def->NumFrames - 1) if (m_Frame == def->NumFrames - 1)
{ {
m_SwitchDef = def->PairIndex; bReturning = true;
if (m_SwitchDef != 65535) def = m_SwitchDef->PairDef;
if (def != NULL)
{ {
def = TexMan.GetSwitch(def->PairIndex); m_Frame = -1;
m_Frame = 65535;
S_Sound (m_X, m_Y, 0, CHAN_VOICE|CHAN_LISTENERZ, S_Sound (m_X, m_Y, 0, CHAN_VOICE|CHAN_LISTENERZ,
def->Sound != 0 ? FSoundID(def->Sound) : FSoundID("switches/normbutn"), def->Sound != 0 ? FSoundID(def->Sound) : FSoundID("switches/normbutn"),
1, ATTN_STATIC); 1, ATTN_STATIC);
@ -358,7 +356,7 @@ void DActiveButton::Tick ()
} }
bool killme = AdvanceFrame (); bool killme = AdvanceFrame ();
m_Side->SetTexture(m_Part, def->u[m_Frame].Texture); m_Side->SetTexture(m_Part, def->frames[m_Frame].Texture);
if (killme) if (killme)
{ {
@ -376,7 +374,7 @@ void DActiveButton::Tick ()
bool DActiveButton::AdvanceFrame () bool DActiveButton::AdvanceFrame ()
{ {
bool ret = false; bool ret = false;
FSwitchDef *def = TexMan.GetSwitch(m_SwitchDef); FSwitchDef *def = bReturning? m_SwitchDef->PairDef : m_SwitchDef;
if (++m_Frame == def->NumFrames - 1) if (++m_Frame == def->NumFrames - 1)
{ {
@ -391,17 +389,10 @@ bool DActiveButton::AdvanceFrame ()
} }
else else
{ {
if (def->u[m_Frame].Time & 0xffff0000) m_Timer = def->frames[m_Frame].TimeMin;
if (def->frames[m_Frame].TimeRnd != 0)
{ {
int t = pr_switchanim(); m_Timer += pr_switchanim(def->frames[m_Frame].TimeRnd);
m_Timer = (WORD)((((t | (pr_switchanim() << 8))
% def->u[m_Frame].Time) >> 16)
+ (def->u[m_Frame].Time & 0xffff));
}
else
{
m_Timer = (WORD)def->u[m_Frame].Time;
} }
} }
return ret; return ret;

View file

@ -242,6 +242,8 @@ void P_InitTerrainTypes ()
int lump; int lump;
int size; int size;
Splashes.Clear();
Terrains.Clear();
size = (TexMan.NumTextures()+1); size = (TexMan.NumTextures()+1);
TerrainTypes.Resize(size); TerrainTypes.Resize(size);
TerrainTypes.Clear(); TerrainTypes.Clear();

View file

@ -390,6 +390,7 @@ class UDMFParser : public UDMFParserBase
TArray<mapsidedef_t> ParsedSideTextures; TArray<mapsidedef_t> ParsedSideTextures;
TArray<sector_t> ParsedSectors; TArray<sector_t> ParsedSectors;
TArray<vertex_t> ParsedVertices; TArray<vertex_t> ParsedVertices;
TArray<vertexdata_t> ParsedVertexDatas;
FDynamicColormap *fogMap, *normMap; FDynamicColormap *fogMap, *normMap;
@ -1303,9 +1304,10 @@ public:
// //
//=========================================================================== //===========================================================================
void ParseVertex(vertex_t *vt) void ParseVertex(vertex_t *vt, vertexdata_t *vd)
{ {
vt->x = vt->y = 0; vt->x = vt->y = 0;
vd->zCeiling = vd->zFloor = vd->flags = 0;
sc.MustGetStringName("{"); sc.MustGetStringName("{");
while (!sc.CheckString("}")) while (!sc.CheckString("}"))
{ {
@ -1320,9 +1322,21 @@ public:
case NAME_X: case NAME_X:
vt->x = FLOAT2FIXED(strtod(value, NULL)); vt->x = FLOAT2FIXED(strtod(value, NULL));
break; break;
case NAME_Y: case NAME_Y:
vt->y = FLOAT2FIXED(strtod(value, NULL)); vt->y = FLOAT2FIXED(strtod(value, NULL));
break; break;
case NAME_ZCeiling:
vd->zCeiling = FLOAT2FIXED(strtod(value, NULL));
vd->flags |= VERTEXFLAG_ZCeilingEnabled;
break;
case NAME_ZFloor:
vd->zFloor = FLOAT2FIXED(strtod(value, NULL));
vd->flags |= VERTEXFLAG_ZFloorEnabled;
break;
default: default:
break; break;
} }
@ -1520,8 +1534,10 @@ public:
else if (sc.Compare("vertex")) else if (sc.Compare("vertex"))
{ {
vertex_t vt; vertex_t vt;
ParseVertex(&vt); vertexdata_t vd;
ParseVertex(&vt, &vd);
ParsedVertices.Push(vt); ParsedVertices.Push(vt);
ParsedVertexDatas.Push(vd);
} }
else else
{ {
@ -1534,6 +1550,11 @@ public:
vertexes = new vertex_t[numvertexes]; vertexes = new vertex_t[numvertexes];
memcpy(vertexes, &ParsedVertices[0], numvertexes * sizeof(*vertexes)); memcpy(vertexes, &ParsedVertices[0], numvertexes * sizeof(*vertexes));
// Create the real vertex datas
numvertexdatas = ParsedVertexDatas.Size();
vertexdatas = new vertexdata_t[numvertexdatas];
memcpy(vertexdatas, &ParsedVertexDatas[0], numvertexdatas * sizeof(*vertexdatas));
// Create the real sectors // Create the real sectors
numsectors = ParsedSectors.Size(); numsectors = ParsedSectors.Size();
sectors = new sector_t[numsectors]; sectors = new sector_t[numsectors];

View file

@ -432,10 +432,6 @@ void APlayerPawn::Serialize (FArchive &arc)
<< MorphWeapon << MorphWeapon
<< DamageFade << DamageFade
<< PlayerFlags; << PlayerFlags;
if (SaveVersion < 2435)
{
DamageFade.a = 255;
}
} }
//=========================================================================== //===========================================================================
@ -2554,33 +2550,9 @@ void player_t::Serialize (FArchive &arc)
<< poisoncount << poisoncount
<< poisoner << poisoner
<< attacker << attacker
<< extralight; << extralight
if (SaveVersion < 1858) << fixedcolormap << fixedlightlevel
{ << morphTics
int fixedmap;
arc << fixedmap;
fixedcolormap = NOFIXEDCOLORMAP;
fixedlightlevel = -1;
if (fixedmap >= NUMCOLORMAPS)
{
fixedcolormap = fixedmap - NUMCOLORMAPS;
}
else if (fixedmap > 0)
{
fixedlightlevel = fixedmap;
}
}
else if (SaveVersion < 1893)
{
int ll;
arc << fixedcolormap << ll;
fixedlightlevel = ll;
}
else
{
arc << fixedcolormap << fixedlightlevel;
}
arc << morphTics
<< MorphedPlayerClass << MorphedPlayerClass
<< MorphStyle << MorphStyle
<< MorphExitFlash << MorphExitFlash

View file

@ -70,6 +70,16 @@ extern size_t MaxDrawSegs;
// Note: transformed values not buffered locally, // Note: transformed values not buffered locally,
// like some DOOM-alikes ("wt", "WebView") did. // like some DOOM-alikes ("wt", "WebView") did.
// //
enum
{
VERTEXFLAG_ZCeilingEnabled = 0x01,
VERTEXFLAG_ZFloorEnabled = 0x02
};
struct vertexdata_t
{
fixed_t zCeiling, zFloor;
DWORD flags;
};
struct vertex_t struct vertex_t
{ {
fixed_t x, y; fixed_t x, y;

View file

@ -826,16 +826,7 @@ void DPolyobjInterpolation::Serialize(FArchive &arc)
arc << po << oldverts; arc << po << oldverts;
poly = polyobjs + po; poly = polyobjs + po;
if (SaveVersion >= 2448)
{
arc << oldcx << oldcy; arc << oldcx << oldcy;
}
else
{
// This will glitch if an old savegame is loaded but at least it'll allow loading it.
oldcx = poly->CenterSpot.x;
oldcy = poly->CenterSpot.y;
}
if (arc.IsLoading()) bakverts.Resize(oldverts.Size()); if (arc.IsLoading()) bakverts.Resize(oldverts.Size());
} }

View file

@ -55,6 +55,8 @@ extern DWORD NumStdSprites;
extern int numvertexes; extern int numvertexes;
extern vertex_t* vertexes; extern vertex_t* vertexes;
extern int numvertexdatas;
extern vertexdata_t* vertexdatas;
extern int numsegs; extern int numsegs;
extern seg_t* segs; extern seg_t* segs;

View file

@ -2357,6 +2357,7 @@ void R_InitParticles ()
if ( NumParticles < 100 ) if ( NumParticles < 100 )
NumParticles = 100; NumParticles = 100;
R_DeinitParticles();
Particles = new particle_t[NumParticles]; Particles = new particle_t[NumParticles];
R_ClearParticles (); R_ClearParticles ();
atterm (R_DeinitParticles); atterm (R_DeinitParticles);

View file

@ -857,6 +857,8 @@ static void S_ClearSoundData()
PlayerSounds.Clear(); PlayerSounds.Clear();
DefPlayerClass = 0; DefPlayerClass = 0;
DefPlayerClassName = ""; DefPlayerClassName = "";
MusicAliases.Clear();
MidiDevices.Clear();
} }
//========================================================================== //==========================================================================
@ -867,10 +869,11 @@ static void S_ClearSoundData()
// Also registers Blood SFX files and Strife's voices. // Also registers Blood SFX files and Strife's voices.
//========================================================================== //==========================================================================
void S_ParseSndInfo () void S_ParseSndInfo (bool redefine)
{ {
int lump; int lump;
if (!redefine) SavedPlayerSounds.Clear(); // clear skin sounds only for initial parsing.
atterm (S_ClearSoundData); atterm (S_ClearSoundData);
S_ClearSoundData(); // remove old sound data first! S_ClearSoundData(); // remove old sound data first!
@ -2016,10 +2019,6 @@ void AAmbientSound::Serialize (FArchive &arc)
{ {
Super::Serialize (arc); Super::Serialize (arc);
arc << bActive << NextCheck; arc << bActive << NextCheck;
if (SaveVersion < 2798)
{
NextCheck += level.maptime;
}
} }
//========================================================================== //==========================================================================

View file

@ -322,7 +322,7 @@ void S_Init ()
void S_InitData () void S_InitData ()
{ {
LastLocalSndInfo = LastLocalSndSeq = ""; LastLocalSndInfo = LastLocalSndSeq = "";
S_ParseSndInfo (); S_ParseSndInfo (false);
S_ParseSndSeq (-1); S_ParseSndSeq (-1);
S_ParseMusInfo(); S_ParseMusInfo();
} }
@ -408,7 +408,7 @@ void S_Start ()
} }
// Parse the global SNDINFO // Parse the global SNDINFO
S_ParseSndInfo(); S_ParseSndInfo(true);
if (*LocalSndInfo) if (*LocalSndInfo)
{ {

View file

@ -331,7 +331,7 @@ void S_UpdateSounds (AActor *listener);
void S_RestoreEvictedChannels(); void S_RestoreEvictedChannels();
// [RH] S_sfx "maintenance" routines // [RH] S_sfx "maintenance" routines
void S_ParseSndInfo (); void S_ParseSndInfo (bool redefine);
void S_ParseReverbDef (); void S_ParseReverbDef ();
void S_UnloadReverbDef (); void S_UnloadReverbDef ();

View file

@ -134,6 +134,7 @@ static void ParseStatistics(const char *fn, TArray<FStatistics> &statlist)
{ {
FScanner sc; FScanner sc;
sc.OpenFile(fn); sc.OpenFile(fn);
statlist.Clear();
while (sc.GetString()) while (sc.GetString())
{ {

View file

@ -3,5 +3,5 @@
// This file was automatically generated by the // This file was automatically generated by the
// updaterevision tool. Do not edit by hand. // updaterevision tool. Do not edit by hand.
#define ZD_SVN_REVISION_STRING "3029" #define ZD_SVN_REVISION_STRING "3038"
#define ZD_SVN_REVISION_NUMBER 3029 #define ZD_SVN_REVISION_NUMBER 3038

View file

@ -131,6 +131,7 @@ void FTeam::ParseTeamInfo ()
{ {
int iLump, iLastLump = 0; int iLump, iLastLump = 0;
Teams.Clear();
while ((iLump = Wads.FindLump ("TEAMINFO", &iLastLump)) != -1) while ((iLump = Wads.FindLump ("TEAMINFO", &iLastLump)) != -1)
{ {
FScanner Scan (iLump); FScanner Scan (iLump);

View file

@ -63,8 +63,6 @@ void FTextureManager::InitSwitchList ()
{ {
const BITFIELD texflags = TEXMAN_Overridable | TEXMAN_TryAny; const BITFIELD texflags = TEXMAN_Overridable | TEXMAN_TryAny;
int lump = Wads.CheckNumForName ("SWITCHES"); int lump = Wads.CheckNumForName ("SWITCHES");
FSwitchDef **origMap;
int i, j;
if (lump != -1) if (lump != -1)
{ {
@ -87,46 +85,19 @@ void FTextureManager::InitSwitchList ()
{ {
def1 = (FSwitchDef *)M_Malloc (sizeof(FSwitchDef)); def1 = (FSwitchDef *)M_Malloc (sizeof(FSwitchDef));
def2 = (FSwitchDef *)M_Malloc (sizeof(FSwitchDef)); def2 = (FSwitchDef *)M_Malloc (sizeof(FSwitchDef));
def1->PreTexture = def2->u[0].Texture = CheckForTexture (list_p /* .name1 */, FTexture::TEX_Wall, texflags); def1->PreTexture = def2->frames[0].Texture = CheckForTexture (list_p /* .name1 */, FTexture::TEX_Wall, texflags);
def2->PreTexture = def1->u[0].Texture = CheckForTexture (list_p + 9, FTexture::TEX_Wall, texflags); def2->PreTexture = def1->frames[0].Texture = CheckForTexture (list_p + 9, FTexture::TEX_Wall, texflags);
def1->Sound = def2->Sound = 0; def1->Sound = def2->Sound = 0;
def1->NumFrames = def2->NumFrames = 1; def1->NumFrames = def2->NumFrames = 1;
def1->u[0].Time = def2->u[0].Time = 0; def1->frames[0].TimeMin = def2->frames[0].TimeMin = 0;
def2->PairIndex = AddSwitchDef (def1); def1->frames[0].TimeRnd = def2->frames[0].TimeRnd = 0;
def1->PairIndex = AddSwitchDef (def2); AddSwitchPair(def1, def2);
} }
} }
} }
mSwitchDefs.ShrinkToFit (); mSwitchDefs.ShrinkToFit ();
qsort (&mSwitchDefs[0], mSwitchDefs.Size(), sizeof(FSwitchDef *), SortSwitchDefs);
// Sort mSwitchDefs for quick searching
origMap = new FSwitchDef *[mSwitchDefs.Size ()];
for (i = 0; i < (int)mSwitchDefs.Size (); i++)
{
origMap[i] = mSwitchDefs[i];
}
qsort (&mSwitchDefs[0], i, sizeof(FSwitchDef *), SortSwitchDefs);
// Correct the PairIndex of each switch def, since the sorting broke them
for (i = (int)(mSwitchDefs.Size () - 1); i >= 0; i--)
{
FSwitchDef *def = mSwitchDefs[i];
if (def->PairIndex != 65535)
{
for (j = (int)(mSwitchDefs.Size () - 1); j >= 0; j--)
{
if (mSwitchDefs[j] == origMap[def->PairIndex])
{
def->PairIndex = (WORD)j;
break;
}
}
}
}
delete[] origMap;
} }
//========================================================================== //==========================================================================
@ -228,18 +199,18 @@ void FTextureManager::ProcessSwitchDef (FScanner &sc)
def2 = (FSwitchDef *)M_Malloc (sizeof(FSwitchDef)); def2 = (FSwitchDef *)M_Malloc (sizeof(FSwitchDef));
def2->Sound = def1->Sound; def2->Sound = def1->Sound;
def2->NumFrames = 1; def2->NumFrames = 1;
def2->u[0].Time = 0; def2->frames[0].TimeMin = 0;
def2->u[0].Texture = picnum; def2->frames[0].TimeRnd = 0;
def2->frames[0].Texture = picnum;
} }
def1->PreTexture = picnum; def1->PreTexture = picnum;
def2->PreTexture = def1->u[def1->NumFrames-1].Texture; def2->PreTexture = def1->frames[def1->NumFrames-1].Texture;
if (def1->PreTexture == def2->PreTexture) if (def1->PreTexture == def2->PreTexture)
{ {
sc.ScriptError ("The on state for switch %s must end with a texture other than %s", picname.GetChars(), picname.GetChars()); sc.ScriptError ("The on state for switch %s must end with a texture other than %s", picname.GetChars(), picname.GetChars());
} }
def2->PairIndex = AddSwitchDef (def1); AddSwitchPair(def1, def2);
def1->PairIndex = AddSwitchDef (def2);
def1->QuestPanel = def2->QuestPanel = quest; def1->QuestPanel = def2->QuestPanel = quest;
} }
@ -286,7 +257,8 @@ FSwitchDef *FTextureManager::ParseSwitchDef (FScanner &sc, bool ignoreBad)
if (sc.Compare ("tics")) if (sc.Compare ("tics"))
{ {
sc.MustGetNumber (); sc.MustGetNumber ();
thisframe.Time = sc.Number & 65535; thisframe.TimeMin = sc.Number & 65535;
thisframe.TimeRnd = 0;
} }
else if (sc.Compare ("rand")) else if (sc.Compare ("rand"))
{ {
@ -300,11 +272,13 @@ FSwitchDef *FTextureManager::ParseSwitchDef (FScanner &sc, bool ignoreBad)
{ {
swapvalues (min, max); swapvalues (min, max);
} }
thisframe.Time = ((max - min + 1) << 16) | min; thisframe.TimeMin = min;
thisframe.TimeRnd = (max - min + 1);
} }
else else
{ {
thisframe.Time = 0; // Shush, GCC. thisframe.TimeMin = 0; // Shush, GCC.
thisframe.TimeRnd = 0;
sc.ScriptError ("Must specify a duration for switch frame"); sc.ScriptError ("Must specify a duration for switch frame");
} }
frames.Push(thisframe); frames.Push(thisframe);
@ -324,11 +298,11 @@ FSwitchDef *FTextureManager::ParseSwitchDef (FScanner &sc, bool ignoreBad)
return NULL; return NULL;
} }
def = (FSwitchDef *)M_Malloc (myoffsetof (FSwitchDef, u[0]) + frames.Size()*sizeof(frames[0])); def = (FSwitchDef *)M_Malloc (myoffsetof (FSwitchDef, frames[0]) + frames.Size()*sizeof(frames[0]));
def->Sound = sound; def->Sound = sound;
def->NumFrames = frames.Size(); def->NumFrames = frames.Size();
memcpy (&def->u[0], &frames[0], frames.Size() * sizeof(frames[0])); memcpy (&def->frames[0], &frames[0], frames.Size() * sizeof(frames[0]));
def->PairIndex = 65535; def->PairDef = NULL;
return def; return def;
} }
@ -338,20 +312,54 @@ FSwitchDef *FTextureManager::ParseSwitchDef (FScanner &sc, bool ignoreBad)
// //
//========================================================================== //==========================================================================
WORD FTextureManager::AddSwitchDef (FSwitchDef *def) void FTextureManager::AddSwitchPair (FSwitchDef *def1, FSwitchDef *def2)
{ {
unsigned int i; unsigned int i;
FSwitchDef *sw1 = NULL;
FSwitchDef *sw2 = NULL;
unsigned int index1 = 0xffffffff, index2 = 0xffffffff;
for (i = mSwitchDefs.Size (); i-- > 0; ) for (i = mSwitchDefs.Size (); i-- > 0; )
{ {
if (mSwitchDefs[i]->PreTexture == def->PreTexture) if (mSwitchDefs[i]->PreTexture == def1->PreTexture)
{ {
M_Free (mSwitchDefs[i]); index1 = i;
mSwitchDefs[i] = def; sw1 = mSwitchDefs[index1];
return (WORD)i; if (index2 != 0xffffffff) break;
}
if (mSwitchDefs[i]->PreTexture == def2->PreTexture)
{
index2 = i;
sw2 = mSwitchDefs[index2];
if (index1 != 0xffffffff) break;
} }
} }
return (WORD)mSwitchDefs.Push (def);
def1->PairDef = def2;
def2->PairDef = def1;
if (sw1 != NULL && sw2 != NULL && sw1->PairDef == sw2 && sw2->PairDef == sw1)
{
//We are replacing an existing pair so we can safely delete the old definitions
M_Free(sw1);
M_Free(sw2);
mSwitchDefs[index1] = def1;
mSwitchDefs[index2] = def2;
}
else
{
// This new switch will not or only partially replace an existing pair.
// We should not break up an old pair if the new one only redefined one
// of the two textures. These paired definitions will only be used
// as the return animation so their names don't matter. Better clear them to be safe.
if (sw1 != NULL) sw1->PreTexture.SetInvalid();
if (sw2 != NULL) sw2->PreTexture.SetInvalid();
sw1 = NULL;
sw2 = NULL;
unsigned int pos = mSwitchDefs.Reserve(2);
mSwitchDefs[pos] = def1;
mSwitchDefs[pos+1] = def2;
}
} }
//========================================================================== //==========================================================================
@ -360,7 +368,7 @@ WORD FTextureManager::AddSwitchDef (FSwitchDef *def)
// //
//========================================================================== //==========================================================================
int FTextureManager::FindSwitch (FTextureID texture) FSwitchDef *FTextureManager::FindSwitch (FTextureID texture)
{ {
int mid, low, high; int mid, low, high;
@ -373,7 +381,7 @@ int FTextureManager::FindSwitch (FTextureID texture)
mid = (high + low) / 2; mid = (high + low) / 2;
if (mSwitchDefs[mid]->PreTexture == texture) if (mSwitchDefs[mid]->PreTexture == texture)
{ {
return mid; return mSwitchDefs[mid];
} }
else if (texture < mSwitchDefs[mid]->PreTexture) else if (texture < mSwitchDefs[mid]->PreTexture)
{ {
@ -385,6 +393,27 @@ int FTextureManager::FindSwitch (FTextureID texture)
} }
} while (low <= high); } while (low <= high);
} }
return -1; return NULL;
}
//==========================================================================
//
// operator<<
//
//==========================================================================
template<> FArchive &operator<< (FArchive &arc, FSwitchDef* &Switch)
{
if (arc.IsStoring())
{
arc << Switch->PreTexture;
}
else
{
FTextureID tex;
arc << tex;
Switch = TexMan.FindSwitch(tex);
}
return arc;
} }

View file

@ -903,3 +903,24 @@ void FTextureManager::UpdateAnimations (DWORD mstime)
} }
} }
//==========================================================================
//
// operator<<
//
//==========================================================================
template<> FArchive &operator<< (FArchive &arc, FDoorAnimation* &Doorani)
{
if (arc.IsStoring())
{
arc << Doorani->BaseTexture;
}
else
{
FTextureID tex;
arc << tex;
Doorani = TexMan.FindAnimatedDoor(tex);
}
return arc;
}

View file

@ -48,9 +48,6 @@
#include "cmdlib.h" #include "cmdlib.h"
#include "g_level.h" #include "g_level.h"
extern void R_InitBuildTiles();
FTextureManager TexMan; FTextureManager TexMan;
//========================================================================== //==========================================================================

View file

@ -108,15 +108,16 @@ struct FAnimDef
struct FSwitchDef struct FSwitchDef
{ {
FTextureID PreTexture; // texture to switch from FTextureID PreTexture; // texture to switch from
WORD PairIndex; // switch def to use to return to PreTexture FSwitchDef *PairDef; // switch def to use to return to PreTexture
WORD NumFrames; // # of animation frames WORD NumFrames; // # of animation frames
int Sound; // sound to play at start of animation. Changed to int to avoiud having to include s_sound here.
bool QuestPanel; // Special texture for Strife mission bool QuestPanel; // Special texture for Strife mission
int Sound; // sound to play at start of animation. Changed to int to avoiud having to include s_sound here.
struct frame // Array of times followed by array of textures struct frame // Array of times followed by array of textures
{ // actual length of each array is <NumFrames> { // actual length of each array is <NumFrames>
DWORD Time; WORD TimeMin;
WORD TimeRnd;
FTextureID Texture; FTextureID Texture;
} u[1]; } frames[1];
}; };
struct FDoorAnimation struct FDoorAnimation
@ -464,12 +465,7 @@ public:
void UpdateAnimations (DWORD mstime); void UpdateAnimations (DWORD mstime);
int GuesstimateNumTextures (); int GuesstimateNumTextures ();
int FindSwitch (FTextureID texture); FSwitchDef *FindSwitch (FTextureID texture);
FSwitchDef *GetSwitch (unsigned int index)
{
if (index < mSwitchDefs.Size()) return mSwitchDefs[index];
else return NULL;
}
FDoorAnimation *FindAnimatedDoor (FTextureID picnum); FDoorAnimation *FindAnimatedDoor (FTextureID picnum);
private: private:
@ -507,7 +503,7 @@ private:
void InitSwitchList (); void InitSwitchList ();
void ProcessSwitchDef (FScanner &sc); void ProcessSwitchDef (FScanner &sc);
FSwitchDef *ParseSwitchDef (FScanner &sc, bool ignoreBad); FSwitchDef *ParseSwitchDef (FScanner &sc, bool ignoreBad);
WORD AddSwitchDef (FSwitchDef *def); void AddSwitchPair (FSwitchDef *def1, FSwitchDef *def2);
struct TextureHash struct TextureHash
{ {

View file

@ -337,6 +337,7 @@ void LoadActors ()
{ {
int lastlump, lump; int lastlump, lump;
DropItemList.Clear();
FScriptPosition::ResetErrorCounter(); FScriptPosition::ResetErrorCounter();
InitThingdef(); InitThingdef();
lastlump = 0; lastlump = 0;

View file

@ -584,6 +584,7 @@ void InitThingdef()
} }
// Create a sorted list of properties // Create a sorted list of properties
if (properties.Size() == 0)
{ {
FAutoSegIterator probe(GRegHead, GRegTail); FAutoSegIterator probe(GRegHead, GRegTail);
@ -596,6 +597,7 @@ void InitThingdef()
} }
// Create a sorted list of native action functions // Create a sorted list of native action functions
if (AFTable.Size() == 0)
{ {
FAutoSegIterator probe(ARegHead, ARegTail); FAutoSegIterator probe(ARegHead, ARegTail);
@ -608,6 +610,7 @@ void InitThingdef()
} }
// Create a sorted list of native variables // Create a sorted list of native variables
if (variables.Size() == 0)
{ {
FAutoSegIterator probe(MRegHead, MRegTail); FAutoSegIterator probe(MRegHead, MRegTail);

View file

@ -77,7 +77,7 @@
// SAVESIG should match SAVEVER. // SAVESIG should match SAVEVER.
// MINSAVEVER is the minimum level snapshot version that can be loaded. // MINSAVEVER is the minimum level snapshot version that can be loaded.
#define MINSAVEVER 1848 #define MINSAVEVER 3030
#if ZD_SVN_REVISION_NUMBER < MINSAVEVER #if ZD_SVN_REVISION_NUMBER < MINSAVEVER
// If we don't know the current revision write something very high to ensure that // If we don't know the current revision write something very high to ensure that
@ -87,8 +87,11 @@
static inline const char *MakeSaveSig() static inline const char *MakeSaveSig()
{ {
static char foo[] = { 'Z','D','O','O','M','S','A','V','E', static char foo[] = { 'Z','D','O','O','M','S','A','V','E',
#if SAVEVER > 99999
'0' + (SAVEVER / 100000),
#endif
#if SAVEVER > 9999 #if SAVEVER > 9999
'0' + (SAVEVER / 10000), '0' + ((SAVEVER / 10000) % 10),
#endif #endif
#if SAVEVER > 999 #if SAVEVER > 999
'0' + ((SAVEVER / 1000) % 10), '0' + ((SAVEVER / 1000) % 10),

View file

@ -610,6 +610,7 @@ dir_tree_t *add_dirs(char **argv)
{ {
// Skip hidden directories. (Prevents SVN bookkeeping // Skip hidden directories. (Prevents SVN bookkeeping
// info from being included.) // info from being included.)
// [BL] Also skip backup files.
fts_set(fts, ent, FTS_SKIP); fts_set(fts, ent, FTS_SKIP);
} }
if (ent->fts_info == FTS_D && ent->fts_level == 0) if (ent->fts_info == FTS_D && ent->fts_level == 0)
@ -628,6 +629,11 @@ dir_tree_t *add_dirs(char **argv)
// We're only interested in remembering files. // We're only interested in remembering files.
continue; continue;
} }
else if(ent->fts_name[strlen(ent->fts_name)-1] == '~')
{
// Don't remember backup files.
continue;
}
file = alloc_file_entry("", ent->fts_path, ent->fts_statp->st_mtime); file = alloc_file_entry("", ent->fts_path, ent->fts_statp->st_mtime);
if (file == NULL) if (file == NULL)
{ {

View file

@ -736,6 +736,7 @@ OptionMenu "HUDOptions"
Option "Display nametags", "displaynametags", "DisplayTagsTypes" Option "Display nametags", "displaynametags", "DisplayTagsTypes"
Option "Nametag color", "nametagcolor", "TextColors", "displaynametags" Option "Nametag color", "nametagcolor", "TextColors", "displaynametags"
Option "Stretch status bar", "st_scale", "OnOff" Option "Stretch status bar", "st_scale", "OnOff"
Option "Use old ouch mug shot formula", "st_oldouch", "OnOff"
} }
//------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------