diff --git a/src/dobject.h b/src/dobject.h index f478cfc080..254891eb56 100644 --- a/src/dobject.h +++ b/src/dobject.h @@ -98,7 +98,8 @@ enum CLASSREG_PClassPlayerPawn, CLASSREG_PClassType, CLASSREG_PClassClass, - CLASSREG_PClassWeaponPiece + CLASSREG_PClassWeaponPiece, + CLASSREG_PClassPowerupGiver }; struct ClassReg diff --git a/src/dobjtype.cpp b/src/dobjtype.cpp index 1762079fb0..b5d758bfcc 100644 --- a/src/dobjtype.cpp +++ b/src/dobjtype.cpp @@ -2165,6 +2165,7 @@ PClass *ClassReg::RegisterClass() &PClassType::RegistrationInfo, &PClassClass::RegistrationInfo, &PClassWeaponPiece::RegistrationInfo, + &PClassPowerupGiver::RegistrationInfo, }; // Skip classes that have already been registered diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index 58aee16fb9..992e97cefc 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -42,6 +42,18 @@ IMPLEMENT_CLASS (APowerup) // Powerup-Giver ------------------------------------------------------------- +IMPLEMENT_CLASS(PClassPowerupGiver) + +void PClassPowerupGiver::ReplaceClassRef(PClass *oldclass, PClass *newclass) +{ + Super::ReplaceClassRef(oldclass, newclass); + APowerupGiver *def = (APowerupGiver*)Defaults; + if (def != NULL) + { + if (def->PowerupType == oldclass) def->PowerupType = static_cast(newclass); + } +} + //=========================================================================== // // APowerupGiver :: Use diff --git a/src/g_shared/a_artifacts.h b/src/g_shared/a_artifacts.h index 5881fc52fc..a99cf64c51 100644 --- a/src/g_shared/a_artifacts.h +++ b/src/g_shared/a_artifacts.h @@ -36,14 +36,24 @@ protected: friend void InitAllPowerupEffects(AInventory *item); }; +class PClassPowerupGiver: public PClassInventory +{ + DECLARE_CLASS(PClassPowerupGiver, PClassInventory) +protected: +public: + virtual void ReplaceClassRef(PClass *oldclass, PClass *newclass); +}; + + // An artifact is an item that gives the player a powerup when activated. class APowerupGiver : public AInventory { - DECLARE_CLASS (APowerupGiver, AInventory) + DECLARE_CLASS_WITH_META (APowerupGiver, AInventory, PClassPowerupGiver) public: virtual bool Use (bool pickup); virtual void Serialize (FArchive &arc); + PClassActor *PowerupType; int EffectTics; // Non-0 to override the powerup's default tics PalEntry BlendColor; // Non-0 to override the powerup's default blend diff --git a/src/g_shared/a_weaponpiece.h b/src/g_shared/a_weaponpiece.h index dfa30f5d75..4fa2118cd9 100644 --- a/src/g_shared/a_weaponpiece.h +++ b/src/g_shared/a_weaponpiece.h @@ -1,5 +1,5 @@ -// Ammo: Something a weapon needs to operate +// class PClassWeaponPiece : public PClassInventory { DECLARE_CLASS(PClassWeaponPiece, PClassInventory)