mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 15:02:39 +00:00
- 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:
parent
e04fc026ff
commit
b31f284e28
3 changed files with 44 additions and 4 deletions
|
@ -426,10 +426,7 @@ void P_Recalculate3DFloors(sector_t * sector)
|
||||||
// Translucent and swimmable floors are split if they overlap with solid ones.
|
// Translucent and swimmable floors are split if they overlap with solid ones.
|
||||||
if (ffloors.Size()>1)
|
if (ffloors.Size()>1)
|
||||||
{
|
{
|
||||||
TArray<F3DFloor*> oldlist;
|
TArray<F3DFloor*> oldlist = std::move(ffloors);
|
||||||
|
|
||||||
oldlist = ffloors;
|
|
||||||
ffloors.Clear();
|
|
||||||
|
|
||||||
// first delete the old dynamic stuff
|
// first delete the old dynamic stuff
|
||||||
for(i=0;i<oldlist.Size();i++)
|
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
|
// recalculates 3D floors for all attached sectors
|
||||||
|
@ -891,6 +922,11 @@ void P_Spawn3DFloors (void)
|
||||||
line.special=0;
|
line.special=0;
|
||||||
line.args[0] = line.args[1] = line.args[2] = line.args[3] = line.args[4] = 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -123,6 +123,7 @@ void P_Recalculate3DFloors(sector_t *);
|
||||||
void P_RecalculateAttached3DFloors(sector_t * sec);
|
void P_RecalculateAttached3DFloors(sector_t * sec);
|
||||||
void P_RecalculateLights(sector_t *sector);
|
void P_RecalculateLights(sector_t *sector);
|
||||||
void P_RecalculateAttachedLights(sector_t *sector);
|
void P_RecalculateAttachedLights(sector_t *sector);
|
||||||
|
void P_ClearDynamic3DFloorData();
|
||||||
|
|
||||||
lightlist_t * P_GetPlaneLight(sector_t * , secplane_t * plane, bool underside);
|
lightlist_t * P_GetPlaneLight(sector_t * , secplane_t * plane, bool underside);
|
||||||
void P_Spawn3DFloors( void );
|
void P_Spawn3DFloors( void );
|
||||||
|
|
|
@ -3770,6 +3770,9 @@ void P_SetupLevel(const char *lumpname, int position, bool newGame)
|
||||||
node.len = (float)g_sqrt(fdx * fdx + fdy * fdy);
|
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!!!
|
// This must be done BEFORE the PolyObj Spawn!!!
|
||||||
InitRenderInfo(); // create hardware independent renderer resources for the level.
|
InitRenderInfo(); // create hardware independent renderer resources for the level.
|
||||||
screen->mVertexData->CreateVBO();
|
screen->mVertexData->CreateVBO();
|
||||||
|
|
Loading…
Reference in a new issue