]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_brush.c
due to Mercury's insistance you can disable bobbing by using cl_bobcycle == 0 as...
[xonotic/darkplaces.git] / model_brush.c
index dfc3fa02b7a9f95e00e0ddd601000bde8d6134b0..34e1726a77f76e93faa73c2df3ca77dcf0002b98 100644 (file)
@@ -27,7 +27,7 @@ cvar_t halflifebsp = {0, "halflifebsp", "0"};
 cvar_t r_novis = {0, "r_novis", "0"};
 cvar_t r_miplightmaps = {CVAR_SAVE, "r_miplightmaps", "0"};
 cvar_t r_lightmaprgba = {0, "r_lightmaprgba", "1"};
-cvar_t r_vertexsurfacesthreshold = {CVAR_SAVE, "r_vertexsurfacesthreshold", "48"};
+cvar_t r_vertexsurfacesthreshold = {CVAR_SAVE, "r_vertexsurfacesthreshold", "0"};
 
 /*
 ===============
@@ -1217,10 +1217,6 @@ static void Mod_LoadFaces (lump_t *l)
                out->cached_dlight = true;
                out->cached_ambient = -1000;
                out->cached_lightscalebit = -1000;
-               out->cached_light[0] = -1000;
-               out->cached_light[1] = -1000;
-               out->cached_light[2] = -1000;
-               out->cached_light[3] = -1000;
 
                CalcSurfaceExtents (out);
 
@@ -1641,16 +1637,11 @@ static void Mod_LoadPlanes (lump_t *l)
 typedef struct
 {
        int numpoints;
+       int padding;
        double points[8][3]; // variable sized
 }
 winding_t;
 
-typedef struct
-{
-       int numpoints;
-}
-windingsizeof_t;
-
 /*
 ==================
 NewWinding
@@ -1662,9 +1653,9 @@ static winding_t *NewWinding (int points)
        int size;
 
        if (points > MAX_POINTS_ON_WINDING)
-               Host_Error("NewWinding: too many points\n");
+               Sys_Error("NewWinding: too many points\n");
 
-       size = sizeof(windingsizeof_t) + sizeof(double[3]) * points;
+       size = sizeof(winding_t) + sizeof(double[3]) * (points - 8);
        w = Mem_Alloc(loadmodel->mempool, size);
        memset (w, 0, size);
 
@@ -1736,9 +1727,6 @@ static winding_t *ClipWinding (winding_t *in, mplane_t *split, int keepon)
        winding_t       *neww;
        int             maxpts;
 
-       // debugging
-       Mem_CheckSentinels(in);
-
        counts[SIDE_FRONT] = counts[SIDE_BACK] = counts[SIDE_ON] = 0;
 
        // determine sides for each point
@@ -1768,12 +1756,15 @@ static winding_t *ClipWinding (winding_t *in, mplane_t *split, int keepon)
                return in;
 
        maxpts = in->numpoints+4;       // can't use counts[0]+2 because of fp grouping errors
+       if (maxpts > MAX_POINTS_ON_WINDING)
+               Sys_Error ("ClipWinding: maxpts > MAX_POINTS_ON_WINDING");
+
        neww = NewWinding (maxpts);
 
        for (i = 0;i < in->numpoints;i++)
        {
                if (neww->numpoints >= maxpts)
-                       Host_Error ("ClipWinding: points exceeded estimate");
+                       Sys_Error ("ClipWinding: points exceeded estimate");
 
                p1 = in->points[i];
 
@@ -1815,7 +1806,7 @@ static winding_t *ClipWinding (winding_t *in, mplane_t *split, int keepon)
        FreeWinding (in);
 
        // debugging
-       Mem_CheckSentinels(neww);
+       //Mem_CheckSentinels(neww);
 
        return neww;
 }
@@ -1843,9 +1834,6 @@ static void DivideWinding (winding_t *in, mplane_t *split, winding_t **front, wi
        winding_t       *f, *b;
        int             maxpts;
 
-       // debugging
-       Mem_CheckSentinels(in);
-
        counts[SIDE_FRONT] = counts[SIDE_BACK] = counts[SIDE_ON] = 0;
 
        // determine sides for each point
@@ -1877,13 +1865,16 @@ static void DivideWinding (winding_t *in, mplane_t *split, winding_t **front, wi
 
        maxpts = in->numpoints+4;       // can't use counts[0]+2 because of fp grouping errors
 
+       if (maxpts > MAX_POINTS_ON_WINDING)
+               Sys_Error ("ClipWinding: maxpts > MAX_POINTS_ON_WINDING");
+
        *front = f = NewWinding (maxpts);
        *back = b = NewWinding (maxpts);
 
        for (i = 0;i < in->numpoints;i++)
        {
                if (f->numpoints >= maxpts || b->numpoints >= maxpts)
-                       Host_Error ("DivideWinding: points exceeded estimate");
+                       Sys_Error ("DivideWinding: points exceeded estimate");
 
                p1 = in->points[i];
 
@@ -1931,8 +1922,8 @@ static void DivideWinding (winding_t *in, mplane_t *split, winding_t **front, wi
        }
 
        // debugging
-       Mem_CheckSentinels(front);
-       Mem_CheckSentinels(back);
+       //Mem_CheckSentinels(f);
+       //Mem_CheckSentinels(b);
 }
 
 typedef struct portal_s
@@ -1993,6 +1984,8 @@ static void Mod_FinalizePortals(void)
        mleaf_t *leaf, *endleaf;
        winding_t *w;
 
+       //Mem_CheckSentinelsGlobal();
+
        // recalculate bounding boxes for all leafs (because qbsp is very sloppy)
        leaf = loadmodel->leafs;
        endleaf = leaf + loadmodel->numleafs;
@@ -2026,6 +2019,8 @@ static void Mod_FinalizePortals(void)
 
        Mod_RecursiveRecalcNodeBBox(loadmodel->nodes);
 
+       //Mem_CheckSentinelsGlobal();
+
        // tally up portal and point counts
        p = portalchain;
        numportals = 0;
@@ -2116,6 +2111,8 @@ static void Mod_FinalizePortals(void)
                FreePortal(p);
                p = pnext;
        }
+
+       //Mem_CheckSentinelsGlobal();
 }
 
 /*
@@ -2218,6 +2215,7 @@ static void Mod_RecursiveNodePortals (mnode_t *node)
        nodeportal->plane = *node->plane;
 
        nodeportalwinding = BaseWindingForPlane (node->plane);
+       //Mem_CheckSentinels(nodeportalwinding);
        side = 0;       // shut up compiler warning
        for (portal = (portal_t *)node->portals;portal;portal = portal->next[side])
        {