From c18a0e7736360a025c52bc9e6d0ce9b67d3fb79d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 30 Jan 2019 22:34:11 +0100 Subject: [PATCH] - replaced DWORD_MAX with UINT_MAX globally. This was the last remnant of ZDoom's old integer types. --- src/maploader/glnodes.cpp | 2 +- src/nodebuild.cpp | 54 +++++++++++++++++++-------------------- src/nodebuild_extract.cpp | 8 +++--- src/nodebuild_gl.cpp | 52 ++++++++++++++++++------------------- src/nodebuild_utility.cpp | 44 +++++++++++++++---------------- 5 files changed, 80 insertions(+), 80 deletions(-) diff --git a/src/maploader/glnodes.cpp b/src/maploader/glnodes.cpp index defd5e7b7..7d16eb92e 100644 --- a/src/maploader/glnodes.cpp +++ b/src/maploader/glnodes.cpp @@ -346,7 +346,7 @@ bool MapLoader::LoadGLSegs(FileReader &lump) segs[i].v2 = &Level->vertexes[checkGLVertex3(LittleLong(ml->v2))]; const uint32_t partner = LittleLong(ml->partner); - segs[i].PartnerSeg = DWORD_MAX == partner ? nullptr : &segs[partner]; + segs[i].PartnerSeg = UINT_MAX == partner ? nullptr : &segs[partner]; if(ml->linedef != 0xffff) // skip minisegs { diff --git a/src/nodebuild.cpp b/src/nodebuild.cpp index 81d841c1b..8955060ff 100644 --- a/src/nodebuild.cpp +++ b/src/nodebuild.cpp @@ -117,8 +117,8 @@ void FNodeBuilder::BuildTree () { fixed_t bbox[4]; - HackSeg = DWORD_MAX; - HackMate = DWORD_MAX; + HackSeg = UINT_MAX; + HackMate = UINT_MAX; CreateNode (0, Segs.Size(), bbox); CreateSubsectorsForReal (); } @@ -171,7 +171,7 @@ int FNodeBuilder::CreateSubsector (uint32_t set, fixed_t bbox[4]) D(Printf (PRINT_LOG, "Subsector from set %d\n", set)); - assert (set != DWORD_MAX); + assert (set != UINT_MAX); // We cannot actually create the subsector now because the node building // process might split a seg in this subsector (because all partner segs @@ -181,7 +181,7 @@ int FNodeBuilder::CreateSubsector (uint32_t set, fixed_t bbox[4]) ssnum = (int)SubsectorSets.Push (set); count = 0; - while (set != DWORD_MAX) + while (set != UINT_MAX) { AddSegToBBox (bbox, &Segs[set]); set = Segs[set].next; @@ -211,7 +211,7 @@ void FNodeBuilder::CreateSubsectorsForReal () uint32_t set = SubsectorSets[i]; uint32_t firstline = (uint32_t)SegList.Size(); - while (set != DWORD_MAX) + while (set != UINT_MAX) { USegPtr ptr; @@ -349,9 +349,9 @@ bool FNodeBuilder::CheckSubsector (uint32_t set, node_t &node, uint32_t &splitse } } seg = Segs[seg].next; - } while (seg != DWORD_MAX); + } while (seg != UINT_MAX); - if (seg == DWORD_MAX) + if (seg == UINT_MAX) { // It's a valid non-GL subsector, and probably a valid GL subsector too. if (GLNodes) { @@ -361,13 +361,13 @@ bool FNodeBuilder::CheckSubsector (uint32_t set, node_t &node, uint32_t &splitse } D(Printf(PRINT_LOG, "Need to synthesize a splitter for set %d on seg %d\n", set, seg)); - splitseg = DWORD_MAX; + splitseg = UINT_MAX; // This is a very simple and cheap "fix" for subsectors with segs // from multiple sectors, and it seems ZenNode does something // similar. It is the only technique I could find that makes the // "transparent water" in nb_bmtrk.wad work properly. - return ShoveSegBehind (set, node, seg, DWORD_MAX); + return ShoveSegBehind (set, node, seg, UINT_MAX); } // When creating GL nodes, we need to check for segs with the same start and @@ -378,7 +378,7 @@ bool FNodeBuilder::CheckSubsectorOverlappingSegs (uint32_t set, node_t &node, ui int v1, v2; uint32_t seg1, seg2; - for (seg1 = set; seg1 != DWORD_MAX; seg1 = Segs[seg1].next) + for (seg1 = set; seg1 != UINT_MAX; seg1 = Segs[seg1].next) { if (Segs[seg1].linedef == -1) { // Do not check minisegs. @@ -386,7 +386,7 @@ bool FNodeBuilder::CheckSubsectorOverlappingSegs (uint32_t set, node_t &node, ui } v1 = Segs[seg1].v1; v2 = Segs[seg1].v2; - for (seg2 = Segs[seg1].next; seg2 != DWORD_MAX; seg2 = Segs[seg2].next) + for (seg2 = Segs[seg1].next; seg2 != UINT_MAX; seg2 = Segs[seg2].next) { if (Segs[seg2].v1 == v1 && Segs[seg2].v2 == v2) { @@ -395,7 +395,7 @@ bool FNodeBuilder::CheckSubsectorOverlappingSegs (uint32_t set, node_t &node, ui swapvalues (seg1, seg2); } D(Printf(PRINT_LOG, "Need to synthesize a splitter for set %d on seg %d (ov)\n", set, seg2)); - splitseg = DWORD_MAX; + splitseg = UINT_MAX; return ShoveSegBehind (set, node, seg2, seg1); } @@ -410,7 +410,7 @@ bool FNodeBuilder::CheckSubsectorOverlappingSegs (uint32_t set, node_t &node, ui // set, all the other segs will be in front of the splitter. Since // the splitter is formed from this seg, the back of the splitter // will have a one-dimensional subsector. SplitSegs() will add one -// or two new minisegs to close it: If mate is DWORD_MAX, then a +// or two new minisegs to close it: If mate is UINT_MAX, then a // new seg is created to replace this one on the front of the // splitter. Otherwise, mate takes its place. In either case, the // seg in front of the splitter is partnered with a new miniseg on @@ -447,7 +447,7 @@ int FNodeBuilder::SelectSplitter (uint32_t set, node_t &node, uint32_t &splitseg bool nosplitters = false; bestvalue = 0; - bestseg = DWORD_MAX; + bestseg = UINT_MAX; seg = set; stepleft = 0; @@ -456,7 +456,7 @@ int FNodeBuilder::SelectSplitter (uint32_t set, node_t &node, uint32_t &splitseg D(Printf (PRINT_LOG, "Processing set %d\n", set)); - while (seg != DWORD_MAX) + while (seg != UINT_MAX) { FPrivSeg *pseg = &Segs[seg]; @@ -495,7 +495,7 @@ int FNodeBuilder::SelectSplitter (uint32_t set, node_t &node, uint32_t &splitseg seg = pseg->next; } - if (bestseg == DWORD_MAX) + if (bestseg == UINT_MAX) { // No lines split any others into two sets, so this is a convex region. D(Printf (PRINT_LOG, "set %d, step %d, nosplit %d has no good splitter (%d)\n", set, step, nosplit, nosplitters)); return nosplitters ? -1 : 0; @@ -532,7 +532,7 @@ int FNodeBuilder::Heuristic (node_t &node, uint32_t set, bool honorNoSplit) Touched.Clear (); Colinear.Clear (); - while (i != DWORD_MAX) + while (i != UINT_MAX) { const FPrivSeg *test = &Segs[i]; @@ -756,13 +756,13 @@ void FNodeBuilder::SplitSegs (uint32_t set, node_t &node, uint32_t splitseg, uin { unsigned int _count0 = 0; unsigned int _count1 = 0; - outset0 = DWORD_MAX; - outset1 = DWORD_MAX; + outset0 = UINT_MAX; + outset1 = UINT_MAX; Events.DeleteAll (); SplitSharers.Clear (); - while (set != DWORD_MAX) + while (set != UINT_MAX) { bool hack; FPrivSeg *seg = &Segs[set]; @@ -772,7 +772,7 @@ void FNodeBuilder::SplitSegs (uint32_t set, node_t &node, uint32_t splitseg, uin if (HackSeg == set) { - HackSeg = DWORD_MAX; + HackSeg = UINT_MAX; side = 1; sidev[0] = sidev[1] = 0; hack = true; @@ -822,7 +822,7 @@ void FNodeBuilder::SplitSegs (uint32_t set, node_t &node, uint32_t splitseg, uin _count1++; // Also split the seg on the back side - if (Segs[set].partner != DWORD_MAX) + if (Segs[set].partner != UINT_MAX) { int partner1 = Segs[set].partner; int partner2 = SplitSeg(partner1, vertnum, sidev[1]); @@ -884,8 +884,8 @@ void FNodeBuilder::SplitSegs (uint32_t set, node_t &node, uint32_t splitseg, uin { uint32_t newback, newfront; - newback = AddMiniseg (seg->v2, seg->v1, DWORD_MAX, set, splitseg); - if (HackMate == DWORD_MAX) + newback = AddMiniseg (seg->v2, seg->v1, UINT_MAX, set, splitseg); + if (HackMate == UINT_MAX) { newfront = AddMiniseg (Segs[set].v1, Segs[set].v2, newback, set, splitseg); Segs[newfront].next = outset0; @@ -996,7 +996,7 @@ void FNodeBuilder::RemoveSegFromVert1 (uint32_t segnum, int vertnum) uint32_t prev, curr; prev = 0; curr = v->segs; - while (curr != DWORD_MAX && curr != segnum) + while (curr != UINT_MAX && curr != segnum) { prev = curr; curr = Segs[curr].nextforvert; @@ -1021,7 +1021,7 @@ void FNodeBuilder::RemoveSegFromVert2 (uint32_t segnum, int vertnum) uint32_t prev, curr; prev = 0; curr = v->segs2; - while (curr != DWORD_MAX && curr != segnum) + while (curr != UINT_MAX && curr != segnum) { prev = curr; curr = Segs[curr].nextforvert2; @@ -1059,7 +1059,7 @@ double FNodeBuilder::InterceptVector (const node_t &splitter, const FPrivSeg &se void FNodeBuilder::PrintSet (int l, uint32_t set) { Printf (PRINT_LOG, "set %d:\n", l); - for (; set != DWORD_MAX; set = Segs[set].next) + for (; set != UINT_MAX; set = Segs[set].next) { Printf (PRINT_LOG, "\t%u(%d)%c%d(%d,%d)-%d(%d,%d)\n", set, Segs[set].frontsector->sectornum, Segs[set].linedef == -1 ? '+' : ':', diff --git a/src/nodebuild_extract.cpp b/src/nodebuild_extract.cpp index 441275dc6..9714a52c6 100644 --- a/src/nodebuild_extract.cpp +++ b/src/nodebuild_extract.cpp @@ -122,10 +122,10 @@ void FNodeBuilder::Extract (FLevelLocals &theLevel) { outSegs[i] = *(seg_t *)&segs[i]; - if (segs[i].Partner != DWORD_MAX) + if (segs[i].Partner != UINT_MAX) { const uint32_t storedseg = Segs[segs[i].Partner].storedseg; - outSegs[i].PartnerSeg = DWORD_MAX == storedseg ? nullptr : &outSegs[storedseg]; + outSegs[i].PartnerSeg = UINT_MAX == storedseg ? nullptr : &outSegs[storedseg]; } else { @@ -330,7 +330,7 @@ int FNodeBuilder::CloseSubsector (TArray &segs, int subsector, vertex_t { angle_t bestdiff = ANGLE_MAX; FPrivSeg *bestseg = NULL; - uint32_t bestj = DWORD_MAX; + uint32_t bestj = UINT_MAX; j = first; do { @@ -526,6 +526,6 @@ void FNodeBuilder::PushConnectingGLSeg (int subsector, TArray &segs, ve newseg.frontsector = NULL; newseg.linedef = NULL; newseg.sidedef = NULL; - newseg.Partner = DWORD_MAX; + newseg.Partner = UINT_MAX; segs.Push (newseg); } diff --git a/src/nodebuild_gl.cpp b/src/nodebuild_gl.cpp index db9d716ac..d2b987e04 100644 --- a/src/nodebuild_gl.cpp +++ b/src/nodebuild_gl.cpp @@ -56,7 +56,7 @@ double FNodeBuilder::AddIntersection (const node_t &node, int vertex) { static const FEventInfo defaultInfo = { - -1, DWORD_MAX + -1, UINT_MAX }; // Calculate signed distance of intersection vertex from start of splitter. @@ -142,7 +142,7 @@ void FNodeBuilder::FixSplitSharers (const node_t &node) Segs[seg].next = newseg; uint32_t partner = Segs[seg].partner; - if (partner != DWORD_MAX) + if (partner != UINT_MAX) { int endpartner = SplitSeg (partner, event->Info.Vertex, 1); @@ -184,13 +184,13 @@ void FNodeBuilder::AddMinisegs (const node_t &node, uint32_t splitseg, uint32_t // are unclosed, but at least we won't be needlessly creating subsectors in void space. // Unclosed subsectors can be closed trivially once the BSP tree is complete. - 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, event->Info.Vertex)) != DWORD_MAX && - (bseg2 = CheckLoopEnd (-node.dx, -node.dy, prev->Info.Vertex)) != DWORD_MAX) + if ((fseg1 = CheckLoopStart (node.dx, node.dy, prev->Info.Vertex, event->Info.Vertex)) != UINT_MAX && + (bseg1 = CheckLoopStart (-node.dx, -node.dy, event->Info.Vertex, prev->Info.Vertex)) != UINT_MAX && + (fseg2 = CheckLoopEnd (node.dx, node.dy, event->Info.Vertex)) != UINT_MAX && + (bseg2 = CheckLoopEnd (-node.dx, -node.dy, prev->Info.Vertex)) != UINT_MAX) { // 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, UINT_MAX, fseg1, splitseg); Segs[fnseg].next = fset; fset = fnseg; @@ -243,14 +243,14 @@ uint32_t FNodeBuilder::AddMiniseg (int v1, int v2, uint32_t partner, uint32_t se newseg.sidedef = NO_SIDE; newseg.linedef = -1; newseg.loopnum = 0; - newseg.next = DWORD_MAX; + newseg.next = UINT_MAX; newseg.planefront = true; newseg.hashnext = NULL; - newseg.storedseg = DWORD_MAX; + newseg.storedseg = UINT_MAX; newseg.frontsector = NULL; newseg.backsector = NULL; - if (splitseg != DWORD_MAX) + if (splitseg != UINT_MAX) { newseg.planenum = Segs[splitseg].planenum; } @@ -264,16 +264,16 @@ uint32_t FNodeBuilder::AddMiniseg (int v1, int v2, uint32_t partner, uint32_t se newseg.nextforvert = Vertices[v1].segs; newseg.nextforvert2 = Vertices[v2].segs2; newseg.next = seg->next; - if (partner != DWORD_MAX) + if (partner != UINT_MAX) { newseg.partner = partner; } else { - newseg.partner = DWORD_MAX; + newseg.partner = UINT_MAX; } nseg = Segs.Push (newseg); - if (newseg.partner != DWORD_MAX) + if (newseg.partner != UINT_MAX) { Segs[partner].partner = nseg; } @@ -295,8 +295,8 @@ uint32_t FNodeBuilder::CheckLoopStart (fixed_t dx, fixed_t dy, int vertex, int v // to the splitter. segnum = v->segs2; bestang = ANGLE_MAX; - bestseg = DWORD_MAX; - while (segnum != DWORD_MAX) + bestseg = UINT_MAX; + while (segnum != UINT_MAX) { FPrivSeg *seg = &Segs[segnum]; angle_t segAngle = PointToAngle (Vertices[seg->v1].x - v->x, Vertices[seg->v1].y - v->y); @@ -317,25 +317,25 @@ uint32_t FNodeBuilder::CheckLoopStart (fixed_t dx, fixed_t dy, int vertex, int v } segnum = seg->nextforvert2; } - if (bestseg == DWORD_MAX) + if (bestseg == UINT_MAX) { - return DWORD_MAX; + return UINT_MAX; } // Now make sure there are no segs starting at this vertex that form // an even smaller angle to the splitter. segnum = v->segs; - while (segnum != DWORD_MAX) + while (segnum != UINT_MAX) { FPrivSeg *seg = &Segs[segnum]; if (seg->v2 == vertex2) { - return DWORD_MAX; + return UINT_MAX; } angle_t segAngle = PointToAngle (Vertices[seg->v2].x - v->x, Vertices[seg->v2].y - v->y); angle_t diff = splitAngle - segAngle; if (diff < bestang && seg->partner != bestseg) { - return DWORD_MAX; + return UINT_MAX; } segnum = seg->nextforvert; } @@ -354,8 +354,8 @@ uint32_t FNodeBuilder::CheckLoopEnd (fixed_t dx, fixed_t dy, int vertex) // to the splitter. segnum = v->segs; bestang = ANGLE_MAX; - bestseg = DWORD_MAX; - while (segnum != DWORD_MAX) + bestseg = UINT_MAX; + while (segnum != UINT_MAX) { FPrivSeg *seg = &Segs[segnum]; angle_t segAngle = PointToAngle (Vertices[seg->v2].x - v->x, Vertices[seg->v2].y - v->y); @@ -376,21 +376,21 @@ uint32_t FNodeBuilder::CheckLoopEnd (fixed_t dx, fixed_t dy, int vertex) } segnum = seg->nextforvert; } - if (bestseg == DWORD_MAX) + if (bestseg == UINT_MAX) { - return DWORD_MAX; + return UINT_MAX; } // Now make sure there are no segs ending at this vertex that form // an even smaller angle to the splitter. segnum = v->segs2; - while (segnum != DWORD_MAX) + while (segnum != UINT_MAX) { FPrivSeg *seg = &Segs[segnum]; angle_t segAngle = PointToAngle (Vertices[seg->v1].x - v->x, Vertices[seg->v1].y - v->y); angle_t diff = segAngle - splitAngle; if (diff < bestang && seg->partner != bestseg) { - return DWORD_MAX; + return UINT_MAX; } segnum = seg->nextforvert2; } diff --git a/src/nodebuild_utility.cpp b/src/nodebuild_utility.cpp index a6e724ed4..0735c299f 100644 --- a/src/nodebuild_utility.cpp +++ b/src/nodebuild_utility.cpp @@ -152,13 +152,13 @@ int FNodeBuilder::CreateSeg (int linenum, int sidenum) FPrivSeg seg; int segnum; - seg.next = DWORD_MAX; + seg.next = UINT_MAX; seg.loopnum = 0; - seg.partner = DWORD_MAX; + seg.partner = UINT_MAX; seg.hashnext = NULL; seg.planefront = false; - seg.planenum = DWORD_MAX; - seg.storedseg = DWORD_MAX; + seg.planenum = UINT_MAX; + seg.storedseg = UINT_MAX; if (sidenum == 0) { // front @@ -202,13 +202,13 @@ void FNodeBuilder::AddSegs(seg_t *segs, int numsegs) FPrivVert vert; int segnum; - seg.next = DWORD_MAX; + seg.next = UINT_MAX; seg.loopnum = 0; - seg.partner = DWORD_MAX; + seg.partner = UINT_MAX; seg.hashnext = NULL; seg.planefront = false; - seg.planenum = DWORD_MAX; - seg.storedseg = DWORD_MAX; + seg.planenum = UINT_MAX; + seg.storedseg = UINT_MAX; seg.frontsector = segs[i].frontsector; seg.backsector = segs[i].backsector; @@ -239,13 +239,13 @@ void FNodeBuilder::AddPolySegs(FPolySeg *segs, int numsegs) FPrivVert vert; int segnum; - seg.next = DWORD_MAX; + seg.next = UINT_MAX; seg.loopnum = 0; - seg.partner = DWORD_MAX; + seg.partner = UINT_MAX; seg.hashnext = NULL; seg.planefront = false; - seg.planenum = DWORD_MAX; - seg.storedseg = DWORD_MAX; + seg.planenum = UINT_MAX; + seg.storedseg = UINT_MAX; side_t *side = segs[i].wall; assert(side != NULL); @@ -286,7 +286,7 @@ void FNodeBuilder::GroupSegPlanes () seg->hashnext = NULL; } - Segs[Segs.Size()-1].next = DWORD_MAX; + Segs[Segs.Size()-1].next = UINT_MAX; for (i = planenum = 0; i < (int)Segs.Size(); ++i) { @@ -379,7 +379,7 @@ void FNodeBuilder::GroupSegPlanesSimple() pline->dx = Vertices[seg->v2].x - Vertices[seg->v1].x; pline->dy = Vertices[seg->v2].y - Vertices[seg->v1].y; } - Segs.Last().next = DWORD_MAX; + Segs.Last().next = UINT_MAX; PlaneChecked.Reserve((Segs.Size() + 7) / 8); } @@ -497,13 +497,13 @@ int FNodeBuilder::MarkLoop (uint32_t firstseg, int loopnum) Vertices[s1->v1].x>>16, Vertices[s1->v1].y>>16, Vertices[s1->v2].x>>16, Vertices[s1->v2].y>>16)); - uint32_t bestseg = DWORD_MAX; + uint32_t bestseg = UINT_MAX; uint32_t tryseg = Vertices[s1->v2].segs; angle_t bestang = ANGLE_MAX; angle_t ang1 = PointToAngle (Vertices[s1->v2].x - Vertices[s1->v1].x, Vertices[s1->v2].y - Vertices[s1->v1].y); - while (tryseg != DWORD_MAX) + while (tryseg != UINT_MAX) { FPrivSeg *s2 = &Segs[tryseg]; @@ -523,7 +523,7 @@ int FNodeBuilder::MarkLoop (uint32_t firstseg, int loopnum) } seg = bestseg; - } while (seg != DWORD_MAX && Segs[seg].loopnum == 0); + } while (seg != UINT_MAX && Segs[seg].loopnum == 0); return loopnum + 1; } @@ -563,7 +563,7 @@ bool FNodeBuilder::GetPolyExtents (int polynum, fixed_t bbox[4]) vert = Segs[i].v2; i = Vertices[vert].segs; count++; // to prevent endless loops. Stop when this reaches the number of segs. - } while (i != DWORD_MAX && (Vertices[vert].x != start.fixX() || Vertices[vert].y != start.fixY()) && count < Segs.Size()); + } while (i != UINT_MAX && (Vertices[vert].x != start.fixX() || Vertices[vert].y != start.fixY()) && count < Segs.Size()); return true; } @@ -691,8 +691,8 @@ int FNodeBuilder::FVertexMap::InsertVertex (FNodeBuilder::FPrivVert &vert) { int vertnum; - vert.segs = DWORD_MAX; - vert.segs2 = DWORD_MAX; + vert.segs = UINT_MAX; + vert.segs2 = UINT_MAX; vertnum = (int)MyBuilder.Vertices.Push (vert); // If a vertex is near a block boundary, then it will be inserted on @@ -772,7 +772,7 @@ int FNodeBuilder::FVertexMapSimple::SelectVertexClose(FNodeBuilder::FPrivVert &v int FNodeBuilder::FVertexMapSimple::InsertVertex (FNodeBuilder::FPrivVert &vert) { - vert.segs = DWORD_MAX; - vert.segs2 = DWORD_MAX; + vert.segs = UINT_MAX; + vert.segs2 = UINT_MAX; return (int)MyBuilder.Vertices.Push (vert); }