From c30d5d42a299209454b5dca7ba5f2b36286e6950 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 18 Apr 2016 12:56:16 +0200 Subject: [PATCH] - fixed: UpdateSectorRenderList may not be called when spawning mapthings. At this time the portals have not been initialized yet and doing this here would trash the cached previous coordinate. --- src/p_maputl.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/p_maputl.cpp b/src/p_maputl.cpp index f3dda49a9..8ee251316 100644 --- a/src/p_maputl.cpp +++ b/src/p_maputl.cpp @@ -396,14 +396,19 @@ bool AActor::FixMapthingPos() void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector) { - if (spawningmapthing && (flags4 & MF4_FIXMAPTHINGPOS) && sector == NULL) + bool spawning = spawningmapthing; + + if (spawning) { - if (FixMapthingPos()) spawningmapthing = false; + if ((flags4 & MF4_FIXMAPTHINGPOS) && sector == NULL) + { + if (FixMapthingPos()) spawning = false; + } } if (sector == NULL) { - if (!spawningmapthing || numgamenodes == 0) + if (!spawning || numgamenodes == 0) { sector = P_PointInSector(Pos()); } @@ -499,7 +504,8 @@ void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector) } } } - UpdateRenderSectorList(); + // Portal links cannot be done unless the level is fully initialized. + if (!spawningmapthing) UpdateRenderSectorList(); } void AActor::SetOrigin(double x, double y, double z, bool moving)