mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
- a few more
This commit is contained in:
parent
7edf4c1afc
commit
a542e99143
7 changed files with 228 additions and 32 deletions
|
@ -1,7 +1,7 @@
|
||||||
#include "a_pickups.h"
|
#include "a_pickups.h"
|
||||||
#include "a_weaponpiece.h"
|
#include "a_weaponpiece.h"
|
||||||
#include "doomstat.h"
|
#include "doomstat.h"
|
||||||
#include "farchive.h"
|
#include "serializer.h"
|
||||||
|
|
||||||
IMPLEMENT_CLASS(PClassWeaponPiece)
|
IMPLEMENT_CLASS(PClassWeaponPiece)
|
||||||
IMPLEMENT_CLASS (AWeaponHolder)
|
IMPLEMENT_CLASS (AWeaponHolder)
|
||||||
|
@ -17,10 +17,11 @@ void PClassWeaponPiece::ReplaceClassRef(PClass *oldclass, PClass *newclass)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AWeaponHolder::Serialize(FArchive &arc)
|
void AWeaponHolder::Serialize(FSerializer &arc)
|
||||||
{
|
{
|
||||||
Super::Serialize(arc);
|
Super::Serialize(arc);
|
||||||
arc << PieceMask << PieceWeapon;
|
arc("piecemask", PieceMask)
|
||||||
|
("pieceweapon", PieceWeapon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,10 +30,13 @@ IMPLEMENT_POINTY_CLASS (AWeaponPiece)
|
||||||
END_POINTERS
|
END_POINTERS
|
||||||
|
|
||||||
|
|
||||||
void AWeaponPiece::Serialize(FArchive &arc)
|
void AWeaponPiece::Serialize(FSerializer &arc)
|
||||||
{
|
{
|
||||||
Super::Serialize (arc);
|
Super::Serialize (arc);
|
||||||
arc << WeaponClass << FullWeapon << PieceValue;
|
auto def = (AWeaponPiece*)GetDefault();
|
||||||
|
arc("weaponclass", WeaponClass, def->WeaponClass)
|
||||||
|
("fullweapon", FullWeapon)
|
||||||
|
("piecevalue", PieceValue, def->PieceValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -15,7 +15,8 @@ class AWeaponPiece : public AInventory
|
||||||
protected:
|
protected:
|
||||||
bool PrivateShouldStay ();
|
bool PrivateShouldStay ();
|
||||||
public:
|
public:
|
||||||
void Serialize(FArchive &arc);
|
DECLARE_OLD_SERIAL
|
||||||
|
void Serialize(FSerializer &arc);
|
||||||
bool TryPickup (AActor *&toucher);
|
bool TryPickup (AActor *&toucher);
|
||||||
bool TryPickupRestricted (AActor *&toucher);
|
bool TryPickupRestricted (AActor *&toucher);
|
||||||
bool ShouldStay ();
|
bool ShouldStay ();
|
||||||
|
@ -23,7 +24,7 @@ public:
|
||||||
virtual void PlayPickupSound (AActor *toucher);
|
virtual void PlayPickupSound (AActor *toucher);
|
||||||
|
|
||||||
int PieceValue;
|
int PieceValue;
|
||||||
PClassWeapon *WeaponClass;
|
PClassActor *WeaponClass;
|
||||||
TObjPtr<AWeapon> FullWeapon;
|
TObjPtr<AWeapon> FullWeapon;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -35,7 +36,8 @@ class AWeaponHolder : public AInventory
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int PieceMask;
|
int PieceMask;
|
||||||
const PClass * PieceWeapon;
|
PClassActor * PieceWeapon;
|
||||||
|
|
||||||
void Serialize(FArchive &arc);
|
DECLARE_OLD_SERIAL
|
||||||
|
void Serialize(FSerializer &arc);
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#include "p_local.h"
|
#include "p_local.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "po_man.h"
|
#include "po_man.h"
|
||||||
#include "farchive.h"
|
#include "serializer.h"
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
|
@ -66,7 +66,8 @@ public:
|
||||||
void UpdateInterpolation();
|
void UpdateInterpolation();
|
||||||
void Restore();
|
void Restore();
|
||||||
void Interpolate(double smoothratio);
|
void Interpolate(double smoothratio);
|
||||||
void Serialize(FArchive &arc);
|
DECLARE_OLD_SERIAL
|
||||||
|
virtual void Serialize(FSerializer &arc);
|
||||||
size_t PointerSubstitution (DObject *old, DObject *notOld);
|
size_t PointerSubstitution (DObject *old, DObject *notOld);
|
||||||
size_t PropagateMark();
|
size_t PropagateMark();
|
||||||
};
|
};
|
||||||
|
@ -94,7 +95,8 @@ public:
|
||||||
void UpdateInterpolation();
|
void UpdateInterpolation();
|
||||||
void Restore();
|
void Restore();
|
||||||
void Interpolate(double smoothratio);
|
void Interpolate(double smoothratio);
|
||||||
void Serialize(FArchive &arc);
|
DECLARE_OLD_SERIAL
|
||||||
|
virtual void Serialize(FSerializer &arc);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,7 +123,8 @@ public:
|
||||||
void UpdateInterpolation();
|
void UpdateInterpolation();
|
||||||
void Restore();
|
void Restore();
|
||||||
void Interpolate(double smoothratio);
|
void Interpolate(double smoothratio);
|
||||||
void Serialize(FArchive &arc);
|
DECLARE_OLD_SERIAL
|
||||||
|
virtual void Serialize(FSerializer &arc);
|
||||||
};
|
};
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -147,7 +150,8 @@ public:
|
||||||
void UpdateInterpolation();
|
void UpdateInterpolation();
|
||||||
void Restore();
|
void Restore();
|
||||||
void Interpolate(double smoothratio);
|
void Interpolate(double smoothratio);
|
||||||
void Serialize(FArchive &arc);
|
DECLARE_OLD_SERIAL
|
||||||
|
virtual void Serialize(FSerializer &arc);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -370,11 +374,11 @@ void DInterpolation::Destroy()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void DInterpolation::Serialize(FArchive &arc)
|
void DInterpolation::Serialize(FSerializer &arc)
|
||||||
{
|
{
|
||||||
Super::Serialize(arc);
|
Super::Serialize(arc);
|
||||||
arc << refcount;
|
arc("refcount", refcount);
|
||||||
if (arc.IsLoading())
|
if (arc.isReading())
|
||||||
{
|
{
|
||||||
interpolator.AddInterpolation(this);
|
interpolator.AddInterpolation(this);
|
||||||
}
|
}
|
||||||
|
@ -516,10 +520,14 @@ void DSectorPlaneInterpolation::Interpolate(double smoothratio)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void DSectorPlaneInterpolation::Serialize(FArchive &arc)
|
void DSectorPlaneInterpolation::Serialize(FSerializer &arc)
|
||||||
{
|
{
|
||||||
Super::Serialize(arc);
|
Super::Serialize(arc);
|
||||||
arc << sector << ceiling << oldheight << oldtexz << attached;
|
arc("sector", sector)
|
||||||
|
("ceiling", ceiling)
|
||||||
|
("oldheight", oldheight)
|
||||||
|
("oldtexz", oldtexz)
|
||||||
|
("attached", attached);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -648,10 +656,13 @@ void DSectorScrollInterpolation::Interpolate(double smoothratio)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void DSectorScrollInterpolation::Serialize(FArchive &arc)
|
void DSectorScrollInterpolation::Serialize(FSerializer &arc)
|
||||||
{
|
{
|
||||||
Super::Serialize(arc);
|
Super::Serialize(arc);
|
||||||
arc << sector << ceiling << oldx << oldy;
|
arc("sector", sector)
|
||||||
|
("ceiling", ceiling)
|
||||||
|
("oldx", oldx)
|
||||||
|
("oldy", oldy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -739,10 +750,13 @@ void DWallScrollInterpolation::Interpolate(double smoothratio)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void DWallScrollInterpolation::Serialize(FArchive &arc)
|
void DWallScrollInterpolation::Serialize(FSerializer &arc)
|
||||||
{
|
{
|
||||||
Super::Serialize(arc);
|
Super::Serialize(arc);
|
||||||
arc << side << part << oldx << oldy;
|
arc("side", side)
|
||||||
|
("part", part)
|
||||||
|
("oldx", oldx)
|
||||||
|
("oldy", oldy);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -855,15 +869,14 @@ void DPolyobjInterpolation::Interpolate(double smoothratio)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void DPolyobjInterpolation::Serialize(FArchive &arc)
|
void DPolyobjInterpolation::Serialize(FSerializer &arc)
|
||||||
{
|
{
|
||||||
Super::Serialize(arc);
|
Super::Serialize(arc);
|
||||||
int po = int(poly - polyobjs);
|
arc("poly", poly)
|
||||||
arc << po << oldverts;
|
("oldverts", oldverts)
|
||||||
poly = polyobjs + po;
|
("oldcx", oldcx)
|
||||||
|
("oldcy", oldcy);
|
||||||
arc << oldcx << oldcy;
|
if (arc.isReading()) bakverts.Resize(oldverts.Size());
|
||||||
if (arc.IsLoading()) bakverts.Resize(oldverts.Size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,8 @@ public:
|
||||||
virtual void UpdateInterpolation() = 0;
|
virtual void UpdateInterpolation() = 0;
|
||||||
virtual void Restore() = 0;
|
virtual void Restore() = 0;
|
||||||
virtual void Interpolate(double smoothratio) = 0;
|
virtual void Interpolate(double smoothratio) = 0;
|
||||||
virtual void Serialize(FArchive &arc);
|
DECLARE_OLD_SERIAL
|
||||||
|
virtual void Serialize(FSerializer &arc);
|
||||||
};
|
};
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
#define RAPIDJSON_HAS_CXX11_RANGE_FOR 1
|
#define RAPIDJSON_HAS_CXX11_RANGE_FOR 1
|
||||||
#define RAPIDJSON_PARSE_DEFAULT_FLAGS kParseFullPrecisionFlag
|
#define RAPIDJSON_PARSE_DEFAULT_FLAGS kParseFullPrecisionFlag
|
||||||
|
|
||||||
//#define PRETTY
|
#ifdef _DEBUG
|
||||||
|
#define PRETTY
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "rapidjson/rapidjson.h"
|
#include "rapidjson/rapidjson.h"
|
||||||
#include "rapidjson/writer.h"
|
#include "rapidjson/writer.h"
|
||||||
|
@ -26,6 +28,7 @@
|
||||||
#include "d_player.h"
|
#include "d_player.h"
|
||||||
#include "r_data/r_interpolate.h"
|
#include "r_data/r_interpolate.h"
|
||||||
#include "g_shared/a_sharedglobal.h"
|
#include "g_shared/a_sharedglobal.h"
|
||||||
|
#include "po_man.h"
|
||||||
|
|
||||||
char nulspace[1024 * 1024 * 4];
|
char nulspace[1024 * 1024 * 4];
|
||||||
|
|
||||||
|
@ -802,6 +805,11 @@ FSerializer &SerializePointer(FSerializer &arc, const char *key, T *&value, T **
|
||||||
return arc;
|
return arc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FSerializer &Serialize(FSerializer &arc, const char *key, FPolyObj *&value, FPolyObj **defval)
|
||||||
|
{
|
||||||
|
return SerializePointer(arc, key, value, defval, polyobjs);
|
||||||
|
}
|
||||||
|
|
||||||
FSerializer &Serialize(FSerializer &arc, const char *key, side_t *&value, side_t **defval)
|
FSerializer &Serialize(FSerializer &arc, const char *key, side_t *&value, side_t **defval)
|
||||||
{
|
{
|
||||||
return SerializePointer(arc, key, value, defval, sides);
|
return SerializePointer(arc, key, value, defval, sides);
|
||||||
|
|
|
@ -26,6 +26,10 @@ public:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
~FSerializer()
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
bool OpenWriter();
|
bool OpenWriter();
|
||||||
bool OpenReader(const char *buffer, size_t length);
|
bool OpenReader(const char *buffer, size_t length);
|
||||||
void Close();
|
void Close();
|
||||||
|
@ -114,6 +118,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, uint16_t &value, uint1
|
||||||
FSerializer &Serialize(FSerializer &arc, const char *key, double &value, double *defval);
|
FSerializer &Serialize(FSerializer &arc, const char *key, double &value, double *defval);
|
||||||
FSerializer &Serialize(FSerializer &arc, const char *key, float &value, float *defval);
|
FSerializer &Serialize(FSerializer &arc, const char *key, float &value, float *defval);
|
||||||
FSerializer &Serialize(FSerializer &arc, const char *key, side_t *&value, side_t **defval);
|
FSerializer &Serialize(FSerializer &arc, const char *key, side_t *&value, side_t **defval);
|
||||||
|
FSerializer &Serialize(FSerializer &arc, const char *key, FPolyObj *&value, FPolyObj **defval);
|
||||||
FSerializer &Serialize(FSerializer &arc, const char *key, sector_t *&value, sector_t **defval);
|
FSerializer &Serialize(FSerializer &arc, const char *key, sector_t *&value, sector_t **defval);
|
||||||
FSerializer &Serialize(FSerializer &arc, const char *key, player_t *&value, player_t **defval);
|
FSerializer &Serialize(FSerializer &arc, const char *key, player_t *&value, player_t **defval);
|
||||||
FSerializer &Serialize(FSerializer &arc, const char *key, line_t *&value, line_t **defval);
|
FSerializer &Serialize(FSerializer &arc, const char *key, line_t *&value, line_t **defval);
|
||||||
|
|
163
src/zzz_old.cpp
163
src/zzz_old.cpp
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "a_doomglobal.h"
|
#include "a_doomglobal.h"
|
||||||
#include "ravenshared.h"
|
#include "ravenshared.h"
|
||||||
|
#include "a_weaponpiece.h"
|
||||||
|
|
||||||
// For NULL states, which aren't owned by any actor, the owner
|
// For NULL states, which aren't owned by any actor, the owner
|
||||||
// is recorded as AActor with the following state. AActor should
|
// is recorded as AActor with the following state. AActor should
|
||||||
|
@ -874,6 +875,168 @@ void APuzzleItem::Serialize(FArchive &arc)
|
||||||
arc << PuzzleItemNumber;
|
arc << PuzzleItemNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class DSectorPlaneInterpolation : public DInterpolation
|
||||||
|
{
|
||||||
|
DECLARE_CLASS(DSectorPlaneInterpolation, DInterpolation)
|
||||||
|
|
||||||
|
sector_t *sector;
|
||||||
|
double oldheight, oldtexz;
|
||||||
|
double bakheight, baktexz;
|
||||||
|
bool ceiling;
|
||||||
|
TArray<DInterpolation *> attached;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
DSectorPlaneInterpolation() {}
|
||||||
|
DSectorPlaneInterpolation(sector_t *sector, bool plane, bool attach);
|
||||||
|
void Destroy();
|
||||||
|
void UpdateInterpolation();
|
||||||
|
void Restore();
|
||||||
|
void Interpolate(double smoothratio);
|
||||||
|
DECLARE_OLD_SERIAL
|
||||||
|
virtual void Serialize(FSerializer &arc);
|
||||||
|
size_t PointerSubstitution(DObject *old, DObject *notOld);
|
||||||
|
size_t PropagateMark();
|
||||||
|
};
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
class DSectorScrollInterpolation : public DInterpolation
|
||||||
|
{
|
||||||
|
DECLARE_CLASS(DSectorScrollInterpolation, DInterpolation)
|
||||||
|
|
||||||
|
sector_t *sector;
|
||||||
|
double oldx, oldy;
|
||||||
|
double bakx, baky;
|
||||||
|
bool ceiling;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
DSectorScrollInterpolation() {}
|
||||||
|
DSectorScrollInterpolation(sector_t *sector, bool plane);
|
||||||
|
void Destroy();
|
||||||
|
void UpdateInterpolation();
|
||||||
|
void Restore();
|
||||||
|
void Interpolate(double smoothratio);
|
||||||
|
DECLARE_OLD_SERIAL
|
||||||
|
virtual void Serialize(FSerializer &arc);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
class DWallScrollInterpolation : public DInterpolation
|
||||||
|
{
|
||||||
|
DECLARE_CLASS(DWallScrollInterpolation, DInterpolation)
|
||||||
|
|
||||||
|
side_t *side;
|
||||||
|
int part;
|
||||||
|
double oldx, oldy;
|
||||||
|
double bakx, baky;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
DWallScrollInterpolation() {}
|
||||||
|
DWallScrollInterpolation(side_t *side, int part);
|
||||||
|
void Destroy();
|
||||||
|
void UpdateInterpolation();
|
||||||
|
void Restore();
|
||||||
|
void Interpolate(double smoothratio);
|
||||||
|
DECLARE_OLD_SERIAL
|
||||||
|
virtual void Serialize(FSerializer &arc);
|
||||||
|
};
|
||||||
|
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
class DPolyobjInterpolation : public DInterpolation
|
||||||
|
{
|
||||||
|
DECLARE_CLASS(DPolyobjInterpolation, DInterpolation)
|
||||||
|
|
||||||
|
FPolyObj *poly;
|
||||||
|
TArray<double> oldverts, bakverts;
|
||||||
|
double oldcx, oldcy;
|
||||||
|
double bakcx, bakcy;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
DPolyobjInterpolation() {}
|
||||||
|
DPolyobjInterpolation(FPolyObj *poly);
|
||||||
|
void Destroy();
|
||||||
|
void UpdateInterpolation();
|
||||||
|
void Restore();
|
||||||
|
void Interpolate(double smoothratio);
|
||||||
|
DECLARE_OLD_SERIAL
|
||||||
|
virtual void Serialize(FSerializer &arc);
|
||||||
|
};
|
||||||
|
|
||||||
|
void DInterpolation::Serialize(FArchive &arc)
|
||||||
|
{
|
||||||
|
Super::Serialize(arc);
|
||||||
|
arc << refcount;
|
||||||
|
if (arc.IsLoading())
|
||||||
|
{
|
||||||
|
interpolator.AddInterpolation(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//==========================================================================
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//==========================================================================
|
||||||
|
|
||||||
|
void DSectorPlaneInterpolation::Serialize(FArchive &arc)
|
||||||
|
{
|
||||||
|
Super::Serialize(arc);
|
||||||
|
arc << sector << ceiling << oldheight << oldtexz << attached;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DSectorScrollInterpolation::Serialize(FArchive &arc)
|
||||||
|
{
|
||||||
|
Super::Serialize(arc);
|
||||||
|
arc << sector << ceiling << oldx << oldy;
|
||||||
|
}
|
||||||
|
void DWallScrollInterpolation::Serialize(FArchive &arc)
|
||||||
|
{
|
||||||
|
Super::Serialize(arc);
|
||||||
|
arc << side << part << oldx << oldy;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DPolyobjInterpolation::Serialize(FArchive &arc)
|
||||||
|
{
|
||||||
|
Super::Serialize(arc);
|
||||||
|
int po = int(poly - polyobjs);
|
||||||
|
arc << po << oldverts;
|
||||||
|
poly = polyobjs + po;
|
||||||
|
|
||||||
|
arc << oldcx << oldcy;
|
||||||
|
if (arc.IsLoading()) bakverts.Resize(oldverts.Size());
|
||||||
|
}
|
||||||
|
|
||||||
|
void AWeaponHolder::Serialize(FArchive &arc)
|
||||||
|
{
|
||||||
|
Super::Serialize(arc);
|
||||||
|
arc << PieceMask << PieceWeapon;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AWeaponPiece::Serialize(FArchive &arc)
|
||||||
|
{
|
||||||
|
Super::Serialize(arc);
|
||||||
|
arc << WeaponClass << FullWeapon << PieceValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Reference in a new issue