From e3b7b9615ad715718b16a2fd69e944377082c3c3 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Thu, 1 Jun 2017 01:16:36 -0600 Subject: [PATCH] qbsp: fix check for needing PRT2 (unlikely to matter on real maps) --- qbsp/portals.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qbsp/portals.cc b/qbsp/portals.cc index 0e6aab2b..d6189c1c 100644 --- a/qbsp/portals.cc +++ b/qbsp/portals.cc @@ -29,6 +29,7 @@ static int num_visleafs; // leafs the player can be in static int num_visclusters; // clusters of leafs static int iNodesDone; static FILE *PortalFile; +static bool uses_detail; /* ============================================================================== @@ -232,6 +233,7 @@ NumberLeafs_r(node_t *node, int cluster) node->visleafnum = -99; node->viscluster = -99; if (cluster < 0 && node->detail_separator) { + uses_detail = true; cluster = num_visclusters++; node->viscluster = cluster; CountPortals(node); @@ -271,6 +273,7 @@ WritePortalfile(node_t *headnode) num_visleafs = 0; num_visclusters = 0; num_visportals = 0; + uses_detail = false; NumberLeafs_r(headnode, -1); // write the file @@ -282,7 +285,7 @@ WritePortalfile(node_t *headnode) Error("Failed to open %s: %s", options.szBSPName, strerror(errno)); /* If no detail clusters, just use a normal PRT1 format */ - if (num_visclusters == num_visleafs) { + if (!uses_detail) { fprintf(PortalFile, "PRT1\n"); fprintf(PortalFile, "%d\n", num_visleafs); fprintf(PortalFile, "%d\n", num_visportals);