]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/common/polylib.c
ported over the 1.5 branch version of q3map2 which is newer
[xonotic/netradiant.git] / tools / quake3 / common / polylib.c
index 187b1e70285ed0fc2f871fd1d2d0c4b02a4d94c3..75caec6bcd4c93046bbc167994427131abf12d9c 100644 (file)
@@ -249,8 +249,11 @@ winding_t *BaseWindingForPlane (vec3_t normal, vec_t dist)
        
        CrossProduct (vup, normal, vright);
        
-       VectorScale (vup, MAX_WORLD_COORD, vup);
-       VectorScale (vright, MAX_WORLD_COORD, vright);
+       // LordHavoc: this has to use *2 because otherwise some created points may
+       // be inside the world (think of a diagonal case), and any brush with such
+       // points should be removed, failure to detect such cases is disasterous
+       VectorScale (vup, MAX_WORLD_COORD*2, vup);
+       VectorScale (vright, MAX_WORLD_COORD*2, vright);
 
   // project a really big      axis aligned box onto the plane
        w = AllocWinding (4);
@@ -283,7 +286,7 @@ winding_t   *CopyWinding (winding_t *w)
        winding_t       *c;
 
        c = AllocWinding (w->numpoints);
-       size = (int)((winding_t *)0)->p[w->numpoints];
+       size = (int)((size_t)((winding_t *)0)->p[w->numpoints]);
        memcpy (c, w, size);
        return c;
 }