- fixed: Actors cannot be linked into the world until after all actors and sectors have been deserialized.

Two issues:

Portal linking requires all skyboxes in the sectors to be present, without them some info is not there when needed.
UpdateWaterLevel was called in AActor::Serialize, which operated on the freshly loaded level where lots of things haven't been set up yet and plane heights may be wrong.
This commit is contained in:
Christoph Oelckers 2016-04-18 15:27:19 +02:00
parent 961a4c8524
commit 2327107f32
4 changed files with 16 additions and 4 deletions

View file

@ -576,6 +576,7 @@ public:
~AActor (); ~AActor ();
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
void PostSerialize();
static AActor *StaticSpawn (PClassActor *type, const DVector3 &pos, replace_t allowreplacement, bool SpawningMapThing = false); static AActor *StaticSpawn (PClassActor *type, const DVector3 &pos, replace_t allowreplacement, bool SpawningMapThing = false);

View file

@ -69,6 +69,7 @@ public:
virtual ~DThinker (); virtual ~DThinker ();
virtual void Tick (); virtual void Tick ();
virtual void PostBeginPlay (); // Called just before the first tick virtual void PostBeginPlay (); // Called just before the first tick
virtual void PostSerialize() {}
size_t PropagateMark(); size_t PropagateMark();
void ChangeStatNum (int statnum); void ChangeStatNum (int statnum);

View file

@ -1580,6 +1580,13 @@ void G_SerializeLevel (FArchive &arc, bool hubLoad)
P_SerializeSounds (arc); P_SerializeSounds (arc);
if (arc.IsLoading()) if (arc.IsLoading())
{ {
FThinkerIterator it(RUNTIME_CLASS(DThinker));
DThinker *th;
while ((th = it.Next()))
{
th->PostSerialize();
}
for (i = 0; i < numsectors; i++) for (i = 0; i < numsectors; i++)
{ {
P_Recalculate3DFloors(&sectors[i]); P_Recalculate3DFloors(&sectors[i]);

View file

@ -397,8 +397,6 @@ void AActor::Serialize(FArchive &arc)
if (arc.IsLoading ()) if (arc.IsLoading ())
{ {
touching_sectorlist = NULL;
LinkToWorld (false, Sector);
AddToHash (); AddToHash ();
SetShade (fillcolor); SetShade (fillcolor);
if (player) if (player)
@ -415,11 +413,16 @@ void AActor::Serialize(FArchive &arc)
Speed = GetDefault()->Speed; Speed = GetDefault()->Speed;
} }
} }
ClearInterpolation();
UpdateWaterLevel(false);
} }
} }
void AActor::PostSerialize()
{
touching_sectorlist = NULL;
LinkToWorld(false, Sector);
ClearInterpolation();
UpdateWaterLevel(false);
}
AActor::AActor () throw() AActor::AActor () throw()
{ {