]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
deal with colbrushf == NULL cases in Mod_MakeCollisionBIH
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 17 Feb 2010 18:27:58 +0000 (18:27 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 17 Feb 2010 18:27:58 +0000 (18:27 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9970 d7cf8633-e32d-0410-b094-e92efae38249

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;