diff --git a/src/p_3dfloors.cpp b/src/p_3dfloors.cpp index 732866c5b8..5e8d05359c 100644 --- a/src/p_3dfloors.cpp +++ b/src/p_3dfloors.cpp @@ -426,10 +426,7 @@ void P_Recalculate3DFloors(sector_t * sector) // Translucent and swimmable floors are split if they overlap with solid ones. if (ffloors.Size()>1) { - TArray oldlist; - - oldlist = ffloors; - ffloors.Clear(); + TArray oldlist = std::move(ffloors); // first delete the old dynamic stuff for(i=0;i & ffloors = sec.e->XFloor.ffloors; + + // delete the dynamic stuff + for (unsigned i = 0; i < ffloors.Size(); i++) + { + F3DFloor * rover = ffloors[i]; + + if (rover->flags&FF_DYNAMIC) + { + delete rover; + ffloors.Delete(i); + i--; + continue; + } + if (rover->flags&FF_CLIPPED) + { + rover->flags &= ~FF_CLIPPED; + rover->flags |= FF_EXISTS; + } + } + } +} + //========================================================================== // // recalculates 3D floors for all attached sectors @@ -891,6 +922,11 @@ void P_Spawn3DFloors (void) line.special=0; line.args[0] = line.args[1] = line.args[2] = line.args[3] = line.args[4] = 0; } + + for (auto &sec : level.sectors) + { + P_Recalculate3DFloors(&sec); + } } diff --git a/src/p_3dfloors.h b/src/p_3dfloors.h index e260f9f5f4..d0f4f500a5 100644 --- a/src/p_3dfloors.h +++ b/src/p_3dfloors.h @@ -123,6 +123,7 @@ void P_Recalculate3DFloors(sector_t *); void P_RecalculateAttached3DFloors(sector_t * sec); void P_RecalculateLights(sector_t *sector); void P_RecalculateAttachedLights(sector_t *sector); +void P_ClearDynamic3DFloorData(); lightlist_t * P_GetPlaneLight(sector_t * , secplane_t * plane, bool underside); void P_Spawn3DFloors( void ); diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 0cb8894da0..1dd094655d 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -3770,6 +3770,9 @@ void P_SetupLevel(const char *lumpname, int position, bool newGame) node.len = (float)g_sqrt(fdx * fdx + fdy * fdy); } + // CreateVBO must be run on the plain 3D floor data. + P_ClearDynamic3DFloorData(); + // This must be done BEFORE the PolyObj Spawn!!! InitRenderInfo(); // create hardware independent renderer resources for the level. screen->mVertexData->CreateVBO();