diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 9df8695b4f..62eefe2ec4 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -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. March 14, 2009 diff --git a/src/nodebuild.h b/src/nodebuild.h index 4c7babbcca..1e0a2efaf7 100644 --- a/src/nodebuild.h +++ b/src/nodebuild.h @@ -219,7 +219,7 @@ private: double AddIntersection (const node_t &node, int vertex); 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 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 RemoveSegFromVert2 (DWORD segnum, int vertnum); DWORD AddMiniseg (int v1, int v2, DWORD partner, DWORD seg1, DWORD splitseg); diff --git a/src/nodebuild_gl.cpp b/src/nodebuild_gl.cpp index 475bccd213..e3453cd336 100644 --- a/src/nodebuild_gl.cpp +++ b/src/nodebuild_gl.cpp @@ -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 && (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 && - (bseg2 = CheckLoopEnd (-node.dx, -node.dy, event->Info.Vertex, prev->Info.Vertex)) != DWORD_MAX) + (fseg2 = CheckLoopEnd (node.dx, node.dy, event->Info.Vertex)) != DWORD_MAX && + (bseg2 = CheckLoopEnd (-node.dx, -node.dy, prev->Info.Vertex)) != DWORD_MAX) { // Add miniseg on the front side 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; } -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]; angle_t splitAngle = PointToAngle (dx, dy) + ANGLE_180; diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 857308e860..6a79c7bc74 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -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) { @@ -757,10 +757,21 @@ void P_LoadGLZSegs (FileReaderZ &data) { seg_t *seg; DWORD v1, partner; - WORD line; + DWORD line; + WORD lineword; 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->v1 = &vertexes[v1]; @@ -780,7 +791,7 @@ void P_LoadGLZSegs (FileReaderZ &data) { seg->PartnerSeg = &segs[partner]; } - if (line != 0xFFFF) + if (line != 0xFFFFFFFF) { line_t *ldef; @@ -891,7 +902,7 @@ static void P_LoadZNodes (FileReader &dalump, DWORD id) } else { - P_LoadGLZSegs (data); + P_LoadGLZSegs (data, id); } // Read nodes @@ -3455,7 +3466,7 @@ void P_SetupLevel (char *lumpname, int position) { // Check for compressed nodes first, then uncompressed nodes 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) { @@ -3467,10 +3478,11 @@ void P_SetupLevel (char *lumpname, int position) // If normal nodes are not present but GL nodes are, use them. map->Seek(ML_GLZNODES); idcheck = MAKE_ID('Z','G','L','N'); + idcheck2 = MAKE_ID('Z','G','L','2'); } map->file->Read (&id, 4); - if (id == idcheck) + if (id == idcheck || id == idcheck2) { try { @@ -3513,7 +3525,6 @@ void P_SetupLevel (char *lumpname, int position) times[9].Unclock(); } else ForceNodeBuild = true; - } if (ForceNodeBuild) {