qbsp: return first face number from MakeFaceEdges and pass to ExportDrawNodes
Removes another global variable. Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
parent
26c2789d7e
commit
926cf8eb95
|
|
@ -37,7 +37,7 @@ ProcessEntity
|
|||
static void
|
||||
ProcessEntity(mapentity_t *ent, const int hullnum)
|
||||
{
|
||||
int i, numportals;
|
||||
int i, numportals, firstface;
|
||||
surface_t *surfs;
|
||||
node_t *nodes;
|
||||
const char *classname;
|
||||
|
|
@ -180,8 +180,9 @@ ProcessEntity(mapentity_t *ent, const int hullnum)
|
|||
}
|
||||
|
||||
ExportNodePlanes(nodes);
|
||||
MakeFaceEdges(ent, nodes);
|
||||
ExportDrawNodes(ent, nodes);
|
||||
|
||||
firstface = MakeFaceEdges(ent, nodes);
|
||||
ExportDrawNodes(ent, nodes, firstface);
|
||||
}
|
||||
|
||||
map.cTotal[BSPMODEL]++;
|
||||
|
|
|
|||
|
|
@ -653,9 +653,9 @@ surface_t *CSGFaces(const mapentity_t *ent);
|
|||
int PortalizeWorld(const mapentity_t *ent, node_t *headnode, const int hullnum);
|
||||
void TJunc(const mapentity_t *ent, node_t *headnode);
|
||||
node_t *SolidBSP(const mapentity_t *ent, surface_t *surfhead, bool midsplit);
|
||||
void MakeFaceEdges(mapentity_t *ent, node_t *headnode);
|
||||
int MakeFaceEdges(mapentity_t *ent, node_t *headnode);
|
||||
void ExportClipNodes(mapentity_t *ent, node_t *headnode, const int hullnum);
|
||||
void ExportDrawNodes(mapentity_t *ent, node_t *headnode);
|
||||
void ExportDrawNodes(mapentity_t *ent, node_t *headnode, int firstface);
|
||||
|
||||
// util.c
|
||||
|
||||
|
|
|
|||
|
|
@ -436,10 +436,10 @@ CountData_r(mapentity_t *ent, node_t *node)
|
|||
MakeFaceEdges
|
||||
================
|
||||
*/
|
||||
void
|
||||
int
|
||||
MakeFaceEdges(mapentity_t *ent, node_t *headnode)
|
||||
{
|
||||
int i;
|
||||
int i, firstface;
|
||||
void *pTemp;
|
||||
struct lumpdata *surfedges = &ent->lumps[BSPSURFEDGE];
|
||||
struct lumpdata *edges = &ent->lumps[BSPEDGE];
|
||||
|
|
@ -475,6 +475,7 @@ MakeFaceEdges(mapentity_t *ent, node_t *headnode)
|
|||
c_tryedges = 0;
|
||||
iNodes = 0;
|
||||
|
||||
firstface = map.cTotal[BSPFACE];
|
||||
MakeFaceEdges_r(ent, headnode);
|
||||
|
||||
FreeMem(pHashverts, HASHVERT, vertices->count);
|
||||
|
|
@ -502,4 +503,6 @@ MakeFaceEdges(mapentity_t *ent, node_t *headnode)
|
|||
|
||||
Message(msgProgress, "GrowRegions");
|
||||
GrowNodeRegion_r(ent, headnode);
|
||||
|
||||
return firstface;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@
|
|||
#include "qbsp.h"
|
||||
#include "wad.h"
|
||||
|
||||
static int firstface;
|
||||
|
||||
static void
|
||||
ExportNodePlanes_r(node_t *node, int *planemap)
|
||||
{
|
||||
|
|
@ -379,7 +377,7 @@ ExportDrawNodes
|
|||
==================
|
||||
*/
|
||||
void
|
||||
ExportDrawNodes(mapentity_t *entity, node_t *headnode)
|
||||
ExportDrawNodes(mapentity_t *entity, node_t *headnode, int firstface)
|
||||
{
|
||||
int i;
|
||||
dmodel_t *dmodel;
|
||||
|
|
@ -405,7 +403,6 @@ ExportDrawNodes(mapentity_t *entity, node_t *headnode)
|
|||
dmodel->headnode[0] = map.cTotal[BSPNODE];
|
||||
dmodel->firstface = firstface;
|
||||
dmodel->numfaces = map.cTotal[BSPFACE] - firstface;
|
||||
firstface = map.cTotal[BSPFACE];
|
||||
|
||||
if (headnode->contents < 0)
|
||||
ExportLeaf(entity, headnode);
|
||||
|
|
@ -434,8 +431,6 @@ BeginBSPFile
|
|||
void
|
||||
BeginBSPFile(void)
|
||||
{
|
||||
firstface = 0;
|
||||
|
||||
// First edge must remain unused because 0 can't be negated
|
||||
pWorldEnt->lumps[BSPEDGE].count++;
|
||||
pWorldEnt->lumps[BSPEDGE].index++;
|
||||
|
|
|
|||
Loading…
Reference in New Issue