mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-01-29 20:10:58 +00:00
- all thinker serializers done.
This commit is contained in:
parent
a5000ead4c
commit
ab43e0c8cb
27 changed files with 564 additions and 656 deletions
|
@ -12,7 +12,7 @@
|
|||
#include "cmdlib.h"
|
||||
#include "teaminfo.h"
|
||||
#include "d_net.h"
|
||||
#include "farchive.h"
|
||||
#include "serializer.h"
|
||||
#include "d_player.h"
|
||||
|
||||
IMPLEMENT_POINTY_CLASS(DBot)
|
||||
|
@ -55,31 +55,44 @@ void DBot::Clear ()
|
|||
old = { 0, 0 };
|
||||
}
|
||||
|
||||
void DBot::Serialize(FArchive &arc)
|
||||
FSerializer &Serialize(FSerializer &arc, const char *key, botskill_t &skill, botskill_t *def)
|
||||
{
|
||||
if (arc.BeginObject(key))
|
||||
{
|
||||
arc("aiming", skill.aiming)
|
||||
("perfection", skill.perfection)
|
||||
("reaction", skill.reaction)
|
||||
("isp", skill.isp)
|
||||
.EndObject();
|
||||
}
|
||||
return arc;
|
||||
}
|
||||
|
||||
void DBot::Serialize(FSerializer &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;
|
||||
arc("player", player)
|
||||
("angle", Angle)
|
||||
("dest", dest)
|
||||
("prev", prev)
|
||||
("enemy", enemy)
|
||||
("missile", missile)
|
||||
("mate", mate)
|
||||
("lastmate", last_mate)
|
||||
("skill", skill)
|
||||
("active", t_active)
|
||||
("respawn", t_respawn)
|
||||
("strafe", t_strafe)
|
||||
("react", t_react)
|
||||
("fight", t_fight)
|
||||
("roam", t_roam)
|
||||
("rocket", t_rocket)
|
||||
("firstshot", first_shot)
|
||||
("sleft", sleft)
|
||||
("allround", allround)
|
||||
("increase", increase)
|
||||
("old", old);
|
||||
}
|
||||
|
||||
void DBot::Tick ()
|
||||
|
@ -193,11 +206,6 @@ CCMD (listbots)
|
|||
Printf ("> %d bots\n", count);
|
||||
}
|
||||
|
||||
FArchive &operator<< (FArchive &arc, botskill_t &skill)
|
||||
{
|
||||
return arc << skill.aiming << skill.perfection << skill.reaction << skill.isp;
|
||||
}
|
||||
|
||||
// set the bot specific weapon information
|
||||
// This is intentionally not in the weapon definition anymore.
|
||||
void InitBotStuff()
|
||||
|
|
|
@ -142,7 +142,8 @@ public:
|
|||
DBot ();
|
||||
|
||||
void Clear ();
|
||||
void Serialize(FArchive &arc);
|
||||
DECLARE_OLD_SERIAL
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
//(b_think.cpp)
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
#include "v_text.h"
|
||||
#include "d_net.h"
|
||||
#include "d_main.h"
|
||||
#include "farchive.h"
|
||||
#include "serializer.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
@ -65,7 +65,7 @@ class DWaitingCommand : public DThinker
|
|||
public:
|
||||
DWaitingCommand (const char *cmd, int tics);
|
||||
~DWaitingCommand ();
|
||||
void Serialize(FArchive &arc);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
private:
|
||||
|
@ -189,10 +189,11 @@ static const char *KeyConfCommands[] =
|
|||
|
||||
IMPLEMENT_CLASS (DWaitingCommand)
|
||||
|
||||
void DWaitingCommand::Serialize(FArchive &arc)
|
||||
void DWaitingCommand::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
arc << Command << TicsLeft;
|
||||
arc("command", Command)
|
||||
("ticsleft", TicsLeft);
|
||||
}
|
||||
|
||||
DWaitingCommand::DWaitingCommand ()
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#include "g_level.h"
|
||||
#include "colormatcher.h"
|
||||
#include "b_bot.h"
|
||||
#include "farchive.h"
|
||||
#include "serializer.h"
|
||||
|
||||
FDecalLib DecalLibrary;
|
||||
|
||||
|
@ -113,7 +113,7 @@ struct DDecalThinker : public DThinker
|
|||
HAS_OBJECT_POINTERS
|
||||
public:
|
||||
DDecalThinker (DBaseDecal *decal) : DThinker (STAT_DECALTHINKER), TheDecal (decal) {}
|
||||
void Serialize(FArchive &arc);
|
||||
void Serialize(FSerializer &arc);
|
||||
TObjPtr<DBaseDecal> TheDecal;
|
||||
protected:
|
||||
DDecalThinker () : DThinker (STAT_DECALTHINKER) {}
|
||||
|
@ -123,10 +123,10 @@ IMPLEMENT_POINTY_CLASS (DDecalThinker)
|
|||
DECLARE_POINTER (TheDecal)
|
||||
END_POINTERS
|
||||
|
||||
void DDecalThinker::Serialize(FArchive &arc)
|
||||
void DDecalThinker::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
arc << TheDecal;
|
||||
arc("thedecal", TheDecal);
|
||||
}
|
||||
|
||||
struct FDecalFaderAnim : public FDecalAnimator
|
||||
|
@ -143,7 +143,7 @@ class DDecalFader : public DDecalThinker
|
|||
DECLARE_CLASS (DDecalFader, DDecalThinker)
|
||||
public:
|
||||
DDecalFader (DBaseDecal *decal) : DDecalThinker (decal) {}
|
||||
void Serialize(FArchive &arc);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
int TimeToStartDecay;
|
||||
|
@ -168,7 +168,7 @@ class DDecalColorer : public DDecalThinker
|
|||
DECLARE_CLASS (DDecalColorer, DDecalThinker)
|
||||
public:
|
||||
DDecalColorer (DBaseDecal *decal) : DDecalThinker (decal) {}
|
||||
void Serialize(FArchive &arc);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
int TimeToStartDecay;
|
||||
|
@ -194,7 +194,7 @@ class DDecalStretcher : public DDecalThinker
|
|||
DECLARE_CLASS (DDecalStretcher, DDecalThinker)
|
||||
public:
|
||||
DDecalStretcher (DBaseDecal *decal) : DDecalThinker (decal) {}
|
||||
void Serialize(FArchive &arc);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
int TimeToStart;
|
||||
|
@ -225,7 +225,7 @@ class DDecalSlider : public DDecalThinker
|
|||
DECLARE_CLASS (DDecalSlider, DDecalThinker)
|
||||
public:
|
||||
DDecalSlider (DBaseDecal *decal) : DDecalThinker (decal) {}
|
||||
void Serialize(FArchive &arc);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
int TimeToStart;
|
||||
|
@ -1153,10 +1153,12 @@ FDecalAnimator::~FDecalAnimator ()
|
|||
|
||||
IMPLEMENT_CLASS (DDecalFader)
|
||||
|
||||
void DDecalFader::Serialize(FArchive &arc)
|
||||
void DDecalFader::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
arc << TimeToStartDecay << TimeToEndDecay << StartTrans;
|
||||
arc("starttime", TimeToStartDecay)
|
||||
("endtime", TimeToEndDecay)
|
||||
("starttrans", StartTrans);
|
||||
}
|
||||
|
||||
void DDecalFader::Tick ()
|
||||
|
@ -1200,18 +1202,18 @@ DThinker *FDecalFaderAnim::CreateThinker (DBaseDecal *actor, side_t *wall) const
|
|||
|
||||
IMPLEMENT_CLASS (DDecalStretcher)
|
||||
|
||||
void DDecalStretcher::Serialize(FArchive &arc)
|
||||
void DDecalStretcher::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
arc << TimeToStart
|
||||
<< TimeToStop
|
||||
<< GoalX
|
||||
<< StartX
|
||||
<< bStretchX
|
||||
<< GoalY
|
||||
<< StartY
|
||||
<< bStretchY
|
||||
<< bStarted;
|
||||
arc("starttime", TimeToStart)
|
||||
("endtime", TimeToStop)
|
||||
("goalx", GoalX)
|
||||
("startx", StartX)
|
||||
("stretchx", bStretchX)
|
||||
("goaly", GoalY)
|
||||
("starty", StartY)
|
||||
("stretchy", bStretchY)
|
||||
("started", bStarted);
|
||||
}
|
||||
|
||||
DThinker *FDecalStretcherAnim::CreateThinker (DBaseDecal *actor, side_t *wall) const
|
||||
|
@ -1288,16 +1290,14 @@ void DDecalStretcher::Tick ()
|
|||
|
||||
IMPLEMENT_CLASS (DDecalSlider)
|
||||
|
||||
void DDecalSlider::Serialize(FArchive &arc)
|
||||
void DDecalSlider::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
arc << TimeToStart
|
||||
<< TimeToStop
|
||||
/*<< DistX*/
|
||||
<< DistY
|
||||
/*<< StartX*/
|
||||
<< StartY
|
||||
<< bStarted;
|
||||
arc("starttime", TimeToStart)
|
||||
("endtime", TimeToStop)
|
||||
("disty", DistY)
|
||||
("starty", StartY)
|
||||
("started", bStarted);
|
||||
}
|
||||
|
||||
DThinker *FDecalSliderAnim::CreateThinker (DBaseDecal *actor, side_t *wall) const
|
||||
|
@ -1371,10 +1371,13 @@ FDecalAnimator *FDecalLib::FindAnimator (const char *name)
|
|||
|
||||
IMPLEMENT_CLASS (DDecalColorer)
|
||||
|
||||
void DDecalColorer::Serialize(FArchive &arc)
|
||||
void DDecalColorer::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
arc << TimeToStartDecay << TimeToEndDecay << StartColor << GoalColor;
|
||||
arc("starttime", TimeToStartDecay)
|
||||
("endtime", TimeToEndDecay)
|
||||
("startcolor", StartColor)
|
||||
("goalcolor", GoalColor);
|
||||
}
|
||||
|
||||
void DDecalColorer::Tick ()
|
||||
|
|
|
@ -294,13 +294,6 @@ inline FArchive &operator<< (FArchive &arc, T* &object)
|
|||
return arc.SerializeObject ((DObject*&)object, RUNTIME_TEMPLATE_CLASS(T));
|
||||
}
|
||||
|
||||
class FFont;
|
||||
FArchive &SerializeFFontPtr (FArchive &arc, FFont* &font);
|
||||
template<> inline FArchive &operator<< <FFont> (FArchive &arc, FFont* &font)
|
||||
{
|
||||
return SerializeFFontPtr (arc, font);
|
||||
}
|
||||
|
||||
struct FStrifeDialogueNode;
|
||||
struct FSwitchDef;
|
||||
struct FDoorAnimation;
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
#include "t_script.h"
|
||||
#include "i_system.h"
|
||||
#include "w_wad.h"
|
||||
#include "farchive.h"
|
||||
#include "serializer.h"
|
||||
|
||||
|
||||
//==========================================================================
|
||||
|
@ -81,10 +81,14 @@ END_POINTERS
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void DFsSection::Serialize(FArchive &ar)
|
||||
void DFsSection::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize(ar);
|
||||
ar << type << start_index << end_index << loop_index << next;
|
||||
Super::Serialize(arc);
|
||||
arc("type", type)
|
||||
("start_index", start_index)
|
||||
("end_index", end_index)
|
||||
("loop_index", loop_index)
|
||||
("next", next);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
#include "i_system.h"
|
||||
#include "doomerrors.h"
|
||||
#include "doomstat.h"
|
||||
#include "farchive.h"
|
||||
#include "serializer.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
@ -187,18 +187,23 @@ void DFsScript::Destroy()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void DFsScript::Serialize(FArchive &arc)
|
||||
void DFsScript::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize(arc);
|
||||
// don't save a reference to the global script
|
||||
if (parent == global_script) parent = NULL;
|
||||
if (parent == global_script) parent = nullptr;
|
||||
|
||||
arc << data << scriptnum << len << parent << trigger << lastiftrue;
|
||||
for(int i=0; i< SECTIONSLOTS; i++) arc << sections[i];
|
||||
for(int i=0; i< VARIABLESLOTS; i++) arc << variables[i];
|
||||
for(int i=0; i< MAXSCRIPTS; i++) arc << children[i];
|
||||
arc("data", data)
|
||||
("scriptnum", scriptnum)
|
||||
("len", len)
|
||||
("parent", parent)
|
||||
("trigger", trigger)
|
||||
("lastiftrue", lastiftrue)
|
||||
.Array("sections", sections, SECTIONSLOTS)
|
||||
.Array("variables", variables, VARIABLESLOTS)
|
||||
.Array("children", children, MAXSCRIPTS);
|
||||
|
||||
if (parent == NULL) parent = global_script;
|
||||
if (parent == nullptr) parent = global_script;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -338,12 +343,17 @@ void DRunningScript::Destroy()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void DRunningScript::Serialize(FArchive &arc)
|
||||
void DRunningScript::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize(arc);
|
||||
|
||||
arc << script << save_point << wait_type << wait_data << prev << next << trigger;
|
||||
for(int i=0; i< VARIABLESLOTS; i++) arc << variables[i];
|
||||
arc("script", script)
|
||||
("save_point", save_point)
|
||||
("wait_type", wait_type)
|
||||
("wait_data", wait_data)
|
||||
("prev", prev)
|
||||
("next", next)
|
||||
("trigger", trigger)
|
||||
.Array("variables", variables, VARIABLESLOTS);
|
||||
}
|
||||
|
||||
|
||||
|
@ -416,10 +426,13 @@ void DFraggleThinker::Destroy()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void DFraggleThinker::Serialize(FArchive &arc)
|
||||
void DFraggleThinker::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize(arc);
|
||||
arc << LevelScript << RunningScripts << SpawnedThings << nocheckposition;
|
||||
arc("levelscript", LevelScript)
|
||||
("runningscripts", RunningScripts)
|
||||
("spawnedthings", SpawnedThings)
|
||||
("nocheckposition", nocheckposition);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -189,7 +189,7 @@ public:
|
|||
|
||||
void GetValue(svalue_t &result);
|
||||
void SetValue(const svalue_t &newvalue);
|
||||
void Serialize(FArchive &ar);
|
||||
void Serialize(FSerializer &ar);
|
||||
};
|
||||
|
||||
//==========================================================================
|
||||
|
@ -238,7 +238,7 @@ public:
|
|||
next = NULL;
|
||||
}
|
||||
|
||||
void Serialize(FArchive &ar);
|
||||
void Serialize(FSerializer &ar);
|
||||
};
|
||||
|
||||
|
||||
|
@ -337,7 +337,7 @@ public:
|
|||
|
||||
DFsScript();
|
||||
void Destroy();
|
||||
void Serialize(FArchive &ar);
|
||||
void Serialize(FSerializer &ar);
|
||||
|
||||
DFsVariable *NewVariable(const char *name, int vtype);
|
||||
void NewFunction(const char *name, void (FParser::*handler)());
|
||||
|
@ -652,7 +652,7 @@ class DRunningScript : public DObject
|
|||
public:
|
||||
DRunningScript(AActor *trigger=NULL, DFsScript *owner = NULL, int index = 0) ;
|
||||
void Destroy();
|
||||
void Serialize(FArchive &arc);
|
||||
void Serialize(FSerializer &arc);
|
||||
|
||||
TObjPtr<DFsScript> script;
|
||||
|
||||
|
@ -689,7 +689,7 @@ public:
|
|||
void Destroy();
|
||||
|
||||
|
||||
void Serialize(FArchive & arc);
|
||||
void Serialize(FSerializer & arc);
|
||||
void Tick();
|
||||
size_t PropagateMark();
|
||||
size_t PointerSubstitution (DObject *old, DObject *notOld);
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
|
||||
#include "t_script.h"
|
||||
#include "a_pickups.h"
|
||||
#include "farchive.h"
|
||||
#include "serializer.h"
|
||||
|
||||
|
||||
//==========================================================================
|
||||
|
@ -306,10 +306,15 @@ void DFsVariable::SetValue(const svalue_t &newvalue)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void DFsVariable::Serialize(FArchive & ar)
|
||||
void DFsVariable::Serialize(FSerializer & ar)
|
||||
{
|
||||
Super::Serialize(ar);
|
||||
ar << Name << type << string << actor << value.i << next;
|
||||
ar("name", Name)
|
||||
("type", type)
|
||||
("string", string)
|
||||
("actor", actor)
|
||||
("value", value.i)
|
||||
("next", next);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -44,8 +44,9 @@
|
|||
#include "d_net.h"
|
||||
#include "colormatcher.h"
|
||||
#include "v_palette.h"
|
||||
#include "farchive.h"
|
||||
#include "serializer.h"
|
||||
#include "doomdata.h"
|
||||
#include "r_state.h"
|
||||
|
||||
static double DecalWidth, DecalLeft, DecalRight;
|
||||
static double SpreadZ;
|
||||
|
@ -58,7 +59,8 @@ static int ImpactCount;
|
|||
CVAR (Bool, cl_spreaddecals, true, CVAR_ARCHIVE)
|
||||
|
||||
IMPLEMENT_POINTY_CLASS (DBaseDecal)
|
||||
DECLARE_POINTER(WallNext)
|
||||
DECLARE_POINTER(WallPrev)
|
||||
DECLARE_POINTER(WallNext)
|
||||
END_POINTERS
|
||||
|
||||
IMPLEMENT_CLASS (DImpactDecal)
|
||||
|
@ -75,7 +77,7 @@ DBaseDecal::DBaseDecal ()
|
|||
DBaseDecal::DBaseDecal (double z)
|
||||
: DThinker(STAT_DECAL),
|
||||
WallNext(0), WallPrev(0), LeftDistance(0), Z(z), ScaleX(1.), ScaleY(1.), Alpha(1.),
|
||||
AlphaColor(0), Translation(0), RenderFlags(0)
|
||||
AlphaColor(0), Translation(0), RenderFlags(0), Side(nullptr), Sector(nullptr)
|
||||
{
|
||||
RenderStyle = STYLE_None;
|
||||
PicNum.SetInvalid();
|
||||
|
@ -83,8 +85,8 @@ DBaseDecal::DBaseDecal (double z)
|
|||
|
||||
DBaseDecal::DBaseDecal (int statnum, double z)
|
||||
: DThinker(statnum),
|
||||
WallNext(0), WallPrev(0), LeftDistance(0), Z(z), ScaleX(1.), ScaleY(1.), Alpha(1.),
|
||||
AlphaColor(0), Translation(0), RenderFlags(0)
|
||||
WallNext(nullptr), WallPrev(nullptr), LeftDistance(0), Z(z), ScaleX(1.), ScaleY(1.), Alpha(1.),
|
||||
AlphaColor(0), Translation(0), RenderFlags(0), Side(nullptr), Sector(nullptr)
|
||||
{
|
||||
RenderStyle = STYLE_None;
|
||||
PicNum.SetInvalid();
|
||||
|
@ -92,17 +94,17 @@ DBaseDecal::DBaseDecal (int statnum, double z)
|
|||
|
||||
DBaseDecal::DBaseDecal (const AActor *basis)
|
||||
: DThinker(STAT_DECAL),
|
||||
WallNext(0), WallPrev(0), LeftDistance(0), Z(basis->Z()), ScaleX(basis->Scale.X), ScaleY(basis->Scale.Y),
|
||||
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)
|
||||
RenderFlags(basis->renderflags), RenderStyle(basis->RenderStyle), Side(nullptr), Sector(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
DBaseDecal::DBaseDecal (const DBaseDecal *basis)
|
||||
: DThinker(STAT_DECAL),
|
||||
WallNext(0), WallPrev(0), LeftDistance(basis->LeftDistance), Z(basis->Z), ScaleX(basis->ScaleX),
|
||||
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)
|
||||
PicNum(basis->PicNum), RenderFlags(basis->RenderFlags), RenderStyle(basis->RenderStyle), Side(nullptr), Sector(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -114,64 +116,32 @@ void DBaseDecal::Destroy ()
|
|||
|
||||
void DBaseDecal::Remove ()
|
||||
{
|
||||
DBaseDecal **prev = WallPrev;
|
||||
DBaseDecal *next = WallNext;
|
||||
if (prev && (*prev = next))
|
||||
next->WallPrev = prev;
|
||||
if (WallPrev == nullptr) Side->AttachedDecals = WallNext;
|
||||
else WallPrev->WallNext = WallNext;
|
||||
|
||||
if (WallNext != nullptr) WallNext->WallPrev = WallPrev;
|
||||
|
||||
WallPrev = NULL;
|
||||
WallNext = NULL;
|
||||
}
|
||||
|
||||
void DBaseDecal::Serialize(FArchive &arc)
|
||||
void DBaseDecal::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
arc << LeftDistance
|
||||
<< Z
|
||||
<< ScaleX << ScaleY
|
||||
<< Alpha
|
||||
<< AlphaColor
|
||||
<< Translation
|
||||
<< PicNum
|
||||
<< RenderFlags
|
||||
<< RenderStyle
|
||||
<< Sector;
|
||||
}
|
||||
|
||||
void DBaseDecal::SerializeChain (FArchive &arc, DBaseDecal **first)
|
||||
{
|
||||
DWORD numInChain;
|
||||
DBaseDecal *fresh;
|
||||
DBaseDecal **firstptr = first;
|
||||
|
||||
if (arc.IsLoading ())
|
||||
{
|
||||
numInChain = arc.ReadCount ();
|
||||
|
||||
while (numInChain--)
|
||||
{
|
||||
arc << fresh;
|
||||
*firstptr = fresh;
|
||||
fresh->WallPrev = firstptr;
|
||||
firstptr = &fresh->WallNext;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
numInChain = 0;
|
||||
fresh = *firstptr;
|
||||
while (fresh != NULL)
|
||||
{
|
||||
fresh = fresh->WallNext;
|
||||
++numInChain;
|
||||
}
|
||||
arc.WriteCount (numInChain);
|
||||
fresh = *firstptr;
|
||||
while (numInChain--)
|
||||
{
|
||||
arc << fresh;
|
||||
fresh = fresh->WallNext;
|
||||
}
|
||||
}
|
||||
arc("wallprev", WallPrev)
|
||||
("wallnext", WallNext)
|
||||
("leftdistance", LeftDistance)
|
||||
("z", Z)
|
||||
("scalex", ScaleX)
|
||||
("scaley", ScaleY)
|
||||
("alpha", Alpha)
|
||||
("alphacolor", AlphaColor)
|
||||
("translation", Translation)
|
||||
("picnum", PicNum)
|
||||
("renderflags", RenderFlags)
|
||||
("renderstyle", RenderStyle)
|
||||
("side", Side)
|
||||
("sectpr", Sector);
|
||||
}
|
||||
|
||||
void DBaseDecal::GetXY (side_t *wall, double &ox, double &oy) const
|
||||
|
@ -211,26 +181,18 @@ void DBaseDecal::SetShade (int r, int g, int b)
|
|||
// Returns the texture the decal stuck to.
|
||||
FTextureID DBaseDecal::StickToWall (side_t *wall, double x, double y, F3DFloor *ffloor)
|
||||
{
|
||||
// Stick the decal at the end of the chain so it appears on top
|
||||
DBaseDecal *next, **prev;
|
||||
Side = wall;
|
||||
WallPrev = wall->AttachedDecals;
|
||||
|
||||
prev = &wall->AttachedDecals;
|
||||
while (*prev != NULL)
|
||||
while (WallPrev != nullptr && WallPrev->WallNext != nullptr)
|
||||
{
|
||||
next = *prev;
|
||||
prev = &next->WallNext;
|
||||
WallPrev = WallPrev->WallNext;
|
||||
}
|
||||
if (WallPrev != nullptr) WallPrev->WallNext = this;
|
||||
else wall->AttachedDecals = this;
|
||||
WallNext = nullptr;
|
||||
|
||||
|
||||
*prev = this;
|
||||
WallNext = NULL;
|
||||
WallPrev = prev;
|
||||
/*
|
||||
WallNext = wall->AttachedDecals;
|
||||
WallPrev = &wall->AttachedDecals;
|
||||
if (WallNext)
|
||||
WallNext->WallPrev = &WallNext;
|
||||
wall->AttachedDecals = this;
|
||||
*/
|
||||
sector_t *front, *back;
|
||||
line_t *line;
|
||||
FTextureID tex;
|
||||
|
@ -592,28 +554,6 @@ CUSTOM_CVAR (Int, cl_maxdecals, 1024, CVAR_ARCHIVE)
|
|||
}
|
||||
}
|
||||
|
||||
// Uses: target points to previous impact decal
|
||||
// tracer points to next impact decal
|
||||
//
|
||||
// Note that this means we can't simply serialize an impact decal as-is
|
||||
// because doing so when many are present in a level could result in
|
||||
// a lot of recursion and we would run out of stack. Not nice. So instead,
|
||||
// the save game code calls DImpactDecal::SerializeAll to serialize a
|
||||
// list of impact decals.
|
||||
|
||||
void DImpactDecal::SerializeTime (FArchive &arc)
|
||||
{
|
||||
if (arc.IsLoading ())
|
||||
{
|
||||
ImpactCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void DImpactDecal::Serialize(FArchive &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
}
|
||||
|
||||
DImpactDecal::DImpactDecal ()
|
||||
: DBaseDecal (STAT_AUTODECAL, 0.)
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
DBaseDecal (const AActor *actor);
|
||||
DBaseDecal (const DBaseDecal *basis);
|
||||
|
||||
void Serialize(FArchive &arc);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Destroy ();
|
||||
FTextureID StickToWall(side_t *wall, double x, double y, F3DFloor * ffloor);
|
||||
double GetRealZ (const side_t *wall) const;
|
||||
|
@ -33,9 +33,7 @@ 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;
|
||||
|
||||
static void SerializeChain (FArchive &arc, DBaseDecal **firstptr);
|
||||
|
||||
DBaseDecal *WallNext, **WallPrev;
|
||||
DBaseDecal *WallNext, *WallPrev;
|
||||
|
||||
double LeftDistance;
|
||||
double Z;
|
||||
|
@ -46,7 +44,8 @@ public:
|
|||
FTextureID PicNum;
|
||||
DWORD RenderFlags;
|
||||
FRenderStyle RenderStyle;
|
||||
sector_t * Sector; // required for 3D floors
|
||||
side_t *Side;
|
||||
sector_t *Sector;
|
||||
|
||||
protected:
|
||||
virtual DBaseDecal *CloneSelf(const FDecalTemplate *tpl, double x, double y, double z, side_t *wall, F3DFloor * ffloor) const;
|
||||
|
@ -70,9 +69,6 @@ public:
|
|||
void BeginPlay ();
|
||||
void Destroy ();
|
||||
|
||||
void Serialize(FArchive &arc);
|
||||
static void SerializeTime (FArchive &arc);
|
||||
|
||||
protected:
|
||||
DBaseDecal *CloneSelf(const FDecalTemplate *tpl, double x, double y, double z, side_t *wall, F3DFloor * ffloor) const;
|
||||
static void CheckMax ();
|
||||
|
|
|
@ -185,7 +185,7 @@ void DHUDMessage::Serialize(FArchive &arc)
|
|||
Super::Serialize(arc);
|
||||
arc << Left << Top << CenterX << HoldTics
|
||||
<< Tics << State << TextColor
|
||||
<< SBarID << SourceText << Font << Next
|
||||
//<< SBarID << SourceText << Font << Next
|
||||
<< HUDWidth << HUDHeight
|
||||
<< NoWrap
|
||||
<< ClipX << ClipY << ClipWidth << ClipHeight
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#include "d_net.h"
|
||||
#include "d_dehacked.h"
|
||||
#include "gi.h"
|
||||
#include "farchive.h"
|
||||
#include "serializer.h"
|
||||
#include "r_utility.h"
|
||||
#include "a_morph.h"
|
||||
|
||||
|
@ -1026,10 +1026,10 @@ public:
|
|||
}
|
||||
// You'll probably never be able to catch this in a save game, but
|
||||
// just in case, add a proper serializer.
|
||||
void Serialize(FArchive &arc)
|
||||
void Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize(arc);
|
||||
arc << Pawn;
|
||||
arc("pawn", Pawn);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
280
src/p_acs.cpp
280
src/p_acs.cpp
|
@ -75,6 +75,7 @@
|
|||
#include "po_man.h"
|
||||
#include "actorptrselect.h"
|
||||
#include "farchive.h"
|
||||
#include "serializer.h"
|
||||
#include "decallib.h"
|
||||
#include "p_terrain.h"
|
||||
#include "version.h"
|
||||
|
@ -82,6 +83,7 @@
|
|||
#include "r_utility.h"
|
||||
#include "a_morph.h"
|
||||
#include "i_music.h"
|
||||
#include "serializer.h"
|
||||
|
||||
#include "g_shared/a_pickups.h"
|
||||
|
||||
|
@ -1367,11 +1369,12 @@ public:
|
|||
int tag, int height, int special,
|
||||
int arg0, int arg1, int arg2, int arg3, int arg4);
|
||||
void Tick ();
|
||||
void Serialize(FArchive &arc);
|
||||
void Serialize(FSerializer &arc);
|
||||
private:
|
||||
sector_t *Sector;
|
||||
double WatchD, LastD;
|
||||
int Special, Arg0, Arg1, Arg2, Arg3, Arg4;
|
||||
int Special;
|
||||
int Args[5];
|
||||
TObjPtr<AActor> Activator;
|
||||
line_t *Line;
|
||||
bool LineSide;
|
||||
|
@ -1387,11 +1390,16 @@ END_POINTERS
|
|||
DPlaneWatcher::DPlaneWatcher (AActor *it, line_t *line, int lineSide, bool ceiling,
|
||||
int tag, int height, int special,
|
||||
int arg0, int arg1, int arg2, int arg3, int arg4)
|
||||
: Special (special), Arg0 (arg0), Arg1 (arg1), Arg2 (arg2), Arg3 (arg3), Arg4 (arg4),
|
||||
: Special (special),
|
||||
Activator (it), Line (line), LineSide (!!lineSide), bCeiling (ceiling)
|
||||
{
|
||||
int secnum;
|
||||
|
||||
Args[0] = arg0;
|
||||
Args[1] = arg1;
|
||||
Args[2] = arg2;
|
||||
Args[3] = arg3;
|
||||
Args[4] = arg4;
|
||||
secnum = P_FindFirstSectorFromTag (tag);
|
||||
if (secnum >= 0)
|
||||
{
|
||||
|
@ -1417,13 +1425,19 @@ DPlaneWatcher::DPlaneWatcher (AActor *it, line_t *line, int lineSide, bool ceili
|
|||
}
|
||||
}
|
||||
|
||||
void DPlaneWatcher::Serialize(FArchive &arc)
|
||||
void DPlaneWatcher::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
arc("special", Special)
|
||||
.Args("args", Args, nullptr, Special)
|
||||
("sector", Sector)
|
||||
("ceiling", bCeiling)
|
||||
("watchd", WatchD)
|
||||
("lastd", LastD)
|
||||
("activator", Activator)
|
||||
("line", Line)
|
||||
("lineside", LineSide);
|
||||
|
||||
arc << Special << Arg0 << Arg1 << Arg2 << Arg3 << Arg4
|
||||
<< Sector << bCeiling << WatchD << LastD << Activator
|
||||
<< Line << LineSide << bCeiling;
|
||||
}
|
||||
|
||||
void DPlaneWatcher::Tick ()
|
||||
|
@ -1448,7 +1462,7 @@ void DPlaneWatcher::Tick ()
|
|||
if ((LastD < WatchD && newd >= WatchD) ||
|
||||
(LastD > WatchD && newd <= WatchD))
|
||||
{
|
||||
P_ExecuteSpecial(Special, Line, Activator, LineSide, Arg0, Arg1, Arg2, Arg3, Arg4);
|
||||
P_ExecuteSpecial(Special, Line, Activator, LineSide, Args[0], Args[1], Args[2], Args[3], Args[4]);
|
||||
Destroy ();
|
||||
}
|
||||
|
||||
|
@ -2868,33 +2882,6 @@ void FBehavior::StaticStopMyScripts (AActor *actor)
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// P_SerializeACSScriptNumber
|
||||
//
|
||||
// Serializes a script number. If it's negative, it's really a name, so
|
||||
// that will get serialized after it.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void P_SerializeACSScriptNumber(FArchive &arc, int &scriptnum, bool was2byte)
|
||||
{
|
||||
arc << scriptnum;
|
||||
// If the script number is negative, then it's really a name.
|
||||
// So read/store the name after it.
|
||||
if (scriptnum < 0)
|
||||
{
|
||||
if (arc.IsStoring())
|
||||
{
|
||||
arc.WriteName(FName(ENamedName(-scriptnum)).GetChars());
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *nam = arc.ReadName();
|
||||
scriptnum = -FName(nam);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---- The ACS Interpreter ----//
|
||||
|
||||
|
@ -2927,81 +2914,63 @@ DACSThinker::~DACSThinker ()
|
|||
ActiveThinker = NULL;
|
||||
}
|
||||
|
||||
void DACSThinker::Serialize(FArchive &arc)
|
||||
//==========================================================================
|
||||
//
|
||||
// helper class for the runningscripts serializer
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
struct SavingRunningscript
|
||||
{
|
||||
int scriptnum;
|
||||
int scriptcount = 0;
|
||||
DLevelScript *lscript;
|
||||
};
|
||||
|
||||
Super::Serialize (arc);
|
||||
if (arc.IsStoring())
|
||||
FSerializer &Serialize(FSerializer &arc, const char *key, SavingRunningscript &rs, SavingRunningscript *def)
|
||||
{
|
||||
if (arc.BeginObject(key))
|
||||
{
|
||||
DLevelScript *script;
|
||||
script = Scripts;
|
||||
while (script)
|
||||
{
|
||||
scriptcount++;
|
||||
|
||||
// We want to store this list backwards, so we can't loose the last pointer
|
||||
if (script->next == NULL)
|
||||
break;
|
||||
script = script->next;
|
||||
}
|
||||
arc << scriptcount;
|
||||
|
||||
while (script)
|
||||
{
|
||||
arc << script;
|
||||
script = script->prev;
|
||||
}
|
||||
arc.ScriptNum("num", rs.scriptnum)
|
||||
("script", rs.lscript)
|
||||
.EndObject();
|
||||
}
|
||||
else
|
||||
return arc;
|
||||
}
|
||||
|
||||
void DACSThinker::Serialize(FSerializer &arc)
|
||||
{
|
||||
arc("scripts", Scripts);
|
||||
|
||||
if (arc.isWriting())
|
||||
{
|
||||
// We are running through this list backwards, so the next entry is the last processed
|
||||
DLevelScript *next = NULL;
|
||||
arc << scriptcount;
|
||||
Scripts = NULL;
|
||||
LastScript = NULL;
|
||||
for (int i = 0; i < scriptcount; i++)
|
||||
if (RunningScripts.CountUsed())
|
||||
{
|
||||
arc << Scripts;
|
||||
ScriptMap::Iterator it(RunningScripts);
|
||||
ScriptMap::Pair *pair;
|
||||
|
||||
Scripts->next = next;
|
||||
Scripts->prev = NULL;
|
||||
if (next != NULL)
|
||||
next->prev = Scripts;
|
||||
|
||||
next = Scripts;
|
||||
|
||||
if (i == 0)
|
||||
LastScript = Scripts;
|
||||
arc.BeginArray("runningscripts");
|
||||
while (it.NextPair(pair))
|
||||
{
|
||||
assert(pair->Value != nullptr);
|
||||
SavingRunningscript srs = { pair->Key, pair->Value };
|
||||
arc(nullptr, srs);
|
||||
}
|
||||
arc.EndArray();
|
||||
}
|
||||
}
|
||||
if (arc.IsStoring ())
|
||||
{
|
||||
ScriptMap::Iterator it(RunningScripts);
|
||||
ScriptMap::Pair *pair;
|
||||
|
||||
while (it.NextPair(pair))
|
||||
{
|
||||
assert(pair->Value != NULL);
|
||||
arc << pair->Value;
|
||||
scriptnum = pair->Key;
|
||||
P_SerializeACSScriptNumber(arc, scriptnum, true);
|
||||
}
|
||||
DLevelScript *nilptr = NULL;
|
||||
arc << nilptr;
|
||||
}
|
||||
else // Loading
|
||||
{
|
||||
DLevelScript *script = NULL;
|
||||
DLevelScript *script = nullptr;
|
||||
RunningScripts.Clear();
|
||||
|
||||
arc << script;
|
||||
while (script)
|
||||
if (arc.BeginArray("runniongscripts"))
|
||||
{
|
||||
P_SerializeACSScriptNumber(arc, scriptnum, true);
|
||||
RunningScripts[scriptnum] = script;
|
||||
arc << script;
|
||||
auto cnt = arc.ArraySize();
|
||||
for (int i = 0; i < cnt; i++)
|
||||
{
|
||||
SavingRunningscript srs;
|
||||
arc(nullptr, srs);
|
||||
RunningScripts[srs.scriptnum] = srs.lscript;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3048,58 +3017,74 @@ IMPLEMENT_POINTY_CLASS (DLevelScript)
|
|||
DECLARE_POINTER(activator)
|
||||
END_POINTERS
|
||||
|
||||
inline FArchive &operator<< (FArchive &arc, DLevelScript::EScriptState &state)
|
||||
//==========================================================================
|
||||
//
|
||||
// SerializeFFontPtr
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
template<> FSerializer &Serialize(FSerializer &arc, const char *key, FFont *&font, FFont **def)
|
||||
{
|
||||
BYTE val = (BYTE)state;
|
||||
arc << val;
|
||||
state = (DLevelScript::EScriptState)val;
|
||||
return arc;
|
||||
}
|
||||
|
||||
void DLevelScript::Serialize(FArchive &arc)
|
||||
{
|
||||
DWORD i;
|
||||
|
||||
Super::Serialize (arc);
|
||||
|
||||
P_SerializeACSScriptNumber(arc, script, false);
|
||||
|
||||
arc << state
|
||||
<< statedata
|
||||
<< activator
|
||||
<< activationline
|
||||
<< backSide
|
||||
<< numlocalvars;
|
||||
|
||||
if (arc.IsLoading())
|
||||
if (arc.isWriting())
|
||||
{
|
||||
localvars = new SDWORD[numlocalvars];
|
||||
}
|
||||
for (i = 0; i < (DWORD)numlocalvars; i++)
|
||||
{
|
||||
arc << localvars[i];
|
||||
}
|
||||
|
||||
if (arc.IsStoring ())
|
||||
{
|
||||
WORD lib = activeBehavior->GetLibraryID() >> LIBRARYID_SHIFT;
|
||||
arc << lib;
|
||||
i = activeBehavior->PC2Ofs (pc);
|
||||
arc << i;
|
||||
const char *n = font->GetName();
|
||||
return arc.StringPtr(key, n);
|
||||
}
|
||||
else
|
||||
{
|
||||
WORD lib;
|
||||
arc << lib << i;
|
||||
activeBehavior = FBehavior::StaticGetModule (lib);
|
||||
pc = activeBehavior->Ofs2PC (i);
|
||||
const char *n;
|
||||
arc.StringPtr(key, n);
|
||||
font = V_GetFont(n);
|
||||
if (font == NULL)
|
||||
{
|
||||
Printf("Could not load font %s\n", n);
|
||||
font = SmallFont;
|
||||
}
|
||||
return arc;
|
||||
}
|
||||
|
||||
arc << activefont
|
||||
<< hudwidth << hudheight;
|
||||
arc << ClipRectLeft << ClipRectTop << ClipRectWidth << ClipRectHeight
|
||||
<< WrapWidth;
|
||||
arc << InModuleScriptNumber;
|
||||
}
|
||||
|
||||
|
||||
void DLevelScript::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize(arc);
|
||||
|
||||
uint32_t pcofs;
|
||||
uint16_t lib;
|
||||
|
||||
if (arc.isWriting())
|
||||
{
|
||||
lib = activeBehavior->GetLibraryID() >> LIBRARYID_SHIFT;
|
||||
pcofs = activeBehavior->PC2Ofs(pc);
|
||||
}
|
||||
|
||||
arc.ScriptNum("scriptnum", script)
|
||||
("next", next)
|
||||
("prev", prev)
|
||||
.Enum("state", state)
|
||||
("statedata", statedata)
|
||||
("activator", activator)
|
||||
("activationline", activationline)
|
||||
("backside", backSide)
|
||||
("localvars", Localvars)
|
||||
("lib", lib)
|
||||
("pc", pcofs)
|
||||
("activefont", activefont)
|
||||
("hudwidth", hudwidth)
|
||||
("hudheight", hudheight)
|
||||
("cliprectleft", ClipRectLeft)
|
||||
("cliprectop", ClipRectTop)
|
||||
("cliprectwidth", ClipRectWidth)
|
||||
("cliprectheight", ClipRectHeight)
|
||||
("wrapwidth", WrapWidth)
|
||||
("inmodulescriptnum", InModuleScriptNumber);
|
||||
|
||||
if (arc.isReading())
|
||||
{
|
||||
activeBehavior = FBehavior::StaticGetModule(lib);
|
||||
pc = activeBehavior->Ofs2PC(pcofs);
|
||||
}
|
||||
}
|
||||
|
||||
DLevelScript::DLevelScript ()
|
||||
|
@ -3108,14 +3093,10 @@ DLevelScript::DLevelScript ()
|
|||
if (DACSThinker::ActiveThinker == NULL)
|
||||
new DACSThinker;
|
||||
activefont = SmallFont;
|
||||
localvars = NULL;
|
||||
}
|
||||
|
||||
DLevelScript::~DLevelScript ()
|
||||
{
|
||||
if (localvars != NULL)
|
||||
delete[] localvars;
|
||||
localvars = NULL;
|
||||
}
|
||||
|
||||
void DLevelScript::Unlink ()
|
||||
|
@ -6140,7 +6121,7 @@ static bool CharArrayParms(int &capacity, int &offset, int &a, int *Stack, int &
|
|||
int DLevelScript::RunScript ()
|
||||
{
|
||||
DACSThinker *controller = DACSThinker::ActiveThinker;
|
||||
SDWORD *locals = localvars;
|
||||
SDWORD *locals = &Localvars[0];
|
||||
ACSLocalArrays noarrays;
|
||||
ACSLocalArrays *localarrays = &noarrays;
|
||||
ScriptFunction *activeFunction = NULL;
|
||||
|
@ -9676,12 +9657,11 @@ DLevelScript::DLevelScript (AActor *who, line_t *where, int num, const ScriptPtr
|
|||
|
||||
script = num;
|
||||
assert(code->VarCount >= code->ArgCount);
|
||||
numlocalvars = code->VarCount;
|
||||
localvars = new SDWORD[code->VarCount];
|
||||
memset(localvars, 0, code->VarCount * sizeof(SDWORD));
|
||||
Localvars.Resize(code->VarCount);
|
||||
memset(&Localvars[0], 0, code->VarCount * sizeof(SDWORD));
|
||||
for (int i = 0; i < MIN<int>(argcount, code->ArgCount); ++i)
|
||||
{
|
||||
localvars[i] = args[i];
|
||||
Localvars[i] = args[i];
|
||||
}
|
||||
pc = module->GetScriptAddress(code);
|
||||
InModuleScriptNumber = module->GetScriptIndex(code);
|
||||
|
|
13
src/p_acs.h
13
src/p_acs.h
|
@ -859,7 +859,7 @@ public:
|
|||
const int *args, int argcount, int flags);
|
||||
~DLevelScript ();
|
||||
|
||||
void Serialize(FArchive &arc);
|
||||
void Serialize(FSerializer &arc);
|
||||
int RunScript ();
|
||||
|
||||
inline void SetState (EScriptState newstate) { state = newstate; }
|
||||
|
@ -869,22 +869,21 @@ public:
|
|||
|
||||
void MarkLocalVarStrings() const
|
||||
{
|
||||
GlobalACSStrings.MarkStringArray(localvars, numlocalvars);
|
||||
GlobalACSStrings.MarkStringArray(&Localvars[0], Localvars.Size());
|
||||
}
|
||||
void LockLocalVarStrings() const
|
||||
{
|
||||
GlobalACSStrings.LockStringArray(localvars, numlocalvars);
|
||||
GlobalACSStrings.LockStringArray(&Localvars[0], Localvars.Size());
|
||||
}
|
||||
void UnlockLocalVarStrings() const
|
||||
{
|
||||
GlobalACSStrings.UnlockStringArray(localvars, numlocalvars);
|
||||
GlobalACSStrings.UnlockStringArray(&Localvars[0], Localvars.Size());
|
||||
}
|
||||
|
||||
protected:
|
||||
DLevelScript *next, *prev;
|
||||
int script;
|
||||
SDWORD *localvars;
|
||||
int numlocalvars;
|
||||
TArray<int32_t> Localvars;
|
||||
int *pc;
|
||||
EScriptState state;
|
||||
int statedata;
|
||||
|
@ -944,7 +943,7 @@ public:
|
|||
DACSThinker ();
|
||||
~DACSThinker ();
|
||||
|
||||
void Serialize(FArchive &arc);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
typedef TMap<int, DLevelScript *> ScriptMap;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <stdlib.h>
|
||||
#include "actor.h"
|
||||
#include "p_spec.h"
|
||||
#include "farchive.h"
|
||||
#include "serializer.h"
|
||||
#include "p_lnspec.h"
|
||||
#include "c_cvars.h"
|
||||
#include "p_maputl.h"
|
||||
|
@ -52,7 +52,7 @@ public:
|
|||
|
||||
DPusher ();
|
||||
DPusher (EPusher type, line_t *l, int magnitude, int angle, AActor *source, int affectee);
|
||||
void Serialize(FArchive &arc);
|
||||
void Serialize(FSerializer &arc);
|
||||
int CheckForSectorMatch (EPusher type, int tag);
|
||||
void ChangeValues (int magnitude, int angle)
|
||||
{
|
||||
|
@ -83,23 +83,15 @@ DPusher::DPusher ()
|
|||
{
|
||||
}
|
||||
|
||||
inline FArchive &operator<< (FArchive &arc, DPusher::EPusher &type)
|
||||
{
|
||||
BYTE val = (BYTE)type;
|
||||
arc << val;
|
||||
type = (DPusher::EPusher)val;
|
||||
return arc;
|
||||
}
|
||||
|
||||
void DPusher::Serialize(FArchive &arc)
|
||||
void DPusher::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
arc << m_Type
|
||||
<< m_Source
|
||||
<< m_PushVec
|
||||
<< m_Magnitude
|
||||
<< m_Radius
|
||||
<< m_Affectee;
|
||||
arc.Enum("type", m_Type)
|
||||
("source", m_Source)
|
||||
("pushvec", m_PushVec)
|
||||
("magnitude", m_Magnitude)
|
||||
("radius", m_Radius)
|
||||
("affectee", m_Affectee);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -358,7 +358,7 @@ static void SpawnExtraPlayers ()
|
|||
void P_SerializeThinkers (FArchive &arc, bool hubLoad)
|
||||
{
|
||||
arc.EnableThinkers();
|
||||
DImpactDecal::SerializeTime (arc);
|
||||
//DImpactDecal::Im ::SerializeTime (arc);
|
||||
DThinker::SerializeAll (arc, hubLoad);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <stdlib.h>
|
||||
#include "actor.h"
|
||||
#include "p_spec.h"
|
||||
#include "farchive.h"
|
||||
#include "serializer.h"
|
||||
#include "p_lnspec.h"
|
||||
#include "r_data/r_interpolate.h"
|
||||
|
||||
|
@ -46,7 +46,7 @@ public:
|
|||
DScroller (double dx, double dy, const line_t *l, int control, int accel, EScrollPos scrollpos = EScrollPos::scw_all);
|
||||
void Destroy();
|
||||
|
||||
void Serialize(FArchive &arc);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
bool AffectsWall (int wallnum) const { return m_Type == EScroll::sc_side && m_Affectee == wallnum; }
|
||||
|
@ -87,22 +87,6 @@ END_POINTERS
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
inline FArchive &operator<< (FArchive &arc, EScroll &type)
|
||||
{
|
||||
BYTE val = (BYTE)type;
|
||||
arc << val;
|
||||
type = (EScroll)val;
|
||||
return arc;
|
||||
}
|
||||
|
||||
inline FArchive &operator<< (FArchive &arc, EScrollPos &type)
|
||||
{
|
||||
int val = (int)type;
|
||||
arc << val;
|
||||
type = (EScrollPos)val;
|
||||
return arc;
|
||||
}
|
||||
|
||||
EScrollPos operator &(EScrollPos one, EScrollPos two)
|
||||
{
|
||||
return EScrollPos(int(one) & int(two));
|
||||
|
@ -114,20 +98,20 @@ EScrollPos operator &(EScrollPos one, EScrollPos two)
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void DScroller::Serialize(FArchive &arc)
|
||||
void DScroller::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
arc << m_Type
|
||||
<< m_dx << m_dy
|
||||
<< m_Affectee
|
||||
<< m_Control
|
||||
<< m_LastHeight
|
||||
<< m_vdx << m_vdy
|
||||
<< m_Accel
|
||||
<< m_Parts
|
||||
<< m_Interpolations[0]
|
||||
<< m_Interpolations[1]
|
||||
<< m_Interpolations[2];
|
||||
arc.Enum("type", m_Type)
|
||||
("dx", m_dx)
|
||||
("dy", m_dy)
|
||||
("affectee", m_Affectee)
|
||||
("control", m_Control)
|
||||
("lastheight", m_LastHeight)
|
||||
("vdx", m_vdx)
|
||||
("vdy", m_vdy)
|
||||
("accel", m_Accel)
|
||||
.Enum("parts", m_Parts)
|
||||
.Array("interpolations", m_Interpolations, 3);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
#include "g_level.h"
|
||||
#include "v_font.h"
|
||||
#include "a_sharedglobal.h"
|
||||
#include "farchive.h"
|
||||
#include "serializer.h"
|
||||
#include "a_keys.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "r_sky.h"
|
||||
|
@ -648,7 +648,7 @@ class DLightTransfer : public DThinker
|
|||
DLightTransfer() {}
|
||||
public:
|
||||
DLightTransfer (sector_t *srcSec, int target, bool copyFloor);
|
||||
void Serialize(FArchive &arc);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
protected:
|
||||
|
@ -662,11 +662,13 @@ protected:
|
|||
|
||||
IMPLEMENT_CLASS (DLightTransfer)
|
||||
|
||||
void DLightTransfer::Serialize(FArchive &arc)
|
||||
void DLightTransfer::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
arc << LastLight;
|
||||
arc << Source << TargetTag << CopyFloor;
|
||||
arc("lastlight", LastLight)
|
||||
("source", Source)
|
||||
("targettag", TargetTag)
|
||||
("copyfloor", CopyFloor);
|
||||
}
|
||||
|
||||
DLightTransfer::DLightTransfer (sector_t *srcSec, int target, bool copyFloor)
|
||||
|
@ -736,7 +738,7 @@ class DWallLightTransfer : public DThinker
|
|||
DWallLightTransfer() {}
|
||||
public:
|
||||
DWallLightTransfer (sector_t *srcSec, int target, BYTE flags);
|
||||
void Serialize(FArchive &arc);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
protected:
|
||||
|
@ -750,11 +752,13 @@ protected:
|
|||
|
||||
IMPLEMENT_CLASS (DWallLightTransfer)
|
||||
|
||||
void DWallLightTransfer::Serialize(FArchive &arc)
|
||||
void DWallLightTransfer::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
arc << LastLight;
|
||||
arc << Source << TargetID << Flags;
|
||||
arc("lastlight", LastLight)
|
||||
("source", Source)
|
||||
("targetid", TargetID)
|
||||
("flags", Flags);
|
||||
}
|
||||
|
||||
DWallLightTransfer::DWallLightTransfer (sector_t *srcSec, int target, BYTE flags)
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "w_wad.h"
|
||||
#include "tarray.h"
|
||||
#include "cmdlib.h"
|
||||
#include "farchive.h"
|
||||
#include "serializer.h"
|
||||
#include "p_maputl.h"
|
||||
#include "p_spec.h"
|
||||
|
||||
|
@ -61,7 +61,7 @@ public:
|
|||
DActiveButton ();
|
||||
DActiveButton (side_t *, int, FSwitchDef *, const DVector2 &pos, bool flippable);
|
||||
|
||||
void Serialize(FArchive &arc);
|
||||
void Serialize(FSerializer &arc);
|
||||
void Tick ();
|
||||
|
||||
side_t *m_Side;
|
||||
|
@ -348,16 +348,45 @@ DActiveButton::DActiveButton (side_t *side, int Where, FSwitchDef *Switch,
|
|||
AdvanceFrame ();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// operator<<
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
template<> FSerializer &Serialize (FSerializer &arc, const char *key, FSwitchDef* &Switch, FSwitchDef **def)
|
||||
{
|
||||
if (arc.isWriting())
|
||||
{
|
||||
Serialize(arc, key, Switch->PreTexture, nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
FTextureID tex;
|
||||
tex.SetInvalid();
|
||||
Serialize(arc, key, tex, nullptr);
|
||||
Switch = TexMan.FindSwitch(tex);
|
||||
}
|
||||
return arc;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void DActiveButton::Serialize(FArchive &arc)
|
||||
void DActiveButton::Serialize(FSerializer &arc)
|
||||
{
|
||||
Super::Serialize (arc);
|
||||
arc << m_Side << m_Part << m_SwitchDef << m_Frame << m_Timer << bFlippable << m_Pos << bReturning;
|
||||
arc("side", m_Side)
|
||||
("part", m_Part)
|
||||
("switchdef", m_SwitchDef)
|
||||
("frame", m_Frame)
|
||||
("timer", m_Timer)
|
||||
("fippable", bFlippable)
|
||||
("pos", m_Pos)
|
||||
("returning", bReturning);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -407,6 +407,49 @@ FSerializer &FSerializer::Args(const char *key, int *args, int *defargs, int spe
|
|||
return *this;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// Special handler for script numbers
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FSerializer &FSerializer::ScriptNum(const char *key, int &num)
|
||||
{
|
||||
if (isWriting())
|
||||
{
|
||||
WriteKey(key);
|
||||
if (num < 0)
|
||||
{
|
||||
w->mWriter.String(FName(ENamedName(-num)).GetChars());
|
||||
}
|
||||
else
|
||||
{
|
||||
w->mWriter.Int(num);
|
||||
}
|
||||
w->mWriter.EndArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
auto val = r->FindKey(key);
|
||||
if (val != nullptr)
|
||||
{
|
||||
if (val->IsInt())
|
||||
{
|
||||
num = val->GetInt();
|
||||
}
|
||||
else if (val->IsString())
|
||||
{
|
||||
num = -FName(val->GetString());
|
||||
}
|
||||
else
|
||||
{
|
||||
I_Error("Integer expected for '%s'", key);
|
||||
}
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
@ -1047,7 +1090,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FSoundID &sid, FSoundI
|
|||
{
|
||||
if (arc.isWriting())
|
||||
{
|
||||
if (arc.w->inObject() && def != nullptr && sid != *def)
|
||||
if (!arc.w->inObject() || def == nullptr || sid != *def)
|
||||
{
|
||||
arc.WriteKey(key);
|
||||
const char *sn = (const char*)sid;
|
||||
|
@ -1088,7 +1131,7 @@ template<> FSerializer &Serialize(FSerializer &arc, const char *key, PClassActor
|
|||
{
|
||||
if (arc.isWriting())
|
||||
{
|
||||
if (arc.w->inObject() && def != nullptr && clst != *def)
|
||||
if (!arc.w->inObject() || def == nullptr || clst != *def)
|
||||
{
|
||||
arc.WriteKey(key);
|
||||
arc.w->mWriter.String(clst->TypeName.GetChars());
|
||||
|
@ -1123,7 +1166,7 @@ template<> FSerializer &Serialize(FSerializer &arc, const char *key, FState *&st
|
|||
{
|
||||
if (arc.isWriting())
|
||||
{
|
||||
if (arc.w->inObject() && def != nullptr && state != *def)
|
||||
if (!arc.w->inObject() || def == nullptr || state != *def)
|
||||
{
|
||||
arc.WriteKey(key);
|
||||
if (state == nullptr)
|
||||
|
@ -1192,7 +1235,7 @@ template<> FSerializer &Serialize(FSerializer &arc, const char *key, FStrifeDial
|
|||
{
|
||||
if (arc.isWriting())
|
||||
{
|
||||
if (arc.w->inObject() && def != nullptr && node != *def)
|
||||
if (!arc.w->inObject() || def == nullptr || node != *def)
|
||||
{
|
||||
arc.WriteKey(key);
|
||||
if (node == nullptr)
|
||||
|
@ -1245,7 +1288,7 @@ template<> FSerializer &Serialize(FSerializer &arc, const char *key, FString *&p
|
|||
{
|
||||
if (arc.isWriting())
|
||||
{
|
||||
if (arc.w->inObject() && def != nullptr && pstr != *def)
|
||||
if (!arc.w->inObject() || def == nullptr || pstr != *def)
|
||||
{
|
||||
arc.WriteKey(key);
|
||||
if (pstr == nullptr)
|
||||
|
@ -1281,3 +1324,86 @@ template<> FSerializer &Serialize(FSerializer &arc, const char *key, FString *&p
|
|||
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FSerializer &Serialize(FSerializer &arc, const char *key, FString &pstr, FString *def)
|
||||
{
|
||||
if (arc.isWriting())
|
||||
{
|
||||
if (!arc.w->inObject() || def == nullptr || pstr.Compare(*def) != 0)
|
||||
{
|
||||
arc.WriteKey(key);
|
||||
arc.w->mWriter.String(pstr.GetChars());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
auto val = arc.r->FindKey(key);
|
||||
if (val != nullptr)
|
||||
{
|
||||
if (val->IsNull())
|
||||
{
|
||||
pstr = "";
|
||||
}
|
||||
else if (val->IsString())
|
||||
{
|
||||
pstr = val->GetString();
|
||||
}
|
||||
else
|
||||
{
|
||||
I_Error("string expected for '%s'", key);
|
||||
}
|
||||
}
|
||||
}
|
||||
return arc;
|
||||
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
template<> FSerializer &Serialize(FSerializer &arc, const char *key, char *&pstr, char **def)
|
||||
{
|
||||
if (arc.isWriting())
|
||||
{
|
||||
if (!arc.w->inObject() || def == nullptr || strcmp(pstr, *def))
|
||||
{
|
||||
arc.WriteKey(key);
|
||||
if (pstr == nullptr)
|
||||
{
|
||||
arc.w->mWriter.Null();
|
||||
}
|
||||
else
|
||||
{
|
||||
arc.w->mWriter.String(pstr);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
auto val = arc.r->FindKey(key);
|
||||
if (val != nullptr)
|
||||
{
|
||||
if (val->IsNull())
|
||||
{
|
||||
pstr = nullptr;
|
||||
}
|
||||
else if (val->IsString())
|
||||
{
|
||||
pstr = copystring(val->GetString());
|
||||
}
|
||||
else
|
||||
{
|
||||
I_Error("string expected for '%s'", key);
|
||||
}
|
||||
}
|
||||
}
|
||||
return arc;
|
||||
}
|
|
@ -44,7 +44,8 @@ public:
|
|||
FSerializer &Args(const char *key, int *args, int *defargs, int special);
|
||||
FSerializer &Terrain(const char *key, int &terrain, int *def = nullptr);
|
||||
FSerializer &Sprite(const char *key, int32_t &spritenum, int32_t *def);
|
||||
FSerializer &StringPtr(const char *key, const char *&charptr); // This only retrieves the address but creates no permanent copy of the string.
|
||||
FSerializer &StringPtr(const char *key, const char *&charptr); // This only retrieves the address but creates no permanent copy of the string unlike the regular char* serializer.
|
||||
FSerializer &ScriptNum(const char *key, int &num);
|
||||
bool isReading() const
|
||||
{
|
||||
return r != nullptr;
|
||||
|
@ -131,6 +132,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FTextureID &value, FTe
|
|||
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, FSoundID &sid, FSoundID *def);
|
||||
FSerializer &Serialize(FSerializer &arc, const char *key, FString &sid, FString *def);
|
||||
|
||||
template<class T>
|
||||
FSerializer &Serialize(FSerializer &arc, const char *key, T *&value, T **)
|
||||
|
@ -185,6 +187,7 @@ template<> FSerializer &Serialize(FSerializer &arc, const char *key, FState *&st
|
|||
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);
|
||||
template<> FSerializer &Serialize(FSerializer &arc, const char *key, char *&pstr, char **def);
|
||||
|
||||
|
||||
inline FSerializer &Serialize(FSerializer &arc, const char *key, DVector3 &p, DVector3 *def)
|
||||
|
|
|
@ -398,24 +398,3 @@ FSwitchDef *FTextureManager::FindSwitch (FTextureID texture)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// operator<<
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
template<> FArchive &operator<< (FArchive &arc, FSwitchDef* &Switch)
|
||||
{
|
||||
if (arc.IsStoring())
|
||||
{
|
||||
arc << Switch->PreTexture;
|
||||
}
|
||||
else
|
||||
{
|
||||
FTextureID tex;
|
||||
arc << tex;
|
||||
Switch = TexMan.FindSwitch(tex);
|
||||
}
|
||||
return arc;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,13 +82,6 @@ public:
|
|||
TT GetValue() const { return Value; }
|
||||
operator TT() const { return Value; }
|
||||
|
||||
// Serialize to FArchive
|
||||
FArchive& Serialize(FArchive& arc)
|
||||
{
|
||||
arc << Value;
|
||||
return arc;
|
||||
}
|
||||
|
||||
// Set the value of the flagset manually with an integer.
|
||||
// Please think twice before using this.
|
||||
static Self FromInt (TT value) { return Self (static_cast<T> (value)); }
|
||||
|
|
|
@ -340,33 +340,6 @@ FFont *V_GetFont(const char *name)
|
|||
}
|
||||
return font;
|
||||
}
|
||||
//==========================================================================
|
||||
//
|
||||
// SerializeFFontPtr
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FArchive &SerializeFFontPtr (FArchive &arc, FFont* &font)
|
||||
{
|
||||
if (arc.IsStoring ())
|
||||
{
|
||||
arc << font->Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *name = NULL;
|
||||
|
||||
arc << name;
|
||||
font = V_GetFont(name);
|
||||
if (font == NULL)
|
||||
{
|
||||
Printf ("Could not load font %s\n", name);
|
||||
font = SmallFont;
|
||||
}
|
||||
delete[] name;
|
||||
}
|
||||
return arc;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
|
|
@ -88,6 +88,7 @@ public:
|
|||
int GetDefaultKerning () const { return GlobalKerning; }
|
||||
virtual void LoadTranslations();
|
||||
void Preload() const;
|
||||
const char *GetName() const { return Name; }
|
||||
|
||||
static FFont *FindFont (const char *fontname);
|
||||
static void StaticPreloadFonts();
|
||||
|
@ -134,8 +135,6 @@ protected:
|
|||
|
||||
friend void V_ClearFonts();
|
||||
friend void V_RetranslateFonts();
|
||||
|
||||
friend FArchive &SerializeFFontPtr (FArchive &arc, FFont* &font);
|
||||
};
|
||||
|
||||
|
||||
|
|
219
src/zzz_old.cpp
219
src/zzz_old.cpp
|
@ -183,7 +183,7 @@ void P_SerializeWorldActors(FArchive &arc)
|
|||
{
|
||||
if (line->sidedef[s] != NULL)
|
||||
{
|
||||
DBaseDecal::SerializeChain(arc, &line->sidedef[s]->AttachedDecals);
|
||||
//DBaseDecal::SerializeChain(arc, &line->sidedef[s]->AttachedDecals);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -394,173 +394,6 @@ void AActor::Serialize(FArchive &arc)
|
|||
{
|
||||
Super::Serialize(arc);
|
||||
|
||||
if (arc.IsStoring())
|
||||
{
|
||||
arc.WriteSprite(sprite);
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite = arc.ReadSprite();
|
||||
}
|
||||
|
||||
arc << __Pos
|
||||
<< Angles.Yaw
|
||||
<< Angles.Pitch
|
||||
<< Angles.Roll
|
||||
<< frame
|
||||
<< Scale
|
||||
<< RenderStyle
|
||||
<< renderflags
|
||||
<< picnum
|
||||
<< floorpic
|
||||
<< ceilingpic
|
||||
<< TIDtoHate
|
||||
<< LastLookPlayerNumber
|
||||
<< LastLookActor
|
||||
<< effects
|
||||
<< Alpha
|
||||
<< fillcolor
|
||||
<< Sector
|
||||
<< floorz
|
||||
<< ceilingz
|
||||
<< dropoffz
|
||||
<< floorsector
|
||||
<< ceilingsector
|
||||
<< radius
|
||||
<< Height
|
||||
<< projectilepassheight
|
||||
<< Vel
|
||||
<< tics
|
||||
<< state
|
||||
<< DamageVal;
|
||||
if (DamageVal == 0x40000000 || DamageVal == -1)
|
||||
{
|
||||
DamageVal = -1;
|
||||
DamageFunc = GetDefault()->DamageFunc;
|
||||
}
|
||||
else
|
||||
{
|
||||
DamageFunc = nullptr;
|
||||
}
|
||||
P_SerializeTerrain(arc, floorterrain);
|
||||
arc << projectileKickback
|
||||
<< flags
|
||||
<< flags2
|
||||
<< flags3
|
||||
<< flags4
|
||||
<< flags5
|
||||
<< flags6
|
||||
<< flags7
|
||||
<< weaponspecial
|
||||
<< special1
|
||||
<< special2
|
||||
<< specialf1
|
||||
<< specialf2
|
||||
<< health
|
||||
<< movedir
|
||||
<< visdir
|
||||
<< movecount
|
||||
<< strafecount
|
||||
<< target
|
||||
<< lastenemy
|
||||
<< LastHeard
|
||||
<< reactiontime
|
||||
<< threshold
|
||||
<< player
|
||||
<< SpawnPoint
|
||||
<< SpawnAngle
|
||||
<< StartHealth
|
||||
<< skillrespawncount
|
||||
<< tracer
|
||||
<< Floorclip
|
||||
<< tid
|
||||
<< special;
|
||||
if (P_IsACSSpecial(special))
|
||||
{
|
||||
P_SerializeACSScriptNumber(arc, args[0], false);
|
||||
}
|
||||
else
|
||||
{
|
||||
arc << args[0];
|
||||
}
|
||||
arc << args[1] << args[2] << args[3] << args[4];
|
||||
arc << accuracy << stamina;
|
||||
arc << goal
|
||||
<< waterlevel
|
||||
<< MinMissileChance
|
||||
<< SpawnFlags
|
||||
<< Inventory
|
||||
<< InventoryID;
|
||||
arc << FloatBobPhase
|
||||
<< Translation
|
||||
<< SeeSound
|
||||
<< AttackSound
|
||||
<< PainSound
|
||||
<< DeathSound
|
||||
<< ActiveSound
|
||||
<< UseSound
|
||||
<< BounceSound
|
||||
<< WallBounceSound
|
||||
<< CrushPainSound
|
||||
<< Speed
|
||||
<< FloatSpeed
|
||||
<< Mass
|
||||
<< PainChance
|
||||
<< SpawnState
|
||||
<< SeeState
|
||||
<< MeleeState
|
||||
<< MissileState
|
||||
<< MaxDropOffHeight
|
||||
<< MaxStepHeight
|
||||
<< BounceFlags
|
||||
<< bouncefactor
|
||||
<< wallbouncefactor
|
||||
<< bouncecount
|
||||
<< maxtargetrange
|
||||
<< meleethreshold
|
||||
<< meleerange
|
||||
<< DamageType;
|
||||
arc << DamageTypeReceived;
|
||||
arc << PainType
|
||||
<< DeathType;
|
||||
arc << Gravity
|
||||
<< FastChaseStrafeCount
|
||||
<< master
|
||||
<< smokecounter
|
||||
<< BlockingMobj
|
||||
<< BlockingLine
|
||||
<< VisibleToTeam // [BB]
|
||||
<< pushfactor
|
||||
<< Species
|
||||
<< Score;
|
||||
arc << DesignatedTeam;
|
||||
arc << lastpush << lastbump
|
||||
<< PainThreshold
|
||||
<< DamageFactor;
|
||||
arc << DamageMultiply;
|
||||
arc << WeaveIndexXY << WeaveIndexZ
|
||||
<< PoisonDamageReceived << PoisonDurationReceived << PoisonPeriodReceived << Poisoner
|
||||
<< PoisonDamage << PoisonDuration << PoisonPeriod;
|
||||
arc << PoisonDamageType << PoisonDamageTypeReceived;
|
||||
arc << ConversationRoot << Conversation;
|
||||
arc << FriendPlayer;
|
||||
arc << TeleFogSourceType
|
||||
<< TeleFogDestType;
|
||||
arc << RipperLevel
|
||||
<< RipLevelMin
|
||||
<< RipLevelMax;
|
||||
arc << DefThreshold;
|
||||
if (SaveVersion >= 4549)
|
||||
{
|
||||
arc << SpriteAngle;
|
||||
arc << SpriteRotation;
|
||||
}
|
||||
|
||||
if (SaveVersion >= 4550)
|
||||
{
|
||||
arc << alternative;
|
||||
}
|
||||
|
||||
{
|
||||
FString tagstr;
|
||||
if (arc.IsStoring() && Tag != NULL && Tag->Len() > 0) tagstr = *Tag;
|
||||
|
@ -716,3 +549,53 @@ 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;
|
||||
// If the script number is negative, then it's really a name.
|
||||
// So read/store the name after it.
|
||||
if (scriptnum < 0)
|
||||
{
|
||||
if (arc.IsStoring())
|
||||
{
|
||||
arc.WriteName(FName(ENamedName(-scriptnum)).GetChars());
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *nam = arc.ReadName();
|
||||
scriptnum = -FName(nam);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue