renamed q1bsp marksurfaces to leaffaces for consistency with q2bsp and q3bsp naming
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 6 Mar 2005 17:09:47 +0000 (17:09 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 6 Mar 2005 17:09:47 +0000 (17:09 +0000)
replaced q3mnode_t and q3mleaf_t with mnode_t and mleaf_t (which now contain supersets of the fields between the two bsp versions)

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5042 d7cf8633-e32d-0410-b094-e92efae38249

gl_rsurf.c
model_brush.c
model_brush.h
model_shared.h
portals.c
r_light.c

index b132019..3d94d18 100644 (file)
@@ -40,24 +40,6 @@ cvar_t r_drawcollisionbrushes_polygonoffset = {0, "r_drawcollisionbrushes_polygo
 cvar_t r_q3bsp_renderskydepth = {0, "r_q3bsp_renderskydepth", "0"};
 cvar_t gl_lightmaps = {0, "gl_lightmaps", "0"};
 
-/*
-// FIXME: these arrays are huge!
-int r_q1bsp_maxmarkleafs;
-int r_q1bsp_nummarkleafs;
-mleaf_t *r_q1bsp_maxleaflist[65536];
-int r_q1bsp_maxmarksurfaces;
-int r_q1bsp_nummarksurfaces;
-msurface_t *r_q1bsp_maxsurfacelist[65536];
-
-// FIXME: these arrays are huge!
-int r_q3bsp_maxmarkleafs;
-int r_q3bsp_nummarkleafs;
-q3mleaf_t *r_q3bsp_maxleaflist[65536];
-int r_q3bsp_maxmarksurfaces;
-int r_q3bsp_nummarksurfaces;
-q3msurface_t *r_q3bsp_maxsurfacelist[65536];
-*/
-
 static int dlightdivtable[32768];
 
 static int R_IntAddDynamicLights (const matrix4x4_t *matrix, msurface_t *surf)
@@ -1345,7 +1327,7 @@ void R_WorldVisibility(void)
        if (model->type == mod_brushq3)
        {
                int i, j;
-               q3mleaf_t *leaf;
+               mleaf_t *leaf;
                memset(r_worldsurfacevisible, 0, r_refdef.worldmodel->brushq3.num_faces);
                for (j = 0, leaf = r_refdef.worldmodel->brushq3.data_leafs;j < r_refdef.worldmodel->brushq3.num_leafs;j++, leaf++)
                {
@@ -1380,8 +1362,8 @@ void R_WorldVisibility(void)
                                if (CHECKPVSBIT(r_pvsbits, leaf->clusterindex) && !R_CullBox (leaf->mins, leaf->maxs))
                                {
                                        c_leafs++;
-                                       if (leaf->nummarksurfaces)
-                                               for (i = 0, mark = leaf->firstmarksurface;i < leaf->nummarksurfaces;i++, mark++)
+                                       if (leaf->numleaffaces)
+                                               for (i = 0, mark = leaf->firstleafface;i < leaf->numleaffaces;i++, mark++)
                                                        r_worldsurfacevisible[*mark] = true;
                                }
                        }
@@ -1401,8 +1383,8 @@ void R_WorldVisibility(void)
                                leaf = leafstack[--leafstackpos];
                                leafvisited[leaf - r_refdef.worldmodel->brushq1.data_leafs] = 1;
                                // draw any surfaces bounding this leaf
-                               if (leaf->nummarksurfaces)
-                                       for (i = 0, mark = leaf->firstmarksurface;i < leaf->nummarksurfaces;i++, mark++)
+                               if (leaf->numleaffaces)
+                                       for (i = 0, mark = leaf->firstleafface;i < leaf->numleaffaces;i++, mark++)
                                                r_worldsurfacevisible[*mark] = true;
                                // follow portals into other leafs
                                for (p = leaf->portals;p;p = p->next)
@@ -1435,7 +1417,7 @@ void R_Q1BSP_GetLightInfo(entity_render_t *ent, vec3_t relativelightorigin, floa
 {
        model_t *model = ent->model;
        vec3_t lightmins, lightmaxs;
-       int t, leafindex, marksurfaceindex, surfaceindex, triangleindex, outnumclusters = 0, outnumsurfaces = 0;
+       int t, leafindex, leaffaceindex, surfaceindex, triangleindex, outnumclusters = 0, outnumsurfaces = 0;
        const int *e;
        const float *v[3];
        msurface_t *surface;
@@ -1484,9 +1466,9 @@ void R_Q1BSP_GetLightInfo(entity_render_t *ent, vec3_t relativelightorigin, floa
                        }
                        if (outsurfacepvs)
                        {
-                               for (marksurfaceindex = 0;marksurfaceindex < leaf->nummarksurfaces;marksurfaceindex++)
+                               for (leaffaceindex = 0;leaffaceindex < leaf->numleaffaces;leaffaceindex++)
                                {
-                                       surfaceindex = leaf->firstmarksurface[marksurfaceindex];
+                                       surfaceindex = leaf->firstleafface[leaffaceindex];
                                        if (!CHECKPVSBIT(outsurfacepvs, surfaceindex))
                                        {
                                                surface = model->brushq1.surfaces + surfaceindex;
@@ -2144,11 +2126,11 @@ void R_Q3BSP_GetLightInfo(entity_render_t *ent, vec3_t relativelightorigin, floa
 {
        model_t *model = ent->model;
        vec3_t lightmins, lightmaxs;
-       int t, leafindex, marksurfaceindex, surfaceindex, triangleindex, outnumclusters = 0, outnumsurfaces = 0;
+       int t, leafindex, leaffaceindex, surfaceindex, triangleindex, outnumclusters = 0, outnumsurfaces = 0;
        const int *e;
        const float *v[3];
        q3msurface_t *surface;
-       q3mleaf_t *leaf;
+       mleaf_t *leaf;
        const qbyte *pvs;
        lightmins[0] = relativelightorigin[0] - lightradius;
        lightmins[1] = relativelightorigin[1] - lightradius;
@@ -2193,9 +2175,9 @@ void R_Q3BSP_GetLightInfo(entity_render_t *ent, vec3_t relativelightorigin, floa
                        }
                        if (outsurfacepvs)
                        {
-                               for (marksurfaceindex = 0;marksurfaceindex < leaf->numleaffaces;marksurfaceindex++)
+                               for (leaffaceindex = 0;leaffaceindex < leaf->numleaffaces;leaffaceindex++)
                                {
-                                       surfaceindex = leaf->firstleafface[marksurfaceindex];
+                                       surfaceindex = leaf->firstleafface[leaffaceindex];
                                        surface = model->brushq3.data_faces + surfaceindex;
                                        if (!CHECKPVSBIT(outsurfacepvs, surfaceindex))
                                        {
index 5e4202b..cd872f7 100644 (file)
@@ -176,7 +176,7 @@ static void Mod_Q1BSP_FindNonSolidLocation_r_Leaf(findnonsolidlocationinfo_t *in
        float surfnormal[3];
 #endif
        msurface_t *surf;
-       for (surfnum = 0, mark = leaf->firstmarksurface;surfnum < leaf->nummarksurfaces;surfnum++, mark++)
+       for (surfnum = 0, mark = leaf->firstleafface;surfnum < leaf->numleaffaces;surfnum++, mark++)
        {
                surf = info->model->brushq1.surfaces + *mark;
                if (surf->flags & SURF_SOLIDCLIP)
@@ -303,7 +303,7 @@ static void Mod_Q1BSP_FindNonSolidLocation_r(findnonsolidlocationinfo_t *info, m
        }
        else
        {
-               if (((mleaf_t *)node)->nummarksurfaces)
+               if (((mleaf_t *)node)->numleaffaces)
                        Mod_Q1BSP_FindNonSolidLocation_r_Leaf(info, (mleaf_t *)node);
        }
 }
@@ -2025,13 +2025,13 @@ static void Mod_Q1BSP_LoadLeafs(lump_t *l)
 
                out->contents = LittleLong(in->contents);
 
-               out->firstmarksurface = loadmodel->brushq1.marksurfaces + LittleShort(in->firstmarksurface);
-               out->nummarksurfaces = LittleShort(in->nummarksurfaces);
-               if (out->firstmarksurface < 0 || LittleShort(in->firstmarksurface) + out->nummarksurfaces > loadmodel->brushq1.nummarksurfaces)
+               out->firstleafface = loadmodel->brushq1.leaffaces + LittleShort(in->firstmarksurface);
+               out->numleaffaces = LittleShort(in->nummarksurfaces);
+               if (out->firstleafface < 0 || LittleShort(in->firstmarksurface) + out->numleaffaces > loadmodel->brushq1.numleaffaces)
                {
-                       Con_Printf("Mod_Q1BSP_LoadLeafs: invalid marksurface range %i:%i outside range %i:%i\n", out->firstmarksurface, out->firstmarksurface + out->nummarksurfaces, 0, loadmodel->brushq1.nummarksurfaces);
-                       out->firstmarksurface = NULL;
-                       out->nummarksurfaces = 0;
+                       Con_Printf("Mod_Q1BSP_LoadLeafs: invalid leafface range %i:%i outside range %i:%i\n", out->firstleafface, out->firstleafface + out->numleaffaces, 0, loadmodel->brushq1.numleaffaces);
+                       out->firstleafface = NULL;
+                       out->numleaffaces = 0;
                }
 
                out->clusterindex = i - 1;
@@ -2176,23 +2176,23 @@ static void Mod_Q1BSP_MakeHull0(void)
        }
 }
 
-static void Mod_Q1BSP_LoadMarksurfaces(lump_t *l)
+static void Mod_Q1BSP_LoadLeaffaces(lump_t *l)
 {
        int i, j;
        short *in;
 
        in = (void *)(mod_base + l->fileofs);
        if (l->filelen % sizeof(*in))
-               Host_Error("Mod_Q1BSP_LoadMarksurfaces: funny lump size in %s",loadmodel->name);
-       loadmodel->brushq1.nummarksurfaces = l->filelen / sizeof(*in);
-       loadmodel->brushq1.marksurfaces = Mem_Alloc(loadmodel->mempool, loadmodel->brushq1.nummarksurfaces * sizeof(int));
+               Host_Error("Mod_Q1BSP_LoadLeaffaces: funny lump size in %s",loadmodel->name);
+       loadmodel->brushq1.numleaffaces = l->filelen / sizeof(*in);
+       loadmodel->brushq1.leaffaces = Mem_Alloc(loadmodel->mempool, loadmodel->brushq1.numleaffaces * sizeof(int));
 
-       for (i = 0;i < loadmodel->brushq1.nummarksurfaces;i++)
+       for (i = 0;i < loadmodel->brushq1.numleaffaces;i++)
        {
                j = (unsigned) LittleShort(in[i]);
                if (j >= loadmodel->brushq1.numsurfaces)
-                       Host_Error("Mod_Q1BSP_LoadMarksurfaces: bad surface number");
-               loadmodel->brushq1.marksurfaces[i] = j;
+                       Host_Error("Mod_Q1BSP_LoadLeaffaces: bad surface number");
+               loadmodel->brushq1.leaffaces[i] = j;
        }
 }
 
@@ -2927,15 +2927,15 @@ void Mod_Q1BSP_RecursiveGetVisible(mnode_t *node, model_t *model, const vec3_t p
        leaf = (mleaf_t *)node;
        if ((pvs == NULL || CHECKPVSBIT(pvs, leaf->clusterindex)))
        {
-               int marksurfacenum;
+               int leaffacenum;
                msurface_t *surf;
                if (maxleafs && *numleafs < maxleafs)
                        leaflist[(*numleafs)++] = leaf;
                if (maxsurfaces)
                {
-                       for (marksurfacenum = 0;marksurfacenum < leaf->nummarksurfaces;marksurfacenum++)
+                       for (leaffacenum = 0;leaffacenum < leaf->numleaffaces;leaffacenum++)
                        {
-                               surf = model->brushq1.surfaces + leaf->firstmarksurface[marksurfacenum];
+                               surf = model->brushq1.surfaces + leaf->firstleafface[leaffacenum];
                                if (surf->shadowmark != shadowmarkcount)
                                {
                                        surf->shadowmark = shadowmarkcount;
@@ -3023,7 +3023,7 @@ void Mod_Q1BSP_Load(model_t *mod, void *buffer)
        Mod_Q1BSP_LoadPlanes(&header->lumps[LUMP_PLANES]);
        Mod_Q1BSP_LoadTexinfo(&header->lumps[LUMP_TEXINFO]);
        Mod_Q1BSP_LoadFaces(&header->lumps[LUMP_FACES]);
-       Mod_Q1BSP_LoadMarksurfaces(&header->lumps[LUMP_MARKSURFACES]);
+       Mod_Q1BSP_LoadLeaffaces(&header->lumps[LUMP_MARKSURFACES]);
        Mod_Q1BSP_LoadVisibility(&header->lumps[LUMP_VISIBILITY]);
        // load submodels before leafs because they contain the number of vis leafs
        Mod_Q1BSP_LoadSubmodels(&header->lumps[LUMP_MODELS]);
@@ -4582,7 +4582,7 @@ static void Mod_Q3BSP_LoadLeafFaces(lump_t *l)
 static void Mod_Q3BSP_LoadLeafs(lump_t *l)
 {
        q3dleaf_t *in;
-       q3mleaf_t *out;
+       mleaf_t *out;
        int i, j, n, c, count;
 
        in = (void *)(mod_base + l->fileofs);
@@ -4621,7 +4621,7 @@ static void Mod_Q3BSP_LoadLeafs(lump_t *l)
        }
 }
 
-static void Mod_Q3BSP_LoadNodes_RecursiveSetParent(q3mnode_t *node, q3mnode_t *parent)
+static void Mod_Q3BSP_LoadNodes_RecursiveSetParent(mnode_t *node, mnode_t *parent)
 {
        if (node->parent)
                Host_Error("Mod_Q3BSP_LoadNodes_RecursiveSetParent: runaway recursion\n");
@@ -4636,7 +4636,7 @@ static void Mod_Q3BSP_LoadNodes_RecursiveSetParent(q3mnode_t *node, q3mnode_t *p
 static void Mod_Q3BSP_LoadNodes(lump_t *l)
 {
        q3dnode_t *in;
-       q3mnode_t *out;
+       mnode_t *out;
        int i, j, n, count;
 
        in = (void *)(mod_base + l->fileofs);
@@ -4669,7 +4669,7 @@ static void Mod_Q3BSP_LoadNodes(lump_t *l)
                                n = -1 - n;
                                if (n >= loadmodel->brushq3.num_leafs)
                                        Host_Error("Mod_Q3BSP_LoadNodes: invalid child leaf index %i (%i leafs)\n", n, loadmodel->brushq3.num_leafs);
-                               out->children[j] = (q3mnode_t *)(loadmodel->brushq3.data_leafs + n);
+                               out->children[j] = (mnode_t *)(loadmodel->brushq3.data_leafs + n);
                        }
                }
                for (j = 0;j < 3;j++)
@@ -4844,16 +4844,16 @@ static void Mod_Q3BSP_LightPoint(model_t *model, const vec3_t p, vec3_t ambientc
        //Con_Printf("result: ambient %f %f %f diffuse %f %f %f diffusenormal %f %f %f\n", ambientcolor[0], ambientcolor[1], ambientcolor[2], diffusecolor[0], diffusecolor[1], diffusecolor[2], diffusenormal[0], diffusenormal[1], diffusenormal[2]);
 }
 
-static void Mod_Q3BSP_TracePoint_RecursiveBSPNode(trace_t *trace, model_t *model, q3mnode_t *node, const vec3_t point, int markframe)
+static void Mod_Q3BSP_TracePoint_RecursiveBSPNode(trace_t *trace, model_t *model, mnode_t *node, const vec3_t point, int markframe)
 {
        int i;
-       q3mleaf_t *leaf;
+       mleaf_t *leaf;
        colbrushf_t *brush;
        // find which leaf the point is in
        while (node->plane)
                node = node->children[DotProduct(point, node->plane->normal) < node->plane->dist];
        // point trace the brushes
-       leaf = (q3mleaf_t *)node;
+       leaf = (mleaf_t *)node;
        for (i = 0;i < leaf->numleafbrushes;i++)
        {
                brush = model->brushq3.data_brushes[leaf->firstleafbrush[i]].colbrushf;
@@ -4866,11 +4866,11 @@ static void Mod_Q3BSP_TracePoint_RecursiveBSPNode(trace_t *trace, model_t *model
        // can't do point traces on curves (they have no thickness)
 }
 
-static void Mod_Q3BSP_TraceLine_RecursiveBSPNode(trace_t *trace, model_t *model, q3mnode_t *node, const vec3_t start, const vec3_t end, vec_t startfrac, vec_t endfrac, const vec3_t linestart, const vec3_t lineend, int markframe, const vec3_t segmentmins, const vec3_t segmentmaxs)
+static void Mod_Q3BSP_TraceLine_RecursiveBSPNode(trace_t *trace, model_t *model, mnode_t *node, const vec3_t start, const vec3_t end, vec_t startfrac, vec_t endfrac, const vec3_t linestart, const vec3_t lineend, int markframe, const vec3_t segmentmins, const vec3_t segmentmaxs)
 {
        int i, startside, endside;
        float dist1, dist2, midfrac, mid[3], nodesegmentmins[3], nodesegmentmaxs[3];
-       q3mleaf_t *leaf;
+       mleaf_t *leaf;
        q3msurface_t *face;
        colbrushf_t *brush;
        if (startfrac > trace->realfraction)
@@ -4918,7 +4918,7 @@ static void Mod_Q3BSP_TraceLine_RecursiveBSPNode(trace_t *trace, model_t *model,
        nodesegmentmaxs[1] = max(start[1], end[1]);
        nodesegmentmaxs[2] = max(start[2], end[2]);
        // line trace the brushes
-       leaf = (q3mleaf_t *)node;
+       leaf = (mleaf_t *)node;
        for (i = 0;i < leaf->numleafbrushes;i++)
        {
                brush = model->brushq3.data_brushes[leaf->firstleafbrush[i]].colbrushf;
@@ -4948,12 +4948,12 @@ static void Mod_Q3BSP_TraceLine_RecursiveBSPNode(trace_t *trace, model_t *model,
        }
 }
 
-static void Mod_Q3BSP_TraceBrush_RecursiveBSPNode(trace_t *trace, model_t *model, q3mnode_t *node, const colbrushf_t *thisbrush_start, const colbrushf_t *thisbrush_end, int markframe, const vec3_t segmentmins, const vec3_t segmentmaxs)
+static void Mod_Q3BSP_TraceBrush_RecursiveBSPNode(trace_t *trace, model_t *model, mnode_t *node, const colbrushf_t *thisbrush_start, const colbrushf_t *thisbrush_end, int markframe, const vec3_t segmentmins, const vec3_t segmentmaxs)
 {
        int i;
        //int sides;
        float nodesegmentmins[3], nodesegmentmaxs[3];
-       q3mleaf_t *leaf;
+       mleaf_t *leaf;
        colbrushf_t *brush;
        q3msurface_t *face;
        /*
@@ -5302,7 +5302,7 @@ static void Mod_Q3BSP_TraceBrush_RecursiveBSPNode(trace_t *trace, model_t *model
        }
 #endif
        // hit a leaf
-       leaf = (q3mleaf_t *)node;
+       leaf = (mleaf_t *)node;
        for (i = 0;i < leaf->numleafbrushes;i++)
        {
                brush = model->brushq3.data_brushes[leaf->firstleafbrush[i]].colbrushf;
@@ -5410,7 +5410,7 @@ static void Mod_Q3BSP_TraceBox(model_t *model, int frame, trace_t *trace, const
 static int Mod_Q3BSP_BoxTouchingPVS(model_t *model, const qbyte *pvs, const vec3_t mins, const vec3_t maxs)
 {
        int clusterindex, side, nodestackindex = 0;
-       q3mnode_t *node, *nodestack[1024];
+       mnode_t *node, *nodestack[1024];
        node = model->brushq3.data_nodes;
        if (!model->brush.num_pvsclusters)
                return true;
@@ -5436,7 +5436,7 @@ static int Mod_Q3BSP_BoxTouchingPVS(model_t *model, const qbyte *pvs, const vec3
                else
                {
                        // leaf - check cluster bit
-                       clusterindex = ((q3mleaf_t *)node)->clusterindex;
+                       clusterindex = ((mleaf_t *)node)->clusterindex;
 #if 0
                        if (clusterindex >= model->brush.num_pvsclusters)
                        {
@@ -5466,18 +5466,18 @@ static int Mod_Q3BSP_BoxTouchingPVS(model_t *model, const qbyte *pvs, const vec3
 //(note: can return NULL)
 static qbyte *Mod_Q3BSP_GetPVS(model_t *model, const vec3_t p)
 {
-       q3mnode_t *node;
+       mnode_t *node;
        Mod_CheckLoaded(model);
        node = model->brushq3.data_nodes;
        while (node->plane)
                node = node->children[(node->plane->type < 3 ? p[node->plane->type] : DotProduct(p,node->plane->normal)) < node->plane->dist];
-       if (((q3mleaf_t *)node)->clusterindex >= 0)
-               return model->brush.data_pvsclusters + ((q3mleaf_t *)node)->clusterindex * model->brush.num_pvsclusterbytes;
+       if (((mleaf_t *)node)->clusterindex >= 0)
+               return model->brush.data_pvsclusters + ((mleaf_t *)node)->clusterindex * model->brush.num_pvsclusterbytes;
        else
                return NULL;
 }
 
-static void Mod_Q3BSP_FatPVS_RecursiveBSPNode(model_t *model, const vec3_t org, vec_t radius, qbyte *pvsbuffer, int pvsbytes, q3mnode_t *node)
+static void Mod_Q3BSP_FatPVS_RecursiveBSPNode(model_t *model, const vec3_t org, vec_t radius, qbyte *pvsbuffer, int pvsbytes, mnode_t *node)
 {
        while (node->plane)
        {
@@ -5494,10 +5494,10 @@ static void Mod_Q3BSP_FatPVS_RecursiveBSPNode(model_t *model, const vec3_t org,
                }
        }
        // if this leaf is in a cluster, accumulate the pvs bits
-       if (((q3mleaf_t *)node)->clusterindex >= 0)
+       if (((mleaf_t *)node)->clusterindex >= 0)
        {
                int i;
-               qbyte *pvs = model->brush.data_pvsclusters + ((q3mleaf_t *)node)->clusterindex * model->brush.num_pvsclusterbytes;
+               qbyte *pvs = model->brush.data_pvsclusters + ((mleaf_t *)node)->clusterindex * model->brush.num_pvsclusterbytes;
                for (i = 0;i < pvsbytes;i++)
                        pvsbuffer[i] |= pvs[i];
        }
@@ -5584,7 +5584,7 @@ void Mod_Q3BSP_BuildTextureFaceLists(void)
        }
 }
 
-void Mod_Q3BSP_RecursiveFindNumLeafs(q3mnode_t *node)
+void Mod_Q3BSP_RecursiveFindNumLeafs(mnode_t *node)
 {
        int numleafs;
        while (node->plane)
@@ -5592,7 +5592,7 @@ void Mod_Q3BSP_RecursiveFindNumLeafs(q3mnode_t *node)
                Mod_Q3BSP_RecursiveFindNumLeafs(node->children[0]);
                node = node->children[1];
        }
-       numleafs = ((q3mleaf_t *)node - loadmodel->brushq3.data_leafs) + 1;
+       numleafs = ((mleaf_t *)node - loadmodel->brushq3.data_leafs) + 1;
        if (loadmodel->brushq3.num_leafs < numleafs)
                loadmodel->brushq3.num_leafs = numleafs;
 }
index 08e54c9..c789886 100644 (file)
@@ -202,6 +202,8 @@ typedef struct mnode_s
 
        // this part unique to node
        struct mnode_s *children[2];
+
+       // q1bsp specific
        unsigned short firstsurface;
        unsigned short numsurfaces;
 }
@@ -218,12 +220,16 @@ typedef struct mleaf_s
        vec3_t maxs;
 
        // this part unique to leaf
+       // common
        int clusterindex; // -1 is not in pvs, >= 0 is pvs bit number
-       int contents; // TODO: remove (only used temporarily during loading when making collision hull 0)
-       int *firstmarksurface;
-       int nummarksurfaces;
-       qbyte ambient_sound_level[NUM_AMBIENTS];
-       int portalmarkid; // used by see-polygon-through-portals visibility checker
+       int areaindex; // q3bsp
+       int numleaffaces;
+       int *firstleafface;
+       int numleafbrushes; // q3bsp
+       int *firstleafbrush; // q3bsp
+       qbyte ambient_sound_level[NUM_AMBIENTS]; // q1bsp
+       int contents; // q1bsp: // TODO: remove (only used temporarily during loading when making collision hull 0)
+       int portalmarkid; // q1bsp // used by see-polygon-through-portals visibility checker
 }
 mleaf_t;
 
@@ -787,37 +793,6 @@ typedef struct q3mtexture_s
 }
 q3mtexture_t;
 
-typedef struct q3mnode_s
-{
-       //this part shared between node and leaf
-       struct mplane_s *plane; // != NULL
-       struct q3mnode_s *parent;
-       vec3_t mins;
-       vec3_t maxs;
-
-       // this part unique to node
-       struct q3mnode_s *children[2];
-}
-q3mnode_t;
-
-typedef struct q3mleaf_s
-{
-       //this part shared between node and leaf
-       struct mplane_s *plane; // == NULL
-       struct q3mnode_s *parent;
-       vec3_t mins;
-       vec3_t maxs;
-
-       // this part unique to leaf
-       int clusterindex; // -1 is not in pvs, >= 0 is pvs bit number
-       int areaindex;
-       int numleaffaces;
-       int *firstleafface;
-       int numleafbrushes;
-       int *firstleafbrush;
-}
-q3mleaf_t;
-
 typedef struct q3mmodel_s
 {
        vec3_t mins;
index 1847240..6dfa202 100644 (file)
@@ -249,8 +249,8 @@ typedef struct model_brushq1_s
        int                             numclipnodes;
        dclipnode_t             *clipnodes;
 
-       int                             nummarksurfaces;
-       int                             *marksurfaces;
+       int                             numleaffaces;
+       int                             *leaffaces;
 
        hull_t                  hulls[MAX_MAP_HULLS];
 
@@ -305,10 +305,10 @@ typedef struct model_brushq3_s
        mplane_t *data_planes;
 
        int num_nodes;
-       q3mnode_t *data_nodes;
+       mnode_t *data_nodes;
 
        int num_leafs;
-       q3mleaf_t *data_leafs;
+       mleaf_t *data_leafs;
 
        int num_leafbrushes;
        int *data_leafbrushes;
index cf47208..14712f7 100644 (file)
--- a/portals.c
+++ b/portals.c
@@ -334,12 +334,12 @@ typedef struct portalrecursioninfo_s
 }
 portalrecursioninfo_t;
 
-void Portal_RecursiveFlow_ExactMarkSurfaces(portalrecursioninfo_t *info, int *mark, int nummarksurfaces, int firstclipplane, int numclipplanes)
+void Portal_RecursiveFlow_ExactLeafFaces(portalrecursioninfo_t *info, int *mark, int numleaffaces, int firstclipplane, int numclipplanes)
 {
        int i, j, *elements;
        vec3_t trimins, trimaxs;
        msurface_t *surf;
-       for (i = 0;i < nummarksurfaces;i++, mark++)
+       for (i = 0;i < numleaffaces;i++, mark++)
        {
                if (!info->surfacemark[*mark])
                {
@@ -405,13 +405,13 @@ void Portal_RecursiveFlow (portalrecursioninfo_t *info, mleaf_t *leaf, int first
                info->leafmark[leaf - info->model->brushq1.data_leafs] = true;
 
        // mark surfaces in leaf that can be seen through portal
-       if (leaf->nummarksurfaces && info->surfacemark)
+       if (leaf->numleaffaces && info->surfacemark)
        {
                if (info->exact)
-                       Portal_RecursiveFlow_ExactMarkSurfaces(info, leaf->firstmarksurface, leaf->nummarksurfaces, firstclipplane, numclipplanes);
+                       Portal_RecursiveFlow_ExactLeafFaces(info, leaf->firstleafface, leaf->numleaffaces, firstclipplane, numclipplanes);
                else
-                       for (i = 0;i < leaf->nummarksurfaces;i++)
-                               info->surfacemark[leaf->firstmarksurface[i]] = true;
+                       for (i = 0;i < leaf->numleaffaces;i++)
+                               info->surfacemark[leaf->firstleafface[i]] = true;
        }
 
        // follow portals into other leafs
index 8f906ef..4c4643c 100644 (file)
--- a/r_light.c
+++ b/r_light.c
@@ -200,18 +200,18 @@ static void R_RecursiveMarkLights(entity_render_t *ent, vec3_t lightorigin, dlig
        // check if leaf is visible according to pvs
        leaf = (mleaf_t *)node;
        i = leaf->clusterindex;
-       if (leaf->nummarksurfaces && (i >= pvsbits || CHECKPVSBIT(pvs, i)))
+       if (leaf->numleaffaces && (i >= pvsbits || CHECKPVSBIT(pvs, i)))
        {
                int d, impacts, impactt;
                float sdist, maxdist, dist2, impact[3];
                msurface_t *surf;
                // mark the polygons
                maxdist = light->rtlight.lightmap_cullradius2;
-               for (i = 0;i < leaf->nummarksurfaces;i++)
+               for (i = 0;i < leaf->numleaffaces;i++)
                {
-                       if (ent == r_refdef.worldentity && !r_worldsurfacevisible[leaf->firstmarksurface[i]])
+                       if (ent == r_refdef.worldentity && !r_worldsurfacevisible[leaf->firstleafface[i]])
                                continue;
-                       surf = ent->model->brushq1.surfaces + leaf->firstmarksurface[i];
+                       surf = ent->model->brushq1.surfaces + leaf->firstleafface[i];
                        dist = sdist = PlaneDiff(lightorigin, surf->plane);
                        if (surf->flags & SURF_PLANEBACK)
                                dist = -dist;