]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_brush.c
deal with colbrushf == NULL cases in Mod_MakeCollisionBIH
[xonotic/darkplaces.git] / model_brush.c
index b2ca71d3da367f07248af8da14410aff8a1cb263..d82106349f68764ae0418f2483339071b6a0455e 100644 (file)
@@ -6536,7 +6536,9 @@ void Mod_MakeCollisionBIH(dp_model_t *model, qboolean userendersurfaces)
        }
        else
        {
-               bihnumleafs += model->nummodelbrushes;
+               for (brushindex = 0, brush = model->brush.data_brushes + brushindex+model->firstmodelbrush;brushindex < nummodelbrushes;brushindex++, brush++)
+                       if (brush->colbrushf)
+                               bihnumleafs++;
                for (j = 0, surface = model->data_surfaces + model->firstmodelsurface;j < nummodelsurfaces;j++, surface++)
                        bihnumleafs += surface->num_collisiontriangles;
        }
@@ -6576,6 +6578,8 @@ void Mod_MakeCollisionBIH(dp_model_t *model, qboolean userendersurfaces)
                // add collision brushes
                for (brushindex = 0, brush = model->brush.data_brushes + brushindex+model->firstmodelbrush;brushindex < nummodelbrushes;brushindex++, brush++)
                {
+                       if (!brush->colbrushf)
+                               continue;
                        bihleafs[bihleafindex].type = BIH_LEAF;
                        bihleafs[bihleafindex].textureindex = brush->texture - model->data_textures;
                        bihleafs[bihleafindex].itemindex = brushindex+model->firstmodelbrush;