mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- some reshuffling of save data so that the actors won't get restored before the sectors.
Note that this required splitting P_SerializeWorld, because sector_t and FSectorPortal contain some actor pointers, for which the same rule applies: Portal linking can only be done after all sectors have been read, meaning it cannot be done along with the rest of the data in these structures. Obviously such a change breaks savegame compatibility so the min. savegame version had to be increased again.
This commit is contained in:
parent
082042818b
commit
e5dc92f998
8 changed files with 29 additions and 26 deletions
|
@ -576,8 +576,7 @@ public:
|
|||
~AActor ();
|
||||
|
||||
void Serialize (FArchive &arc);
|
||||
void PostSerialize();
|
||||
|
||||
|
||||
static AActor *StaticSpawn (PClassActor *type, const DVector3 &pos, replace_t allowreplacement, bool SpawningMapThing = false);
|
||||
|
||||
inline AActor *GetDefault () const
|
||||
|
|
|
@ -69,7 +69,6 @@ public:
|
|||
virtual ~DThinker ();
|
||||
virtual void Tick ();
|
||||
virtual void PostBeginPlay (); // Called just before the first tick
|
||||
virtual void PostSerialize() {}
|
||||
size_t PropagateMark();
|
||||
|
||||
void ChangeStatNum (int statnum);
|
||||
|
|
|
@ -1531,8 +1531,9 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad)
|
|||
|
||||
FBehavior::StaticSerializeModuleStates (arc);
|
||||
if (arc.IsLoading()) interpolator.ClearInterpolations();
|
||||
P_SerializeWorld(arc);
|
||||
P_SerializeThinkers (arc, hubLoad);
|
||||
P_SerializeWorld (arc);
|
||||
P_SerializeWorldActors(arc); // serializing actor pointers in the world data must be done after SerializeWorld has restored the entire sector state, otherwise LinkToWorld may fail.
|
||||
P_SerializePolyobjs (arc);
|
||||
P_SerializeSubsectors(arc);
|
||||
StatusBar->Serialize (arc);
|
||||
|
@ -1579,13 +1580,6 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad)
|
|||
P_SerializeSounds (arc);
|
||||
if (arc.IsLoading())
|
||||
{
|
||||
FThinkerIterator it(RUNTIME_CLASS(DThinker));
|
||||
DThinker *th;
|
||||
while ((th = it.Next()))
|
||||
{
|
||||
th->PostSerialize();
|
||||
}
|
||||
|
||||
for (i = 0; i < numsectors; i++)
|
||||
{
|
||||
P_Recalculate3DFloors(§ors[i]);
|
||||
|
|
|
@ -397,6 +397,9 @@ void AActor::Serialize(FArchive &arc)
|
|||
|
||||
if (arc.IsLoading ())
|
||||
{
|
||||
touching_sectorlist = NULL;
|
||||
LinkToWorld(false, Sector);
|
||||
|
||||
AddToHash ();
|
||||
SetShade (fillcolor);
|
||||
if (player)
|
||||
|
@ -413,17 +416,11 @@ void AActor::Serialize(FArchive &arc)
|
|||
Speed = GetDefault()->Speed;
|
||||
}
|
||||
}
|
||||
ClearInterpolation();
|
||||
UpdateWaterLevel(false);
|
||||
}
|
||||
}
|
||||
|
||||
void AActor::PostSerialize()
|
||||
{
|
||||
touching_sectorlist = NULL;
|
||||
LinkToWorld(false, Sector);
|
||||
ClearInterpolation();
|
||||
UpdateWaterLevel(false);
|
||||
}
|
||||
|
||||
AActor::AActor () throw()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -363,9 +363,7 @@ void P_SerializeWorld (FArchive &arc)
|
|||
arc << sec->damageamount;
|
||||
arc << sec->damageinterval
|
||||
<< sec->leakydamage
|
||||
<< sec->damagetype;
|
||||
arc << sec->SoundTarget
|
||||
<< sec->SecActTarget
|
||||
<< sec->damagetype
|
||||
<< sec->sky
|
||||
<< sec->MoreFlags
|
||||
<< sec->Flags
|
||||
|
@ -453,6 +451,22 @@ void P_SerializeWorld (FArchive &arc)
|
|||
P_CollectLinkedPortals();
|
||||
}
|
||||
|
||||
void P_SerializeWorldActors(FArchive &arc)
|
||||
{
|
||||
int i, j;
|
||||
sector_t *sec;
|
||||
|
||||
for (i = 0, sec = sectors; i < numsectors; i++, sec++)
|
||||
{
|
||||
arc << sec->SoundTarget
|
||||
<< sec->SecActTarget;
|
||||
}
|
||||
for (auto &s : sectorPortals)
|
||||
{
|
||||
arc << s.mSkybox;
|
||||
}
|
||||
}
|
||||
|
||||
void extsector_t::Serialize(FArchive &arc)
|
||||
{
|
||||
arc << FakeFloor.Sectors
|
||||
|
|
|
@ -41,6 +41,7 @@ struct PNGHandle;
|
|||
// These are the load / save game routines.
|
||||
// Also see farchive.(h|cpp)
|
||||
void P_SerializePlayers (FArchive &arc, bool fakeload);
|
||||
void P_SerializeWorldActors(FArchive &arc);
|
||||
void P_SerializeWorld (FArchive &arc);
|
||||
void P_SerializeThinkers (FArchive &arc, bool);
|
||||
void P_SerializePolyobjs (FArchive &arc);
|
||||
|
|
|
@ -230,8 +230,7 @@ FArchive &operator<< (FArchive &arc, FSectorPortal &port)
|
|||
<< port.mOrigin
|
||||
<< port.mDestination
|
||||
<< port.mDisplacement
|
||||
<< port.mPlaneZ
|
||||
<< port.mSkybox;
|
||||
<< port.mPlaneZ;
|
||||
return arc;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,11 +72,11 @@ const char *GetVersionString();
|
|||
// SAVESIG should match SAVEVER.
|
||||
|
||||
// MINSAVEVER is the minimum level snapshot version that can be loaded.
|
||||
#define MINSAVEVER 4539
|
||||
#define MINSAVEVER 4540
|
||||
|
||||
// Use 4500 as the base git save version, since it's higher than the
|
||||
// SVN revision ever got.
|
||||
#define SAVEVER 4539
|
||||
#define SAVEVER 4540
|
||||
|
||||
#define SAVEVERSTRINGIFY2(x) #x
|
||||
#define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x)
|
||||
|
|
Loading…
Reference in a new issue