mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-16 17:21:10 +00:00
- split up PClass::Derive and its child functions because part of them is also needed when initializing an inherited native class with the properties of its parent - but calling the base version in PClass is not possible.
- moved a few AActor properties out of the EXE so that I could easily test if it works.
This commit is contained in:
parent
b484cbf18a
commit
6ce0c9f78e
12 changed files with 29 additions and 29 deletions
|
@ -73,9 +73,9 @@ class PClassPlayerPawn : public PClassActor
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PClassPlayerPawn, PClassActor);
|
DECLARE_CLASS(PClassPlayerPawn, PClassActor);
|
||||||
protected:
|
protected:
|
||||||
virtual void Derive(PClass *newclass);
|
|
||||||
public:
|
public:
|
||||||
PClassPlayerPawn();
|
PClassPlayerPawn();
|
||||||
|
virtual void DeriveData(PClass *newclass);
|
||||||
void EnumColorSets(TArray<int> *out);
|
void EnumColorSets(TArray<int> *out);
|
||||||
FPlayerColorSet *GetColorSet(int setnum) { return ColorSets.CheckKey(setnum); }
|
FPlayerColorSet *GetColorSet(int setnum) { return ColorSets.CheckKey(setnum); }
|
||||||
void SetPainFlash(FName type, PalEntry color);
|
void SetPainFlash(FName type, PalEntry color);
|
||||||
|
|
|
@ -2347,6 +2347,7 @@ PClass *PClass::CreateDerivedClass(FName name, unsigned int size)
|
||||||
type->Size = size;
|
type->Size = size;
|
||||||
type->bRuntimeClass = true;
|
type->bRuntimeClass = true;
|
||||||
Derive(type);
|
Derive(type);
|
||||||
|
DeriveData(type);
|
||||||
if (!notnew)
|
if (!notnew)
|
||||||
{
|
{
|
||||||
type->InsertIntoHash();
|
type->InsertIntoHash();
|
||||||
|
|
|
@ -610,13 +610,14 @@ class PClass : public PStruct
|
||||||
DECLARE_CLASS(PClass, PStruct);
|
DECLARE_CLASS(PClass, PStruct);
|
||||||
HAS_OBJECT_POINTERS;
|
HAS_OBJECT_POINTERS;
|
||||||
protected:
|
protected:
|
||||||
virtual void Derive(PClass *newclass);
|
|
||||||
// We unravel _WITH_META here just as we did for PType.
|
// We unravel _WITH_META here just as we did for PType.
|
||||||
enum { MetaClassNum = CLASSREG_PClassClass };
|
enum { MetaClassNum = CLASSREG_PClassClass };
|
||||||
|
virtual void Derive(PClass *newclass);
|
||||||
public:
|
public:
|
||||||
typedef PClassClass MetaClass;
|
typedef PClassClass MetaClass;
|
||||||
MetaClass *GetClass() const;
|
MetaClass *GetClass() const;
|
||||||
|
|
||||||
|
virtual void DeriveData(PClass *newclass) {}
|
||||||
static void StaticInit();
|
static void StaticInit();
|
||||||
static void StaticShutdown();
|
static void StaticShutdown();
|
||||||
static void StaticBootstrap();
|
static void StaticBootstrap();
|
||||||
|
@ -677,9 +678,9 @@ class PClassType : public PClass
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PClassType, PClass);
|
DECLARE_CLASS(PClassType, PClass);
|
||||||
protected:
|
protected:
|
||||||
virtual void Derive(PClass *newclass);
|
|
||||||
public:
|
public:
|
||||||
PClassType();
|
PClassType();
|
||||||
|
virtual void Derive(PClass *newclass);
|
||||||
|
|
||||||
PClass *TypeTableType; // The type to use for hashing into the type table
|
PClass *TypeTableType; // The type to use for hashing into the type table
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,10 +30,10 @@ PClassInventory::PClassInventory()
|
||||||
AltHUDIcon.SetNull();
|
AltHUDIcon.SetNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PClassInventory::Derive(PClass *newclass)
|
void PClassInventory::DeriveData(PClass *newclass)
|
||||||
{
|
{
|
||||||
assert(newclass->IsKindOf(RUNTIME_CLASS(PClassInventory)));
|
assert(newclass->IsKindOf(RUNTIME_CLASS(PClassInventory)));
|
||||||
Super::Derive(newclass);
|
Super::DeriveData(newclass);
|
||||||
PClassInventory *newc = static_cast<PClassInventory *>(newclass);
|
PClassInventory *newc = static_cast<PClassInventory *>(newclass);
|
||||||
|
|
||||||
newc->PickupMessage = PickupMessage;
|
newc->PickupMessage = PickupMessage;
|
||||||
|
@ -60,10 +60,10 @@ PClassAmmo::PClassAmmo()
|
||||||
DropAmount = 0;
|
DropAmount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PClassAmmo::Derive(PClass *newclass)
|
void PClassAmmo::DeriveData(PClass *newclass)
|
||||||
{
|
{
|
||||||
assert(newclass->IsKindOf(RUNTIME_CLASS(PClassAmmo)));
|
assert(newclass->IsKindOf(RUNTIME_CLASS(PClassAmmo)));
|
||||||
Super::Derive(newclass);
|
Super::DeriveData(newclass);
|
||||||
PClassAmmo *newc = static_cast<PClassAmmo *>(newclass);
|
PClassAmmo *newc = static_cast<PClassAmmo *>(newclass);
|
||||||
|
|
||||||
newc->DropAmount = DropAmount;
|
newc->DropAmount = DropAmount;
|
||||||
|
@ -1684,10 +1684,10 @@ PClassHealth::PClassHealth()
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
void PClassHealth::Derive(PClass *newclass)
|
void PClassHealth::DeriveData(PClass *newclass)
|
||||||
{
|
{
|
||||||
assert(newclass->IsKindOf(RUNTIME_CLASS(PClassHealth)));
|
assert(newclass->IsKindOf(RUNTIME_CLASS(PClassHealth)));
|
||||||
Super::Derive(newclass);
|
Super::DeriveData(newclass);
|
||||||
PClassHealth *newc = static_cast<PClassHealth *>(newclass);
|
PClassHealth *newc = static_cast<PClassHealth *>(newclass);
|
||||||
|
|
||||||
newc->LowHealth = LowHealth;
|
newc->LowHealth = LowHealth;
|
||||||
|
|
|
@ -135,10 +135,9 @@ enum
|
||||||
class PClassInventory : public PClassActor
|
class PClassInventory : public PClassActor
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PClassInventory, PClassActor)
|
DECLARE_CLASS(PClassInventory, PClassActor)
|
||||||
protected:
|
|
||||||
virtual void Derive(PClass *newclass);
|
|
||||||
public:
|
public:
|
||||||
PClassInventory();
|
PClassInventory();
|
||||||
|
virtual void DeriveData(PClass *newclass);
|
||||||
virtual void ReplaceClassRef(PClass *oldclass, PClass *newclass);
|
virtual void ReplaceClassRef(PClass *oldclass, PClass *newclass);
|
||||||
|
|
||||||
FString PickupMessage;
|
FString PickupMessage;
|
||||||
|
@ -242,7 +241,7 @@ class PClassAmmo : public PClassInventory
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PClassAmmo, PClassInventory)
|
DECLARE_CLASS(PClassAmmo, PClassInventory)
|
||||||
protected:
|
protected:
|
||||||
virtual void Derive(PClass *newclass);
|
virtual void DeriveData(PClass *newclass);
|
||||||
public:
|
public:
|
||||||
PClassAmmo();
|
PClassAmmo();
|
||||||
|
|
||||||
|
@ -267,7 +266,7 @@ class PClassWeapon : public PClassInventory
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PClassWeapon, PClassInventory);
|
DECLARE_CLASS(PClassWeapon, PClassInventory);
|
||||||
protected:
|
protected:
|
||||||
virtual void Derive(PClass *newclass);
|
virtual void DeriveData(PClass *newclass);
|
||||||
public:
|
public:
|
||||||
PClassWeapon();
|
PClassWeapon();
|
||||||
virtual void ReplaceClassRef(PClass *oldclass, PClass *newclass);
|
virtual void ReplaceClassRef(PClass *oldclass, PClass *newclass);
|
||||||
|
@ -403,9 +402,9 @@ class PClassHealth : public PClassInventory
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PClassHealth, PClassInventory)
|
DECLARE_CLASS(PClassHealth, PClassInventory)
|
||||||
protected:
|
protected:
|
||||||
virtual void Derive(PClass *newclass);
|
|
||||||
public:
|
public:
|
||||||
PClassHealth();
|
PClassHealth();
|
||||||
|
virtual void DeriveData(PClass *newclass);
|
||||||
|
|
||||||
FString LowHealthMessage;
|
FString LowHealthMessage;
|
||||||
int LowHealth;
|
int LowHealth;
|
||||||
|
@ -520,8 +519,8 @@ class PClassPuzzleItem : public PClassInventory
|
||||||
{
|
{
|
||||||
DECLARE_CLASS(PClassPuzzleItem, PClassInventory);
|
DECLARE_CLASS(PClassPuzzleItem, PClassInventory);
|
||||||
protected:
|
protected:
|
||||||
virtual void Derive(PClass *newclass);
|
|
||||||
public:
|
public:
|
||||||
|
virtual void DeriveData(PClass *newclass);
|
||||||
FString PuzzFailMessage;
|
FString PuzzFailMessage;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PClassPuzzleItem)
|
IMPLEMENT_CLASS(PClassPuzzleItem)
|
||||||
|
|
||||||
void PClassPuzzleItem::Derive(PClass *newclass)
|
void PClassPuzzleItem::DeriveData(PClass *newclass)
|
||||||
{
|
{
|
||||||
Super::Derive(newclass);
|
Super::DeriveData(newclass);
|
||||||
assert(newclass->IsKindOf(RUNTIME_CLASS(PClassPuzzleItem)));
|
assert(newclass->IsKindOf(RUNTIME_CLASS(PClassPuzzleItem)));
|
||||||
static_cast<PClassPuzzleItem *>(newclass)->PuzzFailMessage = PuzzFailMessage;
|
static_cast<PClassPuzzleItem *>(newclass)->PuzzFailMessage = PuzzFailMessage;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,10 +44,10 @@ PClassWeapon::PClassWeapon()
|
||||||
SlotPriority = FIXED_MAX;
|
SlotPriority = FIXED_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PClassWeapon::Derive(PClass *newclass)
|
void PClassWeapon::DeriveData(PClass *newclass)
|
||||||
{
|
{
|
||||||
assert(newclass->IsKindOf(RUNTIME_CLASS(PClassWeapon)));
|
assert(newclass->IsKindOf(RUNTIME_CLASS(PClassWeapon)));
|
||||||
Super::Derive(newclass);
|
Super::DeriveData(newclass);
|
||||||
PClassWeapon *newc = static_cast<PClassWeapon *>(newclass);
|
PClassWeapon *newc = static_cast<PClassWeapon *>(newclass);
|
||||||
|
|
||||||
newc->SlotNumber = SlotNumber;
|
newc->SlotNumber = SlotNumber;
|
||||||
|
|
|
@ -201,16 +201,11 @@ PClassActor::PClassActor()
|
||||||
FastSpeed = FIXED_MIN;
|
FastSpeed = FIXED_MIN;
|
||||||
RDFactor = FRACUNIT;
|
RDFactor = FRACUNIT;
|
||||||
CameraHeight = FIXED_MIN;
|
CameraHeight = FIXED_MIN;
|
||||||
BloodType = NAME_Blood;
|
|
||||||
BloodType2 = NAME_BloodSplatter;
|
|
||||||
BloodType3 = NAME_AxeBlood;
|
|
||||||
|
|
||||||
DropItems = NULL;
|
DropItems = NULL;
|
||||||
|
|
||||||
DontHurtShooter = false;
|
DontHurtShooter = false;
|
||||||
ExplosionDamage = 128;
|
|
||||||
ExplosionRadius = -1;
|
ExplosionRadius = -1;
|
||||||
MissileHeight = 32*FRACUNIT;
|
|
||||||
MeleeDamage = 0;
|
MeleeDamage = 0;
|
||||||
|
|
||||||
// Record this in the master list.
|
// Record this in the master list.
|
||||||
|
@ -250,10 +245,9 @@ PClassActor::~PClassActor()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void PClassActor::Derive(PClass *newclass)
|
void PClassActor::DeriveData(PClass *newclass)
|
||||||
{
|
{
|
||||||
assert(newclass->IsKindOf(RUNTIME_CLASS(PClassActor)));
|
assert(newclass->IsKindOf(RUNTIME_CLASS(PClassActor)));
|
||||||
Super::Derive(newclass);
|
|
||||||
PClassActor *newa = static_cast<PClassActor *>(newclass);
|
PClassActor *newa = static_cast<PClassActor *>(newclass);
|
||||||
|
|
||||||
newa->Obituary = Obituary;
|
newa->Obituary = Obituary;
|
||||||
|
|
|
@ -192,10 +192,10 @@ class PClassActor : public PClass
|
||||||
DECLARE_CLASS(PClassActor, PClass);
|
DECLARE_CLASS(PClassActor, PClass);
|
||||||
HAS_OBJECT_POINTERS;
|
HAS_OBJECT_POINTERS;
|
||||||
protected:
|
protected:
|
||||||
virtual void Derive(PClass *newclass);
|
|
||||||
public:
|
public:
|
||||||
static void StaticInit ();
|
static void StaticInit ();
|
||||||
static void StaticSetActorNums ();
|
static void StaticSetActorNums ();
|
||||||
|
virtual void DeriveData(PClass *newclass);
|
||||||
|
|
||||||
PClassActor();
|
PClassActor();
|
||||||
~PClassActor();
|
~PClassActor();
|
||||||
|
|
|
@ -515,10 +515,10 @@ PClassPlayerPawn::PClassPlayerPawn()
|
||||||
ColorRangeEnd = 0;
|
ColorRangeEnd = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PClassPlayerPawn::Derive(PClass *newclass)
|
void PClassPlayerPawn::DeriveData(PClass *newclass)
|
||||||
{
|
{
|
||||||
assert(newclass->IsKindOf(RUNTIME_CLASS(PClassPlayerPawn)));
|
assert(newclass->IsKindOf(RUNTIME_CLASS(PClassPlayerPawn)));
|
||||||
Super::Derive(newclass);
|
Super::DeriveData(newclass);
|
||||||
PClassPlayerPawn *newp = static_cast<PClassPlayerPawn *>(newclass);
|
PClassPlayerPawn *newp = static_cast<PClassPlayerPawn *>(newclass);
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
|
|
@ -137,6 +137,7 @@ PClassActor *CreateNewActor(const FScriptPosition &sc, FName typeName, FName par
|
||||||
goto create;
|
goto create;
|
||||||
}
|
}
|
||||||
ti->InitializeNativeDefaults();
|
ti->InitializeNativeDefaults();
|
||||||
|
ti->ParentClass->DeriveData(ti);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,6 +32,10 @@ ACTOR Actor native //: Thinker
|
||||||
RipLevelMin 0
|
RipLevelMin 0
|
||||||
RipLevelMax 0
|
RipLevelMax 0
|
||||||
DefThreshold 100
|
DefThreshold 100
|
||||||
|
BloodType "Blood", "BloodSplatter", "AxeBlood"
|
||||||
|
ExplosionDamage 128
|
||||||
|
MissileHeight 32
|
||||||
|
|
||||||
|
|
||||||
// Functions
|
// Functions
|
||||||
native bool CheckClass(class<Actor> checkclass, int ptr_select = AAPTR_DEFAULT, bool match_superclass = false);
|
native bool CheckClass(class<Actor> checkclass, int ptr_select = AAPTR_DEFAULT, bool match_superclass = false);
|
||||||
|
|
Loading…
Reference in a new issue