f = 0.1;
}
frac = (cl.time - cl.mtime[1]) / f;
-//Con_Printf ("frac: %f\n",frac);
+// Con_Printf ("frac: %f\n",frac);
if (frac < 0)
{
if (frac < -0.01)
{
cl.time = cl.mtime[1];
-// Con_Printf ("low frac\n");
+// Con_Printf ("low frac\n");
}
frac = 0;
}
if (frac > 1.01)
{
cl.time = cl.mtime[0];
-// Con_Printf ("high frac\n");
+// Con_Printf ("high frac\n");
}
frac = 1;
}
{
entity_t *ent;
int i, j;
- float frac, f, d;
- vec3_t delta;
- float bobjrotate;
-// float bobjoffset;
- vec3_t oldorg;
+ float frac, f, d, bobjrotate/*, bobjoffset*/, dlightradius;
+ vec3_t oldorg, delta, dlightcolor;
// determine partial update time
frac = CL_LerpPoint ();
ent->render.colormod[1] = (float) ((ent->state_current.colormod >> 2) & 7) * (1.0f / 7.0f);
ent->render.colormod[2] = (float) (ent->state_current.colormod & 3) * (1.0f / 3.0f);
+ dlightradius = 0;
+ dlightcolor[0] = 0;
+ dlightcolor[1] = 0;
+ dlightcolor[2] = 0;
+
// LordHavoc: if the entity has no effects, don't check each
if (ent->render.effects)
{
v[1] = v[1] * 18 + ent->render.origin[1];
v[2] = v[2] * 18 + ent->render.origin[2] + 16;
- CL_AllocDlight (ent, v, 100, 1, 1, 1, 0, 0.1);
+ CL_AllocDlight (NULL, v, 100, 1, 1, 1, 0, 0.1);
}
- if (ent->render.effects & EF_BRIGHTLIGHT)
- CL_AllocDlight (ent, ent->render.origin, 400, 1, 1, 1, 0, 0);
if (ent->render.effects & EF_DIMLIGHT)
- CL_AllocDlight (ent, ent->render.origin, 200, 1, 1, 1, 0, 0);
+ {
+ dlightcolor[0] += 200.0f;
+ dlightcolor[1] += 200.0f;
+ dlightcolor[2] += 200.0f;
+ }
+ if (ent->render.effects & EF_BRIGHTLIGHT)
+ {
+ dlightcolor[0] += 400.0f;
+ dlightcolor[1] += 400.0f;
+ dlightcolor[2] += 400.0f;
+ }
// LordHavoc: added EF_RED and EF_BLUE
if (ent->render.effects & EF_RED) // red
- {
- if (ent->render.effects & EF_BLUE) // magenta
- CL_AllocDlight (ent, ent->render.origin, 200, 1.0f, 0.2f, 1.0f, 0, 0);
- else // red
- CL_AllocDlight (ent, ent->render.origin, 200, 1.0f, 0.1f, 0.1f, 0, 0);
+ {
+ dlightcolor[0] += 200.0f;
+ dlightcolor[1] += 20.0f;
+ dlightcolor[2] += 20.0f;
+ }
+ if (ent->render.effects & EF_BLUE) // blue
+ {
+ dlightcolor[0] += 20.0f;
+ dlightcolor[1] += 20.0f;
+ dlightcolor[2] += 200.0f;
}
- else if (ent->render.effects & EF_BLUE) // blue
- CL_AllocDlight (ent, ent->render.origin, 200, 0.1f, 0.1f, 1.0f, 0, 0);
else if (ent->render.effects & EF_FLAME)
{
if (ent->render.model)
temp = (int) (cl.time * 300) - (int) (cl.oldtime * 300);
R_FlameCube(mins, maxs, temp);
}
- CL_AllocDlight (ent, ent->render.origin, lhrandom(200, 250), 1.0f, 0.7f, 0.3f, 0, 0);
+ d = lhrandom(200, 250);
+ dlightcolor[0] += d * 1.0f;
+ dlightcolor[1] += d * 0.7f;
+ dlightcolor[2] += d * 0.3f;
}
}
else if (ent->render.model->flags & EF_ROCKET)
{
R_RocketTrail (oldorg, ent->render.origin, 0, ent);
- CL_AllocDlight (ent, ent->render.origin, 200, 1.0f, 0.8f, 0.4f, 0, 0);
+ dlightcolor[0] += 200.0f;
+ dlightcolor[1] += 160.0f;
+ dlightcolor[2] += 80.0f;
}
else if (ent->render.model->flags & EF_GRENADE)
{
R_RocketTrail (oldorg, ent->render.origin, 6, ent);
}
}
- if (ent->render.glowsize) // LordHavoc: customizable glow
+ // LordHavoc: customizable glow
+ if (ent->render.glowsize)
{
byte *tempcolor = (byte *)&d_8to24table[ent->render.glowcolor];
- CL_AllocDlight (ent, ent->render.origin, ent->render.glowsize, tempcolor[0]*(1.0/255.0), tempcolor[1]*(1.0/255.0), tempcolor[2]*(1.0/255.0), 0, 0);
+ dlightcolor[0] += ent->render.glowsize * tempcolor[0] * (1.0f / 255.0f);
+ dlightcolor[1] += ent->render.glowsize * tempcolor[1] * (1.0f / 255.0f);
+ dlightcolor[2] += ent->render.glowsize * tempcolor[2] * (1.0f / 255.0f);
}
- if (ent->render.flags & RENDER_GLOWTRAIL) // LordHavoc: customizable glow and trail
+ // LordHavoc: customizable trail
+ if (ent->render.flags & RENDER_GLOWTRAIL)
R_RocketTrail2 (oldorg, ent->render.origin, ent->render.glowcolor, ent);
+ if (dlightcolor[0] || dlightcolor[1] || dlightcolor[2])
+ {
+ dlightradius = VectorLength(dlightcolor);
+ d = 1.0f / dlightradius;
+ CL_AllocDlight (ent, ent->render.origin, dlightradius, dlightcolor[0] * d, dlightcolor[1] * d, dlightcolor[2] * d, 0, 0);
+ }
+
if (i == cl.viewentity && !chase_active.value)
continue;
cvar_t gl_nosubimage = {"gl_nosubimage", "0"};
cvar_t r_ambient = {"r_ambient", "0"};
cvar_t gl_vertex = {"gl_vertex", "0"};
-cvar_t r_leafworldnode = {"r_leafworldnode", "0"};
-cvar_t r_portalworldnode = {"r_portalworldnode", "0"};
-//cvar_t r_oldclip = {"r_oldclip", "1"};
cvar_t r_dlightmap = {"r_dlightmap", "1"};
cvar_t r_drawportals = {"r_drawportals", "0"};
-cvar_t r_novis = {"r_novis","0"};
qboolean lightmaprgba, nosubimagefragments, nosubimage;
int lightmapbytes;
Cvar_RegisterVariable(&gl_nosubimage);
Cvar_RegisterVariable(&r_ambient);
Cvar_RegisterVariable(&gl_vertex);
- Cvar_RegisterVariable(&r_leafworldnode);
- Cvar_RegisterVariable(&r_portalworldnode);
-// Cvar_RegisterVariable(&r_oldclip);
Cvar_RegisterVariable(&r_dlightmap);
Cvar_RegisterVariable(&r_drawportals);
- Cvar_RegisterVariable(&r_novis);
R_RegisterModule("GL_Surf", gl_surf_start, gl_surf_shutdown, gl_surf_newmap);
}
float wvert[1024*6]; // used by the following functions
-extern qboolean hlbsp;
-
void RSurf_DrawSky(msurface_t *s, int transform)
{
glpoly_t *p;
=============================================================
*/
-int r_vismarkframecount; // bumped when going to a new PVS
+static byte *worldvis;
+extern cvar_t r_novis;
void R_MarkLeaves (void)
{
- byte *vis;
- mnode_t *node;
- int i;
-
- if (r_oldviewleaf == r_viewleaf)
+ static float noviscache;
+ if (r_oldviewleaf == r_viewleaf && noviscache == r_novis.value)
return;
- r_vismarkframecount++;
r_oldviewleaf = r_viewleaf;
+ noviscache = r_novis.value;
- vis = Mod_LeafPVS (r_viewleaf, cl.worldmodel);
-
- for (i = 0;i < cl.worldmodel->numleafs;i++)
- {
- if (vis[i>>3] & (1<<(i&7)))
- {
- node = (mnode_t *)&cl.worldmodel->leafs[i+1];
- do
- {
- if (node->vismarkframe == r_vismarkframecount)
- break;
- node->vismarkframe = r_vismarkframecount;
- node = node->parent;
- } while (node);
- }
- }
+ worldvis = Mod_LeafPVS (r_viewleaf, cl.worldmodel);
}
-void R_LeafWorldNode ()
+void R_SolidWorldNode ()
{
int l;
mleaf_t *leaf;
for (l = 0, leaf = cl.worldmodel->leafs;l < cl.worldmodel->numleafs;l++, leaf++)
{
- if ((leaf->vismarkframe == r_vismarkframecount) && (/*leaf->efrags || */leaf->nummarksurfaces))
+ if (/*leaf->efrags || */leaf->nummarksurfaces)
{
if (R_CullBox(leaf->mins, leaf->maxs))
continue;
}
}
-typedef struct nodestack_s
-{
- unsigned short side, clip;
- mnode_t *node;
-}
-nodestack_t;
-
-void R_NoVisWorldNode ()
+/*
+// experimental and inferior to the other in recursion depth allowances
+void R_PortalWorldNode ()
{
- int side, c, clip;
- nodestack_t *nstack, nodestack[8192];
- mnode_t *node;
- mleaf_t *pleaf;
- msurface_t *surf, *endsurf, **mark, **endmark;
- nstack = nodestack;
-
- node = cl.worldmodel->nodes;
-
- if (!node)
- return;
+ int i, j;
+ mportal_t *p;
+ msurface_t *surf, **mark, **endmark;
+ mleaf_t *leaf, *llistbuffer[8192], **l, **llist;
- clip = true;
- while(1)
+ leaf = r_viewleaf;
+ leaf->worldnodeframe = r_framecount;
+ l = llist = &llistbuffer[0];
+ *llist++ = r_viewleaf;
+ while (l < llist)
{
- if (node->contents < 0)
- {
- if (node->contents != CONTENTS_SOLID && R_NotCulledBox(node->mins, node->maxs))
- {
- // mark surfaces as being visible for processing by code later
- pleaf = (mleaf_t *)node;
-
- c_leafs++;
-
- pleaf->visframe = r_framecount;
-
- if (pleaf->nummarksurfaces)
- {
- mark = pleaf->firstmarksurface;
- endmark = mark + pleaf->nummarksurfaces;
- do
- (*mark++)->visframe = r_framecount;
- while (mark < endmark);
- }
-
- // deal with model fragments in this leaf
-// if (pleaf->efrags)
-// R_StoreEfrags (&pleaf->efrags);
- }
-
-culled:
- if (nstack <= nodestack)
- break;
- nstack--;
- node = nstack->node;
- side = nstack->side;
- clip = nstack->clip;
- goto loc0;
- }
- else if (clip)
- {
- // for easier reading, the values are:
- // 1 = not culled at all (very uncommon in large nodes, uncommon in medium nodes, common in small nodes)
- // 2 = completely culled (uncommon in large nodes, common in medium nodes, uncommon in small nodes)
- // 3 = partially culled (common in large nodes, common in medium nodes, uncommon in small nodes)
- if ((c = frustum[0].BoxOnPlaneSideFunc(node->mins, node->maxs, &frustum[0])) == 3) goto cull1;else if (c == 2) goto culled;// else 1
- if ((c = frustum[1].BoxOnPlaneSideFunc(node->mins, node->maxs, &frustum[1])) == 3) goto cull2;else if (c == 2) goto culled;// else 1
- if ((c = frustum[2].BoxOnPlaneSideFunc(node->mins, node->maxs, &frustum[2])) == 3) goto cull3;else if (c == 2) goto culled;// else 1
- if ((c = frustum[3].BoxOnPlaneSideFunc(node->mins, node->maxs, &frustum[3])) == 3) goto cull4;else if (c == 2) goto culled;// else 1
- // completely onscreen, no need to cull children
- clip = false;
- goto cull4;
- // partially clipped node
-cull1: if (frustum[1].BoxOnPlaneSideFunc(node->mins, node->maxs, &frustum[1]) == 2) goto culled;// else 1 or 3
-cull2: if (frustum[2].BoxOnPlaneSideFunc(node->mins, node->maxs, &frustum[2]) == 2) goto culled;// else 1 or 3
-cull3: if (frustum[3].BoxOnPlaneSideFunc(node->mins, node->maxs, &frustum[3]) == 2) goto culled;// else 1 or 3
-cull4: ;
- }
-
- c_nodes++;
+ leaf = *l++;
- // node is just a decision point, so go down the apropriate sides
+ c_leafs++;
- // find which side of the node we are on
- side = PlaneDist(modelorg, node->plane) < node->plane->dist;
+ leaf->visframe = r_framecount;
- // recurse down the children, front side first
- nstack->node = node;
- nstack->side = !side; // go down back side when we come back up
- nstack->clip = clip;
- nstack++;
- node = node->children[side];
- continue;
-loc0:
+ // deal with model fragments in this leaf
+ // if (leaf->efrags)
+ // R_StoreEfrags (&leaf->efrags);
- // draw stuff
- if (node->numsurfaces)
+ if (leaf->nummarksurfaces)
{
- surf = cl.worldmodel->surfaces + node->firstsurface;
- endsurf = surf + node->numsurfaces;
-
- if (side)
+ mark = leaf->firstmarksurface;
+ endmark = mark + leaf->nummarksurfaces;
+ do
{
- for (;surf < endsurf;surf++)
+ surf = *mark++;
+ // make sure surfaces are only processed once
+ if (surf->worldnodeframe == r_framecount)
+ continue;
+ surf->worldnodeframe = r_framecount;
+ if (PlaneDist(modelorg, surf->plane) < surf->plane->dist)
+ {
if (surf->flags & SURF_PLANEBACK)
- surf->visframe = -1;
- }
- else
- {
- for (;surf < endsurf;surf++)
- if (!(surf->flags & SURF_PLANEBACK))
- surf->visframe = -1;
- }
- }
-
- // recurse down the back side
- node = node->children[side];
- continue;
- }
-}
-
-void R_BSPWorldNode ()
-{
- int side, c, clip/*, oldclip = r_oldclip.value*/;
- nodestack_t *nstack, nodestack[8192];
- mnode_t *node;
- mleaf_t *pleaf;
- msurface_t *surf, *endsurf, **mark, **endmark;
- nstack = nodestack;
-
- node = cl.worldmodel->nodes;
-
- if (!node)
- return;
-
- clip = true;
- while(1)
- {
- if (node->contents < 0)
- {
- if (node->contents != CONTENTS_SOLID && R_NotCulledBox(node->mins, node->maxs))
- {
- // mark surfaces as being visible for processing by code later
- pleaf = (mleaf_t *)node;
-
- c_leafs++;
-
- pleaf->visframe = r_framecount;
-
- if (pleaf->nummarksurfaces)
+ surf->visframe = r_framecount;
+ }
+ else
{
- mark = pleaf->firstmarksurface;
- endmark = mark + pleaf->nummarksurfaces;
- do
- (*mark++)->visframe = r_framecount;
- while (mark < endmark);
+ if (!(surf->flags & SURF_PLANEBACK))
+ surf->visframe = r_framecount;
}
-
- // deal with model fragments in this leaf
-// if (pleaf->efrags)
-// R_StoreEfrags (&pleaf->efrags);
- }
-
-culled:
- if (nstack <= nodestack)
- break;
- nstack--;
- node = nstack->node;
- side = nstack->side;
- clip = nstack->clip;
- goto loc0;
- }
- /*
- else if (oldclip)
- {
- if (R_CullBox(node->mins, node->maxs))
- {
- if (nstack <= nodestack)
- break;
- nstack--;
- node = nstack->node;
- side = nstack->side;
- clip = nstack->clip;
- goto loc0;
}
+ while (mark < endmark);
}
- */
- else if (clip)
- {
- // for easier reading, the values are:
- // 1 = not culled at all (very uncommon in large nodes, uncommon in medium nodes, common in small nodes)
- // 2 = completely culled (uncommon in large nodes, common in medium nodes, uncommon in small nodes)
- // 3 = partially culled (common in large nodes, common in medium nodes, uncommon in small nodes)
- if ((c = frustum[0].BoxOnPlaneSideFunc(node->mins, node->maxs, &frustum[0])) == 3) goto cull1;else if (c == 2) goto culled;// else 1
- if ((c = frustum[1].BoxOnPlaneSideFunc(node->mins, node->maxs, &frustum[1])) == 3) goto cull2;else if (c == 2) goto culled;// else 1
- if ((c = frustum[2].BoxOnPlaneSideFunc(node->mins, node->maxs, &frustum[2])) == 3) goto cull3;else if (c == 2) goto culled;// else 1
- if ((c = frustum[3].BoxOnPlaneSideFunc(node->mins, node->maxs, &frustum[3])) == 3) goto cull4;else if (c == 2) goto culled;// else 1
- // completely onscreen, no need to cull children
- clip = false;
- goto cull4;
- // partially clipped node
-cull1: if (frustum[1].BoxOnPlaneSideFunc(node->mins, node->maxs, &frustum[1]) == 2) goto culled;// else 1 or 3
-cull2: if (frustum[2].BoxOnPlaneSideFunc(node->mins, node->maxs, &frustum[2]) == 2) goto culled;// else 1 or 3
-cull3: if (frustum[3].BoxOnPlaneSideFunc(node->mins, node->maxs, &frustum[3]) == 2) goto culled;// else 1 or 3
-cull4: ;
- }
-
- c_nodes++;
-
- // node is just a decision point, so go down the apropriate sides
-
- // find which side of the node we are on
- side = PlaneDist(modelorg, node->plane) < node->plane->dist;
-
- // recurse down the children, front side first
- if (node->children[side]->vismarkframe == r_vismarkframecount)
- {
- nstack->node = node;
- nstack->side = !side; // go down back side when we come back up
- nstack->clip = clip;
- nstack++;
- node = node->children[side];
- continue;
- }
- side = !side;
-loc0:
- // draw stuff
- if (node->numsurfaces)
+ // follow portals into other leafs
+ p = leaf->portals;
+ for (;p;p = p->next)
{
- surf = cl.worldmodel->surfaces + node->firstsurface;
- endsurf = surf + node->numsurfaces;
-
- if (side)
- {
- for (;surf < endsurf;surf++)
- if (surf->flags & SURF_PLANEBACK)
- surf->visframe = -1;
- }
- else
+ leaf = p->past;
+ if (leaf->worldnodeframe != r_framecount)
{
- for (;surf < endsurf;surf++)
- if (!(surf->flags & SURF_PLANEBACK))
- surf->visframe = -1;
+ leaf->worldnodeframe = r_framecount;
+ i = (leaf - cl.worldmodel->leafs) - 1;
+ if ((worldvis[i>>3] & (1<<(i&7))) && R_NotCulledBox(leaf->mins, leaf->maxs))
+ *llist++ = leaf;
}
}
+ }
- // recurse down the back side
- if (node->children[side]->vismarkframe == r_vismarkframecount)
- {
- node = node->children[side];
- continue;
- }
-
- if (nstack <= nodestack)
- break;
- nstack--;
- node = nstack->node;
- side = nstack->side;
- clip = nstack->clip;
- goto loc0;
+ i = 0;
+ j = 0;
+ p = r_viewleaf->portals;
+ for (;p;p = p->next)
+ {
+ j++;
+ if (p->past->worldnodeframe != r_framecount)
+ i++;
}
+ if (i)
+ Con_Printf("%i portals of viewleaf (%i portals) were not checked\n", i, j);
}
+*/
void R_PortalWorldNode ()
{
- int portalstack;
+ int portalstack, i;
mportal_t *p, *pstack[8192];
msurface_t *surf, **mark, **endmark;
mleaf_t *leaf;
leaf = r_viewleaf;
+ leaf->worldnodeframe = r_framecount;
portalstack = 0;
loc0:
c_leafs++;
}
// follow portals into other leafs
- for (p = leaf->portals;p;p = p->next)
+ p = leaf->portals;
+ for (;p;p = p->next)
{
- if (p->past->worldnodeframe != r_framecount)
+ leaf = p->past;
+ if (leaf->worldnodeframe != r_framecount)
{
- leaf = p->past;
leaf->worldnodeframe = r_framecount;
- if (leaf->contents != CONTENTS_SOLID && leaf->vismarkframe == r_vismarkframecount && R_NotCulledBox(leaf->mins, leaf->maxs))
+ if (leaf->contents != CONTENTS_SOLID)
{
- pstack[portalstack++] = p;
- goto loc0;
-loc1:;
+ i = (leaf - cl.worldmodel->leafs) - 1;
+ if (worldvis[i>>3] & (1<<(i&7)))
+ {
+ if (R_NotCulledBox(leaf->mins, leaf->maxs))
+ {
+ pstack[portalstack++] = p;
+ goto loc0;
+
+loc1:
+ p = pstack[--portalstack];
+ }
+ }
}
}
}
if (portalstack)
- {
- p = pstack[--portalstack];
goto loc1;
+
+ i = 0;
+ portalstack = 0;
+ p = r_viewleaf->portals;
+ for (;p;p = p->next)
+ {
+ portalstack++;
+ if (p->past->worldnodeframe != r_framecount)
+ i++;
}
+ if (i)
+ Con_Printf("%i portals of viewleaf (%i portals) were not checked\n", i, portalstack);
}
void R_DrawSurfaces (void)
if (cl.worldmodel)
{
- if (r_novis.value || !r_viewleaf->compressed_vis)
- R_NoVisWorldNode ();
+ if (r_viewleaf->contents == CONTENTS_SOLID)
+ R_SolidWorldNode ();
else
{
R_MarkLeaves ();
- if (r_portalworldnode.value)
- R_PortalWorldNode ();
- else if (r_leafworldnode.value)
- R_LeafWorldNode ();
- else
- R_BSPWorldNode ();
+ R_PortalWorldNode ();
}
}
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);
}
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)
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;
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");
}