- changed thinker initialization to occur in a Construct function instead of the constructor itself.

This was done to ensure that this code only runs when the thinker itself is fully set up.
With a constructor there is no control about such things, if some common initialization needs to be done it has to be in the base constructor, but that makes the entire approach chosen here to ensure proper linking into the thinker chains impossible.
ZDoom originally did it that way, which resulted in a very inflexible system and required some awful hacks to let the serializer work with it - the corresponding bSerialOverride flag is now gone.

The only thinker class still having a constructor is DFraggleThinker, because it contains non-serializable data that needs to be initialized in a piece of code that always runs, regardless of whether the object is created explicitly or from a savegame.
This commit is contained in:
Christoph Oelckers 2019-01-27 13:08:54 +01:00
parent 22939aade7
commit e7aa10b5c8
37 changed files with 235 additions and 327 deletions

View file

@ -63,7 +63,7 @@ IMPLEMENT_POINTERS_END
DEFINE_FIELD(DBot, dest)
DBot::DBot ()
void DBot::Construct()
{
Clear ();
}

View file

@ -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);

View file

@ -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<DBaseDecal*> 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

View file

@ -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;

View file

@ -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);
}

View file

@ -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,14 +25,13 @@ class DMover : public DSectorEffect
DECLARE_ABSTRACT_CLASS (DMover, DSectorEffect)
HAS_OBJECT_POINTERS
protected:
DMover (sector_t *sector);
void Construct(sector_t *sector);
TObjPtr<DInterpolation*> 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__

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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,16 +373,22 @@ DFraggleThinker::DFraggleThinker()
{
GlobalScript = Create<DFsScript>();
GC::WriteBarrier(this, GlobalScript);
// do not create resources which will be filled in by the serializer if being called from there.
if (!bSerialOverride)
{
InitFunctions();
}
//==========================================================================
//
//
//
//==========================================================================
void DFraggleThinker::Construct()
{
RunningScripts = Create<DRunningScript>();
GC::WriteBarrier(this, RunningScripts);
LevelScript = Create<DFsScript>();
LevelScript->parent = GlobalScript;
GC::WriteBarrier(this, LevelScript);
}
InitFunctions();
}
//==========================================================================

View file

@ -696,7 +696,8 @@ public:
TObjPtr<DRunningScript*> RunningScripts;
TArray<TObjPtr<AActor*> > SpawnedThings;
DFraggleThinker();
DFraggleThinker(); // This class needs a real constructor because it has non-serializable content.
void Construct();
void OnDestroy() override;

View file

@ -909,6 +909,7 @@ class DAutosaver : public DThinker
{
DECLARE_CLASS (DAutosaver, DThinker)
public:
void Construct() {}
void Tick ();
};

View file

@ -353,17 +353,6 @@ public:
return true;
}
template<typename T, typename... Args>
T* CreateThinker(Args&&... args)
{
auto thinker = Create<T>(std::forward<Args>(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<DThinker*>(cls->CreateNew());
@ -374,6 +363,14 @@ public:
return thinker;
}
template<typename T, typename... Args>
T* CreateThinker(Args&&... args)
{
auto thinker = static_cast<T*>(CreateThinker(RUNTIME_CLASS(T), T::DEFAULT_STAT));
thinker->Construct(std::forward<Args>(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

View file

@ -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 ()

View file

@ -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;

View file

@ -41,7 +41,7 @@ static FRandom pr_lightning ("Lightning");
IMPLEMENT_CLASS(DLightningThinker, false, false)
DLightningThinker::DLightningThinker ()
void DLightningThinker::Construct()
{
Stopped = false;
LightningFlashCount = 0;

View file

@ -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 ();

View file

@ -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)

View file

@ -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<AActor*> 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__

View file

@ -597,6 +597,7 @@ class DSuicider : public DThinker
public:
TObjPtr<AActor*> Pawn;
void Construct() {}
void Tick()
{
Pawn->flags |= MF_SHOOTABLE;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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;

View file

@ -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);
}
//

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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<DInterpolation*> m_Interp_Ceiling;
TObjPtr<DInterpolation*> 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

View file

@ -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<DInterpolation*> m_Interpolations[3];
private:
DScroller () = default;
};

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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;
}
}