mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 06:53:58 +00:00
- Fixed: The names in the Depths array in m_options.cpp were never freed.
- Fixed: FDoomEdMap needed a destructor. - Fixed: Decal animators were never freed. - Fixed: Colormaps were never freed. - Fixed: Memory allocated in R_InitTranslationTables() was never freed. - Fixed: R_InitParticles() allocated way more memory than it needed to. (And the particle memory was never freed, either.) - Fixed: FMetaTable::FreeMeta() should use delete[] to free string metadata. - Fixed: FConfigFile::ClearCurrentSection() must cast the entry to a char * before deleting it, because that's the way it was allocated. - Fixed definitions of DeadZombieMan and DeadShotgunGuy in doom/deadthings.txt. Skip_super resets the dropitem list, so having it after "DropItem None" is pointless. - Fixed: Decorate DropItem information was never freed. - Fixed: FinishStates() allocated even 0-entry state arrays. - Fixed: Default actor instances were never freed. - Fixed: FRandomSoundList never freed its sound list. - Fixed: Level and cluster strings read from MAPINFO were never freed. - Fixed: Episode names were never freed. - Fixed: InverseColormap and GoldColormap were never freed. Since they're always allocated, they can just be arrays rather than pointers. - Fixed: FFont destructor never freed any of the character data or the font's name. - Fixed: Fonts were not freed at exit. - Fixed: FStringTable::LoadLanguage() did not call SC_Close(). - Fixed: When using the -iwad parameter, IdentifyVersion() did not release the buffer it created to hold the parameter's path. SVN r88 (trunk)
This commit is contained in:
parent
201e17082c
commit
df17a60f5d
26 changed files with 314 additions and 131 deletions
|
@ -1,4 +1,30 @@
|
|||
May 8, 2006
|
||||
- Fixed: The names in the Depths array in m_options.cpp were never freed.
|
||||
- Fixed: FDoomEdMap needed a destructor.
|
||||
- Fixed: Decal animators were never freed.
|
||||
- Fixed: Colormaps were never freed.
|
||||
- Fixed: Memory allocated in R_InitTranslationTables() was never freed.
|
||||
- Fixed: R_InitParticles() allocated way more memory than it needed to. (And the
|
||||
particle memory was never freed, either.)
|
||||
- Fixed: FMetaTable::FreeMeta() should use delete[] to free string metadata.
|
||||
- Fixed: FConfigFile::ClearCurrentSection() must cast the entry to a char *
|
||||
before deleting it, because that's the way it was allocated.
|
||||
- Fixed definitions of DeadZombieMan and DeadShotgunGuy in doom/deadthings.txt.
|
||||
Skip_super resets the dropitem list, so having it after "DropItem None" is
|
||||
pointless.
|
||||
- Fixed: Decorate DropItem information was never freed.
|
||||
- Fixed: FinishStates() allocated even 0-entry state arrays.
|
||||
- Fixed: Default actor instances were never freed.
|
||||
- Fixed: FRandomSoundList never freed its sound list.
|
||||
- Fixed: Level and cluster strings read from MAPINFO were never freed.
|
||||
- Fixed: Episode names were never freed.
|
||||
- Fixed: InverseColormap and GoldColormap were never freed. Since they're always
|
||||
allocated, they can just be arrays rather than pointers.
|
||||
- Fixed: FFont destructor never freed any of the character data or the font's name.
|
||||
- Fixed: Fonts were not freed at exit.
|
||||
- Fixed: FStringTable::LoadLanguage() did not call SC_Close().
|
||||
- Fixed: When using the -iwad parameter, IdentifyVersion() did not release the
|
||||
buffer it created to hold the parameter's path.
|
||||
- Blends created with the ACS fade commands now degrade to transparent overlays
|
||||
when the menu is visible, so they can no longer obscure the menu.
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ void FConfigFile::ClearCurrentSection ()
|
|||
{
|
||||
next = entry->Next;
|
||||
delete[] entry->Value;
|
||||
delete entry;
|
||||
delete (char *)entry;
|
||||
entry = next;
|
||||
}
|
||||
CurrentSection->RootEntry = NULL;
|
||||
|
|
|
@ -1550,17 +1550,16 @@ static EIWADType IdentifyVersion (const char *zdoom_wad)
|
|||
int pickwad;
|
||||
size_t i;
|
||||
bool iwadparmfound = false;
|
||||
FString custwad;
|
||||
|
||||
memset (wads, 0, sizeof(wads));
|
||||
|
||||
if (iwadparm)
|
||||
{
|
||||
char *custwad = new char[strlen (iwadparm) + 5];
|
||||
strcpy (custwad, iwadparm);
|
||||
FixPathSeperator (custwad);
|
||||
custwad = iwadparm;
|
||||
FixPathSeperator (custwad.GetChars());
|
||||
if (CheckIWAD (custwad, wads))
|
||||
{ // -iwad parameter was a directory
|
||||
delete[] custwad;
|
||||
iwadparm = NULL;
|
||||
}
|
||||
else
|
||||
|
@ -2015,13 +2014,12 @@ void D_DoomMain (void)
|
|||
// [RH] Initialize localizable strings.
|
||||
GStrings.LoadStrings (false);
|
||||
|
||||
//P_InitXlat ();
|
||||
|
||||
// [RH] Moved these up here so that we can do most of our
|
||||
// startup output in a fullscreen console.
|
||||
|
||||
CT_Init ();
|
||||
I_Init ();
|
||||
|
||||
V_Init ();
|
||||
|
||||
// Base systems have been inited; enable cvar callbacks
|
||||
|
|
|
@ -92,10 +92,22 @@ struct FDecalAnimator
|
|||
virtual ~FDecalAnimator ();
|
||||
virtual DThinker *CreateThinker (DBaseDecal *actor, side_t *wall) const = 0;
|
||||
|
||||
char *Name;
|
||||
FName Name;
|
||||
};
|
||||
|
||||
static TArray<FDecalAnimator *> Animators;
|
||||
class FDecalAnimatorArray : public TArray<FDecalAnimator *>
|
||||
{
|
||||
public:
|
||||
~FDecalAnimatorArray()
|
||||
{
|
||||
for (unsigned int i = 0; i < Size(); ++i)
|
||||
{
|
||||
delete (*this)[i];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
FDecalAnimatorArray Animators;
|
||||
|
||||
struct DDecalThinker : public DThinker
|
||||
{
|
||||
|
@ -554,7 +566,7 @@ void FDecalLib::ParseDecalGroup ()
|
|||
SC_MustGetString ();
|
||||
if (SC_Compare ("}"))
|
||||
{
|
||||
group->Name = copystring (groupName);
|
||||
group->Name = groupName;
|
||||
group->SpawnID = decalNum;
|
||||
AddDecal (group);
|
||||
break;
|
||||
|
@ -835,7 +847,7 @@ void FDecalLib::AddDecal (const char *name, byte num, const FDecalTemplate &deca
|
|||
FDecalTemplate *newDecal = new FDecalTemplate;
|
||||
|
||||
*newDecal = decal;
|
||||
newDecal->Name = copystring (name);
|
||||
newDecal->Name = name;
|
||||
newDecal->SpawnID = num;
|
||||
AddDecal (newDecal);
|
||||
}
|
||||
|
@ -987,13 +999,11 @@ FDecalLib::FTranslation *FDecalLib::GenerateTranslation (DWORD start, DWORD end)
|
|||
|
||||
FDecalBase::FDecalBase ()
|
||||
{
|
||||
Name = NULL;
|
||||
Name = NAME_None;
|
||||
}
|
||||
|
||||
FDecalBase::~FDecalBase ()
|
||||
{
|
||||
if (Name != NULL)
|
||||
delete[] Name;
|
||||
}
|
||||
|
||||
void FDecalTemplate::ApplyToDecal (DBaseDecal *decal, side_t *wall) const
|
||||
|
@ -1101,16 +1111,11 @@ const FDecalTemplate *FDecalGroup::GetDecal () const
|
|||
|
||||
FDecalAnimator::FDecalAnimator (const char *name)
|
||||
{
|
||||
Name = copystring (name);
|
||||
Name = name;
|
||||
}
|
||||
|
||||
FDecalAnimator::~FDecalAnimator ()
|
||||
{
|
||||
if (Name != NULL)
|
||||
{
|
||||
delete[] Name;
|
||||
Name = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
IMPLEMENT_CLASS (DDecalFader)
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include "doomtype.h"
|
||||
#include "tarray.h"
|
||||
#include "name.h"
|
||||
|
||||
class AActor;
|
||||
class FDecalTemplate;
|
||||
|
@ -57,7 +58,7 @@ protected:
|
|||
virtual ~FDecalBase ();
|
||||
|
||||
FDecalBase *Left, *Right;
|
||||
char *Name;
|
||||
FName Name;
|
||||
BYTE SpawnID;
|
||||
TArray<const TypeInfo *> Users; // Which actors generate this decal
|
||||
};
|
||||
|
|
|
@ -118,6 +118,14 @@ static struct TypeInfoDataFreeer
|
|||
|
||||
void TypeInfo::StaticFreeData (TypeInfo *type)
|
||||
{
|
||||
if (type->ActorInfo != NULL)
|
||||
{
|
||||
if (type->ActorInfo->Defaults != NULL)
|
||||
{
|
||||
delete[] type->ActorInfo->Defaults;
|
||||
type->ActorInfo->Defaults = NULL;
|
||||
}
|
||||
}
|
||||
if (type->bRuntimeClass)
|
||||
{
|
||||
if (type->Name != NULL)
|
||||
|
@ -127,6 +135,11 @@ void TypeInfo::StaticFreeData (TypeInfo *type)
|
|||
type->Name = NULL;
|
||||
if (type->ActorInfo != NULL)
|
||||
{
|
||||
if (type->ActorInfo->OwnedStates != NULL)
|
||||
{
|
||||
delete[] type->ActorInfo->OwnedStates;
|
||||
type->ActorInfo->OwnedStates = NULL;
|
||||
}
|
||||
delete type->ActorInfo;
|
||||
type->ActorInfo = NULL;
|
||||
}
|
||||
|
@ -350,7 +363,7 @@ void FMetaTable::FreeMeta ()
|
|||
switch (meta->Type)
|
||||
{
|
||||
case META_String:
|
||||
delete meta->Value.String;
|
||||
delete[] meta->Value.String;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -95,6 +95,17 @@ static void InitPlayerClasses ();
|
|||
static void ParseEpisodeInfo ();
|
||||
static void G_DoParseMapInfo (int lump);
|
||||
static void SetLevelNum (level_info_t *info, int num);
|
||||
static void ClearEpisodes ();
|
||||
static void ClearLevelInfoStrings (level_info_t *linfo);
|
||||
static void ClearClusterInfoStrings (cluster_info_t *cinfo);
|
||||
|
||||
static struct EpisodeKiller
|
||||
{
|
||||
~EpisodeKiller()
|
||||
{
|
||||
ClearEpisodes();
|
||||
}
|
||||
} KillTheEpisodes;
|
||||
|
||||
static FRandom pr_classchoice ("RandomPlayerClassChoice");
|
||||
|
||||
|
@ -130,6 +141,23 @@ level_locals_t level; // info about current level
|
|||
static TArray<cluster_info_t> wadclusterinfos;
|
||||
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.
|
||||
static bool HexenHack;
|
||||
|
||||
|
@ -532,8 +560,16 @@ static void G_DoParseMapInfo (int lump)
|
|||
{
|
||||
levelindex = wadlevelinfos.Reserve(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClearLevelInfoStrings (&wadlevelinfos[levelindex]);
|
||||
}
|
||||
levelinfo = &wadlevelinfos[levelindex];
|
||||
memcpy (levelinfo, &defaultinfo, sizeof(*levelinfo));
|
||||
if (levelinfo->music != NULL)
|
||||
{
|
||||
levelinfo->music = copystring (levelinfo->music);
|
||||
}
|
||||
if (HexenHack)
|
||||
{
|
||||
levelinfo->WallHorizLight = levelinfo->WallVertLight = 0;
|
||||
|
@ -612,6 +648,10 @@ static void G_DoParseMapInfo (int lump)
|
|||
{
|
||||
delete[] clusterinfo->messagemusic;
|
||||
}
|
||||
if (clusterinfo->clustername != NULL)
|
||||
{
|
||||
delete[] clusterinfo->clustername;
|
||||
}
|
||||
}
|
||||
memset (clusterinfo, 0, sizeof(cluster_info_t));
|
||||
clusterinfo->cluster = sc_Number;
|
||||
|
@ -623,18 +663,61 @@ static void G_DoParseMapInfo (int lump)
|
|||
break;
|
||||
|
||||
case MITL_CLEAREPISODES:
|
||||
for (int i = 0; i < EpiDef.numitems; ++i)
|
||||
{
|
||||
delete[] const_cast<char *>(EpisodeMenu[i].name);
|
||||
EpisodeMenu[i].name = NULL;
|
||||
}
|
||||
EpiDef.numitems = 0;
|
||||
ClearEpisodes ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
SC_Close ();
|
||||
}
|
||||
|
||||
static void ClearLevelInfoStrings(level_info_t *linfo)
|
||||
{
|
||||
if (linfo->music != NULL)
|
||||
{
|
||||
delete[] linfo->music;
|
||||
linfo->music = NULL;
|
||||
}
|
||||
if (linfo->level_name != NULL)
|
||||
{
|
||||
delete[] linfo->level_name;
|
||||
linfo->level_name = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void ClearClusterInfoStrings(cluster_info_t *cinfo)
|
||||
{
|
||||
if (cinfo->exittext != NULL)
|
||||
{
|
||||
delete[] cinfo->exittext;
|
||||
cinfo->exittext = NULL;
|
||||
}
|
||||
if (cinfo->entertext != NULL)
|
||||
{
|
||||
delete[] cinfo->entertext;
|
||||
cinfo->entertext = NULL;
|
||||
}
|
||||
if (cinfo->messagemusic != NULL)
|
||||
{
|
||||
delete[] cinfo->messagemusic;
|
||||
cinfo->messagemusic = NULL;
|
||||
}
|
||||
if (cinfo->clustername != NULL)
|
||||
{
|
||||
delete[] cinfo->clustername;
|
||||
cinfo->clustername = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void ClearEpisodes()
|
||||
{
|
||||
for (int i = 0; i < EpiDef.numitems; ++i)
|
||||
{
|
||||
delete[] const_cast<char *>(EpisodeMenu[i].name);
|
||||
EpisodeMenu[i].name = NULL;
|
||||
}
|
||||
EpiDef.numitems = 0;
|
||||
}
|
||||
|
||||
static void ParseMapInfoLower (MapInfoHandler *handlers,
|
||||
const char *strings[],
|
||||
level_info_t *levelinfo,
|
||||
|
|
|
@ -31,19 +31,6 @@ BEGIN_DEFAULTS (AWeapon, Any, -1, 0)
|
|||
PROP_Inventory_PickupSound ("misc/w_pkup")
|
||||
END_DEFAULTS
|
||||
|
||||
ACTOR_STATE_NAMES(AWeapon) =
|
||||
{
|
||||
{ (FState *AActor::*)&AWeapon::UpState, "Up" },
|
||||
{ (FState *AActor::*)&AWeapon::DownState, "Down" },
|
||||
{ (FState *AActor::*)&AWeapon::ReadyState, "Ready" },
|
||||
{ (FState *AActor::*)&AWeapon::AtkState, "Attack" },
|
||||
{ (FState *AActor::*)&AWeapon::HoldAtkState, "HoldAttack" },
|
||||
{ (FState *AActor::*)&AWeapon::AltAtkState, "AltAttack" },
|
||||
{ (FState *AActor::*)&AWeapon::AltHoldAtkState, "AltHoldAttack" },
|
||||
{ (FState *AActor::*)&AWeapon::FlashState, "Flash" },
|
||||
{ 0, NAME_None }
|
||||
};
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// AWeapon :: Serialize
|
||||
|
|
|
@ -303,6 +303,11 @@ FDoomEdMap DoomEdMap;
|
|||
|
||||
FDoomEdMap::FDoomEdEntry *FDoomEdMap::DoomEdHash[DOOMED_HASHSIZE];
|
||||
|
||||
FDoomEdMap::~FDoomEdMap()
|
||||
{
|
||||
Empty();
|
||||
}
|
||||
|
||||
void FDoomEdMap::AddType (int doomednum, const TypeInfo *type)
|
||||
{
|
||||
unsigned int hash = (unsigned int)doomednum % DOOMED_HASHSIZE;
|
||||
|
|
|
@ -353,12 +353,6 @@ enum
|
|||
ADEF_EOL = 0xED5E // End Of List
|
||||
};
|
||||
|
||||
struct FStateName
|
||||
{
|
||||
FState *AActor::*State;
|
||||
FName Name;
|
||||
};
|
||||
|
||||
#if _MSC_VER
|
||||
// nonstandard extension used : zero-sized array in struct/union
|
||||
#pragma warning(disable:4200)
|
||||
|
@ -378,7 +372,6 @@ struct FActorInfo
|
|||
TypeInfo *Class;
|
||||
FState *OwnedStates;
|
||||
BYTE *Defaults;
|
||||
FStateName *StateNames;
|
||||
int NumOwnedStates;
|
||||
BYTE GameFilter;
|
||||
BYTE SpawnID;
|
||||
|
@ -400,6 +393,8 @@ struct FActorInfo
|
|||
class FDoomEdMap
|
||||
{
|
||||
public:
|
||||
~FDoomEdMap();
|
||||
|
||||
const TypeInfo *FindType (int doomednum) const;
|
||||
void AddType (int doomednum, const TypeInfo *type);
|
||||
void DelType (int doomednum);
|
||||
|
|
|
@ -173,12 +173,12 @@ public:
|
|||
|
||||
#define BEGIN_DEFAULTS(actor,game,ednum,spawnid) \
|
||||
BEGIN_DEFAULTS_PRE(actor) \
|
||||
RUNTIME_CLASS(actor), &actor::States[0], NULL, NULL, countof(actor::States), \
|
||||
RUNTIME_CLASS(actor), &actor::States[0], NULL, countof(actor::States), \
|
||||
BEGIN_DEFAULTS_POST(actor,game,ednum,spawnid)
|
||||
|
||||
#define BEGIN_STATELESS_DEFAULTS(actor,game,ednum,spawnid) \
|
||||
BEGIN_DEFAULTS_PRE(actor) \
|
||||
RUNTIME_CLASS(actor), NULL, NULL, NULL, 0, \
|
||||
RUNTIME_CLASS(actor), NULL, NULL, 0, \
|
||||
BEGIN_DEFAULTS_POST(actor,game,ednum,spawnid)
|
||||
|
||||
// IMPLEMENT_ACTOR combines IMPLEMENT_CLASS and BEGIN_DEFAULTS
|
||||
|
@ -191,13 +191,6 @@ public:
|
|||
#define IMPLEMENT_ABSTRACT_ACTOR(actor) \
|
||||
IMPLEMENT_STATELESS_ACTOR(actor,Any,-1,0) END_DEFAULTS
|
||||
|
||||
#define ACTOR_STATE_NAMES(actor) \
|
||||
extern FStateName actor##StateNames[]; \
|
||||
extern FActorInfo actor##ActorInfo; \
|
||||
struct actor##StateNamesAssignerClass { actor##StateNamesAssignerClass() { actor##ActorInfo.StateNames = actor##StateNames; } } \
|
||||
actor##StateNamesAssigner; \
|
||||
FStateName actor##StateNames[]
|
||||
|
||||
#define PROP_SeeSound(x) ADD_STRING_PROP(ADEF_SeeSound,"\1",x)
|
||||
#define PROP_AttackSound(x) ADD_STRING_PROP(ADEF_AttackSound,"\2",x)
|
||||
#define PROP_PainSound(x) ADD_STRING_PROP(ADEF_PainSound,"\3",x)
|
||||
|
|
|
@ -799,6 +799,21 @@ EXTERN_CVAR (Bool, fullscreen)
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
} KillTheDepthValues;
|
||||
|
||||
EXTERN_CVAR (Bool, vid_tft) // Defined below
|
||||
CUSTOM_CVAR (Int, menu_screenratios, 0, CVAR_ARCHIVE)
|
||||
{
|
||||
|
@ -1155,7 +1170,7 @@ void M_OptInit (void)
|
|||
int currval = 0, dummy1, dummy2, i;
|
||||
char name[24];
|
||||
|
||||
for (i = 1; i < 32; i++)
|
||||
for (i = 1; i < 32 && currval < countof(Depths); i++)
|
||||
{
|
||||
I_StartModeIterator (i);
|
||||
if (I_NextMode (&dummy1, &dummy2, NULL))
|
||||
|
|
|
@ -168,24 +168,6 @@ IMPLEMENT_POINTY_CLASS (AActor)
|
|||
DECLARE_POINTER (master)
|
||||
END_POINTERS
|
||||
|
||||
ACTOR_STATE_NAMES(AActor) =
|
||||
{
|
||||
{ &AActor::SpawnState, "Spawn" },
|
||||
{ &AActor::SeeState, "See" },
|
||||
{ &AActor::PainState, "Pain" },
|
||||
{ &AActor::MeleeState, "Melee" },
|
||||
{ &AActor::MissileState, "Missile" },
|
||||
{ &AActor::CrashState, "Crash" },
|
||||
{ &AActor::DeathState, "Death" },
|
||||
{ &AActor::XDeathState, "XDeath" },
|
||||
{ &AActor::BDeathState, "Burn" },
|
||||
{ &AActor::IDeathState, "Ice" },
|
||||
{ &AActor::EDeathState, "Disintegrate" },
|
||||
{ &AActor::RaiseState, "Raise" },
|
||||
{ &AActor::WoundState, "Wound" },
|
||||
{ 0, NAME_None }
|
||||
};
|
||||
|
||||
AActor::~AActor ()
|
||||
{
|
||||
// Please avoid calling the destructor directly (or through delete)!
|
||||
|
|
|
@ -2836,6 +2836,23 @@ int firstfakecmap;
|
|||
byte *realcolormaps;
|
||||
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)
|
||||
{
|
||||
if (strnicmp (fakecmaps[0].name, name, 8) != 0)
|
||||
|
|
|
@ -1212,18 +1212,19 @@ void R_DrawFogBoundary (int x1, int x2, short *uclip, short *dclip)
|
|||
//
|
||||
void R_InitTranslationTables ()
|
||||
{
|
||||
int i, j;
|
||||
|
||||
// Diminishing translucency tables for shaded actors. Not really
|
||||
// translation tables, but putting them here was convenient, particularly
|
||||
// since translationtables[0] would otherwise be wasted.
|
||||
translationtables[0] = new BYTE[256*
|
||||
static BYTE MainTranslationTables[256*
|
||||
(NUMCOLORMAPS*16 // Shaded
|
||||
+MAXPLAYERS*2 // Players + PlayersExtra
|
||||
+8 // Standard (7 for Strife, 3 for the rest)
|
||||
+MAX_ACS_TRANSLATIONS // LevelScripted
|
||||
+BODYQUESIZE // PlayerCorpses
|
||||
)];
|
||||
int i, j;
|
||||
|
||||
// Diminishing translucency tables for shaded actors. Not really
|
||||
// translation tables, but putting them here was convenient, particularly
|
||||
// since translationtables[0] would otherwise be wasted.
|
||||
translationtables[0] = MainTranslationTables;
|
||||
|
||||
// Player translations, one for each player
|
||||
translationtables[TRANSLATION_Players] =
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
#ifndef __R_MAIN_H__
|
||||
#define __R_MAIN_H__
|
||||
|
||||
// Number of diminishing brightness levels.
|
||||
// There a 0-31, i.e. 32 LUT in the COLORMAP lump.
|
||||
#define NUMCOLORMAPS 32
|
||||
|
||||
#include "d_player.h"
|
||||
#include "r_data.h"
|
||||
#include "r_bsp.h"
|
||||
|
@ -83,9 +87,6 @@ extern int r_Yaspect;
|
|||
// 16 discrete light levels. The terminology I use is borrowed from Build.
|
||||
//
|
||||
|
||||
// Number of diminishing brightness levels.
|
||||
// There a 0-31, i.e. 32 LUT in the COLORMAP lump.
|
||||
#define NUMCOLORMAPS 32
|
||||
#define INVERSECOLORMAP 32
|
||||
#define GOLDCOLORMAP 33
|
||||
|
||||
|
|
|
@ -1975,6 +1975,14 @@ void R_DrawMasked (void)
|
|||
// [RH] Particle functions
|
||||
//
|
||||
|
||||
static void STACK_ARGS FreeParticles()
|
||||
{
|
||||
if (Particles != NULL)
|
||||
{
|
||||
delete[] Particles;
|
||||
}
|
||||
}
|
||||
|
||||
void R_InitParticles ()
|
||||
{
|
||||
char *i;
|
||||
|
@ -1986,8 +1994,9 @@ void R_InitParticles ()
|
|||
else if (NumParticles < 100)
|
||||
NumParticles = 100;
|
||||
|
||||
Particles = new particle_t[NumParticles * sizeof(particle_t)];
|
||||
Particles = new particle_t[NumParticles];
|
||||
R_ClearParticles ();
|
||||
atterm (FreeParticles);
|
||||
}
|
||||
|
||||
void R_ClearParticles ()
|
||||
|
|
|
@ -62,11 +62,31 @@
|
|||
|
||||
struct FRandomSoundList
|
||||
{
|
||||
FRandomSoundList()
|
||||
: Sounds(0), SfxHead(0), NumSounds(0)
|
||||
{
|
||||
}
|
||||
~FRandomSoundList()
|
||||
{
|
||||
if (Sounds != NULL)
|
||||
{
|
||||
delete[] Sounds;
|
||||
Sounds = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
WORD *Sounds; // A list of sounds that can result for the following id
|
||||
WORD SfxHead; // The sound id used to reference this list
|
||||
WORD NumSounds;
|
||||
};
|
||||
|
||||
template<>
|
||||
void CopyForTArray<FRandomSoundList> (FRandomSoundList &dst, FRandomSoundList &src)
|
||||
{
|
||||
dst = src;
|
||||
}
|
||||
|
||||
|
||||
struct FPlayerClassLookup
|
||||
{
|
||||
char Name[MAX_SNDNAME+1];
|
||||
|
@ -540,10 +560,6 @@ static void S_ClearSoundData()
|
|||
if (Ambients[i]) delete Ambients[i];
|
||||
Ambients[i]=NULL;
|
||||
}
|
||||
for(i=0;i<S_rnd.Size();i++)
|
||||
{
|
||||
delete[] S_rnd[i].Sounds;
|
||||
}
|
||||
while (MusicVolumes != NULL)
|
||||
{
|
||||
FMusicVolume * me = MusicVolumes;
|
||||
|
@ -934,10 +950,10 @@ static void S_AddSNDINFO (int lump)
|
|||
else if (list.Size() > 1)
|
||||
{ // Only add non-empty random lists
|
||||
random.NumSounds = (WORD)list.Size();
|
||||
random.Sounds = new WORD[random.NumSounds];
|
||||
memcpy (random.Sounds, &list[0], sizeof(WORD)*random.NumSounds);
|
||||
S_sfx[random.SfxHead].link = (WORD)S_rnd.Push (random);
|
||||
S_sfx[random.SfxHead].bRandomHeader = true;
|
||||
S_rnd[S_sfx[random.SfxHead].link].Sounds = new WORD[random.NumSounds];
|
||||
memcpy (S_rnd[S_sfx[random.SfxHead].link].Sounds, &list[0], sizeof(WORD)*random.NumSounds);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -267,6 +267,7 @@ void FStringTable::LoadLanguage (int lumpnum, DWORD code, bool exactMatch, int p
|
|||
}
|
||||
}
|
||||
}
|
||||
SC_Close ();
|
||||
}
|
||||
|
||||
// Replace \ escape sequences in a string with the escaped characters.
|
||||
|
|
|
@ -79,15 +79,6 @@ TArray<char*> DecalNames;
|
|||
// all state parameters
|
||||
TArray<intptr_t> StateParameters;
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
inline char * MS_Strdup(const char * s)
|
||||
{
|
||||
return *s? strdup(s):NULL;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// List of all flags
|
||||
|
@ -953,12 +944,35 @@ enum
|
|||
|
||||
struct FDropItem
|
||||
{
|
||||
const char * Name;
|
||||
FName Name;
|
||||
int probability;
|
||||
int amount;
|
||||
FDropItem * Next;
|
||||
};
|
||||
TArray<FDropItem *> DropItemList;
|
||||
|
||||
static void FreeDropItemChain(FDropItem *chain)
|
||||
{
|
||||
while (chain != NULL)
|
||||
{
|
||||
FDropItem *next = chain->Next;
|
||||
delete chain;
|
||||
chain = next;
|
||||
}
|
||||
}
|
||||
|
||||
class FDropItemPtrArray : public TArray<FDropItem *>
|
||||
{
|
||||
public:
|
||||
~FDropItemPtrArray()
|
||||
{
|
||||
for (unsigned int i = 0; i < Size(); ++i)
|
||||
{
|
||||
FreeDropItemChain ((*this)[i]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
FDropItemPtrArray DropItemList;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//
|
||||
|
@ -999,7 +1013,7 @@ void A_NoBlocking (AActor *actor)
|
|||
|
||||
while (di != NULL)
|
||||
{
|
||||
if (stricmp (di->Name, "None") != 0)
|
||||
if (di->Name != NAME_None)
|
||||
{
|
||||
const TypeInfo *ti = TypeInfo::FindType(di->Name);
|
||||
if (ti) P_DropItem (actor, ti, di->amount, di->probability);
|
||||
|
@ -1032,7 +1046,7 @@ struct FBasicAttack
|
|||
{
|
||||
int MeleeDamage;
|
||||
int MeleeSound;
|
||||
const char *MissileName;
|
||||
FName MissileName;
|
||||
fixed_t MissileHeight;
|
||||
};
|
||||
|
||||
|
@ -1165,7 +1179,7 @@ static void ResetBaggage (Baggage *bag)
|
|||
bag->DropItemList = NULL;
|
||||
bag->BAttack.MissileHeight = 32*FRACUNIT;
|
||||
bag->BAttack.MeleeSound = 0;
|
||||
bag->BAttack.MissileName = NULL;
|
||||
bag->BAttack.MissileName = NAME_None;
|
||||
bag->DropItemSet = false;
|
||||
bag->CurrentState = 0;
|
||||
bag->StateSet = false;
|
||||
|
@ -1174,6 +1188,10 @@ static void ResetBaggage (Baggage *bag)
|
|||
static void ResetActor (AActor *actor, Baggage *bag)
|
||||
{
|
||||
memcpy (actor, GetDefault<AActor>(), sizeof(AActor));
|
||||
if (bag->DropItemList != NULL)
|
||||
{
|
||||
FreeDropItemChain (bag->DropItemList);
|
||||
}
|
||||
ResetBaggage (bag);
|
||||
}
|
||||
|
||||
|
@ -1373,7 +1391,7 @@ bool DoSpecialFunctions(FState & state, bool multistate, int * statecount, Bagga
|
|||
|
||||
StateParameters[paramindex] = bag.BAttack.MeleeDamage;
|
||||
StateParameters[paramindex+1] = bag.BAttack.MeleeSound;
|
||||
StateParameters[paramindex+2] = (intptr_t)bag.BAttack.MissileName;
|
||||
StateParameters[paramindex+2] = bag.BAttack.MissileName;
|
||||
StateParameters[paramindex+3] = bag.BAttack.MissileHeight;
|
||||
state.Action = BasicAttacks[batk];
|
||||
return true;
|
||||
|
@ -1400,7 +1418,7 @@ static void RetargetStatePointers (intptr_t count, const char *target, FState **
|
|||
{
|
||||
if (*probe == (FState *)count)
|
||||
{
|
||||
*probe = target == NULL? NULL : (FState *)strdup (target);
|
||||
*probe = target == NULL ? NULL : (FState *)copystring (target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1463,7 +1481,7 @@ do_goto: SC_MustGetString();
|
|||
// copy the text - this must be resolved later!
|
||||
if (laststate != NULL)
|
||||
{ // Following a state definition: Modify it.
|
||||
laststate->NextState=(FState*)strdup(statestring);
|
||||
laststate->NextState = (FState*)copystring(statestring);
|
||||
}
|
||||
else if (lastlabel >= 0)
|
||||
{ // Following a label: Retarget it.
|
||||
|
@ -1667,7 +1685,7 @@ do_stop:
|
|||
case 'T':
|
||||
case 't': // String
|
||||
SC_MustGetString();
|
||||
v=(intptr_t)MS_Strdup(sc_String);
|
||||
v = (intptr_t)(sc_String[0] ? copystring(sc_String) : NULL);
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
|
@ -1858,7 +1876,7 @@ static FState *ResolveGotoLabel (AActor *actor, const TypeInfo *type, char *name
|
|||
{
|
||||
SC_ScriptError("Unknown state label %s", label);
|
||||
}
|
||||
free(namestart); // free the allocated string buffer
|
||||
delete[] namestart; // free the allocated string buffer
|
||||
return state;
|
||||
}
|
||||
|
||||
|
@ -1915,12 +1933,13 @@ static void FixStatePointersAgain (FActorInfo *actor, AActor *defaults, FState *
|
|||
static int FinishStates (FActorInfo *actor, AActor *defaults, Baggage &bag)
|
||||
{
|
||||
int count = StateArray.Size();
|
||||
FState *realstates = new FState[count];
|
||||
int i;
|
||||
int currange;
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
FState *realstates = new FState[count];
|
||||
int i;
|
||||
int currange;
|
||||
|
||||
memcpy(realstates, &StateArray[0], count*sizeof(FState));
|
||||
actor->OwnedStates = realstates;
|
||||
actor->NumOwnedStates = count;
|
||||
|
@ -2471,7 +2490,7 @@ static void ActorDropItem (AActor *defaults, Baggage &bag)
|
|||
FDropItem * di=new FDropItem;
|
||||
|
||||
SC_MustGetString();
|
||||
di->Name=strdup(sc_String);
|
||||
di->Name=sc_String;
|
||||
di->probability=255;
|
||||
di->amount=-1;
|
||||
if (SC_CheckNumber())
|
||||
|
@ -2763,7 +2782,7 @@ static void ActorMeleeSound (AActor *defaults, Baggage &bag)
|
|||
static void ActorMissileType (AActor *defaults, Baggage &bag)
|
||||
{
|
||||
SC_MustGetString();
|
||||
bag.BAttack.MissileName = MS_Strdup(sc_String);
|
||||
bag.BAttack.MissileName = sc_String;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -191,7 +191,7 @@ static void DoAttack (AActor *self, bool domelee, bool domissile)
|
|||
|
||||
int MeleeDamage=StateParameters[index];
|
||||
int MeleeSound=StateParameters[index+1];
|
||||
const char *MissileName=(const char *)StateParameters[index+2];
|
||||
FName MissileName=(ENamedName)StateParameters[index+2];
|
||||
fixed_t MissileHeight=StateParameters[index+3];
|
||||
|
||||
A_FaceTarget (self);
|
||||
|
@ -202,7 +202,7 @@ static void DoAttack (AActor *self, bool domelee, bool domissile)
|
|||
P_DamageMobj (self->target, self, self, damage, MOD_HIT);
|
||||
P_TraceBleed (damage, self->target, self);
|
||||
}
|
||||
else if (domissile && MissileName)
|
||||
else if (domissile && MissileName != NAME_None)
|
||||
{
|
||||
const TypeInfo * ti=TypeInfo::FindType(MissileName);
|
||||
if (ti)
|
||||
|
|
|
@ -110,6 +110,17 @@ static const byte myislower[256] =
|
|||
|
||||
FFont *FFont::FirstFont = NULL;
|
||||
|
||||
static struct FontsDeleter
|
||||
{
|
||||
~FontsDeleter()
|
||||
{
|
||||
while (FFont::FirstFont != NULL)
|
||||
{
|
||||
delete FFont::FirstFont;
|
||||
}
|
||||
}
|
||||
} DeleteAllTheFonts;
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1310
|
||||
template<> FArchive &operator<< (FArchive &arc, FFont* &font)
|
||||
#else
|
||||
|
@ -262,7 +273,7 @@ FFont::~FFont ()
|
|||
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
if (Chars[i].Pic != NULL && Chars[i].Pic->Name == 0)
|
||||
if (Chars[i].Pic != NULL && Chars[i].Pic->Name[0] == 0)
|
||||
{
|
||||
delete Chars[i].Pic;
|
||||
}
|
||||
|
@ -280,6 +291,11 @@ FFont::~FFont ()
|
|||
delete[] PatchRemap;
|
||||
PatchRemap = NULL;
|
||||
}
|
||||
if (Name)
|
||||
{
|
||||
delete[] Name;
|
||||
Name = NULL;
|
||||
}
|
||||
|
||||
FFont **prev = &FirstFont;
|
||||
FFont *font = *prev;
|
||||
|
@ -559,6 +575,7 @@ FFont::FFont ()
|
|||
Chars = NULL;
|
||||
Ranges = NULL;
|
||||
PatchRemap = NULL;
|
||||
Name = NULL;
|
||||
}
|
||||
|
||||
FSingleLumpFont::FSingleLumpFont (const char *name, int lump)
|
||||
|
|
|
@ -108,6 +108,7 @@ protected:
|
|||
FFont *Next;
|
||||
|
||||
static FFont *FirstFont;
|
||||
friend struct FontsDeleter;
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1310
|
||||
template<> friend FArchive &operator<< (FArchive &arc, FFont* &font);
|
||||
|
|
|
@ -59,8 +59,8 @@ extern "C" {
|
|||
FDynamicColormap NormalLight;
|
||||
}
|
||||
FPalette GPalette;
|
||||
BYTE *InverseColormap;
|
||||
BYTE *GoldColormap;
|
||||
BYTE InverseColormap[NUMCOLORMAPS*256];
|
||||
BYTE GoldColormap[NUMCOLORMAPS*256];
|
||||
int Near255;
|
||||
|
||||
FColorMatcher ColorMatcher;
|
||||
|
@ -384,7 +384,6 @@ void InitPalette ()
|
|||
|
||||
// Doom invulnerability is an inverted grayscale
|
||||
// Strife uses it when firing the Sigil
|
||||
InverseColormap = new BYTE[NUMCOLORMAPS*256];
|
||||
shade = InverseColormap;
|
||||
|
||||
for (c = 0; c < 256; c++)
|
||||
|
@ -397,7 +396,6 @@ void InitPalette ()
|
|||
}
|
||||
|
||||
// Heretic invulnerability is a golden shade
|
||||
GoldColormap = new BYTE[NUMCOLORMAPS*256];
|
||||
shade = GoldColormap;
|
||||
|
||||
for (c = 0; c < 256; c++)
|
||||
|
|
|
@ -77,8 +77,8 @@ struct FDynamicColormap
|
|||
FDynamicColormap *Next;
|
||||
};
|
||||
|
||||
extern BYTE *InverseColormap;
|
||||
extern BYTE *GoldColormap;
|
||||
extern BYTE InverseColormap[NUMCOLORMAPS*256];
|
||||
extern BYTE GoldColormap[NUMCOLORMAPS*256];
|
||||
extern FPalette GPalette;
|
||||
extern "C" {
|
||||
extern FDynamicColormap NormalLight;
|
||||
|
|
|
@ -40,9 +40,9 @@ actor DeadMarine 15
|
|||
|
||||
actor DeadZombieMan : ZombieMan 18
|
||||
{
|
||||
Skip_Super
|
||||
Game Doom
|
||||
DropItem None
|
||||
Skip_Super
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
|
@ -54,9 +54,9 @@ actor DeadZombieMan : ZombieMan 18
|
|||
|
||||
actor DeadShotgunGuy : ShotgunGuy 19
|
||||
{
|
||||
Skip_Super
|
||||
Game Doom
|
||||
DropItem None
|
||||
Skip_Super
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
|
@ -68,8 +68,8 @@ actor DeadShotgunGuy : ShotgunGuy 19
|
|||
|
||||
actor DeadDoomImp : DoomImp 20
|
||||
{
|
||||
Game Doom
|
||||
Skip_Super
|
||||
Game Doom
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
|
@ -81,8 +81,8 @@ actor DeadDoomImp : DoomImp 20
|
|||
|
||||
actor DeadDemon : Demon 21
|
||||
{
|
||||
Game Doom
|
||||
Skip_Super
|
||||
Game Doom
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
|
@ -94,8 +94,8 @@ actor DeadDemon : Demon 21
|
|||
|
||||
actor DeadCacodemon : Cacodemon 22
|
||||
{
|
||||
Game Doom
|
||||
Skip_Super
|
||||
Game Doom
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
|
@ -113,8 +113,8 @@ actor DeadCacodemon : Cacodemon 22
|
|||
|
||||
actor DeadLostSoul : LostSoul 23
|
||||
{
|
||||
Game Doom
|
||||
Skip_Super
|
||||
Game Doom
|
||||
States
|
||||
{
|
||||
Spawn:
|
||||
|
|
Loading…
Reference in a new issue