various var cleanups

This commit is contained in:
Bill Currie 2002-09-23 22:54:28 +00:00
parent 918f2dd203
commit ded572b31f
3 changed files with 17 additions and 29 deletions

View File

@ -117,16 +117,15 @@ extern int c_portalpass;
extern int c_portalcheck; extern int c_portalcheck;
extern int bitbytes; extern int bitbytes;
extern int bitlongs; extern int bitlongs;
extern struct bsp_s *bsp;
extern portal_t *portals; extern portal_t *portals;
extern leaf_t *leafs; extern leaf_t *leafs;
extern qboolean showgetleaf;
extern byte *vismap, *vismap_p, *vismap_end; // past visfile
extern byte *uncompressed; extern byte *uncompressed;
extern int c_portalskip, c_leafskip;
extern int c_vistest, c_mighttest;
extern int c_chains; extern int c_chains;
extern int c_mighttest;
extern int c_vistest;
void FreeWinding (winding_t *winding); void FreeWinding (winding_t *winding);
winding_t *NewWinding (int points); winding_t *NewWinding (int points);
@ -138,6 +137,4 @@ void BasePortalVis (void);
void PortalFlow (portal_t *portal); void PortalFlow (portal_t *portal);
void CalcAmbientSounds (void); void CalcAmbientSounds (void);
extern struct bsp_s *bsp;
#endif// __vis_h #endif// __vis_h

View File

@ -59,13 +59,8 @@ static const char rcsid[] =
#include "vis.h" #include "vis.h"
#include "options.h" #include "options.h"
int c_chains; static int leafsee;
int c_portalskip, c_leafskip; static byte portalsee[MAX_PORTALS];
int c_vistest, c_mighttest;
int c_leafsee, c_portalsee;
byte portalsee[MAX_PORTALS];
void void
CheckStack (leaf_t *leaf, threaddata_t *thread) CheckStack (leaf_t *leaf, threaddata_t *thread)
@ -240,10 +235,8 @@ RecursiveLeafFlow (int leafnum, threaddata_t *thread, pstack_t *prevstack)
for (i = 0; i < leaf->numportals; i++) { for (i = 0; i < leaf->numportals; i++) {
p = leaf->portals[i]; p = leaf->portals[i];
if (!(prevstack->mightsee[p->leaf >> 3] & (1 << (p->leaf & 7)))) { if (!(prevstack->mightsee[p->leaf >> 3] & (1 << (p->leaf & 7))))
c_leafskip++;
continue; // can't possibly see it continue; // can't possibly see it
}
// if the portal can't see anything we haven't already seen, skip it // if the portal can't see anything we haven't already seen, skip it
if (p->status == stat_done) { if (p->status == stat_done) {
c_vistest++; c_vistest++;
@ -259,10 +252,9 @@ RecursiveLeafFlow (int leafnum, threaddata_t *thread, pstack_t *prevstack)
more = true; more = true;
} }
if (!more) { // can't see anything new if (!more) // can't see anything new
c_portalskip++;
continue; continue;
}
// get plane of portal, point normal into the neighbor leaf // get plane of portal, point normal into the neighbor leaf
stack.portalplane = p->plane; stack.portalplane = p->plane;
VectorSubtract (vec3_origin, p->plane.normal, backplane.normal); VectorSubtract (vec3_origin, p->plane.normal, backplane.normal);
@ -393,7 +385,7 @@ SimpleFlood (portal_t *srcportal, int leafnum)
if (srcportal->mightsee[leafnum >> 3] & (1 << (leafnum & 7))) if (srcportal->mightsee[leafnum >> 3] & (1 << (leafnum & 7)))
return; return;
srcportal->mightsee[leafnum >> 3] |= (1 << (leafnum & 7)); srcportal->mightsee[leafnum >> 3] |= (1 << (leafnum & 7));
c_leafsee++; leafsee++;
leaf = &leafs[leafnum]; leaf = &leafs[leafnum];
@ -416,7 +408,6 @@ BasePortalVis (void)
for (i = 0, p = portals; i < numportals * 2; i++, p++) { for (i = 0, p = portals; i < numportals * 2; i++, p++) {
p->mightsee = calloc (1, bitbytes); p->mightsee = calloc (1, bitbytes);
c_portalsee = 0;
memset (portalsee, 0, numportals * 2); memset (portalsee, 0, numportals * 2);
for (j = 0, tp = portals; j < numportals * 2; j++, tp++) { for (j = 0, tp = portals; j < numportals * 2; j++, tp++) {
@ -444,11 +435,10 @@ BasePortalVis (void)
continue; // no points on front continue; // no points on front
portalsee[j] = 1; portalsee[j] = 1;
c_portalsee++;
} }
c_leafsee = 0; leafsee = 0;
SimpleFlood (p, p->leaf); SimpleFlood (p, p->leaf);
p->nummightsee = c_leafsee; p->nummightsee = leafsee;
} }
} }

View File

@ -70,21 +70,23 @@ bsp_t *bsp;
options_t options; options_t options;
int numportals; int c_chains;
int portalleafs; int c_mighttest;
int c_portaltest; int c_portaltest;
int c_portalpass; int c_portalpass;
int c_portalcheck; int c_portalcheck;
int c_vistest;
int numportals;
int portalleafs;
int originalvismapsize; int originalvismapsize;
int totalvis; int totalvis;
int count_sep; int count_sep;
int bitbytes; // (portalleafs + 63)>>3 int bitbytes; // (portalleafs + 63)>>3
int bitlongs; int bitlongs;
int leafon; // the next leaf to be given to a thread to process
portal_t *portals; portal_t *portals;
leaf_t *leafs; leaf_t *leafs;
qboolean showgetleaf = true;
dstring_t *visdata; dstring_t *visdata;
byte *uncompressed; // [bitbytes * portalleafs] byte *uncompressed; // [bitbytes * portalleafs]
@ -381,7 +383,6 @@ CalcPortalVis (void)
return; return;
} }
leafon = 0;
#ifdef HAVE_PTHREAD_H #ifdef HAVE_PTHREAD_H
{ {
pthread_t work_threads[MAX_THREADS]; pthread_t work_threads[MAX_THREADS];