lots of whitespace

This commit is contained in:
Bill Currie 2010-08-27 22:12:13 +09:00
parent 5c0a55d818
commit 5cf5c1e227
11 changed files with 115 additions and 117 deletions

View file

@ -33,19 +33,19 @@
#define NUM_CONTENTS 2 // solid and water #define NUM_CONTENTS 2 // solid and water
typedef struct brush_s { typedef struct brush_s {
struct brush_s *next; struct brush_s *next;
vec3_t mins, maxs; vec3_t mins, maxs;
struct visfacet_s *faces; struct visfacet_s *faces;
int contents; int contents;
} brush_t; } brush_t;
typedef struct brushset_s { typedef struct brushset_s {
vec3_t mins, maxs; vec3_t mins, maxs;
brush_t *brushes; // NULL terminated list brush_t *brushes; // NULL terminated list
} brushset_t; } brushset_t;
extern int numbrushplanes; extern int numbrushplanes;
extern plane_t planes[MAX_MAP_PLANES]; extern plane_t planes[MAX_MAP_PLANES];
brushset_t *Brush_LoadEntity (entity_t *ent, int hullnum); brushset_t *Brush_LoadEntity (entity_t *ent, int hullnum);

View file

@ -27,88 +27,90 @@
#include "QF/bspfile.h" #include "QF/bspfile.h"
typedef struct plane_s { typedef struct plane_s {
vec3_t normal; vec3_t normal;
vec_t dist; vec_t dist;
int type; int type;
} plane_t; } plane_t;
#define MAX_THREADS 4 #define MAX_THREADS 4
#define ON_EPSILON 0.05 #define ON_EPSILON 0.05
#define BOGUS_RANGE 18000 #define BOGUS_RANGE 18000
// the exact bounding box of the brushes is expanded some for the headnode // the exact bounding box of the brushes is expanded some for the headnode
// volume. is this still needed? // volume. is this still needed?
#define SIDESPACE 24 #define SIDESPACE 24
#define TEX_SKIP -1 #define TEX_SKIP -1
#define TEX_HINT -2 #define TEX_HINT -2
typedef struct visfacet_s { typedef struct visfacet_s {
struct visfacet_s *next; 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 *original; // face on node int planenum;
int outputnumber; // valid only for original faces after int planeside; // which side is the front of the face
// write surfaces int texturenum;
qboolean detail; // is a detail face 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; struct winding_s *points;
int *edges; int *edges;
} face_t; } face_t;
typedef struct surface_s { typedef struct surface_s {
struct surface_s *next; struct surface_s *next;
struct surface_s *original; // before BSP cuts it up struct surface_s *original; // before BSP cuts it up
int planenum; int planenum;
int outputplanenum; // valid only after WriteSurfacePlanes int outputplanenum; // valid only after WriteSurfacePlanes
vec3_t mins, maxs; vec3_t mins, maxs;
qboolean onnode; // true if surface has already been used qboolean onnode; // true if surface has already been used
// as a splitting node // as a splitting node
qboolean has_detail; // true if the surface has detail brushes qboolean has_detail; // true if the surface has detail brushes
qboolean has_struct; // true if the surface has non-detail brushes qboolean has_struct; // true if the surface has non-detail
face_t *faces; // links to all the faces on either side of the surf // brushes
face_t *faces; // links to all the faces on either side
// of the surf
} surface_t; } surface_t;
// there is a node_t structure for every node and leaf in the bsp tree // 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 { 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 // information for decision nodes
int planenum; // -1 = leaf node int planenum; // -1 = leaf node
int outputplanenum; // valid only after WriteNodePlanes int outputplanenum; // valid only after WriteNodePlanes
int firstface; // decision node only int firstface; // decision node only
int numfaces; // decision node only int numfaces; // decision node only
struct node_s *children[2]; // valid only for decision nodes struct node_s *children[2]; // valid only for decision nodes
face_t *faces; // decision nodes only, list for both sides face_t *faces; // decision nodes only, list for both sides
// information for leafs // information for leafs
int contents; // leaf nodes (0 for decision nodes) int contents; // leaf nodes (0 for decision nodes)
face_t **markfaces; // leaf nodes only, point to node faces face_t **markfaces; // leaf nodes only, point to node faces
struct portal_s *portals; struct portal_s *portals;
int visleafnum; // -1 = solid int visleafnum; // -1 = solid
int valid; // for flood filling int valid; // for flood filling
int occupied; // light number in leaf for outside filling int occupied; // light number in leaf for outside filling
int o_dist; // distance to nearest entity int o_dist; // distance to nearest entity
int detail; // 1 if created by detail split int detail; // 1 if created by detail split
} node_t; } 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 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 // misc functions

View file

@ -25,53 +25,49 @@
#include "bsp5.h" #include "bsp5.h"
#define MAX_FACES 256 #define MAX_FACES 256
typedef struct mface_s typedef struct mface_s {
{
struct mface_s *next; struct mface_s *next;
plane_t plane; plane_t plane;
int texinfo; int texinfo;
} mface_t; } mface_t;
typedef struct mbrush_s typedef struct mbrush_s {
{ struct mbrush_s *next;
struct mbrush_s *next; mface_t *faces;
mface_t *faces; qboolean detail; // true if brush is detail brush
qboolean detail; // true if brush is detail brush
} mbrush_t; } mbrush_t;
typedef struct epair_s typedef struct epair_s {
{ struct epair_s *next;
struct epair_s *next; char *key;
char *key; char *value;
char *value;
} epair_t; } epair_t;
typedef struct typedef struct {
{ vec3_t origin;
vec3_t origin; mbrush_t *brushes;
mbrush_t *brushes; epair_t *epairs;
epair_t *epairs;
} entity_t; } entity_t;
extern int nummapbrushes; extern int nummapbrushes;
extern mbrush_t mapbrushes[MAX_MAP_BRUSHES]; extern mbrush_t mapbrushes[MAX_MAP_BRUSHES];
extern int num_entities; extern int num_entities;
extern entity_t entities[MAX_MAP_ENTITIES]; extern entity_t entities[MAX_MAP_ENTITIES];
extern int nummiptex; extern int nummiptex;
extern char miptex[MAX_MAP_TEXINFO][16]; 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); const char *ValueForKey (entity_t *ent, const char *key);
void SetKeyValue (entity_t *ent, const char *key, const char *value); void SetKeyValue (entity_t *ent, const char *key, const char *value);
void GetVectorForKey (entity_t *ent, const char *key, vec3_t vec); void GetVectorForKey (entity_t *ent, const char *key, vec3_t vec);
void WriteEntitiesToString (void); void WriteEntitiesToString (void);
#endif//qfbsp_map_h #endif//qfbsp_map_h

View file

@ -32,28 +32,28 @@
#include "QF/qtypes.h" #include "QF/qtypes.h"
typedef struct { typedef struct {
int verbosity; // 0=silent int verbosity; // 0=silent
qboolean drawflag; qboolean drawflag;
qboolean notjunc; qboolean notjunc;
qboolean nofill; qboolean nofill;
qboolean noclip; qboolean noclip;
qboolean onlyents; qboolean onlyents;
qboolean portal; qboolean portal;
qboolean extract; qboolean extract;
qboolean extract_textures; qboolean extract_textures;
qboolean extract_entities; qboolean extract_entities;
qboolean extract_hull; qboolean extract_hull;
qboolean usehulls; qboolean usehulls;
qboolean watervis; qboolean watervis;
int hullnum; int hullnum;
int subdivide_size; int subdivide_size;
char *mapfile; char *mapfile;
char *bspfile; char *bspfile;
char *portfile; char *portfile;
char *pointfile; char *pointfile;
char *hullfile; char *hullfile;
char *output_file; char *output_file;
const char *wadpath; const char *wadpath;
} options_t; } options_t;
extern options_t options; extern options_t options;

View file

@ -26,13 +26,13 @@
struct node_s; struct node_s;
typedef struct portal_s { typedef struct portal_s {
int planenum; int planenum;
struct node_s *nodes[2]; // [0] = front side of 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; struct winding_s *winding;
} portal_t; } 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 PortalizeWorld (struct node_s *headnode);
void PortalizeWorldDetail (struct node_s *headnode); // stop at detail nodes void PortalizeWorldDetail (struct node_s *headnode); // stop at detail nodes

View file

@ -28,8 +28,8 @@
struct plane_s; struct plane_s;
typedef struct winding_s { typedef struct winding_s {
int numpoints; int numpoints;
vec3_t points[8]; // variable sized vec3_t points[8]; // variable sized
} winding_t; } winding_t;
winding_t *BaseWindingForPlane (struct plane_s *p); winding_t *BaseWindingForPlane (struct plane_s *p);

View file

@ -251,7 +251,7 @@ FindPlane (plane_t *dplane, int *side)
vec3_t t; vec3_t t;
VectorSubtract (dp->normal, pl.normal, t); VectorSubtract (dp->normal, pl.normal, t);
dot = DotProduct (dp->normal, pl.normal); dot = DotProduct (dp->normal, pl.normal);
if (dot > 1.0 - ANGLEEPSILON if (dot > 1.0 - ANGLEEPSILON
&& fabs(dp->dist - pl.dist) < DISTEPSILON) { // regular match && fabs(dp->dist - pl.dist) < DISTEPSILON) { // regular match
return i; return i;
} }
@ -645,7 +645,7 @@ ExpandBrush (int hullnum)
Converts a mapbrush to a bsp brush Converts a mapbrush to a bsp brush
*/ */
static brush_t * static brush_t *
LoadBrush (mbrush_t *mb, int hullnum) LoadBrush (mbrush_t *mb, int hullnum)
{ {
brush_t *b; brush_t *b;

View file

@ -154,7 +154,7 @@ MergeFaceToList (face_t *face, face_t *list)
face_t *newf, *f; face_t *newf, *f;
for (f = list; f; f = f->next) { for (f = list; f; f = f->next) {
// CheckColinear (f); // CheckColinear (f);
if (mergedebug) { if (mergedebug) {
Draw_ClearWindow (); Draw_ClearWindow ();
Draw_DrawFace (face); Draw_DrawFace (face);

View file

@ -63,7 +63,7 @@ static struct option const long_options[] = {
{"extract-hull", no_argument, 0, 258}, {"extract-hull", no_argument, 0, 258},
{"usehulls", no_argument, 0, 'u'}, {"usehulls", no_argument, 0, 'u'},
{"hullnum", required_argument, 0, 'H'}, {"hullnum", required_argument, 0, 'H'},
{"subdivide", required_argument, 0, 's'}, {"subdivide", required_argument, 0, 's'},
{"wadpath", required_argument, 0, 'w'}, {"wadpath", required_argument, 0, 'w'},
{"watervis", no_argument, 0, 'W'}, {"watervis", no_argument, 0, 'W'},
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
@ -134,7 +134,7 @@ DecodeArgs (int argc, char **argv)
break; break;
case 'v': // verbose case 'v': // verbose
options.verbosity += 1; options.verbosity += 1;
break; break;
case 'h': // help case 'h': // help
usage (0); usage (0);
break; break;
@ -195,7 +195,7 @@ DecodeArgs (int argc, char **argv)
usage (1); usage (1);
} }
} }
if (options.extract) { if (options.extract) {
options.bspfile = strdup (argv[optind++]); options.bspfile = strdup (argv[optind++]);
} else { } else {

View file

@ -221,7 +221,7 @@ ProcessEntity (int entnum)
BumpModel (hullnum); BumpModel (hullnum);
} else { } else {
// SolidBSP generates a node tree // SolidBSP generates a node tree
// //
// if not the world, make a good tree first // if not the world, make a good tree first
// the world is just going to make a bad tree // the world is just going to make a bad tree
// because the outside filling will force a regeneration later // because the outside filling will force a regeneration later

View file

@ -124,7 +124,7 @@ WriteClipNodes_r (node_t *node)
dclipnode_t cn; dclipnode_t cn;
int num, c, i; int num, c, i;
// FIXME: free more stuff? // FIXME: free more stuff?
if (node->planenum == -1) { if (node->planenum == -1) {
num = node->contents; num = node->contents;
free (node); free (node);
@ -200,7 +200,7 @@ WriteDrawNodes_r (node_t *node)
int i; int i;
int nodenum = bsp->numnodes; int nodenum = bsp->numnodes;
// emit a node // emit a node
if (bsp->numnodes == MAX_MAP_NODES) if (bsp->numnodes == MAX_MAP_NODES)
Sys_Error ("numnodes == MAX_MAP_NODES"); Sys_Error ("numnodes == MAX_MAP_NODES");
BSP_AddNode (bsp, &dummy); BSP_AddNode (bsp, &dummy);