- removed the needless copying around of the vertexdatas array. The slope code can just use this from the TArray created by the UDMF parser.

This commit is contained in:
Christoph Oelckers 2017-01-09 01:40:14 +01:00
parent b9ac44e8f2
commit 472ace1bea
4 changed files with 7 additions and 17 deletions

View file

@ -122,8 +122,7 @@ inline bool P_LoadBuildMap(BYTE *mapdata, size_t len, FMapThing **things, int *n
// MAP related Lookup tables.
// Store VERTEXES, LINEDEFS, SIDEDEFS, etc.
//
int numvertexdatas;
vertexdata_t* vertexdatas;
TArray<vertexdata_t> vertexdatas;
int numsegs;
seg_t* segs;
@ -833,7 +832,6 @@ void P_LoadVertexes (MapData * map)
// Determine number of vertices:
// total lump length / vertex record length.
unsigned numvertexes = map->Size(ML_VERTEXES) / sizeof(mapvertex_t);
numvertexdatas = 0;
if (numvertexes == 0)
{
@ -842,7 +840,7 @@ void P_LoadVertexes (MapData * map)
// Allocate memory for buffer.
level.vertexes.Alloc(numvertexes);
vertexdatas = NULL;
vertexdatas.Clear();
map->Seek(ML_VERTEXES);

View file

@ -278,7 +278,7 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt,
}
}
for(int i = 0; i < numvertexdatas; i++)
for(unsigned i = 0; i < vertexdatas.Size(); i++)
{
int ii = oldvertextable == NULL ? i : oldvertextable[i];
@ -296,9 +296,8 @@ static void P_SetSlopesFromVertexHeights(FMapThing *firstmt, FMapThing *lastmt,
}
// If vertexdata_t is ever extended for non-slope usage, this will obviously have to be deferred or removed.
delete[] vertexdatas;
vertexdatas = NULL;
numvertexdatas = 0;
vertexdatas.Clear();
vertexdatas.ShrinkToFit();
if (vt_found)
{

View file

@ -394,7 +394,6 @@ class UDMFParser : public UDMFParserBase
TArray<intmapsidedef_t> ParsedSideTextures;
TArray<sector_t> ParsedSectors;
TArray<vertex_t> ParsedVertices;
TArray<vertexdata_t> ParsedVertexDatas;
FDynamicColormap *fogMap, *normMap;
FMissingTextureTracker &missingTex;
@ -1996,7 +1995,7 @@ public:
vertexdata_t vd;
ParseVertex(&vt, &vd);
ParsedVertices.Push(vt);
ParsedVertexDatas.Push(vd);
vertexdatas.Push(vd);
}
else
{
@ -2014,11 +2013,6 @@ public:
level.vertexes.Alloc(ParsedVertices.Size());
memcpy(&level.vertexes[0], &ParsedVertices[0], level.vertexes.Size() * sizeof(vertex_t));
// Create the real vertex datas
numvertexdatas = ParsedVertexDatas.Size();
vertexdatas = new vertexdata_t[numvertexdatas];
memcpy(vertexdatas, &ParsedVertexDatas[0], numvertexdatas * sizeof(*vertexdatas));
// Create the real sectors
level.sectors.Alloc(ParsedSectors.Size());
memcpy(&level.sectors[0], &ParsedSectors[0], level.sectors.Size() * sizeof(sector_t));

View file

@ -42,8 +42,7 @@ extern "C" int viewheight;
extern TArray<spritedef_t> sprites;
extern DWORD NumStdSprites;
extern int numvertexdatas;
extern vertexdata_t* vertexdatas;
extern TArray<vertexdata_t> vertexdatas;
extern int numsegs;
extern seg_t* segs;