- Added support for loading ZGL2 nodes. (Only useful with UDMF and maps with

more than 65534 lines.)


SVN r1485 (trunk)
This commit is contained in:
Randy Heit 2009-03-17 03:34:31 +00:00
parent 63c170150d
commit 314216343d
4 changed files with 28 additions and 13 deletions

View file

@ -1,4 +1,8 @@
March 15, 2009 (Changes by Graf Zahl) March 16, 2009
- Added support for loading ZGL2 nodes. (Only useful with UDMF and maps with
more than 65534 lines.)
March 15, 2009 (Changes by Graf Zahl)
- Fixed: AWeapon::PickupForAmmo accessed ammo type 1 when checking ammo type2. - Fixed: AWeapon::PickupForAmmo accessed ammo type 1 when checking ammo type2.
March 14, 2009 March 14, 2009

View file

@ -219,7 +219,7 @@ private:
double AddIntersection (const node_t &node, int vertex); double AddIntersection (const node_t &node, int vertex);
void AddMinisegs (const node_t &node, DWORD splitseg, DWORD &fset, DWORD &rset); void AddMinisegs (const node_t &node, DWORD splitseg, DWORD &fset, DWORD &rset);
DWORD CheckLoopStart (fixed_t dx, fixed_t dy, int vertex1, int vertex2); DWORD CheckLoopStart (fixed_t dx, fixed_t dy, int vertex1, int vertex2);
DWORD CheckLoopEnd (fixed_t dx, fixed_t dy, int vertex1, int vertex2); DWORD CheckLoopEnd (fixed_t dx, fixed_t dy, int vertex2);
void RemoveSegFromVert1 (DWORD segnum, int vertnum); void RemoveSegFromVert1 (DWORD segnum, int vertnum);
void RemoveSegFromVert2 (DWORD segnum, int vertnum); void RemoveSegFromVert2 (DWORD segnum, int vertnum);
DWORD AddMiniseg (int v1, int v2, DWORD partner, DWORD seg1, DWORD splitseg); DWORD AddMiniseg (int v1, int v2, DWORD partner, DWORD seg1, DWORD splitseg);

View file

@ -173,8 +173,8 @@ void FNodeBuilder::AddMinisegs (const node_t &node, DWORD splitseg, DWORD &fset,
if ((fseg1 = CheckLoopStart (node.dx, node.dy, prev->Info.Vertex, event->Info.Vertex)) != DWORD_MAX && if ((fseg1 = CheckLoopStart (node.dx, node.dy, prev->Info.Vertex, event->Info.Vertex)) != DWORD_MAX &&
(bseg1 = CheckLoopStart (-node.dx, -node.dy, event->Info.Vertex, prev->Info.Vertex)) != DWORD_MAX && (bseg1 = CheckLoopStart (-node.dx, -node.dy, event->Info.Vertex, prev->Info.Vertex)) != DWORD_MAX &&
(fseg2 = CheckLoopEnd (node.dx, node.dy, prev->Info.Vertex, event->Info.Vertex)) != DWORD_MAX && (fseg2 = CheckLoopEnd (node.dx, node.dy, event->Info.Vertex)) != DWORD_MAX &&
(bseg2 = CheckLoopEnd (-node.dx, -node.dy, event->Info.Vertex, prev->Info.Vertex)) != DWORD_MAX) (bseg2 = CheckLoopEnd (-node.dx, -node.dy, prev->Info.Vertex)) != DWORD_MAX)
{ {
// Add miniseg on the front side // Add miniseg on the front side
fnseg = AddMiniseg (prev->Info.Vertex, event->Info.Vertex, DWORD_MAX, fseg1, splitseg); fnseg = AddMiniseg (prev->Info.Vertex, event->Info.Vertex, DWORD_MAX, fseg1, splitseg);
@ -329,7 +329,7 @@ DWORD FNodeBuilder::CheckLoopStart (fixed_t dx, fixed_t dy, int vertex, int vert
return bestseg; return bestseg;
} }
DWORD FNodeBuilder::CheckLoopEnd (fixed_t dx, fixed_t dy, int vertex1, int vertex) DWORD FNodeBuilder::CheckLoopEnd (fixed_t dx, fixed_t dy, int vertex)
{ {
FPrivVert *v = &Vertices[vertex]; FPrivVert *v = &Vertices[vertex];
angle_t splitAngle = PointToAngle (dx, dy) + ANGLE_180; angle_t splitAngle = PointToAngle (dx, dy) + ANGLE_180;

View file

@ -749,7 +749,7 @@ void P_LoadZSegs (FileReaderZ &data)
// //
//=========================================================================== //===========================================================================
void P_LoadGLZSegs (FileReaderZ &data) void P_LoadGLZSegs (FileReaderZ &data, DWORD id)
{ {
for (int i = 0; i < numsubsectors; ++i) for (int i = 0; i < numsubsectors; ++i)
{ {
@ -757,10 +757,21 @@ void P_LoadGLZSegs (FileReaderZ &data)
{ {
seg_t *seg; seg_t *seg;
DWORD v1, partner; DWORD v1, partner;
WORD line; DWORD line;
WORD lineword;
BYTE side; BYTE side;
data >> v1 >> partner >> line >> side; data >> v1 >> partner;
if (id == MAKE_ID('Z','G','L','2'))
{
data >> line;
}
else
{
data >> lineword;
line = lineword == 0xFFFF ? 0xFFFFFFFF : lineword;
}
data >> side;
seg = &segs[subsectors[i].firstline + j]; seg = &segs[subsectors[i].firstline + j];
seg->v1 = &vertexes[v1]; seg->v1 = &vertexes[v1];
@ -780,7 +791,7 @@ void P_LoadGLZSegs (FileReaderZ &data)
{ {
seg->PartnerSeg = &segs[partner]; seg->PartnerSeg = &segs[partner];
} }
if (line != 0xFFFF) if (line != 0xFFFFFFFF)
{ {
line_t *ldef; line_t *ldef;
@ -891,7 +902,7 @@ static void P_LoadZNodes (FileReader &dalump, DWORD id)
} }
else else
{ {
P_LoadGLZSegs (data); P_LoadGLZSegs (data, id);
} }
// Read nodes // Read nodes
@ -3455,7 +3466,7 @@ void P_SetupLevel (char *lumpname, int position)
{ {
// Check for compressed nodes first, then uncompressed nodes // Check for compressed nodes first, then uncompressed nodes
FWadLump test; FWadLump test;
DWORD id = MAKE_ID('X','x','X','x'), idcheck=0; DWORD id = MAKE_ID('X','x','X','x'), idcheck = 0, idcheck2 = 0;
if (map->MapLumps[ML_ZNODES].Size != 0 && !UsingGLNodes) if (map->MapLumps[ML_ZNODES].Size != 0 && !UsingGLNodes)
{ {
@ -3467,10 +3478,11 @@ void P_SetupLevel (char *lumpname, int position)
// If normal nodes are not present but GL nodes are, use them. // If normal nodes are not present but GL nodes are, use them.
map->Seek(ML_GLZNODES); map->Seek(ML_GLZNODES);
idcheck = MAKE_ID('Z','G','L','N'); idcheck = MAKE_ID('Z','G','L','N');
idcheck2 = MAKE_ID('Z','G','L','2');
} }
map->file->Read (&id, 4); map->file->Read (&id, 4);
if (id == idcheck) if (id == idcheck || id == idcheck2)
{ {
try try
{ {
@ -3513,7 +3525,6 @@ void P_SetupLevel (char *lumpname, int position)
times[9].Unclock(); times[9].Unclock();
} }
else ForceNodeBuild = true; else ForceNodeBuild = true;
} }
if (ForceNodeBuild) if (ForceNodeBuild)
{ {