From dbdfdb6d281ec2b7bf197ed6eb52794c9b201070 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 7 Mar 2013 18:51:32 +0900 Subject: [PATCH] Add support for PRT2 portal files. These seem to be identical to PRT1-AM but with a different count order in the header. Taken from tyrutils-0.5. --- tools/qfvis/include/vis.h | 1 + tools/qfvis/source/qfvis.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/tools/qfvis/include/vis.h b/tools/qfvis/include/vis.h index 92b96a2f2..398c1cd43 100644 --- a/tools/qfvis/include/vis.h +++ b/tools/qfvis/include/vis.h @@ -48,6 +48,7 @@ extern pthread_mutex_t *my_mutex; #define MAX_PORTALS 32768 #define PORTALFILE "PRT1" #define PORTALFILE_AM "PRT1-AM" +#define PORTALFILE2 "PRT2" #define ON_EPSILON 0.1 #define MAX_POINTS_ON_WINDING 64 #define MAX_PORTALS_ON_CLUSTER 128 diff --git a/tools/qfvis/source/qfvis.c b/tools/qfvis/source/qfvis.c index c88bc3b2b..12f7069e0 100644 --- a/tools/qfvis/source/qfvis.c +++ b/tools/qfvis/source/qfvis.c @@ -744,6 +744,18 @@ LoadPortals (char *name) if (!line || sscanf (line, "%i\n", &numrealleafs) != 1) Sys_Error ("LoadPortals: failed to read header"); read_leafs = 1; + } else if (line && (!strcmp (line, PORTALFILE2 "\n") + || !strcmp (line, PORTALFILE2 "\r\n"))) { + line = Qgetline (f); + if (!line || sscanf (line, "%i\n", &numrealleafs) != 1) + Sys_Error ("LoadPortals: failed to read header"); + line = Qgetline (f); + if (!line || sscanf (line, "%i\n", &portalclusters) != 1) + Sys_Error ("LoadPortals: failed to read header"); + line = Qgetline (f); + if (!line || sscanf (line, "%i\n", &numportals) != 1) + Sys_Error ("LoadPortals: failed to read header"); + read_leafs = 1; } else { Sys_Error ("LoadPortals: not a portal file"); }