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
/*
===================
return Mod_DecompressVis (leaf->compressed_vis, model);
}
-byte *mod_base;
+extern byte *mod_base;
extern cvar_t r_fullbrights;
byte d;
char litfilename[1024];
loadmodel->lightdata = NULL;
- if (!l->filelen)
- return;
if (hlbsp) // LordHavoc: load the colored lighting data straight
{
loadmodel->lightdata = Hunk_AllocName ( l->filelen, loadname);
i = LittleLong(((int *)data)[1]);
if (i == 1)
{
+ Con_DPrintf("%s loaded", litfilename);
loadmodel->lightdata = data + 8;
return;
}
Con_Printf("Corrupt .lit file (old version?), ignoring\n");
}
// LordHavoc: oh well, expand the white lighting data
+ if (!l->filelen)
+ return;
loadmodel->lightdata = Hunk_AllocName ( l->filelen*3, litfilename);
in = loadmodel->lightdata + l->filelen*2; // place the file at the end, so it will not be overwritten until the very last write
out = loadmodel->lightdata;
loadmodel->clipnodes = out;
loadmodel->numclipnodes = count;
- hull = &loadmodel->hulls[1];
- hull->clipnodes = out;
- hull->firstclipnode = 0;
- hull->lastclipnode = count-1;
- hull->planes = loadmodel->planes;
- hull->clip_mins[0] = -16;
- hull->clip_mins[1] = -16;
- hull->clip_mins[2] = -24;
- hull->clip_maxs[0] = 16;
- hull->clip_maxs[1] = 16;
- hull->clip_maxs[2] = 32;
-
- hull = &loadmodel->hulls[2];
- hull->clipnodes = out;
- hull->firstclipnode = 0;
- hull->lastclipnode = count-1;
- hull->planes = loadmodel->planes;
- hull->clip_mins[0] = -32;
- hull->clip_mins[1] = -32;
- hull->clip_mins[2] = -24;
- hull->clip_maxs[0] = 32;
- hull->clip_maxs[1] = 32;
- hull->clip_maxs[2] = 64;
+ if (hlbsp)
+ {
+ hull = &loadmodel->hulls[1];
+ hull->clipnodes = out;
+ hull->firstclipnode = 0;
+ hull->lastclipnode = count-1;
+ hull->planes = loadmodel->planes;
+ hull->clip_mins[0] = -16;
+ hull->clip_mins[1] = -16;
+ hull->clip_mins[2] = -36;
+ hull->clip_maxs[0] = 16;
+ hull->clip_maxs[1] = 16;
+ hull->clip_maxs[2] = 36;
+
+ hull = &loadmodel->hulls[2];
+ hull->clipnodes = out;
+ hull->firstclipnode = 0;
+ hull->lastclipnode = count-1;
+ hull->planes = loadmodel->planes;
+ hull->clip_mins[0] = -32;
+ hull->clip_mins[1] = -32;
+ hull->clip_mins[2] = -32;
+ hull->clip_maxs[0] = 32;
+ hull->clip_maxs[1] = 32;
+ hull->clip_maxs[2] = 32;
+
+ hull = &loadmodel->hulls[3];
+ hull->clipnodes = out;
+ hull->firstclipnode = 0;
+ hull->lastclipnode = count-1;
+ hull->planes = loadmodel->planes;
+ hull->clip_mins[0] = -16;
+ hull->clip_mins[1] = -16;
+ hull->clip_mins[2] = -18;
+ hull->clip_maxs[0] = 16;
+ hull->clip_maxs[1] = 16;
+ hull->clip_maxs[2] = 18;
+ }
+ else
+ {
+ hull = &loadmodel->hulls[1];
+ hull->clipnodes = out;
+ hull->firstclipnode = 0;
+ hull->lastclipnode = count-1;
+ hull->planes = loadmodel->planes;
+ hull->clip_mins[0] = -16;
+ hull->clip_mins[1] = -16;
+ hull->clip_mins[2] = -24;
+ hull->clip_maxs[0] = 16;
+ hull->clip_maxs[1] = 16;
+ hull->clip_maxs[2] = 32;
+
+ hull = &loadmodel->hulls[2];
+ hull->clipnodes = out;
+ hull->firstclipnode = 0;
+ hull->lastclipnode = count-1;
+ hull->planes = loadmodel->planes;
+ hull->clip_mins[0] = -32;
+ hull->clip_mins[1] = -32;
+ hull->clip_mins[2] = -24;
+ hull->clip_maxs[0] = 32;
+ hull->clip_maxs[1] = 32;
+ hull->clip_maxs[2] = 64;
+ }
for (i=0 ; i<count ; i++, out++, in++)
{
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");
}
}
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;