cvar_t gl_subdivide_size = {"gl_subdivide_size", "128", true};
cvar_t halflifebsp = {"halflifebsp", "0"};
+cvar_t r_novis = {"r_novis", "0"};
/*
===============
{
Cvar_RegisterVariable (&gl_subdivide_size);
Cvar_RegisterVariable (&halflifebsp);
+ Cvar_RegisterVariable (&r_novis);
memset (mod_novis, 0xff, sizeof(mod_novis));
}
// Sys_Error ("Mod_PointInLeaf: bad model");
node = model->nodes;
- if (node->contents < 0)
- return (mleaf_t *)node;
- while (1)
- {
+ do
node = node->children[(node->plane->type < 3 ? p[node->plane->type] : DotProduct (p,node->plane->normal)) < node->plane->dist];
- if (node->contents < 0)
- return (mleaf_t *)node;
- }
-
- return NULL; // never reached
+ while (node->contents == 0);
+
+ return (mleaf_t *)node;
}
/*
mleaf_t *Mod_PointInLeaf (vec3_t p, model_t *model)
byte *out;
int row;
- row = (model->numleafs+7)>>3;
+ row = (model->numleafs+7)>>3;
out = decompressed;
+ /*
if (!in)
{ // no vis info, so make all visible
while (row)
}
return decompressed;
}
+ */
do
{
byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model)
{
- if (leaf == model->leafs)
+ if (r_novis.value || leaf == model->leafs || leaf->compressed_vis == NULL)
return mod_novis;
return Mod_DecompressVis (leaf->compressed_vis, model);
}
-extern byte *mod_base;
-
-extern cvar_t r_fullbrights;
-
rtexture_t *r_notexture;
texture_t r_notexture_mip;
-void Mod_SetupNoTexture()
+void Mod_SetupNoTexture(void)
{
int x, y;
byte pix[16][16][4];
for (;j < 16;j++)
tx->name[j] = 0;
+ if (!tx->name[0])
+ {
+ Con_Printf("warning: unnamed texture in %s\n", loadname);
+ sprintf(tx->name, "unnamed%i", i);
+ }
+
tx->transparent = false;
data = loadimagepixels(tx->name, false, 0, 0);
if (data)
memcpy (loadmodel->visdata, mod_base + l->fileofs, l->filelen);
}
-void CL_ParseEntityLump(char *entdata);
-
-extern qboolean isworldmodel;
-
/*
=================
Mod_LoadEntities
void GL_SubdivideSurface (msurface_t *fa);
-extern char skyname[];
-
/*
=================
Mod_LoadFaces
for ( i=0 ; i<count ; i++, in++, out++)
{
- for (j=0 ; j<3 ; j++)
- {
- out->mins[j] = LittleShort (in->mins[j]);
- out->maxs[j] = LittleShort (in->maxs[j]);
- }
+// for (j=0 ; j<3 ; j++)
+// {
+// out->mins[j] = LittleShort (in->mins[j]);
+// out->maxs[j] = LittleShort (in->maxs[j]);
+// }
p = LittleLong(in->planenum);
out->plane = loadmodel->planes + p;
out->compressed_vis = NULL;
else
out->compressed_vis = loadmodel->visdata + p;
-// out->efrags = NULL;
for (j=0 ; j<4 ; j++)
out->ambient_sound_level[j] = in->ambient_level[j];
return p;
}
-void Mod_FinalizePortals()
+void Mod_FinalizePortals(void)
{
int i, j, numportals, numpoints;
portal_t *p, *pnext;
mportal_t *portal;
mvertex_t *point;
+ mleaf_t *leaf, *endleaf;
+ winding_t *w;
+
+ // recalculate bounding boxes for all leafs (because qbsp is very sloppy)
+ leaf = loadmodel->leafs;
+ endleaf = leaf + loadmodel->numleafs;
+ for (;leaf < endleaf;leaf++)
+ {
+ VectorSet( 2000000000, 2000000000, 2000000000, leaf->mins);
+ VectorSet(-2000000000, -2000000000, -2000000000, leaf->maxs);
+ }
+ p = portalchain;
+ while(p)
+ {
+ if (p->winding)
+ {
+ for (i = 0;i < 2;i++)
+ {
+ leaf = (mleaf_t *)p->nodes[i];
+ w = p->winding;
+ for (j = 0;j < w->numpoints;j++)
+ {
+ if (leaf->mins[0] > w->points[j][0]) leaf->mins[0] = w->points[j][0];
+ if (leaf->mins[1] > w->points[j][1]) leaf->mins[1] = w->points[j][1];
+ if (leaf->mins[2] > w->points[j][2]) leaf->mins[2] = w->points[j][2];
+ if (leaf->maxs[0] < w->points[j][0]) leaf->maxs[0] = w->points[j][0];
+ if (leaf->maxs[1] < w->points[j][1]) leaf->maxs[1] = w->points[j][1];
+ if (leaf->maxs[2] < w->points[j][2]) leaf->maxs[2] = w->points[j][2];
+ }
+ }
+ }
+ p = p->chain;
+ }
+
+ // tally up portal and point counts
p = portalchain;
numportals = 0;
numpoints = 0;
{
node = portal->nodes[i];
- portalpointer = &node->portals;
+ portalpointer = (void **) &node->portals;
while (1)
{
t = *portalpointer;
}
if (t->nodes[0] == node)
- portalpointer = &t->next[0];
+ portalpointer = (void **) &t->next[0];
else if (t->nodes[1] == node)
- portalpointer = &t->next[1];
+ portalpointer = (void **) &t->next[1];
else
Host_Error ("RemovePortalFromNodes: portal not bounding leaf");
}
}
*/
-void Mod_MakePortals()
+void Mod_MakePortals(void)
{
// Con_Printf("building portals for %s\n", loadmodel->name);