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.
This commit is contained in:
Bill Currie 2013-03-07 18:51:32 +09:00
parent 0649fd7022
commit dbdfdb6d28
2 changed files with 13 additions and 0 deletions

View file

@ -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

View file

@ -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");
}