mirror of
https://github.com/ZDoom/gzdoom-last-svn.git
synced 2025-06-02 10:11:31 +00:00
* Updated to ZDoom 3982:
- Fixed: The map loader did not check for the new node formats. - Added support for loading ZGL3/XGL3 nodes. - Added additional debug spew for the nodebuilder. - Restored the nodebuilder's debug spew that was present in ZDBSP but not the internal version. git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@1483 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
parent
0c7216007d
commit
f433b6edfc
9 changed files with 94 additions and 25 deletions
|
@ -243,12 +243,16 @@ void FNodeBuilder::CreateSubsectorsForReal ()
|
||||||
D(Printf (PRINT_LOG, "Output subsector %d:\n", Subsectors.Size()));
|
D(Printf (PRINT_LOG, "Output subsector %d:\n", Subsectors.Size()));
|
||||||
for (unsigned int i = firstline; i < SegList.Size(); ++i)
|
for (unsigned int i = firstline; i < SegList.Size(); ++i)
|
||||||
{
|
{
|
||||||
D(Printf (PRINT_LOG, " Seg %5d%c(%5d,%5d)-(%5d,%5d)\n", SegList[i].SegPtr - &Segs[0],
|
D(Printf (PRINT_LOG, " Seg %5d%c%d(%5d,%5d)-%d(%5d,%5d) [%08x,%08x]-[%08x,%08x]\n", SegList[i].SegPtr - &Segs[0],
|
||||||
SegList[i].SegPtr->linedef == -1 ? '+' : ' ',
|
SegList[i].SegPtr->linedef == -1 ? '+' : ' ',
|
||||||
|
SegList[i].SegPtr->v1,
|
||||||
Vertices[SegList[i].SegPtr->v1].x>>16,
|
Vertices[SegList[i].SegPtr->v1].x>>16,
|
||||||
Vertices[SegList[i].SegPtr->v1].y>>16,
|
Vertices[SegList[i].SegPtr->v1].y>>16,
|
||||||
|
SegList[i].SegPtr->v2,
|
||||||
Vertices[SegList[i].SegPtr->v2].x>>16,
|
Vertices[SegList[i].SegPtr->v2].x>>16,
|
||||||
Vertices[SegList[i].SegPtr->v2].y>>16));
|
Vertices[SegList[i].SegPtr->v2].y>>16,
|
||||||
|
Vertices[SegList[i].SegPtr->v1].x, Vertices[SegList[i].SegPtr->v1].y,
|
||||||
|
Vertices[SegList[i].SegPtr->v2].x, Vertices[SegList[i].SegPtr->v2].y));
|
||||||
SegList[i].SegNum = DWORD(SegList[i].SegPtr - &Segs[0]);
|
SegList[i].SegNum = DWORD(SegList[i].SegPtr - &Segs[0]);
|
||||||
}
|
}
|
||||||
Subsectors.Push (sub);
|
Subsectors.Push (sub);
|
||||||
|
@ -330,7 +334,8 @@ bool FNodeBuilder::CheckSubsector (DWORD set, node_t &node, DWORD &splitseg)
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
D(Printf (PRINT_LOG, " - seg %d(%d,%d)-(%d,%d) line %d front %d back %d\n", seg,
|
D(Printf (PRINT_LOG, " - seg %d%c(%d,%d)-(%d,%d) line %d front %d back %d\n", seg,
|
||||||
|
Segs[seg].linedef == -1 ? '+' : ' ',
|
||||||
Vertices[Segs[seg].v1].x>>16, Vertices[Segs[seg].v1].y>>16,
|
Vertices[Segs[seg].v1].x>>16, Vertices[Segs[seg].v1].y>>16,
|
||||||
Vertices[Segs[seg].v2].x>>16, Vertices[Segs[seg].v2].y>>16,
|
Vertices[Segs[seg].v2].x>>16, Vertices[Segs[seg].v2].y>>16,
|
||||||
Segs[seg].linedef,
|
Segs[seg].linedef,
|
||||||
|
|
|
@ -34,6 +34,8 @@ public:
|
||||||
FEvent *FindEvent (double distance) const;
|
FEvent *FindEvent (double distance) const;
|
||||||
void DeleteAll ();
|
void DeleteAll ();
|
||||||
|
|
||||||
|
void PrintTree () const { PrintTree (Root); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FEvent Nil;
|
FEvent Nil;
|
||||||
FEvent *Root;
|
FEvent *Root;
|
||||||
|
@ -42,6 +44,8 @@ private:
|
||||||
void DeletionTraverser (FEvent *event);
|
void DeletionTraverser (FEvent *event);
|
||||||
FEvent *Successor (FEvent *event) const;
|
FEvent *Successor (FEvent *event) const;
|
||||||
FEvent *Predecessor (FEvent *event) const;
|
FEvent *Predecessor (FEvent *event) const;
|
||||||
|
|
||||||
|
void PrintTree (const FEvent *event) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FSimpleVert
|
struct FSimpleVert
|
||||||
|
|
|
@ -210,3 +210,17 @@ FEvent *FEventTree::GetMinimum ()
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FEventTree::PrintTree (const FEvent *event) const
|
||||||
|
{
|
||||||
|
// Use the CRT's sprintf so that it shares the same formatting as ZDBSP's output.
|
||||||
|
char buff[100];
|
||||||
|
if (event != &Nil)
|
||||||
|
{
|
||||||
|
PrintTree(event->Left);
|
||||||
|
sprintf(buff, " Distance %g, vertex %d, seg %u\n",
|
||||||
|
sqrt(event->Distance/4294967296.0), event->Info.Vertex, (unsigned)event->Info.FrontSeg);
|
||||||
|
Printf(PRINT_LOG, "%s", buff);
|
||||||
|
PrintTree(event->Right);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -78,7 +78,8 @@ void FNodeBuilder::Extract (node_t *&outNodes, int &nodeCount,
|
||||||
memcpy (outNodes, &Nodes[0], nodeCount*sizeof(node_t));
|
memcpy (outNodes, &Nodes[0], nodeCount*sizeof(node_t));
|
||||||
for (i = 0; i < nodeCount; ++i)
|
for (i = 0; i < nodeCount; ++i)
|
||||||
{
|
{
|
||||||
D(Printf(PRINT_LOG, "Node %d:\n", i));
|
D(Printf(PRINT_LOG, "Node %d: Splitter[%08x,%08x] [%08x,%08x]\n", i,
|
||||||
|
outNodes[i].x, outNodes[i].y, outNodes[i].dx, outNodes[i].dy));
|
||||||
// Go backwards because on 64-bit systems, both of the intchildren are
|
// Go backwards because on 64-bit systems, both of the intchildren are
|
||||||
// inside the first in-game child.
|
// inside the first in-game child.
|
||||||
for (int j = 1; j >= 0; --j)
|
for (int j = 1; j >= 0; --j)
|
||||||
|
@ -296,12 +297,14 @@ int FNodeBuilder::CloseSubsector (TArray<glseg_t> &segs, int subsector, vertex_t
|
||||||
{
|
{
|
||||||
seg = &Segs[SegList[j].SegNum];
|
seg = &Segs[SegList[j].SegNum];
|
||||||
angle_t ang = PointToAngle (Vertices[seg->v1].x - midx, Vertices[seg->v1].y - midy);
|
angle_t ang = PointToAngle (Vertices[seg->v1].x - midx, Vertices[seg->v1].y - midy);
|
||||||
Printf(PRINT_LOG, "%d%c %5d(%5d,%5d)->%5d(%5d,%5d) - %3.3f %d,%d\n", j,
|
Printf(PRINT_LOG, "%d%c %5d(%5d,%5d)->%5d(%5d,%5d) - %3.5f %d,%d [%08x,%08x]-[%08x,%08x]\n", j,
|
||||||
seg->linedef == -1 ? '+' : ':',
|
seg->linedef == -1 ? '+' : ':',
|
||||||
seg->v1, Vertices[seg->v1].x>>16, Vertices[seg->v1].y>>16,
|
seg->v1, Vertices[seg->v1].x>>16, Vertices[seg->v1].y>>16,
|
||||||
seg->v2, Vertices[seg->v2].x>>16, Vertices[seg->v2].y>>16,
|
seg->v2, Vertices[seg->v2].x>>16, Vertices[seg->v2].y>>16,
|
||||||
double(ang/2)*180/(1<<30),
|
double(ang/2)*180/(1<<30),
|
||||||
seg->planenum, seg->planefront);
|
seg->planenum, seg->planefront,
|
||||||
|
Vertices[seg->v1].x, Vertices[seg->v1].y,
|
||||||
|
Vertices[seg->v2].x, Vertices[seg->v2].y);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -395,12 +398,16 @@ int FNodeBuilder::CloseSubsector (TArray<glseg_t> &segs, int subsector, vertex_t
|
||||||
Printf(PRINT_LOG, "Output GL subsector %d:\n", subsector);
|
Printf(PRINT_LOG, "Output GL subsector %d:\n", subsector);
|
||||||
for (i = segs.Size() - count; i < (int)segs.Size(); ++i)
|
for (i = segs.Size() - count; i < (int)segs.Size(); ++i)
|
||||||
{
|
{
|
||||||
Printf(PRINT_LOG, " Seg %5d%c(%5d,%5d)-(%5d,%5d)\n", i,
|
Printf(PRINT_LOG, " Seg %5d%c(%5d,%5d)-(%5d,%5d) [%08x,%08x]-[%08x,%08x]\n", i,
|
||||||
segs[i].linedef == NULL ? '+' : ' ',
|
segs[i].linedef == NULL ? '+' : ' ',
|
||||||
segs[i].v1->x>>16,
|
segs[i].v1->x>>16,
|
||||||
segs[i].v1->y>>16,
|
segs[i].v1->y>>16,
|
||||||
segs[i].v2->x>>16,
|
segs[i].v2->x>>16,
|
||||||
segs[i].v2->y>>16);
|
segs[i].v2->y>>16,
|
||||||
|
segs[i].v1->x,
|
||||||
|
segs[i].v1->y,
|
||||||
|
segs[i].v2->x,
|
||||||
|
segs[i].v2->y);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,8 @@ double FNodeBuilder::AddIntersection (const node_t &node, int vertex)
|
||||||
// seg information will be messed up in the generated tree.
|
// seg information will be messed up in the generated tree.
|
||||||
void FNodeBuilder::FixSplitSharers (const node_t &node)
|
void FNodeBuilder::FixSplitSharers (const node_t &node)
|
||||||
{
|
{
|
||||||
|
D(Printf(PRINT_LOG, "events:\n"));
|
||||||
|
D(Events.PrintTree());
|
||||||
for (unsigned int i = 0; i < SplitSharers.Size(); ++i)
|
for (unsigned int i = 0; i < SplitSharers.Size(); ++i)
|
||||||
{
|
{
|
||||||
DWORD seg = SplitSharers[i].Seg;
|
DWORD seg = SplitSharers[i].Seg;
|
||||||
|
@ -95,6 +97,18 @@ void FNodeBuilder::FixSplitSharers (const node_t &node)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use the CRT's printf so the formatting matches ZDBSP's
|
||||||
|
D(char buff[200]);
|
||||||
|
D(sprintf(buff, "Considering events on seg %d(%d[%d,%d]->%d[%d,%d]) [%g:%g]\n", seg,
|
||||||
|
Segs[seg].v1,
|
||||||
|
Vertices[Segs[seg].v1].x>>16,
|
||||||
|
Vertices[Segs[seg].v1].y>>16,
|
||||||
|
Segs[seg].v2,
|
||||||
|
Vertices[Segs[seg].v2].x>>16,
|
||||||
|
Vertices[Segs[seg].v2].y>>16,
|
||||||
|
SplitSharers[i].Distance, event->Distance));
|
||||||
|
D(Printf(PRINT_LOG, "%s", buff));
|
||||||
|
|
||||||
if (SplitSharers[i].Forward)
|
if (SplitSharers[i].Forward)
|
||||||
{
|
{
|
||||||
event = Events.GetSuccessor (event);
|
event = Events.GetSuccessor (event);
|
||||||
|
|
|
@ -185,6 +185,9 @@ int FNodeBuilder::CreateSeg (int linenum, int sidenum)
|
||||||
segnum = (int)Segs.Push (seg);
|
segnum = (int)Segs.Push (seg);
|
||||||
Vertices[seg.v1].segs = segnum;
|
Vertices[seg.v1].segs = segnum;
|
||||||
Vertices[seg.v2].segs2 = segnum;
|
Vertices[seg.v2].segs2 = segnum;
|
||||||
|
D(Printf(PRINT_LOG, "Seg %4d: From line %d, side %s (%5d,%5d)-(%5d,%5d) [%08x,%08x]-[%08x,%08x]\n", segnum, linenum, sidenum ? "back " : "front",
|
||||||
|
Vertices[seg.v1].x>>16, Vertices[seg.v1].y>>16, Vertices[seg.v2].x>>16, Vertices[seg.v2].y>>16,
|
||||||
|
Vertices[seg.v1].x, Vertices[seg.v1].y, Vertices[seg.v2].x, Vertices[seg.v2].y));
|
||||||
|
|
||||||
return segnum;
|
return segnum;
|
||||||
}
|
}
|
||||||
|
|
|
@ -853,15 +853,18 @@ bool P_LoadGLNodes(MapData * map)
|
||||||
{
|
{
|
||||||
if (map->MapLumps[ML_GLZNODES].Reader && map->MapLumps[ML_GLZNODES].Reader->GetLength() != 0)
|
if (map->MapLumps[ML_GLZNODES].Reader && map->MapLumps[ML_GLZNODES].Reader->GetLength() != 0)
|
||||||
{
|
{
|
||||||
const int idcheck = MAKE_ID('Z','G','L','N');
|
const int idcheck1a = MAKE_ID('Z','G','L','N');
|
||||||
const int idcheck2 = MAKE_ID('Z','G','L','2');
|
const int idcheck2a = MAKE_ID('Z','G','L','2');
|
||||||
const int idcheck3 = MAKE_ID('X','G','L','N');
|
const int idcheck3a = MAKE_ID('Z','G','L','3');
|
||||||
const int idcheck4 = MAKE_ID('X','G','L','2');
|
const int idcheck1b = MAKE_ID('X','G','L','N');
|
||||||
|
const int idcheck2b = MAKE_ID('X','G','L','2');
|
||||||
|
const int idcheck3b = MAKE_ID('X','G','L','3');
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
map->Seek(ML_GLZNODES);
|
map->Seek(ML_GLZNODES);
|
||||||
map->file->Read (&id, 4);
|
map->file->Read (&id, 4);
|
||||||
if (id == idcheck || id == idcheck2 || id == idcheck3 || id == idcheck4)
|
if (id == idcheck1a || id == idcheck2a || id == idcheck3a ||
|
||||||
|
id == idcheck1b || id == idcheck2b || id == idcheck3b)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -892,7 +892,7 @@ void P_LoadGLZSegs (FileReaderBase &data, int type)
|
||||||
BYTE side;
|
BYTE side;
|
||||||
|
|
||||||
data >> v1 >> partner;
|
data >> v1 >> partner;
|
||||||
if (type == 2)
|
if (type >= 2)
|
||||||
{
|
{
|
||||||
data >> line;
|
data >> line;
|
||||||
}
|
}
|
||||||
|
@ -1045,13 +1045,20 @@ void LoadZNodes(FileReaderBase &data, int glnodes)
|
||||||
|
|
||||||
for (i = 0; i < numNodes; ++i)
|
for (i = 0; i < numNodes; ++i)
|
||||||
{
|
{
|
||||||
SWORD x, y, dx, dy;
|
if (glnodes < 3)
|
||||||
|
{
|
||||||
|
SWORD x, y, dx, dy;
|
||||||
|
|
||||||
data >> x >> y >> dx >> dy;
|
data >> x >> y >> dx >> dy;
|
||||||
nodes[i].x = x << FRACBITS;
|
nodes[i].x = x << FRACBITS;
|
||||||
nodes[i].y = y << FRACBITS;
|
nodes[i].y = y << FRACBITS;
|
||||||
nodes[i].dx = dx << FRACBITS;
|
nodes[i].dx = dx << FRACBITS;
|
||||||
nodes[i].dy = dy << FRACBITS;
|
nodes[i].dy = dy << FRACBITS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data >> nodes[i].x >> nodes[i].y >> nodes[i].dx >> nodes[i].dy;
|
||||||
|
}
|
||||||
for (int j = 0; j < 2; ++j)
|
for (int j = 0; j < 2; ++j)
|
||||||
{
|
{
|
||||||
for (int k = 0; k < 4; ++k)
|
for (int k = 0; k < 4; ++k)
|
||||||
|
@ -1100,6 +1107,11 @@ void P_LoadZNodes (FileReader &dalump, DWORD id)
|
||||||
compressed = true;
|
compressed = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MAKE_ID('Z','G','L','3'):
|
||||||
|
type = 3;
|
||||||
|
compressed = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case MAKE_ID('X','N','O','D'):
|
case MAKE_ID('X','N','O','D'):
|
||||||
type = 0;
|
type = 0;
|
||||||
compressed = false;
|
compressed = false;
|
||||||
|
@ -1115,6 +1127,11 @@ void P_LoadZNodes (FileReader &dalump, DWORD id)
|
||||||
compressed = false;
|
compressed = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MAKE_ID('X','G','L','3'):
|
||||||
|
type = 3;
|
||||||
|
compressed = false;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3680,7 +3697,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, idcheck2 = 0, idcheck3 = 0, idcheck4 = 0;
|
DWORD id = MAKE_ID('X','x','X','x'), idcheck = 0, idcheck2 = 0, idcheck3 = 0, idcheck4 = 0, idcheck5 = 0, idcheck6 = 0;
|
||||||
|
|
||||||
if (map->Size(ML_ZNODES) != 0)
|
if (map->Size(ML_ZNODES) != 0)
|
||||||
{
|
{
|
||||||
|
@ -3694,12 +3711,14 @@ void P_SetupLevel (char *lumpname, int position)
|
||||||
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');
|
idcheck2 = MAKE_ID('Z','G','L','2');
|
||||||
idcheck3 = MAKE_ID('X','G','L','N');
|
idcheck3 = MAKE_ID('Z','G','L','3');
|
||||||
idcheck4 = MAKE_ID('X','G','L','2');
|
idcheck4 = MAKE_ID('X','G','L','N');
|
||||||
|
idcheck5 = MAKE_ID('X','G','L','2');
|
||||||
|
idcheck6 = MAKE_ID('X','G','L','3');
|
||||||
}
|
}
|
||||||
|
|
||||||
map->file->Read (&id, 4);
|
map->file->Read (&id, 4);
|
||||||
if (id != 0 && (id == idcheck || id == idcheck2 || id == idcheck3 || id == idcheck4))
|
if (id != 0 && (id == idcheck || id == idcheck2 || id == idcheck3 || id == idcheck4 || id == idcheck5 || id == idcheck6))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
// This file was automatically generated by the
|
// This file was automatically generated by the
|
||||||
// updaterevision tool. Do not edit by hand.
|
// updaterevision tool. Do not edit by hand.
|
||||||
|
|
||||||
#define ZD_SVN_REVISION_STRING "3978"
|
#define ZD_SVN_REVISION_STRING "3982"
|
||||||
#define ZD_SVN_REVISION_NUMBER 3978
|
#define ZD_SVN_REVISION_NUMBER 3978
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue