From 746a210f2ad583913d97390294a3130445cac0d9 Mon Sep 17 00:00:00 2001 From: Kevin Shanahan Date: Mon, 18 Feb 2013 11:01:11 +1030 Subject: [PATCH] qbsp: remove hullnum global and pass to CreateSingleHull() Signed-off-by: Kevin Shanahan --- qbsp/globals.c | 1 - qbsp/qbsp.c | 30 ++++++++++-------------------- qbsp/qbsp.h | 2 -- 3 files changed, 10 insertions(+), 23 deletions(-) diff --git a/qbsp/globals.c b/qbsp/globals.c index c5070308..95b88c9c 100644 --- a/qbsp/globals.c +++ b/qbsp/globals.c @@ -38,7 +38,6 @@ const int rgcMemSize[GLOBAL + 1] = { }; mapdata_t map; -int hullnum; // Useful shortcuts mapentity_t *pWorldEnt; diff --git a/qbsp/qbsp.c b/qbsp/qbsp.c index 13ea2e86..6dab3182 100644 --- a/qbsp/qbsp.c +++ b/qbsp/qbsp.c @@ -35,7 +35,7 @@ ProcessEntity =============== */ static void -ProcessEntity(mapentity_t *ent) +ProcessEntity(mapentity_t *ent, const int hullnum) { surface_t *surfs; node_t *nodes; @@ -173,7 +173,7 @@ CreateSingleHull ================= */ static void -CreateSingleHull(void) +CreateSingleHull(const int hullnum) { int i; mapentity_t *ent; @@ -183,7 +183,7 @@ CreateSingleHull(void) // for each entity in the map file that has geometry for (i = 0, ent = map.entities; i < map.numentities; i++, ent++) { - ProcessEntity(ent); + ProcessEntity(ent, hullnum); if (!options.fAllverbose) options.fVerbose = false; // don't print rest of entities } @@ -200,28 +200,18 @@ CreateHulls(void) { PlaneHash_Init(); - // commanded to create a single hull only - if (hullnum) { - CreateSingleHull(); - exit(0); - } - // commanded to ignore the hulls altogether - if (options.fNoclip) { - CreateSingleHull(); - return; - } - // create the hulls sequentially + /* create the hulls sequentially */ if (!options.fNoverbose) options.fVerbose = true; - hullnum = 0; - CreateSingleHull(); - hullnum = 1; - CreateSingleHull(); + CreateSingleHull(0); - hullnum = 2; - CreateSingleHull(); + /* ignore the clipping hulls altogether */ + if (options.fNoclip) + return; + CreateSingleHull(1); + CreateSingleHull(2); } diff --git a/qbsp/qbsp.h b/qbsp/qbsp.h index 4a9c8b41..627b0b05 100644 --- a/qbsp/qbsp.h +++ b/qbsp/qbsp.h @@ -556,8 +556,6 @@ typedef struct options_s { extern options_t options; -extern int hullnum; - //============================================================================= // map.c