More braces and whitespace.

This commit is contained in:
Bill Currie 2010-08-30 16:58:40 +09:00
parent 313677ee96
commit 4b1b838f87
3 changed files with 25 additions and 19 deletions

View File

@ -165,7 +165,7 @@ ChooseMidPlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs)
The real BSP hueristic The real BSP hueristic
*/ */
static surface_t * static surface_t *
ChoosePlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs, ChoosePlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs,
qboolean usefloors, qboolean usedetail) qboolean usefloors, qboolean usedetail)
{ {
@ -263,7 +263,7 @@ ChoosePlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs,
Selects a surface from a linked list of surfaces to split the group on Selects a surface from a linked list of surfaces to split the group on
returns NULL if the surface list can not be divided any more (a leaf) returns NULL if the surface list can not be divided any more (a leaf)
*/ */
static surface_t * static surface_t *
SelectPartition (surface_t *surfaces, int *detail) SelectPartition (surface_t *surfaces, int *detail)
{ {
int i, j; int i, j;
@ -275,11 +275,12 @@ SelectPartition (surface_t *surfaces, int *detail)
// count onnode surfaces // count onnode surfaces
i = 0; i = 0;
bestsurface = NULL; bestsurface = NULL;
for (p = surfaces; p; p = p->next) for (p = surfaces; p; p = p->next) {
if (!p->onnode) { if (!p->onnode) {
i++; i++;
bestsurface = p; bestsurface = p;
} }
}
if (i == 0) if (i == 0)
return NULL; return NULL;
@ -296,13 +297,14 @@ SelectPartition (surface_t *surfaces, int *detail)
maxs[i] = -BOGUS_RANGE; maxs[i] = -BOGUS_RANGE;
} }
for (p = surfaces; p; p = p->next) for (p = surfaces; p; p = p->next) {
for (j = 0; j < 3; j++) { for (j = 0; j < 3; j++) {
if (p->mins[j] < mins[j]) if (p->mins[j] < mins[j])
mins[j] = p->mins[j]; mins[j] = p->mins[j];
if (p->maxs[j] > maxs[j]) if (p->maxs[j] > maxs[j])
maxs[j] = p->maxs[j]; maxs[j] = p->maxs[j];
} }
}
if (usemidsplit) // do fast way for clipping hull if (usemidsplit) // do fast way for clipping hull
return ChooseMidPlaneFromList (surfaces, mins, maxs); return ChooseMidPlaneFromList (surfaces, mins, maxs);
@ -328,7 +330,7 @@ SelectPartition (surface_t *surfaces, int *detail)
Calculates the bounding box Calculates the bounding box
*/ */
void void
CalcSurfaceInfo (surface_t * surf) CalcSurfaceInfo (surface_t *surf)
{ {
face_t *f; face_t *f;
int i, j; int i, j;
@ -346,13 +348,14 @@ CalcSurfaceInfo (surface_t * surf)
winding_t *fp = f->points; winding_t *fp = f->points;
if (f->contents[0] >= 0 || f->contents[1] >= 0) if (f->contents[0] >= 0 || f->contents[1] >= 0)
Sys_Error ("Bad contents"); Sys_Error ("Bad contents");
for (i = 0; i < fp->numpoints; i++) for (i = 0; i < fp->numpoints; i++) {
for (j = 0; j < 3; j++) { for (j = 0; j < 3; j++) {
if (fp->points[i][j] < surf->mins[j]) if (fp->points[i][j] < surf->mins[j])
surf->mins[j] = fp->points[i][j]; surf->mins[j] = fp->points[i][j];
if (fp->points[i][j] > surf->maxs[j]) if (fp->points[i][j] > surf->maxs[j])
surf->maxs[j] = fp->points[i][j]; surf->maxs[j] = fp->points[i][j];
} }
}
} }
} }
@ -554,7 +557,7 @@ LinkConvexFaces (surface_t *planelist, node_t *leafnode)
Returns a duplicated list of all faces on surface Returns a duplicated list of all faces on surface
*/ */
static face_t * static face_t *
LinkNodeFaces (surface_t *surface) LinkNodeFaces (surface_t *surface)
{ {
face_t *list, *new, **prevptr, *f; face_t *list, *new, **prevptr, *f;
@ -643,7 +646,7 @@ PartitionSurfaces (surface_t *surfaces, node_t *node)
PartitionSurfaces (backlist, node->children[1]); PartitionSurfaces (backlist, node->children[1]);
} }
node_t * node_t *
SolidBSP (surface_t *surfhead, qboolean midsplit) SolidBSP (surface_t *surfhead, qboolean midsplit)
{ {
int i; int i;

View File

@ -189,7 +189,7 @@ GatherNodeFaces_r (node_t *node)
} }
} }
surface_t * surface_t *
GatherNodeFaces (node_t *headnode) GatherNodeFaces (node_t *headnode)
{ {
memset (validfaces, 0, sizeof (validfaces)); memset (validfaces, 0, sizeof (validfaces));

View File

@ -111,33 +111,36 @@ CanonicalVector (vec3_t vec)
if (len < EQUAL_EPSILON) if (len < EQUAL_EPSILON)
return false; return false;
if (vec[0] > EQUAL_EPSILON) if (vec[0] > EQUAL_EPSILON) {
return true; return true;
else if (vec[0] < -EQUAL_EPSILON) { } else if (vec[0] < -EQUAL_EPSILON) {
VectorNegate (vec, vec); VectorNegate (vec, vec);
return true; return true;
} else } else {
vec[0] = 0; vec[0] = 0;
}
if (vec[1] > EQUAL_EPSILON) if (vec[1] > EQUAL_EPSILON) {
return true; return true;
else if (vec[1] < -EQUAL_EPSILON) { } else if (vec[1] < -EQUAL_EPSILON) {
VectorNegate (vec, vec); VectorNegate (vec, vec);
return true; return true;
} else } else {
vec[1] = 0; vec[1] = 0;
}
if (vec[2] > EQUAL_EPSILON) if (vec[2] > EQUAL_EPSILON) {
return true; return true;
else if (vec[2] < -EQUAL_EPSILON) { } else if (vec[2] < -EQUAL_EPSILON) {
VectorNegate (vec, vec); VectorNegate (vec, vec);
return true; return true;
} else } else {
vec[2] = 0; vec[2] = 0;
}
return false; return false;
} }
static wedge_t * static wedge_t *
FindEdge (vec3_t p1, vec3_t p2, vec_t *t1, vec_t *t2) FindEdge (vec3_t p1, vec3_t p2, vec_t *t1, vec_t *t2)
{ {
int h; int h;