diff --git a/include/qbsp/qbsp.hh b/include/qbsp/qbsp.hh index 69c927e0..0aabd146 100644 --- a/include/qbsp/qbsp.hh +++ b/include/qbsp/qbsp.hh @@ -156,9 +156,6 @@ #define T_EPSILON 0.0002 #define CONTINUOUS_EPSILON 0.0005 -// FIXME: replace with MAX_WORLD_COORD/MIN_WORLD_COORD/WORLD_SIZE -#define BOGUS_RANGE 65536 - // from q3map #define MAX_WORLD_COORD ( 128*1024 ) #define MIN_WORLD_COORD ( -128*1024 ) @@ -372,6 +369,7 @@ public: bool fTestExpand; bool fLeakTest; bool fContentHack; + vec_t worldExtent; options_t() { memset(this, 0, sizeof(options_t)); @@ -391,6 +389,7 @@ public: this->fOldaxis = true; this->maxNodeSize = 1024; this->on_epsilon = 0.0001; + this->worldExtent = 65536; } }; diff --git a/qbsp/brush.cc b/qbsp/brush.cc index bcf6dc74..093980cc 100644 --- a/qbsp/brush.cc +++ b/qbsp/brush.cc @@ -105,7 +105,7 @@ CheckFace(face_t *face) p2 = face->w.points[(i + 1) % face->w.numpoints]; for (j = 0; j < 3; j++) - if (p1[j] > BOGUS_RANGE || p1[j] < -BOGUS_RANGE) + if (p1[j] > options.worldExtent || p1[j] < -options.worldExtent) Error("%s: coordinate out of range (%f)", __func__, p1[j]); /* check the point is on the face plane */ diff --git a/qbsp/qbsp.cc b/qbsp/qbsp.cc index 5f946d4f..6ac736f1 100644 --- a/qbsp/qbsp.cc +++ b/qbsp/qbsp.cc @@ -856,6 +856,13 @@ ParseOptions(char *szOptions) Error("Invalid argument to option %s", szTok); options.on_epsilon= atof(szTok2); szTok = szTok2; + } else if (!Q_strcasecmp(szTok, "worldextent")) { + szTok2 = GetTok(szTok + strlen(szTok) + 1, szEnd); + if (!szTok2) + Error("Invalid argument to option %s", szTok); + options.worldExtent= atof(szTok2); + logprint("Overriding maximum world extents to +/- %f units\n", options.worldExtent); + szTok = szTok2; } else if (!Q_strcasecmp(szTok, "objexport")) { options.fObjExport = true; } else if (!Q_strcasecmp(szTok, "omitdetail")) { diff --git a/qbsp/winding.cc b/qbsp/winding.cc index 060c8dae..1af1d096 100644 --- a/qbsp/winding.cc +++ b/qbsp/winding.cc @@ -38,7 +38,7 @@ BaseWindingForPlane(const qbsp_plane_t *p) winding_t *w; // find the major axis - max = -BOGUS_RANGE; + max = -options.worldExtent; x = -1; for (i = 0; i < 3; i++) { v = fabs(p->normal[i]); @@ -69,8 +69,8 @@ BaseWindingForPlane(const qbsp_plane_t *p) CrossProduct(vup, p->normal, vright); - VectorScale(vup, BOGUS_RANGE, vup); - VectorScale(vright, BOGUS_RANGE, vright); + VectorScale(vup, options.worldExtent, vup); + VectorScale(vright, options.worldExtent, vright); // project a really big axis aligned box onto the plane w = (winding_t *)AllocMem(WINDING, 4, true);