mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-27 22:42:29 +00:00
- Merged a lot of these static destructor-only structs into regular
functions added to the exit chain with atterm so that they can be called in a deterministic order and not whatever order the linker decides to put them in. - Fixed: DCajunMaster did not free its getspawned. - Fixed: P_FreeLevelData() did not free ACS scripts. - Fixed: Level snapshots were not freed at exit. - Fixed: The save/load menu list was not freed at exit. - Fixed: FCompressedMemFile needs a destructor to free the m_ImplodedBuffer. - Fixed: G_DoLoadGame() did not free the engine string. - Fixed: M_ReadSaveStrings() did not free the engine string. - Fixed: Processing DEM_SAVEGAME did not free the pathname string. - Added a check for truncated flats to FFlatTexture::MakeTexture() because Heretic's F_SKY1 is only four bytes long. - Added a dump of the offending state to the "Cannot find state..." diagnostic. - Fixed: FCompressedFile did not initialize m_Mode in its default constructor. - Fixed: Heretic and Hexen status bars did not initialize ArtiRefresh. - Fixed: PNGHandle destructor should use delete[] to free TextChunks. SVN r111 (trunk)
This commit is contained in:
parent
01441cd4f0
commit
8fcf93d65a
68 changed files with 870 additions and 489 deletions
|
@ -1,3 +1,23 @@
|
||||||
|
May 11, 2006
|
||||||
|
- Merged a lot of these static destructor-only structs into regular
|
||||||
|
functions added to the exit chain with atterm so that they can be called
|
||||||
|
in a deterministic order and not whatever order the linker decides to put
|
||||||
|
them in.
|
||||||
|
- Fixed: DCajunMaster did not free its getspawned.
|
||||||
|
- Fixed: P_FreeLevelData() did not free ACS scripts.
|
||||||
|
- Fixed: Level snapshots were not freed at exit.
|
||||||
|
- Fixed: The save/load menu list was not freed at exit.
|
||||||
|
- Fixed: FCompressedMemFile needs a destructor to free the m_ImplodedBuffer.
|
||||||
|
- Fixed: G_DoLoadGame() did not free the engine string.
|
||||||
|
- Fixed: M_ReadSaveStrings() did not free the engine string.
|
||||||
|
- Fixed: Processing DEM_SAVEGAME did not free the pathname string.
|
||||||
|
- Added a check for truncated flats to FFlatTexture::MakeTexture() because
|
||||||
|
Heretic's F_SKY1 is only four bytes long.
|
||||||
|
- Added a dump of the offending state to the "Cannot find state..." diagnostic.
|
||||||
|
- Fixed: FCompressedFile did not initialize m_Mode in its default constructor.
|
||||||
|
- Fixed: Heretic and Hexen status bars did not initialize ArtiRefresh.
|
||||||
|
- Fixed: PNGHandle destructor should use delete[] to free TextChunks.
|
||||||
|
|
||||||
May 11, 2006 (Changes by Graf Zahl)
|
May 11, 2006 (Changes by Graf Zahl)
|
||||||
- Converted the stealth monsters to DECORATE.
|
- Converted the stealth monsters to DECORATE.
|
||||||
- Added string replacement option to obituary strings.
|
- Added string replacement option to obituary strings.
|
||||||
|
|
|
@ -93,6 +93,11 @@ void G_DoReborn (int playernum, bool freshbot);
|
||||||
DCajunMaster::~DCajunMaster()
|
DCajunMaster::~DCajunMaster()
|
||||||
{
|
{
|
||||||
ForgetBots();
|
ForgetBots();
|
||||||
|
if (getspawned != NULL)
|
||||||
|
{
|
||||||
|
delete getspawned;
|
||||||
|
getspawned = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//This function is called every tick (from g_game.c),
|
//This function is called every tick (from g_game.c),
|
||||||
|
|
|
@ -87,6 +87,9 @@ extern int gametic;
|
||||||
extern bool automapactive; // in AM_map.c
|
extern bool automapactive; // in AM_map.c
|
||||||
extern BOOL advancedemo;
|
extern BOOL advancedemo;
|
||||||
|
|
||||||
|
extern FBaseCVar *CVars;
|
||||||
|
extern FConsoleCommand *Commands[FConsoleCommand::HASH_SIZE];
|
||||||
|
|
||||||
int ConCols, PhysRows;
|
int ConCols, PhysRows;
|
||||||
BOOL vidactive = false, gotconback = false;
|
BOOL vidactive = false, gotconback = false;
|
||||||
BOOL cursoron = false;
|
BOOL cursoron = false;
|
||||||
|
@ -103,6 +106,13 @@ static char *BufferRover = ConsoleBuffer;
|
||||||
|
|
||||||
static void ClearConsole ();
|
static void ClearConsole ();
|
||||||
|
|
||||||
|
struct GameAtExit
|
||||||
|
{
|
||||||
|
GameAtExit *Next;
|
||||||
|
char Command[1];
|
||||||
|
};
|
||||||
|
|
||||||
|
static GameAtExit *ExitCmdList;
|
||||||
|
|
||||||
#define SCROLLUP 1
|
#define SCROLLUP 1
|
||||||
#define SCROLLDN 2
|
#define SCROLLDN 2
|
||||||
|
@ -116,6 +126,11 @@ static const char *TickerLabel;
|
||||||
static bool TickerVisible;
|
static bool TickerVisible;
|
||||||
static bool ConsoleDrawing;
|
static bool ConsoleDrawing;
|
||||||
|
|
||||||
|
// Buffer for AddToConsole()
|
||||||
|
static char *work = NULL;
|
||||||
|
static int worklen = 0;
|
||||||
|
|
||||||
|
|
||||||
struct History
|
struct History
|
||||||
{
|
{
|
||||||
struct History *Older;
|
struct History *Older;
|
||||||
|
@ -133,22 +148,6 @@ static byte CmdLine[260];
|
||||||
static struct History *HistHead = NULL, *HistTail = NULL, *HistPos = NULL;
|
static struct History *HistHead = NULL, *HistTail = NULL, *HistPos = NULL;
|
||||||
static int HistSize;
|
static int HistSize;
|
||||||
|
|
||||||
static struct HistoryFree
|
|
||||||
{
|
|
||||||
~HistoryFree()
|
|
||||||
{
|
|
||||||
History *hist = HistTail;
|
|
||||||
|
|
||||||
while (hist != NULL)
|
|
||||||
{
|
|
||||||
History *next = hist->Newer;
|
|
||||||
free (hist);
|
|
||||||
hist = next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} HistoryFree_er;
|
|
||||||
|
|
||||||
|
|
||||||
CVAR (Float, con_notifytime, 3.f, CVAR_ARCHIVE)
|
CVAR (Float, con_notifytime, 3.f, CVAR_ARCHIVE)
|
||||||
CVAR (Bool, con_centernotify, false, CVAR_ARCHIVE)
|
CVAR (Bool, con_centernotify, false, CVAR_ARCHIVE)
|
||||||
CUSTOM_CVAR (Int, con_scaletext, 0, CVAR_ARCHIVE) // Scale notify text at high resolutions?
|
CUSTOM_CVAR (Int, con_scaletext, 0, CVAR_ARCHIVE) // Scale notify text at high resolutions?
|
||||||
|
@ -421,6 +420,113 @@ void C_InitConsole (int width, int height, BOOL ingame)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// CCMD atexit
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
CCMD (atexit)
|
||||||
|
{
|
||||||
|
if (argv.argc() == 1)
|
||||||
|
{
|
||||||
|
Printf ("Registered atexit commands:\n");
|
||||||
|
GameAtExit *record = ExitCmdList;
|
||||||
|
while (record != NULL)
|
||||||
|
{
|
||||||
|
Printf ("%s\n", record->Command);
|
||||||
|
record = record->Next;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (int i = 1; i < argv.argc(); ++i)
|
||||||
|
{
|
||||||
|
GameAtExit *record = (GameAtExit *)M_Malloc (
|
||||||
|
sizeof(GameAtExit)+strlen(argv[i]));
|
||||||
|
strcpy (record->Command, argv[i]);
|
||||||
|
record->Next = ExitCmdList;
|
||||||
|
ExitCmdList = record;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// C_DeinitConsole
|
||||||
|
//
|
||||||
|
// Executes the contents of the atexit cvar, if any, at quit time.
|
||||||
|
// Then releases all of the console's memory.
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void C_DeinitConsole ()
|
||||||
|
{
|
||||||
|
GameAtExit *cmd = ExitCmdList;
|
||||||
|
|
||||||
|
while (cmd != NULL)
|
||||||
|
{
|
||||||
|
GameAtExit *next = cmd->Next;
|
||||||
|
AddCommandString (cmd->Command);
|
||||||
|
free (cmd);
|
||||||
|
cmd = next;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Free command history
|
||||||
|
History *hist = HistTail;
|
||||||
|
|
||||||
|
while (hist != NULL)
|
||||||
|
{
|
||||||
|
History *next = hist->Newer;
|
||||||
|
free (hist);
|
||||||
|
hist = next;
|
||||||
|
}
|
||||||
|
HistTail = HistHead = HistPos = NULL;
|
||||||
|
|
||||||
|
// Free cvars allocated at runtime
|
||||||
|
FBaseCVar *var, *next, **nextp;
|
||||||
|
for (var = CVars, nextp = &CVars; var != NULL; var = next)
|
||||||
|
{
|
||||||
|
next = var->m_Next;
|
||||||
|
if (var->GetFlags() & CVAR_UNSETTABLE)
|
||||||
|
{
|
||||||
|
delete var;
|
||||||
|
*nextp = next;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nextp = &var->m_Next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Free alias commands. (i.e. The "commands" that can be allocated
|
||||||
|
// at runtime.)
|
||||||
|
for (size_t i = 0; i < countof(Commands); ++i)
|
||||||
|
{
|
||||||
|
FConsoleCommand *cmd = Commands[i];
|
||||||
|
|
||||||
|
while (cmd != NULL)
|
||||||
|
{
|
||||||
|
FConsoleCommand *next = cmd->m_Next;
|
||||||
|
if (cmd->IsAlias())
|
||||||
|
{
|
||||||
|
delete cmd;
|
||||||
|
}
|
||||||
|
cmd = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure all tab commands are cleared before the memory for
|
||||||
|
// their names is deallocated.
|
||||||
|
C_ClearTabCommands ();
|
||||||
|
|
||||||
|
// Free AddToConsole()'s work buffer
|
||||||
|
if (work != NULL)
|
||||||
|
{
|
||||||
|
free (work);
|
||||||
|
work = NULL;
|
||||||
|
worklen = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void ClearConsole ()
|
static void ClearConsole ()
|
||||||
{
|
{
|
||||||
RowAdjust = 0;
|
RowAdjust = 0;
|
||||||
|
@ -544,21 +650,6 @@ static void AddLine (const char *text, bool more, int len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *work = NULL;
|
|
||||||
static int worklen = 0;
|
|
||||||
|
|
||||||
static struct FreeWork
|
|
||||||
{
|
|
||||||
~FreeWork()
|
|
||||||
{
|
|
||||||
if (work != NULL)
|
|
||||||
{
|
|
||||||
free (work);
|
|
||||||
work = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} FreeTheWork;
|
|
||||||
|
|
||||||
void AddToConsole (int printlevel, const char *text)
|
void AddToConsole (int printlevel, const char *text)
|
||||||
{
|
{
|
||||||
static enum
|
static enum
|
||||||
|
@ -1814,6 +1905,11 @@ void C_RemoveTabCommand (const char *name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void C_ClearTabCommands ()
|
||||||
|
{
|
||||||
|
TabCommands.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
static int FindDiffPoint (FName name1, const char *str2)
|
static int FindDiffPoint (FName name1, const char *str2)
|
||||||
{
|
{
|
||||||
const char *str1 = name1.GetChars();
|
const char *str1 = name1.GetChars();
|
||||||
|
|
|
@ -51,6 +51,7 @@ extern constate_e ConsoleState;
|
||||||
|
|
||||||
// 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 ();
|
||||||
|
|
||||||
// Adjust the console for a new screen mode
|
// Adjust the console for a new screen mode
|
||||||
void C_NewModeAdjust (void);
|
void C_NewModeAdjust (void);
|
||||||
|
@ -78,5 +79,6 @@ BOOL C_Responder (event_t *ev);
|
||||||
|
|
||||||
void C_AddTabCommand (const char *name);
|
void C_AddTabCommand (const char *name);
|
||||||
void C_RemoveTabCommand (const char *name);
|
void C_RemoveTabCommand (const char *name);
|
||||||
|
void C_ClearTabCommands(); // Removes all tab commands
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -68,22 +68,6 @@ FBaseCVar *CVars = NULL;
|
||||||
|
|
||||||
int cvar_defflags;
|
int cvar_defflags;
|
||||||
|
|
||||||
static struct RuntimeCVarDestroyer
|
|
||||||
{
|
|
||||||
~RuntimeCVarDestroyer()
|
|
||||||
{
|
|
||||||
FBaseCVar *var, *next;
|
|
||||||
for (var = CVars; var != NULL; var = next)
|
|
||||||
{
|
|
||||||
next = var->m_Next;
|
|
||||||
if (var->GetFlags() & CVAR_UNSETTABLE)
|
|
||||||
{
|
|
||||||
delete var;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} DestroyTheRuntimeCVars;
|
|
||||||
|
|
||||||
FBaseCVar::FBaseCVar (const FBaseCVar &var)
|
FBaseCVar::FBaseCVar (const FBaseCVar &var)
|
||||||
{
|
{
|
||||||
I_FatalError ("Use of cvar copy constructor");
|
I_FatalError ("Use of cvar copy constructor");
|
||||||
|
|
|
@ -175,7 +175,7 @@ private:
|
||||||
|
|
||||||
friend void FilterCompactCVars (TArray<FBaseCVar *> &cvars, DWORD filter);
|
friend void FilterCompactCVars (TArray<FBaseCVar *> &cvars, DWORD filter);
|
||||||
|
|
||||||
friend struct RuntimeCVarDestroyer;
|
friend void C_DeinitConsole();
|
||||||
};
|
};
|
||||||
|
|
||||||
class FBoolCVar : public FBaseCVar
|
class FBoolCVar : public FBaseCVar
|
||||||
|
|
|
@ -149,29 +149,6 @@ FActionMap ActionMaps[] =
|
||||||
|
|
||||||
#define NUM_ACTIONS countof(ActionMaps)
|
#define NUM_ACTIONS countof(ActionMaps)
|
||||||
|
|
||||||
static struct AliasKiller
|
|
||||||
{
|
|
||||||
~AliasKiller()
|
|
||||||
{
|
|
||||||
// Scan the hash table for all aliases and delete them.
|
|
||||||
// Regular commands will be destroyed automatically.
|
|
||||||
for (size_t i = 0; i < countof(Commands); ++i)
|
|
||||||
{
|
|
||||||
FConsoleCommand *cmd = Commands[i];
|
|
||||||
|
|
||||||
while (cmd != NULL)
|
|
||||||
{
|
|
||||||
FConsoleCommand *next = cmd->m_Next;
|
|
||||||
if (cmd->IsAlias())
|
|
||||||
{
|
|
||||||
delete cmd;
|
|
||||||
}
|
|
||||||
cmd = next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} KillTheAliases;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENT_CLASS (DWaitingCommand)
|
IMPLEMENT_CLASS (DWaitingCommand)
|
||||||
|
|
|
@ -91,12 +91,6 @@
|
||||||
|
|
||||||
// TYPES -------------------------------------------------------------------
|
// TYPES -------------------------------------------------------------------
|
||||||
|
|
||||||
struct GameAtExit
|
|
||||||
{
|
|
||||||
GameAtExit *Next;
|
|
||||||
char Command[1];
|
|
||||||
};
|
|
||||||
|
|
||||||
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
|
||||||
|
|
||||||
extern void M_RestoreMode ();
|
extern void M_RestoreMode ();
|
||||||
|
@ -117,7 +111,6 @@ void D_AddWildFile (const char *pattern);
|
||||||
|
|
||||||
void D_DoomLoop ();
|
void D_DoomLoop ();
|
||||||
static const char *BaseFileSearch (const char *file, const char *ext, bool lookfirstinprogdir=false);
|
static const char *BaseFileSearch (const char *file, const char *ext, bool lookfirstinprogdir=false);
|
||||||
static void STACK_ARGS DoConsoleAtExit ();
|
|
||||||
|
|
||||||
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
||||||
|
|
||||||
|
@ -221,7 +214,6 @@ static const char *IWADNames[] =
|
||||||
"strife0.wad",
|
"strife0.wad",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
static GameAtExit *ExitCmdList;
|
|
||||||
|
|
||||||
// CODE --------------------------------------------------------------------
|
// CODE --------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -620,56 +612,6 @@ void D_Display (bool screenshot)
|
||||||
FrameCycles = cycles;
|
FrameCycles = cycles;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// DoConsoleAtExit
|
|
||||||
//
|
|
||||||
// Executes the contents of the atexit cvar, if any, at quit time.
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
static void STACK_ARGS DoConsoleAtExit ()
|
|
||||||
{
|
|
||||||
GameAtExit *cmd = ExitCmdList;
|
|
||||||
|
|
||||||
while (cmd != NULL)
|
|
||||||
{
|
|
||||||
GameAtExit *next = cmd->Next;
|
|
||||||
AddCommandString (cmd->Command);
|
|
||||||
free (cmd);
|
|
||||||
cmd = next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// CCMD atexit
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
CCMD (atexit)
|
|
||||||
{
|
|
||||||
if (argv.argc() == 1)
|
|
||||||
{
|
|
||||||
Printf ("Registered atexit commands:\n");
|
|
||||||
GameAtExit *record = ExitCmdList;
|
|
||||||
while (record != NULL)
|
|
||||||
{
|
|
||||||
Printf ("%s\n", record->Command);
|
|
||||||
record = record->Next;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (int i = 1; i < argv.argc(); ++i)
|
|
||||||
{
|
|
||||||
GameAtExit *record = (GameAtExit *)M_Malloc (
|
|
||||||
sizeof(GameAtExit)+strlen(argv[i]));
|
|
||||||
strcpy (record->Command, argv[i]);
|
|
||||||
record->Next = ExitCmdList;
|
|
||||||
ExitCmdList = record;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// D_ErrorCleanup ()
|
// D_ErrorCleanup ()
|
||||||
|
@ -1905,12 +1847,9 @@ void D_DoomMain (void)
|
||||||
|
|
||||||
file[PATH_MAX-1] = 0;
|
file[PATH_MAX-1] = 0;
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__GNUC__)
|
|
||||||
PClass::StaticInit ();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
atterm (DObject::StaticShutdown);
|
atterm (DObject::StaticShutdown);
|
||||||
atterm (DoConsoleAtExit);
|
PClass::StaticInit ();
|
||||||
|
atterm (C_DeinitConsole);
|
||||||
|
|
||||||
gamestate = GS_STARTUP;
|
gamestate = GS_STARTUP;
|
||||||
|
|
||||||
|
|
|
@ -1629,7 +1629,7 @@ void D_CheckNetGame (void)
|
||||||
// Called before quitting to leave a net game
|
// Called before quitting to leave a net game
|
||||||
// without hanging the other players
|
// without hanging the other players
|
||||||
//
|
//
|
||||||
void STACK_ARGS D_QuitNetGame (void)
|
void D_QuitNetGame (void)
|
||||||
{
|
{
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
|
|
||||||
|
@ -2184,7 +2184,9 @@ void Net_DoCommand (int type, byte **stream, int player)
|
||||||
case DEM_SAVEGAME:
|
case DEM_SAVEGAME:
|
||||||
if (gamestate == GS_LEVEL)
|
if (gamestate == GS_LEVEL)
|
||||||
{
|
{
|
||||||
savegamefile = ReadString (stream);
|
s = ReadString (stream);
|
||||||
|
savegamefile = s;
|
||||||
|
delete[] s;
|
||||||
s = ReadString (stream);
|
s = ReadString (stream);
|
||||||
memset (savedescription, 0, sizeof(savedescription));
|
memset (savedescription, 0, sizeof(savedescription));
|
||||||
strncpy (savedescription, s, sizeof(savedescription));
|
strncpy (savedescription, s, sizeof(savedescription));
|
||||||
|
|
|
@ -108,7 +108,7 @@ void NetUpdate (void);
|
||||||
|
|
||||||
// Broadcasts special packets to other players
|
// Broadcasts special packets to other players
|
||||||
// to notify of game exit
|
// to notify of game exit
|
||||||
void STACK_ARGS D_QuitNetGame (void);
|
void D_QuitNetGame (void);
|
||||||
|
|
||||||
//? how many ticks to run?
|
//? how many ticks to run?
|
||||||
void TryRunTics (void);
|
void TryRunTics (void);
|
||||||
|
|
|
@ -595,7 +595,7 @@ void DObject::DestroyScan ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void STACK_ARGS DObject::StaticShutdown ()
|
void DObject::StaticShutdown ()
|
||||||
{
|
{
|
||||||
Inactive = true;
|
Inactive = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,7 +254,7 @@ public:
|
||||||
// use this method.
|
// use this method.
|
||||||
static void PointerSubstitution (DObject *old, DObject *notOld);
|
static void PointerSubstitution (DObject *old, DObject *notOld);
|
||||||
|
|
||||||
static void STACK_ARGS StaticShutdown ();
|
static void StaticShutdown ();
|
||||||
|
|
||||||
PClass *GetClass() const
|
PClass *GetClass() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,42 +10,51 @@ PClass *PClass::TypeHash[PClass::HASH_SIZE];
|
||||||
// A harmless non_NULL FlatPointer for classes without pointers.
|
// A harmless non_NULL FlatPointer for classes without pointers.
|
||||||
static const size_t TheEnd = ~0;
|
static const size_t TheEnd = ~0;
|
||||||
|
|
||||||
static struct TypeInfoDataFreeer
|
void PClass::StaticInit ()
|
||||||
{
|
{
|
||||||
~TypeInfoDataFreeer()
|
atterm (StaticShutdown);
|
||||||
{
|
|
||||||
TArray<size_t *> uniqueFPs(64);
|
|
||||||
unsigned int i, j;
|
|
||||||
|
|
||||||
for (i = 0; i < PClass::m_Types.Size(); ++i)
|
TAutoSegIterator<ClassReg *, &CRegHead, &CRegTail> probe;
|
||||||
|
|
||||||
|
while (++probe != NULL)
|
||||||
|
{
|
||||||
|
probe->RegisterClass ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PClass::StaticShutdown ()
|
||||||
|
{
|
||||||
|
TArray<size_t *> uniqueFPs(64);
|
||||||
|
unsigned int i, j;
|
||||||
|
|
||||||
|
for (i = 0; i < PClass::m_Types.Size(); ++i)
|
||||||
|
{
|
||||||
|
PClass *type = PClass::m_Types[i];
|
||||||
|
PClass::m_Types[i] = NULL;
|
||||||
|
if (type->FlatPointers != &TheEnd && type->FlatPointers != type->Pointers)
|
||||||
{
|
{
|
||||||
PClass *type = PClass::m_Types[i];
|
// FlatPointers are shared by many classes, so we must check for
|
||||||
PClass::m_Types[i] = NULL;
|
// duplicates and only delete those that are unique.
|
||||||
if (type->FlatPointers != &TheEnd && type->FlatPointers != type->Pointers)
|
for (j = 0; j < uniqueFPs.Size(); ++j)
|
||||||
{
|
{
|
||||||
// FlatPointers are shared by many classes, so we must check for
|
if (type->FlatPointers == uniqueFPs[j])
|
||||||
// duplicates and only delete those that are unique.
|
|
||||||
for (j = 0; j < uniqueFPs.Size(); ++j)
|
|
||||||
{
|
{
|
||||||
if (type->FlatPointers == uniqueFPs[j])
|
break;
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (j == uniqueFPs.Size())
|
|
||||||
{
|
|
||||||
uniqueFPs.Push(const_cast<size_t *>(type->FlatPointers));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// For runtime classes, this call will also delete the PClass.
|
if (j == uniqueFPs.Size())
|
||||||
PClass::StaticFreeData (type);
|
{
|
||||||
}
|
uniqueFPs.Push(const_cast<size_t *>(type->FlatPointers));
|
||||||
for (i = 0; i < uniqueFPs.Size(); ++i)
|
}
|
||||||
{
|
|
||||||
delete[] uniqueFPs[i];
|
|
||||||
}
|
}
|
||||||
|
// For runtime classes, this call will also delete the PClass.
|
||||||
|
PClass::StaticFreeData (type);
|
||||||
}
|
}
|
||||||
} FreeTypeInfoData;
|
for (i = 0; i < uniqueFPs.Size(); ++i)
|
||||||
|
{
|
||||||
|
delete[] uniqueFPs[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PClass::StaticFreeData (PClass *type)
|
void PClass::StaticFreeData (PClass *type)
|
||||||
{
|
{
|
||||||
|
@ -70,17 +79,6 @@ void PClass::StaticFreeData (PClass *type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PClass::StaticInit ()
|
|
||||||
{
|
|
||||||
TAutoSegIterator<ClassReg *, &CRegHead, &CRegTail> probe;
|
|
||||||
|
|
||||||
while (++probe != NULL)
|
|
||||||
{
|
|
||||||
probe->RegisterClass ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClassReg::RegisterClass ()
|
void ClassReg::RegisterClass ()
|
||||||
{
|
{
|
||||||
assert (MyClass != NULL);
|
assert (MyClass != NULL);
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
struct PClass
|
struct PClass
|
||||||
{
|
{
|
||||||
static void StaticInit ();
|
static void StaticInit ();
|
||||||
|
static void StaticShutdown ();
|
||||||
static void StaticFreeData (PClass *type);
|
static void StaticFreeData (PClass *type);
|
||||||
|
|
||||||
// Per-class information -------------------------------------
|
// Per-class information -------------------------------------
|
||||||
|
|
|
@ -135,6 +135,7 @@ void FCompressedFile::BeEmpty ()
|
||||||
m_Buffer = NULL;
|
m_Buffer = NULL;
|
||||||
m_File = NULL;
|
m_File = NULL;
|
||||||
m_NoCompress = false;
|
m_NoCompress = false;
|
||||||
|
m_Mode = ENotOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char LZOSig[4] = { 'F', 'L', 'Z', 'O' };
|
static const char LZOSig[4] = { 'F', 'L', 'Z', 'O' };
|
||||||
|
@ -425,6 +426,14 @@ FCompressedMemFile::FCompressedMemFile (const char *name, EOpenMode mode)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
FCompressedMemFile::~FCompressedMemFile ()
|
||||||
|
{
|
||||||
|
if (m_ImplodedBuffer != NULL)
|
||||||
|
{
|
||||||
|
free (m_ImplodedBuffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool FCompressedMemFile::Open (const char *name, EOpenMode mode)
|
bool FCompressedMemFile::Open (const char *name, EOpenMode mode)
|
||||||
{
|
{
|
||||||
if (mode == EWriting)
|
if (mode == EWriting)
|
||||||
|
|
|
@ -46,7 +46,8 @@ public:
|
||||||
enum EOpenMode
|
enum EOpenMode
|
||||||
{
|
{
|
||||||
EReading,
|
EReading,
|
||||||
EWriting
|
EWriting,
|
||||||
|
ENotOpen
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ESeekPos
|
enum ESeekPos
|
||||||
|
@ -117,6 +118,7 @@ class FCompressedMemFile : public FCompressedFile
|
||||||
public:
|
public:
|
||||||
FCompressedMemFile ();
|
FCompressedMemFile ();
|
||||||
FCompressedMemFile (FILE *file); // Create for reading
|
FCompressedMemFile (FILE *file); // Create for reading
|
||||||
|
~FCompressedMemFile ();
|
||||||
|
|
||||||
bool Open (const char *name, EOpenMode mode); // Works for reading only
|
bool Open (const char *name, EOpenMode mode); // Works for reading only
|
||||||
bool Open (void *memblock); // Open for reading only
|
bool Open (void *memblock); // Open for reading only
|
||||||
|
|
|
@ -1623,7 +1623,7 @@ void G_DoLoadGame ()
|
||||||
// Check whether this savegame actually has been created by a compatible engine.
|
// Check whether this savegame actually has been created by a compatible engine.
|
||||||
// Since there are ZDoom derivates using the exact same savegame format but
|
// Since there are ZDoom derivates using the exact same savegame format but
|
||||||
// with mutual incompatibilities this check simplifies things significantly.
|
// with mutual incompatibilities this check simplifies things significantly.
|
||||||
char * engine = M_GetPNGText (png, "Engine");
|
char *engine = M_GetPNGText (png, "Engine");
|
||||||
if (engine == NULL || 0 != strcmp (engine, GAMESIG))
|
if (engine == NULL || 0 != strcmp (engine, GAMESIG))
|
||||||
{
|
{
|
||||||
// Make a special case for the message printed for old savegames that don't
|
// Make a special case for the message printed for old savegames that don't
|
||||||
|
@ -1634,12 +1634,17 @@ void G_DoLoadGame ()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Printf ("Savegame is from another ZDoom-based engine\n");
|
Printf ("Savegame is from another ZDoom-based engine: %s\n", engine);
|
||||||
|
delete[] engine;
|
||||||
}
|
}
|
||||||
delete png;
|
delete png;
|
||||||
fclose (stdfile);
|
fclose (stdfile);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (engine != NULL)
|
||||||
|
{
|
||||||
|
delete[] engine;
|
||||||
|
}
|
||||||
|
|
||||||
if (!M_GetPNGText (png, "ZDoom Save Version", sigcheck, 16) ||
|
if (!M_GetPNGText (png, "ZDoom Save Version", sigcheck, 16) ||
|
||||||
0 != strncmp (sigcheck, SAVESIG, 9) || // ZDOOMSAVE is the first 9 chars
|
0 != strncmp (sigcheck, SAVESIG, 9) || // ZDOOMSAVE is the first 9 chars
|
||||||
|
|
|
@ -211,6 +211,7 @@ public:
|
||||||
oldlife = -1;
|
oldlife = -1;
|
||||||
oldkeys = -1;
|
oldkeys = -1;
|
||||||
oldhealth = -1;
|
oldhealth = -1;
|
||||||
|
ArtiRefresh = 0;
|
||||||
}
|
}
|
||||||
DrawMainBar ();
|
DrawMainBar ();
|
||||||
}
|
}
|
||||||
|
@ -408,10 +409,10 @@ private:
|
||||||
|
|
||||||
// Ammo
|
// Ammo
|
||||||
GetCurrentAmmo (ammo1, ammo2, ammocount1, ammocount2);
|
GetCurrentAmmo (ammo1, ammo2, ammocount1, ammocount2);
|
||||||
if (ammo1==ammo2)
|
if (ammo1 == ammo2)
|
||||||
{
|
{
|
||||||
// Don't show the same ammo twice.
|
// Don't show the same ammo twice.
|
||||||
ammo2=NULL;
|
ammo2 = NULL;
|
||||||
}
|
}
|
||||||
if (oldammo1 != ammo1 || oldammo2 != ammo2 ||
|
if (oldammo1 != ammo1 || oldammo2 != ammo2 ||
|
||||||
oldammocount1 != ammocount1 || oldammocount2 != ammocount2)
|
oldammocount1 != ammocount1 || oldammocount2 != ammocount2)
|
||||||
|
|
|
@ -278,6 +278,7 @@ public:
|
||||||
oldfrags = -9999; //can't use -1, 'cuz of negative frags
|
oldfrags = -9999; //can't use -1, 'cuz of negative frags
|
||||||
oldlife = -1;
|
oldlife = -1;
|
||||||
oldkeys[0] = oldkeys[1] = oldkeys[2] = oldkeys[3] = oldkeys[4] = NULL;
|
oldkeys[0] = oldkeys[1] = oldkeys[2] = oldkeys[3] = oldkeys[4] = NULL;
|
||||||
|
ArtiRefresh = 0;
|
||||||
//oldhealth = -1;
|
//oldhealth = -1;
|
||||||
}
|
}
|
||||||
if (!automapactive)
|
if (!automapactive)
|
||||||
|
|
|
@ -99,14 +99,6 @@ static void ClearEpisodes ();
|
||||||
static void ClearLevelInfoStrings (level_info_t *linfo);
|
static void ClearLevelInfoStrings (level_info_t *linfo);
|
||||||
static void ClearClusterInfoStrings (cluster_info_t *cinfo);
|
static void ClearClusterInfoStrings (cluster_info_t *cinfo);
|
||||||
|
|
||||||
static struct EpisodeKiller
|
|
||||||
{
|
|
||||||
~EpisodeKiller()
|
|
||||||
{
|
|
||||||
ClearEpisodes();
|
|
||||||
}
|
|
||||||
} KillTheEpisodes;
|
|
||||||
|
|
||||||
static FRandom pr_classchoice ("RandomPlayerClassChoice");
|
static FRandom pr_classchoice ("RandomPlayerClassChoice");
|
||||||
|
|
||||||
TArray<EndSequence> EndSequences;
|
TArray<EndSequence> EndSequences;
|
||||||
|
@ -141,23 +133,6 @@ level_locals_t level; // info about current level
|
||||||
static TArray<cluster_info_t> wadclusterinfos;
|
static TArray<cluster_info_t> wadclusterinfos;
|
||||||
TArray<level_info_t> wadlevelinfos;
|
TArray<level_info_t> wadlevelinfos;
|
||||||
|
|
||||||
static struct LevelClusterInfoKiller
|
|
||||||
{
|
|
||||||
~LevelClusterInfoKiller()
|
|
||||||
{
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
for (i = 0; i < wadlevelinfos.Size(); ++i)
|
|
||||||
{
|
|
||||||
ClearLevelInfoStrings (&wadlevelinfos[i]);
|
|
||||||
}
|
|
||||||
for (i = 0; i < wadclusterinfos.Size(); ++i)
|
|
||||||
{
|
|
||||||
ClearClusterInfoStrings (&wadclusterinfos[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} KillTheLevelAndClusterInfos;
|
|
||||||
|
|
||||||
// MAPINFO is parsed slightly differently when the map name is just a number.
|
// MAPINFO is parsed slightly differently when the map name is just a number.
|
||||||
static bool HexenHack;
|
static bool HexenHack;
|
||||||
|
|
||||||
|
@ -469,6 +444,8 @@ void G_ParseMapInfo ()
|
||||||
{
|
{
|
||||||
int lump, lastlump = 0;
|
int lump, lastlump = 0;
|
||||||
|
|
||||||
|
atterm (G_UnloadMapInfo);
|
||||||
|
|
||||||
// Parse the default MAPINFO for the current game.
|
// Parse the default MAPINFO for the current game.
|
||||||
switch (gameinfo.gametype)
|
switch (gameinfo.gametype)
|
||||||
{
|
{
|
||||||
|
@ -1181,6 +1158,27 @@ void G_SetForEndGame (char *nextmap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void G_UnloadMapInfo ()
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
G_ClearSnapshots ();
|
||||||
|
|
||||||
|
for (i = 0; i < wadlevelinfos.Size(); ++i)
|
||||||
|
{
|
||||||
|
ClearLevelInfoStrings (&wadlevelinfos[i]);
|
||||||
|
}
|
||||||
|
wadlevelinfos.Clear();
|
||||||
|
|
||||||
|
for (i = 0; i < wadclusterinfos.Size(); ++i)
|
||||||
|
{
|
||||||
|
ClearClusterInfoStrings (&wadclusterinfos[i]);
|
||||||
|
}
|
||||||
|
wadclusterinfos.Clear();
|
||||||
|
|
||||||
|
ClearEpisodes();
|
||||||
|
}
|
||||||
|
|
||||||
level_info_t *FindLevelByWarpTrans (int num)
|
level_info_t *FindLevelByWarpTrans (int num)
|
||||||
{
|
{
|
||||||
for (unsigned i = wadlevelinfos.Size(); i-- != 0; )
|
for (unsigned i = wadlevelinfos.Size(); i-- != 0; )
|
||||||
|
|
|
@ -318,6 +318,7 @@ level_info_t *CheckLevelRedirect (level_info_t *info);
|
||||||
char *CalcMapName (int episode, int level);
|
char *CalcMapName (int episode, int level);
|
||||||
|
|
||||||
void G_ParseMapInfo (void);
|
void G_ParseMapInfo (void);
|
||||||
|
void G_UnloadMapInfo ();
|
||||||
|
|
||||||
void G_ClearSnapshots (void);
|
void G_ClearSnapshots (void);
|
||||||
void G_SnapshotLevel (void);
|
void G_SnapshotLevel (void);
|
||||||
|
|
|
@ -87,14 +87,6 @@ static bool ignorekey; // set to true when the current lock is not being used
|
||||||
|
|
||||||
static void ClearLocks();
|
static void ClearLocks();
|
||||||
|
|
||||||
static struct LockDeleter
|
|
||||||
{
|
|
||||||
~LockDeleter()
|
|
||||||
{
|
|
||||||
ClearLocks();
|
|
||||||
}
|
|
||||||
} DeleteTheLocks;
|
|
||||||
|
|
||||||
static const char * keywords_lock[]={
|
static const char * keywords_lock[]={
|
||||||
"ANY",
|
"ANY",
|
||||||
"MESSAGE",
|
"MESSAGE",
|
||||||
|
@ -327,6 +319,7 @@ static void ClearLocks()
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
|
// P_InitKeyMessages
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
|
@ -359,6 +352,16 @@ void P_InitKeyMessages()
|
||||||
keysdone=true;
|
keysdone=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// P_DeinitKeyMessages
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
void P_DeinitKeyMessages()
|
||||||
|
{
|
||||||
|
ClearLocks();
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
|
|
|
@ -17,6 +17,7 @@ protected:
|
||||||
|
|
||||||
bool P_CheckKeys (AActor *owner, int keynum, bool remote);
|
bool P_CheckKeys (AActor *owner, int keynum, bool remote);
|
||||||
void P_InitKeyMessages ();
|
void P_InitKeyMessages ();
|
||||||
|
void P_DeinitKeyMessages ();
|
||||||
int P_GetMapColorForLock (int lock);
|
int P_GetMapColorForLock (int lock);
|
||||||
int P_GetMapColorForKey (AInventory *key);
|
int P_GetMapColorForKey (AInventory *key);
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,14 @@ FArchive &operator<< (FArchive &arc, FState *&state)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
I_Error ("Cannot find owner for state %p\n", state);
|
I_Error ("Cannot find owner for state %p:\n"
|
||||||
|
"%s %c%c %3d [%p] -> %p", state,
|
||||||
|
sprites[state->sprite.index].name,
|
||||||
|
state->GetFrame() + 'A',
|
||||||
|
state->GetFullbright() ? '*' : ' ',
|
||||||
|
state->GetTics(),
|
||||||
|
state->GetAction(),
|
||||||
|
state->GetNextState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -112,6 +112,8 @@ static void M_QuickLoad ();
|
||||||
static void M_LoadSelect (const FSaveGameNode *file);
|
static void M_LoadSelect (const FSaveGameNode *file);
|
||||||
static void M_SaveSelect (const FSaveGameNode *file);
|
static void M_SaveSelect (const FSaveGameNode *file);
|
||||||
static void M_ReadSaveStrings ();
|
static void M_ReadSaveStrings ();
|
||||||
|
static void M_UnloadSaveStrings ();
|
||||||
|
static FSaveGameNode *M_RemoveSaveSlot (FSaveGameNode *file);
|
||||||
static void M_ExtractSaveData (const FSaveGameNode *file);
|
static void M_ExtractSaveData (const FSaveGameNode *file);
|
||||||
static void M_UnloadSaveData ();
|
static void M_UnloadSaveData ();
|
||||||
static void M_InsertSaveNode (FSaveGameNode *node);
|
static void M_InsertSaveNode (FSaveGameNode *node);
|
||||||
|
@ -605,7 +607,7 @@ void M_GameFiles (int choice)
|
||||||
//
|
//
|
||||||
// Find savegames and read their titles
|
// Find savegames and read their titles
|
||||||
//
|
//
|
||||||
void M_ReadSaveStrings ()
|
static void M_ReadSaveStrings ()
|
||||||
{
|
{
|
||||||
if (SaveGames.IsEmpty ())
|
if (SaveGames.IsEmpty ())
|
||||||
{
|
{
|
||||||
|
@ -613,6 +615,8 @@ void M_ReadSaveStrings ()
|
||||||
findstate_t c_file;
|
findstate_t c_file;
|
||||||
FString filter;
|
FString filter;
|
||||||
|
|
||||||
|
atterm (M_UnloadSaveStrings);
|
||||||
|
|
||||||
filter = G_BuildSaveName ("*.zds", -1);
|
filter = G_BuildSaveName ("*.zds", -1);
|
||||||
filefirst = I_FindFirst (filter.GetChars(), &c_file);
|
filefirst = I_FindFirst (filter.GetChars(), &c_file);
|
||||||
if (filefirst != ((void *)(-1)))
|
if (filefirst != ((void *)(-1)))
|
||||||
|
@ -676,6 +680,10 @@ void M_ReadSaveStrings ()
|
||||||
}
|
}
|
||||||
delete[] ver;
|
delete[] ver;
|
||||||
}
|
}
|
||||||
|
if (engine != NULL)
|
||||||
|
{
|
||||||
|
delete[] engine;
|
||||||
|
}
|
||||||
delete png;
|
delete png;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -725,6 +733,36 @@ void M_ReadSaveStrings ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void M_UnloadSaveStrings()
|
||||||
|
{
|
||||||
|
M_UnloadSaveData();
|
||||||
|
while (!SaveGames.IsEmpty())
|
||||||
|
{
|
||||||
|
M_RemoveSaveSlot (static_cast<FSaveGameNode *>(SaveGames.Head));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static FSaveGameNode *M_RemoveSaveSlot (FSaveGameNode *file)
|
||||||
|
{
|
||||||
|
FSaveGameNode *next = static_cast<FSaveGameNode *>(file->Succ);
|
||||||
|
|
||||||
|
if (file == TopSaveGame)
|
||||||
|
{
|
||||||
|
TopSaveGame = next;
|
||||||
|
}
|
||||||
|
if (quickSaveSlot == file)
|
||||||
|
{
|
||||||
|
quickSaveSlot = NULL;
|
||||||
|
}
|
||||||
|
if (lastSaveSlot == file)
|
||||||
|
{
|
||||||
|
lastSaveSlot = NULL;
|
||||||
|
}
|
||||||
|
file->Remove ();
|
||||||
|
delete file;
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
|
||||||
void M_InsertSaveNode (FSaveGameNode *node)
|
void M_InsertSaveNode (FSaveGameNode *node)
|
||||||
{
|
{
|
||||||
FSaveGameNode *probe;
|
FSaveGameNode *probe;
|
||||||
|
@ -2800,21 +2838,7 @@ static void M_DeleteSaveResponse (int choice)
|
||||||
|
|
||||||
remove (SelSaveGame->Filename.GetChars());
|
remove (SelSaveGame->Filename.GetChars());
|
||||||
M_UnloadSaveData ();
|
M_UnloadSaveData ();
|
||||||
if (SelSaveGame == TopSaveGame)
|
SelSaveGame = M_RemoveSaveSlot (SelSaveGame);
|
||||||
{
|
|
||||||
TopSaveGame = next;
|
|
||||||
}
|
|
||||||
if (quickSaveSlot == SelSaveGame)
|
|
||||||
{
|
|
||||||
quickSaveSlot = NULL;
|
|
||||||
}
|
|
||||||
if (lastSaveSlot == SelSaveGame)
|
|
||||||
{
|
|
||||||
lastSaveSlot = NULL;
|
|
||||||
}
|
|
||||||
SelSaveGame->Remove ();
|
|
||||||
delete SelSaveGame;
|
|
||||||
SelSaveGame = next;
|
|
||||||
M_ExtractSaveData (SelSaveGame);
|
M_ExtractSaveData (SelSaveGame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3107,6 +3131,8 @@ void M_Init (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
atterm (M_Deinit);
|
||||||
|
|
||||||
if (gameinfo.gametype & (GAME_Doom|GAME_Strife))
|
if (gameinfo.gametype & (GAME_Doom|GAME_Strife))
|
||||||
{
|
{
|
||||||
TopLevelMenu = currentMenu = &MainDef;
|
TopLevelMenu = currentMenu = &MainDef;
|
||||||
|
|
|
@ -44,10 +44,11 @@ void M_Ticker (void);
|
||||||
// draws the menus directly into the screen buffer.
|
// draws the menus directly into the screen buffer.
|
||||||
void M_Drawer (void);
|
void M_Drawer (void);
|
||||||
|
|
||||||
// Called by D_DoomMain,
|
// Called by D_DoomMain, loads the config file.
|
||||||
// loads the config file.
|
|
||||||
void M_Init (void);
|
void M_Init (void);
|
||||||
|
|
||||||
|
void M_Deinit ();
|
||||||
|
|
||||||
// Called by intro code to force menu up upon a keypress,
|
// Called by intro code to force menu up upon a keypress,
|
||||||
// does nothing if menu is already up.
|
// does nothing if menu is already up.
|
||||||
void M_StartControlPanel (bool makeSound);
|
void M_StartControlPanel (bool makeSound);
|
||||||
|
|
|
@ -337,7 +337,7 @@ FString GetUserFile (const char *file, bool nodir)
|
||||||
// M_SaveDefaults
|
// M_SaveDefaults
|
||||||
//
|
//
|
||||||
|
|
||||||
void STACK_ARGS M_SaveDefaults ()
|
void M_SaveDefaults ()
|
||||||
{
|
{
|
||||||
GameConfig->ArchiveGlobalData ();
|
GameConfig->ArchiveGlobalData ();
|
||||||
if (GameNames[gameinfo.gametype] != NULL)
|
if (GameNames[gameinfo.gametype] != NULL)
|
||||||
|
|
|
@ -40,7 +40,7 @@ void M_ScreenShot (char *filename);
|
||||||
|
|
||||||
void M_LoadDefaults ();
|
void M_LoadDefaults ();
|
||||||
|
|
||||||
void STACK_ARGS M_SaveDefaults ();
|
void M_SaveDefaults ();
|
||||||
void M_SaveCustomKeys (FConfigFile *config, char *section, char *subsection);
|
void M_SaveCustomKeys (FConfigFile *config, char *section, char *subsection);
|
||||||
|
|
||||||
FString GetUserFile (const char *path, bool nodir=false);
|
FString GetUserFile (const char *path, bool nodir=false);
|
||||||
|
|
|
@ -812,22 +812,6 @@ EXTERN_CVAR (Bool, fullscreen)
|
||||||
|
|
||||||
static value_t Depths[22];
|
static value_t Depths[22];
|
||||||
|
|
||||||
static struct DepthNameKiller
|
|
||||||
{
|
|
||||||
~DepthNameKiller()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < countof(Depths); ++i)
|
|
||||||
{
|
|
||||||
if (Depths[i].name != NULL)
|
|
||||||
{
|
|
||||||
delete[] Depths[i].name;
|
|
||||||
Depths[i].name = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
M_FreeModesList();
|
|
||||||
}
|
|
||||||
} KillTheDepthValues;
|
|
||||||
|
|
||||||
EXTERN_CVAR (Bool, vid_tft) // Defined below
|
EXTERN_CVAR (Bool, vid_tft) // Defined below
|
||||||
CUSTOM_CVAR (Int, menu_screenratios, 0, CVAR_ARCHIVE)
|
CUSTOM_CVAR (Int, menu_screenratios, 0, CVAR_ARCHIVE)
|
||||||
{
|
{
|
||||||
|
@ -3055,3 +3039,20 @@ CCMD (addmenukey)
|
||||||
ControlsMenu.items = &CustomControlsItems[0];
|
ControlsMenu.items = &CustomControlsItems[0];
|
||||||
ControlsMenu.numitems = (int)CustomControlsItems.Size();
|
ControlsMenu.numitems = (int)CustomControlsItems.Size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void M_Deinit ()
|
||||||
|
{
|
||||||
|
// Free bitdepth names for the modes menu.
|
||||||
|
for (int i = 0; i < countof(Depths); ++i)
|
||||||
|
{
|
||||||
|
if (Depths[i].name != NULL)
|
||||||
|
{
|
||||||
|
delete[] Depths[i].name;
|
||||||
|
Depths[i].name = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Free resolutions from the modes menu.
|
||||||
|
M_FreeModesList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ PNGHandle::~PNGHandle ()
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < TextChunks.Size(); ++i)
|
for (unsigned int i = 0; i < TextChunks.Size(); ++i)
|
||||||
{
|
{
|
||||||
delete TextChunks[i];
|
delete[] TextChunks[i];
|
||||||
}
|
}
|
||||||
if (bDeleteFilePtr)
|
if (bDeleteFilePtr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -74,6 +74,7 @@ CVAR (Bool, genglnodes, false, CVAR_SERVERINFO);
|
||||||
CVAR (Bool, showloadtimes, false, 0);
|
CVAR (Bool, showloadtimes, false, 0);
|
||||||
|
|
||||||
static void P_InitTagLists ();
|
static void P_InitTagLists ();
|
||||||
|
static void P_Shutdown ();
|
||||||
|
|
||||||
//
|
//
|
||||||
// MAP related Lookup tables.
|
// MAP related Lookup tables.
|
||||||
|
@ -2798,6 +2799,8 @@ void P_FreeLevelData ()
|
||||||
level.total_monsters = level.total_items = level.total_secrets =
|
level.total_monsters = level.total_items = level.total_secrets =
|
||||||
level.killed_monsters = level.found_items = level.found_secrets =
|
level.killed_monsters = level.found_items = level.found_secrets =
|
||||||
wminfo.maxfrags = 0;
|
wminfo.maxfrags = 0;
|
||||||
|
FBehavior::StaticUnloadModules ();
|
||||||
|
level.behavior = NULL;
|
||||||
if (vertexes != NULL)
|
if (vertexes != NULL)
|
||||||
{
|
{
|
||||||
delete[] vertexes;
|
delete[] vertexes;
|
||||||
|
@ -2915,42 +2918,32 @@ void P_FreeLevelData ()
|
||||||
|
|
||||||
extern msecnode_t *headsecnode;
|
extern msecnode_t *headsecnode;
|
||||||
|
|
||||||
static struct AutoFreeLevelData
|
void P_FreeExtraLevelData()
|
||||||
{
|
{
|
||||||
~AutoFreeLevelData()
|
// Free all blocknodes and msecnodes.
|
||||||
|
// *NEVER* call this function without calling
|
||||||
|
// P_FreeLevelData() first, or they might not all be freed.
|
||||||
{
|
{
|
||||||
P_FreeLevelData();
|
FBlockNode *node = FBlockNode::FreeBlocks;
|
||||||
|
while (node != NULL)
|
||||||
// Blocknodes and msecnodes should be freed now, when we
|
|
||||||
// can be sure they are all easily located in their
|
|
||||||
// free lists.
|
|
||||||
{
|
{
|
||||||
FBlockNode *node = FBlockNode::FreeBlocks;
|
FBlockNode *next = node->NextBlock;
|
||||||
while (node != NULL)
|
delete node;
|
||||||
{
|
node = next;
|
||||||
FBlockNode *next = node->NextBlock;
|
|
||||||
delete node;
|
|
||||||
node = next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
msecnode_t *node = headsecnode;
|
|
||||||
|
|
||||||
while (node != NULL)
|
|
||||||
{
|
|
||||||
msecnode_t *next = node->m_snext;
|
|
||||||
free (node);
|
|
||||||
node = next;
|
|
||||||
}
|
|
||||||
headsecnode = NULL;
|
|
||||||
}
|
|
||||||
if (StatusBar != NULL)
|
|
||||||
{
|
|
||||||
delete StatusBar;
|
|
||||||
StatusBar = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} LevelDataFree_er;
|
{
|
||||||
|
msecnode_t *node = headsecnode;
|
||||||
|
|
||||||
|
while (node != NULL)
|
||||||
|
{
|
||||||
|
msecnode_t *next = node->m_snext;
|
||||||
|
free (node);
|
||||||
|
node = next;
|
||||||
|
}
|
||||||
|
headsecnode = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_SetupLevel
|
// P_SetupLevel
|
||||||
|
@ -3349,6 +3342,8 @@ void P_SetupLevel (char *lumpname, int position)
|
||||||
//
|
//
|
||||||
void P_Init ()
|
void P_Init ()
|
||||||
{
|
{
|
||||||
|
atterm (P_Shutdown);
|
||||||
|
|
||||||
P_InitEffects (); // [RH]
|
P_InitEffects (); // [RH]
|
||||||
P_InitPicAnims ();
|
P_InitPicAnims ();
|
||||||
P_InitSwitchList ();
|
P_InitSwitchList ();
|
||||||
|
@ -3357,6 +3352,19 @@ void P_Init ()
|
||||||
R_InitSprites ();
|
R_InitSprites ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void P_Shutdown ()
|
||||||
|
{
|
||||||
|
R_DeinitSprites ();
|
||||||
|
P_DeinitKeyMessages ();
|
||||||
|
P_FreeLevelData ();
|
||||||
|
P_FreeExtraLevelData ();
|
||||||
|
if (StatusBar != NULL)
|
||||||
|
{
|
||||||
|
delete StatusBar;
|
||||||
|
StatusBar = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#include "c_dispatch.h"
|
#include "c_dispatch.h"
|
||||||
CCMD (lineloc)
|
CCMD (lineloc)
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
void P_SetupLevel (char *mapname, int position);
|
void P_SetupLevel (char *mapname, int position);
|
||||||
|
|
||||||
void P_FreeLevelData();
|
void P_FreeLevelData();
|
||||||
|
void P_FreeExtraLevelData();
|
||||||
|
|
||||||
// Called by startup code.
|
// Called by startup code.
|
||||||
void P_Init (void);
|
void P_Init (void);
|
||||||
|
|
|
@ -83,18 +83,6 @@ drawseg_t *drawsegs;
|
||||||
drawseg_t* firstdrawseg;
|
drawseg_t* firstdrawseg;
|
||||||
drawseg_t* ds_p;
|
drawseg_t* ds_p;
|
||||||
|
|
||||||
static struct DrawSegFree
|
|
||||||
{
|
|
||||||
~DrawSegFree()
|
|
||||||
{
|
|
||||||
if (drawsegs != NULL)
|
|
||||||
{
|
|
||||||
free (drawsegs);
|
|
||||||
drawsegs = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} FreeDrawSegs;
|
|
||||||
|
|
||||||
size_t FirstInterestingDrawseg;
|
size_t FirstInterestingDrawseg;
|
||||||
TArray<size_t> InterestingDrawsegs;
|
TArray<size_t> InterestingDrawsegs;
|
||||||
|
|
||||||
|
|
|
@ -1508,7 +1508,11 @@ void FFlatTexture::MakeTexture ()
|
||||||
{
|
{
|
||||||
FWadLump lump = Wads.OpenLumpNum (SourceLump);
|
FWadLump lump = Wads.OpenLumpNum (SourceLump);
|
||||||
Pixels = new BYTE[Width*Height];
|
Pixels = new BYTE[Width*Height];
|
||||||
lump.Read (Pixels, Width*Height);
|
long numread = lump.Read (Pixels, Width*Height);
|
||||||
|
if (numread < Width*Height)
|
||||||
|
{
|
||||||
|
memset (Pixels + numread, 0xBB, Width*Height - numread);
|
||||||
|
}
|
||||||
FlipSquareBlockRemap (Pixels, Width, Height, GPalette.Remap);
|
FlipSquareBlockRemap (Pixels, Width, Height, GPalette.Remap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2842,23 +2846,6 @@ int firstfakecmap;
|
||||||
byte *realcolormaps;
|
byte *realcolormaps;
|
||||||
int lastusedcolormap;
|
int lastusedcolormap;
|
||||||
|
|
||||||
static struct ColorMapKiller
|
|
||||||
{
|
|
||||||
~ColorMapKiller()
|
|
||||||
{
|
|
||||||
if (fakecmaps != NULL)
|
|
||||||
{
|
|
||||||
delete[] fakecmaps;
|
|
||||||
fakecmaps = NULL;
|
|
||||||
}
|
|
||||||
if (realcolormaps != NULL)
|
|
||||||
{
|
|
||||||
delete[] realcolormaps;
|
|
||||||
realcolormaps = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} KillTheColormaps;
|
|
||||||
|
|
||||||
void R_SetDefaultColormap (const char *name)
|
void R_SetDefaultColormap (const char *name)
|
||||||
{
|
{
|
||||||
if (strnicmp (fakecmaps[0].name, name, 8) != 0)
|
if (strnicmp (fakecmaps[0].name, name, 8) != 0)
|
||||||
|
@ -2983,6 +2970,20 @@ void R_InitColormaps ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void R_DeinitColormaps ()
|
||||||
|
{
|
||||||
|
if (fakecmaps != NULL)
|
||||||
|
{
|
||||||
|
delete[] fakecmaps;
|
||||||
|
fakecmaps = NULL;
|
||||||
|
}
|
||||||
|
if (realcolormaps != NULL)
|
||||||
|
{
|
||||||
|
delete[] realcolormaps;
|
||||||
|
realcolormaps = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// [RH] Returns an index into realcolormaps. Multiply it by
|
// [RH] Returns an index into realcolormaps. Multiply it by
|
||||||
// 256*NUMCOLORMAPS to find the start of the colormap to use.
|
// 256*NUMCOLORMAPS to find the start of the colormap to use.
|
||||||
// WATERMAP is an exception and returns a blending value instead.
|
// WATERMAP is an exception and returns a blending value instead.
|
||||||
|
@ -3026,7 +3027,25 @@ void R_InitData ()
|
||||||
C_InitConsole (SCREENWIDTH, SCREENHEIGHT, true);
|
C_InitConsole (SCREENWIDTH, SCREENHEIGHT, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void R_DeinitData ()
|
||||||
|
{
|
||||||
|
R_DeinitColormaps ();
|
||||||
|
|
||||||
|
// Free openings
|
||||||
|
if (openings != NULL)
|
||||||
|
{
|
||||||
|
free (openings);
|
||||||
|
openings = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Free drawsegs
|
||||||
|
if (drawsegs != NULL)
|
||||||
|
{
|
||||||
|
free (drawsegs);
|
||||||
|
drawsegs = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_PrecacheLevel
|
// R_PrecacheLevel
|
||||||
|
@ -3382,7 +3401,7 @@ static void R_InitPatches ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#ifdef _DEBUG
|
||||||
// Prints the spans generated for a texture. Only needed for debugging.
|
// Prints the spans generated for a texture. Only needed for debugging.
|
||||||
CCMD (printspans)
|
CCMD (printspans)
|
||||||
{
|
{
|
||||||
|
|
|
@ -289,6 +289,7 @@ private:
|
||||||
|
|
||||||
// I/O, setting up the stuff.
|
// I/O, setting up the stuff.
|
||||||
void R_InitData (void);
|
void R_InitData (void);
|
||||||
|
void R_DeinitData ();
|
||||||
void R_PrecacheLevel (void);
|
void R_PrecacheLevel (void);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,8 @@ bool RP_SetupFrame (bool backside);
|
||||||
|
|
||||||
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
||||||
|
|
||||||
|
static void R_Shutdown();
|
||||||
|
|
||||||
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
// EXTERNAL DATA DECLARATIONS ----------------------------------------------
|
||||||
|
|
||||||
extern bool DrawFSHUD; // [RH] Defined in d_main.cpp
|
extern bool DrawFSHUD; // [RH] Defined in d_main.cpp
|
||||||
|
@ -764,8 +766,10 @@ CUSTOM_CVAR (Int, r_columnmethod, 1, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void R_Init (void)
|
void R_Init ()
|
||||||
{
|
{
|
||||||
|
atterm (R_Shutdown);
|
||||||
|
|
||||||
R_InitData ();
|
R_InitData ();
|
||||||
R_InitPointToAngle ();
|
R_InitPointToAngle ();
|
||||||
R_InitTables ();
|
R_InitTables ();
|
||||||
|
@ -790,6 +794,19 @@ void R_Init (void)
|
||||||
framecount = 0;
|
framecount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// R_Shutdown
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
static void R_Shutdown ()
|
||||||
|
{
|
||||||
|
R_DeinitParticles();
|
||||||
|
R_DeinitPlanes();
|
||||||
|
R_DeinitData();
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// R_PointInSubsector
|
// R_PointInSubsector
|
||||||
|
|
|
@ -72,20 +72,6 @@ static visplane_t *visplanes[MAXVISPLANES+1]; // killough
|
||||||
static visplane_t *freetail; // killough
|
static visplane_t *freetail; // killough
|
||||||
static visplane_t **freehead = &freetail; // killough
|
static visplane_t **freehead = &freetail; // killough
|
||||||
|
|
||||||
static struct VisPlaneFree
|
|
||||||
{
|
|
||||||
~VisPlaneFree()
|
|
||||||
{
|
|
||||||
R_ClearPlanes(false);
|
|
||||||
for (visplane_t *pl = freetail; pl != NULL; )
|
|
||||||
{
|
|
||||||
visplane_t *next = pl->next;
|
|
||||||
free (pl);
|
|
||||||
pl = next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} VisPlaneFree_er;
|
|
||||||
|
|
||||||
visplane_t *floorplane;
|
visplane_t *floorplane;
|
||||||
visplane_t *ceilingplane;
|
visplane_t *ceilingplane;
|
||||||
|
|
||||||
|
@ -113,18 +99,6 @@ size_t maxopenings;
|
||||||
short *openings;
|
short *openings;
|
||||||
ptrdiff_t lastopening;
|
ptrdiff_t lastopening;
|
||||||
|
|
||||||
static struct OpeningsFree
|
|
||||||
{
|
|
||||||
~OpeningsFree()
|
|
||||||
{
|
|
||||||
if (openings != NULL)
|
|
||||||
{
|
|
||||||
free (openings);
|
|
||||||
openings = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} FreeOpenings;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Clip values are the solid pixel bounding the range.
|
// Clip values are the solid pixel bounding the range.
|
||||||
// floorclip starts out SCREENHEIGHT and is just outside the range
|
// floorclip starts out SCREENHEIGHT and is just outside the range
|
||||||
|
@ -181,6 +155,23 @@ void R_InitPlanes ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// R_DeinitPlanes
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void R_DeinitPlanes ()
|
||||||
|
{
|
||||||
|
R_ClearPlanes(false);
|
||||||
|
for (visplane_t *pl = freetail; pl != NULL; )
|
||||||
|
{
|
||||||
|
visplane_t *next = pl->next;
|
||||||
|
free (pl);
|
||||||
|
pl = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// R_MapPlane
|
// R_MapPlane
|
||||||
|
|
|
@ -80,6 +80,7 @@ extern short ceilingclip[MAXWIDTH];
|
||||||
extern fixed_t yslope[MAXHEIGHT];
|
extern fixed_t yslope[MAXHEIGHT];
|
||||||
|
|
||||||
void R_InitPlanes ();
|
void R_InitPlanes ();
|
||||||
|
void R_DeinitPlanes ();
|
||||||
void R_ClearPlanes (bool fullclear);
|
void R_ClearPlanes (bool fullclear);
|
||||||
|
|
||||||
void R_DrawPlanes ();
|
void R_DrawPlanes ();
|
||||||
|
|
|
@ -678,17 +678,9 @@ vissprite_t **vissprite_p;
|
||||||
vissprite_t **lastvissprite;
|
vissprite_t **lastvissprite;
|
||||||
int newvissprite;
|
int newvissprite;
|
||||||
|
|
||||||
static struct VisSpriteDeleter
|
static vissprite_t **spritesorter;
|
||||||
{
|
static int spritesortersize = 0;
|
||||||
~VisSpriteDeleter()
|
static int vsprcount;
|
||||||
{
|
|
||||||
for (int i = 0; i < MaxVisSprites; ++i)
|
|
||||||
{
|
|
||||||
delete vissprites[i];
|
|
||||||
}
|
|
||||||
free (vissprites);
|
|
||||||
}
|
|
||||||
} DeleteTheVisSprites;
|
|
||||||
|
|
||||||
static void R_CreateSkinTranslation (const char *palname)
|
static void R_CreateSkinTranslation (const char *palname)
|
||||||
{
|
{
|
||||||
|
@ -797,14 +789,33 @@ void R_InitSprites ()
|
||||||
qsort (&skins[1], numskins-1, sizeof(FPlayerSkin), skinsorter);
|
qsort (&skins[1], numskins-1, sizeof(FPlayerSkin), skinsorter);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct SkinDeleter
|
void R_DeinitSprites()
|
||||||
{
|
{
|
||||||
~SkinDeleter()
|
// Free skins
|
||||||
|
if (skins != NULL)
|
||||||
{
|
{
|
||||||
if (skins!=NULL) delete[] skins;
|
delete[] skins;
|
||||||
|
skins = NULL;
|
||||||
}
|
}
|
||||||
} DeleteTheSkins;
|
|
||||||
|
|
||||||
|
// Free vissprites
|
||||||
|
for (int i = 0; i < MaxVisSprites; ++i)
|
||||||
|
{
|
||||||
|
delete vissprites[i];
|
||||||
|
}
|
||||||
|
free (vissprites);
|
||||||
|
vissprites = NULL;
|
||||||
|
vissprite_p = lastvissprite = NULL;
|
||||||
|
MaxVisSprites = 0;
|
||||||
|
|
||||||
|
// Free vissprites sorter
|
||||||
|
if (spritesorter != NULL)
|
||||||
|
{
|
||||||
|
delete[] spritesorter;
|
||||||
|
spritesortersize = 0;
|
||||||
|
spritesorter = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// R_ClearSprites
|
// R_ClearSprites
|
||||||
|
@ -1562,23 +1573,6 @@ void R_DrawPlayerSprites (void)
|
||||||
// more vissprites that need to be sorted, the better the performance
|
// more vissprites that need to be sorted, the better the performance
|
||||||
// gain compared to the old function.
|
// gain compared to the old function.
|
||||||
//
|
//
|
||||||
static vissprite_t **spritesorter;
|
|
||||||
static int spritesortersize = 0;
|
|
||||||
static int vsprcount;
|
|
||||||
|
|
||||||
static struct SpriteSorterFree
|
|
||||||
{
|
|
||||||
~SpriteSorterFree()
|
|
||||||
{
|
|
||||||
if (spritesorter != NULL)
|
|
||||||
{
|
|
||||||
delete[] spritesorter;
|
|
||||||
spritesortersize = 0;
|
|
||||||
spritesorter = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} SpriteSorterFree_er;
|
|
||||||
|
|
||||||
// Sort vissprites by depth, far to near
|
// Sort vissprites by depth, far to near
|
||||||
static int STACK_ARGS sv_compare (const void *arg1, const void *arg2)
|
static int STACK_ARGS sv_compare (const void *arg1, const void *arg2)
|
||||||
{
|
{
|
||||||
|
@ -2006,14 +2000,6 @@ void R_DrawMasked (void)
|
||||||
// [RH] Particle functions
|
// [RH] Particle functions
|
||||||
//
|
//
|
||||||
|
|
||||||
static void STACK_ARGS FreeParticles()
|
|
||||||
{
|
|
||||||
if (Particles != NULL)
|
|
||||||
{
|
|
||||||
delete[] Particles;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void R_InitParticles ()
|
void R_InitParticles ()
|
||||||
{
|
{
|
||||||
char *i;
|
char *i;
|
||||||
|
@ -2027,7 +2013,16 @@ void R_InitParticles ()
|
||||||
|
|
||||||
Particles = new particle_t[NumParticles];
|
Particles = new particle_t[NumParticles];
|
||||||
R_ClearParticles ();
|
R_ClearParticles ();
|
||||||
atterm (FreeParticles);
|
atterm (R_DeinitParticles);
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_DeinitParticles()
|
||||||
|
{
|
||||||
|
if (Particles != NULL)
|
||||||
|
{
|
||||||
|
delete[] Particles;
|
||||||
|
Particles = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_ClearParticles ()
|
void R_ClearParticles ()
|
||||||
|
|
|
@ -59,6 +59,7 @@ inline particle_t *NewParticle (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_InitParticles ();
|
void R_InitParticles ();
|
||||||
|
void R_DeinitParticles ();
|
||||||
void R_ClearParticles ();
|
void R_ClearParticles ();
|
||||||
void R_DrawParticle (vissprite_t *);
|
void R_DrawParticle (vissprite_t *);
|
||||||
void R_ProjectParticle (particle_t *, const sector_t *sector, int shade, int fakeside);
|
void R_ProjectParticle (particle_t *, const sector_t *sector, int shade, int fakeside);
|
||||||
|
@ -97,6 +98,7 @@ void R_AddSprites (sector_t *sec, int lightlevel, int fakeside);
|
||||||
void R_AddPSprites ();
|
void R_AddPSprites ();
|
||||||
void R_DrawSprites ();
|
void R_DrawSprites ();
|
||||||
void R_InitSprites ();
|
void R_InitSprites ();
|
||||||
|
void R_DeinitSprites ();
|
||||||
void R_ClearSprites ();
|
void R_ClearSprites ();
|
||||||
void R_DrawMasked ();
|
void R_DrawMasked ();
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
#include "r_data.h"
|
#include "r_data.h"
|
||||||
#include "m_random.h"
|
#include "m_random.h"
|
||||||
#include "d_netinf.h"
|
#include "d_netinf.h"
|
||||||
|
#include "i_system.h"
|
||||||
|
|
||||||
// MACROS ------------------------------------------------------------------
|
// MACROS ------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -210,19 +211,6 @@ static const char *SICommandStrings[] =
|
||||||
static TArray<FRandomSoundList> S_rnd;
|
static TArray<FRandomSoundList> S_rnd;
|
||||||
static FMusicVolume *MusicVolumes;
|
static FMusicVolume *MusicVolumes;
|
||||||
|
|
||||||
static struct MusicVolumeDeleter
|
|
||||||
{
|
|
||||||
~MusicVolumeDeleter()
|
|
||||||
{
|
|
||||||
while(MusicVolumes!=NULL)
|
|
||||||
{
|
|
||||||
FMusicVolume * next = MusicVolumes->Next;
|
|
||||||
free(MusicVolumes);
|
|
||||||
MusicVolumes=next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} DeleteTheMusicVolumes;
|
|
||||||
|
|
||||||
static int NumPlayerReserves;
|
static int NumPlayerReserves;
|
||||||
static bool DoneReserving;
|
static bool DoneReserving;
|
||||||
static bool PlayerClassesIsSorted;
|
static bool PlayerClassesIsSorted;
|
||||||
|
@ -568,26 +556,29 @@ static void S_ClearSoundData()
|
||||||
|
|
||||||
S_sfx.Clear();
|
S_sfx.Clear();
|
||||||
|
|
||||||
for(i=0;i<256;i++)
|
for(i = 0; i < countof(Ambients); i++)
|
||||||
{
|
{
|
||||||
if (Ambients[i]) delete Ambients[i];
|
if (Ambients[i] != NULL)
|
||||||
Ambients[i]=NULL;
|
{
|
||||||
|
delete Ambients[i];
|
||||||
|
Ambients[i] = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (MusicVolumes != NULL)
|
while (MusicVolumes != NULL)
|
||||||
{
|
{
|
||||||
FMusicVolume * me = MusicVolumes;
|
FMusicVolume *me = MusicVolumes;
|
||||||
MusicVolumes = me->Next;
|
MusicVolumes = me->Next;
|
||||||
delete me;
|
delete me;
|
||||||
}
|
}
|
||||||
S_rnd.Clear();
|
S_rnd.Clear();
|
||||||
|
|
||||||
DoneReserving=false;
|
DoneReserving = false;
|
||||||
NumPlayerReserves=0;
|
NumPlayerReserves = 0;
|
||||||
PlayerClassesIsSorted=false;
|
PlayerClassesIsSorted = false;
|
||||||
PlayerClasses.Clear();
|
PlayerClasses.Clear();
|
||||||
PlayerSounds.Clear();
|
PlayerSounds.Clear();
|
||||||
DefPlayerClass=0;
|
DefPlayerClass = 0;
|
||||||
*DefPlayerClassName=0;
|
*DefPlayerClassName = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -602,6 +593,7 @@ void S_ParseSndInfo ()
|
||||||
{
|
{
|
||||||
int lump;
|
int lump;
|
||||||
|
|
||||||
|
atterm (S_ClearSoundData);
|
||||||
S_ClearSoundData(); // remove old sound data first!
|
S_ClearSoundData(); // remove old sound data first!
|
||||||
|
|
||||||
CurrentPitchMask = 0;
|
CurrentPitchMask = 0;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "cmdlib.h"
|
#include "cmdlib.h"
|
||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "w_wad.h"
|
#include "w_wad.h"
|
||||||
|
#include "i_system.h"
|
||||||
|
|
||||||
struct FEAXField
|
struct FEAXField
|
||||||
{
|
{
|
||||||
|
@ -382,25 +383,6 @@ ReverbContainer *DefaultEnvironments[26] =
|
||||||
|
|
||||||
ReverbContainer *Environments = &Off;
|
ReverbContainer *Environments = &Off;
|
||||||
|
|
||||||
static struct ReverbContainerDeleter
|
|
||||||
{
|
|
||||||
~ReverbContainerDeleter()
|
|
||||||
{
|
|
||||||
ReverbContainer *probe = Environments;
|
|
||||||
|
|
||||||
while (probe != NULL)
|
|
||||||
{
|
|
||||||
ReverbContainer *next = probe->Next;
|
|
||||||
if (!probe->Builtin)
|
|
||||||
{
|
|
||||||
delete[] const_cast<char *>(probe->Name);
|
|
||||||
delete probe;
|
|
||||||
}
|
|
||||||
probe = next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} DeleteTheReverbContainers;
|
|
||||||
|
|
||||||
ReverbContainer *S_FindEnvironment (const char *name)
|
ReverbContainer *S_FindEnvironment (const char *name)
|
||||||
{
|
{
|
||||||
ReverbContainer *probe = Environments;
|
ReverbContainer *probe = Environments;
|
||||||
|
@ -587,6 +569,8 @@ void S_ParseSndEax ()
|
||||||
{
|
{
|
||||||
int lump, lastlump = 0;
|
int lump, lastlump = 0;
|
||||||
|
|
||||||
|
atterm (S_UnloadSndEax);
|
||||||
|
|
||||||
while ((lump = Wads.FindLump ("SNDEAX", &lastlump)) != -1)
|
while ((lump = Wads.FindLump ("SNDEAX", &lastlump)) != -1)
|
||||||
{
|
{
|
||||||
SC_OpenLumpNum (lump, "SNDEAX");
|
SC_OpenLumpNum (lump, "SNDEAX");
|
||||||
|
@ -594,3 +578,20 @@ void S_ParseSndEax ()
|
||||||
SC_Close ();
|
SC_Close ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void S_UnloadSndEax ()
|
||||||
|
{
|
||||||
|
ReverbContainer *probe = Environments;
|
||||||
|
|
||||||
|
while (probe != NULL)
|
||||||
|
{
|
||||||
|
ReverbContainer *next = probe->Next;
|
||||||
|
if (!probe->Builtin)
|
||||||
|
{
|
||||||
|
delete[] const_cast<char *>(probe->Name);
|
||||||
|
delete probe;
|
||||||
|
}
|
||||||
|
probe = next;
|
||||||
|
}
|
||||||
|
Environments = &Off;
|
||||||
|
}
|
||||||
|
|
|
@ -167,29 +167,6 @@ CVAR (Bool, snd_flipstereo, false, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
|
|
||||||
// CODE --------------------------------------------------------------------
|
// CODE --------------------------------------------------------------------
|
||||||
|
|
||||||
static struct FreeSoundData
|
|
||||||
{
|
|
||||||
~FreeSoundData()
|
|
||||||
{
|
|
||||||
if (Channel != NULL)
|
|
||||||
{
|
|
||||||
delete[] Channel;
|
|
||||||
Channel = NULL;
|
|
||||||
numChannels = 0;
|
|
||||||
}
|
|
||||||
if (SoundCurve != NULL)
|
|
||||||
{
|
|
||||||
delete[] SoundCurve;
|
|
||||||
SoundCurve = NULL;
|
|
||||||
}
|
|
||||||
if (PlayList != NULL)
|
|
||||||
{
|
|
||||||
delete PlayList;
|
|
||||||
PlayList = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} SoundDataFree_er;
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// P_AproxDistance2
|
// P_AproxDistance2
|
||||||
|
@ -306,6 +283,7 @@ void S_Init ()
|
||||||
int curvelump;
|
int curvelump;
|
||||||
|
|
||||||
Printf ("S_Init\n");
|
Printf ("S_Init\n");
|
||||||
|
atterm (S_Shutdown);
|
||||||
|
|
||||||
// remove old data (S_Init can be called multiple times!)
|
// remove old data (S_Init can be called multiple times!)
|
||||||
LastLocalSndInfo = LastLocalSndSeq = "";
|
LastLocalSndInfo = LastLocalSndSeq = "";
|
||||||
|
@ -365,6 +343,32 @@ void S_Init ()
|
||||||
// S_sfx[i].usefulness = -1;
|
// S_sfx[i].usefulness = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
// S_Shutdown
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void S_Shutdown ()
|
||||||
|
{
|
||||||
|
if (Channel != NULL)
|
||||||
|
{
|
||||||
|
delete[] Channel;
|
||||||
|
Channel = NULL;
|
||||||
|
numChannels = 0;
|
||||||
|
}
|
||||||
|
if (SoundCurve != NULL)
|
||||||
|
{
|
||||||
|
delete[] SoundCurve;
|
||||||
|
SoundCurve = NULL;
|
||||||
|
}
|
||||||
|
if (PlayList != NULL)
|
||||||
|
{
|
||||||
|
delete PlayList;
|
||||||
|
PlayList = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// S_Start
|
// S_Start
|
||||||
|
|
|
@ -76,6 +76,7 @@ extern TArray<sfxinfo_t> S_sfx;
|
||||||
// allocates channel buffer, sets S_sfx lookup.
|
// allocates channel buffer, sets S_sfx lookup.
|
||||||
//
|
//
|
||||||
void S_Init ();
|
void S_Init ();
|
||||||
|
void S_Shutdown ();
|
||||||
|
|
||||||
// Per level startup code.
|
// Per level startup code.
|
||||||
// Kills playing sounds at start of level and starts new music.
|
// Kills playing sounds at start of level and starts new music.
|
||||||
|
@ -181,6 +182,7 @@ void S_UpdateSounds (void *listener);
|
||||||
// [RH] S_sfx "maintenance" routines
|
// [RH] S_sfx "maintenance" routines
|
||||||
void S_ParseSndInfo ();
|
void S_ParseSndInfo ();
|
||||||
void S_ParseSndEax ();
|
void S_ParseSndEax ();
|
||||||
|
void S_UnloadSndEax ();
|
||||||
|
|
||||||
void S_HashSounds ();
|
void S_HashSounds ();
|
||||||
int S_FindSound (const char *logicalname);
|
int S_FindSound (const char *logicalname);
|
||||||
|
|
|
@ -49,7 +49,7 @@ EXTERN_CVAR (Float, vid_winscale)
|
||||||
|
|
||||||
IVideo *Video;
|
IVideo *Video;
|
||||||
|
|
||||||
void STACK_ARGS I_ShutdownHardware ()
|
void I_ShutdownHardware ()
|
||||||
{
|
{
|
||||||
if (screen)
|
if (screen)
|
||||||
delete screen, screen = NULL;
|
delete screen, screen = NULL;
|
||||||
|
|
|
@ -88,6 +88,6 @@ class IJoystick : public IInputDevice
|
||||||
};
|
};
|
||||||
|
|
||||||
void I_InitHardware ();
|
void I_InitHardware ();
|
||||||
void STACK_ARGS I_ShutdownHardware ();
|
void I_ShutdownHardware ();
|
||||||
|
|
||||||
#endif // __HARDWARE_H__
|
#endif // __HARDWARE_H__
|
||||||
|
|
|
@ -39,13 +39,21 @@
|
||||||
|
|
||||||
DArgs Args;
|
DArgs Args;
|
||||||
|
|
||||||
#define MAX_TERMS 16
|
#define MAX_TERMS 32
|
||||||
void (STACK_ARGS *TermFuncs[MAX_TERMS]) ();
|
void (*TermFuncs[MAX_TERMS]) ();
|
||||||
const char *TermNames[MAX_TERMS];
|
const char *TermNames[MAX_TERMS];
|
||||||
static int NumTerms;
|
static int NumTerms;
|
||||||
|
|
||||||
void addterm (void (STACK_ARGS *func) (), const char *name)
|
void addterm (void (*func) (), const char *name)
|
||||||
{
|
{
|
||||||
|
// Make sure this function wasn't already registered.
|
||||||
|
for (int i = 0; i < NumTerms; ++i)
|
||||||
|
{
|
||||||
|
if (TermFuncs[i] == func)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (NumTerms == MAX_TERMS)
|
if (NumTerms == MAX_TERMS)
|
||||||
{
|
{
|
||||||
func ();
|
func ();
|
||||||
|
|
|
@ -323,7 +323,7 @@ void BuildAddress (sockaddr_in *address, char *name)
|
||||||
*portpart = ':';
|
*portpart = ':';
|
||||||
}
|
}
|
||||||
|
|
||||||
void STACK_ARGS CloseNetwork (void)
|
void CloseNetwork (void)
|
||||||
{
|
{
|
||||||
if (mysocket != INVALID_SOCKET)
|
if (mysocket != INVALID_SOCKET)
|
||||||
{
|
{
|
||||||
|
@ -386,7 +386,7 @@ void WaitForPlayers (int i)
|
||||||
doomcom.numplayers = doomcom.numnodes;
|
doomcom.numplayers = doomcom.numnodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void STACK_ARGS SendAbort (void)
|
void SendAbort (void)
|
||||||
{
|
{
|
||||||
BYTE dis[2] = { PRE_FAKE, PRE_DISCONNECT };
|
BYTE dis[2] = { PRE_FAKE, PRE_DISCONNECT };
|
||||||
|
|
||||||
|
|
|
@ -277,7 +277,7 @@ void CalculateCPUSpeed ()
|
||||||
//
|
//
|
||||||
static int has_exited;
|
static int has_exited;
|
||||||
|
|
||||||
void STACK_ARGS I_Quit (void)
|
void I_Quit (void)
|
||||||
{
|
{
|
||||||
has_exited = 1; /* Prevent infinitely recursive exits -- killough */
|
has_exited = 1; /* Prevent infinitely recursive exits -- killough */
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ ticcmd_t *I_BaseTiccmd (void);
|
||||||
|
|
||||||
// Called by M_Responder when quit is selected.
|
// Called by M_Responder when quit is selected.
|
||||||
// Clean exit, displays sell blurb.
|
// Clean exit, displays sell blurb.
|
||||||
void STACK_ARGS I_Quit (void);
|
void I_Quit (void);
|
||||||
|
|
||||||
|
|
||||||
void I_Tactile (int on, int off, int total);
|
void I_Tactile (int on, int off, int total);
|
||||||
|
@ -174,7 +174,7 @@ void I_Tactile (int on, int off, int total);
|
||||||
void STACK_ARGS I_Error (const char *error, ...) GCCPRINTF(1,2);
|
void STACK_ARGS I_Error (const char *error, ...) GCCPRINTF(1,2);
|
||||||
void STACK_ARGS I_FatalError (const char *error, ...) GCCPRINTF(1,2);
|
void STACK_ARGS I_FatalError (const char *error, ...) GCCPRINTF(1,2);
|
||||||
|
|
||||||
void addterm (void (STACK_ARGS *func)(void), const char *name);
|
void addterm (void (*func)(void), const char *name);
|
||||||
#define atterm(t) addterm (t, #t)
|
#define atterm(t) addterm (t, #t)
|
||||||
void popterm ();
|
void popterm ();
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ void I_InitMusic (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void STACK_ARGS I_ShutdownMusic(void)
|
void I_ShutdownMusic(void)
|
||||||
{
|
{
|
||||||
if (MusicDown)
|
if (MusicDown)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
// MUSIC I/O
|
// MUSIC I/O
|
||||||
//
|
//
|
||||||
void I_InitMusic ();
|
void I_InitMusic ();
|
||||||
void STACK_ARGS I_ShutdownMusic ();
|
void I_ShutdownMusic ();
|
||||||
void I_BuildMIDIMenuList (struct value_s **values, float *numValues);
|
void I_BuildMIDIMenuList (struct value_s **values, float *numValues);
|
||||||
|
|
||||||
// Volume.
|
// Volume.
|
||||||
|
|
|
@ -237,7 +237,7 @@ void I_InitSound ()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void STACK_ARGS I_ShutdownSound (void)
|
void I_ShutdownSound (void)
|
||||||
{
|
{
|
||||||
if (GSnd != NULL)
|
if (GSnd != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -124,6 +124,6 @@ public:
|
||||||
extern SoundRenderer *GSnd;
|
extern SoundRenderer *GSnd;
|
||||||
|
|
||||||
void I_InitSound ();
|
void I_InitSound ();
|
||||||
void STACK_ARGS I_ShutdownSound ();
|
void I_ShutdownSound ();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -110,17 +110,6 @@ static const byte myislower[256] =
|
||||||
|
|
||||||
FFont *FFont::FirstFont = NULL;
|
FFont *FFont::FirstFont = NULL;
|
||||||
|
|
||||||
static struct FontsDeleter
|
|
||||||
{
|
|
||||||
~FontsDeleter()
|
|
||||||
{
|
|
||||||
while (FFont::FirstFont != NULL)
|
|
||||||
{
|
|
||||||
delete FFont::FirstFont;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} DeleteAllTheFonts;
|
|
||||||
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER < 1310
|
#if defined(_MSC_VER) && _MSC_VER < 1310
|
||||||
template<> FArchive &operator<< (FArchive &arc, FFont* &font)
|
template<> FArchive &operator<< (FArchive &arc, FFont* &font)
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -110,6 +110,8 @@ protected:
|
||||||
static FFont *FirstFont;
|
static FFont *FirstFont;
|
||||||
friend struct FontsDeleter;
|
friend struct FontsDeleter;
|
||||||
|
|
||||||
|
friend void V_Shutdown();
|
||||||
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER < 1310
|
#if defined(_MSC_VER) && _MSC_VER < 1310
|
||||||
template<> friend FArchive &operator<< (FArchive &arc, FFont* &font);
|
template<> friend FArchive &operator<< (FArchive &arc, FFont* &font);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -853,6 +853,8 @@ void V_Init (void)
|
||||||
char *i;
|
char *i;
|
||||||
int width, height, bits;
|
int width, height, bits;
|
||||||
|
|
||||||
|
atterm (V_Shutdown);
|
||||||
|
|
||||||
// [RH] Initialize palette management
|
// [RH] Initialize palette management
|
||||||
InitPalette ();
|
InitPalette ();
|
||||||
|
|
||||||
|
@ -919,8 +921,6 @@ void V_Init (void)
|
||||||
bits = vid_defbits;
|
bits = vid_defbits;
|
||||||
}
|
}
|
||||||
|
|
||||||
atterm (FreeCanvasChain);
|
|
||||||
|
|
||||||
I_ClosestResolution (&width, &height, bits);
|
I_ClosestResolution (&width, &height, bits);
|
||||||
|
|
||||||
if (!V_SetResolution (width, height, bits))
|
if (!V_SetResolution (width, height, bits))
|
||||||
|
@ -935,7 +935,16 @@ void V_Init (void)
|
||||||
BuildTransTable (GPalette.BaseColors);
|
BuildTransTable (GPalette.BaseColors);
|
||||||
}
|
}
|
||||||
|
|
||||||
void STACK_ARGS FreeCanvasChain ()
|
void V_Shutdown()
|
||||||
|
{
|
||||||
|
FreeCanvasChain();
|
||||||
|
while (FFont::FirstFont != NULL)
|
||||||
|
{
|
||||||
|
delete FFont::FirstFont;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FreeCanvasChain ()
|
||||||
{
|
{
|
||||||
if (screen != NULL)
|
if (screen != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -189,7 +189,7 @@ private:
|
||||||
DCanvas *Next;
|
DCanvas *Next;
|
||||||
static DCanvas *CanvasChain;
|
static DCanvas *CanvasChain;
|
||||||
|
|
||||||
friend void STACK_ARGS FreeCanvasChain ();
|
friend void FreeCanvasChain ();
|
||||||
};
|
};
|
||||||
|
|
||||||
// A canvas in system memory.
|
// A canvas in system memory.
|
||||||
|
@ -286,6 +286,8 @@ extern "C" DWORD *Col2RGB8_LessPrecision[65];
|
||||||
// Allocates buffer screens, call before R_Init.
|
// Allocates buffer screens, call before R_Init.
|
||||||
void V_Init ();
|
void V_Init ();
|
||||||
|
|
||||||
|
void V_Shutdown ();
|
||||||
|
|
||||||
void V_MarkRect (int x, int y, int width, int height);
|
void V_MarkRect (int x, int y, int width, int height);
|
||||||
|
|
||||||
// Returns the closest color to the one desired. String
|
// Returns the closest color to the one desired. String
|
||||||
|
|
|
@ -55,7 +55,7 @@ IVideo *Video;
|
||||||
//static IMouse *Mouse;
|
//static IMouse *Mouse;
|
||||||
//static IJoystick *Joystick;
|
//static IJoystick *Joystick;
|
||||||
|
|
||||||
void STACK_ARGS I_ShutdownHardware ()
|
void I_ShutdownHardware ()
|
||||||
{
|
{
|
||||||
if (screen)
|
if (screen)
|
||||||
delete screen, screen = NULL;
|
delete screen, screen = NULL;
|
||||||
|
|
|
@ -88,6 +88,6 @@ class IJoystick : public IInputDevice
|
||||||
};
|
};
|
||||||
|
|
||||||
void I_InitHardware ();
|
void I_InitHardware ();
|
||||||
void STACK_ARGS I_ShutdownHardware ();
|
void I_ShutdownHardware ();
|
||||||
|
|
||||||
#endif // __HARDWARE_H__
|
#endif // __HARDWARE_H__
|
||||||
|
|
|
@ -434,7 +434,7 @@ DWORD FCDThread::Dispatch (DWORD method, DWORD parm1, DWORD parm2, DWORD parm3)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
static void STACK_ARGS KillThread ()
|
static void KillThread ()
|
||||||
{
|
{
|
||||||
if (CDThread != NULL)
|
if (CDThread != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1479,7 +1479,7 @@ BOOL I_InitInput (void *hwnd)
|
||||||
|
|
||||||
|
|
||||||
// Free all input resources
|
// Free all input resources
|
||||||
void STACK_ARGS I_ShutdownInput ()
|
void I_ShutdownInput ()
|
||||||
{
|
{
|
||||||
if (g_pKey)
|
if (g_pKey)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#include "doomtype.h"
|
#include "doomtype.h"
|
||||||
|
|
||||||
BOOL I_InitInput (void *hwnd);
|
BOOL I_InitInput (void *hwnd);
|
||||||
void STACK_ARGS I_ShutdownInput ();
|
void I_ShutdownInput ();
|
||||||
void I_PutInClipboard (const char *str);
|
void I_PutInClipboard (const char *str);
|
||||||
char *I_GetFromClipboard ();
|
char *I_GetFromClipboard ();
|
||||||
|
|
||||||
|
|
|
@ -99,14 +99,25 @@ BOOL (*pIsDebuggerPresent)(VOID);
|
||||||
extern UINT TimerPeriod;
|
extern UINT TimerPeriod;
|
||||||
extern HCURSOR TheArrowCursor, TheInvisibleCursor;
|
extern HCURSOR TheArrowCursor, TheInvisibleCursor;
|
||||||
|
|
||||||
#define MAX_TERMS 16
|
#define MAX_TERMS 32
|
||||||
void (STACK_ARGS *TermFuncs[MAX_TERMS])(void);
|
void (*TermFuncs[MAX_TERMS])(void);
|
||||||
static int NumTerms;
|
static int NumTerms;
|
||||||
|
|
||||||
void atterm (void (STACK_ARGS *func)(void))
|
void atterm (void (STACK_ARGS *func)(void))
|
||||||
{
|
{
|
||||||
|
// Make sure this function wasn't already registered.
|
||||||
|
for (int i = 0; i < NumTerms; ++i)
|
||||||
|
{
|
||||||
|
if (TermFuncs[i] == func)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (NumTerms == MAX_TERMS)
|
if (NumTerms == MAX_TERMS)
|
||||||
|
{
|
||||||
|
func ();
|
||||||
I_FatalError ("Too many exit functions registered.\nIncrease MAX_TERMS in i_main.cpp");
|
I_FatalError ("Too many exit functions registered.\nIncrease MAX_TERMS in i_main.cpp");
|
||||||
|
}
|
||||||
TermFuncs[NumTerms++] = func;
|
TermFuncs[NumTerms++] = func;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +143,7 @@ static int STACK_ARGS NewFailure (size_t size)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void STACK_ARGS UnCOM (void)
|
static void UnCOM (void)
|
||||||
{
|
{
|
||||||
CoUninitialize ();
|
CoUninitialize ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -323,7 +323,7 @@ void BuildAddress (sockaddr_in *address, char *name)
|
||||||
*portpart = ':';
|
*portpart = ':';
|
||||||
}
|
}
|
||||||
|
|
||||||
void STACK_ARGS CloseNetwork (void)
|
void CloseNetwork (void)
|
||||||
{
|
{
|
||||||
if (mysocket != INVALID_SOCKET)
|
if (mysocket != INVALID_SOCKET)
|
||||||
{
|
{
|
||||||
|
@ -386,7 +386,7 @@ void WaitForPlayers (int i)
|
||||||
doomcom.numplayers = doomcom.numnodes;
|
doomcom.numplayers = doomcom.numnodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void STACK_ARGS SendAbort (void)
|
void SendAbort (void)
|
||||||
{
|
{
|
||||||
BYTE dis[2] = { PRE_FAKE, PRE_DISCONNECT };
|
BYTE dis[2] = { PRE_FAKE, PRE_DISCONNECT };
|
||||||
|
|
||||||
|
|
|
@ -484,7 +484,7 @@ void CalculateCPUSpeed ()
|
||||||
//
|
//
|
||||||
static int has_exited;
|
static int has_exited;
|
||||||
|
|
||||||
void STACK_ARGS I_Quit (void)
|
void I_Quit (void)
|
||||||
{
|
{
|
||||||
has_exited = 1; /* Prevent infinitely recursive exits -- killough */
|
has_exited = 1; /* Prevent infinitely recursive exits -- killough */
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,7 @@ ticcmd_t *I_BaseTiccmd (void);
|
||||||
|
|
||||||
// Called by M_Responder when quit is selected.
|
// Called by M_Responder when quit is selected.
|
||||||
// Clean exit, displays sell blurb.
|
// Clean exit, displays sell blurb.
|
||||||
void STACK_ARGS I_Quit (void);
|
void I_Quit (void);
|
||||||
|
|
||||||
|
|
||||||
void I_Tactile (int on, int off, int total);
|
void I_Tactile (int on, int off, int total);
|
||||||
|
@ -180,7 +180,7 @@ void I_Tactile (int on, int off, int total);
|
||||||
void STACK_ARGS I_Error (const char *error, ...) GCCPRINTF(1,2);
|
void STACK_ARGS I_Error (const char *error, ...) GCCPRINTF(1,2);
|
||||||
void STACK_ARGS I_FatalError (const char *error, ...) GCCPRINTF(1,2);
|
void STACK_ARGS I_FatalError (const char *error, ...) GCCPRINTF(1,2);
|
||||||
|
|
||||||
void atterm (void (STACK_ARGS *func)(void));
|
void atterm (void (*func)(void));
|
||||||
void popterm ();
|
void popterm ();
|
||||||
|
|
||||||
// Repaint the pre-game console
|
// Repaint the pre-game console
|
||||||
|
|
258
zdoom.vcproj
258
zdoom.vcproj
|
@ -4435,6 +4435,264 @@
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="SDL Files"
|
||||||
|
Filter="">
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\sdl\crashcatcher.c">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\sdl\dikeys.h">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\sdl\hardware.cpp">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\sdl\hardware.h">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\sdl\i_cd.cpp">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\sdl\i_input.cpp">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\sdl\i_input.h">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\sdl\i_main.cpp">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\sdl\i_movie.cpp">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\sdl\i_net.cpp">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\sdl\i_net.h">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\sdl\i_system.cpp">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\sdl\i_system.h">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\sdl\i_video.h">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\sdl\sdlvideo.cpp">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\src\sdl\sdlvideo.h">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
ExcludedFromBuild="TRUE">
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
</Globals>
|
</Globals>
|
||||||
|
|
Loading…
Reference in a new issue