mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 07:12:02 +00:00
Restore nodebuilder files to their previous versions
- For easy comparison, changes between the built-in nodebuilder and ZDBSP must be kept to a minimum.
This commit is contained in:
parent
1a6bbcc206
commit
2d7592c2c3
3 changed files with 11 additions and 4 deletions
|
@ -937,10 +937,13 @@ void FNodeBuilder::SetNodeFromSeg (node_t &node, const FPrivSeg *pseg) const
|
||||||
|
|
||||||
DWORD FNodeBuilder::SplitSeg (DWORD segnum, int splitvert, int v1InFront)
|
DWORD FNodeBuilder::SplitSeg (DWORD segnum, int splitvert, int v1InFront)
|
||||||
{
|
{
|
||||||
|
double dx, dy;
|
||||||
FPrivSeg newseg;
|
FPrivSeg newseg;
|
||||||
int newnum = (int)Segs.Size();
|
int newnum = (int)Segs.Size();
|
||||||
|
|
||||||
newseg = Segs[segnum];
|
newseg = Segs[segnum];
|
||||||
|
dx = double(Vertices[splitvert].x - Vertices[newseg.v1].x);
|
||||||
|
dy = double(Vertices[splitvert].y - Vertices[newseg.v1].y);
|
||||||
if (v1InFront > 0)
|
if (v1InFront > 0)
|
||||||
{
|
{
|
||||||
newseg.v1 = splitvert;
|
newseg.v1 = splitvert;
|
||||||
|
@ -1126,7 +1129,8 @@ int ClassifyLineBackpatchC (node_t &node, const FSimpleVert *v1, const FSimpleVe
|
||||||
long pagesize = sysconf(_SC_PAGESIZE);
|
long pagesize = sysconf(_SC_PAGESIZE);
|
||||||
char *callerpage = (char *)((intptr_t)calleroffset & ~(pagesize - 1));
|
char *callerpage = (char *)((intptr_t)calleroffset & ~(pagesize - 1));
|
||||||
size_t protectlen = (intptr_t)calleroffset + sizeof(void*) - (intptr_t)callerpage;
|
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
|
#endif
|
||||||
{
|
{
|
||||||
*calleroffset = diff;
|
*calleroffset = diff;
|
||||||
|
|
|
@ -317,6 +317,7 @@ int FNodeBuilder::CloseSubsector (TArray<glseg_t> &segs, int subsector, vertex_t
|
||||||
{
|
{
|
||||||
angle_t bestdiff = ANGLE_MAX;
|
angle_t bestdiff = ANGLE_MAX;
|
||||||
FPrivSeg *bestseg = NULL;
|
FPrivSeg *bestseg = NULL;
|
||||||
|
DWORD bestj = DWORD_MAX;
|
||||||
j = first;
|
j = first;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
@ -327,12 +328,14 @@ int FNodeBuilder::CloseSubsector (TArray<glseg_t> &segs, int subsector, vertex_t
|
||||||
{
|
{
|
||||||
bestdiff = diff;
|
bestdiff = diff;
|
||||||
bestseg = seg;
|
bestseg = seg;
|
||||||
|
bestj = j;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (diff < bestdiff && diff > 0)
|
if (diff < bestdiff && diff > 0)
|
||||||
{
|
{
|
||||||
bestdiff = diff;
|
bestdiff = diff;
|
||||||
bestseg = seg;
|
bestseg = seg;
|
||||||
|
bestj = j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (++j < max);
|
while (++j < max);
|
||||||
|
|
|
@ -176,7 +176,7 @@ void FNodeBuilder::AddMinisegs (const node_t &node, DWORD splitseg, DWORD &fset,
|
||||||
{
|
{
|
||||||
if (prev != NULL)
|
if (prev != NULL)
|
||||||
{
|
{
|
||||||
DWORD fseg1, bseg1;
|
DWORD fseg1, bseg1, fseg2, bseg2;
|
||||||
DWORD fnseg, bnseg;
|
DWORD fnseg, bnseg;
|
||||||
|
|
||||||
// Minisegs should only be added when they can create valid loops on both the front and
|
// 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 &&
|
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 &&
|
||||||
(CheckLoopEnd (node.dx, node.dy, event->Info.Vertex)) != DWORD_MAX &&
|
(fseg2 = CheckLoopEnd (node.dx, node.dy, event->Info.Vertex)) != DWORD_MAX &&
|
||||||
(CheckLoopEnd (-node.dx, -node.dy, 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);
|
||||||
|
|
Loading…
Reference in a new issue