Whitespace.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2002-09-19 02:37:52 +00:00
parent b3f842ba65
commit 6376ebb253
13 changed files with 571 additions and 643 deletions

View file

@ -60,4 +60,3 @@ void TransformSample (vec3_t in, vec3_t out);
void RotateSample (vec3_t in, vec3_t out);
#endif// __light_h

View file

@ -93,7 +93,6 @@ MatchTargets (void)
{
int i, j;
for (i = 0; i < num_entities; i++) {
if (!entities[i].target[0])
continue;
@ -125,10 +124,10 @@ void
LoadEntities (void)
{
const char *data;
entity_t *entity;
char key[64];
epair_t *epair;
double vec[3];
entity_t *entity;
epair_t *epair;
int i;
data = dentdata;

View file

@ -26,10 +26,10 @@
*/
static const char rcsid[] =
"$Id$";
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
@ -91,9 +91,8 @@ vec_t
CastRay (vec3_t p1, vec3_t p2)
{
int i;
vec_t t;
qboolean trace;
vec_t t;
trace = TestLine (p1, p2);
@ -141,7 +140,6 @@ CalcFaceVectors (lightinfo_t *l)
float distscale;
vec_t dist, len;
tex = &texinfo[l->face->texinfo];
// convert from float to vec_t
@ -177,7 +175,8 @@ CalcFaceVectors (lightinfo_t *l)
dist = DotProduct (l->worldtotex[i], l->facenormal);
dist *= distscale;
VectorMA (l->worldtotex[i], -dist, texnormal, l->textoworld[i]);
VectorScale (l->textoworld[i], (1 / len) * (1 / len), l->textoworld[i]);
VectorScale (l->textoworld[i], (1 / len) * (1 / len),
l->textoworld[i]);
}
// calculate texorg on the texture plane
@ -189,7 +188,6 @@ CalcFaceVectors (lightinfo_t *l)
dist = DotProduct (l->texorg, l->facenormal) - l->facedist - 1;
dist *= distscale;
VectorMA (l->texorg, -dist, texnormal, l->texorg);
}
/*
@ -202,11 +200,10 @@ void
CalcFaceExtents (lightinfo_t *l)
{
dface_t *s;
vec_t mins[2], maxs[2], val;
int i, j, e;
dvertex_t *v;
int i, j, e;
texinfo_t *tex;
vec_t mins[2], maxs[2], val;
s = l->face;
@ -256,15 +253,11 @@ CalcFaceExtents (lightinfo_t *l)
void
CalcPoints (lightinfo_t *l)
{
int i;
int s, t, j;
int w, h, step;
vec_t starts, startt, us, ut;
int step, i, j , s, t, w, h;
vec_t mids, midt, starts, startt, us, ut;
vec_t *surf;
vec_t mids, midt;
vec3_t facemid, move;
// fill in surforg
// the points are biased towards the center of the surface
// to help avoid edge cases just inside walls
@ -345,20 +338,11 @@ CalcPoints (lightinfo_t *l)
void
SingleLightFace (entity_t *light, lightinfo_t *l)
{
vec_t dist;
vec3_t incoming;
vec_t angle;
vec_t add;
vec_t *surf;
int mapnum, size, c, i;
qboolean hit;
int mapnum;
int size;
int c, i;
vec3_t rel;
vec3_t spotvec;
vec_t falloff;
vec_t *lightsamp;
vec3_t incoming, rel, spotvec;
vec_t add, angle, dist, falloff;
vec_t *lightsamp, *surf;
VectorSubtract (light->origin, bsp_origin, rel);
dist = options.distance * (DotProduct (rel, l->facenormal) - l->facedist);
@ -437,9 +421,8 @@ SingleLightFace (entity_t *light, lightinfo_t *l)
void
FixMinlight (lightinfo_t *l)
{
int i, j;
float minlight;
int i, j;
minlight = minlights[l->surfnum];
@ -468,17 +451,12 @@ FixMinlight (lightinfo_t *l)
void
LightFace (int surfnum)
{
dface_t *f;
lightinfo_t l;
int s, t;
int i, j, c;
vec_t total;
int size;
int lightmapwidth, lightmapsize;
byte *out;
dface_t *f;
int lightmapwidth, lightmapsize, size, c, i, j, s, t, w, h;
lightinfo_t l;
vec_t total;
vec_t *light;
int w, h;
f = dfaces + surfnum;
@ -567,4 +545,3 @@ LightFace (int surfnum)
}
}
}

View file

@ -36,7 +36,6 @@ static const char rcsid[] =
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <getopt.h>
#include <errno.h>
#include <stdlib.h>
@ -77,7 +76,8 @@ usage (int status)
{
printf ("%s - QuakeForge light tool\n", this_program);
printf ("Usage: %s [options] bspfile\n", this_program);
printf ("Options:\n"
printf (
"Options:\n"
" -q, --quiet Inhibit usual output\n"
" -v, --verbose Display more output than usual\n"
" -h, --help Display this help and exit\n"

View file

@ -30,7 +30,6 @@ static const char rcsid[] =
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
@ -92,7 +91,6 @@ GetFileSpace (int size)
return buf;
}
void
LightThread (void *junk)
{

View file

@ -30,7 +30,6 @@ static const char rcsid[] =
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
@ -80,7 +79,6 @@ RunThreadsOn (threadfunc_t func)
pthread_attr_t attrib;
int i;
if (numthreads == 1) {
func (NULL);
return;
@ -92,7 +90,9 @@ RunThreadsOn (threadfunc_t func)
fprintf (stderr, "pthread_attr_setstacksize failed");
for (i = 0; i < numthreads; i++) {
if (pthread_create (&work_threads[i], attrib, (pthread_startroutine_t) func, (pthread_addr_t) i) == -1)
if (pthread_create (&work_threads[i], attrib,
(pthread_startroutine_t) func,
(pthread_addr_t) i) == -1)
fprintf (stderr, "pthread_create failed");
}

View file

@ -30,7 +30,6 @@ static const char rcsid[] =
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
@ -85,11 +84,10 @@ by recursive subdivision of the line by the BSP tree.
void
MakeTnode (int nodenum)
{
tnode_t *t;
dnode_t *node;
dplane_t *plane;
int i;
dnode_t *node;
tnode_t *t;
t = tnode_p++;
@ -126,15 +124,12 @@ MakeTnodes (dmodel_t *bm)
qboolean
TestLine (vec3_t start, vec3_t stop)
{
int node;
float front, back;
float front, back, frontx, fronty, frontz, backx, backy, backz;
int node, side;
tracestack_t *tstack_p;
int side;
float frontx, fronty, frontz, backx, backy, backz;
tracestack_t tracestack[64];
tnode_t *tnode;
frontx = start[0];
fronty = start[1];
frontz = start[2];
@ -194,16 +189,14 @@ TestLine (vec3_t start, vec3_t stop)
break;
}
if (front > -ON_EPSILON && back > -ON_EPSILON)
// if (front > 0 && back > 0)
{
if (front > -ON_EPSILON && back > -ON_EPSILON) {
// if (front > 0 && back > 0) {
node = tnode->children[0];
continue;
}
if (front < ON_EPSILON && back < ON_EPSILON)
// if (front <= 0 && back <= 0)
{
if (front < ON_EPSILON && back < ON_EPSILON) {
// if (front <= 0 && back <= 0) {
node = tnode->children[1];
continue;
}
@ -227,4 +220,3 @@ TestLine (vec3_t start, vec3_t stop)
node = tnode->children[side];
}
}

View file

@ -134,4 +134,3 @@ void PortalFlow (portal_t *portal);
void CalcAmbientSounds (void);
#endif// __vis_h

View file

@ -73,7 +73,6 @@ CheckStack (leaf_t *leaf, threaddata_t *thread)
{
pstack_t *p;
for (p = thread->pstack_head.next; p; p = p->next)
if (p->leaf == leaf)
fprintf (stderr, "CheckStack: leaf recursion");
@ -97,21 +96,20 @@ winding_t *
ClipToSeperators (winding_t *source, winding_t *pass, winding_t *target,
qboolean flipclip)
{
int i, j, k, l;
plane_t plane;
vec3_t v1, v2;
float d;
vec_t length;
int i, j, k, l;
int counts[3];
qboolean fliptest;
plane_t plane;
vec3_t v1, v2;
vec_t length;
// check all combinations
for (i = 0; i < source->numpoints; i++) {
l = (i + 1) % source->numpoints;
VectorSubtract (source->points[l], source->points[i], v1);
// fing a vertex of pass that makes a plane that puts all of the
// find a vertex of pass that makes a plane that puts all of the
// vertexes of pass on the front side and all of the vertexes of
// source on the back side
for (j = 0; j < pass->numpoints; j++) {
@ -212,14 +210,13 @@ void
RecursiveLeafFlow (int leafnum, threaddata_t *thread, pstack_t *prevstack)
{
int i, j;
leaf_t *leaf;
long *test, *might, *vis;
qboolean more;
pstack_t stack;
portal_t *p;
plane_t backplane;
winding_t *source, *target;
leaf_t *leaf;
long *test, *might, *vis;
qboolean more;
c_chains++;
@ -361,7 +358,6 @@ PortalFlow (portal_t *p)
{
threaddata_t data;
if (p->status != stat_working)
fprintf (stderr, "PortalFlow: reflowed");
p->status = stat_working;
@ -394,7 +390,6 @@ SimpleFlood (portal_t *srcportal, int leafnum)
leaf_t *leaf;
portal_t *p;
if (srcportal->mightsee[leafnum >> 3] & (1 << (leafnum & 7)))
return;
srcportal->mightsee[leafnum >> 3] |= (1 << (leafnum & 7));
@ -418,7 +413,6 @@ BasePortalVis (void)
portal_t *tp, *p;
winding_t *winding;
for (i = 0, p = portals; i < numportals * 2; i++, p++) {
p->mightsee = malloc (bitbytes);
memset (p->mightsee, 0, bitbytes);
@ -459,4 +453,3 @@ BasePortalVis (void)
p->nummightsee = c_leafsee;
}
}

View file

@ -30,7 +30,6 @@ static const char rcsid[] =
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
@ -68,6 +67,7 @@ static const char *short_options =
"f:" // file
;
void
usage (int status)
{
@ -82,8 +82,7 @@ usage (int status)
" -t, --threads [num] Number of threads to use\n"
" -m, --minimal Perform minimal vis'ing\n"
" -l, --level [level] Vis level to perform\n"
" -f, --file [bspfile] BSP file to vis\n\n"
);
" -f, --file [bspfile] BSP file to vis\n\n");
exit (status);
}

View file

@ -30,7 +30,6 @@ static const char rcsid[] =
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
@ -94,7 +93,6 @@ NormalizePlane (plane_t *dp)
{
vec_t ax, ay, az;
if (dp->normal[0] == -1.0) {
dp->normal[0] = 1.0;
dp->dist = -dp->dist;
@ -143,7 +141,6 @@ PlaneFromWinding (winding_t *winding, plane_t *plane)
{
vec3_t v1, v2;
// calc plane
VectorSubtract (winding->points[2], winding->points[1], v1);
VectorSubtract (winding->points[0], winding->points[1], v2);
@ -158,7 +155,6 @@ NewWinding (int points)
winding_t *winding;
int size;
if (points > MAX_POINTS_ON_WINDING)
fprintf (stderr, "NewWinding: %i points\n", points);
@ -197,7 +193,6 @@ prl (leaf_t *leaf)
portal_t *portal;
plane_t plane;
for (i = 0; i < leaf->numportals; i++) {
portal = leaf->portals[i];
plane = portal->plane;
@ -214,7 +209,6 @@ CopyWinding (winding_t *winding)
int size;
winding_t *copy;
size = (int) ((winding_t *) 0)->points[winding->numpoints];
copy = malloc (size);
memcpy (copy, winding, size);
@ -236,16 +230,14 @@ CopyWinding (winding_t *winding)
winding_t *
ClipWinding (winding_t *in, plane_t *split, qboolean keepon)
{
int i, j;
vec_t dists[MAX_POINTS_ON_WINDING];
int maxpts, i, j;
int sides[MAX_POINTS_ON_WINDING];
int counts[3];
vec_t dists[MAX_POINTS_ON_WINDING];
vec_t dot;
vec_t *p1, *p2;
vec3_t mid;
winding_t *neww;
int maxpts;
counts[0] = counts[1] = counts[2] = 0;
@ -337,7 +329,6 @@ GetNextPortal (void)
portal_t *p, *tp;
int min;
LOCK;
min = 99999;
@ -358,11 +349,11 @@ GetNextPortal (void)
return p;
}
void *LeafThread (void *thread)
void *
LeafThread (void *thread)
{
portal_t *portal;
do {
portal = GetNextPortal ();
if (!portal)
@ -388,7 +379,6 @@ CompressRow (byte *vis, byte *dest)
int visrow;
byte *dest_p;
dest_p = dest;
visrow = (portalleafs + 7) >> 3;
@ -418,15 +408,12 @@ CompressRow (byte *vis, byte *dest)
void
LeafFlow (int leafnum)
{
int i, j;
leaf_t *leaf;
byte *outbuffer;
byte *dest, *outbuffer;
byte compressed[MAX_MAP_LEAFS / 8];
int numvis;
byte *dest;
int numbvis, i, j;
leaf_t *leaf;
portal_t *portal;
// flow through all portals, collecting visible bits
outbuffer = uncompressed + leafnum * bitbytes;
leaf = &leafs[leafnum];
@ -467,6 +454,7 @@ LeafFlow (int leafnum)
int d = dest - dvisdata;
int p = vismap_p - dvisdata;
int e = vismap_end - dvisdata;
visdatasize = p;
vismap = dvisdata = realloc (dvisdata, visdatasize);
dest = dvisdata + d;
@ -485,7 +473,6 @@ CalcPortalVis (void)
{
int i;
// fastvis just uses mightsee for a very loose bound
if (options.minimal) {
for (i = 0; i < numportals * 2; i++) {
@ -507,7 +494,8 @@ CalcPortalVis (void)
my_mutex = malloc (sizeof (*my_mutex));
if (pthread_mutexattr_init (&mattrib) == -1)
fprintf (stderr, "pthread_mutex_attr_create failed\n");
//if (pthread_mutexattr_settype (&mattrib, PTHREAD_MUTEX_ADAPTIVE_NP) == -1)
// if (pthread_mutexattr_settype (&mattrib, PTHREAD_MUTEX_ADAPTIVE_NP)
// == -1)
// fprintf (stderr, "pthread_mutexattr_setkind_np failed\n");
if (pthread_mutex_init (my_mutex, &mattrib) == -1)
fprintf (stderr, "pthread_mutex_init failed\n");
@ -538,7 +526,6 @@ CalcPortalVis (void)
c_portalcheck, c_portaltest, c_portalpass);
printf ("c_vistest: %i c_mighttest: %i\n", c_vistest, c_mighttest);
}
}
void
@ -546,9 +533,7 @@ CalcVis (void)
{
int i;
BasePortalVis ();
CalcPortalVis ();
// assemble the leaf vis lists by oring and compressing the portal lists
@ -564,7 +549,6 @@ PlaneCompare (plane_t *p1, plane_t *p2)
{
int i;
if (fabs (p1->dist - p2->dist) > 0.01)
return false;
@ -578,15 +562,14 @@ PlaneCompare (plane_t *p1, plane_t *p2)
sep_t *
Findpassages (winding_t *source, winding_t *pass)
{
double length;
float d;
int counts[3];
int i, j, k, l;
plane_t plane;
vec3_t v1, v2;
float d;
double length;
int counts[3];
qboolean fliptest;
sep_t *sep, *list;
vec3_t v1, v2;
list = NULL;
@ -595,7 +578,7 @@ Findpassages (winding_t *source, winding_t *pass)
l = (i + 1) % source->numpoints;
VectorSubtract (source->points[l], source->points[i], v1);
// fing a vertex of pass that makes a plane that puts all of the
// find a vertex of pass that makes a plane that puts all of the
// vertexes of pass on the front side and all of the vertexes of
// source on the back side
for (j = 0; j < pass->numpoints; j++) {
@ -684,14 +667,12 @@ Findpassages (winding_t *source, winding_t *pass)
void
CalcPassages (void)
{
int i, j, k;
int count, count2;
int count, count2, i, j, k;
leaf_t *leaf;
portal_t *p1, *p2;
sep_t *sep;
passage_t *passages;
if (options.verbosity >= 0)
printf ("building passages...\n");
@ -740,16 +721,14 @@ CalcPassages (void)
void
LoadPortals (char *name)
{
int i, j;
portal_t *portal;
leaf_t *leaf;
winding_t *winding;
plane_t plane;
char magic[80];
FILE *f;
int numpoints;
int leafnums[2];
int numpoints, i, j;
leaf_t *leaf;
plane_t plane;
portal_t *portal;
winding_t *winding;
if (!strcmp (name, "-"))
f = stdin;
@ -792,7 +771,8 @@ LoadPortals (char *name)
&leafnums[1]) != 3)
fprintf (stderr, "LoadPortals: reading portal %i\n", i);
if (numpoints > MAX_POINTS_ON_WINDING)
fprintf (stderr, "LoadPortals: portal %i has too many points\n", i);
fprintf (stderr, "LoadPortals: portal %i has too many points\n",
i);
if ((unsigned) leafnums[0] > portalleafs
|| (unsigned) leafnums[1] > portalleafs)
fprintf (stderr, "LoadPortals: reading portal %i\n", i);
@ -802,7 +782,6 @@ LoadPortals (char *name)
winding->numpoints = numpoints;
for (j = 0; j < numpoints; j++) {
double v[3];
int k;
@ -864,7 +843,6 @@ main (int argc, char **argv)
usage (1);
}
COM_StripExtension (options.bspfile, options.bspfile);
COM_DefaultExtension (options.bspfile, ".bsp");

View file

@ -30,7 +30,6 @@ static const char rcsid[] =
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <getopt.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
@ -69,9 +68,7 @@ static const char rcsid[] =
void
SurfaceBBox (dface_t *s, vec3_t mins, vec3_t maxs)
{
int i, j;
int e;
int vi;
int vi, e, i, j;
float *v;
mins[0] = mins[1] = 999999;
@ -97,18 +94,15 @@ SurfaceBBox (dface_t *s, vec3_t mins, vec3_t maxs)
void
CalcAmbientSounds (void)
{
int i, j, k, l;
dleaf_t *leaf, *hit;
byte *vis;
dface_t *surf;
dleaf_t *leaf, *hit;
float maxd, vol, d;
float dists[NUM_AMBIENTS];
int ambient_type, ofs, i, j, k, l;
vec3_t mins, maxs;
float d, maxd;
int ambient_type;
texinfo_t *info;
miptex_t *miptex;
int ofs;
float dists[NUM_AMBIENTS];
float vol;
for (i = 0; i < portalleafs; i++) {
leaf = &dleafs[i + 1];