mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 04:22:34 +00:00
- all DObjects converted.
- cleaned out some old cruft that's no longer needed.
This commit is contained in:
parent
daf43f9d35
commit
af6404f763
20 changed files with 137 additions and 610 deletions
|
@ -583,7 +583,6 @@ public:
|
|||
void Destroy ();
|
||||
~AActor ();
|
||||
|
||||
DECLARE_OLD_SERIAL
|
||||
void Serialize(FSerializer &arc);
|
||||
void PostSerialize();
|
||||
|
||||
|
|
|
@ -142,7 +142,6 @@ public:
|
|||
DBot ();
|
||||
|
||||
void Clear ();
|
||||
DECLARE_OLD_SERIAL
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
|
|
|
@ -438,8 +438,6 @@ template<class T> inline void GC::Mark(TObjPtr<T> &obj)
|
|||
GC::Mark(&obj.o);
|
||||
}
|
||||
|
||||
#define DECLARE_OLD_SERIAL virtual void Serialize(FArchive &arc);
|
||||
|
||||
class DObject
|
||||
{
|
||||
public:
|
||||
|
@ -469,7 +467,6 @@ public:
|
|||
inline bool IsA (const PClass *type) const;
|
||||
|
||||
void SerializeUserVars(FArchive &arc);
|
||||
DECLARE_OLD_SERIAL
|
||||
|
||||
void SerializeUserVars(FSerializer &arc);
|
||||
virtual void Serialize(FSerializer &arc);
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "i_system.h"
|
||||
#include "doomerrors.h"
|
||||
#include "farchive.h"
|
||||
#include "serializer.h"
|
||||
#include "d_player.h"
|
||||
|
||||
|
||||
|
@ -103,14 +104,14 @@ bool FThinkerList::IsEmpty() const
|
|||
return Sentinel == NULL || Sentinel->NextThinker == NULL;
|
||||
}
|
||||
|
||||
void DThinker::SaveList(FArchive &arc, DThinker *node)
|
||||
void DThinker::SaveList(FSerializer &arc, DThinker *node)
|
||||
{
|
||||
if (node != NULL)
|
||||
{
|
||||
while (!(node->ObjectFlags & OF_Sentinel))
|
||||
{
|
||||
assert(node->NextThinker != NULL && !(node->NextThinker->ObjectFlags & OF_EuthanizeMe));
|
||||
arc << node;
|
||||
::Serialize<DThinker>(arc, nullptr, node, nullptr);
|
||||
node = node->NextThinker;
|
||||
}
|
||||
}
|
||||
|
@ -118,6 +119,7 @@ void DThinker::SaveList(FArchive &arc, DThinker *node)
|
|||
|
||||
void DThinker::SerializeAll(FArchive &arc, bool hubLoad)
|
||||
{
|
||||
#if 0
|
||||
DThinker *thinker;
|
||||
BYTE stat;
|
||||
int statcount;
|
||||
|
@ -197,6 +199,7 @@ void DThinker::SerializeAll(FArchive &arc, bool hubLoad)
|
|||
}
|
||||
bSerialOverride = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
DThinker::DThinker (int statnum) throw()
|
||||
|
|
|
@ -1087,6 +1087,7 @@ FArchive &FArchive::SerializeObject (DObject *&object, PClass *type)
|
|||
|
||||
FArchive &FArchive::ReadObject (DObject* &obj, PClass *wanttype)
|
||||
{
|
||||
#if 0
|
||||
BYTE objHead;
|
||||
const PClass *type;
|
||||
BYTE playerNum;
|
||||
|
@ -1203,6 +1204,7 @@ FArchive &FArchive::ReadObject (DObject* &obj, PClass *wanttype)
|
|||
default:
|
||||
I_Error ("Unknown object code (%d) in archive\n", objHead);
|
||||
}
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -288,19 +288,10 @@ inline FArchive &operator<< (FArchive &arc, PalEntry &p)
|
|||
return arc << p.a << p.r << p.g << p.b;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline FArchive &operator<< (FArchive &arc, T* &object)
|
||||
{
|
||||
return arc.SerializeObject ((DObject*&)object, RUNTIME_TEMPLATE_CLASS(T));
|
||||
}
|
||||
|
||||
struct FStrifeDialogueNode;
|
||||
struct FSwitchDef;
|
||||
struct FDoorAnimation;
|
||||
struct FLinePortal;
|
||||
template<> FArchive &operator<< (FArchive &arc, FStrifeDialogueNode *&node);
|
||||
template<> FArchive &operator<< (FArchive &arc, FSwitchDef* &sw);
|
||||
template<> FArchive &operator<< (FArchive &arc, FDoorAnimation* &da);
|
||||
FArchive &operator<< (FArchive &arc, FLinePortal &da);
|
||||
FArchive &operator<< (FArchive &arc, FSectorPortal &da);
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "v_video.h"
|
||||
#include "cmdlib.h"
|
||||
#include "doomstat.h"
|
||||
#include "farchive.h"
|
||||
#include "serializer.h"
|
||||
|
||||
EXTERN_CVAR(Int, con_scaletext)
|
||||
int active_con_scaletext();
|
||||
|
@ -56,14 +56,6 @@ IMPLEMENT_CLASS (DHUDMessageTypeOnFadeOut)
|
|||
* Basic HUD message. Appears and disappears without any special effects *
|
||||
*************************************************************************/
|
||||
|
||||
inline FArchive &operator<< (FArchive &arc, EColorRange &i)
|
||||
{
|
||||
BYTE val = (BYTE)i;
|
||||
arc << val;
|
||||
i = (EColorRange)val;
|
||||
return arc;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// DHUDMessage Constructor
|
||||
|
@ -180,20 +172,30 @@ DHUDMessage::~DHUDMessage ()
|
|||
//
|
||||
//============================================================================
|
||||
|
||||
void DHUDMessage::Serialize(FArchive &arc)
|
||||
void DHUDMessage::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize(arc);
|
||||
arc << Left << Top << CenterX << HoldTics
|
||||
<< Tics << State << TextColor
|
||||
//<< SBarID << SourceText << Font << Next
|
||||
<< HUDWidth << HUDHeight
|
||||
<< NoWrap
|
||||
<< ClipX << ClipY << ClipWidth << ClipHeight
|
||||
<< WrapWidth
|
||||
<< HandleAspect
|
||||
<< VisibilityFlags
|
||||
<< Style << Alpha;
|
||||
if (arc.IsLoading())
|
||||
arc("left", Left)
|
||||
("top", Top)
|
||||
("centerx", CenterX)
|
||||
("holdtics", HoldTics)
|
||||
("tics", Tics)
|
||||
("state", State)
|
||||
.Enum("textcolor", TextColor)
|
||||
("hudwidth", HUDWidth)
|
||||
("hudheight", HUDHeight)
|
||||
("nowrap", NoWrap)
|
||||
("clipx", ClipX)
|
||||
("clipy", ClipY)
|
||||
("clipwidth", ClipWidth)
|
||||
("clipheight", ClipHeight)
|
||||
("wrapwidth", WrapWidth)
|
||||
("handleaspect", HandleAspect)
|
||||
("visibilityflags", VisibilityFlags)
|
||||
("style", Style)
|
||||
("alpha", Alpha);
|
||||
|
||||
if (arc.isReading())
|
||||
{
|
||||
Lines = NULL;
|
||||
ResetText(SourceText);
|
||||
|
@ -504,10 +506,10 @@ DHUDMessageFadeOut::DHUDMessageFadeOut (FFont *font, const char *text, float x,
|
|||
//
|
||||
//============================================================================
|
||||
|
||||
void DHUDMessageFadeOut::Serialize(FArchive &arc)
|
||||
void DHUDMessageFadeOut::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
arc << FadeOutTics;
|
||||
arc("fadeouttics", FadeOutTics);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
@ -609,10 +611,10 @@ DHUDMessageFadeInOut::DHUDMessageFadeInOut (FFont *font, const char *text, float
|
|||
//
|
||||
//============================================================================
|
||||
|
||||
void DHUDMessageFadeInOut::Serialize(FArchive &arc)
|
||||
void DHUDMessageFadeInOut::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
arc << FadeInTics;
|
||||
arc("fadeintics", FadeInTics);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
@ -718,10 +720,13 @@ DHUDMessageTypeOnFadeOut::DHUDMessageTypeOnFadeOut (FFont *font, const char *tex
|
|||
//
|
||||
//============================================================================
|
||||
|
||||
void DHUDMessageTypeOnFadeOut::Serialize(FArchive &arc)
|
||||
void DHUDMessageTypeOnFadeOut::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
arc << TypeOnTime << CurrLine << LineVisible << LineLen;
|
||||
arc("typeontime", TypeOnTime)
|
||||
("currline", CurrLine)
|
||||
("linevisible", LineVisible)
|
||||
("linelen", LineLen);
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
EColorRange textColor, float holdTime);
|
||||
virtual ~DHUDMessage ();
|
||||
|
||||
virtual void Serialize(FArchive &arc);
|
||||
virtual void Serialize(FSerializer &arc);
|
||||
|
||||
void Draw (int bottom, int visibility);
|
||||
virtual void ResetText (const char *text);
|
||||
|
@ -157,7 +157,7 @@ public:
|
|||
DHUDMessageFadeOut (FFont *font, const char *text, float x, float y, int hudwidth, int hudheight,
|
||||
EColorRange textColor, float holdTime, float fadeOutTime);
|
||||
|
||||
virtual void Serialize(FArchive &arc);
|
||||
virtual void Serialize(FSerializer &arc);
|
||||
virtual void DoDraw (int linenum, int x, int y, bool clean, int hudheight);
|
||||
virtual bool Tick ();
|
||||
|
||||
|
@ -176,7 +176,7 @@ public:
|
|||
DHUDMessageFadeInOut (FFont *font, const char *text, float x, float y, int hudwidth, int hudheight,
|
||||
EColorRange textColor, float holdTime, float fadeInTime, float fadeOutTime);
|
||||
|
||||
virtual void Serialize(FArchive &arc);
|
||||
virtual void Serialize(FSerializer &arc);
|
||||
virtual void DoDraw (int linenum, int x, int y, bool clean, int hudheight);
|
||||
virtual bool Tick ();
|
||||
|
||||
|
@ -195,7 +195,7 @@ public:
|
|||
DHUDMessageTypeOnFadeOut (FFont *font, const char *text, float x, float y, int hudwidth, int hudheight,
|
||||
EColorRange textColor, float typeTime, float holdTime, float fadeOutTime);
|
||||
|
||||
virtual void Serialize(FArchive &arc);
|
||||
virtual void Serialize(FSerializer &arc);
|
||||
virtual void DoDraw (int linenum, int x, int y, bool clean, int hudheight);
|
||||
virtual bool Tick ();
|
||||
virtual void ScreenSizeChanged ();
|
||||
|
@ -355,7 +355,8 @@ public:
|
|||
|
||||
static void AddBlend (float r, float g, float b, float a, float v_blend[4]);
|
||||
|
||||
virtual void Serialize(FArchive &arc);
|
||||
// do not make this a DObject Serialize function because it's not used like one!
|
||||
void SerializeMessages(FSerializer &arc);
|
||||
|
||||
virtual void Tick ();
|
||||
virtual void Draw (EHudState state);
|
||||
|
|
|
@ -51,8 +51,9 @@
|
|||
#include "colormatcher.h"
|
||||
#include "v_palette.h"
|
||||
#include "d_player.h"
|
||||
#include "farchive.h"
|
||||
#include "serializer.h"
|
||||
#include "gstrings.h"
|
||||
#include "r_utility.h"
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
|
@ -1654,12 +1655,9 @@ void DBaseStatusBar::ReceivedWeapon (AWeapon *weapon)
|
|||
{
|
||||
}
|
||||
|
||||
void DBaseStatusBar::Serialize(FArchive &arc)
|
||||
void DBaseStatusBar::SerializeMessages(FSerializer &arc)
|
||||
{
|
||||
for (size_t i = 0; i < countof(Messages); ++i)
|
||||
{
|
||||
arc << Messages[i];
|
||||
}
|
||||
arc.Array("hudmessages", Messages, 3, true);
|
||||
}
|
||||
|
||||
void DBaseStatusBar::ScreenSizeChanged ()
|
||||
|
|
15
src/json.cpp
15
src/json.cpp
|
@ -33,21 +33,6 @@ void DObject::SerializeUserVars(FSerializer &arc)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void DThinker::SaveList(FSerializer &arc, DThinker *node)
|
||||
{
|
||||
if (node != NULL)
|
||||
{
|
||||
while (!(node->ObjectFlags & OF_Sentinel))
|
||||
{
|
||||
assert(node->NextThinker != NULL && !(node->NextThinker->ObjectFlags & OF_EuthanizeMe));
|
||||
//node->SerializeUserVars(arc);
|
||||
::Serialize<DThinker>(arc, nullptr, node, nullptr);
|
||||
node->CheckIfSerialized();
|
||||
node = node->NextThinker;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DThinker::SerializeThinkers(FSerializer &arc, bool hubLoad)
|
||||
{
|
||||
|
|
|
@ -57,7 +57,6 @@
|
|||
#include "doomstat.h"
|
||||
#include "c_console.h"
|
||||
#include "sbar.h"
|
||||
#include "farchive.h"
|
||||
#include "p_lnspec.h"
|
||||
#include "r_utility.h"
|
||||
#include "p_local.h"
|
||||
|
@ -1470,25 +1469,3 @@ static void TerminalResponse (const char *str)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
template<> FArchive &operator<< (FArchive &arc, FStrifeDialogueNode *&node)
|
||||
{
|
||||
DWORD convnum;
|
||||
if (arc.IsStoring())
|
||||
{
|
||||
arc.WriteCount (node == NULL? ~0u : node->ThisNodeNum);
|
||||
}
|
||||
else
|
||||
{
|
||||
convnum = arc.ReadCount();
|
||||
if (convnum >= StrifeDialogues.Size())
|
||||
{
|
||||
node = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
node = StrifeDialogues[convnum];
|
||||
}
|
||||
}
|
||||
return arc;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "g_level.h"
|
||||
#include "farchive.h"
|
||||
#include "d_player.h"
|
||||
#include "serializer.h"
|
||||
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
@ -1446,13 +1447,23 @@ void DPSprite::Tick()
|
|||
//
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
void DPSprite::Serialize(FArchive &arc)
|
||||
void DPSprite::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize(arc);
|
||||
|
||||
arc << Next << Caller << Owner << Flags
|
||||
<< State << Tics << Sprite << Frame
|
||||
<< ID << x << y << oldx << oldy;
|
||||
arc("next", Next)
|
||||
("caller", Caller)
|
||||
("owner", Owner)
|
||||
("flags", Flags)
|
||||
("state", State)
|
||||
("tics", Tics)
|
||||
.Sprite("sprite", Sprite, nullptr)
|
||||
("frame", Frame)
|
||||
("id", ID)
|
||||
("x", x)
|
||||
("y", y)
|
||||
("oldx", oldx)
|
||||
("oldy", oldy);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
private:
|
||||
DPSprite () {}
|
||||
|
||||
void Serialize(FArchive &arc);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick();
|
||||
void Destroy();
|
||||
|
||||
|
|
|
@ -863,7 +863,7 @@ void G_SerializeLevel(FSerializer &arc, bool hubload)
|
|||
arc.Array("sectors", sectors, &loadsectors[0], numsectors);
|
||||
arc.Array("polyobjs", polyobjs, po_NumPolyobjs);
|
||||
arc("subsectors", subsectors);
|
||||
//StatusBar->Serialize(arc);
|
||||
StatusBar->SerializeMessages(arc);
|
||||
arc("zones", Zones);
|
||||
arc("lineportals", linePortals);
|
||||
arc("sectorportals", sectorPortals);
|
||||
|
@ -882,7 +882,7 @@ void G_SerializeLevel(FSerializer &arc, bool hubload)
|
|||
void P_SerializeSounds (FArchive &arc)
|
||||
{
|
||||
S_SerializeSounds (arc);
|
||||
DSeqNode::SerializeSequences (arc);
|
||||
//DSeqNode::SerializeSequences (arc);
|
||||
char *name = NULL;
|
||||
BYTE order;
|
||||
|
||||
|
@ -900,40 +900,6 @@ void P_SerializeSounds (FArchive &arc)
|
|||
delete[] name;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// ArchivePolyobjs
|
||||
//
|
||||
//==========================================================================
|
||||
#define ASEG_POLYOBJS 104
|
||||
|
||||
void P_SerializePolyobjs (FArchive &arc)
|
||||
{
|
||||
int i;
|
||||
FPolyObj *po;
|
||||
|
||||
if (arc.IsStoring ())
|
||||
{
|
||||
int seg = ASEG_POLYOBJS;
|
||||
arc << seg << po_NumPolyobjs;
|
||||
for(i = 0, po = polyobjs; i < po_NumPolyobjs; i++, po++)
|
||||
{
|
||||
arc << po->tag << po->Angle << po->StartSpot.pos << po->interpolation << po->bBlocked << po->bHasPortals;
|
||||
arc << po->specialdata;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int data;
|
||||
DAngle angle;
|
||||
DVector2 delta;
|
||||
|
||||
for (i = 0, po = polyobjs; i < po_NumPolyobjs; i++, po++)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
@ -976,7 +942,6 @@ void G_SerializeLevel(FArchive &arc, bool hubLoad)
|
|||
|
||||
// This must be saved, too, of course!
|
||||
FCanvasTextureInfo::Serialize(arc);
|
||||
//AM_SerializeMarkers(arc);
|
||||
|
||||
P_SerializePlayers(arc, hubLoad);
|
||||
P_SerializeSounds(arc);
|
||||
|
|
|
@ -3007,6 +3007,7 @@ void P_UnPredictPlayer ()
|
|||
|
||||
void player_t::Serialize(FArchive &arc)
|
||||
{
|
||||
#if 0
|
||||
int i;
|
||||
FString skinname;
|
||||
|
||||
|
@ -3079,54 +3080,6 @@ void player_t::Serialize(FArchive &arc)
|
|||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
arc << frags[i];
|
||||
|
||||
if (SaveVersion < 4547)
|
||||
{
|
||||
int layer = PSP_WEAPON;
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
FState *state;
|
||||
int tics;
|
||||
double sx, sy;
|
||||
int sprite;
|
||||
int frame;
|
||||
|
||||
arc << state << tics
|
||||
<< sx << sy
|
||||
<< sprite << frame;
|
||||
|
||||
if (state != nullptr &&
|
||||
((layer < PSP_TARGETCENTER && ReadyWeapon != nullptr) ||
|
||||
(layer >= PSP_TARGETCENTER && mo->FindInventory(RUNTIME_CLASS(APowerTargeter), true))))
|
||||
{
|
||||
DPSprite *pspr;
|
||||
pspr = GetPSprite(PSPLayers(layer));
|
||||
pspr->State = state;
|
||||
pspr->Tics = tics;
|
||||
pspr->Sprite = sprite;
|
||||
pspr->Frame = frame;
|
||||
pspr->Owner = this;
|
||||
|
||||
if (layer == PSP_FLASH)
|
||||
{
|
||||
pspr->x = 0;
|
||||
pspr->y = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
pspr->x = sx;
|
||||
pspr->y = sy;
|
||||
}
|
||||
}
|
||||
|
||||
if (layer == PSP_WEAPON)
|
||||
layer = PSP_FLASH;
|
||||
else if (layer == PSP_FLASH)
|
||||
layer = PSP_TARGETCENTER;
|
||||
else
|
||||
layer++;
|
||||
}
|
||||
}
|
||||
else
|
||||
arc << psprites;
|
||||
|
||||
arc << CurrentPlayerClass;
|
||||
|
@ -3154,6 +3107,7 @@ void player_t::Serialize(FArchive &arc)
|
|||
userinfo.SkinChanged(skinname, CurrentPlayerClass);
|
||||
}
|
||||
arc << MUSINFOactor << MUSINFOtics;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool P_IsPlayerTotallyFrozen(const player_t *player)
|
||||
|
|
|
@ -1043,6 +1043,7 @@ void FCanvasTextureInfo::EmptyList ()
|
|||
|
||||
void FCanvasTextureInfo::Serialize(FArchive &arc)
|
||||
{
|
||||
#if 0
|
||||
if (arc.IsStoring ())
|
||||
{
|
||||
FCanvasTextureInfo *probe;
|
||||
|
@ -1070,6 +1071,7 @@ void FCanvasTextureInfo::Serialize(FArchive &arc)
|
|||
Add (viewpoint, picnum, fov);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
107
src/s_sndseq.cpp
107
src/s_sndseq.cpp
|
@ -27,7 +27,7 @@
|
|||
#include "templates.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "g_level.h"
|
||||
#include "farchive.h"
|
||||
#include "serializer.h"
|
||||
#include "d_player.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
@ -106,7 +106,7 @@ class DSeqActorNode : public DSeqNode
|
|||
public:
|
||||
DSeqActorNode(AActor *actor, int sequence, int modenum);
|
||||
void Destroy();
|
||||
void Serialize(FArchive &arc);
|
||||
void Serialize(FSerializer &arc);
|
||||
void MakeSound(int loop, FSoundID id)
|
||||
{
|
||||
S_Sound(m_Actor, CHAN_BODY|loop, id, clamp(m_Volume, 0.f, 1.f), m_Atten);
|
||||
|
@ -134,7 +134,7 @@ class DSeqPolyNode : public DSeqNode
|
|||
public:
|
||||
DSeqPolyNode(FPolyObj *poly, int sequence, int modenum);
|
||||
void Destroy();
|
||||
void Serialize(FArchive &arc);
|
||||
void Serialize(FSerializer &arc);
|
||||
void MakeSound(int loop, FSoundID id)
|
||||
{
|
||||
S_Sound (m_Poly, CHAN_BODY|loop, id, clamp(m_Volume, 0.f, 1.f), m_Atten);
|
||||
|
@ -162,7 +162,7 @@ class DSeqSectorNode : public DSeqNode
|
|||
public:
|
||||
DSeqSectorNode(sector_t *sec, int chan, int sequence, int modenum);
|
||||
void Destroy();
|
||||
void Serialize(FArchive &arc);
|
||||
void Serialize(FSerializer &arc);
|
||||
void MakeSound(int loop, FSoundID id)
|
||||
{
|
||||
Channel = (Channel & 7) | CHAN_AREA | loop;
|
||||
|
@ -280,9 +280,9 @@ static FRandom pr_sndseq ("SndSeq");
|
|||
|
||||
// CODE --------------------------------------------------------------------
|
||||
|
||||
void DSeqNode::SerializeSequences (FArchive &arc)
|
||||
void DSeqNode::SerializeSequences (FSerializer &arc)
|
||||
{
|
||||
arc << SequenceListHead;
|
||||
arc("sndseqlisthead", SequenceListHead);
|
||||
}
|
||||
|
||||
IMPLEMENT_POINTY_CLASS (DSeqNode)
|
||||
|
@ -298,35 +298,10 @@ DSeqNode::DSeqNode ()
|
|||
m_Next = m_Prev = m_ChildSeqNode = m_ParentSeqNode = NULL;
|
||||
}
|
||||
|
||||
void DSeqNode::Serialize(FArchive &arc)
|
||||
void DSeqNode::Serialize(FSerializer &arc)
|
||||
{
|
||||
int seqOffset;
|
||||
unsigned int i;
|
||||
|
||||
Super::Serialize (arc);
|
||||
if (arc.IsStoring ())
|
||||
{
|
||||
seqOffset = (int)SN_GetSequenceOffset (m_Sequence, m_SequencePtr);
|
||||
arc << seqOffset
|
||||
<< m_DelayUntilTic
|
||||
<< m_Volume
|
||||
<< m_Atten
|
||||
<< m_ModeNum
|
||||
<< m_Next
|
||||
<< m_Prev
|
||||
<< m_ChildSeqNode
|
||||
<< m_ParentSeqNode
|
||||
<< m_CurrentSoundID
|
||||
<< Sequences[m_Sequence]->SeqName;
|
||||
|
||||
arc.WriteCount (m_SequenceChoices.Size());
|
||||
for (i = 0; i < m_SequenceChoices.Size(); ++i)
|
||||
{
|
||||
arc << Sequences[m_SequenceChoices[i]]->SeqName;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FName seqName;
|
||||
int delayTics = 0;
|
||||
FSoundID id;
|
||||
|
@ -335,18 +310,46 @@ void DSeqNode::Serialize(FArchive &arc)
|
|||
int seqnum;
|
||||
unsigned int numchoices;
|
||||
|
||||
arc << seqOffset
|
||||
<< delayTics
|
||||
<< volume
|
||||
<< atten
|
||||
<< m_ModeNum
|
||||
<< m_Next
|
||||
<< m_Prev
|
||||
<< m_ChildSeqNode
|
||||
<< m_ParentSeqNode
|
||||
<< id
|
||||
<< seqName;
|
||||
// copy these to local variables so that the actual serialization code does not need to be duplicated for saving and loading.
|
||||
if (arc.isWriting())
|
||||
{
|
||||
seqOffset = (int)SN_GetSequenceOffset(m_Sequence, m_SequencePtr);
|
||||
delayTics = m_DelayUntilTic;
|
||||
volume = m_Volume;
|
||||
atten = m_Atten;
|
||||
id = m_CurrentSoundID;
|
||||
seqName = Sequences[m_Sequence]->SeqName;
|
||||
numchoices = m_SequenceChoices.Size();
|
||||
}
|
||||
Super::Serialize(arc);
|
||||
|
||||
arc("seqoffset", seqOffset)
|
||||
("delaytics", delayTics)
|
||||
("volume", volume)
|
||||
("atten", atten)
|
||||
("modelnum", m_ModeNum)
|
||||
("next", m_Next)
|
||||
("prev", m_Prev)
|
||||
("childseqnode", m_ChildSeqNode)
|
||||
("parentseqnode", m_ParentSeqNode)
|
||||
("id", id)
|
||||
("seqname", seqName)
|
||||
("numchoices", numchoices);
|
||||
|
||||
// The way this is saved makes it hard to encapsulate so just do it the hard way...
|
||||
if (arc.isWriting())
|
||||
{
|
||||
if (numchoices > 0 && arc.BeginArray("choices"))
|
||||
{
|
||||
for (i = 0; i < m_SequenceChoices.Size(); ++i)
|
||||
{
|
||||
arc(nullptr, Sequences[m_SequenceChoices[i]]->SeqName);
|
||||
}
|
||||
arc.EndArray();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
seqnum = FindSequence (seqName);
|
||||
if (seqnum >= 0)
|
||||
{
|
||||
|
@ -360,13 +363,16 @@ void DSeqNode::Serialize(FArchive &arc)
|
|||
|
||||
ChangeData (seqOffset, delayTics - TIME_REFERENCE, volume, id);
|
||||
|
||||
numchoices = arc.ReadCount();
|
||||
m_SequenceChoices.Resize(numchoices);
|
||||
if (numchoices > 0 && arc.BeginArray("choices"))
|
||||
{
|
||||
for (i = 0; i < numchoices; ++i)
|
||||
{
|
||||
arc << seqName;
|
||||
arc(nullptr, seqName);
|
||||
m_SequenceChoices[i] = FindSequence(seqName);
|
||||
}
|
||||
arc.EndArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -425,15 +431,15 @@ IMPLEMENT_POINTY_CLASS (DSeqActorNode)
|
|||
DECLARE_POINTER (m_Actor)
|
||||
END_POINTERS
|
||||
|
||||
void DSeqActorNode::Serialize(FArchive &arc)
|
||||
void DSeqActorNode::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
arc << m_Actor;
|
||||
arc("actor", m_Actor);
|
||||
}
|
||||
|
||||
IMPLEMENT_CLASS (DSeqPolyNode)
|
||||
|
||||
void DSeqPolyNode::Serialize(FArchive &arc)
|
||||
void DSeqPolyNode::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
//arc << m_Poly;
|
||||
|
@ -441,10 +447,11 @@ void DSeqPolyNode::Serialize(FArchive &arc)
|
|||
|
||||
IMPLEMENT_CLASS (DSeqSectorNode)
|
||||
|
||||
void DSeqSectorNode::Serialize(FArchive &arc)
|
||||
void DSeqSectorNode::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
arc << m_Sector << Channel;
|
||||
arc("sector",m_Sector)
|
||||
("channel", Channel);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -20,7 +20,7 @@ class DSeqNode : public DObject
|
|||
DECLARE_CLASS (DSeqNode, DObject)
|
||||
HAS_OBJECT_POINTERS
|
||||
public:
|
||||
void Serialize(FArchive &arc);
|
||||
void Serialize(FSerializer &arc);
|
||||
void StopAndDestroy ();
|
||||
void Destroy ();
|
||||
void Tick ();
|
||||
|
@ -38,7 +38,7 @@ public:
|
|||
inline static DSeqNode *FirstSequence() { return SequenceListHead; }
|
||||
inline DSeqNode *NextSequence() const { return m_Next; }
|
||||
|
||||
static void SerializeSequences (FArchive &arc);
|
||||
static void SerializeSequences (FSerializer &arc);
|
||||
|
||||
protected:
|
||||
DSeqNode ();
|
||||
|
|
|
@ -2237,7 +2237,7 @@ static FArchive &operator<<(FArchive &arc, FSoundChan &chan)
|
|||
switch (chan.SourceType)
|
||||
{
|
||||
case SOURCE_None: break;
|
||||
case SOURCE_Actor: arc << chan.Actor; break;
|
||||
//case SOURCE_Actor: arc << chan.Actor; break;
|
||||
case SOURCE_Sector: arc << chan.Sector; break;
|
||||
case SOURCE_Polyobj: /*arc << chan.Poly;*/ break;
|
||||
case SOURCE_Unattached: arc << chan.Point[0] << chan.Point[1] << chan.Point[2]; break;
|
||||
|
@ -2324,7 +2324,7 @@ void S_SerializeSounds(FArchive &arc)
|
|||
// sounds might be heard briefly before pausing for the wipe.
|
||||
RestartEvictionsAt = level.time + 2;
|
||||
}
|
||||
DSeqNode::SerializeSequences(arc);
|
||||
//DSeqNode::SerializeSequences(arc);
|
||||
GSnd->Sync(false);
|
||||
GSnd->UpdateSounds();
|
||||
}
|
||||
|
|
373
src/zzz_old.cpp
373
src/zzz_old.cpp
|
@ -35,260 +35,10 @@
|
|||
#define NEW_SPRITE ((BYTE)11) // A new sprite name follows
|
||||
#define OLD_SPRITE ((BYTE)12) // Reference to an old sprite name follows
|
||||
|
||||
inline FArchive &operator<< (FArchive &arc, FLinkedSector &link)
|
||||
{
|
||||
arc << link.Sector << link.Type;
|
||||
return arc;
|
||||
}
|
||||
|
||||
//
|
||||
// P_ArchiveWorld
|
||||
//
|
||||
void P_SerializeWorld (FArchive &arc)
|
||||
{
|
||||
int i, j;
|
||||
sector_t *sec;
|
||||
line_t *li;
|
||||
zone_t *zn;
|
||||
|
||||
// do sectors
|
||||
for (i = 0, sec = sectors; i < numsectors; i++, sec++)
|
||||
{
|
||||
arc << sec->floorplane
|
||||
<< sec->ceilingplane;
|
||||
arc << sec->lightlevel;
|
||||
arc << sec->special;
|
||||
arc << sec->soundtraversed
|
||||
<< sec->seqType
|
||||
<< sec->friction
|
||||
<< sec->movefactor
|
||||
<< sec->stairlock
|
||||
<< sec->prevsec
|
||||
<< sec->nextsec
|
||||
<< sec->planes[sector_t::floor]
|
||||
<< sec->planes[sector_t::ceiling]
|
||||
<< sec->heightsec
|
||||
<< sec->bottommap << sec->midmap << sec->topmap
|
||||
<< sec->gravity;
|
||||
P_SerializeTerrain(arc, sec->terrainnum[0]);
|
||||
P_SerializeTerrain(arc, sec->terrainnum[1]);
|
||||
arc << sec->damageamount;
|
||||
arc << sec->damageinterval
|
||||
<< sec->leakydamage
|
||||
<< sec->damagetype
|
||||
<< sec->sky
|
||||
<< sec->MoreFlags
|
||||
<< sec->Flags
|
||||
<< sec->Portals[sector_t::floor] << sec->Portals[sector_t::ceiling]
|
||||
<< sec->ZoneNumber;
|
||||
arc << sec->interpolations[0]
|
||||
<< sec->interpolations[1]
|
||||
<< sec->interpolations[2]
|
||||
<< sec->interpolations[3]
|
||||
<< sec->SeqName;
|
||||
|
||||
sec->e->Serialize(arc);
|
||||
if (arc.IsStoring ())
|
||||
{
|
||||
arc << sec->ColorMap->Color
|
||||
<< sec->ColorMap->Fade;
|
||||
BYTE sat = sec->ColorMap->Desaturate;
|
||||
arc << sat;
|
||||
}
|
||||
else
|
||||
{
|
||||
PalEntry color, fade;
|
||||
BYTE desaturate;
|
||||
arc << color << fade
|
||||
<< desaturate;
|
||||
sec->ColorMap = GetSpecialLights (color, fade, desaturate);
|
||||
}
|
||||
}
|
||||
|
||||
// do lines
|
||||
for (i = 0, li = lines; i < numlines; i++, li++)
|
||||
{
|
||||
arc << li->flags
|
||||
<< li->activation
|
||||
<< li->special
|
||||
<< li->alpha;
|
||||
|
||||
if (P_IsACSSpecial(li->special))
|
||||
{
|
||||
P_SerializeACSScriptNumber(arc, li->args[0], false);
|
||||
}
|
||||
else
|
||||
{
|
||||
arc << li->args[0];
|
||||
}
|
||||
arc << li->args[1] << li->args[2] << li->args[3] << li->args[4];
|
||||
|
||||
arc << li->portalindex;
|
||||
for (j = 0; j < 2; j++)
|
||||
{
|
||||
if (li->sidedef[j] == NULL)
|
||||
continue;
|
||||
|
||||
side_t *si = li->sidedef[j];
|
||||
arc << si->textures[side_t::top]
|
||||
<< si->textures[side_t::mid]
|
||||
<< si->textures[side_t::bottom]
|
||||
<< si->Light
|
||||
<< si->Flags
|
||||
<< si->LeftSide
|
||||
<< si->RightSide
|
||||
<< si->Index;
|
||||
}
|
||||
}
|
||||
|
||||
// do zones
|
||||
unsigned numzones = Zones.Size();
|
||||
arc << numzones;
|
||||
|
||||
if (arc.IsLoading())
|
||||
{
|
||||
Zones.Resize(numzones);
|
||||
}
|
||||
|
||||
for (i = 0, zn = &Zones[0]; i < (int)numzones; ++i, ++zn)
|
||||
{
|
||||
arc << zn->Environment;
|
||||
}
|
||||
|
||||
arc << linePortals << sectorPortals;
|
||||
P_CollectLinkedPortals();
|
||||
}
|
||||
|
||||
void P_SerializeWorldActors(FArchive &arc)
|
||||
{
|
||||
int i;
|
||||
sector_t *sec;
|
||||
line_t *line;
|
||||
|
||||
for (i = 0, sec = sectors; i < numsectors; i++, sec++)
|
||||
{
|
||||
arc << sec->SoundTarget
|
||||
<< sec->SecActTarget
|
||||
<< sec->floordata
|
||||
<< sec->ceilingdata
|
||||
<< sec->lightingdata;
|
||||
}
|
||||
for (auto &s : sectorPortals)
|
||||
{
|
||||
arc << s.mSkybox;
|
||||
}
|
||||
for (i = 0, line = lines; i < numlines; i++, line++)
|
||||
{
|
||||
for (int s = 0; s < 2; s++)
|
||||
{
|
||||
if (line->sidedef[s] != NULL)
|
||||
{
|
||||
//DBaseDecal::SerializeChain(arc, &line->sidedef[s]->AttachedDecals);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void extsector_t::Serialize(FArchive &arc)
|
||||
{
|
||||
arc << FakeFloor.Sectors
|
||||
<< Midtex.Floor.AttachedLines
|
||||
<< Midtex.Floor.AttachedSectors
|
||||
<< Midtex.Ceiling.AttachedLines
|
||||
<< Midtex.Ceiling.AttachedSectors
|
||||
<< Linked.Floor.Sectors
|
||||
<< Linked.Ceiling.Sectors;
|
||||
}
|
||||
|
||||
FArchive &operator<< (FArchive &arc, side_t::part &p)
|
||||
{
|
||||
arc << p.xOffset << p.yOffset << p.interpolation << p.texture
|
||||
<< p.xScale << p.yScale;// << p.Light;
|
||||
return arc;
|
||||
}
|
||||
|
||||
FArchive &operator<< (FArchive &arc, sector_t::splane &p)
|
||||
{
|
||||
arc << p.xform.xOffs << p.xform.yOffs << p.xform.xScale << p.xform.yScale
|
||||
<< p.xform.Angle << p.xform.baseyOffs << p.xform.baseAngle
|
||||
<< p.Flags << p.Light << p.Texture << p.TexZ << p.alpha;
|
||||
return arc;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// ArchiveSubsectors
|
||||
//
|
||||
//==========================================================================
|
||||
void RecalculateDrawnSubsectors();
|
||||
|
||||
void P_SerializeSubsectors(FArchive &arc)
|
||||
{
|
||||
int num_verts, num_subs, num_nodes;
|
||||
BYTE by;
|
||||
|
||||
if (arc.IsStoring())
|
||||
{
|
||||
if (hasglnodes)
|
||||
{
|
||||
arc << numvertexes << numsubsectors << numnodes; // These are only for verification
|
||||
for(int i=0;i<numsubsectors;i+=8)
|
||||
{
|
||||
by = 0;
|
||||
for(int j=0;j<8;j++)
|
||||
{
|
||||
if (i+j<numsubsectors && (subsectors[i+j].flags & SSECF_DRAWN))
|
||||
{
|
||||
by |= (1<<j);
|
||||
}
|
||||
}
|
||||
arc << by;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int v = 0;
|
||||
arc << v << v << v;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
arc << num_verts << num_subs << num_nodes;
|
||||
if (num_verts != numvertexes ||
|
||||
num_subs != numsubsectors ||
|
||||
num_nodes != numnodes)
|
||||
{
|
||||
// Nodes don't match - we can't use this info
|
||||
for(int i=0;i<num_subs;i+=8)
|
||||
{
|
||||
// Skip the subsector info.
|
||||
arc << by;
|
||||
}
|
||||
if (hasglnodes)
|
||||
{
|
||||
RecalculateDrawnSubsectors();
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int i=0;i<numsubsectors;i+=8)
|
||||
{
|
||||
arc << by;
|
||||
for(int j=0;j<8;j++)
|
||||
{
|
||||
if ((by & (1<<j)) && i+j<numsubsectors)
|
||||
{
|
||||
subsectors[i+j].flags |= SSECF_DRAWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FArchive &FArchive::WriteObject (DObject *obj)
|
||||
{
|
||||
#if 0
|
||||
player_t *player;
|
||||
BYTE id[2];
|
||||
|
||||
|
@ -387,49 +137,10 @@ FArchive &FArchive::WriteObject (DObject *obj)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return *this;
|
||||
}
|
||||
|
||||
void AActor::Serialize(FArchive &arc)
|
||||
{
|
||||
Super::Serialize(arc);
|
||||
|
||||
{
|
||||
FString tagstr;
|
||||
if (arc.IsStoring() && Tag != NULL && Tag->Len() > 0) tagstr = *Tag;
|
||||
arc << tagstr;
|
||||
if (arc.IsLoading())
|
||||
{
|
||||
if (tagstr.Len() == 0) Tag = NULL;
|
||||
else Tag = mStringPropertyData.Alloc(tagstr);
|
||||
}
|
||||
}
|
||||
|
||||
if (arc.IsLoading ())
|
||||
{
|
||||
touching_sectorlist = NULL;
|
||||
LinkToWorld(false, Sector);
|
||||
|
||||
AddToHash ();
|
||||
SetShade (fillcolor);
|
||||
if (player)
|
||||
{
|
||||
if (playeringame[player - players] &&
|
||||
player->cls != NULL &&
|
||||
!(flags4 & MF4_NOSKIN) &&
|
||||
state->sprite == GetDefaultByType (player->cls)->SpawnState->sprite)
|
||||
{ // Give player back the skin
|
||||
sprite = skins[player->userinfo.GetSkin()].sprite;
|
||||
}
|
||||
if (Speed == 0)
|
||||
{
|
||||
Speed = GetDefault()->Speed;
|
||||
}
|
||||
}
|
||||
ClearInterpolation();
|
||||
UpdateWaterLevel(false);
|
||||
}
|
||||
}
|
||||
|
||||
FArchive &operator<< (FArchive &arc, sector_t *&sec)
|
||||
{
|
||||
|
@ -532,12 +243,6 @@ FArchive &operator<< (FArchive &arc, FState *&state)
|
|||
return arc;
|
||||
}
|
||||
|
||||
void DObject::Serialize(FArchive &arc)
|
||||
{
|
||||
ObjectFlags |= OF_SerialSuccess;
|
||||
}
|
||||
|
||||
|
||||
FArchive &operator<< (FArchive &arc, secplane_t &plane)
|
||||
{
|
||||
arc << plane.normal << plane.D;
|
||||
|
@ -549,37 +254,6 @@ FArchive &operator<< (FArchive &arc, secplane_t &plane)
|
|||
return arc;
|
||||
}
|
||||
|
||||
FArchive &operator<< (FArchive &arc, botskill_t &skill)
|
||||
{
|
||||
return arc << skill.aiming << skill.perfection << skill.reaction << skill.isp;
|
||||
}
|
||||
|
||||
void DBot::Serialize(FArchive &arc)
|
||||
{
|
||||
Super::Serialize(arc);
|
||||
|
||||
arc << player
|
||||
<< Angle
|
||||
<< dest
|
||||
<< prev
|
||||
<< enemy
|
||||
<< missile
|
||||
<< mate
|
||||
<< last_mate
|
||||
<< skill
|
||||
<< t_active
|
||||
<< t_respawn
|
||||
<< t_strafe
|
||||
<< t_react
|
||||
<< t_fight
|
||||
<< t_roam
|
||||
<< t_rocket
|
||||
<< first_shot
|
||||
<< sleft
|
||||
<< allround
|
||||
<< increase
|
||||
<< old;
|
||||
}
|
||||
void P_SerializeACSScriptNumber(FArchive &arc, int &scriptnum, bool was2byte)
|
||||
{
|
||||
arc << scriptnum;
|
||||
|
@ -598,46 +272,3 @@ void P_SerializeACSScriptNumber(FArchive &arc, int &scriptnum, bool was2byte)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// Save a line portal for savegames.
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
FArchive &operator<< (FArchive &arc, FLinePortal &port)
|
||||
{
|
||||
arc << port.mOrigin
|
||||
<< port.mDestination
|
||||
<< port.mDisplacement
|
||||
<< port.mType
|
||||
<< port.mFlags
|
||||
<< port.mDefFlags
|
||||
<< port.mAlign;
|
||||
return arc;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// Save a sector portal for savegames.
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
FArchive &operator<< (FArchive &arc, FSectorPortal &port)
|
||||
{
|
||||
arc << port.mType
|
||||
<< port.mFlags
|
||||
<< port.mPartner
|
||||
<< port.mPlane
|
||||
<< port.mOrigin
|
||||
<< port.mDestination
|
||||
<< port.mDisplacement
|
||||
<< port.mPlaneZ;
|
||||
if (arc.IsLoading())
|
||||
{
|
||||
port.mSkybox = nullptr;
|
||||
}
|
||||
return arc;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue