mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-31 05:40:44 +00:00
- Fixed: Conversion of c_bind.cpp to FString was incomplete.
- Fixed some functions that were declared as taking size_t's but defined as taking unsigned ints. - Added a dummy object to delete sound environments on exit. - Fixed: FWarpTexture did not delete its Spans when destroyed. - Changed wadclusterinfos and wadlevelinfos arrays into TArrays. - Added the TypeInfo::AutoTypeInfoPtr for TypeInfo::m_RuntimeActors so they can be automatically deleted. - Changed TypeInfo::m_Types into a TArray so it will be automatically deleted on exit. - Fixed: TArray::Resize() did not deconstruct entries when shrinking the array. - Changed TArray::Push() so that it calls Grow() instead of duplicating the growth calculations itself. - Calling TArray::Grow() for a small amount when the array is short should grow it a bit more than it was doing. SVN r76 (trunk)
This commit is contained in:
parent
c8cdb52863
commit
fe84b6077e
22 changed files with 155 additions and 139 deletions
|
@ -1,4 +1,19 @@
|
||||||
May 3, 2006
|
May 3, 2006
|
||||||
|
- Fixed: Conversion of c_bind.cpp to FString was incomplete.
|
||||||
|
- Fixed some functions that were declared as taking size_t's but defined as taking
|
||||||
|
unsigned ints.
|
||||||
|
- Added a dummy object to delete sound environments on exit.
|
||||||
|
- Fixed: FWarpTexture did not delete its Spans when destroyed.
|
||||||
|
- Changed wadclusterinfos and wadlevelinfos arrays into TArrays.
|
||||||
|
- Added the TypeInfo::AutoTypeInfoPtr for TypeInfo::m_RuntimeActors so they can
|
||||||
|
be automatically deleted.
|
||||||
|
- Changed TypeInfo::m_Types into a TArray so it will be automatically deleted
|
||||||
|
on exit.
|
||||||
|
- Fixed: TArray::Resize() did not deconstruct entries when shrinking the array.
|
||||||
|
- Changed TArray::Push() so that it calls Grow() instead of duplicating the growth
|
||||||
|
calculations itself.
|
||||||
|
- Calling TArray::Grow() for a small amount when the array is short should grow it
|
||||||
|
a bit more than it was doing.
|
||||||
- Removed generational garbage collection from the string pool because it didn't
|
- Removed generational garbage collection from the string pool because it didn't
|
||||||
actually work.
|
actually work.
|
||||||
- Turned the list of TabCommands into a TArray because I saw lots of console
|
- Turned the list of TabCommands into a TArray because I saw lots of console
|
||||||
|
|
|
@ -283,16 +283,8 @@ void C_UnbindAll ()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < NUM_KEYS; ++i)
|
for (int i = 0; i < NUM_KEYS; ++i)
|
||||||
{
|
{
|
||||||
if (Bindings[i])
|
Bindings[i] = "";
|
||||||
{
|
DoubleBindings[i] = "";
|
||||||
free (Bindings[i]);
|
|
||||||
Bindings[i] = NULL;
|
|
||||||
}
|
|
||||||
if (DoubleBindings[i])
|
|
||||||
{
|
|
||||||
free (DoubleBindings[i]);
|
|
||||||
DoubleBindings[i] = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,11 +301,7 @@ CCMD (unbind)
|
||||||
{
|
{
|
||||||
if ( (i = GetKeyFromName (argv[1])) )
|
if ( (i = GetKeyFromName (argv[1])) )
|
||||||
{
|
{
|
||||||
if (Bindings[i])
|
Bindings[i] = "";
|
||||||
{
|
|
||||||
free (Bindings[i]);
|
|
||||||
Bindings[i] = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -338,7 +326,7 @@ CCMD (bind)
|
||||||
}
|
}
|
||||||
if (argv.argc() == 2)
|
if (argv.argc() == 2)
|
||||||
{
|
{
|
||||||
Printf ("\"%s\" = \"%s\"\n", argv[1], (Bindings[i] ? Bindings[i] : ""));
|
Printf ("\"%s\" = \"%s\"\n", argv[1], (Bindings[i].GetChars() ? Bindings[i].GetChars() : ""));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -351,8 +339,8 @@ CCMD (bind)
|
||||||
|
|
||||||
for (i = 0; i < NUM_KEYS; i++)
|
for (i = 0; i < NUM_KEYS; i++)
|
||||||
{
|
{
|
||||||
if (Bindings[i])
|
if (!Bindings[i].IsEmpty())
|
||||||
Printf ("%s \"%s\"\n", KeyName (i), Bindings[i]);
|
Printf ("%s \"%s\"\n", KeyName (i), Bindings[i].GetChars());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -404,11 +392,7 @@ CCMD (undoublebind)
|
||||||
{
|
{
|
||||||
if ( (i = GetKeyFromName (argv[1])) )
|
if ( (i = GetKeyFromName (argv[1])) )
|
||||||
{
|
{
|
||||||
if (DoubleBindings[i])
|
DoubleBindings[i] = "";
|
||||||
{
|
|
||||||
delete[] DoubleBindings[i];
|
|
||||||
DoubleBindings[i] = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -433,7 +417,7 @@ CCMD (doublebind)
|
||||||
}
|
}
|
||||||
if (argv.argc() == 2)
|
if (argv.argc() == 2)
|
||||||
{
|
{
|
||||||
Printf ("\"%s\" = \"%s\"\n", argv[1], (DoubleBindings[i] ? DoubleBindings[i] : ""));
|
Printf ("\"%s\" = \"%s\"\n", argv[1], (DoubleBindings[i].GetChars() ? DoubleBindings[i].GetChars() : ""));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -446,8 +430,8 @@ CCMD (doublebind)
|
||||||
|
|
||||||
for (i = 0; i < NUM_KEYS; i++)
|
for (i = 0; i < NUM_KEYS; i++)
|
||||||
{
|
{
|
||||||
if (DoubleBindings[i])
|
if (!DoubleBindings[i].IsEmpty())
|
||||||
Printf ("%s \"%s\"\n", KeyName (i), DoubleBindings[i]);
|
Printf ("%s \"%s\"\n", KeyName (i), DoubleBindings[i].GetChars());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -610,7 +594,7 @@ void C_ArchiveBindings (FConfigFile *f, bool dodouble, const char *matchcmd)
|
||||||
|
|
||||||
for (i = 0; i < NUM_KEYS; i++)
|
for (i = 0; i < NUM_KEYS; i++)
|
||||||
{
|
{
|
||||||
if (bindings[i] && (matchcmd==NULL || stricmp(bindings[i], matchcmd)==0))
|
if (!bindings[i].IsEmpty() && (matchcmd==NULL || stricmp(bindings[i], matchcmd)==0))
|
||||||
{
|
{
|
||||||
name = KeyName (i);
|
name = KeyName (i);
|
||||||
if (name[1] == 0) // Make sure given name is config-safe
|
if (name[1] == 0) // Make sure given name is config-safe
|
||||||
|
@ -628,8 +612,7 @@ void C_ArchiveBindings (FConfigFile *f, bool dodouble, const char *matchcmd)
|
||||||
if (matchcmd != NULL)
|
if (matchcmd != NULL)
|
||||||
{ // If saving a specific command, remove the old binding
|
{ // If saving a specific command, remove the old binding
|
||||||
// so it does not get saved in the general binding list
|
// so it does not get saved in the general binding list
|
||||||
delete[] Bindings[i];
|
Bindings[i] = "";
|
||||||
Bindings[i] = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -671,7 +654,7 @@ int C_GetKeysForCommand (char *cmd, int *first, int *second)
|
||||||
|
|
||||||
while (i < NUM_KEYS && c < 2)
|
while (i < NUM_KEYS && c < 2)
|
||||||
{
|
{
|
||||||
if (Bindings[i] && stricmp (cmd, Bindings[i]) == 0)
|
if (stricmp (cmd, Bindings[i]) == 0)
|
||||||
{
|
{
|
||||||
if (c++ == 0)
|
if (c++ == 0)
|
||||||
*first = i;
|
*first = i;
|
||||||
|
@ -712,10 +695,9 @@ void C_UnbindACommand (char *str)
|
||||||
|
|
||||||
for (i = 0; i < NUM_KEYS; i++)
|
for (i = 0; i < NUM_KEYS; i++)
|
||||||
{
|
{
|
||||||
if (Bindings[i] && !stricmp (str, Bindings[i]))
|
if (!stricmp (str, Bindings[i]))
|
||||||
{
|
{
|
||||||
delete[] Bindings[i];
|
Bindings[i] = "";
|
||||||
Bindings[i] = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -724,10 +706,7 @@ void C_ChangeBinding (const char *str, int newone)
|
||||||
{
|
{
|
||||||
if ((unsigned int)newone < NUM_KEYS)
|
if ((unsigned int)newone < NUM_KEYS)
|
||||||
{
|
{
|
||||||
if (Bindings[newone])
|
Bindings[newone] = str;
|
||||||
delete[] Bindings[newone];
|
|
||||||
|
|
||||||
Bindings[newone] = copystring (str);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1336,7 +1336,7 @@ static int PatchAmmo (int ammoNum)
|
||||||
// Fix per-ammo/max-ammo amounts for descendants of the base ammo class
|
// Fix per-ammo/max-ammo amounts for descendants of the base ammo class
|
||||||
if (oldclip != *per)
|
if (oldclip != *per)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < TypeInfo::m_NumTypes; ++i)
|
for (int i = 0; i < TypeInfo::m_Types.Size(); ++i)
|
||||||
{
|
{
|
||||||
TypeInfo *type = TypeInfo::m_Types[i];
|
TypeInfo *type = TypeInfo::m_Types[i];
|
||||||
|
|
||||||
|
|
|
@ -1597,7 +1597,7 @@ static EIWADType IdentifyVersion (void)
|
||||||
#ifdef unix
|
#ifdef unix
|
||||||
else if (*value == '~' && (*(value + 1) == 0 || *(value + 1) == '/'))
|
else if (*value == '~' && (*(value + 1) == 0 || *(value + 1) == '/'))
|
||||||
{
|
{
|
||||||
string homepath = GetUserFile (*(value + 1) ? value + 2 : value + 1);
|
FString homepath = GetUserFile (*(value + 1) ? value + 2 : value + 1);
|
||||||
CheckIWAD (homepath, wads);
|
CheckIWAD (homepath, wads);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -47,10 +47,8 @@
|
||||||
#include "r_state.h"
|
#include "r_state.h"
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
|
|
||||||
TArray<TypeInfo *> TypeInfo::m_RuntimeActors;
|
TypeInfo::DeletingArray TypeInfo::m_RuntimeActors;
|
||||||
TypeInfo **TypeInfo::m_Types;
|
TArray<TypeInfo *> TypeInfo::m_Types (256);
|
||||||
unsigned short TypeInfo::m_NumTypes;
|
|
||||||
unsigned short TypeInfo::m_MaxTypes;
|
|
||||||
unsigned int TypeInfo::TypeHash[256]; // Why can't I use TypeInfo::HASH_SIZE?
|
unsigned int TypeInfo::TypeHash[256]; // Why can't I use TypeInfo::HASH_SIZE?
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__GNUC__)
|
#if defined(_MSC_VER) || defined(__GNUC__)
|
||||||
|
@ -79,17 +77,22 @@ TypeInfo DObject::_StaticType(NULL, "DObject", NULL, sizeof(DObject));
|
||||||
static cycle_t StaleCycles;
|
static cycle_t StaleCycles;
|
||||||
static int StaleCount;
|
static int StaleCount;
|
||||||
|
|
||||||
|
TypeInfo::DeletingArray::~DeletingArray()
|
||||||
|
{
|
||||||
|
for (unsigned int i = 0; i < Size(); ++i)
|
||||||
|
{
|
||||||
|
if ((*this)[i] != NULL)
|
||||||
|
{
|
||||||
|
delete (*this)[i];
|
||||||
|
(*this)[i] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TypeInfo::RegisterType ()
|
void TypeInfo::RegisterType ()
|
||||||
{
|
{
|
||||||
// Add type to list
|
// Add type to list
|
||||||
if (m_NumTypes == m_MaxTypes)
|
TypeIndex = m_Types.Push (this);
|
||||||
{
|
|
||||||
m_MaxTypes = m_MaxTypes ? m_MaxTypes*2 : 256;
|
|
||||||
m_Types = (TypeInfo **)M_Realloc (m_Types, m_MaxTypes * sizeof(*m_Types));
|
|
||||||
}
|
|
||||||
m_Types[m_NumTypes] = this;
|
|
||||||
TypeIndex = m_NumTypes;
|
|
||||||
m_NumTypes++;
|
|
||||||
|
|
||||||
// Add type to hash table. Types are inserted into each bucket
|
// Add type to hash table. Types are inserted into each bucket
|
||||||
// lexicographically, and the prefix character is ignored.
|
// lexicographically, and the prefix character is ignored.
|
||||||
|
@ -150,7 +153,7 @@ const TypeInfo *TypeInfo::IFindType (const char *name)
|
||||||
{
|
{
|
||||||
if (name != NULL)
|
if (name != NULL)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < TypeInfo::m_NumTypes; i++)
|
for (int i = 0; i < TypeInfo::m_Types.Size(); i++)
|
||||||
{
|
{
|
||||||
if (stricmp (TypeInfo::m_Types[i]->Name + 1, name) == 0)
|
if (stricmp (TypeInfo::m_Types[i]->Name + 1, name) == 0)
|
||||||
return TypeInfo::m_Types[i];
|
return TypeInfo::m_Types[i];
|
||||||
|
@ -434,7 +437,7 @@ CCMD (dumpclasses)
|
||||||
}
|
}
|
||||||
|
|
||||||
shown = omitted = 0;
|
shown = omitted = 0;
|
||||||
for (i = 0; i < TypeInfo::m_NumTypes; i++)
|
for (i = 0; i < TypeInfo::m_Types.Size(); i++)
|
||||||
{
|
{
|
||||||
if (root == NULL ||
|
if (root == NULL ||
|
||||||
(TypeInfo::m_Types[i]->IsDescendantOf (root) &&
|
(TypeInfo::m_Types[i]->IsDescendantOf (root) &&
|
||||||
|
|
|
@ -169,9 +169,16 @@ struct TypeInfo
|
||||||
static const TypeInfo *FindType (const char *name);
|
static const TypeInfo *FindType (const char *name);
|
||||||
static const TypeInfo *IFindType (const char *name);
|
static const TypeInfo *IFindType (const char *name);
|
||||||
|
|
||||||
static unsigned short m_NumTypes, m_MaxTypes;
|
// The DeletingArray deletes all the TypeInfos it points to
|
||||||
static TypeInfo **m_Types;
|
// when it gets destroyed.
|
||||||
static TArray<TypeInfo *> m_RuntimeActors;
|
class DeletingArray : public TArray<TypeInfo *>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
~DeletingArray();
|
||||||
|
};
|
||||||
|
|
||||||
|
static TArray<TypeInfo *> m_Types;
|
||||||
|
static DeletingArray m_RuntimeActors;
|
||||||
|
|
||||||
enum { HASH_SIZE = 256 };
|
enum { HASH_SIZE = 256 };
|
||||||
static unsigned int TypeHash[HASH_SIZE];
|
static unsigned int TypeHash[HASH_SIZE];
|
||||||
|
@ -344,7 +351,7 @@ private:
|
||||||
void RemoveFromArray ();
|
void RemoveFromArray ();
|
||||||
|
|
||||||
static bool Inactive;
|
static bool Inactive;
|
||||||
unsigned int Index;
|
size_t Index;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //__DOBJECT_H__
|
#endif //__DOBJECT_H__
|
||||||
|
|
|
@ -547,7 +547,7 @@ FPNGChunkFile::FPNGChunkFile (FILE *file, DWORD id)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
FPNGChunkFile::FPNGChunkFile (FILE *file, DWORD id, unsigned int chunklen)
|
FPNGChunkFile::FPNGChunkFile (FILE *file, DWORD id, size_t chunklen)
|
||||||
: FCompressedFile (file, EReading, true, false), m_ChunkID (id)
|
: FCompressedFile (file, EReading, true, false), m_ChunkID (id)
|
||||||
{
|
{
|
||||||
m_Buffer = (byte *)M_Malloc (chunklen);
|
m_Buffer = (byte *)M_Malloc (chunklen);
|
||||||
|
@ -588,7 +588,7 @@ FPNGChunkArchive::FPNGChunkArchive (FILE *file, DWORD id)
|
||||||
AttachToFile (Chunk);
|
AttachToFile (Chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
FPNGChunkArchive::FPNGChunkArchive (FILE *file, DWORD id, unsigned int len)
|
FPNGChunkArchive::FPNGChunkArchive (FILE *file, DWORD id, size_t len)
|
||||||
: FArchive (), Chunk (file, id, len)
|
: FArchive (), Chunk (file, id, len)
|
||||||
{
|
{
|
||||||
AttachToFile (Chunk);
|
AttachToFile (Chunk);
|
||||||
|
@ -636,8 +636,8 @@ void FArchive::AttachToFile (FFile &file)
|
||||||
}
|
}
|
||||||
m_Persistent = file.IsPersistent();
|
m_Persistent = file.IsPersistent();
|
||||||
m_TypeMap = NULL;
|
m_TypeMap = NULL;
|
||||||
m_TypeMap = new TypeMap[TypeInfo::m_NumTypes];
|
m_TypeMap = new TypeMap[TypeInfo::m_Types.Size()];
|
||||||
for (i = 0; i < TypeInfo::m_NumTypes; i++)
|
for (i = 0; i < TypeInfo::m_Types.Size(); i++)
|
||||||
{
|
{
|
||||||
m_TypeMap[i].toArchive = TypeMap::NO_INDEX;
|
m_TypeMap[i].toArchive = TypeMap::NO_INDEX;
|
||||||
m_TypeMap[i].toCurrent = NULL;
|
m_TypeMap[i].toCurrent = NULL;
|
||||||
|
@ -1291,10 +1291,10 @@ DWORD FArchive::FindName (const char *name, unsigned int bucket) const
|
||||||
|
|
||||||
DWORD FArchive::WriteClass (const TypeInfo *info)
|
DWORD FArchive::WriteClass (const TypeInfo *info)
|
||||||
{
|
{
|
||||||
if (m_ClassCount >= TypeInfo::m_NumTypes)
|
if (m_ClassCount >= TypeInfo::m_Types.Size())
|
||||||
{
|
{
|
||||||
I_Error ("Too many unique classes have been written.\nOnly %u were registered\n",
|
I_Error ("Too many unique classes have been written.\nOnly %u were registered\n",
|
||||||
TypeInfo::m_NumTypes);
|
TypeInfo::m_Types.Size());
|
||||||
}
|
}
|
||||||
if (m_TypeMap[info->TypeIndex].toArchive != TypeMap::NO_INDEX)
|
if (m_TypeMap[info->TypeIndex].toArchive != TypeMap::NO_INDEX)
|
||||||
{
|
{
|
||||||
|
@ -1315,13 +1315,13 @@ const TypeInfo *FArchive::ReadClass ()
|
||||||
} typeName;
|
} typeName;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (m_ClassCount >= TypeInfo::m_NumTypes)
|
if (m_ClassCount >= TypeInfo::m_Types.Size())
|
||||||
{
|
{
|
||||||
I_Error ("Too many unique classes have been read.\nOnly %u were registered\n",
|
I_Error ("Too many unique classes have been read.\nOnly %u were registered\n",
|
||||||
TypeInfo::m_NumTypes);
|
TypeInfo::m_Types.Size());
|
||||||
}
|
}
|
||||||
operator<< (typeName.val);
|
operator<< (typeName.val);
|
||||||
for (i = 0; i < TypeInfo::m_NumTypes; i++)
|
for (i = 0; i < TypeInfo::m_Types.Size(); i++)
|
||||||
{
|
{
|
||||||
if (!strcmp (TypeInfo::m_Types[i]->Name, typeName.val))
|
if (!strcmp (TypeInfo::m_Types[i]->Name, typeName.val))
|
||||||
{
|
{
|
||||||
|
|
|
@ -127,10 +127,8 @@ void *statcopy; // for statistics driver
|
||||||
|
|
||||||
level_locals_t level; // info about current level
|
level_locals_t level; // info about current level
|
||||||
|
|
||||||
static cluster_info_t *wadclusterinfos;
|
static TArray<cluster_info_t> wadclusterinfos;
|
||||||
static int numwadclusterinfos = 0;
|
TArray<level_info_t> wadlevelinfos;
|
||||||
level_info_t *wadlevelinfos;
|
|
||||||
int numwadlevelinfos = 0;
|
|
||||||
|
|
||||||
// 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;
|
||||||
|
@ -394,9 +392,7 @@ static void ParseMapInfoLower (MapInfoHandler *handlers,
|
||||||
|
|
||||||
static int FindWadLevelInfo (char *name)
|
static int FindWadLevelInfo (char *name)
|
||||||
{
|
{
|
||||||
int i;
|
for (unsigned int i = 0; i < wadlevelinfos.Size(); i++)
|
||||||
|
|
||||||
for (i = 0; i < numwadlevelinfos; i++)
|
|
||||||
if (!strnicmp (name, wadlevelinfos[i].mapname, 8))
|
if (!strnicmp (name, wadlevelinfos[i].mapname, 8))
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
|
@ -405,9 +401,7 @@ static int FindWadLevelInfo (char *name)
|
||||||
|
|
||||||
static int FindWadClusterInfo (int cluster)
|
static int FindWadClusterInfo (int cluster)
|
||||||
{
|
{
|
||||||
int i;
|
for (unsigned int i = 0; i < wadclusterinfos.Size(); i++)
|
||||||
|
|
||||||
for (i = 0; i < numwadclusterinfos; i++)
|
|
||||||
if (wadclusterinfos[i].cluster == cluster)
|
if (wadclusterinfos[i].cluster == cluster)
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
|
@ -536,10 +530,9 @@ static void G_DoParseMapInfo (int lump)
|
||||||
levelindex = FindWadLevelInfo (sc_String);
|
levelindex = FindWadLevelInfo (sc_String);
|
||||||
if (levelindex == -1)
|
if (levelindex == -1)
|
||||||
{
|
{
|
||||||
levelindex = numwadlevelinfos++;
|
levelindex = wadlevelinfos.Reserve(1);
|
||||||
wadlevelinfos = (level_info_t *)M_Realloc (wadlevelinfos, sizeof(level_info_t)*numwadlevelinfos);
|
|
||||||
}
|
}
|
||||||
levelinfo = wadlevelinfos + levelindex;
|
levelinfo = &wadlevelinfos[levelindex];
|
||||||
memcpy (levelinfo, &defaultinfo, sizeof(*levelinfo));
|
memcpy (levelinfo, &defaultinfo, sizeof(*levelinfo));
|
||||||
if (HexenHack)
|
if (HexenHack)
|
||||||
{
|
{
|
||||||
|
@ -601,13 +594,12 @@ static void G_DoParseMapInfo (int lump)
|
||||||
clusterindex = FindWadClusterInfo (sc_Number);
|
clusterindex = FindWadClusterInfo (sc_Number);
|
||||||
if (clusterindex == -1)
|
if (clusterindex == -1)
|
||||||
{
|
{
|
||||||
clusterindex = numwadclusterinfos++;
|
clusterindex = wadclusterinfos.Reserve(1);
|
||||||
wadclusterinfos = (cluster_info_t *)M_Realloc (wadclusterinfos, sizeof(cluster_info_t)*numwadclusterinfos);
|
clusterinfo = &wadclusterinfos[clusterindex];
|
||||||
clusterinfo = wadclusterinfos + clusterindex;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
clusterinfo = wadclusterinfos + clusterindex;
|
clusterinfo = &wadclusterinfos[clusterindex];
|
||||||
if (clusterinfo->entertext != NULL)
|
if (clusterinfo->entertext != NULL)
|
||||||
{
|
{
|
||||||
delete[] clusterinfo->entertext;
|
delete[] clusterinfo->entertext;
|
||||||
|
@ -835,9 +827,8 @@ static void ParseMapInfoLower (MapInfoHandler *handlers,
|
||||||
// depending on the check done.
|
// depending on the check done.
|
||||||
if (FindWadClusterInfo (sc_Number) == -1)
|
if (FindWadClusterInfo (sc_Number) == -1)
|
||||||
{
|
{
|
||||||
int clusterindex = numwadclusterinfos++;
|
unsigned int clusterindex = wadclusterinfos.Reserve(1);
|
||||||
wadclusterinfos = (cluster_info_t *)M_Realloc (wadclusterinfos, sizeof(cluster_info_t)*numwadclusterinfos);
|
clusterinfo = &wadclusterinfos[clusterindex];
|
||||||
clusterinfo = wadclusterinfos + clusterindex;
|
|
||||||
memset (clusterinfo, 0, sizeof(cluster_info_t));
|
memset (clusterinfo, 0, sizeof(cluster_info_t));
|
||||||
clusterinfo->cluster = sc_Number;
|
clusterinfo->cluster = sc_Number;
|
||||||
if (gameinfo.gametype == GAME_Hexen)
|
if (gameinfo.gametype == GAME_Hexen)
|
||||||
|
@ -1105,11 +1096,9 @@ void G_SetForEndGame (char *nextmap)
|
||||||
|
|
||||||
level_info_t *FindLevelByWarpTrans (int num)
|
level_info_t *FindLevelByWarpTrans (int num)
|
||||||
{
|
{
|
||||||
int i;
|
for (unsigned i = wadlevelinfos.Size(); i-- != 0; )
|
||||||
|
|
||||||
for (i = numwadlevelinfos - 1; i >= 0; --i)
|
|
||||||
if (wadlevelinfos[i].WarpTrans == num)
|
if (wadlevelinfos[i].WarpTrans == num)
|
||||||
return (level_info_t *)(wadlevelinfos + i);
|
return &wadlevelinfos[i];
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1126,10 +1115,8 @@ static void zapDefereds (acsdefered_t *def)
|
||||||
|
|
||||||
void P_RemoveDefereds (void)
|
void P_RemoveDefereds (void)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
// Remove any existing defereds
|
// Remove any existing defereds
|
||||||
for (i = 0; i < numwadlevelinfos; i++)
|
for (unsigned int i = 0; i < wadlevelinfos.Size(); i++)
|
||||||
{
|
{
|
||||||
if (wadlevelinfos[i].defered)
|
if (wadlevelinfos[i].defered)
|
||||||
{
|
{
|
||||||
|
@ -1244,7 +1231,7 @@ void G_InitNew (char *mapname, bool bTitleLevel)
|
||||||
// [RH] Mark all levels as not visited
|
// [RH] Mark all levels as not visited
|
||||||
if (!savegamerestore)
|
if (!savegamerestore)
|
||||||
{
|
{
|
||||||
for (i = 0; i < numwadlevelinfos; i++)
|
for (unsigned int i = 0; i < wadlevelinfos.Size(); i++)
|
||||||
wadlevelinfos[i].flags = wadlevelinfos[i].flags & ~LEVEL_VISITED;
|
wadlevelinfos[i].flags = wadlevelinfos[i].flags & ~LEVEL_VISITED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2080,18 +2067,16 @@ level_info_t *FindLevelInfo (char *mapname)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ((i = FindWadLevelInfo (mapname)) > -1)
|
if ((i = FindWadLevelInfo (mapname)) > -1)
|
||||||
return (level_info_t *)(wadlevelinfos + i);
|
return &wadlevelinfos[i];
|
||||||
else
|
else
|
||||||
return &TheDefaultLevelInfo;
|
return &TheDefaultLevelInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
level_info_t *FindLevelByNum (int num)
|
level_info_t *FindLevelByNum (int num)
|
||||||
{
|
{
|
||||||
int i;
|
for (unsigned int i = 0; i < wadlevelinfos.Size(); i++)
|
||||||
|
|
||||||
for (i = 0; i < numwadlevelinfos; i++)
|
|
||||||
if (wadlevelinfos[i].levelnum == num)
|
if (wadlevelinfos[i].levelnum == num)
|
||||||
return (level_info_t *)(wadlevelinfos + i);
|
return &wadlevelinfos[i];
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -2119,7 +2104,7 @@ level_info_t *CheckLevelRedirect (level_info_t *info)
|
||||||
static void SetLevelNum (level_info_t *info, int num)
|
static void SetLevelNum (level_info_t *info, int num)
|
||||||
{
|
{
|
||||||
// Avoid duplicate levelnums. The level being set always has precedence.
|
// Avoid duplicate levelnums. The level being set always has precedence.
|
||||||
for (int i = 0; i < numwadlevelinfos; ++i)
|
for (unsigned int i = 0; i < wadlevelinfos.Size(); ++i)
|
||||||
{
|
{
|
||||||
if (wadlevelinfos[i].levelnum == num)
|
if (wadlevelinfos[i].levelnum == num)
|
||||||
wadlevelinfos[i].levelnum = 0;
|
wadlevelinfos[i].levelnum = 0;
|
||||||
|
@ -2132,7 +2117,7 @@ cluster_info_t *FindClusterInfo (int cluster)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ((i = FindWadClusterInfo (cluster)) > -1)
|
if ((i = FindWadClusterInfo (cluster)) > -1)
|
||||||
return wadclusterinfos + i;
|
return &wadclusterinfos[i];
|
||||||
else
|
else
|
||||||
return &TheDefaultClusterInfo;
|
return &TheDefaultClusterInfo;
|
||||||
}
|
}
|
||||||
|
@ -2461,9 +2446,7 @@ void G_UnSnapshotLevel (bool hubLoad)
|
||||||
|
|
||||||
void G_ClearSnapshots (void)
|
void G_ClearSnapshots (void)
|
||||||
{
|
{
|
||||||
int i;
|
for (unsigned int i = 0; i < wadlevelinfos.Size(); i++)
|
||||||
|
|
||||||
for (i = 0; i < numwadlevelinfos; i++)
|
|
||||||
{
|
{
|
||||||
if (wadlevelinfos[i].snapshot)
|
if (wadlevelinfos[i].snapshot)
|
||||||
{
|
{
|
||||||
|
@ -2497,9 +2480,9 @@ static void writeSnapShot (FArchive &arc, level_info_t *i)
|
||||||
|
|
||||||
void G_WriteSnapshots (FILE *file)
|
void G_WriteSnapshots (FILE *file)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < numwadlevelinfos; i++)
|
for (i = 0; i < wadlevelinfos.Size(); i++)
|
||||||
{
|
{
|
||||||
if (wadlevelinfos[i].snapshot)
|
if (wadlevelinfos[i].snapshot)
|
||||||
{
|
{
|
||||||
|
@ -2511,7 +2494,7 @@ void G_WriteSnapshots (FILE *file)
|
||||||
FPNGChunkArchive *arc = NULL;
|
FPNGChunkArchive *arc = NULL;
|
||||||
|
|
||||||
// Write out which levels have been visited
|
// Write out which levels have been visited
|
||||||
for (i = 0; i < numwadlevelinfos; ++i)
|
for (i = 0; i < wadlevelinfos.Size(); ++i)
|
||||||
{
|
{
|
||||||
if (wadlevelinfos[i].flags & LEVEL_VISITED)
|
if (wadlevelinfos[i].flags & LEVEL_VISITED)
|
||||||
{
|
{
|
||||||
|
@ -2638,9 +2621,8 @@ static void writeDefereds (FArchive &arc, level_info_t *i)
|
||||||
void P_WriteACSDefereds (FILE *file)
|
void P_WriteACSDefereds (FILE *file)
|
||||||
{
|
{
|
||||||
FPNGChunkArchive *arc = NULL;
|
FPNGChunkArchive *arc = NULL;
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < numwadlevelinfos; i++)
|
for (unsigned int i = 0; i < wadlevelinfos.Size(); i++)
|
||||||
{
|
{
|
||||||
if (wadlevelinfos[i].defered)
|
if (wadlevelinfos[i].defered)
|
||||||
{
|
{
|
||||||
|
|
|
@ -274,8 +274,7 @@ typedef struct cluster_info_s cluster_info_t;
|
||||||
|
|
||||||
extern level_locals_t level;
|
extern level_locals_t level;
|
||||||
|
|
||||||
extern level_info_t *wadlevelinfos;
|
extern TArray<level_info_t> wadlevelinfos;
|
||||||
extern int numwadlevelinfos;
|
|
||||||
|
|
||||||
extern SDWORD ACS_WorldVars[NUM_WORLDVARS];
|
extern SDWORD ACS_WorldVars[NUM_WORLDVARS];
|
||||||
extern SDWORD ACS_GlobalVars[NUM_GLOBALVARS];
|
extern SDWORD ACS_GlobalVars[NUM_GLOBALVARS];
|
||||||
|
|
|
@ -309,7 +309,7 @@ static void ParseLock()
|
||||||
static void ClearLocks()
|
static void ClearLocks()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i=0;i<TypeInfo::m_NumTypes;i++)
|
for(i=0;i<TypeInfo::m_Types.Size();i++)
|
||||||
{
|
{
|
||||||
if (TypeInfo::m_Types[i]->IsDescendantOf(RUNTIME_CLASS(AKey)))
|
if (TypeInfo::m_Types[i]->IsDescendantOf(RUNTIME_CLASS(AKey)))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1893,7 +1893,7 @@ AInventory *ABackpack::CreateCopy (AActor *other)
|
||||||
{
|
{
|
||||||
// Find every unique type of ammo. Give it to the player if
|
// Find every unique type of ammo. Give it to the player if
|
||||||
// he doesn't have it already, and double it's maximum capacity.
|
// he doesn't have it already, and double it's maximum capacity.
|
||||||
for (int i = 0; i < TypeInfo::m_NumTypes; ++i)
|
for (unsigned int i = 0; i < TypeInfo::m_Types.Size(); ++i)
|
||||||
{
|
{
|
||||||
const TypeInfo *type = TypeInfo::m_Types[i];
|
const TypeInfo *type = TypeInfo::m_Types[i];
|
||||||
|
|
||||||
|
|
|
@ -356,7 +356,7 @@ static int STACK_ARGS sortnums (const void *a, const void *b)
|
||||||
|
|
||||||
void FDoomEdMap::DumpMapThings ()
|
void FDoomEdMap::DumpMapThings ()
|
||||||
{
|
{
|
||||||
TArray<EdSorting> infos (TypeInfo::m_NumTypes);
|
TArray<EdSorting> infos (TypeInfo::m_Types.Size());
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < DOOMED_HASHSIZE; ++i)
|
for (i = 0; i < DOOMED_HASHSIZE; ++i)
|
||||||
|
|
|
@ -518,7 +518,7 @@ void cht_Give (player_t *player, char *name, int amount)
|
||||||
{
|
{
|
||||||
// Find every unique type of ammo. Give it to the player if
|
// Find every unique type of ammo. Give it to the player if
|
||||||
// he doesn't have it already, and set each to its maximum.
|
// he doesn't have it already, and set each to its maximum.
|
||||||
for (int i = 0; i < TypeInfo::m_NumTypes; ++i)
|
for (unsigned int i = 0; i < TypeInfo::m_Types.Size(); ++i)
|
||||||
{
|
{
|
||||||
const TypeInfo *type = TypeInfo::m_Types[i];
|
const TypeInfo *type = TypeInfo::m_Types[i];
|
||||||
|
|
||||||
|
@ -574,7 +574,7 @@ void cht_Give (player_t *player, char *name, int amount)
|
||||||
|
|
||||||
if (giveall || stricmp (name, "keys") == 0)
|
if (giveall || stricmp (name, "keys") == 0)
|
||||||
{
|
{
|
||||||
for (i = 0; i < TypeInfo::m_NumTypes; ++i)
|
for (unsigned int i = 0; i < TypeInfo::m_Types.Size(); ++i)
|
||||||
{
|
{
|
||||||
if (TypeInfo::m_Types[i]->IsDescendantOf (RUNTIME_CLASS(AKey)))
|
if (TypeInfo::m_Types[i]->IsDescendantOf (RUNTIME_CLASS(AKey)))
|
||||||
{
|
{
|
||||||
|
@ -596,7 +596,7 @@ void cht_Give (player_t *player, char *name, int amount)
|
||||||
if (giveall || stricmp (name, "weapons") == 0)
|
if (giveall || stricmp (name, "weapons") == 0)
|
||||||
{
|
{
|
||||||
AWeapon *savedpending = player->PendingWeapon;
|
AWeapon *savedpending = player->PendingWeapon;
|
||||||
for (i = 0; i < TypeInfo::m_NumTypes; ++i)
|
for (unsigned int i = 0; i < TypeInfo::m_Types.Size(); ++i)
|
||||||
{
|
{
|
||||||
type = TypeInfo::m_Types[i];
|
type = TypeInfo::m_Types[i];
|
||||||
if (type != RUNTIME_CLASS(AWeapon) &&
|
if (type != RUNTIME_CLASS(AWeapon) &&
|
||||||
|
@ -617,7 +617,7 @@ void cht_Give (player_t *player, char *name, int amount)
|
||||||
|
|
||||||
if (giveall || stricmp (name, "artifacts") == 0)
|
if (giveall || stricmp (name, "artifacts") == 0)
|
||||||
{
|
{
|
||||||
for (i = 0; i < TypeInfo::m_NumTypes; ++i)
|
for (unsigned int i = 0; i < TypeInfo::m_Types.Size(); ++i)
|
||||||
{
|
{
|
||||||
type = TypeInfo::m_Types[i];
|
type = TypeInfo::m_Types[i];
|
||||||
if (type->IsDescendantOf (RUNTIME_CLASS(AInventory)))
|
if (type->IsDescendantOf (RUNTIME_CLASS(AInventory)))
|
||||||
|
@ -638,7 +638,7 @@ void cht_Give (player_t *player, char *name, int amount)
|
||||||
|
|
||||||
if (giveall || stricmp (name, "puzzlepieces") == 0)
|
if (giveall || stricmp (name, "puzzlepieces") == 0)
|
||||||
{
|
{
|
||||||
for (i = 0; i < TypeInfo::m_NumTypes; ++i)
|
for (unsigned int i = 0; i < TypeInfo::m_Types.Size(); ++i)
|
||||||
{
|
{
|
||||||
type = TypeInfo::m_Types[i];
|
type = TypeInfo::m_Types[i];
|
||||||
if (type->IsDescendantOf (RUNTIME_CLASS(APuzzleItem)))
|
if (type->IsDescendantOf (RUNTIME_CLASS(APuzzleItem)))
|
||||||
|
|
|
@ -296,13 +296,13 @@ static long ParseCommandLine (const char *args, int *argc, char **argv)
|
||||||
|
|
||||||
|
|
||||||
#ifdef unix
|
#ifdef unix
|
||||||
zstring GetUserFile (const char *file, bool nodir)
|
FString GetUserFile (const char *file, bool nodir)
|
||||||
{
|
{
|
||||||
char *home = getenv ("HOME");
|
char *home = getenv ("HOME");
|
||||||
if (home == NULL || *home == '\0')
|
if (home == NULL || *home == '\0')
|
||||||
I_FatalError ("Please set your HOME environment variable");
|
I_FatalError ("Please set your HOME environment variable");
|
||||||
|
|
||||||
zstring path = home;
|
FString path = home;
|
||||||
if (path[path.Len()-1] != '/')
|
if (path[path.Len()-1] != '/')
|
||||||
path += nodir ? "/" : "/.zdoom";
|
path += nodir ? "/" : "/.zdoom";
|
||||||
else if (!nodir)
|
else if (!nodir)
|
||||||
|
|
|
@ -3445,7 +3445,7 @@ void P_SpawnPlayer (mapthing2_t *mthing)
|
||||||
// give all cards in death match mode
|
// give all cards in death match mode
|
||||||
if (deathmatch)
|
if (deathmatch)
|
||||||
{
|
{
|
||||||
for (i = 0; i < TypeInfo::m_NumTypes; ++i)
|
for (i = 0; i < TypeInfo::m_Types.Size(); ++i)
|
||||||
{
|
{
|
||||||
if (TypeInfo::m_Types[i]->IsDescendantOf (RUNTIME_CLASS(AKey)))
|
if (TypeInfo::m_Types[i]->IsDescendantOf (RUNTIME_CLASS(AKey)))
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,7 +83,7 @@ drawseg_t *drawsegs;
|
||||||
drawseg_t* firstdrawseg;
|
drawseg_t* firstdrawseg;
|
||||||
drawseg_t* ds_p;
|
drawseg_t* ds_p;
|
||||||
|
|
||||||
unsigned int FirstInterestingDrawseg;
|
size_t FirstInterestingDrawseg;
|
||||||
TArray<size_t> InterestingDrawsegs;
|
TArray<size_t> InterestingDrawsegs;
|
||||||
|
|
||||||
fixed_t WallTX1, WallTX2; // x coords at left, right of wall in view space
|
fixed_t WallTX1, WallTX2; // x coords at left, right of wall in view space
|
||||||
|
|
|
@ -58,7 +58,7 @@ extern drawseg_t *firstdrawseg;
|
||||||
extern drawseg_t* ds_p;
|
extern drawseg_t* ds_p;
|
||||||
|
|
||||||
extern TArray<size_t> InterestingDrawsegs; // drawsegs that have something drawn on them
|
extern TArray<size_t> InterestingDrawsegs; // drawsegs that have something drawn on them
|
||||||
extern unsigned int FirstInterestingDrawseg;
|
extern size_t FirstInterestingDrawseg;
|
||||||
|
|
||||||
extern int WindowLeft, WindowRight;
|
extern int WindowLeft, WindowRight;
|
||||||
extern WORD MirrorFlags;
|
extern WORD MirrorFlags;
|
||||||
|
|
|
@ -1100,6 +1100,7 @@ FPatchTexture::~FPatchTexture ()
|
||||||
if (Spans != NULL)
|
if (Spans != NULL)
|
||||||
{
|
{
|
||||||
FreeSpans (Spans);
|
FreeSpans (Spans);
|
||||||
|
Spans = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1603,6 +1604,7 @@ FIMGZTexture::~FIMGZTexture ()
|
||||||
if (Spans != NULL)
|
if (Spans != NULL)
|
||||||
{
|
{
|
||||||
FreeSpans (Spans);
|
FreeSpans (Spans);
|
||||||
|
Spans = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1880,10 +1882,12 @@ FPNGTexture::~FPNGTexture ()
|
||||||
if (Spans != NULL)
|
if (Spans != NULL)
|
||||||
{
|
{
|
||||||
FreeSpans (Spans);
|
FreeSpans (Spans);
|
||||||
|
Spans = NULL;
|
||||||
}
|
}
|
||||||
if (PaletteMap != NULL && PaletteMap != GrayMap)
|
if (PaletteMap != NULL && PaletteMap != GrayMap)
|
||||||
{
|
{
|
||||||
delete[] PaletteMap;
|
delete[] PaletteMap;
|
||||||
|
PaletteMap = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1993,6 +1997,7 @@ FBuildTexture::~FBuildTexture ()
|
||||||
if (Spans != NULL)
|
if (Spans != NULL)
|
||||||
{
|
{
|
||||||
FreeSpans (Spans);
|
FreeSpans (Spans);
|
||||||
|
Spans = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2143,10 +2148,12 @@ FMultiPatchTexture::~FMultiPatchTexture ()
|
||||||
if (Parts != NULL)
|
if (Parts != NULL)
|
||||||
{
|
{
|
||||||
delete[] Parts;
|
delete[] Parts;
|
||||||
|
Parts = NULL;
|
||||||
}
|
}
|
||||||
if (Spans != NULL)
|
if (Spans != NULL)
|
||||||
{
|
{
|
||||||
FreeSpans (Spans);
|
FreeSpans (Spans);
|
||||||
|
Spans = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2367,6 +2374,11 @@ FWarpTexture::FWarpTexture (FTexture *source)
|
||||||
FWarpTexture::~FWarpTexture ()
|
FWarpTexture::~FWarpTexture ()
|
||||||
{
|
{
|
||||||
Unload ();
|
Unload ();
|
||||||
|
if (Spans != NULL)
|
||||||
|
{
|
||||||
|
FreeSpans (Spans);
|
||||||
|
Spans = NULL;
|
||||||
|
}
|
||||||
delete SourcePic;
|
delete SourcePic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2706,7 +2718,7 @@ void R_InitTextures (void)
|
||||||
// Hexen parallax skies use color 0 to indicate transparency on the front
|
// Hexen parallax skies use color 0 to indicate transparency on the front
|
||||||
// layer, so we must not remap color 0 on these textures. Unfortunately,
|
// layer, so we must not remap color 0 on these textures. Unfortunately,
|
||||||
// the only way to identify these textures is to check the MAPINFO.
|
// the only way to identify these textures is to check the MAPINFO.
|
||||||
for (i = 0; i < numwadlevelinfos; ++i)
|
for (unsigned int i = 0; i < wadlevelinfos.Size(); ++i)
|
||||||
{
|
{
|
||||||
if (wadlevelinfos[i].flags & LEVEL_DOUBLESKY)
|
if (wadlevelinfos[i].flags & LEVEL_DOUBLESKY)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1034,7 +1034,7 @@ void R_DrawSkyBoxes ()
|
||||||
ptrdiff_t savedvissprite_p = vissprite_p - vissprites;
|
ptrdiff_t savedvissprite_p = vissprite_p - vissprites;
|
||||||
ptrdiff_t savedds_p = ds_p - drawsegs;
|
ptrdiff_t savedds_p = ds_p - drawsegs;
|
||||||
ptrdiff_t savedlastopening = lastopening;
|
ptrdiff_t savedlastopening = lastopening;
|
||||||
unsigned int savedinteresting = FirstInterestingDrawseg;
|
size_t savedinteresting = FirstInterestingDrawseg;
|
||||||
float savedvisibility = R_GetVisibility ();
|
float savedvisibility = R_GetVisibility ();
|
||||||
AActor *savedcamera = camera;
|
AActor *savedcamera = camera;
|
||||||
sector_t *savedsector = viewsector;
|
sector_t *savedsector = viewsector;
|
||||||
|
@ -1180,7 +1180,7 @@ void R_DrawSkyBoxes ()
|
||||||
vissprite_p = vissprites + savedvissprite_p;
|
vissprite_p = vissprites + savedvissprite_p;
|
||||||
firstdrawseg = drawsegs;
|
firstdrawseg = drawsegs;
|
||||||
ds_p = drawsegs + savedds_p;
|
ds_p = drawsegs + savedds_p;
|
||||||
InterestingDrawsegs.Resize (FirstInterestingDrawseg);
|
InterestingDrawsegs.Resize ((unsigned int)FirstInterestingDrawseg);
|
||||||
FirstInterestingDrawseg = savedinteresting;
|
FirstInterestingDrawseg = savedinteresting;
|
||||||
|
|
||||||
lastopening = savedlastopening;
|
lastopening = savedlastopening;
|
||||||
|
|
|
@ -382,6 +382,25 @@ 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;
|
||||||
|
|
23
src/tarray.h
23
src/tarray.h
|
@ -125,11 +125,7 @@ public:
|
||||||
}
|
}
|
||||||
unsigned int Push (const T &item)
|
unsigned int Push (const T &item)
|
||||||
{
|
{
|
||||||
if (Count >= Most)
|
Grow (1);
|
||||||
{
|
|
||||||
Most = (Most >= 16) ? Most + Most / 2 : 16;
|
|
||||||
DoResize ();
|
|
||||||
}
|
|
||||||
ConstructInTArray (&Array[Count], item);
|
ConstructInTArray (&Array[Count], item);
|
||||||
return Count++;
|
return Count++;
|
||||||
}
|
}
|
||||||
|
@ -209,7 +205,7 @@ public:
|
||||||
if (Count + amount > Most)
|
if (Count + amount > Most)
|
||||||
{
|
{
|
||||||
const unsigned int choicea = Count + amount;
|
const unsigned int choicea = Count + amount;
|
||||||
const unsigned int choiceb = Most + Most/2;
|
const unsigned int choiceb = Most = (Most >= 16) ? Most + Most / 2 : 16;
|
||||||
Most = (choicea > choiceb ? choicea : choiceb);
|
Most = (choicea > choiceb ? choicea : choiceb);
|
||||||
DoResize ();
|
DoResize ();
|
||||||
}
|
}
|
||||||
|
@ -219,11 +215,17 @@ public:
|
||||||
{
|
{
|
||||||
if (Count < amount)
|
if (Count < amount)
|
||||||
{
|
{
|
||||||
|
// Adding new entries
|
||||||
Grow (amount - Count);
|
Grow (amount - Count);
|
||||||
|
for (unsigned int i = Count; i < amount; ++i)
|
||||||
|
{
|
||||||
|
ConstructEmptyInTArray (&Array[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (unsigned int i = Count; i < amount; ++i)
|
else if (Count != amount)
|
||||||
{
|
{
|
||||||
ConstructEmptyInTArray (&Array[i]);
|
// Deleting old entries
|
||||||
|
DoDelete (amount, Count - 1);
|
||||||
}
|
}
|
||||||
Count = amount;
|
Count = amount;
|
||||||
}
|
}
|
||||||
|
@ -231,10 +233,7 @@ public:
|
||||||
// with them.
|
// with them.
|
||||||
unsigned int Reserve (unsigned int amount)
|
unsigned int Reserve (unsigned int amount)
|
||||||
{
|
{
|
||||||
if (Count + amount > Most)
|
Grow (amount);
|
||||||
{
|
|
||||||
Grow (amount);
|
|
||||||
}
|
|
||||||
unsigned int place = Count;
|
unsigned int place = Count;
|
||||||
Count += amount;
|
Count += amount;
|
||||||
return place;
|
return place;
|
||||||
|
|
|
@ -962,6 +962,7 @@ FFontChar2::~FFontChar2 ()
|
||||||
if (Spans != NULL)
|
if (Spans != NULL)
|
||||||
{
|
{
|
||||||
FreeSpans (Spans);
|
FreeSpans (Spans);
|
||||||
|
Spans = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue