- Removed the third parameter from dumpclasses when it was restricted it to Actors, because

I have no idea what that was all about.
- Got rid of FActorInfo and merged it into a new PClassActor.

SVN r2240 (scripting)
This commit is contained in:
Randy Heit 2010-03-24 02:49:37 +00:00
parent 7aa402b2a5
commit f88f601230
78 changed files with 1170 additions and 1038 deletions

View file

@ -538,7 +538,7 @@ int StoreDropItemChain(FDropItem *chain);
// Map Object definition.
class AActor : public DThinker
{
DECLARE_CLASS (AActor, DThinker)
DECLARE_CLASS_WITH_META (AActor, DThinker, PClassActor)
HAS_OBJECT_POINTERS
public:
AActor () throw();
@ -549,7 +549,7 @@ public:
void Serialize (FArchive &arc);
static AActor *StaticSpawn (const PClass *type, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement, bool SpawningMapThing = false);
static AActor *StaticSpawn (PClassActor *type, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement, bool SpawningMapThing = false);
inline AActor *GetDefault () const
{
@ -648,7 +648,7 @@ public:
bool CheckLocalView (int playernum) const;
// Finds the first item of a particular type.
AInventory *FindInventory (const PClass *type);
AInventory *FindInventory (PClassActor *type);
AInventory *FindInventory (FName type);
template<class T> T *FindInventory ()
{
@ -900,13 +900,13 @@ public:
FState *FindState (FName label) const
{
return GetClass()->ActorInfo->FindState(1, &label);
return GetClass()->FindState(1, &label);
}
FState *FindState (FName label, FName sublabel, bool exact = false) const
{
FName names[] = { label, sublabel };
return GetClass()->ActorInfo->FindState(2, names, exact);
return GetClass()->FindState(2, names, exact);
}
bool HasSpecialDeathStates () const;
@ -975,9 +975,16 @@ public:
}
};
inline AActor *Spawn (PClass *type, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement)
{
return AActor::StaticSpawn (dyn_cast<PClassActor>(type), x, y, z, allowreplacement);
}
inline AActor *Spawn (const PClass *type, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement)
{
return AActor::StaticSpawn (type, x, y, z, allowreplacement);
// Thanks to some fiddling while determining replacements, type is modified, but only
// temporarily.
return AActor::StaticSpawn (const_cast<PClassActor *>(dyn_cast<PClassActor>(type)), x, y, z, allowreplacement);
}
AActor *Spawn (const char *type, fixed_t x, fixed_t y, fixed_t z, replace_t allowreplacement);

View file

@ -168,7 +168,7 @@ void InitBotStuff()
{
w->MoveCombatDist = botinits[i].movecombatdist;
w->WeaponFlags |= botinits[i].weaponflags;
w->ProjectileType = PClass::FindClass(botinits[i].projectile);
w->ProjectileType = PClass::FindActor(botinits[i].projectile);
}
}
}

View file

@ -354,7 +354,7 @@ void FCajunMaster::WhatToGet (AActor *actor, AActor *item)
else if (item->IsKindOf (RUNTIME_CLASS(AAmmo)))
{
AAmmo *ammo = static_cast<AAmmo *> (item);
const PClass *parent = ammo->GetParentAmmo ();
PClassActor *parent = ammo->GetParentAmmo ();
AInventory *holdingammo = b->mo->FindInventory (parent);
if (holdingammo != NULL && holdingammo->Amount >= holdingammo->MaxAmount)

View file

@ -110,7 +110,7 @@ struct StateMapper
{
FState *State;
int StateSpan;
const PClass *Owner;
PClassActor *Owner;
bool OwnerIsPickup;
};
@ -121,7 +121,7 @@ static TArray<StateMapper> StateMap;
static TArray<FSoundID> SoundMap;
// Names of different actor types, in original Doom 2 order
static TArray<const PClass *> InfoNames;
static TArray<PClassActor *> InfoNames;
// bit flags for PatchThing (a .bex extension):
struct BitName
@ -142,8 +142,8 @@ struct StyleName
static TArray<StyleName> StyleNames;
static TArray<const PClass *> AmmoNames;
static TArray<const PClass *> WeaponNames;
static TArray<PClassActor *> AmmoNames;
static TArray<PClassActor *> WeaponNames;
// DeHackEd trickery to support MBF-style parameters
// List of states that are hacked to use a codepointer
@ -196,7 +196,7 @@ IMPLEMENT_POINTY_CLASS (ADehackedPickup)
DECLARE_POINTER (RealPickup)
END_POINTERS
TArray<PClass *> TouchedActors;
TArray<PClassActor *> TouchedActors;
char *UnchangedSpriteNames;
int NumUnchangedSprites;
@ -318,11 +318,14 @@ static bool ReadChars (char **stuff, int size);
static char *igets (void);
static int GetLine (void);
static void PushTouchedActor(PClass *cls)
static void PushTouchedActor(PClassActor *cls)
{
for(unsigned i = 0; i < TouchedActors.Size(); i++)
{
if (TouchedActors[i] == cls) return;
if (TouchedActors[i] == cls)
{
return;
}
}
TouchedActors.Push(cls);
}
@ -390,7 +393,7 @@ static FState *FindState (int statenum)
{
if (StateMap[i].OwnerIsPickup)
{
PushTouchedActor(const_cast<PClass *>(StateMap[i].Owner));
PushTouchedActor(StateMap[i].Owner);
}
return StateMap[i].State + statenum - stateacc;
}
@ -746,7 +749,7 @@ static int PatchThing (int thingy)
FStateDefinitions statedef;
bool patchedStates = false;
int oldflags;
const PClass *type;
PClassActor *type;
SWORD *ednum, dummyed;
type = NULL;
@ -772,7 +775,7 @@ static int PatchThing (int thingy)
else
{
info = GetDefaultByType (type);
ednum = &type->ActorInfo->DoomEdNum;
ednum = &type->DoomEdNum;
}
}
}
@ -1179,7 +1182,7 @@ static int PatchThing (int thingy)
if (info->flags & MF_SPECIAL)
{
PushTouchedActor(const_cast<PClass *>(type));
PushTouchedActor(const_cast<PClassActor *>(type));
}
// Make MF3_ISMONSTER match MF_COUNTKILL
@ -1193,7 +1196,7 @@ static int PatchThing (int thingy)
}
if (patchedStates)
{
statedef.InstallStates(type->ActorInfo, info);
statedef.InstallStates(type, info);
}
}
@ -1486,7 +1489,7 @@ static int PatchAmmo (int ammoNum)
static int PatchWeapon (int weapNum)
{
int result;
const PClass *type = NULL;
PClassActor *type = NULL;
BYTE dummy[sizeof(AWeapon)];
AWeapon *info = (AWeapon *)&dummy;
bool patchedStates = false;
@ -1589,7 +1592,7 @@ static int PatchWeapon (int weapNum)
if (patchedStates)
{
statedef.InstallStates(type->ActorInfo, info);
statedef.InstallStates(type, info);
}
return result;
@ -1764,14 +1767,14 @@ static int PatchMisc (int dummy)
};
static const PClass * const *types[] =
{
&RUNTIME_CLASS(APowerInvulnerable),
&RUNTIME_CLASS(APowerStrength),
&RUNTIME_CLASS(APowerInvisibility),
&RUNTIME_CLASS(APowerIronFeet),
&RUNTIME_CLASS(APowerLightAmp),
&RUNTIME_CLASS(APowerWeaponLevel2),
&RUNTIME_CLASS(APowerSpeed),
&RUNTIME_CLASS(APowerMinotaur)
&RUNTIME_CLASS_CASTLESS(APowerInvulnerable),
&RUNTIME_CLASS_CASTLESS(APowerStrength),
&RUNTIME_CLASS_CASTLESS(APowerInvisibility),
&RUNTIME_CLASS_CASTLESS(APowerIronFeet),
&RUNTIME_CLASS_CASTLESS(APowerLightAmp),
&RUNTIME_CLASS_CASTLESS(APowerWeaponLevel2),
&RUNTIME_CLASS_CASTLESS(APowerSpeed),
&RUNTIME_CLASS_CASTLESS(APowerMinotaur)
};
int i;
@ -2657,19 +2660,20 @@ static bool LoadDehSupp ()
StateMapper s;
sc.MustGetString();
const PClass *type = PClass::FindClass (sc.String);
PClass *type = PClass::FindClass (sc.String);
if (type == NULL)
{
sc.ScriptError ("Can't find type %s", sc.String);
}
else if (type->ActorInfo == NULL)
else if (!type->IsKindOf(RUNTIME_CLASS(PClassActor)))
{
sc.ScriptError ("%s has no ActorInfo", sc.String);
sc.ScriptError ("%s is not an actor", sc.String);
}
sc.MustGetStringName(",");
sc.MustGetString();
s.State = type->ActorInfo->FindState(sc.String);
PClassActor *actortype = static_cast<PClassActor *>(type);
s.State = actortype->FindState(sc.String);
if (s.State == NULL)
{
sc.ScriptError("Invalid state '%s' in '%s'", sc.String, type->TypeName.GetChars());
@ -2677,14 +2681,14 @@ static bool LoadDehSupp ()
sc.MustGetStringName(",");
sc.MustGetNumber();
if (s.State == NULL || s.State + sc.Number > type->ActorInfo->OwnedStates + type->ActorInfo->NumOwnedStates)
if (s.State == NULL || s.State + sc.Number > actortype->OwnedStates + actortype->NumOwnedStates)
{
sc.ScriptError("Invalid state range in '%s'", type->TypeName.GetChars());
}
AActor *def = GetDefaultByType(type);
s.StateSpan = sc.Number;
s.Owner = type;
s.Owner = actortype;
s.OwnerIsPickup = def != NULL && (def->flags & MF_SPECIAL) != 0;
if (addit) StateMap.Push(s);
@ -2709,7 +2713,7 @@ static bool LoadDehSupp ()
while (!sc.CheckString("}"))
{
sc.MustGetString();
const PClass *cls = PClass::FindClass(sc.String);
PClassActor *cls = PClass::FindActor(sc.String);
if (cls == NULL)
{
sc.ScriptError("Unknown actor type '%s'", sc.String);
@ -2776,12 +2780,12 @@ static bool LoadDehSupp ()
}
else
{
const PClass *cls = PClass::FindClass(sc.String);
PClass *cls = PClass::FindClass(sc.String);
if (cls == NULL || cls->ParentClass != RUNTIME_CLASS(AAmmo))
{
sc.ScriptError("Unknown ammo type '%s'", sc.String);
}
AmmoNames.Push(cls);
AmmoNames.Push(static_cast<PClassActor *>(cls));
}
if (sc.CheckString("}")) break;
sc.MustGetStringName(",");
@ -2793,12 +2797,12 @@ static bool LoadDehSupp ()
while (!sc.CheckString("}"))
{
sc.MustGetString();
const PClass *cls = PClass::FindClass(sc.String);
PClass *cls = PClass::FindClass(sc.String);
if (cls == NULL || !cls->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
{
sc.ScriptError("Unknown weapon type '%s'", sc.String);
}
WeaponNames.Push(cls);
WeaponNames.Push(static_cast<PClassActor *>(cls));
if (sc.CheckString("}")) break;
sc.MustGetStringName(",");
}
@ -2848,7 +2852,7 @@ void FinishDehPatch ()
for (touchedIndex = 0; touchedIndex < TouchedActors.Size(); ++touchedIndex)
{
PClass *type = TouchedActors[touchedIndex];
PClassActor *type = TouchedActors[touchedIndex];
AActor *defaults1 = GetDefaultByType (type);
if (!(defaults1->flags & MF_SPECIAL))
{ // We only need to do this for pickups
@ -2858,8 +2862,8 @@ void FinishDehPatch ()
// Create a new class that will serve as the actual pickup
char typeNameBuilder[32];
mysnprintf (typeNameBuilder, countof(typeNameBuilder), "DehackedPickup%d", touchedIndex);
PClass *subclass = RUNTIME_CLASS(ADehackedPickup)->CreateDerivedClass
(typeNameBuilder, sizeof(ADehackedPickup));
PClassActor *subclass = static_cast<PClassActor *>(RUNTIME_CLASS(ADehackedPickup)->
CreateDerivedClass(typeNameBuilder, sizeof(ADehackedPickup)));
AActor *defaults2 = GetDefaultByType (subclass);
memcpy (defaults2, defaults1, sizeof(AActor));
@ -2870,21 +2874,21 @@ void FinishDehPatch ()
if (!type->IsDescendantOf(RUNTIME_CLASS(AInventory)))
{
// If this is a hacked non-inventory item we must also copy AInventory's special states
statedef.AddStateDefines(RUNTIME_CLASS(AInventory)->ActorInfo->StateList);
statedef.AddStateDefines(RUNTIME_CLASS(AInventory)->StateList);
}
statedef.InstallStates(subclass->ActorInfo, defaults2);
statedef.InstallStates(subclass, defaults2);
// Use the DECORATE replacement feature to redirect all spawns
// of the original class to the new one.
FActorInfo *old_replacement = type->ActorInfo->Replacement;
PClassActor *old_replacement = type->Replacement;
type->ActorInfo->Replacement = subclass->ActorInfo;
subclass->ActorInfo->Replacee = type->ActorInfo;
type->Replacement = subclass;
subclass->Replacee = type;
// If this actor was already replaced by another actor, copy that
// replacement over to this item.
if (old_replacement != NULL)
{
subclass->ActorInfo->Replacement = old_replacement;
subclass->Replacement = old_replacement;
}
DPrintf ("%s replaces %s\n", subclass->TypeName.GetChars(), type->TypeName.GetChars());

View file

@ -2055,7 +2055,7 @@ void D_DoomMain (void)
Printf ("ParseTeamInfo: Load team definitions.\n");
TeamLibrary.ParseTeamInfo ();
FActorInfo::StaticInit ();
PClassActor::StaticInit ();
// [GRB] Initialize player class list
SetupPlayerClasses ();
@ -2105,7 +2105,7 @@ void D_DoomMain (void)
// Create replacements for dehacked pickups
FinishDehPatch();
FActorInfo::StaticSetActorNums ();
PClassActor::StaticSetActorNums ();
// [RH] User-configurable startup strings. Because BOOM does.
static const char *startupString[5] = {

View file

@ -2115,7 +2115,7 @@ void Net_DoCommand (int type, BYTE **stream, int player)
}
typeinfo = PClass::FindClass (s);
if (typeinfo != NULL && typeinfo->ActorInfo != NULL)
if (typeinfo != NULL && typeinfo->IsKindOf(RUNTIME_CLASS(PClassActor)))
{
AActor *source = players[player].mo;
if (source != NULL)
@ -2383,7 +2383,7 @@ void Net_DoCommand (int type, BYTE **stream, int player)
}
for(int i = 0; i < count; ++i)
{
const PClass *wpn = Net_ReadWeapon(stream);
PClassActor *wpn = Net_ReadWeapon(stream);
players[player].weapons.AddSlot(slot, wpn, player == consoleplayer);
}
}
@ -2392,7 +2392,7 @@ void Net_DoCommand (int type, BYTE **stream, int player)
case DEM_ADDSLOT:
{
int slot = ReadByte(stream);
const PClass *wpn = Net_ReadWeapon(stream);
PClassActor *wpn = Net_ReadWeapon(stream);
players[player].weapons.AddSlot(slot, wpn, player == consoleplayer);
}
break;
@ -2400,7 +2400,7 @@ void Net_DoCommand (int type, BYTE **stream, int player)
case DEM_ADDSLOTDEFAULT:
{
int slot = ReadByte(stream);
const PClass *wpn = Net_ReadWeapon(stream);
PClassActor *wpn = Net_ReadWeapon(stream);
players[player].weapons.AddSlotDefault(slot, wpn, player == consoleplayer);
}
break;

View file

@ -598,7 +598,7 @@ void FDecalLib::ParseGenerator (FScanner &sc)
// Get name of generator (actor)
sc.MustGetString ();
type = PClass::FindClass (sc.String);
if (type == NULL || type->ActorInfo == NULL)
if (type == NULL || !type->IsKindOf(RUNTIME_CLASS(PClassActor)))
{
sc.ScriptError ("%s is not an actor.", sc.String);
}

View file

@ -53,9 +53,10 @@ ClassReg DObject::RegistrationInfo =
NULL, // MyClass
"DObject", // Name
NULL, // ParentType
sizeof(DObject), // SizeOf
NULL, // Pointers
&DObject::InPlaceConstructor // ConstructNative
&DObject::InPlaceConstructor, // ConstructNative
sizeof(DObject), // SizeOf
CLASSREG_PClass, // MetaClassNum
};
_DECLARE_TI(DObject)
@ -294,7 +295,6 @@ CCMD (dumpclasses)
int shown, omitted;
DumpInfo *tree = NULL;
const PClass *root = NULL;
bool showall = true;
if (argv.argc() > 1)
{
@ -304,13 +304,6 @@ CCMD (dumpclasses)
Printf ("Class '%s' not found\n", argv[1]);
return;
}
if (stricmp (argv[1], "Actor") == 0)
{
if (argv.argc() < 3 || stricmp (argv[2], "all") != 0)
{
showall = false;
}
}
}
shown = omitted = 0;
@ -318,10 +311,7 @@ CCMD (dumpclasses)
for (i = 0; i < PClass::m_Types.Size(); i++)
{
PClass *cls = PClass::m_Types[i];
if (root == NULL ||
(cls->IsDescendantOf (root) &&
(showall || cls == root ||
cls->ActorInfo != root->ActorInfo)))
if (root == NULL || cls == root || cls->IsDescendantOf(root))
{
DumpInfo::AddType (&tree, cls);
// Printf (" %s\n", PClass::m_Types[i]->Name + 1);

View file

@ -78,7 +78,7 @@ class DFloorWaggle;
class DPlat;
class DPillar;
struct FActorInfo;
class PClassActor;
enum EMetaType
{
@ -131,17 +131,26 @@ private:
};
#define RUNTIME_TYPE(object) (object->GetClass()) // Passed an object, returns the type of that object
#define RUNTIME_CLASS(cls) (cls::RegistrationInfo.MyClass) // Passed a native class name, returns a PClass representing that class
#define RUNTIME_CLASS_CASTLESS(cls) (cls::RegistrationInfo.MyClass) // Passed a native class name, returns a PClass representing that class
#define RUNTIME_CLASS(cls) ((cls::MetaClass *)RUNTIME_CLASS_CASTLESS(cls)) // Like above, but returns the true type of the meta object
#define NATIVE_TYPE(object) (object->StaticType()) // Passed an object, returns the type of the C++ class representing the object
// Enumerations for the meta classes created by ClassReg::RegisterClass()
enum
{
CLASSREG_PClass,
CLASSREG_PClassActor,
};
struct ClassReg
{
PClass *MyClass;
const char *Name;
ClassReg *ParentType;
unsigned int SizeOf;
const size_t *Pointers;
void (*ConstructNative)(void *);
unsigned int SizeOf:31;
unsigned int MetaClassNum:1;
PClass *RegisterClass();
};
@ -156,10 +165,22 @@ private: \
typedef parent Super; \
typedef cls ThisClass;
#define DECLARE_ABSTRACT_CLASS_WITH_META(cls,parent,meta) \
DECLARE_ABSTRACT_CLASS(cls,parent) \
public: \
typedef meta MetaClass; \
MetaClass *GetClass() const { return static_cast<MetaClass *>(DObject::GetClass()); } \
protected: \
enum { MetaClassNum = CLASSREG_##meta }; private: \
#define DECLARE_CLASS(cls,parent) \
DECLARE_ABSTRACT_CLASS(cls,parent) \
private: static void InPlaceConstructor (void *mem);
#define DECLARE_CLASS_WITH_META(cls,parent,meta) \
DECLARE_ABSTRACT_CLASS_WITH_META(cls,parent,meta) \
private: static void InPlaceConstructor (void *mem);
#define HAS_OBJECT_POINTERS \
static const size_t PointerOffsets[];
@ -180,9 +201,10 @@ private: \
NULL, \
#cls, \
&cls::Super::RegistrationInfo, \
sizeof(cls), \
ptrs, \
create }; \
create, \
sizeof(cls), \
cls::MetaClassNum }; \
_DECLARE_TI(cls)
#define _IMP_CREATE_OBJ(cls) \
@ -436,8 +458,11 @@ public:
virtual PClass *StaticType() const { return RegistrationInfo.MyClass; }
static ClassReg RegistrationInfo, * const RegistrationInfoPtr;
static void InPlaceConstructor (void *mem);
typedef PClass MetaClass;
private:
typedef DObject ThisClass;
protected:
enum { MetaClassNum = CLASSREG_PClass };
// Per-instance variables. There are four.
private:
@ -592,4 +617,18 @@ inline bool DObject::IsA (const PClass *type) const
return (type == GetClass());
}
template<class T> T *dyn_cast(DObject *p)
{
if (p != NULL && p->IsKindOf(RUNTIME_CLASS_CASTLESS(T)))
{
return static_cast<T *>(p);
}
return NULL;
}
template<class T> const T *dyn_cast(const DObject *p)
{
return dyn_cast<T>(const_cast<DObject *>(p));
}
#endif //__DOBJECT_H__

View file

@ -43,7 +43,7 @@ IMPLEMENT_POINTY_CLASS(PClass)
DECLARE_POINTER(ParentClass)
END_POINTERS
TArray<PClass *> PClass::m_RuntimeActors;
TArray<PClassActor *> PClass::m_RuntimeActors;
TArray<PClass *> PClass::m_Types;
PClass *PClass::TypeHash[PClass::HASH_SIZE];
bool PClass::bShutdown;
@ -103,8 +103,6 @@ void PClass::StaticShutdown ()
uniqueFPs.Push(const_cast<size_t *>(type->FlatPointers));
}
}
// For runtime classes, this call will also delete the PClass.
PClass::StaticFreeData (type);
}
for (i = 0; i < uniqueFPs.Size(); ++i)
{
@ -119,7 +117,6 @@ PClass::PClass()
ParentClass = NULL;
Pointers = NULL;
FlatPointers = NULL;
ActorInfo = NULL;
HashNext = NULL;
Defaults = NULL;
bRuntimeClass = false;
@ -129,45 +126,11 @@ PClass::PClass()
PClass::~PClass()
{
Symbols.ReleaseSymbols();
if (Defaults != NULL)
{
M_Free(Defaults);
Defaults = NULL;
}
void PClass::StaticFreeData (PClass *type)
{
if (type->Defaults != NULL)
{
M_Free(type->Defaults);
type->Defaults = NULL;
}
type->FreeStateList ();
if (type->ActorInfo != NULL)
{
if (type->ActorInfo->OwnedStates != NULL)
{
delete[] type->ActorInfo->OwnedStates;
type->ActorInfo->OwnedStates = NULL;
}
if (type->ActorInfo->DamageFactors != NULL)
{
delete type->ActorInfo->DamageFactors;
type->ActorInfo->DamageFactors = NULL;
}
if (type->ActorInfo->PainChances != NULL)
{
delete type->ActorInfo->PainChances;
type->ActorInfo->PainChances = NULL;
}
delete type->ActorInfo;
type->ActorInfo = NULL;
}/*
if (type->bRuntimeClass)
{
delete type;
}
else
{
type->Symbols.ReleaseSymbols();
}*/
}
PClass *ClassReg::RegisterClass()
@ -180,7 +143,21 @@ PClass *ClassReg::RegisterClass()
}
// Add type to list
PClass *cls = new PClass;
PClass *cls;
switch (MetaClassNum)
{
case CLASSREG_PClass:
cls = new PClass;
break;
case CLASSREG_PClassActor:
cls = new PClassActor;
break;
default:
assert(0 && "Class registry has an invalid meta class identifier");
}
MyClass = cls;
PClass::m_Types.Push(cls);
cls->TypeName = FName(Name+1);
@ -292,7 +269,8 @@ PClass *PClass::CreateDerivedClass (FName name, unsigned int size)
}
else
{
type = new PClass;
// Create a new type object of the same type as us. (We may be a derived class of PClass.)
type = static_cast<PClass *>(GetClass()->CreateNew());
notnew = false;
}
@ -317,27 +295,17 @@ PClass *PClass::CreateDerivedClass (FName name, unsigned int size)
type->FlatPointers = NULL;
type->bRuntimeClass = true;
type->ActorInfo = NULL;
type->Symbols.SetParentTable (&this->Symbols);
if (!notnew) type->InsertIntoHash();
if (!notnew)
{
type->InsertIntoHash();
}
// If this class has an actor info, then any classes derived from it
// also need an actor info.
if (this->ActorInfo != NULL)
if (type->IsKindOf(RUNTIME_CLASS(PClassActor)))
{
FActorInfo *info = type->ActorInfo = new FActorInfo;
info->Class = type;
info->GameFilter = GAME_Any;
info->SpawnID = 0;
info->DoomEdNum = -1;
info->OwnedStates = NULL;
info->NumOwnedStates = 0;
info->Replacement = NULL;
info->Replacee = NULL;
info->StateList = NULL;
info->DamageFactors = NULL;
info->PainChances = NULL;
m_RuntimeActors.Push (type);
m_RuntimeActors.Push(static_cast<PClassActor *>(type));
}
return type;
}
@ -358,7 +326,7 @@ unsigned int PClass::Extend(unsigned int extension)
// Like FindClass but creates a placeholder if no class
// is found. CreateDerivedClass will automatcally fill in
// the placeholder when the actual class is defined.
const PClass *PClass::FindClassTentative (FName name)
PClass *PClass::FindClassTentative (FName name)
{
if (name == NAME_None)
{
@ -383,7 +351,7 @@ const PClass *PClass::FindClassTentative (FName name)
break;
}
}
PClass *type = new PClass;
PClass *type = new PClassActor;
DPrintf("Creating placeholder class %s : %s\n", name.GetChars(), TypeName.GetChars());
type->TypeName = name;
@ -395,45 +363,10 @@ const PClass *PClass::FindClassTentative (FName name)
type->Defaults = NULL;
type->FlatPointers = NULL;
type->bRuntimeClass = true;
type->ActorInfo = NULL;
type->InsertIntoHash();
return type;
}
// This is used by DECORATE to assign ActorInfos to internal classes
void PClass::InitializeActorInfo ()
{
Symbols.SetParentTable (&ParentClass->Symbols);
Defaults = new BYTE[Size];
if (ParentClass->Defaults != NULL)
{
memcpy (Defaults, ParentClass->Defaults, ParentClass->Size);
if (Size > ParentClass->Size)
{
memset (Defaults + ParentClass->Size, 0, Size - ParentClass->Size);
}
}
else
{
memset (Defaults, 0, Size);
}
FActorInfo *info = ActorInfo = new FActorInfo;
info->Class = this;
info->GameFilter = GAME_Any;
info->SpawnID = 0;
info->DoomEdNum = -1;
info->OwnedStates = NULL;
info->NumOwnedStates = 0;
info->Replacement = NULL;
info->Replacee = NULL;
info->StateList = NULL;
info->DamageFactors = NULL;
info->PainChances = NULL;
m_RuntimeActors.Push (this);
}
// Create the FlatPointers array, if it doesn't exist already.
// It comprises all the Pointers from superclasses plus this class's own Pointers.
// If this class does not define any new Pointers, then FlatPointers will be set
@ -485,16 +418,6 @@ void PClass::BuildFlatPointers ()
}
}
void PClass::FreeStateList ()
{
if (ActorInfo != NULL && ActorInfo->StateList != NULL)
{
ActorInfo->StateList->Destroy();
M_Free (ActorInfo->StateList);
ActorInfo->StateList = NULL;
}
}
const PClass *PClass::NativeClass() const
{
const PClass *cls = this;
@ -512,18 +435,6 @@ size_t PClass::PropagateMark()
// Mark symbols
marked = Symbols.MarkSymbols();
// Mark state functions
if (ActorInfo != NULL)
{
for (int i = 0; i < ActorInfo->NumOwnedStates; ++i)
{
if (ActorInfo->OwnedStates[i].ActionFunc != NULL)
{
GC::Mark(ActorInfo->OwnedStates[i].ActionFunc);
}
}
// marked += ActorInfo->NumOwnedStates * sizeof(FState);
}
return marked + Super::PropagateMark();
}

View file

@ -156,7 +156,6 @@ class PClass : public DObject
public:
static void StaticInit ();
static void StaticShutdown ();
static void StaticFreeData (PClass *type);
// Per-class information -------------------------------------
FName TypeName; // this class's name
@ -164,7 +163,6 @@ public:
PClass *ParentClass; // the class this class derives from
const size_t *Pointers; // object pointers defined by this class *only*
const size_t *FlatPointers; // object pointers defined by this class and all its superclasses; not initialized by default
FActorInfo *ActorInfo;
PClass *HashNext;
FMetaTable Meta;
BYTE *Defaults;
@ -183,7 +181,6 @@ public:
unsigned int Extend(unsigned int extension);
void InitializeActorInfo ();
void BuildFlatPointers ();
void FreeStateList();
const PClass *NativeClass() const;
size_t PropagateMark();
@ -208,10 +205,14 @@ public:
static PClass *FindClass (const FString &name) { return FindClass (FName (name, true)); }
static PClass *FindClass (ENamedName name) { return FindClass (FName (name)); }
static PClass *FindClass (FName name);
const PClass *FindClassTentative (FName name); // not static!
static PClassActor *FindActor (const char *name) { return FindActor (FName (name, true)); }
static PClassActor *FindActor (const FString &name) { return FindActor (FName (name, true)); }
static PClassActor *FindActor (ENamedName name) { return FindActor (FName (name)); }
static PClassActor *FindActor (FName name);
PClass *FindClassTentative (FName name); // not static!
static TArray<PClass *> m_Types;
static TArray<PClass *> m_RuntimeActors;
static TArray<PClassActor *> m_RuntimeActors;
enum { HASH_SIZE = 256 };
static PClass *TypeHash[HASH_SIZE];

View file

@ -467,7 +467,7 @@ struct castinfo_t
const char *name;
const char *type;
const AActor *info;
const PClass *Class;
const PClassActor *Class;
};
castinfo_t castorder[] =
@ -566,7 +566,7 @@ void F_StartCast (void)
else
{
castorder[i].info = GetDefaultByType (type);
castorder[i].Class= type;
castorder[i].Class= dyn_cast<PClassActor>(type);
}
}
@ -729,7 +729,7 @@ bool F_CastResponder (event_t* ev)
// go into death frame
castdeath = true;
caststate = castorder[castnum].Class->ActorInfo->FindState(NAME_Death);
caststate = castorder[castnum].Class->FindState(NAME_Death);
if (caststate != NULL)
{
casttics = caststate->GetTics();

View file

@ -169,6 +169,12 @@ virtual void Read (void *mem, unsigned int len);
void UserWriteClass (const PClass *info);
void UserReadClass (const PClass *&info);
template<typename T> void UserReadClass(const T *&info)
{
const PClass *myclass;
UserReadClass(myclass);
info = dyn_cast<T>(const_cast<PClass *>(myclass));
}
FArchive& operator<< (BYTE &c);
FArchive& operator<< (WORD &s);

View file

@ -85,7 +85,7 @@ void A_Fire(AActor *self, int height)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_VileTarget)
{
PARAM_ACTION_PROLOGUE;
PARAM_CLASS_OPT(fire, AActor) { fire = PClass::FindClass("ArchvileFire"); }
PARAM_CLASS_OPT(fire, AActor) { fire = PClass::FindActor("ArchvileFire"); }
AActor *fog;

View file

@ -39,13 +39,12 @@ static void BrainishExplosion (fixed_t x, fixed_t y, fixed_t z)
boom->DeathSound = "misc/brainexplode";
boom->velz = pr_brainscream() << 9;
const PClass *cls = PClass::FindClass("BossBrain");
PClassActor *cls = PClass::FindActor("BossBrain");
if (cls != NULL)
{
FState *state = cls->ActorInfo->FindState(NAME_Brainexplode);
FState *state = cls->FindState(NAME_Brainexplode);
if (state != NULL)
boom->SetState (state);
}
boom->effects = 0;
boom->Damage = 0; // disables collision detection which is not wanted here
@ -107,7 +106,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BrainSpit)
{
if (spawntype == NULL)
{
spawntype = PClass::FindClass("SpawnShot");
spawntype = PClass::FindActor("SpawnShot");
isdefault = true;
}
@ -282,7 +281,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnFly)
}
else
{
spawntype = PClass::FindClass("SpawnFire");
spawntype = PClass::FindActor("SpawnFire");
sound = "brain/spawn";
}
SpawnFly(self, spawntype, sound);

View file

@ -98,7 +98,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePistol)
S_Sound (self, CHAN_WEAPON, "weapons/pistol", 1, ATTN_NORM);
P_GunShot (self, accurate, PClass::FindClass(NAME_BulletPuff), P_BulletSlope (self));
P_GunShot (self, accurate, PClass::FindActor(NAME_BulletPuff), P_BulletSlope (self));
return 0;
}
@ -130,9 +130,13 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Saw)
}
if (pufftype == NULL)
pufftype = PClass::FindClass(NAME_BulletPuff);
{
pufftype = PClass::FindActor(NAME_BulletPuff);
}
if (damage == 0)
{
damage = 2;
}
damage *= (pr_saw()%10 + 1);
angle = self->angle;
@ -199,7 +203,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireShotgun)
angle_t pitch = P_BulletSlope (self);
for (i = 0; i < 7; i++)
P_GunShot (self, false, PClass::FindClass(NAME_BulletPuff), pitch);
{
P_GunShot (self, false, PClass::FindActor(NAME_BulletPuff), pitch);
}
return 0;
}
@ -289,15 +295,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_CloseShotgun2)
void P_SetSafeFlash(AWeapon *weapon, player_t *player, FState *flashstate, int index)
{
const PClass * cls = weapon->GetClass();
PClassActor *cls = weapon->GetClass();
while (cls != RUNTIME_CLASS(AWeapon))
{
FActorInfo * info = cls->ActorInfo;
if (flashstate >= info->OwnedStates && flashstate < info->OwnedStates + info->NumOwnedStates)
if (flashstate >= cls->OwnedStates && flashstate < cls->OwnedStates + cls->NumOwnedStates)
{
// The flash state belongs to this class.
// Now let's check if the actually wanted state does also
if (flashstate+index < info->OwnedStates + info->NumOwnedStates)
if (flashstate + index < cls->OwnedStates + cls->NumOwnedStates)
{
// we're ok so set the state
P_SetPsprite (player, ps_flash, flashstate + index);
@ -311,7 +316,7 @@ void P_SetSafeFlash(AWeapon * weapon, player_t * player, FState * flashstate, in
}
}
// try again with parent class
cls = cls->ParentClass;
cls = static_cast<PClassActor *>(cls->ParentClass);
}
// if we get here the state doesn't seem to belong to any class in the inheritance chain
// This can happen with Dehacked if the flash states are remapped.
@ -362,7 +367,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireCGun)
}
player->mo->PlayAttacking2 ();
P_GunShot (self, !player->refire, PClass::FindClass(NAME_BulletPuff), P_BulletSlope (self));
P_GunShot (self, !player->refire, PClass::FindActor(NAME_BulletPuff), P_BulletSlope (self));
return 0;
}
@ -395,7 +400,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireMissile)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireSTGrenade)
{
PARAM_ACTION_PROLOGUE;
PARAM_CLASS_OPT(grenade, AActor) { grenade = PClass::FindClass("Grenade"); }
PARAM_CLASS_OPT(grenade, AActor) { grenade = PClass::FindActor("Grenade"); }
player_t *player;
@ -555,7 +560,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BFGSpray)
AActor *linetarget;
if (spraytype == NULL) spraytype = PClass::FindClass("BFGExtra");
if (spraytype == NULL) spraytype = PClass::FindActor("BFGExtra");
if (numrays <= 0) numrays = 40;
if (damagecnt <= 0) damagecnt = 15;

View file

@ -37,7 +37,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FatAttack1)
if (!self->target)
return 0;
if (spawntype == NULL) spawntype = PClass::FindClass("FatShot");
if (spawntype == NULL) spawntype = PClass::FindActor("FatShot");
A_FaceTarget (self);
// Change direction to ...
@ -66,7 +66,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FatAttack2)
if (!self->target)
return 0;
if (spawntype == NULL) spawntype = PClass::FindClass("FatShot");
if (spawntype == NULL) spawntype = PClass::FindActor("FatShot");
A_FaceTarget (self);
// Now here choose opposite deviation.
@ -95,7 +95,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FatAttack3)
if (!self->target)
return 0;
if (spawntype == NULL) spawntype = PClass::FindClass("FatShot");
if (spawntype == NULL) spawntype = PClass::FindActor("FatShot");
A_FaceTarget (self);
@ -144,8 +144,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_Mushroom)
int i, j;
if (n == 0) n = self->Damage; // GetMissileDamage (0, 1);
if (spawntype == NULL) spawntype = PClass::FindClass("FatShot");
if (n == 0)
{
n = self->Damage; // GetMissileDamage (0, 1);
}
if (spawntype == NULL)
{
spawntype = PClass::FindActor("FatShot");
}
P_RadiusAttack (self, self->target, 128, 128, self->DamageType, !(flags & MSF_DontHurt));
P_CheckSplash(self, 128<<FRACBITS);

View file

@ -263,8 +263,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_Saw)
if (self->target == NULL)
return 0;
if (pufftype == NULL) pufftype = PClass::FindClass(NAME_BulletPuff);
if (damage == 0) damage = 2;
if (pufftype == NULL)
{
pufftype = PClass::FindActor(NAME_BulletPuff);
}
if (damage == 0)
{
damage = 2;
}
A_FaceTarget (self);
if (self->CheckMeleeRange ())
@ -357,7 +363,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_Punch)
//
//============================================================================
void P_GunShot2 (AActor *mo, bool accurate, int pitch, const PClass *pufftype)
void P_GunShot2 (AActor *mo, bool accurate, int pitch, PClassActor *pufftype)
{
angle_t angle;
int damage;
@ -390,7 +396,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_FirePistol)
S_Sound (self, CHAN_WEAPON, "weapons/pistol", 1, ATTN_NORM);
A_FaceTarget (self);
P_GunShot2 (self, accurate, P_AimLineAttack (self, self->angle, MISSILERANGE),
PClass::FindClass(NAME_BulletPuff));
PClass::FindActor(NAME_BulletPuff));
return 0;
}
@ -414,7 +420,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_FireShotgun)
pitch = P_AimLineAttack (self, self->angle, MISSILERANGE);
for (int i = 0; i < 7; ++i)
{
P_GunShot2 (self, false, pitch, PClass::FindClass(NAME_BulletPuff));
P_GunShot2 (self, false, pitch, PClass::FindActor(NAME_BulletPuff));
}
self->special1 = level.maptime + 27;
return 0;
@ -489,7 +495,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_M_FireCGun)
S_Sound (self, CHAN_WEAPON, "weapons/chngun", 1, ATTN_NORM);
A_FaceTarget (self);
P_GunShot2 (self, accurate, P_AimLineAttack (self, self->angle, MISSILERANGE),
PClass::FindClass(NAME_BulletPuff));
PClass::FindActor(NAME_BulletPuff));
return 0;
}
@ -637,9 +643,9 @@ void AScriptedMarine::SetWeapon (EMarineWeapon type)
void AScriptedMarine::SetSprite (const PClass *source)
{
if (source == NULL || source->ActorInfo == NULL)
if (source == NULL)
{ // A valid actor class wasn't passed, so use the standard sprite
SpriteOverride = sprite = GetClass()->ActorInfo->OwnedStates[0].sprite;
SpriteOverride = sprite = GetClass()->OwnedStates[0].sprite;
// Copy the standard scaling
scaleX = GetDefault()->scaleX;
scaleY = GetDefault()->scaleY;

View file

@ -419,13 +419,16 @@ CCMD (use)
{
if (argv.argc() > 1 && who != NULL)
{
SendItemUse = who->FindInventory (PClass::FindClass (argv[1]));
SendItemUse = who->FindInventory(PClass::FindActor(argv[1]));
}
}
CCMD (invdrop)
{
if (players[consoleplayer].mo) SendItemDrop = players[consoleplayer].mo->InvSel;
if (players[consoleplayer].mo)
{
SendItemDrop = players[consoleplayer].mo->InvSel;
}
}
CCMD (weapdrop)
@ -437,7 +440,7 @@ CCMD (drop)
{
if (argv.argc() > 1 && who != NULL)
{
SendItemDrop = who->FindInventory (PClass::FindClass (argv[1]));
SendItemDrop = who->FindInventory(PClass::FindActor(argv[1]));
}
}
@ -476,7 +479,7 @@ CCMD (select)
{
if (argv.argc() > 1)
{
AInventory *item = who->FindInventory (PClass::FindClass (argv[1]));
AInventory *item = who->FindInventory(PClass::FindActor(argv[1]));
if (item != NULL)
{
who->InvSel = item;

View file

@ -43,7 +43,7 @@ static FRandom pr_volcimpact ("VolcBallImpact");
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_PodPain)
{
PARAM_ACTION_PROLOGUE;
PARAM_CLASS_OPT (gootype, AActor) { gootype = PClass::FindClass("PodGoo"); }
PARAM_CLASS_OPT (gootype, AActor) { gootype = PClass::FindActor("PodGoo"); }
int count;
int chance;
@ -98,7 +98,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_RemovePod)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_MakePod)
{
PARAM_ACTION_PROLOGUE;
PARAM_CLASS_OPT(podtype, AActor) { podtype = PClass::FindClass("Pod"); }
PARAM_CLASS_OPT(podtype, AActor) { podtype = PClass::FindActor("Pod"); }
AActor *mo;
fixed_t x;

View file

@ -82,7 +82,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_StaffAttack)
if (!weapon->DepleteAmmo (weapon->bAltFire))
return 0;
}
if (puff == NULL) puff = PClass::FindClass(NAME_BulletPuff); // just to be sure
if (puff == NULL)
{
puff = PClass::FindActor(NAME_BulletPuff); // just to be sure
}
angle = self->angle;
angle += pr_sap.Random2() << 18;
slope = P_AimLineAttack (self, angle, MELEERANGE, &linetarget);
@ -254,7 +257,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GauntletAttack)
int randVal;
fixed_t dist;
player_t *player;
const PClass *pufftype;
PClassActor *pufftype;
AActor *linetarget;
if (NULL == (player = self->player))
@ -278,14 +281,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GauntletAttack)
damage = pr_gatk.HitDice (2);
dist = 4*MELEERANGE;
angle += pr_gatk.Random2() << 17;
pufftype = PClass::FindClass("GauntletPuff2");
pufftype = PClass::FindActor("GauntletPuff2");
}
else
{
damage = pr_gatk.HitDice (2);
dist = MELEERANGE+1;
angle += pr_gatk.Random2() << 18;
pufftype = PClass::FindClass("GauntletPuff1");
pufftype = PClass::FindActor("GauntletPuff1");
}
slope = P_AimLineAttack (self, angle, dist, &linetarget);
P_LineAttack (self, angle, dist, slope, damage, NAME_Melee, pufftype);

View file

@ -100,7 +100,7 @@ DEFINE_ACTION_FUNCTION_PARAMS (AActor, A_Blast)
PARAM_FIXED_OPT (strength) { strength = 255; }
PARAM_FIXED_OPT (radius) { radius = 255; }
PARAM_FIXED_OPT (speed) { speed = 20; }
PARAM_CLASS_OPT (blasteffect, AActor) { blasteffect = PClass::FindClass("BlastEffect"); }
PARAM_CLASS_OPT (blasteffect, AActor) { blasteffect = PClass::FindActor("BlastEffect"); }
PARAM_SOUND_OPT (blastsound) { blastsound = "BlastRadius"; }
AActor *mo;

View file

@ -38,7 +38,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CMaceAttack)
slope = P_AimLineAttack (player->mo, angle, 2*MELEERANGE, &linetarget);
if (linetarget)
{
P_LineAttack (player->mo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"), true);
P_LineAttack (player->mo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, PClass::FindActor("HammerPuff"), true);
AdjustPlayerAngle (player->mo, linetarget);
// player->mo->angle = R_PointToAngle2(player->mo->x,
// player->mo->y, linetarget->x, linetarget->y);
@ -48,7 +48,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CMaceAttack)
slope = P_AimLineAttack (player->mo, angle, 2*MELEERANGE, &linetarget);
if (linetarget)
{
P_LineAttack (player->mo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"), true);
P_LineAttack (player->mo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, PClass::FindActor("HammerPuff"), true);
AdjustPlayerAngle (player->mo, linetarget);
// player->mo->angle = R_PointToAngle2(player->mo->x,
// player->mo->y, linetarget->x, linetarget->y);
@ -60,7 +60,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CMaceAttack)
angle = player->mo->angle;
slope = P_AimLineAttack (player->mo, angle, MELEERANGE, &linetarget);
P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"));
P_LineAttack (player->mo, angle, MELEERANGE, slope, damage, NAME_Melee, PClass::FindActor("HammerPuff"));
macedone:
return 0;
}

View file

@ -72,7 +72,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck)
slope = P_AimLineAttack (pmo, angle, fixed_t(1.5*MELEERANGE), &linetarget, 0, false, true);
if (linetarget)
{
P_LineAttack (pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, PClass::FindClass ("CStaffPuff"));
P_LineAttack (pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, PClass::FindActor("CStaffPuff"));
pmo->angle = R_PointToAngle2 (pmo->x, pmo->y,
linetarget->x, linetarget->y);
if (((linetarget->player && (!linetarget->IsTeammate (pmo) || level.teamdamage != 0))|| linetarget->flags3&MF3_ISMONSTER)
@ -96,7 +96,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck)
slope = P_AimLineAttack (player->mo, angle, fixed_t(1.5*MELEERANGE), &linetarget, 0, false, true);
if (linetarget)
{
P_LineAttack (pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, PClass::FindClass ("CStaffPuff"));
P_LineAttack (pmo, angle, fixed_t(1.5*MELEERANGE), slope, damage, NAME_Melee, PClass::FindActor("CStaffPuff"));
pmo->angle = R_PointToAngle2 (pmo->x, pmo->y,
linetarget->x, linetarget->y);
if ((linetarget->player && (!linetarget->IsTeammate (pmo) || level.teamdamage != 0)) || linetarget->flags3&MF3_ISMONSTER)

View file

@ -211,7 +211,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeAttack)
int useMana;
player_t *player;
AWeapon *weapon;
const PClass *pufftype;
PClassActor *pufftype;
AActor *linetarget;
if (NULL == (player = self->player))
@ -228,12 +228,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeAttack)
{
damage <<= 1;
power = 6*FRACUNIT;
pufftype = PClass::FindClass ("AxePuffGlow");
pufftype = PClass::FindActor ("AxePuffGlow");
useMana = 1;
}
else
{
pufftype = PClass::FindClass ("AxePuff");
pufftype = PClass::FindActor ("AxePuff");
useMana = 0;
}
for (i = 0; i < 16; i++)

View file

@ -36,6 +36,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack)
int i;
player_t *player;
AActor *linetarget;
PClassActor *hammertime;
if (NULL == (player = self->player))
{
@ -45,13 +46,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack)
damage = 60+(pr_hammeratk()&63);
power = 10*FRACUNIT;
hammertime = PClass::FindActor("HammerPuff");
for (i = 0; i < 16; i++)
{
angle = pmo->angle + i*(ANG45/32);
slope = P_AimLineAttack (pmo, angle, HAMMER_RANGE, &linetarget, 0, false, true);
if (linetarget)
{
P_LineAttack (pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"), true);
P_LineAttack (pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, hammertime, true);
AdjustPlayerAngle(pmo, linetarget);
if (linetarget->flags3&MF3_ISMONSTER || linetarget->player)
{
@ -64,7 +66,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack)
slope = P_AimLineAttack(pmo, angle, HAMMER_RANGE, &linetarget, 0, false, true);
if(linetarget)
{
P_LineAttack(pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"), true);
P_LineAttack(pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, hammertime, true);
AdjustPlayerAngle(pmo, linetarget);
if (linetarget->flags3&MF3_ISMONSTER || linetarget->player)
{
@ -77,7 +79,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack)
// didn't find any targets in meleerange, so set to throw out a hammer
angle = pmo->angle;
slope = P_AimLineAttack (pmo, angle, HAMMER_RANGE, &linetarget, 0, false, true);
if (P_LineAttack (pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, PClass::FindClass ("HammerPuff"), true) != NULL)
if (P_LineAttack (pmo, angle, HAMMER_RANGE, slope, damage, NAME_Melee, hammertime, true) != NULL)
{
pmo->special1 = false;
}

View file

@ -142,7 +142,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FPunchAttack)
fixed_t power;
int i;
player_t *player;
const PClass *pufftype;
PClassActor *pufftype;
AActor *linetarget;
if (NULL == (player = self->player))
@ -153,7 +153,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FPunchAttack)
damage = 40+(pr_fpatk()&15);
power = 2*FRACUNIT;
pufftype = PClass::FindClass ("PunchPuff");
pufftype = PClass::FindActor("PunchPuff");
for (i = 0; i < 16; i++)
{
angle = pmo->angle + i*(ANG45/16);
@ -165,7 +165,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FPunchAttack)
{
damage <<= 1;
power = 6*FRACUNIT;
pufftype = PClass::FindClass ("HammerPuff");
pufftype = PClass::FindActor("HammerPuff");
}
P_LineAttack (pmo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, pufftype, true);
if (linetarget->flags3&MF3_ISMONSTER || linetarget->player)
@ -184,7 +184,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FPunchAttack)
{
damage <<= 1;
power = 6*FRACUNIT;
pufftype = PClass::FindClass ("HammerPuff");
pufftype = PClass::FindActor("HammerPuff");
}
P_LineAttack (pmo, angle, 2*MELEERANGE, slope, damage, NAME_Melee, pufftype, true);
if (linetarget->flags3&MF3_ISMONSTER || linetarget->player)

View file

@ -269,8 +269,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningZap)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_MLightningAttack)
{
PARAM_ACTION_PROLOGUE;
PARAM_CLASS_OPT(floor, AActor) { floor = PClass::FindClass("LightningFloor"); }
PARAM_CLASS_OPT(ceiling, AActor) { ceiling = PClass::FindClass("LightningCeiling"); }
PARAM_CLASS_OPT(floor, AActor) { floor = PClass::FindActor("LightningFloor"); }
PARAM_CLASS_OPT(ceiling, AActor) { ceiling = PClass::FindActor("LightningCeiling"); }
AActor *fmo, *cmo;

View file

@ -29,7 +29,7 @@ public:
void Unload ();
bool CheckModified ();
void SetVial (FTexture *pic, AActor *actor, const PClass *manaType);
void SetVial (FTexture *pic, AActor *actor, PClassActor *manaType);
protected:
BYTE Pixels[5*24];
@ -93,7 +93,7 @@ const BYTE *FManaBar::GetPixels ()
return Pixels;
}
void FManaBar::SetVial (FTexture *pic, AActor *actor, const PClass *manaType)
void FManaBar::SetVial (FTexture *pic, AActor *actor, PClassActor *manaType)
{
int level, max;
AInventory *ammo;
@ -457,8 +457,8 @@ private:
// If the weapon uses some ammo that is not mana, do not draw
// the mana bars; draw the specific used ammo instead.
const PClass *mana1 = PClass::FindClass(NAME_Mana1);
const PClass *mana2 = PClass::FindClass(NAME_Mana2);
PClassActor *mana1 = PClass::FindActor(NAME_Mana1);
PClassActor *mana2 = PClass::FindActor(NAME_Mana2);
drawbar = !((ammo1 != NULL && ammo1->GetClass() != mana1 && ammo1->GetClass() != mana2) ||
(ammo2 != NULL && ammo2->GetClass() != mana1 && ammo2->GetClass() != mana2));
@ -564,7 +564,7 @@ private:
//
//---------------------------------------------------------------------------
void DrawManaBars (AAmmo *ammo1, AAmmo *ammo2, const PClass *manatype1, const PClass *manatype2)
void DrawManaBars (AAmmo *ammo1, AAmmo *ammo2, PClassActor *manatype1, PClassActor *manatype2)
{
AAmmo *mana1 = NULL, *mana2 = NULL;
int usemana1 = false, usemana2 = false;
@ -1004,8 +1004,8 @@ private:
// If the weapon uses some ammo that is not mana, do not draw
// the mana blocks; draw the specific used ammo instead.
const PClass *mana1 = PClass::FindClass(NAME_Mana1);
const PClass *mana2 = PClass::FindClass(NAME_Mana2);
PClassActor *mana1 = PClass::FindActor(NAME_Mana1);
PClassActor *mana2 = PClass::FindActor(NAME_Mana2);
drawmana = !((ammo1 != NULL && ammo1->GetClass() != mana1 && ammo1->GetClass() != mana2) ||
(ammo2 != NULL && ammo2->GetClass() != mana1 && ammo2->GetClass() != mana2));

View file

@ -351,7 +351,7 @@ level_info_t *level_info_t::CheckLevelRedirect ()
{
if (RedirectType != NAME_None)
{
const PClass *type = PClass::FindClass(RedirectType);
PClassActor *type = PClass::FindActor(RedirectType);
if (type != NULL)
{
for (int i = 0; i < MAXPLAYERS; ++i)

View file

@ -66,7 +66,7 @@ bool AArtiTeleport::Use (bool pickup)
bool P_AutoUseChaosDevice (player_t *player)
{
AInventory *arti = player->mo->FindInventory(PClass::FindClass("ArtiTeleport"));
AInventory *arti = player->mo->FindInventory(PClass::FindActor("ArtiTeleport"));
if (arti != NULL)
{

View file

@ -104,7 +104,7 @@ void AMinotaurFriend::Die (AActor *source, AActor *inflictor)
if (mo == NULL)
{
AInventory *power = tracer->FindInventory (PClass::FindClass("PowerMinotaur"));
AInventory *power = tracer->FindInventory(PClass::FindActor("PowerMinotaur"));
if (power != NULL)
{
power->Destroy ();

View file

@ -160,7 +160,7 @@ void ABasicArmor::AbsorbDamage (int damage, FName damageType, int &newdamage)
// The differences include not checking for the NAME_None key (doesn't seem appropriate here),
// not using a default value, and of course the way the damage factor info is obtained.
const fixed_t *pdf = NULL;
DmgFactors *df = PClass::FindClass(ArmorType)->ActorInfo->DamageFactors;
DmgFactors *df = PClass::FindActor(ArmorType)->DamageFactors;
if (df != NULL && df->CountUsed() != 0)
{
pdf = df->CheckKey(damageType);

View file

@ -1460,7 +1460,7 @@ void APowerDamage::ModifyDamage(int damage, FName damageType, int &newdamage, bo
if (!passive && damage > 0)
{
const fixed_t *pdf = NULL;
DmgFactors * df = GetClass()->ActorInfo->DamageFactors;
DmgFactors *df = GetClass()->DamageFactors;
if (df != NULL && df->CountUsed() != 0)
{
pdf = df->CheckKey(damageType);
@ -1538,7 +1538,7 @@ void APowerProtection::ModifyDamage(int damage, FName damageType, int &newdamage
if (passive && damage > 0)
{
const fixed_t *pdf = NULL;
DmgFactors *df = GetClass()->ActorInfo->DamageFactors;
DmgFactors *df = GetClass()->DamageFactors;
if (df != NULL && df->CountUsed() != 0)
{
pdf = df->CheckKey(damageType);

View file

@ -40,7 +40,7 @@ public:
virtual bool Use (bool pickup);
virtual void Serialize (FArchive &arc);
const PClass *PowerupType;
PClassActor *PowerupType;
int EffectTics; // Non-0 to override the powerup's default tics
PalEntry BlendColor; // Non-0 to override the powerup's default blend
FNameNoInit Mode; // Meaning depends on powerup - used for Invulnerability and Invisibility

View file

@ -112,7 +112,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_BridgeInit)
AActor *ball;
fixed_t cx, cy, cz;
if (balltype == NULL) balltype = PClass::FindClass("BridgeBall");
if (balltype == NULL)
{
balltype = PClass::FindActor("BridgeBall");
}
cx = self->x;
cy = self->y;

View file

@ -14,7 +14,7 @@
struct OneKey
{
const PClass *key;
PClassActor *key;
int count;
bool check(AActor *owner)
@ -99,7 +99,7 @@ static const char * keywords_lock[]={
//
//===========================================================================
static void AddOneKey(Keygroup *keygroup, const PClass *mi, FScanner &sc)
static void AddOneKey(Keygroup *keygroup, PClassActor *mi, FScanner &sc)
{
if (mi)
{
@ -139,14 +139,14 @@ static void AddOneKey(Keygroup *keygroup, const PClass *mi, FScanner &sc)
static Keygroup *ParseKeygroup(FScanner &sc)
{
Keygroup *keygroup;
const PClass * mi;
PClassActor *mi;
sc.MustGetStringName("{");
keygroup = new Keygroup;
while (!sc.CheckString("}"))
{
sc.MustGetString();
mi = PClass::FindClass(sc.String);
mi = PClass::FindActor(sc.String);
AddOneKey(keygroup, mi, sc);
}
if (keygroup->anykeylist.Size() == 0)
@ -187,7 +187,7 @@ static void ParseLock(FScanner &sc)
Lock sink;
Lock *lock = &sink;
Keygroup *keygroup;
const PClass * mi;
PClassActor *mi;
sc.MustGetNumber();
keynum = sc.Number;
@ -272,7 +272,7 @@ static void ParseLock(FScanner &sc)
break;
default:
mi = PClass::FindClass(sc.String);
mi = PClass::FindActor(sc.String);
if (mi)
{
keygroup = new Keygroup;

View file

@ -330,7 +330,7 @@ bool P_UndoPlayerMorph (player_t *activator, player_t *player, int unmorphflag,
}
if (correctweapon)
{ // Better "lose morphed weapon" semantics
const PClass *morphweapon = PClass::FindClass (pmo->MorphWeapon);
PClassActor *morphweapon = PClass::FindActor(pmo->MorphWeapon);
if (morphweapon != NULL && morphweapon->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
{
AWeapon *OriginalMorphWeapon = static_cast<AWeapon *>(mo->FindInventory (morphweapon));

View file

@ -51,15 +51,15 @@ void AAmmo::Serialize (FArchive &arc)
//
//===========================================================================
const PClass *AAmmo::GetParentAmmo () const
PClassActor *AAmmo::GetParentAmmo () const
{
const PClass *type = GetClass ();
PClass *type = GetClass();
while (type->ParentClass != RUNTIME_CLASS(AAmmo) && type->ParentClass != NULL)
{
type = type->ParentClass;
}
return type;
return static_cast<PClassActor *>(type);
}
//===========================================================================
@ -130,8 +130,7 @@ AInventory *AAmmo::CreateCopy (AActor *other)
if (GetClass()->ParentClass != RUNTIME_CLASS(AAmmo) && GetClass() != RUNTIME_CLASS(AAmmo))
{
const PClass *type = GetParentAmmo();
assert (type->ActorInfo != NULL);
PClassActor *type = GetParentAmmo();
if (!GoAway ())
{
Destroy ();
@ -1584,11 +1583,12 @@ AInventory *ABackpackItem::CreateCopy (AActor *other)
// he doesn't have it already, and double its maximum capacity.
for (unsigned int i = 0; i < PClass::m_Types.Size(); ++i)
{
const PClass *type = PClass::m_Types[i];
PClass *type = PClass::m_Types[i];
if (type->ParentClass == RUNTIME_CLASS(AAmmo))
{
AAmmo *ammo = static_cast<AAmmo *>(other->FindInventory (type));
PClassActor *atype = static_cast<PClassActor *>(type);
AAmmo *ammo = static_cast<AAmmo *>(other->FindInventory(atype));
int amount = static_cast<AAmmo *>(GetDefaultByType(type))->BackpackAmount;
// extra ammo in baby mode and nightmare mode
if (!(ItemFlags&IF_IGNORESKILL))

View file

@ -19,13 +19,13 @@ public:
FWeaponSlot &operator= (const FWeaponSlot &other) { Weapons = other.Weapons; return *this; }
void Clear() { Weapons.Clear(); }
bool AddWeapon (const char *type);
bool AddWeapon (const PClass *type);
bool AddWeapon (PClassActor *type);
void AddWeaponList (const char *list, bool clear);
AWeapon *PickWeapon (player_t *player);
int Size () const { return (int)Weapons.Size(); }
int LocateWeapon (const PClass *type);
int LocateWeapon (PClassActor *type);
inline const PClass *GetWeapon (int index) const
inline PClassActor *GetWeapon (int index) const
{
if ((unsigned)index < Weapons.Size())
{
@ -42,7 +42,7 @@ public:
private:
struct WeaponInfo
{
const PClass *Type;
PClassActor *Type;
fixed_t Position;
};
void SetInitialPositions();
@ -68,25 +68,25 @@ struct FWeaponSlots
AWeapon *PickPrevWeapon (player_t *player);
void Clear ();
bool LocateWeapon (const PClass *type, int *const slot, int *const index);
ESlotDef AddDefaultWeapon (int slot, const PClass *type);
bool LocateWeapon (PClassActor *type, int *const slot, int *const index);
ESlotDef AddDefaultWeapon (int slot, PClassActor *type);
void AddExtraWeapons();
void SetFromGameInfo();
void SetFromPlayer(const PClass *type);
void StandardSetup(const PClass *type);
void LocalSetup(const PClass *type);
void SetFromPlayer(PClassActor *type);
void StandardSetup(PClassActor *type);
void LocalSetup(PClassActor *type);
void SendDifferences(const FWeaponSlots &other);
int RestoreSlots (FConfigFile *config, const char *section);
void PrintSettings();
void AddSlot(int slot, const PClass *type, bool feedback);
void AddSlotDefault(int slot, const PClass *type, bool feedback);
void AddSlot(int slot, PClassActor *type, bool feedback);
void AddSlotDefault(int slot, PClassActor *type, bool feedback);
};
void P_PlaybackKeyConfWeapons(FWeaponSlots *slots);
void Net_WriteWeapon(const PClass *type);
const PClass *Net_ReadWeapon(BYTE **stream);
void Net_WriteWeapon(PClassActor *type);
PClassActor *Net_ReadWeapon(BYTE **stream);
void P_SetupWeapons_ntohton();
void P_WriteDemoWeaponsChunk(BYTE **demo);
@ -227,7 +227,7 @@ public:
void Serialize (FArchive &arc);
AInventory *CreateCopy (AActor *other);
bool HandlePickup (AInventory *item);
const PClass *GetParentAmmo () const;
PClassActor *GetParentAmmo () const;
AInventory *CreateTossable ();
int BackpackAmount, BackpackMaxAmount;
@ -247,16 +247,16 @@ class AWeapon : public AInventory
HAS_OBJECT_POINTERS
public:
DWORD WeaponFlags;
const PClass *AmmoType1, *AmmoType2; // Types of ammo used by this weapon
PClassActor *AmmoType1, *AmmoType2; // Types of ammo used by this weapon
int AmmoGive1, AmmoGive2; // Amount of each ammo to get when picking up weapon
int MinAmmo1, MinAmmo2; // Minimum ammo needed to switch to this weapon
int AmmoUse1, AmmoUse2; // How much ammo to use with each shot
int Kickback;
fixed_t YAdjust; // For viewing the weapon fullscreen
FSoundIDNoInit UpSound, ReadySound; // Sounds when coming up and idle
const PClass *SisterWeaponType; // Another weapon to pick up with this one
const PClass *ProjectileType; // Projectile used by primary attack
const PClass *AltProjectileType; // Projectile used by alternate attack
PClassActor *SisterWeaponType; // Another weapon to pick up with this one
PClassActor *ProjectileType; // Projectile used by primary attack
PClassActor *AltProjectileType; // Projectile used by alternate attack
int SelectionOrder; // Lower-numbered weapons get picked first
fixed_t MoveCombatDist; // Used by bots, but do they *really* need it?
int ReloadCounter; // For A_CheckForReload
@ -300,9 +300,9 @@ public:
bool DepleteAmmo (bool altFire, bool checkEnough=true);
protected:
AAmmo *AddAmmo (AActor *other, const PClass *ammotype, int amount);
AAmmo *AddAmmo (AActor *other, PClassActor *ammotype, int amount);
bool AddExistingAmmo (AAmmo *ammo, int amount);
AWeapon *AddWeapon (const PClass *weapon);
AWeapon *AddWeapon (PClassActor *weapon);
};
enum

View file

@ -67,11 +67,11 @@ class ARandomSpawner : public AActor
else if (pr_randomspawn() <= di->probability) // prob 255 = always spawn, prob 0 = never spawn.
{
// Handle replacement here so as to get the proper speed and flags for missiles
const PClass *cls;
cls = PClass::FindClass(di->Name);
PClassActor *cls;
cls = PClass::FindActor(di->Name);
if (cls != NULL)
{
const PClass *rep = cls->ActorInfo->GetReplacement()->Class;
PClassActor *rep = cls->GetReplacement();
if (rep != NULL)
{
cls = rep;
@ -160,7 +160,7 @@ class ARandomSpawner : public AActor
if ((newmobj->flags4 & MF4_BOSSDEATH) || (newmobj->flags2 & MF2_BOSS))
boss = true;
// If a replaced actor has either of those same flags, it's also a boss.
AActor * rep = GetDefaultByType(GetClass()->ActorInfo->GetReplacee()->Class);
AActor *rep = GetDefaultByType(GetClass()->GetReplacee());
if (rep && ((rep->flags4 & MF4_BOSSDEATH) || (rep->flags2 & MF2_BOSS)))
boss = true;
}

View file

@ -13,7 +13,7 @@ public:
virtual void PlayPickupSound (AActor *toucher);
int PieceValue;
const PClass * WeaponClass;
PClassActor *WeaponClass;
TObjPtr<AWeapon> FullWeapon;
};

View file

@ -30,8 +30,8 @@ FString WeaponSection;
TArray<FString> KeyConfWeapons;
FWeaponSlots *PlayingKeyConf;
TArray<const PClass *> Weapons_ntoh;
TMap<const PClass *, int> Weapons_hton;
TArray<PClassActor *> Weapons_ntoh;
TMap<PClassActor *, int> Weapons_hton;
static int STACK_ARGS ntoh_cmp(const void *a, const void *b);
@ -284,7 +284,7 @@ void AWeapon::AttachToOwner (AActor *other)
//
//===========================================================================
AAmmo *AWeapon::AddAmmo (AActor *other, const PClass *ammotype, int amount)
AAmmo *AWeapon::AddAmmo (AActor *other, PClassActor *ammotype, int amount)
{
AAmmo *ammo;
@ -357,7 +357,7 @@ bool AWeapon::AddExistingAmmo (AAmmo *ammo, int amount)
//
//===========================================================================
AWeapon *AWeapon::AddWeapon (const PClass *weapontype)
AWeapon *AWeapon::AddWeapon (PClassActor *weapontype)
{
AWeapon *weap;
@ -625,8 +625,8 @@ bool AWeaponGiver::TryPickup(AActor *&toucher)
if (di != NULL)
{
const PClass *ti = PClass::FindClass(di->Name);
if (ti->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
PClassActor *ti = PClass::FindActor(di->Name);
if (ti != NULL && ti->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
{
if (master == NULL)
{
@ -662,10 +662,10 @@ bool AWeaponGiver::TryPickup(AActor *&toucher)
bool FWeaponSlot::AddWeapon(const char *type)
{
return AddWeapon (PClass::FindClass (type));
return AddWeapon (PClass::FindActor (type));
}
bool FWeaponSlot::AddWeapon(const PClass *type)
bool FWeaponSlot::AddWeapon(PClassActor *type)
{
unsigned int i;
@ -726,7 +726,7 @@ void FWeaponSlot :: AddWeaponList(const char *list, bool clear)
//
//===========================================================================
int FWeaponSlot::LocateWeapon(const PClass *type)
int FWeaponSlot::LocateWeapon(PClassActor *type)
{
unsigned int i;
@ -842,7 +842,7 @@ void FWeaponSlot::Sort()
for (i = 1; i < (int)Weapons.Size(); ++i)
{
fixed_t pos = Weapons[i].Position;
const PClass *type = Weapons[i].Type;
PClassActor *type = Weapons[i].Type;
for (j = i - 1; j >= 0 && Weapons[j].Position > pos; --j)
{
Weapons[j + 1] = Weapons[j];
@ -891,7 +891,7 @@ void FWeaponSlots::Clear()
//
//===========================================================================
ESlotDef FWeaponSlots::AddDefaultWeapon (int slot, const PClass *type)
ESlotDef FWeaponSlots::AddDefaultWeapon (int slot, PClassActor *type)
{
int currSlot, index;
@ -916,7 +916,7 @@ ESlotDef FWeaponSlots::AddDefaultWeapon (int slot, const PClass *type)
//
//===========================================================================
bool FWeaponSlots::LocateWeapon (const PClass *type, int *const slot, int *const index)
bool FWeaponSlots::LocateWeapon (PClassActor *type, int *const slot, int *const index)
{
int i, j;
@ -1014,7 +1014,7 @@ AWeapon *FWeaponSlots::PickNextWeapon(player_t *player)
slot = 0;
}
}
const PClass *type = Slots[slot].GetWeapon(index);
PClassActor *type = Slots[slot].GetWeapon(index);
AWeapon *weap = static_cast<AWeapon *>(player->mo->FindInventory(type));
if (weap != NULL && weap->CheckAmmo(AWeapon::EitherFire, false))
{
@ -1069,7 +1069,7 @@ AWeapon *FWeaponSlots::PickPrevWeapon (player_t *player)
}
index = Slots[slot].Size() - 1;
}
const PClass *type = Slots[slot].GetWeapon(index);
PClassActor *type = Slots[slot].GetWeapon(index);
AWeapon *weap = static_cast<AWeapon *>(player->mo->FindInventory(type));
if (weap != NULL && weap->CheckAmmo(AWeapon::EitherFire, false))
{
@ -1105,18 +1105,21 @@ void FWeaponSlots::AddExtraWeapons()
{
PClass *cls = PClass::m_Types[i];
if (cls->ActorInfo != NULL &&
(cls->ActorInfo->GameFilter == GAME_Any || (cls->ActorInfo->GameFilter & gameinfo.gametype)) &&
cls->ActorInfo->Replacement == NULL && // Replaced weapons don't get slotted.
cls->IsDescendantOf(RUNTIME_CLASS(AWeapon)) &&
!LocateWeapon(cls, NULL, NULL) // Don't duplicate it if it's already present.
if (!cls->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
{
continue;
}
PClassActor *acls = static_cast<PClassActor *>(cls);
if ((acls->GameFilter == GAME_Any || (acls->GameFilter & gameinfo.gametype)) &&
acls->Replacement == NULL && // Replaced weapons don't get slotted.
!LocateWeapon(acls, NULL, NULL) // Don't duplicate it if it's already present.
)
{
int slot = cls->Meta.GetMetaInt(AWMETA_SlotNumber, -1);
int slot = acls->Meta.GetMetaInt(AWMETA_SlotNumber, -1);
if ((unsigned)slot < NUM_WEAPON_SLOTS)
{
fixed_t position = cls->Meta.GetMetaFixed(AWMETA_SlotPriority, INT_MAX);
FWeaponSlot::WeaponInfo info = { cls, position };
fixed_t position = acls->Meta.GetMetaFixed(AWMETA_SlotPriority, INT_MAX);
FWeaponSlot::WeaponInfo info = { acls, position };
Slots[slot].Weapons.Push(info);
}
}
@ -1153,7 +1156,7 @@ void FWeaponSlots::SetFromGameInfo()
{
for (unsigned j = 0; j < gameinfo.DefaultWeaponSlots[i].Size(); i++)
{
const PClass *cls = PClass::FindClass(gameinfo.DefaultWeaponSlots[i][j]);
PClassActor *cls = PClass::FindActor(gameinfo.DefaultWeaponSlots[i][j]);
if (cls == NULL)
{
Printf("Unknown weapon class '%s' found in default weapon slot assignments\n",
@ -1178,7 +1181,7 @@ void FWeaponSlots::SetFromGameInfo()
//
//===========================================================================
void FWeaponSlots::StandardSetup(const PClass *type)
void FWeaponSlots::StandardSetup(PClassActor *type)
{
SetFromPlayer(type);
AddExtraWeapons();
@ -1198,7 +1201,7 @@ void FWeaponSlots::StandardSetup(const PClass *type)
//
//===========================================================================
void FWeaponSlots::LocalSetup(const PClass *type)
void FWeaponSlots::LocalSetup(PClassActor *type)
{
P_PlaybackKeyConfWeapons(this);
if (WeaponSection.IsNotEmpty())
@ -1263,7 +1266,7 @@ void FWeaponSlots::SendDifferences(const FWeaponSlots &other)
//
//===========================================================================
void FWeaponSlots::SetFromPlayer(const PClass *type)
void FWeaponSlots::SetFromPlayer(PClassActor *type)
{
Clear();
for (int i = 0; i < NUM_WEAPON_SLOTS; ++i)
@ -1382,7 +1385,7 @@ CCMD (setslot)
Net_WriteByte(argv.argc()-2);
for (int i = 2; i < argv.argc(); i++)
{
Net_WriteWeapon(PClass::FindClass(argv[i]));
Net_WriteWeapon(PClass::FindActor(argv[i]));
}
}
}
@ -1393,7 +1396,7 @@ CCMD (setslot)
//
//===========================================================================
void FWeaponSlots::AddSlot(int slot, const PClass *type, bool feedback)
void FWeaponSlots::AddSlot(int slot, PClassActor *type, bool feedback)
{
if (type != NULL && !Slots[slot].AddWeapon(type) && feedback)
{
@ -1417,13 +1420,13 @@ CCMD (addslot)
}
else if (PlayingKeyConf != NULL)
{
PlayingKeyConf->AddSlot(int(slot), PClass::FindClass(argv[2]), false);
PlayingKeyConf->AddSlot(int(slot), PClass::FindActor(argv[2]), false);
}
else
{
Net_WriteByte(DEM_ADDSLOT);
Net_WriteByte(slot);
Net_WriteWeapon(PClass::FindClass(argv[2]));
Net_WriteWeapon(PClass::FindActor(argv[2]));
}
}
@ -1446,7 +1449,7 @@ CCMD (weaponsection)
// CCMD addslotdefault
//
//===========================================================================
void FWeaponSlots::AddSlotDefault(int slot, const PClass *type, bool feedback)
void FWeaponSlots::AddSlotDefault(int slot, PClassActor *type, bool feedback)
{
if (type != NULL && type->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
{
@ -1471,7 +1474,7 @@ void FWeaponSlots::AddSlotDefault(int slot, const PClass *type, bool feedback)
CCMD (addslotdefault)
{
const PClass *type;
PClassActor *type;
unsigned int slot;
if (argv.argc() != 3 || (slot = atoi (argv[1])) >= NUM_WEAPON_SLOTS)
@ -1480,7 +1483,7 @@ CCMD (addslotdefault)
return;
}
type = PClass::FindClass (argv[2]);
type = PClass::FindActor(argv[2]);
if (type == NULL || !type->IsDescendantOf (RUNTIME_CLASS(AWeapon)))
{
Printf ("%s is not a weapon\n", argv[2]);
@ -1493,13 +1496,13 @@ CCMD (addslotdefault)
}
else if (PlayingKeyConf != NULL)
{
PlayingKeyConf->AddSlotDefault(int(slot), PClass::FindClass(argv[2]), false);
PlayingKeyConf->AddSlotDefault(int(slot), PClass::FindActor(argv[2]), false);
}
else
{
Net_WriteByte(DEM_ADDSLOTDEFAULT);
Net_WriteByte(slot);
Net_WriteWeapon(PClass::FindClass(argv[2]));
Net_WriteWeapon(PClass::FindActor(argv[2]));
}
}
@ -1536,7 +1539,7 @@ void P_PlaybackKeyConfWeapons(FWeaponSlots *slots)
void P_SetupWeapons_ntohton()
{
unsigned int i;
const PClass *cls;
PClassActor *cls;
Weapons_ntoh.Clear();
Weapons_hton.Clear();
@ -1547,9 +1550,9 @@ void P_SetupWeapons_ntohton()
{
PClass *cls = PClass::m_Types[i];
if (cls->ActorInfo != NULL && cls->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
if (cls->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
{
Weapons_ntoh.Push(cls);
Weapons_ntoh.Push(static_cast<PClassActor *>(cls));
}
}
qsort(&Weapons_ntoh[1], Weapons_ntoh.Size() - 1, sizeof(Weapons_ntoh[0]), ntoh_cmp);
@ -1575,10 +1578,10 @@ void P_SetupWeapons_ntohton()
static int STACK_ARGS ntoh_cmp(const void *a, const void *b)
{
const PClass *c1 = *(const PClass **)a;
const PClass *c2 = *(const PClass **)b;
int g1 = c1->ActorInfo->GameFilter == GAME_Any ? 1 : (c1->ActorInfo->GameFilter & gameinfo.gametype) ? 0 : 2;
int g2 = c2->ActorInfo->GameFilter == GAME_Any ? 1 : (c2->ActorInfo->GameFilter & gameinfo.gametype) ? 0 : 2;
PClassActor *c1 = *(PClassActor **)a;
PClassActor *c2 = *(PClassActor **)b;
int g1 = c1->GameFilter == GAME_Any ? 1 : (c1->GameFilter & gameinfo.gametype) ? 0 : 2;
int g2 = c2->GameFilter == GAME_Any ? 1 : (c2->GameFilter & gameinfo.gametype) ? 0 : 2;
if (g1 != g2)
{
return g1 - g2;
@ -1616,7 +1619,7 @@ void P_WriteDemoWeaponsChunk(BYTE **demo)
void P_ReadDemoWeaponsChunk(BYTE **demo)
{
int count, i;
const PClass *type;
PClassActor *type;
const char *s;
count = ReadWord(demo);
@ -1629,7 +1632,7 @@ void P_ReadDemoWeaponsChunk(BYTE **demo)
for (i = 1; i < count; ++i)
{
s = ReadStringConst(demo);
type = PClass::FindClass(s);
type = PClass::FindActor(s);
// If a demo was recorded with a weapon that is no longer present,
// should we report it?
Weapons_ntoh[i] = type;
@ -1646,7 +1649,7 @@ void P_ReadDemoWeaponsChunk(BYTE **demo)
//
//===========================================================================
void Net_WriteWeapon(const PClass *type)
void Net_WriteWeapon(PClassActor *type)
{
int index, *index_p;
@ -1678,7 +1681,7 @@ void Net_WriteWeapon(const PClass *type)
//
//===========================================================================
const PClass *Net_ReadWeapon(BYTE **stream)
PClassActor *Net_ReadWeapon(BYTE **stream)
{
int index;

View file

@ -106,7 +106,7 @@ class CommandDrawImage : public SBarInfoCommand
{
type = INVENTORYICON;
const PClass* item = PClass::FindClass(sc.String);
if(item == NULL || !PClass::FindClass("Inventory")->IsAncestorOf(item)) //must be a kind of Inventory
if(item == NULL || !RUNTIME_CLASS(AInventory)->IsAncestorOf(item)) //must be a kind of Inventory
{
sc.ScriptError("'%s' is not a type of inventory item.", sc.String);
}
@ -322,7 +322,7 @@ class CommandDrawSwitchableImage : public CommandDrawImage
{
inventoryItem[0] = sc.String;
const PClass* item = PClass::FindClass(sc.String);
if(item == NULL || !PClass::FindClass("Inventory")->IsAncestorOf(item)) //must be a kind of Inventory
if(item == NULL || !RUNTIME_CLASS(AInventory)->IsAncestorOf(item)) //must be a kind of Inventory
{
sc.ScriptError("'%s' is not a type of inventory item.", sc.String);
}
@ -347,7 +347,7 @@ class CommandDrawSwitchableImage : public CommandDrawImage
sc.MustGetToken(TK_Identifier);
inventoryItem[1] = sc.String;
const PClass* item = PClass::FindClass(sc.String);
if(item == NULL || !PClass::FindClass("Inventory")->IsAncestorOf(item)) //must be a kind of Inventory
if(item == NULL || !RUNTIME_CLASS(AInventory)->IsAncestorOf(item)) //must be a kind of Inventory
{
sc.ScriptError("'%s' is not a type of inventory item.", sc.String);
}
@ -378,7 +378,7 @@ class CommandDrawSwitchableImage : public CommandDrawImage
drawAlt = 1; //draw off state until we know we have something.
for (int i = 0; i < statusBar->CPlayer->weapons.Slots[conditionalValue[0]].Size(); i++)
{
const PClass *weap = statusBar->CPlayer->weapons.Slots[conditionalValue[0]].GetWeapon(i);
PClassActor *weap = statusBar->CPlayer->weapons.Slots[conditionalValue[0]].GetWeapon(i);
if(weap == NULL)
{
continue;
@ -455,12 +455,12 @@ class CommandDrawSwitchableImage : public CommandDrawImage
}
else //check the inventory items and draw selected sprite
{
AInventory* item = statusBar->CPlayer->mo->FindInventory(PClass::FindClass(inventoryItem[0]));
AInventory* item = statusBar->CPlayer->mo->FindInventory(PClass::FindActor(inventoryItem[0]));
if(item == NULL || !EvaluateOperation(conditionalOperator[0], conditionalValue[0], item->Amount))
drawAlt = 1;
if(conditionAnd)
{
item = statusBar->CPlayer->mo->FindInventory(PClass::FindClass(inventoryItem[1]));
item = statusBar->CPlayer->mo->FindInventory(PClass::FindActor(inventoryItem[1]));
bool secondCondition = item != NULL && EvaluateOperation(conditionalOperator[1], conditionalValue[1], item->Amount);
if((item != NULL && secondCondition) && drawAlt == 0) //both
{
@ -605,7 +605,7 @@ class CommandDrawNumber : public CommandDrawString
{
value = AMMO;
sc.MustGetToken(TK_Identifier);
inventoryItem = PClass::FindClass(sc.String);
inventoryItem = PClass::FindActor(sc.String);
if(inventoryItem == NULL || !RUNTIME_CLASS(AAmmo)->IsAncestorOf(inventoryItem)) //must be a kind of ammo
{
sc.ScriptError("'%s' is not a type of ammo.", sc.String);
@ -615,7 +615,7 @@ class CommandDrawNumber : public CommandDrawString
{
value = AMMOCAPACITY;
sc.MustGetToken(TK_Identifier);
inventoryItem = PClass::FindClass(sc.String);
inventoryItem = PClass::FindActor(sc.String);
if(inventoryItem == NULL || !RUNTIME_CLASS(AAmmo)->IsAncestorOf(inventoryItem)) //must be a kind of ammo
{
sc.ScriptError("'%s' is not a type of ammo.", sc.String);
@ -659,8 +659,8 @@ class CommandDrawNumber : public CommandDrawString
{
value = POWERUPTIME;
sc.MustGetToken(TK_Identifier);
inventoryItem = PClass::FindClass(sc.String);
if(inventoryItem == NULL || !PClass::FindClass("PowerupGiver")->IsAncestorOf(inventoryItem))
inventoryItem = PClass::FindActor(sc.String);
if(inventoryItem == NULL || !RUNTIME_CLASS(APowerupGiver)->IsAncestorOf(inventoryItem))
{
sc.ScriptError("'%s' is not a type of PowerupGiver.", sc.String);
}
@ -668,8 +668,8 @@ class CommandDrawNumber : public CommandDrawString
else
{
value = INVENTORY;
inventoryItem = PClass::FindClass(sc.String);
if(inventoryItem == NULL || !PClass::FindClass("Inventory")->IsAncestorOf(inventoryItem)) //must be a kind of ammo
inventoryItem = PClass::FindActor(sc.String);
if(inventoryItem == NULL || !RUNTIME_CLASS(AInventory)->IsAncestorOf(inventoryItem)) //must be a kind of ammo
{
sc.ScriptError("'%s' is not a type of inventory item.", sc.String);
}
@ -831,7 +831,7 @@ class CommandDrawNumber : public CommandDrawString
case POWERUPTIME:
{
//Get the PowerupType and check to see if the player has any in inventory.
const PClass* powerupType = ((APowerupGiver*) GetDefaultByType(inventoryItem))->PowerupType;
PClassActor* powerupType = ((APowerupGiver*) GetDefaultByType(inventoryItem))->PowerupType;
APowerup* powerup = (APowerup*) statusBar->CPlayer->mo->FindInventory(powerupType);
if(powerup != NULL)
num = powerup->EffectTics / TICRATE + 1;
@ -949,7 +949,7 @@ class CommandDrawNumber : public CommandDrawString
EColorRange normalTranslation;
ValueType value;
int valueArgument;
const PClass *inventoryItem;
PClassActor *inventoryItem;
SBarInfoCoordinate startX;
@ -1811,8 +1811,8 @@ class CommandDrawBar : public SBarInfoCommand
type = HEALTH;
if(sc.CheckToken(TK_Identifier)) //comparing reference
{
inventoryItem = PClass::FindClass(sc.String);
if(inventoryItem == NULL || !PClass::FindClass("Inventory")->IsAncestorOf(inventoryItem)) //must be a kind of inventory
inventoryItem = PClass::FindActor(sc.String);
if(inventoryItem == NULL || !RUNTIME_CLASS(AInventory)->IsAncestorOf(inventoryItem)) //must be a kind of inventory
sc.ScriptError("'%s' is not a type of inventory item.", sc.String);
}
}
@ -1821,8 +1821,8 @@ class CommandDrawBar : public SBarInfoCommand
type = ARMOR;
if(sc.CheckToken(TK_Identifier))
{
inventoryItem = PClass::FindClass(sc.String);
if(inventoryItem == NULL || !PClass::FindClass("Inventory")->IsAncestorOf(inventoryItem)) //must be a kind of inventory
inventoryItem = PClass::FindActor(sc.String);
if(inventoryItem == NULL || !RUNTIME_CLASS(AInventory)->IsAncestorOf(inventoryItem)) //must be a kind of inventory
sc.ScriptError("'%s' is not a type of inventory item.", sc.String);
}
}
@ -1834,7 +1834,7 @@ class CommandDrawBar : public SBarInfoCommand
{
sc.MustGetToken(TK_Identifier);
type = AMMO;
inventoryItem = PClass::FindClass(sc.String);
inventoryItem = PClass::FindActor(sc.String);
if(inventoryItem == NULL || !RUNTIME_CLASS(AAmmo)->IsAncestorOf(inventoryItem)) //must be a kind of ammo
{
sc.ScriptError("'%s' is not a type of ammo.", sc.String);
@ -1854,8 +1854,8 @@ class CommandDrawBar : public SBarInfoCommand
{
type = POWERUPTIME;
sc.MustGetToken(TK_Identifier);
inventoryItem = PClass::FindClass(sc.String);
if(inventoryItem == NULL || !PClass::FindClass("PowerupGiver")->IsAncestorOf(inventoryItem))
inventoryItem = PClass::FindActor(sc.String);
if(inventoryItem == NULL || !RUNTIME_CLASS(APowerupGiver)->IsAncestorOf(inventoryItem))
{
sc.ScriptError("'%s' is not a type of PowerupGiver.", sc.String);
}
@ -1863,7 +1863,7 @@ class CommandDrawBar : public SBarInfoCommand
else
{
type = INVENTORY;
inventoryItem = PClass::FindClass(sc.String);
inventoryItem = PClass::FindActor(sc.String);
if(inventoryItem == NULL || !RUNTIME_CLASS(AInventory)->IsAncestorOf(inventoryItem))
{
sc.ScriptError("'%s' is not a type of inventory item.", sc.String);
@ -2016,7 +2016,7 @@ class CommandDrawBar : public SBarInfoCommand
{
//Get the PowerupType and check to see if the player has any in inventory.
APowerupGiver *powerupGiver = (APowerupGiver*) GetDefaultByType(inventoryItem);
const PClass *powerupType = powerupGiver->PowerupType;
PClassActor *powerupType = powerupGiver->PowerupType;
APowerup *powerup = (APowerup*) statusBar->CPlayer->mo->FindInventory(powerupType);
if(powerup != NULL && powerupType != NULL && powerupGiver != NULL)
{
@ -2077,7 +2077,7 @@ class CommandDrawBar : public SBarInfoCommand
int foreground;
int background;
ValueType type;
const PClass *inventoryItem;
PClassActor *inventoryItem;
SBarInfoCoordinate x;
SBarInfoCoordinate y;
@ -2507,7 +2507,7 @@ class CommandInInventory : public SBarInfoCommandFlowControl
}
for(int i = 0;i < 2;i++)
{
item[i] = PClass::FindClass(sc.String);
item[i] = PClass::FindActor(sc.String);
if(item[i] == NULL || !RUNTIME_CLASS(AInventory)->IsAncestorOf(item[i]))
sc.ScriptError("'%s' is not a type of inventory item.", sc.String);
@ -2535,7 +2535,7 @@ class CommandInInventory : public SBarInfoCommandFlowControl
protected:
bool conditionAnd;
bool negate;
const PClass *item[2];
PClassActor *item[2];
int amount[2];
};

View file

@ -315,12 +315,12 @@ static void DrawArmor(AInventory * armor, int x, int y)
// this doesn't have to be done each frame
//
//---------------------------------------------------------------------------
static TArray<const PClass*> KeyTypes, UnassignedKeyTypes;
static TArray<PClassActor *> KeyTypes, UnassignedKeyTypes;
static int STACK_ARGS ktcmp(const void * a, const void * b)
{
AKey * key1 = (AKey*)GetDefaultByType ( *(const PClass**)a );
AKey * key2 = (AKey*)GetDefaultByType ( *(const PClass**)b );
AKey *key1 = (AKey*)GetDefaultByType ( *(PClassActor **)a );
AKey *key2 = (AKey*)GetDefaultByType ( *(PClassActor **)b );
return key1->KeyNumber - key2->KeyNumber;
}
@ -328,19 +328,20 @@ static void SetKeyTypes()
{
for(unsigned int i = 0; i < PClass::m_Types.Size(); i++)
{
const PClass * ti = PClass::m_Types[i];
PClass *ti = PClass::m_Types[i];
if (ti->IsDescendantOf(RUNTIME_CLASS(AKey)))
{
AKey * key = (AKey*)GetDefaultByType(ti);
PClassActor *tia = static_cast<PClassActor *>(ti);
AKey *key = (AKey*)GetDefaultByType(tia);
if (key->Icon.isValid() && key->KeyNumber>0)
{
KeyTypes.Push(ti);
KeyTypes.Push(tia);
}
else
{
UnassignedKeyTypes.Push(ti);
UnassignedKeyTypes.Push(tia);
}
}
}
@ -351,7 +352,7 @@ static void SetKeyTypes()
else
{
// Don't leave the list empty
const PClass * ti = RUNTIME_CLASS(AKey);
PClassActor *ti = RUNTIME_CLASS(AKey);
KeyTypes.Push(ti);
}
}
@ -449,14 +450,14 @@ static int DrawKeys(player_t * CPlayer, int x, int y)
// Drawing Ammo
//
//---------------------------------------------------------------------------
static TArray<const PClass *> orderedammos;
static TArray<PClassActor *> orderedammos;
static void AddAmmoToList(AWeapon * weapdef)
{
for(int i=0; i<2;i++)
{
const PClass * ti = i==0? weapdef->AmmoType1 : weapdef->AmmoType2;
PClassActor * ti = i==0? weapdef->AmmoType1 : weapdef->AmmoType2;
if (ti)
{
AAmmo * ammodef=(AAmmo*)GetDefaultByType(ti);
@ -515,7 +516,7 @@ static int DrawAmmo(player_t *CPlayer, int x, int y)
for(i=orderedammos.Size()-1;i>=0;i--)
{
const PClass * type = orderedammos[i];
PClassActor * type = orderedammos[i];
AAmmo * ammoitem = (AAmmo*)CPlayer->mo->FindInventory(type);
AAmmo * inv = ammoitem? ammoitem : (AAmmo*)GetDefaultByType(orderedammos[i]);
@ -622,7 +623,7 @@ static void DrawWeapons(player_t * CPlayer, int x, int y)
// And now everything in the weapon slots back to front
for (k = NUM_WEAPON_SLOTS - 1; k >= 0; k--) for(j = CPlayer->weapons.Slots[k].Size() - 1; j >= 0; j--)
{
const PClass *weap = CPlayer->weapons.Slots[k].GetWeapon(j);
PClassActor *weap = CPlayer->weapons.Slots[k].GetWeapon(j);
if (weap)
{
inv=CPlayer->mo->FindInventory(weap);

View file

@ -63,6 +63,6 @@ public:
int NumPieces, DownPieces;
};
extern const PClass *QuestItemClasses[31];
extern PClassActor *QuestItemClasses[31];
#endif

View file

@ -284,7 +284,7 @@ IMPLEMENT_CLASS (AAmmoFillup)
bool AAmmoFillup::TryPickup (AActor *&toucher)
{
const PClass * clip = PClass::FindClass(NAME_ClipOfBullets);
PClassActor *clip = PClass::FindActor(NAME_ClipOfBullets);
if (clip != NULL)
{
AInventory *item = toucher->FindInventory(clip);

View file

@ -14,8 +14,6 @@
static FRandom pr_bang4cloud ("Bang4Cloud");
static FRandom pr_lightout ("LightOut");
extern const PClass *QuestItemClasses[31];
DEFINE_ACTION_FUNCTION(AActor, A_Bang4Cloud)
{
PARAM_ACTION_PROLOGUE;

View file

@ -706,7 +706,7 @@ private:
};
for (i = 0; i < 7; ++i)
{
const PClass *ammotype = PClass::FindClass(AmmoList[i].AmmoType);
PClassActor *ammotype = PClass::FindActor(AmmoList[i].AmmoType);
item = CPlayer->mo->FindInventory (ammotype);
if (item == NULL)

View file

@ -107,13 +107,15 @@ int GetSpriteIndex(const char * spritename)
return (lastindex = (int)sprites.Push (temp));
}
IMPLEMENT_CLASS(PClassActor)
//==========================================================================
//
// PClassActor :: StaticInit STATIC
//
//==========================================================================
void FActorInfo::StaticInit ()
void PClassActor::StaticInit()
{
if (sprites.Size() == 0)
{
@ -136,37 +138,143 @@ void FActorInfo::StaticInit ()
//==========================================================================
//
// PClassActor :: StaticSetActorNums STATIC
//
// Called after Dehacked patches are applied
//
//==========================================================================
void FActorInfo::StaticSetActorNums ()
void PClassActor::StaticSetActorNums()
{
memset(SpawnableThings, 0, sizeof(SpawnableThings));
DoomEdMap.Empty();
for (unsigned int i = 0; i < PClass::m_RuntimeActors.Size(); ++i)
{
PClass::m_RuntimeActors[i]->ActorInfo->RegisterIDs ();
static_cast<PClassActor *>(PClass::m_RuntimeActors[i])->RegisterIDs();
}
}
//==========================================================================
//
// PClassActor Constructor
//
//==========================================================================
void FActorInfo::RegisterIDs ()
PClassActor::PClassActor()
{
const PClass *cls = PClass::FindClass(Class->TypeName);
GameFilter = GAME_Any;
SpawnID = 0;
DoomEdNum = -1;
OwnedStates = NULL;
NumOwnedStates = 0;
Replacement = NULL;
Replacee = NULL;
StateList = NULL;
DamageFactors = NULL;
PainChances = NULL;
}
//==========================================================================
//
// PClassActor Destructor
//
//==========================================================================
PClassActor::~PClassActor()
{
if (OwnedStates != NULL)
{
delete[] OwnedStates;
}
if (DamageFactors != NULL)
{
delete DamageFactors;
}
if (PainChances != NULL)
{
delete PainChances;
}
if (StateList != NULL)
{
StateList->Destroy();
M_Free(StateList);
}
}
//==========================================================================
//
// PClassActor :: PropagateMark
//
//==========================================================================
size_t PClassActor::PropagateMark()
{
// Mark state functions
for (int i = 0; i < NumOwnedStates; ++i)
{
if (OwnedStates[i].ActionFunc != NULL)
{
GC::Mark(OwnedStates[i].ActionFunc);
}
}
// marked += ActorInfo->NumOwnedStates * sizeof(FState);
return Super::PropagateMark();
}
//==========================================================================
//
// PClassActor :: InitializeNativeDefaults
//
// This is used by DECORATE to assign ActorInfos to internal classes
//
//==========================================================================
void PClassActor::InitializeNativeDefaults()
{
Symbols.SetParentTable(&ParentClass->Symbols);
assert(Defaults == NULL);
Defaults = new BYTE[Size];
if (ParentClass->Defaults != NULL)
{
memcpy(Defaults, ParentClass->Defaults, ParentClass->Size);
if (Size > ParentClass->Size)
{
memset(Defaults + ParentClass->Size, 0, Size - ParentClass->Size);
}
}
else
{
memset (Defaults, 0, Size);
}
m_RuntimeActors.Push(this);
}
//==========================================================================
//
// PClassActor :: RegisterIDs
//
// Registers this class's SpawnID and DoomEdNum in the appropriate tables.
//
//==========================================================================
void PClassActor::RegisterIDs()
{
PClassActor *cls = PClass::FindActor(TypeName);
bool set = false;
if (cls == NULL)
{
Printf(TEXTCOLOR_RED"The actor '%s' has been hidden by a non-actor of the same name\n", TypeName.GetChars());
return;
}
if (GameFilter == GAME_Any || (GameFilter & gameinfo.gametype))
{
if (SpawnID != 0)
{
SpawnableThings[SpawnID] = cls;
if (cls != Class)
if (cls != this)
{
Printf(TEXTCOLOR_RED"Spawn ID %d refers to hidden class type '%s'\n", SpawnID, cls->TypeName.GetChars());
}
@ -174,18 +282,17 @@ void FActorInfo::RegisterIDs ()
if (DoomEdNum != -1)
{
DoomEdMap.AddType(DoomEdNum, cls);
if (cls != Class)
if (cls != this)
{
Printf(TEXTCOLOR_RED"Editor number %d refers to hidden class type '%s'\n", DoomEdNum, cls->TypeName.GetChars());
}
}
}
// Fill out the list for Chex Quest with Doom's actors
if (gameinfo.gametype == GAME_Chex && DoomEdMap.FindType(DoomEdNum) == NULL &&
(GameFilter & GAME_Doom))
if (gameinfo.gametype == GAME_Chex && DoomEdMap.FindType(DoomEdNum) == NULL && (GameFilter & GAME_Doom))
{
DoomEdMap.AddType (DoomEdNum, Class, true);
if (cls != Class)
DoomEdMap.AddType(DoomEdNum, this, true);
if (cls != this)
{
Printf(TEXTCOLOR_RED"Editor number %d refers to hidden class type '%s'\n", DoomEdNum, cls->TypeName.GetChars());
}
@ -194,24 +301,25 @@ void FActorInfo::RegisterIDs ()
//==========================================================================
//
// PClassActor :: GetReplacement
//
//==========================================================================
FActorInfo *FActorInfo::GetReplacement (bool lookskill)
PClassActor *PClassActor::GetReplacement(bool lookskill)
{
FName skillrepname;
if (lookskill && AllSkills.Size() > (unsigned)gameskill)
{
skillrepname = AllSkills[gameskill].GetReplacement(this->Class->TypeName);
skillrepname = AllSkills[gameskill].GetReplacement(TypeName);
if (skillrepname != NAME_None && PClass::FindClass(skillrepname) == NULL)
{
Printf("Warning: incorrect actor name in definition of skill %s: \n"
"class %s is replaced by non-existent class %s\n"
"Skill replacement will be ignored for this actor.\n",
AllSkills[gameskill].Name.GetChars(),
this->Class->TypeName.GetChars(), skillrepname.GetChars());
AllSkills[gameskill].SetReplacement(this->Class->TypeName, NAME_None);
TypeName.GetChars(), skillrepname.GetChars());
AllSkills[gameskill].SetReplacement(TypeName, NAME_None);
AllSkills[gameskill].SetReplacedBy(skillrepname, NAME_None);
lookskill = false; skillrepname = NAME_None;
}
@ -222,15 +330,15 @@ FActorInfo *FActorInfo::GetReplacement (bool lookskill)
}
// The Replacement field is temporarily NULLed to prevent
// potential infinite recursion.
FActorInfo *savedrep = Replacement;
PClassActor *savedrep = Replacement;
Replacement = NULL;
FActorInfo *rep = savedrep;
PClassActor *rep = savedrep;
// Handle skill-based replacement here. It has precedence on DECORATE replacement
// in that the skill replacement is applied first, followed by DECORATE replacement
// on the actor indicated by the skill replacement.
if (lookskill && (skillrepname != NAME_None))
{
rep = PClass::FindClass(skillrepname)->ActorInfo;
rep = PClass::FindActor(skillrepname);
}
// Now handle DECORATE replacement chain
// Skill replacements are not recursive, contrarily to DECORATE replacements
@ -242,24 +350,25 @@ FActorInfo *FActorInfo::GetReplacement (bool lookskill)
//==========================================================================
//
// PClassActor :: GetReplacee
//
//==========================================================================
FActorInfo *FActorInfo::GetReplacee (bool lookskill)
PClassActor *PClassActor::GetReplacee(bool lookskill)
{
FName skillrepname;
if (lookskill && AllSkills.Size() > (unsigned)gameskill)
{
skillrepname = AllSkills[gameskill].GetReplacedBy(this->Class->TypeName);
skillrepname = AllSkills[gameskill].GetReplacedBy(TypeName);
if (skillrepname != NAME_None && PClass::FindClass(skillrepname) == NULL)
{
Printf("Warning: incorrect actor name in definition of skill %s: \n"
"non-existent class %s is replaced by class %s\n"
"Skill replacement will be ignored for this actor.\n",
AllSkills[gameskill].Name.GetChars(),
skillrepname.GetChars(), this->Class->TypeName.GetChars());
AllSkills[gameskill].SetReplacedBy(this->Class->TypeName, NAME_None);
skillrepname.GetChars(), TypeName.GetChars());
AllSkills[gameskill].SetReplacedBy(TypeName, NAME_None);
AllSkills[gameskill].SetReplacement(skillrepname, NAME_None);
lookskill = false;
}
@ -270,51 +379,58 @@ FActorInfo *FActorInfo::GetReplacee (bool lookskill)
}
// The Replacee field is temporarily NULLed to prevent
// potential infinite recursion.
FActorInfo *savedrep = Replacee;
PClassActor *savedrep = Replacee;
Replacee = NULL;
FActorInfo *rep = savedrep;
PClassActor *rep = savedrep;
if (lookskill && (skillrepname != NAME_None) && (PClass::FindClass(skillrepname) != NULL))
{
rep = PClass::FindClass(skillrepname)->ActorInfo;
rep = PClass::FindActor(skillrepname);
}
rep = rep->GetReplacee (false); Replacee = savedrep;
rep = rep->GetReplacee(false);
Replacee = savedrep;
return rep;
}
//==========================================================================
//
// PClassActor :: SetDamageFactor
//
//==========================================================================
void FActorInfo::SetDamageFactor(FName type, fixed_t factor)
void PClassActor::SetDamageFactor(FName type, fixed_t factor)
{
if (factor != FRACUNIT)
{
if (DamageFactors == NULL) DamageFactors=new DmgFactors;
if (DamageFactors == NULL)
{
DamageFactors = new DmgFactors;
}
DamageFactors->Insert(type, factor);
}
else
else if (DamageFactors != NULL)
{
if (DamageFactors != NULL)
DamageFactors->Remove(type);
}
}
//==========================================================================
//
// PClassActor :: SetPainChance
//
//==========================================================================
void FActorInfo::SetPainChance(FName type, int chance)
void PClassActor::SetPainChance(FName type, int chance)
{
if (chance >= 0)
{
if (PainChances == NULL) PainChances=new PainChanceList;
if (PainChances == NULL)
{
PainChances = new PainChanceList;
}
PainChances->Insert(type, MIN(chance, 255));
}
else
else if (PainChances != NULL)
{
if (PainChances != NULL)
PainChances->Remove(type);
}
}
@ -333,7 +449,7 @@ FDoomEdMap::~FDoomEdMap()
Empty();
}
void FDoomEdMap::AddType (int doomednum, const PClass *type, bool temporary)
void FDoomEdMap::AddType (int doomednum, PClassActor *type, bool temporary)
{
unsigned int hash = (unsigned int)doomednum % DOOMED_HASHSIZE;
FDoomEdEntry *entry = DoomEdHash[hash];
@ -392,7 +508,7 @@ void FDoomEdMap::Empty ()
}
}
const PClass *FDoomEdMap::FindType (int doomednum) const
PClassActor *FDoomEdMap::FindType (int doomednum) const
{
unsigned int hash = (unsigned int)doomednum % DOOMED_HASHSIZE;
FDoomEdEntry *entry = DoomEdHash[hash];

View file

@ -94,8 +94,8 @@ struct FState
}
void SetAction(VMFunction *func) { ActionFunc = func; }
bool CallAction(AActor *self, AActor *stateowner, StateCallData *statecall = NULL);
static const PClass *StaticFindStateOwner (const FState *state);
static const PClass *StaticFindStateOwner (const FState *state, const FActorInfo *info);
static const PClassActor *StaticFindStateOwner (const FState *state);
static const PClassActor *StaticFindStateOwner (const FState *state, const PClassActor *info);
};
struct FStateLabels;
@ -125,16 +125,23 @@ FArchive &operator<< (FArchive &arc, FState *&state);
typedef TMap<FName, fixed_t> DmgFactors;
typedef TMap<FName, BYTE> PainChanceList;
struct FActorInfo
class PClassActor : public PClass
{
DECLARE_CLASS(PClassActor, PClass);
public:
static void StaticInit ();
static void StaticSetActorNums ();
PClassActor();
~PClassActor();
void BuildDefaults();
void ApplyDefaults(BYTE *defaults);
void RegisterIDs();
void SetDamageFactor(FName type, fixed_t factor);
void SetPainChance(FName type, int chance);
size_t PropagateMark();
void InitializeNativeDefaults();
FState *FindState(int numnames, FName *names, bool exact=false) const;
FState *FindStateByString(const char *name, bool exact=false);
@ -143,13 +150,12 @@ struct FActorInfo
return FindState(1, &name);
}
FActorInfo *GetReplacement (bool lookskill=true);
FActorInfo *GetReplacee (bool lookskill=true);
PClassActor *GetReplacement(bool lookskill=true);
PClassActor *GetReplacee(bool lookskill=true);
PClass *Class;
FState *OwnedStates;
FActorInfo *Replacement;
FActorInfo *Replacee;
PClassActor *Replacement;
PClassActor *Replacee;
int NumOwnedStates;
BYTE GameFilter;
BYTE SpawnID;
@ -159,13 +165,18 @@ struct FActorInfo
PainChanceList *PainChances;
};
inline PClassActor *PClass::FindActor(FName name)
{
return dyn_cast<PClassActor>(FindClass(name));
}
class FDoomEdMap
{
public:
~FDoomEdMap();
const PClass *FindType (int doomednum) const;
void AddType (int doomednum, const PClass *type, bool temporary = false);
PClassActor *FindType (int doomednum) const;
void AddType (int doomednum, PClassActor *type, bool temporary = false);
void DelType (int doomednum);
void Empty ();
@ -177,7 +188,7 @@ private:
struct FDoomEdEntry
{
FDoomEdEntry *HashNext;
const PClass *Type;
PClassActor *Type;
int DoomEdNum;
bool temp;
};

View file

@ -52,19 +52,19 @@
void cht_DoCheat (player_t *player, int cheat)
{
static const PClass *const *BeholdPowers[9] =
static PClass *const *BeholdPowers[9] =
{
&RUNTIME_CLASS(APowerInvulnerable),
&RUNTIME_CLASS(APowerStrength),
&RUNTIME_CLASS(APowerInvisibility),
&RUNTIME_CLASS(APowerIronFeet),
&RUNTIME_CLASS_CASTLESS(APowerInvulnerable),
&RUNTIME_CLASS_CASTLESS(APowerStrength),
&RUNTIME_CLASS_CASTLESS(APowerInvisibility),
&RUNTIME_CLASS_CASTLESS(APowerIronFeet),
NULL, // MapRevealer
&RUNTIME_CLASS(APowerLightAmp),
&RUNTIME_CLASS(APowerShadow),
&RUNTIME_CLASS(APowerMask),
&RUNTIME_CLASS(APowerTargeter)
&RUNTIME_CLASS_CASTLESS(APowerLightAmp),
&RUNTIME_CLASS_CASTLESS(APowerShadow),
&RUNTIME_CLASS_CASTLESS(APowerMask),
&RUNTIME_CLASS_CASTLESS(APowerTargeter)
};
const PClass *type;
PClassActor *type;
AInventory *item;
const char *msg = "";
char msgbuild[32];
@ -175,15 +175,12 @@ void cht_DoCheat (player_t *player, int cheat)
case CHT_CHAINSAW:
if (player->mo != NULL && player->health >= 0)
{
type = PClass::FindClass ("Chainsaw");
type = PClass::FindActor("Chainsaw");
if (player->mo->FindInventory (type) == NULL)
{
player->mo->GiveInventoryType (type);
}
if(gameinfo.gametype != GAME_Chex)
msg = GStrings("STSTR_CHOPPERS");
else
msg = GStrings("STSTR_CCHOPPERS");
msg = GStrings(gameinfo.gametype != GAME_Chex ? "STSTR_CHOPPERS" : "STSTR_CCHOPPERS");
}
// [RH] The original cheat also set powers[pw_invulnerability] to true.
// Since this is a timer and not a boolean, it effectively turned off
@ -248,7 +245,7 @@ void cht_DoCheat (player_t *player, int cheat)
}
else if (player->mo != NULL && player->health >= 0)
{
item = player->mo->FindInventory (*BeholdPowers[i]);
item = player->mo->FindInventory(static_cast<PClassActor *>(*BeholdPowers[i]));
if (item == NULL)
{
if (i != 0)
@ -262,7 +259,7 @@ void cht_DoCheat (player_t *player, int cheat)
else
{
// Let's give the item here so that the power doesn't need colormap information.
player->mo->GiveInventoryType(PClass::FindClass("InvulnerabilitySphere"));
player->mo->GiveInventoryType(PClass::FindActor("InvulnerabilitySphere"));
}
}
else
@ -603,7 +600,7 @@ void cht_Give (player_t *player, const char *name, int amount)
{
bool giveall;
int i;
const PClass *type;
PClass *type;
if (player != &players[consoleplayer])
Printf ("%s is a cheater: give %s\n", player->userinfo.netname, name);
@ -664,11 +661,11 @@ void cht_Give (player_t *player, const char *name, int amount)
// he doesn't have it already, and set each to its maximum.
for (unsigned int i = 0; i < PClass::m_Types.Size(); ++i)
{
const PClass *type = PClass::m_Types[i];
PClass *type = PClass::m_Types[i];
if (type->ParentClass == RUNTIME_CLASS(AAmmo))
{
AInventory *ammo = player->mo->FindInventory (type);
AInventory *ammo = player->mo->FindInventory(static_cast<PClassActor *>(type));
if (ammo == NULL)
{
ammo = static_cast<AInventory *>(Spawn (type, 0, 0, 0, NO_REPLACE));
@ -746,15 +743,14 @@ void cht_Give (player_t *player, const char *name, int amount)
// Don't give replaced weapons unless the replacement was done by Dehacked.
if (type != RUNTIME_CLASS(AWeapon) &&
type->IsDescendantOf (RUNTIME_CLASS(AWeapon)) &&
(type->ActorInfo->GetReplacement() == type->ActorInfo ||
type->ActorInfo->GetReplacement()->Class->IsDescendantOf(RUNTIME_CLASS(ADehackedPickup))))
(static_cast<PClassActor *>(type)->GetReplacement() == type ||
static_cast<PClassActor *>(type)->GetReplacement()->IsDescendantOf(RUNTIME_CLASS(ADehackedPickup))))
{
// Give the weapon only if it belongs to the current game or
// is in a weapon slot.
if (type->ActorInfo->GameFilter == GAME_Any ||
(type->ActorInfo->GameFilter & gameinfo.gametype) ||
player->weapons.LocateWeapon(type, NULL, NULL))
if (static_cast<PClassActor *>(type)->GameFilter == GAME_Any ||
(static_cast<PClassActor *>(type)->GameFilter & gameinfo.gametype) ||
player->weapons.LocateWeapon(static_cast<PClassActor *>(type), NULL, NULL))
{
AWeapon *def = (AWeapon*)GetDefaultByType (type);
if (!(def->WeaponFlags & WIF_CHEATNOTWEAPON))
@ -828,7 +824,7 @@ void cht_Give (player_t *player, const char *name, int amount)
void cht_Take (player_t *player, const char *name, int amount)
{
bool takeall;
const PClass *type;
PClass *type;
if (player->mo == NULL || player->health <= 0)
{
@ -874,13 +870,14 @@ void cht_Take (player_t *player, const char *name, int amount)
// Take away all types of backpacks the player might own.
for (unsigned int i = 0; i < PClass::m_Types.Size(); ++i)
{
const PClass *type = PClass::m_Types[i];
PClass *type = PClass::m_Types[i];
if (type->IsDescendantOf(RUNTIME_CLASS (ABackpackItem)))
{
AInventory *pack = player->mo->FindInventory (type);
AInventory *pack = player->mo->FindInventory(static_cast<PClassActor *>(type));
if (pack) pack->Destroy();
if (pack)
pack->Destroy();
}
}
@ -892,11 +889,11 @@ void cht_Take (player_t *player, const char *name, int amount)
{
for (unsigned int i = 0; i < PClass::m_Types.Size(); ++i)
{
const PClass *type = PClass::m_Types[i];
PClass *type = PClass::m_Types[i];
if (type->ParentClass == RUNTIME_CLASS (AAmmo))
{
AInventory *ammo = player->mo->FindInventory (type);
AInventory *ammo = player->mo->FindInventory(static_cast<PClassActor *>(type));
if (ammo)
ammo->Amount = 0;
@ -915,7 +912,7 @@ void cht_Take (player_t *player, const char *name, int amount)
if (type->IsDescendantOf (RUNTIME_CLASS (AArmor)))
{
AActor *armor = player->mo->FindInventory (type);
AActor *armor = player->mo->FindInventory(static_cast<PClassActor *>(type));
if (armor)
armor->Destroy ();
@ -934,7 +931,7 @@ void cht_Take (player_t *player, const char *name, int amount)
if (type->IsDescendantOf (RUNTIME_CLASS (AKey)))
{
AActor *key = player->mo->FindInventory (type);
AActor *key = player->mo->FindInventory(static_cast<PClassActor *>(type));
if (key)
key->Destroy ();
@ -954,7 +951,7 @@ void cht_Take (player_t *player, const char *name, int amount)
if (type != RUNTIME_CLASS(AWeapon) &&
type->IsDescendantOf (RUNTIME_CLASS (AWeapon)))
{
AActor *weapon = player->mo->FindInventory (type);
AActor *weapon = player->mo->FindInventory(static_cast<PClassActor *>(type));
if (weapon)
weapon->Destroy ();
@ -984,7 +981,7 @@ void cht_Take (player_t *player, const char *name, int amount)
!type->IsDescendantOf (RUNTIME_CLASS (AWeapon)) &&
!type->IsDescendantOf (RUNTIME_CLASS (AKey)))
{
AActor *artifact = player->mo->FindInventory (type);
AActor *artifact = player->mo->FindInventory(static_cast<PClassActor *>(type));
if (artifact)
artifact->Destroy ();
@ -1004,7 +1001,7 @@ void cht_Take (player_t *player, const char *name, int amount)
if (type->IsDescendantOf (RUNTIME_CLASS (APuzzleItem)))
{
AActor *puzzlepiece = player->mo->FindInventory (type);
AActor *puzzlepiece = player->mo->FindInventory(static_cast<PClassActor *>(type));
if (puzzlepiece)
puzzlepiece->Destroy ();
@ -1026,7 +1023,7 @@ void cht_Take (player_t *player, const char *name, int amount)
}
else
{
AInventory *inventory = player->mo->FindInventory (type);
AInventory *inventory = player->mo->FindInventory(static_cast<PClassActor *>(type));
if (inventory != NULL)
{
@ -1055,7 +1052,10 @@ void cht_Suicide (player_t *plyr)
plyr->mo->flags |= MF_SHOOTABLE;
plyr->mo->flags2 &= ~MF2_INVULNERABLE;
P_DamageMobj (plyr->mo, plyr->mo, plyr->mo, TELEFRAG_DAMAGE, NAME_Suicide);
if (plyr->mo->health <= 0) plyr->mo->flags &= ~MF_SHOOTABLE;
if (plyr->mo->health <= 0)
{
plyr->mo->flags &= ~MF_SHOOTABLE;
}
}
}

View file

@ -520,7 +520,7 @@ static void GiveInventory (AActor *activator, const char *type, int amount)
//
//============================================================================
static void DoTakeInv (AActor *actor, const PClass *info, int amount)
static void DoTakeInv (AActor *actor, PClassActor *info, int amount)
{
AInventory *item = actor->FindInventory (info);
if (item != NULL)
@ -556,7 +556,7 @@ static void DoTakeInv (AActor *actor, const PClass *info, int amount)
static void TakeInventory (AActor *activator, const char *type, int amount)
{
const PClass *info;
PClassActor *info;
if (type == NULL)
{
@ -570,7 +570,7 @@ static void TakeInventory (AActor *activator, const char *type, int amount)
{
return;
}
info = PClass::FindClass (type);
info = PClass::FindActor (type);
if (info == NULL)
{
return;
@ -597,7 +597,7 @@ static void TakeInventory (AActor *activator, const char *type, int amount)
//
//============================================================================
static bool DoUseInv (AActor *actor, const PClass *info)
static bool DoUseInv (AActor *actor, PClassActor *info)
{
AInventory *item = actor->FindInventory (info);
if (item != NULL)
@ -617,14 +617,14 @@ static bool DoUseInv (AActor *actor, const PClass *info)
static int UseInventory (AActor *activator, const char *type)
{
const PClass *info;
PClassActor *info;
int ret = 0;
if (type == NULL)
{
return 0;
}
info = PClass::FindClass (type);
info = PClass::FindActor (type);
if (info == NULL)
{
return 0;
@ -666,7 +666,7 @@ static int CheckInventory (AActor *activator, const char *type)
return activator->health;
}
const PClass *info = PClass::FindClass (type);
PClassActor *info = PClass::FindActor (type);
AInventory *item = activator->FindInventory (info);
return item ? item->Amount : 0;
}
@ -2060,7 +2060,7 @@ int DLevelScript::Random (int min, int max)
int DLevelScript::ThingCount (int type, int stringid, int tid, int tag)
{
AActor *actor;
const PClass *kind;
PClassActor *kind;
int count = 0;
bool replacemented = false;
@ -2080,10 +2080,9 @@ int DLevelScript::ThingCount (int type, int stringid, int tid, int tag)
if (type_name == NULL)
return 0;
kind = PClass::FindClass (type_name);
if (kind == NULL || kind->ActorInfo == NULL)
kind = PClass::FindActor(type_name);
if (kind == NULL)
return 0;
}
else
{
@ -2135,7 +2134,7 @@ do_count:
{
// Again, with decorate replacements
replacemented = true;
PClass *newkind = kind->ActorInfo->GetReplacement()->Class;
PClassActor *newkind = kind->GetReplacement();
if (newkind != kind)
{
kind = newkind;
@ -5500,12 +5499,12 @@ int DLevelScript::RunScript ()
case PCD_GETAMMOCAPACITY:
if (activator != NULL)
{
const PClass *type = PClass::FindClass (FBehavior::StaticLookupString (STACK(1)));
PClass *type = PClass::FindClass (FBehavior::StaticLookupString (STACK(1)));
AInventory *item;
if (type != NULL && type->ParentClass == RUNTIME_CLASS(AAmmo))
{
item = activator->FindInventory (type);
item = activator->FindInventory (static_cast<PClassActor *>(type));
if (item != NULL)
{
STACK(1) = item->MaxAmount;
@ -5529,12 +5528,12 @@ int DLevelScript::RunScript ()
case PCD_SETAMMOCAPACITY:
if (activator != NULL)
{
const PClass *type = PClass::FindClass (FBehavior::StaticLookupString (STACK(2)));
PClass *type = PClass::FindClass (FBehavior::StaticLookupString (STACK(2)));
AInventory *item;
if (type != NULL && type->ParentClass == RUNTIME_CLASS(AAmmo))
{
item = activator->FindInventory (type);
item = activator->FindInventory (static_cast<PClassActor *>(type));
if (item != NULL)
{
item->MaxAmount = STACK(1);
@ -5835,8 +5834,8 @@ int DLevelScript::RunScript ()
}
else
{
AInventory *item = activator->FindInventory (PClass::FindClass (
FBehavior::StaticLookupString (STACK(1))));
AInventory *item = activator->FindInventory (dyn_cast<PClassActor>(
PClass::FindClass (FBehavior::StaticLookupString (STACK(1)))));
if (item == NULL || !item->IsKindOf (RUNTIME_CLASS(AWeapon)))
{
@ -6149,7 +6148,7 @@ int DLevelScript::RunScript ()
{
if (activator != NULL)
{
state = activator->GetClass()->ActorInfo->FindStateByString (statename, !!STACK(1));
state = activator->GetClass()->FindStateByString (statename, !!STACK(1));
if (state != NULL)
{
activator->SetState (state);
@ -6169,7 +6168,7 @@ int DLevelScript::RunScript ()
while ( (actor = iterator.Next ()) )
{
state = actor->GetClass()->ActorInfo->FindStateByString (statename, !!STACK(1));
state = actor->GetClass()->FindStateByString (statename, !!STACK(1));
if (state != NULL)
{
actor->SetState (state);
@ -6235,7 +6234,7 @@ int DLevelScript::RunScript ()
int amount = STACK(4);
FName type = FBehavior::StaticLookupString(STACK(3));
FName protection = FName (FBehavior::StaticLookupString(STACK(2)), true);
const PClass *protectClass = PClass::FindClass (protection);
PClassActor *protectClass = PClass::FindActor (protection);
int flags = STACK(1);
sp -= 5;

View file

@ -107,7 +107,7 @@ TArray<FStrifeDialogueNode *> StrifeDialogues;
// to their index in the mobjinfo table. This table indexes all
// the Strife actor types in the order Strife had them and is
// initialized as part of the actor's setup in infodefaults.cpp.
const PClass *StrifeTypes[1001];
PClass *StrifeTypes[1001];
static menu_t ConversationMenu;
static TArray<menuitem_t> ConversationItems;
@ -139,7 +139,7 @@ static FBrokenLines *DialogueLines;
//
//============================================================================
static const PClass *GetStrifeType (int typenum)
static PClass *GetStrifeType (int typenum)
{
if (typenum > 0 && typenum < 1001)
{
@ -342,12 +342,12 @@ static FStrifeDialogueNode *ReadRetailNode (FileReader *lump, DWORD &prevSpeaker
node->SpeakerName = ncopystring (speech.Name);
// The item the speaker should drop when killed.
node->DropType = GetStrifeType (speech.DropType);
node->DropType = dyn_cast<PClassActor>(GetStrifeType (speech.DropType));
// Items you need to have to make the speaker use a different node.
for (j = 0; j < 3; ++j)
{
node->ItemCheck[j] = GetStrifeType (speech.ItemCheck[j]);
node->ItemCheck[j] = dyn_cast<PClassActor>(GetStrifeType (speech.ItemCheck[j]));
}
node->ItemCheckNode = speech.Link;
node->Children = NULL;
@ -416,7 +416,7 @@ static FStrifeDialogueNode *ReadTeaserNode (FileReader *lump, DWORD &prevSpeaker
node->SpeakerName = ncopystring (speech.Name);
// The item the speaker should drop when killed.
node->DropType = GetStrifeType (speech.DropType);
node->DropType = dyn_cast<PClassActor>(GetStrifeType (speech.DropType));
// Items you need to have to make the speaker use a different node.
for (j = 0; j < 3; ++j)
@ -478,12 +478,12 @@ static void ParseReplies (FStrifeDialogueReply **replyptr, Response *responses)
reply->LogNumber = rsp->Log;
// The item to receive when this reply is used.
reply->GiveType = GetStrifeType (rsp->GiveType);
reply->GiveType = dyn_cast<PClassActor>(GetStrifeType (rsp->GiveType));
// Do you need anything special for this reply to succeed?
for (k = 0; k < 3; ++k)
{
reply->ItemCheck[k] = GetStrifeType (rsp->Item[k]);
reply->ItemCheck[k] = dyn_cast<PClassActor>(GetStrifeType (rsp->Item[k]));
reply->ItemCheckAmount[k] = rsp->Count[k];
}
@ -592,7 +592,7 @@ static int FindNode (const FStrifeDialogueNode *node)
//
//============================================================================
static bool CheckStrifeItem (player_t *player, const PClass *itemtype, int amount=-1)
static bool CheckStrifeItem (player_t *player, PClassActor *itemtype, int amount=-1)
{
AInventory *item;
@ -615,7 +615,7 @@ static bool CheckStrifeItem (player_t *player, const PClass *itemtype, int amoun
//
//============================================================================
static void TakeStrifeItem (player_t *player, const PClass *itemtype, int amount)
static void TakeStrifeItem (player_t *player, PClassActor *itemtype, int amount)
{
if (itemtype == NULL || amount == 0)
return;

View file

@ -15,8 +15,8 @@ struct FBrokenLines;
struct FStrifeDialogueNode
{
~FStrifeDialogueNode ();
const PClass *DropType;
const PClass *ItemCheck[3];
PClassActor *DropType;
PClassActor *ItemCheck[3];
int ThisNodeNum; // location of this node in StrifeDialogues
int ItemCheckNode; // index into StrifeDialogues
@ -35,8 +35,8 @@ struct FStrifeDialogueReply
~FStrifeDialogueReply ();
FStrifeDialogueReply *Next;
const PClass *GiveType;
const PClass *ItemCheck[3];
PClassActor *GiveType;
PClassActor *ItemCheck[3];
int ItemCheckAmount[3];
char *Reply;
char *QuickYes;
@ -54,7 +54,7 @@ extern TArray<FStrifeDialogueNode *> StrifeDialogues;
// to their index in the mobjinfo table. This table indexes all
// the Strife actor types in the order Strife had them and is
// initialized as part of the actor's setup in infodefaults.cpp.
extern const PClass *StrifeTypes[1001];
extern PClass *StrifeTypes[1001];
struct MapData;

View file

@ -2548,10 +2548,10 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
{
// For Dehacked compatibility this has to use the Arch Vile's
// heal state as a default if the actor doesn't define one itself.
const PClass *archvile = PClass::FindClass("Archvile");
const PClassActor *archvile = PClass::FindActor("Archvile");
if (archvile != NULL)
{
self->SetState (archvile->ActorInfo->FindState(NAME_Heal));
self->SetState (archvile->FindState(NAME_Heal));
}
}
S_Sound (corpsehit, CHAN_BODY, "vile/raise", 1, ATTN_IDLE);
@ -3084,7 +3084,7 @@ void A_BossDeath(AActor *self)
FName mytype = self->GetClass()->TypeName;
// Ugh...
FName type = self->GetClass()->ActorInfo->GetReplacee()->Class->TypeName;
FName type = self->GetClass()->GetReplacee()->TypeName;
// Do generic special death actions first
bool checked = false;

View file

@ -1005,11 +1005,14 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage
if (!(flags & DMG_NO_FACTOR))
{
DmgFactors *df = target->GetClass()->ActorInfo->DamageFactors;
DmgFactors *df = target->GetClass()->DamageFactors;
if (df != NULL)
{
fixed_t *pdf = df->CheckKey(mod);
if (pdf== NULL && mod != NAME_None) pdf = df->CheckKey(NAME_None);
if (pdf== NULL && mod != NAME_None)
{
pdf = df->CheckKey(NAME_None);
}
if (pdf != NULL)
{
damage = FixedMul(damage, *pdf);
@ -1281,7 +1284,7 @@ void P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage
if (!(target->flags5 & MF5_NOPAIN) && (inflictor == NULL || !(inflictor->flags5 & MF5_PAINLESS)) &&
!G_SkillProperty(SKILLP_NoPain) && !(target->flags & MF_SKULLFLY))
{
pc = target->GetClass()->ActorInfo->PainChances;
pc = target->GetClass()->PainChances;
painchance = target->PainChance;
if (pc != NULL)
{

View file

@ -2529,19 +2529,19 @@ FUNC(LS_SetPlayerProperty)
// Add or remove a power
if (arg2 >= PROP_INVULNERABILITY && arg2 <= PROP_SPEED)
{
static const PClass * const *powers[11] =
static PClass * const *powers[11] =
{
&RUNTIME_CLASS(APowerInvulnerable),
&RUNTIME_CLASS(APowerStrength),
&RUNTIME_CLASS(APowerInvisibility),
&RUNTIME_CLASS(APowerIronFeet),
&RUNTIME_CLASS_CASTLESS(APowerInvulnerable),
&RUNTIME_CLASS_CASTLESS(APowerStrength),
&RUNTIME_CLASS_CASTLESS(APowerInvisibility),
&RUNTIME_CLASS_CASTLESS(APowerIronFeet),
NULL, // MapRevealer
&RUNTIME_CLASS(APowerLightAmp),
&RUNTIME_CLASS(APowerWeaponLevel2),
&RUNTIME_CLASS(APowerFlight),
&RUNTIME_CLASS_CASTLESS(APowerLightAmp),
&RUNTIME_CLASS_CASTLESS(APowerWeaponLevel2),
&RUNTIME_CLASS_CASTLESS(APowerFlight),
NULL,
NULL,
&RUNTIME_CLASS(APowerSpeed)
&RUNTIME_CLASS_CASTLESS(APowerSpeed)
};
int power = arg2 - PROP_INVULNERABILITY;
@ -2571,7 +2571,7 @@ FUNC(LS_SetPlayerProperty)
{ // Take power from activator
if (power != 4)
{
AInventory *item = it->FindInventory (*powers[power]);
AInventory *item = it->FindInventory (static_cast<PClassActor *>(*powers[power]));
if (item != NULL)
{
item->Destroy ();
@ -2596,7 +2596,7 @@ FUNC(LS_SetPlayerProperty)
{ // Give power
if (power != 4)
{
APowerup *item = static_cast<APowerup*>(players[i].mo->GiveInventoryType (*powers[power]));
APowerup *item = static_cast<APowerup*>(players[i].mo->GiveInventoryType (static_cast<PClassActor *>(*powers[power])));
if (item != NULL && power == 0 && arg1 == 1)
{
item->BlendColor = MakeSpecialColormap(INVERSECOLORMAP);
@ -2611,7 +2611,7 @@ FUNC(LS_SetPlayerProperty)
{ // Take power
if (power != 4)
{
AInventory *item = players[i].mo->FindInventory (*powers[power]);
AInventory *item = players[i].mo->FindInventory (static_cast<PClassActor *>(*powers[power]));
if (item != NULL)
{
item->Destroy ();

View file

@ -131,7 +131,7 @@ void P_CheckFakeFloorTriggers (AActor *mo, fixed_t oldz, bool oldz_has_viewheigh
// [RH] P_THINGS
//
#define MAX_SPAWNABLES (256)
extern const PClass *SpawnableThings[MAX_SPAWNABLES];
extern PClassActor *SpawnableThings[MAX_SPAWNABLES];
bool P_Thing_Spawn (int tid, AActor *source, int type, angle_t angle, bool fog, int newtid);
bool P_Thing_Projectile (int tid, AActor *source, int type, const char * type_name, angle_t angle,
@ -399,13 +399,13 @@ void P_FindFloorCeiling (AActor *actor, bool onlymidtex = false);
bool P_ChangeSector (sector_t* sector, int crunch, int amt, int floorOrCeil, bool isreset);
fixed_t P_AimLineAttack (AActor *t1, angle_t angle, fixed_t distance, AActor **pLineTarget = NULL, fixed_t vrange=0, bool forcenosmart=false, bool check3d = false, bool checknonshootable = false, AActor *target=NULL);
AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, FName damageType, const PClass *pufftype, bool ismelee = false);
AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, FName damageType, PClassActor *pufftype, bool ismelee = false);
AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance, int pitch, int damage, FName damageType, FName pufftype, bool ismelee = false);
void P_TraceBleed (int damage, fixed_t x, fixed_t y, fixed_t z, AActor *target, angle_t angle, int pitch);
void P_TraceBleed (int damage, AActor *target, angle_t angle, int pitch);
void P_TraceBleed (int damage, AActor *target, AActor *missile); // missile version
void P_TraceBleed (int damage, AActor *target); // random direction version
void P_RailAttack (AActor *source, int damage, int offset, int color1 = 0, int color2 = 0, float maxdiff = 0, bool silent = false, const PClass *puff = NULL, bool pierce = true); // [RH] Shoot a railgun
void P_RailAttack (AActor *source, int damage, int offset, int color1 = 0, int color2 = 0, float maxdiff = 0, bool silent = false, PClassActor *puff = NULL, bool pierce = true); // [RH] Shoot a railgun
bool P_HitFloor (AActor *thing);
bool P_HitWater (AActor *thing, sector_t *sec, fixed_t splashx = FIXED_MIN, fixed_t splashy = FIXED_MIN, fixed_t splashz=FIXED_MIN, bool checkabove = false, bool alert = true);
void P_CheckSplash(AActor *self, fixed_t distance);

View file

@ -3293,7 +3293,7 @@ static bool CheckForSpectral (FTraceResults &res)
//==========================================================================
AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance,
int pitch, int damage, FName damageType, const PClass *pufftype, bool ismeleeattack)
int pitch, int damage, FName damageType, PClassActor *pufftype, bool ismeleeattack)
{
fixed_t vx, vy, vz, shootz;
FTraceResults trace;
@ -3326,7 +3326,7 @@ AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance,
(t1->player->ReadyWeapon->flags2 & MF2_THRUGHOST));
// We need to check the defaults of the replacement here
AActor *puffDefaults = GetDefaultByType(pufftype->ActorInfo->GetReplacement()->Class);
AActor *puffDefaults = GetDefaultByType(pufftype->GetReplacement());
// if the puff uses a non-standard damage type this will override default and melee damage type.
// All other explicitly passed damage types (currenty only MDK) will be preserved.
@ -3506,7 +3506,7 @@ AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance,
AActor *P_LineAttack (AActor *t1, angle_t angle, fixed_t distance,
int pitch, int damage, FName damageType, FName pufftype, bool ismeleeattack)
{
const PClass * type = PClass::FindClass(pufftype);
PClassActor *type = PClass::FindActor(pufftype);
if (type == NULL)
{
Printf("Attempt to spawn unknown actor type '%s'\n", pufftype.GetChars());
@ -3731,7 +3731,7 @@ static bool ProcessNoPierceRailHit (FTraceResults &res)
//
//==========================================================================
void P_RailAttack (AActor *source, int damage, int offset, int color1, int color2, float maxdiff, bool silent, const PClass *puffclass, bool pierce)
void P_RailAttack (AActor *source, int damage, int offset, int color1, int color2, float maxdiff, bool silent, PClassActor *puffclass, bool pierce)
{
fixed_t vx, vy, vz;
angle_t angle, pitch;
@ -3740,7 +3740,10 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
FTraceResults trace;
fixed_t shootz;
if (puffclass == NULL) puffclass = PClass::FindClass(NAME_BulletPuff);
if (puffclass == NULL)
{
puffclass = PClass::FindActor(NAME_BulletPuff);
}
pitch = (angle_t)(-source->pitch) >> ANGLETOFINESHIFT;
angle = source->angle >> ANGLETOFINESHIFT;
@ -3775,7 +3778,7 @@ void P_RailAttack (AActor *source, int damage, int offset, int color1, int color
int flags;
AActor *puffDefaults = puffclass == NULL ?
NULL : GetDefaultByType (puffclass->ActorInfo->GetReplacement()->Class);
NULL : GetDefaultByType (puffclass->GetReplacement());
if (puffDefaults != NULL && puffDefaults->flags6 & MF6_NOTRIGGER) flags = 0;
else flags = TRACE_PCross|TRACE_Impact;

View file

@ -820,13 +820,14 @@ AInventory *AActor::DropInventory (AInventory *item)
//
//============================================================================
AInventory *AActor::FindInventory (const PClass *type)
AInventory *AActor::FindInventory (PClassActor *type)
{
AInventory *item;
if (type == NULL) return NULL;
assert (type->ActorInfo != NULL);
if (type == NULL)
{
return NULL;
}
for (item = Inventory; item != NULL; item = item->Inventory)
{
if (item->GetClass() == type)
@ -839,7 +840,7 @@ AInventory *AActor::FindInventory (const PClass *type)
AInventory *AActor::FindInventory (FName type)
{
return FindInventory(PClass::FindClass(type));
return FindInventory(PClass::FindActor(type));
}
//============================================================================
@ -1080,11 +1081,11 @@ bool AActor::Grind(bool items)
A_BossDeath(this);
}
const PClass *i = PClass::FindClass("RealGibs");
PClassActor *i = PClass::FindActor("RealGibs");
if (i != NULL)
{
i = i->ActorInfo->GetReplacement()->Class;
i = i->GetReplacement();
const AActor *defaults = GetDefaultByType (i);
if (defaults->SpawnState == NULL ||
@ -3505,25 +3506,21 @@ bool AActor::UpdateWaterLevel (fixed_t oldz, bool dosplash)
//
//==========================================================================
AActor *AActor::StaticSpawn (const PClass *type, fixed_t ix, fixed_t iy, fixed_t iz, replace_t allowreplacement, bool SpawningMapThing)
AActor *AActor::StaticSpawn (PClassActor *type, fixed_t ix, fixed_t iy, fixed_t iz, replace_t allowreplacement, bool SpawningMapThing)
{
if (type == NULL)
{
I_Error ("Tried to spawn a class-less actor\n");
}
if (type->ActorInfo == NULL)
{
I_Error ("%s is not an actor\n", type->TypeName.GetChars());
}
if (allowreplacement)
type = type->ActorInfo->GetReplacement()->Class;
{
type = type->GetReplacement();
}
AActor *actor;
actor = static_cast<AActor *>(const_cast<PClass *>(type)->CreateNew ());
actor = static_cast<AActor *>(const_cast<PClassActor *>(type)->CreateNew ());
actor->x = actor->PrevX = ix;
actor->y = actor->PrevY = iy;
@ -3693,7 +3690,11 @@ AActor *Spawn (FName classname, fixed_t x, fixed_t y, fixed_t z, replace_t allow
{
I_Error("Attempt to spawn actor of unknown type '%s'\n", classname.GetChars());
}
return AActor::StaticSpawn (cls, x, y, z, allowreplacement);
if (!cls->IsKindOf(RUNTIME_CLASS(PClassActor)))
{
I_Error("Attempt to spawn non-actor of type '%s'\n", classname.GetChars());
}
return AActor::StaticSpawn (const_cast<PClassActor *>(static_cast<const PClassActor *>(cls)), x, y, z, allowreplacement);
}
void AActor::LevelSpawned ()
@ -4134,7 +4135,7 @@ APlayerPawn *P_SpawnPlayer (FMapThing *mthing, bool tempplayer)
// [RH] position is used to weed out unwanted start spots
AActor *P_SpawnMapThing (FMapThing *mthing, int position)
{
const PClass *i;
PClassActor *i;
int mask;
AActor *mobj;
fixed_t x, y, z;
@ -4318,7 +4319,8 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
Printf ("Unknown type %i at (%i, %i)\n",
mthing->type,
mthing->x>>FRACBITS, mthing->y>>FRACBITS);
i = PClass::FindClass("Unknown");
i = PClass::FindActor("Unknown");
assert(i->IsKindOf(RUNTIME_CLASS(PClassActor)));
}
// [RH] If the thing's corresponding sprite has no frames, also map
// it to the unknown thing.
@ -4326,7 +4328,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
{
// Handle decorate replacements explicitly here
// to check for missing frames in the replacement object.
i = i->ActorInfo->GetReplacement()->Class;
i = i->GetReplacement();
const AActor *defaults = GetDefaultByType (i);
if (defaults->SpawnState == NULL ||
@ -4334,7 +4336,8 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position)
{
Printf ("%s at (%i, %i) has no frames\n",
i->TypeName.GetChars(), mthing->x>>FRACBITS, mthing->y>>FRACBITS);
i = PClass::FindClass("Unknown");
i = PClass::FindActor("Unknown");
assert(i->IsKindOf(RUNTIME_CLASS(PClassActor)));
}
}

View file

@ -769,7 +769,7 @@ angle_t P_BulletSlope (AActor *mo, AActor **pLineTarget)
//
// P_GunShot
//
void P_GunShot (AActor *mo, bool accurate, const PClass *pufftype, angle_t pitch)
void P_GunShot (AActor *mo, bool accurate, PClassActor *pufftype, angle_t pitch)
{
angle_t angle;
int damage;

View file

@ -87,7 +87,7 @@ void P_FireWeapon (player_t *player);
void P_DropWeapon (player_t *player);
void P_BobWeapon (player_t *player, pspdef_t *psp, fixed_t *x, fixed_t *y);
angle_t P_BulletSlope (AActor *mo, AActor **pLineTarget = NULL);
void P_GunShot (AActor *mo, bool accurate, const PClass *pufftype, angle_t pitch);
void P_GunShot (AActor *mo, bool accurate, PClassActor *pufftype, angle_t pitch);
void DoReadyWeapon(AActor *self);
void DoReadyWeaponToBob(AActor *self);

View file

@ -60,7 +60,7 @@
FArchive &operator<< (FArchive &arc, FState *&state)
{
const PClass *info;
const PClassActor *info;
if (arc.IsStoring ())
{
@ -76,7 +76,7 @@ FArchive &operator<< (FArchive &arc, FState *&state)
if (info != NULL)
{
arc.UserWriteClass (info);
arc.WriteCount ((DWORD)(state - info->ActorInfo->OwnedStates));
arc.WriteCount ((DWORD)(state - info->OwnedStates));
}
else
{
@ -94,22 +94,18 @@ FArchive &operator<< (FArchive &arc, FState *&state)
}
else
{
const PClass *info;
const PClassActor *info;
DWORD ofs;
arc.UserReadClass (info);
arc.UserReadClass<PClassActor>(info);
ofs = arc.ReadCount ();
if (ofs == NULL_STATE_INDEX && info == RUNTIME_CLASS(AActor))
{
state = NULL;
}
else if (info->ActorInfo != NULL)
{
state = info->ActorInfo->OwnedStates + ofs;
}
else
{
state = NULL;
state = info->OwnedStates + ofs;
}
}
return arc;
@ -121,15 +117,15 @@ FArchive &operator<< (FArchive &arc, FState *&state)
//
//==========================================================================
const PClass *FState::StaticFindStateOwner (const FState *state)
const PClassActor *FState::StaticFindStateOwner (const FState *state)
{
for (unsigned int i = 0; i < PClass::m_RuntimeActors.Size(); ++i)
{
FActorInfo *info = PClass::m_RuntimeActors[i]->ActorInfo;
PClassActor *info = PClass::m_RuntimeActors[i];
if (state >= info->OwnedStates &&
state < info->OwnedStates + info->NumOwnedStates)
{
return info->Class;
return info;
}
}
@ -143,16 +139,16 @@ const PClass *FState::StaticFindStateOwner (const FState *state)
//
//==========================================================================
const PClass *FState::StaticFindStateOwner (const FState *state, const FActorInfo *info)
const PClassActor *FState::StaticFindStateOwner (const FState *state, const PClassActor *info)
{
while (info != NULL)
{
if (state >= info->OwnedStates &&
state < info->OwnedStates + info->NumOwnedStates)
{
return info->Class;
return info;
}
info = info->Class->ParentClass->ActorInfo;
info = dyn_cast<PClassActor>(info->ParentClass);
}
return NULL;
}
@ -192,7 +188,7 @@ void FStateLabels::Destroy ()
bool AActor::HasSpecialDeathStates () const
{
const FActorInfo *info = GetClass()->ActorInfo;
const PClassActor *info = static_cast<PClassActor *>(GetClass());
if (info->StateList != NULL)
{
@ -201,7 +197,10 @@ bool AActor::HasSpecialDeathStates () const
{
for(int i = 0; i < slabel->Children->NumLabels; i++)
{
if (slabel->Children->Labels[i].State != NULL) return true;
if (slabel->Children->Labels[i].State != NULL)
{
return true;
}
}
}
}
@ -245,7 +244,10 @@ TArray<FName> &MakeStateNameList(const char * fname)
namelist.Clear();
namelist.Push(firstpart);
if (secondpart!=NAME_None) namelist.Push(secondpart);
if (secondpart != NAME_None)
{
namelist.Push(secondpart);
}
while ((c = strtok(NULL, ".")) != NULL)
{
@ -271,7 +273,7 @@ TArray<FName> &MakeStateNameList(const char * fname)
// has names, ignore it. If the argument list still has names, remember it.
//
//===========================================================================
FState *FActorInfo::FindState (int numnames, FName *names, bool exact) const
FState *PClassActor::FindState(int numnames, FName *names, bool exact) const
{
FStateLabels *labels = StateList;
FState *best = NULL;
@ -299,7 +301,10 @@ FState *FActorInfo::FindState (int numnames, FName *names, bool exact) const
break;
}
}
if (count < numnames && exact) return NULL;
if (count < numnames && exact)
{
return NULL;
}
}
return best;
}
@ -310,7 +315,7 @@ FState *FActorInfo::FindState (int numnames, FName *names, bool exact) const
//
//==========================================================================
FState *FActorInfo::FindStateByString(const char *name, bool exact)
FState *PClassActor::FindStateByString(const char *name, bool exact)
{
TArray<FName> &namelist = MakeStateNameList(name);
return FindState(namelist.Size(), &namelist[0], exact);
@ -329,7 +334,10 @@ FStateDefine *FStateDefinitions::FindStateLabelInList(TArray<FStateDefine> & lis
{
for(unsigned i = 0; i<list.Size(); i++)
{
if (list[i].Label == name) return &list[i];
if (list[i].Label == name)
{
return &list[i];
}
}
if (create)
{
@ -410,7 +418,10 @@ FState * FStateDefinitions::FindState(const char * name)
for(unsigned i = 0; i < namelist.Size(); i++)
{
statedef = FindStateLabelInList(*statelist, namelist[i], false);
if (statedef == NULL) return NULL;
if (statedef == NULL)
{
return NULL;
}
statelist = &statedef->Children;
}
return statedef ? statedef->State : NULL;
@ -442,8 +453,10 @@ FStateLabels * FStateDefinitions::CreateStateLabelList(TArray<FStateDefine> & st
int count = statelist.Size();
if (count == 0) return NULL;
if (count == 0)
{
return NULL;
}
FStateLabels *list = (FStateLabels*)M_Malloc(sizeof(FStateLabels)+(count-1)*sizeof(FStateLabel));
list->NumLabels = count;
@ -465,7 +478,7 @@ FStateLabels * FStateDefinitions::CreateStateLabelList(TArray<FStateDefine> & st
//
//===========================================================================
void FStateDefinitions::InstallStates(FActorInfo *info, AActor *defaults)
void FStateDefinitions::InstallStates(PClassActor *info, AActor *defaults)
{
// First ensure we have a valid spawn state.
FState *state = FindState("Spawn");
@ -519,15 +532,15 @@ void FStateDefinitions::MakeStateList(const FStateLabels *list, TArray<FStateDef
}
}
void FStateDefinitions::MakeStateDefines(const PClass *cls)
void FStateDefinitions::MakeStateDefines(const PClassActor *cls)
{
StateArray.Clear();
laststate = NULL;
lastlabel = -1;
if (cls != NULL && cls->ActorInfo != NULL && cls->ActorInfo->StateList != NULL)
if (cls != NULL && cls->StateList != NULL)
{
MakeStateList(cls->ActorInfo->StateList, StateLabels);
MakeStateList(cls->StateList, StateLabels);
}
else
{
@ -613,9 +626,9 @@ void FStateDefinitions::RetargetStates (intptr_t count, const char *target)
//
//==========================================================================
FState *FStateDefinitions::ResolveGotoLabel (AActor *actor, const PClass *mytype, char *name)
FState *FStateDefinitions::ResolveGotoLabel (AActor *actor, PClassActor *mytype, char *name)
{
const PClass *type=mytype;
PClassActor *type = mytype;
FState *state;
char *namestart = name;
char *label, *offset, *pt;
@ -632,13 +645,13 @@ FState *FStateDefinitions::ResolveGotoLabel (AActor *actor, const PClass *mytype
// superclass, or it may be the name of any class that this one derives from.
if (stricmp (classname, "Super") == 0)
{
type = type->ParentClass;
type = dyn_cast<PClassActor>(type->ParentClass);
actor = GetDefaultByType(type);
}
else
{
// first check whether a state of the desired name exists
const PClass *stype = PClass::FindClass (classname);
PClass *stype = PClass::FindClass (classname);
if (stype == NULL)
{
I_Error ("%s is an unknown class.", classname);
@ -654,7 +667,7 @@ FState *FStateDefinitions::ResolveGotoLabel (AActor *actor, const PClass *mytype
}
if (type != stype)
{
type = stype;
type = static_cast<PClassActor *>(stype);
actor = GetDefaultByType (type);
}
}
@ -670,8 +683,14 @@ FState *FStateDefinitions::ResolveGotoLabel (AActor *actor, const PClass *mytype
v = offset ? strtol (offset, NULL, 0) : 0;
// Get the state's address.
if (type==mytype) state = FindState (label);
else state = type->ActorInfo->FindStateByString(label, true);
if (type == mytype)
{
state = FindState (label);
}
else
{
state = type->FindStateByString(label, true);
}
if (state != NULL)
{
@ -693,7 +712,7 @@ FState *FStateDefinitions::ResolveGotoLabel (AActor *actor, const PClass *mytype
//
//==========================================================================
void FStateDefinitions::FixStatePointers (FActorInfo *actor, TArray<FStateDefine> & list)
void FStateDefinitions::FixStatePointers (PClassActor *actor, TArray<FStateDefine> & list)
{
for (unsigned i = 0; i < list.Size(); i++)
{
@ -703,7 +722,10 @@ void FStateDefinitions::FixStatePointers (FActorInfo *actor, TArray<FStateDefine
list[i].State = actor->OwnedStates + v - 1;
list[i].DefineFlags = SDF_STATE;
}
if (list[i].Children.Size() > 0) FixStatePointers(actor, list[i].Children);
if (list[i].Children.Size() > 0)
{
FixStatePointers(actor, list[i].Children);
}
}
}
@ -715,13 +737,13 @@ void FStateDefinitions::FixStatePointers (FActorInfo *actor, TArray<FStateDefine
//
//==========================================================================
void FStateDefinitions::ResolveGotoLabels (FActorInfo *actor, AActor *defaults, TArray<FStateDefine> & list)
void FStateDefinitions::ResolveGotoLabels (PClassActor *actor, AActor *defaults, TArray<FStateDefine> & list)
{
for (unsigned i = 0; i < list.Size(); i++)
{
if (list[i].State != NULL && list[i].DefineFlags == SDF_LABEL)
{ // It's not a valid state, so it must be a label string. Resolve it.
list[i].State = ResolveGotoLabel (defaults, actor->Class, (char *)list[i].State);
list[i].State = ResolveGotoLabel (defaults, actor, (char *)list[i].State);
list[i].DefineFlags = SDF_STATE;
}
if (list[i].Children.Size() > 0) ResolveGotoLabels(actor, defaults, list[i].Children);
@ -858,7 +880,7 @@ int FStateDefinitions::AddStates(FState *state, const char *framechars)
//
//==========================================================================
int FStateDefinitions::FinishStates (FActorInfo *actor, AActor *defaults)
int FStateDefinitions::FinishStates(PClassActor *actor, AActor *defaults)
{
static int c = 0;
int count = StateArray.Size();
@ -899,7 +921,7 @@ int FStateDefinitions::FinishStates (FActorInfo *actor, AActor *defaults)
break;
case SDF_LABEL:
realstates[i].NextState = ResolveGotoLabel (defaults, actor->Class, (char *)realstates[i].NextState);
realstates[i].NextState = ResolveGotoLabel(defaults, actor, (char *)realstates[i].NextState);
break;
}
}
@ -924,7 +946,7 @@ void DumpStateHelper(FStateLabels *StateList, const FString &prefix)
{
if (StateList->Labels[i].State != NULL)
{
const PClass *owner = FState::StaticFindStateOwner(StateList->Labels[i].State);
const PClassActor *owner = FState::StaticFindStateOwner(StateList->Labels[i].State);
if (owner == NULL)
{
Printf(PRINT_LOG, "%s%s: invalid\n", prefix.GetChars(), StateList->Labels[i].Label.GetChars());
@ -932,7 +954,7 @@ void DumpStateHelper(FStateLabels *StateList, const FString &prefix)
else
{
Printf(PRINT_LOG, "%s%s: %s.%d\n", prefix.GetChars(), StateList->Labels[i].Label.GetChars(),
owner->TypeName.GetChars(), int(StateList->Labels[i].State - owner->ActorInfo->OwnedStates));
owner->TypeName.GetChars(), int(StateList->Labels[i].State - owner->OwnedStates));
}
}
if (StateList->Labels[i].Children != NULL)
@ -946,8 +968,8 @@ CCMD(dumpstates)
{
for (unsigned int i = 0; i < PClass::m_RuntimeActors.Size(); ++i)
{
FActorInfo *info = PClass::m_RuntimeActors[i]->ActorInfo;
Printf(PRINT_LOG, "State labels for %s\n", info->Class->TypeName.GetChars());
PClassActor *info = PClass::m_RuntimeActors[i];
Printf(PRINT_LOG, "State labels for %s\n", info->TypeName.GetChars());
DumpStateHelper(info->StateList, "");
Printf(PRINT_LOG, "----------------------------\n");
}

View file

@ -47,14 +47,14 @@
#include "g_level.h"
// List of spawnable things for the Thing_Spawn and Thing_Projectile specials.
const PClass *SpawnableThings[MAX_SPAWNABLES];
PClassActor *SpawnableThings[MAX_SPAWNABLES];
static FRandom pr_leadtarget ("LeadTarget");
bool P_Thing_Spawn (int tid, AActor *source, int type, angle_t angle, bool fog, int newtid)
{
int rtn = 0;
const PClass *kind;
PClassActor *kind;
AActor *spot, *mobj;
FActorIterator iterator (tid);
@ -65,7 +65,7 @@ bool P_Thing_Spawn (int tid, AActor *source, int type, angle_t angle, bool fog,
return false;
// Handle decorate replacements.
kind = kind->ActorInfo->GetReplacement()->Class;
kind = kind->GetReplacement();
if ((GetDefaultByType(kind)->flags3 & MF3_ISMONSTER) &&
((dmflags & DF_NO_MONSTERS) || (level.flags2 & LEVEL2_NOMONSTERS)))
@ -178,7 +178,7 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_nam
bool leadTarget)
{
int rtn = 0;
const PClass *kind;
PClassActor *kind;
AActor *spot, *mobj, *targ = forcedest;
FActorIterator iterator (tid);
double fspeed = speed;
@ -194,13 +194,13 @@ bool P_Thing_Projectile (int tid, AActor *source, int type, const char *type_nam
}
else
{
if ((kind = PClass::FindClass(type_name)) == NULL || kind->ActorInfo == NULL)
if ((kind = PClass::FindActor(type_name)) == NULL)
return false;
}
// Handle decorate replacements.
kind = kind->ActorInfo->GetReplacement()->Class;
kind = kind->GetReplacement();
defflags3 = GetDefaultByType(kind)->flags3;
if ((defflags3 & MF3_ISMONSTER) &&

View file

@ -1053,7 +1053,7 @@ void APlayerPawn::GiveDefaultInventory ()
while (di)
{
const PClass *ti = PClass::FindClass (di->Name);
PClassActor *ti = PClass::FindActor (di->Name);
if (ti)
{
AInventory *item = FindInventory (ti);
@ -1104,7 +1104,7 @@ void APlayerPawn::MorphPlayerThink ()
void APlayerPawn::ActivateMorphWeapon ()
{
const PClass *morphweapon = PClass::FindClass (MorphWeapon);
PClassActor *morphweapon = PClass::FindActor (MorphWeapon);
player->PendingWeapon = WP_NOCHANGE;
player->psprites[ps_weapon].sy = WEAPONTOP;
@ -1341,8 +1341,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SkullPop)
// [GRB] Parameterized version
if (spawntype == NULL || !spawntype->IsDescendantOf(RUNTIME_CLASS(APlayerChunk)))
{
spawntype = PClass::FindClass("BloodySkull");
if (spawntype == NULL) return 0;
spawntype = PClass::FindActor("BloodySkull");
if (spawntype == NULL)
return 0;
}
self->flags &= ~MF_SOLID;

View file

@ -103,7 +103,7 @@ IMPLEMENT_CLASS (AFakeInventory)
static void ParseInsideDecoration (Baggage &bag, AActor *defaults,
FExtraInfo &extra, EDefinitionType def, FScanner &sc, TArray<FState> &StateArray);
static void ParseSpriteFrames (FActorInfo *info, TArray<FState> &states, FScanner &sc);
static void ParseSpriteFrames (PClassActor *info, TArray<FState> &states, FScanner &sc);
// PRIVATE DATA DEFINITIONS ------------------------------------------------
@ -146,24 +146,22 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def)
Baggage bag;
TArray<FState> StateArray;
FExtraInfo extra;
FActorInfo *info;
PClass *type;
PClass *parent;
PClassActor *type;
PClassActor *parent;
FName typeName;
if (def == DEF_Pickup) parent = RUNTIME_CLASS(AFakeInventory);
else parent = RUNTIME_CLASS(AActor);
parent = (def == DEF_Pickup) ? RUNTIME_CLASS(AFakeInventory) : RUNTIME_CLASS(AActor);
sc.MustGetString();
typeName = FName(sc.String);
type = parent->CreateDerivedClass (typeName, parent->Size);
type = static_cast<PClassActor *>(parent->CreateDerivedClass (typeName, parent->Size));
ResetBaggage(&bag, parent);
info = bag.Info = type->ActorInfo;
bag.Info = type;
#ifdef _DEBUG
bag.ClassName = type->TypeName;
#endif
info->GameFilter = GAME_Any;
type->GameFilter = GAME_Any;
sc.MustGetStringName("{");
memset (&extra, 0, sizeof(extra));
@ -192,15 +190,15 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def)
// Make a copy of the final frozen frame for A_FreezeDeathChunks
FState icecopy = StateArray[extra.IceDeathEnd-1];
StateArray.Push (icecopy);
info->NumOwnedStates += 1;
type->NumOwnedStates += 1;
}
info->OwnedStates = new FState[info->NumOwnedStates];
memcpy (info->OwnedStates, &StateArray[0], info->NumOwnedStates * sizeof(info->OwnedStates[0]));
if (info->NumOwnedStates == 1)
type->OwnedStates = new FState[type->NumOwnedStates];
memcpy (type->OwnedStates, &StateArray[0], type->NumOwnedStates * sizeof(type->OwnedStates[0]));
if (type->NumOwnedStates == 1)
{
info->OwnedStates->Tics = -1;
info->OwnedStates->Misc1 = 0;
type->OwnedStates->Tics = -1;
type->OwnedStates->Misc1 = 0;
}
else
{
@ -209,55 +207,58 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def)
// Spawn states loop endlessly
for (i = extra.SpawnStart; i < extra.SpawnEnd-1; ++i)
{
info->OwnedStates[i].NextState = &info->OwnedStates[i+1];
type->OwnedStates[i].NextState = &type->OwnedStates[i+1];
}
info->OwnedStates[i].NextState = &info->OwnedStates[extra.SpawnStart];
type->OwnedStates[i].NextState = &type->OwnedStates[extra.SpawnStart];
// Death states are one-shot and freeze on the final state
if (extra.DeathEnd != 0)
{
for (i = extra.DeathStart; i < extra.DeathEnd-1; ++i)
{
info->OwnedStates[i].NextState = &info->OwnedStates[i+1];
type->OwnedStates[i].NextState = &type->OwnedStates[i+1];
}
if (extra.bDiesAway || def == DEF_Projectile)
{
info->OwnedStates[i].NextState = NULL;
type->OwnedStates[i].NextState = NULL;
}
else
{
info->OwnedStates[i].Tics = -1;
info->OwnedStates[i].Misc1 = 0;
type->OwnedStates[i].Tics = -1;
type->OwnedStates[i].Misc1 = 0;
}
if (def == DEF_Projectile)
{
if (extra.bExplosive)
{
info->OwnedStates[extra.DeathStart].SetAction(FindGlobalActionFunction("A_Explode")->Function);
type->OwnedStates[extra.DeathStart].SetAction(FindGlobalActionFunction("A_Explode")->Function);
}
}
else
{
// The first frame plays the death sound and
// the second frame makes it nonsolid.
info->OwnedStates[extra.DeathStart].SetAction(FindGlobalActionFunction("A_Scream")->Function);
type->OwnedStates[extra.DeathStart].SetAction(FindGlobalActionFunction("A_Scream")->Function);
if (extra.bSolidOnDeath)
{
}
else if (extra.DeathStart + 1 < extra.DeathEnd)
{
info->OwnedStates[extra.DeathStart+1].SetAction(FindGlobalActionFunction("A_NoBlocking")->Function);
type->OwnedStates[extra.DeathStart+1].SetAction(FindGlobalActionFunction("A_NoBlocking")->Function);
}
else
{
info->OwnedStates[extra.DeathStart].SetAction(FindGlobalActionFunction("A_ScreamAndUnblock")->Function);
type->OwnedStates[extra.DeathStart].SetAction(FindGlobalActionFunction("A_ScreamAndUnblock")->Function);
}
if (extra.DeathHeight == 0) extra.DeathHeight = ((AActor*)(type->Defaults))->height;
info->Class->Meta.SetMetaFixed (AMETA_DeathHeight, extra.DeathHeight);
if (extra.DeathHeight == 0)
{
extra.DeathHeight = ((AActor*)(type->Defaults))->height;
}
bag.statedef.SetStateLabel("Death", &info->OwnedStates[extra.DeathStart]);
type->Meta.SetMetaFixed (AMETA_DeathHeight, extra.DeathHeight);
}
bag.statedef.SetStateLabel("Death", &type->OwnedStates[extra.DeathStart]);
}
// Burn states are the same as death states, except they can optionally terminate
@ -265,37 +266,37 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def)
{
for (i = extra.FireDeathStart; i < extra.FireDeathEnd-1; ++i)
{
info->OwnedStates[i].NextState = &info->OwnedStates[i+1];
type->OwnedStates[i].NextState = &type->OwnedStates[i+1];
}
if (extra.bBurnAway)
{
info->OwnedStates[i].NextState = NULL;
type->OwnedStates[i].NextState = NULL;
}
else
{
info->OwnedStates[i].Tics = -1;
info->OwnedStates[i].Misc1 = 0;
type->OwnedStates[i].Tics = -1;
type->OwnedStates[i].Misc1 = 0;
}
// The first frame plays the burn sound and
// the second frame makes it nonsolid.
info->OwnedStates[extra.FireDeathStart].SetAction(FindGlobalActionFunction("A_ActiveSound")->Function);
type->OwnedStates[extra.FireDeathStart].SetAction(FindGlobalActionFunction("A_ActiveSound")->Function);
if (extra.bSolidOnBurn)
{
}
else if (extra.FireDeathStart + 1 < extra.FireDeathEnd)
{
info->OwnedStates[extra.FireDeathStart+1].SetAction(FindGlobalActionFunction("A_NoBlocking")->Function);
type->OwnedStates[extra.FireDeathStart+1].SetAction(FindGlobalActionFunction("A_NoBlocking")->Function);
}
else
{
info->OwnedStates[extra.FireDeathStart].SetAction(FindGlobalActionFunction("A_ActiveAndUnblock")->Function);
type->OwnedStates[extra.FireDeathStart].SetAction(FindGlobalActionFunction("A_ActiveAndUnblock")->Function);
}
if (extra.BurnHeight == 0) extra.BurnHeight = ((AActor*)(type->Defaults))->height;
type->Meta.SetMetaFixed (AMETA_BurnHeight, extra.BurnHeight);
bag.statedef.SetStateLabel("Burn", &info->OwnedStates[extra.FireDeathStart]);
bag.statedef.SetStateLabel("Burn", &type->OwnedStates[extra.FireDeathStart]);
}
// Ice states are similar to burn and death, except their final frame enters
@ -304,23 +305,23 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def)
{
for (i = extra.IceDeathStart; i < extra.IceDeathEnd-1; ++i)
{
info->OwnedStates[i].NextState = &info->OwnedStates[i+1];
type->OwnedStates[i].NextState = &type->OwnedStates[i+1];
}
info->OwnedStates[i].NextState = &info->OwnedStates[info->NumOwnedStates-1];
info->OwnedStates[i].Tics = 5;
info->OwnedStates[i].Misc1 = 0;
info->OwnedStates[i].SetAction(FindGlobalActionFunction("A_FreezeDeath")->Function);
type->OwnedStates[i].NextState = &type->OwnedStates[type->NumOwnedStates-1];
type->OwnedStates[i].Tics = 5;
type->OwnedStates[i].Misc1 = 0;
type->OwnedStates[i].SetAction(FindGlobalActionFunction("A_FreezeDeath")->Function);
i = info->NumOwnedStates - 1;
info->OwnedStates[i].NextState = &info->OwnedStates[i];
info->OwnedStates[i].Tics = 1;
info->OwnedStates[i].Misc1 = 0;
info->OwnedStates[i].SetAction(FindGlobalActionFunction("A_FreezeDeathChunks")->Function);
bag.statedef.SetStateLabel("Ice", &info->OwnedStates[extra.IceDeathStart]);
i = type->NumOwnedStates - 1;
type->OwnedStates[i].NextState = &type->OwnedStates[i];
type->OwnedStates[i].Tics = 1;
type->OwnedStates[i].Misc1 = 0;
type->OwnedStates[i].SetAction(FindGlobalActionFunction("A_FreezeDeathChunks")->Function);
bag.statedef.SetStateLabel("Ice", &type->OwnedStates[extra.IceDeathStart]);
}
else if (extra.bGenericIceDeath)
{
bag.statedef.SetStateLabel("Ice", RUNTIME_CLASS(AActor)->ActorInfo->FindState(NAME_GenericFreezeDeath));
bag.statedef.SetStateLabel("Ice", RUNTIME_CLASS(AActor)->FindState(NAME_GenericFreezeDeath));
}
}
if (def == DEF_BreakableDecoration)
@ -331,8 +332,8 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def)
{
((AActor *)(type->Defaults))->flags |= MF_DROPOFF|MF_MISSILE;
}
bag.statedef.SetStateLabel("Spawn", &info->OwnedStates[extra.SpawnStart]);
bag.statedef.InstallStates (info, ((AActor *)(type->Defaults)));
bag.statedef.SetStateLabel("Spawn", &type->OwnedStates[extra.SpawnStart]);
bag.statedef.InstallStates (type, ((AActor *)(type->Defaults)));
}
//==========================================================================
@ -474,18 +475,18 @@ static void ParseInsideDecoration (Baggage &bag, AActor *defaults,
else if (def == DEF_Projectile && sc.Compare ("ExplosionRadius"))
{
sc.MustGetNumber ();
bag.Info->Class->Meta.SetMetaInt(ACMETA_ExplosionRadius, sc.Number);
bag.Info->Meta.SetMetaInt(ACMETA_ExplosionRadius, sc.Number);
extra.bExplosive = true;
}
else if (def == DEF_Projectile && sc.Compare ("ExplosionDamage"))
{
sc.MustGetNumber ();
bag.Info->Class->Meta.SetMetaInt(ACMETA_ExplosionDamage, sc.Number);
bag.Info->Meta.SetMetaInt(ACMETA_ExplosionDamage, sc.Number);
extra.bExplosive = true;
}
else if (def == DEF_Projectile && sc.Compare ("DoNotHurtShooter"))
{
bag.Info->Class->Meta.SetMetaInt(ACMETA_DontHurtShooter, true);
bag.Info->Meta.SetMetaInt(ACMETA_DontHurtShooter, true);
}
else if (def == DEF_Projectile && sc.Compare ("Damage"))
{
@ -570,7 +571,7 @@ static void ParseInsideDecoration (Baggage &bag, AActor *defaults,
else if (def == DEF_Pickup && sc.Compare ("PickupMessage"))
{
sc.MustGetString ();
bag.Info->Class->Meta.SetMetaString(AIMETA_PickupMessage, sc.String);
bag.Info->Meta.SetMetaString(AIMETA_PickupMessage, sc.String);
}
else if (def == DEF_Pickup && sc.Compare ("Respawns"))
{
@ -641,7 +642,7 @@ static void ParseInsideDecoration (Baggage &bag, AActor *defaults,
// "10:A, 15:B, 8:C, 6:B"
//==========================================================================
static void ParseSpriteFrames (FActorInfo *info, TArray<FState> &states, FScanner &sc)
static void ParseSpriteFrames (PClassActor *info, TArray<FState> &states, FScanner &sc)
{
FState state;
char *token = strtok (sc.String, ",\t\n\r");

View file

@ -71,7 +71,7 @@ void InitThingdef();
void ParseDecorate (FScanner &sc);
// STATIC FUNCTION PROTOTYPES --------------------------------------------
const PClass *QuestItemClasses[31];
PClassActor *QuestItemClasses[31];
PSymbolTable GlobalSymbols;
//==========================================================================
@ -79,19 +79,18 @@ PSymbolTable GlobalSymbols;
// Starts a new actor definition
//
//==========================================================================
FActorInfo *CreateNewActor(const FScriptPosition &sc, FName typeName, FName parentName, bool native)
PClassActor *CreateNewActor(const FScriptPosition &sc, FName typeName, FName parentName, bool native)
{
const PClass *replacee = NULL;
PClass *ti = NULL;
FActorInfo *info = NULL;
PClassActor *replacee = NULL;
PClassActor *ti = NULL;
PClass *parent = RUNTIME_CLASS(AActor);
PClassActor *parent = RUNTIME_CLASS(AActor);
if (parentName != NAME_None)
{
parent = const_cast<PClass *> (PClass::FindClass (parentName));
parent = PClass::FindActor(parentName);
const PClass *p = parent;
PClassActor *p = parent;
while (p != NULL)
{
if (p->TypeName == typeName)
@ -99,7 +98,7 @@ FActorInfo *CreateNewActor(const FScriptPosition &sc, FName typeName, FName pare
sc.Message(MSG_ERROR, "'%s' inherits from a class with the same name", typeName.GetChars());
break;
}
p = p->ParentClass;
p = dyn_cast<PClassActor>(p->ParentClass);
}
if (parent == NULL)
@ -112,19 +111,14 @@ FActorInfo *CreateNewActor(const FScriptPosition &sc, FName typeName, FName pare
sc.Message(MSG_ERROR, "Parent type '%s' is not an actor in %s", parentName.GetChars(), typeName.GetChars());
parent = RUNTIME_CLASS(AActor);
}
else if (parent->ActorInfo == NULL)
{
sc.Message(MSG_ERROR, "uninitialized parent type '%s' in %s", parentName.GetChars(), typeName.GetChars());
parent = RUNTIME_CLASS(AActor);
}
}
if (native)
{
ti = (PClass*)PClass::FindClass(typeName);
ti = PClass::FindActor(typeName);
if (ti == NULL)
{
sc.Message(MSG_ERROR, "Unknown native class '%s'", typeName.GetChars());
sc.Message(MSG_ERROR, "Unknown native actor '%s'", typeName.GetChars());
goto create;
}
else if (ti != RUNTIME_CLASS(AActor) && ti->ParentClass->NativeClass() != parent->NativeClass())
@ -133,36 +127,34 @@ FActorInfo *CreateNewActor(const FScriptPosition &sc, FName typeName, FName pare
parent = RUNTIME_CLASS(AActor);
goto create;
}
else if (ti->ActorInfo != NULL)
else if (ti->Defaults != NULL)
{
sc.Message(MSG_ERROR, "Redefinition of internal class '%s'", typeName.GetChars());
goto create;
}
ti->InitializeActorInfo();
info = ti->ActorInfo;
ti->InitializeNativeDefaults();
}
else
{
create:
ti = parent->CreateDerivedClass (typeName, parent->Size);
info = ti->ActorInfo;
ti = static_cast<PClassActor *>(parent->CreateDerivedClass (typeName, parent->Size));
}
if (parent->ActorInfo->DamageFactors != NULL)
if (parent->DamageFactors != NULL)
{
// copy damage factors from parent
info->DamageFactors = new DmgFactors;
*info->DamageFactors = *parent->ActorInfo->DamageFactors;
ti->DamageFactors = new DmgFactors;
*ti->DamageFactors = *parent->DamageFactors;
}
if (parent->ActorInfo->PainChances != NULL)
if (parent->PainChances != NULL)
{
// copy pain chances from parent
info->PainChances = new PainChanceList;
*info->PainChances = *parent->ActorInfo->PainChances;
ti->PainChances = new PainChanceList;
*ti->PainChances = *parent->PainChances;
}
info->Replacee = info->Replacement = NULL;
info->DoomEdNum = -1;
return info;
ti->Replacee = ti->Replacement = NULL;
ti->DoomEdNum = -1;
return ti;
}
//==========================================================================
@ -171,26 +163,22 @@ FActorInfo *CreateNewActor(const FScriptPosition &sc, FName typeName, FName pare
//
//==========================================================================
void SetReplacement(FActorInfo *info, FName replaceName)
void SetReplacement(PClassActor *info, FName replaceName)
{
// Check for "replaces"
if (replaceName != NAME_None)
{
// Get actor name
const PClass *replacee = PClass::FindClass (replaceName);
PClassActor *replacee = PClass::FindActor(replaceName);
if (replacee == NULL)
{
I_Error ("Replaced type '%s' not found in %s", replaceName.GetChars(), info->Class->TypeName.GetChars());
}
else if (replacee->ActorInfo == NULL)
{
I_Error ("Replaced type '%s' is not an actor in %s", replaceName.GetChars(), info->Class->TypeName.GetChars());
I_Error ("Replaced type '%s' not found in %s", replaceName.GetChars(), info->TypeName.GetChars());
}
if (replacee != NULL)
{
replacee->ActorInfo->Replacement = info;
info->Replacee = replacee->ActorInfo;
replacee->Replacement = info;
info->Replacee = replacee;
}
}
@ -202,10 +190,9 @@ void SetReplacement(FActorInfo *info, FName replaceName)
//
//==========================================================================
void FinishActor(const FScriptPosition &sc, FActorInfo *info, Baggage &bag)
void FinishActor(const FScriptPosition &sc, PClassActor *info, Baggage &bag)
{
PClass *ti = info->Class;
AActor *defaults = (AActor*)ti->Defaults;
AActor *defaults = (AActor*)info->Defaults;
try
{
@ -223,29 +210,28 @@ void FinishActor(const FScriptPosition &sc, FActorInfo *info, Baggage &bag)
{
if (bag.DropItemList == NULL)
{
if (ti->Meta.GetMetaInt (ACMETA_DropItems) != 0)
if (info->Meta.GetMetaInt (ACMETA_DropItems) != 0)
{
ti->Meta.SetMetaInt (ACMETA_DropItems, 0);
info->Meta.SetMetaInt (ACMETA_DropItems, 0);
}
}
else
{
ti->Meta.SetMetaInt (ACMETA_DropItems,
StoreDropItemChain(bag.DropItemList));
info->Meta.SetMetaInt (ACMETA_DropItems, StoreDropItemChain(bag.DropItemList));
}
}
if (ti->IsDescendantOf (RUNTIME_CLASS(AInventory)))
if (info->IsDescendantOf (RUNTIME_CLASS(AInventory)))
{
defaults->flags |= MF_SPECIAL;
}
// Weapons must be checked for all relevant states. They may crash the game otherwise.
if (ti->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
if (info->IsDescendantOf(RUNTIME_CLASS(AWeapon)))
{
FState * ready = ti->ActorInfo->FindState(NAME_Ready);
FState * select = ti->ActorInfo->FindState(NAME_Select);
FState * deselect = ti->ActorInfo->FindState(NAME_Deselect);
FState * fire = ti->ActorInfo->FindState(NAME_Fire);
FState *ready = info->FindState(NAME_Ready);
FState *select = info->FindState(NAME_Select);
FState *deselect = info->FindState(NAME_Deselect);
FState *fire = info->FindState(NAME_Fire);
// Consider any weapon without any valid state abstract and don't output a warning
// This is for creating base classes for weapon groups that only set up some properties.
@ -253,19 +239,19 @@ void FinishActor(const FScriptPosition &sc, FActorInfo *info, Baggage &bag)
{
if (!ready)
{
sc.Message(MSG_ERROR, "Weapon %s doesn't define a ready state.\n", ti->TypeName.GetChars());
sc.Message(MSG_ERROR, "Weapon %s doesn't define a ready state.\n", info->TypeName.GetChars());
}
if (!select)
{
sc.Message(MSG_ERROR, "Weapon %s doesn't define a select state.\n", ti->TypeName.GetChars());
sc.Message(MSG_ERROR, "Weapon %s doesn't define a select state.\n", info->TypeName.GetChars());
}
if (!deselect)
{
sc.Message(MSG_ERROR, "Weapon %s doesn't define a deselect state.\n", ti->TypeName.GetChars());
sc.Message(MSG_ERROR, "Weapon %s doesn't define a deselect state.\n", info->TypeName.GetChars());
}
if (!fire)
{
sc.Message(MSG_ERROR, "Weapon %s doesn't define a fire state.\n", ti->TypeName.GetChars());
sc.Message(MSG_ERROR, "Weapon %s doesn't define a fire state.\n", info->TypeName.GetChars());
}
}
}
@ -295,7 +281,7 @@ static void FinishThingdef()
}
else
{
FCompileContext ctx(tcall->ActorInfo->Class, true);
FCompileContext ctx(tcall->ActorClass, true);
for (j = 0; j < tcall->Parameters.Size(); ++j)
{
tcall->Parameters[j]->Resolve(ctx);
@ -325,7 +311,7 @@ static void FinishThingdef()
const char *marks = "=======================================================";
char label[64];
int labellen = mysnprintf(label, countof(label), "Function %s.States[%d] (*%d)",
tcall->ActorInfo->Class->TypeName.GetChars(),
tcall->ActorClass->TypeName.GetChars(),
tcall->FirstState, tcall->NumStates);
fprintf(dump, "\n%.*s %s %.*s", MAX(3, 38 - labellen / 2), marks, label, MAX(3, 38 - labellen / 2), marks);
fprintf(dump, "\nInteger regs: %-3d Float regs: %-3d Address regs: %-3d String regs: %-3d\nStack size: %d\n",
@ -337,7 +323,7 @@ static void FinishThingdef()
}
for (int k = 0; k < tcall->NumStates; ++k)
{
tcall->ActorInfo->OwnedStates[tcall->FirstState + k].SetAction(func);
tcall->ActorClass->OwnedStates[tcall->FirstState + k].SetAction(func);
}
}
fclose(dump);
@ -375,7 +361,7 @@ static void FinishThingdef()
{
char fmt[20];
mysnprintf(fmt, countof(fmt), "QuestItem%d", i+1);
QuestItemClasses[i] = PClass::FindClass(fmt);
QuestItemClasses[i] = PClass::FindActor(fmt);
}
}

View file

@ -25,7 +25,7 @@ struct FFlagDef
};
FFlagDef *FindFlag (const PClass *type, const char *part1, const char *part2);
void HandleDeprecatedFlags(AActor *defaults, FActorInfo *info, bool set, int index);
void HandleDeprecatedFlags(AActor *defaults, PClassActor *info, bool set, int index);
const char *GetFlagName(int flagnum, int flagoffset);
#define FLAG_NAME(flagnum, flagvar) GetFlagName(flagnum, myoffsetof(AActor, flagvar))
@ -74,9 +74,9 @@ class FStateDefinitions
FStateDefine *FindStateAddress(const char *name);
FState *FindState(const char *name);
FState *ResolveGotoLabel (AActor *actor, const PClass *mytype, char *name);
static void FixStatePointers (FActorInfo *actor, TArray<FStateDefine> & list);
void ResolveGotoLabels (FActorInfo *actor, AActor *defaults, TArray<FStateDefine> & list);
FState *ResolveGotoLabel(AActor *actor, PClassActor *mytype, char *name);
static void FixStatePointers(PClassActor *actor, TArray<FStateDefine> & list);
void ResolveGotoLabels(PClassActor *actor, AActor *defaults, TArray<FStateDefine> & list);
public:
@ -88,10 +88,10 @@ public:
void SetStateLabel(const char *statename, FState *state, BYTE defflags = SDF_STATE);
void AddStateLabel(const char *statename);
void InstallStates(FActorInfo *info, AActor *defaults);
int FinishStates (FActorInfo *actor, AActor *defaults);
void InstallStates(PClassActor *info, AActor *defaults);
int FinishStates(PClassActor *actor, AActor *defaults);
void MakeStateDefines(const PClass *cls);
void MakeStateDefines(const PClassActor *cls);
void AddStateDefines(const FStateLabels *list);
void RetargetStates (intptr_t count, const char *target);
@ -111,9 +111,9 @@ public:
struct FStateTempCall
{
FStateTempCall() : ActorInfo(NULL), Function(NULL), FirstState(0), NumStates(0) {}
FStateTempCall() : ActorClass(NULL), Function(NULL), FirstState(0), NumStates(0) {}
FActorInfo *ActorInfo;
PClassActor *ActorClass;
VMFunction *Function;
TArray<FxExpression *> Parameters;
int FirstState;
@ -124,7 +124,7 @@ extern TDeletingArray<FStateTempCall *> StateTempCalls;
struct FStateExpression
{
FxExpression *expr;
const PClass *owner;
PClassActor *owner;
bool constant;
bool cloned;
};
@ -135,8 +135,8 @@ class FStateExpressions
public:
~FStateExpressions();
int Add(FxExpression *x, const PClass *o, bool c);
int Reserve(int num, const PClass *cls);
int Add(FxExpression *x, PClassActor *o, bool c);
int Reserve(int num, PClassActor *cls);
void Set(int num, FxExpression *x, bool cloned = false);
void Copy(int dest, int src, int cnt);
int ResolveAll();
@ -159,7 +159,7 @@ struct Baggage
#ifdef _DEBUG
FString ClassName; // This is here so that during debugging the class name can be seen
#endif
FActorInfo *Info;
PClassActor *Info;
bool DropItemSet;
bool StateSet;
int CurrentState;
@ -171,7 +171,7 @@ struct Baggage
FScriptPosition ScriptPosition;
};
inline void ResetBaggage (Baggage *bag, const PClass *stateclass)
inline void ResetBaggage (Baggage *bag, PClassActor *stateclass)
{
bag->DropItemList = NULL;
bag->DropItemSet = false;
@ -196,7 +196,7 @@ struct AFuncDesc
AFuncDesc *FindFunction(const char * string);
void ParseStates(FScanner &sc, FActorInfo *actor, AActor *defaults, Baggage &bag);
void ParseStates(FScanner &sc, PClassActor *actor, AActor *defaults, Baggage &bag);
PSymbolActionFunction *FindGlobalActionFunction(const char *name);
@ -206,12 +206,12 @@ PSymbolActionFunction *FindGlobalActionFunction(const char *name);
//
//==========================================================================
FActorInfo *CreateNewActor(const FScriptPosition &sc, FName typeName, FName parentName, bool native);
void SetReplacement(FActorInfo *info, FName replaceName);
PClassActor *CreateNewActor(const FScriptPosition &sc, FName typeName, FName parentName, bool native);
void SetReplacement(PClassActor *info, FName replaceName);
void HandleActorFlag(FScanner &sc, Baggage &bag, const char *part1, const char *part2, int mod);
void FinishActor(const FScriptPosition &sc, FActorInfo *info, Baggage &bag);
FxExpression *ParseParameter(FScanner &sc, PClass *cls, char type, bool constant);
void FinishActor(const FScriptPosition &sc, PClassActor *info, Baggage &bag);
FxExpression *ParseParameter(FScanner &sc, PClassActor *cls, char type, bool constant);
enum
@ -282,7 +282,7 @@ union FPropParam
const char *s;
};
typedef void (*PropHandler)(AActor *defaults, FActorInfo *info, Baggage &bag, FPropParam *params);
typedef void (*PropHandler)(AActor *defaults, PClassActor *info, Baggage &bag, FPropParam *params);
enum ECategory
{
@ -313,18 +313,18 @@ int MatchString (const char *in, const char **strings);
#define DEFINE_PROPERTY_BASE(name, paramlist, clas, cat) \
static void Handler_##name##_##paramlist##_##clas(A##clas *defaults, FActorInfo *info, Baggage &bag, FPropParam *params); \
static void Handler_##name##_##paramlist##_##clas(A##clas *defaults, PClassActor *info, Baggage &bag, FPropParam *params); \
static FPropertyInfo Prop_##name##_##paramlist##_##clas = \
{ #name, #paramlist, &RUNTIME_CLASS(A##clas), (PropHandler)Handler_##name##_##paramlist##_##clas, cat }; \
{ #name, #paramlist, &RUNTIME_CLASS_CASTLESS(A##clas), (PropHandler)Handler_##name##_##paramlist##_##clas, cat }; \
MSVC_PSEG FPropertyInfo *infoptr_##name##_##paramlist##_##clas GCC_PSEG = &Prop_##name##_##paramlist##_##clas; \
static void Handler_##name##_##paramlist##_##clas(A##clas *defaults, FActorInfo *info, Baggage &bag, FPropParam *params)
static void Handler_##name##_##paramlist##_##clas(A##clas *defaults, PClassActor *info, Baggage &bag, FPropParam *params)
#define DEFINE_PREFIXED_PROPERTY_BASE(prefix, name, paramlist, clas, cat) \
static void Handler_##name##_##paramlist##_##clas(A##clas *defaults, FActorInfo *info, Baggage &bag, FPropParam *params); \
static void Handler_##name##_##paramlist##_##clas(A##clas *defaults, PClassActor *info, Baggage &bag, FPropParam *params); \
static FPropertyInfo Prop_##name##_##paramlist##_##clas = \
{ #prefix"."#name, #paramlist, &RUNTIME_CLASS(A##clas), (PropHandler)Handler_##name##_##paramlist##_##clas, cat }; \
{ #prefix"."#name, #paramlist, &RUNTIME_CLASS_CASTLESS(A##clas), (PropHandler)Handler_##name##_##paramlist##_##clas, cat }; \
MSVC_PSEG FPropertyInfo *infoptr_##name##_##paramlist##_##clas GCC_PSEG = &Prop_##name##_##paramlist##_##clas; \
static void Handler_##name##_##paramlist##_##clas(A##clas *defaults, FActorInfo *info, Baggage &bag, FPropParam *params)
static void Handler_##name##_##paramlist##_##clas(A##clas *defaults, PClassActor *info, Baggage &bag, FPropParam *params)
#define DEFINE_PROPERTY(name, paramlist, clas) DEFINE_PROPERTY_BASE(name, paramlist, clas, CAT_PROPERTY)
@ -352,11 +352,11 @@ int MatchString (const char *in, const char **strings);
#define DEFINE_MEMBER_VARIABLE(name, cls) \
static FVariableInfo GlobalDef__##name = { #name, myoffsetof(cls, name), &RUNTIME_CLASS(cls) }; \
static FVariableInfo GlobalDef__##name = { #name, myoffsetof(cls, name), &RUNTIME_CLASS_CASTLESS(cls) }; \
MSVC_MSEG FVariableInfo *infoptr_GlobalDef__##name GCC_MSEG = &GlobalDef__##name;
#define DEFINE_MEMBER_VARIABLE_ALIAS(name, alias, cls) \
static FVariableInfo GlobalDef__##name = { #name, myoffsetof(cls, alias), &RUNTIME_CLASS(cls) }; \
static FVariableInfo GlobalDef__##name = { #name, myoffsetof(cls, alias), &RUNTIME_CLASS_CASTLESS(cls) }; \
MSVC_MSEG FVariableInfo *infoptr_GlobalDef__##name GCC_MSEG = &GlobalDef__##name;

View file

@ -854,7 +854,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomBulletAttack)
PARAM_ANGLE (spread_z);
PARAM_INT (numbullets);
PARAM_INT (damageperbullet);
PARAM_CLASS_OPT (pufftype, AActor) { pufftype = PClass::FindClass(NAME_BulletPuff); }
PARAM_CLASS_OPT (pufftype, AActor) { pufftype = PClass::FindActor(NAME_BulletPuff); }
PARAM_FIXED_OPT (range) { range = MISSILERANGE; }
PARAM_BOOL_OPT (aimfacing) { aimfacing = false; }
@ -1037,7 +1037,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FireBullets)
bangle = self->angle;
if (pufftype == NULL)
pufftype = PClass::FindClass(NAME_BulletPuff);
pufftype = PClass::FindActor(NAME_BulletPuff);
S_Sound(self, CHAN_WEAPON, weapon->AttackSound, 1, ATTN_NORM);
@ -1171,7 +1171,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomPunch)
}
if (pufftype == NULL)
pufftype = PClass::FindClass(NAME_BulletPuff);
pufftype = PClass::FindActor(NAME_BulletPuff);
P_LineAttack (self, angle, range, pitch, damage, NAME_None, pufftype, true);
@ -1207,7 +1207,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RailAttack)
PARAM_COLOR_OPT (color2) { color2 = 0; }
PARAM_INT_OPT (flags) { flags = 0; }
PARAM_FLOAT_OPT (maxdiff) { maxdiff = 0; }
PARAM_CLASS_OPT (pufftype, AActor) { pufftype = PClass::FindClass(NAME_BulletPuff); }
PARAM_CLASS_OPT (pufftype, AActor) { pufftype = PClass::FindActor(NAME_BulletPuff); }
if (!self->player)
return 0;
@ -1247,7 +1247,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
PARAM_INT_OPT (flags) { flags = 0; }
PARAM_INT_OPT (aim) { aim = CRF_DONTAIM; }
PARAM_FLOAT_OPT (maxdiff) { maxdiff = 0; }
PARAM_CLASS_OPT (pufftype, AActor) { pufftype = PClass::FindClass(NAME_BulletPuff); }
PARAM_CLASS_OPT (pufftype, AActor) { pufftype = PClass::FindActor(NAME_BulletPuff); }
AActor *linetarget;
@ -1548,7 +1548,7 @@ static bool InitSpawnedItem(AActor *self, AActor *mo, int flags)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItem)
{
PARAM_ACTION_PROLOGUE;
PARAM_CLASS_OPT (missile, AActor) { missile = PClass::FindClass("Unknown"); }
PARAM_CLASS_OPT (missile, AActor) { missile = PClass::FindActor("Unknown"); }
PARAM_FIXED_OPT (distance) { distance = 0; }
PARAM_FIXED_OPT (zheight) { zheight = 0; }
PARAM_BOOL_OPT (useammo) { useammo = true; }
@ -1985,9 +1985,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnDebris)
{
mo->Translation = self->Translation;
}
if (mo && i < mo->GetClass()->ActorInfo->NumOwnedStates)
if (mo && i < mo->GetClass()->NumOwnedStates)
{
mo->SetState (mo->GetClass()->ActorInfo->OwnedStates + i);
mo->SetState (mo->GetClass()->OwnedStates + i);
mo->velz = FixedMul(mult_v, ((pr_spawndebris()&7)+5)*FRACUNIT);
mo->velx = FixedMul(mult_h, pr_spawndebris.Random2()<<(FRACBITS-6));
mo->vely = FixedMul(mult_h, pr_spawndebris.Random2()<<(FRACBITS-6));
@ -2740,7 +2740,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeFlag)
const char *dot = strchr(flagname, '.');
FFlagDef *fd;
const PClass *cls = self->GetClass();
PClassActor *cls = self->GetClass();
if (dot != NULL)
{
@ -2762,7 +2762,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_ChangeFlag)
if (fd->structoffset == -1)
{
HandleDeprecatedFlags(self, cls->ActorInfo, value, fd->flagbit);
HandleDeprecatedFlags(self, cls, value, fd->flagbit);
}
else
{

View file

@ -320,10 +320,10 @@ static FFlagDef PlayerPawnFlags[] =
static const struct FFlagList { const PClass * const *Type; FFlagDef *Defs; int NumDefs; } FlagLists[] =
{
{ &RUNTIME_CLASS(AActor), ActorFlags, countof(ActorFlags) },
{ &RUNTIME_CLASS(AInventory), InventoryFlags, countof(InventoryFlags) },
{ &RUNTIME_CLASS(AWeapon), WeaponFlags, countof(WeaponFlags) },
{ &RUNTIME_CLASS(APlayerPawn), PlayerPawnFlags,countof(PlayerPawnFlags) },
{ &RUNTIME_CLASS_CASTLESS(AActor), ActorFlags, countof(ActorFlags) },
{ &RUNTIME_CLASS_CASTLESS(AInventory), InventoryFlags, countof(InventoryFlags) },
{ &RUNTIME_CLASS_CASTLESS(AWeapon), WeaponFlags, countof(WeaponFlags) },
{ &RUNTIME_CLASS_CASTLESS(APlayerPawn), PlayerPawnFlags,countof(PlayerPawnFlags) },
};
#define NUM_FLAG_LISTS (countof(FlagLists))

View file

@ -57,22 +57,22 @@ FRandom pr_exrandom ("EX_Random");
// [GRB] Parses an expression and stores it into Expression array
//
static FxExpression *ParseExpressionM (FScanner &sc, const PClass *cls);
static FxExpression *ParseExpressionL (FScanner &sc, const PClass *cls);
static FxExpression *ParseExpressionK (FScanner &sc, const PClass *cls);
static FxExpression *ParseExpressionJ (FScanner &sc, const PClass *cls);
static FxExpression *ParseExpressionI (FScanner &sc, const PClass *cls);
static FxExpression *ParseExpressionH (FScanner &sc, const PClass *cls);
static FxExpression *ParseExpressionG (FScanner &sc, const PClass *cls);
static FxExpression *ParseExpressionF (FScanner &sc, const PClass *cls);
static FxExpression *ParseExpressionE (FScanner &sc, const PClass *cls);
static FxExpression *ParseExpressionD (FScanner &sc, const PClass *cls);
static FxExpression *ParseExpressionC (FScanner &sc, const PClass *cls);
static FxExpression *ParseExpressionB (FScanner &sc, const PClass *cls);
static FxExpression *ParseExpressionA (FScanner &sc, const PClass *cls);
static FxExpression *ParseExpression0 (FScanner &sc, const PClass *cls);
static FxExpression *ParseExpressionM (FScanner &sc, PClassActor *cls);
static FxExpression *ParseExpressionL (FScanner &sc, PClassActor *cls);
static FxExpression *ParseExpressionK (FScanner &sc, PClassActor *cls);
static FxExpression *ParseExpressionJ (FScanner &sc, PClassActor *cls);
static FxExpression *ParseExpressionI (FScanner &sc, PClassActor *cls);
static FxExpression *ParseExpressionH (FScanner &sc, PClassActor *cls);
static FxExpression *ParseExpressionG (FScanner &sc, PClassActor *cls);
static FxExpression *ParseExpressionF (FScanner &sc, PClassActor *cls);
static FxExpression *ParseExpressionE (FScanner &sc, PClassActor *cls);
static FxExpression *ParseExpressionD (FScanner &sc, PClassActor *cls);
static FxExpression *ParseExpressionC (FScanner &sc, PClassActor *cls);
static FxExpression *ParseExpressionB (FScanner &sc, PClassActor *cls);
static FxExpression *ParseExpressionA (FScanner &sc, PClassActor *cls);
static FxExpression *ParseExpression0 (FScanner &sc, PClassActor *cls);
FxExpression *ParseExpression (FScanner &sc, PClass *cls)
FxExpression *ParseExpression (FScanner &sc, PClassActor *cls)
{
FxExpression *data = ParseExpressionM (sc, cls);
@ -84,7 +84,7 @@ FxExpression *ParseExpression (FScanner &sc, PClass *cls)
return data;
}
static FxExpression *ParseExpressionM (FScanner &sc, const PClass *cls)
static FxExpression *ParseExpressionM (FScanner &sc, PClassActor *cls)
{
FxExpression *condition = ParseExpressionL (sc, cls);
@ -101,7 +101,7 @@ static FxExpression *ParseExpressionM (FScanner &sc, const PClass *cls)
}
}
static FxExpression *ParseExpressionL (FScanner &sc, const PClass *cls)
static FxExpression *ParseExpressionL (FScanner &sc, PClassActor *cls)
{
FxExpression *tmp = ParseExpressionK (sc, cls);
@ -113,7 +113,7 @@ static FxExpression *ParseExpressionL (FScanner &sc, const PClass *cls)
return tmp;
}
static FxExpression *ParseExpressionK (FScanner &sc, const PClass *cls)
static FxExpression *ParseExpressionK (FScanner &sc, PClassActor *cls)
{
FxExpression *tmp = ParseExpressionJ (sc, cls);
@ -125,7 +125,7 @@ static FxExpression *ParseExpressionK (FScanner &sc, const PClass *cls)
return tmp;
}
static FxExpression *ParseExpressionJ (FScanner &sc, const PClass *cls)
static FxExpression *ParseExpressionJ (FScanner &sc, PClassActor *cls)
{
FxExpression *tmp = ParseExpressionI (sc, cls);
@ -137,7 +137,7 @@ static FxExpression *ParseExpressionJ (FScanner &sc, const PClass *cls)
return tmp;
}
static FxExpression *ParseExpressionI (FScanner &sc, const PClass *cls)
static FxExpression *ParseExpressionI (FScanner &sc, PClassActor *cls)
{
FxExpression *tmp = ParseExpressionH (sc, cls);
@ -149,7 +149,7 @@ static FxExpression *ParseExpressionI (FScanner &sc, const PClass *cls)
return tmp;
}
static FxExpression *ParseExpressionH (FScanner &sc, const PClass *cls)
static FxExpression *ParseExpressionH (FScanner &sc, PClassActor *cls)
{
FxExpression *tmp = ParseExpressionG (sc, cls);
@ -161,7 +161,7 @@ static FxExpression *ParseExpressionH (FScanner &sc, const PClass *cls)
return tmp;
}
static FxExpression *ParseExpressionG (FScanner &sc, const PClass *cls)
static FxExpression *ParseExpressionG (FScanner &sc, PClassActor *cls)
{
FxExpression *tmp = ParseExpressionF (sc, cls);
@ -175,7 +175,7 @@ static FxExpression *ParseExpressionG (FScanner &sc, const PClass *cls)
return tmp;
}
static FxExpression *ParseExpressionF (FScanner &sc, const PClass *cls)
static FxExpression *ParseExpressionF (FScanner &sc, PClassActor *cls)
{
FxExpression *tmp = ParseExpressionE (sc, cls);
@ -189,7 +189,7 @@ static FxExpression *ParseExpressionF (FScanner &sc, const PClass *cls)
return tmp;
}
static FxExpression *ParseExpressionE (FScanner &sc, const PClass *cls)
static FxExpression *ParseExpressionE (FScanner &sc, PClassActor *cls)
{
FxExpression *tmp = ParseExpressionD (sc, cls);
@ -203,7 +203,7 @@ static FxExpression *ParseExpressionE (FScanner &sc, const PClass *cls)
return tmp;
}
static FxExpression *ParseExpressionD (FScanner &sc, const PClass *cls)
static FxExpression *ParseExpressionD (FScanner &sc, PClassActor *cls)
{
FxExpression *tmp = ParseExpressionC (sc, cls);
@ -217,7 +217,7 @@ static FxExpression *ParseExpressionD (FScanner &sc, const PClass *cls)
return tmp;
}
static FxExpression *ParseExpressionC (FScanner &sc, const PClass *cls)
static FxExpression *ParseExpressionC (FScanner &sc, PClassActor *cls)
{
FxExpression *tmp = ParseExpressionB (sc, cls);
@ -231,7 +231,7 @@ static FxExpression *ParseExpressionC (FScanner &sc, const PClass *cls)
return tmp;
}
static FxExpression *ParseExpressionB (FScanner &sc, const PClass *cls)
static FxExpression *ParseExpressionB (FScanner &sc, PClassActor *cls)
{
sc.GetToken();
switch(sc.TokenType)
@ -260,7 +260,7 @@ static FxExpression *ParseExpressionB (FScanner &sc, const PClass *cls)
//
//==========================================================================
static FxExpression *ParseExpressionA (FScanner &sc, const PClass *cls)
static FxExpression *ParseExpressionA (FScanner &sc, PClassActor *cls)
{
FxExpression *base_expr = ParseExpression0 (sc, cls);
@ -311,7 +311,7 @@ static FxExpression *ParseExpressionA (FScanner &sc, const PClass *cls)
static FxExpression *ParseExpression0 (FScanner &sc, const PClass *cls)
static FxExpression *ParseExpression0 (FScanner &sc, PClassActor *cls)
{
FScriptPosition scpos(sc);
if (sc.CheckToken('('))

View file

@ -60,11 +60,11 @@ extern PSymbolTable GlobalSymbols;
struct FCompileContext
{
const PClass *cls;
PClassActor *cls;
bool lax;
bool isconst;
FCompileContext(const PClass *_cls = NULL, bool _lax = false, bool _isconst = false)
FCompileContext(PClassActor *_cls = NULL, bool _lax = false, bool _isconst = false)
{
cls = _cls;
lax = _lax;
@ -894,7 +894,7 @@ public:
class FxMultiNameState : public FxExpression
{
const PClass *scope;
PClassActor *scope;
TArray<FName> names;
public:
@ -906,7 +906,7 @@ public:
FxExpression *ParseExpression (FScanner &sc, PClass *cls);
FxExpression *ParseExpression (FScanner &sc, PClassActor *cls);
#endif

View file

@ -3782,19 +3782,19 @@ ExpEmit FxClassTypeCast::Emit(VMFunctionBuilder *build)
FxExpression *FxStateByIndex::Resolve(FCompileContext &ctx)
{
CHECKRESOLVED();
if (ctx.cls->ActorInfo == NULL || ctx.cls->ActorInfo->NumOwnedStates == 0)
if (ctx.cls->NumOwnedStates == 0)
{
// This can't really happen
assert(false);
}
if (ctx.cls->ActorInfo->NumOwnedStates <= index)
if (ctx.cls->NumOwnedStates <= index)
{
ScriptPosition.Message(MSG_ERROR, "%s: Attempt to jump to non existing state index %d",
ctx.cls->TypeName.GetChars(), index);
delete this;
return NULL;
}
FxExpression *x = new FxConstant(ctx.cls->ActorInfo->OwnedStates + index, ScriptPosition);
FxExpression *x = new FxConstant(ctx.cls->OwnedStates + index, ScriptPosition);
delete this;
return x;
}
@ -3842,11 +3842,11 @@ FxExpression *FxMultiNameState::Resolve(FCompileContext &ctx)
}
else if (names[0] == NAME_Super)
{
scope = ctx.cls->ParentClass;
scope = dyn_cast<PClassActor>(ctx.cls->ParentClass);
}
else
{
scope = PClass::FindClass(names[0]);
scope = PClass::FindActor(names[0]);
if (scope == NULL)
{
ScriptPosition.Message(MSG_ERROR, "Unknown class '%s' in state label", names[0].GetChars());
@ -3866,13 +3866,7 @@ FxExpression *FxMultiNameState::Resolve(FCompileContext &ctx)
// If the label is class specific we can resolve it right here
if (names[1] != NAME_None)
{
if (scope->ActorInfo == NULL)
{
ScriptPosition.Message(MSG_ERROR, "'%s' has no actorinfo", names[0].GetChars());
delete this;
return NULL;
}
destination = scope->ActorInfo->FindState(names.Size()-1, &names[1], false);
destination = scope->FindState(names.Size()-1, &names[1], false);
if (destination == NULL)
{
ScriptPosition.Message(ctx.lax? MSG_WARNING:MSG_ERROR, "Unknown state jump destination");
@ -3904,7 +3898,7 @@ ExpVal FxMultiNameState::EvalExpression (AActor *self)
{
ExpVal ret;
ret.Type = VAL_State;
ret.pointer = self->GetClass()->ActorInfo->FindState(names.Size(), &names[0]);
ret.pointer = self->GetClass()->FindState(names.Size(), &names[0]);
if (ret.pointer == NULL)
{
const char *dot="";
@ -3932,7 +3926,7 @@ int DecoFindMultiNameState(VMFrameStack *stack, VMValue *param, int numparam, VM
names[i - 1] = zaname;
}
PARAM_OBJECT_AT(0, self, AActor);
FState *state = self->GetClass()->ActorInfo->FindState(numparam - 1, names);
FState *state = self->GetClass()->FindState(numparam - 1, names);
if (state == NULL)
{
const char *dot = "";
@ -4011,7 +4005,7 @@ FStateExpressions::~FStateExpressions()
//
//==========================================================================
int FStateExpressions::Add(FxExpression *x, const PClass *o, bool c)
int FStateExpressions::Add(FxExpression *x, PClassActor *o, bool c)
{
int idx = expressions.Reserve(1);
FStateExpression &exp = expressions[idx];
@ -4028,7 +4022,7 @@ int FStateExpressions::Add(FxExpression *x, const PClass *o, bool c)
//
//==========================================================================
int FStateExpressions::Reserve(int num, const PClass *cls)
int FStateExpressions::Reserve(int num, PClassActor *cls)
{
int idx = expressions.Reserve(num);
FStateExpression *exp = &expressions[idx];

View file

@ -64,7 +64,7 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def);
//
//==========================================================================
FxExpression *ParseParameter(FScanner &sc, PClass *cls, char type, bool constant)
FxExpression *ParseParameter(FScanner &sc, PClassActor *cls, char type, bool constant)
{
FxExpression *x = NULL;
int v;
@ -193,7 +193,7 @@ FxExpression *ParseParameter(FScanner &sc, PClass *cls, char type, bool constant
//
//==========================================================================
static void ParseConstant (FScanner &sc, PSymbolTable * symt, PClass *cls)
static void ParseConstant (FScanner &sc, PSymbolTable * symt, PClassActor *cls)
{
// Read the type and make sure it's int or float.
if (sc.CheckToken(TK_Int) || sc.CheckToken(TK_Float))
@ -241,7 +241,7 @@ static void ParseConstant (FScanner &sc, PSymbolTable * symt, PClass *cls)
//
//==========================================================================
static void ParseEnum (FScanner &sc, PSymbolTable *symt, PClass *cls)
static void ParseEnum (FScanner &sc, PSymbolTable *symt, PClassActor *cls)
{
int currvalue = 0;
@ -282,7 +282,7 @@ static void ParseEnum (FScanner &sc, PSymbolTable *symt, PClass *cls)
//
//==========================================================================
static void ParseNativeVariable (FScanner &sc, PSymbolTable * symt, PClass *cls)
static void ParseNativeVariable (FScanner &sc, PSymbolTable *symt, PClassActor *cls)
{
FExpressionType valuetype;
@ -367,7 +367,7 @@ static void ParseNativeVariable (FScanner &sc, PSymbolTable * symt, PClass *cls)
//
//==========================================================================
static void ParseUserVariable (FScanner &sc, PSymbolTable *symt, PClass *cls)
static void ParseUserVariable (FScanner &sc, PSymbolTable *symt, PClassActor *cls)
{
FExpressionType valuetype;
@ -453,9 +453,9 @@ void HandleActorFlag(FScanner &sc, Baggage &bag, const char *part1, const char *
{
FFlagDef *fd;
if ( (fd = FindFlag (bag.Info->Class, part1, part2)) )
if ( (fd = FindFlag (bag.Info, part1, part2)) )
{
AActor *defaults = (AActor*)bag.Info->Class->Defaults;
AActor *defaults = (AActor*)bag.Info->Defaults;
if (fd->structoffset == -1) // this is a deprecated flag that has been changed into a real property
{
HandleDeprecatedFlags(defaults, bag.Info, mod=='+', fd->flagbit);
@ -592,7 +592,7 @@ static FState *CheckState(FScanner &sc, PClass *type)
FState *state = NULL;
sc.MustGetString();
FActorInfo * info = type->ParentClass->ActorInfo;
PClassActor *info = dyn_cast<PClassActor>(type->ParentClass);
if (info != NULL)
{
@ -612,8 +612,10 @@ static FState *CheckState(FScanner &sc, PClass *type)
}
}
if (state == NULL && v==0) return NULL;
if (state == NULL && v==0)
{
return NULL;
}
if (v != 0 && state==NULL)
{
sc.ScriptMessage("Attempt to get invalid state from actor %s\n", type->ParentClass->TypeName.GetChars());
@ -667,8 +669,8 @@ static bool ParsePropertyParams(FScanner &sc, FPropertyInfo *prop, AActor *defau
if (sc.CheckString ("("))
{
FxExpression *x = ParseExpression(sc, bag.Info->Class);
conv.i = 0x40000000 | StateParams.Add(x, bag.Info->Class, false);
FxExpression *x = ParseExpression(sc, bag.Info);
conv.i = 0x40000000 | StateParams.Add(x, bag.Info, false);
params.Push(conv);
sc.MustGetStringName(")");
break;
@ -849,9 +851,9 @@ static void ParseActorProperty(FScanner &sc, Baggage &bag)
if (prop != NULL)
{
if (bag.Info->Class->IsDescendantOf(*prop->cls))
if (bag.Info->IsDescendantOf(*prop->cls))
{
ParsePropertyParams(sc, prop, (AActor *)bag.Info->Class->Defaults, bag);
ParsePropertyParams(sc, prop, (AActor *)bag.Info->Defaults, bag);
}
else
{
@ -861,7 +863,7 @@ static void ParseActorProperty(FScanner &sc, Baggage &bag)
}
else if (MatchString(propname, statenames) != -1)
{
bag.statedef.SetStateLabel(propname, CheckState (sc, bag.Info->Class));
bag.statedef.SetStateLabel(propname, CheckState (sc, bag.Info));
}
else
{
@ -879,7 +881,7 @@ static void ParseActorProperty(FScanner &sc, Baggage &bag)
//
//==========================================================================
static void ParseActionDef (FScanner &sc, PClass *cls)
static void ParseActionDef (FScanner &sc, PClassActor *cls)
{
enum
{
@ -1034,7 +1036,7 @@ static void ParseActionDef (FScanner &sc, PClass *cls)
// Starts a new actor definition
//
//==========================================================================
static FActorInfo *ParseActorHeader(FScanner &sc, Baggage *bag)
static PClassActor *ParseActorHeader(FScanner &sc, Baggage *bag)
{
FName typeName;
FName parentName;
@ -1115,11 +1117,11 @@ static FActorInfo *ParseActorHeader(FScanner &sc, Baggage *bag)
try
{
FActorInfo *info = CreateNewActor(sc, typeName, parentName, native);
PClassActor *info = CreateNewActor(sc, typeName, parentName, native);
info->DoomEdNum = DoomEdNum > 0 ? DoomEdNum : -1;
SetReplacement(info, replaceName);
ResetBaggage (bag, info->Class->ParentClass);
ResetBaggage (bag, info == RUNTIME_CLASS(AActor) ? NULL : static_cast<PClassActor *>(info->ParentClass));
bag->Info = info;
bag->Lumpnum = sc.LumpNum;
#ifdef _DEBUG
@ -1141,7 +1143,7 @@ static FActorInfo *ParseActorHeader(FScanner &sc, Baggage *bag)
//==========================================================================
static void ParseActor(FScanner &sc)
{
FActorInfo * info=NULL;
PClassActor *info = NULL;
Baggage bag;
info = ParseActorHeader(sc, &bag);
@ -1151,23 +1153,23 @@ static void ParseActor(FScanner &sc)
switch (sc.TokenType)
{
case TK_Action:
ParseActionDef (sc, info->Class);
ParseActionDef (sc, info);
break;
case TK_Const:
ParseConstant (sc, &info->Class->Symbols, info->Class);
ParseConstant (sc, &info->Symbols, info);
break;
case TK_Enum:
ParseEnum (sc, &info->Class->Symbols, info->Class);
ParseEnum (sc, &info->Symbols, info);
break;
case TK_Native:
ParseNativeVariable (sc, &info->Class->Symbols, info->Class);
ParseNativeVariable (sc, &info->Symbols, info);
break;
case TK_Var:
ParseUserVariable (sc, &info->Class->Symbols, info->Class);
ParseUserVariable (sc, &info->Symbols, info);
break;
case TK_Identifier:
@ -1177,10 +1179,10 @@ static void ParseActor(FScanner &sc)
case TK_States:
if (bag.StateSet)
{
sc.ScriptMessage("'%s' contains multiple state declarations", bag.Info->Class->TypeName.GetChars());
sc.ScriptMessage("'%s' contains multiple state declarations", bag.Info->TypeName.GetChars());
FScriptPosition::ErrorCounter++;
}
ParseStates(sc, bag.Info, (AActor *)bag.Info->Class->Defaults, bag);
ParseStates(sc, bag.Info, (AActor *)bag.Info->Defaults, bag);
bag.StateSet = true;
break;
@ -1190,7 +1192,7 @@ static void ParseActor(FScanner &sc)
break;
default:
sc.ScriptError("Unexpected '%s' in definition of '%s'", sc.String, bag.Info->Class->TypeName.GetChars());
sc.ScriptError("Unexpected '%s' in definition of '%s'", sc.String, bag.Info->TypeName.GetChars());
break;
}
}

View file

@ -74,7 +74,7 @@
// Gets a class pointer and performs an error check for correct type
//
//==========================================================================
static const PClass *FindClassTentative(const char *name, const char *ancestor)
static PClassActor *FindClassTentative(const char *name, const char *ancestor)
{
// "" and "none" mean 'no class'
if (name == NULL || *name == 0 || !stricmp(name, "none"))
@ -82,15 +82,15 @@ static const PClass *FindClassTentative(const char *name, const char *ancestor)
return NULL;
}
const PClass *anc = PClass::FindClass(ancestor);
PClass *anc = PClass::FindClass(ancestor);
assert(anc != NULL); // parent classes used here should always be natively defined
const PClass *cls = const_cast<PClass*>(anc)->FindClassTentative(name);
PClass *cls = anc->FindClassTentative(name);
assert (cls != NULL); // cls can not ne NULL here
if (!cls->IsDescendantOf(anc))
{
I_Error("%s does not inherit from %s\n", name, ancestor);
}
return cls;
return static_cast<PClassActor *>(cls);
}
//===========================================================================
@ -103,7 +103,7 @@ static const PClass *FindClassTentative(const char *name, const char *ancestor)
// properties is not recommended
//
//===========================================================================
void HandleDeprecatedFlags(AActor *defaults, FActorInfo *info, bool set, int index)
void HandleDeprecatedFlags(AActor *defaults, PClassActor *info, bool set, int index)
{
switch (index)
{
@ -255,13 +255,17 @@ DEFINE_INFO_PROPERTY(conversationid, IiI, Actor)
if ((gameinfo.flags & (GI_SHAREWARE|GI_TEASER2)) == (GI_SHAREWARE|GI_TEASER2))
convid = id2;
if (convid==-1) return;
if (convid == -1)
return;
}
if (convid < 0 || convid > 1000)
{
I_Error ("ConversationID must be in the range [0,1000]");
}
else StrifeTypes[convid] = info->Class;
else
{
StrifeTypes[convid] = info;
}
}
//==========================================================================
@ -275,10 +279,10 @@ DEFINE_INFO_PROPERTY(conversationid, IiI, Actor)
//==========================================================================
DEFINE_PROPERTY(skip_super, 0, Actor)
{
if (info->Class->IsDescendantOf(RUNTIME_CLASS(AInventory)))
if (info->IsDescendantOf(RUNTIME_CLASS(AInventory)))
{
bag.ScriptPosition.Message(MSG_WARNING,
"'skip_super' in definition of inventory item '%s' ignored.", info->Class->TypeName.GetChars() );
"'skip_super' in definition of inventory item '%s' ignored.", info->TypeName.GetChars() );
return;
}
if (bag.StateSet)
@ -320,7 +324,7 @@ DEFINE_PROPERTY(health, I, Actor)
DEFINE_PROPERTY(gibhealth, I, Actor)
{
PROP_INT_PARM(id, 0);
info->Class->Meta.SetMetaInt (AMETA_GibHealth, id);
info->Meta.SetMetaInt (AMETA_GibHealth, id);
}
//==========================================================================
@ -329,7 +333,7 @@ DEFINE_PROPERTY(gibhealth, I, Actor)
DEFINE_PROPERTY(woundhealth, I, Actor)
{
PROP_INT_PARM(id, 0);
info->Class->Meta.SetMetaInt (AMETA_WoundHealth, id);
info->Meta.SetMetaInt (AMETA_WoundHealth, id);
}
//==========================================================================
@ -552,7 +556,7 @@ DEFINE_PROPERTY(activesound, S, Actor)
DEFINE_PROPERTY(howlsound, S, Actor)
{
PROP_STRING_PARM(str, 0);
info->Class->Meta.SetMetaInt (AMETA_HowlSound, S_FindSound(str));
info->Meta.SetMetaInt (AMETA_HowlSound, S_FindSound(str));
}
//==========================================================================
@ -633,7 +637,7 @@ DEFINE_PROPERTY(alpha, F, Actor)
DEFINE_PROPERTY(obituary, S, Actor)
{
PROP_STRING_PARM(str, 0);
info->Class->Meta.SetMetaString (AMETA_Obituary, str);
info->Meta.SetMetaString (AMETA_Obituary, str);
}
//==========================================================================
@ -642,7 +646,7 @@ DEFINE_PROPERTY(obituary, S, Actor)
DEFINE_PROPERTY(hitobituary, S, Actor)
{
PROP_STRING_PARM(str, 0);
info->Class->Meta.SetMetaString (AMETA_HitObituary, str);
info->Meta.SetMetaString (AMETA_HitObituary, str);
}
//==========================================================================
@ -650,7 +654,7 @@ DEFINE_PROPERTY(hitobituary, S, Actor)
//==========================================================================
DEFINE_PROPERTY(donthurtshooter, 0, Actor)
{
info->Class->Meta.SetMetaInt (ACMETA_DontHurtShooter, true);
info->Meta.SetMetaInt (ACMETA_DontHurtShooter, true);
}
//==========================================================================
@ -659,7 +663,7 @@ DEFINE_PROPERTY(donthurtshooter, 0, Actor)
DEFINE_PROPERTY(explosionradius, I, Actor)
{
PROP_INT_PARM(id, 0);
info->Class->Meta.SetMetaInt (ACMETA_ExplosionRadius, id);
info->Meta.SetMetaInt (ACMETA_ExplosionRadius, id);
}
//==========================================================================
@ -668,7 +672,7 @@ DEFINE_PROPERTY(explosionradius, I, Actor)
DEFINE_PROPERTY(explosiondamage, I, Actor)
{
PROP_INT_PARM(id, 0);
info->Class->Meta.SetMetaInt (ACMETA_ExplosionDamage, id);
info->Meta.SetMetaInt (ACMETA_ExplosionDamage, id);
}
//==========================================================================
@ -679,7 +683,7 @@ DEFINE_PROPERTY(deathheight, F, Actor)
PROP_FIXED_PARM(h, 0);
// AActor::Die() uses a height of 0 to mean "cut the height to 1/4",
// so if a height of 0 is desired, store it as -1.
info->Class->Meta.SetMetaFixed (AMETA_DeathHeight, h <= 0 ? -1 : h);
info->Meta.SetMetaFixed (AMETA_DeathHeight, h <= 0 ? -1 : h);
}
//==========================================================================
@ -689,7 +693,7 @@ DEFINE_PROPERTY(burnheight, F, Actor)
{
PROP_FIXED_PARM(h, 0);
// The note above for AMETA_DeathHeight also applies here.
info->Class->Meta.SetMetaFixed (AMETA_BurnHeight, h <= 0 ? -1 : h);
info->Meta.SetMetaFixed (AMETA_BurnHeight, h <= 0 ? -1 : h);
}
//==========================================================================
@ -716,7 +720,7 @@ DEFINE_PROPERTY(meleethreshold, F, Actor)
DEFINE_PROPERTY(meleedamage, I, Actor)
{
PROP_INT_PARM(id, 0);
info->Class->Meta.SetMetaInt (ACMETA_MeleeDamage, id);
info->Meta.SetMetaInt (ACMETA_MeleeDamage, id);
}
//==========================================================================
@ -734,7 +738,7 @@ DEFINE_PROPERTY(meleerange, F, Actor)
DEFINE_PROPERTY(meleesound, S, Actor)
{
PROP_STRING_PARM(str, 0);
info->Class->Meta.SetMetaInt (ACMETA_MeleeSound, S_FindSound(str));
info->Meta.SetMetaInt (ACMETA_MeleeSound, S_FindSound(str));
}
//==========================================================================
@ -743,7 +747,7 @@ DEFINE_PROPERTY(meleesound, S, Actor)
DEFINE_PROPERTY(missiletype, S, Actor)
{
PROP_STRING_PARM(str, 0);
info->Class->Meta.SetMetaInt (ACMETA_MissileName, FName(str));
info->Meta.SetMetaInt (ACMETA_MissileName, FName(str));
}
//==========================================================================
@ -752,7 +756,7 @@ DEFINE_PROPERTY(missiletype, S, Actor)
DEFINE_PROPERTY(missileheight, F, Actor)
{
PROP_FIXED_PARM(id, 0);
info->Class->Meta.SetMetaFixed (ACMETA_MissileHeight, id);
info->Meta.SetMetaFixed (ACMETA_MissileHeight, id);
}
//==========================================================================
@ -822,7 +826,7 @@ DEFINE_PROPERTY(bloodcolor, C, Actor)
PalEntry pe = color;
pe.a = CreateBloodTranslation(pe);
info->Class->Meta.SetMetaInt (AMETA_BloodColor, pe);
info->Meta.SetMetaInt (AMETA_BloodColor, pe);
}
@ -837,21 +841,21 @@ DEFINE_PROPERTY(bloodtype, Sss, Actor)
FName blood = str;
// normal blood
info->Class->Meta.SetMetaInt (AMETA_BloodType, blood);
info->Meta.SetMetaInt (AMETA_BloodType, blood);
if (PROP_PARM_COUNT > 1)
{
blood = str1;
}
// blood splatter
info->Class->Meta.SetMetaInt (AMETA_BloodType2, blood);
info->Meta.SetMetaInt (AMETA_BloodType2, blood);
if (PROP_PARM_COUNT > 2)
{
blood = str2;
}
// axe blood
info->Class->Meta.SetMetaInt (AMETA_BloodType3, blood);
info->Meta.SetMetaInt (AMETA_BloodType3, blood);
}
//==========================================================================
@ -996,7 +1000,7 @@ DEFINE_PROPERTY(maxdropoffheight, F, Actor)
DEFINE_PROPERTY(poisondamage, I, Actor)
{
PROP_INT_PARM(i, 0);
info->Class->Meta.SetMetaInt (AMETA_PoisonDamage, i);
info->Meta.SetMetaInt (AMETA_PoisonDamage, i);
}
//==========================================================================
@ -1005,7 +1009,7 @@ DEFINE_PROPERTY(poisondamage, I, Actor)
DEFINE_PROPERTY(fastspeed, F, Actor)
{
PROP_FIXED_PARM(i, 0);
info->Class->Meta.SetMetaFixed (AMETA_FastSpeed, i);
info->Meta.SetMetaFixed (AMETA_FastSpeed, i);
}
//==========================================================================
@ -1014,7 +1018,7 @@ DEFINE_PROPERTY(fastspeed, F, Actor)
DEFINE_PROPERTY(radiusdamagefactor, F, Actor)
{
PROP_FIXED_PARM(i, 0);
info->Class->Meta.SetMetaFixed (AMETA_RDFactor, i);
info->Meta.SetMetaFixed (AMETA_RDFactor, i);
}
//==========================================================================
@ -1023,7 +1027,7 @@ DEFINE_PROPERTY(radiusdamagefactor, F, Actor)
DEFINE_PROPERTY(cameraheight, F, Actor)
{
PROP_FIXED_PARM(i, 0);
info->Class->Meta.SetMetaFixed (AMETA_CameraHeight, i);
info->Meta.SetMetaFixed (AMETA_CameraHeight, i);
}
//==========================================================================
@ -1131,7 +1135,7 @@ DEFINE_CLASS_PROPERTY(backpackmaxamount, I, Ammo)
DEFINE_CLASS_PROPERTY(dropamount, I, Ammo)
{
PROP_INT_PARM(i, 0);
info->Class->Meta.SetMetaInt (AIMETA_DropAmount, i);
info->Meta.SetMetaInt (AIMETA_DropAmount, i);
}
//==========================================================================
@ -1169,11 +1173,11 @@ DEFINE_CLASS_PROPERTY(saveamount, I, Armor)
PROP_INT_PARM(i, 0);
// Special case here because this property has to work for 2 unrelated classes
if (info->Class->IsDescendantOf(RUNTIME_CLASS(ABasicArmorPickup)))
if (info->IsDescendantOf(RUNTIME_CLASS(ABasicArmorPickup)))
{
((ABasicArmorPickup*)defaults)->SaveAmount=i;
}
else if (info->Class->IsDescendantOf(RUNTIME_CLASS(ABasicArmorBonus)))
else if (info->IsDescendantOf(RUNTIME_CLASS(ABasicArmorBonus)))
{
((ABasicArmorBonus*)defaults)->SaveAmount=i;
}
@ -1192,11 +1196,11 @@ DEFINE_CLASS_PROPERTY(savepercent, F, Armor)
i = clamp(i, 0, 100*FRACUNIT)/100;
// Special case here because this property has to work for 2 unrelated classes
if (info->Class->IsDescendantOf(RUNTIME_CLASS(ABasicArmorPickup)))
if (info->IsDescendantOf(RUNTIME_CLASS(ABasicArmorPickup)))
{
((ABasicArmorPickup*)defaults)->SavePercent = i;
}
else if (info->Class->IsDescendantOf(RUNTIME_CLASS(ABasicArmorBonus)))
else if (info->IsDescendantOf(RUNTIME_CLASS(ABasicArmorBonus)))
{
((ABasicArmorBonus*)defaults)->SavePercent = i;
}
@ -1214,11 +1218,11 @@ DEFINE_CLASS_PROPERTY(maxabsorb, I, Armor)
PROP_INT_PARM(i, 0);
// Special case here because this property has to work for 2 unrelated classes
if (info->Class->IsDescendantOf(RUNTIME_CLASS(ABasicArmorPickup)))
if (info->IsDescendantOf(RUNTIME_CLASS(ABasicArmorPickup)))
{
((ABasicArmorPickup*)defaults)->MaxAbsorb = i;
}
else if (info->Class->IsDescendantOf(RUNTIME_CLASS(ABasicArmorBonus)))
else if (info->IsDescendantOf(RUNTIME_CLASS(ABasicArmorBonus)))
{
((ABasicArmorBonus*)defaults)->MaxAbsorb = i;
}
@ -1236,11 +1240,11 @@ DEFINE_CLASS_PROPERTY(maxfullabsorb, I, Armor)
PROP_INT_PARM(i, 0);
// Special case here because this property has to work for 2 unrelated classes
if (info->Class->IsDescendantOf(RUNTIME_CLASS(ABasicArmorPickup)))
if (info->IsDescendantOf(RUNTIME_CLASS(ABasicArmorPickup)))
{
((ABasicArmorPickup*)defaults)->MaxFullAbsorb = i;
}
else if (info->Class->IsDescendantOf(RUNTIME_CLASS(ABasicArmorBonus)))
else if (info->IsDescendantOf(RUNTIME_CLASS(ABasicArmorBonus)))
{
((ABasicArmorBonus*)defaults)->MaxFullAbsorb = i;
}
@ -1275,7 +1279,7 @@ DEFINE_CLASS_PROPERTY(icon, S, Inventory)
!(gameinfo.flags&GI_SHAREWARE) && Wads.GetLumpFile(bag.Lumpnum) != 0)
{
bag.ScriptPosition.Message(MSG_WARNING,
"Icon '%s' for '%s' not found\n", i, info->Class->TypeName.GetChars());
"Icon '%s' for '%s' not found\n", i, info->TypeName.GetChars());
}
}
}
@ -1322,7 +1326,7 @@ DEFINE_CLASS_PROPERTY(pickupflash, S, Inventory)
DEFINE_CLASS_PROPERTY(pickupmessage, T, Inventory)
{
PROP_STRING_PARM(str, 0);
info->Class->Meta.SetMetaString(AIMETA_PickupMessage, str);
info->Meta.SetMetaString(AIMETA_PickupMessage, str);
}
//==========================================================================
@ -1365,7 +1369,7 @@ DEFINE_CLASS_PROPERTY(usesound, S, Inventory)
DEFINE_CLASS_PROPERTY(givequest, I, Inventory)
{
PROP_INT_PARM(i, 0);
info->Class->Meta.SetMetaInt(AIMETA_GiveQuest, i);
info->Meta.SetMetaInt(AIMETA_GiveQuest, i);
}
//==========================================================================
@ -1375,8 +1379,8 @@ DEFINE_CLASS_PROPERTY(lowmessage, IT, Health)
{
PROP_INT_PARM(i, 0);
PROP_STRING_PARM(str, 1);
info->Class->Meta.SetMetaInt(AIMETA_LowHealth, i);
info->Class->Meta.SetMetaString(AIMETA_LowHealthMessage, str);
info->Meta.SetMetaInt(AIMETA_LowHealth, i);
info->Meta.SetMetaString(AIMETA_LowHealthMessage, str);
}
//==========================================================================
@ -1403,7 +1407,7 @@ DEFINE_CLASS_PROPERTY(number, I, PuzzleItem)
DEFINE_CLASS_PROPERTY(failmessage, T, PuzzleItem)
{
PROP_STRING_PARM(str, 0);
info->Class->Meta.SetMetaString(AIMETA_PuzzFailMessage, str);
info->Meta.SetMetaString(AIMETA_PuzzFailMessage, str);
}
//==========================================================================
@ -1558,7 +1562,7 @@ DEFINE_CLASS_PROPERTY(yadjust, F, Weapon)
DEFINE_CLASS_PROPERTY(slotnumber, I, Weapon)
{
PROP_INT_PARM(i, 0);
info->Class->Meta.SetMetaInt(AWMETA_SlotNumber, i);
info->Meta.SetMetaInt(AWMETA_SlotNumber, i);
}
//==========================================================================
@ -1567,7 +1571,7 @@ DEFINE_CLASS_PROPERTY(slotnumber, I, Weapon)
DEFINE_CLASS_PROPERTY(slotpriority, F, Weapon)
{
PROP_FIXED_PARM(i, 0);
info->Class->Meta.SetMetaFixed(AWMETA_SlotPriority, i);
info->Meta.SetMetaFixed(AWMETA_SlotPriority, i);
}
//==========================================================================
@ -1599,11 +1603,11 @@ DEFINE_CLASS_PROPERTY_PREFIX(powerup, color, C_f, Inventory)
int alpha;
PalEntry * pBlendColor;
if (info->Class->IsDescendantOf(RUNTIME_CLASS(APowerup)))
if (info->IsDescendantOf(RUNTIME_CLASS(APowerup)))
{
pBlendColor = &((APowerup*)defaults)->BlendColor;
}
else if (info->Class->IsDescendantOf(RUNTIME_CLASS(APowerupGiver)))
else if (info->IsDescendantOf(RUNTIME_CLASS(APowerupGiver)))
{
pBlendColor = &((APowerupGiver*)defaults)->BlendColor;
}
@ -1649,11 +1653,11 @@ DEFINE_CLASS_PROPERTY_PREFIX(powerup, colormap, FFFfff, Inventory)
{
PalEntry * pBlendColor;
if (info->Class->IsDescendantOf(RUNTIME_CLASS(APowerup)))
if (info->IsDescendantOf(RUNTIME_CLASS(APowerup)))
{
pBlendColor = &((APowerup*)defaults)->BlendColor;
}
else if (info->Class->IsDescendantOf(RUNTIME_CLASS(APowerupGiver)))
else if (info->IsDescendantOf(RUNTIME_CLASS(APowerupGiver)))
{
pBlendColor = &((APowerupGiver*)defaults)->BlendColor;
}
@ -1693,11 +1697,11 @@ DEFINE_CLASS_PROPERTY_PREFIX(powerup, duration, I, Inventory)
{
int *pEffectTics;
if (info->Class->IsDescendantOf(RUNTIME_CLASS(APowerup)))
if (info->IsDescendantOf(RUNTIME_CLASS(APowerup)))
{
pEffectTics = &((APowerup*)defaults)->EffectTics;
}
else if (info->Class->IsDescendantOf(RUNTIME_CLASS(APowerupGiver)))
else if (info->IsDescendantOf(RUNTIME_CLASS(APowerupGiver)))
{
pEffectTics = &((APowerupGiver*)defaults)->EffectTics;
}
@ -1718,11 +1722,11 @@ DEFINE_CLASS_PROPERTY_PREFIX(powerup, strength, F, Inventory)
{
fixed_t *pStrength;
if (info->Class->IsDescendantOf(RUNTIME_CLASS(APowerup)))
if (info->IsDescendantOf(RUNTIME_CLASS(APowerup)))
{
pStrength = &((APowerup*)defaults)->Strength;
}
else if (info->Class->IsDescendantOf(RUNTIME_CLASS(APowerupGiver)))
else if (info->IsDescendantOf(RUNTIME_CLASS(APowerupGiver)))
{
pStrength = &((APowerupGiver*)defaults)->Strength;
}
@ -1743,11 +1747,11 @@ DEFINE_CLASS_PROPERTY_PREFIX(powerup, mode, S, Inventory)
{
PROP_STRING_PARM(str, 0);
FName *pMode;
if (info->Class->IsDescendantOf(RUNTIME_CLASS(APowerup)))
if (info->IsDescendantOf(RUNTIME_CLASS(APowerup)))
{
pMode = &((APowerup*)defaults)->Mode;
}
else if (info->Class->IsDescendantOf(RUNTIME_CLASS(APowerupGiver)))
else if (info->IsDescendantOf(RUNTIME_CLASS(APowerupGiver)))
{
pMode = &((APowerupGiver*)defaults)->Mode;
}
@ -1768,7 +1772,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(powerup, type, S, PowerupGiver)
// Yuck! What was I thinking when I decided to prepend "Power" to the name?
// Now it's too late to change it...
const PClass *cls = PClass::FindClass(str);
PClassActor *cls = PClass::FindActor(str);
if (cls == NULL || !cls->IsDescendantOf(RUNTIME_CLASS(APowerup)))
{
FString st;
@ -1791,7 +1795,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(powerup, type, S, PowerupGiver)
DEFINE_CLASS_PROPERTY_PREFIX(player, displayname, S, PlayerPawn)
{
PROP_STRING_PARM(str, 0);
info->Class->Meta.SetMetaString (APMETA_DisplayName, str);
info->Meta.SetMetaString (APMETA_DisplayName, str);
}
//==========================================================================
@ -1803,7 +1807,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, soundclass, S, PlayerPawn)
FString tmp = str;
tmp.ReplaceChars (' ', '_');
info->Class->Meta.SetMetaString (APMETA_SoundClass, tmp);
info->Meta.SetMetaString (APMETA_SoundClass, tmp);
}
//==========================================================================
@ -1819,7 +1823,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, face, S, PlayerPawn)
{
bag.ScriptPosition.Message(MSG_WARNING,
"Invalid face '%s' for '%s';\nSTF replacement codes must be 3 characters.\n",
tmp.GetChars(), info->Class->TypeName.GetChars ());
tmp.GetChars(), info->TypeName.GetChars ());
}
bool valid = (
@ -1831,10 +1835,10 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, face, S, PlayerPawn)
{
bag.ScriptPosition.Message(MSG_WARNING,
"Invalid face '%s' for '%s';\nSTF replacement codes must be alphanumeric.\n",
tmp.GetChars(), info->Class->TypeName.GetChars ());
tmp.GetChars(), info->TypeName.GetChars ());
}
info->Class->Meta.SetMetaString (APMETA_Face, tmp);
info->Meta.SetMetaString (APMETA_Face, tmp);
}
//==========================================================================
@ -1848,7 +1852,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, colorrange, I_I, PlayerPawn)
if (start > end)
swap (start, end);
info->Class->Meta.SetMetaInt (APMETA_ColorRange, (start & 255) | ((end & 255) << 8));
info->Meta.SetMetaInt (APMETA_ColorRange, (start & 255) | ((end & 255) << 8));
}
//==========================================================================
@ -1983,7 +1987,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, scoreicon, S, PlayerPawn)
if (!defaults->ScoreIcon.isValid())
{
bag.ScriptPosition.Message(MSG_WARNING,
"Icon '%s' for '%s' not found\n", z, info->Class->TypeName.GetChars ());
"Icon '%s' for '%s' not found\n", z, info->TypeName.GetChars ());
}
}
@ -2052,7 +2056,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, startitem, S_i, PlayerPawn)
DEFINE_CLASS_PROPERTY_PREFIX(player, invulnerabilitymode, S, PlayerPawn)
{
PROP_STRING_PARM(str, 0);
info->Class->Meta.SetMetaInt (APMETA_InvulMode, (FName)str);
info->Meta.SetMetaInt (APMETA_InvulMode, (FName)str);
}
//==========================================================================
@ -2061,7 +2065,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, invulnerabilitymode, S, PlayerPawn)
DEFINE_CLASS_PROPERTY_PREFIX(player, healradiustype, S, PlayerPawn)
{
PROP_STRING_PARM(str, 0);
info->Class->Meta.SetMetaInt (APMETA_HealingRadius, (FName)str);
info->Meta.SetMetaInt (APMETA_HealingRadius, (FName)str);
}
//==========================================================================
@ -2072,7 +2076,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, hexenarmor, FFFFF, PlayerPawn)
for (int i=0;i<5;i++)
{
PROP_FIXED_PARM(val, i);
info->Class->Meta.SetMetaFixed (APMETA_Hexenarmor0+i, val);
info->Meta.SetMetaFixed (APMETA_Hexenarmor0+i, val);
}
}
@ -2096,7 +2100,7 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, weaponslot, ISsssssssssssssssssssssssssssss
PROP_STRING_PARM(str, i);
weapons << ' ' << str;
}
info->Class->Meta.SetMetaString(APMETA_Slot0 + slot, &weapons[1]);
info->Meta.SetMetaString(APMETA_Slot0 + slot, &weapons[1]);
}
}

View file

@ -82,7 +82,7 @@ bool DoActionSpecials(FScanner &sc, FState & state, Baggage &bag, FStateTempCall
{
for (i = 0; i < 5;)
{
tcall->Parameters.Push(new FxParameter(new FxIntCast(ParseExpression(sc, bag.Info->Class))));
tcall->Parameters.Push(new FxParameter(new FxIntCast(ParseExpression(sc, bag.Info))));
i++;
if (!sc.CheckToken (',')) break;
}
@ -136,7 +136,7 @@ static FString ParseStateString(FScanner &sc)
// parses a state block
//
//==========================================================================
void ParseStates(FScanner &sc, FActorInfo * actor, AActor * defaults, Baggage &bag)
void ParseStates(FScanner &sc, PClassActor * actor, AActor * defaults, Baggage &bag)
{
FString statestring;
FState state;
@ -272,7 +272,7 @@ do_stop:
goto endofstate;
}
PSymbol *sym = bag.Info->Class->Symbols.FindSymbol (FName(sc.String, true), true);
PSymbol *sym = bag.Info->Symbols.FindSymbol (FName(sc.String, true), true);
if (sym != NULL && sym->SymbolType == SYM_ActionFunction)
{
PSymbolActionFunction *afd = static_cast<PSymbolActionFunction *>(sym);
@ -341,7 +341,7 @@ do_stop:
else
{
// Use the generic parameter parser for everything else
x = ParseParameter(sc, bag.Info->Class, *params, false);
x = ParseParameter(sc, bag.Info, *params, false);
}
// StateParams.Set(paramindex++, x);
tcall->Parameters.Push(new FxParameter(x));
@ -357,7 +357,7 @@ do_stop:
goto endofstate;
}
params--;
StateParams.Reserve(1, bag.Info->Class);
StateParams.Reserve(1, bag.Info);
}
else if ((islower(*params) || *params=='!') && sc.CheckString(")"))
{
@ -391,7 +391,7 @@ endofstate:
}
if (tcall->Function != NULL)
{
tcall->ActorInfo = actor;
tcall->ActorClass = actor;
tcall->FirstState = bag.statedef.GetStateCount() - count;
tcall->NumStates = count;
StateTempCalls.Push(tcall);

View file

@ -873,7 +873,7 @@ void VMDisasm(FILE *out, const VMOP *code, int codesize, const VMScriptFunction
#define PARAM_STATE_AT(p,x) assert((p) < numparam); assert(param[p].Type == REGT_POINTER && (param[p].atag == ATAG_STATE || param[p].a == NULL)); FState *x = (FState *)param[p].a;
#define PARAM_POINTER_AT(p,x,type) assert((p) < numparam); assert(param[p].Type == REGT_POINTER); type *x = (type *)param[p].a;
#define PARAM_OBJECT_AT(p,x,type) assert((p) < numparam); assert(param[p].Type == REGT_POINTER && (param[p].atag == ATAG_OBJECT || param[p].a == NULL)); type *x = (type *)param[p].a; assert(x == NULL || x->IsKindOf(RUNTIME_CLASS(type)));
#define PARAM_CLASS_AT(p,x,base) assert((p) < numparam); assert(param[p].Type == REGT_POINTER && (param[p].atag == ATAG_OBJECT || param[p].a == NULL)); PClass *x = (PClass *)param[p].a; assert(x != NULL && x->IsDescendantOf(RUNTIME_CLASS(base)));
#define PARAM_CLASS_AT(p,x,base) assert((p) < numparam); assert(param[p].Type == REGT_POINTER && (param[p].atag == ATAG_OBJECT || param[p].a == NULL)); base::MetaClass *x = (base::MetaClass *)param[p].a; assert(x != NULL && x->IsDescendantOf(RUNTIME_CLASS(base)));
// For optional paramaters. These have dangling elses for you to fill in the default assignment. e.g.:
// PARAM_INT_OPT(0,myint) { myint = 55; }
@ -891,7 +891,7 @@ void VMDisasm(FILE *out, const VMOP *code, int codesize, const VMScriptFunction
#define PARAM_STATE_OPT_AT(p,x) FState *x; if ((p) < numparam && param[p].Type != REGT_NIL) { assert(param[p].Type == REGT_POINTER && (param[p].atag == ATAG_STATE || param[p].a == NULL)); x = (FState *)param[p].a; } else
#define PARAM_POINTER_OPT_AT(p,x,type) type *x; if ((p) < numparam && param[p].Type != REGT_NIL) { assert(param[p].Type == REGT_POINTER); x = (type *)param[p].a; } else
#define PARAM_OBJECT_OPT_AT(p,x,type) type *x; if ((p) < numparam && param[p].Type != REGT_NIL) { assert(param[p].Type == REGT_POINTER && (param[p].atag == ATAG_OBJECT || param[p].a == NULL)); x = (type *)param[p].a; assert(x == NULL || x->IsKindOf(RUNTIME_CLASS(type))); } else
#define PARAM_CLASS_OPT_AT(p,x,base) PClass *x; if ((p) < numparam && param[p].Type != REGT_NIL) { assert(param[p].Type == REGT_POINTER && (param[p].atag == ATAG_OBJECT || param[p].a == NULL)); x = (PClass *)param[p].a; assert(x != NULL && x->IsDescendantOf(RUNTIME_CLASS(base))); } else
#define PARAM_CLASS_OPT_AT(p,x,base) base::MetaClass *x; if ((p) < numparam && param[p].Type != REGT_NIL) { assert(param[p].Type == REGT_POINTER && (param[p].atag == ATAG_OBJECT || param[p].a == NULL)); x = (base::MetaClass *)param[p].a; assert(x != NULL && x->IsDescendantOf(RUNTIME_CLASS(base))); } else
// The above, but with an automatically increasing position index.
#define PARAM_PROLOGUE int paramnum = -1;