diff --git a/tools/qfbsp/include/brush.h b/tools/qfbsp/include/brush.h index 884f56546..248dc97c9 100644 --- a/tools/qfbsp/include/brush.h +++ b/tools/qfbsp/include/brush.h @@ -33,19 +33,19 @@ #define NUM_CONTENTS 2 // solid and water typedef struct brush_s { - struct brush_s *next; - vec3_t mins, maxs; + struct brush_s *next; + vec3_t mins, maxs; struct visfacet_s *faces; - int contents; + int contents; } brush_t; typedef struct brushset_s { - vec3_t mins, maxs; - brush_t *brushes; // NULL terminated list + vec3_t mins, maxs; + brush_t *brushes; // NULL terminated list } brushset_t; -extern int numbrushplanes; -extern plane_t planes[MAX_MAP_PLANES]; +extern int numbrushplanes; +extern plane_t planes[MAX_MAP_PLANES]; brushset_t *Brush_LoadEntity (entity_t *ent, int hullnum); diff --git a/tools/qfbsp/include/bsp5.h b/tools/qfbsp/include/bsp5.h index 87570adf2..d3f790e81 100644 --- a/tools/qfbsp/include/bsp5.h +++ b/tools/qfbsp/include/bsp5.h @@ -27,88 +27,90 @@ #include "QF/bspfile.h" typedef struct plane_s { - vec3_t normal; - vec_t dist; - int type; + vec3_t normal; + vec_t dist; + int type; } plane_t; -#define MAX_THREADS 4 +#define MAX_THREADS 4 -#define ON_EPSILON 0.05 -#define BOGUS_RANGE 18000 +#define ON_EPSILON 0.05 +#define BOGUS_RANGE 18000 // the exact bounding box of the brushes is expanded some for the headnode // volume. is this still needed? -#define SIDESPACE 24 +#define SIDESPACE 24 #define TEX_SKIP -1 #define TEX_HINT -2 typedef struct visfacet_s { - struct visfacet_s *next; - - int planenum; - int planeside; // which side is the front of the face - int texturenum; - int contents[2]; // 0 = front side + struct visfacet_s *next; - struct visfacet_s *original; // face on node - int outputnumber; // valid only for original faces after - // write surfaces - qboolean detail; // is a detail face + int planenum; + int planeside; // which side is the front of the face + int texturenum; + int contents[2]; // 0 = front side + + struct visfacet_s *original;// face on node + int outputnumber; // valid only for original faces after + // write surfaces + qboolean detail; // is a detail face struct winding_s *points; - int *edges; + int *edges; } face_t; typedef struct surface_s { - struct surface_s *next; - struct surface_s *original; // before BSP cuts it up - int planenum; - int outputplanenum; // valid only after WriteSurfacePlanes - vec3_t mins, maxs; - qboolean onnode; // true if surface has already been used - // as a splitting node - qboolean has_detail; // true if the surface has detail brushes - qboolean has_struct; // true if the surface has non-detail brushes - face_t *faces; // links to all the faces on either side of the surf + struct surface_s *next; + struct surface_s *original; // before BSP cuts it up + int planenum; + int outputplanenum; // valid only after WriteSurfacePlanes + vec3_t mins, maxs; + qboolean onnode; // true if surface has already been used + // as a splitting node + qboolean has_detail; // true if the surface has detail brushes + qboolean has_struct; // true if the surface has non-detail + // brushes + face_t *faces; // links to all the faces on either side + // of the surf } surface_t; // there is a node_t structure for every node and leaf in the bsp tree -#define PLANENUM_LEAF -1 +#define PLANENUM_LEAF -1 typedef struct node_s { - vec3_t mins,maxs; // bounding volume, not just points inside + vec3_t mins,maxs; // bounding volume, not just points inside // information for decision nodes - int planenum; // -1 = leaf node - int outputplanenum; // valid only after WriteNodePlanes - int firstface; // decision node only - int numfaces; // decision node only - struct node_s *children[2]; // valid only for decision nodes - face_t *faces; // decision nodes only, list for both sides - + int planenum; // -1 = leaf node + int outputplanenum; // valid only after WriteNodePlanes + int firstface; // decision node only + int numfaces; // decision node only + struct node_s *children[2]; // valid only for decision nodes + face_t *faces; // decision nodes only, list for both sides + // information for leafs - int contents; // leaf nodes (0 for decision nodes) - face_t **markfaces; // leaf nodes only, point to node faces - struct portal_s *portals; - int visleafnum; // -1 = solid - int valid; // for flood filling - int occupied; // light number in leaf for outside filling - int o_dist; // distance to nearest entity - int detail; // 1 if created by detail split + int contents; // leaf nodes (0 for decision nodes) + face_t **markfaces; // leaf nodes only, point to node faces + struct portal_s *portals; + int visleafnum; // -1 = solid + int valid; // for flood filling + int occupied; // light number in leaf for outside filling + int o_dist; // distance to nearest entity + int detail; // 1 if created by detail split } node_t; -extern struct brushset_s *brushset; +extern struct brushset_s *brushset; void qprintf (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); // prints only if verbose -extern int valid; +extern int valid; -extern qboolean worldmodel; +extern qboolean worldmodel; // misc functions diff --git a/tools/qfbsp/include/map.h b/tools/qfbsp/include/map.h index c468f448c..a4563a91e 100644 --- a/tools/qfbsp/include/map.h +++ b/tools/qfbsp/include/map.h @@ -25,53 +25,49 @@ #include "bsp5.h" -#define MAX_FACES 256 -typedef struct mface_s -{ +#define MAX_FACES 256 +typedef struct mface_s { struct mface_s *next; plane_t plane; int texinfo; } mface_t; -typedef struct mbrush_s -{ - struct mbrush_s *next; - mface_t *faces; - qboolean detail; // true if brush is detail brush +typedef struct mbrush_s { + struct mbrush_s *next; + mface_t *faces; + qboolean detail; // true if brush is detail brush } mbrush_t; -typedef struct epair_s -{ - struct epair_s *next; - char *key; - char *value; +typedef struct epair_s { + struct epair_s *next; + char *key; + char *value; } epair_t; -typedef struct -{ - vec3_t origin; - mbrush_t *brushes; - epair_t *epairs; +typedef struct { + vec3_t origin; + mbrush_t *brushes; + epair_t *epairs; } entity_t; -extern int nummapbrushes; -extern mbrush_t mapbrushes[MAX_MAP_BRUSHES]; +extern int nummapbrushes; +extern mbrush_t mapbrushes[MAX_MAP_BRUSHES]; -extern int num_entities; -extern entity_t entities[MAX_MAP_ENTITIES]; +extern int num_entities; +extern entity_t entities[MAX_MAP_ENTITIES]; -extern int nummiptex; -extern char miptex[MAX_MAP_TEXINFO][16]; +extern int nummiptex; +extern char miptex[MAX_MAP_TEXINFO][16]; -void LoadMapFile (const char *filename); +void LoadMapFile (const char *filename); -int FindMiptex (const char *name); +int FindMiptex (const char *name); -void PrintEntity (entity_t *ent); +void PrintEntity (entity_t *ent); const char *ValueForKey (entity_t *ent, const char *key); -void SetKeyValue (entity_t *ent, const char *key, const char *value); -void GetVectorForKey (entity_t *ent, const char *key, vec3_t vec); +void SetKeyValue (entity_t *ent, const char *key, const char *value); +void GetVectorForKey (entity_t *ent, const char *key, vec3_t vec); -void WriteEntitiesToString (void); +void WriteEntitiesToString (void); #endif//qfbsp_map_h diff --git a/tools/qfbsp/include/options.h b/tools/qfbsp/include/options.h index 032260903..0adcf7dce 100644 --- a/tools/qfbsp/include/options.h +++ b/tools/qfbsp/include/options.h @@ -32,28 +32,28 @@ #include "QF/qtypes.h" typedef struct { - int verbosity; // 0=silent - qboolean drawflag; - qboolean notjunc; - qboolean nofill; - qboolean noclip; - qboolean onlyents; - qboolean portal; + int verbosity; // 0=silent + qboolean drawflag; + qboolean notjunc; + qboolean nofill; + qboolean noclip; + qboolean onlyents; + qboolean portal; qboolean extract; qboolean extract_textures; qboolean extract_entities; qboolean extract_hull; - qboolean usehulls; - qboolean watervis; - int hullnum; - int subdivide_size; - char *mapfile; - char *bspfile; - char *portfile; - char *pointfile; - char *hullfile; - char *output_file; - const char *wadpath; + qboolean usehulls; + qboolean watervis; + int hullnum; + int subdivide_size; + char *mapfile; + char *bspfile; + char *portfile; + char *pointfile; + char *hullfile; + char *output_file; + const char *wadpath; } options_t; extern options_t options; diff --git a/tools/qfbsp/include/portals.h b/tools/qfbsp/include/portals.h index 4b29d1b1a..f92062fab 100644 --- a/tools/qfbsp/include/portals.h +++ b/tools/qfbsp/include/portals.h @@ -26,13 +26,13 @@ struct node_s; typedef struct portal_s { - int planenum; + int planenum; struct node_s *nodes[2]; // [0] = front side of planenum - struct portal_s *next[2]; + struct portal_s *next[2]; struct winding_s *winding; } portal_t; -extern struct node_s outside_node; // portals outside the world face this +extern struct node_s outside_node; // portals outside the world face this void PortalizeWorld (struct node_s *headnode); void PortalizeWorldDetail (struct node_s *headnode); // stop at detail nodes diff --git a/tools/qfbsp/include/winding.h b/tools/qfbsp/include/winding.h index 863a64b80..ac2fd20bb 100644 --- a/tools/qfbsp/include/winding.h +++ b/tools/qfbsp/include/winding.h @@ -28,8 +28,8 @@ struct plane_s; typedef struct winding_s { - int numpoints; - vec3_t points[8]; // variable sized + int numpoints; + vec3_t points[8]; // variable sized } winding_t; winding_t *BaseWindingForPlane (struct plane_s *p); diff --git a/tools/qfbsp/source/brush.c b/tools/qfbsp/source/brush.c index 196e515e2..8fccfe3d1 100644 --- a/tools/qfbsp/source/brush.c +++ b/tools/qfbsp/source/brush.c @@ -251,7 +251,7 @@ FindPlane (plane_t *dplane, int *side) vec3_t t; VectorSubtract (dp->normal, pl.normal, t); dot = DotProduct (dp->normal, pl.normal); - if (dot > 1.0 - ANGLEEPSILON + if (dot > 1.0 - ANGLEEPSILON && fabs(dp->dist - pl.dist) < DISTEPSILON) { // regular match return i; } @@ -645,7 +645,7 @@ ExpandBrush (int hullnum) Converts a mapbrush to a bsp brush */ -static brush_t * +static brush_t * LoadBrush (mbrush_t *mb, int hullnum) { brush_t *b; diff --git a/tools/qfbsp/source/merge.c b/tools/qfbsp/source/merge.c index 5745eabb0..3a2951272 100644 --- a/tools/qfbsp/source/merge.c +++ b/tools/qfbsp/source/merge.c @@ -154,7 +154,7 @@ MergeFaceToList (face_t *face, face_t *list) face_t *newf, *f; for (f = list; f; f = f->next) { -// CheckColinear (f); +// CheckColinear (f); if (mergedebug) { Draw_ClearWindow (); Draw_DrawFace (face); diff --git a/tools/qfbsp/source/options.c b/tools/qfbsp/source/options.c index 2a10a5c92..f1e2a20a5 100644 --- a/tools/qfbsp/source/options.c +++ b/tools/qfbsp/source/options.c @@ -63,7 +63,7 @@ static struct option const long_options[] = { {"extract-hull", no_argument, 0, 258}, {"usehulls", no_argument, 0, 'u'}, {"hullnum", required_argument, 0, 'H'}, - {"subdivide", required_argument, 0, 's'}, + {"subdivide", required_argument, 0, 's'}, {"wadpath", required_argument, 0, 'w'}, {"watervis", no_argument, 0, 'W'}, {NULL, 0, NULL, 0} @@ -134,7 +134,7 @@ DecodeArgs (int argc, char **argv) break; case 'v': // verbose options.verbosity += 1; - break; + break; case 'h': // help usage (0); break; @@ -195,7 +195,7 @@ DecodeArgs (int argc, char **argv) usage (1); } } - + if (options.extract) { options.bspfile = strdup (argv[optind++]); } else { diff --git a/tools/qfbsp/source/qfbsp.c b/tools/qfbsp/source/qfbsp.c index fda8ba300..99640f20e 100644 --- a/tools/qfbsp/source/qfbsp.c +++ b/tools/qfbsp/source/qfbsp.c @@ -221,7 +221,7 @@ ProcessEntity (int entnum) BumpModel (hullnum); } else { // SolidBSP generates a node tree - // + // // if not the world, make a good tree first // the world is just going to make a bad tree // because the outside filling will force a regeneration later diff --git a/tools/qfbsp/source/writebsp.c b/tools/qfbsp/source/writebsp.c index 12416d684..9d98f3713 100644 --- a/tools/qfbsp/source/writebsp.c +++ b/tools/qfbsp/source/writebsp.c @@ -124,7 +124,7 @@ WriteClipNodes_r (node_t *node) dclipnode_t cn; int num, c, i; - // FIXME: free more stuff? + // FIXME: free more stuff? if (node->planenum == -1) { num = node->contents; free (node); @@ -200,7 +200,7 @@ WriteDrawNodes_r (node_t *node) int i; int nodenum = bsp->numnodes; - // emit a node + // emit a node if (bsp->numnodes == MAX_MAP_NODES) Sys_Error ("numnodes == MAX_MAP_NODES"); BSP_AddNode (bsp, &dummy);