From 66d28a24b88471162be0a7201fe2693fe9ab771b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 24 Nov 2016 21:36:02 +0100 Subject: [PATCH] - disabled the scripted virtual function module after finding out that it only works if each single class that may serve as a parent for scripting is explicitly declared. Needless to say, this is simply too volatile and would require constant active maintenance, not to mention a huge amount of work up front to get going. It also hid a nasty problem with the Destroy method. Due to the way the garbage collector works, Destroy cannot be exposed to scripts as-is. It may be called from scripts but it may not be overridden from scripts because the garbage collector can call this function after all data needed for calling a scripted override has already been destroyed because if that data is also being collected there is no guarantee that proper order of destruction is observed. So for now Destroy is just a normal native method to scripted classes --- src/actor.h | 9 +- src/b_bot.cpp | 2 +- src/c_dispatch.cpp | 4 +- src/d_dehacked.cpp | 2 +- src/d_dehacked.h | 2 +- src/d_player.h | 2 +- src/decallib.cpp | 10 +- src/dobject.cpp | 3 +- src/dobject.h | 16 +- src/dobjgc.cpp | 2 +- src/dobjtype.cpp | 83 ++++--- src/dobjtype.h | 1 - src/dsectoreffect.cpp | 8 +- src/dsectoreffect.h | 4 +- src/dthinker.cpp | 173 +++++++++++++- src/dthinker.h | 4 +- src/fragglescript/t_func.cpp | 4 +- src/fragglescript/t_prepro.cpp | 2 +- src/fragglescript/t_script.cpp | 6 +- src/fragglescript/t_script.h | 6 +- src/fragglescript/t_variable.cpp | 2 +- src/g_heretic/a_hereticartifacts.cpp | 4 +- src/g_heretic/a_hereticweaps.cpp | 10 +- src/g_hexen/a_boostarmor.cpp | 2 +- src/g_hexen/a_clericholy.cpp | 4 +- src/g_hexen/a_clericstaff.cpp | 2 +- src/g_hexen/a_fighteraxe.cpp | 2 +- src/g_hexen/a_fighterplayer.cpp | 6 +- src/g_hexen/a_fighterquietus.cpp | 2 +- src/g_hexen/a_flechette.cpp | 14 +- src/g_hexen/a_healingradius.cpp | 2 +- src/g_hexen/a_heresiarch.cpp | 10 +- src/g_hexen/a_hexenspecialdecs.cpp | 4 +- src/g_hexen/a_magecone.cpp | 2 +- src/g_hexen/a_magelightning.cpp | 4 +- src/g_hexen/a_magestaff.cpp | 4 +- src/g_hexen/a_spike.cpp | 2 +- src/g_hexen/a_summon.cpp | 2 +- src/g_hexen/a_teleportother.cpp | 4 +- src/g_level.cpp | 2 +- src/g_raven/a_artitele.cpp | 2 +- src/g_raven/a_minotaur.cpp | 4 +- src/g_shared/a_action.cpp | 8 +- src/g_shared/a_armor.cpp | 10 +- src/g_shared/a_artifacts.cpp | 52 ++--- src/g_shared/a_artifacts.h | 2 +- src/g_shared/a_bridge.cpp | 6 +- src/g_shared/a_camera.cpp | 4 +- src/g_shared/a_debris.cpp | 2 +- src/g_shared/a_decals.cpp | 6 +- src/g_shared/a_fastprojectile.cpp | 14 +- src/g_shared/a_flashfader.cpp | 2 +- src/g_shared/a_fountain.cpp | 4 +- src/g_shared/a_hatetarget.cpp | 2 +- src/g_shared/a_keys.cpp | 2 +- src/g_shared/a_lightning.cpp | 2 +- src/g_shared/a_mapmarker.cpp | 2 +- src/g_shared/a_morph.cpp | 4 +- src/g_shared/a_movingcamera.cpp | 14 +- src/g_shared/a_pickups.cpp | 26 +-- src/g_shared/a_pickups.h | 4 +- src/g_shared/a_puzzleitems.cpp | 4 +- src/g_shared/a_quake.cpp | 2 +- src/g_shared/a_randomspawner.cpp | 2 +- src/g_shared/a_secrettrigger.cpp | 2 +- src/g_shared/a_sectoraction.cpp | 24 +- src/g_shared/a_setcolor.cpp | 4 +- src/g_shared/a_sharedglobal.h | 10 +- src/g_shared/a_skies.cpp | 14 +- src/g_shared/a_soundenvironment.cpp | 4 +- src/g_shared/a_soundsequence.cpp | 6 +- src/g_shared/a_spark.cpp | 2 +- src/g_shared/a_specialspot.cpp | 4 +- src/g_shared/a_specialspot.h | 4 +- src/g_shared/a_waterzone.cpp | 2 +- src/g_shared/a_weaponpiece.cpp | 6 +- src/g_shared/a_weapons.cpp | 6 +- src/g_shared/hudmessages.cpp | 8 +- src/g_shared/sbar.h | 2 +- src/g_shared/sbarinfo.cpp | 2 +- src/g_shared/shared_sbar.cpp | 2 +- src/g_strife/a_coin.cpp | 2 +- src/g_strife/a_loremaster.cpp | 2 +- src/g_strife/a_programmer.cpp | 2 +- src/g_strife/a_rebels.cpp | 2 +- src/g_strife/a_spectral.cpp | 2 +- src/g_strife/a_strifeitems.cpp | 28 +-- src/g_strife/a_strifestuff.cpp | 6 +- src/g_strife/a_strifeweapons.cpp | 6 +- src/g_strife/strife_sbar.cpp | 2 +- src/info.cpp | 2 +- src/intermission/intermission.cpp | 12 +- src/intermission/intermission.h | 4 +- src/m_argv.cpp | 2 +- src/m_cheat.cpp | 2 +- src/menu/colorpickermenu.cpp | 4 +- src/menu/joystickmenu.cpp | 2 +- src/menu/listmenu.cpp | 2 +- src/menu/loadsavemenu.cpp | 12 +- src/menu/menu.cpp | 2 +- src/menu/menuinput.cpp | 2 +- src/menu/messagebox.cpp | 13 +- src/menu/optionmenu.cpp | 6 +- src/menu/optionmenuitems.h | 2 +- src/menu/playermenu.cpp | 2 +- src/menu/readthis.cpp | 2 +- src/menu/videomenu.cpp | 2 +- src/p_acs.cpp | 6 +- src/p_buildmap.cpp | 2 +- src/p_ceiling.cpp | 2 +- src/p_conversation.cpp | 3 +- src/p_doors.cpp | 4 +- src/p_floor.cpp | 15 +- src/p_interaction.cpp | 2 +- src/p_lights.cpp | 16 +- src/p_lnspec.cpp | 4 +- src/p_map.cpp | 4 +- src/p_mobj.cpp | 117 +++++++++- src/p_pillar.cpp | 2 +- src/p_plats.cpp | 2 +- src/p_pspr.cpp | 2 +- src/p_pspr.h | 2 +- src/p_pusher.cpp | 2 +- src/p_scroll.cpp | 4 +- src/p_spec.cpp | 4 +- src/p_spec.h | 5 +- src/p_switch.cpp | 2 +- src/p_teleport.cpp | 2 +- src/p_user.cpp | 40 ++-- src/po_man.cpp | 10 +- src/po_man.h | 2 +- src/posix/sdl/sdlvideo.cpp | 2 +- src/r_data/r_interpolate.cpp | 18 +- src/r_data/r_interpolate.h | 2 +- src/r_defs.h | 2 +- src/s_advsound.cpp | 6 +- src/s_sndseq.cpp | 14 +- src/s_sndseq.h | 2 +- src/scripting/decorate/olddecorations.cpp | 2 +- src/scripting/vm/vm.h | 2 +- src/scripting/vm/vmframe.cpp | 8 +- src/scripting/zscript/zcc_compile.cpp | 36 --- src/v_video.cpp | 8 +- src/virtual.h | 272 +--------------------- src/win32/fb_d3d9.cpp | 2 +- src/win32/fb_ddraw.cpp | 2 +- src/win32/win32video.cpp | 2 +- wadsrc/static/zscript/base.txt | 2 +- wadsrc/static/zscript/hexen/firedemon.txt | 16 +- 149 files changed, 727 insertions(+), 759 deletions(-) diff --git a/src/actor.h b/src/actor.h index bbe7381a2..36fcc5de4 100644 --- a/src/actor.h +++ b/src/actor.h @@ -584,7 +584,7 @@ public: AActor () throw(); AActor (const AActor &other) throw(); AActor &operator= (const AActor &other); - void Destroy (); + void Destroy () override; ~AActor (); void Serialize(FSerializer &arc); @@ -612,6 +612,7 @@ public: bool CheckNoDelay(); virtual void BeginPlay(); // Called immediately after the actor is created + void CallBeginPlay(); virtual void PostBeginPlay(); // Called immediately before the actor's first tick void LevelSpawned(); // Called after BeginPlay if this actor was spawned by the world virtual void HandleSpawnFlags(); // Translates SpawnFlags into in-game flags. @@ -620,6 +621,8 @@ public: virtual void Activate (AActor *activator); virtual void Deactivate (AActor *activator); + void CallActivate(AActor *activator); + void CallDeactivate(AActor *activator); virtual void Tick (); @@ -629,6 +632,7 @@ public: // Perform some special damage action. Returns the amount of damage to do. // Returning -1 signals the damage routine to exit immediately virtual int DoSpecialDamage (AActor *target, int damage, FName damagetype); + int CallDoSpecialDamage(AActor *target, int damage, FName damagetype); // Like DoSpecialDamage, but called on the actor receiving the damage. virtual int TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype); @@ -684,7 +688,8 @@ public: virtual bool TakeInventory (PClassActor *itemclass, int amount, bool fromdecorate = false, bool notakeinfinite = false); // Uses an item and removes it from the inventory. - virtual bool UseInventory (AInventory *item); + virtual bool DoUseInventory (AInventory *item); + bool UseInventory(AInventory *item); // Tosses an item out of the inventory. virtual AInventory *DropInventory (AInventory *item); diff --git a/src/b_bot.cpp b/src/b_bot.cpp index 93d71092d..3f4d0c592 100644 --- a/src/b_bot.cpp +++ b/src/b_bot.cpp @@ -15,7 +15,7 @@ #include "serializer.h" #include "d_player.h" -IMPLEMENT_CLASS(DBot, false, true, false, false) +IMPLEMENT_CLASS(DBot, false, true) IMPLEMENT_POINTERS_START(DBot) IMPLEMENT_POINTER(dest) diff --git a/src/c_dispatch.cpp b/src/c_dispatch.cpp index 71aeea0fa..d112634d6 100644 --- a/src/c_dispatch.cpp +++ b/src/c_dispatch.cpp @@ -187,7 +187,7 @@ static const char *KeyConfCommands[] = // CODE -------------------------------------------------------------------- -IMPLEMENT_CLASS(DWaitingCommand, false, false, false, false) +IMPLEMENT_CLASS(DWaitingCommand, false, false) void DWaitingCommand::Serialize(FSerializer &arc) { @@ -225,7 +225,7 @@ void DWaitingCommand::Tick () } } -IMPLEMENT_CLASS(DStoredCommand, false, false, false, false) +IMPLEMENT_CLASS(DStoredCommand, false, false) DStoredCommand::DStoredCommand () { diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index 2e8c56f05..40e8e5702 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -221,7 +221,7 @@ DehInfo deh = // from the original actor's defaults. The original actor is then changed to // spawn the new class. -IMPLEMENT_CLASS(ADehackedPickup, false, true, false, false) +IMPLEMENT_CLASS(ADehackedPickup, false, true) IMPLEMENT_POINTERS_START(ADehackedPickup) IMPLEMENT_POINTER(RealPickup) diff --git a/src/d_dehacked.h b/src/d_dehacked.h index 564a6d499..a622707a3 100644 --- a/src/d_dehacked.h +++ b/src/d_dehacked.h @@ -41,7 +41,7 @@ class ADehackedPickup : public AInventory DECLARE_CLASS (ADehackedPickup, AInventory) HAS_OBJECT_POINTERS public: - void Destroy (); + void Destroy() override; const char *PickupMessage (); bool ShouldRespawn (); bool ShouldStay (); diff --git a/src/d_player.h b/src/d_player.h index d1678b619..af06e9730 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -109,7 +109,7 @@ public: virtual void Tick(); virtual void AddInventory (AInventory *item); virtual void RemoveInventory (AInventory *item); - virtual bool UseInventory (AInventory *item); + virtual bool DoUseInventory (AInventory *item); virtual void MarkPrecacheSounds () const; virtual void PlayIdle (); diff --git a/src/decallib.cpp b/src/decallib.cpp index 970bd7458..9fe2966eb 100644 --- a/src/decallib.cpp +++ b/src/decallib.cpp @@ -119,7 +119,7 @@ protected: DDecalThinker () : DThinker (STAT_DECALTHINKER) {} }; -IMPLEMENT_CLASS(DDecalThinker, false, true, false, false) +IMPLEMENT_CLASS(DDecalThinker, false, true) IMPLEMENT_POINTERS_START(DDecalThinker) IMPLEMENT_POINTER(TheDecal) @@ -1153,7 +1153,7 @@ FDecalAnimator::~FDecalAnimator () { } -IMPLEMENT_CLASS(DDecalFader, false, false, false, false) +IMPLEMENT_CLASS(DDecalFader, false, false) void DDecalFader::Serialize(FSerializer &arc) { @@ -1202,7 +1202,7 @@ DThinker *FDecalFaderAnim::CreateThinker (DBaseDecal *actor, side_t *wall) const return fader; } -IMPLEMENT_CLASS(DDecalStretcher, false, false, false, false) +IMPLEMENT_CLASS(DDecalStretcher, false, false) void DDecalStretcher::Serialize(FSerializer &arc) { @@ -1290,7 +1290,7 @@ void DDecalStretcher::Tick () } } -IMPLEMENT_CLASS(DDecalSlider, false, false, false, false) +IMPLEMENT_CLASS(DDecalSlider, false, false) void DDecalSlider::Serialize(FSerializer &arc) { @@ -1370,7 +1370,7 @@ FDecalAnimator *FDecalLib::FindAnimator (const char *name) return NULL; } -IMPLEMENT_CLASS(DDecalColorer, false, false, false, false) +IMPLEMENT_CLASS(DDecalColorer, false, false) void DDecalColorer::Serialize(FSerializer &arc) { diff --git a/src/dobject.cpp b/src/dobject.cpp index 849f6a477..b05ae69ac 100644 --- a/src/dobject.cpp +++ b/src/dobject.cpp @@ -61,7 +61,7 @@ ClassReg DObject::RegistrationInfo = nullptr, // MyClass "DObject", // Name nullptr, // ParentType - &DVMObject::RegistrationInfo, // VMExport + nullptr, nullptr, // Pointers &DObject::InPlaceConstructor, // ConstructNative nullptr, @@ -358,7 +358,6 @@ void DObject::Destroy () DEFINE_ACTION_FUNCTION(DObject, Destroy) { PARAM_SELF_PROLOGUE(DObject); - self->VMSuperCall(); self->Destroy(); return 0; } diff --git a/src/dobject.h b/src/dobject.h index f728713e0..cb1074c0c 100644 --- a/src/dobject.h +++ b/src/dobject.h @@ -110,7 +110,7 @@ struct ClassReg PClass *MyClass; const char *Name; ClassReg *ParentType; - ClassReg *VMExport; + ClassReg *_VMExport; const size_t *Pointers; void (*ConstructNative)(void *); void(*InitNatives)(); @@ -157,23 +157,23 @@ protected: \ # define _DECLARE_TI(cls) ClassReg * const cls::RegistrationInfoPtr __attribute__((section(SECTION_CREG))) = &cls::RegistrationInfo; #endif -#define _IMP_PCLASS(cls, ptrs, create, initn, vmexport) \ +#define _IMP_PCLASS(cls, ptrs, create) \ ClassReg cls::RegistrationInfo = {\ nullptr, \ #cls, \ &cls::Super::RegistrationInfo, \ - vmexport, \ + nullptr, \ ptrs, \ create, \ - initn, \ + nullptr, \ sizeof(cls), \ cls::MetaClassNum }; \ _DECLARE_TI(cls) \ PClass *cls::StaticType() const { return RegistrationInfo.MyClass; } -#define IMPLEMENT_CLASS(cls, isabstract, ptrs, fields, vmexport) \ +#define IMPLEMENT_CLASS(cls, isabstract, ptrs) \ _X_CONSTRUCTOR_##isabstract(cls) \ - _IMP_PCLASS(cls, _X_POINTERS_##ptrs(cls), _X_ABSTRACT_##isabstract(cls), _X_FIELDS_##fields(cls), _X_VMEXPORT_##vmexport(cls)) + _IMP_PCLASS(cls, _X_POINTERS_##ptrs(cls), _X_ABSTRACT_##isabstract(cls)) // Taking the address of a field in an object at address 1 instead of // address 0 keeps GCC from complaining about possible misuse of offsetof. @@ -190,7 +190,7 @@ protected: \ #define _X_CONSTRUCTOR_false(cls) void cls::InPlaceConstructor(void *mem) { new((EInPlace *)mem) cls; } #define _X_ABSTRACT_true(cls) nullptr #define _X_ABSTRACT_false(cls) cls::InPlaceConstructor -#define _X_VMEXPORT_true(cls) &DVMObject::RegistrationInfo +#define _X_VMEXPORT_true(cls) nullptr #define _X_VMEXPORT_false(cls) nullptr enum EObjectFlags @@ -481,7 +481,7 @@ public: // that don't call their base class. void CheckIfSerialized () const; - virtual void Destroy (); + virtual void Destroy(); // If you need to replace one object with another and want to // change any pointers from the old object to the new object, diff --git a/src/dobjgc.cpp b/src/dobjgc.cpp index 40ef7b784..827516172 100644 --- a/src/dobjgc.cpp +++ b/src/dobjgc.cpp @@ -125,7 +125,7 @@ public: int SideNum; }; -IMPLEMENT_CLASS(DSectorMarker, false, false, false, false) +IMPLEMENT_CLASS(DSectorMarker, false, false) // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- diff --git a/src/dobjtype.cpp b/src/dobjtype.cpp index 52a269873..079890f86 100644 --- a/src/dobjtype.cpp +++ b/src/dobjtype.cpp @@ -97,8 +97,8 @@ static const size_t TheEnd = ~(size_t)0; // CODE -------------------------------------------------------------------- -IMPLEMENT_CLASS(PErrorType, false, false, false, false) -IMPLEMENT_CLASS(PVoidType, false, false, false, false) +IMPLEMENT_CLASS(PErrorType, false, false) +IMPLEMENT_CLASS(PVoidType, false, false) void DumpTypeTable() { @@ -145,7 +145,7 @@ void DumpTypeTable() /* PClassType *************************************************************/ -IMPLEMENT_CLASS(PClassType, false, false, false, false) +IMPLEMENT_CLASS(PClassType, false, false) //========================================================================== // @@ -173,7 +173,7 @@ void PClassType::DeriveData(PClass *newclass) /* PClassClass ************************************************************/ -IMPLEMENT_CLASS(PClassClass, false, false, false, false) +IMPLEMENT_CLASS(PClassClass, false, false) //========================================================================== // @@ -191,7 +191,7 @@ PClassClass::PClassClass() /* PType ******************************************************************/ -IMPLEMENT_CLASS(PType, true, true, false, false) +IMPLEMENT_CLASS(PType, true, true) IMPLEMENT_POINTERS_START(PType) IMPLEMENT_POINTER(HashNext) @@ -647,7 +647,7 @@ void PType::StaticInit() /* PBasicType *************************************************************/ -IMPLEMENT_CLASS(PBasicType, true, false, false, false) +IMPLEMENT_CLASS(PBasicType, true, false) //========================================================================== // @@ -673,11 +673,11 @@ PBasicType::PBasicType(unsigned int size, unsigned int align) /* PCompoundType **********************************************************/ -IMPLEMENT_CLASS(PCompoundType, true, false, false, false) +IMPLEMENT_CLASS(PCompoundType, true, false) /* PNamedType *************************************************************/ -IMPLEMENT_CLASS(PNamedType, true, true, false, false) +IMPLEMENT_CLASS(PNamedType, true, true) IMPLEMENT_POINTERS_START(PNamedType) IMPLEMENT_POINTER(Outer) @@ -725,7 +725,7 @@ FString PNamedType::QualifiedName() const /* PInt *******************************************************************/ -IMPLEMENT_CLASS(PInt, false, false, false, false) +IMPLEMENT_CLASS(PInt, false, false) //========================================================================== // @@ -964,7 +964,7 @@ double PInt::GetValueFloat(void *addr) const /* PBool ******************************************************************/ -IMPLEMENT_CLASS(PBool, false, false, false, false) +IMPLEMENT_CLASS(PBool, false, false) //========================================================================== // @@ -985,7 +985,7 @@ PBool::PBool() /* PFloat *****************************************************************/ -IMPLEMENT_CLASS(PFloat, false, false, false, false) +IMPLEMENT_CLASS(PFloat, false, false) //========================================================================== // @@ -1235,7 +1235,7 @@ void PFloat::SetOps() /* PString ****************************************************************/ -IMPLEMENT_CLASS(PString, false, false, false, false) +IMPLEMENT_CLASS(PString, false, false) //========================================================================== // @@ -1332,7 +1332,7 @@ void PString::DestroyValue(void *addr) const /* PName ******************************************************************/ -IMPLEMENT_CLASS(PName, false, false, false, false) +IMPLEMENT_CLASS(PName, false, false) //========================================================================== // @@ -1382,7 +1382,7 @@ bool PName::ReadValue(FSerializer &ar, const char *key, void *addr) const /* PSpriteID ******************************************************************/ -IMPLEMENT_CLASS(PSpriteID, false, false, false, false) +IMPLEMENT_CLASS(PSpriteID, false, false) //========================================================================== // @@ -1424,7 +1424,7 @@ bool PSpriteID::ReadValue(FSerializer &ar, const char *key, void *addr) const /* PTextureID ******************************************************************/ -IMPLEMENT_CLASS(PTextureID, false, false, false, false) +IMPLEMENT_CLASS(PTextureID, false, false) //========================================================================== // @@ -1467,7 +1467,7 @@ bool PTextureID::ReadValue(FSerializer &ar, const char *key, void *addr) const /* PSound *****************************************************************/ -IMPLEMENT_CLASS(PSound, false, false, false, false) +IMPLEMENT_CLASS(PSound, false, false) //========================================================================== // @@ -1517,7 +1517,7 @@ bool PSound::ReadValue(FSerializer &ar, const char *key, void *addr) const /* PColor *****************************************************************/ -IMPLEMENT_CLASS(PColor, false, false, false, false) +IMPLEMENT_CLASS(PColor, false, false) //========================================================================== // @@ -1534,7 +1534,7 @@ PColor::PColor() /* PStateLabel *****************************************************************/ -IMPLEMENT_CLASS(PStateLabel, false, false, false, false) +IMPLEMENT_CLASS(PStateLabel, false, false) //========================================================================== // @@ -1550,7 +1550,7 @@ PStateLabel::PStateLabel() /* PPointer ***************************************************************/ -IMPLEMENT_CLASS(PPointer, false, true, false, false) +IMPLEMENT_CLASS(PPointer, false, true) IMPLEMENT_POINTERS_START(PPointer) IMPLEMENT_POINTER(PointedType) @@ -1695,7 +1695,7 @@ PPointer *NewPointer(PType *type, bool isconst) /* PStatePointer **********************************************************/ -IMPLEMENT_CLASS(PStatePointer, false, false, false, false) +IMPLEMENT_CLASS(PStatePointer, false, false) //========================================================================== // @@ -1738,7 +1738,7 @@ bool PStatePointer::ReadValue(FSerializer &ar, const char *key, void *addr) cons /* PClassPointer **********************************************************/ -IMPLEMENT_CLASS(PClassPointer, false, true, false, false) +IMPLEMENT_CLASS(PClassPointer,false, true) IMPLEMENT_POINTERS_START(PClassPointer) IMPLEMENT_POINTER(ClassRestriction) @@ -1819,7 +1819,7 @@ PClassPointer *NewClassPointer(PClass *restrict) /* PEnum ******************************************************************/ -IMPLEMENT_CLASS(PEnum, false, true, false, false) +IMPLEMENT_CLASS(PEnum, false, true) IMPLEMENT_POINTERS_START(PEnum) IMPLEMENT_POINTER(ValueType) @@ -1872,7 +1872,7 @@ PEnum *NewEnum(FName name, PTypeBase *outer) /* PArray *****************************************************************/ -IMPLEMENT_CLASS(PArray, false, true, false, false) +IMPLEMENT_CLASS(PArray, false, true) IMPLEMENT_POINTERS_START(PArray) IMPLEMENT_POINTER(ElementType) @@ -2035,7 +2035,7 @@ PArray *NewArray(PType *type, unsigned int count) /* PDynArray **************************************************************/ -IMPLEMENT_CLASS(PDynArray, false, true, false, false) +IMPLEMENT_CLASS(PDynArray, false, true) IMPLEMENT_POINTERS_START(PDynArray) IMPLEMENT_POINTER(ElementType) @@ -2118,7 +2118,7 @@ PDynArray *NewDynArray(PType *type) /* PMap *******************************************************************/ -IMPLEMENT_CLASS(PMap, false, true, false, false) +IMPLEMENT_CLASS(PMap, false, true) IMPLEMENT_POINTERS_START(PMap) IMPLEMENT_POINTER(KeyType) @@ -2202,7 +2202,7 @@ PMap *NewMap(PType *keytype, PType *valuetype) /* PStruct ****************************************************************/ -IMPLEMENT_CLASS(PStruct, false, false, false, false) +IMPLEMENT_CLASS(PStruct, false, false) //========================================================================== // @@ -2440,7 +2440,7 @@ PStruct *NewStruct(FName name, PTypeBase *outer) /* PNativeStruct ****************************************************************/ -IMPLEMENT_CLASS(PNativeStruct, false, false, false, false) +IMPLEMENT_CLASS(PNativeStruct, false, false) //========================================================================== // @@ -2478,7 +2478,7 @@ PNativeStruct *NewNativeStruct(FName name, PTypeBase *outer) /* PField *****************************************************************/ -IMPLEMENT_CLASS(PField, false, false, false, false) +IMPLEMENT_CLASS(PField, false, false) //========================================================================== // @@ -2523,7 +2523,7 @@ PField::PField(FName name, PType *type, DWORD flags, size_t offset, int bitvalue /* PPrototype *************************************************************/ -IMPLEMENT_CLASS(PPrototype, false, false, false, false) +IMPLEMENT_CLASS(PPrototype, false, false) //========================================================================== // @@ -2609,7 +2609,7 @@ PPrototype *NewPrototype(const TArray &rettypes, const TArray /* PFunction **************************************************************/ -IMPLEMENT_CLASS(PFunction, false, false, false, false) +IMPLEMENT_CLASS(PFunction, false, false) //========================================================================== // @@ -2672,7 +2672,7 @@ unsigned PFunction::AddVariant(PPrototype *proto, TArray &argflags, TArra /* PClass *****************************************************************/ -IMPLEMENT_CLASS(PClass, false, true, false, false) +IMPLEMENT_CLASS(PClass, false, true) IMPLEMENT_POINTERS_START(PClass) IMPLEMENT_POINTER(ParentClass) @@ -2907,7 +2907,6 @@ void PClass::StaticShutdown () { auto cr = ((ClassReg *)*probe); cr->MyClass = nullptr; - if (cr->VMExport != nullptr) cr->VMExport->MyClass = nullptr; } } @@ -3034,10 +3033,6 @@ PClass *ClassReg::RegisterClass() { cls->ParentClass = ParentType->RegisterClass(); } - if (VMExport != nullptr) - { - cls->VMExported = VMExport->RegisterClass(); - } return cls; } @@ -3717,19 +3712,19 @@ CCMD(typetable) // Symbol tables ------------------------------------------------------------ -IMPLEMENT_CLASS(PTypeBase, true, false, false, false); -IMPLEMENT_CLASS(PSymbol, true, false, false, false); -IMPLEMENT_CLASS(PSymbolConst, false, false, false, false); -IMPLEMENT_CLASS(PSymbolConstNumeric, false, false, false, false); -IMPLEMENT_CLASS(PSymbolConstString, false, false, false, false); -IMPLEMENT_CLASS(PSymbolTreeNode, false, false, false, false) -IMPLEMENT_CLASS(PSymbolType, false, true, false, false) +IMPLEMENT_CLASS(PTypeBase, true, false); +IMPLEMENT_CLASS(PSymbol, true, false); +IMPLEMENT_CLASS(PSymbolConst, false, false); +IMPLEMENT_CLASS(PSymbolConstNumeric, false, false); +IMPLEMENT_CLASS(PSymbolConstString, false, false); +IMPLEMENT_CLASS(PSymbolTreeNode, false, false) +IMPLEMENT_CLASS(PSymbolType, false, true) IMPLEMENT_POINTERS_START(PSymbolType) IMPLEMENT_POINTER(Type) IMPLEMENT_POINTERS_END -IMPLEMENT_CLASS(PSymbolVMFunction, false, true, false, false) +IMPLEMENT_CLASS(PSymbolVMFunction, false, true) IMPLEMENT_POINTERS_START(PSymbolVMFunction) IMPLEMENT_POINTER(Function) diff --git a/src/dobjtype.h b/src/dobjtype.h index 76d6e7585..b952a3c23 100644 --- a/src/dobjtype.h +++ b/src/dobjtype.h @@ -809,7 +809,6 @@ public: // Per-class information ------------------------------------- PClass *ParentClass; // the class this class derives from - PClass *VMExported; // this is here to allow script classes to override native virtual functions 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 BYTE *Defaults; diff --git a/src/dsectoreffect.cpp b/src/dsectoreffect.cpp index 700a407fd..3c33d1634 100644 --- a/src/dsectoreffect.cpp +++ b/src/dsectoreffect.cpp @@ -31,7 +31,7 @@ #include "serializer.h" #include "doomstat.h" -IMPLEMENT_CLASS(DSectorEffect, false, false, false, false) +IMPLEMENT_CLASS(DSectorEffect, false, false) DSectorEffect::DSectorEffect () : DThinker(STAT_SECTOREFFECT) @@ -71,7 +71,7 @@ void DSectorEffect::Serialize(FSerializer &arc) arc("sector", m_Sector); } -IMPLEMENT_CLASS(DMover, false, true, false, false) +IMPLEMENT_CLASS(DMover, false, true) IMPLEMENT_POINTERS_START(DMover) IMPLEMENT_POINTER(interpolation) @@ -108,7 +108,7 @@ void DMover::StopInterpolation(bool force) } } -IMPLEMENT_CLASS(DMovingFloor, false, false, false, false) +IMPLEMENT_CLASS(DMovingFloor, false, false) DMovingFloor::DMovingFloor () { @@ -121,7 +121,7 @@ DMovingFloor::DMovingFloor (sector_t *sector) interpolation = sector->SetInterpolation(sector_t::FloorMove, true); } -IMPLEMENT_CLASS(DMovingCeiling, false, false, false, false) +IMPLEMENT_CLASS(DMovingCeiling, false, false) DMovingCeiling::DMovingCeiling () { diff --git a/src/dsectoreffect.h b/src/dsectoreffect.h index 0a5e9bd56..e9327ce70 100644 --- a/src/dsectoreffect.h +++ b/src/dsectoreffect.h @@ -12,7 +12,7 @@ public: void Serialize(FSerializer &arc); - void Destroy(); + void Destroy() override; sector_t *GetSector() const { return m_Sector; } @@ -35,7 +35,7 @@ protected: DMover (); void Serialize(FSerializer &arc); - void Destroy(); + void Destroy() override; }; class DMovingFloor : public DMover diff --git a/src/dthinker.cpp b/src/dthinker.cpp index 9478393c0..d214b28e9 100644 --- a/src/dthinker.cpp +++ b/src/dthinker.cpp @@ -48,7 +48,7 @@ extern cycle_t BotSupportCycles; extern cycle_t ActionCycles; extern int BotWTG; -IMPLEMENT_CLASS(DThinker, false, false, false, true) +IMPLEMENT_CLASS(DThinker, false, false) DThinker *NextToThink; @@ -56,6 +56,12 @@ FThinkerList DThinker::Thinkers[MAX_STATNUM+2]; FThinkerList DThinker::FreshThinkers[MAX_STATNUM+1]; bool DThinker::bSerialOverride = false; +//========================================================================== +// +// +// +//========================================================================== + void FThinkerList::AddTail(DThinker *thinker) { assert(thinker->PrevThinker == NULL && thinker->NextThinker == NULL); @@ -80,6 +86,12 @@ void FThinkerList::AddTail(DThinker *thinker) GC::WriteBarrier(Sentinel, thinker); } +//========================================================================== +// +// +// +//========================================================================== + DThinker *FThinkerList::GetHead() const { if (Sentinel == NULL || Sentinel->NextThinker == Sentinel) @@ -90,6 +102,12 @@ DThinker *FThinkerList::GetHead() const return Sentinel->NextThinker; } +//========================================================================== +// +// +// +//========================================================================== + DThinker *FThinkerList::GetTail() const { if (Sentinel == NULL || Sentinel->PrevThinker == Sentinel) @@ -99,11 +117,23 @@ DThinker *FThinkerList::GetTail() const return Sentinel->PrevThinker; } +//========================================================================== +// +// +// +//========================================================================== + bool FThinkerList::IsEmpty() const { return Sentinel == NULL || Sentinel->NextThinker == NULL; } +//========================================================================== +// +// +// +//========================================================================== + void DThinker::SaveList(FSerializer &arc, DThinker *node) { if (node != NULL) @@ -234,6 +264,12 @@ void DThinker::Destroy () Super::Destroy(); } +//========================================================================== +// +// +// +//========================================================================== + void DThinker::Remove() { if (this == NextToThink) @@ -254,6 +290,12 @@ void DThinker::Remove() PrevThinker = NULL; } +//========================================================================== +// +// +// +//========================================================================== + void DThinker::PostBeginPlay () { } @@ -261,15 +303,41 @@ void DThinker::PostBeginPlay () DEFINE_ACTION_FUNCTION(DThinker, PostBeginPlay) { PARAM_SELF_PROLOGUE(DThinker); - self->VMSuperCall(); self->PostBeginPlay(); return 0; } +void DThinker::CallPostBeginPlay() +{ + IFVIRTUAL(DThinker, PostBeginPlay) + { + // Without the type cast this picks the 'void *' assignment... + VMValue params[1] = { (DObject*)this }; + VMFrameStack stack; + stack.Call(func, params, 1, nullptr, 0, nullptr); + } + else + { + PostBeginPlay(); + } +} + +//========================================================================== +// +// +// +//========================================================================== + void DThinker::PostSerialize() { } +//========================================================================== +// +// +// +//========================================================================== + DThinker *DThinker::FirstThinker (int statnum) { DThinker *node; @@ -290,6 +358,12 @@ DThinker *DThinker::FirstThinker (int statnum) return node; } +//========================================================================== +// +// +// +//========================================================================== + void DThinker::ChangeStatNum (int statnum) { FThinkerList *list; @@ -313,7 +387,12 @@ void DThinker::ChangeStatNum (int statnum) list->AddTail(this); } +//========================================================================== +// // Mark the first thinker of each list +// +//========================================================================== + void DThinker::MarkRoots() { for (int i = 0; i <= MAX_STATNUM; ++i) @@ -324,7 +403,12 @@ void DThinker::MarkRoots() GC::Mark(Thinkers[MAX_STATNUM+1].Sentinel); } +//========================================================================== +// // Destroy every thinker +// +//========================================================================== + void DThinker::DestroyAllThinkers () { int i; @@ -341,6 +425,12 @@ void DThinker::DestroyAllThinkers () GC::FullGC(); } +//========================================================================== +// +// +// +//========================================================================== + void DThinker::DestroyThinkersInList (FThinkerList &list) { if (list.Sentinel != NULL) @@ -355,6 +445,12 @@ void DThinker::DestroyThinkersInList (FThinkerList &list) } } +//========================================================================== +// +// +// +//========================================================================== + void DThinker::RunThinkers () { int i, count; @@ -385,6 +481,12 @@ void DThinker::RunThinkers () ThinkCycles.Unclock(); } +//========================================================================== +// +// +// +//========================================================================== + int DThinker::TickThinkers (FThinkerList *list, FThinkerList *dest) { int count = 0; @@ -407,7 +509,7 @@ int DThinker::TickThinkers (FThinkerList *list, FThinkerList *dest) node->Remove(); dest->AddTail(node); } - node->PostBeginPlay(); + node->CallPostBeginPlay(); } else if (dest != NULL) { @@ -416,7 +518,7 @@ int DThinker::TickThinkers (FThinkerList *list, FThinkerList *dest) if (!(node->ObjectFlags & OF_EuthanizeMe)) { // Only tick thinkers not scheduled for destruction - node->Tick(); + node->CallTick(); node->ObjectFlags &= ~OF_JustSpawned; GC::CheckGC(); } @@ -425,6 +527,12 @@ int DThinker::TickThinkers (FThinkerList *list, FThinkerList *dest) return count; } +//========================================================================== +// +// +// +//========================================================================== + void DThinker::Tick () { } @@ -432,11 +540,28 @@ void DThinker::Tick () DEFINE_ACTION_FUNCTION(DThinker, Tick) { PARAM_SELF_PROLOGUE(DThinker); - self->VMSuperCall(); self->Tick(); return 0; } +void DThinker::CallTick() +{ + IFVIRTUAL(DThinker, Tick) + { + // Without the type cast this picks the 'void *' assignment... + VMValue params[1] = { (DObject*)this }; + VMFrameStack stack; + stack.Call(func, params, 1, nullptr, 0, nullptr); + } + else Tick(); +} + +//========================================================================== +// +// +// +//========================================================================== + size_t DThinker::PropagateMark() { // Do not choke on partially initialized objects (as happens when loading a savegame fails) @@ -450,6 +575,12 @@ size_t DThinker::PropagateMark() return Super::PropagateMark(); } +//========================================================================== +// +// +// +//========================================================================== + FThinkerIterator::FThinkerIterator (const PClass *type, int statnum) { if ((unsigned)statnum > MAX_STATNUM) @@ -467,6 +598,12 @@ FThinkerIterator::FThinkerIterator (const PClass *type, int statnum) m_SearchingFresh = false; } +//========================================================================== +// +// +// +//========================================================================== + FThinkerIterator::FThinkerIterator (const PClass *type, int statnum, DThinker *prev) { if ((unsigned)statnum > MAX_STATNUM) @@ -491,12 +628,24 @@ FThinkerIterator::FThinkerIterator (const PClass *type, int statnum, DThinker *p } } +//========================================================================== +// +// +// +//========================================================================== + void FThinkerIterator::Reinit () { m_CurrThinker = DThinker::Thinkers[m_Stat].GetHead(); m_SearchingFresh = false; } +//========================================================================== +// +// +// +//========================================================================== + DThinker *FThinkerIterator::Next (bool exact) { if (m_ParentType == NULL) @@ -542,8 +691,13 @@ DThinker *FThinkerIterator::Next (bool exact) return NULL; } +//========================================================================== +// // This is for scripting, which needs the iterator wrapped into an object with the needed functions exported. // Unfortunately we cannot have templated type conversions in scripts. +// +//========================================================================== + class DThinkerIterator : public DObject, public FThinkerIterator { DECLARE_CLASS(DThinkerIterator, DObject) @@ -555,7 +709,7 @@ public: } }; -IMPLEMENT_CLASS(DThinkerIterator, false, false, false, false); +IMPLEMENT_CLASS(DThinkerIterator, false, false); DEFINE_ACTION_FUNCTION(DThinkerIterator, Create) { PARAM_PROLOGUE; @@ -577,8 +731,11 @@ DEFINE_ACTION_FUNCTION(DThinkerIterator, Reinit) return 0; } - - +//========================================================================== +// +// +// +//========================================================================== ADD_STAT (think) { diff --git a/src/dthinker.h b/src/dthinker.h index 95985c2fb..3d580c3c2 100644 --- a/src/dthinker.h +++ b/src/dthinker.h @@ -66,10 +66,12 @@ class DThinker : public DObject DECLARE_CLASS (DThinker, DObject) public: DThinker (int statnum = STAT_DEFAULT) throw(); - void Destroy (); + void Destroy () override; virtual ~DThinker (); virtual void Tick (); + void CallTick(); virtual void PostBeginPlay (); // Called just before the first tick + void CallPostBeginPlay(); virtual void PostSerialize(); size_t PropagateMark(); diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index ddc1a4bd4..7266daf40 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -1785,7 +1785,7 @@ public: void Destroy() { Super::Destroy(); m_Sector->lightingdata=NULL; } }; -IMPLEMENT_CLASS(DLightLevel, false, false, false, false) +IMPLEMENT_CLASS(DLightLevel, false, false) void DLightLevel::Serialize(FSerializer &arc) { @@ -2975,7 +2975,7 @@ void FParser::SF_ObjAwaken(void) if(mo) { - mo->Activate(Script->trigger); + mo->CallActivate(Script->trigger); } } diff --git a/src/fragglescript/t_prepro.cpp b/src/fragglescript/t_prepro.cpp index 2129df54f..4128e6661 100644 --- a/src/fragglescript/t_prepro.cpp +++ b/src/fragglescript/t_prepro.cpp @@ -71,7 +71,7 @@ // //========================================================================== -IMPLEMENT_CLASS(DFsSection, false, true, false, false) +IMPLEMENT_CLASS(DFsSection, false, true) IMPLEMENT_POINTERS_START(DFsSection) IMPLEMENT_POINTER(next) diff --git a/src/fragglescript/t_script.cpp b/src/fragglescript/t_script.cpp index a40122623..b852607b3 100644 --- a/src/fragglescript/t_script.cpp +++ b/src/fragglescript/t_script.cpp @@ -99,7 +99,7 @@ AActor *trigger_obj; // //========================================================================== -IMPLEMENT_CLASS(DFsScript, false, true, false, false) +IMPLEMENT_CLASS(DFsScript, false, true) IMPLEMENT_POINTERS_START(DFsScript) IMPLEMENT_POINTER(parent) @@ -269,7 +269,7 @@ void DFsScript::ParseScript(char *position) // //========================================================================== -IMPLEMENT_CLASS(DRunningScript, false, true, false, false) +IMPLEMENT_CLASS(DRunningScript, false, true) IMPLEMENT_POINTERS_START(DRunningScript) IMPLEMENT_POINTER(prev) @@ -380,7 +380,7 @@ void DRunningScript::Serialize(FSerializer &arc) // //========================================================================== -IMPLEMENT_CLASS(DFraggleThinker, false, true, false, false) +IMPLEMENT_CLASS(DFraggleThinker, false, true) IMPLEMENT_POINTERS_START(DFraggleThinker) IMPLEMENT_POINTER(RunningScripts) diff --git a/src/fragglescript/t_script.h b/src/fragglescript/t_script.h index 3734e16b8..50829e000 100644 --- a/src/fragglescript/t_script.h +++ b/src/fragglescript/t_script.h @@ -337,7 +337,7 @@ public: DFsScript(); ~DFsScript(); - void Destroy(); + void Destroy() override; void Serialize(FSerializer &ar); DFsVariable *NewVariable(const char *name, int vtype); @@ -652,7 +652,7 @@ class DRunningScript : public DObject public: DRunningScript(AActor *trigger=NULL, DFsScript *owner = NULL, int index = 0) ; - void Destroy(); + void Destroy() override; void Serialize(FSerializer &arc); TObjPtr script; @@ -687,7 +687,7 @@ public: bool nocheckposition; DFraggleThinker(); - void Destroy(); + void Destroy() override; void Serialize(FSerializer & arc); diff --git a/src/fragglescript/t_variable.cpp b/src/fragglescript/t_variable.cpp index 23d24b78a..9bdddda34 100644 --- a/src/fragglescript/t_variable.cpp +++ b/src/fragglescript/t_variable.cpp @@ -179,7 +179,7 @@ AActor* actorvalue(const svalue_t &svalue) // //========================================================================== -IMPLEMENT_CLASS(DFsVariable, false, true, false, false) +IMPLEMENT_CLASS(DFsVariable, false, true) IMPLEMENT_POINTERS_START(DFsVariable) IMPLEMENT_POINTER(next) diff --git a/src/g_heretic/a_hereticartifacts.cpp b/src/g_heretic/a_hereticartifacts.cpp index f2ad18b2f..2fb45c124 100644 --- a/src/g_heretic/a_hereticartifacts.cpp +++ b/src/g_heretic/a_hereticartifacts.cpp @@ -17,7 +17,7 @@ public: bool Use (bool pickup); }; -IMPLEMENT_CLASS(AArtiTomeOfPower, false, false, false, false) +IMPLEMENT_CLASS(AArtiTomeOfPower, false, false) bool AArtiTomeOfPower::Use (bool pickup) { @@ -51,7 +51,7 @@ public: bool Use (bool pickup); }; -IMPLEMENT_CLASS(AArtiTimeBomb, false, false, false, false) +IMPLEMENT_CLASS(AArtiTimeBomb, false, false) bool AArtiTimeBomb::Use (bool pickup) { diff --git a/src/g_heretic/a_hereticweaps.cpp b/src/g_heretic/a_hereticweaps.cpp index 3b2711e24..4e2d62f1d 100644 --- a/src/g_heretic/a_hereticweaps.cpp +++ b/src/g_heretic/a_hereticweaps.cpp @@ -58,7 +58,7 @@ public: int DoSpecialDamage (AActor *target, int damage, FName damagetype); }; -IMPLEMENT_CLASS(ARainPillar, false, false, false, false) +IMPLEMENT_CLASS(ARainPillar, false, false) int ARainPillar::DoSpecialDamage (AActor *target, int damage, FName damagetype) { @@ -80,7 +80,7 @@ public: TObjPtr Rain1, Rain2; }; -IMPLEMENT_CLASS(ARainTracker, false, false, false, false) +IMPLEMENT_CLASS(ARainTracker, false, false) void ARainTracker::Serialize(FSerializer &arc) { @@ -367,8 +367,8 @@ public: void EndPowerup (); }; -IMPLEMENT_CLASS(APhoenixRod, false, false, false, false) -IMPLEMENT_CLASS(APhoenixRodPowered, false, false, false, false) +IMPLEMENT_CLASS(APhoenixRod, false, false) +IMPLEMENT_CLASS(APhoenixRodPowered, false, false) void APhoenixRodPowered::EndPowerup () { @@ -388,7 +388,7 @@ public: int DoSpecialDamage (AActor *target, int damage, FName damagetype); }; -IMPLEMENT_CLASS(APhoenixFX2, false, false, false, false) +IMPLEMENT_CLASS(APhoenixFX2, false, false) int APhoenixFX2::DoSpecialDamage (AActor *target, int damage, FName damagetype) { diff --git a/src/g_hexen/a_boostarmor.cpp b/src/g_hexen/a_boostarmor.cpp index 1323af8a5..b910f63e7 100644 --- a/src/g_hexen/a_boostarmor.cpp +++ b/src/g_hexen/a_boostarmor.cpp @@ -17,7 +17,7 @@ public: bool Use (bool pickup); }; -IMPLEMENT_CLASS(AArtiBoostArmor, false, false, false, false) +IMPLEMENT_CLASS(AArtiBoostArmor, false, false) bool AArtiBoostArmor::Use (bool pickup) { diff --git a/src/g_hexen/a_clericholy.cpp b/src/g_hexen/a_clericholy.cpp index 362434b02..52ff4179d 100644 --- a/src/g_hexen/a_clericholy.cpp +++ b/src/g_hexen/a_clericholy.cpp @@ -58,11 +58,11 @@ public: BYTE CHolyCount; }; -IMPLEMENT_CLASS(ACWeapWraithverge, false, false, false, false) +IMPLEMENT_CLASS(ACWeapWraithverge, false, false) // Holy Spirit -------------------------------------------------------------- -IMPLEMENT_CLASS(AHolySpirit, false, false, false, false) +IMPLEMENT_CLASS(AHolySpirit, false, false) bool AHolySpirit::Slam(AActor *thing) { diff --git a/src/g_hexen/a_clericstaff.cpp b/src/g_hexen/a_clericstaff.cpp index a838357d6..ef7beaffa 100644 --- a/src/g_hexen/a_clericstaff.cpp +++ b/src/g_hexen/a_clericstaff.cpp @@ -25,7 +25,7 @@ public: int DoSpecialDamage (AActor *target, int damage, FName damagetype); }; -IMPLEMENT_CLASS(ACStaffMissile, false, false, false, false) +IMPLEMENT_CLASS(ACStaffMissile, false, false) int ACStaffMissile::DoSpecialDamage (AActor *target, int damage, FName damagetype) { diff --git a/src/g_hexen/a_fighteraxe.cpp b/src/g_hexen/a_fighteraxe.cpp index 1dc02d599..fde3a9c18 100644 --- a/src/g_hexen/a_fighteraxe.cpp +++ b/src/g_hexen/a_fighteraxe.cpp @@ -31,7 +31,7 @@ public: FState *GetAtkState (bool hold); }; -IMPLEMENT_CLASS(AFWeapAxe, false, false, false, false) +IMPLEMENT_CLASS(AFWeapAxe, false, false) FState *AFWeapAxe::GetUpState () { diff --git a/src/g_hexen/a_fighterplayer.cpp b/src/g_hexen/a_fighterplayer.cpp index afdbe8a90..4f1d1fd3b 100644 --- a/src/g_hexen/a_fighterplayer.cpp +++ b/src/g_hexen/a_fighterplayer.cpp @@ -11,9 +11,9 @@ #include "vm.h" */ -IMPLEMENT_CLASS(AFighterWeapon, false, false, false, false) -IMPLEMENT_CLASS(AClericWeapon, false, false, false, false) -IMPLEMENT_CLASS(AMageWeapon, false, false, false, false) +IMPLEMENT_CLASS(AFighterWeapon, false, false) +IMPLEMENT_CLASS(AClericWeapon, false, false) +IMPLEMENT_CLASS(AMageWeapon, false, false) static FRandom pr_fpatk ("FPunchAttack"); diff --git a/src/g_hexen/a_fighterquietus.cpp b/src/g_hexen/a_fighterquietus.cpp index adba8d235..458d1415b 100644 --- a/src/g_hexen/a_fighterquietus.cpp +++ b/src/g_hexen/a_fighterquietus.cpp @@ -59,7 +59,7 @@ public: int DoSpecialDamage(AActor *victim, int damage, FName damagetype); }; -IMPLEMENT_CLASS(AFSwordMissile, false, false, false, false) +IMPLEMENT_CLASS(AFSwordMissile, false, false) int AFSwordMissile::DoSpecialDamage(AActor *victim, int damage, FName damagetype) { diff --git a/src/g_hexen/a_flechette.cpp b/src/g_hexen/a_flechette.cpp index 335842887..77917c402 100644 --- a/src/g_hexen/a_flechette.cpp +++ b/src/g_hexen/a_flechette.cpp @@ -24,7 +24,7 @@ DECLARE_ACTION(A_CheckThrowBomb) // Poison Bag Artifact (Flechette) ------------------------------------------ -IMPLEMENT_CLASS(AArtiPoisonBag, false, false, false, false) +IMPLEMENT_CLASS(AArtiPoisonBag, false, false) // Poison Bag 1 (The Cleric's) ---------------------------------------------- @@ -35,7 +35,7 @@ public: bool Use (bool pickup); }; -IMPLEMENT_CLASS(AArtiPoisonBag1, false, false, false, false) +IMPLEMENT_CLASS(AArtiPoisonBag1, false, false) bool AArtiPoisonBag1::Use (bool pickup) { @@ -60,7 +60,7 @@ public: bool Use (bool pickup); }; -IMPLEMENT_CLASS(AArtiPoisonBag2, false, false, false, false) +IMPLEMENT_CLASS(AArtiPoisonBag2, false, false) bool AArtiPoisonBag2::Use (bool pickup) { @@ -85,7 +85,7 @@ public: bool Use (bool pickup); }; -IMPLEMENT_CLASS(AArtiPoisonBag3, false, false, false, false) +IMPLEMENT_CLASS(AArtiPoisonBag3, false, false) bool AArtiPoisonBag3::Use (bool pickup) { @@ -136,7 +136,7 @@ public: bool Use (bool pickup); }; -IMPLEMENT_CLASS(AArtiPoisonBagGiver, false, false, false, false) +IMPLEMENT_CLASS(AArtiPoisonBagGiver, false, false) bool AArtiPoisonBagGiver::Use (bool pickup) { @@ -167,7 +167,7 @@ public: bool Use (bool pickup); }; -IMPLEMENT_CLASS(AArtiPoisonBagShooter, false, false, false, false) +IMPLEMENT_CLASS(AArtiPoisonBagShooter, false, false) bool AArtiPoisonBagShooter::Use (bool pickup) { @@ -296,7 +296,7 @@ public: void BeginPlay (); }; -IMPLEMENT_CLASS(APoisonCloud, false, false, false, false) +IMPLEMENT_CLASS(APoisonCloud, false, false) void APoisonCloud::BeginPlay () { diff --git a/src/g_hexen/a_healingradius.cpp b/src/g_hexen/a_healingradius.cpp index 25efbc3ca..bf18a7e0e 100644 --- a/src/g_hexen/a_healingradius.cpp +++ b/src/g_hexen/a_healingradius.cpp @@ -25,7 +25,7 @@ public: bool Use (bool pickup); }; -IMPLEMENT_CLASS(AArtiHealingRadius, false, false, false, false) +IMPLEMENT_CLASS(AArtiHealingRadius, false, false) bool AArtiHealingRadius::Use (bool pickup) { diff --git a/src/g_hexen/a_heresiarch.cpp b/src/g_hexen/a_heresiarch.cpp index 32ad9ab69..a53d9926d 100644 --- a/src/g_hexen/a_heresiarch.cpp +++ b/src/g_hexen/a_heresiarch.cpp @@ -72,7 +72,7 @@ public: void Die (AActor *source, AActor *inflictor, int dmgflags); }; -IMPLEMENT_CLASS(AHeresiarch, false, false, false, false) +IMPLEMENT_CLASS(AHeresiarch, false, false) void AHeresiarch::Serialize(FSerializer &arc) { @@ -122,7 +122,7 @@ public: } }; -IMPLEMENT_CLASS(ASorcBall, false, false, false, false) +IMPLEMENT_CLASS(ASorcBall, false, false) // First ball (purple) - fires projectiles ---------------------------------- @@ -140,7 +140,7 @@ public: virtual void CastSorcererSpell (); }; -IMPLEMENT_CLASS(ASorcBall1, false, false, false, false) +IMPLEMENT_CLASS(ASorcBall1, false, false) // Second ball (blue) - generates the shield -------------------------------- @@ -156,7 +156,7 @@ public: virtual void CastSorcererSpell (); }; -IMPLEMENT_CLASS(ASorcBall2, false, false, false, false) +IMPLEMENT_CLASS(ASorcBall2, false, false) // Third ball (green) - summons Bishops ------------------------------------- @@ -172,7 +172,7 @@ public: virtual void CastSorcererSpell (); }; -IMPLEMENT_CLASS(ASorcBall3, false, false, false, false) +IMPLEMENT_CLASS(ASorcBall3, false, false) // Sorcerer spell 1 (The burning, bouncing head thing) ---------------------- diff --git a/src/g_hexen/a_hexenspecialdecs.cpp b/src/g_hexen/a_hexenspecialdecs.cpp index 0dcdc2c5f..1745e6efc 100644 --- a/src/g_hexen/a_hexenspecialdecs.cpp +++ b/src/g_hexen/a_hexenspecialdecs.cpp @@ -121,7 +121,7 @@ public: void PostBeginPlay (); }; -IMPLEMENT_CLASS(AZCorpseLynchedNoHeart, false, false, false, false) +IMPLEMENT_CLASS(AZCorpseLynchedNoHeart, false, false) void AZCorpseLynchedNoHeart::PostBeginPlay () { @@ -329,7 +329,7 @@ public: void Activate (AActor *activator); }; -IMPLEMENT_CLASS(AZBell, false, false, false, false) +IMPLEMENT_CLASS(AZBell, false, false) void AZBell::Activate (AActor *activator) { diff --git a/src/g_hexen/a_magecone.cpp b/src/g_hexen/a_magecone.cpp index da53a829c..102f68155 100644 --- a/src/g_hexen/a_magecone.cpp +++ b/src/g_hexen/a_magecone.cpp @@ -32,7 +32,7 @@ public: int DoSpecialDamage (AActor *victim, int damage, FName damagetype); }; -IMPLEMENT_CLASS(AFrostMissile, false, false, false, false) +IMPLEMENT_CLASS(AFrostMissile, false, false) int AFrostMissile::DoSpecialDamage (AActor *victim, int damage, FName damagetype) { diff --git a/src/g_hexen/a_magelightning.cpp b/src/g_hexen/a_magelightning.cpp index 2a744db75..d5fcef880 100644 --- a/src/g_hexen/a_magelightning.cpp +++ b/src/g_hexen/a_magelightning.cpp @@ -34,7 +34,7 @@ public: int SpecialMissileHit (AActor *victim); }; -IMPLEMENT_CLASS(ALightning, false, false, false, false) +IMPLEMENT_CLASS(ALightning, false, false) int ALightning::SpecialMissileHit (AActor *thing) { @@ -87,7 +87,7 @@ public: int SpecialMissileHit (AActor *thing); }; -IMPLEMENT_CLASS(ALightningZap, false, false, false, false) +IMPLEMENT_CLASS(ALightningZap, false, false) int ALightningZap::SpecialMissileHit (AActor *thing) { diff --git a/src/g_hexen/a_magestaff.cpp b/src/g_hexen/a_magestaff.cpp index 0b78bd279..78d9edec0 100644 --- a/src/g_hexen/a_magestaff.cpp +++ b/src/g_hexen/a_magestaff.cpp @@ -56,7 +56,7 @@ public: BYTE MStaffCount; }; -IMPLEMENT_CLASS(AMWeapBloodscourge, false, false, false, false) +IMPLEMENT_CLASS(AMWeapBloodscourge, false, false) // Mage Staff FX2 (Bloodscourge) -------------------------------------------- @@ -68,7 +68,7 @@ public: bool SpecialBlastHandling (AActor *source, double strength); }; -IMPLEMENT_CLASS(AMageStaffFX2, false, false, false, false) +IMPLEMENT_CLASS(AMageStaffFX2, false, false) int AMageStaffFX2::SpecialMissileHit (AActor *victim) { diff --git a/src/g_hexen/a_spike.cpp b/src/g_hexen/a_spike.cpp index be28e38df..cd0d2e891 100644 --- a/src/g_hexen/a_spike.cpp +++ b/src/g_hexen/a_spike.cpp @@ -26,7 +26,7 @@ public: void Deactivate (AActor *activator); }; -IMPLEMENT_CLASS(AThrustFloor, false, false, false, false) +IMPLEMENT_CLASS(AThrustFloor, false, false) void AThrustFloor::Activate (AActor *activator) { diff --git a/src/g_hexen/a_summon.cpp b/src/g_hexen/a_summon.cpp index 7c0746c91..58e50eeaf 100644 --- a/src/g_hexen/a_summon.cpp +++ b/src/g_hexen/a_summon.cpp @@ -21,7 +21,7 @@ public: bool Use (bool pickup); }; -IMPLEMENT_CLASS(AArtiDarkServant, false, false, false, false) +IMPLEMENT_CLASS(AArtiDarkServant, false, false) //============================================================================ // diff --git a/src/g_hexen/a_teleportother.cpp b/src/g_hexen/a_teleportother.cpp index 4eeba53f9..0e7dd018d 100644 --- a/src/g_hexen/a_teleportother.cpp +++ b/src/g_hexen/a_teleportother.cpp @@ -34,7 +34,7 @@ public: bool Use (bool pickup); }; -IMPLEMENT_CLASS(AArtiTeleportOther, false, false, false, false) +IMPLEMENT_CLASS(AArtiTeleportOther, false, false) // Teleport Other FX -------------------------------------------------------- @@ -45,7 +45,7 @@ public: int DoSpecialDamage (AActor *target, int damage, FName damagetype); }; -IMPLEMENT_CLASS(ATelOtherFX1, false, false, false, false) +IMPLEMENT_CLASS(ATelOtherFX1, false, false) static void TeloSpawn (AActor *source, const char *type) { diff --git a/src/g_level.cpp b/src/g_level.cpp index a715b5d26..904b38b8a 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -903,7 +903,7 @@ public: void Tick (); }; -IMPLEMENT_CLASS(DAutosaver, false, false, false, false) +IMPLEMENT_CLASS(DAutosaver, false, false) void DAutosaver::Tick () { diff --git a/src/g_raven/a_artitele.cpp b/src/g_raven/a_artitele.cpp index b333c9a13..76c0bc402 100644 --- a/src/g_raven/a_artitele.cpp +++ b/src/g_raven/a_artitele.cpp @@ -23,7 +23,7 @@ public: bool Use (bool pickup); }; -IMPLEMENT_CLASS(AArtiTeleport, false, false, false, false) +IMPLEMENT_CLASS(AArtiTeleport, false, false) bool AArtiTeleport::Use (bool pickup) { diff --git a/src/g_raven/a_minotaur.cpp b/src/g_raven/a_minotaur.cpp index dd4e4a8b8..cd0ab2669 100644 --- a/src/g_raven/a_minotaur.cpp +++ b/src/g_raven/a_minotaur.cpp @@ -31,7 +31,7 @@ void P_MinotaurSlam (AActor *source, AActor *target); DECLARE_ACTION(A_MinotaurLook) -IMPLEMENT_CLASS(AMinotaur, false, false, false, false) +IMPLEMENT_CLASS(AMinotaur, false, false) void AMinotaur::Tick () { @@ -72,7 +72,7 @@ int AMinotaur::DoSpecialDamage (AActor *target, int damage, FName damagetype) // Minotaur Friend ---------------------------------------------------------- -IMPLEMENT_CLASS(AMinotaurFriend, false, false, false, false) +IMPLEMENT_CLASS(AMinotaurFriend, false, false) void AMinotaurFriend::BeginPlay () { diff --git a/src/g_shared/a_action.cpp b/src/g_shared/a_action.cpp index a371e4ad5..3938a9743 100644 --- a/src/g_shared/a_action.cpp +++ b/src/g_shared/a_action.cpp @@ -28,7 +28,7 @@ public: void Deactivate (AActor *activator); }; -IMPLEMENT_CLASS(ASwitchableDecoration, false, false, false, false) +IMPLEMENT_CLASS(ASwitchableDecoration, false, false) void ASwitchableDecoration::Activate (AActor *activator) { @@ -49,7 +49,7 @@ public: void Deactivate (AActor *activator) {} }; -IMPLEMENT_CLASS(ASwitchingDecoration, false, false, false, false) +IMPLEMENT_CLASS(ASwitchingDecoration, false, false) //---------------------------------------------------------------------------- // @@ -295,7 +295,7 @@ class DCorpsePointer : public DThinker HAS_OBJECT_POINTERS public: DCorpsePointer (AActor *ptr); - void Destroy (); + void Destroy() override; void Serialize(FSerializer &arc); TObjPtr Corpse; DWORD Count; // Only the first corpse pointer's count is valid. @@ -303,7 +303,7 @@ private: DCorpsePointer () {} }; -IMPLEMENT_CLASS(DCorpsePointer, false, true, false, false) +IMPLEMENT_CLASS(DCorpsePointer, false, true) IMPLEMENT_POINTERS_START(DCorpsePointer) IMPLEMENT_POINTER(Corpse) diff --git a/src/g_shared/a_armor.cpp b/src/g_shared/a_armor.cpp index e1dd0986e..6be1472bf 100644 --- a/src/g_shared/a_armor.cpp +++ b/src/g_shared/a_armor.cpp @@ -9,11 +9,11 @@ #include "serializer.h" #include "cmdlib.h" -IMPLEMENT_CLASS(AArmor, false, false, false, false) -IMPLEMENT_CLASS(ABasicArmor, false, false, false, false) -IMPLEMENT_CLASS(ABasicArmorPickup, false, false, false, false) -IMPLEMENT_CLASS(ABasicArmorBonus, false, false, true, false) -IMPLEMENT_CLASS(AHexenArmor, false, false, false, false) +IMPLEMENT_CLASS(AArmor, false, false) +IMPLEMENT_CLASS(ABasicArmor, false, false) +IMPLEMENT_CLASS(ABasicArmorPickup, false, false) +IMPLEMENT_CLASS(ABasicArmorBonus, false, false) +IMPLEMENT_CLASS(AHexenArmor, false, false) DEFINE_FIELD(ABasicArmor, AbsorbCount) diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index bf24c8eb8..73b71e2ff 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -40,11 +40,11 @@ static FRandom pr_torch ("Torch"); #define TIMEFREEZE_TICS ( 12 * TICRATE ) */ -IMPLEMENT_CLASS(APowerup, false, false, false, false) +IMPLEMENT_CLASS(APowerup, false, false) // Powerup-Giver ------------------------------------------------------------- -IMPLEMENT_CLASS(PClassPowerupGiver, false, false, false, false) +IMPLEMENT_CLASS(PClassPowerupGiver, false, false) void PClassPowerupGiver::ReplaceClassRef(PClass *oldclass, PClass *newclass) { @@ -388,7 +388,7 @@ bool APowerup::GetNoTeleportFreeze () // Invulnerability Powerup --------------------------------------------------- -IMPLEMENT_CLASS(APowerInvulnerable, false, false, false, false) +IMPLEMENT_CLASS(APowerInvulnerable, false, false) //=========================================================================== // @@ -525,7 +525,7 @@ int APowerInvulnerable::AlterWeaponSprite (visstyle_t *vis) // Strength (aka Berserk) Powerup -------------------------------------------- -IMPLEMENT_CLASS(APowerStrength, false, false, false, false) +IMPLEMENT_CLASS(APowerStrength, false, false) //=========================================================================== // @@ -590,7 +590,7 @@ PalEntry APowerStrength::GetBlend () // Invisibility Powerup ------------------------------------------------------ -IMPLEMENT_CLASS(APowerInvisibility, false, false, false, false) +IMPLEMENT_CLASS(APowerInvisibility, false, false) // Invisibility flag combos #define INVISIBILITY_FLAGS1 (MF_SHADOW) @@ -795,7 +795,7 @@ bool APowerInvisibility::HandlePickup (AInventory *item) // Ironfeet Powerup ---------------------------------------------------------- -IMPLEMENT_CLASS(APowerIronFeet, false, false, false, false) +IMPLEMENT_CLASS(APowerIronFeet, false, false) //=========================================================================== // @@ -832,7 +832,7 @@ void APowerIronFeet::DoEffect () // Strife Environment Suit Powerup ------------------------------------------- -IMPLEMENT_CLASS(APowerMask, false, false, false, false) +IMPLEMENT_CLASS(APowerMask, false, false) //=========================================================================== // @@ -869,7 +869,7 @@ void APowerMask::DoEffect () // Light-Amp Powerup --------------------------------------------------------- -IMPLEMENT_CLASS(APowerLightAmp, false, false, false, false) +IMPLEMENT_CLASS(APowerLightAmp, false, false) //=========================================================================== // @@ -911,7 +911,7 @@ void APowerLightAmp::EndEffect () // Torch Powerup ------------------------------------------------------------- -IMPLEMENT_CLASS(APowerTorch, false, false, false, false) +IMPLEMENT_CLASS(APowerTorch, false, false) //=========================================================================== // @@ -974,7 +974,7 @@ void APowerTorch::DoEffect () // Flight (aka Wings of Wrath) powerup --------------------------------------- -IMPLEMENT_CLASS(APowerFlight, false, false, false, false) +IMPLEMENT_CLASS(APowerFlight, false, false) //=========================================================================== // @@ -1114,7 +1114,7 @@ bool APowerFlight::DrawPowerup (int x, int y) // Weapon Level 2 (aka Tome of Power) Powerup -------------------------------- -IMPLEMENT_CLASS(APowerWeaponLevel2, false, false, false, false) +IMPLEMENT_CLASS(APowerWeaponLevel2, false, false) //=========================================================================== // @@ -1198,7 +1198,7 @@ void APowerWeaponLevel2::EndEffect () // Speed Powerup ------------------------------------------------------------- -IMPLEMENT_CLASS(APowerSpeed, false, false, false, false) +IMPLEMENT_CLASS(APowerSpeed, false, false) DEFINE_FIELD(APowerSpeed, SpeedFlags) @@ -1287,11 +1287,11 @@ void APowerSpeed::DoEffect () // Minotaur (aka Dark Servant) powerup --------------------------------------- -IMPLEMENT_CLASS(APowerMinotaur, false, false, false, false) +IMPLEMENT_CLASS(APowerMinotaur, false, false) // Targeter powerup --------------------------------------------------------- -IMPLEMENT_CLASS(APowerTargeter, false, false, false, false) +IMPLEMENT_CLASS(APowerTargeter, false, false) void APowerTargeter::Travelled () { @@ -1406,7 +1406,7 @@ void APowerTargeter::PositionAccuracy () // Frightener Powerup -------------------------------- -IMPLEMENT_CLASS(APowerFrightener, false, false, false, false) +IMPLEMENT_CLASS(APowerFrightener, false, false) //=========================================================================== // @@ -1442,7 +1442,7 @@ void APowerFrightener::EndEffect () // Buddha Powerup -------------------------------- -IMPLEMENT_CLASS(APowerBuddha, false, false, false, false) +IMPLEMENT_CLASS(APowerBuddha, false, false) //=========================================================================== // @@ -1478,11 +1478,11 @@ void APowerBuddha::EndEffect () // Scanner powerup ---------------------------------------------------------- -IMPLEMENT_CLASS(APowerScanner, false, false, false, false) +IMPLEMENT_CLASS(APowerScanner, false, false) // Time freezer powerup ----------------------------------------------------- -IMPLEMENT_CLASS( APowerTimeFreezer, false, false, false, false) +IMPLEMENT_CLASS( APowerTimeFreezer, false, false) //=========================================================================== // @@ -1609,7 +1609,7 @@ void APowerTimeFreezer::EndEffect() // Damage powerup ------------------------------------------------------ -IMPLEMENT_CLASS(APowerDamage, false, false, false, false) +IMPLEMENT_CLASS(APowerDamage, false, false) //=========================================================================== // @@ -1666,7 +1666,7 @@ void APowerDamage::ModifyDamage(int damage, FName damageType, int &newdamage, bo // Quarter damage powerup ------------------------------------------------------ -IMPLEMENT_CLASS(APowerProtection, false, false, false, false) +IMPLEMENT_CLASS(APowerProtection, false, false) #define PROTECTION_FLAGS3 (MF3_NORADIUSDMG | MF3_DONTMORPH | MF3_DONTSQUASH | MF3_DONTBLAST | MF3_NOTELEOTHER) #define PROTECTION_FLAGS5 (MF5_NOPAIN | MF5_DONTRIP) @@ -1744,7 +1744,7 @@ void APowerProtection::ModifyDamage(int damage, FName damageType, int &newdamage // Drain rune ------------------------------------------------------- -IMPLEMENT_CLASS(APowerDrain, false, false, false, false) +IMPLEMENT_CLASS(APowerDrain, false, false) //=========================================================================== // @@ -1784,7 +1784,7 @@ void APowerDrain::EndEffect( ) // Regeneration rune ------------------------------------------------------- -IMPLEMENT_CLASS(APowerRegeneration, false, false, false, false) +IMPLEMENT_CLASS(APowerRegeneration, false, false) //=========================================================================== // @@ -1806,7 +1806,7 @@ void APowerRegeneration::DoEffect() // High jump rune ------------------------------------------------------- -IMPLEMENT_CLASS(APowerHighJump, false, false, false, false) +IMPLEMENT_CLASS(APowerHighJump, false, false) //=========================================================================== // @@ -1844,7 +1844,7 @@ void APowerHighJump::EndEffect( ) // Double firing speed rune --------------------------------------------- -IMPLEMENT_CLASS(APowerDoubleFiringSpeed, false, false, false, false) +IMPLEMENT_CLASS(APowerDoubleFiringSpeed, false, false) //=========================================================================== // @@ -1882,7 +1882,7 @@ void APowerDoubleFiringSpeed::EndEffect( ) // Morph powerup ------------------------------------------------------ -IMPLEMENT_CLASS(APowerMorph, false, false, false, false) +IMPLEMENT_CLASS(APowerMorph, false, false) DEFINE_FIELD(APowerMorph, PlayerClass) DEFINE_FIELD(APowerMorph, MorphFlash) @@ -1990,7 +1990,7 @@ void APowerMorph::EndEffect( ) // Infinite Ammo Powerup ----------------------------------------------------- -IMPLEMENT_CLASS(APowerInfiniteAmmo, false, false, false, false) +IMPLEMENT_CLASS(APowerInfiniteAmmo, false, false) //=========================================================================== // diff --git a/src/g_shared/a_artifacts.h b/src/g_shared/a_artifacts.h index d9629c165..95de95086 100644 --- a/src/g_shared/a_artifacts.h +++ b/src/g_shared/a_artifacts.h @@ -12,7 +12,7 @@ class APowerup : public AInventory DECLARE_CLASS (APowerup, AInventory) public: virtual void Tick (); - virtual void Destroy (); + virtual void Destroy () override; virtual bool HandlePickup (AInventory *item); virtual AInventory *CreateCopy (AActor *other); virtual AInventory *CreateTossable (); diff --git a/src/g_shared/a_bridge.cpp b/src/g_shared/a_bridge.cpp index c4b452f77..556767f37 100644 --- a/src/g_shared/a_bridge.cpp +++ b/src/g_shared/a_bridge.cpp @@ -37,10 +37,10 @@ class ACustomBridge : public AActor DECLARE_CLASS (ACustomBridge, AActor) public: void BeginPlay (); - void Destroy(); + void Destroy() override; }; -IMPLEMENT_CLASS(ACustomBridge, false, false, false, false) +IMPLEMENT_CLASS(ACustomBridge, false, false) void ACustomBridge::BeginPlay () { @@ -155,7 +155,7 @@ public: void BeginPlay (); }; -IMPLEMENT_CLASS(AInvisibleBridge, false, false, false, false) +IMPLEMENT_CLASS(AInvisibleBridge, false, false) void AInvisibleBridge::BeginPlay () { diff --git a/src/g_shared/a_camera.cpp b/src/g_shared/a_camera.cpp index ae34c3cbc..a0bc40ce3 100644 --- a/src/g_shared/a_camera.cpp +++ b/src/g_shared/a_camera.cpp @@ -64,7 +64,7 @@ protected: DAngle Range; }; -IMPLEMENT_CLASS(ASecurityCamera, false, false, false, false) +IMPLEMENT_CLASS(ASecurityCamera, false, false) void ASecurityCamera::Serialize(FSerializer &arc) { @@ -124,7 +124,7 @@ protected: DAngle MaxPitchChange; }; -IMPLEMENT_CLASS(AAimingCamera, false, false, false, false) +IMPLEMENT_CLASS(AAimingCamera, false, false) void AAimingCamera::Serialize(FSerializer &arc) { diff --git a/src/g_shared/a_debris.cpp b/src/g_shared/a_debris.cpp index d3d69d7f6..0932088c2 100644 --- a/src/g_shared/a_debris.cpp +++ b/src/g_shared/a_debris.cpp @@ -23,5 +23,5 @@ public: } }; -IMPLEMENT_CLASS(AGlassShard, false, false, false, false) +IMPLEMENT_CLASS(AGlassShard, false, false) diff --git a/src/g_shared/a_decals.cpp b/src/g_shared/a_decals.cpp index 06563f995..bfbe6d13d 100644 --- a/src/g_shared/a_decals.cpp +++ b/src/g_shared/a_decals.cpp @@ -58,14 +58,14 @@ static int ImpactCount; CVAR (Bool, cl_spreaddecals, true, CVAR_ARCHIVE) -IMPLEMENT_CLASS(DBaseDecal, false, true, false, false) +IMPLEMENT_CLASS(DBaseDecal, false, true) IMPLEMENT_POINTERS_START(DBaseDecal) IMPLEMENT_POINTER(WallPrev) IMPLEMENT_POINTER(WallNext) IMPLEMENT_POINTERS_END -IMPLEMENT_CLASS(DImpactDecal, false, false, false, false) +IMPLEMENT_CLASS(DImpactDecal, false, false) DBaseDecal::DBaseDecal () : DThinker(STAT_DECAL), @@ -746,7 +746,7 @@ public: void BeginPlay (); }; -IMPLEMENT_CLASS(ADecal, false, false, false, false) +IMPLEMENT_CLASS(ADecal, false, false) void ADecal::BeginPlay () { diff --git a/src/g_shared/a_fastprojectile.cpp b/src/g_shared/a_fastprojectile.cpp index 1ded466a9..c68fa800c 100644 --- a/src/g_shared/a_fastprojectile.cpp +++ b/src/g_shared/a_fastprojectile.cpp @@ -8,7 +8,7 @@ #include "p_checkposition.h" #include "virtual.h" -IMPLEMENT_CLASS(AFastProjectile, false, false, false, false) +IMPLEMENT_CLASS(AFastProjectile, false, false) //---------------------------------------------------------------------------- @@ -135,11 +135,13 @@ void AFastProjectile::Tick () ripcount = count >> 3; // call the scripted 'Effect' method. - VINDEX(AFastProjectile, Effect); - // Without the type cast this picks the 'void *' assignment... - VMValue params[1] = { (DObject*)this }; - VMFrameStack stack; - stack.Call(VFUNC, params, 1, nullptr, 0, nullptr); + IFVIRTUAL(AFastProjectile, Effect) + { + // Without the type cast this picks the 'void *' assignment... + VMValue params[1] = { (DObject*)this }; + VMFrameStack stack; + stack.Call(func, params, 1, nullptr, 0, nullptr); + } } } } diff --git a/src/g_shared/a_flashfader.cpp b/src/g_shared/a_flashfader.cpp index 8602f7a86..3e0b939e0 100644 --- a/src/g_shared/a_flashfader.cpp +++ b/src/g_shared/a_flashfader.cpp @@ -3,7 +3,7 @@ #include "d_player.h" #include "serializer.h" -IMPLEMENT_CLASS(DFlashFader, false, true, false, false) +IMPLEMENT_CLASS(DFlashFader, false, true) IMPLEMENT_POINTERS_START(DFlashFader) IMPLEMENT_POINTER(ForWho) diff --git a/src/g_shared/a_fountain.cpp b/src/g_shared/a_fountain.cpp index e89745fc7..7d7e2e412 100644 --- a/src/g_shared/a_fountain.cpp +++ b/src/g_shared/a_fountain.cpp @@ -46,13 +46,13 @@ public: void Deactivate (AActor *activator); }; -IMPLEMENT_CLASS(AParticleFountain, false, false, false, false) +IMPLEMENT_CLASS(AParticleFountain, false, false) void AParticleFountain::PostBeginPlay () { Super::PostBeginPlay (); if (!(SpawnFlags & MTF_DORMANT)) - Activate (NULL); + CallActivate (NULL); } void AParticleFountain::Activate (AActor *activator) diff --git a/src/g_shared/a_hatetarget.cpp b/src/g_shared/a_hatetarget.cpp index 7d25bdb31..8d5b0fa72 100644 --- a/src/g_shared/a_hatetarget.cpp +++ b/src/g_shared/a_hatetarget.cpp @@ -46,7 +46,7 @@ public: int TakeSpecialDamage(AActor *inflictor, AActor *source, int damage, FName damagetype); }; -IMPLEMENT_CLASS(AHateTarget, false, false, false, false) +IMPLEMENT_CLASS(AHateTarget, false, false) void AHateTarget::BeginPlay() { diff --git a/src/g_shared/a_keys.cpp b/src/g_shared/a_keys.cpp index 538e26090..51962c1b0 100644 --- a/src/g_shared/a_keys.cpp +++ b/src/g_shared/a_keys.cpp @@ -470,7 +470,7 @@ bool P_CheckKeys (AActor *owner, int keynum, bool remote) // //========================================================================== -IMPLEMENT_CLASS(AKey, false, false, false, false) +IMPLEMENT_CLASS(AKey, false, false) DEFINE_FIELD(AKey, KeyNumber) diff --git a/src/g_shared/a_lightning.cpp b/src/g_shared/a_lightning.cpp index f00560fc8..3f44f2fdd 100644 --- a/src/g_shared/a_lightning.cpp +++ b/src/g_shared/a_lightning.cpp @@ -13,7 +13,7 @@ static FRandom pr_lightning ("Lightning"); -IMPLEMENT_CLASS(DLightningThinker, false, false, false, false) +IMPLEMENT_CLASS(DLightningThinker, false, false) DLightningThinker::DLightningThinker () : DThinker (STAT_LIGHTNING) diff --git a/src/g_shared/a_mapmarker.cpp b/src/g_shared/a_mapmarker.cpp index d874042c5..524bfca44 100644 --- a/src/g_shared/a_mapmarker.cpp +++ b/src/g_shared/a_mapmarker.cpp @@ -51,7 +51,7 @@ // //-------------------------------------------------------------------------- -IMPLEMENT_CLASS(AMapMarker, false, false, false, false) +IMPLEMENT_CLASS(AMapMarker, false, false) void AMapMarker::BeginPlay () { diff --git a/src/g_shared/a_morph.cpp b/src/g_shared/a_morph.cpp index 84de5a0d6..5514ae413 100644 --- a/src/g_shared/a_morph.cpp +++ b/src/g_shared/a_morph.cpp @@ -616,7 +616,7 @@ void InitAllPowerupEffects(AInventory *item) // Base class for morphing projectiles -------------------------------------- -IMPLEMENT_CLASS(AMorphProjectile, false, false, false, false) +IMPLEMENT_CLASS(AMorphProjectile, false, false) DEFINE_FIELD(AMorphProjectile, PlayerClass) DEFINE_FIELD(AMorphProjectile, MonsterClass) @@ -653,7 +653,7 @@ void AMorphProjectile::Serialize(FSerializer &arc) // Morphed Monster (you must subclass this to do something useful) --------- -IMPLEMENT_CLASS(AMorphedMonster, false, true, false, false) +IMPLEMENT_CLASS(AMorphedMonster, false, true) IMPLEMENT_POINTERS_START(AMorphedMonster) IMPLEMENT_POINTER(UnmorphedMe) diff --git a/src/g_shared/a_movingcamera.cpp b/src/g_shared/a_movingcamera.cpp index 030f5d368..a1ffe5dc6 100644 --- a/src/g_shared/a_movingcamera.cpp +++ b/src/g_shared/a_movingcamera.cpp @@ -66,7 +66,7 @@ public: TObjPtr Next; }; -IMPLEMENT_CLASS(AInterpolationPoint, false, true, false, false) +IMPLEMENT_CLASS(AInterpolationPoint, false, true) IMPLEMENT_POINTERS_START(AInterpolationPoint) IMPLEMENT_POINTER(Next) @@ -135,7 +135,7 @@ public: void Tick () {} // Does absolutely nothing itself }; -IMPLEMENT_CLASS(AInterpolationSpecial, false, false, false, false) +IMPLEMENT_CLASS(AInterpolationSpecial, false, false) /* == PathFollower: something that follows a camera path @@ -178,7 +178,7 @@ protected: int HoldTime; }; -IMPLEMENT_CLASS(APathFollower, false, true, false, false) +IMPLEMENT_CLASS(APathFollower, false, true) IMPLEMENT_POINTERS_START(APathFollower) IMPLEMENT_POINTER(PrevNode) @@ -342,9 +342,9 @@ void APathFollower::Tick () if (CurrNode != NULL) NewNode (); if (CurrNode == NULL || CurrNode->Next == NULL) - Deactivate (this); + CallDeactivate (this); if ((args[2] & 1) == 0 && CurrNode->Next->Next == NULL) - Deactivate (this); + CallDeactivate (this); } } } @@ -480,7 +480,7 @@ protected: bool Interpolate (); }; -IMPLEMENT_CLASS(AActorMover, false, false, false, false) +IMPLEMENT_CLASS(AActorMover, false, false) void AActorMover::BeginPlay() { @@ -596,7 +596,7 @@ protected: TObjPtr Activator; }; -IMPLEMENT_CLASS(AMovingCamera, false, true, false, false) +IMPLEMENT_CLASS(AMovingCamera, false, true) IMPLEMENT_POINTERS_START(AMovingCamera) IMPLEMENT_POINTER(Activator) diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index c6475cc74..16a63a2ff 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -23,7 +23,7 @@ static FRandom pr_restore ("RestorePos"); -IMPLEMENT_CLASS(PClassInventory, false, false, false, false) +IMPLEMENT_CLASS(PClassInventory, false, false) PClassInventory::PClassInventory() { @@ -70,7 +70,7 @@ void PClassInventory::Finalize(FStateDefinitions &statedef) ((AActor*)Defaults)->flags |= MF_SPECIAL; } -IMPLEMENT_CLASS(PClassAmmo, false, false, false, false) +IMPLEMENT_CLASS(PClassAmmo, false, false) PClassAmmo::PClassAmmo() { @@ -86,7 +86,7 @@ void PClassAmmo::DeriveData(PClass *newclass) newc->DropAmount = DropAmount; } -IMPLEMENT_CLASS(AAmmo, false, false, false, false) +IMPLEMENT_CLASS(AAmmo, false, false) DEFINE_FIELD(AAmmo, BackpackAmount) DEFINE_FIELD(AAmmo, BackpackMaxAmount) @@ -480,7 +480,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition) int AInventory::StaticLastMessageTic; const char *AInventory::StaticLastMessage; -IMPLEMENT_CLASS(AInventory, false, true, false, false) +IMPLEMENT_CLASS(AInventory, false, true) IMPLEMENT_POINTERS_START(AInventory) IMPLEMENT_POINTER(Owner) @@ -1378,7 +1378,7 @@ bool AInventory::DrawPowerup (int x, int y) /* AArtifact implementation */ /***************************************************************************/ -IMPLEMENT_CLASS(APowerupGiver, false, false, false, false) +IMPLEMENT_CLASS(APowerupGiver, false, false) //=========================================================================== // @@ -1679,8 +1679,8 @@ void AInventory::DetachFromOwner () { } -IMPLEMENT_CLASS(AStateProvider, false, false, false, false) -IMPLEMENT_CLASS(ACustomInventory, false, false, false, false) +IMPLEMENT_CLASS(AStateProvider, false, false) +IMPLEMENT_CLASS(ACustomInventory, false, false) //=========================================================================== // @@ -1725,7 +1725,7 @@ bool ACustomInventory::TryPickup (AActor *&toucher) return useok; } -IMPLEMENT_CLASS(PClassHealth, false, false, false, false) +IMPLEMENT_CLASS(PClassHealth, false, false) //=========================================================================== // @@ -1754,7 +1754,7 @@ void PClassHealth::DeriveData(PClass *newclass) newc->LowHealthMessage = LowHealthMessage; } -IMPLEMENT_CLASS(AHealth, false, false, false, false) +IMPLEMENT_CLASS(AHealth, false, false) DEFINE_FIELD(AHealth, PrevHealth) @@ -1799,7 +1799,7 @@ bool AHealth::TryPickup (AActor *&other) return false; } -IMPLEMENT_CLASS(AHealthPickup, false, false, false, false) +IMPLEMENT_CLASS(AHealthPickup, false, false) DEFINE_FIELD(AHealthPickup, autousemode) @@ -1879,7 +1879,7 @@ void AHealthPickup::Serialize(FSerializer &arc) // Backpack ----------------------------------------------------------------- -IMPLEMENT_CLASS(ABackpackItem, false, false, false, false) +IMPLEMENT_CLASS(ABackpackItem, false, false) DEFINE_FIELD(ABackpackItem, bDepleted) @@ -2058,7 +2058,7 @@ void ABackpackItem::DetachFromOwner () // //=========================================================================== -IMPLEMENT_CLASS(AMapRevealer, false, false, false, false) +IMPLEMENT_CLASS(AMapRevealer, false, false) //=========================================================================== // @@ -2083,7 +2083,7 @@ bool AMapRevealer::TryPickup (AActor *&toucher) // //=========================================================================== -IMPLEMENT_CLASS(AScoreItem, false, false, false, false) +IMPLEMENT_CLASS(AScoreItem, false, false) //=========================================================================== // diff --git a/src/g_shared/a_pickups.h b/src/g_shared/a_pickups.h index ec34404df..bf4af5a63 100644 --- a/src/g_shared/a_pickups.h +++ b/src/g_shared/a_pickups.h @@ -159,7 +159,7 @@ public: virtual void MarkPrecacheSounds() const; virtual void BeginPlay (); - virtual void Destroy (); + virtual void Destroy () override; virtual void DepleteOrDestroy (); virtual void Tick (); virtual bool ShouldRespawn (); @@ -331,7 +331,7 @@ public: virtual bool TryPickupRestricted (AActor *&toucher); virtual bool PickupForAmmo (AWeapon *ownedWeapon); virtual bool Use (bool pickup); - virtual void Destroy(); + virtual void Destroy() override; virtual FState *GetUpState (); virtual FState *GetDownState (); diff --git a/src/g_shared/a_puzzleitems.cpp b/src/g_shared/a_puzzleitems.cpp index 640d5517d..0d63bb00c 100644 --- a/src/g_shared/a_puzzleitems.cpp +++ b/src/g_shared/a_puzzleitems.cpp @@ -8,7 +8,7 @@ #include "doomstat.h" #include "v_font.h" -IMPLEMENT_CLASS(PClassPuzzleItem, false, false, false, false) +IMPLEMENT_CLASS(PClassPuzzleItem, false, false) void PClassPuzzleItem::DeriveData(PClass *newclass) { @@ -17,7 +17,7 @@ void PClassPuzzleItem::DeriveData(PClass *newclass) static_cast(newclass)->PuzzFailMessage = PuzzFailMessage; } -IMPLEMENT_CLASS(APuzzleItem, false, false, false, false) +IMPLEMENT_CLASS(APuzzleItem, false, false) DEFINE_FIELD(APuzzleItem, PuzzleItemNumber) diff --git a/src/g_shared/a_quake.cpp b/src/g_shared/a_quake.cpp index 80a53ee08..96a932d4f 100644 --- a/src/g_shared/a_quake.cpp +++ b/src/g_shared/a_quake.cpp @@ -14,7 +14,7 @@ static FRandom pr_quake ("Quake"); -IMPLEMENT_CLASS(DEarthquake, false, true, false, false) +IMPLEMENT_CLASS(DEarthquake, false, true) IMPLEMENT_POINTERS_START(DEarthquake) IMPLEMENT_POINTER(m_Spot) diff --git a/src/g_shared/a_randomspawner.cpp b/src/g_shared/a_randomspawner.cpp index 40fdd0745..0cecfd115 100644 --- a/src/g_shared/a_randomspawner.cpp +++ b/src/g_shared/a_randomspawner.cpp @@ -230,4 +230,4 @@ class ARandomSpawner : public AActor }; -IMPLEMENT_CLASS(ARandomSpawner, false, false, false, false) +IMPLEMENT_CLASS(ARandomSpawner, false, false) diff --git a/src/g_shared/a_secrettrigger.cpp b/src/g_shared/a_secrettrigger.cpp index 372cef07d..509ec47e9 100644 --- a/src/g_shared/a_secrettrigger.cpp +++ b/src/g_shared/a_secrettrigger.cpp @@ -50,7 +50,7 @@ public: void Activate (AActor *activator); }; -IMPLEMENT_CLASS(ASecretTrigger, false, false, false, false) +IMPLEMENT_CLASS(ASecretTrigger, false, false) void ASecretTrigger::PostBeginPlay () { diff --git a/src/g_shared/a_sectoraction.cpp b/src/g_shared/a_sectoraction.cpp index 61a69b1b3..2d7037551 100644 --- a/src/g_shared/a_sectoraction.cpp +++ b/src/g_shared/a_sectoraction.cpp @@ -37,7 +37,7 @@ // The base class for sector actions ---------------------------------------- -IMPLEMENT_CLASS(ASectorAction, false, false, false, false) +IMPLEMENT_CLASS(ASectorAction, false, false) ASectorAction::ASectorAction (bool activatedByUse) : ActivatedByUse (activatedByUse) {} @@ -142,7 +142,7 @@ public: bool DoTriggerAction (AActor *triggerer, int activationType); }; -IMPLEMENT_CLASS(ASecActEnter, false, false, false, false) +IMPLEMENT_CLASS(ASecActEnter, false, false) bool ASecActEnter::DoTriggerAction (AActor *triggerer, int activationType) @@ -160,7 +160,7 @@ public: bool DoTriggerAction (AActor *triggerer, int activationType); }; -IMPLEMENT_CLASS(ASecActExit, false, false, false, false) +IMPLEMENT_CLASS(ASecActExit, false, false) bool ASecActExit::DoTriggerAction (AActor *triggerer, int activationType) @@ -181,7 +181,7 @@ public: // Skull Tag uses 9999 for a special that is triggered whenever // the player is on the sector's floor. I think this is more useful. -IMPLEMENT_CLASS(ASecActHitFloor, false, false, false, false) +IMPLEMENT_CLASS(ASecActHitFloor, false, false) bool ASecActHitFloor::DoTriggerAction (AActor *triggerer, int activationType) @@ -199,7 +199,7 @@ public: bool DoTriggerAction (AActor *triggerer, int activationType); }; -IMPLEMENT_CLASS(ASecActHitCeil, false, false, false, false) +IMPLEMENT_CLASS(ASecActHitCeil, false, false) bool ASecActHitCeil::DoTriggerAction (AActor *triggerer, int activationType) @@ -218,7 +218,7 @@ public: bool DoTriggerAction (AActor *triggerer, int activationType); }; -IMPLEMENT_CLASS(ASecActUse, false, false, false, false) +IMPLEMENT_CLASS(ASecActUse, false, false) bool ASecActUse::DoTriggerAction (AActor *triggerer, int activationType) @@ -237,7 +237,7 @@ public: bool DoTriggerAction (AActor *triggerer, int activationType); }; -IMPLEMENT_CLASS(ASecActUseWall, false, false, false, false) +IMPLEMENT_CLASS(ASecActUseWall, false, false) bool ASecActUseWall::DoTriggerAction (AActor *triggerer, int activationType) @@ -255,7 +255,7 @@ public: bool DoTriggerAction (AActor *triggerer, int activationType); }; -IMPLEMENT_CLASS(ASecActEyesDive, false, false, false, false) +IMPLEMENT_CLASS(ASecActEyesDive, false, false) bool ASecActEyesDive::DoTriggerAction (AActor *triggerer, int activationType) @@ -273,7 +273,7 @@ public: bool DoTriggerAction (AActor *triggerer, int activationType); }; -IMPLEMENT_CLASS(ASecActEyesSurface, false, false, false, false) +IMPLEMENT_CLASS(ASecActEyesSurface, false, false) bool ASecActEyesSurface::DoTriggerAction (AActor *triggerer, int activationType) @@ -291,7 +291,7 @@ public: bool DoTriggerAction (AActor *triggerer, int activationType); }; -IMPLEMENT_CLASS(ASecActEyesBelowC, false, false, false, false) +IMPLEMENT_CLASS(ASecActEyesBelowC, false, false) bool ASecActEyesBelowC::DoTriggerAction (AActor *triggerer, int activationType) @@ -309,7 +309,7 @@ public: bool DoTriggerAction (AActor *triggerer, int activationType); }; -IMPLEMENT_CLASS(ASecActEyesAboveC, false, false, false, false) +IMPLEMENT_CLASS(ASecActEyesAboveC, false, false) bool ASecActEyesAboveC::DoTriggerAction (AActor *triggerer, int activationType) @@ -327,7 +327,7 @@ public: bool DoTriggerAction (AActor *triggerer, int activationType); }; -IMPLEMENT_CLASS(ASecActHitFakeFloor, false, false, false, false) +IMPLEMENT_CLASS(ASecActHitFakeFloor, false, false) bool ASecActHitFakeFloor::DoTriggerAction (AActor *triggerer, int activationType) diff --git a/src/g_shared/a_setcolor.cpp b/src/g_shared/a_setcolor.cpp index 585b9fcf6..e8a11b850 100644 --- a/src/g_shared/a_setcolor.cpp +++ b/src/g_shared/a_setcolor.cpp @@ -15,7 +15,7 @@ class AColorSetter : public AActor }; -IMPLEMENT_CLASS(AColorSetter, false, false, false, false) +IMPLEMENT_CLASS(AColorSetter, false, false) class AFadeSetter : public AActor { @@ -30,4 +30,4 @@ class AFadeSetter : public AActor }; -IMPLEMENT_CLASS(AFadeSetter, false, false, false, false) +IMPLEMENT_CLASS(AFadeSetter, false, false) diff --git a/src/g_shared/a_sharedglobal.h b/src/g_shared/a_sharedglobal.h index bb85a023c..a690107c9 100644 --- a/src/g_shared/a_sharedglobal.h +++ b/src/g_shared/a_sharedglobal.h @@ -24,7 +24,7 @@ public: DBaseDecal (const DBaseDecal *basis); void Serialize(FSerializer &arc); - void Destroy (); + void Destroy() override; FTextureID StickToWall(side_t *wall, double x, double y, F3DFloor * ffloor); double GetRealZ (const side_t *wall) const; void SetShade (DWORD rgb); @@ -66,7 +66,7 @@ public: static DImpactDecal *StaticCreate(const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0); void BeginPlay (); - void Destroy (); + void Destroy() override; protected: DBaseDecal *CloneSelf(const FDecalTemplate *tpl, double x, double y, double z, side_t *wall, F3DFloor * ffloor) const; @@ -88,7 +88,7 @@ class ASkyViewpoint : public AActor DECLARE_CLASS (ASkyViewpoint, AActor) public: void BeginPlay (); - void Destroy (); + void Destroy() override; }; // For an EE compatible linedef based definition. @@ -116,7 +116,7 @@ public: DFlashFader (float r1, float g1, float b1, float a1, float r2, float g2, float b2, float a2, float time, AActor *who); - void Destroy (); + void Destroy() override; void Serialize(FSerializer &arc); void Tick (); AActor *WhoFor() { return ForWho; } @@ -206,7 +206,7 @@ public: void Serialize(FSerializer &arc); void Die (AActor *source, AActor *inflictor, int dmgflags); - void Destroy (); + void Destroy() override; TObjPtr UnmorphedMe; int UnmorphTime, MorphStyle; diff --git a/src/g_shared/a_skies.cpp b/src/g_shared/a_skies.cpp index 148a452e0..d42324936 100644 --- a/src/g_shared/a_skies.cpp +++ b/src/g_shared/a_skies.cpp @@ -42,7 +42,7 @@ // arg0 = Visibility*4 for this skybox -IMPLEMENT_CLASS(ASkyViewpoint, false, false, false, false) +IMPLEMENT_CLASS(ASkyViewpoint, false, false) // If this actor has no TID, make it the default sky box void ASkyViewpoint::BeginPlay () @@ -73,7 +73,7 @@ void ASkyViewpoint::Destroy () Super::Destroy(); } -IMPLEMENT_CLASS(ASkyCamCompat, false, false, false, false) +IMPLEMENT_CLASS(ASkyCamCompat, false, false) void ASkyCamCompat::BeginPlay() { @@ -98,7 +98,7 @@ public: void PostBeginPlay (); }; -IMPLEMENT_CLASS(ASkyPicker, false, false, false, false) +IMPLEMENT_CLASS(ASkyPicker, false, false) void ASkyPicker::PostBeginPlay () { @@ -142,7 +142,7 @@ void ASkyPicker::PostBeginPlay () // arg0 = opacity of plane; 0 = invisible, 255 = fully opaque -IMPLEMENT_CLASS(AStackPoint, false, false, false, false) +IMPLEMENT_CLASS(AStackPoint, false, false) void AStackPoint::BeginPlay () { @@ -157,10 +157,10 @@ class ASectorSilencer : public AActor DECLARE_CLASS (ASectorSilencer, AActor) public: void BeginPlay (); - void Destroy (); + void Destroy() override; }; -IMPLEMENT_CLASS(ASectorSilencer, false, false, false, false) +IMPLEMENT_CLASS(ASectorSilencer, false, false) void ASectorSilencer::BeginPlay () { @@ -184,7 +184,7 @@ public: void BeginPlay (); }; -IMPLEMENT_CLASS(ASectorFlagSetter, false, false, false, false) +IMPLEMENT_CLASS(ASectorFlagSetter, false, false) void ASectorFlagSetter::BeginPlay () { diff --git a/src/g_shared/a_soundenvironment.cpp b/src/g_shared/a_soundenvironment.cpp index 8e5cb133b..25088ae44 100644 --- a/src/g_shared/a_soundenvironment.cpp +++ b/src/g_shared/a_soundenvironment.cpp @@ -46,14 +46,14 @@ public: void Activate (AActor *deactivator); }; -IMPLEMENT_CLASS(ASoundEnvironment, false, false, false, false) +IMPLEMENT_CLASS(ASoundEnvironment, false, false) void ASoundEnvironment::PostBeginPlay () { Super::PostBeginPlay (); if (!(flags2 & MF2_DORMANT)) { - Activate (this); + CallActivate (this); } } diff --git a/src/g_shared/a_soundsequence.cpp b/src/g_shared/a_soundsequence.cpp index 25380a4c7..304017fba 100644 --- a/src/g_shared/a_soundsequence.cpp +++ b/src/g_shared/a_soundsequence.cpp @@ -80,7 +80,7 @@ public: TObjPtr Sequence; }; -IMPLEMENT_CLASS(ASoundSequenceSlot, false, true, false, false) +IMPLEMENT_CLASS(ASoundSequenceSlot, false, true) IMPLEMENT_POINTERS_START(ASoundSequenceSlot) IMPLEMENT_POINTER(Sequence) @@ -104,14 +104,14 @@ class ASoundSequence : public AActor { DECLARE_CLASS (ASoundSequence, AActor) public: - void Destroy (); + void Destroy() override; void PostBeginPlay (); void Activate (AActor *activator); void Deactivate (AActor *activator); void MarkPrecacheSounds () const; }; -IMPLEMENT_CLASS(ASoundSequence, false, false, false, false) +IMPLEMENT_CLASS(ASoundSequence, false, false) //========================================================================== // diff --git a/src/g_shared/a_spark.cpp b/src/g_shared/a_spark.cpp index 654ad710b..f13c7178f 100644 --- a/src/g_shared/a_spark.cpp +++ b/src/g_shared/a_spark.cpp @@ -45,7 +45,7 @@ public: void Activate (AActor *activator); }; -IMPLEMENT_CLASS(ASpark, false, false, false, false) +IMPLEMENT_CLASS(ASpark, false, false) void ASpark::Activate (AActor *activator) { diff --git a/src/g_shared/a_specialspot.cpp b/src/g_shared/a_specialspot.cpp index 935333a5c..026185d07 100644 --- a/src/g_shared/a_specialspot.cpp +++ b/src/g_shared/a_specialspot.cpp @@ -44,8 +44,8 @@ static FRandom pr_spot ("SpecialSpot"); static FRandom pr_spawnmace ("SpawnMace"); -IMPLEMENT_CLASS(DSpotState, false, false, false, false) -IMPLEMENT_CLASS(ASpecialSpot, false, false, false, false) +IMPLEMENT_CLASS(DSpotState, false, false) +IMPLEMENT_CLASS(ASpecialSpot, false, false) TObjPtr DSpotState::SpotState; //---------------------------------------------------------------------------- diff --git a/src/g_shared/a_specialspot.h b/src/g_shared/a_specialspot.h index 8fe38608a..57a643bdd 100644 --- a/src/g_shared/a_specialspot.h +++ b/src/g_shared/a_specialspot.h @@ -11,7 +11,7 @@ class ASpecialSpot : public AActor public: void BeginPlay(); - void Destroy(); + void Destroy() override; }; @@ -28,7 +28,7 @@ public: DSpotState (); - void Destroy (); + void Destroy() override; void Tick (); static DSpotState *GetSpotState(bool create = true); FSpotList *FindSpotList(PClassActor *type); diff --git a/src/g_shared/a_waterzone.cpp b/src/g_shared/a_waterzone.cpp index 556d08d7a..2245b22bd 100644 --- a/src/g_shared/a_waterzone.cpp +++ b/src/g_shared/a_waterzone.cpp @@ -42,7 +42,7 @@ public: void PostBeginPlay (); }; -IMPLEMENT_CLASS(AWaterZone, false, false, false, false) +IMPLEMENT_CLASS(AWaterZone, false, false) void AWaterZone::PostBeginPlay () { diff --git a/src/g_shared/a_weaponpiece.cpp b/src/g_shared/a_weaponpiece.cpp index 9edae6906..52c9a9e38 100644 --- a/src/g_shared/a_weaponpiece.cpp +++ b/src/g_shared/a_weaponpiece.cpp @@ -3,8 +3,8 @@ #include "doomstat.h" #include "serializer.h" -IMPLEMENT_CLASS(PClassWeaponPiece, false, false, false, false) -IMPLEMENT_CLASS(AWeaponHolder, false, false, false, false) +IMPLEMENT_CLASS(PClassWeaponPiece, false, false) +IMPLEMENT_CLASS(AWeaponHolder, false, false) DEFINE_FIELD(AWeaponHolder, PieceMask); DEFINE_FIELD(AWeaponHolder, PieceWeapon); @@ -27,7 +27,7 @@ void AWeaponHolder::Serialize(FSerializer &arc) ("pieceweapon", PieceWeapon); } -IMPLEMENT_CLASS(AWeaponPiece, false, true, false, false) +IMPLEMENT_CLASS(AWeaponPiece, false, true) IMPLEMENT_POINTERS_START(AWeaponPiece) IMPLEMENT_POINTER(FullWeapon) diff --git a/src/g_shared/a_weapons.cpp b/src/g_shared/a_weapons.cpp index 530f8e364..b94a4770c 100644 --- a/src/g_shared/a_weapons.cpp +++ b/src/g_shared/a_weapons.cpp @@ -23,7 +23,7 @@ extern FFlagDef WeaponFlagDefs[]; -IMPLEMENT_CLASS(AWeapon, false, true, true, false) +IMPLEMENT_CLASS(AWeapon, false, true) IMPLEMENT_POINTERS_START(AWeapon) IMPLEMENT_POINTER(Ammo1) @@ -80,7 +80,7 @@ TMap Weapons_hton; static int ntoh_cmp(const void *a, const void *b); -IMPLEMENT_CLASS(PClassWeapon, false, false, false, false) +IMPLEMENT_CLASS(PClassWeapon, false, false) //=========================================================================== // @@ -866,7 +866,7 @@ FState *AWeapon::GetStateForButtonName (FName button) /* Weapon giver ***********************************************************/ -IMPLEMENT_CLASS(AWeaponGiver, false, false, false, false) +IMPLEMENT_CLASS(AWeaponGiver, false, false) DEFINE_FIELD(AWeaponGiver, DropAmmoFactor); diff --git a/src/g_shared/hudmessages.cpp b/src/g_shared/hudmessages.cpp index e9370ae79..0db6d4743 100644 --- a/src/g_shared/hudmessages.cpp +++ b/src/g_shared/hudmessages.cpp @@ -44,15 +44,15 @@ EXTERN_CVAR(Int, con_scaletext) int active_con_scaletext(); -IMPLEMENT_CLASS(DHUDMessage, false, true, false, false) +IMPLEMENT_CLASS(DHUDMessage, false, true) IMPLEMENT_POINTERS_START(DHUDMessage) IMPLEMENT_POINTER(Next) IMPLEMENT_POINTERS_END -IMPLEMENT_CLASS(DHUDMessageFadeOut, false, false, false, false) -IMPLEMENT_CLASS(DHUDMessageFadeInOut, false, false, false, false) -IMPLEMENT_CLASS(DHUDMessageTypeOnFadeOut, false, false, false, false) +IMPLEMENT_CLASS(DHUDMessageFadeOut, false, false) +IMPLEMENT_CLASS(DHUDMessageFadeInOut, false, false) +IMPLEMENT_CLASS(DHUDMessageTypeOnFadeOut, false, false) /************************************************************************* * Basic HUD message. Appears and disappears without any special effects * diff --git a/src/g_shared/sbar.h b/src/g_shared/sbar.h index 6d5b10739..7b7a2849a 100644 --- a/src/g_shared/sbar.h +++ b/src/g_shared/sbar.h @@ -341,7 +341,7 @@ public: }; DBaseStatusBar (int reltop, int hres=320, int vres=200); - void Destroy (); + void Destroy() override; void SetScaled (bool scale, bool force=false); diff --git a/src/g_shared/sbarinfo.cpp b/src/g_shared/sbarinfo.cpp index 304101311..a005c1ada 100644 --- a/src/g_shared/sbarinfo.cpp +++ b/src/g_shared/sbarinfo.cpp @@ -1531,7 +1531,7 @@ private: SBarInfoMainBlock *lastPopup; }; -IMPLEMENT_CLASS(DSBarInfo, false, true, false, false) +IMPLEMENT_CLASS(DSBarInfo, false, true) IMPLEMENT_POINTERS_START(DSBarInfo) IMPLEMENT_POINTER(ammo1) diff --git a/src/g_shared/shared_sbar.cpp b/src/g_shared/shared_sbar.cpp index 80d221cfc..c288a05c8 100644 --- a/src/g_shared/shared_sbar.cpp +++ b/src/g_shared/shared_sbar.cpp @@ -62,7 +62,7 @@ #define XHAIRPICKUPSIZE (2+XHAIRSHRINKSIZE) #define POWERUPICONSIZE 32 -IMPLEMENT_CLASS(DBaseStatusBar, false, true, false, false) +IMPLEMENT_CLASS(DBaseStatusBar, false, true) IMPLEMENT_POINTERS_START(DBaseStatusBar) IMPLEMENT_POINTER(Messages[0]) diff --git a/src/g_strife/a_coin.cpp b/src/g_strife/a_coin.cpp index 87c4619d3..53cc59f50 100644 --- a/src/g_strife/a_coin.cpp +++ b/src/g_strife/a_coin.cpp @@ -6,7 +6,7 @@ // Coin --------------------------------------------------------------------- -IMPLEMENT_CLASS(ACoin, false, false, false, false) +IMPLEMENT_CLASS(ACoin, false, false) const char *ACoin::PickupMessage () { diff --git a/src/g_strife/a_loremaster.cpp b/src/g_strife/a_loremaster.cpp index 0f1bef7cc..747ba326a 100644 --- a/src/g_strife/a_loremaster.cpp +++ b/src/g_strife/a_loremaster.cpp @@ -17,7 +17,7 @@ public: int DoSpecialDamage (AActor *victim, int damage, FName damagetype); }; -IMPLEMENT_CLASS(ALoreShot, false, false, false, false) +IMPLEMENT_CLASS(ALoreShot, false, false) int ALoreShot::DoSpecialDamage (AActor *victim, int damage, FName damagetype) { diff --git a/src/g_strife/a_programmer.cpp b/src/g_strife/a_programmer.cpp index c00e7fb01..07f6a6c4c 100644 --- a/src/g_strife/a_programmer.cpp +++ b/src/g_strife/a_programmer.cpp @@ -23,7 +23,7 @@ public: PalEntry GetBlend (); }; -IMPLEMENT_CLASS(AProgLevelEnder, false, false, false, false) +IMPLEMENT_CLASS(AProgLevelEnder, false, false) //============================================================================ // diff --git a/src/g_strife/a_rebels.cpp b/src/g_strife/a_rebels.cpp index 7f21886bf..d3d68153f 100644 --- a/src/g_strife/a_rebels.cpp +++ b/src/g_strife/a_rebels.cpp @@ -47,7 +47,7 @@ public: bool Use (bool pickup); }; -IMPLEMENT_CLASS(ATeleporterBeacon, false, false, false, false) +IMPLEMENT_CLASS(ATeleporterBeacon, false, false) bool ATeleporterBeacon::Use (bool pickup) { diff --git a/src/g_strife/a_spectral.cpp b/src/g_strife/a_spectral.cpp index c7012accf..4bd24bac7 100644 --- a/src/g_strife/a_spectral.cpp +++ b/src/g_strife/a_spectral.cpp @@ -16,7 +16,7 @@ public: void Touch (AActor *toucher); }; -IMPLEMENT_CLASS(ASpectralMonster, false, false, false, false) +IMPLEMENT_CLASS(ASpectralMonster, false, false) void ASpectralMonster::Touch (AActor *toucher) { diff --git a/src/g_strife/a_strifeitems.cpp b/src/g_strife/a_strifeitems.cpp index c1b9d75d6..0586583ff 100644 --- a/src/g_strife/a_strifeitems.cpp +++ b/src/g_strife/a_strifeitems.cpp @@ -19,7 +19,7 @@ */ // Degnin Ore --------------------------------------------------------------- -IMPLEMENT_CLASS(ADegninOre, false, false, false, false) +IMPLEMENT_CLASS(ADegninOre, false, false) DEFINE_ACTION_FUNCTION(AActor, A_RemoveForceField) { @@ -75,7 +75,7 @@ public: bool TryPickup (AActor *&toucher); }; -IMPLEMENT_CLASS(AHealthTraining, false, false, false, false) +IMPLEMENT_CLASS(AHealthTraining, false, false) bool AHealthTraining::TryPickup (AActor *&toucher) { @@ -105,7 +105,7 @@ public: bool Use (bool pickup); }; -IMPLEMENT_CLASS(AScanner, false, false, false, false) +IMPLEMENT_CLASS(AScanner, false, false) bool AScanner::Use (bool pickup) { @@ -130,7 +130,7 @@ public: bool SpecialDropAction (AActor *dropper); }; -IMPLEMENT_CLASS(APrisonPass, false, false, false, false) +IMPLEMENT_CLASS(APrisonPass, false, false) bool APrisonPass::TryPickup (AActor *&toucher) { @@ -163,7 +163,7 @@ bool APrisonPass::SpecialDropAction (AActor *dropper) // actions and cannot be held. ---------------------------------------------- //--------------------------------------------------------------------------- -IMPLEMENT_CLASS(ADummyStrifeItem, false, false, false, false) +IMPLEMENT_CLASS(ADummyStrifeItem, false, false) // Sound the alarm! --------------------------------------------------------- @@ -175,7 +175,7 @@ public: bool SpecialDropAction (AActor *dropper); }; -IMPLEMENT_CLASS(ARaiseAlarm, false, false, false, false) +IMPLEMENT_CLASS(ARaiseAlarm, false, false) bool ARaiseAlarm::TryPickup (AActor *&toucher) { @@ -209,7 +209,7 @@ public: bool TryPickup (AActor *&toucher); }; -IMPLEMENT_CLASS(AOpenDoor222, false, false, false, false) +IMPLEMENT_CLASS(AOpenDoor222, false, false) bool AOpenDoor222::TryPickup (AActor *&toucher) { @@ -228,7 +228,7 @@ public: bool SpecialDropAction (AActor *dropper); }; -IMPLEMENT_CLASS(ACloseDoor222, false, false, false, false) +IMPLEMENT_CLASS(ACloseDoor222, false, false) bool ACloseDoor222::TryPickup (AActor *&toucher) { @@ -262,7 +262,7 @@ public: bool SpecialDropAction (AActor *dropper); }; -IMPLEMENT_CLASS(AOpenDoor224, false, false, false, false) +IMPLEMENT_CLASS(AOpenDoor224, false, false) bool AOpenDoor224::TryPickup (AActor *&toucher) { @@ -287,7 +287,7 @@ public: bool TryPickup (AActor *&toucher); }; -IMPLEMENT_CLASS(AAmmoFillup, false, false, false, false) +IMPLEMENT_CLASS(AAmmoFillup, false, false) bool AAmmoFillup::TryPickup (AActor *&toucher) { @@ -325,7 +325,7 @@ public: bool TryPickup (AActor *&toucher); }; -IMPLEMENT_CLASS(AHealthFillup, false, false, false, false) +IMPLEMENT_CLASS(AHealthFillup, false, false) bool AHealthFillup::TryPickup (AActor *&toucher) { @@ -342,7 +342,7 @@ bool AHealthFillup::TryPickup (AActor *&toucher) // Upgrade Stamina ---------------------------------------------------------- -IMPLEMENT_CLASS(AUpgradeStamina, false, false, false, false) +IMPLEMENT_CLASS(AUpgradeStamina, false, false) bool AUpgradeStamina::TryPickup (AActor *&toucher) { @@ -360,7 +360,7 @@ bool AUpgradeStamina::TryPickup (AActor *&toucher) // Upgrade Accuracy --------------------------------------------------------- -IMPLEMENT_CLASS(AUpgradeAccuracy, false, false, false, false) +IMPLEMENT_CLASS(AUpgradeAccuracy, false, false) bool AUpgradeAccuracy::TryPickup (AActor *&toucher) { @@ -373,7 +373,7 @@ bool AUpgradeAccuracy::TryPickup (AActor *&toucher) // Start a slideshow -------------------------------------------------------- -IMPLEMENT_CLASS(ASlideshowStarter, false, false, false, false) +IMPLEMENT_CLASS(ASlideshowStarter, false, false) bool ASlideshowStarter::TryPickup (AActor *&toucher) { diff --git a/src/g_strife/a_strifestuff.cpp b/src/g_strife/a_strifestuff.cpp index 1580f127f..7cccdd3f3 100644 --- a/src/g_strife/a_strifestuff.cpp +++ b/src/g_strife/a_strifestuff.cpp @@ -72,7 +72,7 @@ public: int TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype); }; -IMPLEMENT_CLASS(AForceFieldGuard, false, false, false, false) +IMPLEMENT_CLASS(AForceFieldGuard, false, false) int AForceFieldGuard::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype) { @@ -197,7 +197,7 @@ public: void Die (AActor *source, AActor *inflictor, int dmgflags); }; -IMPLEMENT_CLASS(APowerCoupling, false, false, false, false) +IMPLEMENT_CLASS(APowerCoupling, false, false) void APowerCoupling::Die (AActor *source, AActor *inflictor, int dmgflags) { @@ -239,7 +239,7 @@ public: } }; -IMPLEMENT_CLASS(AMeat, false, false, false, false) +IMPLEMENT_CLASS(AMeat, false, false) //========================================================================== // diff --git a/src/g_strife/a_strifeweapons.cpp b/src/g_strife/a_strifeweapons.cpp index 56eb06597..0268682f3 100644 --- a/src/g_strife/a_strifeweapons.cpp +++ b/src/g_strife/a_strifeweapons.cpp @@ -184,7 +184,7 @@ public: int DoSpecialDamage (AActor *target, int damage, FName damagetype); }; -IMPLEMENT_CLASS(APoisonBolt, false, false, false, false) +IMPLEMENT_CLASS(APoisonBolt, false, false) int APoisonBolt::DoSpecialDamage (AActor *target, int damage, FName damagetype) { @@ -607,7 +607,7 @@ public: int DoSpecialDamage (AActor *target, int damage, FName damagetype); }; -IMPLEMENT_CLASS(APhosphorousFire, false, false, false, false) +IMPLEMENT_CLASS(APhosphorousFire, false, false) int APhosphorousFire::DoSpecialDamage (AActor *target, int damage, FName damagetype) { @@ -734,7 +734,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireGrenade) // The Almighty Sigil! ------------------------------------------------------ -IMPLEMENT_CLASS(ASigil, false, false, false, false) +IMPLEMENT_CLASS(ASigil, false, false) //============================================================================ // diff --git a/src/g_strife/strife_sbar.cpp b/src/g_strife/strife_sbar.cpp index 73e31e676..39f92d076 100644 --- a/src/g_strife/strife_sbar.cpp +++ b/src/g_strife/strife_sbar.cpp @@ -851,7 +851,7 @@ private: double ItemFlash; }; -IMPLEMENT_CLASS(DStrifeStatusBar, false, false, false, false); +IMPLEMENT_CLASS(DStrifeStatusBar, false, false); DBaseStatusBar *CreateStrifeStatusBar () { diff --git a/src/info.cpp b/src/info.cpp index fec5af63e..8a2842ff4 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -151,7 +151,7 @@ int GetSpriteIndex(const char * spritename, bool add) return (lastindex = (int)sprites.Push (temp)); } -IMPLEMENT_CLASS(PClassActor, false, true, false, false) +IMPLEMENT_CLASS(PClassActor, false, true) IMPLEMENT_POINTERS_START(PClassActor) IMPLEMENT_POINTER(DropItems) diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index be8f58e19..2aacd215b 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -54,12 +54,12 @@ FIntermissionDescriptorList IntermissionDescriptors; -IMPLEMENT_CLASS(DIntermissionScreen, false, false, false, false) -IMPLEMENT_CLASS(DIntermissionScreenFader, false, false, false, false) -IMPLEMENT_CLASS(DIntermissionScreenText, false, false, false, false) -IMPLEMENT_CLASS(DIntermissionScreenCast, false, false, false, false) -IMPLEMENT_CLASS(DIntermissionScreenScroller, false, false, false, false) -IMPLEMENT_CLASS(DIntermissionController, false, true, false, false) +IMPLEMENT_CLASS(DIntermissionScreen, false, false) +IMPLEMENT_CLASS(DIntermissionScreenFader, false, false) +IMPLEMENT_CLASS(DIntermissionScreenText, false, false) +IMPLEMENT_CLASS(DIntermissionScreenCast, false, false) +IMPLEMENT_CLASS(DIntermissionScreenScroller, false, false) +IMPLEMENT_CLASS(DIntermissionController, false, true) IMPLEMENT_POINTERS_START(DIntermissionController) IMPLEMENT_POINTER(mScreen) diff --git a/src/intermission/intermission.h b/src/intermission/intermission.h index 45779f895..25b369a3a 100644 --- a/src/intermission/intermission.h +++ b/src/intermission/intermission.h @@ -176,7 +176,7 @@ public: virtual int Responder (event_t *ev); virtual int Ticker (); virtual void Drawer (); - void Destroy(); + void Destroy() override; FTextureID GetBackground(bool *fill) { *fill = mFlatfill; @@ -301,7 +301,7 @@ public: bool Responder (event_t *ev); void Ticker (); void Drawer (); - void Destroy(); + void Destroy() override; friend void F_AdvanceIntermission(); }; diff --git a/src/m_argv.cpp b/src/m_argv.cpp index 7d82ed834..395885986 100644 --- a/src/m_argv.cpp +++ b/src/m_argv.cpp @@ -37,7 +37,7 @@ #include "cmdlib.h" #include "i_system.h" -IMPLEMENT_CLASS(DArgs, false, false, false, false) +IMPLEMENT_CLASS(DArgs, false, false) //=========================================================================== // diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index c53192ee7..7ba40f957 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -1033,7 +1033,7 @@ public: } }; -IMPLEMENT_CLASS(DSuicider, false, true, false, false) +IMPLEMENT_CLASS(DSuicider, false, true) IMPLEMENT_POINTERS_START(DSuicider) IMPLEMENT_POINTER(Pawn) diff --git a/src/menu/colorpickermenu.cpp b/src/menu/colorpickermenu.cpp index 639c6bbef..e1ee3566d 100644 --- a/src/menu/colorpickermenu.cpp +++ b/src/menu/colorpickermenu.cpp @@ -95,7 +95,7 @@ public: desc->CalcIndent(); } - void Destroy() + void Destroy() override { if (mStartItem >= 0) { @@ -331,7 +331,7 @@ public: } }; -IMPLEMENT_CLASS(DColorPickerMenu, true, false, false, false) +IMPLEMENT_CLASS(DColorPickerMenu, true, false) CCMD(undocolorpic) { diff --git a/src/menu/joystickmenu.cpp b/src/menu/joystickmenu.cpp index cca13ad44..f715dce4a 100644 --- a/src/menu/joystickmenu.cpp +++ b/src/menu/joystickmenu.cpp @@ -236,7 +236,7 @@ class DJoystickConfigMenu : public DOptionMenu DECLARE_CLASS(DJoystickConfigMenu, DOptionMenu) }; -IMPLEMENT_CLASS(DJoystickConfigMenu, false, false, false, false) +IMPLEMENT_CLASS(DJoystickConfigMenu, false, false) //============================================================================= // diff --git a/src/menu/listmenu.cpp b/src/menu/listmenu.cpp index 7fdd0c5bc..455ea6c4b 100644 --- a/src/menu/listmenu.cpp +++ b/src/menu/listmenu.cpp @@ -42,7 +42,7 @@ #include "d_event.h" #include "menu/menu.h" -IMPLEMENT_CLASS(DListMenu, false, false, false, false) +IMPLEMENT_CLASS(DListMenu, false, false) //============================================================================= // diff --git a/src/menu/loadsavemenu.cpp b/src/menu/loadsavemenu.cpp index 6d543228c..73183ca22 100644 --- a/src/menu/loadsavemenu.cpp +++ b/src/menu/loadsavemenu.cpp @@ -103,7 +103,7 @@ protected: char savegamestring[SAVESTRINGSIZE]; DLoadSaveMenu(DMenu *parent = NULL, FListMenuDescriptor *desc = NULL); - void Destroy(); + void Destroy() override; int RemoveSaveSlot (int index); void UnloadSaveData (); @@ -119,7 +119,7 @@ public: }; -IMPLEMENT_CLASS(DLoadSaveMenu, false, false, false, false) +IMPLEMENT_CLASS(DLoadSaveMenu, false, false) TArray DLoadSaveMenu::SaveGames; int DLoadSaveMenu::LastSaved = -1; @@ -466,6 +466,7 @@ void DLoadSaveMenu::Destroy() if (currentSavePic != nullptr) delete currentSavePic; currentSavePic = nullptr; ClearSaveStuff (); + Super::Destroy(); } //============================================================================= @@ -927,14 +928,14 @@ class DSaveMenu : public DLoadSaveMenu public: DSaveMenu(DMenu *parent = NULL, FListMenuDescriptor *desc = NULL); - void Destroy(); + void Destroy() override; void DoSave (FSaveGameNode *node); bool Responder (event_t *ev); bool MenuEvent (int mkey, bool fromcontroller); }; -IMPLEMENT_CLASS(DSaveMenu, false, false, false, false) +IMPLEMENT_CLASS(DSaveMenu, false, false) //============================================================================= @@ -975,6 +976,7 @@ void DSaveMenu::Destroy() if (Selected == 0) Selected = -1; else Selected--; } + Super::Destroy(); } //============================================================================= @@ -1102,7 +1104,7 @@ public: bool MenuEvent (int mkey, bool fromcontroller); }; -IMPLEMENT_CLASS(DLoadMenu, false, false, false, false) +IMPLEMENT_CLASS(DLoadMenu, false, false) //============================================================================= diff --git a/src/menu/menu.cpp b/src/menu/menu.cpp index 6648c32b4..0c6019a5f 100644 --- a/src/menu/menu.cpp +++ b/src/menu/menu.cpp @@ -91,7 +91,7 @@ static bool MenuEnabled = true; // //============================================================================ -IMPLEMENT_CLASS(DMenu, false, true, false, false) +IMPLEMENT_CLASS(DMenu, false, true) IMPLEMENT_POINTERS_START(DMenu) IMPLEMENT_POINTER(mParentMenu) diff --git a/src/menu/menuinput.cpp b/src/menu/menuinput.cpp index c33e9fed2..cca4756f5 100644 --- a/src/menu/menuinput.cpp +++ b/src/menu/menuinput.cpp @@ -44,7 +44,7 @@ // [TP] New #includes #include "v_text.h" -IMPLEMENT_CLASS(DTextEnterMenu, true, false, false, false) +IMPLEMENT_CLASS(DTextEnterMenu, true, false) #define INPUTGRID_WIDTH 13 #define INPUTGRID_HEIGHT 5 diff --git a/src/menu/messagebox.cpp b/src/menu/messagebox.cpp index de8fa1027..c406fc701 100644 --- a/src/menu/messagebox.cpp +++ b/src/menu/messagebox.cpp @@ -63,7 +63,7 @@ class DMessageBoxMenu : public DMenu public: DMessageBoxMenu(DMenu *parent = NULL, const char *message = NULL, int messagemode = 0, bool playsound = false, FName action = NAME_None); - void Destroy(); + void Destroy() override; void Init(DMenu *parent, const char *message, int messagemode, bool playsound = false); void Drawer(); bool Responder(event_t *ev); @@ -73,7 +73,7 @@ public: virtual void HandleResult(bool res); }; -IMPLEMENT_CLASS(DMessageBoxMenu, false, false, false, false) +IMPLEMENT_CLASS(DMessageBoxMenu, false, false) //============================================================================= // @@ -128,6 +128,7 @@ void DMessageBoxMenu::Destroy() { if (mMessage != NULL) V_FreeBrokenLines(mMessage); mMessage = NULL; + Super::Destroy(); } //============================================================================= @@ -365,7 +366,7 @@ public: virtual void HandleResult(bool res); }; -IMPLEMENT_CLASS(DQuitMenu, false, false, false, false) +IMPLEMENT_CLASS(DQuitMenu, false, false) //============================================================================= // @@ -458,7 +459,7 @@ public: virtual void HandleResult(bool res); }; -IMPLEMENT_CLASS(DEndGameMenu, false, false, false, false) +IMPLEMENT_CLASS(DEndGameMenu, false, false) //============================================================================= // @@ -536,7 +537,7 @@ public: virtual void HandleResult(bool res); }; -IMPLEMENT_CLASS(DQuickSaveMenu, false, false, false, false) +IMPLEMENT_CLASS(DQuickSaveMenu, false, false) //============================================================================= // @@ -632,7 +633,7 @@ public: virtual void HandleResult(bool res); }; -IMPLEMENT_CLASS(DQuickLoadMenu, false, false, false, false) +IMPLEMENT_CLASS(DQuickLoadMenu, false, false) //============================================================================= // diff --git a/src/menu/optionmenu.cpp b/src/menu/optionmenu.cpp index 1631c3d4b..f9a29b6f5 100644 --- a/src/menu/optionmenu.cpp +++ b/src/menu/optionmenu.cpp @@ -64,7 +64,7 @@ void M_DrawConText (int color, int x, int y, const char *str) TAG_DONE); } -IMPLEMENT_CLASS(DOptionMenu, false, false, false, false) +IMPLEMENT_CLASS(DOptionMenu, false, false) //============================================================================= // @@ -578,7 +578,7 @@ public: } }; -IMPLEMENT_CLASS(DGameplayMenu, false, false, false, false) +IMPLEMENT_CLASS(DGameplayMenu, false, false) class DCompatibilityMenu : public DOptionMenu { @@ -600,4 +600,4 @@ public: } }; -IMPLEMENT_CLASS(DCompatibilityMenu, false, false, false, false) +IMPLEMENT_CLASS(DCompatibilityMenu, false, false) diff --git a/src/menu/optionmenuitems.h b/src/menu/optionmenuitems.h index e83f4ada4..c3cb7297a 100644 --- a/src/menu/optionmenuitems.h +++ b/src/menu/optionmenuitems.h @@ -399,7 +399,7 @@ public: }; #ifndef NO_IMP -IMPLEMENT_CLASS(DEnterKey, true, false, false, false) +IMPLEMENT_CLASS(DEnterKey, true, false) #endif //============================================================================= diff --git a/src/menu/playermenu.cpp b/src/menu/playermenu.cpp index e32c7dd61..9f5196367 100644 --- a/src/menu/playermenu.cpp +++ b/src/menu/playermenu.cpp @@ -526,7 +526,7 @@ public: void Drawer (); }; -IMPLEMENT_CLASS(DPlayerMenu, false, false, false, false) +IMPLEMENT_CLASS(DPlayerMenu, false, false) //============================================================================= // diff --git a/src/menu/readthis.cpp b/src/menu/readthis.cpp index 0dfc47e73..b8a3837ee 100644 --- a/src/menu/readthis.cpp +++ b/src/menu/readthis.cpp @@ -54,7 +54,7 @@ public: bool MouseEvent(int type, int x, int y); }; -IMPLEMENT_CLASS(DReadThisMenu, false, false, false, false) +IMPLEMENT_CLASS(DReadThisMenu, false, false) //============================================================================= // diff --git a/src/menu/videomenu.cpp b/src/menu/videomenu.cpp index 37f59149e..d8edee8f1 100644 --- a/src/menu/videomenu.cpp +++ b/src/menu/videomenu.cpp @@ -183,7 +183,7 @@ public: } }; -IMPLEMENT_CLASS(DVideoModeMenu, false, false, false, false) +IMPLEMENT_CLASS(DVideoModeMenu, false, false) //============================================================================= diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 96e20d022..a5b8b977d 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -1368,7 +1368,7 @@ private: DPlaneWatcher() {} }; -IMPLEMENT_CLASS(DPlaneWatcher, false, true, false, false) +IMPLEMENT_CLASS(DPlaneWatcher, false, true) IMPLEMENT_POINTERS_START(DPlaneWatcher) IMPLEMENT_POINTER(Activator) @@ -2859,7 +2859,7 @@ void FBehavior::StaticStopMyScripts (AActor *actor) //---- The ACS Interpreter ----// -IMPLEMENT_CLASS(DACSThinker, false, true, false, false) +IMPLEMENT_CLASS(DACSThinker, false, true) IMPLEMENT_POINTERS_START(DACSThinker) IMPLEMENT_POINTER(LastScript) @@ -2990,7 +2990,7 @@ void DACSThinker::StopScriptsFor (AActor *actor) } } -IMPLEMENT_CLASS(DLevelScript, false, true, false, false) +IMPLEMENT_CLASS(DLevelScript, false, true) IMPLEMENT_POINTERS_START(DLevelScript) IMPLEMENT_POINTER(next) diff --git a/src/p_buildmap.cpp b/src/p_buildmap.cpp index b3526c60d..4d1909da5 100644 --- a/src/p_buildmap.cpp +++ b/src/p_buildmap.cpp @@ -865,7 +865,7 @@ public: void BeginPlay (); }; -IMPLEMENT_CLASS(ACustomSprite, false, false, false, false) +IMPLEMENT_CLASS(ACustomSprite, false, false) void ACustomSprite::BeginPlay () { diff --git a/src/p_ceiling.cpp b/src/p_ceiling.cpp index d22dd6371..a38a17f9c 100644 --- a/src/p_ceiling.cpp +++ b/src/p_ceiling.cpp @@ -38,7 +38,7 @@ // //============================================================================ -IMPLEMENT_CLASS(DCeiling, false, false, false, false) +IMPLEMENT_CLASS(DCeiling, false, false) DCeiling::DCeiling () { diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index 15e3e42c4..404b2f2bc 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -834,6 +834,7 @@ public: V_FreeBrokenLines(mDialogueLines); mDialogueLines = NULL; I_SetMusicVolume (1.f); + Super::Destroy(); } bool DimAllowed() @@ -1103,7 +1104,7 @@ public: }; -IMPLEMENT_CLASS(DConversationMenu, true, false, false, false) +IMPLEMENT_CLASS(DConversationMenu, true, false) int DConversationMenu::mSelection; // needs to be preserved if the same dialogue is restarted diff --git a/src/p_doors.cpp b/src/p_doors.cpp index 542308fa6..aa59e5463 100644 --- a/src/p_doors.cpp +++ b/src/p_doors.cpp @@ -45,7 +45,7 @@ // //============================================================================ -IMPLEMENT_CLASS(DDoor, false, false, false, false) +IMPLEMENT_CLASS(DDoor, false, false) DDoor::DDoor () { @@ -513,7 +513,7 @@ bool EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing, // //============================================================================ -IMPLEMENT_CLASS(DAnimatedDoor, false, false, false, false) +IMPLEMENT_CLASS(DAnimatedDoor, false, false) DAnimatedDoor::DAnimatedDoor () { diff --git a/src/p_floor.cpp b/src/p_floor.cpp index 7b5ff5cc9..0431fa808 100644 --- a/src/p_floor.cpp +++ b/src/p_floor.cpp @@ -64,7 +64,7 @@ static void StartFloorSound (sector_t *sec) // //========================================================================== -IMPLEMENT_CLASS(DFloor, false, false, false, false) +IMPLEMENT_CLASS(DFloor, false, false) DFloor::DFloor () { @@ -815,7 +815,7 @@ bool EV_DoDonut (int tag, line_t *line, double pillarspeed, double slimespeed) // //========================================================================== -IMPLEMENT_CLASS(DElevator, false, true, false, false) +IMPLEMENT_CLASS(DElevator, false, true) IMPLEMENT_POINTERS_START(DElevator) IMPLEMENT_POINTER(m_Interp_Floor) @@ -1105,9 +1105,9 @@ bool EV_DoChange (line_t *line, EChange changetype, int tag) // //========================================================================== -IMPLEMENT_CLASS(DWaggleBase, false, false, false, false) -IMPLEMENT_CLASS(DFloorWaggle, false, false, false, false) -IMPLEMENT_CLASS(DCeilingWaggle, false, false, false, false) +IMPLEMENT_CLASS(DWaggleBase, false, false) +IMPLEMENT_CLASS(DFloorWaggle, false, false) +IMPLEMENT_CLASS(DCeilingWaggle, false, false) DWaggleBase::DWaggleBase () { @@ -1141,11 +1141,6 @@ DWaggleBase::DWaggleBase (sector_t *sec) { } -void DWaggleBase::Destroy() -{ - Super::Destroy(); -} - //========================================================================== // // diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 48d13bebf..aece79edc 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -1071,7 +1071,7 @@ int P_DamageMobj (AActor *target, AActor *inflictor, AActor *source, int damage, } } - damage = inflictor->DoSpecialDamage(target, damage, mod); + damage = inflictor->CallDoSpecialDamage(target, damage, mod); if (damage < 0) { return -1; diff --git a/src/p_lights.cpp b/src/p_lights.cpp index c44a22d4b..910c52a64 100644 --- a/src/p_lights.cpp +++ b/src/p_lights.cpp @@ -173,7 +173,7 @@ private: // //----------------------------------------------------------------------------- -IMPLEMENT_CLASS(DLighting, false, false, false, false) +IMPLEMENT_CLASS(DLighting, false, false) DLighting::DLighting () { @@ -191,7 +191,7 @@ DLighting::DLighting (sector_t *sector) // //----------------------------------------------------------------------------- -IMPLEMENT_CLASS(DFireFlicker, false, false, false, false) +IMPLEMENT_CLASS(DFireFlicker, false, false) DFireFlicker::DFireFlicker () { @@ -258,7 +258,7 @@ DFireFlicker::DFireFlicker (sector_t *sector, int upper, int lower) // //----------------------------------------------------------------------------- -IMPLEMENT_CLASS(DFlicker, false, false, false, false) +IMPLEMENT_CLASS(DFlicker, false, false) DFlicker::DFlicker () { @@ -334,7 +334,7 @@ void EV_StartLightFlickering (int tag, int upper, int lower) // //----------------------------------------------------------------------------- -IMPLEMENT_CLASS(DLightFlash, false, false, false, false) +IMPLEMENT_CLASS(DLightFlash, false, false) DLightFlash::DLightFlash () { @@ -409,7 +409,7 @@ DLightFlash::DLightFlash (sector_t *sector, int min, int max) // //----------------------------------------------------------------------------- -IMPLEMENT_CLASS(DStrobe, false, false, false, false) +IMPLEMENT_CLASS(DStrobe, false, false) DStrobe::DStrobe () { @@ -667,7 +667,7 @@ void EV_LightChange (int tag, int value) // //----------------------------------------------------------------------------- -IMPLEMENT_CLASS(DGlow, false, false, false, false) +IMPLEMENT_CLASS(DGlow, false, false) DGlow::DGlow () { @@ -736,7 +736,7 @@ DGlow::DGlow (sector_t *sector) // //----------------------------------------------------------------------------- -IMPLEMENT_CLASS(DGlow2, false, false, false, false) +IMPLEMENT_CLASS(DGlow2, false, false) DGlow2::DGlow2 () { @@ -869,7 +869,7 @@ void EV_StartLightFading (int tag, int value, int tics) // //----------------------------------------------------------------------------- -IMPLEMENT_CLASS(DPhased, false, false, false, false) +IMPLEMENT_CLASS(DPhased, false, false) DPhased::DPhased () { diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index c8c7db74d..e41912e23 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -1368,7 +1368,7 @@ void DoActivateThing(AActor * thing, AActor * activator) if (thing->activationtype & THINGSPEC_Switch) // Set other flag if switching thing->activationtype |= THINGSPEC_Deactivate; } - thing->Activate (activator); + thing->CallActivate (activator); } void DoDeactivateThing(AActor * thing, AActor * activator) @@ -1379,7 +1379,7 @@ void DoDeactivateThing(AActor * thing, AActor * activator) if (thing->activationtype & THINGSPEC_Switch) // Set other flag if switching thing->activationtype |= THINGSPEC_Activate; } - thing->Deactivate (activator); + thing->CallDeactivate (activator); } FUNC(LS_Thing_Activate) diff --git a/src/p_map.cpp b/src/p_map.cpp index af5ab100a..f1fa55cf9 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -6758,7 +6758,7 @@ bool P_ActivateThingSpecial(AActor * thing, AActor * trigger, bool death) thing->activationtype &= ~THINGSPEC_Activate; // Clear flag if (thing->activationtype & THINGSPEC_Switch) // Set other flag if switching thing->activationtype |= THINGSPEC_Deactivate; - thing->Activate(trigger); + thing->CallActivate(trigger); res = true; } // If not, can it be deactivated? @@ -6767,7 +6767,7 @@ bool P_ActivateThingSpecial(AActor * thing, AActor * trigger, bool death) thing->activationtype &= ~THINGSPEC_Deactivate; // Clear flag if (thing->activationtype & THINGSPEC_Switch) // Set other flag if switching thing->activationtype |= THINGSPEC_Activate; - thing->Deactivate(trigger); + thing->CallDeactivate(trigger); res = true; } } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 3c8d1173b..cde2eb0b4 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -131,7 +131,7 @@ CVAR (Int, cl_bloodtype, 0, CVAR_ARCHIVE); // CODE -------------------------------------------------------------------- -IMPLEMENT_CLASS(AActor, false, true, false, true) +IMPLEMENT_CLASS(AActor, false, true) IMPLEMENT_POINTERS_START(AActor) IMPLEMENT_POINTER(target) @@ -943,7 +943,7 @@ AInventory *AActor::FirstInv () // //============================================================================ -bool AActor::UseInventory (AInventory *item) +bool AActor::DoUseInventory (AInventory *item) { // No using items if you're dead. if (health <= 0) @@ -975,7 +975,23 @@ DEFINE_ACTION_FUNCTION(AActor, UseInventory) PARAM_SELF_PROLOGUE(AActor); PARAM_OBJECT(item, AInventory); self->VMSuperCall(); - ACTION_RETURN_BOOL(self->UseInventory(item)); + ACTION_RETURN_BOOL(self->DoUseInventory(item)); +} + +bool AActor::UseInventory(AInventory *item) +{ + IFVIRTUAL(AActor, UseInventory) + { + // Without the type cast this picks the 'void *' assignment... + VMValue params[2] = { (DObject*)this, (DObject*)item }; + VMReturn ret; + VMFrameStack stack; + int retval; + ret.IntAt(&retval); + stack.Call(func, params, 2, &ret, 1, nullptr); + return !!retval; + } + else return DoUseInventory(item); } //=========================================================================== @@ -4475,7 +4491,7 @@ AActor *AActor::StaticSpawn (PClassActor *type, const DVector3 &pos, replace_t a actor->UpdateWaterLevel (false); if (!SpawningMapThing) { - actor->BeginPlay (); + actor->CallBeginPlay (); if (actor->ObjectFlags & OF_EuthanizeMe) { return NULL; @@ -4551,7 +4567,7 @@ void AActor::HandleSpawnFlags () } if (SpawnFlags & MTF_DORMANT) { - Deactivate (NULL); + CallDeactivate (NULL); } if (SpawnFlags & MTF_STANDSTILL) { @@ -4595,18 +4611,29 @@ void AActor::BeginPlay () if (flags2 & MF2_DORMANT) { flags2 &= ~MF2_DORMANT; - Deactivate (NULL); + CallDeactivate (NULL); } } DEFINE_ACTION_FUNCTION(AActor, BeginPlay) { PARAM_SELF_PROLOGUE(AActor); - self->VMSuperCall(); self->BeginPlay(); return 0; } +void AActor::CallBeginPlay() +{ + IFVIRTUAL(AActor, BeginPlay) + { + // Without the type cast this picks the 'void *' assignment... + VMValue params[1] = { (DObject*)this }; + VMFrameStack stack; + stack.Call(func, params, 1, nullptr, 0, nullptr); + } + else BeginPlay(); +} + void AActor::PostBeginPlay () { @@ -4643,6 +4670,12 @@ bool AActor::isSlow() return !!G_SkillProperty(SKILLP_SlowMonsters); } +//=========================================================================== +// +// Activate +// +//=========================================================================== + void AActor::Activate (AActor *activator) { if ((flags3 & MF3_ISMONSTER) && (health > 0 || (flags & MF_ICECORPSE))) @@ -4672,6 +4705,25 @@ DEFINE_ACTION_FUNCTION(AActor, Activate) return 0; } +void AActor::CallActivate(AActor *activator) +{ + IFVIRTUAL(AActor, Activate) + { + // Without the type cast this picks the 'void *' assignment... + VMValue params[2] = { (DObject*)this, (DObject*)activator }; + VMFrameStack stack; + stack.Call(func, params, 2, nullptr, 0, nullptr); + } + else Activate(activator); +} + + +//=========================================================================== +// +// Deactivate +// +//=========================================================================== + void AActor::Deactivate (AActor *activator) { if ((flags3 & MF3_ISMONSTER) && (health > 0 || (flags & MF_ICECORPSE))) @@ -4701,10 +4753,23 @@ DEFINE_ACTION_FUNCTION(AActor, Deactivate) return 0; } +void AActor::CallDeactivate(AActor *activator) +{ + IFVIRTUAL(AActor, Deactivate) + { + // Without the type cast this picks the 'void *' assignment... + VMValue params[2] = { (DObject*)this, (DObject*)activator }; + VMFrameStack stack; + stack.Call(func, params, 2, nullptr, 0, nullptr); + } + else Deactivate(activator); +} +//=========================================================================== // -// P_RemoveMobj +// Destroy // +//=========================================================================== void AActor::Destroy () { @@ -5415,7 +5480,7 @@ AActor *P_SpawnMapThing (FMapThing *mthing, int position) if (mthing->fillcolor) mobj->fillcolor = mthing->fillcolor; - mobj->BeginPlay (); + mobj->CallBeginPlay (); if (!(mobj->ObjectFlags & OF_EuthanizeMe)) { mobj->LevelSpawned (); @@ -6687,6 +6752,14 @@ bool AActor::IsHostile (AActor *other) return true; } +//========================================================================== +// +// AActor :: DoSpecialDamage +// +// override this for special damage effects. +// +//========================================================================== + int AActor::DoSpecialDamage (AActor *target, int damage, FName damagetype) { if (target->player && target->player->mo == target && damage < 1000 && @@ -6720,6 +6793,28 @@ DEFINE_ACTION_FUNCTION(AActor, DoSpecialDamage) ACTION_RETURN_INT(self->DoSpecialDamage(target, damage, damagetype)); } +int AActor::CallDoSpecialDamage(AActor *target, int damage, FName damagetype) +{ + IFVIRTUAL(AActor, DoSpecialDamage) + { + // Without the type cast this picks the 'void *' assignment... + VMValue params[4] = { (DObject*)this, (DObject*)target, damage, damagetype.GetIndex() }; + VMReturn ret; + VMFrameStack stack; + int retval; + ret.IntAt(&retval); + stack.Call(func, params, 4, &ret, 1, nullptr); + return retval; + } + else return DoSpecialDamage(target, damage, damagetype); + +} + +//========================================================================== +// +// AActor :: TakeSpecialDamage +// +//========================================================================== int AActor::TakeSpecialDamage (AActor *inflictor, AActor *source, int damage, FName damagetype) { @@ -7032,7 +7127,7 @@ public: } }; -IMPLEMENT_CLASS(DActorIterator, false, false, false, false); +IMPLEMENT_CLASS(DActorIterator, false, false); DEFINE_ACTION_FUNCTION(DActorIterator, Create) { PARAM_PROLOGUE; @@ -7252,7 +7347,7 @@ DEFINE_ACTION_FUNCTION(AActor, RestoreDamage) // //---------------------------------------------------------------------------- -IMPLEMENT_CLASS(DDropItem, false, true, true, false) +IMPLEMENT_CLASS(DDropItem, false, true) IMPLEMENT_POINTERS_START(DDropItem) IMPLEMENT_POINTER(Next) diff --git a/src/p_pillar.cpp b/src/p_pillar.cpp index 27eb13ec5..b0ea0e4a3 100644 --- a/src/p_pillar.cpp +++ b/src/p_pillar.cpp @@ -40,7 +40,7 @@ #include "serializer.h" #include "r_data/r_interpolate.h" -IMPLEMENT_CLASS(DPillar, false, true, false, false) +IMPLEMENT_CLASS(DPillar, false, true) IMPLEMENT_POINTERS_START(DPillar) IMPLEMENT_POINTER(m_Interp_Floor) diff --git a/src/p_plats.cpp b/src/p_plats.cpp index 9924a0f9c..43e8eefb4 100644 --- a/src/p_plats.cpp +++ b/src/p_plats.cpp @@ -35,7 +35,7 @@ static FRandom pr_doplat ("DoPlat"); -IMPLEMENT_CLASS(DPlat, false, false, false, false) +IMPLEMENT_CLASS(DPlat, false, false) DPlat::DPlat () { diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index ca305d677..eddeb3430 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -99,7 +99,7 @@ static const FGenericButtons ButtonChecks[] = // //------------------------------------------------------------------------ -IMPLEMENT_CLASS(DPSprite, false, true, false, false) +IMPLEMENT_CLASS(DPSprite, false, true) IMPLEMENT_POINTERS_START(DPSprite) IMPLEMENT_POINTER(Caller) diff --git a/src/p_pspr.h b/src/p_pspr.h index 7039b2cc8..d6eb2a82d 100644 --- a/src/p_pspr.h +++ b/src/p_pspr.h @@ -86,7 +86,7 @@ private: void Serialize(FSerializer &arc); void Tick(); - void Destroy(); + void Destroy() override; public: // must be public to be able to generate the field export tables. Grrr... TObjPtr Caller; diff --git a/src/p_pusher.cpp b/src/p_pusher.cpp index f2f982a7f..1cf004120 100644 --- a/src/p_pusher.cpp +++ b/src/p_pusher.cpp @@ -74,7 +74,7 @@ protected: friend bool PIT_PushThing (AActor *thing); }; -IMPLEMENT_CLASS(DPusher, false, true, false, false) +IMPLEMENT_CLASS(DPusher, false, true) IMPLEMENT_POINTERS_START(DPusher) IMPLEMENT_POINTER(m_Source) diff --git a/src/p_scroll.cpp b/src/p_scroll.cpp index f44eac25a..25789d944 100644 --- a/src/p_scroll.cpp +++ b/src/p_scroll.cpp @@ -44,7 +44,7 @@ public: DScroller (EScroll type, double dx, double dy, int control, int affectee, int accel, EScrollPos scrollpos = EScrollPos::scw_all); DScroller (double dx, double dy, const line_t *l, int control, int accel, EScrollPos scrollpos = EScrollPos::scw_all); - void Destroy(); + void Destroy() override; void Serialize(FSerializer &arc); void Tick (); @@ -73,7 +73,7 @@ private: } }; -IMPLEMENT_CLASS(DScroller, false, true, false, false) +IMPLEMENT_CLASS(DScroller, false, true) IMPLEMENT_POINTERS_START(DScroller) IMPLEMENT_POINTER(m_Interpolations[0]) diff --git a/src/p_spec.cpp b/src/p_spec.cpp index e687d5724..c9a8294b5 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -660,7 +660,7 @@ protected: short LastLight; }; -IMPLEMENT_CLASS(DLightTransfer, false, false, false, false) +IMPLEMENT_CLASS(DLightTransfer, false, false) void DLightTransfer::Serialize(FSerializer &arc) { @@ -750,7 +750,7 @@ protected: BYTE Flags; }; -IMPLEMENT_CLASS(DWallLightTransfer, false, false, false, false) +IMPLEMENT_CLASS(DWallLightTransfer, false, false) void DWallLightTransfer::Serialize(FSerializer &arc) { diff --git a/src/p_spec.h b/src/p_spec.h index 41d47c721..8a0729d6a 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -243,7 +243,7 @@ public: void Serialize(FSerializer &arc); void Tick (); - void Destroy(); + void Destroy() override; protected: EPillar m_Type; @@ -572,7 +572,7 @@ public: DElevator (sector_t *sec); - void Destroy(); + void Destroy() override; void Serialize(FSerializer &arc); void Tick (); @@ -617,7 +617,6 @@ protected: int offset, int timer, bool ceiling); void DoWaggle (bool ceiling); - void Destroy(); DWaggleBase (); }; diff --git a/src/p_switch.cpp b/src/p_switch.cpp index 2d5423f08..ae7cf2143 100644 --- a/src/p_switch.cpp +++ b/src/p_switch.cpp @@ -320,7 +320,7 @@ bool P_ChangeSwitchTexture (side_t *side, int useAgain, BYTE special, bool *ques // //========================================================================== -IMPLEMENT_CLASS(DActiveButton, false, false, false, false) +IMPLEMENT_CLASS(DActiveButton, false, false) DActiveButton::DActiveButton () { diff --git a/src/p_teleport.cpp b/src/p_teleport.cpp index 80bfd4f7f..14055202a 100644 --- a/src/p_teleport.cpp +++ b/src/p_teleport.cpp @@ -47,7 +47,7 @@ extern void P_CalcHeight (player_t *player); CVAR (Bool, telezoom, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG); -IMPLEMENT_CLASS(ATeleportFog, false, false, false, false) +IMPLEMENT_CLASS(ATeleportFog, false, false) void ATeleportFog::PostBeginPlay () { diff --git a/src/p_user.cpp b/src/p_user.cpp index 2917db668..03df6a0ca 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -508,7 +508,7 @@ int player_t::GetSpawnClass() // //=========================================================================== -IMPLEMENT_CLASS(PClassPlayerPawn, false, false, false, false) +IMPLEMENT_CLASS(PClassPlayerPawn, false, false) PClassPlayerPawn::PClassPlayerPawn() { @@ -622,14 +622,14 @@ void player_t::SendPitchLimits() const // //=========================================================================== -IMPLEMENT_CLASS(APlayerPawn, false, true, false, true) +IMPLEMENT_CLASS(APlayerPawn, false, true) IMPLEMENT_POINTERS_START(APlayerPawn) IMPLEMENT_POINTER(InvFirst) IMPLEMENT_POINTER(InvSel) IMPLEMENT_POINTERS_END -IMPLEMENT_CLASS(APlayerChunk, false, false, false, false) +IMPLEMENT_CLASS(APlayerChunk, false, false) void APlayerPawn::Serialize(FSerializer &arc) { @@ -882,7 +882,7 @@ void APlayerPawn::RemoveInventory (AInventory *item) // //=========================================================================== -bool APlayerPawn::UseInventory (AInventory *item) +bool APlayerPawn::DoUseInventory (AInventory *item) { const PClass *itemtype = item->GetClass(); @@ -896,7 +896,7 @@ bool APlayerPawn::UseInventory (AInventory *item) return false; } - if (!Super::UseInventory (item)) + if (!Super::DoUseInventory (item)) { // Heretic and Hexen advance the inventory cursor if the use failed. // Should this behavior be retained? @@ -1280,18 +1280,22 @@ void APlayerPawn::PlayRunning () void APlayerPawn::PlayAttacking () { - VINDEX(APlayerPawn, PlayAttacking); - VMValue params[1] = { (DObject*)this }; - VMFrameStack stack; - stack.Call(VFUNC, params, 1, nullptr, 0, nullptr); + IFVIRTUAL(APlayerPawn, PlayAttacking) + { + VMValue params[1] = { (DObject*)this }; + VMFrameStack stack; + stack.Call(func, params, 1, nullptr, 0, nullptr); + } } void APlayerPawn::PlayAttacking2 () { - VINDEX(APlayerPawn, PlayAttacking2); - VMValue params[1] = { (DObject*)this }; - VMFrameStack stack; - stack.Call(VFUNC, params, 1, nullptr, 0, nullptr); + IFVIRTUAL(APlayerPawn, PlayAttacking2) + { + VMValue params[1] = { (DObject*)this }; + VMFrameStack stack; + stack.Call(func, params, 1, nullptr, 0, nullptr); + } } void APlayerPawn::ThrowPoisonBag () @@ -1381,10 +1385,12 @@ void APlayerPawn::GiveDefaultInventory () void APlayerPawn::MorphPlayerThink () { - VINDEX(APlayerPawn, MorphPlayerThink); - VMValue params[1] = { (DObject*)this }; - VMFrameStack stack; - stack.Call(VFUNC, params, 1, nullptr, 0, nullptr); + IFVIRTUAL(APlayerPawn, MorphPlayerThink) + { + VMValue params[1] = { (DObject*)this }; + VMFrameStack stack; + stack.Call(func, params, 1, nullptr, 0, nullptr); + } } void APlayerPawn::ActivateMorphWeapon () diff --git a/src/po_man.cpp b/src/po_man.cpp index 4e304daa8..fafa227ee 100644 --- a/src/po_man.cpp +++ b/src/po_man.cpp @@ -172,7 +172,7 @@ static FPolyNode *FreePolyNodes; // //========================================================================== -IMPLEMENT_CLASS(DPolyAction, false, true, false, false) +IMPLEMENT_CLASS(DPolyAction, false, true) IMPLEMENT_POINTERS_START(DPolyAction) IMPLEMENT_POINTER(m_Interpolation) @@ -240,7 +240,7 @@ void DPolyAction::StopInterpolation () // //========================================================================== -IMPLEMENT_CLASS(DRotatePoly, false, false, false, false) +IMPLEMENT_CLASS(DRotatePoly, false, false) DRotatePoly::DRotatePoly () { @@ -257,7 +257,7 @@ DRotatePoly::DRotatePoly (int polyNum) // //========================================================================== -IMPLEMENT_CLASS(DMovePoly, false, false, false, false) +IMPLEMENT_CLASS(DMovePoly, false, false) DMovePoly::DMovePoly () { @@ -284,7 +284,7 @@ DMovePoly::DMovePoly (int polyNum) // //========================================================================== -IMPLEMENT_CLASS(DMovePolyTo, false, false, false, false) +IMPLEMENT_CLASS(DMovePolyTo, false, false) DMovePolyTo::DMovePolyTo() { @@ -309,7 +309,7 @@ DMovePolyTo::DMovePolyTo(int polyNum) // //========================================================================== -IMPLEMENT_CLASS(DPolyDoor, false, false, false, false) +IMPLEMENT_CLASS(DPolyDoor, false, false) DPolyDoor::DPolyDoor () { diff --git a/src/po_man.h b/src/po_man.h index ec6a3901b..4d78fa179 100644 --- a/src/po_man.h +++ b/src/po_man.h @@ -12,7 +12,7 @@ class DPolyAction : public DThinker public: DPolyAction(int polyNum); void Serialize(FSerializer &arc); - void Destroy(); + void Destroy() override; void Stop(); double GetSpeed() const { return m_Speed; } diff --git a/src/posix/sdl/sdlvideo.cpp b/src/posix/sdl/sdlvideo.cpp index a1e6056ca..4a6833026 100644 --- a/src/posix/sdl/sdlvideo.cpp +++ b/src/posix/sdl/sdlvideo.cpp @@ -79,7 +79,7 @@ private: SDLFB () {} }; -IMPLEMENT_CLASS(SDLFB, false, false, false, false) +IMPLEMENT_CLASS(SDLFB, false, false) struct MiniModeInfo { diff --git a/src/r_data/r_interpolate.cpp b/src/r_data/r_interpolate.cpp index c98adb47b..a202345a3 100644 --- a/src/r_data/r_interpolate.cpp +++ b/src/r_data/r_interpolate.cpp @@ -62,7 +62,7 @@ public: DSectorPlaneInterpolation() {} DSectorPlaneInterpolation(sector_t *sector, bool plane, bool attach); - void Destroy(); + void Destroy() override; void UpdateInterpolation(); void Restore(); void Interpolate(double smoothratio); @@ -91,7 +91,7 @@ public: DSectorScrollInterpolation() {} DSectorScrollInterpolation(sector_t *sector, bool plane); - void Destroy(); + void Destroy() override; void UpdateInterpolation(); void Restore(); void Interpolate(double smoothratio); @@ -119,7 +119,7 @@ public: DWallScrollInterpolation() {} DWallScrollInterpolation(side_t *side, int part); - void Destroy(); + void Destroy() override; void UpdateInterpolation(); void Restore(); void Interpolate(double smoothratio); @@ -146,7 +146,7 @@ public: DPolyobjInterpolation() {} DPolyobjInterpolation(FPolyObj *poly); - void Destroy(); + void Destroy() override; void UpdateInterpolation(); void Restore(); void Interpolate(double smoothratio); @@ -161,17 +161,17 @@ public: // //========================================================================== -IMPLEMENT_CLASS(DInterpolation, true, true, false, false) +IMPLEMENT_CLASS(DInterpolation, true, true) IMPLEMENT_POINTERS_START(DInterpolation) IMPLEMENT_POINTER(Next) IMPLEMENT_POINTER(Prev) IMPLEMENT_POINTERS_END -IMPLEMENT_CLASS(DSectorPlaneInterpolation, false, false, false, false) -IMPLEMENT_CLASS(DSectorScrollInterpolation, false, false, false, false) -IMPLEMENT_CLASS(DWallScrollInterpolation, false, false, false, false) -IMPLEMENT_CLASS(DPolyobjInterpolation, false, false, false, false) +IMPLEMENT_CLASS(DSectorPlaneInterpolation, false, false) +IMPLEMENT_CLASS(DSectorScrollInterpolation, false, false) +IMPLEMENT_CLASS(DWallScrollInterpolation, false, false) +IMPLEMENT_CLASS(DPolyobjInterpolation, false, false) //========================================================================== // diff --git a/src/r_data/r_interpolate.h b/src/r_data/r_interpolate.h index 092cbe5ee..44ff9bed0 100644 --- a/src/r_data/r_interpolate.h +++ b/src/r_data/r_interpolate.h @@ -27,7 +27,7 @@ public: int AddRef(); int DelRef(bool force = false); - virtual void Destroy(); + void Destroy() override; virtual void UpdateInterpolation() = 0; virtual void Restore() = 0; virtual void Interpolate(double smoothratio) = 0; diff --git a/src/r_defs.h b/src/r_defs.h index a21d23616..2d16d28f9 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -253,7 +253,7 @@ class ASectorAction : public AActor DECLARE_CLASS (ASectorAction, AActor) public: ASectorAction (bool activatedByUse = false); - void Destroy (); + void Destroy () override; void BeginPlay (); void Activate (AActor *source); void Deactivate (AActor *source); diff --git a/src/s_advsound.cpp b/src/s_advsound.cpp index c68df5f3c..083e0eeef 100644 --- a/src/s_advsound.cpp +++ b/src/s_advsound.cpp @@ -2213,7 +2213,7 @@ private: int NextCheck; }; -IMPLEMENT_CLASS(AAmbientSound, false, false, false, false) +IMPLEMENT_CLASS(AAmbientSound, false, false) //========================================================================== // @@ -2346,7 +2346,7 @@ void AAmbientSound::SetTicker (struct FAmbientSound *ambient) void AAmbientSound::BeginPlay () { Super::BeginPlay (); - Activate (NULL); + CallActivate (NULL); } //========================================================================== @@ -2470,7 +2470,7 @@ public: virtual void PostBeginPlay(); }; -IMPLEMENT_CLASS(AMusicChanger, false, false, false, false) +IMPLEMENT_CLASS(AMusicChanger, false, false) bool AMusicChanger::DoTriggerAction (AActor *triggerer, int activationType) { diff --git a/src/s_sndseq.cpp b/src/s_sndseq.cpp index 1bed35ed5..28786ef8f 100644 --- a/src/s_sndseq.cpp +++ b/src/s_sndseq.cpp @@ -105,7 +105,7 @@ class DSeqActorNode : public DSeqNode HAS_OBJECT_POINTERS public: DSeqActorNode(AActor *actor, int sequence, int modenum); - void Destroy(); + void Destroy() override; void Serialize(FSerializer &arc); void MakeSound(int loop, FSoundID id) { @@ -133,7 +133,7 @@ class DSeqPolyNode : public DSeqNode DECLARE_CLASS(DSeqPolyNode, DSeqNode) public: DSeqPolyNode(FPolyObj *poly, int sequence, int modenum); - void Destroy(); + void Destroy() override; void Serialize(FSerializer &arc); void MakeSound(int loop, FSoundID id) { @@ -161,7 +161,7 @@ class DSeqSectorNode : public DSeqNode DECLARE_CLASS(DSeqSectorNode, DSeqNode) public: DSeqSectorNode(sector_t *sec, int chan, int sequence, int modenum); - void Destroy(); + void Destroy() override; void Serialize(FSerializer &arc); void MakeSound(int loop, FSoundID id) { @@ -285,7 +285,7 @@ void DSeqNode::SerializeSequences (FSerializer &arc) arc("sndseqlisthead", SequenceListHead); } -IMPLEMENT_CLASS(DSeqNode, false, true, false, false) +IMPLEMENT_CLASS(DSeqNode, false, true) IMPLEMENT_POINTERS_START(DSeqNode) IMPLEMENT_POINTER(m_ChildSeqNode) @@ -429,7 +429,7 @@ FName DSeqNode::GetSequenceName () const return Sequences[m_Sequence]->SeqName; } -IMPLEMENT_CLASS(DSeqActorNode, false, true, false, false) +IMPLEMENT_CLASS(DSeqActorNode, false, true) IMPLEMENT_POINTERS_START(DSeqActorNode) IMPLEMENT_POINTER(m_Actor) @@ -441,7 +441,7 @@ void DSeqActorNode::Serialize(FSerializer &arc) arc("actor", m_Actor); } -IMPLEMENT_CLASS(DSeqPolyNode, false, false, false, false) +IMPLEMENT_CLASS(DSeqPolyNode, false, false) void DSeqPolyNode::Serialize(FSerializer &arc) { @@ -449,7 +449,7 @@ void DSeqPolyNode::Serialize(FSerializer &arc) arc("poly", m_Poly); } -IMPLEMENT_CLASS(DSeqSectorNode, false, false, false, false) +IMPLEMENT_CLASS(DSeqSectorNode, false, false) void DSeqSectorNode::Serialize(FSerializer &arc) { diff --git a/src/s_sndseq.h b/src/s_sndseq.h index 74ded5af4..13444f862 100644 --- a/src/s_sndseq.h +++ b/src/s_sndseq.h @@ -22,7 +22,7 @@ class DSeqNode : public DObject public: void Serialize(FSerializer &arc); void StopAndDestroy (); - void Destroy (); + void Destroy() override; void Tick (); void ChangeData (int seqOffset, int delayTics, float volume, FSoundID currentSoundID); void AddChoice (int seqnum, seqtype_t type); diff --git a/src/scripting/decorate/olddecorations.cpp b/src/scripting/decorate/olddecorations.cpp index 7540d45f4..8321a8f89 100644 --- a/src/scripting/decorate/olddecorations.cpp +++ b/src/scripting/decorate/olddecorations.cpp @@ -96,7 +96,7 @@ public: } }; -IMPLEMENT_CLASS(AFakeInventory, false, false, false, false) +IMPLEMENT_CLASS(AFakeInventory, false, false) DEFINE_FIELD(AFakeInventory, Respawnable) diff --git a/src/scripting/vm/vm.h b/src/scripting/vm/vm.h index 05c43aa1f..c7082ff76 100644 --- a/src/scripting/vm/vm.h +++ b/src/scripting/vm/vm.h @@ -667,7 +667,7 @@ public: bool Final = false; // cannot be overridden bool Unsafe = false; // Contains references to class fields that are unsafe for psp and item state calls. BYTE ImplicitArgs = 0; // either 0 for static, 1 for method or 3 for action - int VirtualIndex = -1; + unsigned VirtualIndex = ~0u; FName Name; TArray DefaultArgs; FString PrintableName; // so that the VM can print meaningful info if something in this function goes wrong. diff --git a/src/scripting/vm/vmframe.cpp b/src/scripting/vm/vmframe.cpp index f35c3718d..0ec6ec15b 100644 --- a/src/scripting/vm/vmframe.cpp +++ b/src/scripting/vm/vmframe.cpp @@ -34,15 +34,15 @@ #include #include "dobject.h" -IMPLEMENT_CLASS(VMException, false, false, false, false) -IMPLEMENT_CLASS(VMFunction, true, true, false, false) +IMPLEMENT_CLASS(VMException, false, false) +IMPLEMENT_CLASS(VMFunction, true, true) IMPLEMENT_POINTERS_START(VMFunction) IMPLEMENT_POINTER(Proto) IMPLEMENT_POINTERS_END -IMPLEMENT_CLASS(VMScriptFunction, false, false, false, false) -IMPLEMENT_CLASS(VMNativeFunction, false, false, false, false) +IMPLEMENT_CLASS(VMScriptFunction, false, false) +IMPLEMENT_CLASS(VMNativeFunction, false, false) VMScriptFunction::VMScriptFunction(FName name) { diff --git a/src/scripting/zscript/zcc_compile.cpp b/src/scripting/zscript/zcc_compile.cpp index a4a2cc453..98ebc17d9 100644 --- a/src/scripting/zscript/zcc_compile.cpp +++ b/src/scripting/zscript/zcc_compile.cpp @@ -51,8 +51,6 @@ #include "codegeneration/codegen.h" #include "vmbuilder.h" -#define DEFAULTS_VMEXPORT ((BYTE *)(void *)1) - //========================================================================== // // ZCCCompiler :: ProcessClass @@ -505,26 +503,6 @@ void ZCCCompiler::CreateClassTypes() } else { - // The parent was the last native class in the inheritance tree. - // There is probably a better place for this somewhere else - // TODO: Do this somewhere else or find a less hackish way to do it - if (!parent->bRuntimeClass) - { - //assert(parent->VMExported != nullptr); // Ideally the macro would be used on all inheritable-native classes - /**/ if (parent->VMExported != nullptr) { /**/ // remove the if condition when all done - - parent = parent->VMExported; - assert(parent->bRuntimeClass == false); - - if (parent->Defaults == nullptr) - { - // We have to manually do that since zscript knows nothing about these - parent->Defaults = DEFAULTS_VMEXPORT; - } - - /**/ } /**/ - } - // We will never get here if the name is a duplicate, so we can just do the assignment. try { @@ -1980,15 +1958,6 @@ void ZCCCompiler::InitDefaults() // Copy the parent's defaults and meta data. auto ti = static_cast(c->Type()); - // Hack for the DVMObjects as they weren't in the list originally - // TODO: process them in a non hackish way obviously - if (ti->ParentClass->Defaults == DEFAULTS_VMEXPORT) - { - ti->ParentClass->Defaults = nullptr; - ti->ParentClass->InitializeDefaults(); - ti->ParentClass->ParentClass->DeriveData(ti->ParentClass); - } - ti->InitializeDefaults(); ti->ParentClass->DeriveData(ti); @@ -2400,11 +2369,6 @@ void ZCCCompiler::InitFunctions() // cannot be done earlier because it requires the parent class to be processed by this code, too. if (c->Type()->ParentClass != nullptr) { - if (c->Type()->ParentClass->Virtuals.Size() == 0) - { - // This a VMClass which didn't get processed here. - c->Type()->ParentClass->Virtuals = c->Type()->ParentClass->ParentClass->Virtuals; - } c->Type()->Virtuals = c->Type()->ParentClass->Virtuals; } for (auto f : c->Functions) diff --git a/src/v_video.cpp b/src/v_video.cpp index b18a6e727..7192c5d03 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -69,8 +69,8 @@ int active_con_scale(); FRenderer *Renderer; -IMPLEMENT_CLASS(DCanvas, true, false, false, false) -IMPLEMENT_CLASS(DFrameBuffer, true, false, false, false) +IMPLEMENT_CLASS(DCanvas, true, false) +IMPLEMENT_CLASS(DFrameBuffer, true, false) #if defined(_DEBUG) && defined(_M_IX86) && !defined(__MINGW32__) #define DBGBREAK { __asm int 3 } @@ -106,11 +106,11 @@ public: float Gamma; }; -IMPLEMENT_CLASS(DDummyFrameBuffer, true, false, false, false) +IMPLEMENT_CLASS(DDummyFrameBuffer, true, false) // SimpleCanvas is not really abstract, but this macro does not // try to generate a CreateNew() function. -IMPLEMENT_CLASS(DSimpleCanvas, true, false, false, false) +IMPLEMENT_CLASS(DSimpleCanvas, true, false) class FPaletteTester : public FTexture { diff --git a/src/virtual.h b/src/virtual.h index 26fc694ea..8485dec07 100644 --- a/src/virtual.h +++ b/src/virtual.h @@ -1,275 +1,21 @@ - - - -// Templates really are powerful -#define VMEXPORTED_NATIVES_START \ - template class ExportedNatives : public ExportedNatives {}; \ - template<> class ExportedNatives { \ - protected: ExportedNatives() {} \ - public: \ - static ExportedNatives *Get() { static ExportedNatives *Instance = nullptr; if (Instance == nullptr) Instance = new ExportedNatives; return Instance; } \ - ExportedNatives(const ExportedNatives&) = delete; \ - ExportedNatives(ExportedNatives&&) = delete; - -#define VMEXPORTED_NATIVES_FUNC(func) \ - template ret func(void *ptr, args ... arglist) { return ret(); } - -#define VMEXPORTED_NATIVES_END }; - -#define VMEXPORT_NATIVES_START(cls, parent) \ - template<> class ExportedNatives : public ExportedNatives { \ - protected: ExportedNatives() {} \ - public: \ - static ExportedNatives *Get() { static ExportedNatives *Instance = nullptr; if (Instance == nullptr) Instance = new ExportedNatives; return Instance; } \ - ExportedNatives(const ExportedNatives&) = delete; \ - ExportedNatives(ExportedNatives&&) = delete; - -#define VMEXPORT_NATIVES_FUNC(func) \ - template ret func(void *ptr, args ... arglist) { return static_cast(ptr)->object::func(arglist...); } - -#define VMEXPORT_NATIVES_END(cls) }; - - -//Initial list -VMEXPORTED_NATIVES_START - VMEXPORTED_NATIVES_FUNC(Destroy) - VMEXPORTED_NATIVES_FUNC(Tick) - VMEXPORTED_NATIVES_FUNC(PostBeginPlay) - VMEXPORTED_NATIVES_FUNC(BeginPlay) - VMEXPORTED_NATIVES_FUNC(Activate) - VMEXPORTED_NATIVES_FUNC(Deactivate) - VMEXPORTED_NATIVES_FUNC(DoSpecialDamage) - VMEXPORTED_NATIVES_FUNC(UseInventory) -VMEXPORTED_NATIVES_END - - -inline int GetVirtualIndex(PClass *cls, const char *funcname) +inline unsigned GetVirtualIndex(PClass *cls, const char *funcname) { // Look up the virtual function index in the defining class because this may have gotten overloaded in subclasses with something different than a virtual override. auto sym = dyn_cast(cls->Symbols.FindSymbol(funcname, false)); assert(sym != nullptr); auto VIndex = sym->Variants[0].Implementation->VirtualIndex; - assert(VIndex >= 0); return VIndex; } -#define VINDEX(cls, funcname) \ - static int VIndex = -1; \ - if (VIndex < 0) { \ +#define IFVIRTUAL(cls, funcname) \ + static unsigned VIndex = ~0u; \ + if (VIndex == ~0u) { \ VIndex = GetVirtualIndex(RUNTIME_CLASS(cls), #funcname); \ - if (VIndex < 0) I_Error("Unable to find virtual function %s in " #cls, #funcname); \ - } + assert(VIndex != ~0u); \ + } \ + auto clss = GetClass(); \ + VMFunction *func = clss->Virtuals.Size() > VIndex? clss->Virtuals[VIndex] : nullptr; \ + if (func != nullptr) -#define VFUNC this->GetClass()->Virtuals[VIndex] -template -class DVMObject : public T -{ -public: - static char *FormatClassName() - { - static char *name = nullptr; - if (name == nullptr) - { - name = new char[64]; - mysnprintf(name, 64, "DVMObject<%s>", Super::RegistrationInfo.Name); - atterm([]{ delete[] DVMObject::RegistrationInfo.Name; }); - } - return name; - } - virtual PClass *StaticType() const - { - return RegistrationInfo.MyClass; - } - static ClassReg RegistrationInfo; - static ClassReg * const RegistrationInfoPtr; - typedef T Super; - -private: - typedef DVMObject ThisClass; - static void InPlaceConstructor(void *mem) - { - new((EInPlace *)mem) DVMObject; - } - -public: - void Destroy() - { - if (this->ObjectFlags & OF_SuperCall) - { - this->ObjectFlags &= ~OF_SuperCall; - ExportedNatives::Get()->template Destroy(this); - } - else - { - VINDEX(DObject, Destroy); - // Without the type cast this picks the 'void *' assignment... - VMValue params[1] = { (DObject*)this }; - VMFrameStack stack; - stack.Call(VFUNC, params, 1, nullptr, 0, nullptr); - } - } - void Tick() - { - if (this->ObjectFlags & OF_SuperCall) - { - this->ObjectFlags &= ~OF_SuperCall; - ExportedNatives::Get()->template Tick(this); - } - else - { - VINDEX(DThinker, Tick); - // Without the type cast this picks the 'void *' assignment... - VMValue params[1] = { (DObject*)this }; - VMFrameStack stack; - stack.Call(VFUNC, params, 1, nullptr, 0, nullptr); - } - } - - void PostBeginPlay() - { - if (this->ObjectFlags & OF_SuperCall) - { - this->ObjectFlags &= ~OF_SuperCall; - ExportedNatives::Get()->template PostBeginPlay(this); - } - else - { - VINDEX(DThinker, PostBeginPlay); - // Without the type cast this picks the 'void *' assignment... - VMValue params[1] = { (DObject*)this }; - VMFrameStack stack; - stack.Call(VFUNC, params, 1, nullptr, 0, nullptr); - } - } - - void BeginPlay() - { - if (this->ObjectFlags & OF_SuperCall) - { - this->ObjectFlags &= ~OF_SuperCall; - ExportedNatives::Get()->template BeginPlay(this); - } - else - { - VINDEX(AActor, BeginPlay); - // Without the type cast this picks the 'void *' assignment... - VMValue params[1] = { (DObject*)this }; - VMFrameStack stack; - stack.Call(VFUNC, params, 1, nullptr, 0, nullptr); - } - } - - void Activate(AActor *activator) - { - if (this->ObjectFlags & OF_SuperCall) - { - this->ObjectFlags &= ~OF_SuperCall; - ExportedNatives::Get()->template Activate(this, activator); - } - else - { - VINDEX(AActor, Activate); - // Without the type cast this picks the 'void *' assignment... - VMValue params[2] = { (DObject*)this, (DObject*)activator }; - VMFrameStack stack; - stack.Call(VFUNC, params, 2, nullptr, 0, nullptr); - } - } - - void Deactivate(AActor *activator) - { - if (this->ObjectFlags & OF_SuperCall) - { - this->ObjectFlags &= ~OF_SuperCall; - ExportedNatives::Get()->template Deactivate(this, activator); - } - else - { - VINDEX(AActor, Deactivate); - // Without the type cast this picks the 'void *' assignment... - VMValue params[2] = { (DObject*)this, (DObject*)activator }; - VMFrameStack stack; - stack.Call(VFUNC, params, 2, nullptr, 0, nullptr); - } - } - int DoSpecialDamage(AActor *target, int damage, FName damagetype) - { - if (this->ObjectFlags & OF_SuperCall) - { - this->ObjectFlags &= ~OF_SuperCall; - return ExportedNatives::Get()->template DoSpecialDamage(this, target, damage, damagetype); - } - else - { - VINDEX(AActor, DoSpecialDamage); - // Without the type cast this picks the 'void *' assignment... - VMValue params[4] = { (DObject*)this, (DObject*)target, damage, damagetype.GetIndex() }; - VMReturn ret; - VMFrameStack stack; - int retval; - ret.IntAt(&retval); - stack.Call(VFUNC, params, 4, &ret, 1, nullptr); - return retval; - } - } - bool UseInventory(AInventory *item) - { - if (this->ObjectFlags & OF_SuperCall) - { - this->ObjectFlags &= ~OF_SuperCall; - return ExportedNatives::Get()->template UseInventory(this, item); - } - else - { - VINDEX(AActor, UseInventory); - // Without the type cast this picks the 'void *' assignment... - VMValue params[2] = { (DObject*)this, (DObject*)item }; - VMReturn ret; - VMFrameStack stack; - int retval; - ret.IntAt(&retval); - stack.Call(VFUNC, params, 2, &ret, 1, nullptr); - return !!retval; - } - } - -}; - -template -ClassReg DVMObject::RegistrationInfo = -{ - nullptr, - DVMObject::FormatClassName(), - &DVMObject::Super::RegistrationInfo, - nullptr, - nullptr, - DVMObject::InPlaceConstructor, - nullptr, - sizeof(DVMObject), - DVMObject::MetaClassNum -}; -template _DECLARE_TI(DVMObject) - -VMEXPORT_NATIVES_START(DObject, void) - VMEXPORT_NATIVES_FUNC(Destroy) -VMEXPORT_NATIVES_END(DObject) - -VMEXPORT_NATIVES_START(DThinker, DObject) - VMEXPORT_NATIVES_FUNC(Tick) - VMEXPORT_NATIVES_FUNC(PostBeginPlay) -VMEXPORT_NATIVES_END(DThinker) - -VMEXPORT_NATIVES_START(AActor, DThinker) - VMEXPORT_NATIVES_FUNC(BeginPlay) - VMEXPORT_NATIVES_FUNC(Activate) - VMEXPORT_NATIVES_FUNC(Deactivate) - VMEXPORT_NATIVES_FUNC(DoSpecialDamage) - VMEXPORT_NATIVES_FUNC(UseInventory) -VMEXPORT_NATIVES_END(AActor) - -/* -VMEXPORT_NATIVES_START(AActor, DThinker) -VMEXPORT_NATIVES_END(AActor) -*/ diff --git a/src/win32/fb_d3d9.cpp b/src/win32/fb_d3d9.cpp index 6d162bbec..0e8dd3dec 100644 --- a/src/win32/fb_d3d9.cpp +++ b/src/win32/fb_d3d9.cpp @@ -91,7 +91,7 @@ // TYPES ------------------------------------------------------------------- -IMPLEMENT_CLASS(D3DFB, false, false, false, false) +IMPLEMENT_CLASS(D3DFB, false, false) struct D3DFB::PackedTexture { diff --git a/src/win32/fb_ddraw.cpp b/src/win32/fb_ddraw.cpp index bd5a4db23..85f0c4768 100644 --- a/src/win32/fb_ddraw.cpp +++ b/src/win32/fb_ddraw.cpp @@ -61,7 +61,7 @@ // TYPES ------------------------------------------------------------------- -IMPLEMENT_CLASS(DDrawFB, false, false, false, false) +IMPLEMENT_CLASS(DDrawFB, false, false) // EXTERNAL FUNCTION PROTOTYPES -------------------------------------------- diff --git a/src/win32/win32video.cpp b/src/win32/win32video.cpp index df96f7f41..0d91ed1d0 100644 --- a/src/win32/win32video.cpp +++ b/src/win32/win32video.cpp @@ -80,7 +80,7 @@ // TYPES ------------------------------------------------------------------- -IMPLEMENT_CLASS(BaseWinFB, true, false, false, false) +IMPLEMENT_CLASS(BaseWinFB, true, false) typedef IDirect3D9 *(WINAPI *DIRECT3DCREATE9FUNC)(UINT SDKVersion); typedef HRESULT (WINAPI *DIRECTDRAWCREATEFUNC)(GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter); diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index c899bbd37..3eebceeb5 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -6,7 +6,7 @@ class Object native native static int G_SkillPropertyInt(int p); native static double G_SkillPropertyFloat(int p); - virtual native void Destroy(); + /*virtual*/ native void Destroy(); } class Thinker : Object native diff --git a/wadsrc/static/zscript/hexen/firedemon.txt b/wadsrc/static/zscript/hexen/firedemon.txt index b425ecb11..9ca12529f 100644 --- a/wadsrc/static/zscript/hexen/firedemon.txt +++ b/wadsrc/static/zscript/hexen/firedemon.txt @@ -4,7 +4,7 @@ class FireDemon : Actor { const FIREDEMON_ATTACK_RANGE = 64*8.; - int strafecount; + int fdstrafecount; Default { @@ -77,7 +77,7 @@ class FireDemon : Actor // Fire Demon AI // // special1 index into floatbob - // strafecount whether strafing or not + // fdstrafecount whether strafing or not //============================================================================ //============================================================================ @@ -125,7 +125,7 @@ class FireDemon : Actor } // Initialize fire demon - strafecount = 0; + fdstrafecount = 0; bJustAttacked = false; } @@ -188,13 +188,13 @@ class FireDemon : Actor } // Strafe - if (strafecount > 0) + if (fdstrafecount > 0) { - strafecount--; + fdstrafecount--; } else { - strafecount = 0; + fdstrafecount = 0; Vel.X = Vel.Y = 0; dist = Distance2D(target); if (dist < FIREDEMON_ATTACK_RANGE) @@ -207,7 +207,7 @@ class FireDemon : Actor else ang -= 90; Thrust(8, ang); - strafecount = 3; // strafe time + fdstrafecount = 3; // strafe time } } } @@ -215,7 +215,7 @@ class FireDemon : Actor FaceMovementDirection (); // Normal movement - if (!strafecount) + if (!fdstrafecount) { if (--movecount<0 || !MonsterMove ()) {