mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 05:01:41 +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
|
||||
- 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
|
||||
actually work.
|
||||
- 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)
|
||||
{
|
||||
if (Bindings[i])
|
||||
{
|
||||
free (Bindings[i]);
|
||||
Bindings[i] = NULL;
|
||||
}
|
||||
if (DoubleBindings[i])
|
||||
{
|
||||
free (DoubleBindings[i]);
|
||||
DoubleBindings[i] = NULL;
|
||||
}
|
||||
Bindings[i] = "";
|
||||
DoubleBindings[i] = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -309,11 +301,7 @@ CCMD (unbind)
|
|||
{
|
||||
if ( (i = GetKeyFromName (argv[1])) )
|
||||
{
|
||||
if (Bindings[i])
|
||||
{
|
||||
free (Bindings[i]);
|
||||
Bindings[i] = NULL;
|
||||
}
|
||||
Bindings[i] = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -338,7 +326,7 @@ CCMD (bind)
|
|||
}
|
||||
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
|
||||
{
|
||||
|
@ -351,8 +339,8 @@ CCMD (bind)
|
|||
|
||||
for (i = 0; i < NUM_KEYS; i++)
|
||||
{
|
||||
if (Bindings[i])
|
||||
Printf ("%s \"%s\"\n", KeyName (i), Bindings[i]);
|
||||
if (!Bindings[i].IsEmpty())
|
||||
Printf ("%s \"%s\"\n", KeyName (i), Bindings[i].GetChars());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -404,11 +392,7 @@ CCMD (undoublebind)
|
|||
{
|
||||
if ( (i = GetKeyFromName (argv[1])) )
|
||||
{
|
||||
if (DoubleBindings[i])
|
||||
{
|
||||
delete[] DoubleBindings[i];
|
||||
DoubleBindings[i] = NULL;
|
||||
}
|
||||
DoubleBindings[i] = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -433,7 +417,7 @@ CCMD (doublebind)
|
|||
}
|
||||
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
|
||||
{
|
||||
|
@ -446,8 +430,8 @@ CCMD (doublebind)
|
|||
|
||||
for (i = 0; i < NUM_KEYS; i++)
|
||||
{
|
||||
if (DoubleBindings[i])
|
||||
Printf ("%s \"%s\"\n", KeyName (i), DoubleBindings[i]);
|
||||
if (!DoubleBindings[i].IsEmpty())
|
||||
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++)
|
||||
{
|
||||
if (bindings[i] && (matchcmd==NULL || stricmp(bindings[i], matchcmd)==0))
|
||||
if (!bindings[i].IsEmpty() && (matchcmd==NULL || stricmp(bindings[i], matchcmd)==0))
|
||||
{
|
||||
name = KeyName (i);
|
||||
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 saving a specific command, remove the old binding
|
||||
// so it does not get saved in the general binding list
|
||||
delete[] Bindings[i];
|
||||
Bindings[i] = NULL;
|
||||
Bindings[i] = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -671,7 +654,7 @@ int C_GetKeysForCommand (char *cmd, int *first, int *second)
|
|||
|
||||
while (i < NUM_KEYS && c < 2)
|
||||
{
|
||||
if (Bindings[i] && stricmp (cmd, Bindings[i]) == 0)
|
||||
if (stricmp (cmd, Bindings[i]) == 0)
|
||||
{
|
||||
if (c++ == 0)
|
||||
*first = i;
|
||||
|
@ -712,10 +695,9 @@ void C_UnbindACommand (char *str)
|
|||
|
||||
for (i = 0; i < NUM_KEYS; i++)
|
||||
{
|
||||
if (Bindings[i] && !stricmp (str, Bindings[i]))
|
||||
if (!stricmp (str, Bindings[i]))
|
||||
{
|
||||
delete[] Bindings[i];
|
||||
Bindings[i] = NULL;
|
||||
Bindings[i] = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -724,10 +706,7 @@ void C_ChangeBinding (const char *str, int newone)
|
|||
{
|
||||
if ((unsigned int)newone < NUM_KEYS)
|
||||
{
|
||||
if (Bindings[newone])
|
||||
delete[] Bindings[newone];
|
||||
|
||||
Bindings[newone] = copystring (str);
|
||||
Bindings[newone] = str;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1336,7 +1336,7 @@ static int PatchAmmo (int ammoNum)
|
|||
// Fix per-ammo/max-ammo amounts for descendants of the base ammo class
|
||||
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];
|
||||
|
||||
|
|
|
@ -1597,7 +1597,7 @@ static EIWADType IdentifyVersion (void)
|
|||
#ifdef unix
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -47,10 +47,8 @@
|
|||
#include "r_state.h"
|
||||
#include "stats.h"
|
||||
|
||||
TArray<TypeInfo *> TypeInfo::m_RuntimeActors;
|
||||
TypeInfo **TypeInfo::m_Types;
|
||||
unsigned short TypeInfo::m_NumTypes;
|
||||
unsigned short TypeInfo::m_MaxTypes;
|
||||
TypeInfo::DeletingArray TypeInfo::m_RuntimeActors;
|
||||
TArray<TypeInfo *> TypeInfo::m_Types (256);
|
||||
unsigned int TypeInfo::TypeHash[256]; // Why can't I use TypeInfo::HASH_SIZE?
|
||||
|
||||
#if defined(_MSC_VER) || defined(__GNUC__)
|
||||
|
@ -79,17 +77,22 @@ TypeInfo DObject::_StaticType(NULL, "DObject", NULL, sizeof(DObject));
|
|||
static cycle_t StaleCycles;
|
||||
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 ()
|
||||
{
|
||||
// Add type to list
|
||||
if (m_NumTypes == m_MaxTypes)
|
||||
{
|
||||
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++;
|
||||
TypeIndex = m_Types.Push (this);
|
||||
|
||||
// Add type to hash table. Types are inserted into each bucket
|
||||
// lexicographically, and the prefix character is ignored.
|
||||
|
@ -150,7 +153,7 @@ const TypeInfo *TypeInfo::IFindType (const char *name)
|
|||
{
|
||||
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)
|
||||
return TypeInfo::m_Types[i];
|
||||
|
@ -434,7 +437,7 @@ CCMD (dumpclasses)
|
|||
}
|
||||
|
||||
shown = omitted = 0;
|
||||
for (i = 0; i < TypeInfo::m_NumTypes; i++)
|
||||
for (i = 0; i < TypeInfo::m_Types.Size(); i++)
|
||||
{
|
||||
if (root == NULL ||
|
||||
(TypeInfo::m_Types[i]->IsDescendantOf (root) &&
|
||||
|
|
|
@ -169,9 +169,16 @@ struct TypeInfo
|
|||
static const TypeInfo *FindType (const char *name);
|
||||
static const TypeInfo *IFindType (const char *name);
|
||||
|
||||
static unsigned short m_NumTypes, m_MaxTypes;
|
||||
static TypeInfo **m_Types;
|
||||
static TArray<TypeInfo *> m_RuntimeActors;
|
||||
// The DeletingArray deletes all the TypeInfos it points to
|
||||
// when it gets destroyed.
|
||||
class DeletingArray : public TArray<TypeInfo *>
|
||||
{
|
||||
public:
|
||||
~DeletingArray();
|
||||
};
|
||||
|
||||
static TArray<TypeInfo *> m_Types;
|
||||
static DeletingArray m_RuntimeActors;
|
||||
|
||||
enum { HASH_SIZE = 256 };
|
||||
static unsigned int TypeHash[HASH_SIZE];
|
||||
|
@ -344,7 +351,7 @@ private:
|
|||
void RemoveFromArray ();
|
||||
|
||||
static bool Inactive;
|
||||
unsigned int Index;
|
||||
size_t Index;
|
||||
};
|
||||
|
||||
#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)
|
||||
{
|
||||
m_Buffer = (byte *)M_Malloc (chunklen);
|
||||
|
@ -588,7 +588,7 @@ FPNGChunkArchive::FPNGChunkArchive (FILE *file, DWORD id)
|
|||
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)
|
||||
{
|
||||
AttachToFile (Chunk);
|
||||
|
@ -636,8 +636,8 @@ void FArchive::AttachToFile (FFile &file)
|
|||
}
|
||||
m_Persistent = file.IsPersistent();
|
||||
m_TypeMap = NULL;
|
||||
m_TypeMap = new TypeMap[TypeInfo::m_NumTypes];
|
||||
for (i = 0; i < TypeInfo::m_NumTypes; i++)
|
||||
m_TypeMap = new TypeMap[TypeInfo::m_Types.Size()];
|
||||
for (i = 0; i < TypeInfo::m_Types.Size(); i++)
|
||||
{
|
||||
m_TypeMap[i].toArchive = TypeMap::NO_INDEX;
|
||||
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)
|
||||
{
|
||||
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",
|
||||
TypeInfo::m_NumTypes);
|
||||
TypeInfo::m_Types.Size());
|
||||
}
|
||||
if (m_TypeMap[info->TypeIndex].toArchive != TypeMap::NO_INDEX)
|
||||
{
|
||||
|
@ -1315,13 +1315,13 @@ const TypeInfo *FArchive::ReadClass ()
|
|||
} typeName;
|
||||
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",
|
||||
TypeInfo::m_NumTypes);
|
||||
TypeInfo::m_Types.Size());
|
||||
}
|
||||
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))
|
||||
{
|
||||
|
|
|
@ -127,10 +127,8 @@ void *statcopy; // for statistics driver
|
|||
|
||||
level_locals_t level; // info about current level
|
||||
|
||||
static cluster_info_t *wadclusterinfos;
|
||||
static int numwadclusterinfos = 0;
|
||||
level_info_t *wadlevelinfos;
|
||||
int numwadlevelinfos = 0;
|
||||
static TArray<cluster_info_t> wadclusterinfos;
|
||||
TArray<level_info_t> wadlevelinfos;
|
||||
|
||||
// MAPINFO is parsed slightly differently when the map name is just a number.
|
||||
static bool HexenHack;
|
||||
|
@ -394,9 +392,7 @@ static void ParseMapInfoLower (MapInfoHandler *handlers,
|
|||
|
||||
static int FindWadLevelInfo (char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < numwadlevelinfos; i++)
|
||||
for (unsigned int i = 0; i < wadlevelinfos.Size(); i++)
|
||||
if (!strnicmp (name, wadlevelinfos[i].mapname, 8))
|
||||
return i;
|
||||
|
||||
|
@ -405,9 +401,7 @@ static int FindWadLevelInfo (char *name)
|
|||
|
||||
static int FindWadClusterInfo (int cluster)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < numwadclusterinfos; i++)
|
||||
for (unsigned int i = 0; i < wadclusterinfos.Size(); i++)
|
||||
if (wadclusterinfos[i].cluster == cluster)
|
||||
return i;
|
||||
|
||||
|
@ -536,10 +530,9 @@ static void G_DoParseMapInfo (int lump)
|
|||
levelindex = FindWadLevelInfo (sc_String);
|
||||
if (levelindex == -1)
|
||||
{
|
||||
levelindex = numwadlevelinfos++;
|
||||
wadlevelinfos = (level_info_t *)M_Realloc (wadlevelinfos, sizeof(level_info_t)*numwadlevelinfos);
|
||||
levelindex = wadlevelinfos.Reserve(1);
|
||||
}
|
||||
levelinfo = wadlevelinfos + levelindex;
|
||||
levelinfo = &wadlevelinfos[levelindex];
|
||||
memcpy (levelinfo, &defaultinfo, sizeof(*levelinfo));
|
||||
if (HexenHack)
|
||||
{
|
||||
|
@ -601,13 +594,12 @@ static void G_DoParseMapInfo (int lump)
|
|||
clusterindex = FindWadClusterInfo (sc_Number);
|
||||
if (clusterindex == -1)
|
||||
{
|
||||
clusterindex = numwadclusterinfos++;
|
||||
wadclusterinfos = (cluster_info_t *)M_Realloc (wadclusterinfos, sizeof(cluster_info_t)*numwadclusterinfos);
|
||||
clusterinfo = wadclusterinfos + clusterindex;
|
||||
clusterindex = wadclusterinfos.Reserve(1);
|
||||
clusterinfo = &wadclusterinfos[clusterindex];
|
||||
}
|
||||
else
|
||||
{
|
||||
clusterinfo = wadclusterinfos + clusterindex;
|
||||
clusterinfo = &wadclusterinfos[clusterindex];
|
||||
if (clusterinfo->entertext != NULL)
|
||||
{
|
||||
delete[] clusterinfo->entertext;
|
||||
|
@ -835,9 +827,8 @@ static void ParseMapInfoLower (MapInfoHandler *handlers,
|
|||
// depending on the check done.
|
||||
if (FindWadClusterInfo (sc_Number) == -1)
|
||||
{
|
||||
int clusterindex = numwadclusterinfos++;
|
||||
wadclusterinfos = (cluster_info_t *)M_Realloc (wadclusterinfos, sizeof(cluster_info_t)*numwadclusterinfos);
|
||||
clusterinfo = wadclusterinfos + clusterindex;
|
||||
unsigned int clusterindex = wadclusterinfos.Reserve(1);
|
||||
clusterinfo = &wadclusterinfos[clusterindex];
|
||||
memset (clusterinfo, 0, sizeof(cluster_info_t));
|
||||
clusterinfo->cluster = sc_Number;
|
||||
if (gameinfo.gametype == GAME_Hexen)
|
||||
|
@ -1105,11 +1096,9 @@ void G_SetForEndGame (char *nextmap)
|
|||
|
||||
level_info_t *FindLevelByWarpTrans (int num)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = numwadlevelinfos - 1; i >= 0; --i)
|
||||
for (unsigned i = wadlevelinfos.Size(); i-- != 0; )
|
||||
if (wadlevelinfos[i].WarpTrans == num)
|
||||
return (level_info_t *)(wadlevelinfos + i);
|
||||
return &wadlevelinfos[i];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1126,10 +1115,8 @@ static void zapDefereds (acsdefered_t *def)
|
|||
|
||||
void P_RemoveDefereds (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
// Remove any existing defereds
|
||||
for (i = 0; i < numwadlevelinfos; i++)
|
||||
for (unsigned int i = 0; i < wadlevelinfos.Size(); i++)
|
||||
{
|
||||
if (wadlevelinfos[i].defered)
|
||||
{
|
||||
|
@ -1244,7 +1231,7 @@ void G_InitNew (char *mapname, bool bTitleLevel)
|
|||
// [RH] Mark all levels as not visited
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -2080,18 +2067,16 @@ level_info_t *FindLevelInfo (char *mapname)
|
|||
int i;
|
||||
|
||||
if ((i = FindWadLevelInfo (mapname)) > -1)
|
||||
return (level_info_t *)(wadlevelinfos + i);
|
||||
return &wadlevelinfos[i];
|
||||
else
|
||||
return &TheDefaultLevelInfo;
|
||||
}
|
||||
|
||||
level_info_t *FindLevelByNum (int num)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < numwadlevelinfos; i++)
|
||||
for (unsigned int i = 0; i < wadlevelinfos.Size(); i++)
|
||||
if (wadlevelinfos[i].levelnum == num)
|
||||
return (level_info_t *)(wadlevelinfos + i);
|
||||
return &wadlevelinfos[i];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2119,7 +2104,7 @@ level_info_t *CheckLevelRedirect (level_info_t *info)
|
|||
static void SetLevelNum (level_info_t *info, int num)
|
||||
{
|
||||
// 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)
|
||||
wadlevelinfos[i].levelnum = 0;
|
||||
|
@ -2132,7 +2117,7 @@ cluster_info_t *FindClusterInfo (int cluster)
|
|||
int i;
|
||||
|
||||
if ((i = FindWadClusterInfo (cluster)) > -1)
|
||||
return wadclusterinfos + i;
|
||||
return &wadclusterinfos[i];
|
||||
else
|
||||
return &TheDefaultClusterInfo;
|
||||
}
|
||||
|
@ -2461,9 +2446,7 @@ void G_UnSnapshotLevel (bool hubLoad)
|
|||
|
||||
void G_ClearSnapshots (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < numwadlevelinfos; i++)
|
||||
for (unsigned int i = 0; i < wadlevelinfos.Size(); i++)
|
||||
{
|
||||
if (wadlevelinfos[i].snapshot)
|
||||
{
|
||||
|
@ -2497,9 +2480,9 @@ static void writeSnapShot (FArchive &arc, level_info_t *i)
|
|||
|
||||
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)
|
||||
{
|
||||
|
@ -2511,7 +2494,7 @@ void G_WriteSnapshots (FILE *file)
|
|||
FPNGChunkArchive *arc = NULL;
|
||||
|
||||
// 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)
|
||||
{
|
||||
|
@ -2638,9 +2621,8 @@ static void writeDefereds (FArchive &arc, level_info_t *i)
|
|||
void P_WriteACSDefereds (FILE *file)
|
||||
{
|
||||
FPNGChunkArchive *arc = NULL;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < numwadlevelinfos; i++)
|
||||
for (unsigned int i = 0; i < wadlevelinfos.Size(); i++)
|
||||
{
|
||||
if (wadlevelinfos[i].defered)
|
||||
{
|
||||
|
|
|
@ -274,8 +274,7 @@ typedef struct cluster_info_s cluster_info_t;
|
|||
|
||||
extern level_locals_t level;
|
||||
|
||||
extern level_info_t *wadlevelinfos;
|
||||
extern int numwadlevelinfos;
|
||||
extern TArray<level_info_t> wadlevelinfos;
|
||||
|
||||
extern SDWORD ACS_WorldVars[NUM_WORLDVARS];
|
||||
extern SDWORD ACS_GlobalVars[NUM_GLOBALVARS];
|
||||
|
|
|
@ -309,7 +309,7 @@ static void ParseLock()
|
|||
static void ClearLocks()
|
||||
{
|
||||
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)))
|
||||
{
|
||||
|
|
|
@ -1893,7 +1893,7 @@ AInventory *ABackpack::CreateCopy (AActor *other)
|
|||
{
|
||||
// Find every unique type of ammo. Give it to the player if
|
||||
// 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];
|
||||
|
||||
|
|
|
@ -356,7 +356,7 @@ static int STACK_ARGS sortnums (const void *a, const void *b)
|
|||
|
||||
void FDoomEdMap::DumpMapThings ()
|
||||
{
|
||||
TArray<EdSorting> infos (TypeInfo::m_NumTypes);
|
||||
TArray<EdSorting> infos (TypeInfo::m_Types.Size());
|
||||
int 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
|
||||
// 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];
|
||||
|
||||
|
@ -574,7 +574,7 @@ void cht_Give (player_t *player, char *name, int amount)
|
|||
|
||||
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)))
|
||||
{
|
||||
|
@ -596,7 +596,7 @@ void cht_Give (player_t *player, char *name, int amount)
|
|||
if (giveall || stricmp (name, "weapons") == 0)
|
||||
{
|
||||
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];
|
||||
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)
|
||||
{
|
||||
for (i = 0; i < TypeInfo::m_NumTypes; ++i)
|
||||
for (unsigned int i = 0; i < TypeInfo::m_Types.Size(); ++i)
|
||||
{
|
||||
type = TypeInfo::m_Types[i];
|
||||
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)
|
||||
{
|
||||
for (i = 0; i < TypeInfo::m_NumTypes; ++i)
|
||||
for (unsigned int i = 0; i < TypeInfo::m_Types.Size(); ++i)
|
||||
{
|
||||
type = TypeInfo::m_Types[i];
|
||||
if (type->IsDescendantOf (RUNTIME_CLASS(APuzzleItem)))
|
||||
|
|
|
@ -296,13 +296,13 @@ static long ParseCommandLine (const char *args, int *argc, char **argv)
|
|||
|
||||
|
||||
#ifdef unix
|
||||
zstring GetUserFile (const char *file, bool nodir)
|
||||
FString GetUserFile (const char *file, bool nodir)
|
||||
{
|
||||
char *home = getenv ("HOME");
|
||||
if (home == NULL || *home == '\0')
|
||||
I_FatalError ("Please set your HOME environment variable");
|
||||
|
||||
zstring path = home;
|
||||
FString path = home;
|
||||
if (path[path.Len()-1] != '/')
|
||||
path += nodir ? "/" : "/.zdoom";
|
||||
else if (!nodir)
|
||||
|
|
|
@ -3445,7 +3445,7 @@ void P_SpawnPlayer (mapthing2_t *mthing)
|
|||
// give all cards in death match mode
|
||||
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)))
|
||||
{
|
||||
|
|
|
@ -83,7 +83,7 @@ drawseg_t *drawsegs;
|
|||
drawseg_t* firstdrawseg;
|
||||
drawseg_t* ds_p;
|
||||
|
||||
unsigned int FirstInterestingDrawseg;
|
||||
size_t FirstInterestingDrawseg;
|
||||
TArray<size_t> InterestingDrawsegs;
|
||||
|
||||
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 TArray<size_t> InterestingDrawsegs; // drawsegs that have something drawn on them
|
||||
extern unsigned int FirstInterestingDrawseg;
|
||||
extern size_t FirstInterestingDrawseg;
|
||||
|
||||
extern int WindowLeft, WindowRight;
|
||||
extern WORD MirrorFlags;
|
||||
|
|
|
@ -1100,6 +1100,7 @@ FPatchTexture::~FPatchTexture ()
|
|||
if (Spans != NULL)
|
||||
{
|
||||
FreeSpans (Spans);
|
||||
Spans = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1603,6 +1604,7 @@ FIMGZTexture::~FIMGZTexture ()
|
|||
if (Spans != NULL)
|
||||
{
|
||||
FreeSpans (Spans);
|
||||
Spans = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1880,10 +1882,12 @@ FPNGTexture::~FPNGTexture ()
|
|||
if (Spans != NULL)
|
||||
{
|
||||
FreeSpans (Spans);
|
||||
Spans = NULL;
|
||||
}
|
||||
if (PaletteMap != NULL && PaletteMap != GrayMap)
|
||||
{
|
||||
delete[] PaletteMap;
|
||||
PaletteMap = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1993,6 +1997,7 @@ FBuildTexture::~FBuildTexture ()
|
|||
if (Spans != NULL)
|
||||
{
|
||||
FreeSpans (Spans);
|
||||
Spans = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2143,10 +2148,12 @@ FMultiPatchTexture::~FMultiPatchTexture ()
|
|||
if (Parts != NULL)
|
||||
{
|
||||
delete[] Parts;
|
||||
Parts = NULL;
|
||||
}
|
||||
if (Spans != NULL)
|
||||
{
|
||||
FreeSpans (Spans);
|
||||
Spans = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2367,6 +2374,11 @@ FWarpTexture::FWarpTexture (FTexture *source)
|
|||
FWarpTexture::~FWarpTexture ()
|
||||
{
|
||||
Unload ();
|
||||
if (Spans != NULL)
|
||||
{
|
||||
FreeSpans (Spans);
|
||||
Spans = NULL;
|
||||
}
|
||||
delete SourcePic;
|
||||
}
|
||||
|
||||
|
@ -2706,7 +2718,7 @@ void R_InitTextures (void)
|
|||
// Hexen parallax skies use color 0 to indicate transparency on the front
|
||||
// layer, so we must not remap color 0 on these textures. Unfortunately,
|
||||
// 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)
|
||||
{
|
||||
|
|
|
@ -1034,7 +1034,7 @@ void R_DrawSkyBoxes ()
|
|||
ptrdiff_t savedvissprite_p = vissprite_p - vissprites;
|
||||
ptrdiff_t savedds_p = ds_p - drawsegs;
|
||||
ptrdiff_t savedlastopening = lastopening;
|
||||
unsigned int savedinteresting = FirstInterestingDrawseg;
|
||||
size_t savedinteresting = FirstInterestingDrawseg;
|
||||
float savedvisibility = R_GetVisibility ();
|
||||
AActor *savedcamera = camera;
|
||||
sector_t *savedsector = viewsector;
|
||||
|
@ -1180,7 +1180,7 @@ void R_DrawSkyBoxes ()
|
|||
vissprite_p = vissprites + savedvissprite_p;
|
||||
firstdrawseg = drawsegs;
|
||||
ds_p = drawsegs + savedds_p;
|
||||
InterestingDrawsegs.Resize (FirstInterestingDrawseg);
|
||||
InterestingDrawsegs.Resize ((unsigned int)FirstInterestingDrawseg);
|
||||
FirstInterestingDrawseg = savedinteresting;
|
||||
|
||||
lastopening = savedlastopening;
|
||||
|
|
|
@ -382,6 +382,25 @@ ReverbContainer *DefaultEnvironments[26] =
|
|||
|
||||
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 *probe = Environments;
|
||||
|
|
23
src/tarray.h
23
src/tarray.h
|
@ -125,11 +125,7 @@ public:
|
|||
}
|
||||
unsigned int Push (const T &item)
|
||||
{
|
||||
if (Count >= Most)
|
||||
{
|
||||
Most = (Most >= 16) ? Most + Most / 2 : 16;
|
||||
DoResize ();
|
||||
}
|
||||
Grow (1);
|
||||
ConstructInTArray (&Array[Count], item);
|
||||
return Count++;
|
||||
}
|
||||
|
@ -209,7 +205,7 @@ public:
|
|||
if (Count + amount > Most)
|
||||
{
|
||||
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);
|
||||
DoResize ();
|
||||
}
|
||||
|
@ -219,11 +215,17 @@ public:
|
|||
{
|
||||
if (Count < amount)
|
||||
{
|
||||
// Adding new entries
|
||||
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;
|
||||
}
|
||||
|
@ -231,10 +233,7 @@ public:
|
|||
// with them.
|
||||
unsigned int Reserve (unsigned int amount)
|
||||
{
|
||||
if (Count + amount > Most)
|
||||
{
|
||||
Grow (amount);
|
||||
}
|
||||
Grow (amount);
|
||||
unsigned int place = Count;
|
||||
Count += amount;
|
||||
return place;
|
||||
|
|
|
@ -962,6 +962,7 @@ FFontChar2::~FFontChar2 ()
|
|||
if (Spans != NULL)
|
||||
{
|
||||
FreeSpans (Spans);
|
||||
Spans = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue