From 4fea8f28b5b076f130ffc78813685ff93c55bb92 Mon Sep 17 00:00:00 2001 From: Kevin Shanahan Date: Wed, 6 Mar 2013 09:39:15 +1030 Subject: [PATCH] qbsp: place outside filling number into mapdata global Remove the (file) global fillmark from outside.c and place into the global mapadata. Pass the fillmark into RecursiveFillOutside as a read-only parameter instead. Signed-off-by: Kevin Shanahan --- qbsp/outside.c | 10 +++++----- qbsp/qbsp.h | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/qbsp/outside.c b/qbsp/outside.c index 36e8425b..76a73127 100644 --- a/qbsp/outside.c +++ b/qbsp/outside.c @@ -30,10 +30,10 @@ typedef struct { typedef struct { bool fill; int hullnum; + int fillmark; int numportals; } fillparms_t; -static int fillmark; static int numports; static bool firstone = true; static FILE *LeakFile; @@ -338,7 +338,7 @@ RecursiveFillOutside(fillstate_t *state, const fillparms_t *parms, node_t *node) if (node->contents == CONTENTS_SOLID || node->contents == CONTENTS_SKY) return false; - if (node->fillmark == fillmark) + if (node->fillmark == parms->fillmark) return false; if (node->occupied) { @@ -348,7 +348,7 @@ RecursiveFillOutside(fillstate_t *state, const fillparms_t *parms, node_t *node) return true; } - node->fillmark = fillmark; + node->fillmark = parms->fillmark; // fill it and it's neighbors if (parms->fill) { @@ -468,10 +468,10 @@ FillOutside(node_t *node, const int hullnum, const int numportals) fillstate.backdraw = 0; fillstate.hit_occupied = 0; numleaks = 0; - fillmark++; /* first check to see if an occupied leaf is hit */ fillparms.fill = false; + fillparms.fillmark = ++map.fillmark; side = !(outside_node.portals->nodes[1] == &outside_node); fillnode = outside_node.portals->nodes[side]; if (RecursiveFillOutside(&fillstate, &fillparms, fillnode)) { @@ -519,8 +519,8 @@ FillOutside(node_t *node, const int hullnum, const int numportals) } /* now go back and fill things in */ - fillmark++; fillparms.fill = true; + fillparms.fillmark = ++map.fillmark; fillnode = outside_node.portals->nodes[side]; RecursiveFillOutside(&fillstate, &fillparms, fillnode); diff --git a/qbsp/qbsp.h b/qbsp/qbsp.h index 04da49a7..0585fbfa 100644 --- a/qbsp/qbsp.h +++ b/qbsp/qbsp.h @@ -625,8 +625,11 @@ typedef struct mapdata_s { plane_t *planes; miptex_t *miptex; - // Totals for BSP data items + /* Totals for BSP data items -> TODO: move to a bspdata struct? */ int cTotal[BSP_LUMPS]; + + /* Misc other global state for the compile process */ + int fillmark; /* For marking leaves while outside filling */ } mapdata_t; extern mapdata_t map;