- fixed 3D floor initialization for actor spawning.

Since actors are being spawned before the renderer gets set up this needs to fully initialize the list before spawning the actors, then take it down again for creating the vertex buffer and then recreate it.
This commit is contained in:
Christoph Oelckers 2018-12-27 08:28:09 +01:00
commit b31f284e28
3 changed files with 44 additions and 4 deletions

View file

@ -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<F3DFloor*> oldlist;
oldlist = ffloors;
ffloors.Clear();
TArray<F3DFloor*> oldlist = std::move(ffloors);
// first delete the old dynamic stuff
for(i=0;i<oldlist.Size();i++)
@ -653,6 +650,40 @@ void P_Recalculate3DFloors(sector_t * sector)
}
}
//==========================================================================
//
// removes all dynamic data. This needs to be done once before creating
// the vertex buffer.
//
//==========================================================================
void P_ClearDynamic3DFloorData()
{
for (auto &sec : level.sectors)
{
TArray<F3DFloor*> & 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);
}
}