]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_brush.c
remove never used svc_playerposition code
[xonotic/darkplaces.git] / model_brush.c
index e62b5272bfd0491aa021b5ef6edf59f8ab600660..82c2eb342b88738c392cf90db67890ad04ffd059 100644 (file)
@@ -39,36 +39,7 @@ void Mod_BrushInit (void)
        memset (mod_novis, 0xff, sizeof(mod_novis));
 }
 
-/*
-===============
-Mod_PointInLeaf
-===============
-*/
-mleaf_t *Mod_PointInLeaf (vec3_t p, model_t *model)
-{
-       mnode_t         *node;
-       float           d;
-       mplane_t        *plane;
-       
-       if (!model || !model->nodes)
-               Sys_Error ("Mod_PointInLeaf: bad model");
-
-       node = model->nodes;
-       while (1)
-       {
-               if (node->contents < 0)
-                       return (mleaf_t *)node;
-               plane = node->plane;
-               d = DotProduct (p,plane->normal) - plane->dist;
-               if (d > 0)
-                       node = node->children[0];
-               else
-                       node = node->children[1];
-       }
-       
-       return NULL;    // never reached
-}
-
+// Mod_PointInLeaf moved to cpu_noasm.c
 
 /*
 ===================
@@ -122,7 +93,7 @@ byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model)
        return Mod_DecompressVis (leaf->compressed_vis, model);
 }
 
-byte   *mod_base;
+extern byte    *mod_base;
 
 extern cvar_t r_fullbrights;
 
@@ -597,6 +568,7 @@ void Mod_LoadTexinfo (lump_t *l)
                {
                        out->texture = r_notexture_mip; // checkerboard texture
                        out->flags = 0;
+                       out->texture->transparent = FALSE;
                }
                else
                {
@@ -607,9 +579,8 @@ void Mod_LoadTexinfo (lump_t *l)
                        {
                                out->texture = r_notexture_mip; // texture not found
                                out->flags = 0;
-                       }
-                       else
                                out->texture->transparent = FALSE;
+                       }
                }
        }
 }
@@ -924,6 +895,8 @@ void Mod_LoadClipnodes (lump_t *l)
                out->planenum = LittleLong(in->planenum);
                out->children[0] = LittleShort(in->children[0]);
                out->children[1] = LittleShort(in->children[1]);
+               if (out->children[0] >= count || out->children[1] >= count)
+                       Host_Error("Corrupt clipping hull (out of range child)\n");
        }
 }
 
@@ -1074,7 +1047,7 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer)
        header = (dheader_t *)buffer;
 
        i = LittleLong (header->version);
-       if (i != BSPVERSION & i != 30)
+       if (i != BSPVERSION && i != 30)
                Host_Error ("Mod_LoadBrushModel: %s has wrong version number (%i should be %i or 30 (HalfLife))", mod->name, i, BSPVERSION);
        hlbsp = i == 30;
        halflifebsp.value = hlbsp;