- most thinkers are done. Some stuff about polyobject pointers is temporarily disabled right now because some of the required functions have already been pulled out.

This commit is contained in:
Christoph Oelckers 2016-09-19 19:14:30 +02:00
parent 340c7795f3
commit e89d072abc
39 changed files with 290 additions and 342 deletions

View file

@ -48,7 +48,7 @@ public:
bool TryPickup (AActor *&toucher);
void PlayPickupSound (AActor *toucher);
void DoPickupSpecial (AActor *toucher);
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
private:
PClassActor *DetermineType ();

View file

@ -102,7 +102,7 @@ class APlayerPawn : public AActor
DECLARE_CLASS_WITH_META(APlayerPawn, AActor, PClassPlayerPawn)
HAS_OBJECT_POINTERS
public:
DECLARE_OLD_SERIAL
virtual void Serialize(FSerializer &arc);
virtual void PostBeginPlay();

View file

@ -10,7 +10,7 @@ class DSectorEffect : public DThinker
public:
DSectorEffect (sector_t *sector);
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
void Destroy();
@ -33,7 +33,7 @@ protected:
private:
protected:
DMover ();
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
void Destroy();
};

View file

@ -65,7 +65,7 @@
#include "v_palette.h"
#include "v_font.h"
#include "r_data/colormaps.h"
#include "farchive.h"
#include "serializer.h"
#include "p_setup.h"
#include "p_spec.h"
#include "r_utility.h"
@ -1780,8 +1780,7 @@ class DLightLevel : public DLighting
public:
DLightLevel(sector_t * s,int destlevel,int speed);
void Serialize(FArchive &arc);
//void Serialize(FArchive &arc);
void Serialize(FSerializer &arc);
void Tick ();
void Destroy() { Super::Destroy(); m_Sector->lightingdata=NULL; }
};
@ -1790,11 +1789,11 @@ public:
IMPLEMENT_CLASS (DLightLevel)
void DLightLevel::Serialize(FArchive &arc)
void DLightLevel::Serialize(FSerializer &arc)
{
Super::Serialize (arc);
arc << destlevel << speed;
if (arc.IsLoading()) m_Sector->lightingdata=this;
arc("destlevel", destlevel)
("speed", speed);
}

View file

@ -29,7 +29,7 @@ public:
void Tick ();
void SetWeapon (EMarineWeapon);
void SetSprite (PClassActor *source);
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
int CurrentWeapon;

View file

@ -866,7 +866,7 @@ class ARainTracker : public AInventory
{
DECLARE_CLASS (ARainTracker, AInventory)
public:
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
TObjPtr<AActor> Rain1, Rain2;
};
@ -1142,7 +1142,7 @@ class APhoenixRod : public AWeapon
{
DECLARE_CLASS (APhoenixRod, AWeapon)
public:
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc)
{
Super::Serialize (arc);

View file

@ -31,7 +31,7 @@ class ACWeapWraithverge : public AClericWeapon
{
DECLARE_CLASS (ACWeapWraithverge, AClericWeapon)
public:
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc)
{
Super::Serialize (arc);

View file

@ -67,7 +67,7 @@ public:
PClassActor *StopBall;
DAngle BallAngle;
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
void Die (AActor *source, AActor *inflictor, int dmgflags);
};
@ -107,7 +107,7 @@ public:
DAngle AngleOffset;
DAngle OldAngle;
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc)
{

View file

@ -29,7 +29,7 @@ class AMWeapBloodscourge : public AMageWeapon
{
DECLARE_CLASS (AMWeapBloodscourge, AMageWeapon)
public:
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc)
{
Super::Serialize (arc);

View file

@ -22,7 +22,7 @@ class AThrustFloor : public AActor
DECLARE_CLASS (AThrustFloor, AActor)
HAS_OBJECT_POINTERS
public:
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
void Activate (AActor *activator);

View file

@ -23,7 +23,7 @@ public:
void Die (AActor *source, AActor *inflictor, int dmgflags);
bool OkayToSwitchTarget (AActor *other);
void BeginPlay ();
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
};

View file

@ -16,7 +16,7 @@ public:
virtual bool HandlePickup (AInventory *item);
virtual AInventory *CreateCopy (AActor *other);
virtual AInventory *CreateTossable ();
DECLARE_OLD_SERIAL
virtual void Serialize(FSerializer &arc);
virtual void OwnerDied ();
virtual bool GetNoTeleportFreeze();
@ -52,7 +52,7 @@ class APowerupGiver : public AInventory
DECLARE_CLASS_WITH_META (APowerupGiver, AInventory, PClassPowerupGiver)
public:
virtual bool Use (bool pickup);
DECLARE_OLD_SERIAL
virtual void Serialize(FSerializer &arc);
@ -123,7 +123,7 @@ class APowerTorch : public APowerLightAmp
{
DECLARE_CLASS (APowerTorch, APowerLightAmp)
public:
DECLARE_OLD_SERIAL
virtual void Serialize(FSerializer &arc);
protected:
void DoEffect ();
@ -135,7 +135,7 @@ class APowerFlight : public APowerup
DECLARE_CLASS (APowerFlight, APowerup)
public:
bool DrawPowerup (int x, int y);
DECLARE_OLD_SERIAL
virtual void Serialize(FSerializer &arc);
protected:
@ -159,7 +159,7 @@ class APowerSpeed : public APowerup
DECLARE_CLASS (APowerSpeed, APowerup)
protected:
void DoEffect ();
DECLARE_OLD_SERIAL
virtual void Serialize(FSerializer &arc);
double GetSpeedFactor();
public:
@ -277,7 +277,7 @@ class APowerMorph : public APowerup
{
DECLARE_CLASS( APowerMorph, APowerup )
public:
DECLARE_OLD_SERIAL
virtual void Serialize(FSerializer &arc);
void SetNoCallUndoMorph() { bNoCallUndoMorph = true; }

View file

@ -55,7 +55,7 @@ public:
void PostBeginPlay ();
void Tick ();
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
protected:
DAngle Center;
@ -118,7 +118,7 @@ public:
void PostBeginPlay ();
void Tick ();
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
protected:
DAngle MaxPitchChange;

View file

@ -60,7 +60,7 @@ public:
AInterpolationPoint *ScanForLoop ();
void FormChain ();
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
TObjPtr<AInterpolationPoint> Next;
@ -167,7 +167,7 @@ protected:
virtual bool Interpolate ();
virtual void NewNode ();
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
bool bActive, bJustStepped;
@ -584,7 +584,7 @@ class AMovingCamera : public APathFollower
public:
void PostBeginPlay ();
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
protected:
bool Interpolate ();

View file

@ -153,7 +153,7 @@ class AInventory : public AActor
HAS_OBJECT_POINTERS
public:
virtual void Touch (AActor *toucher);
DECLARE_OLD_SERIAL
virtual void Serialize(FSerializer &arc);
virtual void MarkPrecacheSounds() const;
@ -255,7 +255,7 @@ class AAmmo : public AInventory
{
DECLARE_CLASS_WITH_META(AAmmo, AInventory, PClassAmmo)
public:
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
AInventory *CreateCopy (AActor *other);
bool HandlePickup (AInventory *item);
@ -313,7 +313,7 @@ public:
bool bAltFire; // Set when this weapon's alternate fire is used.
virtual void MarkPrecacheSounds() const;
DECLARE_OLD_SERIAL
virtual void Serialize(FSerializer &arc);
virtual bool ShouldStay ();
virtual void AttachToOwner (AActor *other);
@ -398,7 +398,7 @@ class AWeaponGiver : public AWeapon
public:
bool TryPickup(AActor *&toucher);
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
double DropAmmoFactor;
@ -435,7 +435,7 @@ class AHealthPickup : public AInventory
public:
int autousemode;
DECLARE_OLD_SERIAL
virtual void Serialize(FSerializer &arc);
virtual AInventory *CreateCopy (AActor *other);
virtual AInventory *CreateTossable ();
@ -456,7 +456,7 @@ class ABasicArmor : public AArmor
{
DECLARE_CLASS (ABasicArmor, AArmor)
public:
DECLARE_OLD_SERIAL
virtual void Serialize(FSerializer &arc);
virtual void Tick ();
virtual AInventory *CreateCopy (AActor *other);
@ -477,7 +477,7 @@ class ABasicArmorPickup : public AArmor
{
DECLARE_CLASS (ABasicArmorPickup, AArmor)
public:
DECLARE_OLD_SERIAL
virtual void Serialize(FSerializer &arc);
virtual AInventory *CreateCopy (AActor *other);
virtual bool Use (bool pickup);
@ -493,7 +493,7 @@ class ABasicArmorBonus : public AArmor
{
DECLARE_CLASS (ABasicArmorBonus, AArmor)
public:
DECLARE_OLD_SERIAL
virtual void Serialize(FSerializer &arc);
virtual AInventory *CreateCopy (AActor *other);
virtual bool Use (bool pickup);
@ -513,7 +513,7 @@ class AHexenArmor : public AArmor
{
DECLARE_CLASS (AHexenArmor, AArmor)
public:
DECLARE_OLD_SERIAL
virtual void Serialize(FSerializer &arc);
virtual AInventory *CreateCopy (AActor *other);
virtual AInventory *CreateTossable ();
@ -542,7 +542,7 @@ class APuzzleItem : public AInventory
{
DECLARE_CLASS_WITH_META(APuzzleItem, AInventory, PClassPuzzleItem)
public:
DECLARE_OLD_SERIAL
bool ShouldStay ();
bool Use (bool pickup);
bool HandlePickup (AInventory *item);
@ -564,7 +564,7 @@ class ABackpackItem : public AInventory
{
DECLARE_CLASS (ABackpackItem, AInventory)
public:
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
bool HandlePickup (AInventory *item);
AInventory *CreateCopy (AActor *other);

View file

@ -194,7 +194,7 @@ class AMorphProjectile : public AActor
DECLARE_CLASS (AMorphProjectile, AActor)
public:
int DoSpecialDamage (AActor *target, int damage, FName damagetype);
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
FNameNoInit PlayerClass, MonsterClass, MorphFlash, UnMorphFlash;
@ -207,7 +207,7 @@ class AMorphedMonster : public AActor
HAS_OBJECT_POINTERS
public:
void Tick ();
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
void Die (AActor *source, AActor *inflictor, int dmgflags);
void Destroy ();

View file

@ -74,7 +74,7 @@ class ASoundSequenceSlot : public AActor
DECLARE_CLASS (ASoundSequenceSlot, AActor)
HAS_OBJECT_POINTERS
public:
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
TObjPtr<DSeqNode> Sequence;

View file

@ -15,7 +15,7 @@ class AWeaponPiece : public AInventory
protected:
bool PrivateShouldStay ();
public:
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
bool TryPickup (AActor *&toucher);
bool TryPickupRestricted (AActor *&toucher);
@ -38,6 +38,6 @@ public:
int PieceMask;
PClassActor * PieceWeapon;
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
};

View file

@ -55,7 +55,7 @@ class ASigil : public AWeapon
public:
bool HandlePickup (AInventory *item);
AInventory *CreateCopy (AActor *other);
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
bool SpecialDropAction (AActor *dropper);
static int GiveSigilPiece (AActor *daPlayer);

View file

@ -29,31 +29,9 @@
#include "doomstat.h"
#include "r_state.h"
#include "gi.h"
#include "farchive.h"
#include "serializer.h"
#include "p_spec.h"
//============================================================================
//
//
//
//============================================================================
inline FArchive &operator<< (FArchive &arc, DCeiling::ECeiling &type)
{
BYTE val = (BYTE)type;
arc << val;
type = (DCeiling::ECeiling)val;
return arc;
}
inline FArchive &operator<< (FArchive &arc, DCeiling::ECrushMode &type)
{
BYTE val = (BYTE)type;
arc << val;
type = (DCeiling::ECrushMode)val;
return arc;
}
//============================================================================
//
// CEILINGS
@ -72,23 +50,23 @@ DCeiling::DCeiling ()
//
//============================================================================
void DCeiling::Serialize(FArchive &arc)
void DCeiling::Serialize(FSerializer &arc)
{
Super::Serialize (arc);
arc << m_Type
<< m_BottomHeight
<< m_TopHeight
<< m_Speed
<< m_Speed1
<< m_Speed2
<< m_Crush
<< m_Silent
<< m_Direction
<< m_Texture
<< m_NewSpecial
<< m_Tag
<< m_OldDirection
<< m_CrushMode;
arc.Enum("type", m_Type)
("bottomheight", m_BottomHeight)
("topheight", m_TopHeight)
("speed", m_Speed)
("speed1", m_Speed1)
("speed2", m_Speed2)
("crush", m_Crush)
("silent", m_Silent)
("direction", m_Direction)
("texture", m_Texture)
("newspecial", m_NewSpecial)
("tag", m_Tag)
("olddirecton", m_OldDirection)
.Enum("crushmode", m_CrushMode);
}
//============================================================================

View file

@ -35,7 +35,7 @@
#include "i_system.h"
#include "sc_man.h"
#include "cmdlib.h"
#include "farchive.h"
#include "serializer.h"
#include "d_player.h"
#include "p_spec.h"
@ -47,29 +47,23 @@
IMPLEMENT_CLASS (DDoor)
inline FArchive &operator<< (FArchive &arc, DDoor::EVlDoor &type)
{
BYTE val = (BYTE)type;
arc << val;
type = (DDoor::EVlDoor)val;
return arc;
}
DDoor::DDoor ()
{
}
void DDoor::Serialize(FArchive &arc)
void DDoor::Serialize(FSerializer &arc)
{
Super::Serialize (arc);
arc << m_Type
<< m_TopDist
<< m_BotSpot << m_BotDist << m_OldFloorDist
<< m_Speed
<< m_Direction
<< m_TopWait
<< m_TopCountdown
<< m_LightTag;
arc.Enum("type", m_Type)
("topdist", m_TopDist)
("botspot", m_BotSpot)
("botdist", m_BotDist)
("oldfloordist", m_OldFloorDist)
("speed", m_Speed)
("direction", m_Direction)
("topwait", m_TopWait)
("topcountdown", m_TopCountdown)
("lighttag", m_LightTag);
}
//============================================================================
@ -530,19 +524,21 @@ DAnimatedDoor::DAnimatedDoor (sector_t *sec)
{
}
void DAnimatedDoor::Serialize(FArchive &arc)
void DAnimatedDoor::Serialize(FSerializer &arc)
{
Super::Serialize (arc);
arc << m_Line1 << m_Line2
<< m_Frame
<< m_Timer
<< m_BotDist
<< m_Status
<< m_Speed
<< m_Delay
<< m_DoorAnim
<< m_SetBlocking1 << m_SetBlocking2;
arc("line1", m_Line1)
("line2", m_Line2)
("frame", m_Frame)
("timer", m_Timer)
("botdist", m_BotDist)
("status", m_Status)
("speed", m_Speed)
("delay", m_Delay)
("dooranim", m_DoorAnim)
("setblock1", m_SetBlocking1)
("setblock2", m_SetBlocking2);
}
//============================================================================

View file

@ -28,7 +28,7 @@
#include "s_sndseq.h"
#include "doomstat.h"
#include "r_state.h"
#include "farchive.h"
#include "serializer.h"
#include "p_3dmidtex.h"
#include "p_spec.h"
#include "r_data/r_interpolate.h"
@ -39,20 +39,6 @@
//
//==========================================================================
inline FArchive &operator<< (FArchive &arc, DFloor::EFloor &type)
{
BYTE val = (BYTE)type;
arc << val;
type = (DFloor::EFloor)val;
return arc;
}
//==========================================================================
//
//
//
//==========================================================================
static void StartFloorSound (sector_t *sec)
{
if (sec->Flags & SECF_SILENTMOVE) return;
@ -84,23 +70,23 @@ DFloor::DFloor ()
{
}
void DFloor::Serialize(FArchive &arc)
void DFloor::Serialize(FSerializer &arc)
{
Super::Serialize (arc);
arc << m_Type
<< m_Crush
<< m_Direction
<< m_NewSpecial
<< m_Texture
<< m_FloorDestDist
<< m_Speed
<< m_ResetCount
<< m_OrgDist
<< m_Delay
<< m_PauseTime
<< m_StepTime
<< m_PerStepTime
<< m_Hexencrush;
arc.Enum("type", m_Type)
("crush", m_Crush)
("direction", m_Direction)
("newspecial", m_NewSpecial)
("texture", m_Texture)
("floordestdist", m_FloorDestDist)
("speed", m_Speed)
("resetcount", m_ResetCount)
("orgdist", m_OrgDist)
("delay", m_Delay)
("pausetime", m_PauseTime)
("steptime", m_StepTime)
("persteptime", m_PerStepTime)
("crushmode", m_Hexencrush);
}
//==========================================================================
@ -834,14 +820,6 @@ IMPLEMENT_POINTY_CLASS (DElevator)
DECLARE_POINTER(m_Interp_Ceiling)
END_POINTERS
inline FArchive &operator<< (FArchive &arc, DElevator::EElevator &type)
{
BYTE val = (BYTE)type;
arc << val;
type = (DElevator::EElevator)val;
return arc;
}
DElevator::DElevator ()
{
}
@ -855,16 +833,16 @@ DElevator::DElevator (sector_t *sec)
m_Interp_Ceiling = sec->SetInterpolation(sector_t::CeilingMove, true);
}
void DElevator::Serialize(FArchive &arc)
void DElevator::Serialize(FSerializer &arc)
{
Super::Serialize (arc);
arc << m_Type
<< m_Direction
<< m_FloorDestDist
<< m_CeilingDestDist
<< m_Speed
<< m_Interp_Floor
<< m_Interp_Ceiling;
arc.Enum("type", m_Type)
("direction", m_Direction)
("floordestdist", m_FloorDestDist)
("ceilingdestdist", m_CeilingDestDist)
("speed", m_Speed)
("interp_floor", m_Interp_Floor)
("interp_ceiling", m_Interp_Ceiling);
}
//==========================================================================
@ -1136,18 +1114,18 @@ DWaggleBase::DWaggleBase ()
{
}
void DWaggleBase::Serialize(FArchive &arc)
void DWaggleBase::Serialize(FSerializer &arc)
{
Super::Serialize (arc);
arc << m_OriginalDist
<< m_Accumulator
<< m_AccDelta
<< m_TargetScale
<< m_Scale
<< m_ScaleDelta
<< m_Ticker
<< m_State
<< m_Interpolation;
arc("originaldist", m_OriginalDist)
("accumulator", m_Accumulator)
("accdelta", m_AccDelta)
("targetscale", m_TargetScale)
("scale", m_Scale)
("scaledelta", m_ScaleDelta)
("ticker", m_Ticker)
("state", m_State)
("interpolation", m_Interpolation);
}
//==========================================================================

View file

@ -35,7 +35,7 @@
// State.
#include "r_state.h"
#include "statnums.h"
#include "farchive.h"
#include "serializer.h"
static FRandom pr_flicker ("Flicker");
static FRandom pr_lightflash ("LightFlash");
@ -49,7 +49,7 @@ class DFireFlicker : public DLighting
public:
DFireFlicker(sector_t *sector);
DFireFlicker(sector_t *sector, int upper, int lower);
void Serialize(FArchive &arc);
void Serialize(FSerializer &arc);
void Tick();
protected:
int m_Count;
@ -64,7 +64,7 @@ class DFlicker : public DLighting
DECLARE_CLASS(DFlicker, DLighting)
public:
DFlicker(sector_t *sector, int upper, int lower);
void Serialize(FArchive &arc);
void Serialize(FSerializer &arc);
void Tick();
protected:
int m_Count;
@ -80,7 +80,7 @@ class DLightFlash : public DLighting
public:
DLightFlash(sector_t *sector);
DLightFlash(sector_t *sector, int min, int max);
void Serialize(FArchive &arc);
void Serialize(FSerializer &arc);
void Tick();
protected:
int m_Count;
@ -98,7 +98,7 @@ class DStrobe : public 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 Serialize(FArchive &arc);
void Serialize(FSerializer &arc);
void Tick();
protected:
int m_Count;
@ -115,7 +115,7 @@ class DGlow : public DLighting
DECLARE_CLASS(DGlow, DLighting)
public:
DGlow(sector_t *sector);
void Serialize(FArchive &arc);
void Serialize(FSerializer &arc);
void Tick();
protected:
int m_MinLight;
@ -131,7 +131,7 @@ class DGlow2 : public DLighting
DECLARE_CLASS(DGlow2, DLighting)
public:
DGlow2(sector_t *sector, int start, int end, int tics, bool oneshot);
void Serialize(FArchive &arc);
void Serialize(FSerializer &arc);
void Tick();
protected:
int m_Start;
@ -150,7 +150,7 @@ class DPhased : public DLighting
public:
DPhased(sector_t *sector);
DPhased(sector_t *sector, int baselevel, int phase);
void Serialize(FArchive &arc);
void Serialize(FSerializer &arc);
void Tick();
protected:
BYTE m_BaseLevel;
@ -197,10 +197,12 @@ DFireFlicker::DFireFlicker ()
{
}
void DFireFlicker::Serialize(FArchive &arc)
void DFireFlicker::Serialize(FSerializer &arc)
{
Super::Serialize (arc);
arc << m_Count << m_MaxLight << m_MinLight;
arc("count", m_Count)
("maxlight", m_MaxLight)
("minlight", m_MinLight);
}
@ -262,10 +264,12 @@ DFlicker::DFlicker ()
{
}
void DFlicker::Serialize(FArchive &arc)
void DFlicker::Serialize(FSerializer &arc)
{
Super::Serialize (arc);
arc << m_Count << m_MaxLight << m_MinLight;
arc("count", m_Count)
("maxlight", m_MaxLight)
("minlight", m_MinLight);
}
//-----------------------------------------------------------------------------
@ -336,10 +340,14 @@ DLightFlash::DLightFlash ()
{
}
void DLightFlash::Serialize(FArchive &arc)
void DLightFlash::Serialize(FSerializer &arc)
{
Super::Serialize (arc);
arc << m_Count << m_MaxLight << m_MaxTime << m_MinLight << m_MinTime;
arc("count", m_Count)
("maxlight", m_MaxLight)
("minlight", m_MinLight)
("maxtime", m_MaxTime)
("mintime", m_MinTime);
}
//-----------------------------------------------------------------------------
@ -407,10 +415,14 @@ DStrobe::DStrobe ()
{
}
void DStrobe::Serialize(FArchive &arc)
void DStrobe::Serialize(FSerializer &arc)
{
Super::Serialize (arc);
arc << m_Count << m_MaxLight << m_MinLight << m_DarkTime << m_BrightTime;
arc("count", m_Count)
("maxlight", m_MaxLight)
("minlight", m_MinLight)
("darktime", m_DarkTime)
("brighttime", m_BrightTime);
}
//-----------------------------------------------------------------------------
@ -661,10 +673,12 @@ DGlow::DGlow ()
{
}
void DGlow::Serialize(FArchive &arc)
void DGlow::Serialize(FSerializer &arc)
{
Super::Serialize (arc);
arc << m_Direction << m_MaxLight << m_MinLight;
arc("direction", m_Direction)
("maxlight", m_MaxLight)
("minlight", m_MinLight);
}
//-----------------------------------------------------------------------------
@ -728,10 +742,14 @@ DGlow2::DGlow2 ()
{
}
void DGlow2::Serialize(FArchive &arc)
void DGlow2::Serialize(FSerializer &arc)
{
Super::Serialize (arc);
arc << m_End << m_MaxTics << m_OneShot << m_Start << m_Tics;
arc("end", m_End)
("maxtics", m_MaxTics)
("oneshot", m_OneShot)
("start", m_Start)
("tics", m_Tics);
}
//-----------------------------------------------------------------------------
@ -857,10 +875,11 @@ DPhased::DPhased ()
{
}
void DPhased::Serialize(FArchive &arc)
void DPhased::Serialize(FSerializer &arc)
{
Super::Serialize (arc);
arc << m_BaseLevel << m_Phase;
arc("baselevel", m_BaseLevel)
("phase", m_Phase);
}
//-----------------------------------------------------------------------------

View file

@ -37,7 +37,7 @@
#include "p_spec.h"
#include "g_level.h"
#include "s_sndseq.h"
#include "farchive.h"
#include "serializer.h"
#include "r_data/r_interpolate.h"
IMPLEMENT_POINTY_CLASS (DPillar)
@ -45,14 +45,6 @@ IMPLEMENT_POINTY_CLASS (DPillar)
DECLARE_POINTER(m_Interp_Ceiling)
END_POINTERS
inline FArchive &operator<< (FArchive &arc, DPillar::EPillar &type)
{
BYTE val = (BYTE)type;
arc << val;
type = (DPillar::EPillar)val;
return arc;
}
DPillar::DPillar ()
{
}
@ -72,18 +64,18 @@ void DPillar::Destroy()
Super::Destroy();
}
void DPillar::Serialize(FArchive &arc)
void DPillar::Serialize(FSerializer &arc)
{
Super::Serialize (arc);
arc << m_Type
<< m_FloorSpeed
<< m_CeilingSpeed
<< m_FloorTarget
<< m_CeilingTarget
<< m_Crush
<< m_Hexencrush
<< m_Interp_Floor
<< m_Interp_Ceiling;
arc.Enum("type", m_Type)
("floorspeed", m_FloorSpeed)
("ceilingspeed", m_CeilingSpeed)
("floortarget", m_FloorTarget)
("ceilingtarget", m_CeilingTarget)
("crush", m_Crush)
("hexencrush", m_Hexencrush)
("interp_floor", m_Interp_Floor)
("interp_ceiling", m_Interp_Ceiling);
}
void DPillar::Tick ()

View file

@ -30,45 +30,30 @@
#include "doomstat.h"
#include "r_state.h"
#include "gi.h"
#include "farchive.h"
#include "serializer.h"
#include "p_spec.h"
static FRandom pr_doplat ("DoPlat");
IMPLEMENT_CLASS (DPlat)
inline FArchive &operator<< (FArchive &arc, DPlat::EPlatType &type)
{
BYTE val = (BYTE)type;
arc << val;
type = (DPlat::EPlatType)val;
return arc;
}
inline FArchive &operator<< (FArchive &arc, DPlat::EPlatState &state)
{
BYTE val = (BYTE)state;
arc << val;
state = (DPlat::EPlatState)val;
return arc;
}
DPlat::DPlat ()
{
}
void DPlat::Serialize(FArchive &arc)
void DPlat::Serialize(FSerializer &arc)
{
Super::Serialize (arc);
arc << m_Speed
<< m_Low
<< m_High
<< m_Wait
<< m_Count
<< m_Status
<< m_OldStatus
<< m_Crush
<< m_Tag
<< m_Type;
arc.Enum("type", m_Type)
("speed", m_Speed)
("low", m_Low)
("high", m_High)
("wait", m_Wait)
("count", m_Count)
.Enum("status", m_Status)
.Enum("oldstatus", m_OldStatus)
("crush", m_Crush)
("tag", m_Tag);
}
void DPlat::PlayPlatSound (const char *sound)

View file

@ -28,7 +28,7 @@
#include "nodebuild.h"
#include "p_terrain.h"
#include "po_man.h"
#include "farchive.h"
#include "serializer.h"
#include "r_utility.h"
#include "a_sharedglobal.h"
#include "p_local.h"
@ -1053,14 +1053,14 @@ double sector_t::NextLowestFloorAt(double x, double y, double z, int flags, doub
//
//===========================================================================
FArchive &operator<< (FArchive &arc, secspecial_t &p)
FSerializer &Serialize(FSerializer &arc, const char *key, secspecial_t &spec, secspecial_t *def)
{
arc << p.special
<< p.damageamount
<< p.damagetype
<< p.damageinterval
<< p.leakydamage
<< p.Flags;
arc("special", spec.special)
("damageamount", spec.damageamount)
("damagetype", spec.damagetype)
("damageinterval", spec.damageinterval)
("leakydamage", spec.leakydamage)
("flags", spec.Flags);
return arc;
}
@ -1101,17 +1101,6 @@ bool secplane_t::CopyPlaneIfValid (secplane_t *dest, const secplane_t *opp) cons
return copy;
}
FArchive &operator<< (FArchive &arc, secplane_t &plane)
{
arc << plane.normal << plane.D;
if (plane.normal.Z != 0)
{ // plane.c should always be non-0. Otherwise, the plane
// would be perfectly vertical. (But then, don't let this crash on a broken savegame...)
plane.negiC = -1 / plane.normal.Z;
}
return arc;
}
//==========================================================================
//
// P_AlignFlat

View file

@ -184,7 +184,7 @@ public:
platRaiseAndStayLockout,
};
void Serialize(FArchive &arc);
void Serialize(FSerializer &arc);
void Tick ();
bool IsLift() const { return m_Type == platDownWaitUpStay || m_Type == platDownWaitUpStayStone; }
@ -241,7 +241,7 @@ public:
DPillar (sector_t *sector, EPillar type, double speed, double height,
double height2, int crush, bool hexencrush);
void Serialize(FArchive &arc);
void Serialize(FSerializer &arc);
void Tick ();
void Destroy();
@ -283,7 +283,7 @@ public:
DDoor (sector_t *sector);
DDoor (sector_t *sec, EVlDoor type, double speed, int delay, int lightTag, int topcountdown);
void Serialize(FArchive &arc);
void Serialize(FSerializer &arc);
void Tick ();
protected:
EVlDoor m_Type;
@ -325,7 +325,7 @@ public:
DAnimatedDoor (sector_t *sector);
DAnimatedDoor (sector_t *sec, line_t *line, int speed, int delay, FDoorAnimation *anim);
void Serialize(FArchive &arc);
void Serialize(FSerializer &arc);
void Tick ();
bool StartClosing ();
@ -405,7 +405,7 @@ public:
DCeiling (sector_t *sec);
DCeiling (sector_t *sec, double speed1, double speed2, int silent);
void Serialize(FArchive &arc);
void Serialize(FSerializer &arc);
void Tick ();
protected:
@ -508,7 +508,7 @@ public:
DFloor (sector_t *sec);
void Serialize(FArchive &arc);
void Serialize(FSerializer &arc);
void Tick ();
//protected:
@ -573,7 +573,7 @@ public:
DElevator (sector_t *sec);
void Destroy();
void Serialize(FArchive &arc);
void Serialize(FSerializer &arc);
void Tick ();
protected:
@ -601,7 +601,7 @@ class DWaggleBase : public DMover
public:
DWaggleBase (sector_t *sec);
void Serialize(FArchive &arc);
void Serialize(FSerializer &arc);
protected:
double m_OriginalDist;

View file

@ -27,7 +27,7 @@
#include "po_man.h"
#include "p_setup.h"
#include "vectors.h"
#include "farchive.h"
#include "serializer.h"
#include "p_blockmap.h"
#include "p_maputl.h"
#include "r_utility.h"
@ -50,25 +50,6 @@ inline vertex_t *side_t::V2() const
}
FArchive &operator<< (FArchive &arc, FPolyObj *&poly)
{
return arc.SerializePointer (polyobjs, (BYTE **)&poly, sizeof(FPolyObj));
}
FArchive &operator<< (FArchive &arc, const FPolyObj *&poly)
{
return arc.SerializePointer (polyobjs, (BYTE **)&poly, sizeof(FPolyObj));
}
inline FArchive &operator<< (FArchive &arc, podoortype_t &type)
{
BYTE val = (BYTE)type;
arc << val;
type = (podoortype_t)val;
return arc;
}
class DRotatePoly : public DPolyAction
{
DECLARE_CLASS (DRotatePoly, DPolyAction)
@ -87,7 +68,7 @@ class DMovePoly : public DPolyAction
DECLARE_CLASS (DMovePoly, DPolyAction)
public:
DMovePoly (int polyNum);
void Serialize(FArchive &arc);
void Serialize(FSerializer &arc);
void Tick ();
protected:
DMovePoly ();
@ -102,7 +83,7 @@ class DMovePolyTo : public DPolyAction
DECLARE_CLASS(DMovePolyTo, DPolyAction)
public:
DMovePolyTo(int polyNum);
void Serialize(FArchive &arc);
void Serialize(FSerializer &arc);
void Tick();
protected:
DMovePolyTo();
@ -118,7 +99,7 @@ class DPolyDoor : public DMovePoly
DECLARE_CLASS (DPolyDoor, DMovePoly)
public:
DPolyDoor (int polyNum, podoortype_t type);
void Serialize(FArchive &arc);
void Serialize(FSerializer &arc);
void Tick ();
protected:
DAngle m_Direction;
@ -199,10 +180,13 @@ DPolyAction::DPolyAction ()
{
}
void DPolyAction::Serialize(FArchive &arc)
void DPolyAction::Serialize(FSerializer &arc)
{
Super::Serialize (arc);
arc << m_PolyObj << m_Speed << m_Dist << m_Interpolation;
arc("polyobj", m_PolyObj)
("speed", m_Speed)
("dist", m_Dist)
("interpolation", m_Interpolation);
}
DPolyAction::DPolyAction (int polyNum)
@ -277,14 +261,12 @@ DMovePoly::DMovePoly ()
{
}
void DMovePoly::Serialize(FArchive &arc)
void DMovePoly::Serialize(FSerializer &arc)
{
Super::Serialize (arc);
arc << m_Angle << m_Speed;
if (SaveVersion >= 4548)
{
arc << m_Speedv;
}
arc("angle", m_Angle)
("speed", m_Speed);
("speedv", m_Speedv);
}
DMovePoly::DMovePoly (int polyNum)
@ -307,10 +289,11 @@ DMovePolyTo::DMovePolyTo()
{
}
void DMovePolyTo::Serialize(FArchive &arc)
void DMovePolyTo::Serialize(FSerializer &arc)
{
Super::Serialize(arc);
arc << m_Speedv << m_Target;
arc("speedv", m_Speedv)
("target", m_Target);
}
DMovePolyTo::DMovePolyTo(int polyNum)
@ -331,10 +314,15 @@ DPolyDoor::DPolyDoor ()
{
}
void DPolyDoor::Serialize(FArchive &arc)
void DPolyDoor::Serialize(FSerializer &arc)
{
Super::Serialize (arc);
arc << m_Direction << m_TotalDist << m_Tics << m_WaitTics << m_Type << m_Close;
arc.Enum("type", m_Type)
("direction", m_Direction)
("totaldist", m_TotalDist)
("tics", m_Tics)
("waittics", m_WaitTics)
("close", m_Close);
}
DPolyDoor::DPolyDoor (int polyNum, podoortype_t type)

View file

@ -11,7 +11,7 @@ class DPolyAction : public DThinker
HAS_OBJECT_POINTERS
public:
DPolyAction(int polyNum);
void Serialize(FArchive &arc);
void Serialize(FSerializer &arc);
void Destroy();
void Stop();
double GetSpeed() const { return m_Speed; }
@ -126,8 +126,6 @@ struct polyblock_t
void PO_LinkToSubsectors();
FArchive &operator<< (FArchive &arc, FPolyObj *&poly);
FArchive &operator<< (FArchive &arc, const FPolyObj *&poly);
// ===== PO_MAN =====

View file

@ -66,7 +66,7 @@ public:
void UpdateInterpolation();
void Restore();
void Interpolate(double smoothratio);
DECLARE_OLD_SERIAL
virtual void Serialize(FSerializer &arc);
size_t PointerSubstitution (DObject *old, DObject *notOld);
size_t PropagateMark();
@ -95,7 +95,7 @@ public:
void UpdateInterpolation();
void Restore();
void Interpolate(double smoothratio);
DECLARE_OLD_SERIAL
virtual void Serialize(FSerializer &arc);
};
@ -123,7 +123,7 @@ public:
void UpdateInterpolation();
void Restore();
void Interpolate(double smoothratio);
DECLARE_OLD_SERIAL
virtual void Serialize(FSerializer &arc);
};
@ -150,7 +150,7 @@ public:
void UpdateInterpolation();
void Restore();
void Interpolate(double smoothratio);
DECLARE_OLD_SERIAL
virtual void Serialize(FSerializer &arc);
};

View file

@ -31,7 +31,7 @@ public:
virtual void UpdateInterpolation() = 0;
virtual void Restore() = 0;
virtual void Interpolate(double smoothratio) = 0;
DECLARE_OLD_SERIAL
virtual void Serialize(FSerializer &arc);
};

View file

@ -591,7 +591,7 @@ struct secspecial_t
}
};
FArchive &operator<< (FArchive &arc, secspecial_t &p);
FSerializer &Serialize(FSerializer &arc, const char *key, secspecial_t &spec, secspecial_t *def);
enum class EMoveResult { ok, crushed, pastdest };

View file

@ -2102,7 +2102,7 @@ class AAmbientSound : public AActor
{
DECLARE_CLASS (AAmbientSound, AActor)
public:
DECLARE_OLD_SERIAL
void Serialize(FSerializer &arc);
void MarkPrecacheSounds () const;

View file

@ -436,7 +436,7 @@ IMPLEMENT_CLASS (DSeqPolyNode)
void DSeqPolyNode::Serialize(FArchive &arc)
{
Super::Serialize (arc);
arc << m_Poly;
//arc << m_Poly;
}
IMPLEMENT_CLASS (DSeqSectorNode)

View file

@ -2239,7 +2239,7 @@ static FArchive &operator<<(FArchive &arc, FSoundChan &chan)
case SOURCE_None: break;
case SOURCE_Actor: arc << chan.Actor; break;
case SOURCE_Sector: arc << chan.Sector; break;
case SOURCE_Polyobj: arc << chan.Poly; break;
case SOURCE_Polyobj: /*arc << chan.Poly;*/ break;
case SOURCE_Unattached: arc << chan.Point[0] << chan.Point[1] << chan.Point[2]; break;
default: I_Error("Unknown sound source type %d\n", chan.SourceType); break;
}

View file

@ -805,31 +805,36 @@ FSerializer &SerializePointer(FSerializer &arc, const char *key, T *&value, T **
return arc;
}
FSerializer &Serialize(FSerializer &arc, const char *key, FPolyObj *&value, FPolyObj **defval)
template<> FSerializer &Serialize(FSerializer &arc, const char *key, FPolyObj *&value, FPolyObj **defval)
{
return SerializePointer(arc, key, value, defval, polyobjs);
}
FSerializer &Serialize(FSerializer &arc, const char *key, side_t *&value, side_t **defval)
template<> FSerializer &Serialize(FSerializer &arc, const char *key, side_t *&value, side_t **defval)
{
return SerializePointer(arc, key, value, defval, sides);
}
FSerializer &Serialize(FSerializer &arc, const char *key, sector_t *&value, sector_t **defval)
template<> FSerializer &Serialize(FSerializer &arc, const char *key, sector_t *&value, sector_t **defval)
{
return SerializePointer(arc, key, value, defval, sectors);
}
FSerializer &Serialize(FSerializer &arc, const char *key, player_t *&value, player_t **defval)
template<> FSerializer &Serialize(FSerializer &arc, const char *key, player_t *&value, player_t **defval)
{
return SerializePointer(arc, key, value, defval, players);
}
FSerializer &Serialize(FSerializer &arc, const char *key, line_t *&value, line_t **defval)
template<> FSerializer &Serialize(FSerializer &arc, const char *key, line_t *&value, line_t **defval)
{
return SerializePointer(arc, key, value, defval, lines);
}
template<> FSerializer &Serialize(FSerializer &arc, const char *key, vertex_t *&value, vertex_t **defval)
{
return SerializePointer(arc, key, value, defval, vertexes);
}
//==========================================================================
//
//
@ -988,7 +993,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FName &value, FName *d
//
//==========================================================================
FSerializer &Serialize(FSerializer &arc, const char *key, FDynamicColormap *&cm, FDynamicColormap **def)
template<> FSerializer &Serialize(FSerializer &arc, const char *key, FDynamicColormap *&cm, FDynamicColormap **def)
{
if (arc.isWriting())
{
@ -1079,7 +1084,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FSoundID &sid, FSoundI
//
//==========================================================================
FSerializer &Serialize(FSerializer &arc, const char *key, PClassActor *&clst, PClassActor **def)
template<> FSerializer &Serialize(FSerializer &arc, const char *key, PClassActor *&clst, PClassActor **def)
{
if (arc.isWriting())
{
@ -1114,7 +1119,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, PClassActor *&clst, PC
//
//==========================================================================
FSerializer &Serialize(FSerializer &arc, const char *key, FState *&state, FState **def)
template<> FSerializer &Serialize(FSerializer &arc, const char *key, FState *&state, FState **def)
{
if (arc.isWriting())
{
@ -1183,7 +1188,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FState *&state, FState
//
//==========================================================================
FSerializer &Serialize(FSerializer &arc, const char *key, FStrifeDialogueNode *&node, FStrifeDialogueNode **def)
template<> FSerializer &Serialize(FSerializer &arc, const char *key, FStrifeDialogueNode *&node, FStrifeDialogueNode **def)
{
if (arc.isWriting())
{
@ -1236,7 +1241,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FStrifeDialogueNode *&
//
//==========================================================================
FSerializer &Serialize(FSerializer &arc, const char *key, FString *&pstr, FString **def)
template<> FSerializer &Serialize(FSerializer &arc, const char *key, FString *&pstr, FString **def)
{
if (arc.isWriting())
{

View file

@ -2,6 +2,7 @@
#define __SERIALIZER_H
#include <stdint.h>
#include <type_traits>
#include "tarray.h"
#include "r_defs.h"
@ -104,6 +105,15 @@ public:
}
return *this;
}
template<class T>
FSerializer &Enum(const char *key, T &obj)
{
auto val = (std::underlying_type<T>::type)obj;
Serialize(*this, key, val, nullptr);
obj = (T)val;
return *this;
}
};
FSerializer &Serialize(FSerializer &arc, const char *key, bool &value, bool *defval);
@ -117,21 +127,10 @@ FSerializer &Serialize(FSerializer &arc, const char *key, int16_t &value, int16_
FSerializer &Serialize(FSerializer &arc, const char *key, uint16_t &value, uint16_t *defval);
FSerializer &Serialize(FSerializer &arc, const char *key, double &value, double *defval);
FSerializer &Serialize(FSerializer &arc, const char *key, float &value, float *defval);
FSerializer &Serialize(FSerializer &arc, const char *key, side_t *&value, side_t **defval);
FSerializer &Serialize(FSerializer &arc, const char *key, FPolyObj *&value, FPolyObj **defval);
FSerializer &Serialize(FSerializer &arc, const char *key, sector_t *&value, sector_t **defval);
FSerializer &Serialize(FSerializer &arc, const char *key, player_t *&value, player_t **defval);
FSerializer &Serialize(FSerializer &arc, const char *key, line_t *&value, line_t **defval);
FSerializer &Serialize(FSerializer &arc, const char *key, FTextureID &value, FTextureID *defval);
FSerializer &Serialize(FSerializer &arc, const char *key, DObject *&value, DObject ** /*defval*/);
FSerializer &Serialize(FSerializer &arc, const char *key, FName &value, FName *defval);
FSerializer &Serialize(FSerializer &arc, const char *key, FDynamicColormap *&cm, FDynamicColormap **def);
FSerializer &Serialize(FSerializer &arc, const char *key, FSoundID &sid, FSoundID *def);
FSerializer &Serialize(FSerializer &arc, const char *key, PClassActor *&clst, PClassActor **def);
FSerializer &Serialize(FSerializer &arc, const char *key, FState *&state, FState **def);
FSerializer &Serialize(FSerializer &arc, const char *key, FStrifeDialogueNode *&node, FStrifeDialogueNode **def);
FSerializer &Serialize(FSerializer &arc, const char *key, FString *&pstr, FString **def);
template<class T>
FSerializer &Serialize(FSerializer &arc, const char *key, T *&value, T **)
@ -174,6 +173,20 @@ FSerializer &Serialize(FSerializer &arc, const char *key, TArray<T, TT> &value,
return arc;
}
template<> FSerializer &Serialize(FSerializer &arc, const char *key, FPolyObj *&value, FPolyObj **defval);
template<> FSerializer &Serialize(FSerializer &arc, const char *key, sector_t *&value, sector_t **defval);
template<> FSerializer &Serialize(FSerializer &arc, const char *key, player_t *&value, player_t **defval);
template<> FSerializer &Serialize(FSerializer &arc, const char *key, line_t *&value, line_t **defval);
template<> FSerializer &Serialize(FSerializer &arc, const char *key, side_t *&value, side_t **defval);
template<> FSerializer &Serialize(FSerializer &arc, const char *key, vertex_t *&value, vertex_t **defval);
template<> FSerializer &Serialize(FSerializer &arc, const char *key, FDynamicColormap *&cm, FDynamicColormap **def);
template<> FSerializer &Serialize(FSerializer &arc, const char *key, PClassActor *&clst, PClassActor **def);
template<> FSerializer &Serialize(FSerializer &arc, const char *key, FState *&state, FState **def);
template<> FSerializer &Serialize(FSerializer &arc, const char *key, FStrifeDialogueNode *&node, FStrifeDialogueNode **def);
template<> FSerializer &Serialize(FSerializer &arc, const char *key, FString *&pstr, FString **def);
template<> FSerializer &Serialize(FSerializer &arc, const char *key, FDoorAnimation *&pstr, FDoorAnimation **def);
inline FSerializer &Serialize(FSerializer &arc, const char *key, DVector3 &p, DVector3 *def)
{
return arc.Array<double>(key, &p[0], def? &(*def)[0] : nullptr, 3, true);

View file

@ -44,6 +44,7 @@
#include "w_wad.h"
#include "g_level.h"
#include "farchive.h"
#include "serializer.h"
// MACROS ------------------------------------------------------------------
@ -990,17 +991,13 @@ void FTextureManager::UpdateAnimations (DWORD mstime)
//
//==========================================================================
template<> FArchive &operator<< (FArchive &arc, FDoorAnimation* &Doorani)
template<> FSerializer &Serialize(FSerializer &arc, const char *key, FDoorAnimation *&p, FDoorAnimation **def)
{
if (arc.IsStoring())
FTextureID tex = p->BaseTexture;
Serialize(arc, key, tex, def ? &(*def)->BaseTexture : nullptr);
if (arc.isReading())
{
arc << Doorani->BaseTexture;
}
else
{
FTextureID tex;
arc << tex;
Doorani = TexMan.FindAnimatedDoor(tex);
p = TexMan.FindAnimatedDoor(tex);
}
return arc;
}

View file

@ -705,3 +705,14 @@ void DObject::Serialize(FArchive &arc)
}
FArchive &operator<< (FArchive &arc, secplane_t &plane)
{
arc << plane.normal << plane.D;
if (plane.normal.Z != 0)
{ // plane.c should always be non-0. Otherwise, the plane
// would be perfectly vertical. (But then, don't let this crash on a broken savegame...)
plane.negiC = -1 / plane.normal.Z;
}
return arc;
}