qbsp: fix check for needing PRT2 (unlikely to matter on real maps)

This commit is contained in:
Eric Wasylishen 2017-06-01 01:16:36 -06:00
parent 213e4b9f7d
commit e3b7b9615a
1 changed files with 4 additions and 1 deletions

View File

@ -29,6 +29,7 @@ static int num_visleafs; // leafs the player can be in
static int num_visclusters; // clusters of leafs static int num_visclusters; // clusters of leafs
static int iNodesDone; static int iNodesDone;
static FILE *PortalFile; static FILE *PortalFile;
static bool uses_detail;
/* /*
============================================================================== ==============================================================================
@ -232,6 +233,7 @@ NumberLeafs_r(node_t *node, int cluster)
node->visleafnum = -99; node->visleafnum = -99;
node->viscluster = -99; node->viscluster = -99;
if (cluster < 0 && node->detail_separator) { if (cluster < 0 && node->detail_separator) {
uses_detail = true;
cluster = num_visclusters++; cluster = num_visclusters++;
node->viscluster = cluster; node->viscluster = cluster;
CountPortals(node); CountPortals(node);
@ -271,6 +273,7 @@ WritePortalfile(node_t *headnode)
num_visleafs = 0; num_visleafs = 0;
num_visclusters = 0; num_visclusters = 0;
num_visportals = 0; num_visportals = 0;
uses_detail = false;
NumberLeafs_r(headnode, -1); NumberLeafs_r(headnode, -1);
// write the file // write the file
@ -282,7 +285,7 @@ WritePortalfile(node_t *headnode)
Error("Failed to open %s: %s", options.szBSPName, strerror(errno)); Error("Failed to open %s: %s", options.szBSPName, strerror(errno));
/* If no detail clusters, just use a normal PRT1 format */ /* If no detail clusters, just use a normal PRT1 format */
if (num_visclusters == num_visleafs) { if (!uses_detail) {
fprintf(PortalFile, "PRT1\n"); fprintf(PortalFile, "PRT1\n");
fprintf(PortalFile, "%d\n", num_visleafs); fprintf(PortalFile, "%d\n", num_visleafs);
fprintf(PortalFile, "%d\n", num_visportals); fprintf(PortalFile, "%d\n", num_visportals);