mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
- fixed: APowerupGiver::PowerupType also needs replacement handling for placeholder classes.
This commit is contained in:
parent
3358181f18
commit
bc616dbf06
5 changed files with 27 additions and 3 deletions
|
@ -98,7 +98,8 @@ enum
|
|||
CLASSREG_PClassPlayerPawn,
|
||||
CLASSREG_PClassType,
|
||||
CLASSREG_PClassClass,
|
||||
CLASSREG_PClassWeaponPiece
|
||||
CLASSREG_PClassWeaponPiece,
|
||||
CLASSREG_PClassPowerupGiver
|
||||
};
|
||||
|
||||
struct ClassReg
|
||||
|
|
|
@ -2165,6 +2165,7 @@ PClass *ClassReg::RegisterClass()
|
|||
&PClassType::RegistrationInfo,
|
||||
&PClassClass::RegistrationInfo,
|
||||
&PClassWeaponPiece::RegistrationInfo,
|
||||
&PClassPowerupGiver::RegistrationInfo,
|
||||
};
|
||||
|
||||
// Skip classes that have already been registered
|
||||
|
|
|
@ -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<PClassWeapon *>(newclass);
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// APowerupGiver :: Use
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
// Ammo: Something a weapon needs to operate
|
||||
//
|
||||
class PClassWeaponPiece : public PClassInventory
|
||||
{
|
||||
DECLARE_CLASS(PClassWeaponPiece, PClassInventory)
|
||||
|
|
Loading…
Reference in a new issue