mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 07:12:16 +00:00
- 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:
parent
b9ac44e8f2
commit
472ace1bea
4 changed files with 7 additions and 17 deletions
|
@ -122,8 +122,7 @@ inline bool P_LoadBuildMap(BYTE *mapdata, size_t len, FMapThing **things, int *n
|
||||||
// MAP related Lookup tables.
|
// MAP related Lookup tables.
|
||||||
// Store VERTEXES, LINEDEFS, SIDEDEFS, etc.
|
// Store VERTEXES, LINEDEFS, SIDEDEFS, etc.
|
||||||
//
|
//
|
||||||
int numvertexdatas;
|
TArray<vertexdata_t> vertexdatas;
|
||||||
vertexdata_t* vertexdatas;
|
|
||||||
|
|
||||||
int numsegs;
|
int numsegs;
|
||||||
seg_t* segs;
|
seg_t* segs;
|
||||||
|
@ -833,7 +832,6 @@ void P_LoadVertexes (MapData * map)
|
||||||
// Determine number of vertices:
|
// Determine number of vertices:
|
||||||
// total lump length / vertex record length.
|
// total lump length / vertex record length.
|
||||||
unsigned numvertexes = map->Size(ML_VERTEXES) / sizeof(mapvertex_t);
|
unsigned numvertexes = map->Size(ML_VERTEXES) / sizeof(mapvertex_t);
|
||||||
numvertexdatas = 0;
|
|
||||||
|
|
||||||
if (numvertexes == 0)
|
if (numvertexes == 0)
|
||||||
{
|
{
|
||||||
|
@ -842,7 +840,7 @@ void P_LoadVertexes (MapData * map)
|
||||||
|
|
||||||
// Allocate memory for buffer.
|
// Allocate memory for buffer.
|
||||||
level.vertexes.Alloc(numvertexes);
|
level.vertexes.Alloc(numvertexes);
|
||||||
vertexdatas = NULL;
|
vertexdatas.Clear();
|
||||||
|
|
||||||
map->Seek(ML_VERTEXES);
|
map->Seek(ML_VERTEXES);
|
||||||
|
|
||||||
|
|
|
@ -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];
|
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.
|
// If vertexdata_t is ever extended for non-slope usage, this will obviously have to be deferred or removed.
|
||||||
delete[] vertexdatas;
|
vertexdatas.Clear();
|
||||||
vertexdatas = NULL;
|
vertexdatas.ShrinkToFit();
|
||||||
numvertexdatas = 0;
|
|
||||||
|
|
||||||
if (vt_found)
|
if (vt_found)
|
||||||
{
|
{
|
||||||
|
|
|
@ -394,7 +394,6 @@ class UDMFParser : public UDMFParserBase
|
||||||
TArray<intmapsidedef_t> ParsedSideTextures;
|
TArray<intmapsidedef_t> ParsedSideTextures;
|
||||||
TArray<sector_t> ParsedSectors;
|
TArray<sector_t> ParsedSectors;
|
||||||
TArray<vertex_t> ParsedVertices;
|
TArray<vertex_t> ParsedVertices;
|
||||||
TArray<vertexdata_t> ParsedVertexDatas;
|
|
||||||
|
|
||||||
FDynamicColormap *fogMap, *normMap;
|
FDynamicColormap *fogMap, *normMap;
|
||||||
FMissingTextureTracker &missingTex;
|
FMissingTextureTracker &missingTex;
|
||||||
|
@ -1996,7 +1995,7 @@ public:
|
||||||
vertexdata_t vd;
|
vertexdata_t vd;
|
||||||
ParseVertex(&vt, &vd);
|
ParseVertex(&vt, &vd);
|
||||||
ParsedVertices.Push(vt);
|
ParsedVertices.Push(vt);
|
||||||
ParsedVertexDatas.Push(vd);
|
vertexdatas.Push(vd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2014,11 +2013,6 @@ public:
|
||||||
level.vertexes.Alloc(ParsedVertices.Size());
|
level.vertexes.Alloc(ParsedVertices.Size());
|
||||||
memcpy(&level.vertexes[0], &ParsedVertices[0], level.vertexes.Size() * sizeof(vertex_t));
|
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
|
// Create the real sectors
|
||||||
level.sectors.Alloc(ParsedSectors.Size());
|
level.sectors.Alloc(ParsedSectors.Size());
|
||||||
memcpy(&level.sectors[0], &ParsedSectors[0], level.sectors.Size() * sizeof(sector_t));
|
memcpy(&level.sectors[0], &ParsedSectors[0], level.sectors.Size() * sizeof(sector_t));
|
||||||
|
|
|
@ -42,8 +42,7 @@ extern "C" int viewheight;
|
||||||
extern TArray<spritedef_t> sprites;
|
extern TArray<spritedef_t> sprites;
|
||||||
extern DWORD NumStdSprites;
|
extern DWORD NumStdSprites;
|
||||||
|
|
||||||
extern int numvertexdatas;
|
extern TArray<vertexdata_t> vertexdatas;
|
||||||
extern vertexdata_t* vertexdatas;
|
|
||||||
|
|
||||||
extern int numsegs;
|
extern int numsegs;
|
||||||
extern seg_t* segs;
|
extern seg_t* segs;
|
||||||
|
|
Loading…
Reference in a new issue