From 2d7592c2c34d5097302846098707b0f8c0418c8e Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sun, 8 Feb 2015 19:49:08 -0600 Subject: [PATCH] Restore nodebuilder files to their previous versions - For easy comparison, changes between the built-in nodebuilder and ZDBSP must be kept to a minimum. --- src/nodebuild.cpp | 6 +++++- src/nodebuild_extract.cpp | 3 +++ src/nodebuild_gl.cpp | 6 +++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/nodebuild.cpp b/src/nodebuild.cpp index 081b42f3e..210f0f3de 100644 --- a/src/nodebuild.cpp +++ b/src/nodebuild.cpp @@ -937,10 +937,13 @@ void FNodeBuilder::SetNodeFromSeg (node_t &node, const FPrivSeg *pseg) const DWORD FNodeBuilder::SplitSeg (DWORD segnum, int splitvert, int v1InFront) { + double dx, dy; FPrivSeg newseg; int newnum = (int)Segs.Size(); newseg = Segs[segnum]; + dx = double(Vertices[splitvert].x - Vertices[newseg.v1].x); + dy = double(Vertices[splitvert].y - Vertices[newseg.v1].y); if (v1InFront > 0) { newseg.v1 = splitvert; @@ -1126,7 +1129,8 @@ int ClassifyLineBackpatchC (node_t &node, const FSimpleVert *v1, const FSimpleVe long pagesize = sysconf(_SC_PAGESIZE); char *callerpage = (char *)((intptr_t)calleroffset & ~(pagesize - 1)); size_t protectlen = (intptr_t)calleroffset + sizeof(void*) - (intptr_t)callerpage; - if (!mprotect(callerpage, protectlen, PROT_READ|PROT_WRITE|PROT_EXEC)) + int ptect; + if (!(ptect = mprotect(callerpage, protectlen, PROT_READ|PROT_WRITE|PROT_EXEC))) #endif { *calleroffset = diff; diff --git a/src/nodebuild_extract.cpp b/src/nodebuild_extract.cpp index 04660f6d0..c0f769873 100644 --- a/src/nodebuild_extract.cpp +++ b/src/nodebuild_extract.cpp @@ -317,6 +317,7 @@ int FNodeBuilder::CloseSubsector (TArray &segs, int subsector, vertex_t { angle_t bestdiff = ANGLE_MAX; FPrivSeg *bestseg = NULL; + DWORD bestj = DWORD_MAX; j = first; do { @@ -327,12 +328,14 @@ int FNodeBuilder::CloseSubsector (TArray &segs, int subsector, vertex_t { bestdiff = diff; bestseg = seg; + bestj = j; break; } if (diff < bestdiff && diff > 0) { bestdiff = diff; bestseg = seg; + bestj = j; } } while (++j < max); diff --git a/src/nodebuild_gl.cpp b/src/nodebuild_gl.cpp index 8853a7eab..d029e7f69 100644 --- a/src/nodebuild_gl.cpp +++ b/src/nodebuild_gl.cpp @@ -176,7 +176,7 @@ void FNodeBuilder::AddMinisegs (const node_t &node, DWORD splitseg, DWORD &fset, { if (prev != NULL) { - DWORD fseg1, bseg1; + DWORD fseg1, bseg1, fseg2, bseg2; DWORD fnseg, bnseg; // Minisegs should only be added when they can create valid loops on both the front and @@ -186,8 +186,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 && - (CheckLoopEnd (node.dx, node.dy, event->Info.Vertex)) != DWORD_MAX && - (CheckLoopEnd (-node.dx, -node.dy, 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);