mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-27 22:42:57 +00:00
- Fixed: The nodebuilder is highly likely to renumber vertices, so we need to remember how the
original vertices map to the new ones until after vertex slopes are handled. SVN r3380 (trunk)
This commit is contained in:
parent
514f29a34a
commit
472ac1b07c
5 changed files with 38 additions and 13 deletions
|
@ -65,8 +65,8 @@ const int AAPreference = 16;
|
|||
FNodeBuilder::FNodeBuilder(FLevel &level)
|
||||
: Level(level), GLNodes(false), SegsStuffed(0)
|
||||
{
|
||||
|
||||
VertexMap = NULL;
|
||||
OldVertexTable = NULL;
|
||||
}
|
||||
|
||||
FNodeBuilder::FNodeBuilder (FLevel &level,
|
||||
|
@ -84,10 +84,14 @@ FNodeBuilder::FNodeBuilder (FLevel &level,
|
|||
|
||||
FNodeBuilder::~FNodeBuilder()
|
||||
{
|
||||
if (VertexMap != 0)
|
||||
if (VertexMap != NULL)
|
||||
{
|
||||
delete VertexMap;
|
||||
}
|
||||
if (OldVertexTable != NULL)
|
||||
{
|
||||
delete OldVertexTable;
|
||||
}
|
||||
}
|
||||
|
||||
void FNodeBuilder::BuildMini(bool makeGLNodes)
|
||||
|
|
|
@ -209,6 +209,7 @@ public:
|
|||
seg_t *&segs, glsegextra_t *&glsegextras, int &segCount,
|
||||
subsector_t *&ssecs, int &subCount,
|
||||
vertex_t *&verts, int &vertCount);
|
||||
const int *GetOldVertexTable();
|
||||
|
||||
// These are used for building sub-BSP trees for polyobjects.
|
||||
void Clear();
|
||||
|
@ -227,6 +228,7 @@ public:
|
|||
|
||||
private:
|
||||
IVertexMap *VertexMap;
|
||||
int *OldVertexTable;
|
||||
|
||||
TArray<node_t> Nodes;
|
||||
TArray<subsector_t> Subsectors;
|
||||
|
|
|
@ -75,7 +75,7 @@ angle_t FNodeBuilder::PointToAngle (fixed_t x, fixed_t y)
|
|||
|
||||
void FNodeBuilder::FindUsedVertices (vertex_t *oldverts, int max)
|
||||
{
|
||||
int *map = (int *)alloca (max*sizeof(int));
|
||||
int *map = new int[max];
|
||||
int i;
|
||||
FPrivVert newvert;
|
||||
|
||||
|
@ -102,6 +102,17 @@ void FNodeBuilder::FindUsedVertices (vertex_t *oldverts, int max)
|
|||
Level.Lines[i].v1 = (vertex_t *)(size_t)map[v1];
|
||||
Level.Lines[i].v2 = (vertex_t *)(size_t)map[v2];
|
||||
}
|
||||
OldVertexTable = map;
|
||||
}
|
||||
|
||||
// Retrieves the original vertex -> current vertex table.
|
||||
// Doing so prevents the node builder from freeing it.
|
||||
|
||||
const int *FNodeBuilder::GetOldVertexTable()
|
||||
{
|
||||
int *table = OldVertexTable;
|
||||
OldVertexTable = NULL;
|
||||
return table;
|
||||
}
|
||||
|
||||
// For every sidedef in the map, create a corresponding seg.
|
||||
|
|
|
@ -73,7 +73,7 @@
|
|||
|
||||
#define MISSING_TEXTURE_WARN_LIMIT 20
|
||||
|
||||
void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt);
|
||||
void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt, const int *oldvertextable);
|
||||
void P_SetSlopes ();
|
||||
void P_CopySlopes();
|
||||
void BloodCrypt (void *data, int key, int len);
|
||||
|
@ -3444,6 +3444,7 @@ void P_SetupLevel (char *lumpname, int position)
|
|||
int numbuildthings;
|
||||
int i;
|
||||
bool buildmap;
|
||||
const int *oldvertextable = NULL;
|
||||
|
||||
// This is motivated as follows:
|
||||
|
||||
|
@ -3758,7 +3759,7 @@ void P_SetupLevel (char *lumpname, int position)
|
|||
bool BuildGLNodes;
|
||||
if (ForceNodeBuild)
|
||||
{
|
||||
BuildGLNodes = Renderer->RequireGLNodes() || am_textured || multiplayer || demoplayback || demorecording || genglnodes;
|
||||
BuildGLNodes = RequireGLNodes || multiplayer || demoplayback || demorecording || genglnodes;
|
||||
|
||||
startTime = I_FPSTime ();
|
||||
TArray<FNodeBuilder::FPolyStart> polyspots, anchors;
|
||||
|
@ -3782,6 +3783,7 @@ void P_SetupLevel (char *lumpname, int position)
|
|||
vertexes, numvertexes);
|
||||
endTime = I_FPSTime ();
|
||||
DPrintf ("BSP generation took %.3f sec (%d segs)\n", (endTime - startTime) * 0.001, numsegs);
|
||||
oldvertextable = builder.GetOldVertexTable();
|
||||
reloop = true;
|
||||
}
|
||||
else
|
||||
|
@ -3868,7 +3870,7 @@ void P_SetupLevel (char *lumpname, int position)
|
|||
if (!buildmap)
|
||||
{
|
||||
// [RH] Spawn slope creating things first.
|
||||
P_SpawnSlopeMakers (&MapThingsConverted[0], &MapThingsConverted[MapThingsConverted.Size()]);
|
||||
P_SpawnSlopeMakers (&MapThingsConverted[0], &MapThingsConverted[MapThingsConverted.Size()], oldvertextable);
|
||||
P_CopySlopes();
|
||||
|
||||
// Spawn 3d floors - must be done before spawning things so it can't be done in P_SpawnSpecials
|
||||
|
@ -3898,6 +3900,10 @@ void P_SetupLevel (char *lumpname, int position)
|
|||
delete[] buildthings;
|
||||
}
|
||||
delete map;
|
||||
if (oldvertextable != NULL)
|
||||
{
|
||||
delete[] oldvertextable;
|
||||
}
|
||||
|
||||
// set up world state
|
||||
P_SpawnSpecials ();
|
||||
|
|
|
@ -280,7 +280,7 @@ enum
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt)
|
||||
static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt, const int *oldvertextable)
|
||||
{
|
||||
TMap<int, fixed_t> vt_heights[2];
|
||||
FMapThing *mt;
|
||||
|
@ -311,15 +311,17 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt)
|
|||
|
||||
for(int i = 0; i < numvertexdatas; i++)
|
||||
{
|
||||
int ii = oldvertextable == NULL ? i : oldvertextable[i];
|
||||
|
||||
if (vertexdatas[i].flags & VERTEXFLAG_ZCeilingEnabled)
|
||||
{
|
||||
vt_heights[1][i] = vertexdatas[i].zCeiling;
|
||||
vt_heights[1][ii] = vertexdatas[i].zCeiling;
|
||||
vt_found = true;
|
||||
}
|
||||
|
||||
if (vertexdatas[i].flags & VERTEXFLAG_ZFloorEnabled)
|
||||
{
|
||||
vt_heights[0][i] = vertexdatas[i].zFloor;
|
||||
vt_heights[0][ii] = vertexdatas[i].zFloor;
|
||||
vt_found = true;
|
||||
}
|
||||
}
|
||||
|
@ -413,7 +415,7 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt)
|
|||
//
|
||||
//===========================================================================
|
||||
|
||||
void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt)
|
||||
void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt, const int *oldvertextable)
|
||||
{
|
||||
FMapThing *mt;
|
||||
|
||||
|
@ -421,7 +423,7 @@ void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt)
|
|||
{
|
||||
if ((mt->type >= THING_SlopeFloorPointLine &&
|
||||
mt->type <= THING_SetCeilingSlope) ||
|
||||
mt->type==THING_VavoomFloor || mt->type==THING_VavoomCeiling)
|
||||
mt->type == THING_VavoomFloor || mt->type == THING_VavoomCeiling)
|
||||
{
|
||||
fixed_t x, y, z;
|
||||
secplane_t *refplane;
|
||||
|
@ -439,7 +441,7 @@ void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt)
|
|||
refplane = &sec->floorplane;
|
||||
}
|
||||
z = refplane->ZatPoint (x, y) + (mt->z);
|
||||
if (mt->type==THING_VavoomFloor || mt->type==THING_VavoomCeiling)
|
||||
if (mt->type == THING_VavoomFloor || mt->type == THING_VavoomCeiling)
|
||||
{
|
||||
P_VavoomSlope(sec, mt->thingid, x, y, mt->z, mt->type & 1);
|
||||
}
|
||||
|
@ -465,7 +467,7 @@ void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt)
|
|||
}
|
||||
}
|
||||
|
||||
P_SetSlopesFromVertexHeights(firstmt, lastmt);
|
||||
P_SetSlopesFromVertexHeights(firstmt, lastmt, oldvertextable);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue