diff --git a/src/b_bot.cpp b/src/b_bot.cpp index 9bddac1ad..9ff12a8ab 100644 --- a/src/b_bot.cpp +++ b/src/b_bot.cpp @@ -63,7 +63,7 @@ IMPLEMENT_POINTERS_END DEFINE_FIELD(DBot, dest) -DBot::DBot () +void DBot::Construct() { Clear (); } diff --git a/src/b_bot.h b/src/b_bot.h index 0d28f796c..71b8252f8 100644 --- a/src/b_bot.h +++ b/src/b_bot.h @@ -167,7 +167,7 @@ class DBot : public DThinker HAS_OBJECT_POINTERS public: static const int DEFAULT_STAT = STAT_BOT; - DBot (); + void Construct (); void Clear (); void Serialize(FSerializer &arc); diff --git a/src/decallib.cpp b/src/decallib.cpp index 9a3cd15cd..8a984ecd7 100644 --- a/src/decallib.cpp +++ b/src/decallib.cpp @@ -110,11 +110,12 @@ struct DDecalThinker : public DThinker HAS_OBJECT_POINTERS public: static const int DEFAULT_STAT = STAT_DECALTHINKER; - DDecalThinker (DBaseDecal *decal) : TheDecal (decal) {} + void Construct(DBaseDecal *decal) + { + TheDecal = decal; + } void Serialize(FSerializer &arc); TObjPtr TheDecal; -protected: - DDecalThinker() = default; }; IMPLEMENT_CLASS(DDecalThinker, false, true) @@ -142,15 +143,16 @@ class DDecalFader : public DDecalThinker { DECLARE_CLASS (DDecalFader, DDecalThinker) public: - DDecalFader (DBaseDecal *decal) : DDecalThinker (decal) {} + void Construct(DBaseDecal *decal) + { + Super::Construct(decal); + } void Serialize(FSerializer &arc); void Tick (); int TimeToStartDecay; int TimeToEndDecay; double StartTrans; -private: - DDecalFader () {} }; struct FDecalColorerAnim : public FDecalAnimator @@ -167,7 +169,10 @@ class DDecalColorer : public DDecalThinker { DECLARE_CLASS (DDecalColorer, DDecalThinker) public: - DDecalColorer (DBaseDecal *decal) : DDecalThinker (decal) {} + void Construct(DBaseDecal *decal) + { + Super::Construct(decal); + } void Serialize(FSerializer &arc); void Tick (); @@ -175,8 +180,6 @@ public: int TimeToEndDecay; PalEntry StartColor; PalEntry GoalColor; -private: - DDecalColorer () {} }; struct FDecalStretcherAnim : public FDecalAnimator @@ -193,7 +196,10 @@ class DDecalStretcher : public DDecalThinker { DECLARE_CLASS (DDecalStretcher, DDecalThinker) public: - DDecalStretcher (DBaseDecal *decal) : DDecalThinker (decal) {} + void Construct(DBaseDecal *decal) + { + Super::Construct(decal); + } void Serialize(FSerializer &arc); void Tick (); @@ -206,8 +212,6 @@ public: bool bStretchX; bool bStretchY; bool bStarted; -private: - DDecalStretcher () {} }; struct FDecalSliderAnim : public FDecalAnimator @@ -224,7 +228,10 @@ class DDecalSlider : public DDecalThinker { DECLARE_CLASS (DDecalSlider, DDecalThinker) public: - DDecalSlider (DBaseDecal *decal) : DDecalThinker (decal) {} + void Construct(DBaseDecal *decal) + { + Super::Construct(decal); + } void Serialize(FSerializer &arc); void Tick (); @@ -235,8 +242,6 @@ public: double StartX; double StartY; bool bStarted; -private: - DDecalSlider () {} }; struct FDecalCombinerAnim : public FDecalAnimator diff --git a/src/dobjtype.cpp b/src/dobjtype.cpp index 2e7a006b1..96a135a03 100644 --- a/src/dobjtype.cpp +++ b/src/dobjtype.cpp @@ -562,12 +562,7 @@ void PClass::InitializeDefaults() assert(Defaults == nullptr); Defaults = (uint8_t *)M_Malloc(Size); - // run the constructor on the defaults to set the vtbl pointer which is needed to run class-aware functions on them. - // Temporarily setting bSerialOverride prevents linking into the thinker chains. - auto s = DThinker::bSerialOverride; - DThinker::bSerialOverride = true; ConstructNative(Defaults); - DThinker::bSerialOverride = s; // We must unlink the defaults from the class list because it's just a static block of data to the engine. DObject *optr = (DObject*)Defaults; GC::Root = optr->ObjNext; diff --git a/src/dsectoreffect.cpp b/src/dsectoreffect.cpp index 755253148..adc9c5f0a 100644 --- a/src/dsectoreffect.cpp +++ b/src/dsectoreffect.cpp @@ -56,7 +56,7 @@ void DSectorEffect::OnDestroy() Super::OnDestroy(); } -DSectorEffect::DSectorEffect (sector_t *sector) +void DSectorEffect::Construct(sector_t *sector) { m_Sector = sector; } @@ -81,9 +81,9 @@ IMPLEMENT_POINTERS_START(DMover) IMPLEMENT_POINTER(interpolation) IMPLEMENT_POINTERS_END -DMover::DMover (sector_t *sector) - : DSectorEffect (sector) +void DMover::Construct (sector_t *sector) { + Super::Construct(sector); interpolation = nullptr; } @@ -111,9 +111,9 @@ void DMover::StopInterpolation(bool force) IMPLEMENT_CLASS(DMovingFloor, true, false) -DMovingFloor::DMovingFloor (sector_t *sector) - : DMover (sector) +void DMovingFloor::Construct(sector_t *sector) { + Super::Construct(sector); sector->floordata = this; interpolation = sector->SetInterpolation(sector_t::FloorMove, true); } @@ -121,9 +121,9 @@ DMovingFloor::DMovingFloor (sector_t *sector) IMPLEMENT_CLASS(DMovingCeiling, true, false) -DMovingCeiling::DMovingCeiling (sector_t *sector, bool interpolate) - : DMover (sector) +void DMovingCeiling::Construct(sector_t *sector, bool interpolate) { + Super::Construct(sector); sector->ceilingdata = this; if (interpolate) interpolation = sector->SetInterpolation(sector_t::CeilingMove, true); } diff --git a/src/dsectoreffect.h b/src/dsectoreffect.h index a3ccc718c..cbaff9efc 100644 --- a/src/dsectoreffect.h +++ b/src/dsectoreffect.h @@ -9,7 +9,7 @@ class DSectorEffect : public DThinker DECLARE_CLASS (DSectorEffect, DThinker) public: static const int DEFAULT_STAT = STAT_SECTOREFFECT; - DSectorEffect (sector_t *sector); + void Construct(sector_t *sector); void Serialize(FSerializer &arc); @@ -18,10 +18,6 @@ public: sector_t *GetSector() const { return m_Sector; } sector_t *m_Sector; - -protected: - DSectorEffect() = default; - }; class DMover : public DSectorEffect @@ -29,15 +25,14 @@ class DMover : public DSectorEffect DECLARE_ABSTRACT_CLASS (DMover, DSectorEffect) HAS_OBJECT_POINTERS protected: - DMover (sector_t *sector); + void Construct(sector_t *sector); TObjPtr interpolation; public: void StopInterpolation(bool force = false); protected: - DMover () {} - + void Serialize(FSerializer &arc); void OnDestroy() override; }; @@ -46,16 +41,14 @@ class DMovingFloor : public DMover { DECLARE_ABSTRACT_CLASS (DMovingFloor, DMover) protected: - DMovingFloor (sector_t *sector); - DMovingFloor() {} + void Construct(sector_t *sector); }; class DMovingCeiling : public DMover { DECLARE_ABSTRACT_CLASS (DMovingCeiling, DMover) protected: - DMovingCeiling (sector_t *sector, bool interpolate = true); - DMovingCeiling () {} + void Construct(sector_t *sector, bool interpolate = true); }; #endif //__DSECTOREFFECT_H__ diff --git a/src/dthinker.cpp b/src/dthinker.cpp index dc7ffdd6b..959d9f3e9 100644 --- a/src/dthinker.cpp +++ b/src/dthinker.cpp @@ -56,7 +56,6 @@ DThinker *NextToThink; FThinkerList DThinker::Thinkers[MAX_STATNUM+2]; FThinkerList DThinker::FreshThinkers[MAX_STATNUM+1]; -bool DThinker::bSerialOverride = false; //========================================================================== // @@ -232,17 +231,6 @@ void DThinker::SerializeThinkers(FSerializer &arc, bool hubLoad) // //========================================================================== -DThinker::DThinker () throw() -{ - NextThinker = nullptr; - PrevThinker = nullptr; -} - -DThinker::DThinker(no_link_type foo) throw() -{ - foo; // Avoid unused argument warnings. -} - DThinker::~DThinker () { assert(NextThinker == nullptr && PrevThinker == nullptr); diff --git a/src/dthinker.h b/src/dthinker.h index 548eb6bd0..c90c8b536 100644 --- a/src/dthinker.h +++ b/src/dthinker.h @@ -67,7 +67,6 @@ class DThinker : public DObject DECLARE_CLASS (DThinker, DObject) public: static const int DEFAULT_STAT = STAT_DEFAULT; - DThinker () throw(); void OnDestroy () override; virtual ~DThinker (); virtual void Tick (); @@ -92,11 +91,6 @@ public: static void MarkRoots(); static DThinker *FirstThinker (int statnum); - static bool bSerialOverride; - - // only used internally but Create needs access. - enum no_link_type { NO_LINK }; - DThinker(no_link_type) throw(); private: static void DestroyThinkersInList (FThinkerList &list); static bool DoDestroyThinkersInList(FThinkerList &list); @@ -113,7 +107,7 @@ private: friend class DObject; friend class FSerializer; - DThinker *NextThinker, *PrevThinker; + DThinker *NextThinker = nullptr, *PrevThinker = nullptr; public: FLevelLocals *Level; diff --git a/src/fragglescript/t_func.cpp b/src/fragglescript/t_func.cpp index 99be0b2b7..90513d97d 100644 --- a/src/fragglescript/t_func.cpp +++ b/src/fragglescript/t_func.cpp @@ -1741,11 +1741,9 @@ class DLightLevel : public DLighting unsigned char destlevel; unsigned char speed; - DLightLevel() = default; - public: - DLightLevel(sector_t * s,int destlevel,int speed); + void Construct(sector_t * s,int destlevel,int speed); void Serialize(FSerializer &arc); void Tick (); void OnDestroy() { Super::OnDestroy(); m_Sector->lightingdata = nullptr; } @@ -1806,8 +1804,9 @@ void DLightLevel::Tick() //========================================================================== // //========================================================================== -DLightLevel::DLightLevel(sector_t * s,int _destlevel,int _speed) : DLighting(s) +void DLightLevel::Construct(sector_t * s,int _destlevel,int _speed) { + Super::Construct(s); destlevel=_destlevel; speed=_speed; s->lightingdata=this; diff --git a/src/fragglescript/t_script.cpp b/src/fragglescript/t_script.cpp index b8caaaff1..47f0a1bf3 100644 --- a/src/fragglescript/t_script.cpp +++ b/src/fragglescript/t_script.cpp @@ -361,7 +361,11 @@ IMPLEMENT_POINTERS_END //========================================================================== // +// This thinker is a little unusual from all the rest, because it +// needs to construct some non-serializable data. // +// This cannot be done in Construct, but requires an actual constructor, +// so that even a deserialized ionstance is fully set up. // //========================================================================== @@ -369,15 +373,6 @@ DFraggleThinker::DFraggleThinker() { GlobalScript = Create(); GC::WriteBarrier(this, GlobalScript); - // do not create resources which will be filled in by the serializer if being called from there. - if (!bSerialOverride) - { - RunningScripts = Create(); - GC::WriteBarrier(this, RunningScripts); - LevelScript = Create(); - LevelScript->parent = GlobalScript; - GC::WriteBarrier(this, LevelScript); - } InitFunctions(); } @@ -387,6 +382,21 @@ DFraggleThinker::DFraggleThinker() // //========================================================================== +void DFraggleThinker::Construct() +{ + RunningScripts = Create(); + GC::WriteBarrier(this, RunningScripts); + LevelScript = Create(); + LevelScript->parent = GlobalScript; + GC::WriteBarrier(this, LevelScript); +} + +//========================================================================== +// +// +// +//========================================================================== + void DFraggleThinker::OnDestroy() { DRunningScript *p = RunningScripts; diff --git a/src/fragglescript/t_script.h b/src/fragglescript/t_script.h index 7b21940bb..3887f736d 100644 --- a/src/fragglescript/t_script.h +++ b/src/fragglescript/t_script.h @@ -696,7 +696,8 @@ public: TObjPtr RunningScripts; TArray > SpawnedThings; - DFraggleThinker(); + DFraggleThinker(); // This class needs a real constructor because it has non-serializable content. + void Construct(); void OnDestroy() override; diff --git a/src/g_level.cpp b/src/g_level.cpp index 633096c54..727abc4d0 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -909,6 +909,7 @@ class DAutosaver : public DThinker { DECLARE_CLASS (DAutosaver, DThinker) public: + void Construct() {} void Tick (); }; diff --git a/src/g_levellocals.h b/src/g_levellocals.h index 8844cdba9..e427b15bb 100644 --- a/src/g_levellocals.h +++ b/src/g_levellocals.h @@ -353,17 +353,6 @@ public: return true; } - template - T* CreateThinker(Args&&... args) - { - auto thinker = Create(std::forward(args)...); - auto statnum = T::DEFAULT_STAT; - thinker->ObjectFlags |= OF_JustSpawned; - DThinker::FreshThinkers[statnum].AddTail(thinker); - thinker->Level = this; - return thinker; - } - DThinker *CreateThinker(PClass *cls, int statnum = STAT_DEFAULT) { DThinker *thinker = static_cast(cls->CreateNew()); @@ -374,6 +363,14 @@ public: return thinker; } + template + T* CreateThinker(Args&&... args) + { + auto thinker = static_cast(CreateThinker(RUNTIME_CLASS(T), T::DEFAULT_STAT)); + thinker->Construct(std::forward(args)...); + return thinker; + } + uint8_t md5[16]; // for savegame validation. If the MD5 does not match the savegame won't be loaded. int time; // time in the hub diff --git a/src/g_shared/a_decals.cpp b/src/g_shared/a_decals.cpp index e644d8c00..a2283852c 100644 --- a/src/g_shared/a_decals.cpp +++ b/src/g_shared/a_decals.cpp @@ -67,26 +67,39 @@ IMPLEMENT_POINTERS_END IMPLEMENT_CLASS(DImpactDecal, false, false) -DBaseDecal::DBaseDecal (double z) -: WallNext(0), WallPrev(0), LeftDistance(0), Z(z), ScaleX(1.), ScaleY(1.), Alpha(1.), - AlphaColor(0), Translation(0), RenderFlags(0), Side(nullptr), Sector(nullptr) +void DBaseDecal::Construct(double z) { + Z = z; RenderStyle = STYLE_None; PicNum.SetInvalid(); } -DBaseDecal::DBaseDecal (const AActor *basis) -: WallNext(nullptr), WallPrev(nullptr), LeftDistance(0), Z(basis->Z()), ScaleX(basis->Scale.X), ScaleY(basis->Scale.Y), - Alpha(basis->Alpha), AlphaColor(basis->fillcolor), Translation(basis->Translation), PicNum(basis->picnum), - RenderFlags(basis->renderflags), RenderStyle(basis->RenderStyle), Side(nullptr), Sector(nullptr) +void DBaseDecal::Construct(const AActor *basis) { + Z = basis->Z(); + ScaleX = basis->Scale.X; + ScaleY = basis->Scale.Y; + Alpha = basis->Alpha; + AlphaColor = basis->fillcolor; + Translation = basis->Translation; + PicNum = basis->picnum; + RenderFlags = basis->renderflags; + RenderStyle = basis->RenderStyle; } -DBaseDecal::DBaseDecal (const DBaseDecal *basis) -: WallNext(nullptr), WallPrev(nullptr), LeftDistance(basis->LeftDistance), Z(basis->Z), ScaleX(basis->ScaleX), - ScaleY(basis->ScaleY), Alpha(basis->Alpha), AlphaColor(basis->AlphaColor), Translation(basis->Translation), - PicNum(basis->PicNum), RenderFlags(basis->RenderFlags), RenderStyle(basis->RenderStyle), Side(nullptr), Sector(nullptr) +void DBaseDecal::Construct(const DBaseDecal *basis) { + LeftDistance = basis->LeftDistance; + Z = basis->Z; + ScaleX = basis->ScaleX; + ScaleY = basis->ScaleY; + Alpha = basis->Alpha; + AlphaColor = basis->AlphaColor; + Translation = basis->Translation; + PicNum = basis->PicNum; + RenderFlags = basis->RenderFlags; + RenderStyle = basis->RenderStyle; + } void DBaseDecal::OnDestroy () diff --git a/src/g_shared/a_flashfader.cpp b/src/g_shared/a_flashfader.cpp index 5c20205f3..c93ef7ef4 100644 --- a/src/g_shared/a_flashfader.cpp +++ b/src/g_shared/a_flashfader.cpp @@ -43,11 +43,13 @@ IMPLEMENT_POINTERS_START(DFlashFader) IMPLEMENT_POINTER(ForWho) IMPLEMENT_POINTERS_END -DFlashFader::DFlashFader (float r1, float g1, float b1, float a1, +void DFlashFader::Construct (float r1, float g1, float b1, float a1, float r2, float g2, float b2, float a2, float time, AActor *who, bool terminate) - : TotalTics ((int)(time*TICRATE)), RemainingTics(TotalTics), ForWho (who) { + TotalTics = (int)(time*TICRATE); + RemainingTics = TotalTics; + ForWho = who; Blends[0][0]=r1; Blends[0][1]=g1; Blends[0][2]=b1; Blends[0][3]=a1; Blends[1][0]=r2; Blends[1][1]=g2; Blends[1][2]=b2; Blends[1][3]=a2; Terminate = terminate; diff --git a/src/g_shared/a_lightning.cpp b/src/g_shared/a_lightning.cpp index 0c599a798..27af34e6e 100644 --- a/src/g_shared/a_lightning.cpp +++ b/src/g_shared/a_lightning.cpp @@ -41,7 +41,7 @@ static FRandom pr_lightning ("Lightning"); IMPLEMENT_CLASS(DLightningThinker, false, false) -DLightningThinker::DLightningThinker () +void DLightningThinker::Construct() { Stopped = false; LightningFlashCount = 0; diff --git a/src/g_shared/a_lightning.h b/src/g_shared/a_lightning.h index 9375fb7ac..13ebd2468 100644 --- a/src/g_shared/a_lightning.h +++ b/src/g_shared/a_lightning.h @@ -12,7 +12,7 @@ class DLightningThinker : public DThinker DECLARE_CLASS (DLightningThinker, DThinker); public: static const int DEFAULT_STAT = STAT_LIGHTNING; - DLightningThinker (); + void Construct(); ~DLightningThinker (); void Serialize(FSerializer &arc); void Tick (); diff --git a/src/g_shared/a_quake.cpp b/src/g_shared/a_quake.cpp index d2467a925..098e6d893 100644 --- a/src/g_shared/a_quake.cpp +++ b/src/g_shared/a_quake.cpp @@ -47,7 +47,7 @@ IMPLEMENT_POINTERS_END // //========================================================================== -DEarthquake::DEarthquake(AActor *center, int intensityX, int intensityY, int intensityZ, int duration, +void DEarthquake::Construct(AActor *center, int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, FSoundID quakesound, int flags, double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint, double rollIntensity, double rollWave) diff --git a/src/g_shared/a_sharedglobal.h b/src/g_shared/a_sharedglobal.h index 01823a051..c97fd237c 100644 --- a/src/g_shared/a_sharedglobal.h +++ b/src/g_shared/a_sharedglobal.h @@ -20,9 +20,9 @@ class DBaseDecal : public DThinker HAS_OBJECT_POINTERS public: static const int DEFAULT_STAT = STAT_DECAL; - DBaseDecal(double z = 0); - DBaseDecal (const AActor *actor); - DBaseDecal (const DBaseDecal *basis); + void Construct(double z = 0); + void Construct(const AActor *actor); + void Construct(const DBaseDecal *basis); void Serialize(FSerializer &arc); void OnDestroy() override; @@ -33,19 +33,19 @@ public: void Spread (const FDecalTemplate *tpl, side_t *wall, double x, double y, double z, F3DFloor * ffloor); void GetXY (side_t *side, double &x, double &y) const; - DBaseDecal *WallNext, *WallPrev; + DBaseDecal *WallNext = nullptr, *WallPrev = nullptr; - double LeftDistance; + double LeftDistance = 0; double Z; - double ScaleX, ScaleY; - double Alpha; - uint32_t AlphaColor; - int Translation; + double ScaleX = 1, ScaleY = 1; + double Alpha = 1; + uint32_t AlphaColor = 0; + int Translation = 0; FTextureID PicNum; - uint32_t RenderFlags; + uint32_t RenderFlags = 0; FRenderStyle RenderStyle; - side_t *Side; - sector_t *Sector; + side_t *Side = nullptr; + sector_t *Sector = nullptr; protected: virtual DBaseDecal *CloneSelf(const FDecalTemplate *tpl, double x, double y, double z, side_t *wall, F3DFloor * ffloor) const; @@ -61,8 +61,11 @@ class DImpactDecal : public DBaseDecal DECLARE_CLASS (DImpactDecal, DBaseDecal) public: static const int DEFAULT_STAT = STAT_AUTODECAL; - DImpactDecal(double z = 0) : DBaseDecal(z) {} - DImpactDecal (side_t *wall, const FDecalTemplate *templ); + void Construct(double z = 0) + { + Super::Construct(z); + } + void Construct(side_t *wall, const FDecalTemplate *templ); static DImpactDecal *StaticCreate(FLevelLocals *Level, const char *name, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0); static DImpactDecal *StaticCreate(FLevelLocals *Level, const FDecalTemplate *tpl, const DVector3 &pos, side_t *wall, F3DFloor * ffloor, PalEntry color = 0); @@ -79,7 +82,7 @@ class DFlashFader : public DThinker DECLARE_CLASS (DFlashFader, DThinker) HAS_OBJECT_POINTERS public: - DFlashFader (float r1, float g1, float b1, float a1, + void Construct(float r1, float g1, float b1, float a1, float r2, float g2, float b2, float a2, float time, AActor *who, bool terminate = false); void OnDestroy() override; @@ -96,7 +99,6 @@ protected: TObjPtr ForWho; bool Terminate; void SetBlend (float time); - DFlashFader() = default; }; enum @@ -124,7 +126,7 @@ class DEarthquake : public DThinker HAS_OBJECT_POINTERS public: static const int DEFAULT_STAT = STAT_EARTHQUAKE; - DEarthquake(AActor *center, int intensityX, int intensityY, int intensityZ, int duration, + void Construct(AActor *center, int intensityX, int intensityY, int intensityZ, int duration, int damrad, int tremrad, FSoundID quakesfx, int flags, double waveSpeedX, double waveSpeedY, double waveSpeedZ, int falloff, int highpoint, double rollIntensity, double rollWave); @@ -147,9 +149,6 @@ public: double GetFalloff(double dist) const; static int StaticGetQuakeIntensities(double ticFrac, AActor *viewer, FQuakeJiggers &jiggers); - -private: - DEarthquake() = default; }; #endif //__A_SHAREDGLOBAL_H__ diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index 0de6758d0..3890e2ea8 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -597,6 +597,7 @@ class DSuicider : public DThinker public: TObjPtr Pawn; + void Construct() {} void Tick() { Pawn->flags |= MF_SHOOTABLE; diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 6047ac87c..2ebdfd0b4 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -1813,7 +1813,7 @@ class DPlaneWatcher : public DThinker DECLARE_CLASS (DPlaneWatcher, DThinker) HAS_OBJECT_POINTERS public: - DPlaneWatcher (AActor *it, line_t *line, int lineSide, bool ceiling, + void Construct(AActor *it, line_t *line, int lineSide, bool ceiling, sector_t *sec, int height, int special, int arg0, int arg1, int arg2, int arg3, int arg4); void Tick (); @@ -1837,13 +1837,17 @@ IMPLEMENT_POINTERS_START(DPlaneWatcher) IMPLEMENT_POINTER(Activator) IMPLEMENT_POINTERS_END -DPlaneWatcher::DPlaneWatcher (AActor *it, line_t *line, int lineSide, bool ceiling, +void DPlaneWatcher::Construct(AActor *it, line_t *line, int lineSide, bool ceiling, sector_t *sec, int height, int special, int arg0, int arg1, int arg2, int arg3, int arg4) - : Special (special), - Activator (it), Line (line), LineSide (!!lineSide), bCeiling (ceiling) { secplane_t plane; + Special = special; + Activator = it; + Line = line; + LineSide = !!lineSide; + bCeiling = ceiling; + Args[0] = arg0; Args[1] = arg1; Args[2] = arg2; @@ -3299,13 +3303,6 @@ IMPLEMENT_POINTERS_START(DACSThinker) IMPLEMENT_POINTER(Scripts) IMPLEMENT_POINTERS_END -DACSThinker::DACSThinker () -{ - Scripts = nullptr; - LastScript = nullptr; - RunningScripts.Clear(); -} - DACSThinker::~DACSThinker () { Scripts = nullptr; diff --git a/src/p_acs.h b/src/p_acs.h index c209ca16d..5f106fbb1 100644 --- a/src/p_acs.h +++ b/src/p_acs.h @@ -454,7 +454,7 @@ class DACSThinker : public DThinker HAS_OBJECT_POINTERS public: static const int DEFAULT_STAT = STAT_SCRIPTS; - DACSThinker(); + void Construct() {} ~DACSThinker(); void Serialize(FSerializer &arc); @@ -467,8 +467,8 @@ public: void StopScriptsFor(AActor *actor); private: - DLevelScript *LastScript; - DLevelScript *Scripts; // List of all running scripts + DLevelScript *LastScript = nullptr; + DLevelScript *Scripts = nullptr; // List of all running scripts friend class DLevelScript; friend class FBehavior; diff --git a/src/p_ceiling.cpp b/src/p_ceiling.cpp index 015fe5882..b9c168ed9 100644 --- a/src/p_ceiling.cpp +++ b/src/p_ceiling.cpp @@ -204,14 +204,14 @@ void DCeiling::Tick () // //============================================================================ -DCeiling::DCeiling (sector_t *sec) - : DMovingCeiling (sec) +void DCeiling::Construct(sector_t *sec) { + Super::Construct(sec); } -DCeiling::DCeiling (sector_t *sec, double speed1, double speed2, int silent) - : DMovingCeiling (sec) +void DCeiling::Construct(sector_t *sec, double speed1, double speed2, int silent) { + Super::Construct(sec); m_Crush = -1; m_CrushMode = ECrushMode::crushDoom; m_Speed = m_Speed1 = speed1; diff --git a/src/p_doors.cpp b/src/p_doors.cpp index e07e736a1..a0bc8af66 100644 --- a/src/p_doors.cpp +++ b/src/p_doors.cpp @@ -328,9 +328,9 @@ void DDoor::DoorSound(bool raise, DSeqNode *curseq) const } } -DDoor::DDoor (sector_t *sector) - : DMovingCeiling (sector) +void DDoor::Construct(sector_t *sector) { + Super::Construct(sector); } //============================================================================ @@ -339,13 +339,19 @@ DDoor::DDoor (sector_t *sector) // //============================================================================ -DDoor::DDoor (sector_t *sec, EVlDoor type, double speed, int delay, int lightTag, int topcountdown) - : DMovingCeiling (sec), - m_Type (type), m_Speed (speed), m_TopWait (delay), m_TopCountdown(topcountdown), m_LightTag (lightTag) +void DDoor::Construct(sector_t *sec, EVlDoor type, double speed, int delay, int lightTag, int topcountdown) { vertex_t *spot; double height; + Super::Construct(sec); + + m_Type = type; + m_Speed = speed; + m_TopWait = delay; + m_TopCountdown = topcountdown; + m_LightTag = lightTag; + if (i_compatflags & COMPATF_NODOORLIGHT) { m_LightTag = 0; @@ -510,9 +516,9 @@ bool FLevelLocals::EV_DoDoor (DDoor::EVlDoor type, line_t *line, AActor *thing, IMPLEMENT_CLASS(DAnimatedDoor, false, false) -DAnimatedDoor::DAnimatedDoor (sector_t *sec) - : DMovingCeiling (sec, false) +void DAnimatedDoor::Construct(sector_t *sec) { + Super::Construct(sec, false); } void DAnimatedDoor::Serialize(FSerializer &arc) @@ -675,12 +681,13 @@ void DAnimatedDoor::Tick () // //============================================================================ -DAnimatedDoor::DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay, FDoorAnimation *anim, DAnimatedDoor::EADType type) - : DMovingCeiling (sec, false) +void DAnimatedDoor::Construct(sector_t *sec, line_t *line, int speed, int delay, FDoorAnimation *anim, DAnimatedDoor::EADType type) { double topdist; FTextureID picnum; + Super::Construct(sec, false); + m_DoorAnim = anim; m_Line1 = line; diff --git a/src/p_floor.cpp b/src/p_floor.cpp index 825282263..45357bf8c 100644 --- a/src/p_floor.cpp +++ b/src/p_floor.cpp @@ -255,9 +255,9 @@ void DFloor::StartFloorSound () // //========================================================================== -DFloor::DFloor (sector_t *sec) - : DMovingFloor (sec) +void DFloor::Construct(sector_t *sec) { + Super::Construct(sec); } //========================================================================== @@ -858,9 +858,9 @@ IMPLEMENT_POINTERS_START(DElevator) IMPLEMENT_POINTER(m_Interp_Ceiling) IMPLEMENT_POINTERS_END -DElevator::DElevator (sector_t *sec) - : Super (sec) +void DElevator::Construct(sector_t *sec) { + Super::Construct(sec); sec->floordata = this; sec->ceilingdata = this; m_Interp_Floor = sec->SetInterpolation(sector_t::FloorMove, true); @@ -1164,9 +1164,9 @@ void DWaggleBase::Serialize(FSerializer &arc) #define WGLSTATE_STABLE 2 #define WGLSTATE_REDUCE 3 -DWaggleBase::DWaggleBase (sector_t *sec) - : Super (sec) +void DWaggleBase::Construct(sector_t *sec) { + Super::Construct(sec); } //========================================================================== @@ -1252,9 +1252,9 @@ void DWaggleBase::DoWaggle (bool ceiling) // //========================================================================== -DFloorWaggle::DFloorWaggle (sector_t *sec) - : Super (sec) +void DFloorWaggle::Construct(sector_t *sec) { + Super::Construct(sec); sec->floordata = this; interpolation = sec->SetInterpolation(sector_t::FloorMove, true); } @@ -1270,9 +1270,9 @@ void DFloorWaggle::Tick () // //========================================================================== -DCeilingWaggle::DCeilingWaggle (sector_t *sec) - : Super (sec) +void DCeilingWaggle::Construct(sector_t *sec) { + Super::Construct(sec); sec->ceilingdata = this; interpolation = sec->SetInterpolation(sector_t::CeilingMove, true); } diff --git a/src/p_lights.cpp b/src/p_lights.cpp index 96ef415c1..d5fb201cd 100644 --- a/src/p_lights.cpp +++ b/src/p_lights.cpp @@ -57,11 +57,6 @@ static FRandom pr_fireflicker ("FireFlicker"); IMPLEMENT_CLASS(DLighting, false, false) -DLighting::DLighting (sector_t *sector) - : DSectorEffect (sector) -{ -} - //----------------------------------------------------------------------------- // // FIRELIGHT FLICKER @@ -109,17 +104,17 @@ void DFireFlicker::Tick () // //----------------------------------------------------------------------------- -DFireFlicker::DFireFlicker (sector_t *sector) - : DLighting (sector) +void DFireFlicker::Construct(sector_t *sector) { + Super::Construct(sector); m_MaxLight = sector->lightlevel; m_MinLight = sector_t::ClampLight(FindMinSurroundingLight(sector, sector->lightlevel) + 16); m_Count = 4; } -DFireFlicker::DFireFlicker (sector_t *sector, int upper, int lower) - : DLighting (sector) +void DFireFlicker::Construct(sector_t *sector, int upper, int lower) { + Super::Construct(sector); m_MaxLight = sector_t::ClampLight(upper); m_MinLight = sector_t::ClampLight(lower); m_Count = 4; @@ -171,9 +166,9 @@ void DFlicker::Tick () // //----------------------------------------------------------------------------- -DFlicker::DFlicker (sector_t *sector, int upper, int lower) - : DLighting (sector) +void DFlicker::Construct(sector_t *sector, int upper, int lower) { + Super::Construct(sector); m_MaxLight = sector_t::ClampLight(upper); m_MinLight = sector_t::ClampLight(lower); sector->lightlevel = m_MaxLight; @@ -228,9 +223,9 @@ void DLightFlash::Tick () // //----------------------------------------------------------------------------- -DLightFlash::DLightFlash (sector_t *sector) - : DLighting (sector) +void DLightFlash::Construct(sector_t *sector) { + Super::Construct(sector); // Find light levels like Doom. m_MaxLight = sector->lightlevel; m_MinLight = FindMinSurroundingLight (sector, sector->lightlevel); @@ -239,9 +234,9 @@ DLightFlash::DLightFlash (sector_t *sector) m_Count = (pr_lightflash() & m_MaxTime) + 1; } -DLightFlash::DLightFlash (sector_t *sector, int min, int max) - : DLighting (sector) +void DLightFlash::Construct (sector_t *sector, int min, int max) { + Super::Construct(sector); // Use specified light levels. m_MaxLight = sector_t::ClampLight(max); m_MinLight = sector_t::ClampLight(min); @@ -298,9 +293,9 @@ void DStrobe::Tick () // //----------------------------------------------------------------------------- -DStrobe::DStrobe (sector_t *sector, int upper, int lower, int utics, int ltics) - : DLighting (sector) +void DStrobe::Construct(sector_t *sector, int upper, int lower, int utics, int ltics) { + Super::Construct(sector); m_DarkTime = ltics; m_BrightTime = utics; m_MaxLight = sector_t::ClampLight(upper); @@ -314,9 +309,9 @@ DStrobe::DStrobe (sector_t *sector, int upper, int lower, int utics, int ltics) // //----------------------------------------------------------------------------- -DStrobe::DStrobe (sector_t *sector, int utics, int ltics, bool inSync) - : DLighting (sector) +void DStrobe::Construct(sector_t *sector, int utics, int ltics, bool inSync) { + Super::Construct(sector); m_DarkTime = ltics; m_BrightTime = utics; @@ -390,9 +385,9 @@ void DGlow::Tick () // //----------------------------------------------------------------------------- -DGlow::DGlow (sector_t *sector) - : DLighting (sector) +void DGlow::Construct(sector_t *sector) { + Super::Construct(sector); m_MinLight = FindMinSurroundingLight (sector, sector->lightlevel); m_MaxLight = sector->lightlevel; m_Direction = -1; @@ -450,9 +445,9 @@ void DGlow2::Tick () // //----------------------------------------------------------------------------- -DGlow2::DGlow2 (sector_t *sector, int start, int end, int tics, bool oneshot) - : DLighting (sector) +void DGlow2::Construct(sector_t *sector, int start, int end, int tics, bool oneshot) { + Super::Construct(sector); m_Start = sector_t::ClampLight(start); m_End = sector_t::ClampLight(end); m_MaxTics = tics; @@ -550,9 +545,9 @@ void DPhased::Propagate() PhaseHelper (m_Sector, 0, 0, nullptr); } -DPhased::DPhased (sector_t *sector, int baselevel, int phase) - : DLighting (sector) +void DPhased::Construct (sector_t *sector, int baselevel, int phase) { + Super::Construct(sector); m_BaseLevel = baselevel; m_Phase = phase; } diff --git a/src/p_pillar.cpp b/src/p_pillar.cpp index ae29629f8..ee9bb6e50 100644 --- a/src/p_pillar.cpp +++ b/src/p_pillar.cpp @@ -114,10 +114,9 @@ void DPillar::Tick () } } -DPillar::DPillar (sector_t *sector, EPillar type, double speed, - double floordist, double ceilingdist, int crush, bool hexencrush) - : DMover (sector) +void DPillar::Construct(sector_t *sector, EPillar type, double speed, double floordist, double ceilingdist, int crush, bool hexencrush) { + Super::Construct(sector); double newheight; vertex_t *spot; diff --git a/src/p_plats.cpp b/src/p_plats.cpp index 993c5cbcb..2b1e3e253 100644 --- a/src/p_plats.cpp +++ b/src/p_plats.cpp @@ -215,9 +215,9 @@ void DPlat::Stop() m_Status = in_stasis; } -DPlat::DPlat (sector_t *sector) - : DMovingFloor (sector) +void DPlat::Construct (sector_t *sector) { + Super::Construct(sector); } // diff --git a/src/p_pusher.cpp b/src/p_pusher.cpp index 7b38aab3f..0859429e4 100644 --- a/src/p_pusher.cpp +++ b/src/p_pusher.cpp @@ -110,7 +110,7 @@ void DPusher::Serialize(FSerializer &arc) // // Add a push thinker to the thinker list -DPusher::DPusher (DPusher::EPusher type, line_t *l, int magnitude, int angle, +void DPusher::Construct (DPusher::EPusher type, line_t *l, int magnitude, int angle, AActor *source, int affectee) { m_Source = source; diff --git a/src/p_scroll.cpp b/src/p_scroll.cpp index 0923d8d60..b48160ab5 100644 --- a/src/p_scroll.cpp +++ b/src/p_scroll.cpp @@ -246,7 +246,7 @@ void DScroller::Tick () // //----------------------------------------------------------------------------- -DScroller::DScroller (EScroll type, double dx, double dy, sector_t *ctrl, sector_t *sec, side_t *side, int accel, EScrollPos scrollpos) +void DScroller::Construct (EScroll type, double dx, double dy, sector_t *ctrl, sector_t *sec, side_t *side, int accel, EScrollPos scrollpos) { m_Type = type; m_dx = dx; @@ -327,7 +327,7 @@ void DScroller::OnDestroy () // //----------------------------------------------------------------------------- -DScroller::DScroller (double dx, double dy, const line_t *l, sector_t * control, int accel, EScrollPos scrollpos) +void DScroller::Construct(double dx, double dy, const line_t *l, sector_t * control, int accel, EScrollPos scrollpos) { double x = fabs(l->Delta().X), y = fabs(l->Delta().Y), d; if (y > x) d = x, x = y, y = d; diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 71f1093fe..0c81a2de0 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -696,7 +696,7 @@ void DLightTransfer::Serialize(FSerializer &arc) ("copyfloor", CopyFloor); } -DLightTransfer::DLightTransfer (sector_t *srcSec, int target, bool copyFloor) +void DLightTransfer::Construct(sector_t *srcSec, int target, bool copyFloor) { int secnum; @@ -762,7 +762,7 @@ void DWallLightTransfer::Serialize(FSerializer &arc) ("flags", Flags); } -DWallLightTransfer::DWallLightTransfer (sector_t *srcSec, int target, uint8_t flags) +void DWallLightTransfer::Construct(sector_t *srcSec, int target, uint8_t flags) { int linenum; int wallflags; diff --git a/src/p_spec.h b/src/p_spec.h index de9e291f5..23414c33f 100644 --- a/src/p_spec.h +++ b/src/p_spec.h @@ -126,9 +126,6 @@ class DLighting : public DSectorEffect DECLARE_CLASS(DLighting, DSectorEffect) public: static const int DEFAULT_STAT = STAT_LIGHT; - DLighting(sector_t *sector); -protected: - DLighting() = default; }; // @@ -176,7 +173,7 @@ public: void Tick (); bool IsLift() const { return m_Type == platDownWaitUpStay || m_Type == platDownWaitUpStayStone; } - DPlat(sector_t *sector); + void Construct(sector_t *sector); protected: @@ -195,9 +192,6 @@ protected: void Reactivate (); void Stop (); -private: - DPlat() = default; - friend struct FLevelLocals; }; @@ -218,8 +212,7 @@ public: }; - DPillar (sector_t *sector, EPillar type, double speed, double height, - double height2, int crush, bool hexencrush); + void Construct (sector_t *sector, EPillar type, double speed, double height, double height2, int crush, bool hexencrush); void Serialize(FSerializer &arc); void Tick (); @@ -235,9 +228,6 @@ protected: bool m_Hexencrush; TObjPtr m_Interp_Ceiling; TObjPtr m_Interp_Floor; - -private: - DPillar() = default; }; @@ -258,8 +248,8 @@ public: doorWaitClose, }; - DDoor (sector_t *sector); - DDoor (sector_t *sec, EVlDoor type, double speed, int delay, int lightTag, int topcountdown); + void Construct(sector_t *sector); + void Construct(sector_t *sec, EVlDoor type, double speed, int delay, int lightTag, int topcountdown); void Serialize(FSerializer &arc); void Tick (); @@ -285,8 +275,6 @@ protected: private: friend struct FLevelLocals; - DDoor() = default; - }; class DAnimatedDoor : public DMovingCeiling @@ -300,8 +288,8 @@ public: adClose }; - DAnimatedDoor (sector_t *sector); - DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay, FDoorAnimation *anim, EADType type); + void Construct(sector_t *sector); + void Construct(sector_t *sec, line_t *line, int speed, int delay, FDoorAnimation *anim, EADType type); void Serialize(FSerializer &arc); void Tick (); @@ -327,8 +315,6 @@ protected: bool m_SetBlocking1, m_SetBlocking2; friend struct FLevelLocals; -private: - DAnimatedDoor() = default; }; // @@ -379,8 +365,8 @@ public: }; - DCeiling (sector_t *sec); - DCeiling (sector_t *sec, double speed1, double speed2, int silent); + void Construct(sector_t *sec); + void Construct(sector_t *sec, double speed1, double speed2, int silent); void Serialize(FSerializer &arc); void Tick (); @@ -407,10 +393,7 @@ protected: void PlayCeilingSound (); -private: - DCeiling() = default; friend struct FLevelLocals; - }; // @@ -474,7 +457,7 @@ public: stairCrush = 4, }; - DFloor (sector_t *sec); + void Construct(sector_t *sec); void Serialize(FSerializer &arc); void Tick (); @@ -501,9 +484,6 @@ public: void StartFloorSound (); void SetFloorChangeType (sector_t *sec, int change); friend struct FLevelLocals; - -private: - DFloor() = default; }; class DElevator : public DMover @@ -521,7 +501,7 @@ public: elevateLower }; - DElevator (sector_t *sec); + void Construct(sector_t *sec); void OnDestroy() override; void Serialize(FSerializer &arc); @@ -538,8 +518,6 @@ protected: void StartFloorSound (); friend struct FLevelLocals; -private: - DElevator() = default; }; @@ -548,7 +526,7 @@ class DWaggleBase : public DMover DECLARE_CLASS (DWaggleBase, DMover) HAS_OBJECT_POINTERS public: - DWaggleBase (sector_t *sec); + void Construct(sector_t *sec); void Serialize(FSerializer &arc); @@ -564,27 +542,22 @@ protected: friend struct FLevelLocals; void DoWaggle (bool ceiling); - DWaggleBase() = default; }; class DFloorWaggle : public DWaggleBase { DECLARE_CLASS (DFloorWaggle, DWaggleBase) public: - DFloorWaggle (sector_t *sec); + void Construct(sector_t *sec); void Tick (); -private: - DFloorWaggle() = default; }; class DCeilingWaggle : public DWaggleBase { DECLARE_CLASS (DCeilingWaggle, DWaggleBase) public: - DCeilingWaggle (sector_t *sec); + void Construct(sector_t *sec); void Tick (); -private: - DCeilingWaggle() = default; }; //jff 3/15/98 pure texture/type change for better generalized support diff --git a/src/p_spec_thinkers.h b/src/p_spec_thinkers.h index 3647a1314..dfa4038ea 100644 --- a/src/p_spec_thinkers.h +++ b/src/p_spec_thinkers.h @@ -7,10 +7,9 @@ class DLightTransfer : public DThinker { DECLARE_CLASS (DLightTransfer, DThinker) - DLightTransfer() = default; public: static const int DEFAULT_STAT = STAT_LIGHTTRANSFER; - DLightTransfer (sector_t *srcSec, int target, bool copyFloor); + void Construct(sector_t *srcSec, int target, bool copyFloor); void Serialize(FSerializer &arc); void Tick (); @@ -33,10 +32,9 @@ class DWallLightTransfer : public DThinker }; DECLARE_CLASS (DWallLightTransfer, DThinker) - DWallLightTransfer() = default; public: static const int DEFAULT_STAT = STAT_LIGHTTRANSFER; - DWallLightTransfer (sector_t *srcSec, int target, uint8_t flags); + void Construct(sector_t *srcSec, int target, uint8_t flags); void Serialize(FSerializer &arc); void Tick (); @@ -54,39 +52,35 @@ class DFireFlicker : public DLighting { DECLARE_CLASS(DFireFlicker, DLighting) public: - DFireFlicker(sector_t *sector); - DFireFlicker(sector_t *sector, int upper, int lower); + void Construct(sector_t *sector); + void Construct(sector_t *sector, int upper, int lower); void Serialize(FSerializer &arc); void Tick(); protected: int m_Count; int m_MaxLight; int m_MinLight; -private: - DFireFlicker() = default; }; class DFlicker : public DLighting { DECLARE_CLASS(DFlicker, DLighting) public: - DFlicker(sector_t *sector, int upper, int lower); + void Construct(sector_t *sector, int upper, int lower); void Serialize(FSerializer &arc); void Tick(); protected: int m_Count; int m_MaxLight; int m_MinLight; -private: - DFlicker() = default; }; class DLightFlash : public DLighting { DECLARE_CLASS(DLightFlash, DLighting) public: - DLightFlash(sector_t *sector); - DLightFlash(sector_t *sector, int min, int max); + void Construct(sector_t *sector); + void Construct(sector_t *sector, int min, int max); void Serialize(FSerializer &arc); void Tick(); protected: @@ -95,16 +89,14 @@ protected: int m_MinLight; int m_MaxTime; int m_MinTime; -private: - DLightFlash() = default; }; class DStrobe : public DLighting { DECLARE_CLASS(DStrobe, DLighting) public: - DStrobe(sector_t *sector, int utics, int ltics, bool inSync); - DStrobe(sector_t *sector, int upper, int lower, int utics, int ltics); + void Construct(sector_t *sector, int utics, int ltics, bool inSync); + void Construct(sector_t *sector, int upper, int lower, int utics, int ltics); void Serialize(FSerializer &arc); void Tick(); protected: @@ -113,23 +105,19 @@ protected: int m_MaxLight; int m_DarkTime; int m_BrightTime; -private: - DStrobe() = default; }; class DGlow : public DLighting { DECLARE_CLASS(DGlow, DLighting) public: - DGlow(sector_t *sector); + void Construct(sector_t *sector); void Serialize(FSerializer &arc); void Tick(); protected: int m_MinLight; int m_MaxLight; int m_Direction; -private: - DGlow() = default; }; // [RH] Glow from Light_Glow and Light_Fade specials @@ -137,7 +125,7 @@ class DGlow2 : public DLighting { DECLARE_CLASS(DGlow2, DLighting) public: - DGlow2(sector_t *sector, int start, int end, int tics, bool oneshot); + void Construct(sector_t *sector, int start, int end, int tics, bool oneshot); void Serialize(FSerializer &arc); void Tick(); protected: @@ -146,8 +134,6 @@ protected: int m_MaxTics; int m_Tics; bool m_OneShot; -private: - DGlow2() = default; }; // [RH] Phased light thinker @@ -155,9 +141,9 @@ class DPhased : public DLighting { DECLARE_CLASS(DPhased, DLighting) public: - DPhased(sector_t *sector, int baselevel = 0, int phase = 0); + void Construct(sector_t *sector, int baselevel = 0, int phase = 0); // These are for internal use only but the Create template needs access to them. - DPhased() = default; + void Construct(); void Propagate(); void Serialize(FSerializer &arc); @@ -184,8 +170,7 @@ public: p_current }; - DPusher () = default; - DPusher (EPusher type, line_t *l, int magnitude, int angle, AActor *source, int affectee); + void Construct(EPusher type, line_t *l, int magnitude, int angle, AActor *source, int affectee); void Serialize(FSerializer &arc); int CheckForSectorMatch (EPusher type, int tag); void ChangeValues (int magnitude, int angle) @@ -221,8 +206,8 @@ class DScroller : public DThinker public: static const int DEFAULT_STAT = STAT_SCROLLER; - DScroller(EScroll type, double dx, double dy, sector_t *control, sector_t *sec, side_t *side, int accel, EScrollPos scrollpos = EScrollPos::scw_all); - DScroller (double dx, double dy, const line_t *l, sector_t *control, int accel, EScrollPos scrollpos = EScrollPos::scw_all); + void Construct(EScroll type, double dx, double dy, sector_t *control, sector_t *sec, side_t *side, int accel, EScrollPos scrollpos = EScrollPos::scw_all); + void Construct(double dx, double dy, const line_t *l, sector_t *control, int accel, EScrollPos scrollpos = EScrollPos::scw_all); void OnDestroy() override; void Serialize(FSerializer &arc); @@ -246,8 +231,5 @@ protected: int m_Accel; // Whether it's accelerative EScrollPos m_Parts; // Which parts of a sidedef are being scrolled? TObjPtr m_Interpolations[3]; - -private: - DScroller () = default; }; diff --git a/src/p_switch.cpp b/src/p_switch.cpp index 3911c141d..ac58e8cc0 100644 --- a/src/p_switch.cpp +++ b/src/p_switch.cpp @@ -56,8 +56,7 @@ class DActiveButton : public DThinker { DECLARE_CLASS (DActiveButton, DThinker) public: - DActiveButton (); - DActiveButton (side_t *, int, FSwitchDef *, const DVector2 &pos, bool flippable); + void Construct(side_t *, int, FSwitchDef *, const DVector2 &pos, bool flippable); void Serialize(FSerializer &arc); void Tick (); @@ -320,20 +319,7 @@ bool P_ChangeSwitchTexture (side_t *side, int useAgain, uint8_t special, bool *q IMPLEMENT_CLASS(DActiveButton, false, false) -DActiveButton::DActiveButton () -{ - m_Side = NULL; - m_Part = -1; - m_SwitchDef = 0; - m_Timer = 0; - m_Pos = { 0,0 }; - bFlippable = false; - bReturning = false; - m_Frame = 0; -} - -DActiveButton::DActiveButton (side_t *side, int Where, FSwitchDef *Switch, - const DVector2 &pos, bool useagain) +void DActiveButton::Construct (side_t *side, int Where, FSwitchDef *Switch, const DVector2 &pos, bool useagain) { m_Side = side; m_Part = int8_t(Where); diff --git a/src/po_man.cpp b/src/po_man.cpp index 44e451dc5..b5d90f364 100644 --- a/src/po_man.cpp +++ b/src/po_man.cpp @@ -46,10 +46,8 @@ class DRotatePoly : public DPolyAction { DECLARE_CLASS (DRotatePoly, DPolyAction) public: - DRotatePoly (FPolyObj *polyNum); + void Construct(FPolyObj *polyNum); void Tick (); -private: - DRotatePoly (); friend bool EV_RotatePoly (FLevelLocals *Level, line_t *line, int polyNum, int speed, int byteAngle, int direction, bool overRide); }; @@ -59,11 +57,10 @@ class DMovePoly : public DPolyAction { DECLARE_CLASS (DMovePoly, DPolyAction) public: - DMovePoly (FPolyObj *polyNum); + void Construct(FPolyObj *polyNum); void Serialize(FSerializer &arc); void Tick (); protected: - DMovePoly (); DAngle m_Angle; DVector2 m_Speedv; @@ -74,11 +71,10 @@ class DMovePolyTo : public DPolyAction { DECLARE_CLASS(DMovePolyTo, DPolyAction) public: - DMovePolyTo(FPolyObj *polyNum); + void Construct(FPolyObj *polyNum); void Serialize(FSerializer &arc); void Tick(); protected: - DMovePolyTo(); DVector2 m_Speedv; DVector2 m_Target; @@ -90,7 +86,7 @@ class DPolyDoor : public DMovePoly { DECLARE_CLASS (DPolyDoor, DMovePoly) public: - DPolyDoor (FPolyObj *polyNum, podoortype_t type); + void Construct(FPolyObj *polyNum, podoortype_t type); void Serialize(FSerializer &arc); void Tick (); protected: @@ -102,8 +98,6 @@ protected: bool m_Close; friend bool EV_OpenPolyDoor(FLevelLocals *Level, line_t *line, int polyNum, double speed, DAngle angle, int delay, double distance, podoortype_t type); -private: - DPolyDoor (); }; class FPolyMirrorIterator @@ -152,10 +146,6 @@ IMPLEMENT_POINTERS_START(DPolyAction) IMPLEMENT_POINTER(m_Interpolation) IMPLEMENT_POINTERS_END -DPolyAction::DPolyAction () -{ -} - void DPolyAction::Serialize(FSerializer &arc) { Super::Serialize (arc); @@ -165,7 +155,7 @@ void DPolyAction::Serialize(FSerializer &arc) ("interpolation", m_Interpolation); } -DPolyAction::DPolyAction (FPolyObj *polyNum) +void DPolyAction::Construct(FPolyObj *polyNum) { m_PolyObj = polyNum; m_Speed = 0; @@ -212,13 +202,9 @@ void DPolyAction::StopInterpolation () IMPLEMENT_CLASS(DRotatePoly, false, false) -DRotatePoly::DRotatePoly () -{ -} - -DRotatePoly::DRotatePoly (FPolyObj *polyNum) - : Super (polyNum) +void DRotatePoly::Construct(FPolyObj *polyNum) { + Super::Construct(polyNum); } //========================================================================== @@ -229,10 +215,6 @@ DRotatePoly::DRotatePoly (FPolyObj *polyNum) IMPLEMENT_CLASS(DMovePoly, false, false) -DMovePoly::DMovePoly () -{ -} - void DMovePoly::Serialize(FSerializer &arc) { Super::Serialize (arc); @@ -240,9 +222,9 @@ void DMovePoly::Serialize(FSerializer &arc) ("speedv", m_Speedv); } -DMovePoly::DMovePoly (FPolyObj *polyNum) - : Super (polyNum) +void DMovePoly::Construct(FPolyObj *polyNum) { + Super::Construct(polyNum); m_Angle = 0.; m_Speedv = { 0,0 }; } @@ -256,10 +238,6 @@ DMovePoly::DMovePoly (FPolyObj *polyNum) IMPLEMENT_CLASS(DMovePolyTo, false, false) -DMovePolyTo::DMovePolyTo() -{ -} - void DMovePolyTo::Serialize(FSerializer &arc) { Super::Serialize(arc); @@ -267,9 +245,9 @@ void DMovePolyTo::Serialize(FSerializer &arc) ("target", m_Target); } -DMovePolyTo::DMovePolyTo(FPolyObj *polyNum) - : Super(polyNum) +void DMovePolyTo::Construct(FPolyObj *polyNum) { + Super::Construct(polyNum); m_Speedv = m_Target = { 0,0 }; } @@ -281,10 +259,6 @@ DMovePolyTo::DMovePolyTo(FPolyObj *polyNum) IMPLEMENT_CLASS(DPolyDoor, false, false) -DPolyDoor::DPolyDoor () -{ -} - void DPolyDoor::Serialize(FSerializer &arc) { Super::Serialize (arc); @@ -296,9 +270,10 @@ void DPolyDoor::Serialize(FSerializer &arc) ("close", m_Close); } -DPolyDoor::DPolyDoor (FPolyObj * polyNum, podoortype_t type) - : Super (polyNum), m_Type (type) +void DPolyDoor::Construct (FPolyObj * polyNum, podoortype_t type) { + Super::Construct(polyNum); + m_Type = type; m_Direction = 0.; m_TotalDist = 0; m_Tics = 0; diff --git a/src/po_man.h b/src/po_man.h index e9d23ebe8..70f437443 100644 --- a/src/po_man.h +++ b/src/po_man.h @@ -13,7 +13,7 @@ class DPolyAction : public DThinker DECLARE_CLASS(DPolyAction, DThinker) HAS_OBJECT_POINTERS public: - DPolyAction(FPolyObj *polyNum); + void Construct(FPolyObj *polyNum); void Serialize(FSerializer &arc); void OnDestroy() override; void Stop(); @@ -21,7 +21,6 @@ public: void StopInterpolation(); protected: - DPolyAction(); FPolyObj *m_PolyObj; double m_Speed; double m_Dist; diff --git a/src/serializer.cpp b/src/serializer.cpp index 94bb57f78..b88ae0ba5 100644 --- a/src/serializer.cpp +++ b/src/serializer.cpp @@ -987,7 +987,6 @@ void FSerializer::ReadObjects(bool hubtravel) // Do not link any thinker that's being created here. This will be done by deserializing the thinker list later. try { - DThinker::bSerialOverride = true; r->mDObjects.Resize(ArraySize()); for (auto &p : r->mDObjects) { @@ -1052,7 +1051,6 @@ void FSerializer::ReadObjects(bool hubtravel) } EndArray(); - DThinker::bSerialOverride = false; assert(!founderrors); if (founderrors) { @@ -1070,7 +1068,6 @@ void FSerializer::ReadObjects(bool hubtravel) r->mDObjects.Clear(); // make sure this flag gets unset, even if something in here throws an error. - DThinker::bSerialOverride = false; throw; } }