qbsp: Rework CopyFacesToOutside as CopyBrushFaces
New version returns the list of copied faces. This was the last user of the inside and outside globals outside of CSGFaces, so they now move onto the local stack there. Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
parent
83c0fd541a
commit
e94d2b5cdd
23
qbsp/csg4.c
23
qbsp/csg4.c
|
|
@ -30,7 +30,6 @@ Brushes that touch still need to be split at the cut point to make a tjunction
|
|||
|
||||
*/
|
||||
|
||||
static face_t *inside, *outside;
|
||||
static int brushfaces;
|
||||
static int csgfaces;
|
||||
int csgmergefaces;
|
||||
|
|
@ -405,27 +404,28 @@ BuildSurfaces(face_t **planefaces)
|
|||
|
||||
/*
|
||||
==================
|
||||
CopyFacesToOutside
|
||||
CopyBrushFaces
|
||||
==================
|
||||
*/
|
||||
static void
|
||||
CopyFacesToOutside(const brush_t *brush)
|
||||
static face_t *
|
||||
CopyBrushFaces(const brush_t *brush)
|
||||
{
|
||||
face_t *face, *newface;
|
||||
|
||||
outside = NULL;
|
||||
face_t *facelist, *face, *newface;
|
||||
|
||||
facelist = NULL;
|
||||
for (face = brush->faces; face; face = face->next) {
|
||||
brushfaces++;
|
||||
newface = AllocMem(FACE, 1, true);
|
||||
*newface = *face;
|
||||
newface->next = outside;
|
||||
newface->contents[0] = CONTENTS_EMPTY;
|
||||
newface->contents[1] = brush->contents;
|
||||
newface->cflags[0] = 0;
|
||||
newface->cflags[1] = brush->cflags;
|
||||
outside = newface;
|
||||
newface->next = facelist;
|
||||
facelist = newface;
|
||||
}
|
||||
|
||||
return facelist;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -442,7 +442,7 @@ CSGFaces(const mapentity_t *entity)
|
|||
int i;
|
||||
const brush_t *brush, *clipbrush;
|
||||
const face_t *clipface;
|
||||
face_t **planefaces;
|
||||
face_t *inside, *outside, **planefaces;
|
||||
bool overwrite, mirror;
|
||||
surface_t *surfaces;
|
||||
int progress = 0;
|
||||
|
|
@ -459,8 +459,7 @@ CSGFaces(const mapentity_t *entity)
|
|||
* clipbrush => the brush we are clipping against
|
||||
*/
|
||||
for (brush = entity->brushes; brush; brush = brush->next) {
|
||||
// set outside to a copy of the brush's faces
|
||||
CopyFacesToOutside(brush);
|
||||
outside = CopyBrushFaces(brush);
|
||||
overwrite = false;
|
||||
clipbrush = entity->brushes;
|
||||
for (; clipbrush; clipbrush = clipbrush->next) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue