From 7dca7e8e2e8fc25136ab96305a14ef06b440e6dd Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 10 Oct 2010 10:05:01 +0900 Subject: [PATCH 001/115] Doc/boostrap tweaks. Mention git instead of subversion, add libsamplerate to the requirements and it turns out autoconf 2.65 is good enough. --- INSTALL | 4 ++-- bootstrap | 4 ++-- configure.ac | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/INSTALL b/INSTALL index 1cb0ae732..f4158b5ce 100644 --- a/INSTALL +++ b/INSTALL @@ -11,9 +11,9 @@ UNIX users: because of the diversity of machines QuakeForge runs on, we do not p * GNU flex * GNU make (BSD make doesn't like some constructs used) * C compiler and preprocessor (gcc and cpp recommended) + * libsamplerate The following are recommended: - * subversion (highly recommended for staying up to date with current - changes) + * git (highly recommended for staying up to date with current changes) * zlib devel (highly recommended for compressed file and download support) * Ogg Vorbis libs (for compressed sound effects support) * X11 devel (for X11-based clients: software and OpenGL) diff --git a/bootstrap b/bootstrap index 569b84253..6178ee1c0 100755 --- a/bootstrap +++ b/bootstrap @@ -72,8 +72,8 @@ if test -n "$ac" ; then errors="Autoconf 2.67 or greater needed to build configure.\n$errors" fi - if test "$AC_VER_MAJOR" -eq "2" -a "$AC_VER_MINOR" -lt "67" ; then - errors="Autoconf 2.67 or greater needed to build configure.\n$errors" + if test "$AC_VER_MAJOR" -eq "2" -a "$AC_VER_MINOR" -lt "65" ; then + errors="Autoconf 2.65 or greater needed to build configure.\n$errors" fi fi else diff --git a/configure.ac b/configure.ac index 912590416..643aee1a8 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_PREREQ(2.67) +AC_PREREQ(2.65) dnl This is the only place where the package name and version appear AC_INIT([QuakeForge], [git-master]) From 8808eba3ffb5d71006987099518a1664a5f65904 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 13 Oct 2010 20:50:45 +0900 Subject: [PATCH 002/115] add VectorSet macro VectorSet(a,b,c,d) -> vec3_t d = (a, b, c) This should be useful. --- include/QF/mathlib.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/QF/mathlib.h b/include/QF/mathlib.h index 164711bc9..3cce24532 100644 --- a/include/QF/mathlib.h +++ b/include/QF/mathlib.h @@ -99,6 +99,12 @@ extern const vec_t * const vec3_origin; #define VectorIsZero(a) (!(a)[0] && !(a)[1] && !(a)[2]) #define VectorZero(a) ((a)[2] = (a)[1] = (a)[0] = 0); +#define VectorSet(a,b,c,d) \ + do { \ + (d)[0] = a; \ + (d)[1] = b; \ + (d)[2] = c; \ + } while (0) #define VectorBlend(v1,v2,b,v) \ do { \ From f4042c5b9116ab9890620ce03a84999f8cdbcf1c Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 22 Aug 2010 08:40:31 +0900 Subject: [PATCH 003/115] Make the bsp disk data structures type size independent. However, this assumes float is always 32 bits. Also use size_t for the *size fields in bsp_t and clean up the mess. --- include/QF/bspfile.h | 94 +++++++++++++++++----------------- libs/util/bspfile.c | 38 +++++++------- tools/qflight/source/qflight.c | 2 +- tools/qfvis/source/qfvis.c | 4 +- 4 files changed, 69 insertions(+), 69 deletions(-) diff --git a/include/QF/bspfile.h b/include/QF/bspfile.h index 99ee5b05a..9e0156bf1 100644 --- a/include/QF/bspfile.h +++ b/include/QF/bspfile.h @@ -75,8 +75,8 @@ #define TOOLVERSION 2 typedef struct lump_s { - int fileofs; - int filelen; + int32_t fileofs; + int32_t filelen; } lump_t; #define LUMP_ENTITIES 0 @@ -99,26 +99,26 @@ typedef struct lump_s { typedef struct dmodel_s { float mins[3], maxs[3]; float origin[3]; - int headnode[MAX_MAP_HULLS]; - int visleafs; // not including the solid leaf 0 - int firstface, numfaces; + int32_t headnode[MAX_MAP_HULLS]; + int32_t visleafs; // not including the solid leaf 0 + int32_t firstface, numfaces; } dmodel_t; typedef struct dheader_s { - int version; + int32_t version; lump_t lumps[HEADER_LUMPS]; } dheader_t; typedef struct dmiptexlump_s { - int nummiptex; - int dataofs[4]; // [nummiptex] + int32_t nummiptex; + int32_t dataofs[4]; // [nummiptex] } dmiptexlump_t; #define MIPLEVELS 4 typedef struct miptex_s { char name[16]; - unsigned int width, height; - unsigned int offsets[MIPLEVELS]; // four mip maps stored + uint32_t width, height; + uint32_t offsets[MIPLEVELS]; // four mip maps stored } miptex_t; @@ -140,7 +140,7 @@ typedef struct dvertex_s { typedef struct dplane_s { float normal[3]; float dist; - int type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate + int32_t type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate } dplane_t; #define CONTENTS_EMPTY -1 @@ -162,45 +162,45 @@ typedef struct dplane_s { // !!! if this is changed, it must be changed in asm_i386.h too !!! typedef struct dnode_s { - int planenum; - short children[2]; // negative numbers are -(leafs+1), not nodes - short mins[3]; // for sphere culling - short maxs[3]; - unsigned short firstface; - unsigned short numfaces; // counting both sides + int32_t planenum; + int16_t children[2]; // negative numbers are -(leafs+1), not nodes + int16_t mins[3]; // for sphere culling + int16_t maxs[3]; + uint16_t firstface; + uint16_t numfaces; // counting both sides } dnode_t; typedef struct dclipnode_s { - int planenum; - short children[2]; // negative numbers are contents + int32_t planenum; + int16_t children[2]; // negative numbers are contents } dclipnode_t; typedef struct texinfo_s { float vecs[2][4]; // [s/t][xyz offset] - int miptex; - int flags; + int32_t miptex; + int32_t flags; } texinfo_t; #define TEX_SPECIAL 1 // sky or slime, no lightmap or 256 subdivision // note that edge 0 is never used, because negative edge nums are used for // counterclockwise use of the edge in a face typedef struct dedge_s { - unsigned short v[2]; // vertex numbers + uint16_t v[2]; // vertex numbers } dedge_t; #define MAXLIGHTMAPS 4 typedef struct dface_s { - short planenum; - short side; + int16_t planenum; + int16_t side; - int firstedge; // we must support > 64k edges - short numedges; - short texinfo; + int32_t firstedge; // we must support > 64k edges + int16_t numedges; + int16_t texinfo; // lighting info byte styles[MAXLIGHTMAPS]; - int lightofs; // start of [numstyles*surfsize] samples + int32_t lightofs; // start of [numstyles*surfsize] samples } dface_t; @@ -214,14 +214,14 @@ typedef struct dface_s { // leaf 0 is the generic CONTENTS_SOLID leaf, used for all solid areas // all other leafs need visibility info typedef struct dleaf_s { - int contents; - int visofs; // -1 = no visibility info + int32_t contents; + int32_t visofs; // -1 = no visibility info - short mins[3]; // for frustum culling - short maxs[3]; + int16_t mins[3]; // for frustum culling + int16_t maxs[3]; - unsigned short firstmarksurface; - unsigned short nummarksurfaces; + uint16_t firstmarksurface; + uint16_t nummarksurfaces; byte ambient_level[NUM_AMBIENTS]; } dleaf_t; @@ -232,16 +232,16 @@ typedef struct bsp_s { int nummodels; dmodel_t *models; - int visdatasize; + size_t visdatasize; byte *visdata; - int lightdatasize; + size_t lightdatasize; byte *lightdata; - int texdatasize; + size_t texdatasize; byte *texdata; // (dmiptexlump_t) - int entdatasize; + size_t entdatasize; char *entdata; int numleafs; @@ -269,14 +269,14 @@ typedef struct bsp_s { dedge_t *edges; int nummarksurfaces; - unsigned short *marksurfaces; + uint16_t *marksurfaces; int numsurfedges; - int *surfedges; + int32_t *surfedges; } bsp_t; -bsp_t *LoadBSPMem (void *mem, int size); -bsp_t *LoadBSPFile (QFile *file, int size); +bsp_t *LoadBSPMem (void *mem, size_t size); +bsp_t *LoadBSPFile (QFile *file, size_t size); void WriteBSPFile (bsp_t *bsp, QFile *file); bsp_t *BSP_New (void); void BSP_AddPlane (bsp_t *bsp, dplane_t *plane); @@ -286,13 +286,13 @@ void BSP_AddNode (bsp_t *bsp, dnode_t *node); void BSP_AddTexinfo (bsp_t *bsp, texinfo_t *texinfo); void BSP_AddFace (bsp_t *bsp, dface_t *face); void BSP_AddClipnode (bsp_t *bsp, dclipnode_t *clipnode); -void BSP_AddMarkSurface (bsp_t *bsp, unsigned short marksurface); +void BSP_AddMarkSurface (bsp_t *bsp, int marksurface); void BSP_AddSurfEdge (bsp_t *bsp, int surfedge); void BSP_AddEdge (bsp_t *bsp, dedge_t *edge); void BSP_AddModel (bsp_t *bsp, dmodel_t *model); -void BSP_AddLighting (bsp_t *bsp, byte *lightdata, int lightdatasize); -void BSP_AddVisibility (bsp_t *bsp, byte *visdata, int visdatasize); -void BSP_AddEntities (bsp_t *bsp, char *entdata, int entdatasize); -void BSP_AddTextures (bsp_t *bsp, byte *texdata, int texdatasize); +void BSP_AddLighting (bsp_t *bsp, byte *lightdata, size_t lightdatasize); +void BSP_AddVisibility (bsp_t *bsp, byte *visdata, size_t visdatasize); +void BSP_AddEntities (bsp_t *bsp, char *entdata, size_t entdatasize); +void BSP_AddTextures (bsp_t *bsp, byte *texdata, size_t texdatasize); #endif // __bspfile_h_ diff --git a/libs/util/bspfile.c b/libs/util/bspfile.c index de3b0d4ad..4cb987614 100644 --- a/libs/util/bspfile.c +++ b/libs/util/bspfile.c @@ -49,11 +49,11 @@ static __attribute__ ((used)) const char rcsid[] = static void swap_bsp (bsp_t *bsp, int todisk) { - int c, i, j; - dmiptexlump_t *mtl; - dmodel_t *d; + int c, i, j; + dmiptexlump_t *mtl; + dmodel_t *d; - // models + // models for (i=0 ; inummodels ; i++) { d = &bsp->models[i]; @@ -157,13 +157,13 @@ swap_bsp (bsp_t *bsp, int todisk) // marksurfaces for (i=0 ; inummarksurfaces ; i++) { - unsigned short *marksurface = &bsp->marksurfaces[i]; + uint16_t *marksurface = &bsp->marksurfaces[i]; *marksurface = LittleShort (*marksurface); } // surfedges for (i=0 ; inumsurfedges ; i++) { - int *surfedge = &bsp->surfedges[i]; + int32_t *surfedge = &bsp->surfedges[i]; *surfedge = LittleLong (*surfedge); } @@ -176,7 +176,7 @@ swap_bsp (bsp_t *bsp, int todisk) } bsp_t * -LoadBSPMem (void *mem, int size) +LoadBSPMem (void *mem, size_t size) { dheader_t *header = mem; bsp_t *bsp; @@ -235,7 +235,7 @@ do { \ } VISIBLE bsp_t * -LoadBSPFile (QFile *file, int size) +LoadBSPFile (QFile *file, size_t size) { void *buf; bsp_t *bsp; @@ -254,8 +254,8 @@ LoadBSPFile (QFile *file, int size) */ VISIBLE void WriteBSPFile (bsp_t *bsp, QFile *file) -{ - int size; +{ + size_t size; dheader_t *header; byte *data; @@ -275,8 +275,8 @@ WriteBSPFile (bsp_t *bsp, QFile *file) size += ROUND (bsp->numfaces * sizeof (dface_t)); size += ROUND (bsp->numclipnodes * sizeof (dclipnode_t)); size += ROUND (bsp->numedges * sizeof (dedge_t)); - size += ROUND (bsp->nummarksurfaces * sizeof (unsigned short)); - size += ROUND (bsp->numsurfedges * sizeof (int)); + size += ROUND (bsp->nummarksurfaces * sizeof (uint16_t)); + size += ROUND (bsp->numsurfedges * sizeof (uint32_t)); header = malloc (size); memset (header, 0, size); @@ -390,11 +390,11 @@ BSP_AddClipnode (bsp_t *bsp, dclipnode_t *clipnode) } VISIBLE void -BSP_AddMarkSurface (bsp_t *bsp, unsigned short marksurface) +BSP_AddMarkSurface (bsp_t *bsp, int marksurface) { bsp->marksurfaces = realloc (bsp->marksurfaces, (bsp->nummarksurfaces + 1) - * sizeof (unsigned short)); + * sizeof (uint16_t)); bsp->marksurfaces[bsp->nummarksurfaces++] = marksurface; } @@ -402,7 +402,7 @@ VISIBLE void BSP_AddSurfEdge (bsp_t *bsp, int surfedge) { bsp->surfedges = realloc (bsp->surfedges, - (bsp->numsurfedges + 1) * sizeof (int)); + (bsp->numsurfedges + 1) * sizeof (int32_t)); bsp->surfedges[bsp->numsurfedges++] = surfedge; } @@ -423,7 +423,7 @@ BSP_AddModel (bsp_t *bsp, dmodel_t *model) } VISIBLE void -BSP_AddLighting (bsp_t *bsp, byte *lightdata, int lightdatasize) +BSP_AddLighting (bsp_t *bsp, byte *lightdata, size_t lightdatasize) { bsp->lightdatasize = lightdatasize; bsp->lightdata = malloc (lightdatasize); @@ -431,7 +431,7 @@ BSP_AddLighting (bsp_t *bsp, byte *lightdata, int lightdatasize) } VISIBLE void -BSP_AddVisibility (bsp_t *bsp, byte *visdata, int visdatasize) +BSP_AddVisibility (bsp_t *bsp, byte *visdata, size_t visdatasize) { bsp->visdatasize = visdatasize; bsp->visdata = malloc (visdatasize); @@ -439,7 +439,7 @@ BSP_AddVisibility (bsp_t *bsp, byte *visdata, int visdatasize) } VISIBLE void -BSP_AddEntities (bsp_t *bsp, char *entdata, int entdatasize) +BSP_AddEntities (bsp_t *bsp, char *entdata, size_t entdatasize) { bsp->entdatasize = entdatasize; bsp->entdata = malloc (entdatasize); @@ -447,7 +447,7 @@ BSP_AddEntities (bsp_t *bsp, char *entdata, int entdatasize) } VISIBLE void -BSP_AddTextures (bsp_t *bsp, byte *texdata, int texdatasize) +BSP_AddTextures (bsp_t *bsp, byte *texdata, size_t texdatasize) { bsp->texdatasize = texdatasize; bsp->texdata = malloc (texdatasize); diff --git a/tools/qflight/source/qflight.c b/tools/qflight/source/qflight.c index 2f27e6696..c5123411f 100644 --- a/tools/qflight/source/qflight.c +++ b/tools/qflight/source/qflight.c @@ -169,7 +169,7 @@ LightWorld (void) BSP_AddLighting (bsp, (byte *) lightdata->str, lightdata->size); if (options.verbosity >= 0) - printf ("lightdatasize: %i\n", bsp->lightdatasize); + printf ("lightdatasize: %zi\n", bsp->lightdatasize); } int diff --git a/tools/qfvis/source/qfvis.c b/tools/qfvis/source/qfvis.c index 797265c80..9e908425f 100644 --- a/tools/qfvis/source/qfvis.c +++ b/tools/qfvis/source/qfvis.c @@ -83,7 +83,7 @@ int c_vistest; int numportals; int portalclusters; int numrealleafs; -int originalvismapsize; +size_t originalvismapsize; int totalvis; int count_sep; int bitbytes; // (portalleafs + 63)>>3 @@ -848,7 +848,7 @@ main (int argc, char **argv) BSP_AddVisibility (bsp, (byte *) visdata->str, visdata->size); if (options.verbosity >= 0) - printf ("visdatasize:%i compressed from %i\n", bsp->visdatasize, + printf ("visdatasize:%zi compressed from %zi\n", bsp->visdatasize, originalvismapsize); CalcAmbientSounds (); From 1d86e7140433c502e9bd5ad396ef9f2bd6614ca4 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 22 Aug 2010 22:29:26 +0900 Subject: [PATCH 004/115] make WriteBSPFile take a const bsp_t * This means that the supplied bsp can now be reused, as it should be. --- include/QF/bspfile.h | 5 ++- libs/util/bspfile.c | 75 +++++++++++++++++++++++++++++--------------- 2 files changed, 54 insertions(+), 26 deletions(-) diff --git a/include/QF/bspfile.h b/include/QF/bspfile.h index 9e0156bf1..8c7a8830e 100644 --- a/include/QF/bspfile.h +++ b/include/QF/bspfile.h @@ -229,6 +229,9 @@ typedef struct dleaf_s { //============================================================================ typedef struct bsp_s { + dheader_t *header; // if this is non-null, all data is in one + // contiguous block + int nummodels; dmodel_t *models; @@ -277,7 +280,7 @@ typedef struct bsp_s { bsp_t *LoadBSPMem (void *mem, size_t size); bsp_t *LoadBSPFile (QFile *file, size_t size); -void WriteBSPFile (bsp_t *bsp, QFile *file); +void WriteBSPFile (const bsp_t *bsp, QFile *file); bsp_t *BSP_New (void); void BSP_AddPlane (bsp_t *bsp, dplane_t *plane); void BSP_AddLeaf (bsp_t *bsp, dleaf_t *leaf); diff --git a/libs/util/bspfile.c b/libs/util/bspfile.c index 4cb987614..445517d27 100644 --- a/libs/util/bspfile.c +++ b/libs/util/bspfile.c @@ -53,6 +53,16 @@ swap_bsp (bsp_t *bsp, int todisk) dmiptexlump_t *mtl; dmodel_t *d; + if (bsp->header) { + bsp->header->version = LittleLong (bsp->header->version); + for (i = 0; i < HEADER_LUMPS; i++) { + bsp->header->lumps[i].fileofs = + LittleLong (bsp->header->lumps[i].fileofs); + bsp->header->lumps[i].filelen = + LittleLong (bsp->header->lumps[i].filelen); + } + } + // models for (i=0 ; inummodels ; i++) { d = &bsp->models[i]; @@ -185,6 +195,9 @@ LoadBSPMem (void *mem, size_t size) Sys_Error ("version %i, not %i", LittleLong (header->version), BSPVERSION); + bsp = malloc (sizeof (bsp_t)); + bsp->header = 0; + #undef SET_LUMP #define SET_LUMP(l,n) \ do { \ @@ -194,11 +207,12 @@ do { \ memcpy (bsp->n, \ (byte *) header + LittleLong (header->lumps[l].fileofs), \ bsp->num##n); \ + } else { \ + bsp->n = 0; \ } \ bsp->num##n /= sizeof (bsp->n[0]); \ } while (0) - bsp = malloc (sizeof (bsp_t)); SET_LUMP (LUMP_PLANES, planes); SET_LUMP (LUMP_LEAFS, leafs); SET_LUMP (LUMP_VERTEXES, vertexes); @@ -220,8 +234,9 @@ do { \ memcpy (bsp->n, \ (byte *) header + LittleLong (header->lumps[l].fileofs), \ bsp->n##size); \ + } else { \ + bsp->n = 0; \ } \ - bsp->n##size /= sizeof (bsp->n[0]); \ } while (0) SET_LUMP (LUMP_LIGHTING, lightdata); @@ -229,7 +244,6 @@ do { \ SET_LUMP (LUMP_ENTITIES, entdata); SET_LUMP (LUMP_TEXTURES, texdata); - swap_bsp (bsp, 0); return bsp; } @@ -249,15 +263,13 @@ LoadBSPFile (QFile *file, size_t size) /* WriteBSPFile - - Swaps the bsp file in place, so it should not be referenced again */ VISIBLE void -WriteBSPFile (bsp_t *bsp, QFile *file) +WriteBSPFile (const bsp_t *bsp, QFile *file) { size_t size; - dheader_t *header; byte *data; + bsp_t tbsp; #define ROUND(x) (((x) + 3) & ~3) @@ -278,24 +290,28 @@ WriteBSPFile (bsp_t *bsp, QFile *file) size += ROUND (bsp->nummarksurfaces * sizeof (uint16_t)); size += ROUND (bsp->numsurfedges * sizeof (uint32_t)); - header = malloc (size); - memset (header, 0, size); - - swap_bsp (bsp, 1); + tbsp.header = calloc (size, 1); #undef SET_LUMP #define SET_LUMP(l,n) \ do { \ - bsp->num##n *= sizeof (bsp->n[0]); \ - header->lumps[l].fileofs = LittleLong (data - (byte *) header); \ - header->lumps[l].filelen = LittleLong (bsp->num##n); \ - memcpy (data, bsp->n, bsp->num##n); \ - data += ROUND (bsp->num##n); \ + tbsp.num##n = bsp->num##n; \ + if (tbsp.num##n) {\ + tbsp.n = (void *) data; \ + tbsp.header->lumps[l].fileofs = data - (byte *) tbsp.header; \ + tbsp.header->lumps[l].filelen = tbsp.num##n * sizeof (bsp->n[0]); \ + memcpy (data, bsp->n, tbsp.header->lumps[l].filelen); \ + data += ROUND (tbsp.header->lumps[l].filelen); \ + } else {\ + tbsp.n = 0; \ + tbsp.header->lumps[l].fileofs = 0; \ + tbsp.header->lumps[l].filelen = 0; \ + } \ } while (0) - header->version = LittleLong (BSPVERSION); + tbsp.header->version = BSPVERSION; - data = (byte *) &header[1]; + data = (byte *) &tbsp.header[1]; SET_LUMP (LUMP_PLANES, planes); SET_LUMP (LUMP_LEAFS, leafs); SET_LUMP (LUMP_VERTEXES, vertexes); @@ -311,11 +327,18 @@ do { \ #undef SET_LUMP #define SET_LUMP(l,n) \ do { \ - bsp->n##size *= sizeof (bsp->n[0]); \ - header->lumps[l].fileofs = LittleLong (data - (byte *) header); \ - header->lumps[l].filelen = LittleLong (bsp->n##size); \ - memcpy (data, bsp->n, bsp->n##size); \ - data += ROUND (bsp->n##size); \ + tbsp.n##size = bsp->n##size; \ + if (tbsp.n##size) { \ + tbsp.n = (void *) data; \ + tbsp.header->lumps[l].fileofs = data - (byte *) tbsp.header; \ + tbsp.header->lumps[l].filelen = tbsp.n##size; \ + memcpy (data, bsp->n, bsp->n##size); \ + data += ROUND (tbsp.header->lumps[l].filelen); \ + } else {\ + tbsp.n = 0; \ + tbsp.header->lumps[l].fileofs = 0; \ + tbsp.header->lumps[l].filelen = 0; \ + } \ } while (0) SET_LUMP (LUMP_LIGHTING, lightdata); @@ -323,8 +346,10 @@ do { \ SET_LUMP (LUMP_ENTITIES, entdata); SET_LUMP (LUMP_TEXTURES, texdata); - Qwrite (file, header, size); - free (header); + swap_bsp (&tbsp, 1); + + Qwrite (file, tbsp.header, size); + free (tbsp.header); } VISIBLE bsp_t * From 99d8ea22b47902275f8a79c44bc79720fe1735df Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 22 Aug 2010 22:32:16 +0900 Subject: [PATCH 005/115] fix uninitialized data In the process of testing the changes to WriteBSPFile, it was found that the data being supplied to it contained uninitialized values. --- tools/qfbsp/source/writebsp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/qfbsp/source/writebsp.c b/tools/qfbsp/source/writebsp.c index a712a1952..12416d684 100644 --- a/tools/qfbsp/source/writebsp.c +++ b/tools/qfbsp/source/writebsp.c @@ -187,6 +187,8 @@ WriteLeaf (node_t *node) } leaf_p.nummarksurfaces = bsp->nummarksurfaces - leaf_p.firstmarksurface; + + memset (leaf_p.ambient_level, 0, sizeof (leaf_p.ambient_level)); BSP_AddLeaf (bsp, &leaf_p); } @@ -244,6 +246,8 @@ WriteDrawNodes (node_t *headnode) Sys_Error ("nummodels == MAX_MAP_MODELS"); bm.headnode[0] = bsp->numnodes; + for (i = 1; i < MAX_MAP_HULLS; i++) + bm.headnode[i] = 0; bm.firstface = firstface; bm.numfaces = bsp->numfaces - firstface; firstface = bsp->numfaces; @@ -260,6 +264,7 @@ WriteDrawNodes (node_t *headnode) bm.mins[i] = headnode->mins[i] + SIDESPACE + 1; // remove the padding bm.maxs[i] = headnode->maxs[i] - SIDESPACE - 1; } + VectorZero (bm.origin); BSP_AddModel (bsp, &bm); // FIXME: are all the children decendant of padded nodes? } From cec8e09f076e695257d1adf448b320a252feb5aa Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 23 Aug 2010 08:21:32 +0900 Subject: [PATCH 006/115] white space cleanup --- include/QF/bspfile.h | 292 +++++++++++++++++++++---------------------- 1 file changed, 145 insertions(+), 147 deletions(-) diff --git a/include/QF/bspfile.h b/include/QF/bspfile.h index 8c7a8830e..67cebb100 100644 --- a/include/QF/bspfile.h +++ b/include/QF/bspfile.h @@ -33,36 +33,36 @@ // upper design bounds -#define MAX_MAP_HULLS 4 +#define MAX_MAP_HULLS 4 -#define MAX_MAP_MODELS 256 -#define MAX_MAP_BRUSHES 4096 -#define MAX_MAP_ENTITIES 1024 -#define MAX_MAP_ENTSTRING 65536 +#define MAX_MAP_MODELS 256 +#define MAX_MAP_BRUSHES 4096 +#define MAX_MAP_ENTITIES 1024 +#define MAX_MAP_ENTSTRING 65536 -#define MAX_MAP_PLANES 32767 -//#define MAX_MAP_PLANES 8192 -#define MAX_MAP_NODES 32767 // because negative shorts are contents -#define MAX_MAP_CLIPNODES 32767 // -#define MAX_MAP_LEAFS 32767 // -//#define MAX_MAP_LEAFS 8192 -#define MAX_MAP_VERTS 65535 -#define MAX_MAP_FACES 65535 -#define MAX_MAP_MARKSURFACES 65535 -#define MAX_MAP_TEXINFO 4096 -#define MAX_MAP_EDGES 256000 -#define MAX_MAP_SURFEDGES 512000 -#define MAX_MAP_TEXTURES 512 -#define MAX_MAP_MIPTEX 0x200000 -#define MAX_MAP_LIGHTING 0x100000 -#define MAX_MAP_VISIBILITY 0x100000 +#define MAX_MAP_PLANES 32767 +//#define MAX_MAP_PLANES 8192 +#define MAX_MAP_NODES 32767 // because negative shorts are contents +#define MAX_MAP_CLIPNODES 32767 // +#define MAX_MAP_LEAFS 32767 // +//#define MAX_MAP_LEAFS 8192 +#define MAX_MAP_VERTS 65535 +#define MAX_MAP_FACES 65535 +#define MAX_MAP_MARKSURFACES 65535 +#define MAX_MAP_TEXINFO 4096 +#define MAX_MAP_EDGES 256000 +#define MAX_MAP_SURFEDGES 512000 +#define MAX_MAP_TEXTURES 512 +#define MAX_MAP_MIPTEX 0x200000 +#define MAX_MAP_LIGHTING 0x100000 +#define MAX_MAP_VISIBILITY 0x100000 -#define MAX_MAP_PORTALS 65536 +#define MAX_MAP_PORTALS 65536 // key / value pair sizes -#define MAX_KEY 32 -#define MAX_VALUE 1024 +#define MAX_KEY 32 +#define MAX_VALUE 1024 //============================================================================= @@ -72,210 +72,208 @@ #define BSPVERSION 29 #define Q2BSPVERSION 38 -#define TOOLVERSION 2 +#define TOOLVERSION 2 typedef struct lump_s { - int32_t fileofs; - int32_t filelen; + int32_t fileofs; + int32_t filelen; } lump_t; -#define LUMP_ENTITIES 0 -#define LUMP_PLANES 1 -#define LUMP_TEXTURES 2 -#define LUMP_VERTEXES 3 -#define LUMP_VISIBILITY 4 -#define LUMP_NODES 5 -#define LUMP_TEXINFO 6 -#define LUMP_FACES 7 -#define LUMP_LIGHTING 8 -#define LUMP_CLIPNODES 9 -#define LUMP_LEAFS 10 -#define LUMP_MARKSURFACES 11 -#define LUMP_EDGES 12 -#define LUMP_SURFEDGES 13 -#define LUMP_MODELS 14 -#define HEADER_LUMPS 15 +#define LUMP_ENTITIES 0 +#define LUMP_PLANES 1 +#define LUMP_TEXTURES 2 +#define LUMP_VERTEXES 3 +#define LUMP_VISIBILITY 4 +#define LUMP_NODES 5 +#define LUMP_TEXINFO 6 +#define LUMP_FACES 7 +#define LUMP_LIGHTING 8 +#define LUMP_CLIPNODES 9 +#define LUMP_LEAFS 10 +#define LUMP_MARKSURFACES 11 +#define LUMP_EDGES 12 +#define LUMP_SURFEDGES 13 +#define LUMP_MODELS 14 +#define HEADER_LUMPS 15 typedef struct dmodel_s { - float mins[3], maxs[3]; - float origin[3]; - int32_t headnode[MAX_MAP_HULLS]; - int32_t visleafs; // not including the solid leaf 0 - int32_t firstface, numfaces; + float mins[3], maxs[3]; + float origin[3]; + int32_t headnode[MAX_MAP_HULLS]; + int32_t visleafs; // not including the solid leaf 0 + int32_t firstface, numfaces; } dmodel_t; typedef struct dheader_s { - int32_t version; - lump_t lumps[HEADER_LUMPS]; + int32_t version; + lump_t lumps[HEADER_LUMPS]; } dheader_t; typedef struct dmiptexlump_s { - int32_t nummiptex; - int32_t dataofs[4]; // [nummiptex] + int32_t nummiptex; + int32_t dataofs[4]; // [nummiptex] } dmiptexlump_t; -#define MIPLEVELS 4 +#define MIPLEVELS 4 typedef struct miptex_s { - char name[16]; - uint32_t width, height; - uint32_t offsets[MIPLEVELS]; // four mip maps stored + char name[16]; + uint32_t width, height; + uint32_t offsets[MIPLEVELS]; // four mip maps stored } miptex_t; typedef struct dvertex_s { - float point[3]; + float point[3]; } dvertex_t; // 0-2 are axial planes -#define PLANE_X 0 -#define PLANE_Y 1 -#define PLANE_Z 2 - +#define PLANE_X 0 +#define PLANE_Y 1 +#define PLANE_Z 2 // 3-5 are non-axial planes snapped to the nearest -#define PLANE_ANYX 3 -#define PLANE_ANYY 4 -#define PLANE_ANYZ 5 +#define PLANE_ANYX 3 +#define PLANE_ANYY 4 +#define PLANE_ANYZ 5 typedef struct dplane_s { - float normal[3]; - float dist; - int32_t type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate + float normal[3]; + float dist; + int32_t type; // PLANE_X - PLANE_ANYZ } dplane_t; -#define CONTENTS_EMPTY -1 -#define CONTENTS_SOLID -2 -#define CONTENTS_WATER -3 -#define CONTENTS_SLIME -4 -#define CONTENTS_LAVA -5 -#define CONTENTS_SKY -6 -#define CONTENTS_ORIGIN -7 // removed at csg time -#define CONTENTS_CLIP -8 // changed to contents_solid +#define CONTENTS_EMPTY -1 +#define CONTENTS_SOLID -2 +#define CONTENTS_WATER -3 +#define CONTENTS_SLIME -4 +#define CONTENTS_LAVA -5 +#define CONTENTS_SKY -6 +#define CONTENTS_ORIGIN -7 // removed at csg time +#define CONTENTS_CLIP -8 // changed to contents_solid -#define CONTENTS_CURRENT_0 -9 -#define CONTENTS_CURRENT_90 -10 -#define CONTENTS_CURRENT_180 -11 -#define CONTENTS_CURRENT_270 -12 -#define CONTENTS_CURRENT_UP -13 -#define CONTENTS_CURRENT_DOWN -14 +#define CONTENTS_CURRENT_0 -9 +#define CONTENTS_CURRENT_90 -10 +#define CONTENTS_CURRENT_180 -11 +#define CONTENTS_CURRENT_270 -12 +#define CONTENTS_CURRENT_UP -13 +#define CONTENTS_CURRENT_DOWN -14 // !!! if this is changed, it must be changed in asm_i386.h too !!! typedef struct dnode_s { - int32_t planenum; - int16_t children[2]; // negative numbers are -(leafs+1), not nodes - int16_t mins[3]; // for sphere culling - int16_t maxs[3]; - uint16_t firstface; - uint16_t numfaces; // counting both sides + int32_t planenum; + int16_t children[2]; // negative numbers are -(leafs+1), not nodes + int16_t mins[3]; // for sphere culling + int16_t maxs[3]; + uint16_t firstface; + uint16_t numfaces; // counting both sides } dnode_t; typedef struct dclipnode_s { - int32_t planenum; - int16_t children[2]; // negative numbers are contents + int32_t planenum; + int16_t children[2]; // negative numbers are contents } dclipnode_t; typedef struct texinfo_s { - float vecs[2][4]; // [s/t][xyz offset] - int32_t miptex; - int32_t flags; + float vecs[2][4]; // [s/t][xyz offset] + int32_t miptex; + int32_t flags; } texinfo_t; -#define TEX_SPECIAL 1 // sky or slime, no lightmap or 256 subdivision +#define TEX_SPECIAL 1 // sky or slime, no lightmap or 256 subdivision // note that edge 0 is never used, because negative edge nums are used for // counterclockwise use of the edge in a face typedef struct dedge_s { - uint16_t v[2]; // vertex numbers + uint16_t v[2]; // vertex numbers } dedge_t; -#define MAXLIGHTMAPS 4 +#define MAXLIGHTMAPS 4 typedef struct dface_s { - int16_t planenum; - int16_t side; + int16_t planenum; + int16_t side; - int32_t firstedge; // we must support > 64k edges - int16_t numedges; - int16_t texinfo; + int32_t firstedge; // we must support > 64k edges + int16_t numedges; + int16_t texinfo; // lighting info - byte styles[MAXLIGHTMAPS]; - int32_t lightofs; // start of [numstyles*surfsize] samples + byte styles[MAXLIGHTMAPS]; + int32_t lightofs; // start of [numstyles*surfsize] samples } dface_t; -#define AMBIENT_WATER 0 -#define AMBIENT_SKY 1 -#define AMBIENT_SLIME 2 -#define AMBIENT_LAVA 3 +#define AMBIENT_WATER 0 +#define AMBIENT_SKY 1 +#define AMBIENT_SLIME 2 +#define AMBIENT_LAVA 3 -#define NUM_AMBIENTS 4 // automatic ambient sounds +#define NUM_AMBIENTS 4 // automatic ambient sounds // leaf 0 is the generic CONTENTS_SOLID leaf, used for all solid areas // all other leafs need visibility info typedef struct dleaf_s { - int32_t contents; - int32_t visofs; // -1 = no visibility info + int32_t contents; + int32_t visofs; // -1 = no visibility info - int16_t mins[3]; // for frustum culling - int16_t maxs[3]; + int16_t mins[3]; // for frustum culling + int16_t maxs[3]; - uint16_t firstmarksurface; - uint16_t nummarksurfaces; + uint16_t firstmarksurface; + uint16_t nummarksurfaces; - byte ambient_level[NUM_AMBIENTS]; + byte ambient_level[NUM_AMBIENTS]; } dleaf_t; //============================================================================ typedef struct bsp_s { - dheader_t *header; // if this is non-null, all data is in one - // contiguous block + dheader_t *header; - int nummodels; - dmodel_t *models; + int nummodels; + dmodel_t *models; - size_t visdatasize; - byte *visdata; + size_t visdatasize; + byte *visdata; - size_t lightdatasize; - byte *lightdata; + size_t lightdatasize; + byte *lightdata; - size_t texdatasize; - byte *texdata; // (dmiptexlump_t) + size_t texdatasize; + byte *texdata; // (dmiptexlump_t) - size_t entdatasize; - char *entdata; + size_t entdatasize; + char *entdata; - int numleafs; - dleaf_t *leafs; + int numleafs; + dleaf_t *leafs; - int numplanes; - dplane_t *planes; + int numplanes; + dplane_t *planes; - int numvertexes; - dvertex_t *vertexes; + int numvertexes; + dvertex_t *vertexes; - int numnodes; - dnode_t *nodes; + int numnodes; + dnode_t *nodes; - int numtexinfo; - texinfo_t *texinfo; + int numtexinfo; + texinfo_t *texinfo; - int numfaces; - dface_t *faces; + int numfaces; + dface_t *faces; - int numclipnodes; - dclipnode_t *clipnodes; + int numclipnodes; + dclipnode_t *clipnodes; - int numedges; - dedge_t *edges; + int numedges; + dedge_t *edges; - int nummarksurfaces; - uint16_t *marksurfaces; + int nummarksurfaces; + uint16_t *marksurfaces; - int numsurfedges; - int32_t *surfedges; + int numsurfedges; + int32_t *surfedges; } bsp_t; bsp_t *LoadBSPMem (void *mem, size_t size); @@ -298,4 +296,4 @@ void BSP_AddVisibility (bsp_t *bsp, byte *visdata, size_t visdatasize); void BSP_AddEntities (bsp_t *bsp, char *entdata, size_t entdatasize); void BSP_AddTextures (bsp_t *bsp, byte *texdata, size_t texdatasize); -#endif // __bspfile_h_ +#endif//__bspfile_h_ From 56fb4d9a22b3296495fd0664ca3e10b64f37037b Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 23 Aug 2010 09:04:21 +0900 Subject: [PATCH 007/115] allow safe bsp freeing any memory the bsp thinks it does not own will not be freed --- include/QF/bspfile.h | 21 +++++++++- libs/util/bspfile.c | 82 +++++++++++++++++++++++++++----------- tools/qfbsp/source/qfbsp.c | 4 ++ 3 files changed, 82 insertions(+), 25 deletions(-) diff --git a/include/QF/bspfile.h b/include/QF/bspfile.h index 67cebb100..efc9f6722 100644 --- a/include/QF/bspfile.h +++ b/include/QF/bspfile.h @@ -228,50 +228,66 @@ typedef struct dleaf_s { //============================================================================ typedef struct bsp_s { + int own_header; dheader_t *header; - int nummodels; - dmodel_t *models; + int own_models; + int nummodels; + dmodel_t *models; + int own_visdata; size_t visdatasize; byte *visdata; + int own_lightdata; size_t lightdatasize; byte *lightdata; + int own_texdata; size_t texdatasize; byte *texdata; // (dmiptexlump_t) + int own_entdata; size_t entdatasize; char *entdata; + int own_leafs; int numleafs; dleaf_t *leafs; + int own_planes; int numplanes; dplane_t *planes; + int own_vertexes; int numvertexes; dvertex_t *vertexes; + int own_nodes; int numnodes; dnode_t *nodes; + int own_texinfo; int numtexinfo; texinfo_t *texinfo; + int own_faces; int numfaces; dface_t *faces; + int own_clipnodes; int numclipnodes; dclipnode_t *clipnodes; + int own_edges; int numedges; dedge_t *edges; + int own_marksurfaces; int nummarksurfaces; uint16_t *marksurfaces; + int own_surfedges; int numsurfedges; int32_t *surfedges; } bsp_t; @@ -280,6 +296,7 @@ bsp_t *LoadBSPMem (void *mem, size_t size); bsp_t *LoadBSPFile (QFile *file, size_t size); void WriteBSPFile (const bsp_t *bsp, QFile *file); bsp_t *BSP_New (void); +void BSP_Free (bsp_t *bsp); void BSP_AddPlane (bsp_t *bsp, dplane_t *plane); void BSP_AddLeaf (bsp_t *bsp, dleaf_t *leaf); void BSP_AddVertex (bsp_t *bsp, dvertex_t *vertex); diff --git a/libs/util/bspfile.c b/libs/util/bspfile.c index 445517d27..6408819b4 100644 --- a/libs/util/bspfile.c +++ b/libs/util/bspfile.c @@ -358,98 +358,131 @@ BSP_New (void) return calloc (1, sizeof (bsp_t)); } +VISIBLE void +BSP_Free (bsp_t *bsp) +{ +#define FREE(X) \ + do { \ + if (bsp->own_##X && bsp->X) \ + free (bsp->X); \ + } while (0) + + FREE (models); + FREE (visdata); + FREE (lightdata); + FREE (texdata); + FREE (entdata); + FREE (leafs); + FREE (planes); + FREE (vertexes); + FREE (nodes); + FREE (texinfo); + FREE (faces); + FREE (clipnodes); + FREE (edges); + FREE (marksurfaces); + FREE (surfedges); + FREE (header); + + free (bsp); +} + +#define REALLOC(X) \ + do { \ + if (!bsp->own_##X) { \ + bsp->own_##X = 1; \ + bsp->X = 0; \ + } \ + bsp->X = realloc (bsp->X, (bsp->num##X + 1) * sizeof (bsp->X[0])); \ + } while (0) + VISIBLE void BSP_AddPlane (bsp_t *bsp, dplane_t *plane) { - bsp->planes = realloc (bsp->planes, - (bsp->numplanes + 1) * sizeof (dplane_t)); + REALLOC (planes); bsp->planes[bsp->numplanes++] = *plane; } VISIBLE void BSP_AddLeaf (bsp_t *bsp, dleaf_t *leaf) { - bsp->leafs = realloc (bsp->leafs, - (bsp->numleafs + 1) * sizeof (dleaf_t)); + REALLOC (leafs); bsp->leafs[bsp->numleafs++] = *leaf; } VISIBLE void BSP_AddVertex (bsp_t *bsp, dvertex_t *vertex) { - bsp->vertexes = realloc (bsp->vertexes, - (bsp->numvertexes + 1) * sizeof (dvertex_t)); + REALLOC (vertexes); bsp->vertexes[bsp->numvertexes++] = *vertex; } VISIBLE void BSP_AddNode (bsp_t *bsp, dnode_t *node) { - bsp->nodes = realloc (bsp->nodes, - (bsp->numnodes + 1) * sizeof (dnode_t)); + REALLOC (nodes); bsp->nodes[bsp->numnodes++] = *node; } VISIBLE void BSP_AddTexinfo (bsp_t *bsp, texinfo_t *texinfo) { - bsp->texinfo = realloc (bsp->texinfo, - (bsp->numtexinfo + 1) * sizeof (texinfo_t)); + REALLOC (texinfo); bsp->texinfo[bsp->numtexinfo++] = *texinfo; } VISIBLE void BSP_AddFace (bsp_t *bsp, dface_t *face) { - bsp->faces = realloc (bsp->faces, - (bsp->numfaces + 1) * sizeof (dface_t)); + REALLOC (faces); bsp->faces[bsp->numfaces++] = *face; } VISIBLE void BSP_AddClipnode (bsp_t *bsp, dclipnode_t *clipnode) { - bsp->clipnodes = realloc (bsp->clipnodes, - (bsp->numclipnodes + 1) * sizeof (dclipnode_t)); + REALLOC (clipnodes); bsp->clipnodes[bsp->numclipnodes++] = *clipnode; } VISIBLE void BSP_AddMarkSurface (bsp_t *bsp, int marksurface) { - bsp->marksurfaces = realloc (bsp->marksurfaces, - (bsp->nummarksurfaces + 1) - * sizeof (uint16_t)); + REALLOC (marksurfaces); bsp->marksurfaces[bsp->nummarksurfaces++] = marksurface; } VISIBLE void BSP_AddSurfEdge (bsp_t *bsp, int surfedge) { - bsp->surfedges = realloc (bsp->surfedges, - (bsp->numsurfedges + 1) * sizeof (int32_t)); + REALLOC (surfedges); bsp->surfedges[bsp->numsurfedges++] = surfedge; } VISIBLE void BSP_AddEdge (bsp_t *bsp, dedge_t *edge) { - bsp->edges = realloc (bsp->edges, - (bsp->numedges + 1) * sizeof (dedge_t)); + REALLOC (edges); bsp->edges[bsp->numedges++] = *edge; } VISIBLE void BSP_AddModel (bsp_t *bsp, dmodel_t *model) { - bsp->models = realloc (bsp->models, - (bsp->nummodels + 1) * sizeof (dmodel_t)); + REALLOC (models); bsp->models[bsp->nummodels++] = *model; } +#define OWN(X) \ + do { \ + FREE(X); \ + bsp->own_##X = 1; \ + } while (0) + VISIBLE void BSP_AddLighting (bsp_t *bsp, byte *lightdata, size_t lightdatasize) { + OWN (lightdata); bsp->lightdatasize = lightdatasize; bsp->lightdata = malloc (lightdatasize); memcpy (bsp->lightdata, lightdata, lightdatasize); @@ -458,6 +491,7 @@ BSP_AddLighting (bsp_t *bsp, byte *lightdata, size_t lightdatasize) VISIBLE void BSP_AddVisibility (bsp_t *bsp, byte *visdata, size_t visdatasize) { + OWN (visdata); bsp->visdatasize = visdatasize; bsp->visdata = malloc (visdatasize); memcpy (bsp->visdata, visdata, visdatasize); @@ -466,6 +500,7 @@ BSP_AddVisibility (bsp_t *bsp, byte *visdata, size_t visdatasize) VISIBLE void BSP_AddEntities (bsp_t *bsp, char *entdata, size_t entdatasize) { + OWN (entdata); bsp->entdatasize = entdatasize; bsp->entdata = malloc (entdatasize); memcpy (bsp->entdata, entdata, entdatasize); @@ -474,6 +509,7 @@ BSP_AddEntities (bsp_t *bsp, char *entdata, size_t entdatasize) VISIBLE void BSP_AddTextures (bsp_t *bsp, byte *texdata, size_t texdatasize) { + OWN (texdata); bsp->texdatasize = texdatasize; bsp->texdata = malloc (texdatasize); memcpy (bsp->texdata, texdata, texdatasize); diff --git a/tools/qfbsp/source/qfbsp.c b/tools/qfbsp/source/qfbsp.c index b8a15d41a..fda8ba300 100644 --- a/tools/qfbsp/source/qfbsp.c +++ b/tools/qfbsp/source/qfbsp.c @@ -290,6 +290,7 @@ UpdateEntLump (void) if (!f) Sys_Error ("couldn't open %s. %s", options.bspfile, strerror(errno)); WriteBSPFile (bsp, f); + BSP_Free (bsp); Qclose (f); } @@ -495,6 +496,7 @@ ProcessFile (void) extract_entities (); if (options.extract_hull) extract_hull (); + BSP_Free (bsp); return; } @@ -503,6 +505,7 @@ ProcessFile (void) if (options.onlyents) { UpdateEntLump (); + BSP_Free (bsp); return; } @@ -527,6 +530,7 @@ ProcessFile (void) WriteEntitiesToString (); FinishBSPFile (); + BSP_Free (bsp); } int From 719ca1551694965998aa8ac80f6f8caff7e6aa8b Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 23 Aug 2010 09:40:01 +0900 Subject: [PATCH 008/115] make LoadBSPMem work in-place LoadBSPMem now modifies the passed in buffer rathern than allocating new memory. One step closer to cleaning up brush model loading. --- libs/util/bspfile.c | 50 ++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/libs/util/bspfile.c b/libs/util/bspfile.c index 6408819b4..748009a23 100644 --- a/libs/util/bspfile.c +++ b/libs/util/bspfile.c @@ -186,31 +186,32 @@ swap_bsp (bsp_t *bsp, int todisk) } bsp_t * -LoadBSPMem (void *mem, size_t size) +LoadBSPMem (void *mem, size_t mem_size) { - dheader_t *header = mem; + byte *data = mem; bsp_t *bsp; + size_t size; - if (LittleLong (header->version) != BSPVERSION) - Sys_Error ("version %i, not %i", LittleLong (header->version), + bsp = calloc (sizeof (bsp_t), 1); + + bsp->header = mem; + + if (LittleLong (bsp->header->version) != BSPVERSION) + Sys_Error ("version %i, not %i", LittleLong (bsp->header->version), BSPVERSION); - bsp = malloc (sizeof (bsp_t)); - bsp->header = 0; - #undef SET_LUMP #define SET_LUMP(l,n) \ do { \ - bsp->num##n = LittleLong (header->lumps[l].filelen); \ - if (bsp->num##n) { \ - bsp->n = malloc (bsp->num##n); \ - memcpy (bsp->n, \ - (byte *) header + LittleLong (header->lumps[l].fileofs), \ - bsp->num##n); \ - } else { \ - bsp->n = 0; \ + size = LittleLong (bsp->header->lumps[l].filelen); \ + data = (byte *) mem + LittleLong (bsp->header->lumps[l].fileofs); \ + if ((data + size) > ((byte *) mem + mem_size)) { \ + Sys_Error ("invalid lump"); \ } \ - bsp->num##n /= sizeof (bsp->n[0]); \ + bsp->n = 0; \ + if (size) \ + bsp->n = (void *) data; \ + bsp->num##n = size / sizeof (bsp->n[0]); \ } while (0) SET_LUMP (LUMP_PLANES, planes); @@ -228,15 +229,15 @@ do { \ #undef SET_LUMP #define SET_LUMP(l,n) \ do { \ - bsp->n##size = LittleLong (header->lumps[l].filelen); \ - if (bsp->n##size) { \ - bsp->n = malloc (bsp->n##size); \ - memcpy (bsp->n, \ - (byte *) header + LittleLong (header->lumps[l].fileofs), \ - bsp->n##size); \ - } else { \ - bsp->n = 0; \ + size = LittleLong (bsp->header->lumps[l].filelen); \ + data = (byte *) mem + LittleLong (bsp->header->lumps[l].fileofs); \ + if ((data + size) > ((byte *) mem + mem_size)) { \ + Sys_Error ("invalid lump"); \ } \ + bsp->n = 0; \ + if (size) \ + bsp->n = (void *) data; \ + bsp->n##size = size; \ } while (0) SET_LUMP (LUMP_LIGHTING, lightdata); @@ -257,7 +258,6 @@ LoadBSPFile (QFile *file, size_t size) buf = malloc (size); Qread (file, buf, size); bsp = LoadBSPMem (buf, size); - free (buf); return bsp; } From db898655d155fcfb11f868e5f9f4e57f603b90f9 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 23 Aug 2010 09:49:45 +0900 Subject: [PATCH 009/115] make LoadBSPFile own the memory for the bsp data --- libs/util/bspfile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/util/bspfile.c b/libs/util/bspfile.c index 748009a23..d0f05b565 100644 --- a/libs/util/bspfile.c +++ b/libs/util/bspfile.c @@ -258,6 +258,7 @@ LoadBSPFile (QFile *file, size_t size) buf = malloc (size); Qread (file, buf, size); bsp = LoadBSPMem (buf, size); + bsp->own_header = 1; return bsp; } From 7fca21837af9252ea7c5c4067344fcb6aeed808c Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 23 Aug 2010 09:50:42 +0900 Subject: [PATCH 010/115] fix some errors found by valgrind --- tools/bsp2img/bsp2img.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/bsp2img/bsp2img.c b/tools/bsp2img/bsp2img.c index a72ed18bf..36eda93c2 100644 --- a/tools/bsp2img/bsp2img.c +++ b/tools/bsp2img/bsp2img.c @@ -149,8 +149,9 @@ plotpoint (image_t *image, long xco, long yco, unsigned int color) { unsigned int bigcol = 0; - if (image->width < 0 || image->height < 0 - || xco < 0 || xco > image->width || yco < 0 || yco > image->height) + if (image->width <= 0 || image->height <= 0 + || xco < 0 || xco >= image->width + || yco < 0 || yco >= image->height) return; bigcol = (unsigned int) image->image[yco * image->width + xco]; @@ -729,10 +730,10 @@ render_map (bsp_t *bsp) { long width, height; - width = (maxX - minX) / options.scaledown; + width = (maxX - minX + 1) / options.scaledown; width += (options.image_pad + options.z_pad) * 2; - height = (maxY - minY) / options.scaledown; + height = (maxY - minY + 1) / options.scaledown; height += (options.image_pad + options.z_pad) * 2; image = create_image (width, height); @@ -964,6 +965,7 @@ main (int argc, char *argv[]) Qclose (bspfile); image = render_map (bsp); + BSP_Free (bsp); /* Write image */ From cd159e1cc152e9985e9adcb267c5754435a14b8c Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 23 Aug 2010 11:56:43 +0900 Subject: [PATCH 011/115] Use LoadBSPMem to load brush models. Now that Mod_LoadBrushModel uses bspfile.[ch], the engine uses the same code as the tools to work with bsp files. --- include/QF/bspfile.h | 19 ++- include/QF/model.h | 2 +- libs/models/brush/gl_model_brush.c | 22 ++-- libs/models/brush/model_brush.c | 196 ++++++++++++----------------- libs/models/brush/sw_model_brush.c | 8 +- libs/models/null_model.c | 2 +- libs/util/bspfile.c | 34 ++--- 7 files changed, 138 insertions(+), 145 deletions(-) diff --git a/include/QF/bspfile.h b/include/QF/bspfile.h index efc9f6722..e60cc22f7 100644 --- a/include/QF/bspfile.h +++ b/include/QF/bspfile.h @@ -292,7 +292,24 @@ typedef struct bsp_s { int32_t *surfedges; } bsp_t; -bsp_t *LoadBSPMem (void *mem, size_t size); +/** Create a bsp structure from a memory buffer. + The returned structure will be setup to point into the supplied buffer. + All structures within the bsp will be byte-swapped. For this reason, if + a callback is provided, the callback be called after byteswapping the + header, but before byteswapping any data in the lumps. + + \param mem The buffer holding the bsp data. + \param size The size of the buffer. This is used for sanity checking. + \param cb Pointer to the callback function. + \param cbdata Pointer to extra data for the callback. + \return Initialized bsp structure. + + \note The caller maintains ownership of the memory buffer. BSP_Free will + free only the bsp structure itself. However, if the caller wishes to + relinquish ownership of the buffer, set bsp_t::own_header to true. +*/ +bsp_t *LoadBSPMem (void *mem, size_t size, void (*cb) (const bsp_t *, void *), + void *cbdata); bsp_t *LoadBSPFile (QFile *file, size_t size); void WriteBSPFile (const bsp_t *bsp, QFile *file); bsp_t *BSP_New (void); diff --git a/include/QF/model.h b/include/QF/model.h index 2407d062b..67790253f 100644 --- a/include/QF/model.h +++ b/include/QF/model.h @@ -436,7 +436,7 @@ model_t *Mod_FindName (const char *name); void Mod_ProcessTexture(miptex_t *mt, texture_t *tx); void Mod_LoadExternalSkins (model_t * mod); void Mod_LoadExternalTextures (model_t * mod); -void Mod_LoadLighting (lump_t *l); +void Mod_LoadLighting (bsp_t *bsp); int Mod_CalcFullbright (byte *in, byte *out, int pixels); int Mod_Fullbright (byte * skin, int width, int height, char *name); diff --git a/libs/models/brush/gl_model_brush.c b/libs/models/brush/gl_model_brush.c index 5418f72e9..78a73d3b6 100644 --- a/libs/models/brush/gl_model_brush.c +++ b/libs/models/brush/gl_model_brush.c @@ -137,12 +137,13 @@ Mod_LoadExternalTextures (model_t *mod) } void -Mod_LoadLighting (lump_t *l) +Mod_LoadLighting (bsp_t *bsp) { byte d; byte *in, *out, *data; dstring_t *litfilename = dstring_new (); - int i; + size_t i; + int ver; dstring_copystr (litfilename, loadmodel->name); loadmodel->lightdata = NULL; @@ -154,36 +155,37 @@ Mod_LoadLighting (lump_t *l) if (data) { if (data[0] == 'Q' && data[1] == 'L' && data[2] == 'I' && data[3] == 'T') { - i = LittleLong (((int *) data)[1]); - if (i == 1) { + ver = LittleLong (((int32_t *) data)[1]); + if (ver == 1) { Sys_DPrintf ("%s loaded", litfilename->str); loadmodel->lightdata = data + 8; return; } else - Sys_DPrintf ("Unknown .lit file version (%d)\n", i); + Sys_DPrintf ("Unknown .lit file version (%d)\n", ver); } else Sys_DPrintf ("Corrupt .lit file (old version?), ignoring\n"); } } // LordHavoc: oh well, expand the white lighting data - if (!l->filelen) { + if (!bsp->lightdatasize) { dstring_delete (litfilename); return; } - loadmodel->lightdata = Hunk_AllocName (l->filelen * mod_lightmap_bytes, + loadmodel->lightdata = Hunk_AllocName (bsp->lightdatasize + * mod_lightmap_bytes, litfilename->str); - in = mod_base + l->fileofs; + in = bsp->lightdata; out = loadmodel->lightdata; if (mod_lightmap_bytes > 1) - for (i = 0; i < l->filelen ; i++) { + for (i = 0; i < bsp->lightdatasize ; i++) { d = gammatable[*in++]; *out++ = d; *out++ = d; *out++ = d; } else - for (i = 0; i < l->filelen ; i++) + for (i = 0; i < bsp->lightdatasize ; i++) *out++ = gammatable[*in++]; dstring_delete (litfilename); } diff --git a/libs/models/brush/model_brush.c b/libs/models/brush/model_brush.c index 21f751dbc..45fb0c2ef 100644 --- a/libs/models/brush/model_brush.c +++ b/libs/models/brush/model_brush.c @@ -128,8 +128,6 @@ Mod_LeafPVS (mleaf_t *leaf, model_t *model) // BRUSHMODEL LOADING ========================================================= -byte *mod_base; - //FIXME SLOW! static void mod_unique_miptex_name (texture_t **textures, texture_t *tx, int ind) @@ -156,7 +154,7 @@ mod_unique_miptex_name (texture_t **textures, texture_t *tx, int ind) } static void -Mod_LoadTextures (lump_t *l) +Mod_LoadTextures (bsp_t *bsp) { dmiptexlump_t *m; int i, j, pixels, num, max, altmax; @@ -164,11 +162,11 @@ Mod_LoadTextures (lump_t *l) texture_t *tx, *tx2; texture_t *anims[10], *altanims[10]; - if (!l->filelen) { + if (!bsp->texdatasize) { loadmodel->textures = NULL; return; } - m = (dmiptexlump_t *) (mod_base + l->fileofs); + m = (dmiptexlump_t *) bsp->texdata; m->nummiptex = LittleLong (m->nummiptex); @@ -292,38 +290,36 @@ Mod_LoadTextures (lump_t *l) } static void -Mod_LoadVisibility (lump_t *l) +Mod_LoadVisibility (bsp_t *bsp) { - if (!l->filelen) { + if (!bsp->visdatasize) { loadmodel->visdata = NULL; return; } - loadmodel->visdata = Hunk_AllocName (l->filelen, loadname); - memcpy (loadmodel->visdata, mod_base + l->fileofs, l->filelen); + loadmodel->visdata = Hunk_AllocName (bsp->visdatasize, loadname); + memcpy (loadmodel->visdata, bsp->visdata, bsp->visdatasize); } static void -Mod_LoadEntities (lump_t *l) +Mod_LoadEntities (bsp_t *bsp) { - if (!l->filelen) { + if (!bsp->entdatasize) { loadmodel->entities = NULL; return; } - loadmodel->entities = Hunk_AllocName (l->filelen, loadname); - memcpy (loadmodel->entities, mod_base + l->fileofs, l->filelen); + loadmodel->entities = Hunk_AllocName (bsp->entdatasize, loadname); + memcpy (loadmodel->entities, bsp->entdata, bsp->entdatasize); } static void -Mod_LoadVertexes (lump_t *l) +Mod_LoadVertexes (bsp_t *bsp) { dvertex_t *in; int count, i; mvertex_t *out; - in = (void *) (mod_base + l->fileofs); - if (l->filelen % sizeof (*in)) - Sys_Error ("Mod_LoadBmodel: funny lump size in %s", loadmodel->name); - count = l->filelen / sizeof (*in); + in = bsp->vertexes; + count = bsp->numvertexes; out = Hunk_AllocName (count * sizeof (*out), loadname); loadmodel->vertexes = out; @@ -337,15 +333,13 @@ Mod_LoadVertexes (lump_t *l) } static void -Mod_LoadSubmodels (lump_t *l) +Mod_LoadSubmodels (bsp_t *bsp) { dmodel_t *in, *out; int count, i, j; - in = (void *) (mod_base + l->fileofs); - if (l->filelen % sizeof (*in)) - Sys_Error ("Mod_LoadBmodel: funny lump size in %s", loadmodel->name); - count = l->filelen / sizeof (*in); + in = bsp->models; + count = bsp->nummodels; out = Hunk_AllocName (count * sizeof (*out), loadname); loadmodel->submodels = out; @@ -366,16 +360,14 @@ Mod_LoadSubmodels (lump_t *l) } static void -Mod_LoadEdges (lump_t *l) +Mod_LoadEdges (bsp_t *bsp) { dedge_t *in; int count, i; medge_t *out; - in = (void *) (mod_base + l->fileofs); - if (l->filelen % sizeof (*in)) - Sys_Error ("Mod_LoadBmodel: funny lump size in %s", loadmodel->name); - count = l->filelen / sizeof (*in); + in = bsp->edges; + count = bsp->numedges; out = Hunk_AllocName ((count + 1) * sizeof (*out), loadname); loadmodel->edges = out; @@ -388,17 +380,15 @@ Mod_LoadEdges (lump_t *l) } static void -Mod_LoadTexinfo (lump_t *l) +Mod_LoadTexinfo (bsp_t *bsp) { float len1, len2; int count, miptex, i, j; mtexinfo_t *out; texinfo_t *in; - in = (void *) (mod_base + l->fileofs); - if (l->filelen % sizeof (*in)) - Sys_Error ("Mod_LoadBmodel: funny lump size in %s", loadmodel->name); - count = l->filelen / sizeof (*in); + in = bsp->texinfo; + count = bsp->numtexinfo; out = Hunk_AllocName (count * sizeof (*out), loadname); loadmodel->texinfo = out; @@ -491,16 +481,14 @@ CalcSurfaceExtents (msurface_t *s) } static void -Mod_LoadFaces (lump_t *l) +Mod_LoadFaces (bsp_t *bsp) { dface_t *in; int count, planenum, side, surfnum, i; msurface_t *out; - in = (void *) (mod_base + l->fileofs); - if (l->filelen % sizeof (*in)) - Sys_Error ("Mod_LoadBmodel: funny lump size in %s", loadmodel->name); - count = l->filelen / sizeof (*in); + in = bsp->faces; + count = bsp->numfaces; out = Hunk_AllocName (count * sizeof (*out), loadname); loadmodel->surfaces = out; @@ -568,16 +556,14 @@ Mod_SetParent (mnode_t *node, mnode_t *parent) } static void -Mod_LoadNodes (lump_t *l) +Mod_LoadNodes (bsp_t *bsp) { dnode_t *in; int count, i, j, p; mnode_t *out; - in = (void *) (mod_base + l->fileofs); - if (l->filelen % sizeof (*in)) - Sys_Error ("Mod_LoadBmodel: funny lump size in %s", loadmodel->name); - count = l->filelen / sizeof (*in); + in = bsp->nodes; + count = bsp->numnodes; out = Hunk_AllocName (count * sizeof (*out), loadname); loadmodel->nodes = out; @@ -608,17 +594,15 @@ Mod_LoadNodes (lump_t *l) } static void -Mod_LoadLeafs (lump_t *l) +Mod_LoadLeafs (bsp_t *bsp) { dleaf_t *in; int count, i, j, p; mleaf_t *out; qboolean isnotmap = true; - in = (void *) (mod_base + l->fileofs); - if (l->filelen % sizeof (*in)) - Sys_Error ("Mod_LoadBmodel: funny lump size in %s", loadmodel->name); - count = l->filelen / sizeof (*in); + in = bsp->leafs; + count = bsp->numleafs; out = Hunk_AllocName (count * sizeof (*out), loadname); loadmodel->leafs = out; @@ -663,16 +647,14 @@ Mod_LoadLeafs (lump_t *l) } static void -Mod_LoadClipnodes (lump_t *l) +Mod_LoadClipnodes (bsp_t *bsp) { dclipnode_t *in, *out; hull_t *hull; int count, i; - in = (void *) (mod_base + l->fileofs); - if (l->filelen % sizeof (*in)) - Sys_Error ("Mod_LoadBmodel: funny lump size in %s", loadmodel->name); - count = l->filelen / sizeof (*in); + in = bsp->clipnodes; + count = bsp->numclipnodes; out = Hunk_AllocName (count * sizeof (*out), loadname); loadmodel->clipnodes = out; @@ -756,16 +738,14 @@ Mod_MakeHull0 (void) } static void -Mod_LoadMarksurfaces (lump_t *l) +Mod_LoadMarksurfaces (bsp_t *bsp) { int count, i, j; msurface_t **out; - short *in; + uint16_t *in; - in = (void *) (mod_base + l->fileofs); - if (l->filelen % sizeof (*in)) - Sys_Error ("Mod_LoadBmodel: funny lump size in %s", loadmodel->name); - count = l->filelen / sizeof (*in); + in = bsp->marksurfaces; + count = bsp->nummarksurfaces; out = Hunk_AllocName (count * sizeof (*out), loadname); loadmodel->marksurfaces = out; @@ -780,15 +760,14 @@ Mod_LoadMarksurfaces (lump_t *l) } static void -Mod_LoadSurfedges (lump_t *l) +Mod_LoadSurfedges (bsp_t *bsp) { - int count, i; - int *in, *out; + int count, i; + int32_t *in; + int *out; - in = (void *) (mod_base + l->fileofs); - if (l->filelen % sizeof (*in)) - Sys_Error ("Mod_LoadBmodel: funny lump size in %s", loadmodel->name); - count = l->filelen / sizeof (*in); + in = bsp->surfedges; + count = bsp->numsurfedges; out = Hunk_AllocName (count * sizeof (*out), loadname); loadmodel->surfedges = out; @@ -799,16 +778,14 @@ Mod_LoadSurfedges (lump_t *l) } static void -Mod_LoadPlanes (lump_t *l) +Mod_LoadPlanes (bsp_t *bsp) { dplane_t *in; int bits, count, i, j; mplane_t *out; - in = (void *) (mod_base + l->fileofs); - if (l->filelen % sizeof (*in)) - Sys_Error ("Mod_LoadBmodel: funny lump size in %s", loadmodel->name); - count = l->filelen / sizeof (*in); + in = bsp->planes; + count = bsp->numplanes; out = Hunk_AllocName (count * 2 * sizeof (*out), loadname); loadmodel->planes = out; @@ -828,66 +805,59 @@ Mod_LoadPlanes (lump_t *l) } } -void -Mod_LoadBrushModel (model_t *mod, void *buffer) +static void +do_checksums (const bsp_t *bsp, void *_mod) { - dheader_t *header; - dmodel_t *bm; - int i, j; + int i; + model_t *mod = (model_t *) _mod; + byte *base; - loadmodel->type = mod_brush; - - header = (dheader_t *) buffer; - - i = LittleLong (header->version); - if (i != BSPVERSION) - Sys_Error ("Mod_LoadBrushModel: %s has wrong version number (%i " - "should be %i)", mod->name, i, BSPVERSION); - - // swap all the lumps - mod_base = (byte *) header; - - for (i = 0; i < (int) sizeof (dheader_t) / 4; i++) - ((int *) header)[i] = LittleLong (((int *) header)[i]); + base = (byte *) bsp->header; // checksum all of the map, except for entities mod->checksum = 0; mod->checksum2 = 0; - for (i = 0; i < HEADER_LUMPS; i++) { - lump_t *lump = header->lumps + i; + lump_t *lump = bsp->header->lumps + i; int csum; - if (lump->fileofs > qfs_filesize - || (lump->fileofs + lump->filelen) > qfs_filesize) - Sys_Error ("Mod_LoadBrushModel: %s seems to be truncated", - mod->name); if (i == LUMP_ENTITIES) continue; - csum = Com_BlockChecksum (mod_base + lump->fileofs, lump->filelen); + csum = Com_BlockChecksum (base + lump->fileofs, lump->filelen); mod->checksum ^= csum; if (i != LUMP_VISIBILITY && i != LUMP_LEAFS && i != LUMP_NODES) mod->checksum2 ^= csum; } +} + +void +Mod_LoadBrushModel (model_t *mod, void *buffer) +{ + dmodel_t *bm; + int i, j; + bsp_t *bsp; + + loadmodel->type = mod_brush; + + bsp = LoadBSPMem (buffer, qfs_filesize, do_checksums, mod); // load into heap - - Mod_LoadVertexes (&header->lumps[LUMP_VERTEXES]); - Mod_LoadEdges (&header->lumps[LUMP_EDGES]); - Mod_LoadSurfedges (&header->lumps[LUMP_SURFEDGES]); - Mod_LoadTextures (&header->lumps[LUMP_TEXTURES]); - Mod_LoadLighting (&header->lumps[LUMP_LIGHTING]); - Mod_LoadPlanes (&header->lumps[LUMP_PLANES]); - Mod_LoadTexinfo (&header->lumps[LUMP_TEXINFO]); - Mod_LoadFaces (&header->lumps[LUMP_FACES]); - Mod_LoadMarksurfaces (&header->lumps[LUMP_MARKSURFACES]); - Mod_LoadVisibility (&header->lumps[LUMP_VISIBILITY]); - Mod_LoadLeafs (&header->lumps[LUMP_LEAFS]); - Mod_LoadNodes (&header->lumps[LUMP_NODES]); - Mod_LoadClipnodes (&header->lumps[LUMP_CLIPNODES]); - Mod_LoadEntities (&header->lumps[LUMP_ENTITIES]); - Mod_LoadSubmodels (&header->lumps[LUMP_MODELS]); + Mod_LoadVertexes (bsp); + Mod_LoadEdges (bsp); + Mod_LoadSurfedges (bsp); + Mod_LoadTextures (bsp); + Mod_LoadLighting (bsp); + Mod_LoadPlanes (bsp); + Mod_LoadTexinfo (bsp); + Mod_LoadFaces (bsp); + Mod_LoadMarksurfaces (bsp); + Mod_LoadVisibility (bsp); + Mod_LoadLeafs (bsp); + Mod_LoadNodes (bsp); + Mod_LoadClipnodes (bsp); + Mod_LoadEntities (bsp); + Mod_LoadSubmodels (bsp); Mod_MakeHull0 (); diff --git a/libs/models/brush/sw_model_brush.c b/libs/models/brush/sw_model_brush.c index d072779f8..4d875fffc 100644 --- a/libs/models/brush/sw_model_brush.c +++ b/libs/models/brush/sw_model_brush.c @@ -62,13 +62,13 @@ Mod_LoadExternalTextures (model_t *mod) } void -Mod_LoadLighting (lump_t *l) +Mod_LoadLighting (bsp_t *bsp) { mod_lightmap_bytes = 1; - if (!l->filelen) { + if (!bsp->lightdatasize) { loadmodel->lightdata = NULL; return; } - loadmodel->lightdata = Hunk_AllocName (l->filelen, loadname); - memcpy (loadmodel->lightdata, mod_base + l->fileofs, l->filelen); + loadmodel->lightdata = Hunk_AllocName (bsp->lightdatasize, loadname); + memcpy (loadmodel->lightdata, bsp->lightdata, bsp->lightdatasize); } diff --git a/libs/models/null_model.c b/libs/models/null_model.c index 6f77a7fa2..bd6ccac38 100644 --- a/libs/models/null_model.c +++ b/libs/models/null_model.c @@ -38,7 +38,7 @@ static __attribute__ ((used)) const char rcsid[] = int mod_lightmap_bytes = 1; void -Mod_LoadLighting (lump_t *l) +Mod_LoadLighting (bsp_t *bsp) { } diff --git a/libs/util/bspfile.c b/libs/util/bspfile.c index d0f05b565..a0b10c2bb 100644 --- a/libs/util/bspfile.c +++ b/libs/util/bspfile.c @@ -47,7 +47,8 @@ static __attribute__ ((used)) const char rcsid[] = #include "QF/sys.h" static void -swap_bsp (bsp_t *bsp, int todisk) +swap_bsp (bsp_t *bsp, int todisk, void (*cb) (const bsp_t *, void *), + void *cbdata) { int c, i, j; dmiptexlump_t *mtl; @@ -61,6 +62,8 @@ swap_bsp (bsp_t *bsp, int todisk) bsp->header->lumps[i].filelen = LittleLong (bsp->header->lumps[i].filelen); } + if (cb) + cb (bsp, cbdata); } // models @@ -186,11 +189,10 @@ swap_bsp (bsp_t *bsp, int todisk) } bsp_t * -LoadBSPMem (void *mem, size_t mem_size) +LoadBSPMem (void *mem, size_t mem_size, void (*cb) (const bsp_t *, void *), + void *cbdata) { - byte *data = mem; bsp_t *bsp; - size_t size; bsp = calloc (sizeof (bsp_t), 1); @@ -203,11 +205,13 @@ LoadBSPMem (void *mem, size_t mem_size) #undef SET_LUMP #define SET_LUMP(l,n) \ do { \ - size = LittleLong (bsp->header->lumps[l].filelen); \ - data = (byte *) mem + LittleLong (bsp->header->lumps[l].fileofs); \ - if ((data + size) > ((byte *) mem + mem_size)) { \ + size_t size = LittleLong (bsp->header->lumps[l].filelen); \ + size_t offs = LittleLong (bsp->header->lumps[l].fileofs); \ + void *data = (byte *) mem + offs; \ + if (offs >= mem_size || (offs + size) > mem_size) \ Sys_Error ("invalid lump"); \ - } \ + if (size % sizeof (bsp->n[0])) \ + Sys_Error ("funny lump size"); \ bsp->n = 0; \ if (size) \ bsp->n = (void *) data; \ @@ -229,11 +233,11 @@ do { \ #undef SET_LUMP #define SET_LUMP(l,n) \ do { \ - size = LittleLong (bsp->header->lumps[l].filelen); \ - data = (byte *) mem + LittleLong (bsp->header->lumps[l].fileofs); \ - if ((data + size) > ((byte *) mem + mem_size)) { \ + size_t size = LittleLong (bsp->header->lumps[l].filelen); \ + size_t offs = LittleLong (bsp->header->lumps[l].fileofs); \ + void *data = (byte *) mem + offs; \ + if (offs >= mem_size || (offs + size) > mem_size) \ Sys_Error ("invalid lump"); \ - } \ bsp->n = 0; \ if (size) \ bsp->n = (void *) data; \ @@ -245,7 +249,7 @@ do { \ SET_LUMP (LUMP_ENTITIES, entdata); SET_LUMP (LUMP_TEXTURES, texdata); - swap_bsp (bsp, 0); + swap_bsp (bsp, 0, cb, cbdata); return bsp; } @@ -257,7 +261,7 @@ LoadBSPFile (QFile *file, size_t size) buf = malloc (size); Qread (file, buf, size); - bsp = LoadBSPMem (buf, size); + bsp = LoadBSPMem (buf, size, 0, 0); bsp->own_header = 1; return bsp; } @@ -347,7 +351,7 @@ do { \ SET_LUMP (LUMP_ENTITIES, entdata); SET_LUMP (LUMP_TEXTURES, texdata); - swap_bsp (&tbsp, 1); + swap_bsp (&tbsp, 1, 0, 0); Qwrite (file, tbsp.header, size); free (tbsp.header); From 9a30968c876b51c32f82edba1f983251d7c20231 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 23 Aug 2010 11:58:49 +0900 Subject: [PATCH 012/115] type size correctness --- libs/models/model.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/models/model.c b/libs/models/model.c index 222344b36..cfce6e53c 100644 --- a/libs/models/model.c +++ b/libs/models/model.c @@ -155,10 +155,10 @@ Mod_FindName (const char *name) static model_t * Mod_RealLoadModel (model_t *mod, qboolean crash, cache_allocator_t allocator) { - unsigned int *buf; + uint32_t *buf; // load the file - buf = (unsigned int *) QFS_LoadFile (mod->name, 0); + buf = (uint32_t *) QFS_LoadFile (mod->name, 0); if (!buf) { if (crash) Sys_Error ("Mod_LoadModel: %s not found", mod->name); @@ -181,7 +181,7 @@ Mod_RealLoadModel (model_t *mod, qboolean crash, cache_allocator_t allocator) mod->needload = false; mod->hasfullbrights = false; - switch (LittleLong (*(unsigned int *) buf)) { + switch (LittleLong (*buf)) { case IDHEADER_MDL: // Type 6: Quake 1 .mdl case HEADER_MDL16: // QF Type 6 extended for 16bit precision if (strequal (mod->name, "progs/grenade.mdl")) { From c9eb679c416a5a56df02fd65a03b59f72f996f8f Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 27 Aug 2010 21:38:09 +0900 Subject: [PATCH 013/115] Make PlaneTypeForNormal const-correct. --- tools/qfbsp/include/brush.h | 2 +- tools/qfbsp/source/brush.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/qfbsp/include/brush.h b/tools/qfbsp/include/brush.h index bfdd2e625..11758f678 100644 --- a/tools/qfbsp/include/brush.h +++ b/tools/qfbsp/include/brush.h @@ -48,7 +48,7 @@ extern int numbrushplanes; extern plane_t planes[MAX_MAP_PLANES]; brushset_t *Brush_LoadEntity (entity_t *ent, int hullnum); -int PlaneTypeForNormal (vec3_t normal); +int PlaneTypeForNormal (const vec3_t normal); int FindPlane (plane_t *dplane, int *side); #endif//qfbsp_brush_h diff --git a/tools/qfbsp/source/brush.c b/tools/qfbsp/source/brush.c index a3347af5a..6f8986182 100644 --- a/tools/qfbsp/source/brush.c +++ b/tools/qfbsp/source/brush.c @@ -134,7 +134,7 @@ AddToBounds (brushset_t *bs, vec3_t v) } int -PlaneTypeForNormal (vec3_t normal) +PlaneTypeForNormal (const vec3_t normal) { float ax, ay, az; From b91568bbdd761d954463103ee57ab4d6ba5ec8cf Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 27 Aug 2010 21:41:04 +0900 Subject: [PATCH 014/115] More non-canonical checks in PlaneTypeForNormal. --- tools/qfbsp/source/brush.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/qfbsp/source/brush.c b/tools/qfbsp/source/brush.c index 6f8986182..255d72731 100644 --- a/tools/qfbsp/source/brush.c +++ b/tools/qfbsp/source/brush.c @@ -137,6 +137,7 @@ int PlaneTypeForNormal (const vec3_t normal) { float ax, ay, az; + int type; // NOTE: should these have an epsilon around 1.0? if (normal[0] == 1.0) @@ -153,10 +154,14 @@ PlaneTypeForNormal (const vec3_t normal) az = fabs(normal[2]); if (ax >= ay && ax >= az) - return PLANE_ANYX; - if (ay >= ax && ay >= az) - return PLANE_ANYY; - return PLANE_ANYZ; + type = PLANE_ANYX; + else if (ay >= ax && ay >= az) + type = PLANE_ANYY; + else + type = PLANE_ANYZ; + if (normal[type - PLANE_ANYX] < 0) + Sys_Error ("PlaneTypeForNormal: not a canonical vector"); + return type; } #define DISTEPSILON 0.01 From 9a4c9c506fcadd46b0f231a5a1279af05f727303 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 27 Aug 2010 21:43:53 +0900 Subject: [PATCH 015/115] Fix bbox calculation for rotating brush entities. --- tools/qfbsp/source/brush.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/qfbsp/source/brush.c b/tools/qfbsp/source/brush.c index 255d72731..8f1824005 100644 --- a/tools/qfbsp/source/brush.c +++ b/tools/qfbsp/source/brush.c @@ -374,9 +374,9 @@ CreateBrushFaces (void) min = brush_mins[2]; max = brush_maxs[0]; - if (max > brush_maxs[1]) + if (max < brush_maxs[1]) max = brush_maxs[1]; - if (max > brush_maxs[2]) + if (max < brush_maxs[2]) max = brush_maxs[2]; delta = fabs(max); From 5c0a55d818bd2788cc1eaa9636b6d09bea86ad32 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 27 Aug 2010 21:46:06 +0900 Subject: [PATCH 016/115] Add some documentation for the brush code. --- tools/qfbsp/include/brush.h | 17 +++++++++++++++++ tools/qfbsp/source/brush.c | 18 +++++++++++++----- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/tools/qfbsp/include/brush.h b/tools/qfbsp/include/brush.h index 11758f678..884f56546 100644 --- a/tools/qfbsp/include/brush.h +++ b/tools/qfbsp/include/brush.h @@ -48,7 +48,24 @@ extern int numbrushplanes; extern plane_t planes[MAX_MAP_PLANES]; brushset_t *Brush_LoadEntity (entity_t *ent, int hullnum); + +/** Determine the primary axis of the normal. + + \param normal Must be canonical. +*/ int PlaneTypeForNormal (const vec3_t normal); + +/** Add a plane to the global list of planes. + + Make the plane canonical, and add it to the global list of planes if it + does not duplicate a plane that is already in the list. If the plane is + flipped while being made canonical, side will be set to 1, otherwise side + will be 0. + + \param dplane The plane to add. + \param side The side of the plane that will be front. + \return global plane number. +*/ int FindPlane (plane_t *dplane, int *side); #endif//qfbsp_brush_h diff --git a/tools/qfbsp/source/brush.c b/tools/qfbsp/source/brush.c index 8f1824005..196e515e2 100644 --- a/tools/qfbsp/source/brush.c +++ b/tools/qfbsp/source/brush.c @@ -167,11 +167,20 @@ PlaneTypeForNormal (const vec3_t normal) #define DISTEPSILON 0.01 #define ANGLEEPSILON 0.00001 +/** Make the plane canonical. + + A cononical plane is one whose normal points towards +inf on its primary + axis. The primary axis is that which has the largest magnitude of the + vector's components. + + \param dp The plane to make canonical. +*/ static void NormalizePlane (plane_t *dp) { vec_t ax, ay, az; + // Make axis aligned planes point to +inf. if (dp->normal[0] == -1.0) { dp->normal[0] = 1.0; dp->dist = -dp->dist; @@ -183,6 +192,8 @@ NormalizePlane (plane_t *dp) dp->dist = -dp->dist; } + // For axis aligned planes, set the plane type and ensure the normal + // vector is mathematically correct. if (dp->normal[0] == 1.0) { dp->type = PLANE_X; dp->normal[1] = dp->normal[2] = 0.0; @@ -199,6 +210,7 @@ NormalizePlane (plane_t *dp) return; } + // Find out with which axis the plane is most aligned. ax = fabs (dp->normal[0]); ay = fabs (dp->normal[1]); az = fabs (dp->normal[2]); @@ -209,17 +221,13 @@ NormalizePlane (plane_t *dp) dp->type = PLANE_ANYY; else dp->type = PLANE_ANYZ; + // Make the plane's normal point towards +inf along its primary axis. if (dp->normal[dp->type - PLANE_ANYX] < 0) { VectorNegate (dp->normal, dp->normal); dp->dist = -dp->dist; } } -/* - FindPlane - - Returns a global plane number and the side that will be the front -*/ int FindPlane (plane_t *dplane, int *side) { From 5cf5c1e2278419708dc32fafebd185426d81fea5 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 27 Aug 2010 22:12:13 +0900 Subject: [PATCH 017/115] lots of whitespace --- tools/qfbsp/include/brush.h | 14 ++--- tools/qfbsp/include/bsp5.h | 98 ++++++++++++++++++----------------- tools/qfbsp/include/map.h | 56 ++++++++++---------- tools/qfbsp/include/options.h | 36 ++++++------- tools/qfbsp/include/portals.h | 6 +-- tools/qfbsp/include/winding.h | 4 +- tools/qfbsp/source/brush.c | 4 +- tools/qfbsp/source/merge.c | 2 +- tools/qfbsp/source/options.c | 6 +-- tools/qfbsp/source/qfbsp.c | 2 +- tools/qfbsp/source/writebsp.c | 4 +- 11 files changed, 115 insertions(+), 117 deletions(-) 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); From 2e6eb419ca88ed1bc851cc5cedff913949998fb6 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 28 Aug 2010 22:04:58 +0900 Subject: [PATCH 018/115] Some documentation for the map parser. --- tools/qfbsp/include/map.h | 56 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/tools/qfbsp/include/map.h b/tools/qfbsp/include/map.h index a4563a91e..32ed2441f 100644 --- a/tools/qfbsp/include/map.h +++ b/tools/qfbsp/include/map.h @@ -35,7 +35,7 @@ typedef struct mface_s { typedef struct mbrush_s { struct mbrush_s *next; mface_t *faces; - qboolean detail; // true if brush is detail brush + qboolean detail; ///< true if brush is detail brush } mbrush_t; typedef struct epair_s { @@ -44,10 +44,12 @@ typedef struct epair_s { char *value; } epair_t; +/** In-memory representation of an entity as parsed from the map script. +*/ typedef struct { - vec3_t origin; - mbrush_t *brushes; - epair_t *epairs; + vec3_t origin; ///< Location of this entity in world-space. + mbrush_t *brushes; ///< Nul terminated list of brushes. + epair_t *epairs; ///< Nul terminated list of key=value pairs. } entity_t; extern int nummapbrushes; @@ -59,15 +61,61 @@ extern entity_t entities[MAX_MAP_ENTITIES]; extern int nummiptex; extern char miptex[MAX_MAP_TEXINFO][16]; +/** Load and parse the map script. + + Fills in the ::mapbrushes, ::entities and ::miptex arrays. + + \param filename Path of the map script to parse. +*/ void LoadMapFile (const char *filename); +/** Allocate a miptex handle for the named miptex. + + If the a miptex with the same name already exists, the previous handle + will be returned. \c hint and \c skip textures are handled specially, + returning \c TEX_HINT and \c TEX_SKIP respectively. + + \param name The name of the texture. + \return The handle for the texture. +*/ int FindMiptex (const char *name); +/** Dump an entity's data to stdout. + + \param ent The entity to dump. +*/ void PrintEntity (entity_t *ent); + +/** Get the value for the specified key from an entity. + + \param ent The entity from which to fetch the value. + \param key The key for which to fetch the value. + \return The value for the key, or the empty string if the key + does not exist in this entity. +*/ const char *ValueForKey (entity_t *ent, const char *key); + +/** Set the value of the entity's key. + If the key does not exist, one will be added. + + \param ent The entity owning the key. + \param key The key to set. + \param value The value to which the key is to be set. +*/ void SetKeyValue (entity_t *ent, const char *key, const char *value); + +/** Parse a vector value from an entity's key. + \param ent The entity from which to fetch the key. + \param key The key of wich to parse the vector value. + \param vec The destination of the vector value. +*/ void GetVectorForKey (entity_t *ent, const char *key, vec3_t vec); +/** Write all valid entities to the bsp file. + + Writes all entities that still have \c key=value pairs to the bsp file. + Only the key=value pairs are written: any brush data is left out. +*/ void WriteEntitiesToString (void); #endif//qfbsp_map_h From a5c96cb8258069d01836e358bcad39e2f0ef708b Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 29 Aug 2010 12:43:07 +0900 Subject: [PATCH 019/115] More documentation and move some functions. --- tools/qfbsp/include/brush.h | 6 +++ tools/qfbsp/include/bsp5.h | 46 +++++++++---------- tools/qfbsp/include/portals.h | 19 ++++++++ tools/qfbsp/include/surfaces.h | 38 ++++++++++++++++ tools/qfbsp/source/brush.c | 12 +++++ tools/qfbsp/source/csg4.c | 3 +- tools/qfbsp/source/merge.c | 1 + tools/qfbsp/source/portals.c | 27 +++++++++++- tools/qfbsp/source/qfbsp.c | 81 ---------------------------------- tools/qfbsp/source/region.c | 2 +- tools/qfbsp/source/surfaces.c | 47 ++++++++++++++++++++ tools/qfbsp/source/tjunc.c | 2 +- 12 files changed, 175 insertions(+), 109 deletions(-) diff --git a/tools/qfbsp/include/brush.h b/tools/qfbsp/include/brush.h index 248dc97c9..7d0e2e88b 100644 --- a/tools/qfbsp/include/brush.h +++ b/tools/qfbsp/include/brush.h @@ -47,6 +47,12 @@ typedef struct brushset_s { extern int numbrushplanes; extern plane_t planes[MAX_MAP_PLANES]; +/** Allocate a new brush. + + \return Pointer to the new brush. +*/ +brush_t *AllocBrush (void); + brushset_t *Brush_LoadEntity (entity_t *ent, int hullnum); /** Determine the primary axis of the normal. diff --git a/tools/qfbsp/include/bsp5.h b/tools/qfbsp/include/bsp5.h index d3f790e81..4872d72a8 100644 --- a/tools/qfbsp/include/bsp5.h +++ b/tools/qfbsp/include/bsp5.h @@ -80,25 +80,25 @@ typedef struct surface_s { #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 + 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 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; @@ -106,7 +106,11 @@ typedef struct node_s { extern struct brushset_s *brushset; -void qprintf (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); // prints only if verbose +/** Formatted printing with verbosity control. + + Behaves the same as printf except it prints only when verbose is true. +*/ +void qprintf (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); extern int valid; @@ -114,17 +118,11 @@ extern qboolean worldmodel; // misc functions -face_t *AllocFace (void); -void FreeFace (face_t *f); - -struct portal_s *AllocPortal (void); -void FreePortal (struct portal_s *p); - -surface_t *AllocSurface (void); -void FreeSurface (surface_t *s); +/** Allocate a new node. + \return Pointer to the new node. +*/ node_t *AllocNode (void); -struct brush_s *AllocBrush (void); //============================================================================= diff --git a/tools/qfbsp/include/portals.h b/tools/qfbsp/include/portals.h index f92062fab..89d30b0ba 100644 --- a/tools/qfbsp/include/portals.h +++ b/tools/qfbsp/include/portals.h @@ -34,6 +34,25 @@ typedef struct portal_s { extern struct node_s outside_node; // portals outside the world face this +/** Allocate a new portal. + + Increases \c c_activeportals by one. + + \return Pointer to the new portal. +*/ +portal_t *AllocPortal (void); + +/** Free a portal. + + Only the first portal will be freed. If the portal is linked to other + portals, those portals will have to be freed seperately. + + Reduces \c c_activeportals by one. + + \param p The portal to free. +*/ +void FreePortal (portal_t *p); + void PortalizeWorld (struct node_s *headnode); void PortalizeWorldDetail (struct node_s *headnode); // stop at detail nodes void WritePortalfile (struct node_s *headnode); diff --git a/tools/qfbsp/include/surfaces.h b/tools/qfbsp/include/surfaces.h index 128d7578c..09fff12d4 100644 --- a/tools/qfbsp/include/surfaces.h +++ b/tools/qfbsp/include/surfaces.h @@ -36,6 +36,44 @@ extern struct visfacet_s *edgefaces[MAX_MAP_EDGES][2]; extern int firstmodeledge; extern int firstmodelface; +/** Allocate a new face. + + Increases \c c_activefaces by one. + + \return Pointer to the new face. +*/ +face_t *AllocFace (void); + +/** Free a face. + + Only the first face will be freed. If the face is linked to another face, + that face will have to be freed seperately. + + Reduces \c c_activefaces by one. + + \param f The face to free. +*/ +void FreeFace (face_t *f); + +/** Allocate a new surface. + + Increases \c c_activesurfaces by one. + + \return Pointer to the new surface. +*/ +surface_t *AllocSurface (void); + +/** Free a surface. + + Only the first surface will be freed. If the surface is linked to another + surface, that surface will have to be freed seperately. + + Reduces \c c_activefaces by one. + + \param s The face to free. +*/ +void FreeSurface (surface_t *s); + void SubdivideFace (struct visfacet_s *f, struct visfacet_s **prevptr); struct surface_s *GatherNodeFaces (struct node_s *headnode); diff --git a/tools/qfbsp/source/brush.c b/tools/qfbsp/source/brush.c index 8fccfe3d1..e340c1b53 100644 --- a/tools/qfbsp/source/brush.c +++ b/tools/qfbsp/source/brush.c @@ -35,6 +35,7 @@ #include "bsp5.h" #include "draw.h" #include "options.h" +#include "surfaces.h" #include "winding.h" int numbrushplanes; @@ -45,6 +46,17 @@ mface_t faces[MAX_FACES]; // beveled clipping hull can generate many extra static entity_t *CurrentEntity; +brush_t * +AllocBrush (void) +{ + brush_t *b; + + b = malloc (sizeof (brush_t)); + memset (b, 0, sizeof (brush_t)); + + return b; +} + /* CheckFace diff --git a/tools/qfbsp/source/csg4.c b/tools/qfbsp/source/csg4.c index 2a62ec83c..7f02470cb 100644 --- a/tools/qfbsp/source/csg4.c +++ b/tools/qfbsp/source/csg4.c @@ -25,7 +25,7 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$"; #ifdef HAVE_STRING_H -# include "string.h" +# include #endif #include "QF/sys.h" @@ -36,6 +36,7 @@ static __attribute__ ((used)) const char rcsid[] = #include "draw.h" #include "merge.h" #include "solidbsp.h" +#include "surfaces.h" #include "winding.h" /* diff --git a/tools/qfbsp/source/merge.c b/tools/qfbsp/source/merge.c index 3a2951272..cf06791f0 100644 --- a/tools/qfbsp/source/merge.c +++ b/tools/qfbsp/source/merge.c @@ -31,6 +31,7 @@ static __attribute__ ((used)) const char rcsid[] = #include "csg4.h" #include "draw.h" #include "merge.h" +#include "surfaces.h" #include "winding.h" #define CONTINUOUS_EPSILON 0.001 diff --git a/tools/qfbsp/source/portals.c b/tools/qfbsp/source/portals.c index 8774b4a3e..56eda7797 100644 --- a/tools/qfbsp/source/portals.c +++ b/tools/qfbsp/source/portals.c @@ -25,8 +25,9 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$"; #ifdef HAVE_STRING_H -# include "string.h" +# include #endif +#include #include "QF/sys.h" @@ -37,8 +38,32 @@ static __attribute__ ((used)) const char rcsid[] = #include "portals.h" #include "winding.h" +int c_activeportals, c_peakportals; + node_t outside_node; // portals outside the world face this +portal_t * +AllocPortal (void) +{ + portal_t *p; + + c_activeportals++; + if (c_activeportals > c_peakportals) + c_peakportals = c_activeportals; + + p = malloc (sizeof (portal_t)); + memset (p, 0, sizeof (portal_t)); + + return p; +} + +void +FreePortal (portal_t *p) +{ + c_activeportals--; + free (p); +} + static void AddPortalToNodes (portal_t *p, node_t *front, node_t *back) diff --git a/tools/qfbsp/source/qfbsp.c b/tools/qfbsp/source/qfbsp.c index 99640f20e..dd055d231 100644 --- a/tools/qfbsp/source/qfbsp.c +++ b/tools/qfbsp/source/qfbsp.c @@ -65,9 +65,6 @@ bsp_t *bsp; brushset_t *brushset; -int c_activefaces, c_peakfaces; -int c_activesurfaces, c_peaksurfaces; -int c_activeportals, c_peakportals; int valid; char *argv0; // changed after fork(); @@ -77,73 +74,6 @@ qboolean worldmodel; int hullnum; -face_t * -AllocFace (void) -{ - face_t *f; - - c_activefaces++; - if (c_activefaces > c_peakfaces) - c_peakfaces = c_activefaces; - - f = malloc (sizeof (face_t)); - memset (f, 0, sizeof (face_t)); - f->planenum = -1; - - return f; -} - -void -FreeFace (face_t *f) -{ - c_activefaces--; - free (f); -} - -surface_t * -AllocSurface (void) -{ - surface_t *s; - - s = malloc (sizeof (surface_t)); - memset (s, 0, sizeof (surface_t)); - - c_activesurfaces++; - if (c_activesurfaces > c_peaksurfaces) - c_peaksurfaces = c_activesurfaces; - - return s; -} - -void -FreeSurface (surface_t *s) -{ - c_activesurfaces--; - free (s); -} - -portal_t * -AllocPortal (void) -{ - portal_t *p; - - c_activeportals++; - if (c_activeportals > c_peakportals) - c_peakportals = c_activeportals; - - p = malloc (sizeof (portal_t)); - memset (p, 0, sizeof (portal_t)); - - return p; -} - -void -FreePortal (portal_t *p) -{ - c_activeportals--; - free (p); -} - node_t * AllocNode (void) { @@ -155,17 +85,6 @@ AllocNode (void) return n; } -brush_t * -AllocBrush (void) -{ - brush_t *b; - - b = malloc (sizeof (brush_t)); - memset (b, 0, sizeof (brush_t)); - - return b; -} - static void ProcessEntity (int entnum) { diff --git a/tools/qfbsp/source/region.c b/tools/qfbsp/source/region.c index 2e2ace668..ba4a6508b 100644 --- a/tools/qfbsp/source/region.c +++ b/tools/qfbsp/source/region.c @@ -25,7 +25,7 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$"; #ifdef HAVE_STRING_H -# include "string.h" +# include #endif #include "QF/sys.h" diff --git a/tools/qfbsp/source/surfaces.c b/tools/qfbsp/source/surfaces.c index 1f39c687a..170464839 100644 --- a/tools/qfbsp/source/surfaces.c +++ b/tools/qfbsp/source/surfaces.c @@ -46,8 +46,55 @@ static __attribute__ ((used)) const char rcsid[] = */ surface_t newcopy_t; int subdivides; +int c_activefaces, c_peakfaces; +int c_activesurfaces, c_peaksurfaces; +face_t * +AllocFace (void) +{ + face_t *f; + + c_activefaces++; + if (c_activefaces > c_peakfaces) + c_peakfaces = c_activefaces; + + f = malloc (sizeof (face_t)); + memset (f, 0, sizeof (face_t)); + f->planenum = -1; + + return f; +} + +void +FreeFace (face_t *f) +{ + c_activefaces--; + free (f); +} + +surface_t * +AllocSurface (void) +{ + surface_t *s; + + s = malloc (sizeof (surface_t)); + memset (s, 0, sizeof (surface_t)); + + c_activesurfaces++; + if (c_activesurfaces > c_peaksurfaces) + c_peaksurfaces = c_activesurfaces; + + return s; +} + +void +FreeSurface (surface_t *s) +{ + c_activesurfaces--; + free (s); +} + /* SubdivideFace diff --git a/tools/qfbsp/source/tjunc.c b/tools/qfbsp/source/tjunc.c index 4556a6185..94d428449 100644 --- a/tools/qfbsp/source/tjunc.c +++ b/tools/qfbsp/source/tjunc.c @@ -25,7 +25,7 @@ static __attribute__ ((used)) const char rcsid[] = "$Id$"; #ifdef HAVE_STRING_H -# include "string.h" +# include #endif #include "QF/sys.h" From 17e5813a5103563ec74bc2e3523b423abb1901e7 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 29 Aug 2010 18:29:08 +0900 Subject: [PATCH 020/115] Make a block of code a little easier to read. --- tools/qfbsp/source/csg4.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/qfbsp/source/csg4.c b/tools/qfbsp/source/csg4.c index 7f02470cb..5a31ea025 100644 --- a/tools/qfbsp/source/csg4.c +++ b/tools/qfbsp/source/csg4.c @@ -359,10 +359,8 @@ CSGFaces (brushset_t *bs) } // all of the faces left in outside are real surface faces - if (b1->contents != CONTENTS_SOLID) - SaveOutside (true); // mirror faces for inside view - else - SaveOutside (false); + // if the brush is not solid, mirror the faces for the inside view + SaveOutside (b1->contents != CONTENTS_SOLID); } #if 0 From 6c89883c8fefdde67956a0b7b60c5fc509693546 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 29 Aug 2010 18:31:04 +0900 Subject: [PATCH 021/115] Lots of csg4 documentation --- tools/qfbsp/include/csg4.h | 43 ++++++++++++++++- tools/qfbsp/source/csg4.c | 96 ++++++++++++++++++++------------------ 2 files changed, 93 insertions(+), 46 deletions(-) diff --git a/tools/qfbsp/include/csg4.h b/tools/qfbsp/include/csg4.h index 3b18c3667..bafb7557f 100644 --- a/tools/qfbsp/include/csg4.h +++ b/tools/qfbsp/include/csg4.h @@ -30,12 +30,53 @@ struct visfacet_s; struct brushset_s; struct surface_s; -// build surfaces is also used by GatherNodeFaces extern struct visfacet_s *validfaces[MAX_MAP_PLANES]; + +/** Build the surface lists for the brushset. + + Each plane still with faces after clipping will have one surface, and + each surface will list the faces on that plane. + + \return Chain of all the external surfaces with one or more + visible faces. +*/ struct surface_s *BuildSurfaces (void); +/** Create a duplicate face. + + Duplicates the non point information of a face. + + \param in The face to duplicate. + \return The new face. + +*/ struct visfacet_s *NewFaceFromFace (struct visfacet_s *in); + +/** Convert a brush-set to a list of clipped faces. + + The brushes of the brush set will be clipped against each other. + + \param bs The brush-set to convert. + \return list of surfaces containing all of the faces +*/ struct surface_s *CSGFaces (struct brushset_s *bs); + +/** Split a face by a plane. + + \param in The face to split. + \param split The plane by which to split the face. + \param front Set to the new face repesenting the part of the input + face that is in front of the plane, or NULL if there is + no front portion. + \param back Set to the new face repesenting the part of the input + face that is behind the plane, or NULL if there is + no back portion. + \note A face entirely on the plane is considered to be behind the plane. + + \note The face represented by \a in becomes invalid. If either \a front + or \a back is NULL, then no split has occurred and the other will be set + to \a in. +*/ void SplitFace (struct visfacet_s *in, struct plane_s *split, struct visfacet_s **front, struct visfacet_s **back); diff --git a/tools/qfbsp/source/csg4.c b/tools/qfbsp/source/csg4.c index 5a31ea025..45a716ab6 100644 --- a/tools/qfbsp/source/csg4.c +++ b/tools/qfbsp/source/csg4.c @@ -52,14 +52,7 @@ int brushfaces; int csgfaces; int csgmergefaces; - -/* - NewFaceFromFace - - Duplicates the non point information of a face, used by SplitFace and - MergeFace. -*/ -face_t * +face_t * NewFaceFromFace (face_t *in) { face_t *newf; @@ -124,15 +117,15 @@ SplitFace (face_t *in, plane_t *split, face_t **front, face_t **back) FreeFace (in); } -/* - ClipInside +/** Clips all of the faces in the ::inside list. - Clips all of the faces in the inside list, possibly moving them to the - outside list or spliting it into a piece in each list. + Faces will be moved to the ::outside list or split into a piece in each + list. Faces exactly on the plane will stay inside unless overdrawn by + a later brush - Faces exactly on the plane will stay inside unless overdrawn by later brush - - frontside is the side of the plane that holds the outside list + \param splitplane Index of the plane by which faces will be clipped. + \param frontside The side of the plane that holds the outside list. + \param precedence XXX */ static void ClipInside (int splitplane, int frontside, qboolean precedence) @@ -145,18 +138,22 @@ ClipInside (int splitplane, int frontside, qboolean precedence) insidelist = NULL; for (f = inside; f; f = next) { - next = f->next; + next = f->next; // f->next will get mashed by SplitFace - if (f->planenum == splitplane) { // exactly on, handle special - if (frontside != f->planeside || precedence) { // always clip off - // opposite faceing + if (f->planenum == splitplane) { + // exactly on, handle special + + // always clip off opposite facing + if (frontside != f->planeside || precedence) { frags[frontside] = NULL; frags[!frontside] = f; - } else { // leave it on the outside + } else { + // leave it on the outside frags[frontside] = f; frags[!frontside] = NULL; } - } else { // proper split + } else { + // proper split SplitFace (f, split, &frags[0], &frags[1]); } @@ -173,10 +170,10 @@ ClipInside (int splitplane, int frontside, qboolean precedence) inside = insidelist; } -/* - SaveOutside +/** Saves all of the faces in the ::outside list to the bsp plane list + (::validfaces). - Saves all of the faces in the outside list to the bsp plane list + \param mirror If true, add extra faces that face the opposite direction. */ static void SaveOutside (qboolean mirror) @@ -207,10 +204,13 @@ SaveOutside (qboolean mirror) } } -/* - FreeInside +/** Free the faces that are inside the clipping brush. - Free all the faces that got clipped out + If the clipping brush is non-solid, then the faces will be moved to + ::outside rather than being freed, thus allowing the faces to continue + to exist. + + \param contents The contents of the clipping brush. */ static void FreeInside (int contents) @@ -229,13 +229,7 @@ FreeInside (int contents) } } -/* - BuildSurfaces - - Returns a chain of all the external surfaces with one or more visible - faces. -*/ -surface_t * +surface_t * BuildSurfaces (void) { face_t *count; @@ -269,6 +263,14 @@ BuildSurfaces (void) return surfhead; } +/** Create faces using the faces of the provided brush. + + The ::outside list will be set to the list of created faces. The faces + will be such that their front is empty and their back is the contents of + the brush. + + \param b The brush from which to create the faces. +*/ static void CopyFacesToOutside (brush_t *b) { @@ -291,12 +293,7 @@ CopyFacesToOutside (brush_t *b) } } -/* - CSGFaces - - Returns a list of surfaces containing all of the faces -*/ -surface_t * +surface_t * CSGFaces (brushset_t *bs) { brush_t *b1, *b2; @@ -324,15 +321,17 @@ CSGFaces (brushset_t *bs) continue; } + // earlier brushes do NOT overwrite overwrite = false; for (b2 = bs->brushes; b2; b2 = b2->next) { + // see if b2 needs to clip a chunk out of b1 if (b2->faces->texturenum < 0) continue; - // see if b2 needs to clip a chunk out of b1 if (b1 == b2) { - overwrite = true; // later brushes now overwrite + // later brushes DO overwrite + overwrite = true; continue; } // check bounding box first @@ -350,12 +349,19 @@ CSGFaces (brushset_t *bs) for (f = b2->faces; f; f = f->next) ClipInside (f->planenum, f->planeside, overwrite); - // these faces are continued in another brush, so get rid of them + // these faces are contained in another brush, so get rid of them if (b1->contents == CONTENTS_SOLID - && b2->contents <= CONTENTS_WATER) + && b2->contents <= CONTENTS_WATER) { + // Faces from a solid brush are allowed to exist inside a + // non-solid brush. This forms an intrusion into the clipping + // brush. FreeInside (b2->contents); - else + } else { + // Unconditionally treat the clipping brush as solid to force + // contents merging, or to make an empty clipping brush clip + // away parts of other brushes. FreeInside (CONTENTS_SOLID); + } } // all of the faces left in outside are real surface faces From 6ce7c5040bc36cccb549ed3fda005a6c423170ae Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 29 Aug 2010 20:34:59 +0900 Subject: [PATCH 022/115] Make NewFaceFromFace const-correct --- tools/qfbsp/include/csg4.h | 2 +- tools/qfbsp/source/csg4.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/qfbsp/include/csg4.h b/tools/qfbsp/include/csg4.h index bafb7557f..24b5cc710 100644 --- a/tools/qfbsp/include/csg4.h +++ b/tools/qfbsp/include/csg4.h @@ -50,7 +50,7 @@ struct surface_s *BuildSurfaces (void); \return The new face. */ -struct visfacet_s *NewFaceFromFace (struct visfacet_s *in); +struct visfacet_s *NewFaceFromFace (const struct visfacet_s *in); /** Convert a brush-set to a list of clipped faces. diff --git a/tools/qfbsp/source/csg4.c b/tools/qfbsp/source/csg4.c index 45a716ab6..284b61b97 100644 --- a/tools/qfbsp/source/csg4.c +++ b/tools/qfbsp/source/csg4.c @@ -53,7 +53,7 @@ int csgfaces; int csgmergefaces; face_t * -NewFaceFromFace (face_t *in) +NewFaceFromFace (const face_t *in) { face_t *newf; From a92bd6dec10e41e1531f087387e8e3a174b7c99e Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 29 Aug 2010 20:35:43 +0900 Subject: [PATCH 023/115] Document the merge code --- tools/qfbsp/include/merge.h | 33 ++++++++++++++++++++++++++++++++- tools/qfbsp/source/merge.c | 26 +++++++++++++++----------- 2 files changed, 47 insertions(+), 12 deletions(-) diff --git a/tools/qfbsp/include/merge.h b/tools/qfbsp/include/merge.h index a4a5cb49c..b6dfe8f52 100644 --- a/tools/qfbsp/include/merge.h +++ b/tools/qfbsp/include/merge.h @@ -23,9 +23,40 @@ #ifndef qfbsp_merge_h #define qfbsp_merge_h -void MergePlaneFaces (surface_t *plane); +/** Add a face to the list of faces, doing any possible merging. + + \param face The face to add to the list. + \param list The list to which the face will be added. + \return The list with the plane added or merged to other faces in + the list. +*/ face_t *MergeFaceToList (face_t *face, face_t *list); + +/** Remove merged out faces from the list. + + Removes faces that MergeFaceToList() wanted to remove but couldn't due to + its implementation. + + \param merged The list of merged faces. + \return The cleaned list. + + \note The list is reversed in the process. + + \todo Reimplement MergeFaceToList() such that this function is no longer + needed. +*/ face_t *FreeMergeListScraps (face_t *merged); + +/** Process the faces on a surface, searching for mergable faces. + + \param plane The surface of which the faces will be processed. +*/ +void MergePlaneFaces (surface_t *plane); + +/** Process the faces on a list of suraces. + + \param surfhead The list of surfaces. +*/ void MergeAll (surface_t *surfhead); #endif//qfbsp_merge_h diff --git a/tools/qfbsp/source/merge.c b/tools/qfbsp/source/merge.c index cf06791f0..afba61ac2 100644 --- a/tools/qfbsp/source/merge.c +++ b/tools/qfbsp/source/merge.c @@ -37,17 +37,21 @@ static __attribute__ ((used)) const char rcsid[] = #define CONTINUOUS_EPSILON 0.001 -/* - TryMerge +/** Try to merge two polygons. If two polygons share a common edge and the edges that meet at the common - points are both inside the other polygons, merge them + points are both inside the other polygons, merge them. The two polygons + must be on the same plane, the same side of the plane, have the same + texture and have the same contents on each side. - Returns NULL if the faces couldn't be merged, or the new face. - The originals will NOT be freed. + \param f1 The first face. + \param f2 The second face. + \return The new face or NULL if the faces could not be merged. + + \note The originals will NOT be freed. */ -static face_t * -TryMerge (face_t *f1, face_t *f2) +static face_t * +TryMerge (const face_t *f1, const face_t *f2) { face_t *newf; int i, j, k, l; @@ -69,10 +73,10 @@ TryMerge (face_t *f1, face_t *f2) if (f1->contents[1] != f2->contents[1]) return NULL; - // find a common edge - p1 = p2 = NULL; // stop compiler warning + p1 = p2 = NULL; j = 0; + // find a common edge for (i = 0; i < f1p->numpoints; i++) { p1 = f1p->points[i]; p2 = f1p->points[(i + 1) % f1p->numpoints]; @@ -149,7 +153,7 @@ found_edge: } qboolean mergedebug; -face_t * +face_t * MergeFaceToList (face_t *face, face_t *list) { face_t *newf, *f; @@ -176,7 +180,7 @@ MergeFaceToList (face_t *face, face_t *list) return face; } -face_t * +face_t * FreeMergeListScraps (face_t *merged) { face_t *head, *next; From cc098fa72098aa44d9fed0c6f38aa97dd5081ea4 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 30 Aug 2010 12:04:45 +0900 Subject: [PATCH 024/115] Documentation for outside. --- tools/qfbsp/include/outside.h | 11 ++++++++ tools/qfbsp/source/outside.c | 48 +++++++++++++++++++++++++++++++---- 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/tools/qfbsp/include/outside.h b/tools/qfbsp/include/outside.h index 7873aac9e..55f4589c2 100644 --- a/tools/qfbsp/include/outside.h +++ b/tools/qfbsp/include/outside.h @@ -24,6 +24,17 @@ #define qfbsp_outside_h struct node_s; + +/** Make the outside of the map solid. + + Removes any faces from filled nodes. + + \pre outside_node must be initilized. + + \param node The root of the map's bsp. + \return \c true if the outside has been set solid, otherwise + \c false. +*/ qboolean FillOutside (struct node_s *node); #endif//qfbsp_outside_h diff --git a/tools/qfbsp/source/outside.c b/tools/qfbsp/source/outside.c index bfdc7ff71..b21b2632b 100644 --- a/tools/qfbsp/source/outside.c +++ b/tools/qfbsp/source/outside.c @@ -35,6 +35,12 @@ static __attribute__ ((used)) const char rcsid[] = int outleafs; +/** Find the leaf node in which the point is. + + \param node The root of the bsp tree. + \param point The point's location. + \return The leaf node in which the point is. +*/ static node_t * PointInLeaf (node_t *node, vec3_t point) { @@ -47,6 +53,13 @@ PointInLeaf (node_t *node, vec3_t point) return node; } +/** Set the distance to a node from all reachable nodes. + + Purpose unknown: not in the id code and the information is not used + anywhere. Probably a bad port from either hqbsp or oq. + + \todo Find the port source and either fix qfbsp or nuke this function. +*/ static void FloodEntDist_r (node_t *n, int dist) { @@ -73,6 +86,15 @@ FloodEntDist_r (node_t *n, int dist) } } +/** Try to place an entity in the map. + + The entity must be in open space. + + \param num The entity number. + \param point The entity's origin. + \param headnode The root of the map's bsp tree. + \return true if the entity could be placed, false otherwise. +*/ static qboolean PlaceOccupant (int num, vec3_t point, node_t *headnode) { @@ -91,6 +113,11 @@ PlaceOccupant (int num, vec3_t point, node_t *headnode) portal_t *prevleaknode; FILE *leakfile; +/** Write the coords for points joining two portals to the point file. + + \param n2 The second portal. + \note The first portal is set by the preceeding call. +*/ static void MarkLeakTrail (portal_t *n2) { @@ -136,11 +163,14 @@ MarkLeakTrail (portal_t *n2) int hit_occupied; -/* - RecursiveFillOutside +/** Recurse through the map setting the outside nodes to solid. - If fill is false, just check, don't fill - Returns true if an occupied leaf is reached + Recursively traverses the portals of the start node. + + \param l The start node. + \param fill If false, just check, don't fill + \return \c true if an occupied leaf is reached, otherwise + \c false. */ static qboolean RecursiveFillOutside (node_t *l, qboolean fill) @@ -188,6 +218,12 @@ RecursiveFillOutside (node_t *l, qboolean fill) return res; } +/** Remove faces from filled in leafs. + + Recursively traverses the portals of the start node. + + \param node Start node. +*/ static void ClearOutFaces (node_t *node) { @@ -223,6 +259,8 @@ FillOutside (node_t *node) return false; } + // Place the map's entities in the map. inside will be true if at least + // one entitie could be placed. inside = false; for (i = 1; i < num_entities; i++) { if (!_VectorCompare (entities[i].origin, vec3_origin)) { @@ -268,7 +306,7 @@ FillOutside (node_t *node) valid++; RecursiveFillOutside (outside_node.portals->nodes[s], true); - // remove faces from filled in leafs + // remove faces from filled in leafs ClearOutFaces (node); qprintf ("%4i outleafs\n", outleafs); From 34d60539de2964b2452d190a27905e93abc607c4 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 30 Aug 2010 14:21:52 +0900 Subject: [PATCH 025/115] Document the portals code. --- tools/qfbsp/include/portals.h | 31 ++++++++++--- tools/qfbsp/source/portals.c | 83 ++++++++++++++++++++++++++++------- 2 files changed, 92 insertions(+), 22 deletions(-) diff --git a/tools/qfbsp/include/portals.h b/tools/qfbsp/include/portals.h index 89d30b0ba..26223cff9 100644 --- a/tools/qfbsp/include/portals.h +++ b/tools/qfbsp/include/portals.h @@ -26,10 +26,10 @@ struct node_s; typedef struct portal_s { - int planenum; - struct node_s *nodes[2]; // [0] = front side of planenum - struct portal_s *next[2]; - struct winding_s *winding; + int planenum; ///< plane holding this portal + struct node_s *nodes[2]; ///< [0] = front side of plane + struct portal_s *next[2]; ///< [0] = front side of plane + struct winding_s *winding; ///< this portal's polygon } portal_t; extern struct node_s outside_node; // portals outside the world face this @@ -53,9 +53,30 @@ portal_t *AllocPortal (void); */ void FreePortal (portal_t *p); +/** Builds the exact polyhedrons for the nodes and leafs. + + \param headnode The root of the world bsp. +*/ void PortalizeWorld (struct node_s *headnode); + +/** Builds the exact polyhedrons for the nodes and leafs. + + Like PortalizeWorld, but stop at detail nodes - Alexander Malmberg. + + \param headnode The root of the world bsp. +*/ void PortalizeWorldDetail (struct node_s *headnode); // stop at detail nodes -void WritePortalfile (struct node_s *headnode); + +/** Free all portals from a node and its decendents. + + \param node The node from which to remove and free portals. +*/ void FreeAllPortals (struct node_s *node); +/** Write the map's portals to the portal file. + + \param headnode The root of the map's bsp. +*/ +void WritePortalfile (struct node_s *headnode); + #endif//qfbsp_portals_h diff --git a/tools/qfbsp/source/portals.c b/tools/qfbsp/source/portals.c index 56eda7797..f84f29a56 100644 --- a/tools/qfbsp/source/portals.c +++ b/tools/qfbsp/source/portals.c @@ -64,7 +64,12 @@ FreePortal (portal_t *p) free (p); } +/** Link the portal into the nodes on either side of the portal. + \param p The portal to link. + \param front The node on the front side of the portal. + \param back The node on the back side of the portal. +*/ static void AddPortalToNodes (portal_t *p, node_t *front, node_t *back) { @@ -80,6 +85,13 @@ AddPortalToNodes (portal_t *p, node_t *front, node_t *back) back->portals = p; } +/** Remove the portal from a node. + + The portal most be linked into the node and bounding the node. + + \param portal The portal to remove. + \param l The leaf node from which to remove the portal. +*/ static void RemovePortalFromNode (portal_t *portal, node_t *l) { @@ -112,6 +124,10 @@ RemovePortalFromNode (portal_t *portal, node_t *l) } } +/** Calculate the bounding box of the node based on its portals. + + \param node The node of which to calculate the bounding box. +*/ static void CalcNodeBounds (node_t *node) { @@ -145,10 +161,11 @@ CalcNodeBounds (node_t *node) } } -/* - MakeHeadnodePortals +/** Make portals for the head node, initializing outside_node. - The created portals will face the global outside_node + The created portals will face the global outside_node. + + \param node The head node. */ static void MakeHeadnodePortals (node_t *node) @@ -169,7 +186,9 @@ MakeHeadnodePortals (node_t *node) outside_node.contents = CONTENTS_SOLID; outside_node.portals = NULL; - for (i = 0; i < 3; i++) + // create a brush based on the enlarged bounding box. + // The brush has all sides pointing in. + for (i = 0; i < 3; i++) { for (j = 0; j < 2; j++) { n = j * 3 + i; @@ -193,6 +212,7 @@ MakeHeadnodePortals (node_t *node) else AddPortalToNodes (p, node, &outside_node); } + } // clip the basewindings by all the other planes for (i = 0; i < 6; i++) { @@ -205,9 +225,13 @@ MakeHeadnodePortals (node_t *node) } } -//============================================================================ +/** Calculate the plane holding the winding. + Uses the first three points of the winding. + \param w The plane for which to calculate the plane. + \param plane The plane to set. +*/ static void PlaneFromWinding (winding_t *w, plane_t *plane) { @@ -236,7 +260,7 @@ CutNodePortals_r (node_t *node) CalcNodeBounds (node); - // seperate the portals on node into it's children + // seperate the portals on node into it's children if (node->contents) return; // at a leaf, no more dividing @@ -333,11 +357,6 @@ CutNodePortals_r (node_t *node) CutNodePortals_r (b); } -/* - PortalizeWorld - - Builds the exact polyhedrons for the nodes and leafs -*/ void PortalizeWorld (node_t *headnode) { @@ -348,11 +367,6 @@ PortalizeWorld (node_t *headnode) CutNodePortals_r (headnode); } -/* - PortalizeWorldDetail - - Like PortalizeWorld, but stop at detail nodes - Alexander Malmberg. -*/ void PortalizeWorldDetail (node_t *headnode) { @@ -394,6 +408,12 @@ int num_visleafs; // leafs the player can be in int num_visportals; int num_realleafs; +/** Check if a node has the specified contents. + + \param n The node to check. + \param cont The contents for which to check. + \return 1 if the node has the specified contents, otherwise 0. +*/ static int HasContents (node_t *n, int cont) { @@ -406,6 +426,11 @@ HasContents (node_t *n, int cont) return HasContents (n->children[1], cont); } +/** Check if two nodes have the same non-solid contents somewhere within them. + + \param n1 The first node to check. + \param n2 The second node to check. +*/ static int ShareContents (node_t *n1, node_t *n2) { @@ -421,6 +446,13 @@ ShareContents (node_t *n1, node_t *n2) return ShareContents (n1->children[1], n2); } +/** Check if two nodes have the same non-solid, non-sky contents. + + \node Affected by watervis. + + \param n1 The first node to check. + \param n2 The second node to check. +*/ static int SameContents (node_t *n1, node_t *n2) { @@ -439,6 +471,11 @@ SameContents (node_t *n1, node_t *n2) return n1->contents == n2->contents; } +/** Recurse through the world bsp, writing the portals for each leaf node to + the portal file. + + \param node The current node of the bsp. Call with the root node. +*/ static void WritePortalFile_r (node_t *node) { @@ -486,9 +523,12 @@ WritePortalFile_r (node_t *node) else p = p->next[1]; } - } +/** Write the vis leaf number to the portal file. + + \param n The current node of the bsp. Call with the root node. +*/ static void WritePortalLeafs_r (node_t *n) { @@ -501,6 +541,11 @@ WritePortalLeafs_r (node_t *n) } } +/** Set the vis leaf number of the leafs in a detail cluster. + + \param n The current node. Call with the detail node. + \param num The vis leaf number. +*/ static void SetCluster_r (node_t *n, int num) { @@ -518,6 +563,10 @@ SetCluster_r (node_t *n, int num) num_realleafs++; } +/** Set the vis leaf number of the leafs in a bsp tree. + + \param node The current node. Call with the root node. +*/ static void NumberLeafs_r (node_t *node) { From 00b635236d5403126284992baa62f8ba2e584b35 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 30 Aug 2010 14:45:20 +0900 Subject: [PATCH 026/115] Document the readbsp code. --- tools/qfbsp/include/readbsp.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/qfbsp/include/readbsp.h b/tools/qfbsp/include/readbsp.h index c89113269..3f624310a 100644 --- a/tools/qfbsp/include/readbsp.h +++ b/tools/qfbsp/include/readbsp.h @@ -23,10 +23,24 @@ #ifndef qfbsp_readbsp_h #define qfbsp_readbsp_h +/** Load the bspfile into memory. +*/ void LoadBSP (void); + +/** Recreate the map's portals and write the portal file. +*/ void bsp2prt (void); + +/** Write a wad file containing the textures in the bsp file. +*/ void extract_textures (void); + +/** Write the map's entities string to a file. +*/ void extract_entities (void); + +/** Write a hull from the map's bsp to a C file. +*/ void extract_hull (void); #endif//qfbsp_readbsp_h From 68dda63de5bf80dc7bf93ccc05c526b75cb83bd4 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 30 Aug 2010 15:12:20 +0900 Subject: [PATCH 027/115] Documentation for region. --- tools/qfbsp/include/region.h | 4 ++++ tools/qfbsp/source/region.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/qfbsp/include/region.h b/tools/qfbsp/include/region.h index 879132fa0..b461d56f3 100644 --- a/tools/qfbsp/include/region.h +++ b/tools/qfbsp/include/region.h @@ -25,6 +25,10 @@ struct node_s; +/** Write the faces and edges to the bsp file. + + \param headnode The root of the map's bsp. +*/ void GrowNodeRegions (struct node_s *headnode); #endif//qfbsp_region_h diff --git a/tools/qfbsp/source/region.c b/tools/qfbsp/source/region.c index ba4a6508b..64dfe4af0 100644 --- a/tools/qfbsp/source/region.c +++ b/tools/qfbsp/source/region.c @@ -132,7 +132,7 @@ RecursiveGrowRegion (dface_t *r, face_t *f) Sys_Error ("RecursiveGrowRegion: region collision"); f->outputnumber = bsp->numfaces; - // add edges + // add edges for (i = 0; i < f->points->numpoints; i++) { e = f->edges[i]; if (!edgefaces[abs (e)][0]) @@ -265,7 +265,7 @@ GrowNodeRegions (node_t *headnode) vec3_t dir; vec3_t origin; vec3_t p[2]; - } + } for all faces for all edges From 69189600a4e54cc78fb259af9896ee16496a7091 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 30 Aug 2010 16:08:04 +0900 Subject: [PATCH 028/115] Some docs for bsp5.h --- tools/qfbsp/include/bsp5.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tools/qfbsp/include/bsp5.h b/tools/qfbsp/include/bsp5.h index 4872d72a8..cf04e9074 100644 --- a/tools/qfbsp/include/bsp5.h +++ b/tools/qfbsp/include/bsp5.h @@ -48,14 +48,14 @@ typedef struct visfacet_s { struct visfacet_s *next; int planenum; - int planeside; // which side is the front of the face + int planeside; ///< which side is the front of the face int texturenum; - int contents[2]; // 0 = front side + 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 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; @@ -63,17 +63,17 @@ typedef struct visfacet_s { typedef struct surface_s { 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 outputplanenum; // valid only after WriteSurfacePlanes + 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 + 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 @@ -82,8 +82,8 @@ typedef struct surface_s { typedef struct node_s { vec3_t mins,maxs; ///< bounding volume, not just points inside -// information for decision nodes - int planenum; ///< -1 = leaf node +// 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 @@ -93,7 +93,7 @@ typedef struct node_s { // 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; + struct portal_s *portals; ///< portals on this leaf int visleafnum; ///< -1 = solid int valid; ///< for flood filling int occupied; ///< light number in leaf for outside filling From 313677ee96ed3dd0751000696b5d8d04e3524301 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 30 Aug 2010 16:09:34 +0900 Subject: [PATCH 029/115] Add some braces and a bit of whitespace --- tools/qfbsp/source/solidbsp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/qfbsp/source/solidbsp.c b/tools/qfbsp/source/solidbsp.c index 20a124d98..c4755d340 100644 --- a/tools/qfbsp/source/solidbsp.c +++ b/tools/qfbsp/source/solidbsp.c @@ -64,7 +64,7 @@ FaceSide (face_t *in, plane_t *split) frontcount = backcount = 0; // axial planes are fast - if (split->type < 3) + if (split->type < 3) { for (i = 0, p = inp->points[0] + split->type; i < inp->numpoints; i++, p += 3) { if (*p > split->dist + ON_EPSILON) { @@ -76,7 +76,8 @@ FaceSide (face_t *in, plane_t *split) return SIDE_ON; backcount = 1; } - } else + } + } else { // sloping planes take longer for (i = 0, p = inp->points[0]; i < inp->numpoints; i++, p += 3) { dot = DotProduct (p, split->normal); @@ -91,6 +92,7 @@ FaceSide (face_t *in, plane_t *split) backcount = 1; } } + } if (!frontcount) return SIDE_BACK; @@ -105,7 +107,7 @@ FaceSide (face_t *in, plane_t *split) The clipping hull BSP doesn't worry about avoiding splits */ -static surface_t * +static surface_t * ChooseMidPlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs) { int j, l; From 4b1b838f87731e1ddf73e2d5658c4057c30ab907 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 30 Aug 2010 16:58:40 +0900 Subject: [PATCH 030/115] More braces and whitespace. --- tools/qfbsp/source/solidbsp.c | 19 +++++++++++-------- tools/qfbsp/source/surfaces.c | 2 +- tools/qfbsp/source/tjunc.c | 23 +++++++++++++---------- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/tools/qfbsp/source/solidbsp.c b/tools/qfbsp/source/solidbsp.c index c4755d340..2d36bb7a0 100644 --- a/tools/qfbsp/source/solidbsp.c +++ b/tools/qfbsp/source/solidbsp.c @@ -165,7 +165,7 @@ ChooseMidPlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs) The real BSP hueristic */ -static surface_t * +static surface_t * ChoosePlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs, 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 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) { int i, j; @@ -275,11 +275,12 @@ SelectPartition (surface_t *surfaces, int *detail) // count onnode surfaces i = 0; bestsurface = NULL; - for (p = surfaces; p; p = p->next) + for (p = surfaces; p; p = p->next) { if (!p->onnode) { i++; bestsurface = p; } + } if (i == 0) return NULL; @@ -296,13 +297,14 @@ SelectPartition (surface_t *surfaces, int *detail) maxs[i] = -BOGUS_RANGE; } - for (p = surfaces; p; p = p->next) + for (p = surfaces; p; p = p->next) { for (j = 0; j < 3; j++) { if (p->mins[j] < mins[j]) mins[j] = p->mins[j]; if (p->maxs[j] > maxs[j]) maxs[j] = p->maxs[j]; } + } if (usemidsplit) // do fast way for clipping hull return ChooseMidPlaneFromList (surfaces, mins, maxs); @@ -328,7 +330,7 @@ SelectPartition (surface_t *surfaces, int *detail) Calculates the bounding box */ void -CalcSurfaceInfo (surface_t * surf) +CalcSurfaceInfo (surface_t *surf) { face_t *f; int i, j; @@ -346,13 +348,14 @@ CalcSurfaceInfo (surface_t * surf) winding_t *fp = f->points; if (f->contents[0] >= 0 || f->contents[1] >= 0) Sys_Error ("Bad contents"); - for (i = 0; i < fp->numpoints; i++) + for (i = 0; i < fp->numpoints; i++) { for (j = 0; j < 3; j++) { if (fp->points[i][j] < surf->mins[j]) surf->mins[j] = fp->points[i][j]; if (fp->points[i][j] > surf->maxs[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 */ -static face_t * +static face_t * LinkNodeFaces (surface_t *surface) { face_t *list, *new, **prevptr, *f; @@ -643,7 +646,7 @@ PartitionSurfaces (surface_t *surfaces, node_t *node) PartitionSurfaces (backlist, node->children[1]); } -node_t * +node_t * SolidBSP (surface_t *surfhead, qboolean midsplit) { int i; diff --git a/tools/qfbsp/source/surfaces.c b/tools/qfbsp/source/surfaces.c index 170464839..e7d208276 100644 --- a/tools/qfbsp/source/surfaces.c +++ b/tools/qfbsp/source/surfaces.c @@ -189,7 +189,7 @@ GatherNodeFaces_r (node_t *node) } } -surface_t * +surface_t * GatherNodeFaces (node_t *headnode) { memset (validfaces, 0, sizeof (validfaces)); diff --git a/tools/qfbsp/source/tjunc.c b/tools/qfbsp/source/tjunc.c index 94d428449..b2b958a64 100644 --- a/tools/qfbsp/source/tjunc.c +++ b/tools/qfbsp/source/tjunc.c @@ -111,33 +111,36 @@ CanonicalVector (vec3_t vec) if (len < EQUAL_EPSILON) return false; - if (vec[0] > EQUAL_EPSILON) + if (vec[0] > EQUAL_EPSILON) { return true; - else if (vec[0] < -EQUAL_EPSILON) { + } else if (vec[0] < -EQUAL_EPSILON) { VectorNegate (vec, vec); return true; - } else + } else { vec[0] = 0; + } - if (vec[1] > EQUAL_EPSILON) + if (vec[1] > EQUAL_EPSILON) { return true; - else if (vec[1] < -EQUAL_EPSILON) { + } else if (vec[1] < -EQUAL_EPSILON) { VectorNegate (vec, vec); return true; - } else + } else { vec[1] = 0; + } - if (vec[2] > EQUAL_EPSILON) + if (vec[2] > EQUAL_EPSILON) { return true; - else if (vec[2] < -EQUAL_EPSILON) { + } else if (vec[2] < -EQUAL_EPSILON) { VectorNegate (vec, vec); return true; - } else + } else { vec[2] = 0; + } return false; } -static wedge_t * +static wedge_t * FindEdge (vec3_t p1, vec3_t p2, vec_t *t1, vec_t *t2) { int h; From f3e7a7ca8907960c3c286acab806e86f4f44e4e9 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 30 Aug 2010 17:34:41 +0900 Subject: [PATCH 031/115] Documentation for solidbsp. --- tools/qfbsp/include/solidbsp.h | 13 +++++- tools/qfbsp/source/solidbsp.c | 80 ++++++++++++++++++++++------------ 2 files changed, 64 insertions(+), 29 deletions(-) diff --git a/tools/qfbsp/include/solidbsp.h b/tools/qfbsp/include/solidbsp.h index e8c06a9b0..af924bfb7 100644 --- a/tools/qfbsp/include/solidbsp.h +++ b/tools/qfbsp/include/solidbsp.h @@ -30,9 +30,18 @@ struct plane_s; struct surface_s; struct node_s; -void DivideFacet (struct visfacet_s *in, struct plane_s *split, - struct visfacet_s **front, struct visfacet_s **back); +/** Calculate the bounding box of the surface. + + \param surf The surface of which to calculate the bounding box. +*/ void CalcSurfaceInfo (struct surface_s *surf); + +/** Partition the surfaces, creating a nice bsp. + + \param surfhead The surfaces to partition. + \param midsplit If true, use the volume balancing heuristic rather than + the split balancing heuristic (false). +*/ struct node_s *SolidBSP (struct surface_s *surfhead, qboolean midsplit); #endif//qfbsp_solidbsp_h diff --git a/tools/qfbsp/source/solidbsp.c b/tools/qfbsp/source/solidbsp.c index 2d36bb7a0..fed8072af 100644 --- a/tools/qfbsp/source/solidbsp.c +++ b/tools/qfbsp/source/solidbsp.c @@ -48,10 +48,18 @@ int c_solid, c_empty, c_water; qboolean usemidsplit; -/* - FaceSide +/** Determine on which side of the plane a face is. - For BSP hueristic + \param in The face. + \param split The plane. + \return
+
SIDE_FRONT
+
The face is in front of or on the plane.
+
SIDE_BACK
+
The face is behind or on the plane.
+
SIDE_ON
+
The face is on or cut by the plane.
+
*/ static int FaceSide (face_t *in, plane_t *split) @@ -102,10 +110,16 @@ FaceSide (face_t *in, plane_t *split) return SIDE_ON; } -/* - ChooseMidPlaneFromList +/** Chose the best plane for dividing the bsp. - The clipping hull BSP doesn't worry about avoiding splits + The clipping hull BSP doesn't worry about avoiding splits, so this + function tries to find the plane that gives the most even split of the + bounding volume. + + \param surfaces The surface chain of the bsp. + \param mins The minimum coordinate of the boundiing box. + \param maxs The maximum coordinate of the boundiing box. + \return The chosen surface. */ static surface_t * ChooseMidPlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs) @@ -160,10 +174,16 @@ ChooseMidPlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs) return bestsurface; } -/* - ChoosePlaneFromList +/** Choose the best plane that produces the fewest splits. - The real BSP hueristic + \param surfaces The surface chain of the bsp. + \param mins The minimum coordinate of the boundiing box. + \param maxs The maximum coordinate of the boundiing box. + \param usefloors If false, floors will not be chosen. + \param usedetail If true, the plain must have structure faces, else + the plain must not have structure faces. + \return The chosen surface, or NULL if a suitable surface could + not be found. */ static surface_t * ChoosePlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs, @@ -257,11 +277,12 @@ ChoosePlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs, return bestsurface; } -/* - SelectPartition +/** Select a surface on which to split the group of surfaces. - 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) + \param surfaces The group of surfaces. + \param detail Set to 1 if the selected surface has detail. + \return The selected surface or NULL if the list can no longer + be defined (ie, a leaf). */ static surface_t * SelectPartition (surface_t *surfaces, int *detail) @@ -322,13 +343,6 @@ SelectPartition (surface_t *surfaces, int *detail) return ChoosePlaneFromList (surfaces, mins, maxs, true, true); } -//============================================================================ - -/* - CalcSurfaceInfo - - Calculates the bounding box -*/ void CalcSurfaceInfo (surface_t *surf) { @@ -359,6 +373,13 @@ CalcSurfaceInfo (surface_t *surf) } } +/** Divide a surface by the plane. + + \param in The surface to divide. + \param split The plane by which to divide the surface. + \param front Tne part of the surface in front of the plane. + \param back The part of the surface behind the plane. +*/ static void DividePlane (surface_t *in, plane_t *split, surface_t **front, surface_t **back) @@ -483,11 +504,11 @@ DividePlane (surface_t *in, plane_t *split, surface_t **front, CalcSurfaceInfo (in); } -/* - LinkConvexFaces - - Determines the contents of the leaf and creates the final list of +/** Determine the contents of the leaf and create the final list of original faces that have some fragment inside this leaf + + \param planelist surfaces bounding the leaf. + \param leafnode The leaf. */ static void LinkConvexFaces (surface_t *planelist, node_t *leafnode) @@ -552,10 +573,10 @@ LinkConvexFaces (surface_t *planelist, node_t *leafnode) leafnode->markfaces[i] = NULL; // sentinal } -/* - LinkNodeFaces +/** Return a duplicated list of all faces on surface - Returns a duplicated list of all faces on surface + \param surface The surface of which to duplicate the faces. + \return The duplicated list. */ static face_t * LinkNodeFaces (surface_t *surface) @@ -589,6 +610,11 @@ LinkNodeFaces (surface_t *surface) return list; } +/** Partition the surfaces, creating a nice bsp. + + \param surfaces The surfaces to partition. + \param node The current node. +*/ static void PartitionSurfaces (surface_t *surfaces, node_t *node) { From fc0e0f46659a0f8dae0b813eceeacdb4cbf24ab7 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 30 Aug 2010 20:13:07 +0900 Subject: [PATCH 032/115] Documentation for surfaces. --- tools/qfbsp/include/surfaces.h | 16 ++++++++++ tools/qfbsp/source/surfaces.c | 56 +++++++++++++++++++++------------- 2 files changed, 50 insertions(+), 22 deletions(-) diff --git a/tools/qfbsp/include/surfaces.h b/tools/qfbsp/include/surfaces.h index 09fff12d4..f591d7d40 100644 --- a/tools/qfbsp/include/surfaces.h +++ b/tools/qfbsp/include/surfaces.h @@ -74,10 +74,26 @@ surface_t *AllocSurface (void); */ void FreeSurface (surface_t *s); +/** Split any faces that are too big. + + If the face is > options.subdivide_size in either texture direction, + carve off a valid sized piece and insert the remainder in the next link. + + \param f The face to subdivide. + \param prevptr The address of the pointer to this face. For nice linked + list manipulation. +*/ void SubdivideFace (struct visfacet_s *f, struct visfacet_s **prevptr); +/** Free the current node tree and return a new chain of the surfaces that + have inside faces. +*/ struct surface_s *GatherNodeFaces (struct node_s *headnode); +/** Give edges to all the faces in the bsp tree. + + \param headnode The root of the bsp tree. +*/ void MakeFaceEdges (struct node_s *headnode); #endif//surfaces_h diff --git a/tools/qfbsp/source/surfaces.c b/tools/qfbsp/source/surfaces.c index e7d208276..98ae2961e 100644 --- a/tools/qfbsp/source/surfaces.c +++ b/tools/qfbsp/source/surfaces.c @@ -95,12 +95,6 @@ FreeSurface (surface_t *s) free (s); } -/* - SubdivideFace - - If the face is >256 in either texture direction, carve a valid sized - piece off and insert the remainder in the next link -*/ void SubdivideFace (face_t *f, face_t **prevptr) { @@ -156,12 +150,6 @@ SubdivideFace (face_t *f, face_t **prevptr) } } -/* - GatherNodeFaces - - Frees the current node tree and returns a new chain of the surfaces that - have inside faces. -*/ static void GatherNodeFaces_r (node_t *node) { @@ -197,8 +185,6 @@ GatherNodeFaces (node_t *headnode) return BuildSurfaces (); } -//=========================================================================== - typedef struct hashvert_s { struct hashvert_s *next; vec3_t point; @@ -219,14 +205,14 @@ face_t *edgefaces[MAX_MAP_EDGES][2]; int firstmodeledge = 1; int firstmodelface; -//============================================================================ - #define NUM_HASH 4096 hashvert_t *hashverts[NUM_HASH]; static vec3_t hash_min, hash_scale; +/** Initialize the vertex hash table. +*/ static void InitHash (void) { @@ -256,6 +242,11 @@ InitHash (void) hvert_p = hvertex; } +/** Calulate the hash value of a vector. + + \param vec The vector for which to calculate the hash value. + \return The hash value of the vector. +*/ static unsigned HashVec (vec3_t vec) { @@ -268,6 +259,11 @@ HashVec (vec3_t vec) return h; } +/** Get the vertex number for the vertex. + + \param in The vertex for which to get the number. + \param planenum The plane on which this vertex is. +*/ static int GetVertex (vec3_t in, int planenum) { @@ -329,14 +325,18 @@ GetVertex (vec3_t in, int planenum) return hv->num; } -//=========================================================================== - int c_tryedges; -/* - GetEdge +/** Find an edge for the two vertices. - Don't allow four way edges + If an edge can not be found, create a new one. Will not create a three + (or more) face edge. + + \param p1 The first vertex. + \param p2 The second vertex. + \param f The face of which the two vertices form an edge. + \return The edge number. For a re-used edge, the edge number will + be negative, indicating the ends of the edge are reversed. */ static int GetEdge (vec3_t p1, vec3_t p2, face_t *f) @@ -348,8 +348,12 @@ GetEdge (vec3_t p1, vec3_t p2, face_t *f) Sys_Error ("GetEdge: 0 contents"); c_tryedges++; + // get the vertex numbers for the two vertices v1 = GetVertex (p1, f->planenum); v2 = GetVertex (p2, f->planenum); + + // search for an edge that uses the two vertices in the opposite direction + // but does not yet have a second face. for (i = firstmodeledge; i < bsp->numedges; i++) { if (v1 == bsp->edges[i].v[1] && v2 == bsp->edges[i].v[0] && !edgefaces[i][1] @@ -359,7 +363,7 @@ GetEdge (vec3_t p1, vec3_t p2, face_t *f) } } - // emit an edge + // Create a new edge. if (bsp->numedges == MAX_MAP_EDGES) Sys_Error ("numedges == MAX_MAP_EDGES"); edge.v[0] = v1; @@ -370,6 +374,10 @@ GetEdge (vec3_t p1, vec3_t p2, face_t *f) return i; } +/** Give the face edges. + + \param face The face to which edges will be given. +*/ static void FindFaceEdges (face_t *face) { @@ -385,6 +393,10 @@ FindFaceEdges (face_t *face) face); } +/** Recurse through the bsp tree, adding edges to the faces. + + \param node bsp tree node. +*/ static void MakeFaceEdges_r (node_t *node) { From f758cacc694a4051601c9d83d3381e1507c7f092 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 30 Aug 2010 20:56:44 +0900 Subject: [PATCH 033/115] Make FindEdge easier to read. --- tools/qfbsp/source/tjunc.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/tools/qfbsp/source/tjunc.c b/tools/qfbsp/source/tjunc.c index b2b958a64..9758e2f2d 100644 --- a/tools/qfbsp/source/tjunc.c +++ b/tools/qfbsp/source/tjunc.c @@ -169,26 +169,10 @@ FindEdge (vec3_t p1, vec3_t p2, vec_t *t1, vec_t *t2) h = HashVec (origin); for (w = wedge_hash[h]; w; w = w->next) { - temp = w->origin[0] - origin[0]; - if (temp < -EQUAL_EPSILON || temp > EQUAL_EPSILON) + if (!_VectorCompare (w->origin, origin)) continue; - temp = w->origin[1] - origin[1]; - if (temp < -EQUAL_EPSILON || temp > EQUAL_EPSILON) + if (!_VectorCompare (w->dir, dir)) continue; - temp = w->origin[2] - origin[2]; - if (temp < -EQUAL_EPSILON || temp > EQUAL_EPSILON) - continue; - - temp = w->dir[0] - dir[0]; - if (temp < -EQUAL_EPSILON || temp > EQUAL_EPSILON) - continue; - temp = w->dir[1] - dir[1]; - if (temp < -EQUAL_EPSILON || temp > EQUAL_EPSILON) - continue; - temp = w->dir[2] - dir[2]; - if (temp < -EQUAL_EPSILON || temp > EQUAL_EPSILON) - continue; - return w; } From a8bd522ca1abadb517075a26fa724e9929f509c0 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 30 Aug 2010 23:19:42 +0900 Subject: [PATCH 034/115] Documentation for tjunc. --- tools/qfbsp/include/tjunc.h | 4 +++ tools/qfbsp/source/tjunc.c | 72 ++++++++++++++++++++++++++++++++++--- 2 files changed, 71 insertions(+), 5 deletions(-) diff --git a/tools/qfbsp/include/tjunc.h b/tools/qfbsp/include/tjunc.h index e78a076c4..ac0ee3f61 100644 --- a/tools/qfbsp/include/tjunc.h +++ b/tools/qfbsp/include/tjunc.h @@ -25,6 +25,10 @@ struct node_s; +/** Add the edges from the faces in the bsp tree. + + \param headnode The current node in the bsp tree. +*/ void tjunc (struct node_s *headnode); #endif//qfbsp_tjunc_h diff --git a/tools/qfbsp/source/tjunc.c b/tools/qfbsp/source/tjunc.c index 9758e2f2d..3c052cbca 100644 --- a/tools/qfbsp/source/tjunc.c +++ b/tools/qfbsp/source/tjunc.c @@ -67,6 +67,11 @@ wedge_t *wedge_hash[NUM_HASH]; static vec3_t hash_min, hash_scale; +/** Initialize the edge hash table. + + \param mins The minimum of the bounding box in which the edges reside. + \param maxs The maximum of the bounding box in which the edges reside. +*/ static void InitHash (vec3_t mins, vec3_t maxs) { @@ -91,6 +96,11 @@ InitHash (vec3_t mins, vec3_t maxs) hash_scale[2] = newsize[1]; } +/** Calulate the hash value of a vector. + + \param vec The vector for which to calculate the hash value. + \return The hash value of the vector. +*/ static unsigned HashVec (vec3_t vec) { @@ -103,6 +113,14 @@ HashVec (vec3_t vec) return h; } +/** Make the vector canonical. + + A canonical vector is a unit vector with the first non-zero axis + positive. + + \param vec The vector to make canonical. + \return false is the vector is (0, 0, 0), otherwise true. +*/ static qboolean CanonicalVector (vec3_t vec) { @@ -140,6 +158,21 @@ CanonicalVector (vec3_t vec) return false; } +/** Find a wedge for the two points. + + A wedge is an infinitely long line passing through the two points with + an "origin" at t=0. + + \param p1 The first point. + \param p2 The second point. + \param t1 The "time" of one of the points. + \param t2 The "time" of the other point. + \return Pointer to the wedge, or NULL for a degenerate edge + (zero length). + + \note t2 will always be greater than t1, so there's no guarantee which + point is represented by t1 and t2. +*/ static wedge_t * FindEdge (vec3_t p1, vec3_t p2, vec_t *t1, vec_t *t2) { @@ -161,6 +194,7 @@ FindEdge (vec3_t p1, vec3_t p2, vec_t *t1, vec_t *t2) VectorMultSub (p1, *t1, dir, origin); if (*t1 > *t2) { + // swap t1 and t2 temp = *t1; *t1 = *t2; *t2 = temp; @@ -176,6 +210,7 @@ FindEdge (vec3_t p1, vec3_t p2, vec_t *t1, vec_t *t2) return w; } + // create a new wedge if (numwedges == MAXWEDGES) Sys_Error ("FindEdge: numwedges == MAXWEDGES"); w = &wedges[numwedges]; @@ -193,6 +228,16 @@ FindEdge (vec3_t p1, vec3_t p2, vec_t *t1, vec_t *t2) #define T_EPSILON 0.01 +/** Add a wvert to the wedge. + + A wvert is a vertex on the wedge and is specified by the time along the + wedge from the wedge's origin. + + If a wvert with the same time already exists, a new one will not be added. + + \param w The wedge to which the wvert will be added. + \param t The "time" of the wvert. +*/ static void AddVert (wedge_t *w, vec_t t) { @@ -221,6 +266,11 @@ AddVert (wedge_t *w, vec_t t) v->prev = newv; } +/** Add a faces edge to the wedge system. + + \param p1 The first point of the face's edge. + \param p2 The second point of the face's edge. +*/ static void AddEdge (vec3_t p1, vec3_t p2) { @@ -233,6 +283,10 @@ AddEdge (vec3_t p1, vec3_t p2) } } +/** Add the edges from the face. + + \param f The face from which to add the faces. +*/ static void AddFaceEdges (face_t *f) { @@ -246,6 +300,13 @@ AddFaceEdges (face_t *f) face_t *newlist; +/** Check and fix the edges of the face. + + If any vertices from other faces lie on an edge of the face between the + edge's end points, add matching vertices along that edge. + + \param f The face of which the edges will be checked. +*/ static void FixFaceEdges (face_t *f) { @@ -284,8 +345,6 @@ FixFaceEdges (face_t *f) newlist = f; } -//============================================================================ - static void tjunc_find_r (node_t *node) { @@ -302,6 +361,10 @@ tjunc_find_r (node_t *node) tjunc_find_r (node->children[1]); } +/** Check and fix the edges from the faces in the bsp tree. + + \param node The current node in the bsp tree. +*/ static void tjunc_fix_r (node_t *node) { @@ -336,9 +399,7 @@ tjunc (node_t *headnode) if (options.notjunc) return; - // identify all points on common edges - - // origin points won't allways be inside the map, so extend the hash area + // origin points won't allways be inside the map, so extend the hash area for (i = 0; i < 3; i++) { if (fabs (brushset->maxs[i]) > fabs (brushset->mins[i])) maxs[i] = fabs (brushset->maxs[i]); @@ -351,6 +412,7 @@ tjunc (node_t *headnode) numwedges = numwverts = 0; + // identify all points on common edges tjunc_find_r (headnode); qprintf ("%i world edges %i edge points\n", numwedges, numwverts); From 44776f111fc0180dcdfd2583731ac46011d03e91 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 31 Aug 2010 10:46:38 +0900 Subject: [PATCH 035/115] Documentation for winding. --- tools/qfbsp/include/winding.h | 72 +++++++++++++++++++++++++++++++++++ tools/qfbsp/source/winding.c | 19 --------- 2 files changed, 72 insertions(+), 19 deletions(-) diff --git a/tools/qfbsp/include/winding.h b/tools/qfbsp/include/winding.h index ac2fd20bb..ae1b38cc7 100644 --- a/tools/qfbsp/include/winding.h +++ b/tools/qfbsp/include/winding.h @@ -32,12 +32,84 @@ typedef struct winding_s { vec3_t points[8]; // variable sized } winding_t; +/** Create a very large four-point winding with all point on the plane. + + The winding will be a box with aligned with the axes of the plane. + + \param p The plane for which to create the winding. + \return The new winding. + \note It is the caller's responsibiltiy to free the new winding. +*/ winding_t *BaseWindingForPlane (struct plane_s *p); + +/** Create a new, empty winding with. + + \param points The number of points for which to leave space. + \return The new winding. + \note It is the caller's responsibiltiy to free the new winding. +*/ winding_t *NewWinding (int points); + +/** Free the winding. + + \param w The winding to be freed. +*/ void FreeWinding (winding_t *w); + +/** Create a new winding with the same points as the given winding. + + \param w The winding to copy. + \return The new winding. + \note It is the caller's responsibiltiy to free the new winding. +*/ winding_t *CopyWinding (winding_t *w); + +/** Create a new winding with the reverse points of the given winding. + + \param w The winding to copy. + \return The new winding. + \note It is the caller's responsibiltiy to free the new winding. +*/ winding_t *CopyWindingReverse (winding_t *w); + +/** Clip the winding to the plain. + + The new winding will be the part of the input winding that is on the + front side of the plane. + + \note It is the caller's responsibiltiy to free the new winding. + + \note The input winding will be freed. + + \param in The winding to be clipped. + \param split The plane by which the winding will be clipped. + \param keepon If true, an exactly on-plane winding will be saved, + otherwise it will be clipped away. + \return The new winding representing the part of the input winding + on the font side of the plane, or NULL if the winding has + been clipped away. +*/ winding_t *ClipWinding (winding_t *in, struct plane_s *split, qboolean keepon); + +/** Divide a winding by a plane, producing one or two windings. + + \note The original winding is not damaged or freed. + + \note If one of \a front or \a back is NULL, the other will point to + the input winding. + + \note If neither \a front nor \a back are NULL, then both will be new + windings and the caller will be responsible for freeing them. + + \param in The winding to be divided. + \param split The plane by which the winding will be divided. + \param front Set to the part of the input winding that is in front of + the plane, or NULL if no part of the winding is in front + of the plane. + \param back Set to the part of the input winding that is behind the + plane, or NULL if no part of the winding is behind the + plane. +*/ void DivideWinding (winding_t *in, struct plane_s *split, winding_t **front, winding_t **back); diff --git a/tools/qfbsp/source/winding.c b/tools/qfbsp/source/winding.c index 5e27e8fcd..3ba838114 100644 --- a/tools/qfbsp/source/winding.c +++ b/tools/qfbsp/source/winding.c @@ -135,17 +135,6 @@ CopyWindingReverse (winding_t *w) return c; } -/* - ClipWinding - - Clips the winding to the plane, returning the new winding on the positive - side. - - Frees the input winding. - - If keepon is true, an exactly on-plane winding will be saved, otherwise - it will be clipped away. -*/ winding_t * ClipWinding (winding_t *in, plane_t *split, qboolean keepon) { @@ -244,14 +233,6 @@ ClipWinding (winding_t *in, plane_t *split, qboolean keepon) return neww; } -/* - DivideWinding - - Divides a winding by a plane, producing one or two windings. The - original winding is not damaged or freed. If on only one side, the - returned winding will be the input winding. If on both sides, two - new windings will be created. -*/ void DivideWinding (winding_t *in, plane_t *split, winding_t **front, winding_t **back) From ad8b08238df088aebb603debce4317a53e1818bd Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 31 Aug 2010 10:56:15 +0900 Subject: [PATCH 036/115] Make some vector code easier to read. --- tools/qfbsp/source/writebsp.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tools/qfbsp/source/writebsp.c b/tools/qfbsp/source/writebsp.c index 9d98f3713..fb57e62fb 100644 --- a/tools/qfbsp/source/writebsp.c +++ b/tools/qfbsp/source/writebsp.c @@ -65,11 +65,7 @@ FindFinalPlane (dplane_t *p) continue; if (p->dist != dplane->dist) continue; - if (p->normal[0] != dplane->normal[0]) - continue; - if (p->normal[1] != dplane->normal[1]) - continue; - if (p->normal[2] != dplane->normal[2]) + if (!VectorCompare (p->normal, dplane->normal)) continue; return i; } @@ -97,9 +93,7 @@ WriteNodePlanes_r (node_t *node) plane = &planes[node->planenum]; - dplane.normal[0] = plane->normal[0]; - dplane.normal[1] = plane->normal[1]; - dplane.normal[2] = plane->normal[2]; + VectorCopy (plane->normal, dplane.normal); dplane.dist = plane->dist; dplane.type = plane->type; BSP_AddPlane (bsp, &dplane); From 142defe9c05f3623501b8fd110b39eef84ba1ceb Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 31 Aug 2010 21:54:48 +0900 Subject: [PATCH 037/115] Parameter consistency fixes. Make the params for FreeWinding and CopyWinding consistent with those in qfbsp. This fixes some doxygen warnings while I think about how best to handle the duplicate code. --- tools/qfvis/include/vis.h | 4 ++-- tools/qfvis/source/qfvis.c | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/qfvis/include/vis.h b/tools/qfvis/include/vis.h index 3afc028cc..226691e9d 100644 --- a/tools/qfvis/include/vis.h +++ b/tools/qfvis/include/vis.h @@ -133,10 +133,10 @@ extern int c_chains; extern int c_mighttest; extern int c_vistest; -void FreeWinding (winding_t *winding); +void FreeWinding (winding_t *w); winding_t *NewWinding (int points); winding_t *ClipWinding (winding_t *in, plane_t *split, qboolean keepon); -winding_t *CopyWinding (winding_t *winding); +winding_t *CopyWinding (winding_t *w); void ClusterFlow (int clusternum); void BasePortalVis (void); diff --git a/tools/qfvis/source/qfvis.c b/tools/qfvis/source/qfvis.c index 9e908425f..af11673b4 100644 --- a/tools/qfvis/source/qfvis.c +++ b/tools/qfvis/source/qfvis.c @@ -126,21 +126,21 @@ NewWinding (int points) } void -FreeWinding (winding_t *winding) +FreeWinding (winding_t *w) { - if (!winding->original) - free (winding); + if (!w->original) + free (w); } winding_t * -CopyWinding (winding_t *winding) +CopyWinding (winding_t *w) { size_t size; winding_t *copy; - size = (size_t) (uintptr_t) ((winding_t *) 0)->points[winding->numpoints]; + size = (size_t) (uintptr_t) ((winding_t *) 0)->points[w->numpoints]; copy = malloc (size); - memcpy (copy, winding, size); + memcpy (copy, w, size); copy->original = false; return copy; } From 93517d40d8adb369c4b9b4af373df01e7901a191 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 1 Sep 2010 09:52:39 +0900 Subject: [PATCH 038/115] Finish the port of smart leak files. This comes from the OpenQuartz version of qbsp. --- tools/qfbsp/include/options.h | 1 + tools/qfbsp/source/options.c | 4 +++ tools/qfbsp/source/outside.c | 51 +++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) diff --git a/tools/qfbsp/include/options.h b/tools/qfbsp/include/options.h index 0adcf7dce..73c7892b9 100644 --- a/tools/qfbsp/include/options.h +++ b/tools/qfbsp/include/options.h @@ -43,6 +43,7 @@ typedef struct { qboolean extract_textures; qboolean extract_entities; qboolean extract_hull; + qboolean smart_leak; qboolean usehulls; qboolean watervis; int hullnum; diff --git a/tools/qfbsp/source/options.c b/tools/qfbsp/source/options.c index f1e2a20a5..1f8c5c0ef 100644 --- a/tools/qfbsp/source/options.c +++ b/tools/qfbsp/source/options.c @@ -61,6 +61,7 @@ static struct option const long_options[] = { {"extract-textures", no_argument, 0, 256}, {"extract-entities", no_argument, 0, 257}, {"extract-hull", no_argument, 0, 258}, + {"smart-leak", no_argument, 0, 259}, {"usehulls", no_argument, 0, 'u'}, {"hullnum", required_argument, 0, 'H'}, {"subdivide", required_argument, 0, 's'}, @@ -176,6 +177,9 @@ DecodeArgs (int argc, char **argv) options.extract = true; options.extract_hull = true; break; + case 259: // smart-leak + options.smart_leak = true; + break; case 'u': // usehulls options.usehulls = true; break; diff --git a/tools/qfbsp/source/outside.c b/tools/qfbsp/source/outside.c index b21b2632b..f7177fe00 100644 --- a/tools/qfbsp/source/outside.c +++ b/tools/qfbsp/source/outside.c @@ -161,6 +161,52 @@ MarkLeakTrail (portal_t *n2) } } +static void +MarkLeakTrail2 (void) +{ + int i; + int next, side; + node_t *n, *nextnode; + portal_t *p, *p2; + vec3_t wc; + vec_t *v; + + leakfile = fopen (options.pointfile, "w"); + if (!leakfile) + Sys_Error ("Couldn't open %s\n", options.pointfile); + + n = &outside_node; + next = -1; + + while ((n->o_dist > 1) || (next == -1)) { + nextnode = 0; + p2 = 0; + for (p = n->portals; p; p = p->next[side]) { + side = (p->nodes[1] == n); + if ((next == -1) + || ((p->nodes[!side]->o_dist < next) + && p->nodes[!side]->o_dist)) { + nextnode = p->nodes[!side]; + next = nextnode->o_dist; + p2 = p; + } + } + if (!nextnode) + break; + n = nextnode; + + VectorZero (wc); + for (i = 0; i < p2->winding->numpoints; i++) + VectorAdd (wc, p2->winding->points[i], wc); + VectorScale (wc, 1.0 / i, wc); + fprintf (leakfile, "%g %g %g", wc[0], wc[1], wc[2]); + } + v = entities[n->occupied].origin; + fprintf (leakfile, "%g %g %g\n", v[0], v[1], v[2]); + + fclose (leakfile); +} + int hit_occupied; /** Recurse through the map setting the outside nodes to solid. @@ -206,6 +252,8 @@ RecursiveFillOutside (node_t *l, qboolean fill) if (RecursiveFillOutside (p->nodes[s], fill)) { // leaked, so stop filling + if (options.smart_leak) + return true; if (!options.hullnum) { MarkLeakTrail (p); DrawLeaf (l, 2); @@ -297,6 +345,9 @@ FillOutside (node_t *node) printf ("leak file written to %s\n", options.pointfile); printf ("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); } + if (options.smart_leak) + MarkLeakTrail2 (); + // remove faces from filled in leafs ClearOutFaces (node); return false; From bfc6c9e798b7f7e7b8bbccd1f9830a07c0cd8157 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 1 Sep 2010 10:06:01 +0900 Subject: [PATCH 039/115] Document the smart-leak function. --- tools/qfbsp/source/outside.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/qfbsp/source/outside.c b/tools/qfbsp/source/outside.c index f7177fe00..48b82c06b 100644 --- a/tools/qfbsp/source/outside.c +++ b/tools/qfbsp/source/outside.c @@ -55,10 +55,8 @@ PointInLeaf (node_t *node, vec3_t point) /** Set the distance to a node from all reachable nodes. - Purpose unknown: not in the id code and the information is not used - anywhere. Probably a bad port from either hqbsp or oq. - - \todo Find the port source and either fix qfbsp or nuke this function. + \param n The current node. + \param dist The distance to the original node. */ static void FloodEntDist_r (node_t *n, int dist) @@ -161,6 +159,10 @@ MarkLeakTrail (portal_t *n2) } } +/** Mark the trail from outside to the entity. + + Try to use the shortest path from the outside node to the entity. +*/ static void MarkLeakTrail2 (void) { From fcd1897421a1e43604d5a1040385011e60466377 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 1 Sep 2010 10:06:54 +0900 Subject: [PATCH 040/115] Create the qfbsp doxygen modules. Also, make doxygen extract static functions as well, so qfbsp's docs can be more complete. --- doc/quakeforge.dox.in | 2 +- tools/qfbsp/include/brush.h | 7 +++++++ tools/qfbsp/include/bsp5.h | 10 ++++++++++ tools/qfbsp/include/csg4.h | 7 +++++++ tools/qfbsp/include/draw.h | 7 +++++++ tools/qfbsp/include/map.h | 7 +++++++ tools/qfbsp/include/merge.h | 7 +++++++ tools/qfbsp/include/options.h | 8 ++++++++ tools/qfbsp/include/outside.h | 7 +++++++ tools/qfbsp/include/portals.h | 7 +++++++ tools/qfbsp/include/readbsp.h | 7 +++++++ tools/qfbsp/include/region.h | 7 +++++++ tools/qfbsp/include/solidbsp.h | 7 +++++++ tools/qfbsp/include/surfaces.h | 7 +++++++ tools/qfbsp/include/tjunc.h | 7 +++++++ tools/qfbsp/include/winding.h | 7 +++++++ tools/qfbsp/include/writebsp.h | 7 +++++++ tools/qfbsp/source/brush.c | 6 ++++++ tools/qfbsp/source/csg4.c | 6 ++++++ tools/qfbsp/source/map.c | 6 ++++++ tools/qfbsp/source/merge.c | 6 ++++++ tools/qfbsp/source/nodraw.c | 6 ++++++ tools/qfbsp/source/options.c | 6 ++++++ tools/qfbsp/source/outside.c | 6 ++++++ tools/qfbsp/source/portals.c | 8 +++++++- tools/qfbsp/source/qfbsp.c | 6 ++++++ tools/qfbsp/source/readbsp.c | 6 ++++++ tools/qfbsp/source/region.c | 6 ++++++ tools/qfbsp/source/solidbsp.c | 6 ++++++ tools/qfbsp/source/surfaces.c | 6 ++++++ tools/qfbsp/source/tjunc.c | 6 ++++++ tools/qfbsp/source/winding.c | 6 ++++++ tools/qfbsp/source/writebsp.c | 6 ++++++ 33 files changed, 214 insertions(+), 2 deletions(-) diff --git a/doc/quakeforge.dox.in b/doc/quakeforge.dox.in index f222db91c..f337f0bda 100644 --- a/doc/quakeforge.dox.in +++ b/doc/quakeforge.dox.in @@ -308,7 +308,7 @@ EXTRACT_PRIVATE = NO # If the EXTRACT_STATIC tag is set to YES all static members of a file # will be included in the documentation. -EXTRACT_STATIC = NO +EXTRACT_STATIC = YES # If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) # defined locally in source files will be included in the documentation. diff --git a/tools/qfbsp/include/brush.h b/tools/qfbsp/include/brush.h index 7d0e2e88b..7c60f4a67 100644 --- a/tools/qfbsp/include/brush.h +++ b/tools/qfbsp/include/brush.h @@ -28,6 +28,11 @@ #include "bsp5.h" #include "map.h" +/** \defgroup qfbsp_brush Brush Functions + \ingroup qfbsp +*/ +//@{ + #define NUM_HULLS 2 // normal and +16 #define NUM_CONTENTS 2 // solid and water @@ -74,4 +79,6 @@ int PlaneTypeForNormal (const vec3_t normal); */ int FindPlane (plane_t *dplane, int *side); +//@} + #endif//qfbsp_brush_h diff --git a/tools/qfbsp/include/bsp5.h b/tools/qfbsp/include/bsp5.h index cf04e9074..78d73398a 100644 --- a/tools/qfbsp/include/bsp5.h +++ b/tools/qfbsp/include/bsp5.h @@ -23,9 +23,17 @@ #ifndef qfbsp_bsp5_h #define qfbsp_bsp5_h +/** \defgroup qfbsp QuakeForge BSP Compiler +*/ + #include "QF/mathlib.h" #include "QF/bspfile.h" +/** \defgroup qfbsp_general General functions + \ingroup qfbsp +*/ +//@{ + typedef struct plane_s { vec3_t normal; vec_t dist; @@ -128,4 +136,6 @@ node_t *AllocNode (void); extern bsp_t *bsp; +//@} + #endif//qfbsp_bsp5_h diff --git a/tools/qfbsp/include/csg4.h b/tools/qfbsp/include/csg4.h index 24b5cc710..12391b19c 100644 --- a/tools/qfbsp/include/csg4.h +++ b/tools/qfbsp/include/csg4.h @@ -25,6 +25,11 @@ #include "QF/bspfile.h" +/** \defgroup qfbsp_csg4 CSG Functions + \ingroup qfbsp +*/ +//@{ + struct plane_s; struct visfacet_s; struct brushset_s; @@ -80,4 +85,6 @@ struct surface_s *CSGFaces (struct brushset_s *bs); void SplitFace (struct visfacet_s *in, struct plane_s *split, struct visfacet_s **front, struct visfacet_s **back); +//@} + #endif//qfbsp_csg4_h diff --git a/tools/qfbsp/include/draw.h b/tools/qfbsp/include/draw.h index a31832939..9f9e6941d 100644 --- a/tools/qfbsp/include/draw.h +++ b/tools/qfbsp/include/draw.h @@ -25,6 +25,11 @@ #include "QF/mathlib.h" +/** \defgroup qfbsp_draw Debug Drawing Functions + \ingroup qfbsp +*/ +//@{ + struct visfacet_s; struct portal_s; struct node_s; @@ -49,4 +54,6 @@ void DrawBrush (struct brush_s *b); void DrawWinding (struct winding_s *w); void DrawTri (vec3_t p1, vec3_t p2, vec3_t p3); +//@} + #endif//qfbsp_draw_h diff --git a/tools/qfbsp/include/map.h b/tools/qfbsp/include/map.h index 32ed2441f..0b1f0ddc8 100644 --- a/tools/qfbsp/include/map.h +++ b/tools/qfbsp/include/map.h @@ -25,6 +25,11 @@ #include "bsp5.h" +/** \defgroup qfbsp_map Map Parser + \ingroup qfbsp +*/ +//@{ + #define MAX_FACES 256 typedef struct mface_s { struct mface_s *next; @@ -118,4 +123,6 @@ void GetVectorForKey (entity_t *ent, const char *key, vec3_t vec); */ void WriteEntitiesToString (void); +//@} + #endif//qfbsp_map_h diff --git a/tools/qfbsp/include/merge.h b/tools/qfbsp/include/merge.h index b6dfe8f52..c2d0601b8 100644 --- a/tools/qfbsp/include/merge.h +++ b/tools/qfbsp/include/merge.h @@ -23,6 +23,11 @@ #ifndef qfbsp_merge_h #define qfbsp_merge_h +/** \defgroup qfbsp_merge Merge Functions + \ingroup qfbsp +*/ +//@{ + /** Add a face to the list of faces, doing any possible merging. \param face The face to add to the list. @@ -59,4 +64,6 @@ void MergePlaneFaces (surface_t *plane); */ void MergeAll (surface_t *surfhead); +//@} + #endif//qfbsp_merge_h diff --git a/tools/qfbsp/include/options.h b/tools/qfbsp/include/options.h index 73c7892b9..d99ccf20e 100644 --- a/tools/qfbsp/include/options.h +++ b/tools/qfbsp/include/options.h @@ -31,6 +31,11 @@ #include "QF/qtypes.h" +/** \defgroup qfbsp_options Command-line Options Parsing + \ingroup qfbsp +*/ +//@{ + typedef struct { int verbosity; // 0=silent qboolean drawflag; @@ -60,4 +65,7 @@ typedef struct { extern options_t options; int DecodeArgs (int argc, char **argv); extern const char *this_program; + +//@} + #endif//qfbsp_options_h diff --git a/tools/qfbsp/include/outside.h b/tools/qfbsp/include/outside.h index 55f4589c2..c90fc04ed 100644 --- a/tools/qfbsp/include/outside.h +++ b/tools/qfbsp/include/outside.h @@ -23,6 +23,11 @@ #ifndef qfbsp_outside_h #define qfbsp_outside_h +/** \defgroup qfbsp_outside Outside Functions + \ingroup qfbsp +*/ +//@{ + struct node_s; /** Make the outside of the map solid. @@ -37,4 +42,6 @@ struct node_s; */ qboolean FillOutside (struct node_s *node); +//@} + #endif//qfbsp_outside_h diff --git a/tools/qfbsp/include/portals.h b/tools/qfbsp/include/portals.h index 26223cff9..68f130fc8 100644 --- a/tools/qfbsp/include/portals.h +++ b/tools/qfbsp/include/portals.h @@ -23,6 +23,11 @@ #ifndef qfbsp_portals_h #define qfbsp_portals_h +/** \defgroup qfbsp_portals Portal Functions + \ingroup qfbsp +*/ +//@{ + struct node_s; typedef struct portal_s { @@ -79,4 +84,6 @@ void FreeAllPortals (struct node_s *node); */ void WritePortalfile (struct node_s *headnode); +//@} + #endif//qfbsp_portals_h diff --git a/tools/qfbsp/include/readbsp.h b/tools/qfbsp/include/readbsp.h index 3f624310a..24c5c9df0 100644 --- a/tools/qfbsp/include/readbsp.h +++ b/tools/qfbsp/include/readbsp.h @@ -23,6 +23,11 @@ #ifndef qfbsp_readbsp_h #define qfbsp_readbsp_h +/** \defgroup qfbsp_readbsp BSP Reading Functions + \ingroup qfbsp +*/ +//@{ + /** Load the bspfile into memory. */ void LoadBSP (void); @@ -43,4 +48,6 @@ void extract_entities (void); */ void extract_hull (void); +//@} + #endif//qfbsp_readbsp_h diff --git a/tools/qfbsp/include/region.h b/tools/qfbsp/include/region.h index b461d56f3..8b2619d4d 100644 --- a/tools/qfbsp/include/region.h +++ b/tools/qfbsp/include/region.h @@ -23,6 +23,11 @@ #ifndef qfbsp_region_h #define qfbsp_region_h +/** \defgroup qfbsp_region Region Functions + \ingroup qfbsp +*/ +//@{ + struct node_s; /** Write the faces and edges to the bsp file. @@ -31,4 +36,6 @@ struct node_s; */ void GrowNodeRegions (struct node_s *headnode); +//@} + #endif//qfbsp_region_h diff --git a/tools/qfbsp/include/solidbsp.h b/tools/qfbsp/include/solidbsp.h index af924bfb7..f0c28a96d 100644 --- a/tools/qfbsp/include/solidbsp.h +++ b/tools/qfbsp/include/solidbsp.h @@ -25,6 +25,11 @@ #include "QF/qtypes.h" +/** \defgroup qfbsp_solidbsp BSP Creation Functions + \ingroup qfbsp +*/ +//@{ + struct visfacet_s; struct plane_s; struct surface_s; @@ -44,4 +49,6 @@ void CalcSurfaceInfo (struct surface_s *surf); */ struct node_s *SolidBSP (struct surface_s *surfhead, qboolean midsplit); +//@} + #endif//qfbsp_solidbsp_h diff --git a/tools/qfbsp/include/surfaces.h b/tools/qfbsp/include/surfaces.h index f591d7d40..4e377f8ae 100644 --- a/tools/qfbsp/include/surfaces.h +++ b/tools/qfbsp/include/surfaces.h @@ -25,6 +25,11 @@ #include "QF/bspfile.h" +/** \defgroup qfbsp_surface Surface Functions + \ingroup qfbsp +*/ +//@{ + struct visfacet_s; struct node_s; struct surface_s; @@ -96,4 +101,6 @@ struct surface_s *GatherNodeFaces (struct node_s *headnode); */ void MakeFaceEdges (struct node_s *headnode); +//@} + #endif//surfaces_h diff --git a/tools/qfbsp/include/tjunc.h b/tools/qfbsp/include/tjunc.h index ac0ee3f61..db70394aa 100644 --- a/tools/qfbsp/include/tjunc.h +++ b/tools/qfbsp/include/tjunc.h @@ -23,6 +23,11 @@ #ifndef qfbsp_tjunc_h #define qfbsp_tjunc_h +/** \defgroup qfbsp_tjunc T-Junction Repair + \ingroup qfbsp +*/ +//@{ + struct node_s; /** Add the edges from the faces in the bsp tree. @@ -31,4 +36,6 @@ struct node_s; */ void tjunc (struct node_s *headnode); +//@} + #endif//qfbsp_tjunc_h diff --git a/tools/qfbsp/include/winding.h b/tools/qfbsp/include/winding.h index ae1b38cc7..cbfab732b 100644 --- a/tools/qfbsp/include/winding.h +++ b/tools/qfbsp/include/winding.h @@ -25,6 +25,11 @@ #include "QF/mathlib.h" +/** \defgroup qfbsp_winding Winding Manipulation + \ingroup qfbsp +*/ +//@{ + struct plane_s; typedef struct winding_s { @@ -113,4 +118,6 @@ winding_t *ClipWinding (winding_t *in, struct plane_s *split, qboolean keepon); void DivideWinding (winding_t *in, struct plane_s *split, winding_t **front, winding_t **back); +//@} + #endif//qfbsp_winding_h diff --git a/tools/qfbsp/include/writebsp.h b/tools/qfbsp/include/writebsp.h index 0de07b16a..58ac5fc77 100644 --- a/tools/qfbsp/include/writebsp.h +++ b/tools/qfbsp/include/writebsp.h @@ -25,6 +25,11 @@ #include "QF/bspfile.h" +/** \defgroup qfbsp_writebsp BSP Writing Functions + \ingroup qfbsp +*/ +//@{ + struct node_s; void WriteNodePlanes (struct node_s *headnode); @@ -37,4 +42,6 @@ int FindFinalPlane (dplane_t *p); void BeginBSPFile (void); void FinishBSPFile (void); +//@} + #endif//qfbsp_writebsp_h diff --git a/tools/qfbsp/source/brush.c b/tools/qfbsp/source/brush.c index e340c1b53..ad43effb1 100644 --- a/tools/qfbsp/source/brush.c +++ b/tools/qfbsp/source/brush.c @@ -38,6 +38,10 @@ #include "surfaces.h" #include "winding.h" +/** \addtogroup qfbsp_brush +*/ +//@{ + int numbrushplanes; plane_t planes[MAX_MAP_PLANES]; @@ -798,3 +802,5 @@ Brush_LoadEntity (entity_t *ent, int hullnum) return bset; } + +//@} diff --git a/tools/qfbsp/source/csg4.c b/tools/qfbsp/source/csg4.c index 284b61b97..0de15cd58 100644 --- a/tools/qfbsp/source/csg4.c +++ b/tools/qfbsp/source/csg4.c @@ -39,6 +39,10 @@ static __attribute__ ((used)) const char rcsid[] = #include "surfaces.h" #include "winding.h" +/** \addtogroup qfbsp_csg4 +*/ +//@{ + /* NOTES @@ -382,3 +386,5 @@ CSGFaces (brushset_t *bs) return surfhead; } + +//@} diff --git a/tools/qfbsp/source/map.c b/tools/qfbsp/source/map.c index 9dd1ce3b3..84083f157 100644 --- a/tools/qfbsp/source/map.c +++ b/tools/qfbsp/source/map.c @@ -44,6 +44,10 @@ static __attribute__ ((used)) const char rcsid[] = #include "map.h" +/** \addtogroup qfbsp_map +*/ +//@{ + int nummapbrushfaces; int nummapbrushes; mbrush_t mapbrushes[MAX_MAP_BRUSHES]; @@ -589,3 +593,5 @@ WriteEntitiesToString (void) } BSP_AddEntities (bsp, buf->str, buf->size); } + +//@} diff --git a/tools/qfbsp/source/merge.c b/tools/qfbsp/source/merge.c index afba61ac2..0a6d42833 100644 --- a/tools/qfbsp/source/merge.c +++ b/tools/qfbsp/source/merge.c @@ -34,6 +34,10 @@ static __attribute__ ((used)) const char rcsid[] = #include "surfaces.h" #include "winding.h" +/** \addtogroup qfbsp_merge +*/ +//@{ + #define CONTINUOUS_EPSILON 0.001 @@ -236,3 +240,5 @@ MergeAll (surface_t * surfhead) printf ("%i mergefaces\n", mergefaces); } + +//@} diff --git a/tools/qfbsp/source/nodraw.c b/tools/qfbsp/source/nodraw.c index 7c4374119..f202df80d 100644 --- a/tools/qfbsp/source/nodraw.c +++ b/tools/qfbsp/source/nodraw.c @@ -26,6 +26,10 @@ static __attribute__ ((used)) const char rcsid[] = #include "draw.h" +/** \addtogroup qfbsp_draw +*/ +//@{ + void Draw_ClearBounds (void) @@ -91,3 +95,5 @@ void DrawPortal (struct portal_s *portal) { } + +//@} diff --git a/tools/qfbsp/source/options.c b/tools/qfbsp/source/options.c index 1f8c5c0ef..cbc040a63 100644 --- a/tools/qfbsp/source/options.c +++ b/tools/qfbsp/source/options.c @@ -45,6 +45,10 @@ static __attribute__ ((used)) const char rcsid[] = #include "options.h" +/** \addtogroup qfbsp_options +*/ +//@{ + const char *this_program; static struct option const long_options[] = { @@ -242,3 +246,5 @@ DecodeArgs (int argc, char **argv) return optind; } + +//@} diff --git a/tools/qfbsp/source/outside.c b/tools/qfbsp/source/outside.c index 48b82c06b..c2479303b 100644 --- a/tools/qfbsp/source/outside.c +++ b/tools/qfbsp/source/outside.c @@ -33,6 +33,10 @@ static __attribute__ ((used)) const char rcsid[] = #include "outside.h" #include "winding.h" +/** \addtogroup qfbsp_outside +*/ +//@{ + int outleafs; /** Find the leaf node in which the point is. @@ -365,3 +369,5 @@ FillOutside (node_t *node) qprintf ("%4i outleafs\n", outleafs); return true; } + +//@} diff --git a/tools/qfbsp/source/portals.c b/tools/qfbsp/source/portals.c index f84f29a56..6f173d077 100644 --- a/tools/qfbsp/source/portals.c +++ b/tools/qfbsp/source/portals.c @@ -38,6 +38,10 @@ static __attribute__ ((used)) const char rcsid[] = #include "portals.h" #include "winding.h" +/** \addtogroup qfbsp_portals +*/ +//@{ + int c_activeportals, c_peakportals; node_t outside_node; // portals outside the world face this @@ -448,7 +452,7 @@ ShareContents (node_t *n1, node_t *n2) /** Check if two nodes have the same non-solid, non-sky contents. - \node Affected by watervis. + \note Affected by watervis. \param n1 The first node to check. \param n2 The second node to check. @@ -636,3 +640,5 @@ WritePortalfile (node_t *headnode) fclose (pf); } + +//@} diff --git a/tools/qfbsp/source/qfbsp.c b/tools/qfbsp/source/qfbsp.c index dd055d231..2c4c26880 100644 --- a/tools/qfbsp/source/qfbsp.c +++ b/tools/qfbsp/source/qfbsp.c @@ -59,6 +59,10 @@ static __attribute__ ((used)) const char rcsid[] = #include "writebsp.h" #include "tjunc.h" +/** \addtogroup qfbsp +*/ +//@{ + options_t options; bsp_t *bsp; @@ -486,3 +490,5 @@ qprintf (const char *fmt, ...) vprintf (fmt, argptr); va_end (argptr); } + +//@} diff --git a/tools/qfbsp/source/readbsp.c b/tools/qfbsp/source/readbsp.c index a5f6265c2..b37b73b97 100644 --- a/tools/qfbsp/source/readbsp.c +++ b/tools/qfbsp/source/readbsp.c @@ -58,6 +58,10 @@ static __attribute__ ((used)) const char rcsid[] = #include "readbsp.h" #include "winding.h" +/** \addtogroup qfbsp_readbsp +*/ +//@{ + dmodel_t *models; face_t *mfaces; node_t *nodes; @@ -474,3 +478,5 @@ extract_hull (void) } Qprintf (hf, "};\n"); } + +//@} diff --git a/tools/qfbsp/source/region.c b/tools/qfbsp/source/region.c index 64dfe4af0..24b95da39 100644 --- a/tools/qfbsp/source/region.c +++ b/tools/qfbsp/source/region.c @@ -37,6 +37,10 @@ static __attribute__ ((used)) const char rcsid[] = #include "surfaces.h" #include "winding.h" +/** \addtogroup qfbsp_region +*/ +//@{ + /* input ----- @@ -273,3 +277,5 @@ GrowNodeRegions (node_t *headnode) if overlap split */ + +//@} diff --git a/tools/qfbsp/source/solidbsp.c b/tools/qfbsp/source/solidbsp.c index fed8072af..eba71795f 100644 --- a/tools/qfbsp/source/solidbsp.c +++ b/tools/qfbsp/source/solidbsp.c @@ -39,6 +39,10 @@ static __attribute__ ((used)) const char rcsid[] = #include "surfaces.h" #include "winding.h" +/** \addtogroup qfbsp_solidbsp +*/ +//@{ + int leaffaces; int nodefaces; int splitnodes; @@ -707,3 +711,5 @@ SolidBSP (surface_t *surfhead, qboolean midsplit) return headnode; } + +//@} diff --git a/tools/qfbsp/source/surfaces.c b/tools/qfbsp/source/surfaces.c index 98ae2961e..cef2f4049 100644 --- a/tools/qfbsp/source/surfaces.c +++ b/tools/qfbsp/source/surfaces.c @@ -38,6 +38,10 @@ static __attribute__ ((used)) const char rcsid[] = #include "surfaces.h" #include "winding.h" +/** \addtogroup qfbsp_surface +*/ +//@{ + /* a surface has all of the faces that could be drawn on a given plane @@ -431,3 +435,5 @@ MakeFaceEdges (node_t *headnode) firstmodeledge = bsp->numedges; firstmodelface = bsp->numfaces; } + +//@} diff --git a/tools/qfbsp/source/tjunc.c b/tools/qfbsp/source/tjunc.c index 3c052cbca..ba7e34b6d 100644 --- a/tools/qfbsp/source/tjunc.c +++ b/tools/qfbsp/source/tjunc.c @@ -38,6 +38,10 @@ static __attribute__ ((used)) const char rcsid[] = #include "winding.h" #include "tjunc.h" +/** \addtogroup qfbsp_tjunc +*/ +//@{ + typedef struct wvert_s { vec_t t; struct wvert_s *prev, *next; @@ -427,3 +431,5 @@ tjunc (node_t *headnode) qprintf ("%i edges added by tjunctions\n", tjuncs); qprintf ("%i faces added by tjunctions\n", tjuncfaces); } + +//@} diff --git a/tools/qfbsp/source/winding.c b/tools/qfbsp/source/winding.c index 3ba838114..bb6dc156f 100644 --- a/tools/qfbsp/source/winding.c +++ b/tools/qfbsp/source/winding.c @@ -40,6 +40,10 @@ static __attribute__ ((used)) const char rcsid[] = #include "bsp5.h" #include "winding.h" +/** \addtogroup qfbsp_winding +*/ +//@{ + int c_activewindings, c_peakwindings; winding_t * @@ -301,3 +305,5 @@ FreeWinding (winding_t *w) c_activewindings--; free (w); } + +//@} diff --git a/tools/qfbsp/source/writebsp.c b/tools/qfbsp/source/writebsp.c index fb57e62fb..beee386bb 100644 --- a/tools/qfbsp/source/writebsp.c +++ b/tools/qfbsp/source/writebsp.c @@ -45,6 +45,10 @@ static __attribute__ ((used)) const char rcsid[] = #include "options.h" #include "writebsp.h" +/** \addtogroup qfbsp_writebsp +*/ +//@{ + int headclipnode; int firstface; @@ -497,3 +501,5 @@ FinishBSPFile (void) WriteBSPFile (bsp, f); Qclose (f); } + +//@} From d90a630b0478cfd8db394fc9c723618b604e0925 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 1 Sep 2010 11:54:38 +0900 Subject: [PATCH 041/115] Call AddAnimatingTextures only once rather than for every wad file. --- tools/qfbsp/source/writebsp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/qfbsp/source/writebsp.c b/tools/qfbsp/source/writebsp.c index beee386bb..942fb98b1 100644 --- a/tools/qfbsp/source/writebsp.c +++ b/tools/qfbsp/source/writebsp.c @@ -436,8 +436,6 @@ WriteMiptex (void) if (res == -1) Sys_Error ("couldn't open %s[.gz]", wad); - AddAnimatingTextures (); - wad = w; if (!wad || !*wad) break; @@ -448,6 +446,8 @@ WriteMiptex (void) free (wad_list); dstring_delete (fullpath); + AddAnimatingTextures (); + data = dstring_new (); data->size = sizeof (dmiptexlump_t); dstring_adjust (data); From 08c6a185ada3b4fff63beab57bdff4240ec4f2fa Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 1 Sep 2010 12:06:37 +0900 Subject: [PATCH 042/115] Documentation for writebsp. --- tools/qfbsp/include/writebsp.h | 37 +++++++++++++++++++++ tools/qfbsp/source/writebsp.c | 59 +++++++++++++++++++++++++--------- 2 files changed, 80 insertions(+), 16 deletions(-) diff --git a/tools/qfbsp/include/writebsp.h b/tools/qfbsp/include/writebsp.h index 58ac5fc77..04ff211e0 100644 --- a/tools/qfbsp/include/writebsp.h +++ b/tools/qfbsp/include/writebsp.h @@ -32,14 +32,51 @@ struct node_s; +/** Write the planes of the map bsp to the bsp file. + + \param headnode The root of the map bsp. +*/ void WriteNodePlanes (struct node_s *headnode); + +/** Write the clip nodes to the bsp file. + + \param headnode The root of the map bsp. +*/ void WriteClipNodes (struct node_s *headnode); + +/** Write the draw nodes and the model information to the bsp file. + + \param headnode The root of the map bsp. +*/ void WriteDrawNodes (struct node_s *headnode); +/** Write the model information for the clipping hull. + + \param hullnum The number of this clipping hull. +*/ void BumpModel (int hullnum); + +/** Add a plane to the bsp. + + If the plane already exists in the bsp, return the number of the existing + plane rather than adding a new one. + + \param p The plane to add to the bsp. + \return The plane number within the bsp. +*/ int FindFinalPlane (dplane_t *p); +/** Prepare the bsp file for writing. + + Write a null edge and leaf for edge 0 and leaf 0. +*/ void BeginBSPFile (void); + +/** Finalize the bsp file. + + Writes the miptex data to the bsp file and then writes the bsp file to + the file system. +*/ void FinishBSPFile (void); //@} diff --git a/tools/qfbsp/source/writebsp.c b/tools/qfbsp/source/writebsp.c index 942fb98b1..c8455bd1d 100644 --- a/tools/qfbsp/source/writebsp.c +++ b/tools/qfbsp/source/writebsp.c @@ -53,11 +53,6 @@ int headclipnode; int firstface; -/* - FindFinalPlane - - Used to find plane index numbers for clip nodes read from child processes -*/ int FindFinalPlane (dplane_t *p) { @@ -84,6 +79,13 @@ FindFinalPlane (dplane_t *p) int planemapping[MAX_MAP_PLANES]; +/** Recursively write the nodes' planes to the bsp file. + + If the plane has already been written, do not write it again. Set the + node's output plane number. + + \param node The current node of which to write the plane. +*/ static void WriteNodePlanes_r (node_t *node) { @@ -116,6 +118,12 @@ WriteNodePlanes (node_t *nodes) WriteNodePlanes_r (nodes); } +/** Recursively write clip nodes to the bsp file. + + \note The node will be freed. + + \param node The node to be written to the bsp file. +*/ static int WriteClipNodes_r (node_t *node) { @@ -140,12 +148,6 @@ WriteClipNodes_r (node_t *node) return c; } -/* - WriteClipNodes - - Called after the clipping hull is completed. Generates a disk format - representation and frees the original memory. -*/ void WriteClipNodes (node_t *nodes) { @@ -153,6 +155,10 @@ WriteClipNodes (node_t *nodes) WriteClipNodes_r (nodes); } +/** Write a leaf node to the bsp file. + + \param node The leaf node to be written to the bsp file. +*/ static void WriteLeaf (node_t *node) { @@ -190,6 +196,10 @@ WriteLeaf (node_t *node) BSP_AddLeaf (bsp, &leaf_p); } +/** Recursively write the draw nodes of the map bsp. + + \param node The current node to be written. +*/ static void WriteDrawNodes_r (node_t *node) { @@ -267,11 +277,6 @@ WriteDrawNodes (node_t *headnode) // FIXME: are all the children decendant of padded nodes? } -/* - BumpModel - - Used by the clipping hull processes that need to store only headclipnode -*/ void BumpModel (int hullnum) { @@ -290,6 +295,9 @@ typedef struct wadlist_s { wadlist_t *wadlist; +/** Load a texture wad file. + \param path The path to the wad file. +*/ static int TEX_InitFromWad (char *path) { @@ -315,6 +323,16 @@ TEX_InitFromWad (char *path) return 0; } +/** Read a lump's data. + + Searches all loaded wad files for the lump. + + \param name The name of the lump for which to search. + \param dest The destination buffer to which the lump's data will be + written. + \return The size of the lump's data or 0 if the lump was not + found. +*/ static int LoadLump (char *name, dstring_t *dest) { @@ -355,6 +373,8 @@ LoadLump (char *name, dstring_t *dest) return 0; } +/** Search loaded miptex for animated textures and load their animations. +*/ static void AddAnimatingTextures (void) { @@ -391,6 +411,13 @@ AddAnimatingTextures (void) printf ("added %i texture frames\n", nummiptex - base); } +/** Write the miptex data to the bsp file. + + The miptex data is read from the wad files specified by the \c wad or + \c _wad key of the world entity. The files are a semi-colon separated list + (this is a QuakeForge extension). The \c wadpath is used to search for the + files. +*/ static void WriteMiptex (void) { From ab70ec2a8f0b784b5b9ad90345fdff1b96b91e2b Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 1 Sep 2010 14:11:24 +0900 Subject: [PATCH 043/115] Sort the group names. --- doc/quakeforge.dox.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/quakeforge.dox.in b/doc/quakeforge.dox.in index f337f0bda..97a012aa5 100644 --- a/doc/quakeforge.dox.in +++ b/doc/quakeforge.dox.in @@ -426,7 +426,7 @@ SORT_MEMBERS_CTORS_1ST = NO # hierarchy of group names into alphabetical order. If set to NO (the default) # the group names will appear in their defined order. -SORT_GROUP_NAMES = NO +SORT_GROUP_NAMES = YES # If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be # sorted by fully-qualified names, including namespaces. If set to From 538956c389996150579f32d3824459bac8361509 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 2 Sep 2010 06:37:13 +0900 Subject: [PATCH 044/115] Make parts of CutNodePortals_r() easier to read. --- tools/qfbsp/source/portals.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/qfbsp/source/portals.c b/tools/qfbsp/source/portals.c index 6f173d077..88459e7aa 100644 --- a/tools/qfbsp/source/portals.c +++ b/tools/qfbsp/source/portals.c @@ -278,7 +278,7 @@ CutNodePortals_r (node_t *node) // create the new portal by taking the full plane winding for the cutting // plane and clipping it by all of the planes from the other portals - w = BaseWindingForPlane (&planes[node->planenum]); + w = BaseWindingForPlane (plane); side = 0; for (p = node->portals; p; p = p->next[side]) { clipplane = planes[p->planenum]; @@ -315,11 +315,12 @@ CutNodePortals_r (node_t *node) side = 1; else Sys_Error ("CutNodePortals_r: mislinked portal"); - next_portal = p->next[side]; + next_portal = p->next[side]; other_node = p->nodes[!side]; - RemovePortalFromNode (p, p->nodes[0]); - RemovePortalFromNode (p, p->nodes[1]); + + RemovePortalFromNode (p, node); + RemovePortalFromNode (p, other_node); // cut the portal into two portals, one on each side of the cut plane DivideWinding (p->winding, plane, &frontwinding, &backwinding); From 16e067c8cb828e189360ccaf7927fab9cc926dbe Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 2 Sep 2010 06:38:13 +0900 Subject: [PATCH 045/115] More portal documentation. --- tools/qfbsp/include/portals.h | 6 ++++++ tools/qfbsp/source/portals.c | 32 ++++++++++++++++++++++---------- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/tools/qfbsp/include/portals.h b/tools/qfbsp/include/portals.h index 68f130fc8..723352352 100644 --- a/tools/qfbsp/include/portals.h +++ b/tools/qfbsp/include/portals.h @@ -25,6 +25,12 @@ /** \defgroup qfbsp_portals Portal Functions \ingroup qfbsp + + A portal is the polygonal interface between two leaf nodes, regardless + of the contents of the two leaf nodes. + + Decision nodes will not have portals on them, though as part of the + portal building process, they will temporarily have portals. */ //@{ diff --git a/tools/qfbsp/source/portals.c b/tools/qfbsp/source/portals.c index 88459e7aa..a15b4e440 100644 --- a/tools/qfbsp/source/portals.c +++ b/tools/qfbsp/source/portals.c @@ -251,6 +251,10 @@ PlaneFromWinding (winding_t *w, plane_t *plane) static int cutnode_detail; +/** Separate the node's portals into its children. + + \param node The current node. +*/ static void CutNodePortals_r (node_t *node) { @@ -264,24 +268,28 @@ CutNodePortals_r (node_t *node) CalcNodeBounds (node); - // seperate the portals on node into it's children - if (node->contents) - return; // at a leaf, no more dividing - - if (node->detail && cutnode_detail) + if (node->contents) { + // at a leaf, no more dividing return; + } + + if (node->detail && cutnode_detail) { + // detail nodes are fake leaf nodes + return; + } plane = &planes[node->planenum]; f = node->children[0]; b = node->children[1]; - // create the new portal by taking the full plane winding for the cutting - // plane and clipping it by all of the planes from the other portals + /// Create a new portal by taking the full plane winding for the node's + /// cutting plane and clipping it by all of the planes from the other + /// portals on the node. w = BaseWindingForPlane (plane); side = 0; for (p = node->portals; p; p = p->next[side]) { - clipplane = planes[p->planenum]; + clipplane = planes[p->planenum]; // COPY the plane if (p->nodes[0] == node) side = 0; else if (p->nodes[1] == node) { @@ -299,7 +307,7 @@ CutNodePortals_r (node_t *node) } if (w) { - // if the plane was not clipped on all sides, there was an error + /// Add the new portal to the node's children. new_portal = AllocPortal (); new_portal->planenum = node->planenum; @@ -307,7 +315,8 @@ CutNodePortals_r (node_t *node) AddPortalToNodes (new_portal, f, b); } - // partition the portals + /// Partition the node's portals by the node's plane, adding each portal's + /// fragments to the node's children. for (p = node->portals; p; p = next_portal) { if (p->nodes[0] == node) side = 0; @@ -319,7 +328,10 @@ CutNodePortals_r (node_t *node) next_portal = p->next[side]; other_node = p->nodes[!side]; + /// Remove each portal from the node. When finished, the node will + /// have no portals on it. RemovePortalFromNode (p, node); + // The fragments will be added back to the other node. RemovePortalFromNode (p, other_node); // cut the portal into two portals, one on each side of the cut plane From f4bff1d3b0492b66e474cb91a967ed34fe8ce4ab Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 2 Sep 2010 13:01:17 +0900 Subject: [PATCH 046/115] Make some code more readable. --- tools/qfbsp/source/qfbsp.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tools/qfbsp/source/qfbsp.c b/tools/qfbsp/source/qfbsp.c index 2c4c26880..c82bad5bd 100644 --- a/tools/qfbsp/source/qfbsp.c +++ b/tools/qfbsp/source/qfbsp.c @@ -304,14 +304,10 @@ ReadClipHull (int hullnum) &c1, &c2) != 7) Sys_Error ("Error parsing %s", options.hullfile); - p.normal[0] = f1; - p.normal[1] = f2; - p.normal[2] = f3; + VectorSet (f1, f2, f3, p.normal); p.dist = f4; - norm[0] = f1; - norm[1] = f2; - norm[2] = f3; // vec_t precision + VectorSet (f1, f2, f3, norm); p.type = PlaneTypeForNormal (norm); d.children[0] = c1 >= 0 ? c1 + firstclipnode : c1; From ef7958d68052606d16dc5a6e637ec57a34e08f94 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 2 Sep 2010 13:01:45 +0900 Subject: [PATCH 047/115] Lots of const correctness. --- include/QF/bspfile.h | 26 +++++++++++++------------- libs/util/bspfile.c | 26 +++++++++++++------------- tools/qfbsp/include/brush.h | 2 +- tools/qfbsp/include/draw.h | 16 ++++++++-------- tools/qfbsp/include/map.h | 6 +++--- tools/qfbsp/include/winding.h | 6 +++--- tools/qfbsp/include/writebsp.h | 4 ++-- tools/qfbsp/source/brush.c | 25 ++++++++++++------------- tools/qfbsp/source/map.c | 12 ++++++------ tools/qfbsp/source/merge.c | 2 +- tools/qfbsp/source/nodraw.c | 16 ++++++++-------- tools/qfbsp/source/outside.c | 18 +++++++++--------- tools/qfbsp/source/portals.c | 19 ++++++++++--------- tools/qfbsp/source/readbsp.c | 16 ++++++++-------- tools/qfbsp/source/solidbsp.c | 11 ++++++----- tools/qfbsp/source/surfaces.c | 6 +++--- tools/qfbsp/source/tjunc.c | 10 +++++----- tools/qfbsp/source/winding.c | 6 +++--- tools/qfbsp/source/writebsp.c | 14 +++++++------- 19 files changed, 121 insertions(+), 120 deletions(-) diff --git a/include/QF/bspfile.h b/include/QF/bspfile.h index e60cc22f7..e0674aed6 100644 --- a/include/QF/bspfile.h +++ b/include/QF/bspfile.h @@ -314,20 +314,20 @@ bsp_t *LoadBSPFile (QFile *file, size_t size); void WriteBSPFile (const bsp_t *bsp, QFile *file); bsp_t *BSP_New (void); void BSP_Free (bsp_t *bsp); -void BSP_AddPlane (bsp_t *bsp, dplane_t *plane); -void BSP_AddLeaf (bsp_t *bsp, dleaf_t *leaf); -void BSP_AddVertex (bsp_t *bsp, dvertex_t *vertex); -void BSP_AddNode (bsp_t *bsp, dnode_t *node); -void BSP_AddTexinfo (bsp_t *bsp, texinfo_t *texinfo); -void BSP_AddFace (bsp_t *bsp, dface_t *face); -void BSP_AddClipnode (bsp_t *bsp, dclipnode_t *clipnode); +void BSP_AddPlane (bsp_t *bsp, const dplane_t *plane); +void BSP_AddLeaf (bsp_t *bsp, const dleaf_t *leaf); +void BSP_AddVertex (bsp_t *bsp, const dvertex_t *vertex); +void BSP_AddNode (bsp_t *bsp, const dnode_t *node); +void BSP_AddTexinfo (bsp_t *bsp, const texinfo_t *texinfo); +void BSP_AddFace (bsp_t *bsp, const dface_t *face); +void BSP_AddClipnode (bsp_t *bsp, const dclipnode_t *clipnode); void BSP_AddMarkSurface (bsp_t *bsp, int marksurface); void BSP_AddSurfEdge (bsp_t *bsp, int surfedge); -void BSP_AddEdge (bsp_t *bsp, dedge_t *edge); -void BSP_AddModel (bsp_t *bsp, dmodel_t *model); -void BSP_AddLighting (bsp_t *bsp, byte *lightdata, size_t lightdatasize); -void BSP_AddVisibility (bsp_t *bsp, byte *visdata, size_t visdatasize); -void BSP_AddEntities (bsp_t *bsp, char *entdata, size_t entdatasize); -void BSP_AddTextures (bsp_t *bsp, byte *texdata, size_t texdatasize); +void BSP_AddEdge (bsp_t *bsp, const dedge_t *edge); +void BSP_AddModel (bsp_t *bsp, const dmodel_t *model); +void BSP_AddLighting (bsp_t *bsp, const byte *lightdata, size_t lightdatasize); +void BSP_AddVisibility (bsp_t *bsp, const byte *visdata, size_t visdatasize); +void BSP_AddEntities (bsp_t *bsp, const char *entdata, size_t entdatasize); +void BSP_AddTextures (bsp_t *bsp, const byte *texdata, size_t texdatasize); #endif//__bspfile_h_ diff --git a/libs/util/bspfile.c b/libs/util/bspfile.c index a0b10c2bb..1d7845dd9 100644 --- a/libs/util/bspfile.c +++ b/libs/util/bspfile.c @@ -402,49 +402,49 @@ BSP_Free (bsp_t *bsp) } while (0) VISIBLE void -BSP_AddPlane (bsp_t *bsp, dplane_t *plane) +BSP_AddPlane (bsp_t *bsp, const dplane_t *plane) { REALLOC (planes); bsp->planes[bsp->numplanes++] = *plane; } VISIBLE void -BSP_AddLeaf (bsp_t *bsp, dleaf_t *leaf) +BSP_AddLeaf (bsp_t *bsp, const dleaf_t *leaf) { REALLOC (leafs); bsp->leafs[bsp->numleafs++] = *leaf; } VISIBLE void -BSP_AddVertex (bsp_t *bsp, dvertex_t *vertex) +BSP_AddVertex (bsp_t *bsp, const dvertex_t *vertex) { REALLOC (vertexes); bsp->vertexes[bsp->numvertexes++] = *vertex; } VISIBLE void -BSP_AddNode (bsp_t *bsp, dnode_t *node) +BSP_AddNode (bsp_t *bsp, const dnode_t *node) { REALLOC (nodes); bsp->nodes[bsp->numnodes++] = *node; } VISIBLE void -BSP_AddTexinfo (bsp_t *bsp, texinfo_t *texinfo) +BSP_AddTexinfo (bsp_t *bsp, const texinfo_t *texinfo) { REALLOC (texinfo); bsp->texinfo[bsp->numtexinfo++] = *texinfo; } VISIBLE void -BSP_AddFace (bsp_t *bsp, dface_t *face) +BSP_AddFace (bsp_t *bsp, const dface_t *face) { REALLOC (faces); bsp->faces[bsp->numfaces++] = *face; } VISIBLE void -BSP_AddClipnode (bsp_t *bsp, dclipnode_t *clipnode) +BSP_AddClipnode (bsp_t *bsp, const dclipnode_t *clipnode) { REALLOC (clipnodes); bsp->clipnodes[bsp->numclipnodes++] = *clipnode; @@ -465,14 +465,14 @@ BSP_AddSurfEdge (bsp_t *bsp, int surfedge) } VISIBLE void -BSP_AddEdge (bsp_t *bsp, dedge_t *edge) +BSP_AddEdge (bsp_t *bsp, const dedge_t *edge) { REALLOC (edges); bsp->edges[bsp->numedges++] = *edge; } VISIBLE void -BSP_AddModel (bsp_t *bsp, dmodel_t *model) +BSP_AddModel (bsp_t *bsp, const dmodel_t *model) { REALLOC (models); bsp->models[bsp->nummodels++] = *model; @@ -485,7 +485,7 @@ BSP_AddModel (bsp_t *bsp, dmodel_t *model) } while (0) VISIBLE void -BSP_AddLighting (bsp_t *bsp, byte *lightdata, size_t lightdatasize) +BSP_AddLighting (bsp_t *bsp, const byte *lightdata, size_t lightdatasize) { OWN (lightdata); bsp->lightdatasize = lightdatasize; @@ -494,7 +494,7 @@ BSP_AddLighting (bsp_t *bsp, byte *lightdata, size_t lightdatasize) } VISIBLE void -BSP_AddVisibility (bsp_t *bsp, byte *visdata, size_t visdatasize) +BSP_AddVisibility (bsp_t *bsp, const byte *visdata, size_t visdatasize) { OWN (visdata); bsp->visdatasize = visdatasize; @@ -503,7 +503,7 @@ BSP_AddVisibility (bsp_t *bsp, byte *visdata, size_t visdatasize) } VISIBLE void -BSP_AddEntities (bsp_t *bsp, char *entdata, size_t entdatasize) +BSP_AddEntities (bsp_t *bsp, const char *entdata, size_t entdatasize) { OWN (entdata); bsp->entdatasize = entdatasize; @@ -512,7 +512,7 @@ BSP_AddEntities (bsp_t *bsp, char *entdata, size_t entdatasize) } VISIBLE void -BSP_AddTextures (bsp_t *bsp, byte *texdata, size_t texdatasize) +BSP_AddTextures (bsp_t *bsp, const byte *texdata, size_t texdatasize) { OWN (texdata); bsp->texdatasize = texdatasize; diff --git a/tools/qfbsp/include/brush.h b/tools/qfbsp/include/brush.h index 7c60f4a67..61b51b223 100644 --- a/tools/qfbsp/include/brush.h +++ b/tools/qfbsp/include/brush.h @@ -77,7 +77,7 @@ int PlaneTypeForNormal (const vec3_t normal); \param side The side of the plane that will be front. \return global plane number. */ -int FindPlane (plane_t *dplane, int *side); +int FindPlane (const plane_t *dplane, int *side); //@} diff --git a/tools/qfbsp/include/draw.h b/tools/qfbsp/include/draw.h index 9f9e6941d..2ba109fd3 100644 --- a/tools/qfbsp/include/draw.h +++ b/tools/qfbsp/include/draw.h @@ -37,22 +37,22 @@ struct brush_s; struct winding_s; void Draw_ClearBounds (void); -void Draw_AddToBounds (vec3_t v); -void Draw_DrawFace (struct visfacet_s *f); +void Draw_AddToBounds (const vec3_t v); +void Draw_DrawFace (const struct visfacet_s *f); void Draw_ClearWindow (void); void Draw_SetRed (void); void Draw_SetGrey (void); void Draw_SetBlack (void); -void DrawPoint (vec3_t v); +void DrawPoint (const vec3_t v); void Draw_SetColor (int c); void SetColor (int c); -void DrawPortal (struct portal_s *p); -void DrawLeaf (struct node_s *l, int color); -void DrawBrush (struct brush_s *b); +void DrawPortal (const struct portal_s *p); +void DrawLeaf (const struct node_s *l, int color); +void DrawBrush (const struct brush_s *b); -void DrawWinding (struct winding_s *w); -void DrawTri (vec3_t p1, vec3_t p2, vec3_t p3); +void DrawWinding (const struct winding_s *w); +void DrawTri (const vec3_t p1, const vec3_t p2, const vec3_t p3); //@} diff --git a/tools/qfbsp/include/map.h b/tools/qfbsp/include/map.h index 0b1f0ddc8..dbaf3469d 100644 --- a/tools/qfbsp/include/map.h +++ b/tools/qfbsp/include/map.h @@ -89,7 +89,7 @@ int FindMiptex (const char *name); \param ent The entity to dump. */ -void PrintEntity (entity_t *ent); +void PrintEntity (const entity_t *ent); /** Get the value for the specified key from an entity. @@ -98,7 +98,7 @@ void PrintEntity (entity_t *ent); \return The value for the key, or the empty string if the key does not exist in this entity. */ -const char *ValueForKey (entity_t *ent, const char *key); +const char *ValueForKey (const entity_t *ent, const char *key); /** Set the value of the entity's key. If the key does not exist, one will be added. @@ -114,7 +114,7 @@ void SetKeyValue (entity_t *ent, const char *key, const char *value); \param key The key of wich to parse the vector value. \param vec The destination of the vector value. */ -void GetVectorForKey (entity_t *ent, const char *key, vec3_t vec); +void GetVectorForKey (const entity_t *ent, const char *key, vec3_t vec); /** Write all valid entities to the bsp file. diff --git a/tools/qfbsp/include/winding.h b/tools/qfbsp/include/winding.h index cbfab732b..4faae3552 100644 --- a/tools/qfbsp/include/winding.h +++ b/tools/qfbsp/include/winding.h @@ -45,7 +45,7 @@ typedef struct winding_s { \return The new winding. \note It is the caller's responsibiltiy to free the new winding. */ -winding_t *BaseWindingForPlane (struct plane_s *p); +winding_t *BaseWindingForPlane (const struct plane_s *p); /** Create a new, empty winding with. @@ -67,7 +67,7 @@ void FreeWinding (winding_t *w); \return The new winding. \note It is the caller's responsibiltiy to free the new winding. */ -winding_t *CopyWinding (winding_t *w); +winding_t *CopyWinding (const winding_t *w); /** Create a new winding with the reverse points of the given winding. @@ -75,7 +75,7 @@ winding_t *CopyWinding (winding_t *w); \return The new winding. \note It is the caller's responsibiltiy to free the new winding. */ -winding_t *CopyWindingReverse (winding_t *w); +winding_t *CopyWindingReverse (const winding_t *w); /** Clip the winding to the plain. diff --git a/tools/qfbsp/include/writebsp.h b/tools/qfbsp/include/writebsp.h index 04ff211e0..111c9ff20 100644 --- a/tools/qfbsp/include/writebsp.h +++ b/tools/qfbsp/include/writebsp.h @@ -48,7 +48,7 @@ void WriteClipNodes (struct node_s *headnode); \param headnode The root of the map bsp. */ -void WriteDrawNodes (struct node_s *headnode); +void WriteDrawNodes (const struct node_s *headnode); /** Write the model information for the clipping hull. @@ -64,7 +64,7 @@ void BumpModel (int hullnum); \param p The plane to add to the bsp. \return The plane number within the bsp. */ -int FindFinalPlane (dplane_t *p); +int FindFinalPlane (const dplane_t *p); /** Prepare the bsp file for writing. diff --git a/tools/qfbsp/source/brush.c b/tools/qfbsp/source/brush.c index ad43effb1..ac0555ca8 100644 --- a/tools/qfbsp/source/brush.c +++ b/tools/qfbsp/source/brush.c @@ -67,7 +67,7 @@ AllocBrush (void) Note: this will not catch 0 area polygons */ static void -CheckFace (face_t *f) +CheckFace (const face_t *f) { int i, j; vec_t *p1, *p2; @@ -91,8 +91,7 @@ CheckFace (face_t *f) j = i + 1 == f->points->numpoints ? 0 : i + 1; // check the point is on the face plane - d = DotProduct (p1, planes[f->planenum].normal) - - planes[f->planenum].dist; + d = PlaneDiff (p1, &planes[f->planenum]); // point off plane autofix if (d < -ON_EPSILON || d > ON_EPSILON) @@ -137,7 +136,7 @@ ClearBounds (brushset_t *bs) } static void -AddToBounds (brushset_t *bs, vec3_t v) +AddToBounds (brushset_t *bs, const vec3_t v) { int i; @@ -245,7 +244,7 @@ NormalizePlane (plane_t *dp) } int -FindPlane (plane_t *dplane, int *side) +FindPlane (const plane_t *dplane, int *side) { int i; plane_t *dp, pl; @@ -437,7 +436,7 @@ int num_hull_edges; int hull_edges[MAX_HULL_EDGES][2]; static void -AddBrushPlane (plane_t *plane) +AddBrushPlane (const plane_t *plane) { float l; int i; @@ -467,7 +466,7 @@ AddBrushPlane (plane_t *plane) vertexes can be put on the front side */ static void -TestAddPlane (plane_t *plane) +TestAddPlane (const plane_t *plane) { int c, i; int counts[3]; @@ -523,7 +522,7 @@ TestAddPlane (plane_t *plane) Doesn't add if duplicated */ static int -AddHullPoint (vec3_t p, int hullnum) +AddHullPoint (const vec3_t p, int hullnum) { int i, x, y, z; vec_t *c; @@ -559,7 +558,7 @@ AddHullPoint (vec3_t p, int hullnum) Creates all of the hull planes around the given edge, if not done already */ static void -AddHullEdge (vec3_t p1, vec3_t p2, int hullnum) +AddHullEdge (const vec3_t p1, const vec3_t p2, int hullnum) { int pt1, pt2, a, b, c, d, e, i; plane_t plane; @@ -662,12 +661,12 @@ ExpandBrush (int hullnum) Converts a mapbrush to a bsp brush */ static brush_t * -LoadBrush (mbrush_t *mb, int hullnum) +LoadBrush (const mbrush_t *mb, int hullnum) { brush_t *b; - char *name; + const char *name; int contents; - mface_t *f; + const mface_t *f; // check texture name for attributes if (mb->faces->texinfo < 0) { @@ -738,7 +737,7 @@ LoadBrush (mbrush_t *mb, int hullnum) } static void -Brush_DrawAll (brushset_t *bs) +Brush_DrawAll (const brushset_t *bs) { brush_t *b; face_t *f; diff --git a/tools/qfbsp/source/map.c b/tools/qfbsp/source/map.c index 84083f157..069aba3c2 100644 --- a/tools/qfbsp/source/map.c +++ b/tools/qfbsp/source/map.c @@ -516,9 +516,9 @@ LoadMapFile (const char *filename) } void -PrintEntity (entity_t *ent) +PrintEntity (const entity_t *ent) { - epair_t *ep; + const epair_t *ep; for (ep = ent->epairs; ep; ep = ep->next) printf ("%20s : %s\n", ep->key, ep->value); @@ -526,9 +526,9 @@ PrintEntity (entity_t *ent) const char * -ValueForKey (entity_t *ent, const char *key) +ValueForKey (const entity_t *ent, const char *key) { - epair_t *ep; + const epair_t *ep; for (ep = ent->epairs; ep; ep = ep->next) if (!strcmp (ep->key, key)) @@ -555,7 +555,7 @@ SetKeyValue (entity_t *ent, const char *key, const char *value) } void -GetVectorForKey (entity_t *ent, const char *key, vec3_t vec) +GetVectorForKey (const entity_t *ent, const char *key, vec3_t vec) { const char *k; double v1, v2, v3; @@ -573,7 +573,7 @@ void WriteEntitiesToString (void) { dstring_t *buf; - epair_t *ep; + const epair_t *ep; int i; buf = dstring_newstr (); diff --git a/tools/qfbsp/source/merge.c b/tools/qfbsp/source/merge.c index 0a6d42833..91a21e8f5 100644 --- a/tools/qfbsp/source/merge.c +++ b/tools/qfbsp/source/merge.c @@ -220,7 +220,7 @@ MergePlaneFaces (surface_t *plane) } void -MergeAll (surface_t * surfhead) +MergeAll (surface_t *surfhead) { face_t *f; int mergefaces; diff --git a/tools/qfbsp/source/nodraw.c b/tools/qfbsp/source/nodraw.c index f202df80d..de0aaad7b 100644 --- a/tools/qfbsp/source/nodraw.c +++ b/tools/qfbsp/source/nodraw.c @@ -37,12 +37,12 @@ Draw_ClearBounds (void) } void -Draw_AddToBounds (vec3_t v) +Draw_AddToBounds (const vec3_t v) { } void -Draw_DrawFace (struct visfacet_s *f) +Draw_DrawFace (const struct visfacet_s *f) { } @@ -67,32 +67,32 @@ Draw_SetBlack (void) } void -DrawPoint (vec3_t v) +DrawPoint (const vec3_t v) { } void -DrawLeaf (struct node_s *l, int color) +DrawLeaf (const struct node_s *l, int color) { } void -DrawBrush (struct brush_s *b) +DrawBrush (const struct brush_s *b) { } void -DrawWinding (struct winding_s *w) +DrawWinding (const struct winding_s *w) { } void -DrawTri (vec3_t p1, vec3_t p2, vec3_t p3) +DrawTri (const vec3_t p1, const vec3_t p2, const vec3_t p3) { } void -DrawPortal (struct portal_s *portal) +DrawPortal (const struct portal_s *portal) { } diff --git a/tools/qfbsp/source/outside.c b/tools/qfbsp/source/outside.c index c2479303b..08ea2e8d8 100644 --- a/tools/qfbsp/source/outside.c +++ b/tools/qfbsp/source/outside.c @@ -46,7 +46,7 @@ int outleafs; \return The leaf node in which the point is. */ static node_t * -PointInLeaf (node_t *node, vec3_t point) +PointInLeaf (node_t *node, const vec3_t point) { vec_t d; @@ -98,7 +98,7 @@ FloodEntDist_r (node_t *n, int dist) \return true if the entity could be placed, false otherwise. */ static qboolean -PlaceOccupant (int num, vec3_t point, node_t *headnode) +PlaceOccupant (int num, const vec3_t point, node_t *headnode) { node_t *n; @@ -112,7 +112,7 @@ PlaceOccupant (int num, vec3_t point, node_t *headnode) return true; } -portal_t *prevleaknode; +const portal_t *prevleaknode; FILE *leakfile; /** Write the coords for points joining two portals to the point file. @@ -121,11 +121,11 @@ FILE *leakfile; \note The first portal is set by the preceeding call. */ static void -MarkLeakTrail (portal_t *n2) +MarkLeakTrail (const portal_t *n2) { float len; int i, j; - portal_t *n1; + const portal_t *n1; vec3_t p1, p2, dir; n1 = prevleaknode; @@ -172,10 +172,10 @@ MarkLeakTrail2 (void) { int i; int next, side; - node_t *n, *nextnode; - portal_t *p, *p2; + const node_t *n, *nextnode; + const portal_t *p, *p2; vec3_t wc; - vec_t *v; + const vec_t *v; leakfile = fopen (options.pointfile, "w"); if (!leakfile) @@ -238,7 +238,7 @@ RecursiveFillOutside (node_t *l, qboolean fill) return false; if (l->occupied) { - vec_t *v; + const vec_t *v; hit_occupied = l->occupied; v = entities[hit_occupied].origin; qprintf ("reached occupant at: (%4.0f,%4.0f,%4.0f) %s\n", v[0], v[1], diff --git a/tools/qfbsp/source/portals.c b/tools/qfbsp/source/portals.c index a15b4e440..f150718c6 100644 --- a/tools/qfbsp/source/portals.c +++ b/tools/qfbsp/source/portals.c @@ -237,7 +237,7 @@ MakeHeadnodePortals (node_t *node) \param plane The plane to set. */ static void -PlaneFromWinding (winding_t *w, plane_t *plane) +PlaneFromWinding (const winding_t *w, plane_t *plane) { vec3_t v1, v2; @@ -432,7 +432,7 @@ int num_realleafs; \return 1 if the node has the specified contents, otherwise 0. */ static int -HasContents (node_t *n, int cont) +HasContents (const node_t *n, int cont) { if (n->contents == cont) return 1; @@ -449,7 +449,7 @@ HasContents (node_t *n, int cont) \param n2 The second node to check. */ static int -ShareContents (node_t *n1, node_t *n2) +ShareContents (const node_t *n1, const node_t *n2) { if (n1->contents) { if (n1->contents == CONTENTS_SOLID) @@ -471,7 +471,7 @@ ShareContents (node_t *n1, node_t *n2) \param n2 The second node to check. */ static int -SameContents (node_t *n1, node_t *n2) +SameContents (const node_t *n1, const node_t *n2) { if (n1->contents == CONTENTS_SOLID || n2->contents == CONTENTS_SOLID) return 0; @@ -494,12 +494,13 @@ SameContents (node_t *n1, node_t *n2) \param node The current node of the bsp. Call with the root node. */ static void -WritePortalFile_r (node_t *node) +WritePortalFile_r (const node_t *node) { int i; - plane_t *pl, plane2; - portal_t *p; - winding_t *w; + const plane_t *pl; + plane_t plane2; + const portal_t *p; + const winding_t *w; if (!node->contents && !node->detail) { WritePortalFile_r (node->children[0]); @@ -547,7 +548,7 @@ WritePortalFile_r (node_t *node) \param n The current node of the bsp. Call with the root node. */ static void -WritePortalLeafs_r (node_t *n) +WritePortalLeafs_r (const node_t *n) { if (!n->contents) { WritePortalLeafs_r (n->children[0]); diff --git a/tools/qfbsp/source/readbsp.c b/tools/qfbsp/source/readbsp.c index b37b73b97..f063b65c5 100644 --- a/tools/qfbsp/source/readbsp.c +++ b/tools/qfbsp/source/readbsp.c @@ -104,7 +104,7 @@ load_edges (void) static void load_planes (void) { - dplane_t *p; + const dplane_t *p; int i; memset (planes, 0, sizeof (planes)); @@ -126,7 +126,7 @@ load_marksurfaces (void) static void load_faces (void) { - dface_t *f; + const dface_t *f; int i, j; winding_t *points; @@ -164,7 +164,7 @@ load_vertices (void) static void load_leafs (void) { - dleaf_t *l; + const dleaf_t *l; int i, j; leafs = calloc (bsp->numleafs, sizeof (node_t)); @@ -186,7 +186,7 @@ load_leafs (void) static void load_nodes (void) { - dnode_t *n; + const dnode_t *n; face_t *f; int i, j; @@ -373,10 +373,10 @@ unique_name (wad_t *wad, const char *name) void extract_textures (void) { - dmiptexlump_t *miptexlump = (dmiptexlump_t *) bsp->texdata; + const dmiptexlump_t *miptexlump = (dmiptexlump_t *) bsp->texdata; miptex_t *miptex; int i, mtsize, pixels; - char *wadfile; + const char *wadfile; wad_t *wad; const char *uname; @@ -409,7 +409,7 @@ extract_textures (void) void extract_entities (void) { - char *entfile; + const char *entfile; int i; QFile *ef; @@ -431,7 +431,7 @@ void extract_hull (void) { // hullfile = output_file (".c"); - char *hullfile; + const char *hullfile; int i, j; QFile *hf; diff --git a/tools/qfbsp/source/solidbsp.c b/tools/qfbsp/source/solidbsp.c index eba71795f..d0ff65c96 100644 --- a/tools/qfbsp/source/solidbsp.c +++ b/tools/qfbsp/source/solidbsp.c @@ -66,12 +66,12 @@ qboolean usemidsplit; */ static int -FaceSide (face_t *in, plane_t *split) +FaceSide (const face_t *in, const plane_t *split) { int frontcount, backcount, i; vec_t dot; - vec_t *p; - winding_t *inp = in->points; + const vec_t *p; + const winding_t *inp = in->points; frontcount = backcount = 0; @@ -126,7 +126,8 @@ FaceSide (face_t *in, plane_t *split) \return The chosen surface. */ static surface_t * -ChooseMidPlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs) +ChooseMidPlaneFromList (surface_t *surfaces, + const vec3_t mins, const vec3_t maxs) { int j, l; plane_t *plane; @@ -190,7 +191,7 @@ ChooseMidPlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs) not be found. */ static surface_t * -ChoosePlaneFromList (surface_t *surfaces, vec3_t mins, vec3_t maxs, +ChoosePlaneFromList (surface_t *surfaces, const vec3_t mins, const vec3_t maxs, qboolean usefloors, qboolean usedetail) { face_t *f; diff --git a/tools/qfbsp/source/surfaces.c b/tools/qfbsp/source/surfaces.c index cef2f4049..644438305 100644 --- a/tools/qfbsp/source/surfaces.c +++ b/tools/qfbsp/source/surfaces.c @@ -252,7 +252,7 @@ InitHash (void) \return The hash value of the vector. */ static unsigned -HashVec (vec3_t vec) +HashVec (const vec3_t vec) { unsigned h; @@ -269,7 +269,7 @@ HashVec (vec3_t vec) \param planenum The plane on which this vertex is. */ static int -GetVertex (vec3_t in, int planenum) +GetVertex (const vec3_t in, int planenum) { hashvert_t *hv; int h, i; @@ -343,7 +343,7 @@ int c_tryedges; be negative, indicating the ends of the edge are reversed. */ static int -GetEdge (vec3_t p1, vec3_t p2, face_t *f) +GetEdge (const vec3_t p1, const vec3_t p2, face_t *f) { dedge_t edge; int v1, v2, i; diff --git a/tools/qfbsp/source/tjunc.c b/tools/qfbsp/source/tjunc.c index ba7e34b6d..0a831d609 100644 --- a/tools/qfbsp/source/tjunc.c +++ b/tools/qfbsp/source/tjunc.c @@ -77,7 +77,7 @@ static vec3_t hash_min, hash_scale; \param maxs The maximum of the bounding box in which the edges reside. */ static void -InitHash (vec3_t mins, vec3_t maxs) +InitHash (const vec3_t mins, const vec3_t maxs) { int newsize[2]; vec3_t size; @@ -106,7 +106,7 @@ InitHash (vec3_t mins, vec3_t maxs) \return The hash value of the vector. */ static unsigned -HashVec (vec3_t vec) +HashVec (const vec3_t vec) { unsigned h; @@ -178,7 +178,7 @@ CanonicalVector (vec3_t vec) point is represented by t1 and t2. */ static wedge_t * -FindEdge (vec3_t p1, vec3_t p2, vec_t *t1, vec_t *t2) +FindEdge (const vec3_t p1, const vec3_t p2, vec_t *t1, vec_t *t2) { int h; vec3_t dir, origin; @@ -276,7 +276,7 @@ AddVert (wedge_t *w, vec_t t) \param p2 The second point of the face's edge. */ static void -AddEdge (vec3_t p1, vec3_t p2) +AddEdge (const vec3_t p1, const vec3_t p2) { wedge_t *w; vec_t t1, t2; @@ -292,7 +292,7 @@ AddEdge (vec3_t p1, vec3_t p2) \param f The face from which to add the faces. */ static void -AddFaceEdges (face_t *f) +AddFaceEdges (const face_t *f) { int i, j; diff --git a/tools/qfbsp/source/winding.c b/tools/qfbsp/source/winding.c index bb6dc156f..b087e69cb 100644 --- a/tools/qfbsp/source/winding.c +++ b/tools/qfbsp/source/winding.c @@ -47,7 +47,7 @@ static __attribute__ ((used)) const char rcsid[] = int c_activewindings, c_peakwindings; winding_t * -BaseWindingForPlane (plane_t *p) +BaseWindingForPlane (const plane_t *p) { int i, x; vec_t max, v; @@ -111,7 +111,7 @@ BaseWindingForPlane (plane_t *p) } winding_t * -CopyWinding (winding_t *w) +CopyWinding (const winding_t *w) { size_t size; winding_t *c; @@ -123,7 +123,7 @@ CopyWinding (winding_t *w) } winding_t * -CopyWindingReverse (winding_t *w) +CopyWindingReverse (const winding_t *w) { int i; size_t size; diff --git a/tools/qfbsp/source/writebsp.c b/tools/qfbsp/source/writebsp.c index c8455bd1d..a5aeddfc9 100644 --- a/tools/qfbsp/source/writebsp.c +++ b/tools/qfbsp/source/writebsp.c @@ -54,9 +54,9 @@ int firstface; int -FindFinalPlane (dplane_t *p) +FindFinalPlane (const dplane_t *p) { - dplane_t *dplane; + const dplane_t *dplane; int i; for (i = 0, dplane = bsp->planes; i < bsp->numplanes; i++, dplane++) { @@ -160,7 +160,7 @@ WriteClipNodes (node_t *nodes) \param node The leaf node to be written to the bsp file. */ static void -WriteLeaf (node_t *node) +WriteLeaf (const node_t *node) { dleaf_t leaf_p; face_t **fp, *f; @@ -201,7 +201,7 @@ WriteLeaf (node_t *node) \param node The current node to be written. */ static void -WriteDrawNodes_r (node_t *node) +WriteDrawNodes_r (const node_t *node) { static dnode_t dummy; dnode_t *n; @@ -239,7 +239,7 @@ WriteDrawNodes_r (node_t *node) } void -WriteDrawNodes (node_t *headnode) +WriteDrawNodes (const node_t *headnode) { dmodel_t bm; int start, i; @@ -299,7 +299,7 @@ wadlist_t *wadlist; \param path The path to the wad file. */ static int -TEX_InitFromWad (char *path) +TEX_InitFromWad (const char *path) { wadlist_t *wl; wad_t *wad; @@ -334,7 +334,7 @@ TEX_InitFromWad (char *path) found. */ static int -LoadLump (char *name, dstring_t *dest) +LoadLump (const char *name, dstring_t *dest) { int r; int ofs = dest->size; From 985c27b52d20c73887a08527e6359ffc25d6dda1 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 12 Oct 2010 19:33:27 +0900 Subject: [PATCH 048/115] Some more brush documentation. --- tools/qfbsp/include/brush.h | 6 ++++++ tools/qfbsp/source/brush.c | 27 +++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/tools/qfbsp/include/brush.h b/tools/qfbsp/include/brush.h index 61b51b223..492ec56e2 100644 --- a/tools/qfbsp/include/brush.h +++ b/tools/qfbsp/include/brush.h @@ -58,6 +58,12 @@ extern plane_t planes[MAX_MAP_PLANES]; */ brush_t *AllocBrush (void); +/** Load the brushes from the entity. + + \param ent The entity from which to load the brushes. + \param hullnum The number of the hull for which to load the brushes. + \return The brush set holding the brushes loaded from the entity. +*/ brushset_t *Brush_LoadEntity (entity_t *ent, int hullnum); /** Determine the primary axis of the normal. diff --git a/tools/qfbsp/source/brush.c b/tools/qfbsp/source/brush.c index ac0555ca8..24c5d07f0 100644 --- a/tools/qfbsp/source/brush.c +++ b/tools/qfbsp/source/brush.c @@ -61,10 +61,11 @@ AllocBrush (void) return b; } -/* - CheckFace +/** Check the face for validity. - Note: this will not catch 0 area polygons + \param f The face to check. + + \note Does not catch 0 area polygons. */ static void CheckFace (const face_t *f) @@ -123,18 +124,28 @@ CheckFace (const face_t *f) } } +/** Initialize the bounding box of the brush set. + + \param bs The brush set of which to initialize the bounding box. +*/ static void ClearBounds (brushset_t *bs) { int i, j; - for (j = 0; j < NUM_HULLS; j++) + for (j = 0; j < NUM_HULLS; j++) { for (i = 0; i < 3; i++) { bs->mins[i] = BOGUS_RANGE; bs->maxs[i] = -BOGUS_RANGE; } + } } +/** Grow the bounding box of the brush set to include the vector. + + \param bs The brush set of which to grown the bounding box. + \param v The vector to be included in the bounding box. +*/ static void AddToBounds (brushset_t *bs, const vec3_t v) { @@ -289,6 +300,11 @@ FindPlane (const plane_t *dplane, int *side) vec3_t brush_mins, brush_maxs; face_t *brush_faces; +/** Find the entity with the matching target name. + + \param targetname The target name for which to search. + \return The matching entity or NULL if not found. +*/ static entity_t * FindTargetEntity (const char *targetname) { @@ -302,6 +318,9 @@ FindTargetEntity (const char *targetname) } #define ZERO_EPSILON 0.001 + +/** Create the faces of the active brush. +*/ static void CreateBrushFaces (void) { From ff49239500f6609214bb9d6cff1bf72382947180 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 16 Oct 2010 14:17:09 +0900 Subject: [PATCH 049/115] Fix shared config files. We've allowed a single level of parent directy access in quake path names for a long time, but this got broken by qfs_expand_path. Thus, make qfs_expand_path allow a certain number of parent directory levels (usually 0 or 1). --- libs/util/quakefs.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libs/util/quakefs.c b/libs/util/quakefs.c index 20808d751..56fd499c4 100644 --- a/libs/util/quakefs.c +++ b/libs/util/quakefs.c @@ -630,7 +630,8 @@ qfs_contains_updir (const char *path, int levels) } static int -qfs_expand_path (dstring_t *full_path, const char *base, const char *path) +qfs_expand_path (dstring_t *full_path, const char *base, const char *path, + int levels) { const char *separator = "/"; char *cpath; @@ -641,7 +642,7 @@ qfs_expand_path (dstring_t *full_path, const char *base, const char *path) return -1; } cpath = QFS_CompressPath (path); - if (qfs_contains_updir (cpath, 0)) { + if (qfs_contains_updir (cpath, levels)) { free (cpath); errno = EACCES; return -1; @@ -659,7 +660,7 @@ qfs_expand_path (dstring_t *full_path, const char *base, const char *path) static int qfs_expand_userpath (dstring_t *full_path, const char *path) { - return qfs_expand_path (full_path, qfs_userpath, path); + return qfs_expand_path (full_path, qfs_userpath, path, 0); } VISIBLE char * @@ -841,7 +842,7 @@ open_file (searchpath_t *search, const char *filename, QFile **gzfile, // check a file in the directory tree dstring_t *netpath = dstring_new (); - if (qfs_expand_path (netpath, search->filename, filename) == 0) { + if (qfs_expand_path (netpath, search->filename, filename, 1) == 0) { if (foundname) { dstring_clearstr (foundname); dstring_appendstr (foundname, filename); @@ -1180,7 +1181,7 @@ qfs_add_gamedir (const char *dir) if (s != e) { dsprintf (s_dir, "%.*s", (int) (e - s), s); if (strcmp (s_dir->str, fs_userpath->string) != 0) { - if (qfs_expand_path (f_dir, s_dir->str, dir) != 0) { + if (qfs_expand_path (f_dir, s_dir->str, dir, 0) != 0) { Sys_Printf ("dropping bad directory %s\n", dir); break; } From 98fa427456bdab4d794e9d62c7946f4569343327 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 16 Oct 2010 16:16:58 +0900 Subject: [PATCH 050/115] Add the extract-hull option to the usage output. --- tools/qfbsp/source/options.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/qfbsp/source/options.c b/tools/qfbsp/source/options.c index cbc040a63..71b3ab1c6 100644 --- a/tools/qfbsp/source/options.c +++ b/tools/qfbsp/source/options.c @@ -110,6 +110,7 @@ usage (int status) " -c, --noclip\n" " -e, --onlyents\n" " -p, --portal\n" + " --extract-hull\n" " --extract-textures\n" " --extract-entities\n" " -u, --usehulls Use the existing hull files\n" From 0c4b2f9e19b231ddb4adf8ec242fe76a84187f9c Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 16 Oct 2010 22:09:18 +0900 Subject: [PATCH 051/115] Add the default extension when no output file is specified. --- tools/qfbsp/source/readbsp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/qfbsp/source/readbsp.c b/tools/qfbsp/source/readbsp.c index f063b65c5..59701f45b 100644 --- a/tools/qfbsp/source/readbsp.c +++ b/tools/qfbsp/source/readbsp.c @@ -263,6 +263,7 @@ output_file (const char *ext) } else { dstring_copystr (name, options.bspfile); QFS_StripExtension (name->str, name->str); + QFS_DefaultExtension (name, ext); } return dstring_freeze (name); } From 2ef291bf46c9a80010b40a3e6541e42ca46d7f8b Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 18 Oct 2010 17:53:04 +0900 Subject: [PATCH 052/115] Make mdl.py work on 64 bit machines. --- tools/misc/mdl.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/misc/mdl.py b/tools/misc/mdl.py index 3b05028ac..00c788316 100644 --- a/tools/misc/mdl.py +++ b/tools/misc/mdl.py @@ -3,7 +3,7 @@ from pprint import * import sys model = open(sys.argv[1],"rb").read() -m = unpack ("4s l 3f 3f f 3f i i i i i i i", model[:76]) +m = unpack ("4s i 3f 3f f 3f i i i i i i i", model[:76]) model = model[76:] m = m[0:2] + (m[2:5],) + (m[5:8],) + m[8:9] + (m[9:12],) + m[12:20] if m[1] == 6: @@ -14,13 +14,13 @@ pprint (m) skins = [] s = m[7] * m[8] for i in range(m[6]): - t = unpack ("l", model[:4])[0] + t = unpack ("i", model[:4])[0] model = model[4:] if t == 0: skins.append((t,model[:s])) model = model[s:] else: - n = unpack ("l", model[:4])[0] + n = unpack ("i", model[:4])[0] model = model [4:] print n k = (n, unpack (`n`+"f", model[:n*4]), []) @@ -33,21 +33,21 @@ pprint (skins) stverts = [] for i in range(m[9]): - x = unpack ("l l l", model[:12]) + x = unpack ("i i i", model[:12]) stverts.append ((x[0], x[1:])) model = model [12:] pprint (stverts) tris = [] for i in range(m[10]): - tris.append (unpack ("l l l l", model[:16])) + tris.append (unpack ("i i i i", model[:16])) tris[-1] = (tris[-1][0], tris[-1][1:]) model = model [16:] pprint (tris) frames = [] for i in range (m[11]): - t = unpack ("l", model[:4])[0] + t = unpack ("i", model[:4])[0] model = model[4:] if t==0: if m[1] == 6: @@ -64,7 +64,7 @@ for i in range (m[11]): f[2].append((x[:3], x[3])) frames.append(f) else: - g = (t, unpack ("l 3B B 3B B", model[:12])) + g = (t, unpack ("i 3B B 3B B", model[:12])) model = model[12:] n = g[1][0] g = g + (unpack (`n`+"f", model[:n*4]), []) From e6b783a6166f68bb41b189ef2aa86f1c18ced5d9 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 13 Nov 2010 14:36:33 +0900 Subject: [PATCH 053/115] Don't touch the watchpoint conditional when printing. --- libs/gamecode/engine/pr_debug.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/libs/gamecode/engine/pr_debug.c b/libs/gamecode/engine/pr_debug.c index 2e4be5697..8364afae5 100644 --- a/libs/gamecode/engine/pr_debug.c +++ b/libs/gamecode/engine/pr_debug.c @@ -127,7 +127,7 @@ pr_debug_expression_error (script_t *script, const char *msg) } static pr_type_t * -parse_expression (progs_t *pr, const char *expr) +parse_expression (progs_t *pr, const char *expr, int conditional) { script_t *es; char *e; @@ -165,18 +165,21 @@ parse_expression (progs_t *pr, const char *expr) goto error; expr_ptr = PR_GetPointer (pr, global->ofs); } - pr->wp_conditional = 0; - if (Script_TokenAvailable (es, 1)) { - if (!Script_GetToken (es, 1) && !strequal (es->token->str, "==" )) - goto error; - if (!Script_GetToken (es, 1)) - goto error; - pr->wp_val.integer_var = strtol (es->token->str, &e, 0); - if (e == es->token->str) - goto error; - if (*e == '.' || *e == 'e' || *e == 'E') - pr->wp_val.float_var = strtod (es->token->str, &e); - pr->wp_conditional = 1; + if (conditional) { + pr->wp_conditional = 0; + if (Script_TokenAvailable (es, 1)) { + if (!Script_GetToken (es, 1) + && !strequal (es->token->str, "==" )) + goto error; + if (!Script_GetToken (es, 1)) + goto error; + pr->wp_val.integer_var = strtol (es->token->str, &e, 0); + if (e == es->token->str) + goto error; + if (*e == '.' || *e == 'e' || *e == 'E') + pr->wp_val.float_var = strtod (es->token->str, &e); + pr->wp_conditional = 1; + } } if (Script_TokenAvailable (es, 1)) Sys_Printf ("ignoring tail\n"); @@ -724,7 +727,7 @@ PR_Debug_Watch (progs_t *pr, const char *expr) return; } - pr->watch = parse_expression (pr, expr); + pr->watch = parse_expression (pr, expr, 1); if (pr->watch) { Sys_Printf ("watchpoint set to [%d]\n", PR_SetPointer (pr, pr->watch)); if (pr->wp_conditional) @@ -744,7 +747,7 @@ PR_Debug_Print (progs_t *pr, const char *expr) return; } - print = parse_expression (pr, expr); + print = parse_expression (pr, expr, 0); if (print) { pr_int_t ofs = PR_SetPointer (pr, print); const char *s = global_string (pr, ofs, ev_void, 1); From f63e505c921e46a9cdccc2c86e76e8455d3d7da7 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 14 Nov 2010 19:21:16 +0900 Subject: [PATCH 054/115] Don't realloc the string pointer table. This causes a bit of memory waste, but avoids breaking the pointers in the string hash table. --- libs/gamecode/engine/pr_strings.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libs/gamecode/engine/pr_strings.c b/libs/gamecode/engine/pr_strings.c index e781ce030..bc254067e 100644 --- a/libs/gamecode/engine/pr_strings.c +++ b/libs/gamecode/engine/pr_strings.c @@ -231,8 +231,6 @@ PR_LoadStrings (progs_t *pr) } str += strlen (str) + 1; } - pr->static_strings = realloc (pr->static_strings, - count * sizeof (strref_t)); pr->num_strings = count; return 1; } From 824e33c82b67c5e5d2e18a25150c47135a3bd335 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 14 Nov 2010 19:22:47 +0900 Subject: [PATCH 055/115] Fix a sizeof braino. Somebody (probably me) got a little over-happy with sizeof. --- libs/util/quakeio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libs/util/quakeio.c b/libs/util/quakeio.c index 75667d1b1..6bed472d5 100644 --- a/libs/util/quakeio.c +++ b/libs/util/quakeio.c @@ -216,12 +216,13 @@ Qdopen (int fd, const char *mode) QFile *file; char *m, *p; int zip = 0; + int len = strlen (mode); - m = alloca (strlen (mode) + 1); + m = alloca (len + 1); #ifdef _WIN32 setmode (fd, O_BINARY); #endif - for (p = m; *mode && p - m < ((int) sizeof (m) - 1); mode++) { + for (p = m; *mode && p - m < len; mode++) { if (*mode == 'z') { zip = 1; continue; From 37fb8d22da2cb3e963789bd67c446d3c20369774 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 14 Nov 2010 20:46:29 +0900 Subject: [PATCH 056/115] Don't open a streamed sfx when there's no sound driver. This happens when qf fails to connect to jackd (possibly other times). There is probably a better solution to the problem, but not opening a stream when the sample rate is reported as 0 definitely fixes the inifinite recursion in read_samples(). --- libs/audio/renderer/snd_sfx.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/audio/renderer/snd_sfx.c b/libs/audio/renderer/snd_sfx.c index 2c93f5870..97d06ceb9 100644 --- a/libs/audio/renderer/snd_sfx.c +++ b/libs/audio/renderer/snd_sfx.c @@ -120,6 +120,11 @@ SND_SFX_StreamOpen (sfx_t *sfx, void *file, int frames; int size; + // if the speed is 0, there is no sound driver (probably failed to connect + // to jackd) + if (!snd_shm->speed) + return 0; + sfx_t *new_sfx = calloc (1, sizeof (sfx_t)); new_sfx->name = sfx->name; From 6260130ae587aacbd1d654f98f406ce121bdee9b Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 16 Nov 2010 00:45:48 +0900 Subject: [PATCH 057/115] Fix borked autoconf of dga/vidmode headers. --- libs/video/targets/dga_check.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/video/targets/dga_check.c b/libs/video/targets/dga_check.c index ed5335eb7..76ddc92e5 100644 --- a/libs/video/targets/dga_check.c +++ b/libs/video/targets/dga_check.c @@ -55,7 +55,11 @@ static __attribute__ ((used)) const char rcsid[] = #endif #ifdef HAVE_VIDMODE # include -# include +# ifdef DGA_OLD_HEADERS +# include +# else +# include +# endif #endif #include "QF/sys.h" From 82687d19dbdf05b340c58af2d4d4454597214767 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 16 Nov 2010 00:49:01 +0900 Subject: [PATCH 058/115] Update for git (vs cvs?!?) --- debian/rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/rules b/debian/rules index d34f62b17..75b76aef0 100755 --- a/debian/rules +++ b/debian/rules @@ -38,7 +38,7 @@ configure: configure-stamp configure-stamp: dh_testdir # Add here commands to configure the package. - if test -d CVS; then ./bootstrap; fi + if test -d .git; then ./bootstrap; fi ./configure --prefix=/usr $(RETARGET) --bindir=/usr/games \ --without-fbdev \ --disable-xmms \ @@ -60,7 +60,7 @@ build-stamp: changelog-stamp: dh_testdir # Add here commands to build the changelog - if test -d CVS; then $(MAKE) changelog; fi + if test -d .git; then $(MAKE) changelog; fi touch $@ clean: From f8f54fa91090fa9a84c6b213bfacd7d9e7d404ba Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 16 Nov 2010 00:53:12 +0900 Subject: [PATCH 059/115] Update the build dependencies. --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 87a27c26e..14ebd55f9 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: contrib/games Priority: optional Maintainer: Jeff Teunissen Standards-Version: 3.1.1 -Build-Depends: automake (>= 1.8) | automake1.8, autoconf, libtool, bison, flex, debhelper, libsdl1.2-dev, zlib1g-dev, libncurses5-dev, xorg-dev | xlibs-dev (>= 4), libasound2-dev, libogg-dev, libvorbis-dev, libflac-dev, libpng12-dev +Build-Depends: automake (>= 1.8) | automake1.8, autoconf, libtool, bison, flex, debhelper, libsdl1.2-dev, zlib1g-dev, libncurses5-dev, xorg-dev | xlibs-dev (>= 4), libasound2-dev, libogg-dev, libvorbis-dev, libflac-dev, libpng12-dev, libsamplerate0-dev, git-core, x11proto-xf86vidmode-dev Package: quakeforge Architecture: any From 3b267779856fd2ac9b799525c57203f1a457af1b Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 16 Nov 2010 00:53:44 +0900 Subject: [PATCH 060/115] Get qf debian stable compatible again. Had to backtrack on the libtool version, (and the init line), but I might be able to make it a little nicer later. --- bootstrap | 26 +++++++++++++------------- configure.ac | 5 +++-- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/bootstrap b/bootstrap index 6178ee1c0..c1942cf5f 100755 --- a/bootstrap +++ b/bootstrap @@ -49,15 +49,15 @@ if test -n "$lt" ; then LTIZE_VER_MAJOR=`echo $LTIZE_VER | cut -f1 -d'.'` LTIZE_VER_MINOR=`echo $LTIZE_VER | cut -f2 -d'.' | sed -e 's/[^0-9]//g'` - if test "$LTIZE_VER_MAJOR" -lt "2"; then - errors="Libtool 1.4 or greater needed to build configure.\n$errors" + if test "$LTIZE_VER_MAJOR" -lt "1"; then + errors="Libtool 1.5 or greater needed to build configure.\n$errors" fi - if test "$LTIZE_VER_MAJOR" -eq "2" -a "$LTIZE_VER_MINOR" -lt "2" ; then - errors="Libtool 1.4 or greater needed to build configure.\n$errors" + if test "$LTIZE_VER_MAJOR" -eq "1" -a "$LTIZE_VER_MINOR" -lt "5" ; then + errors="Libtool 1.5 or greater needed to build configure.\n$errors" fi fi else - errors="Libtool not found. QuakeForge CVS requires libtool to bootstrap itself.\n$errors" + errors="Libtool not found. QuakeForge git requires libtool to bootstrap itself.\n$errors" fi # Check Autoconf version @@ -69,15 +69,15 @@ if test -n "$ac" ; then AC_VER_MINOR=`echo $AC_VER | cut -f2 -d'.' | sed 's/[^0-9]*$//'` if test "$AC_VER_MAJOR" -lt "2" ; then - errors="Autoconf 2.67 or greater needed to build configure.\n$errors" + errors="Autoconf 2.61 or greater needed to build configure.\n$errors" fi - if test "$AC_VER_MAJOR" -eq "2" -a "$AC_VER_MINOR" -lt "65" ; then - errors="Autoconf 2.65 or greater needed to build configure.\n$errors" + if test "$AC_VER_MAJOR" -eq "2" -a "$AC_VER_MINOR" -lt "61" ; then + errors="Autoconf 2.61 or greater needed to build configure.\n$errors" fi fi else - errors="Autoconf not found. QuakeForge CVS requires autoconf to bootstrap itself.\n$errors" + errors="Autoconf not found. QuakeForge git requires autoconf to bootstrap itself.\n$errors" fi am=`which automake` @@ -87,14 +87,14 @@ if test -n "$am" ; then AM_VER_MAJOR=`echo $AM_VER | cut -f1 -d.` AM_VER_MINOR=`echo $AM_VER | cut -f2 -d.` if test "$AM_VER_MAJOR" -lt "1"; then - errors="Automake 1.6 or greater needed to build makefiles.\n$errors" + errors="Automake 1.10 or greater needed to build makefiles.\n$errors" fi - if test "$AM_VER_MAJOR" -eq "1" -a "$AM_VER_MINOR" -lt "11"; then - errors="Automake 1.11 or greater needed to build makefiles.\n$errors" + if test "$AM_VER_MAJOR" -eq "1" -a "$AM_VER_MINOR" -lt "10"; then + errors="Automake 1.10 or greater needed to build makefiles.\n$errors" fi fi else - errors="Automake not found. QuakeForge CVS requires automake to bootstrap itself.\n$errors" + errors="Automake not found. QuakeForge git requires automake to bootstrap itself.\n$errors" fi if test -n "$errors" ; then diff --git a/configure.ac b/configure.ac index 643aee1a8..194e526e3 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_PREREQ(2.65) +AC_PREREQ(2.61) dnl This is the only place where the package name and version appear AC_INIT([QuakeForge], [git-master]) @@ -10,7 +10,8 @@ if test "x${CFLAGS-unset}" = xunset; then CFLAGS="" fi saved_CFLAGS="$CFLAGS" -LT_INIT([win32-dll]) +dnl LT_INIT([win32-dll]) +AM_PROG_LIBTOOL CFLAGS="$saved_CFLAGS" AC_REVISION([$Revision$]) dnl From 232d2f7e18b708fc26a9753b20446f7b2818dbd0 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 16 Nov 2010 08:38:27 +0900 Subject: [PATCH 061/115] Fix an undefined operation thanks to spirit of the domain quaddicted.com. --- libs/video/renderer/sw32/draw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/video/renderer/sw32/draw.c b/libs/video/renderer/sw32/draw.c index 36acdf94f..ce84861cb 100644 --- a/libs/video/renderer/sw32/draw.c +++ b/libs/video/renderer/sw32/draw.c @@ -1090,7 +1090,7 @@ Draw_FadeScreen (void) ((byte *) vid.buffer + vid.rowbytes * y); pbuf = (unsigned short *) vid.buffer + (vid.rowbytes >> 1) * y; for (x = 0; x < vid.conwidth; x++) - pbuf[x] = (pbuf[x] >>= 1) & 0x7BEF; + pbuf[x] = (pbuf[x] >> 1) & 0x7BEF; } } break; @@ -1100,7 +1100,7 @@ Draw_FadeScreen (void) unsigned int *pbuf = (unsigned int *) ((byte *) vid.buffer + vid.rowbytes * y); for (x = 0; x < vid.conwidth; x++) - pbuf[x] = (pbuf[x] >>= 1) & 0x7F7F7F7F; + pbuf[x] = (pbuf[x] >> 1) & 0x7F7F7F7F; } } break; From 2f504709dda0374d51454a643d542e7e48f8e536 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 20 Nov 2010 00:31:34 +0900 Subject: [PATCH 062/115] Print data being loaded from an entity. --- libs/gamecode/engine/pr_debug.c | 18 ++++++++++++++++++ libs/gamecode/engine/pr_opcode.c | 22 ++++++++++++---------- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/libs/gamecode/engine/pr_debug.c b/libs/gamecode/engine/pr_debug.c index 8364afae5..9b7ecd846 100644 --- a/libs/gamecode/engine/pr_debug.c +++ b/libs/gamecode/engine/pr_debug.c @@ -882,6 +882,24 @@ PR_PrintStatement (progs_t *pr, dstatement_t *s, int contents) case 'O': str = va ("%04x", addr + (short) opval); break; + case 'E': + { + edict_t *ed; + opval = pr->pr_globals[s->a].entity_var; + parm_ind = pr->pr_globals[s->b].uinteger_var; + if (parm_ind < pr->progs->entityfields + && opval >= 0 + && opval < pr->pr_edictareasize) { + ed = PROG_TO_EDICT (pr, opval); + opval = &ed->v[parm_ind] - pr->pr_globals; + } else { + str = "bad entity.field"; + break; + } + str = global_string (pr, opval, optype, contents & 1); + str = va ("%d %d %s", s->a, s->b, str); + } + break; default: goto err; } diff --git a/libs/gamecode/engine/pr_opcode.c b/libs/gamecode/engine/pr_opcode.c index f98a3300c..7fdfde1f0 100644 --- a/libs/gamecode/engine/pr_opcode.c +++ b/libs/gamecode/engine/pr_opcode.c @@ -98,6 +98,7 @@ VISIBLE const char *pr_type_name[ev_type_count] = { // P function parameter // F function (must come before any P) // R return value +// E entity + field (%Eab) // // a operand a // b operand b @@ -266,52 +267,52 @@ VISIBLE opcode_t pr_opcodes[] = { {".", "load.f", OP_LOAD_F, false, ev_entity, ev_field, ev_float, PROG_ID_VERSION, - "%Ga.%Gb, %gc", + "%Ga.%Gb(%Ec), %gc",//FIXME %E more flexible? }, {".", "load.v", OP_LOAD_V, false, ev_entity, ev_field, ev_vector, PROG_ID_VERSION, - "%Ga.%Gb, %gc", + "%Ga.%Gb(%Ec), %gc", }, {".", "load.q", OP_LOAD_Q, false, ev_entity, ev_field, ev_quat, PROG_ID_VERSION, - "%Ga.%Gb, %gc", + "%Ga.%Gb(%Ec), %gc", }, {".", "load.s", OP_LOAD_S, false, ev_entity, ev_field, ev_string, PROG_ID_VERSION, - "%Ga.%Gb, %gc", + "%Ga.%Gb(%Ec), %gc", }, {".", "load.ent", OP_LOAD_ENT, false, ev_entity, ev_field, ev_entity, PROG_ID_VERSION, - "%Ga.%Gb, %gc", + "%Ga.%Gb(%Ec), %gc", }, {".", "load.fld", OP_LOAD_FLD, false, ev_entity, ev_field, ev_field, PROG_ID_VERSION, - "%Ga.%Gb, %gc", + "%Ga.%Gb(%Ec), %gc", }, {".", "load.fn", OP_LOAD_FN, false, ev_entity, ev_field, ev_func, PROG_ID_VERSION, - "%Ga.%Gb, %gc", + "%Ga.%Gb(%Ec), %gc", }, {".", "load.i", OP_LOAD_I, false, ev_entity, ev_field, ev_integer, PROG_VERSION, - "%Ga.%Gb, %gc", + "%Ga.%Gb(%Ec), %gc", }, {".", "load.u", OP_LOAD_U, false, ev_entity, ev_field, ev_uinteger, PROG_VERSION, - "%Ga.%Gb, %gc", + "%Ga.%Gb(%Ec), %gc", }, {".", "load.p", OP_LOAD_P, false, ev_entity, ev_field, ev_pointer, PROG_VERSION, - "%Ga.%Gb, %gc", + "%Ga.%Gb(%Ec), %gc", }, {".", "loadb.f", OP_LOADB_F, false, @@ -419,6 +420,7 @@ VISIBLE opcode_t pr_opcodes[] = { {"&", "address", OP_ADDRESS, false, ev_entity, ev_field, ev_pointer, PROG_ID_VERSION, + "%Ga.%Gb, %gc", }, {"&", "address.f", OP_ADDRESS_F, false, From 9d6fd32206503e8250520a3989612e6a0101735a Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 20 Nov 2010 09:02:56 +0900 Subject: [PATCH 063/115] Ensure the the progs data is aligned. Some QuakeC compilers (eg, FTE) insert a data chunk between the progs header and the rest of the progs data. Unfortunately, FTE does not maintain the assumed 32-bit alignment. --- libs/gamecode/engine/pr_load.c | 36 +++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/libs/gamecode/engine/pr_load.c b/libs/gamecode/engine/pr_load.c index d7b2d76ae..34e57e51a 100644 --- a/libs/gamecode/engine/pr_load.c +++ b/libs/gamecode/engine/pr_load.c @@ -100,11 +100,13 @@ free_progs_mem (progs_t *pr, void *mem) } VISIBLE void -PR_LoadProgsFile (progs_t * pr, QFile *file, int size, int edicts, int zone) +PR_LoadProgsFile (progs_t *pr, QFile *file, int size, int edicts, int zone) { size_t i; int mem_size; + int offset_tweak; dprograms_t progs; + byte *base; if (!pr->file_error) pr->file_error = file_error; @@ -152,8 +154,13 @@ PR_LoadProgsFile (progs_t * pr, QFile *file, int size, int edicts, int zone) } } + // Some compilers (eg, FTE) put extra data between the header and the + // strings section. What's worse, they de-align the data. + offset_tweak = progs.ofs_strings % sizeof (pr_int_t); + offset_tweak = (sizeof (pr_int_t) - offset_tweak) % sizeof (pr_int_t); + // size of progs themselves - pr->progs_size = size; + pr->progs_size = size + offset_tweak; Sys_DPrintf ("Programs occupy %iK.\n", size / 1024); // round off to next highest whole word address (esp for Alpha) // this ensures that pointers in the engine data area are always @@ -187,9 +194,10 @@ PR_LoadProgsFile (progs_t * pr, QFile *file, int size, int edicts, int zone) ((byte *) pr->progs)[mem_size] = 0; memcpy (pr->progs, &progs, sizeof (progs)); - Qread (file, pr->progs + 1, size - sizeof (progs)); - CRC_ProcessBlock ((byte *)(pr->progs + 1), &pr->crc, - size - sizeof (progs)); + base = (byte *) (pr->progs + 1) + offset_tweak; + Qread (file, base, size - sizeof (progs)); + CRC_ProcessBlock (base, &pr->crc, size - sizeof (progs)); + base -= sizeof (progs); // offsets are from file start if (pr->edicts) *pr->edicts = (edict_t *)((byte *) pr->progs + pr->progs_size); @@ -199,18 +207,14 @@ PR_LoadProgsFile (progs_t * pr, QFile *file, int size, int edicts, int zone) PR_Zone_Init (pr); pr->pr_functions = - (dfunction_t *) ((byte *) pr->progs + pr->progs->ofs_functions); - pr->pr_strings = (char *) pr->progs + pr->progs->ofs_strings; - pr->pr_stringsize = (char *) pr->zone + pr->zone_size - (char *) pr->progs; - pr->pr_globaldefs = - (ddef_t *) ((byte *) pr->progs + pr->progs->ofs_globaldefs); - pr->pr_fielddefs = - (ddef_t *) ((byte *) pr->progs + pr->progs->ofs_fielddefs); - pr->pr_statements = - (dstatement_t *) ((byte *) pr->progs + pr->progs->ofs_statements); + (dfunction_t *) (base + pr->progs->ofs_functions); + pr->pr_strings = (char *) base + pr->progs->ofs_strings; + pr->pr_stringsize = (char *) pr->zone + pr->zone_size - (char *) base; + pr->pr_globaldefs = (ddef_t *) (base + pr->progs->ofs_globaldefs); + pr->pr_fielddefs = (ddef_t *) (base + pr->progs->ofs_fielddefs); + pr->pr_statements = (dstatement_t *) (base + pr->progs->ofs_statements); - pr->pr_globals = - (pr_type_t *) ((byte *) pr->progs + pr->progs->ofs_globals); + pr->pr_globals = (pr_type_t *) (base + pr->progs->ofs_globals); pr->globals_size = (pr_type_t*)((byte *) pr->zone + pr->zone_size) - pr->pr_globals; From 3309f483b69788552fafed46ec47a43e4d91c2e3 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 20 Nov 2010 14:12:40 +0900 Subject: [PATCH 064/115] Don't require pr_boundscheck for quoth. I don't know about other FTEqcc compiled progs, but quoth doesn't try to do anything clever (all its denormals are either vars of the wrong type, or -0.0). --- libs/gamecode/engine/pr_debug.c | 7 ++++- libs/gamecode/engine/pr_opcode.c | 48 +++++++++++++++++++------------- 2 files changed, 35 insertions(+), 20 deletions(-) diff --git a/libs/gamecode/engine/pr_debug.c b/libs/gamecode/engine/pr_debug.c index 9b7ecd846..46c9d6451 100644 --- a/libs/gamecode/engine/pr_debug.c +++ b/libs/gamecode/engine/pr_debug.c @@ -539,6 +539,8 @@ PR_DumpState (progs_t *pr) PR_StackTrace (pr); } +#define ISDENORM(x) ((x) && !((x) & 0x7f800000)) + static const char * value_string (progs_t *pr, etype_t type, pr_type_t *val) { @@ -611,7 +613,10 @@ value_string (progs_t *pr, etype_t type, pr_type_t *val) case ev_void: return "void"; case ev_float: - dsprintf (line, "%g", val->float_var); + if (ISDENORM (val->integer_var) && val->uinteger_var != 0x80000000) + dsprintf (line, "<%08x>", val->integer_var); + else + dsprintf (line, "%g", val->float_var); break; case ev_vector: dsprintf (line, "'%g %g %g'", diff --git a/libs/gamecode/engine/pr_opcode.c b/libs/gamecode/engine/pr_opcode.c index 7fdfde1f0..12ecfff9f 100644 --- a/libs/gamecode/engine/pr_opcode.c +++ b/libs/gamecode/engine/pr_opcode.c @@ -1204,9 +1204,10 @@ check_branch (progs_t *pr, dstatement_t *st, opcode_t *op, short offset) static inline void check_global (progs_t *pr, dstatement_t *st, opcode_t *op, etype_t type, - unsigned short operand) + unsigned short operand, int check_denorm) { const char *msg; + ddef_t *def; switch (type) { case ev_short: @@ -1223,11 +1224,19 @@ check_global (progs_t *pr, dstatement_t *st, opcode_t *op, etype_t type, msg = "out of bounds global index"; goto error; } - if (type == ev_float) - if (ISDENORM (G_INT (pr, operand)) - && !pr->denorm_found) { + if (type != ev_float || !check_denorm) + break; + if (!ISDENORM (G_INT (pr, operand)) + || G_UINT(pr, operand) == 0x80000000) + break; + if ((def = PR_GlobalAtOfs (pr, operand)) + && (def->type & ~DEF_SAVEGLOBAL) != ev_float) { + // FTEqcc uses store.f parameters of most types :/ + break; + } + if (!pr->denorm_found) { pr->denorm_found = 1; - if (pr_boundscheck-> int_val) { + if (pr_boundscheck->int_val) { Sys_Printf ("DENORMAL floats detected, these progs might " "not work. Good luck.\n"); return; @@ -1305,7 +1314,7 @@ PR_Check_Opcodes (progs_t *pr) switch (st->op) { case OP_IF: case OP_IFNOT: - check_global (pr, st, op, op->type_a, st->a); + check_global (pr, st, op, op->type_a, st->a, 1); check_branch (pr, st, op, st->b); break; case OP_GOTO: @@ -1313,12 +1322,12 @@ PR_Check_Opcodes (progs_t *pr) break; case OP_DONE: case OP_RETURN: - check_global (pr, st, op, ev_integer, st->a); - check_global (pr, st, op, ev_void, st->b); - check_global (pr, st, op, ev_void, st->c); + check_global (pr, st, op, ev_integer, st->a, 1); + check_global (pr, st, op, ev_void, st->b, 0); + check_global (pr, st, op, ev_void, st->c, 0); break; case OP_RCALL1: - check_global (pr, st, op, ev_void, st->c); + check_global (pr, st, op, ev_void, st->c, 1); case OP_RCALL2: case OP_RCALL3: case OP_RCALL4: @@ -1327,9 +1336,9 @@ PR_Check_Opcodes (progs_t *pr) case OP_RCALL7: case OP_RCALL8: if (st->op > OP_RCALL1) - check_global (pr, st, op, ev_integer, st->c); - check_global (pr, st, op, ev_integer, st->b); - check_global (pr, st, op, ev_func, st->a); + check_global (pr, st, op, ev_integer, st->c, 1); + check_global (pr, st, op, ev_integer, st->b, 1); + check_global (pr, st, op, ev_func, st->a, 1); break; case OP_STATE: case OP_STATE_F: @@ -1337,18 +1346,19 @@ PR_Check_Opcodes (progs_t *pr) PR_Error (pr, "PR_Check_Opcodes: %s used with missing " "fields or globals", op->opname); } - check_global (pr, st, op, op->type_a, st->a); - check_global (pr, st, op, op->type_b, st->b); - check_global (pr, st, op, op->type_c, st->c); + check_global (pr, st, op, op->type_a, st->a, 1); + check_global (pr, st, op, op->type_b, st->b, 1); + check_global (pr, st, op, op->type_c, st->c, 1); break; case OP_MOVE: check_global_size (pr, st, op, st->b, st->a); check_global_size (pr, st, op, st->b, st->c); break; default: - check_global (pr, st, op, op->type_a, st->a); - check_global (pr, st, op, op->type_b, st->b); - check_global (pr, st, op, op->type_c, st->c); + check_global (pr, st, op, op->type_a, st->a, 1); + check_global (pr, st, op, op->type_b, st->b, + op->opcode != OP_STORE_F); + check_global (pr, st, op, op->type_c, st->c, 0); break; } } From 15b423cbe7d3cc5636158202bc9502301ab8bac9 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 20 Nov 2010 14:32:27 +0900 Subject: [PATCH 065/115] Track 0 is used to stop the BGM --- libs/audio/cd_file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/audio/cd_file.c b/libs/audio/cd_file.c index 34c569000..618d3e19c 100644 --- a/libs/audio/cd_file.c +++ b/libs/audio/cd_file.c @@ -302,6 +302,8 @@ I_OGGMus_Play (int track, qboolean looping) if (playing) I_OGGMus_Stop (); + if (!track) + return; I_OGGMus_SetPlayList (track); I_OGGMus_PlayNext (looping); } From 49ea878ad9a4019c274239d16500293db150da7a Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 21 Nov 2010 09:56:31 +0900 Subject: [PATCH 066/115] Slightly more informative progress. Display per-thread current portal number. Will get messy if there are more threads than the screen width can handle. --- tools/qfvis/source/qfvis.c | 40 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/tools/qfvis/source/qfvis.c b/tools/qfvis/source/qfvis.c index af11673b4..0a2947a85 100644 --- a/tools/qfvis/source/qfvis.c +++ b/tools/qfvis/source/qfvis.c @@ -96,6 +96,8 @@ dstring_t *visdata; byte *uncompressed; // [bitbytes * portalleafs] int *leafcluster; // leaf to cluster mappings as read from .prt file +int *working; // per thread current portal # + static void PlaneFromWinding (winding_t *winding, plane_t *plane) @@ -281,15 +283,18 @@ GetNextPortal (void) } static void * -LeafThread (void *thread) +LeafThread (void *_thread) { portal_t *portal; + int thread = (int) (intptr_t) _thread; do { portal = GetNextPortal (); if (!portal) break; + if (working) + working[thread] = (int) (portal - portals); PortalFlow (portal); if (options.verbosity > 0) @@ -302,6 +307,29 @@ LeafThread (void *thread) return NULL; } +static void * +WatchThread (void *_thread) +{ + int thread = (intptr_t) _thread; + int *local_work = malloc (thread * sizeof (int)); + int i; + const char *spinner = "|/-\\"; + int ind = 0; + + while (1) { + sleep (1); + + for (i = 0; i < thread; i ++) + local_work[i] = working[i]; + for (i = 0; i < thread; i++) + printf ("%6d", local_work[i]); + printf (" %c\r", spinner[(ind++) % 4]); + fflush (stdout); + } + + return NULL; +} + static int CompressRow (byte *vis, byte *dest) { @@ -412,11 +440,12 @@ CalcPortalVis (void) #ifdef HAVE_PTHREAD_H { - pthread_t work_threads[MAX_THREADS]; + pthread_t work_threads[MAX_THREADS + 1]; void *status; pthread_attr_t attrib; if (options.threads > 1) { + working = calloc (options.threads, sizeof (int)); my_mutex = malloc (sizeof (*my_mutex)); if (pthread_mutex_init (my_mutex, 0) == -1) Sys_Error ("pthread_mutex_init failed"); @@ -429,11 +458,18 @@ CalcPortalVis (void) (void *) i) == -1) Sys_Error ("pthread_create failed"); } + if (pthread_create (&work_threads[i], &attrib, WatchThread, + (void *) i) == -1) + Sys_Error ("pthread_create failed"); for (i = 0; i < options.threads; i++) { if (pthread_join (work_threads[i], &status) == -1) Sys_Error ("pthread_join failed"); } + if (pthread_cancel (work_threads[i]) != 0) + Sys_Error ("pthread_cancel failed"); + if (pthread_join (work_threads[i], &status) == -1) + Sys_Error ("pthread_join failed"); if (pthread_mutex_destroy (my_mutex) == -1) Sys_Error ("pthread_mutex_destroy failed"); From 204c509a43877a1a5eadc62774a70361ca828a6e Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 21 Nov 2010 10:06:56 +0900 Subject: [PATCH 067/115] sezero's "Bad old_size value in Z_Realloc()" patch. --- libs/util/zone.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/util/zone.c b/libs/util/zone.c index 3317cbe38..fbb412555 100644 --- a/libs/util/zone.c +++ b/libs/util/zone.c @@ -238,6 +238,8 @@ Z_Realloc (memzone_t *zone, void *ptr, int size) Sys_Error ("Z_Realloc: realloced a freed pointer"); old_size = block->size; + old_size -= sizeof (memblock_t); // account for size of block header + old_size -= 4; // space for memory trash tester old_ptr = ptr; Z_Free (zone, ptr); From 6771e7b8b5cc06468fa4d1be30ed7145c8e3baff Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 21 Nov 2010 13:55:03 +0900 Subject: [PATCH 068/115] sezero's win32 Sys_ConsoleInput patch. --- libs/util/sys.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/util/sys.c b/libs/util/sys.c index 6be131f44..efee61360 100644 --- a/libs/util/sys.c +++ b/libs/util/sys.c @@ -604,9 +604,14 @@ Sys_ConsoleInput (void) } text[len] = c; len++; - text[len] = 0; - if (len == sizeof (text)) + if (len < sizeof (text)) + text[len] = 0; + else { + // buffer is full len = 0; + text[sizeof (text) - 1] = 0; + return text; + } } return NULL; From 99e87b092b8265287c1d4408da5364fe86e59ff1 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 21 Nov 2010 14:08:18 +0900 Subject: [PATCH 069/115] zixthree's stereo swap patch. Modified slightly for formatting and cleaner swapping. --- libs/audio/renderer/snd_channels.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/audio/renderer/snd_channels.c b/libs/audio/renderer/snd_channels.c index 75ec6f9ed..ef835f86d 100644 --- a/libs/audio/renderer/snd_channels.c +++ b/libs/audio/renderer/snd_channels.c @@ -74,6 +74,7 @@ static vec3_t listener_up; static cvar_t *snd_phasesep; static cvar_t *snd_volumesep; +static cvar_t *snd_swapchannelside; static cvar_t *ambient_fade; static cvar_t *ambient_level; @@ -307,6 +308,9 @@ SND_Channels_Init (void) "20cm head"); snd_volumesep = Cvar_Get ("snd_volumesep", "1.0", CVAR_ARCHIVE, NULL, "max stereo volume separation. 1.0 is max"); + snd_swapchannelside = Cvar_Get ("snd_swapchannelside", "0", CVAR_ARCHIVE, + NULL, "Toggle swapping of left and right " + "channels"); ambient_fade = Cvar_Get ("ambient_fade", "100", CVAR_NONE, NULL, "How quickly ambient sounds fade in or out"); ambient_level = Cvar_Get ("ambient_level", "0.3", CVAR_NONE, NULL, @@ -476,6 +480,8 @@ s_spatialize (channel_t *ch) dist = VectorNormalize (source_vec) * ch->dist_mult; dot = DotProduct (listener_right, source_vec); + if (snd_swapchannelside->int_value) + dot = -dot; if (snd_shm->channels == 1) { rscale = 1.0; From 4cec1874654d445e7aa0a891298365f9bd23096a Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 21 Nov 2010 14:18:15 +0900 Subject: [PATCH 070/115] zixthree's wav file patch Wav file were not read correctly when encoutering most chunk type beside the ones used by QuakeForge. This patch will fix the riff loader code so that unused but defined chunk are skipped. Most wav files should now be loaded correctly fixing some silent sound effect. Also fixed a typo in wav loader and reordered wav validity check so that format is checked first. The data chunk could be inexistant on some weird format and so an invalid format is a more helpful error text. ! Fix: Skip unsupported chunk in riff loader instead of rejecting riff file. ! Fix: typo in Microsoft name. ! Fix: ordering of wav validity to enable more helpful error text. --- libs/audio/renderer/wav.c | 10 +++++----- libs/util/riff.c | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/libs/audio/renderer/wav.c b/libs/audio/renderer/wav.c index 0ee193fa2..1f94daf87 100644 --- a/libs/audio/renderer/wav.c +++ b/libs/audio/renderer/wav.c @@ -235,18 +235,18 @@ wav_get_info (QFile *file) Sys_Printf ("missing format chunk\n"); goto bail; } - if (!data) { - Sys_Printf ("missing data chunk\n"); - goto bail; - } if (dfmt->format_tag != 1) { - Sys_Printf ("not Microsfot PCM\n"); + Sys_Printf ("not Microsoft PCM\n"); goto bail; } if (dfmt->channels < 1 || dfmt->channels > 8) { Sys_Printf ("unsupported channel count\n"); goto bail; } + if (!data) { + Sys_Printf ("missing data chunk\n"); + goto bail; + } info.rate = dfmt->samples_per_sec; info.width = dfmt->bits_per_sample / 8; diff --git a/libs/util/riff.c b/libs/util/riff.c index 2e5ee7f95..eff201e13 100644 --- a/libs/util/riff.c +++ b/libs/util/riff.c @@ -367,6 +367,27 @@ riff_read (QFile *f) chunk = &data->ck; } break; + case RIFF_CASE ('w','a','v','l'): + // FIXME: Convert wavl to data ? + case RIFF_CASE ('s','l','n','t'): + // FIXME: Add silence to data + case RIFF_CASE ('l','i','s','t'): + case RIFF_CASE ('l','a','b','l'): + case RIFF_CASE ('n','o','t','e'): + case RIFF_CASE ('l','t','x','t'): + case RIFF_CASE ('p','l','s','t'): + case RIFF_CASE ('i','n','s','t'): + case RIFF_CASE ('f','a','c','t'): + case RIFF_CASE ('s','m','p','l'): + { // Unused chunk, still present in a lot of wav files. + int c; + + Qseek(f, ck.len, SEEK_CUR); + if ((c = Qgetc (f)) && c != -1) + Qungetc (f, c); + continue; // Skip those blocks. + } + break; default: // unknown chunk. bail (could be corrupted file) chunk = 0; From 1dfb914c46e8b4eaed7651efd5c82f947200b129 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 21 Nov 2010 14:25:32 +0900 Subject: [PATCH 071/115] fix an oopsie (rebase!!) --- libs/audio/renderer/snd_channels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/audio/renderer/snd_channels.c b/libs/audio/renderer/snd_channels.c index ef835f86d..0c10c4f0b 100644 --- a/libs/audio/renderer/snd_channels.c +++ b/libs/audio/renderer/snd_channels.c @@ -480,7 +480,7 @@ s_spatialize (channel_t *ch) dist = VectorNormalize (source_vec) * ch->dist_mult; dot = DotProduct (listener_right, source_vec); - if (snd_swapchannelside->int_value) + if (snd_swapchannelside->int_val) dot = -dot; if (snd_shm->channels == 1) { From d4ae231f34ef157f549e181f3159799efffcd645 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 21 Nov 2010 14:27:43 +0900 Subject: [PATCH 072/115] sezero's NET_SendToAll fix Here's a patch to NET_SendToAll() which was always broken: it never skipped non-connected clients. Depending on the compiler, it would wait the whole 5 seconds of its blocktime before it gave up. While there, changed its blocktime argument to double (the comparison is against a double.) --- include/netmain.h | 2 +- libs/net/net_main.c | 10 ++++------ nq/source/host.c | 2 +- nq/source/sv_main.c | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/include/netmain.h b/include/netmain.h index 10d3d0bf8..2ebc26a7f 100644 --- a/include/netmain.h +++ b/include/netmain.h @@ -287,7 +287,7 @@ int NET_SendUnreliableMessage (struct qsocket_s *sock, sizebuf_t *data); // returns 1 if the message was sent properly // returns -1 if the connection died -int NET_SendToAll(sizebuf_t *data, int blocktime); +int NET_SendToAll(sizebuf_t *data, double blocktime); // This is a reliable *blocking* send to all attached clients. diff --git a/libs/net/net_main.c b/libs/net/net_main.c index 570cb52de..1ed65c06c 100644 --- a/libs/net/net_main.c +++ b/libs/net/net_main.c @@ -736,19 +736,17 @@ NET_CanSendMessage (qsocket_t * sock) int -NET_SendToAll (sizebuf_t *data, int blocktime) +NET_SendToAll (sizebuf_t *data, double blocktime) { double start; int i; int count = 0; - qboolean state1[MAX_SCOREBOARD]; - qboolean state2[MAX_SCOREBOARD]; + qboolean state1[MAX_SCOREBOARD]; /* can we send */ + qboolean state2[MAX_SCOREBOARD]; /* did we send */ for (i = 0, host_client = svs.clients; i < svs.maxclients; i++, host_client++) { - if (!host_client->netconnection) - continue; - if (host_client->active) { + if (host_client->netconnection && host_client->active) { if (host_client->netconnection->driver == 0) { NET_SendMessage (host_client->netconnection, data); state1[i] = true; diff --git a/nq/source/host.c b/nq/source/host.c index c51872026..422516e6f 100644 --- a/nq/source/host.c +++ b/nq/source/host.c @@ -487,7 +487,7 @@ Host_ShutdownServer (qboolean crash) buf.maxsize = 4; buf.cursize = 0; MSG_WriteByte (&buf, svc_disconnect); - count = NET_SendToAll (&buf, 5); + count = NET_SendToAll (&buf, 5.0); if (count) Sys_Printf ("Host_ShutdownServer: NET_SendToAll failed for %u clients\n", diff --git a/nq/source/sv_main.c b/nq/source/sv_main.c index 553e1689b..b9c5e8f2c 100644 --- a/nq/source/sv_main.c +++ b/nq/source/sv_main.c @@ -858,7 +858,7 @@ SV_SendReconnect (void) MSG_WriteByte (&msg, svc_stufftext); MSG_WriteString (&msg, "reconnect\n"); - NET_SendToAll (&msg, 5); + NET_SendToAll (&msg, 5.0); if (cls.state != ca_dedicated) Cmd_ExecuteString ("reconnect\n", src_command); From d0370f7cf53021daea4dbc1350440e7d9914b360 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 21 Nov 2010 15:23:41 +0900 Subject: [PATCH 073/115] zixthree's Microsoft Visual C++ 2005 Express Support + Support for VC++ 2005 Express. - MFC dependency for quakeforge.rc. + VC++ 2005 compatible icon, choose Vista or XP icon depending on SDK target OS. ! Renamed E_POINTER macro to E_PTR (was in conflict with Windows macro). ! Fixed HAVE_SNPRINTF and HAVE__SNPRINTF macros. ! Fixed HAVE_VSNPRINTF and HAVE__VSNPRINTF config macros. + Added explicit dependency to gdi32.lib and user32.lib when using Express. ! Changed -0x80000000 to INT_MIN ! Added return value when running *_Error for Visual C++ compiler. ! Function method_free wasn't freeing _meth parameter. + Added a Visual Studio solution specific to Express to remedy unsupported features. ! Renamed solution files to reflect their associated Visual Studio flavor. ! Updated vc2005/readme.txt to reflect changes and notify incompatibility with Wave preprocessor. --- .../resources/{icon1.ico => icon1Vista.ico} | Bin include/win32/resources/icon1XP.ico | Bin 0 -> 314038 bytes vc2005/QuakeForge-VS8-Express.sln | 935 ++++++++++++++ vc2005/{QuakeForge.sln => QuakeForge-VS8.sln} | 0 vc2005/nq-sdl/nq-sdl.vcproj | 1122 ++++++++-------- vc2005/qw-client-sdl32/qw-client-sdl32.vcproj | 1134 ++++++++--------- vc2005/sound/sound.vcproj | 1026 +++++++-------- 7 files changed, 2576 insertions(+), 1641 deletions(-) rename include/win32/resources/{icon1.ico => icon1Vista.ico} (100%) create mode 100644 include/win32/resources/icon1XP.ico create mode 100644 vc2005/QuakeForge-VS8-Express.sln rename vc2005/{QuakeForge.sln => QuakeForge-VS8.sln} (100%) diff --git a/include/win32/resources/icon1.ico b/include/win32/resources/icon1Vista.ico similarity index 100% rename from include/win32/resources/icon1.ico rename to include/win32/resources/icon1Vista.ico diff --git a/include/win32/resources/icon1XP.ico b/include/win32/resources/icon1XP.ico new file mode 100644 index 0000000000000000000000000000000000000000..ed596b4a14ee8bf083d7ec219b2db56f9238afd3 GIT binary patch literal 314038 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

!4L>f{^C9L9?;+Mb&Sh^-(0D5`CTd+P z-lJ|k4gQ(CCP(a;<70Uc%7P3pF#ABV3t501z!$zO;-CJ3y;a8ouZ7=!@zP7~i*e)J zrOGj-uLUw7v;$0EVh7~n0IEG)q}tj){>Cz(f%wgrzP2}|?uYwO|AtSLK3@3Ih%u38 zN}o%xSsMfVBX2CPFB9LdDeQ-QKh*gF?mhN}599f8{G_hWiuqW#8{Q4;VBE&rdi}O~ z)Yy23*LsgShBWxcUts%3u6Q01a|zE20$E_(1X+OW@-~ZP0QVMOYi<0lb?q4cxAxlJ zpAEkyuVtQk1q@SO`^lc!+nVL;}adJISIc+ z_rq~?LA5pv|LCR+_T&0JU&9mn`tou9IERmTem0#?UJUUt&-VlDn_sUI&lhIQrcdJD z^gQ@8JSMRY#{JOznv@vt#(%?i(%>I|ftMkHY~lE!EXeQzY=gi)FgZZZ)Ut|y_$;|? z%yHr%^b4V;{XfcU&E^X%gac^poJDP#Hr@C)5 =lgYabU*RWi`7SQ+Ne?9=LhcK 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 z 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 IJ>2{M0Ztpfk^lez literal 0 HcmV?d00001 diff --git a/vc2005/QuakeForge-VS8-Express.sln b/vc2005/QuakeForge-VS8-Express.sln new file mode 100644 index 000000000..404f35ff4 --- /dev/null +++ b/vc2005/QuakeForge-VS8-Express.sln @@ -0,0 +1,935 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qw-client", "qfclient\qfclient.vcproj", "{9A942925-61E6-4975-935A-5D62E8248E64}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qw", "qw\qw.vcproj", "{6ADA4322-693A-46BB-897B-17BB5BE9F08C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "net-chan", "net\net.vcproj", "{6540C00F-C5EF-4C8B-824D-F2B7B302F0E0}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ruamoko", "ruamoko\ruamoko.vcproj", "{51028ACF-53D4-4478-8500-55E6B8A81375}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "models-gl", "modelsgl\modelsgl.vcproj", "{1311DEDF-B04C-4E96-BFDC-5D9FA0B05AC7}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "console", "console\console.vcproj", "{ED4AFBF5-C247-4352-966D-048B8998C6A1}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gib", "gib\gib.vcproj", "{01C3B138-9D45-4ED6-A763-893C067262C2}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "util", "util\util.vcproj", "{ACCC6F49-7E06-4395-AAF4-3C03A68F49EB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "engine", "engine\engine.vcproj", "{2626C0E1-6F5C-47D3-B80D-93942D766DD7}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "builtins", "builtins\builtins.vcproj", "{04FA9D77-E45F-4917-B972-B353BA6A6FA8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sound", "sound\sound.vcproj", "{BF149D97-7520-4788-9CD1-3D99C5C8150F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "image", "image\image.vcproj", "{5203F034-0047-4EC0-B7E9-D037FAF5D536}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "video", "video\video.vcproj", "{E7B3D07D-2FE8-481B-8DAB-6255A412A42F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qw-common", "common\common.vcproj", "{BC1F021A-1EEC-4A7A-B746-5AA6048E478C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qw-server", "qfserver\qfserver.vcproj", "{544D097C-9C24-4C57-A171-8C8029421185}" + ProjectSection(ProjectDependencies) = postProject + {6ADA4322-693A-46BB-897B-17BB5BE9F08C} = {6ADA4322-693A-46BB-897B-17BB5BE9F08C} + {B37FE734-01F4-4799-86B2-D084820715BE} = {B37FE734-01F4-4799-86B2-D084820715BE} + {BC1F021A-1EEC-4A7A-B746-5AA6048E478C} = {BC1F021A-1EEC-4A7A-B746-5AA6048E478C} + {DE7E8FF8-0F5D-4062-A5C0-CFA3502E7A5A} = {DE7E8FF8-0F5D-4062-A5C0-CFA3502E7A5A} + {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0} = {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0} + {ED4AFBF5-C247-4352-966D-048B8998C6A1} = {ED4AFBF5-C247-4352-966D-048B8998C6A1} + {2626C0E1-6F5C-47D3-B80D-93942D766DD7} = {2626C0E1-6F5C-47D3-B80D-93942D766DD7} + {51028ACF-53D4-4478-8500-55E6B8A81375} = {51028ACF-53D4-4478-8500-55E6B8A81375} + {04FA9D77-E45F-4917-B972-B353BA6A6FA8} = {04FA9D77-E45F-4917-B972-B353BA6A6FA8} + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + {01C3B138-9D45-4ED6-A763-893C067262C2} = {01C3B138-9D45-4ED6-A763-893C067262C2} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "models", "models\models.vcproj", "{DE7E8FF8-0F5D-4062-A5C0-CFA3502E7A5A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "console-client", "console_client\console_client.vcproj", "{226D42CE-5833-444E-94FA-84C1D51892A8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "console-server", "console_server\console_server.vcproj", "{B37FE734-01F4-4799-86B2-D084820715BE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qfbsp", "qfbsp\qfbsp.vcproj", "{B00D4025-0437-4FF2-BD0E-D2AE6CF82AC2}" + ProjectSection(ProjectDependencies) = postProject + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qflight", "qflight\qflight.vcproj", "{5E7E6110-89E8-4797-A8E3-EBEF0EF5CAF2}" + ProjectSection(ProjectDependencies) = postProject + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qfvis", "qfvis\qfvis.vcproj", "{E5D842C5-669F-4FC7-A5E0-44B562F86435}" + ProjectSection(ProjectDependencies) = postProject + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qw-master", "qw-master\qw-master.vcproj", "{445A2500-3BBC-449A-A929-C419C2A16051}" + ProjectSection(ProjectDependencies) = postProject + {B37FE734-01F4-4799-86B2-D084820715BE} = {B37FE734-01F4-4799-86B2-D084820715BE} + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + {ED4AFBF5-C247-4352-966D-048B8998C6A1} = {ED4AFBF5-C247-4352-966D-048B8998C6A1} + {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0} = {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qfmodelgen", "qfmodelgen\qfmodelgen.vcproj", "{052C34FE-C9E2-43ED-95DA-FB3F27B44E37}" + ProjectSection(ProjectDependencies) = postProject + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qfprogs", "qfprogs\qfprogs.vcproj", "{5FA27C8E-51B1-445A-A375-FBE74F0984B1}" + ProjectSection(ProjectDependencies) = postProject + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + {2626C0E1-6F5C-47D3-B80D-93942D766DD7} = {2626C0E1-6F5C-47D3-B80D-93942D766DD7} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qfwavinfo", "qfwavinfo\qfwavinfo.vcproj", "{56BD559B-1590-4FC4-B441-AB1973BAC2BD}" + ProjectSection(ProjectDependencies) = postProject + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wad", "wad\wad.vcproj", "{88422448-C5FB-46F3-A0B3-0811F90E537C}" + ProjectSection(ProjectDependencies) = postProject + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + {5203F034-0047-4EC0-B7E9-D037FAF5D536} = {5203F034-0047-4EC0-B7E9-D037FAF5D536} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pak", "pak\pak.vcproj", "{9EE8BD4B-47D3-4AD5-A8B9-831329792A05}" + ProjectSection(ProjectDependencies) = postProject + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bsp2img", "bsp2img\bsp2img.vcproj", "{4605418D-2292-470A-AB18-C2119B016F71}" + ProjectSection(ProjectDependencies) = postProject + {5203F034-0047-4EC0-B7E9-D037FAF5D536} = {5203F034-0047-4EC0-B7E9-D037FAF5D536} + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qtv", "qtv\qtv.vcproj", "{05E68E3B-5901-43A9-981D-CF392C0F5C6C}" + ProjectSection(ProjectDependencies) = postProject + {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0} = {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0} + {B37FE734-01F4-4799-86B2-D084820715BE} = {B37FE734-01F4-4799-86B2-D084820715BE} + {ED4AFBF5-C247-4352-966D-048B8998C6A1} = {ED4AFBF5-C247-4352-966D-048B8998C6A1} + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + {6ADA4322-693A-46BB-897B-17BB5BE9F08C} = {6ADA4322-693A-46BB-897B-17BB5BE9F08C} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nq-common", "nq-common\nq-common.vcproj", "{6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nq-wgl", "nq-wgl\nq-wgl.vcproj", "{1CD1A18B-95D5-4EA4-917C-34B10066BFCC}" + ProjectSection(ProjectDependencies) = postProject + {B37FE734-01F4-4799-86B2-D084820715BE} = {B37FE734-01F4-4799-86B2-D084820715BE} + {178D81A7-F2FB-41D7-B300-9D1A4DE5E137} = {178D81A7-F2FB-41D7-B300-9D1A4DE5E137} + {155112B9-A8A9-4E06-90F5-4AAAB32B2F70} = {155112B9-A8A9-4E06-90F5-4AAAB32B2F70} + {C55D5FBF-43A0-4F6C-BCF6-BAE5705C121F} = {C55D5FBF-43A0-4F6C-BCF6-BAE5705C121F} + {2626C0E1-6F5C-47D3-B80D-93942D766DD7} = {2626C0E1-6F5C-47D3-B80D-93942D766DD7} + {5203F034-0047-4EC0-B7E9-D037FAF5D536} = {5203F034-0047-4EC0-B7E9-D037FAF5D536} + {01C3B138-9D45-4ED6-A763-893C067262C2} = {01C3B138-9D45-4ED6-A763-893C067262C2} + {6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80} = {6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80} + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + {04FA9D77-E45F-4917-B972-B353BA6A6FA8} = {04FA9D77-E45F-4917-B972-B353BA6A6FA8} + {E7B3D07D-2FE8-481B-8DAB-6255A412A42F} = {E7B3D07D-2FE8-481B-8DAB-6255A412A42F} + {BF149D97-7520-4788-9CD1-3D99C5C8150F} = {BF149D97-7520-4788-9CD1-3D99C5C8150F} + {226D42CE-5833-444E-94FA-84C1D51892A8} = {226D42CE-5833-444E-94FA-84C1D51892A8} + {51028ACF-53D4-4478-8500-55E6B8A81375} = {51028ACF-53D4-4478-8500-55E6B8A81375} + {ED4AFBF5-C247-4352-966D-048B8998C6A1} = {ED4AFBF5-C247-4352-966D-048B8998C6A1} + {053E1EE2-75B4-4D9A-B8AE-89600BCB60A5} = {053E1EE2-75B4-4D9A-B8AE-89600BCB60A5} + {1311DEDF-B04C-4E96-BFDC-5D9FA0B05AC7} = {1311DEDF-B04C-4E96-BFDC-5D9FA0B05AC7} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "net-main", "net-main\net-main.vcproj", "{053E1EE2-75B4-4D9A-B8AE-89600BCB60A5}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nq-server", "nq-server\nq-server.vcproj", "{231C032C-DE16-459A-8E7D-6509C2EC3998}" + ProjectSection(ProjectDependencies) = postProject + {B37FE734-01F4-4799-86B2-D084820715BE} = {B37FE734-01F4-4799-86B2-D084820715BE} + {01C3B138-9D45-4ED6-A763-893C067262C2} = {01C3B138-9D45-4ED6-A763-893C067262C2} + {6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80} = {6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80} + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + {04FA9D77-E45F-4917-B972-B353BA6A6FA8} = {04FA9D77-E45F-4917-B972-B353BA6A6FA8} + {51028ACF-53D4-4478-8500-55E6B8A81375} = {51028ACF-53D4-4478-8500-55E6B8A81375} + {2626C0E1-6F5C-47D3-B80D-93942D766DD7} = {2626C0E1-6F5C-47D3-B80D-93942D766DD7} + {053E1EE2-75B4-4D9A-B8AE-89600BCB60A5} = {053E1EE2-75B4-4D9A-B8AE-89600BCB60A5} + {ED4AFBF5-C247-4352-966D-048B8998C6A1} = {ED4AFBF5-C247-4352-966D-048B8998C6A1} + {DE7E8FF8-0F5D-4062-A5C0-CFA3502E7A5A} = {DE7E8FF8-0F5D-4062-A5C0-CFA3502E7A5A} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hw-master", "hw-master\hw-master.vcproj", "{419FEFBE-D9D5-4149-974B-0FFFC8D0D93F}" + ProjectSection(ProjectDependencies) = postProject + {ED4AFBF5-C247-4352-966D-048B8998C6A1} = {ED4AFBF5-C247-4352-966D-048B8998C6A1} + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + {B37FE734-01F4-4799-86B2-D084820715BE} = {B37FE734-01F4-4799-86B2-D084820715BE} + {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0} = {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qfcc", "qfcc\qfcc.vcproj", "{40639893-4D75-48CD-811F-4B363CC71FFA}" + ProjectSection(ProjectDependencies) = postProject + {2626C0E1-6F5C-47D3-B80D-93942D766DD7} = {2626C0E1-6F5C-47D3-B80D-93942D766DD7} + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qw-client-wgl", "qw-client-wgl\qw-client-wgl.vcproj", "{5FD733BF-B3C6-4A96-BED7-35E2484448E1}" + ProjectSection(ProjectDependencies) = postProject + {04FA9D77-E45F-4917-B972-B353BA6A6FA8} = {04FA9D77-E45F-4917-B972-B353BA6A6FA8} + {226D42CE-5833-444E-94FA-84C1D51892A8} = {226D42CE-5833-444E-94FA-84C1D51892A8} + {1311DEDF-B04C-4E96-BFDC-5D9FA0B05AC7} = {1311DEDF-B04C-4E96-BFDC-5D9FA0B05AC7} + {2626C0E1-6F5C-47D3-B80D-93942D766DD7} = {2626C0E1-6F5C-47D3-B80D-93942D766DD7} + {ED4AFBF5-C247-4352-966D-048B8998C6A1} = {ED4AFBF5-C247-4352-966D-048B8998C6A1} + {51028ACF-53D4-4478-8500-55E6B8A81375} = {51028ACF-53D4-4478-8500-55E6B8A81375} + {BF149D97-7520-4788-9CD1-3D99C5C8150F} = {BF149D97-7520-4788-9CD1-3D99C5C8150F} + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + {E7B3D07D-2FE8-481B-8DAB-6255A412A42F} = {E7B3D07D-2FE8-481B-8DAB-6255A412A42F} + {9A942925-61E6-4975-935A-5D62E8248E64} = {9A942925-61E6-4975-935A-5D62E8248E64} + {6ADA4322-693A-46BB-897B-17BB5BE9F08C} = {6ADA4322-693A-46BB-897B-17BB5BE9F08C} + {BC1F021A-1EEC-4A7A-B746-5AA6048E478C} = {BC1F021A-1EEC-4A7A-B746-5AA6048E478C} + {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0} = {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0} + {C55D5FBF-43A0-4F6C-BCF6-BAE5705C121F} = {C55D5FBF-43A0-4F6C-BCF6-BAE5705C121F} + {5203F034-0047-4EC0-B7E9-D037FAF5D536} = {5203F034-0047-4EC0-B7E9-D037FAF5D536} + {178D81A7-F2FB-41D7-B300-9D1A4DE5E137} = {178D81A7-F2FB-41D7-B300-9D1A4DE5E137} + {01C3B138-9D45-4ED6-A763-893C067262C2} = {01C3B138-9D45-4ED6-A763-893C067262C2} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qw-client-sgl", "qw-client-sgl\qw-client-sgl.vcproj", "{649C4168-1C65-4E41-818F-85A1C52C1B8F}" + ProjectSection(ProjectDependencies) = postProject + {5203F034-0047-4EC0-B7E9-D037FAF5D536} = {5203F034-0047-4EC0-B7E9-D037FAF5D536} + {01C3B138-9D45-4ED6-A763-893C067262C2} = {01C3B138-9D45-4ED6-A763-893C067262C2} + {04FA9D77-E45F-4917-B972-B353BA6A6FA8} = {04FA9D77-E45F-4917-B972-B353BA6A6FA8} + {E7B3D07D-2FE8-481B-8DAB-6255A412A42F} = {E7B3D07D-2FE8-481B-8DAB-6255A412A42F} + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + {BF149D97-7520-4788-9CD1-3D99C5C8150F} = {BF149D97-7520-4788-9CD1-3D99C5C8150F} + {226D42CE-5833-444E-94FA-84C1D51892A8} = {226D42CE-5833-444E-94FA-84C1D51892A8} + {51028ACF-53D4-4478-8500-55E6B8A81375} = {51028ACF-53D4-4478-8500-55E6B8A81375} + {BC1F021A-1EEC-4A7A-B746-5AA6048E478C} = {BC1F021A-1EEC-4A7A-B746-5AA6048E478C} + {9A942925-61E6-4975-935A-5D62E8248E64} = {9A942925-61E6-4975-935A-5D62E8248E64} + {6ADA4322-693A-46BB-897B-17BB5BE9F08C} = {6ADA4322-693A-46BB-897B-17BB5BE9F08C} + {1311DEDF-B04C-4E96-BFDC-5D9FA0B05AC7} = {1311DEDF-B04C-4E96-BFDC-5D9FA0B05AC7} + {2626C0E1-6F5C-47D3-B80D-93942D766DD7} = {2626C0E1-6F5C-47D3-B80D-93942D766DD7} + {ED4AFBF5-C247-4352-966D-048B8998C6A1} = {ED4AFBF5-C247-4352-966D-048B8998C6A1} + {C55D5FBF-43A0-4F6C-BCF6-BAE5705C121F} = {C55D5FBF-43A0-4F6C-BCF6-BAE5705C121F} + {44A18410-3AA8-4A64-935B-D20223AD6885} = {44A18410-3AA8-4A64-935B-D20223AD6885} + {7E30C3B1-AEE7-483D-B231-C672365CD2D7} = {7E30C3B1-AEE7-483D-B231-C672365CD2D7} + {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0} = {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "video-gl", "videogl\videogl.vcproj", "{C55D5FBF-43A0-4F6C-BCF6-BAE5705C121F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "video-sdl", "video-sdl\video-sdl.vcproj", "{44A18410-3AA8-4A64-935B-D20223AD6885}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qw-client-sdl", "qw-client-sdl\qw-client-sdl.vcproj", "{B44CB3E0-F2FD-4260-A632-C01FB881613E}" + ProjectSection(ProjectDependencies) = postProject + {66D3A191-E4D5-45F3-86BD-EFBB249CD554} = {66D3A191-E4D5-45F3-86BD-EFBB249CD554} + {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0} = {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0} + {44A18410-3AA8-4A64-935B-D20223AD6885} = {44A18410-3AA8-4A64-935B-D20223AD6885} + {BC1F021A-1EEC-4A7A-B746-5AA6048E478C} = {BC1F021A-1EEC-4A7A-B746-5AA6048E478C} + {6ADA4322-693A-46BB-897B-17BB5BE9F08C} = {6ADA4322-693A-46BB-897B-17BB5BE9F08C} + {9A942925-61E6-4975-935A-5D62E8248E64} = {9A942925-61E6-4975-935A-5D62E8248E64} + {5203F034-0047-4EC0-B7E9-D037FAF5D536} = {5203F034-0047-4EC0-B7E9-D037FAF5D536} + {01C3B138-9D45-4ED6-A763-893C067262C2} = {01C3B138-9D45-4ED6-A763-893C067262C2} + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + {04FA9D77-E45F-4917-B972-B353BA6A6FA8} = {04FA9D77-E45F-4917-B972-B353BA6A6FA8} + {E7B3D07D-2FE8-481B-8DAB-6255A412A42F} = {E7B3D07D-2FE8-481B-8DAB-6255A412A42F} + {BF149D97-7520-4788-9CD1-3D99C5C8150F} = {BF149D97-7520-4788-9CD1-3D99C5C8150F} + {226D42CE-5833-444E-94FA-84C1D51892A8} = {226D42CE-5833-444E-94FA-84C1D51892A8} + {2626C0E1-6F5C-47D3-B80D-93942D766DD7} = {2626C0E1-6F5C-47D3-B80D-93942D766DD7} + {ED4AFBF5-C247-4352-966D-048B8998C6A1} = {ED4AFBF5-C247-4352-966D-048B8998C6A1} + {51028ACF-53D4-4478-8500-55E6B8A81375} = {51028ACF-53D4-4478-8500-55E6B8A81375} + {F4A9881E-0EB0-44A1-9664-B6CBDE992861} = {F4A9881E-0EB0-44A1-9664-B6CBDE992861} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "models-sw", "models-sw\models-sw.vcproj", "{F4A9881E-0EB0-44A1-9664-B6CBDE992861}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "video-sw", "video-sw\video-sw.vcproj", "{66D3A191-E4D5-45F3-86BD-EFBB249CD554}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "qw-client-sdl32", "qw-client-sdl32\qw-client-sdl32.vcproj", "{CBD0DD82-4DC7-4398-AF32-FD7BFFA3C2D5}" + ProjectSection(ProjectDependencies) = postProject + {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0} = {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0} + {44A18410-3AA8-4A64-935B-D20223AD6885} = {44A18410-3AA8-4A64-935B-D20223AD6885} + {BC1F021A-1EEC-4A7A-B746-5AA6048E478C} = {BC1F021A-1EEC-4A7A-B746-5AA6048E478C} + {F4A9881E-0EB0-44A1-9664-B6CBDE992861} = {F4A9881E-0EB0-44A1-9664-B6CBDE992861} + {6ADA4322-693A-46BB-897B-17BB5BE9F08C} = {6ADA4322-693A-46BB-897B-17BB5BE9F08C} + {9A942925-61E6-4975-935A-5D62E8248E64} = {9A942925-61E6-4975-935A-5D62E8248E64} + {5203F034-0047-4EC0-B7E9-D037FAF5D536} = {5203F034-0047-4EC0-B7E9-D037FAF5D536} + {01C3B138-9D45-4ED6-A763-893C067262C2} = {01C3B138-9D45-4ED6-A763-893C067262C2} + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + {04FA9D77-E45F-4917-B972-B353BA6A6FA8} = {04FA9D77-E45F-4917-B972-B353BA6A6FA8} + {E7B3D07D-2FE8-481B-8DAB-6255A412A42F} = {E7B3D07D-2FE8-481B-8DAB-6255A412A42F} + {D5B9558F-EF25-4167-ACE4-723C7413B390} = {D5B9558F-EF25-4167-ACE4-723C7413B390} + {BF149D97-7520-4788-9CD1-3D99C5C8150F} = {BF149D97-7520-4788-9CD1-3D99C5C8150F} + {226D42CE-5833-444E-94FA-84C1D51892A8} = {226D42CE-5833-444E-94FA-84C1D51892A8} + {51028ACF-53D4-4478-8500-55E6B8A81375} = {51028ACF-53D4-4478-8500-55E6B8A81375} + {2626C0E1-6F5C-47D3-B80D-93942D766DD7} = {2626C0E1-6F5C-47D3-B80D-93942D766DD7} + {ED4AFBF5-C247-4352-966D-048B8998C6A1} = {ED4AFBF5-C247-4352-966D-048B8998C6A1} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "video-sw32", "video-sw32\video-sw32.vcproj", "{D5B9558F-EF25-4167-ACE4-723C7413B390}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nq", "nq\nq.vcproj", "{155112B9-A8A9-4E06-90F5-4AAAB32B2F70}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "video-wgl", "video-wgl\video-wgl.vcproj", "{178D81A7-F2FB-41D7-B300-9D1A4DE5E137}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "video-sgl", "video-sgl\video-sgl.vcproj", "{7E30C3B1-AEE7-483D-B231-C672365CD2D7}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nq-sgl", "nq-sgl\nq-sgl.vcproj", "{2E26DB8B-9E37-4072-B397-8A7086E0ACD0}" + ProjectSection(ProjectDependencies) = postProject + {B37FE734-01F4-4799-86B2-D084820715BE} = {B37FE734-01F4-4799-86B2-D084820715BE} + {5203F034-0047-4EC0-B7E9-D037FAF5D536} = {5203F034-0047-4EC0-B7E9-D037FAF5D536} + {01C3B138-9D45-4ED6-A763-893C067262C2} = {01C3B138-9D45-4ED6-A763-893C067262C2} + {6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80} = {6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80} + {04FA9D77-E45F-4917-B972-B353BA6A6FA8} = {04FA9D77-E45F-4917-B972-B353BA6A6FA8} + {7E30C3B1-AEE7-483D-B231-C672365CD2D7} = {7E30C3B1-AEE7-483D-B231-C672365CD2D7} + {44A18410-3AA8-4A64-935B-D20223AD6885} = {44A18410-3AA8-4A64-935B-D20223AD6885} + {155112B9-A8A9-4E06-90F5-4AAAB32B2F70} = {155112B9-A8A9-4E06-90F5-4AAAB32B2F70} + {C55D5FBF-43A0-4F6C-BCF6-BAE5705C121F} = {C55D5FBF-43A0-4F6C-BCF6-BAE5705C121F} + {E7B3D07D-2FE8-481B-8DAB-6255A412A42F} = {E7B3D07D-2FE8-481B-8DAB-6255A412A42F} + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + {BF149D97-7520-4788-9CD1-3D99C5C8150F} = {BF149D97-7520-4788-9CD1-3D99C5C8150F} + {51028ACF-53D4-4478-8500-55E6B8A81375} = {51028ACF-53D4-4478-8500-55E6B8A81375} + {226D42CE-5833-444E-94FA-84C1D51892A8} = {226D42CE-5833-444E-94FA-84C1D51892A8} + {2626C0E1-6F5C-47D3-B80D-93942D766DD7} = {2626C0E1-6F5C-47D3-B80D-93942D766DD7} + {053E1EE2-75B4-4D9A-B8AE-89600BCB60A5} = {053E1EE2-75B4-4D9A-B8AE-89600BCB60A5} + {ED4AFBF5-C247-4352-966D-048B8998C6A1} = {ED4AFBF5-C247-4352-966D-048B8998C6A1} + {1311DEDF-B04C-4E96-BFDC-5D9FA0B05AC7} = {1311DEDF-B04C-4E96-BFDC-5D9FA0B05AC7} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nq-sdl", "nq-sdl\nq-sdl.vcproj", "{2736D4F9-EA8B-4ADF-B2D9-B705FF288A8A}" + ProjectSection(ProjectDependencies) = postProject + {ED4AFBF5-C247-4352-966D-048B8998C6A1} = {ED4AFBF5-C247-4352-966D-048B8998C6A1} + {053E1EE2-75B4-4D9A-B8AE-89600BCB60A5} = {053E1EE2-75B4-4D9A-B8AE-89600BCB60A5} + {2626C0E1-6F5C-47D3-B80D-93942D766DD7} = {2626C0E1-6F5C-47D3-B80D-93942D766DD7} + {51028ACF-53D4-4478-8500-55E6B8A81375} = {51028ACF-53D4-4478-8500-55E6B8A81375} + {226D42CE-5833-444E-94FA-84C1D51892A8} = {226D42CE-5833-444E-94FA-84C1D51892A8} + {155112B9-A8A9-4E06-90F5-4AAAB32B2F70} = {155112B9-A8A9-4E06-90F5-4AAAB32B2F70} + {BF149D97-7520-4788-9CD1-3D99C5C8150F} = {BF149D97-7520-4788-9CD1-3D99C5C8150F} + {66D3A191-E4D5-45F3-86BD-EFBB249CD554} = {66D3A191-E4D5-45F3-86BD-EFBB249CD554} + {E7B3D07D-2FE8-481B-8DAB-6255A412A42F} = {E7B3D07D-2FE8-481B-8DAB-6255A412A42F} + {04FA9D77-E45F-4917-B972-B353BA6A6FA8} = {04FA9D77-E45F-4917-B972-B353BA6A6FA8} + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + {6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80} = {6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80} + {01C3B138-9D45-4ED6-A763-893C067262C2} = {01C3B138-9D45-4ED6-A763-893C067262C2} + {5203F034-0047-4EC0-B7E9-D037FAF5D536} = {5203F034-0047-4EC0-B7E9-D037FAF5D536} + {B37FE734-01F4-4799-86B2-D084820715BE} = {B37FE734-01F4-4799-86B2-D084820715BE} + {F4A9881E-0EB0-44A1-9664-B6CBDE992861} = {F4A9881E-0EB0-44A1-9664-B6CBDE992861} + {44A18410-3AA8-4A64-935B-D20223AD6885} = {44A18410-3AA8-4A64-935B-D20223AD6885} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "nq-sdl32", "nq-sdl32\nq-sdl32.vcproj", "{2CEB1965-A89C-4422-A9AC-B30FCE7913C3}" + ProjectSection(ProjectDependencies) = postProject + {44A18410-3AA8-4A64-935B-D20223AD6885} = {44A18410-3AA8-4A64-935B-D20223AD6885} + {F4A9881E-0EB0-44A1-9664-B6CBDE992861} = {F4A9881E-0EB0-44A1-9664-B6CBDE992861} + {B37FE734-01F4-4799-86B2-D084820715BE} = {B37FE734-01F4-4799-86B2-D084820715BE} + {5203F034-0047-4EC0-B7E9-D037FAF5D536} = {5203F034-0047-4EC0-B7E9-D037FAF5D536} + {01C3B138-9D45-4ED6-A763-893C067262C2} = {01C3B138-9D45-4ED6-A763-893C067262C2} + {6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80} = {6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80} + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} = {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB} + {04FA9D77-E45F-4917-B972-B353BA6A6FA8} = {04FA9D77-E45F-4917-B972-B353BA6A6FA8} + {E7B3D07D-2FE8-481B-8DAB-6255A412A42F} = {E7B3D07D-2FE8-481B-8DAB-6255A412A42F} + {D5B9558F-EF25-4167-ACE4-723C7413B390} = {D5B9558F-EF25-4167-ACE4-723C7413B390} + {BF149D97-7520-4788-9CD1-3D99C5C8150F} = {BF149D97-7520-4788-9CD1-3D99C5C8150F} + {155112B9-A8A9-4E06-90F5-4AAAB32B2F70} = {155112B9-A8A9-4E06-90F5-4AAAB32B2F70} + {226D42CE-5833-444E-94FA-84C1D51892A8} = {226D42CE-5833-444E-94FA-84C1D51892A8} + {51028ACF-53D4-4478-8500-55E6B8A81375} = {51028ACF-53D4-4478-8500-55E6B8A81375} + {2626C0E1-6F5C-47D3-B80D-93942D766DD7} = {2626C0E1-6F5C-47D3-B80D-93942D766DD7} + {053E1EE2-75B4-4D9A-B8AE-89600BCB60A5} = {053E1EE2-75B4-4D9A-B8AE-89600BCB60A5} + {ED4AFBF5-C247-4352-966D-048B8998C6A1} = {ED4AFBF5-C247-4352-966D-048B8998C6A1} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release (static)|Win32 = Release (static)|Win32 + Release (static)|x64 = Release (static)|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9A942925-61E6-4975-935A-5D62E8248E64}.Debug|Win32.ActiveCfg = Debug|Win32 + {9A942925-61E6-4975-935A-5D62E8248E64}.Debug|Win32.Build.0 = Debug|Win32 + {9A942925-61E6-4975-935A-5D62E8248E64}.Debug|x64.ActiveCfg = Debug|x64 + {9A942925-61E6-4975-935A-5D62E8248E64}.Debug|x64.Build.0 = Debug|x64 + {9A942925-61E6-4975-935A-5D62E8248E64}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {9A942925-61E6-4975-935A-5D62E8248E64}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {9A942925-61E6-4975-935A-5D62E8248E64}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {9A942925-61E6-4975-935A-5D62E8248E64}.Release (static)|x64.Build.0 = Release (static)|x64 + {9A942925-61E6-4975-935A-5D62E8248E64}.Release|Win32.ActiveCfg = Release|Win32 + {9A942925-61E6-4975-935A-5D62E8248E64}.Release|Win32.Build.0 = Release|Win32 + {9A942925-61E6-4975-935A-5D62E8248E64}.Release|x64.ActiveCfg = Release|x64 + {9A942925-61E6-4975-935A-5D62E8248E64}.Release|x64.Build.0 = Release|x64 + {6ADA4322-693A-46BB-897B-17BB5BE9F08C}.Debug|Win32.ActiveCfg = Debug|Win32 + {6ADA4322-693A-46BB-897B-17BB5BE9F08C}.Debug|Win32.Build.0 = Debug|Win32 + {6ADA4322-693A-46BB-897B-17BB5BE9F08C}.Debug|x64.ActiveCfg = Debug|x64 + {6ADA4322-693A-46BB-897B-17BB5BE9F08C}.Debug|x64.Build.0 = Debug|x64 + {6ADA4322-693A-46BB-897B-17BB5BE9F08C}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {6ADA4322-693A-46BB-897B-17BB5BE9F08C}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {6ADA4322-693A-46BB-897B-17BB5BE9F08C}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {6ADA4322-693A-46BB-897B-17BB5BE9F08C}.Release (static)|x64.Build.0 = Release (static)|x64 + {6ADA4322-693A-46BB-897B-17BB5BE9F08C}.Release|Win32.ActiveCfg = Release|Win32 + {6ADA4322-693A-46BB-897B-17BB5BE9F08C}.Release|Win32.Build.0 = Release|Win32 + {6ADA4322-693A-46BB-897B-17BB5BE9F08C}.Release|x64.ActiveCfg = Release|x64 + {6ADA4322-693A-46BB-897B-17BB5BE9F08C}.Release|x64.Build.0 = Release|x64 + {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0}.Debug|Win32.ActiveCfg = Debug|Win32 + {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0}.Debug|Win32.Build.0 = Debug|Win32 + {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0}.Debug|x64.ActiveCfg = Debug|x64 + {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0}.Debug|x64.Build.0 = Debug|x64 + {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0}.Release (static)|x64.Build.0 = Release (static)|x64 + {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0}.Release|Win32.ActiveCfg = Release|Win32 + {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0}.Release|Win32.Build.0 = Release|Win32 + {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0}.Release|x64.ActiveCfg = Release|x64 + {6540C00F-C5EF-4C8B-824D-F2B7B302F0E0}.Release|x64.Build.0 = Release|x64 + {51028ACF-53D4-4478-8500-55E6B8A81375}.Debug|Win32.ActiveCfg = Debug|Win32 + {51028ACF-53D4-4478-8500-55E6B8A81375}.Debug|Win32.Build.0 = Debug|Win32 + {51028ACF-53D4-4478-8500-55E6B8A81375}.Debug|x64.ActiveCfg = Debug|x64 + {51028ACF-53D4-4478-8500-55E6B8A81375}.Debug|x64.Build.0 = Debug|x64 + {51028ACF-53D4-4478-8500-55E6B8A81375}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {51028ACF-53D4-4478-8500-55E6B8A81375}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {51028ACF-53D4-4478-8500-55E6B8A81375}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {51028ACF-53D4-4478-8500-55E6B8A81375}.Release (static)|x64.Build.0 = Release (static)|x64 + {51028ACF-53D4-4478-8500-55E6B8A81375}.Release|Win32.ActiveCfg = Release|Win32 + {51028ACF-53D4-4478-8500-55E6B8A81375}.Release|Win32.Build.0 = Release|Win32 + {51028ACF-53D4-4478-8500-55E6B8A81375}.Release|x64.ActiveCfg = Release|x64 + {51028ACF-53D4-4478-8500-55E6B8A81375}.Release|x64.Build.0 = Release|x64 + {1311DEDF-B04C-4E96-BFDC-5D9FA0B05AC7}.Debug|Win32.ActiveCfg = Debug|Win32 + {1311DEDF-B04C-4E96-BFDC-5D9FA0B05AC7}.Debug|Win32.Build.0 = Debug|Win32 + {1311DEDF-B04C-4E96-BFDC-5D9FA0B05AC7}.Debug|x64.ActiveCfg = Debug|x64 + {1311DEDF-B04C-4E96-BFDC-5D9FA0B05AC7}.Debug|x64.Build.0 = Debug|x64 + {1311DEDF-B04C-4E96-BFDC-5D9FA0B05AC7}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {1311DEDF-B04C-4E96-BFDC-5D9FA0B05AC7}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {1311DEDF-B04C-4E96-BFDC-5D9FA0B05AC7}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {1311DEDF-B04C-4E96-BFDC-5D9FA0B05AC7}.Release (static)|x64.Build.0 = Release (static)|x64 + {1311DEDF-B04C-4E96-BFDC-5D9FA0B05AC7}.Release|Win32.ActiveCfg = Release|Win32 + {1311DEDF-B04C-4E96-BFDC-5D9FA0B05AC7}.Release|Win32.Build.0 = Release|Win32 + {1311DEDF-B04C-4E96-BFDC-5D9FA0B05AC7}.Release|x64.ActiveCfg = Release|x64 + {1311DEDF-B04C-4E96-BFDC-5D9FA0B05AC7}.Release|x64.Build.0 = Release|x64 + {ED4AFBF5-C247-4352-966D-048B8998C6A1}.Debug|Win32.ActiveCfg = Debug|Win32 + {ED4AFBF5-C247-4352-966D-048B8998C6A1}.Debug|Win32.Build.0 = Debug|Win32 + {ED4AFBF5-C247-4352-966D-048B8998C6A1}.Debug|x64.ActiveCfg = Debug|x64 + {ED4AFBF5-C247-4352-966D-048B8998C6A1}.Debug|x64.Build.0 = Debug|x64 + {ED4AFBF5-C247-4352-966D-048B8998C6A1}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {ED4AFBF5-C247-4352-966D-048B8998C6A1}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {ED4AFBF5-C247-4352-966D-048B8998C6A1}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {ED4AFBF5-C247-4352-966D-048B8998C6A1}.Release (static)|x64.Build.0 = Release (static)|x64 + {ED4AFBF5-C247-4352-966D-048B8998C6A1}.Release|Win32.ActiveCfg = Release|Win32 + {ED4AFBF5-C247-4352-966D-048B8998C6A1}.Release|Win32.Build.0 = Release|Win32 + {ED4AFBF5-C247-4352-966D-048B8998C6A1}.Release|x64.ActiveCfg = Release|x64 + {ED4AFBF5-C247-4352-966D-048B8998C6A1}.Release|x64.Build.0 = Release|x64 + {01C3B138-9D45-4ED6-A763-893C067262C2}.Debug|Win32.ActiveCfg = Debug|Win32 + {01C3B138-9D45-4ED6-A763-893C067262C2}.Debug|Win32.Build.0 = Debug|Win32 + {01C3B138-9D45-4ED6-A763-893C067262C2}.Debug|x64.ActiveCfg = Debug|x64 + {01C3B138-9D45-4ED6-A763-893C067262C2}.Debug|x64.Build.0 = Debug|x64 + {01C3B138-9D45-4ED6-A763-893C067262C2}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {01C3B138-9D45-4ED6-A763-893C067262C2}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {01C3B138-9D45-4ED6-A763-893C067262C2}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {01C3B138-9D45-4ED6-A763-893C067262C2}.Release (static)|x64.Build.0 = Release (static)|x64 + {01C3B138-9D45-4ED6-A763-893C067262C2}.Release|Win32.ActiveCfg = Release|Win32 + {01C3B138-9D45-4ED6-A763-893C067262C2}.Release|Win32.Build.0 = Release|Win32 + {01C3B138-9D45-4ED6-A763-893C067262C2}.Release|x64.ActiveCfg = Release|x64 + {01C3B138-9D45-4ED6-A763-893C067262C2}.Release|x64.Build.0 = Release|x64 + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB}.Debug|Win32.ActiveCfg = Debug|Win32 + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB}.Debug|Win32.Build.0 = Debug|Win32 + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB}.Debug|x64.ActiveCfg = Debug|x64 + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB}.Debug|x64.Build.0 = Debug|x64 + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB}.Release (static)|x64.Build.0 = Release (static)|x64 + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB}.Release|Win32.ActiveCfg = Release|Win32 + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB}.Release|Win32.Build.0 = Release|Win32 + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB}.Release|x64.ActiveCfg = Release|x64 + {ACCC6F49-7E06-4395-AAF4-3C03A68F49EB}.Release|x64.Build.0 = Release|x64 + {2626C0E1-6F5C-47D3-B80D-93942D766DD7}.Debug|Win32.ActiveCfg = Debug|Win32 + {2626C0E1-6F5C-47D3-B80D-93942D766DD7}.Debug|Win32.Build.0 = Debug|Win32 + {2626C0E1-6F5C-47D3-B80D-93942D766DD7}.Debug|x64.ActiveCfg = Debug|x64 + {2626C0E1-6F5C-47D3-B80D-93942D766DD7}.Debug|x64.Build.0 = Debug|x64 + {2626C0E1-6F5C-47D3-B80D-93942D766DD7}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {2626C0E1-6F5C-47D3-B80D-93942D766DD7}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {2626C0E1-6F5C-47D3-B80D-93942D766DD7}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {2626C0E1-6F5C-47D3-B80D-93942D766DD7}.Release (static)|x64.Build.0 = Release (static)|x64 + {2626C0E1-6F5C-47D3-B80D-93942D766DD7}.Release|Win32.ActiveCfg = Release|Win32 + {2626C0E1-6F5C-47D3-B80D-93942D766DD7}.Release|Win32.Build.0 = Release|Win32 + {2626C0E1-6F5C-47D3-B80D-93942D766DD7}.Release|x64.ActiveCfg = Release|x64 + {2626C0E1-6F5C-47D3-B80D-93942D766DD7}.Release|x64.Build.0 = Release|x64 + {04FA9D77-E45F-4917-B972-B353BA6A6FA8}.Debug|Win32.ActiveCfg = Debug|Win32 + {04FA9D77-E45F-4917-B972-B353BA6A6FA8}.Debug|Win32.Build.0 = Debug|Win32 + {04FA9D77-E45F-4917-B972-B353BA6A6FA8}.Debug|x64.ActiveCfg = Debug|x64 + {04FA9D77-E45F-4917-B972-B353BA6A6FA8}.Debug|x64.Build.0 = Debug|x64 + {04FA9D77-E45F-4917-B972-B353BA6A6FA8}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {04FA9D77-E45F-4917-B972-B353BA6A6FA8}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {04FA9D77-E45F-4917-B972-B353BA6A6FA8}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {04FA9D77-E45F-4917-B972-B353BA6A6FA8}.Release (static)|x64.Build.0 = Release (static)|x64 + {04FA9D77-E45F-4917-B972-B353BA6A6FA8}.Release|Win32.ActiveCfg = Release|Win32 + {04FA9D77-E45F-4917-B972-B353BA6A6FA8}.Release|Win32.Build.0 = Release|Win32 + {04FA9D77-E45F-4917-B972-B353BA6A6FA8}.Release|x64.ActiveCfg = Release|x64 + {04FA9D77-E45F-4917-B972-B353BA6A6FA8}.Release|x64.Build.0 = Release|x64 + {BF149D97-7520-4788-9CD1-3D99C5C8150F}.Debug|Win32.ActiveCfg = Debug|Win32 + {BF149D97-7520-4788-9CD1-3D99C5C8150F}.Debug|Win32.Build.0 = Debug|Win32 + {BF149D97-7520-4788-9CD1-3D99C5C8150F}.Debug|x64.ActiveCfg = Debug|x64 + {BF149D97-7520-4788-9CD1-3D99C5C8150F}.Debug|x64.Build.0 = Debug|x64 + {BF149D97-7520-4788-9CD1-3D99C5C8150F}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {BF149D97-7520-4788-9CD1-3D99C5C8150F}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {BF149D97-7520-4788-9CD1-3D99C5C8150F}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {BF149D97-7520-4788-9CD1-3D99C5C8150F}.Release (static)|x64.Build.0 = Release (static)|x64 + {BF149D97-7520-4788-9CD1-3D99C5C8150F}.Release|Win32.ActiveCfg = Release|Win32 + {BF149D97-7520-4788-9CD1-3D99C5C8150F}.Release|Win32.Build.0 = Release|Win32 + {BF149D97-7520-4788-9CD1-3D99C5C8150F}.Release|x64.ActiveCfg = Release|x64 + {BF149D97-7520-4788-9CD1-3D99C5C8150F}.Release|x64.Build.0 = Release|x64 + {5203F034-0047-4EC0-B7E9-D037FAF5D536}.Debug|Win32.ActiveCfg = Debug|Win32 + {5203F034-0047-4EC0-B7E9-D037FAF5D536}.Debug|Win32.Build.0 = Debug|Win32 + {5203F034-0047-4EC0-B7E9-D037FAF5D536}.Debug|x64.ActiveCfg = Debug|x64 + {5203F034-0047-4EC0-B7E9-D037FAF5D536}.Debug|x64.Build.0 = Debug|x64 + {5203F034-0047-4EC0-B7E9-D037FAF5D536}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {5203F034-0047-4EC0-B7E9-D037FAF5D536}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {5203F034-0047-4EC0-B7E9-D037FAF5D536}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {5203F034-0047-4EC0-B7E9-D037FAF5D536}.Release (static)|x64.Build.0 = Release (static)|x64 + {5203F034-0047-4EC0-B7E9-D037FAF5D536}.Release|Win32.ActiveCfg = Release|Win32 + {5203F034-0047-4EC0-B7E9-D037FAF5D536}.Release|Win32.Build.0 = Release|Win32 + {5203F034-0047-4EC0-B7E9-D037FAF5D536}.Release|x64.ActiveCfg = Release|x64 + {5203F034-0047-4EC0-B7E9-D037FAF5D536}.Release|x64.Build.0 = Release|x64 + {E7B3D07D-2FE8-481B-8DAB-6255A412A42F}.Debug|Win32.ActiveCfg = Debug|Win32 + {E7B3D07D-2FE8-481B-8DAB-6255A412A42F}.Debug|Win32.Build.0 = Debug|Win32 + {E7B3D07D-2FE8-481B-8DAB-6255A412A42F}.Debug|x64.ActiveCfg = Debug|x64 + {E7B3D07D-2FE8-481B-8DAB-6255A412A42F}.Debug|x64.Build.0 = Debug|x64 + {E7B3D07D-2FE8-481B-8DAB-6255A412A42F}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {E7B3D07D-2FE8-481B-8DAB-6255A412A42F}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {E7B3D07D-2FE8-481B-8DAB-6255A412A42F}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {E7B3D07D-2FE8-481B-8DAB-6255A412A42F}.Release (static)|x64.Build.0 = Release (static)|x64 + {E7B3D07D-2FE8-481B-8DAB-6255A412A42F}.Release|Win32.ActiveCfg = Release|Win32 + {E7B3D07D-2FE8-481B-8DAB-6255A412A42F}.Release|Win32.Build.0 = Release|Win32 + {E7B3D07D-2FE8-481B-8DAB-6255A412A42F}.Release|x64.ActiveCfg = Release|x64 + {E7B3D07D-2FE8-481B-8DAB-6255A412A42F}.Release|x64.Build.0 = Release|x64 + {BC1F021A-1EEC-4A7A-B746-5AA6048E478C}.Debug|Win32.ActiveCfg = Debug|Win32 + {BC1F021A-1EEC-4A7A-B746-5AA6048E478C}.Debug|Win32.Build.0 = Debug|Win32 + {BC1F021A-1EEC-4A7A-B746-5AA6048E478C}.Debug|x64.ActiveCfg = Debug|x64 + {BC1F021A-1EEC-4A7A-B746-5AA6048E478C}.Debug|x64.Build.0 = Debug|x64 + {BC1F021A-1EEC-4A7A-B746-5AA6048E478C}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {BC1F021A-1EEC-4A7A-B746-5AA6048E478C}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {BC1F021A-1EEC-4A7A-B746-5AA6048E478C}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {BC1F021A-1EEC-4A7A-B746-5AA6048E478C}.Release (static)|x64.Build.0 = Release (static)|x64 + {BC1F021A-1EEC-4A7A-B746-5AA6048E478C}.Release|Win32.ActiveCfg = Release|Win32 + {BC1F021A-1EEC-4A7A-B746-5AA6048E478C}.Release|Win32.Build.0 = Release|Win32 + {BC1F021A-1EEC-4A7A-B746-5AA6048E478C}.Release|x64.ActiveCfg = Release|x64 + {BC1F021A-1EEC-4A7A-B746-5AA6048E478C}.Release|x64.Build.0 = Release|x64 + {544D097C-9C24-4C57-A171-8C8029421185}.Debug|Win32.ActiveCfg = Debug|Win32 + {544D097C-9C24-4C57-A171-8C8029421185}.Debug|Win32.Build.0 = Debug|Win32 + {544D097C-9C24-4C57-A171-8C8029421185}.Debug|x64.ActiveCfg = Debug|x64 + {544D097C-9C24-4C57-A171-8C8029421185}.Debug|x64.Build.0 = Debug|x64 + {544D097C-9C24-4C57-A171-8C8029421185}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {544D097C-9C24-4C57-A171-8C8029421185}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {544D097C-9C24-4C57-A171-8C8029421185}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {544D097C-9C24-4C57-A171-8C8029421185}.Release (static)|x64.Build.0 = Release (static)|x64 + {544D097C-9C24-4C57-A171-8C8029421185}.Release|Win32.ActiveCfg = Release|Win32 + {544D097C-9C24-4C57-A171-8C8029421185}.Release|Win32.Build.0 = Release|Win32 + {544D097C-9C24-4C57-A171-8C8029421185}.Release|x64.ActiveCfg = Release|x64 + {544D097C-9C24-4C57-A171-8C8029421185}.Release|x64.Build.0 = Release|x64 + {DE7E8FF8-0F5D-4062-A5C0-CFA3502E7A5A}.Debug|Win32.ActiveCfg = Debug|Win32 + {DE7E8FF8-0F5D-4062-A5C0-CFA3502E7A5A}.Debug|Win32.Build.0 = Debug|Win32 + {DE7E8FF8-0F5D-4062-A5C0-CFA3502E7A5A}.Debug|x64.ActiveCfg = Debug|x64 + {DE7E8FF8-0F5D-4062-A5C0-CFA3502E7A5A}.Debug|x64.Build.0 = Debug|x64 + {DE7E8FF8-0F5D-4062-A5C0-CFA3502E7A5A}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {DE7E8FF8-0F5D-4062-A5C0-CFA3502E7A5A}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {DE7E8FF8-0F5D-4062-A5C0-CFA3502E7A5A}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {DE7E8FF8-0F5D-4062-A5C0-CFA3502E7A5A}.Release (static)|x64.Build.0 = Release (static)|x64 + {DE7E8FF8-0F5D-4062-A5C0-CFA3502E7A5A}.Release|Win32.ActiveCfg = Release|Win32 + {DE7E8FF8-0F5D-4062-A5C0-CFA3502E7A5A}.Release|Win32.Build.0 = Release|Win32 + {DE7E8FF8-0F5D-4062-A5C0-CFA3502E7A5A}.Release|x64.ActiveCfg = Release|x64 + {DE7E8FF8-0F5D-4062-A5C0-CFA3502E7A5A}.Release|x64.Build.0 = Release|x64 + {226D42CE-5833-444E-94FA-84C1D51892A8}.Debug|Win32.ActiveCfg = Debug|Win32 + {226D42CE-5833-444E-94FA-84C1D51892A8}.Debug|Win32.Build.0 = Debug|Win32 + {226D42CE-5833-444E-94FA-84C1D51892A8}.Debug|x64.ActiveCfg = Debug|x64 + {226D42CE-5833-444E-94FA-84C1D51892A8}.Debug|x64.Build.0 = Debug|x64 + {226D42CE-5833-444E-94FA-84C1D51892A8}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {226D42CE-5833-444E-94FA-84C1D51892A8}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {226D42CE-5833-444E-94FA-84C1D51892A8}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {226D42CE-5833-444E-94FA-84C1D51892A8}.Release (static)|x64.Build.0 = Release (static)|x64 + {226D42CE-5833-444E-94FA-84C1D51892A8}.Release|Win32.ActiveCfg = Release|Win32 + {226D42CE-5833-444E-94FA-84C1D51892A8}.Release|Win32.Build.0 = Release|Win32 + {226D42CE-5833-444E-94FA-84C1D51892A8}.Release|x64.ActiveCfg = Release|x64 + {226D42CE-5833-444E-94FA-84C1D51892A8}.Release|x64.Build.0 = Release|x64 + {B37FE734-01F4-4799-86B2-D084820715BE}.Debug|Win32.ActiveCfg = Debug|Win32 + {B37FE734-01F4-4799-86B2-D084820715BE}.Debug|Win32.Build.0 = Debug|Win32 + {B37FE734-01F4-4799-86B2-D084820715BE}.Debug|x64.ActiveCfg = Debug|x64 + {B37FE734-01F4-4799-86B2-D084820715BE}.Debug|x64.Build.0 = Debug|x64 + {B37FE734-01F4-4799-86B2-D084820715BE}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {B37FE734-01F4-4799-86B2-D084820715BE}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {B37FE734-01F4-4799-86B2-D084820715BE}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {B37FE734-01F4-4799-86B2-D084820715BE}.Release (static)|x64.Build.0 = Release (static)|x64 + {B37FE734-01F4-4799-86B2-D084820715BE}.Release|Win32.ActiveCfg = Release|Win32 + {B37FE734-01F4-4799-86B2-D084820715BE}.Release|Win32.Build.0 = Release|Win32 + {B37FE734-01F4-4799-86B2-D084820715BE}.Release|x64.ActiveCfg = Release|x64 + {B37FE734-01F4-4799-86B2-D084820715BE}.Release|x64.Build.0 = Release|x64 + {B00D4025-0437-4FF2-BD0E-D2AE6CF82AC2}.Debug|Win32.ActiveCfg = Debug|Win32 + {B00D4025-0437-4FF2-BD0E-D2AE6CF82AC2}.Debug|Win32.Build.0 = Debug|Win32 + {B00D4025-0437-4FF2-BD0E-D2AE6CF82AC2}.Debug|x64.ActiveCfg = Debug|x64 + {B00D4025-0437-4FF2-BD0E-D2AE6CF82AC2}.Debug|x64.Build.0 = Debug|x64 + {B00D4025-0437-4FF2-BD0E-D2AE6CF82AC2}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {B00D4025-0437-4FF2-BD0E-D2AE6CF82AC2}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {B00D4025-0437-4FF2-BD0E-D2AE6CF82AC2}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {B00D4025-0437-4FF2-BD0E-D2AE6CF82AC2}.Release (static)|x64.Build.0 = Release (static)|x64 + {B00D4025-0437-4FF2-BD0E-D2AE6CF82AC2}.Release|Win32.ActiveCfg = Release|Win32 + {B00D4025-0437-4FF2-BD0E-D2AE6CF82AC2}.Release|Win32.Build.0 = Release|Win32 + {B00D4025-0437-4FF2-BD0E-D2AE6CF82AC2}.Release|x64.ActiveCfg = Release|x64 + {B00D4025-0437-4FF2-BD0E-D2AE6CF82AC2}.Release|x64.Build.0 = Release|x64 + {5E7E6110-89E8-4797-A8E3-EBEF0EF5CAF2}.Debug|Win32.ActiveCfg = Debug|Win32 + {5E7E6110-89E8-4797-A8E3-EBEF0EF5CAF2}.Debug|Win32.Build.0 = Debug|Win32 + {5E7E6110-89E8-4797-A8E3-EBEF0EF5CAF2}.Debug|x64.ActiveCfg = Debug|x64 + {5E7E6110-89E8-4797-A8E3-EBEF0EF5CAF2}.Debug|x64.Build.0 = Debug|x64 + {5E7E6110-89E8-4797-A8E3-EBEF0EF5CAF2}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {5E7E6110-89E8-4797-A8E3-EBEF0EF5CAF2}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {5E7E6110-89E8-4797-A8E3-EBEF0EF5CAF2}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {5E7E6110-89E8-4797-A8E3-EBEF0EF5CAF2}.Release (static)|x64.Build.0 = Release (static)|x64 + {5E7E6110-89E8-4797-A8E3-EBEF0EF5CAF2}.Release|Win32.ActiveCfg = Release|Win32 + {5E7E6110-89E8-4797-A8E3-EBEF0EF5CAF2}.Release|Win32.Build.0 = Release|Win32 + {5E7E6110-89E8-4797-A8E3-EBEF0EF5CAF2}.Release|x64.ActiveCfg = Release|x64 + {5E7E6110-89E8-4797-A8E3-EBEF0EF5CAF2}.Release|x64.Build.0 = Release|x64 + {E5D842C5-669F-4FC7-A5E0-44B562F86435}.Debug|Win32.ActiveCfg = Debug|Win32 + {E5D842C5-669F-4FC7-A5E0-44B562F86435}.Debug|Win32.Build.0 = Debug|Win32 + {E5D842C5-669F-4FC7-A5E0-44B562F86435}.Debug|x64.ActiveCfg = Debug|x64 + {E5D842C5-669F-4FC7-A5E0-44B562F86435}.Debug|x64.Build.0 = Debug|x64 + {E5D842C5-669F-4FC7-A5E0-44B562F86435}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {E5D842C5-669F-4FC7-A5E0-44B562F86435}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {E5D842C5-669F-4FC7-A5E0-44B562F86435}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {E5D842C5-669F-4FC7-A5E0-44B562F86435}.Release (static)|x64.Build.0 = Release (static)|x64 + {E5D842C5-669F-4FC7-A5E0-44B562F86435}.Release|Win32.ActiveCfg = Release|Win32 + {E5D842C5-669F-4FC7-A5E0-44B562F86435}.Release|Win32.Build.0 = Release|Win32 + {E5D842C5-669F-4FC7-A5E0-44B562F86435}.Release|x64.ActiveCfg = Release|x64 + {E5D842C5-669F-4FC7-A5E0-44B562F86435}.Release|x64.Build.0 = Release|x64 + {445A2500-3BBC-449A-A929-C419C2A16051}.Debug|Win32.ActiveCfg = Debug|Win32 + {445A2500-3BBC-449A-A929-C419C2A16051}.Debug|Win32.Build.0 = Debug|Win32 + {445A2500-3BBC-449A-A929-C419C2A16051}.Debug|x64.ActiveCfg = Debug|x64 + {445A2500-3BBC-449A-A929-C419C2A16051}.Debug|x64.Build.0 = Debug|x64 + {445A2500-3BBC-449A-A929-C419C2A16051}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {445A2500-3BBC-449A-A929-C419C2A16051}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {445A2500-3BBC-449A-A929-C419C2A16051}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {445A2500-3BBC-449A-A929-C419C2A16051}.Release (static)|x64.Build.0 = Release (static)|x64 + {445A2500-3BBC-449A-A929-C419C2A16051}.Release|Win32.ActiveCfg = Release|Win32 + {445A2500-3BBC-449A-A929-C419C2A16051}.Release|Win32.Build.0 = Release|Win32 + {445A2500-3BBC-449A-A929-C419C2A16051}.Release|x64.ActiveCfg = Release|x64 + {445A2500-3BBC-449A-A929-C419C2A16051}.Release|x64.Build.0 = Release|x64 + {052C34FE-C9E2-43ED-95DA-FB3F27B44E37}.Debug|Win32.ActiveCfg = Debug|Win32 + {052C34FE-C9E2-43ED-95DA-FB3F27B44E37}.Debug|Win32.Build.0 = Debug|Win32 + {052C34FE-C9E2-43ED-95DA-FB3F27B44E37}.Debug|x64.ActiveCfg = Debug|x64 + {052C34FE-C9E2-43ED-95DA-FB3F27B44E37}.Debug|x64.Build.0 = Debug|x64 + {052C34FE-C9E2-43ED-95DA-FB3F27B44E37}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {052C34FE-C9E2-43ED-95DA-FB3F27B44E37}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {052C34FE-C9E2-43ED-95DA-FB3F27B44E37}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {052C34FE-C9E2-43ED-95DA-FB3F27B44E37}.Release (static)|x64.Build.0 = Release (static)|x64 + {052C34FE-C9E2-43ED-95DA-FB3F27B44E37}.Release|Win32.ActiveCfg = Release|Win32 + {052C34FE-C9E2-43ED-95DA-FB3F27B44E37}.Release|Win32.Build.0 = Release|Win32 + {052C34FE-C9E2-43ED-95DA-FB3F27B44E37}.Release|x64.ActiveCfg = Release|x64 + {052C34FE-C9E2-43ED-95DA-FB3F27B44E37}.Release|x64.Build.0 = Release|x64 + {5FA27C8E-51B1-445A-A375-FBE74F0984B1}.Debug|Win32.ActiveCfg = Debug|Win32 + {5FA27C8E-51B1-445A-A375-FBE74F0984B1}.Debug|Win32.Build.0 = Debug|Win32 + {5FA27C8E-51B1-445A-A375-FBE74F0984B1}.Debug|x64.ActiveCfg = Debug|x64 + {5FA27C8E-51B1-445A-A375-FBE74F0984B1}.Debug|x64.Build.0 = Debug|x64 + {5FA27C8E-51B1-445A-A375-FBE74F0984B1}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {5FA27C8E-51B1-445A-A375-FBE74F0984B1}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {5FA27C8E-51B1-445A-A375-FBE74F0984B1}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {5FA27C8E-51B1-445A-A375-FBE74F0984B1}.Release (static)|x64.Build.0 = Release (static)|x64 + {5FA27C8E-51B1-445A-A375-FBE74F0984B1}.Release|Win32.ActiveCfg = Release|Win32 + {5FA27C8E-51B1-445A-A375-FBE74F0984B1}.Release|Win32.Build.0 = Release|Win32 + {5FA27C8E-51B1-445A-A375-FBE74F0984B1}.Release|x64.ActiveCfg = Release|x64 + {5FA27C8E-51B1-445A-A375-FBE74F0984B1}.Release|x64.Build.0 = Release|x64 + {56BD559B-1590-4FC4-B441-AB1973BAC2BD}.Debug|Win32.ActiveCfg = Debug|Win32 + {56BD559B-1590-4FC4-B441-AB1973BAC2BD}.Debug|Win32.Build.0 = Debug|Win32 + {56BD559B-1590-4FC4-B441-AB1973BAC2BD}.Debug|x64.ActiveCfg = Debug|x64 + {56BD559B-1590-4FC4-B441-AB1973BAC2BD}.Debug|x64.Build.0 = Debug|x64 + {56BD559B-1590-4FC4-B441-AB1973BAC2BD}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {56BD559B-1590-4FC4-B441-AB1973BAC2BD}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {56BD559B-1590-4FC4-B441-AB1973BAC2BD}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {56BD559B-1590-4FC4-B441-AB1973BAC2BD}.Release (static)|x64.Build.0 = Release (static)|x64 + {56BD559B-1590-4FC4-B441-AB1973BAC2BD}.Release|Win32.ActiveCfg = Release|Win32 + {56BD559B-1590-4FC4-B441-AB1973BAC2BD}.Release|Win32.Build.0 = Release|Win32 + {56BD559B-1590-4FC4-B441-AB1973BAC2BD}.Release|x64.ActiveCfg = Release|x64 + {56BD559B-1590-4FC4-B441-AB1973BAC2BD}.Release|x64.Build.0 = Release|x64 + {88422448-C5FB-46F3-A0B3-0811F90E537C}.Debug|Win32.ActiveCfg = Debug|Win32 + {88422448-C5FB-46F3-A0B3-0811F90E537C}.Debug|Win32.Build.0 = Debug|Win32 + {88422448-C5FB-46F3-A0B3-0811F90E537C}.Debug|x64.ActiveCfg = Debug|x64 + {88422448-C5FB-46F3-A0B3-0811F90E537C}.Debug|x64.Build.0 = Debug|x64 + {88422448-C5FB-46F3-A0B3-0811F90E537C}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {88422448-C5FB-46F3-A0B3-0811F90E537C}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {88422448-C5FB-46F3-A0B3-0811F90E537C}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {88422448-C5FB-46F3-A0B3-0811F90E537C}.Release (static)|x64.Build.0 = Release (static)|x64 + {88422448-C5FB-46F3-A0B3-0811F90E537C}.Release|Win32.ActiveCfg = Release|Win32 + {88422448-C5FB-46F3-A0B3-0811F90E537C}.Release|Win32.Build.0 = Release|Win32 + {88422448-C5FB-46F3-A0B3-0811F90E537C}.Release|x64.ActiveCfg = Release|x64 + {88422448-C5FB-46F3-A0B3-0811F90E537C}.Release|x64.Build.0 = Release|x64 + {9EE8BD4B-47D3-4AD5-A8B9-831329792A05}.Debug|Win32.ActiveCfg = Debug|Win32 + {9EE8BD4B-47D3-4AD5-A8B9-831329792A05}.Debug|Win32.Build.0 = Debug|Win32 + {9EE8BD4B-47D3-4AD5-A8B9-831329792A05}.Debug|x64.ActiveCfg = Debug|x64 + {9EE8BD4B-47D3-4AD5-A8B9-831329792A05}.Debug|x64.Build.0 = Debug|x64 + {9EE8BD4B-47D3-4AD5-A8B9-831329792A05}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {9EE8BD4B-47D3-4AD5-A8B9-831329792A05}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {9EE8BD4B-47D3-4AD5-A8B9-831329792A05}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {9EE8BD4B-47D3-4AD5-A8B9-831329792A05}.Release (static)|x64.Build.0 = Release (static)|x64 + {9EE8BD4B-47D3-4AD5-A8B9-831329792A05}.Release|Win32.ActiveCfg = Release|Win32 + {9EE8BD4B-47D3-4AD5-A8B9-831329792A05}.Release|Win32.Build.0 = Release|Win32 + {9EE8BD4B-47D3-4AD5-A8B9-831329792A05}.Release|x64.ActiveCfg = Release|x64 + {9EE8BD4B-47D3-4AD5-A8B9-831329792A05}.Release|x64.Build.0 = Release|x64 + {4605418D-2292-470A-AB18-C2119B016F71}.Debug|Win32.ActiveCfg = Debug|Win32 + {4605418D-2292-470A-AB18-C2119B016F71}.Debug|Win32.Build.0 = Debug|Win32 + {4605418D-2292-470A-AB18-C2119B016F71}.Debug|x64.ActiveCfg = Debug|x64 + {4605418D-2292-470A-AB18-C2119B016F71}.Debug|x64.Build.0 = Debug|x64 + {4605418D-2292-470A-AB18-C2119B016F71}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {4605418D-2292-470A-AB18-C2119B016F71}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {4605418D-2292-470A-AB18-C2119B016F71}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {4605418D-2292-470A-AB18-C2119B016F71}.Release (static)|x64.Build.0 = Release (static)|x64 + {4605418D-2292-470A-AB18-C2119B016F71}.Release|Win32.ActiveCfg = Release|Win32 + {4605418D-2292-470A-AB18-C2119B016F71}.Release|Win32.Build.0 = Release|Win32 + {4605418D-2292-470A-AB18-C2119B016F71}.Release|x64.ActiveCfg = Release|x64 + {4605418D-2292-470A-AB18-C2119B016F71}.Release|x64.Build.0 = Release|x64 + {05E68E3B-5901-43A9-981D-CF392C0F5C6C}.Debug|Win32.ActiveCfg = Debug|Win32 + {05E68E3B-5901-43A9-981D-CF392C0F5C6C}.Debug|Win32.Build.0 = Debug|Win32 + {05E68E3B-5901-43A9-981D-CF392C0F5C6C}.Debug|x64.ActiveCfg = Debug|x64 + {05E68E3B-5901-43A9-981D-CF392C0F5C6C}.Debug|x64.Build.0 = Debug|x64 + {05E68E3B-5901-43A9-981D-CF392C0F5C6C}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {05E68E3B-5901-43A9-981D-CF392C0F5C6C}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {05E68E3B-5901-43A9-981D-CF392C0F5C6C}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {05E68E3B-5901-43A9-981D-CF392C0F5C6C}.Release (static)|x64.Build.0 = Release (static)|x64 + {05E68E3B-5901-43A9-981D-CF392C0F5C6C}.Release|Win32.ActiveCfg = Release|Win32 + {05E68E3B-5901-43A9-981D-CF392C0F5C6C}.Release|Win32.Build.0 = Release|Win32 + {05E68E3B-5901-43A9-981D-CF392C0F5C6C}.Release|x64.ActiveCfg = Release|x64 + {05E68E3B-5901-43A9-981D-CF392C0F5C6C}.Release|x64.Build.0 = Release|x64 + {6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80}.Debug|Win32.ActiveCfg = Debug|Win32 + {6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80}.Debug|Win32.Build.0 = Debug|Win32 + {6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80}.Debug|x64.ActiveCfg = Debug|x64 + {6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80}.Debug|x64.Build.0 = Debug|x64 + {6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80}.Release (static)|x64.Build.0 = Release (static)|x64 + {6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80}.Release|Win32.ActiveCfg = Release|Win32 + {6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80}.Release|Win32.Build.0 = Release|Win32 + {6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80}.Release|x64.ActiveCfg = Release|x64 + {6BA39648-5BD0-4B8D-A8DD-8202FBA1AE80}.Release|x64.Build.0 = Release|x64 + {1CD1A18B-95D5-4EA4-917C-34B10066BFCC}.Debug|Win32.ActiveCfg = Debug|Win32 + {1CD1A18B-95D5-4EA4-917C-34B10066BFCC}.Debug|Win32.Build.0 = Debug|Win32 + {1CD1A18B-95D5-4EA4-917C-34B10066BFCC}.Debug|x64.ActiveCfg = Debug|x64 + {1CD1A18B-95D5-4EA4-917C-34B10066BFCC}.Debug|x64.Build.0 = Debug|x64 + {1CD1A18B-95D5-4EA4-917C-34B10066BFCC}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {1CD1A18B-95D5-4EA4-917C-34B10066BFCC}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {1CD1A18B-95D5-4EA4-917C-34B10066BFCC}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {1CD1A18B-95D5-4EA4-917C-34B10066BFCC}.Release (static)|x64.Build.0 = Release (static)|x64 + {1CD1A18B-95D5-4EA4-917C-34B10066BFCC}.Release|Win32.ActiveCfg = Release|Win32 + {1CD1A18B-95D5-4EA4-917C-34B10066BFCC}.Release|Win32.Build.0 = Release|Win32 + {1CD1A18B-95D5-4EA4-917C-34B10066BFCC}.Release|x64.ActiveCfg = Release|x64 + {1CD1A18B-95D5-4EA4-917C-34B10066BFCC}.Release|x64.Build.0 = Release|x64 + {053E1EE2-75B4-4D9A-B8AE-89600BCB60A5}.Debug|Win32.ActiveCfg = Debug|Win32 + {053E1EE2-75B4-4D9A-B8AE-89600BCB60A5}.Debug|Win32.Build.0 = Debug|Win32 + {053E1EE2-75B4-4D9A-B8AE-89600BCB60A5}.Debug|x64.ActiveCfg = Debug|x64 + {053E1EE2-75B4-4D9A-B8AE-89600BCB60A5}.Debug|x64.Build.0 = Debug|x64 + {053E1EE2-75B4-4D9A-B8AE-89600BCB60A5}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {053E1EE2-75B4-4D9A-B8AE-89600BCB60A5}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {053E1EE2-75B4-4D9A-B8AE-89600BCB60A5}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {053E1EE2-75B4-4D9A-B8AE-89600BCB60A5}.Release (static)|x64.Build.0 = Release (static)|x64 + {053E1EE2-75B4-4D9A-B8AE-89600BCB60A5}.Release|Win32.ActiveCfg = Release|Win32 + {053E1EE2-75B4-4D9A-B8AE-89600BCB60A5}.Release|Win32.Build.0 = Release|Win32 + {053E1EE2-75B4-4D9A-B8AE-89600BCB60A5}.Release|x64.ActiveCfg = Release|x64 + {053E1EE2-75B4-4D9A-B8AE-89600BCB60A5}.Release|x64.Build.0 = Release|x64 + {231C032C-DE16-459A-8E7D-6509C2EC3998}.Debug|Win32.ActiveCfg = Debug|Win32 + {231C032C-DE16-459A-8E7D-6509C2EC3998}.Debug|Win32.Build.0 = Debug|Win32 + {231C032C-DE16-459A-8E7D-6509C2EC3998}.Debug|x64.ActiveCfg = Debug|x64 + {231C032C-DE16-459A-8E7D-6509C2EC3998}.Debug|x64.Build.0 = Debug|x64 + {231C032C-DE16-459A-8E7D-6509C2EC3998}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {231C032C-DE16-459A-8E7D-6509C2EC3998}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {231C032C-DE16-459A-8E7D-6509C2EC3998}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {231C032C-DE16-459A-8E7D-6509C2EC3998}.Release (static)|x64.Build.0 = Release (static)|x64 + {231C032C-DE16-459A-8E7D-6509C2EC3998}.Release|Win32.ActiveCfg = Release|Win32 + {231C032C-DE16-459A-8E7D-6509C2EC3998}.Release|Win32.Build.0 = Release|Win32 + {231C032C-DE16-459A-8E7D-6509C2EC3998}.Release|x64.ActiveCfg = Release|x64 + {231C032C-DE16-459A-8E7D-6509C2EC3998}.Release|x64.Build.0 = Release|x64 + {419FEFBE-D9D5-4149-974B-0FFFC8D0D93F}.Debug|Win32.ActiveCfg = Debug|Win32 + {419FEFBE-D9D5-4149-974B-0FFFC8D0D93F}.Debug|Win32.Build.0 = Debug|Win32 + {419FEFBE-D9D5-4149-974B-0FFFC8D0D93F}.Debug|x64.ActiveCfg = Debug|x64 + {419FEFBE-D9D5-4149-974B-0FFFC8D0D93F}.Debug|x64.Build.0 = Debug|x64 + {419FEFBE-D9D5-4149-974B-0FFFC8D0D93F}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {419FEFBE-D9D5-4149-974B-0FFFC8D0D93F}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {419FEFBE-D9D5-4149-974B-0FFFC8D0D93F}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {419FEFBE-D9D5-4149-974B-0FFFC8D0D93F}.Release (static)|x64.Build.0 = Release (static)|x64 + {419FEFBE-D9D5-4149-974B-0FFFC8D0D93F}.Release|Win32.ActiveCfg = Release|Win32 + {419FEFBE-D9D5-4149-974B-0FFFC8D0D93F}.Release|Win32.Build.0 = Release|Win32 + {419FEFBE-D9D5-4149-974B-0FFFC8D0D93F}.Release|x64.ActiveCfg = Release|x64 + {419FEFBE-D9D5-4149-974B-0FFFC8D0D93F}.Release|x64.Build.0 = Release|x64 + {40639893-4D75-48CD-811F-4B363CC71FFA}.Debug|Win32.ActiveCfg = Debug|Win32 + {40639893-4D75-48CD-811F-4B363CC71FFA}.Debug|Win32.Build.0 = Debug|Win32 + {40639893-4D75-48CD-811F-4B363CC71FFA}.Debug|x64.ActiveCfg = Debug|x64 + {40639893-4D75-48CD-811F-4B363CC71FFA}.Debug|x64.Build.0 = Debug|x64 + {40639893-4D75-48CD-811F-4B363CC71FFA}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {40639893-4D75-48CD-811F-4B363CC71FFA}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {40639893-4D75-48CD-811F-4B363CC71FFA}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {40639893-4D75-48CD-811F-4B363CC71FFA}.Release (static)|x64.Build.0 = Release (static)|x64 + {40639893-4D75-48CD-811F-4B363CC71FFA}.Release|Win32.ActiveCfg = Release|Win32 + {40639893-4D75-48CD-811F-4B363CC71FFA}.Release|Win32.Build.0 = Release|Win32 + {40639893-4D75-48CD-811F-4B363CC71FFA}.Release|x64.ActiveCfg = Release|x64 + {40639893-4D75-48CD-811F-4B363CC71FFA}.Release|x64.Build.0 = Release|x64 + {5FD733BF-B3C6-4A96-BED7-35E2484448E1}.Debug|Win32.ActiveCfg = Debug|Win32 + {5FD733BF-B3C6-4A96-BED7-35E2484448E1}.Debug|Win32.Build.0 = Debug|Win32 + {5FD733BF-B3C6-4A96-BED7-35E2484448E1}.Debug|x64.ActiveCfg = Debug|Win32 + {5FD733BF-B3C6-4A96-BED7-35E2484448E1}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {5FD733BF-B3C6-4A96-BED7-35E2484448E1}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {5FD733BF-B3C6-4A96-BED7-35E2484448E1}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {5FD733BF-B3C6-4A96-BED7-35E2484448E1}.Release (static)|x64.Build.0 = Release (static)|x64 + {5FD733BF-B3C6-4A96-BED7-35E2484448E1}.Release|Win32.ActiveCfg = Release|Win32 + {5FD733BF-B3C6-4A96-BED7-35E2484448E1}.Release|Win32.Build.0 = Release|Win32 + {5FD733BF-B3C6-4A96-BED7-35E2484448E1}.Release|x64.ActiveCfg = Release|x64 + {5FD733BF-B3C6-4A96-BED7-35E2484448E1}.Release|x64.Build.0 = Release|x64 + {649C4168-1C65-4E41-818F-85A1C52C1B8F}.Debug|Win32.ActiveCfg = Debug|Win32 + {649C4168-1C65-4E41-818F-85A1C52C1B8F}.Debug|Win32.Build.0 = Debug|Win32 + {649C4168-1C65-4E41-818F-85A1C52C1B8F}.Debug|x64.ActiveCfg = Debug|Win32 + {649C4168-1C65-4E41-818F-85A1C52C1B8F}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {649C4168-1C65-4E41-818F-85A1C52C1B8F}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {649C4168-1C65-4E41-818F-85A1C52C1B8F}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {649C4168-1C65-4E41-818F-85A1C52C1B8F}.Release (static)|x64.Build.0 = Release (static)|x64 + {649C4168-1C65-4E41-818F-85A1C52C1B8F}.Release|Win32.ActiveCfg = Release|Win32 + {649C4168-1C65-4E41-818F-85A1C52C1B8F}.Release|Win32.Build.0 = Release|Win32 + {649C4168-1C65-4E41-818F-85A1C52C1B8F}.Release|x64.ActiveCfg = Release|x64 + {649C4168-1C65-4E41-818F-85A1C52C1B8F}.Release|x64.Build.0 = Release|x64 + {C55D5FBF-43A0-4F6C-BCF6-BAE5705C121F}.Debug|Win32.ActiveCfg = Debug|Win32 + {C55D5FBF-43A0-4F6C-BCF6-BAE5705C121F}.Debug|Win32.Build.0 = Debug|Win32 + {C55D5FBF-43A0-4F6C-BCF6-BAE5705C121F}.Debug|x64.ActiveCfg = Debug|Win32 + {C55D5FBF-43A0-4F6C-BCF6-BAE5705C121F}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {C55D5FBF-43A0-4F6C-BCF6-BAE5705C121F}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {C55D5FBF-43A0-4F6C-BCF6-BAE5705C121F}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {C55D5FBF-43A0-4F6C-BCF6-BAE5705C121F}.Release (static)|x64.Build.0 = Release (static)|x64 + {C55D5FBF-43A0-4F6C-BCF6-BAE5705C121F}.Release|Win32.ActiveCfg = Release|Win32 + {C55D5FBF-43A0-4F6C-BCF6-BAE5705C121F}.Release|Win32.Build.0 = Release|Win32 + {C55D5FBF-43A0-4F6C-BCF6-BAE5705C121F}.Release|x64.ActiveCfg = Release|x64 + {C55D5FBF-43A0-4F6C-BCF6-BAE5705C121F}.Release|x64.Build.0 = Release|x64 + {44A18410-3AA8-4A64-935B-D20223AD6885}.Debug|Win32.ActiveCfg = Debug|Win32 + {44A18410-3AA8-4A64-935B-D20223AD6885}.Debug|Win32.Build.0 = Debug|Win32 + {44A18410-3AA8-4A64-935B-D20223AD6885}.Debug|x64.ActiveCfg = Debug|Win32 + {44A18410-3AA8-4A64-935B-D20223AD6885}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {44A18410-3AA8-4A64-935B-D20223AD6885}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {44A18410-3AA8-4A64-935B-D20223AD6885}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {44A18410-3AA8-4A64-935B-D20223AD6885}.Release (static)|x64.Build.0 = Release (static)|x64 + {44A18410-3AA8-4A64-935B-D20223AD6885}.Release|Win32.ActiveCfg = Release|Win32 + {44A18410-3AA8-4A64-935B-D20223AD6885}.Release|Win32.Build.0 = Release|Win32 + {44A18410-3AA8-4A64-935B-D20223AD6885}.Release|x64.ActiveCfg = Release|x64 + {44A18410-3AA8-4A64-935B-D20223AD6885}.Release|x64.Build.0 = Release|x64 + {B44CB3E0-F2FD-4260-A632-C01FB881613E}.Debug|Win32.ActiveCfg = Debug|Win32 + {B44CB3E0-F2FD-4260-A632-C01FB881613E}.Debug|Win32.Build.0 = Debug|Win32 + {B44CB3E0-F2FD-4260-A632-C01FB881613E}.Debug|x64.ActiveCfg = Debug|Win32 + {B44CB3E0-F2FD-4260-A632-C01FB881613E}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {B44CB3E0-F2FD-4260-A632-C01FB881613E}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {B44CB3E0-F2FD-4260-A632-C01FB881613E}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {B44CB3E0-F2FD-4260-A632-C01FB881613E}.Release (static)|x64.Build.0 = Release (static)|x64 + {B44CB3E0-F2FD-4260-A632-C01FB881613E}.Release|Win32.ActiveCfg = Release|Win32 + {B44CB3E0-F2FD-4260-A632-C01FB881613E}.Release|Win32.Build.0 = Release|Win32 + {B44CB3E0-F2FD-4260-A632-C01FB881613E}.Release|x64.ActiveCfg = Release|x64 + {B44CB3E0-F2FD-4260-A632-C01FB881613E}.Release|x64.Build.0 = Release|x64 + {F4A9881E-0EB0-44A1-9664-B6CBDE992861}.Debug|Win32.ActiveCfg = Debug|Win32 + {F4A9881E-0EB0-44A1-9664-B6CBDE992861}.Debug|Win32.Build.0 = Debug|Win32 + {F4A9881E-0EB0-44A1-9664-B6CBDE992861}.Debug|x64.ActiveCfg = Debug|Win32 + {F4A9881E-0EB0-44A1-9664-B6CBDE992861}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {F4A9881E-0EB0-44A1-9664-B6CBDE992861}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {F4A9881E-0EB0-44A1-9664-B6CBDE992861}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {F4A9881E-0EB0-44A1-9664-B6CBDE992861}.Release (static)|x64.Build.0 = Release (static)|x64 + {F4A9881E-0EB0-44A1-9664-B6CBDE992861}.Release|Win32.ActiveCfg = Release|Win32 + {F4A9881E-0EB0-44A1-9664-B6CBDE992861}.Release|Win32.Build.0 = Release|Win32 + {F4A9881E-0EB0-44A1-9664-B6CBDE992861}.Release|x64.ActiveCfg = Release|x64 + {F4A9881E-0EB0-44A1-9664-B6CBDE992861}.Release|x64.Build.0 = Release|x64 + {66D3A191-E4D5-45F3-86BD-EFBB249CD554}.Debug|Win32.ActiveCfg = Debug|Win32 + {66D3A191-E4D5-45F3-86BD-EFBB249CD554}.Debug|Win32.Build.0 = Debug|Win32 + {66D3A191-E4D5-45F3-86BD-EFBB249CD554}.Debug|x64.ActiveCfg = Debug|Win32 + {66D3A191-E4D5-45F3-86BD-EFBB249CD554}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {66D3A191-E4D5-45F3-86BD-EFBB249CD554}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {66D3A191-E4D5-45F3-86BD-EFBB249CD554}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {66D3A191-E4D5-45F3-86BD-EFBB249CD554}.Release (static)|x64.Build.0 = Release (static)|x64 + {66D3A191-E4D5-45F3-86BD-EFBB249CD554}.Release|Win32.ActiveCfg = Release|Win32 + {66D3A191-E4D5-45F3-86BD-EFBB249CD554}.Release|Win32.Build.0 = Release|Win32 + {66D3A191-E4D5-45F3-86BD-EFBB249CD554}.Release|x64.ActiveCfg = Release|x64 + {66D3A191-E4D5-45F3-86BD-EFBB249CD554}.Release|x64.Build.0 = Release|x64 + {CBD0DD82-4DC7-4398-AF32-FD7BFFA3C2D5}.Debug|Win32.ActiveCfg = Debug|Win32 + {CBD0DD82-4DC7-4398-AF32-FD7BFFA3C2D5}.Debug|Win32.Build.0 = Debug|Win32 + {CBD0DD82-4DC7-4398-AF32-FD7BFFA3C2D5}.Debug|x64.ActiveCfg = Debug|Win32 + {CBD0DD82-4DC7-4398-AF32-FD7BFFA3C2D5}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {CBD0DD82-4DC7-4398-AF32-FD7BFFA3C2D5}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {CBD0DD82-4DC7-4398-AF32-FD7BFFA3C2D5}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {CBD0DD82-4DC7-4398-AF32-FD7BFFA3C2D5}.Release (static)|x64.Build.0 = Release (static)|x64 + {CBD0DD82-4DC7-4398-AF32-FD7BFFA3C2D5}.Release|Win32.ActiveCfg = Release|Win32 + {CBD0DD82-4DC7-4398-AF32-FD7BFFA3C2D5}.Release|Win32.Build.0 = Release|Win32 + {CBD0DD82-4DC7-4398-AF32-FD7BFFA3C2D5}.Release|x64.ActiveCfg = Release|x64 + {CBD0DD82-4DC7-4398-AF32-FD7BFFA3C2D5}.Release|x64.Build.0 = Release|x64 + {D5B9558F-EF25-4167-ACE4-723C7413B390}.Debug|Win32.ActiveCfg = Debug|Win32 + {D5B9558F-EF25-4167-ACE4-723C7413B390}.Debug|Win32.Build.0 = Debug|Win32 + {D5B9558F-EF25-4167-ACE4-723C7413B390}.Debug|x64.ActiveCfg = Debug|Win32 + {D5B9558F-EF25-4167-ACE4-723C7413B390}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {D5B9558F-EF25-4167-ACE4-723C7413B390}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {D5B9558F-EF25-4167-ACE4-723C7413B390}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {D5B9558F-EF25-4167-ACE4-723C7413B390}.Release (static)|x64.Build.0 = Release (static)|x64 + {D5B9558F-EF25-4167-ACE4-723C7413B390}.Release|Win32.ActiveCfg = Release|Win32 + {D5B9558F-EF25-4167-ACE4-723C7413B390}.Release|Win32.Build.0 = Release|Win32 + {D5B9558F-EF25-4167-ACE4-723C7413B390}.Release|x64.ActiveCfg = Release|x64 + {D5B9558F-EF25-4167-ACE4-723C7413B390}.Release|x64.Build.0 = Release|x64 + {155112B9-A8A9-4E06-90F5-4AAAB32B2F70}.Debug|Win32.ActiveCfg = Debug|Win32 + {155112B9-A8A9-4E06-90F5-4AAAB32B2F70}.Debug|Win32.Build.0 = Debug|Win32 + {155112B9-A8A9-4E06-90F5-4AAAB32B2F70}.Debug|x64.ActiveCfg = Debug|Win32 + {155112B9-A8A9-4E06-90F5-4AAAB32B2F70}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {155112B9-A8A9-4E06-90F5-4AAAB32B2F70}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {155112B9-A8A9-4E06-90F5-4AAAB32B2F70}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {155112B9-A8A9-4E06-90F5-4AAAB32B2F70}.Release (static)|x64.Build.0 = Release (static)|x64 + {155112B9-A8A9-4E06-90F5-4AAAB32B2F70}.Release|Win32.ActiveCfg = Release|Win32 + {155112B9-A8A9-4E06-90F5-4AAAB32B2F70}.Release|Win32.Build.0 = Release|Win32 + {155112B9-A8A9-4E06-90F5-4AAAB32B2F70}.Release|x64.ActiveCfg = Release|x64 + {155112B9-A8A9-4E06-90F5-4AAAB32B2F70}.Release|x64.Build.0 = Release|x64 + {178D81A7-F2FB-41D7-B300-9D1A4DE5E137}.Debug|Win32.ActiveCfg = Debug|Win32 + {178D81A7-F2FB-41D7-B300-9D1A4DE5E137}.Debug|Win32.Build.0 = Debug|Win32 + {178D81A7-F2FB-41D7-B300-9D1A4DE5E137}.Debug|x64.ActiveCfg = Debug|Win32 + {178D81A7-F2FB-41D7-B300-9D1A4DE5E137}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {178D81A7-F2FB-41D7-B300-9D1A4DE5E137}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {178D81A7-F2FB-41D7-B300-9D1A4DE5E137}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {178D81A7-F2FB-41D7-B300-9D1A4DE5E137}.Release (static)|x64.Build.0 = Release (static)|x64 + {178D81A7-F2FB-41D7-B300-9D1A4DE5E137}.Release|Win32.ActiveCfg = Release|Win32 + {178D81A7-F2FB-41D7-B300-9D1A4DE5E137}.Release|Win32.Build.0 = Release|Win32 + {178D81A7-F2FB-41D7-B300-9D1A4DE5E137}.Release|x64.ActiveCfg = Release|x64 + {178D81A7-F2FB-41D7-B300-9D1A4DE5E137}.Release|x64.Build.0 = Release|x64 + {7E30C3B1-AEE7-483D-B231-C672365CD2D7}.Debug|Win32.ActiveCfg = Debug|Win32 + {7E30C3B1-AEE7-483D-B231-C672365CD2D7}.Debug|Win32.Build.0 = Debug|Win32 + {7E30C3B1-AEE7-483D-B231-C672365CD2D7}.Debug|x64.ActiveCfg = Debug|Win32 + {7E30C3B1-AEE7-483D-B231-C672365CD2D7}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {7E30C3B1-AEE7-483D-B231-C672365CD2D7}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {7E30C3B1-AEE7-483D-B231-C672365CD2D7}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {7E30C3B1-AEE7-483D-B231-C672365CD2D7}.Release (static)|x64.Build.0 = Release (static)|x64 + {7E30C3B1-AEE7-483D-B231-C672365CD2D7}.Release|Win32.ActiveCfg = Release|Win32 + {7E30C3B1-AEE7-483D-B231-C672365CD2D7}.Release|Win32.Build.0 = Release|Win32 + {7E30C3B1-AEE7-483D-B231-C672365CD2D7}.Release|x64.ActiveCfg = Release|x64 + {7E30C3B1-AEE7-483D-B231-C672365CD2D7}.Release|x64.Build.0 = Release|x64 + {2E26DB8B-9E37-4072-B397-8A7086E0ACD0}.Debug|Win32.ActiveCfg = Debug|Win32 + {2E26DB8B-9E37-4072-B397-8A7086E0ACD0}.Debug|Win32.Build.0 = Debug|Win32 + {2E26DB8B-9E37-4072-B397-8A7086E0ACD0}.Debug|x64.ActiveCfg = Debug|Win32 + {2E26DB8B-9E37-4072-B397-8A7086E0ACD0}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {2E26DB8B-9E37-4072-B397-8A7086E0ACD0}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {2E26DB8B-9E37-4072-B397-8A7086E0ACD0}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {2E26DB8B-9E37-4072-B397-8A7086E0ACD0}.Release (static)|x64.Build.0 = Release (static)|x64 + {2E26DB8B-9E37-4072-B397-8A7086E0ACD0}.Release|Win32.ActiveCfg = Release|Win32 + {2E26DB8B-9E37-4072-B397-8A7086E0ACD0}.Release|Win32.Build.0 = Release|Win32 + {2E26DB8B-9E37-4072-B397-8A7086E0ACD0}.Release|x64.ActiveCfg = Release|x64 + {2E26DB8B-9E37-4072-B397-8A7086E0ACD0}.Release|x64.Build.0 = Release|x64 + {2736D4F9-EA8B-4ADF-B2D9-B705FF288A8A}.Debug|Win32.ActiveCfg = Debug|Win32 + {2736D4F9-EA8B-4ADF-B2D9-B705FF288A8A}.Debug|Win32.Build.0 = Debug|Win32 + {2736D4F9-EA8B-4ADF-B2D9-B705FF288A8A}.Debug|x64.ActiveCfg = Debug|Win32 + {2736D4F9-EA8B-4ADF-B2D9-B705FF288A8A}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {2736D4F9-EA8B-4ADF-B2D9-B705FF288A8A}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {2736D4F9-EA8B-4ADF-B2D9-B705FF288A8A}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {2736D4F9-EA8B-4ADF-B2D9-B705FF288A8A}.Release (static)|x64.Build.0 = Release (static)|x64 + {2736D4F9-EA8B-4ADF-B2D9-B705FF288A8A}.Release|Win32.ActiveCfg = Release|Win32 + {2736D4F9-EA8B-4ADF-B2D9-B705FF288A8A}.Release|Win32.Build.0 = Release|Win32 + {2736D4F9-EA8B-4ADF-B2D9-B705FF288A8A}.Release|x64.ActiveCfg = Release|x64 + {2736D4F9-EA8B-4ADF-B2D9-B705FF288A8A}.Release|x64.Build.0 = Release|x64 + {2CEB1965-A89C-4422-A9AC-B30FCE7913C3}.Debug|Win32.ActiveCfg = Debug|Win32 + {2CEB1965-A89C-4422-A9AC-B30FCE7913C3}.Debug|Win32.Build.0 = Debug|Win32 + {2CEB1965-A89C-4422-A9AC-B30FCE7913C3}.Debug|x64.ActiveCfg = Debug|Win32 + {2CEB1965-A89C-4422-A9AC-B30FCE7913C3}.Release (static)|Win32.ActiveCfg = Release (static)|Win32 + {2CEB1965-A89C-4422-A9AC-B30FCE7913C3}.Release (static)|Win32.Build.0 = Release (static)|Win32 + {2CEB1965-A89C-4422-A9AC-B30FCE7913C3}.Release (static)|x64.ActiveCfg = Release (static)|x64 + {2CEB1965-A89C-4422-A9AC-B30FCE7913C3}.Release (static)|x64.Build.0 = Release (static)|x64 + {2CEB1965-A89C-4422-A9AC-B30FCE7913C3}.Release|Win32.ActiveCfg = Release|Win32 + {2CEB1965-A89C-4422-A9AC-B30FCE7913C3}.Release|Win32.Build.0 = Release|Win32 + {2CEB1965-A89C-4422-A9AC-B30FCE7913C3}.Release|x64.ActiveCfg = Release|x64 + {2CEB1965-A89C-4422-A9AC-B30FCE7913C3}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/vc2005/QuakeForge.sln b/vc2005/QuakeForge-VS8.sln similarity index 100% rename from vc2005/QuakeForge.sln rename to vc2005/QuakeForge-VS8.sln diff --git a/vc2005/nq-sdl/nq-sdl.vcproj b/vc2005/nq-sdl/nq-sdl.vcproj index 8a43e897d..f4813f262 100644 --- a/vc2005/nq-sdl/nq-sdl.vcproj +++ b/vc2005/nq-sdl/nq-sdl.vcproj @@ -1,561 +1,561 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vc2005/qw-client-sdl32/qw-client-sdl32.vcproj b/vc2005/qw-client-sdl32/qw-client-sdl32.vcproj index 6af43bad6..ccbdb9c89 100644 --- a/vc2005/qw-client-sdl32/qw-client-sdl32.vcproj +++ b/vc2005/qw-client-sdl32/qw-client-sdl32.vcproj @@ -1,567 +1,567 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vc2005/sound/sound.vcproj b/vc2005/sound/sound.vcproj index e6cd1de6b..50c25ce4c 100644 --- a/vc2005/sound/sound.vcproj +++ b/vc2005/sound/sound.vcproj @@ -1,513 +1,513 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 624a1630f3abf1e303f477ff1ddb7fa47761893a Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 24 Nov 2010 15:47:33 +0900 Subject: [PATCH 074/115] Make bootstrap clean a little smarter. It doesn't delete config.h[.in] or Makefile in the directories in which they are not generated. --- bootstrap | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bootstrap b/bootstrap index c1942cf5f..80db4559e 100755 --- a/bootstrap +++ b/bootstrap @@ -10,8 +10,8 @@ if test "$1" = "clean"; then fi find . -name Makefile.in -print0 | xargs $ARGS rm -f - find . -name config.h.in -print0 | xargs $ARGS rm -f - find . -name config.h -print0 | xargs $ARGS rm -f + find . -path ./tools/texpaint -prune -o -name config.h.in -print0 | xargs $ARGS rm -f + find . \( -path ./vc2005 -o -path ./vc2008 \) -prune -o -name config.h -print0 | xargs $ARGS rm -f find . -name stamp-h1 -print0 | xargs $ARGS rm -f find . -name '*~' -type f -print0 | xargs $ARGS rm -f find . -name '*.rej' -type f -print0 | xargs $ARGS rm -f @@ -23,7 +23,7 @@ if test "$1" = "clean"; then rm -rf autom4te.cache cd - - find . -name Makefile -print0 | xargs $ARGS rm -f + find . \( -path ./tools/gas2masm -o -path ./tools/quaketoascii \) -name Makefile -print0 | xargs $ARGS rm -f find . -name core -print0 | xargs $ARGS rm -f rm -f RPM/build_rpm RPM/quakeforge.conf RPM/quakeforge.spec RPM/rpmmacros find . -name '*.o' -type f -print0 | xargs $ARGS rm -f From e5e560cbaf31dcce8221292e99ad4d8e34bf65d5 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 17 Nov 2010 00:26:41 +0900 Subject: [PATCH 075/115] Ensure struct params are small enough to fit in the param slots. --- tools/qfcc/source/function.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/qfcc/source/function.c b/tools/qfcc/source/function.c index e5ca0bd0e..0f133ee2f 100644 --- a/tools/qfcc/source/function.c +++ b/tools/qfcc/source/function.c @@ -146,6 +146,10 @@ parse_params (type_t *type, param_t *parms) } new.num_parms = -(new.num_parms + 1); } else if (p->type) { + if (type_size (p->type) > type_size (&type_param)) { + error (0, "param too large to be passed by value"); + return type; + } new.parm_types[new.num_parms] = p->type; new.num_parms++; } From a623fb53a70eeaf6783f3673a0265de15b5f035b Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 17 Nov 2010 14:42:21 +0900 Subject: [PATCH 076/115] Proper support for empty structs and unions. They now have a single private, void, unnamed member, resulting in a size of 1 word. This makes empty structs useful for typed opaque handles. --- tools/qfcc/source/qc-parse.y | 16 ++++++++++++---- tools/qfcc/source/struct.c | 1 - 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/tools/qfcc/source/qc-parse.y b/tools/qfcc/source/qc-parse.y index 3033dc1c3..852ccb655 100644 --- a/tools/qfcc/source/qc-parse.y +++ b/tools/qfcc/source/qc-parse.y @@ -230,10 +230,18 @@ def | storage_class simple_def { current_storage = st_global; } | storage_class '{' simple_defs '}' ';' { current_storage = st_global; } - | STRUCT identifier - { current_struct = new_struct ($2); } '{' struct_defs '}' ';' { } - | UNION identifier - { current_struct = new_union ($2); } '{' struct_defs '}' ';' { } + | STRUCT identifier { current_struct = new_struct ($2); } + '{' struct_defs '}' ';' + { + if (!current_struct->struct_head) + new_struct_field (current_struct, &type_void, 0, vis_private); + } + | UNION identifier { current_struct = new_union ($2); } + '{' struct_defs '}' ';' + { + if (!current_struct->struct_head) + new_struct_field (current_struct, &type_void, 0, vis_private); + } | STRUCT identifier ';' { decl_struct ($2); } | UNION identifier ';' { decl_union ($2); } | ENUM '{' enum_list opt_comma '}' ';' diff --git a/tools/qfcc/source/struct.c b/tools/qfcc/source/struct.c index 82595e32a..2426c55a2 100644 --- a/tools/qfcc/source/struct.c +++ b/tools/qfcc/source/struct.c @@ -225,7 +225,6 @@ check_struct (const char *name, struct_type stype) struct_t * decl_struct (const char *name) { - return check_struct (name, str_struct); } From 799d46f83d46ff57a9ee44aa2ff0147c85a2ee12 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 17 Nov 2010 14:45:35 +0900 Subject: [PATCH 077/115] Check for incomplete types and better param/return size checking. --- tools/qfcc/source/expr.c | 8 +++++++- tools/qfcc/source/function.c | 34 ++++++++++++++++++++++++++++++---- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index c79f8a99e..72969d1c3 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -1977,6 +1977,12 @@ build_function_call (expr_t *fexpr, type_t *ftype, expr_t *params) for (i = arg_count - 1, e = params; i >= 0; i--, e = e->next) { type_t *t = get_type (e); + if (!type_size (t)) + err = error (e, "type of formal parameter %d is incomplete", + i + 1); + if (type_size (t) > type_size (&type_param)) + err = error (e, "formal parameter %d is too large to be passed by" + " value", i + 1); check_initialized (e); if (ftype->parm_types[i] == &type_float && e->type == ex_integer) { convert_int (e); @@ -2005,7 +2011,7 @@ build_function_call (expr_t *fexpr, type_t *ftype, expr_t *params) && options.code.progsversion == PROG_ID_VERSION) convert_int (e); if (e->type == ex_integer && options.warnings.vararg_integer) - warning (e, "passing integer consant into ... function"); + warning (e, "passing integer constant into ... function"); } arg_types[arg_count - 1 - i] = t; } diff --git a/tools/qfcc/source/function.c b/tools/qfcc/source/function.c index 0f133ee2f..3d4a80f91 100644 --- a/tools/qfcc/source/function.c +++ b/tools/qfcc/source/function.c @@ -146,10 +146,6 @@ parse_params (type_t *type, param_t *parms) } new.num_parms = -(new.num_parms + 1); } else if (p->type) { - if (type_size (p->type) > type_size (&type_param)) { - error (0, "param too large to be passed by value"); - return type; - } new.parm_types[new.num_parms] = p->type; new.num_parms++; } @@ -350,6 +346,34 @@ find_function (expr_t *fexpr, expr_t *params) return fexpr; } +static void +check_function (def_t *func, param_t *params) +{ + param_t *p; + int i; + + if (!type_size (func->type->aux_type)) { + error (0, "return type is an incomplete type"); + func->type->aux_type = &type_void;//FIXME + } + if (type_size (func->type->aux_type) > type_size (&type_param)) { + error (0, "return value too large to be passed by value"); + func->type->aux_type = &type_void;//FIXME + } + for (p = params, i = 0; p; p = p->next, i++) { + if (!p->selector && !p->type && !p->name) + continue; // ellipsis marker + if (!p->type) + continue; // non-param selector + if (!type_size (p->type)) + error (0, "parameter %d (‘%s’) has incomplete type", + i + 1, p->name); + if (type_size (p->type) > type_size (&type_param)) + error (0, "param %d (‘%s’) is too large to be passed by value", + i + 1, p->name); + } +} + void build_scope (function_t *f, def_t *func, param_t *params) { @@ -359,6 +383,8 @@ build_scope (function_t *f, def_t *func, param_t *params) def_t *args = 0; int parm_ofs[MAX_PARMS]; + check_function (func, params); + f->scope = new_scope (sc_params, new_defspace (), pr.scope); if (func->type->num_parms < 0) { From b0879ba2559e7d88b44604e8c039a8b86f359fb9 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 17 Nov 2010 15:50:07 +0900 Subject: [PATCH 078/115] Convert Point, Size and Rect to structs. Group and the menu plist parser are currently broken. --- ruamoko/cl_menu/Frame.h | 4 +- ruamoko/cl_menu/Frame.r | 4 +- ruamoko/cl_menu/HUD.h | 11 +++-- ruamoko/cl_menu/HUD.r | 29 ++++++----- ruamoko/cl_menu/client_menu.qc | 4 +- ruamoko/cl_menu/options.qc | 30 +++++------ ruamoko/cl_menu/options_util.qc | 7 ++- ruamoko/cl_menu/servlist.qc | 2 +- ruamoko/gui/Group.r | 3 +- ruamoko/gui/InputLine.r | 3 +- ruamoko/gui/Point.r | 63 ++++------------------- ruamoko/gui/Rect.r | 88 +++++---------------------------- ruamoko/gui/Size.r | 73 ++++----------------------- ruamoko/gui/View.r | 3 +- ruamoko/include/gui/InputLine.h | 3 -- ruamoko/include/gui/Point.h | 27 +++------- ruamoko/include/gui/Rect.h | 23 ++------- ruamoko/include/gui/Size.h | 30 +++-------- ruamoko/include/gui/View.h | 5 +- 19 files changed, 99 insertions(+), 313 deletions(-) diff --git a/ruamoko/cl_menu/Frame.h b/ruamoko/cl_menu/Frame.h index f777d6238..497803811 100644 --- a/ruamoko/cl_menu/Frame.h +++ b/ruamoko/cl_menu/Frame.h @@ -1,4 +1,4 @@ -#include "gui/Point.h" +#include "gui/Size.h" #include "draw.h" @interface Frame : Object @@ -8,7 +8,7 @@ } - (id) initWithFile: (string) file duration: (float) time; - (void) dealloc; -- (Point) size; +- (Size) size; - (float) duration; - (void) draw: (integer) x :(integer) y; @end diff --git a/ruamoko/cl_menu/Frame.r b/ruamoko/cl_menu/Frame.r index 62047c724..2b3a11eb9 100644 --- a/ruamoko/cl_menu/Frame.r +++ b/ruamoko/cl_menu/Frame.r @@ -17,9 +17,9 @@ [super dealloc]; } -- (Point) size +- (Size) size { - return [[Point alloc] initWithComponents :[picture width] :[picture height]]; + return makeSize ([picture width], [picture height]); } - (float) duration diff --git a/ruamoko/cl_menu/HUD.h b/ruamoko/cl_menu/HUD.h index 57d44ee0a..15d867778 100644 --- a/ruamoko/cl_menu/HUD.h +++ b/ruamoko/cl_menu/HUD.h @@ -1,7 +1,8 @@ #include "Frame.h" #include "Array.h" -@class Point; +#include "gui/Point.h" +#include "gui/Size.h" @interface HUDObject : Object { @@ -14,7 +15,7 @@ - (void) dealloc; - (integer) handle; - (Point) origin; -- (Point) size; +- (Size) size; - (void) setOrigin: (Point) newPoint; - (void) translate: (Point) addPoint; - (BOOL) isVisible; @@ -28,7 +29,7 @@ } - (id) initWithComponents: (integer) x :(integer) y :(string) _text; -- (Point) size; +- (Size) size; - (string) text; - (void) setText: (string) _text; - (void) display; @@ -41,7 +42,7 @@ - (id) initWithComponents: (integer)x :(integer)y :(string) _file; - (void) dealloc; -- (Point) size; +- (Size) size; - (void) setFile: (string) _file; - (void) display; @end @@ -58,7 +59,7 @@ } - (id) initWithComponents: (integer) x :(integer) y; - (void) dealloc; -- (Point) size; +- (Size) size; - (void) addFrame: (Frame) frame; - (void) changeFrame; - (void) display; diff --git a/ruamoko/cl_menu/HUD.r b/ruamoko/cl_menu/HUD.r index 455433182..f2e47791f 100644 --- a/ruamoko/cl_menu/HUD.r +++ b/ruamoko/cl_menu/HUD.r @@ -11,7 +11,7 @@ integer HUDHandleClass; - (id) initWithComponents: (integer) x : (integer) y { self = [super init]; - origin = [[Point alloc] initWithComponents: x :y]; + origin = makePoint (x, y); visible = YES; return self; @@ -19,7 +19,6 @@ integer HUDHandleClass; - (void) dealloc { - [origin release]; [super dealloc]; } @@ -33,19 +32,19 @@ integer HUDHandleClass; return origin; } -- (Point) size +- (Size) size { - return NIL; + return makeSize (0, 0); } - (void) setOrigin: (Point) newPoint { - [origin setPoint :newPoint]; + origin = newPoint; } -- (void) translate: (Point) addPoint +- (void) translate: (Point) offset { - [origin addPoint :addPoint]; + origin = addPoint(origin, offset); } - (BOOL) isVisible @@ -72,9 +71,9 @@ integer HUDHandleClass; return self; } -- (Point) size +- (Size) size { - return [[Point alloc] initWithComponents :8*(integer) strlen (text) :8]; + return makeSize (8*(integer) strlen (text), 8); } - (string) text @@ -90,7 +89,7 @@ integer HUDHandleClass; - (void) display { if (visible) - Draw_String ([origin x], [origin y], text); + Draw_String (origin.x, origin.y, text); } @end @@ -109,9 +108,9 @@ integer HUDHandleClass; [super dealloc]; } -- (Point) size +- (Size) size { - return [[Point alloc] initWithComponents :[picture width] :[picture height]]; + return makeSize ([picture width], [picture height]); } - (void) setFile: (string) _file @@ -123,7 +122,7 @@ integer HUDHandleClass; - (void) display { if (visible) - [picture draw :[origin x] :[origin y]]; + [picture draw :origin.x :origin.y]; } @end @@ -146,7 +145,7 @@ integer HUDHandleClass; [super dealloc]; } -- (Point) size +- (Size) size { local Frame frame; @@ -188,7 +187,7 @@ integer HUDHandleClass; [self changeFrame]; f = [frames getItemAt :currentFrame]; - [f draw :[origin x] :[origin y]]; + [f draw :origin.x :origin.y]; } - (void) start diff --git a/ruamoko/cl_menu/client_menu.qc b/ruamoko/cl_menu/client_menu.qc index 91a8bfe6a..7f3c9a061 100644 --- a/ruamoko/cl_menu/client_menu.qc +++ b/ruamoko/cl_menu/client_menu.qc @@ -561,9 +561,9 @@ void () main_menu = void () menu_init = { - lanConfig_port_il = [[InputLineBox alloc] initWithBounds:[[Rect alloc] initWithComponents:126 :lanConfig_cursor_table[0] - 8 :8 :4] promptCharacter:' ']; + lanConfig_port_il = [[InputLineBox alloc] initWithBounds:makeRect (126, lanConfig_cursor_table[0] - 8, 8, 4) promptCharacter:' ']; [lanConfig_port_il setWidth:10]; - lanConfig_join_il = [[InputLineBox alloc] initWithBounds:[[Rect alloc] initWithComponents:70 :lanConfig_cursor_table[2] - 8 :24 :4] promptCharacter:' ']; + lanConfig_join_il = [[InputLineBox alloc] initWithBounds:makeRect (70, lanConfig_cursor_table[2] - 8, 24, 4) promptCharacter:' ']; [lanConfig_join_il setWidth:26]; switch (gametype ()) { case "netquake": diff --git a/ruamoko/cl_menu/options.qc b/ruamoko/cl_menu/options.qc index 93abbd23d..b0716cce2 100644 --- a/ruamoko/cl_menu/options.qc +++ b/ruamoko/cl_menu/options.qc @@ -170,8 +170,8 @@ array_from_plist (PLArray plarray) return array; } -id -string_from_plist (PLString plstring) +Rect +rect_from_plist (PLString plstring) { local string str = [plstring string]; local string tmp; @@ -185,8 +185,14 @@ string_from_plist (PLString plstring) yp = stoi ([(PLString) [item getObjectAtIndex:1] string]); xl = stoi ([(PLString) [item getObjectAtIndex:2] string]); yl = stoi ([(PLString) [item getObjectAtIndex:3] string]); - return [[Rect alloc] initWithComponents:xp :yp :xl :yl]; + return makeRect (xp, yp, xl, yl); } + return makeRect (0, 0, 0, 0); +} + +id +string_from_plist (PLString plstring) +{ return NIL; } @@ -403,7 +409,7 @@ MENU_control_options = [view setText:"Bindings"]; [control_options addView:view]; - rect = [[Rect alloc] initWithComponents:70 :70 :224 :8]; + rect = makeRect (70, 70, 224, 8); grab_mouse_view = [[CvarToggleView alloc] initWithBounds:rect title:"Grab mouse" :[[CvarToggle alloc] initWithCvar:"in_grab"]]; [control_options addView:grab_mouse_view]; @@ -433,8 +439,6 @@ MENU_control_options = lookstrafe_view = [[CvarToggleView alloc] initWithBounds:rect title:"Lookstrafe" :[[CvarToggle alloc] initWithCvar:"lookstrafe"]]; [control_options addView:lookstrafe_view]; - [rect release]; - MENU_control_binding (); Menu_Item (54, 70, "in_grab", CB_control_options, 0); @@ -523,7 +527,7 @@ MENU_feature_options = [view setText:"--------"]; [feature_options addView:view]; - rect = [[Rect alloc] initWithComponents:70 :60 :224 :8]; + rect = makeRect (70, 60, 224, 8); autorecord_view = [[CvarToggleView alloc] initWithBounds:rect title:"Autorecord" :[[CvarToggle alloc] initWithCvar:"cl_autorecord"]]; [feature_options addView:autorecord_view]; @@ -531,8 +535,6 @@ MENU_feature_options = fraglog_view = [[CvarToggleView alloc] initWithBounds:rect title:"Frag Logging" :[[CvarToggle alloc] initWithCvar:"cl_fraglog"]]; [feature_options addView:fraglog_view]; - [rect release]; - Menu_Item (54, 70, "cl_autorecord", CB_feature_options, 0); Menu_Item (54, 80, "cl_fraglog", CB_feature_options, 0); Menu_End (); @@ -720,17 +722,17 @@ MENU_player_options = [view setText:"Pants color"]; [player_options addView:view]; - player_config_plname_il = [[InputLineBox alloc] initWithBounds:[[Rect alloc] initWithComponents:120 :PLAYER_CONF_Y_PAD :18 :4] promptCharacter:' ']; + player_config_plname_il = [[InputLineBox alloc] initWithBounds:makeRect (120, PLAYER_CONF_Y_PAD, 18, 4) promptCharacter:' ']; [player_config_plname_il setWidth:18]; [player_options addView:player_config_plname_il]; - player_config_tname_il = [[InputLineBox alloc] initWithBounds:[[Rect alloc] initWithComponents:120 :PLAYER_CONF_Y_PAD + 20 :7 :4] promptCharacter:' ']; + player_config_tname_il = [[InputLineBox alloc] initWithBounds:makeRect (120, PLAYER_CONF_Y_PAD + 20, 7, 4) promptCharacter:' ']; [player_config_tname_il setWidth:7]; [player_options addView:player_config_tname_il]; player_config_iactive = NIL; - rect = [[Rect alloc] initWithComponents:192 :PLAYER_CONF_Y_PAD + 37 :24 :24]; + rect = makeRect (192, PLAYER_CONF_Y_PAD + 37, 24, 24); topcolor_view = [[CvarColorView alloc] initWithBounds:rect :[[CvarColor alloc] initWithCvar:"topcolor"]]; [player_options addView:topcolor_view]; @@ -738,8 +740,6 @@ MENU_player_options = bottomcolor_view = [[CvarColorView alloc] initWithBounds:rect :[[CvarColor alloc] initWithCvar:"bottomcolor"]]; [player_options addView:bottomcolor_view]; - [rect release]; - Menu_Begin (54, 80, "Player"); Menu_FadeScreen (1); Menu_KeyEvent (KEYEV_player_options); @@ -879,7 +879,7 @@ MENU_network_options = [view setText:"Rate..:"]; [network_options addView:view]; - network_config_rate_il = [[InputLineBox alloc] initWithBounds:[[Rect alloc] initWithComponents: 120 :NETWORK_CONF_Y_PAD :9 :4] promptCharacter:' ']; + network_config_rate_il = [[InputLineBox alloc] initWithBounds:makeRect (120, NETWORK_CONF_Y_PAD, 9, 4) promptCharacter:' ']; [network_config_rate_il setWidth:9]; [network_options addView:network_config_rate_il]; diff --git a/ruamoko/cl_menu/options_util.qc b/ruamoko/cl_menu/options_util.qc index 1029804f6..1958a35d5 100644 --- a/ruamoko/cl_menu/options_util.qc +++ b/ruamoko/cl_menu/options_util.qc @@ -179,7 +179,7 @@ toggle = _toggle; - rect = [[Rect alloc] initWithComponents:0 :0 :strlen (_title) * 8 :8]; + rect = makeRect (0, 0, strlen (_title) * 8, 8); title = [[Text alloc] initWithBounds:rect text:_title]; rect.size.width = 3 * 8; @@ -338,7 +338,7 @@ range = _range; - rect = [[Rect alloc] initWithComponents:0 :0 :strlen (_title) * 8 :8]; + rect = makeRect (0, 0, strlen (_title) * 8, 8); title = [[Text alloc] initWithBounds:rect text:_title]; rect.origin.x += rect.size.width + 8; @@ -465,10 +465,9 @@ void traceon () = #0; - (void) setBasePos: (Point) pos { [super setBasePos:pos]; - local Point point = [[Point alloc] initWithComponents:xabs :yabs]; + local Point point = {xabs, yabs}; [title setBasePos:point]; [view setBasePos:point]; - [point release]; } @end diff --git a/ruamoko/cl_menu/servlist.qc b/ruamoko/cl_menu/servlist.qc index cd5ca2b21..9e6f285b4 100644 --- a/ruamoko/cl_menu/servlist.qc +++ b/ruamoko/cl_menu/servlist.qc @@ -97,7 +97,7 @@ void () servlist_filter_menu = void () server_list_menu = { - serv_maxping = [[InputLine alloc] initWithBounds:[[Rect alloc] initWithComponents:206 :40 :8 :4] promptCharacter:' ']; + serv_maxping = [[InputLine alloc] initWithBounds:makeRect (206, 40, 8, 4) promptCharacter:' ']; [serv_maxping setWidth:5]; Menu_Begin (54, 52, ""); diff --git a/ruamoko/gui/Group.r b/ruamoko/gui/Group.r index cf8ea925c..3f02fadd5 100644 --- a/ruamoko/gui/Group.r +++ b/ruamoko/gui/Group.r @@ -40,9 +40,8 @@ - (void) setBasePos: (Point) pos { [super setBasePos:pos]; - local Point point = [[Point alloc] initWithComponents:xabs :yabs]; + local Point point = {xabs, yabs}; [views makeObjectsPerformSelector:@selector (setBasePos:) withObject:point]; - [point release]; } - (void) draw diff --git a/ruamoko/gui/InputLine.r b/ruamoko/gui/InputLine.r index 77b28642f..066dff049 100644 --- a/ruamoko/gui/InputLine.r +++ b/ruamoko/gui/InputLine.r @@ -90,9 +90,8 @@ string (inputline_t il) InputLine_GetText = #0; yp = 8; xl = aRect.size.width; yl = aRect.size.height; - r = [[Rect alloc] initWithComponents:xp :yp :xl :yl]; + r = makeRect (xp, yp, xl, yl); input_line = [[InputLine alloc] initWithBounds:r promptCharacter:char]; - [r release]; return self; } diff --git a/ruamoko/gui/Point.r b/ruamoko/gui/Point.r index db979c1be..b45ef65f0 100644 --- a/ruamoko/gui/Point.r +++ b/ruamoko/gui/Point.r @@ -1,64 +1,19 @@ #include "gui/Point.h" -@implementation Point - -- (id) initWithComponents: (integer)_x : (integer)_y +Point makePoint (integer x, integer y) { - self = [self init]; - x = _x; - y = _y; - return self; + Point p = {x, y}; + return p; } -- (id) initWithPoint: (Point) aPoint +Point addPoint (Point a, Point b) { - self = [self init]; - - if (!self || !aPoint) - return NIL; - - x = [aPoint x]; - y = [aPoint y]; - - return self; + Point c = {a.x + b.x, a.y + b.y}; + return c; } -- (id) copy +Point subtractPoint (Point a, Point b) { - local id myCopy = [super copy]; - - if (!myCopy) - myCopy = [[self class] alloc]; - - return [myCopy initWithComponents: x : y]; + Point c = {a.x - b.x, a.y - b.y}; + return c; } - -- (integer) x -{ - return x; -} - -- (integer) y -{ - return y; -} - -- (void) setPoint: (Point)aPoint -{ - x = [aPoint x]; - y = [aPoint y]; -} - -- (void) addPoint: (Point) aPoint -{ - x += [aPoint x]; - y += [aPoint y]; -} - -- (void) subtractPoint: (Point) aPoint -{ - x -= [aPoint x]; - y -= [aPoint y]; -} - -@end diff --git a/ruamoko/gui/Rect.r b/ruamoko/gui/Rect.r index 7dac069a3..51be28e3e 100644 --- a/ruamoko/gui/Rect.r +++ b/ruamoko/gui/Rect.r @@ -3,87 +3,21 @@ #include "gui/Size.h" #include "gui/Rect.h" -@implementation Rect - -- (id) initWithComponents: (integer)x : (integer)y : (integer)w : (integer)h +Rect makeRect (integer x, integer y, integer w, integer h) { - self = [self init]; - origin = [[Size alloc] initWithComponents: x : y]; - size = [[Size alloc] initWithComponents: w : h]; - return self; + //FIXME Rect r = {{x, y}, {w, h}}; + Rect r; + r.origin = makePoint (x, y); + r.size = makeSize (w, h); + return r; } -- (id) initWithOrigin: (Point)anOrigin size: (Size)aSize +Rect makeRectFromOriginSize (Point origin, Size size) { - self = [self init]; + Rect r; - if (!self || !anOrigin || !aSize) - return NIL; + r.origin = origin; + r.size = size; - origin = [anOrigin retain]; - size = [aSize retain]; - - return self; + return r; } - -- (id) initWithRect: (Rect)aRect -{ - self = [self init]; - - if (!self || !aRect) - return NIL; - - [self setRect: aRect]; - - return self; -} - -- (id) copy -{ - local id myCopy = [super copy]; - - if (!myCopy) - myCopy = [[self class] alloc]; - - return [myCopy initWithOrigin: origin size: size]; -} - -- (Point) origin -{ - return origin; -} - -- (Size) size -{ - return size; -} - -- (void) setOrigin: (Point)aPoint -{ - if (!aPoint) - return; - - if (origin) - [origin release]; - - origin = [aPoint retain]; -} - -- (void) setSize: (Size)aSize -{ - if (!aSize) - return; - - if (size) - [size release]; - - size = [aSize retain]; -} - -- (void) setRect: (Rect)aRect -{ - [self setOrigin: [aRect origin]]; - [self setSize: [aRect size]]; -} - -@end diff --git a/ruamoko/gui/Size.r b/ruamoko/gui/Size.r index c44942d4b..61f272a4f 100644 --- a/ruamoko/gui/Size.r +++ b/ruamoko/gui/Size.r @@ -1,74 +1,19 @@ #include "gui/Size.h" -@implementation Size - -- (id) initWithComponents: (integer)w : (integer)h +Size makeSize (integer width, integer height) { - self = [self init]; - width = w; - height = h; - return self; + Size s = {width, height}; + return s; } -- (id) initWithSize: (Size)aSize +Size addSize (Size a, Size b) { - self = [self init]; - - if (!self || !aSize) - return NIL; - - width = [aSize width]; - height = [aSize height]; - - return self; + Size c = {a.width + b.width, a.height + b.height}; + return c; } -- (id) copy +Size subtractSize (Size a, Size b) { - local id myCopy = [super copy]; - - if (!myCopy) - myCopy = [[self class] alloc]; - - return [myCopy initWithComponents: width : height]; + Size c = {a.width - b.width, a.height - b.height}; + return c; } - -- (integer) width -{ - return width; -} - -- (integer) height -{ - return height; -} - -- (void) setSize: (Size)aSize -{ - width = [aSize width]; - height = [aSize height]; -} - -- (void) setWidth: (integer) w -{ - width = w; -} - -- (void) setHeight: (integer) h -{ - height = h; -} - -- (void) addSize: (Size)aSize -{ - width += [aSize width]; - height += [aSize height]; -} - -- (void) subtractSize: (Size)aSize -{ - width += [aSize width]; - height += [aSize height]; -} - -@end diff --git a/ruamoko/gui/View.r b/ruamoko/gui/View.r index 77c822e90..c3405331f 100644 --- a/ruamoko/gui/View.r +++ b/ruamoko/gui/View.r @@ -40,9 +40,8 @@ - (void) setBasePos: (integer) x y: (integer) y { - local Point point = [[Point alloc] initWithComponents:x :y]; + local Point point = {x, y}; [self setBasePos:point]; - [point release]; } - (void) setBasePos: (Point)pos diff --git a/ruamoko/include/gui/InputLine.h b/ruamoko/include/gui/InputLine.h index b1201001a..7cf4badcd 100644 --- a/ruamoko/include/gui/InputLine.h +++ b/ruamoko/include/gui/InputLine.h @@ -22,9 +22,6 @@ struct il_data_t { BOOL cursor; }; -@class Rect; -@class Point; - @interface InputLine: View { struct il_data_t control; diff --git a/ruamoko/include/gui/Point.h b/ruamoko/include/gui/Point.h index e8f8e53dc..5add63e35 100644 --- a/ruamoko/include/gui/Point.h +++ b/ruamoko/include/gui/Point.h @@ -1,26 +1,15 @@ #ifndef __ruamoko_gui_Point_h #define __ruamoko_gui_Point_h -#include "Object.h" +struct Point { + integer x; + integer y; +}; -@interface Point: Object -{ -@public - integer x; - integer y; -} +typedef struct Point Point; -- (id) initWithComponents: (integer)_x : (integer)_y; -- (id) initWithPoint: (Point)aPoint; -- (id) copy; - -- (void) addPoint: (Point)aPoint; -- (void) subtractPoint: (Point)aPoint; - -- (integer) x; -- (integer) y; - -- (void) setPoint: (Point)aPoint; -@end +@extern Point makePoint (integer x, integer y); +@extern Point addPoint (Point a, Point b); +@extern Point subtractPoint (Point a, Point b); #endif //__ruamoko_gui_Point_h diff --git a/ruamoko/include/gui/Rect.h b/ruamoko/include/gui/Rect.h index 682cd3a7a..4a6ecbbae 100644 --- a/ruamoko/include/gui/Rect.h +++ b/ruamoko/include/gui/Rect.h @@ -1,21 +1,17 @@ #ifndef __ruamoko_gui_Rect_h #define __ruamoko_gui_Rect_h -#include "Object.h" #include "gui/Point.h" #include "gui/Size.h" -@interface Rect: Object -{ -@public +struct Rect { Point origin; Size size; -} +}; +typedef struct Rect Rect; -- (id) initWithComponents: (integer)x : (integer)y : (integer)w : (integer)h; -- (id) initWithOrigin: (Point)anOrigin size: (Size)aSize; -- (id) initWithRect: (Rect)aRect; -- (id) copy; +@extern Rect makeRect (integer x, integer y, integer w, integer h); +@extern Rect makeRectFromOriginSize (Point origin, Size size); #if 0 - (BOOL) intersectsRect: (Rect)aRect; @@ -31,13 +27,4 @@ - (Rect) offsetBySize: (Size)aSize; #endif -- (Point) origin; -- (Size) size; - -- (void) setOrigin: (Point)aPoint; -- (void) setSize: (Size)aSize; -- (void) setRect: (Rect)aRect; - -@end - #endif //__ruamoko_gui_Rect_h diff --git a/ruamoko/include/gui/Size.h b/ruamoko/include/gui/Size.h index ac40a79ec..f78fa4fad 100644 --- a/ruamoko/include/gui/Size.h +++ b/ruamoko/include/gui/Size.h @@ -1,29 +1,15 @@ #ifndef __ruamoko_gui_Size_h #define __ruamoko_gui_Size_h -#include "Object.h" +struct Size { + integer width; + integer height; +}; -@interface Size: Object -{ -@public - integer width; - integer height; -} +typedef struct Size Size; -- (id) initWithComponents: (integer)w : (integer)h; -- (id) initWithSize: (Size)aSize; -- (id) copy; - -- (integer) width; -- (integer) height; - -- (void) setSize: (Size)aSize; -- (void) setWidth: (integer)w; -- (void) setHeight: (integer)h; - -- (void) addSize: (Size)aSize; -- (void) subtractSize: (Size)aSize; - -@end +@extern Size makeSize (integer width, integer height); +@extern Size addSize (Size a, Size b); +@extern Size subtractSize (Size a, Size b); #endif //__ruamoko_gui_Size_h diff --git a/ruamoko/include/gui/View.h b/ruamoko/include/gui/View.h index 30d7fe379..741a820f6 100644 --- a/ruamoko/include/gui/View.h +++ b/ruamoko/include/gui/View.h @@ -2,10 +2,7 @@ #define __ruamoko_gui_View_h #include "Object.h" - -@class Point; -@class Size; -@class Rect; +#include "gui/Rect.h" @interface View: Object { From 67beaf44875f87562f352d104480637695624303 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 17 Nov 2010 18:49:39 +0900 Subject: [PATCH 079/115] Nil is a constant, so allow it in global initializers. --- tools/qfcc/include/expr.h | 3 ++- tools/qfcc/source/emit.c | 4 ++-- tools/qfcc/source/expr.c | 23 +++++++++++++---------- tools/qfcc/source/immediate.c | 2 ++ tools/qfcc/source/qc-lex.l | 8 +++++--- tools/qfcc/source/qc-parse.y | 15 +++++++-------- tools/qfcc/source/switch.c | 2 +- tools/qfcc/test/enum.r | 2 ++ tools/qfcc/test/imp.r | 3 +++ tools/qfcc/test/nil.r | 1 + 10 files changed, 38 insertions(+), 25 deletions(-) create mode 100644 tools/qfcc/test/enum.r create mode 100644 tools/qfcc/test/imp.r create mode 100644 tools/qfcc/test/nil.r diff --git a/tools/qfcc/include/expr.h b/tools/qfcc/include/expr.h index 845e7d032..6b06a45d9 100644 --- a/tools/qfcc/include/expr.h +++ b/tools/qfcc/include/expr.h @@ -44,9 +44,9 @@ typedef enum { ex_uexpr, // unary expression ex_def, ex_temp, // temporary variable - ex_nil, // umm, nil, null. nuff said ex_name, + ex_nil, // umm, nil, null. nuff said ex_string, ex_float, ex_vector, @@ -206,6 +206,7 @@ void convert_uint_int (expr_t *e); void convert_int_uint (expr_t *e); void convert_short_int (expr_t *e); void convert_short_uint (expr_t *e); +void convert_nil (expr_t *e, struct type_s *t); expr_t *test_expr (expr_t *e, int test); void backpatch (ex_list_t *list, expr_t *label); diff --git a/tools/qfcc/source/emit.c b/tools/qfcc/source/emit.c index 5e2daba2d..94223e7e7 100644 --- a/tools/qfcc/source/emit.c +++ b/tools/qfcc/source/emit.c @@ -328,7 +328,7 @@ emit_assign_expr (int oper, expr_t *e) if (e->rvalue && def_b->managed) def_b->users++; if (e1->type == ex_expr && extract_type (e1->e.expr.e1) == ev_pointer - && e1->e.expr.e1->type < ex_string) { + && e1->e.expr.e1->type < ex_nil) { def_a = emit_sub_expr (e1->e.expr.e1, 0); def_c = emit_sub_expr (e1->e.expr.e2, 0); op = opcode_find (operator, def_b->type, def_a->type, def_c->type); @@ -470,7 +470,7 @@ emit_deref_expr (expr_t *e, def_t *dest) if (e->type == ex_expr && e->e.expr.op == '&' - && e->e.expr.e1->type < ex_string) + && e->e.expr.e1->type < ex_nil) e->e.expr.op = '.'; if (e->type == ex_uexpr && e->e.expr.op == '.') d = emit_sub_expr (e, 0); diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index 72969d1c3..7f9f18fa4 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -76,9 +76,9 @@ etype_t qc_types[] = { ev_void, // ex_uexpr ev_void, // ex_def ev_void, // ex_temp - ev_void, // ex_nil ev_void, // ex_name + ev_void, // ex_nil ev_string, // ex_string ev_float, // ex_float ev_vector, // ex_vector @@ -141,6 +141,10 @@ convert_name (expr_t *e) expr_t *new; class_t *class; + new = get_enum (name); + if (new) + goto convert; + class = get_class (name, 0); if (class) { e->type = ex_def; @@ -159,9 +163,6 @@ convert_name (expr_t *e) return; } new = class_ivar_expr (current_class, name); - if (new) - goto convert; - new = get_enum (name); if (new) goto convert; error (e, "Undeclared variable \"%s\".", name); @@ -604,7 +605,7 @@ new_short_expr (short short_val) int is_constant (expr_t *e) { - if (e->type >= ex_string + if (e->type >= ex_nil || (e->type == ex_def && e->e.def->constant)) return 1; return 0; @@ -615,6 +616,8 @@ constant_expr (expr_t *var) { def_t *def; + convert_name (var); + if (var->type != ex_def || !var->e.def->constant) return var; @@ -818,7 +821,7 @@ print_expr (expr_t *e) e->e.temp.users); break; case ex_nil: - printf ("NULL"); + printf ("NIL"); break; case ex_string: case ex_name: @@ -1365,7 +1368,7 @@ convert_short_uint (expr_t *e) e->e.uinteger_val = e->e.short_val; } -static void +void convert_nil (expr_t *e, type_t *t) { e->type = expr_types[t->type]; @@ -1696,7 +1699,7 @@ binary_expr (int op, expr_t *e1, expr_t *e2) { expr_t *tmp1, *tmp2; e = new_block_expr (); - if (e2->type < ex_string) + if (e2->type < ex_nil) tmp1 = new_temp_def_expr (&type_float); else tmp1 = e2; @@ -2519,7 +2522,7 @@ assign_expr (expr_t *e1, expr_t *e2) && POINTER_VAL (e->e.pointer) < 65536)) { if (e->type == ex_expr && e->e.expr.op == '&' && e->e.expr.type->type == ev_pointer - && e->e.expr.e1->type < ex_string) { + && e->e.expr.e1->type < ex_nil) { e2 = e; e2->e.expr.op = '.'; e2->e.expr.type = t2; @@ -2640,7 +2643,7 @@ init_elements (def_t *def, expr_t *eles) } init_elements (&elements[i], c); continue; - } else if (c->type >= ex_string) { + } else if (c->type >= ex_nil) { if (c->type == ex_integer && elements[i].type->type == ev_float) convert_int (c); diff --git a/tools/qfcc/source/immediate.c b/tools/qfcc/source/immediate.c index 93c8db928..7b5890c8b 100644 --- a/tools/qfcc/source/immediate.c +++ b/tools/qfcc/source/immediate.c @@ -167,6 +167,8 @@ ReuseConstant (expr_t *expr, def_t *def) clear_immediates (); } cn = 0; + if (e.type == ex_nil) + convert_nil (&e, def->type); switch (e.type) { case ex_entity: tab = entity_imm_defs; diff --git a/tools/qfcc/source/qc-lex.l b/tools/qfcc/source/qc-lex.l index 8d5511778..aaaefd331 100644 --- a/tools/qfcc/source/qc-lex.l +++ b/tools/qfcc/source/qc-lex.l @@ -358,9 +358,11 @@ type_or_name (char *token) yylval.typename = typename; return TYPE_NAME; } - if ((class = get_class (token, 0))) { - yylval.string_val = save_string (token); - return CLASS_NAME; + if (!get_enum (token)) { + if ((class = get_class (token, 0))) { + yylval.string_val = save_string (token); + return CLASS_NAME; + } } yylval.string_val = save_string (token); return NAME; diff --git a/tools/qfcc/source/qc-parse.y b/tools/qfcc/source/qc-parse.y index 852ccb655..f92d57f3d 100644 --- a/tools/qfcc/source/qc-parse.y +++ b/tools/qfcc/source/qc-parse.y @@ -373,7 +373,7 @@ enum { $$ = 0; $3 = constant_expr ($3); - if ($3->type < ex_string) { + if ($3->type < ex_nil) { error ($3, "non-constant initializer"); } else if ($3->type != ex_integer) { error ($3, "invalid initializer type"); @@ -600,15 +600,14 @@ var_initializer def_initialized ($$); } else { $2 = constant_expr ($2); - if ($2->type >= ex_string) { - if ($$->constant) { + if ($2->type >= ex_nil) { + if ($2->type != ex_nil + && !type_assignable ($$->type, get_type ($2))) { + error ($2, "incompatible types in initialization"); + } else if ($$->constant) { error ($2, "%s re-initialized", $$->name); } else { - if ($$->type->type == ev_func) { - PARSE_ERROR; - } else { - ReuseConstant ($2, $$); - } + ReuseConstant ($2, $$); } } else { error ($2, "non-constant expression used for initializer"); diff --git a/tools/qfcc/source/switch.c b/tools/qfcc/source/switch.c index 6b6e33484..187e80633 100644 --- a/tools/qfcc/source/switch.c +++ b/tools/qfcc/source/switch.c @@ -106,7 +106,7 @@ case_label_expr (switch_block_t *switch_block, expr_t *value) convert_name (value); value = constant_expr (value); } - if (value && value->type < ex_string) { + if (value && value->type < ex_nil) { error (value, "non-constant case value"); free (cl); return 0; diff --git a/tools/qfcc/test/enum.r b/tools/qfcc/test/enum.r new file mode 100644 index 000000000..e2c31e9d8 --- /dev/null +++ b/tools/qfcc/test/enum.r @@ -0,0 +1,2 @@ +typedef enum {x} X; +X y = x; diff --git a/tools/qfcc/test/imp.r b/tools/qfcc/test/imp.r new file mode 100644 index 000000000..030a21ddd --- /dev/null +++ b/tools/qfcc/test/imp.r @@ -0,0 +1,3 @@ +void () foo = #0; +@static IMP bar = NIL; +@static IMP baz = 0; diff --git a/tools/qfcc/test/nil.r b/tools/qfcc/test/nil.r new file mode 100644 index 000000000..2b6a193ce --- /dev/null +++ b/tools/qfcc/test/nil.r @@ -0,0 +1 @@ +Class x = NIL; From c460e3c9791ab1fe36d90b6d78aa8633e15ce753 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 17 Nov 2010 18:59:39 +0900 Subject: [PATCH 080/115] Fix setBasePos to get the pos from a view. This fixes Group for the Point/Size/Rect change. --- ruamoko/gui/Group.r | 3 ++- ruamoko/gui/View.r | 11 +++++++++-- ruamoko/include/gui/View.h | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ruamoko/gui/Group.r b/ruamoko/gui/Group.r index 3f02fadd5..4e5f41b4b 100644 --- a/ruamoko/gui/Group.r +++ b/ruamoko/gui/Group.r @@ -41,7 +41,8 @@ { [super setBasePos:pos]; local Point point = {xabs, yabs}; - [views makeObjectsPerformSelector:@selector (setBasePos:) withObject:point]; + local SEL sel = @selector (setBasePosFromView:); + [views makeObjectsPerformSelector:sel withObject:self]; } - (void) draw diff --git a/ruamoko/gui/View.r b/ruamoko/gui/View.r index c3405331f..c713cccb8 100644 --- a/ruamoko/gui/View.r +++ b/ruamoko/gui/View.r @@ -38,14 +38,21 @@ return flags & 1; } +- (Point) basePos +{ + return makePoint (xabs, yabs); +} + - (void) setBasePos: (integer) x y: (integer) y { local Point point = {x, y}; - [self setBasePos:point]; + xabs = xpos + x; + yabs = ypos + y; } -- (void) setBasePos: (Point)pos +- (void) setBasePosFromView: (View) view { + Point pos = [view basePos]; xabs = xpos + pos.x; yabs = ypos + pos.y; } diff --git a/ruamoko/include/gui/View.h b/ruamoko/include/gui/View.h index 741a820f6..7626eeac5 100644 --- a/ruamoko/include/gui/View.h +++ b/ruamoko/include/gui/View.h @@ -20,7 +20,7 @@ - (id) canFocus: (integer)cf; - (integer) canFocus; - (void) setBasePos: (integer)x y: (integer)y; -- (void) setBasePos: (Point)pos; +- (void) setBasePosFromView: (View)view; - (void) draw; - (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down; From e28ee0378fa20013c6fe4b1e31bb604264891df7 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 18 Nov 2010 09:02:12 +0900 Subject: [PATCH 081/115] Gracefully handle returning NIL though a bad type. --- tools/qfcc/source/expr.c | 2 ++ tools/qfcc/test/nil.r | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index 7f9f18fa4..28b66c41d 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -2138,6 +2138,8 @@ return_expr (function_t *f, expr_t *e) if (e->type == ex_nil) { t = f->def->type->aux_type; e->type = expr_types[t->type]; + if (e->type == ex_nil) + return error (e, "invalid return type for NIL"); } else { if (!options.traditional) return error (e, "void value not ignored as it ought to be"); diff --git a/tools/qfcc/test/nil.r b/tools/qfcc/test/nil.r index 2b6a193ce..b261a25bf 100644 --- a/tools/qfcc/test/nil.r +++ b/tools/qfcc/test/nil.r @@ -1 +1,18 @@ Class x = NIL; + +struct Size { + integer x; + integer y; +}; +typedef struct Size Size; + +@interface foo +-(Size) bar; +@end +@implementation foo +-(Size) bar +{ + local Size s; + return NIL; +} +@end From 9a3f4d5a016edd020a0269e2f21c887b0ae8a128 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 18 Nov 2010 10:44:25 +0900 Subject: [PATCH 082/115] Handle method parameters that use incomplete types. Compare the method's type pointers rather than the type strings as the pointer won't change with the struct is completed. --- tools/qfcc/source/method.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/qfcc/source/method.c b/tools/qfcc/source/method.c index 469e5e759..347a003e7 100644 --- a/tools/qfcc/source/method.c +++ b/tools/qfcc/source/method.c @@ -216,8 +216,7 @@ method_compare (method_t *m1, method_t *m2) { if (m1->instance != m2->instance) return 0; - return strcmp (m1->name, m2->name) == 0 - && strcmp (m1->types, m2->types) == 0; + return strcmp (m1->name, m2->name) == 0 && m1->type == m2->type; } keywordarg_t * From 763cec383869ecdde2ecccaf1c0eab3c1de69569 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 19 Nov 2010 00:06:53 +0900 Subject: [PATCH 083/115] Some spelling/grammar corrections. --- include/QF/qfplist.h | 14 +++++++------- libs/ruamoko/rua_qfile.c | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/QF/qfplist.h b/include/QF/qfplist.h index 482b2b4ed..fae266b22 100644 --- a/include/QF/qfplist.h +++ b/include/QF/qfplist.h @@ -88,7 +88,7 @@ typedef struct plitem_s plitem_t; \param string the saved plist, as read from a file. \return Returns an object equivalent to the passed-in string. - \note You are responsible for freeing the object returned. + \note You are responsible for freeing the returned object. */ plitem_t *PL_GetPropertyList (const char *string); @@ -96,7 +96,7 @@ plitem_t *PL_GetPropertyList (const char *string); \param pl the in-memory representation \return the text representation of the property list - \note You are responsible for freeing the string returned. + \note You are responsible for freeing the returned string. */ char *PL_WritePropertyList (plitem_t *pl); @@ -167,7 +167,7 @@ int PL_D_NumKeys (plitem_t *dict); /** Add a key/value pair to a dictionary. - \param dict The dictionary to add the key/value pair to + \param dict The dictionary to which the key/value pair will be added \param key The key of the key/value pair to be added to the dictionary \param value The value of the key/value pair to be added to the dictionary @@ -179,7 +179,7 @@ qboolean PL_D_AddObject (plitem_t *dict, const char *key, plitem_t *value); /** Add an item to an array. - \param array The array to add the item to + \param array The array to which the item will be added \param item The item to be added to the array \return true on success, false on failure @@ -190,7 +190,7 @@ qboolean PL_A_AddObject (plitem_t *array, plitem_t *item); /** Retrieve the number of items in an array. - \param array The array to get the number of objects in + \param array The array from which to get the number of objects \return number of objects in the array */ @@ -198,7 +198,7 @@ int PL_A_NumObjects (plitem_t *array); /** Insert an item into an array before the specified location. - \param array The array to add the item to + \param array The array to which the item will be added \param item The item to be added to the array \param index The location at which to insert the item into the array @@ -211,7 +211,7 @@ qboolean PL_A_InsertObjectAtIndex (plitem_t *array, plitem_t *item, int index); /** Remove a value from an array object. The array items will be shuffled to fill the resulting hole. - \param array The array to get the value from + \param array The array from which to remove the value \param index The index within the array to remove \return the value associated with the index, or NULL if not found or array isn't an array. diff --git a/libs/ruamoko/rua_qfile.c b/libs/ruamoko/rua_qfile.c index 26f6b5268..cb8e1d2a6 100644 --- a/libs/ruamoko/rua_qfile.c +++ b/libs/ruamoko/rua_qfile.c @@ -182,7 +182,7 @@ bi_Qclose (progs_t *pr) qfile_t *h = handle_get (res, handle); if (!h) - PR_RunError (pr, "invalid file handle pass to Qclose"); + PR_RunError (pr, "invalid file handle passed to Qclose"); Qclose (h->file); *h->prev = h->next; handle_free (res, h); From 5fc4ef63f6573bc9a5853b39ae21c73bb0d1dfc4 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 19 Nov 2010 13:39:20 +0900 Subject: [PATCH 084/115] Rewrite ruamoko plist support to use handles. The plist code was written long before I thought of resource handles, and then it was forgotten. This is much nicer and safer than storing C pointers in progs memory space (*shudder*). --- libs/ruamoko/rua_plist.c | 319 +++++++++++++++++++++++++++++++-------- ruamoko/include/plist.h | 6 +- ruamoko/lib/plist.r | 2 + tools/qwaq/main.qc | 10 +- 4 files changed, 268 insertions(+), 69 deletions(-) diff --git a/libs/ruamoko/rua_plist.c b/libs/ruamoko/rua_plist.c index db1efe9c8..3c59c4a9b 100644 --- a/libs/ruamoko/rua_plist.c +++ b/libs/ruamoko/rua_plist.c @@ -48,55 +48,149 @@ static __attribute__ ((used)) const char rcsid[] = #include "rua_internal.h" +typedef struct bi_plist_s { + struct bi_plist_s *next; + struct bi_plist_s **prev; + plitem_t *plitem; + int own; +} bi_plist_t; + typedef struct { - hashtab_t *items; + PR_RESMAP (bi_plist_t) plist_map; + bi_plist_t *plists; + hashtab_t *plist_tab; } plist_resources_t; -static inline void -return_plitem (progs_t *pr, plitem_t *plitem) +static bi_plist_t * +plist_new (plist_resources_t *res) { - memset (&R_INT (pr), 0, 8); - memcpy (&R_INT (pr), &plitem, sizeof (plitem)); + PR_RESNEW (bi_plist_t, res->plist_map); } -static inline plitem_t * -p_plitem (progs_t *pr, int n) +static void +plist_free (plist_resources_t *res, bi_plist_t *plist) { - plitem_t *plitem; - memcpy (&plitem, &P_INT (pr, n), sizeof (plitem)); - return plitem; + PR_RESFREE (bi_plist_t, res->plist_map, plist); } -static inline plitem_t * -record_plitem (progs_t *pr, plitem_t *plitem) +static void +plist_reset (plist_resources_t *res) { - plist_resources_t *res = PR_Resources_Find (pr, "plist"); - if (plitem) - Hash_AddElement (res->items, plitem); - return plitem; + PR_RESRESET (bi_plist_t, res->plist_map); } -static inline plitem_t * -remove_plitem (progs_t *pr, plitem_t *plitem) +static inline bi_plist_t * +plist_get (plist_resources_t *res, unsigned index) { - plist_resources_t *res = PR_Resources_Find (pr, "plist"); + PR_RESGET(res->plist_map, index); +} + +static inline int +plist_index (plist_resources_t *res, bi_plist_t *plist) +{ + PR_RESINDEX(res->plist_map, plist); +} + +static void +bi_plist_clear (progs_t *pr, void *data) +{ + plist_resources_t *res = (plist_resources_t *) data; + bi_plist_t *plist; + + for (plist = res->plists; plist; plist = plist->next) { + if (plist->own) + PL_Free (plist->plitem); + } + + Hash_FlushTable (res->plist_tab); + plist_reset (res); +} + +static inline int +plist_handle (plist_resources_t *res, plitem_t *plitem) +{ + bi_plist_t dummy = {0, 0, plitem, 0}; + bi_plist_t *plist = Hash_FindElement (res->plist_tab, &dummy); - Hash_DelElement (res->items, plitem); - return plitem; + if (plist) + return plist_index (res, plist); + + plist = plist_new (res); + + if (!plist) + return 0; + + plist->next = res->plists; + plist->prev = &res->plists; + if (res->plists) + res->plists->prev = &plist->next; + res->plists = plist; + + plist->plitem = plitem; + + Hash_AddElement (res->plist_tab, plist); + return plist_index (res, plist); +} + +static inline void +plist_free_handle (plist_resources_t *res, bi_plist_t *plist) +{ + Hash_DelElement (res->plist_tab, plist); + *plist->prev = plist->next; + plist_free (res, plist); +} + +static inline bi_plist_t * +get_plist (progs_t *pr, const char *name, int handle) +{ + plist_resources_t *res = PR_Resources_Find (pr, "plist"); + bi_plist_t *plist = plist_get (res, handle); + + // plist->prev will be null if the handle is unallocated + if (!plist || !plist->prev) + PR_RunError (pr, "invalid plist passed to %s", name + 3); + return plist; +} + +static inline int +plist_retain (plist_resources_t *res, plitem_t *plitem) +{ + int handle; + bi_plist_t *plist; + + if (!plitem) + return 0; + + handle = plist_handle (res, plitem); + if (!handle) { + // we're taking ownership of the plitem, but we have nowhere to store + // it, so we have to lose it. However, in this situation, we have worse + // things to worry about. + PL_Free (plitem); + return 0; + } + + plist = plist_get (res, handle); + plist->own = 1; + return handle; } static void bi_PL_GetPropertyList (progs_t *pr) { + plist_resources_t *res = PR_Resources_Find (pr, "plist"); plitem_t *plitem = PL_GetPropertyList (P_GSTRING (pr, 0)); - - return_plitem (pr, record_plitem (pr, plitem)); + + R_INT (pr) = plist_retain (res, plitem); } static void bi_PL_WritePropertyList (progs_t *pr) { - char *pl = PL_WritePropertyList (p_plitem (pr, 0)); + int handle = P_INT (pr, 0); + bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + char *pl = PL_WritePropertyList (plist->plitem); + R_STRING (pr) = PR_SetDynamicString (pr, pl); free (pl); } @@ -104,117 +198,208 @@ bi_PL_WritePropertyList (progs_t *pr) static void bi_PL_Type (progs_t *pr) { - R_INT (pr) = PL_Type (p_plitem (pr, 0)); + int handle = P_INT (pr, 0); + bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + + R_INT (pr) = PL_Type (plist->plitem); } static void bi_PL_String (progs_t *pr) { - const char *str = PL_String (p_plitem (pr, 0)); + int handle = P_INT (pr, 0); + bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + const char *str = PL_String (plist->plitem); + RETURN_STRING (pr, str); } static void bi_PL_ObjectForKey (progs_t *pr) { - return_plitem (pr, PL_ObjectForKey (p_plitem (pr, 0), P_GSTRING (pr, 1))); + plist_resources_t *res = PR_Resources_Find (pr, "plist"); + int handle = P_INT (pr, 0); + bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + const char *key = P_GSTRING (pr, 1); + plitem_t *plitem = PL_ObjectForKey (plist->plitem, key); + + R_INT (pr) = 0; + if (!plitem) + return; + R_INT (pr) = plist_handle (res, plitem); +} + +static void +bi_PL_RemoveObjectForKey (progs_t *pr) +{ + plist_resources_t *res = PR_Resources_Find (pr, "plist"); + int handle = P_INT (pr, 0); + bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + const char *key = P_GSTRING (pr, 1); + plitem_t *plitem = PL_RemoveObjectForKey (plist->plitem, key); + + R_INT (pr) = plist_retain (res, plitem); } static void bi_PL_ObjectAtIndex (progs_t *pr) { - return_plitem (pr, PL_ObjectAtIndex (p_plitem (pr, 0), P_INT (pr, 1))); + plist_resources_t *res = PR_Resources_Find (pr, "plist"); + int handle = P_INT (pr, 0); + bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + int ind = P_INT (pr, 1); + plitem_t *plitem = PL_ObjectAtIndex (plist->plitem, ind); + + R_INT (pr) = 0; + if (!plitem) + return; + R_INT (pr) = plist_handle (res, plitem); } static void bi_PL_D_AllKeys (progs_t *pr) { - return_plitem (pr, PL_D_AllKeys (p_plitem (pr, 0))); + plist_resources_t *res = PR_Resources_Find (pr, "plist"); + int handle = P_INT (pr, 0); + bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + plitem_t *plitem = PL_D_AllKeys (plist->plitem); + + R_INT (pr) = plist_retain (res, plitem); } static void bi_PL_D_NumKeys (progs_t *pr) { - R_INT (pr) = PL_D_NumKeys (p_plitem (pr, 0)); + int handle = P_INT (pr, 0); + bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + + R_INT (pr) = PL_D_NumKeys (plist->plitem); } static void bi_PL_D_AddObject (progs_t *pr) { - R_INT (pr) = PL_D_AddObject (p_plitem (pr, 0), P_GSTRING (pr, 1), - remove_plitem (pr, p_plitem (pr, 2))); + int dict_handle = P_INT (pr, 0); + int obj_handle = P_INT (pr, 2); + bi_plist_t *dict = get_plist (pr, __FUNCTION__, dict_handle); + const char *key = P_GSTRING (pr, 1); + bi_plist_t *obj = get_plist (pr, __FUNCTION__, obj_handle); + + obj->own = 0; + R_INT (pr) = PL_D_AddObject (dict->plitem, key, obj->plitem); } static void bi_PL_A_AddObject (progs_t *pr) { - R_INT (pr) = PL_A_AddObject (p_plitem (pr, 0), - remove_plitem (pr, p_plitem (pr, 1))); + int arr_handle = P_INT (pr, 0); + int obj_handle = P_INT (pr, 1); + bi_plist_t *arr = get_plist (pr, __FUNCTION__, arr_handle); + bi_plist_t *obj = get_plist (pr, __FUNCTION__, obj_handle); + + obj->own = 0; + R_INT (pr) = PL_A_AddObject (arr->plitem, obj->plitem); } static void bi_PL_A_NumObjects (progs_t *pr) { - R_INT (pr) = PL_A_NumObjects (p_plitem (pr, 0)); + int handle = P_INT (pr, 0); + bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + + R_INT (pr) = PL_A_NumObjects (plist->plitem); } static void bi_PL_A_InsertObjectAtIndex (progs_t *pr) { - R_INT (pr) = PL_A_InsertObjectAtIndex (p_plitem (pr, 0), - remove_plitem (pr, p_plitem (pr, 1)), - P_INT (pr, 2)); + int dict_handle = P_INT (pr, 0); + int obj_handle = P_INT (pr, 1); + bi_plist_t *arr = get_plist (pr, __FUNCTION__, dict_handle); + bi_plist_t *obj = get_plist (pr, __FUNCTION__, obj_handle); + int ind = P_INT (pr, 2); + + obj->own = 0; + R_INT (pr) = PL_A_InsertObjectAtIndex (arr->plitem, obj->plitem, ind); } static void -bi_PL_Free (progs_t *pr) +bi_PL_RemoveObjectAtIndex (progs_t *pr) { - PL_Free (remove_plitem (pr, p_plitem (pr, 0))); -} + plist_resources_t *res = PR_Resources_Find (pr, "plist"); + int handle = P_INT (pr, 0); + bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + int ind = P_INT (pr, 1); + plitem_t *plitem = PL_RemoveObjectAtIndex (plist->plitem, ind); -static void -bi_PL_NewArray (progs_t *pr) -{ - return_plitem (pr, record_plitem (pr, PL_NewArray ())); -} - -static void -bi_PL_NewData (progs_t *pr) -{ - return_plitem (pr, record_plitem (pr, PL_NewData (P_GPOINTER (pr, 0), - P_INT (pr, 1)))); -} - -static void -bi_PL_NewString (progs_t *pr) -{ - return_plitem (pr, record_plitem (pr, PL_NewString (P_GSTRING (pr, 0)))); + R_INT (pr) = plist_retain (res, plitem); } static void bi_PL_NewDictionary (progs_t *pr) { - return_plitem (pr, record_plitem (pr, PL_NewDictionary ())); + plist_resources_t *res = PR_Resources_Find (pr, "plist"); + plitem_t *plitem = PL_NewDictionary (); + + R_INT (pr) = plist_retain (res, plitem); } static void -bi_plist_clear (progs_t *pr, void *data) +bi_PL_NewArray (progs_t *pr) { - plist_resources_t *res = (plist_resources_t *) data; + plist_resources_t *res = PR_Resources_Find (pr, "plist"); + plitem_t *plitem = PL_NewArray (); + + R_INT (pr) = plist_retain (res, plitem); +} - Hash_FlushTable (res->items); +static void +bi_PL_NewData (progs_t *pr) +{ + //FIXME not safe + plist_resources_t *res = PR_Resources_Find (pr, "plist"); + plitem_t *plitem = PL_NewData (P_GPOINTER (pr, 0), P_INT (pr, 1)); + + R_INT (pr) = plist_retain (res, plitem); +} + +static void +bi_PL_NewString (progs_t *pr) +{ + plist_resources_t *res = PR_Resources_Find (pr, "plist"); + plitem_t *plitem = PL_NewString (P_GSTRING (pr, 0)); + + R_INT (pr) = plist_retain (res, plitem); +} + +static void +bi_PL_Free (progs_t *pr) +{ + plist_resources_t *res = PR_Resources_Find (pr, "plist"); + int handle = P_INT (pr, 0); + bi_plist_t *plist = get_plist (pr, __FUNCTION__, handle); + + if (!plist->own) + PR_RunError (pr, "attempt to free unowned plist"); + + PL_Free (plist->plitem); + + plist_free_handle (res, plist); } static uintptr_t plist_get_hash (void *key, void *unused) { - return (uintptr_t) key; + bi_plist_t *plist = (bi_plist_t *) key; + return (uintptr_t) plist->plitem; } static int plist_compare (void *k1, void *k2, void *unused) { - return k1 == k2; + bi_plist_t *pl1 = (bi_plist_t *) k1; + bi_plist_t *pl2 = (bi_plist_t *) k2; + return pl1->plitem == pl2->plitem; } static builtin_t builtins[] = { @@ -223,6 +408,7 @@ static builtin_t builtins[] = { {"PL_Type", bi_PL_Type, -1}, {"PL_String", bi_PL_String, -1}, {"PL_ObjectForKey", bi_PL_ObjectForKey, -1}, + {"PL_RemoveObjectForKey", bi_PL_RemoveObjectForKey, -1}, {"PL_ObjectAtIndex", bi_PL_ObjectAtIndex, -1}, {"PL_D_AllKeys", bi_PL_D_AllKeys, -1}, {"PL_D_NumKeys", bi_PL_D_NumKeys, -1}, @@ -230,6 +416,7 @@ static builtin_t builtins[] = { {"PL_A_AddObject", bi_PL_A_AddObject, -1}, {"PL_A_NumObjects", bi_PL_A_NumObjects, -1}, {"PL_A_InsertObjectAtIndex", bi_PL_A_InsertObjectAtIndex, -1}, + {"PL_RemoveObjectAtIndex", bi_PL_RemoveObjectAtIndex, -1}, {"PL_NewDictionary", bi_PL_NewDictionary, -1}, {"PL_NewArray", bi_PL_NewArray, -1}, {"PL_NewData", bi_PL_NewData, -1}, @@ -242,8 +429,8 @@ void RUA_Plist_Init (progs_t *pr, int secure) { plist_resources_t *res = calloc (1, sizeof (plist_resources_t)); - res->items = Hash_NewTable (1021, 0, 0, 0); - Hash_SetHashCompare (res->items, plist_get_hash, plist_compare); + res->plist_tab = Hash_NewTable (1021, 0, 0, 0); + Hash_SetHashCompare (res->plist_tab, plist_get_hash, plist_compare); PR_Resources_Register (pr, "plist", res, bi_plist_clear); PR_RegisterBuiltins (pr, builtins); diff --git a/ruamoko/include/plist.h b/ruamoko/include/plist.h index 4cb52ba1a..5a78e529e 100644 --- a/ruamoko/include/plist.h +++ b/ruamoko/include/plist.h @@ -1,8 +1,8 @@ #ifndef __ruamoko_plist_h #define __ruamoko_plist_h -struct plitem_s {integer [2] dummy;}; -#define PL_TEST(item) (item.dummy[0] || item.dummy[1]) +struct plitem_s {integer dummy;}; +#define PL_TEST(item) (item.dummy) typedef struct plitem_s plitem_t; typedef enum {QFDictionary, QFArray, QFBinary, QFString} pltype_t; // possible types @@ -11,6 +11,7 @@ typedef enum {QFDictionary, QFArray, QFBinary, QFString} pltype_t; // possible t @extern pltype_t (plitem_t str) PL_Type; @extern string (plitem_t str) PL_String; @extern plitem_t (plitem_t item, string key) PL_ObjectForKey; +@extern plitem_t (plitem_t item, string key) PL_RemoveObjectForKey; @extern plitem_t (plitem_t item, integer index) PL_ObjectAtIndex; @extern plitem_t (plitem_t item) PL_D_AllKeys; @extern integer (plitem_t item) PL_D_NumKeys; @@ -18,6 +19,7 @@ typedef enum {QFDictionary, QFArray, QFBinary, QFString} pltype_t; // possible t @extern integer (plitem_t array_item, plitem_t item) PL_A_AddObject; @extern integer (plitem_t item) PL_A_NumObjects; @extern integer (plitem_t array_item, plitem_t item, integer index) PL_A_InsertObjectAtIndex; +@extern plitem_t (plitem_t array_item, integer index) PL_RemoveObjectAtIndex; @extern plitem_t () PL_NewDictionary; @extern plitem_t () PL_NewArray; @extern plitem_t (void []data, integer len) PL_NewData; diff --git a/ruamoko/lib/plist.r b/ruamoko/lib/plist.r index afaae7f92..a0c91af96 100644 --- a/ruamoko/lib/plist.r +++ b/ruamoko/lib/plist.r @@ -5,6 +5,7 @@ string (plitem_t pl) PL_WritePropertyList = #0; pltype_t (plitem_t str) PL_Type = #0; string (plitem_t str) PL_String = #0; plitem_t (plitem_t item, string key) PL_ObjectForKey = #0; +plitem_t (plitem_t item, string key) PL_RemoveObjectForKey = #0; plitem_t (plitem_t item, integer index) PL_ObjectAtIndex = #0; plitem_t (plitem_t item) PL_D_AllKeys = #0; integer (plitem_t item) PL_D_NumKeys = #0; @@ -12,6 +13,7 @@ integer (plitem_t dict, string key, plitem_t value) PL_D_AddObject = #0; integer (plitem_t array_item, plitem_t item) PL_A_AddObject = #0; integer (plitem_t item) PL_A_NumObjects = #0; integer (plitem_t array_item, plitem_t item, integer index) PL_A_InsertObjectAtIndex = #0; +plitem_t (plitem_t array_item, integer index) PL_RemoveObjectAtIndex = #0; plitem_t () PL_NewDictionary = #0; plitem_t () PL_NewArray = #0; plitem_t (void []data, integer len) PL_NewData = #0; diff --git a/tools/qwaq/main.qc b/tools/qwaq/main.qc index e1974a6f5..028465e5b 100644 --- a/tools/qwaq/main.qc +++ b/tools/qwaq/main.qc @@ -21,13 +21,21 @@ string read_file (string filename) void test_plist (void) { local string data, l; - local plitem_t pl; + local plitem_t pl, item, i; data = read_file ("/home/bill/.quakeforge.dir"); pl = PL_GetPropertyList ("{" + data + "}"); l = PL_WritePropertyList (pl); printf ("%s", data); printf ("%s", l); + i = PL_ObjectForKey (pl, "QF"); + item = PL_RemoveObjectForKey (pl, "QF"); + l = PL_WritePropertyList (item); + printf ("%s", l); + PL_Free (item); + //Because i and item both point to the same plitem, and item has been, + //freed, freeing i will generate an error + //l = PL_WritePropertyList (i); PL_Free (pl); str_free (data); } From 7acf8c057028a700e448390ce8255b45f26f9b8c Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 22 Nov 2010 13:28:42 +0900 Subject: [PATCH 085/115] Must retain before release. --- ruamoko/lib/Array.r | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ruamoko/lib/Array.r b/ruamoko/lib/Array.r index 32eae9053..948f7a874 100644 --- a/ruamoko/lib/Array.r +++ b/ruamoko/lib/Array.r @@ -47,9 +47,9 @@ index = count - 1; if (index < 0 || index >= count) return; + [item retain]; [array[index] release]; array[index] = item; - [item retain]; } - (void) addItem: (id) item @@ -58,8 +58,8 @@ size += incr; array = (id [])obj_realloc (array, size * @sizeof (id)); } - array[count++] = item; [item retain]; + array[count++] = item; } - (void) removeItem: (id) item @@ -106,9 +106,9 @@ } for (i = count; i > index; i--) array[i] = array[i - 1]; + [item retain]; array[index] = item; count++; - [item retain]; return item; } From 4518e6af918d2a181bf9f60d1c982ce24a817e3d Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 22 Nov 2010 13:26:23 +0900 Subject: [PATCH 086/115] First stab at implementing autorelease. It's probably nowhere near right, but probably ok for now (I need to study the GNUStep code). I'm unhappy with the menu code hook, but it will have to do for now. --- libs/console/menu.c | 39 ++++++++++++++++++++++++++--- ruamoko/cl_menu/client_menu.qc | 6 +++++ ruamoko/include/AutoreleasePool.h | 5 ++-- ruamoko/lib/AutoreleasePool.r | 41 +++++++++++++++++++------------ ruamoko/lib/Object.r | 11 ++++++--- tools/qwaq/progs.src.in | 2 ++ 6 files changed, 78 insertions(+), 26 deletions(-) diff --git a/libs/console/menu.c b/libs/console/menu.c index 7ad113898..ea4b51dbd 100644 --- a/libs/console/menu.c +++ b/libs/console/menu.c @@ -86,8 +86,15 @@ static hashtab_t *menu_hash; static func_t menu_init; static func_t menu_quit; static func_t menu_draw_hud; +static func_t menu_post; static const char *top_menu; +static void +run_menu_post (void) +{ + PR_ExecuteProgram (&menu_pr_state, menu_post); +} + static int menu_resolve_globals (progs_t *pr) { @@ -101,6 +108,9 @@ menu_resolve_globals (progs_t *pr) if (!(f = PR_FindFunction (pr, sym = "menu_draw_hud"))) goto error; menu_draw_hud = (func_t) (f - pr->pr_functions); + if (!(f = PR_FindFunction (pr, sym = "menu_post"))) + goto error; + menu_post = (func_t) (f - pr->pr_functions); if (!(def = PR_FindGlobal (pr, sym = "time"))) goto error; menu_pr_state.globals.time = &G_FLOAT (pr, def->ofs); @@ -342,6 +352,7 @@ bi_Menu_SelectMenu (progs_t *pr) game_target = IMT_CONSOLE; if (menu->enter_hook) { PR_ExecuteProgram (&menu_pr_state, menu->enter_hook); + run_menu_post (); } } else { if (name && *name) @@ -394,9 +405,13 @@ togglemenu_f (void) static void quit_f (void) { + int ret; + if (confirm_quit->int_val && menu_quit) { PR_ExecuteProgram (&menu_pr_state, menu_quit); - if (!R_INT (&menu_pr_state)) + ret = R_INT (&menu_pr_state); + run_menu_post (); + if (!ret) return; } bi_Menu_Quit (&menu_pr_state); @@ -503,6 +518,7 @@ Menu_Load (void) RUA_Cbuf_SetCbuf (&menu_pr_state, con_data.cbuf); InputLine_Progs_SetDraw (&menu_pr_state, C_DrawInputLine); PR_ExecuteProgram (&menu_pr_state, menu_init); + run_menu_post (); } void @@ -524,11 +540,15 @@ Menu_Draw (view_t *view) *menu_pr_state.globals.time = *con_data.realtime; if (menu->draw) { + int ret; + PR_RESET_PARAMS (&menu_pr_state); P_INT (&menu_pr_state, 0) = x; P_INT (&menu_pr_state, 1) = y; PR_ExecuteProgram (&menu_pr_state, menu->draw); - if (R_INT (&menu_pr_state)) + ret = R_INT (&menu_pr_state); + run_menu_post (); + if (!ret) return; } @@ -558,6 +578,7 @@ Menu_Draw (view_t *view) P_INT (&menu_pr_state, 0) = x + item->x; P_INT (&menu_pr_state, 1) = y + item->y; PR_ExecuteProgram (&menu_pr_state, menu->cursor); + run_menu_post (); } else { Draw_Character (x + item->x, y + item->y, 12 + ((int) (*con_data.realtime * 4) & 1)); @@ -570,12 +591,14 @@ Menu_Draw_Hud (view_t *view) *menu_pr_state.globals.time = *con_data.realtime; PR_ExecuteProgram (&menu_pr_state, menu_draw_hud); + run_menu_post (); } void Menu_KeyEvent (knum_t key, short unicode, qboolean down) { menu_item_t *item; + int ret; if (!menu) return; @@ -585,7 +608,9 @@ Menu_KeyEvent (knum_t key, short unicode, qboolean down) P_INT (&menu_pr_state, 1) = unicode; P_INT (&menu_pr_state, 2) = down; PR_ExecuteProgram (&menu_pr_state, menu->keyevent); - if (R_INT (&menu_pr_state)) + ret = R_INT (&menu_pr_state); + run_menu_post (); + if (ret) return; } else if (menu->items && menu->items[menu->cur_item]->func && menu->items[menu->cur_item]->allkeys) { @@ -597,7 +622,9 @@ Menu_KeyEvent (knum_t key, short unicode, qboolean down) P_INT (&menu_pr_state, 1) = key; PR_ExecuteProgram (&menu_pr_state, item->func); PR_PopFrame (&menu_pr_state); - if (R_INT (&menu_pr_state)) + ret = R_INT (&menu_pr_state); + run_menu_post (); + if (ret) return; } if (!menu || !menu->items) @@ -625,10 +652,12 @@ Menu_KeyEvent (knum_t key, short unicode, qboolean down) P_INT (&menu_pr_state, 1) = key; PR_ExecuteProgram (&menu_pr_state, item->func); PR_PopFrame (&menu_pr_state); + run_menu_post (); } else { menu = item; if (menu->enter_hook) { PR_ExecuteProgram (&menu_pr_state, menu->enter_hook); + run_menu_post (); } } } @@ -651,6 +680,7 @@ Menu_Enter () menu = Hash_Find (menu_hash, top_menu); if (menu && menu->enter_hook) { PR_ExecuteProgram (&menu_pr_state, menu->enter_hook); + run_menu_post (); } } @@ -660,6 +690,7 @@ Menu_Leave () if (menu) { if (menu->leave_hook) { PR_ExecuteProgram (&menu_pr_state, menu->leave_hook); + run_menu_post (); } menu = menu->parent; if (!menu) { diff --git a/ruamoko/cl_menu/client_menu.qc b/ruamoko/cl_menu/client_menu.qc index 7f3c9a061..d36030cfb 100644 --- a/ruamoko/cl_menu/client_menu.qc +++ b/ruamoko/cl_menu/client_menu.qc @@ -1,3 +1,4 @@ +#include "AutoreleasePool.h" #include "menu.h" #include "file.h" #include "cmd.h" @@ -588,3 +589,8 @@ void () menu_init = void () menu_draw_hud = { }; + +void menu_post () +{ + [AutoreleasePool release]; +} diff --git a/ruamoko/include/AutoreleasePool.h b/ruamoko/include/AutoreleasePool.h index 478a439e7..648c42d2a 100644 --- a/ruamoko/include/AutoreleasePool.h +++ b/ruamoko/include/AutoreleasePool.h @@ -3,10 +3,11 @@ #include "Object.h" +@class Array; + @interface AutoreleasePool: Object { - unsigned count; - id [] array; + Array array; } + (void) addObject: (id)anObject; diff --git a/ruamoko/lib/AutoreleasePool.r b/ruamoko/lib/AutoreleasePool.r index 33cff0bc3..184732f88 100644 --- a/ruamoko/lib/AutoreleasePool.r +++ b/ruamoko/lib/AutoreleasePool.r @@ -1,8 +1,8 @@ #include "AutoreleasePool.h" -#include "Stack.h" +//#include "Stack.h" @static AutoreleasePool sharedInstance; -@static Stack poolStack; +//@static Stack poolStack; @interface AutoreleasePool (Private) - (void) addItem: (id)anItem; @@ -15,19 +15,28 @@ if (!(self = [super init])) return NIL; - if (!poolStack) - poolStack = [Stack new]; + //if (!poolStack) + // poolStack = [Stack new]; if (!sharedInstance) sharedInstance = self; + + array = [[Array alloc] init]; + return self; } + (void) addObject: (id)anObject { + if (!sharedInstance) + [[AutoreleasePool alloc] init]; + [sharedInstance addObject: anObject]; } - (void) addObject: (id)anObject { + [array addItem: anObject]; + [anObject release]; // the array retains the item, and releases when + // dealloced } - (id) retain @@ -35,33 +44,33 @@ [self error: "Don't send -retain to an autorelease pool."]; } ++ (void) release +{ + [sharedInstance release]; + sharedInstance = NIL; +} + - (/*oneway*/ void) release { - if (self == sharedInstance) - sharedInstance = NIL; - [self dealloc]; } - (void) dealloc { - local unsigned i; - local id tmp; + //local id tmp; - for (i = 0; i < count; i++) - [array[(integer)i] release]; //FIXME no unsigned addressing - - obj_free (array); + [array release]; /* This may be wrong. Releasing an autorelease pool should keep popping pools off the stack until it gets to itself. */ - do { - tmp = [poolStack pop]; - } while (tmp != self); + //do { + // tmp = [poolStack pop]; + //} while (tmp != self); + sharedInstance = NIL; [super dealloc]; } @end diff --git a/ruamoko/lib/Object.r b/ruamoko/lib/Object.r index 813a99db8..415fcb354 100644 --- a/ruamoko/lib/Object.r +++ b/ruamoko/lib/Object.r @@ -66,16 +66,19 @@ BOOL (id object) object_is_meta_class = #0; @end +@static BOOL allocDebug; +@static Class autoreleaseClass; +@static SEL autoreleaseSelector; +@static IMP autoreleaseIMP; + @implementation Object + (void) initialize { -#if 0 - allocDebug = localinfo ("AllocDebug"); + //allocDebug = localinfo ("AllocDebug"); autoreleaseClass = [AutoreleasePool class]; autoreleaseSelector = @selector(addObject:); autoreleaseIMP = [autoreleaseClass methodForSelector: autoreleaseSelector]; -#endif return; } @@ -293,7 +296,7 @@ BOOL (id object) object_is_meta_class = #0; - (id) autorelease { - + autoreleaseIMP (autoreleaseClass, autoreleaseSelector, self); } - (unsigned) retainCount diff --git a/tools/qwaq/progs.src.in b/tools/qwaq/progs.src.in index 4d72e4b7e..e6db607cb 100644 --- a/tools/qwaq/progs.src.in +++ b/tools/qwaq/progs.src.in @@ -8,5 +8,7 @@ qwaq.dat @top_srcdir@/ruamoko/lib/string.r @top_srcdir@/ruamoko/lib/Object.r @top_srcdir@/ruamoko/lib/Protocol.r +@top_srcdir@/ruamoko/lib/Array.r +@top_srcdir@/ruamoko/lib/AutoreleasePool.r @srcdir@/test.r @srcdir@/main.qc From 3878b76cc5cc3e35bd308d666e375df95075e7a5 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 22 Nov 2010 14:05:48 +0900 Subject: [PATCH 087/115] Start using autorelease. Much more testing is required (oh, but for qc-valgrind), but there is now a ~945kB block of free data in the menu progs heap :). Also, correct the printed size of the memory block to not include the block header size. --- libs/util/zone.c | 2 +- ruamoko/cl_menu/options.qc | 2 +- ruamoko/include/PropertyList.h | 2 +- ruamoko/lib/PropertyList.r | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libs/util/zone.c b/libs/util/zone.c index fbb412555..e9f02a20b 100644 --- a/libs/util/zone.c +++ b/libs/util/zone.c @@ -263,7 +263,7 @@ Z_Print (memzone_t *zone) for (block = zone->blocklist.next ; ; block = block->next) { Sys_Printf ("block:%p size:%7i tag:%3i ofs:%d\n", - block, block->size, block->tag, + block, block->size - sizeof (memblock_t) - 4, block->tag, (int) ((byte *) block - (byte *) zone)); if (block->next == &zone->blocklist) diff --git a/ruamoko/cl_menu/options.qc b/ruamoko/cl_menu/options.qc index b0716cce2..deca5b4e8 100644 --- a/ruamoko/cl_menu/options.qc +++ b/ruamoko/cl_menu/options.qc @@ -224,7 +224,7 @@ PLItem read_plist (void) } plist_data = Qreadstring (file, Qfilesize (file)); Qclose (file); - plist = [PLItem newFromString:plist_data]; + plist = [PLItem fromString:plist_data]; str_free (plist_data); return plist; } diff --git a/ruamoko/include/PropertyList.h b/ruamoko/include/PropertyList.h index 381efc53b..825249f44 100644 --- a/ruamoko/include/PropertyList.h +++ b/ruamoko/include/PropertyList.h @@ -13,7 +13,7 @@ + (PLItem) newArray; + (PLItem) newData:(void[]) data size:(integer) len; + (PLItem) newString:(string) str; -+ (PLItem) newFromString:(string) str; ++ (PLItem) fromString:(string) str; - initWithItem:(plitem_t) item; - initWithOwnItem:(plitem_t) item; diff --git a/ruamoko/lib/PropertyList.r b/ruamoko/lib/PropertyList.r index ebded2a73..237d07b50 100644 --- a/ruamoko/lib/PropertyList.r +++ b/ruamoko/lib/PropertyList.r @@ -22,9 +22,9 @@ return [PLString new:str]; } -+ (PLItem) newFromString:(string) str ++ (PLItem) fromString:(string) str { - return [PLItem itemClass: PL_GetPropertyList (str)]; + return [[PLItem itemClass: PL_GetPropertyList (str)] autorelease]; } + itemClass:(plitem_t) item @@ -111,12 +111,12 @@ - (PLItem) getObjectForKey:(string) key { - return [PLItem itemClass: PL_ObjectForKey (item, key)]; + return [[PLItem itemClass: PL_ObjectForKey (item, key)] autorelease]; } - (PLItem) allKeys { - return [PLItem itemClass: PL_D_AllKeys (item)]; + return [[PLItem itemClass: PL_D_AllKeys (item)] autorelease]; } - addKey:(string) key value:(PLItem) value @@ -152,7 +152,7 @@ - (PLItem) getObjectAtIndex:(integer) index { - return [PLItem itemClass: PL_ObjectAtIndex (item, index)]; + return [[PLItem itemClass: PL_ObjectAtIndex (item, index)] autorelease]; } - addObject:(PLItem) object From fc2a6e0fb70d9de0b678b46f5a9f3ab827bde613 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 24 Nov 2010 11:41:08 +0900 Subject: [PATCH 088/115] Don't be so spammy with file errors. Record a file even if it could not be found. This way, the error message gets printed once per file rather than every time. --- libs/gamecode/engine/pr_debug.c | 48 +++++++++++++++++---------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/libs/gamecode/engine/pr_debug.c b/libs/gamecode/engine/pr_debug.c index 46c9d6451..15e87287a 100644 --- a/libs/gamecode/engine/pr_debug.c +++ b/libs/gamecode/engine/pr_debug.c @@ -207,7 +207,7 @@ PR_Debug_Init_Cvars (void) static file_t * PR_Load_Source_File (progs_t *pr, const char *fname) { - char *path = 0, *l, *p, **dir; + char *l, *p, **dir; file_t *f = Hash_Find (file_hash, fname); if (f) @@ -220,37 +220,39 @@ PR_Load_Source_File (progs_t *pr, const char *fname) fname)); } if (!f->text) { - pr->file_error (pr, path); - free (f); - return 0; + pr->file_error (pr, fname); + } else { + for (f->num_lines = 1, l = f->text; *l; l++) + if (*l == '\n') + f->num_lines++; } - for (f->num_lines = 1, l = f->text; *l; l++) - if (*l == '\n') - f->num_lines++; f->name = strdup (fname); if (!f->name) { pr->free_progs_mem (pr, f->text); free (f); return 0; } - f->lines = malloc (f->num_lines * sizeof (line_t)); - if (!f->lines) { - free (f->name); - pr->free_progs_mem (pr, f->text); - free (f); - return 0; - } - f->lines[0].text = f->text; - for (f->num_lines = 0, l = f->text; *l; l++) { - if (*l == '\n') { - for (p = l; p > f->lines[f->num_lines].text && isspace(p[-1]); p--) - ; - f->lines[f->num_lines].len = p - f->lines[f->num_lines].text; - f->lines[++f->num_lines].text = l + 1; + if (f->num_lines) { + f->lines = malloc (f->num_lines * sizeof (line_t)); + if (!f->lines) { + free (f->name); + pr->free_progs_mem (pr, f->text); + free (f); + return 0; } + f->lines[0].text = f->text; + for (f->num_lines = 0, l = f->text; *l; l++) { + if (*l == '\n') { + for (p = l; p > f->lines[f->num_lines].text && isspace(p[-1]); + p--) + ; + f->lines[f->num_lines].len = p - f->lines[f->num_lines].text; + f->lines[++f->num_lines].text = l + 1; + } + } + f->lines[f->num_lines].len = l - f->lines[f->num_lines].text; + f->num_lines++; } - f->lines[f->num_lines].len = l - f->lines[f->num_lines].text; - f->num_lines++; f->pr = pr; Hash_Add (file_hash, f); return f; From 023d3c89ece81d19334630369dbf6bbfab74612c Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 24 Nov 2010 11:43:00 +0900 Subject: [PATCH 089/115] Source formatting. --- tools/qfcc/source/idstuff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/qfcc/source/idstuff.c b/tools/qfcc/source/idstuff.c index ae32f0898..57cd15780 100644 --- a/tools/qfcc/source/idstuff.c +++ b/tools/qfcc/source/idstuff.c @@ -220,8 +220,8 @@ WriteProgdefs (const char *filename) f = fopen (filename, "wb"); // print global vars until the first field is defined - fprintf (f, - "\n/* file generated by qcc, do not modify */\n\ntypedef struct\n{\tint\tpad[%i];\n", + fprintf (f, "\n/* file generated by qcc, do not modify */" + "\n\ntypedef struct\n{\tint\tpad[%i];\n", RESERVED_OFS); for (d = pr.scope->head; d; d = d->def_next) { From e9fea12e475804e8af2dbc20ea0f0538093f41a9 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 24 Nov 2010 11:45:49 +0900 Subject: [PATCH 090/115] Must return self in -autorelease --- ruamoko/lib/Object.r | 1 + 1 file changed, 1 insertion(+) diff --git a/ruamoko/lib/Object.r b/ruamoko/lib/Object.r index 415fcb354..9281d7446 100644 --- a/ruamoko/lib/Object.r +++ b/ruamoko/lib/Object.r @@ -297,6 +297,7 @@ BOOL (id object) object_is_meta_class = #0; - (id) autorelease { autoreleaseIMP (autoreleaseClass, autoreleaseSelector, self); + return self; } - (unsigned) retainCount From 730082a393bdca8a6dc1d2b748d627172f491747 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 24 Nov 2010 11:46:45 +0900 Subject: [PATCH 091/115] Make Group set its position (and those of its subviews) correctly. --- ruamoko/cl_menu/options_util.qc | 12 ++++++------ ruamoko/gui/Group.r | 12 +++++++++--- ruamoko/include/gui/Group.h | 1 - 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/ruamoko/cl_menu/options_util.qc b/ruamoko/cl_menu/options_util.qc index 1958a35d5..f7ca3fe5a 100644 --- a/ruamoko/cl_menu/options_util.qc +++ b/ruamoko/cl_menu/options_util.qc @@ -24,6 +24,7 @@ Boston, MA 02111-1307, USA */ +#include "debug.h" #include "cvar.h" #include "draw.h" #include "system.h" @@ -437,7 +438,7 @@ } } @end -void traceon () = #0; + @implementation ProxyView -(id)initWithBounds:(Rect)aRect title:(View)aTitle view:(View)aView @@ -462,12 +463,11 @@ void traceon () = #0; [view draw]; } -- (void) setBasePos: (Point) pos +- (void) setBasePosFromView: (View) aview { - [super setBasePos:pos]; - local Point point = {xabs, yabs}; - [title setBasePos:point]; - [view setBasePos:point]; + [super setBasePosFromView:aview]; + [title setBasePosFromView:self]; + [view setBasePosFromView:self]; } @end diff --git a/ruamoko/gui/Group.r b/ruamoko/gui/Group.r index 4e5f41b4b..d3cf023ad 100644 --- a/ruamoko/gui/Group.r +++ b/ruamoko/gui/Group.r @@ -37,10 +37,16 @@ [self setBasePos: x y:y]; } -- (void) setBasePos: (Point) pos +- (void) setBasePos: (integer) x y: (integer) y { - [super setBasePos:pos]; - local Point point = {xabs, yabs}; + [super setBasePos: x y:y]; + local SEL sel = @selector (setBasePosFromView:); + [views makeObjectsPerformSelector:sel withObject:self]; +} + +- (void) setBasePosFromView: (View) view +{ + [super setBasePosFromView:view]; local SEL sel = @selector (setBasePosFromView:); [views makeObjectsPerformSelector:sel withObject:self]; } diff --git a/ruamoko/include/gui/Group.h b/ruamoko/include/gui/Group.h index 5dd37171d..9e41f8911 100644 --- a/ruamoko/include/gui/Group.h +++ b/ruamoko/include/gui/Group.h @@ -13,7 +13,6 @@ - (View) addView: (View)aView; - (id) addViews: (Array)viewlist; - (void) moveTo: (integer)x y:(integer)y; -- (void) setBasePos: (Point)pos; - (void) draw; @end From 9c3c1b9ac1f390a1c62f8ced6469057a58879477 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 24 Nov 2010 11:49:38 +0900 Subject: [PATCH 092/115] Use @param instead of id to pass objects within the menu parser. This allows mixed types (eg, objects and Rects). To be passed around. This sorts out the changes needed for the conversion of Rect from object to struct. --- ruamoko/cl_menu/Makefile.am | 2 +- ruamoko/cl_menu/options.qc | 69 ++++++++++++++++++++++++++----------- 2 files changed, 49 insertions(+), 22 deletions(-) diff --git a/ruamoko/cl_menu/Makefile.am b/ruamoko/cl_menu/Makefile.am index a51951a92..3dcbd5db5 100644 --- a/ruamoko/cl_menu/Makefile.am +++ b/ruamoko/cl_menu/Makefile.am @@ -28,7 +28,7 @@ EXTRA_DATA= $(menu_data) menu_src= \ client_menu.qc controls_o.qc options.qc options_util.qc servlist.qc \ - Frame.r menu.r HUD.r + Frame.r menu.r HUD.r ../lib/debug.r %.qfo: %.r $(QFCC) $(QCFLAGS) $(QCPPFLAGS) -c -o $@ $< diff --git a/ruamoko/cl_menu/options.qc b/ruamoko/cl_menu/options.qc index deca5b4e8..5b9d29dbf 100644 --- a/ruamoko/cl_menu/options.qc +++ b/ruamoko/cl_menu/options.qc @@ -24,6 +24,7 @@ Boston, MA 02111-1307, USA */ +#include "debug.h" #include "options.h" #include "cbuf.h" #include "menu.h" @@ -101,14 +102,13 @@ InputLine network_config_iactive; * Video settings menu code ****************************/ -void dprint (string str) = #0; +@param object_from_plist (PLItem plist); -id object_from_plist (PLItem plist); - -id +@param class_from_plist (PLDictionary pldict) { local @param [8]params; + local @param ret; local @va_list va_list = { 0, params }; local string classname, selname, paramstr; local Class class; @@ -122,7 +122,8 @@ class_from_plist (PLDictionary pldict) class = obj_lookup_class (classname); if (!class) { dprint ("could not find " + classname + "\n"); - return NIL; + ret.pointer_val = NIL; + return ret; } obj = [class alloc]; @@ -141,7 +142,7 @@ class_from_plist (PLDictionary pldict) break; case "$": item = [pldict getObjectForKey:str_mid (paramstr, 1)]; - va_list.list[j].pointer_val = object_from_plist (item); + va_list.list[j] = object_from_plist (item); break; case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": @@ -154,58 +155,78 @@ class_from_plist (PLDictionary pldict) } obj_msg_sendv (obj, sel, va_list); } - return obj; + ret.pointer_val = obj; + return ret; } -id +@param array_from_plist (PLArray plarray) { local Array array; local integer i, count; + local @param ret; array = [[Array alloc] init]; count = [plarray count]; for (i = 0; i < count; i++) [array addItem: object_from_plist ([plarray getObjectAtIndex:i])]; - return array; + ret.pointer_val = array; + return ret; } -Rect +union ParamRect { + @param p; + Rect r; +}; + +@param rect_from_plist (PLString plstring) { local string str = [plstring string]; local string tmp; local integer xp, yp, xl, yl; local PLItem item; + local union ParamRect pr; + pr.r = makeRect (0, 0, 0, 0); if (str_mid (str, 0, 1) == "[") { tmp = "(" + str_mid (str, 1, -1) + ")"; - item = [PLItem newFromString:tmp]; + item = [PLItem fromString:tmp]; xp = stoi ([(PLString) [item getObjectAtIndex:0] string]); yp = stoi ([(PLString) [item getObjectAtIndex:1] string]); xl = stoi ([(PLString) [item getObjectAtIndex:2] string]); yl = stoi ([(PLString) [item getObjectAtIndex:3] string]); - return makeRect (xp, yp, xl, yl); + pr.r = makeRect (xp, yp, xl, yl); } - return makeRect (0, 0, 0, 0); + return pr.p; } -id +@param string_from_plist (PLString plstring) { - return NIL; + local @param ret; + local string str = [plstring string]; + + if (str_mid (str, 0, 1) == "[") + return rect_from_plist (plstring); + + ret.string_val = NIL; + return ret; } -id +@param object_from_plist (PLItem plist) { + local @param ret; + switch ([plist type]) { case QFDictionary: return class_from_plist ((PLDictionary) plist); case QFArray: return array_from_plist ((PLArray) plist); case QFBinary: - return NIL; + ret.pointer_val = NIL; + return ret; case QFString: return string_from_plist ((PLString) plist); } @@ -257,13 +278,16 @@ KEY_video_options = void () MENU_video_options = { + local @param ret; Menu_Begin (54, 50, "Video"); Menu_FadeScreen (1); Menu_Draw (DRAW_video_options); Menu_KeyEvent (KEY_video_options); - if (menu_plist) - video_options = object_from_plist ([menu_plist getObjectForKey:"video_options"]); + if (menu_plist) { + ret = object_from_plist ([menu_plist getObjectForKey:"video_options"]); + video_options = ret.pointer_val; + } Menu_End (); }; @@ -301,13 +325,16 @@ KEY_audio_options = void () MENU_audio_options = { + local @param ret; Menu_Begin (54, 60, "Audio"); Menu_FadeScreen (1); Menu_Draw (DRAW_audio_options); Menu_KeyEvent (KEY_audio_options); - if (menu_plist) - audio_options = object_from_plist ([menu_plist getObjectForKey:"audio_options"]); + if (menu_plist) { + ret = object_from_plist ([menu_plist getObjectForKey:"audio_options"]); + audio_options = ret.pointer_val; + } Menu_End (); }; From 857f8eb6e4361b8730b3080945c67e14ebe52953 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 24 Nov 2010 12:34:42 +0900 Subject: [PATCH 093/115] Get the plist controls menu mostly working. The bindings menu is currently inaccessible. --- ruamoko/cl_menu/menu.plist | 8 ++++ ruamoko/cl_menu/options.qc | 81 ++++++-------------------------------- 2 files changed, 21 insertions(+), 68 deletions(-) diff --git a/ruamoko/cl_menu/menu.plist b/ruamoko/cl_menu/menu.plist index 1b4a39ee2..67e953ca8 100644 --- a/ruamoko/cl_menu/menu.plist +++ b/ruamoko/cl_menu/menu.plist @@ -40,6 +40,14 @@ ); rect = "[54, 50, 64, 8]"; }, + { + Class = Text; + Messages = ( + (initWithBounds:, $rect), + (setText:, "\"Bindings\"") + ); + rect = "[70, 60, 64, 8]"; + }, { Class = CvarToggleView; Messages = ( diff --git a/ruamoko/cl_menu/options.qc b/ruamoko/cl_menu/options.qc index 5b9d29dbf..3327d714b 100644 --- a/ruamoko/cl_menu/options.qc +++ b/ruamoko/cl_menu/options.qc @@ -392,11 +392,15 @@ DRAW_control_options = [control_options setBasePos:x y:y]; [control_options draw]; - opt_cursor (x + 62, y + (Menu_GetIndex () * 10) + 60); - return 1; }; +integer (integer key, integer unicode, integer down) +KEY_control_options = +{ + return [control_options keyEvent:key unicode:unicode down:down]; +} + /* MENU_control_options @@ -405,78 +409,19 @@ DRAW_control_options = void () MENU_control_options = { - local Rect rect; - local id view; - + local @param ret; Menu_Begin (54, 40, "Controls"); Menu_FadeScreen (1); - Menu_CenterPic (160, 4, "gfx/p_option.lmp"); - Menu_Draw (DRAW_control_options); + Menu_KeyEvent (KEY_control_options); - control_options = [[Group alloc] initWithComponents:0 :0 :320 :200]; - - view = [[Pic alloc] initWithComponents:16 :4 :0 :0]; - [view setPic:"gfx/qplaque.lmp"]; - [control_options addView:view]; - - view = [[CenterPic alloc] initWithComponents:160 :4 :0 :0]; - [view setPic:"gfx/p_option.lmp"]; - [control_options addView:view]; - - view = [[Text alloc] initWithComponents:54 :40 :64 :8]; - [view setText:"Controls"]; - [control_options addView:view]; - - view = [[Text alloc] initWithComponents:54 :50 :64 :8]; - [view setText:"--------"]; - [control_options addView:view]; - - view = [[Text alloc] initWithComponents:70 :60 :64 :8]; - [view setText:"Bindings"]; - [control_options addView:view]; - - rect = makeRect (70, 70, 224, 8); - grab_mouse_view = [[CvarToggleView alloc] initWithBounds:rect title:"Grab mouse" :[[CvarToggle alloc] initWithCvar:"in_grab"]]; - [control_options addView:grab_mouse_view]; - - rect.origin.y += 10; - autorun_view = [[CvarToggleView alloc] initWithBounds:rect title:"Auto run" :[[RunToggle alloc] init]]; - [control_options addView:autorun_view]; - - rect.origin.y += 10; - invert_mouse_view = [[CvarToggleView alloc] initWithBounds:rect title:"Mouse Invert" :[[MouseToggle alloc] init]]; - [control_options addView:invert_mouse_view]; - - rect.origin.y += 10; - rect.size.width += 8; - mouse_amp_view = [[CvarRangeView alloc] initWithBounds:rect title:"Mouse amp:" sliderWidth:14 * 8 :[[CvarRange alloc] initWithCvar:"in_mouse_amp" min:MIN_MOUSE_AMP max:MAX_MOUSE_AMP step:MOUSE_AMP_STEP]]; - rect.size.width -= 8; - [control_options addView:mouse_amp_view]; - - rect.origin.y += 10; - freelook_view = [[CvarToggleView alloc] initWithBounds:rect title:"Freelook" :[[CvarToggle alloc] initWithCvar:"freelook"]]; - [control_options addView:freelook_view]; - - rect.origin.y += 10; - lookspring_view = [[CvarToggleView alloc] initWithBounds:rect title:"Lookspring" :[[CvarToggle alloc] initWithCvar:"lookspring"]]; - [control_options addView:lookspring_view]; - - rect.origin.y += 10; - lookstrafe_view = [[CvarToggleView alloc] initWithBounds:rect title:"Lookstrafe" :[[CvarToggle alloc] initWithCvar:"lookstrafe"]]; - [control_options addView:lookstrafe_view]; - - MENU_control_binding (); - - Menu_Item (54, 70, "in_grab", CB_control_options, 0); - Menu_Item (54, 80, "autorun", CB_control_options, 0); - Menu_Item (54, 90, "m_pitch", CB_control_options, 0); - Menu_Item (54, 100, "mouseamp", CB_control_options, 1); - Menu_Item (54, 110, "freelook", CB_control_options, 0); - Menu_Item (54, 120, "lookspring", CB_control_options, 0); - Menu_Item (54, 130, "lookstrafe", CB_control_options, 0); + if (menu_plist) { + ret = object_from_plist ([menu_plist getObjectForKey:"control_options"]); + control_options = ret.pointer_val; + } Menu_End (); + //MENU_control_binding (); FIXME how to hook in the bindings menu? }; /*********************************************** From defc2a264b4e57e29e643783d8a956b2c450fb12 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 24 Nov 2010 13:10:25 +0900 Subject: [PATCH 094/115] Add QFile_GetHandle() This allows other rua builtins to make use of ruamoko files. --- include/rua_internal.h | 1 + libs/ruamoko/rua_qfile.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/include/rua_internal.h b/include/rua_internal.h index 2dd6fbea4..5ce019bd3 100644 --- a/include/rua_internal.h +++ b/include/rua_internal.h @@ -56,6 +56,7 @@ void RUA_String_Init (struct progs_s *pr, int secure); void RUA_QFile_Init (struct progs_s *pr, int secure); int QFile_AllocHandle (struct progs_s *pr, QFile *file); +QFile *QFile_GetFile (struct progs_s *pr, int handle); void RUA_QFS_Init (struct progs_s *pr, int secure); diff --git a/libs/ruamoko/rua_qfile.c b/libs/ruamoko/rua_qfile.c index cb8e1d2a6..000fd5a33 100644 --- a/libs/ruamoko/rua_qfile.c +++ b/libs/ruamoko/rua_qfile.c @@ -174,6 +174,14 @@ get_handle (progs_t *pr, const char *name, int handle) return h; } +QFile * +QFile_GetFile (progs_t *pr, int handle) +{ + qfile_t *h = get_handle (pr, __FUNCTION__, handle); + + return h->file; +} + static void bi_Qclose (progs_t *pr) { From addbcaa09c3d10346fa37cb97712eef4bd813833 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 24 Nov 2010 13:12:41 +0900 Subject: [PATCH 095/115] Add PL_GetFromFile builtin. This is an extension "wrapper" (no such C function). This allows ruamoko programs to read property lists without worrying about the memory required to store the string for the property list being read. --- libs/ruamoko/rua_plist.c | 24 ++++++++++++++++++++++++ ruamoko/include/PropertyList.h | 1 + ruamoko/include/plist.h | 3 +++ ruamoko/lib/PropertyList.r | 5 +++++ ruamoko/lib/plist.r | 1 + 5 files changed, 34 insertions(+) diff --git a/libs/ruamoko/rua_plist.c b/libs/ruamoko/rua_plist.c index 3c59c4a9b..2c48d6583 100644 --- a/libs/ruamoko/rua_plist.c +++ b/libs/ruamoko/rua_plist.c @@ -175,6 +175,29 @@ plist_retain (plist_resources_t *res, plitem_t *plitem) return handle; } +static void +bi_PL_GetFromFile (progs_t *pr) +{ + plist_resources_t *res = PR_Resources_Find (pr, "plist"); + QFile *file = QFile_GetFile (pr, P_INT (pr, 0)); + plitem_t *plitem; + long offset; + long size; + long len; + char *buf; + + offset = Qtell (file); + size = Qfilesize (file); + len = size - offset; + buf = malloc (len + 1); + Qread (file, buf, len); + buf[len] = 0; + + plitem = PL_GetPropertyList (buf); + + R_INT (pr) = plist_retain (res, plitem); +} + static void bi_PL_GetPropertyList (progs_t *pr) { @@ -403,6 +426,7 @@ plist_compare (void *k1, void *k2, void *unused) } static builtin_t builtins[] = { + {"PL_GetFromFile", bi_PL_GetFromFile, -1}, {"PL_GetPropertyList", bi_PL_GetPropertyList, -1}, {"PL_WritePropertyList", bi_PL_WritePropertyList, -1}, {"PL_Type", bi_PL_Type, -1}, diff --git a/ruamoko/include/PropertyList.h b/ruamoko/include/PropertyList.h index 825249f44..c75d9b571 100644 --- a/ruamoko/include/PropertyList.h +++ b/ruamoko/include/PropertyList.h @@ -14,6 +14,7 @@ + (PLItem) newData:(void[]) data size:(integer) len; + (PLItem) newString:(string) str; + (PLItem) fromString:(string) str; ++ (PLItem) fromFile:(QFile) file; - initWithItem:(plitem_t) item; - initWithOwnItem:(plitem_t) item; diff --git a/ruamoko/include/plist.h b/ruamoko/include/plist.h index 5a78e529e..02d8cfd0e 100644 --- a/ruamoko/include/plist.h +++ b/ruamoko/include/plist.h @@ -1,11 +1,14 @@ #ifndef __ruamoko_plist_h #define __ruamoko_plist_h +#include "qfile.h" + struct plitem_s {integer dummy;}; #define PL_TEST(item) (item.dummy) typedef struct plitem_s plitem_t; typedef enum {QFDictionary, QFArray, QFBinary, QFString} pltype_t; // possible types +@extern plitem_t (QFile file) PL_GetFromFile; @extern plitem_t (string str) PL_GetPropertyList; @extern string (plitem_t pl) PL_WritePropertyList; @extern pltype_t (plitem_t str) PL_Type; diff --git a/ruamoko/lib/PropertyList.r b/ruamoko/lib/PropertyList.r index 237d07b50..a0a66e320 100644 --- a/ruamoko/lib/PropertyList.r +++ b/ruamoko/lib/PropertyList.r @@ -27,6 +27,11 @@ return [[PLItem itemClass: PL_GetPropertyList (str)] autorelease]; } ++ (PLItem) fromFile:(QFile) file +{ + return [[PLItem itemClass: PL_GetFromFile (file)] autorelease]; +} + + itemClass:(plitem_t) item { local string classname = NIL; diff --git a/ruamoko/lib/plist.r b/ruamoko/lib/plist.r index a0c91af96..5fdeada13 100644 --- a/ruamoko/lib/plist.r +++ b/ruamoko/lib/plist.r @@ -1,5 +1,6 @@ #include "plist.h" +plitem_t (QFile file) PL_GetFromFile = #0; plitem_t (string str) PL_GetPropertyList = #0; string (plitem_t pl) PL_WritePropertyList = #0; pltype_t (plitem_t str) PL_Type = #0; From e471ddff47e58cc4364ffa7da1e05e6410e1a61e Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 24 Nov 2010 13:15:19 +0900 Subject: [PATCH 096/115] Use the new file based property list API. Also eleminate the menu_plist global (the plist does not hang around). --- ruamoko/cl_menu/client_menu.qc | 7 +----- ruamoko/cl_menu/options.h | 6 ----- ruamoko/cl_menu/options.qc | 46 ++++++++++++++++------------------ 3 files changed, 22 insertions(+), 37 deletions(-) diff --git a/ruamoko/cl_menu/client_menu.qc b/ruamoko/cl_menu/client_menu.qc index d36030cfb..8d9bb0eea 100644 --- a/ruamoko/cl_menu/client_menu.qc +++ b/ruamoko/cl_menu/client_menu.qc @@ -123,15 +123,10 @@ integer save_cursor; string (QFile f) get_comment = { local string line; - local string plist_data; local PLItem plist; - local integer pos = Qtell (f); - plist_data = Qreadstring (f, Qfilesize (f) - pos); - plist = [PLItem newFromString:plist_data]; - str_free (plist_data); + plist = [PLItem newFromFile:f]; line = [(PLString) [plist getObjectForKey:"comment"] string]; - [plist release]; return line; } diff --git a/ruamoko/cl_menu/options.h b/ruamoko/cl_menu/options.h index 935486e03..1efc57d7f 100644 --- a/ruamoko/cl_menu/options.h +++ b/ruamoko/cl_menu/options.h @@ -1,12 +1,6 @@ #ifndef __options_h #define __options_h -@extern void () MENU_video_options; -@extern void () MENU_audio_options; -@extern void () MENU_control_options; -@extern void () MENU_feature_options; -@extern void () MENU_player_options; -@extern void () MENU_network_options; @extern void () MENU_options; @extern void (integer x, integer y, integer spacing, string label, string valstr) draw_val_item; diff --git a/ruamoko/cl_menu/options.qc b/ruamoko/cl_menu/options.qc index 3327d714b..5413a5b46 100644 --- a/ruamoko/cl_menu/options.qc +++ b/ruamoko/cl_menu/options.qc @@ -45,8 +45,6 @@ #include "gui/Slider.h" #include "gui/Text.h" -PLItem menu_plist; - Group video_options; Group audio_options; @@ -234,7 +232,6 @@ object_from_plist (PLItem plist) PLItem read_plist (void) { - local string plist_data; local QFile file; local PLItem plist; @@ -243,10 +240,8 @@ PLItem read_plist (void) dprint ("could not load menu.plist\n"); return NIL; } - plist_data = Qreadstring (file, Qfilesize (file)); + plist = [PLItem fromFile:file]; Qclose (file); - plist = [PLItem fromString:plist_data]; - str_free (plist_data); return plist; } @@ -275,7 +270,7 @@ KEY_video_options = Menu function for the video options menu. */ -void () +void (PLItem plist) MENU_video_options = { local @param ret; @@ -284,8 +279,8 @@ MENU_video_options = Menu_Draw (DRAW_video_options); Menu_KeyEvent (KEY_video_options); - if (menu_plist) { - ret = object_from_plist ([menu_plist getObjectForKey:"video_options"]); + if (plist) { + ret = object_from_plist ([plist getObjectForKey:"video_options"]); video_options = ret.pointer_val; } @@ -322,7 +317,7 @@ KEY_audio_options = Makes the audio menu */ -void () +void (PLItem plist) MENU_audio_options = { local @param ret; @@ -331,8 +326,8 @@ MENU_audio_options = Menu_Draw (DRAW_audio_options); Menu_KeyEvent (KEY_audio_options); - if (menu_plist) { - ret = object_from_plist ([menu_plist getObjectForKey:"audio_options"]); + if (plist) { + ret = object_from_plist ([plist getObjectForKey:"audio_options"]); audio_options = ret.pointer_val; } @@ -406,7 +401,7 @@ KEY_control_options = Menu make function for control options */ -void () +void (PLItem plist) MENU_control_options = { local @param ret; @@ -415,8 +410,8 @@ MENU_control_options = Menu_Draw (DRAW_control_options); Menu_KeyEvent (KEY_control_options); - if (menu_plist) { - ret = object_from_plist ([menu_plist getObjectForKey:"control_options"]); + if (plist) { + ret = object_from_plist ([plist getObjectForKey:"control_options"]); control_options = ret.pointer_val; } @@ -470,7 +465,7 @@ DRAW_feature_options = Makes the feature option menu */ -void () +void (PLItem plist) MENU_feature_options = { local Rect rect; @@ -654,7 +649,7 @@ CB_ME_player_options = Makes the player option menu */ -void () +void (PLItem plist) MENU_player_options = { local Rect rect; @@ -824,7 +819,7 @@ CB_ME_network_options = Makes the network option menu */ -void () +void (PLItem plist) MENU_network_options = { local id view; @@ -885,8 +880,9 @@ void () MENU_options = { local integer spacing = 120; + local PLItem plist; - menu_plist = read_plist (); + plist = read_plist (); Menu_Begin (54, 72, ""); Menu_FadeScreen (1); @@ -894,12 +890,12 @@ MENU_options = Menu_CenterPic (160, 4, "gfx/p_option.lmp"); Menu_Item (54, 32, "Go to Console", op_goto_console, 0); - MENU_control_options (); - MENU_video_options (); - MENU_audio_options (); - MENU_feature_options (); - MENU_player_options (); - MENU_network_options (); + MENU_control_options (plist); + MENU_video_options (plist); + MENU_audio_options (plist); + MENU_feature_options (plist); + MENU_player_options (plist); + MENU_network_options (plist); Menu_End (); }; From 2b3ba0633ef7b76ef6cb98c98093af180d6f9e0d Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 24 Nov 2010 13:32:08 +0900 Subject: [PATCH 097/115] Break out the menu plist parser into its own file. --- ruamoko/cl_menu/Makefile.am | 2 +- ruamoko/cl_menu/options.qc | 149 +----------------------------- ruamoko/cl_menu/plistmenu.h | 9 ++ ruamoko/cl_menu/plistmenu.r | 179 ++++++++++++++++++++++++++++++++++++ 4 files changed, 191 insertions(+), 148 deletions(-) create mode 100644 ruamoko/cl_menu/plistmenu.h create mode 100644 ruamoko/cl_menu/plistmenu.r diff --git a/ruamoko/cl_menu/Makefile.am b/ruamoko/cl_menu/Makefile.am index 3dcbd5db5..7a5b6643f 100644 --- a/ruamoko/cl_menu/Makefile.am +++ b/ruamoko/cl_menu/Makefile.am @@ -28,7 +28,7 @@ EXTRA_DATA= $(menu_data) menu_src= \ client_menu.qc controls_o.qc options.qc options_util.qc servlist.qc \ - Frame.r menu.r HUD.r ../lib/debug.r + Frame.r menu.r HUD.r plistmenu.r ../lib/debug.r %.qfo: %.r $(QFCC) $(QCFLAGS) $(QCPPFLAGS) -c -o $@ $< diff --git a/ruamoko/cl_menu/options.qc b/ruamoko/cl_menu/options.qc index 5413a5b46..be5db96a4 100644 --- a/ruamoko/cl_menu/options.qc +++ b/ruamoko/cl_menu/options.qc @@ -37,7 +37,7 @@ #include "options_util.h" #include "qfs.h" -#include "PropertyList.h" +#include "plistmenu.h" #include "gui/InputLine.h" #include "gui/Pic.h" @@ -100,151 +100,6 @@ InputLine network_config_iactive; * Video settings menu code ****************************/ -@param object_from_plist (PLItem plist); - -@param -class_from_plist (PLDictionary pldict) -{ - local @param [8]params; - local @param ret; - local @va_list va_list = { 0, params }; - local string classname, selname, paramstr; - local Class class; - local id obj; - local PLArray messages, msg; - local integer message_count, i, j; - local SEL sel; - local PLItem item; - - classname = [(PLString) [pldict getObjectForKey:"Class"] string]; - class = obj_lookup_class (classname); - if (!class) { - dprint ("could not find " + classname + "\n"); - ret.pointer_val = NIL; - return ret; - } - obj = [class alloc]; - - messages = (PLArray) [pldict getObjectForKey:"Messages"]; - message_count = [messages count]; - for (i = 0; i < message_count; i++) { - msg = (PLArray) [messages getObjectAtIndex:i]; - selname = [(PLString) [msg getObjectAtIndex:0] string]; - sel = sel_get_uid (selname); - va_list.count = [msg count] - 1; - for (j = 0; j < va_list.count; j++) { - paramstr = [(PLString) [msg getObjectAtIndex:j + 1] string]; - switch (str_mid (paramstr, 0, 1)) { - case "\"": - va_list.list[j].string_val = str_mid (paramstr, 1, -1); - break; - case "$": - item = [pldict getObjectForKey:str_mid (paramstr, 1)]; - va_list.list[j] = object_from_plist (item); - break; - case "0": case "1": case "2": case "3": case "4": - case "5": case "6": case "7": case "8": case "9": - if (str_str (paramstr, ".")) - va_list.list[j].float_val = stof (paramstr); - else - va_list.list[j].integer_val = stoi (paramstr); - break; - } - } - obj_msg_sendv (obj, sel, va_list); - } - ret.pointer_val = obj; - return ret; -} - -@param -array_from_plist (PLArray plarray) -{ - local Array array; - local integer i, count; - local @param ret; - - array = [[Array alloc] init]; - count = [plarray count]; - for (i = 0; i < count; i++) - [array addItem: object_from_plist ([plarray getObjectAtIndex:i])]; - ret.pointer_val = array; - return ret; -} - -union ParamRect { - @param p; - Rect r; -}; - -@param -rect_from_plist (PLString plstring) -{ - local string str = [plstring string]; - local string tmp; - local integer xp, yp, xl, yl; - local PLItem item; - local union ParamRect pr; - - pr.r = makeRect (0, 0, 0, 0); - if (str_mid (str, 0, 1) == "[") { - tmp = "(" + str_mid (str, 1, -1) + ")"; - item = [PLItem fromString:tmp]; - xp = stoi ([(PLString) [item getObjectAtIndex:0] string]); - yp = stoi ([(PLString) [item getObjectAtIndex:1] string]); - xl = stoi ([(PLString) [item getObjectAtIndex:2] string]); - yl = stoi ([(PLString) [item getObjectAtIndex:3] string]); - pr.r = makeRect (xp, yp, xl, yl); - } - return pr.p; -} - -@param -string_from_plist (PLString plstring) -{ - local @param ret; - local string str = [plstring string]; - - if (str_mid (str, 0, 1) == "[") - return rect_from_plist (plstring); - - ret.string_val = NIL; - return ret; -} - -@param -object_from_plist (PLItem plist) -{ - local @param ret; - - switch ([plist type]) { - case QFDictionary: - return class_from_plist ((PLDictionary) plist); - case QFArray: - return array_from_plist ((PLArray) plist); - case QFBinary: - ret.pointer_val = NIL; - return ret; - case QFString: - return string_from_plist ((PLString) plist); - } -} - -PLItem read_plist (void) -{ - local QFile file; - local PLItem plist; - - file = QFS_OpenFile ("menu.plist"); - if (!file) { - dprint ("could not load menu.plist\n"); - return NIL; - } - plist = [PLItem fromFile:file]; - Qclose (file); - return plist; -} - /* DRAW_video_options @@ -882,7 +737,7 @@ MENU_options = local integer spacing = 120; local PLItem plist; - plist = read_plist (); + plist = read_plist ("menu.plist"); Menu_Begin (54, 72, ""); Menu_FadeScreen (1); diff --git a/ruamoko/cl_menu/plistmenu.h b/ruamoko/cl_menu/plistmenu.h new file mode 100644 index 000000000..1ab134ca3 --- /dev/null +++ b/ruamoko/cl_menu/plistmenu.h @@ -0,0 +1,9 @@ +#ifndef __plistmenu_h +#define __plistmenu_h + +#include "PropertyList.h" + +@extern @param object_from_plist (PLItem plist); +@extern PLItem read_plist (string fname); + +#endif//__plistmenu_r diff --git a/ruamoko/cl_menu/plistmenu.r b/ruamoko/cl_menu/plistmenu.r new file mode 100644 index 000000000..dbab12ead --- /dev/null +++ b/ruamoko/cl_menu/plistmenu.r @@ -0,0 +1,179 @@ +/* + plistmenu.r + + PropertyList menu parser. + + Copyright (C) 2010 Bill Currie + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program; if not, write to: + + Free Software Foundation, Inc. + 59 Temple Place - Suite 330 + Boston, MA 02111-1307, USA +*/ + +#include "debug.h" +#include "string.h" +#include "qfs.h" + +#include "Array.h" +#include "gui/Rect.h" +#include "plistmenu.h" + +@static @param +class_from_plist (PLDictionary pldict) +{ + local @param [8]params; + local @param ret; + local @va_list va_list = { 0, params }; + local string classname, selname, paramstr; + local Class class; + local id obj; + local PLArray messages, msg; + local integer message_count, i, j; + local SEL sel; + local PLItem item; + + classname = [(PLString) [pldict getObjectForKey:"Class"] string]; + class = obj_lookup_class (classname); + if (!class) { + dprint ("could not find " + classname + "\n"); + ret.pointer_val = NIL; + return ret; + } + obj = [class alloc]; + + messages = (PLArray) [pldict getObjectForKey:"Messages"]; + message_count = [messages count]; + for (i = 0; i < message_count; i++) { + msg = (PLArray) [messages getObjectAtIndex:i]; + selname = [(PLString) [msg getObjectAtIndex:0] string]; + sel = sel_get_uid (selname); + va_list.count = [msg count] - 1; + for (j = 0; j < va_list.count; j++) { + paramstr = [(PLString) [msg getObjectAtIndex:j + 1] string]; + switch (str_mid (paramstr, 0, 1)) { + case "\"": + va_list.list[j].string_val = str_mid (paramstr, 1, -1); + break; + case "$": + item = [pldict getObjectForKey:str_mid (paramstr, 1)]; + va_list.list[j] = object_from_plist (item); + break; + case "0": case "1": case "2": case "3": case "4": + case "5": case "6": case "7": case "8": case "9": + if (str_str (paramstr, ".")) + va_list.list[j].float_val = stof (paramstr); + else + va_list.list[j].integer_val = stoi (paramstr); + break; + } + } + obj_msg_sendv (obj, sel, va_list); + } + ret.pointer_val = obj; + return ret; +} + +@static @param +array_from_plist (PLArray plarray) +{ + local Array array; + local integer i, count; + local @param ret; + + array = [[Array alloc] init]; + count = [plarray count]; + for (i = 0; i < count; i++) { + ret = object_from_plist ([plarray getObjectAtIndex:i]); + [array addItem: ret.pointer_val]; + } + ret.pointer_val = array; + return ret; +} + +union ParamRect { + @param p; + Rect r; +}; + +@static @param +rect_from_plist (PLString plstring) +{ + local string str = [plstring string]; + local string tmp; + local integer xp, yp, xl, yl; + local PLItem item; + local union ParamRect pr; + + pr.r = makeRect (0, 0, 0, 0); + if (str_mid (str, 0, 1) == "[") { + tmp = "(" + str_mid (str, 1, -1) + ")"; + item = [PLItem fromString:tmp]; + xp = stoi ([(PLString) [item getObjectAtIndex:0] string]); + yp = stoi ([(PLString) [item getObjectAtIndex:1] string]); + xl = stoi ([(PLString) [item getObjectAtIndex:2] string]); + yl = stoi ([(PLString) [item getObjectAtIndex:3] string]); + pr.r = makeRect (xp, yp, xl, yl); + } + return pr.p; +} + +@static @param +string_from_plist (PLString plstring) +{ + local @param ret; + local string str = [plstring string]; + + if (str_mid (str, 0, 1) == "[") + return rect_from_plist (plstring); + + ret.string_val = NIL; + return ret; +} + +@param +object_from_plist (PLItem plist) +{ + local @param ret; + + switch ([plist type]) { + case QFDictionary: + return class_from_plist ((PLDictionary) plist); + case QFArray: + return array_from_plist ((PLArray) plist); + case QFBinary: + ret.pointer_val = NIL; + return ret; + case QFString: + return string_from_plist ((PLString) plist); + } +} + +PLItem +read_plist (string fname) +{ + local QFile file; + local PLItem plist; + + file = QFS_OpenFile (fname); + if (!file) { + dprint ("could not load menu.plist\n"); + return NIL; + } + plist = [PLItem fromFile:file]; + Qclose (file); + return plist; +} From 7ce1fc3be52be80f4258e0182d4722bd2e5f7f12 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 24 Nov 2010 14:43:16 +0900 Subject: [PATCH 098/115] Break out all the classes into their own files. --- ruamoko/cl_menu/CrosshairCvar.h | 11 + ruamoko/cl_menu/CrosshairCvar.r | 16 ++ ruamoko/cl_menu/CrosshairView.h | 15 ++ ruamoko/cl_menu/CrosshairView.r | 42 +++ ruamoko/cl_menu/CvarColor.h | 12 + ruamoko/cl_menu/CvarColor.r | 25 ++ ruamoko/cl_menu/CvarColorView.h | 17 ++ ruamoko/cl_menu/CvarColorView.r | 51 ++++ ruamoko/cl_menu/CvarObject.h | 13 + ruamoko/cl_menu/CvarObject.r | 24 ++ ruamoko/cl_menu/CvarRange.h | 17 ++ ruamoko/cl_menu/CvarRange.r | 43 +++ ruamoko/cl_menu/CvarRangeView.h | 22 ++ ruamoko/cl_menu/CvarRangeView.r | 74 ++++++ ruamoko/cl_menu/CvarToggle.h | 11 + ruamoko/cl_menu/CvarToggle.r | 15 ++ ruamoko/cl_menu/CvarToggleView.h | 19 ++ ruamoko/cl_menu/CvarToggleView.r | 57 ++++ ruamoko/cl_menu/Makefile.am | 6 +- ruamoko/cl_menu/MenuGroup.h | 14 + ruamoko/cl_menu/MenuGroup.r | 66 +++++ ruamoko/cl_menu/MouseToggle.h | 10 + ruamoko/cl_menu/MouseToggle.r | 19 ++ ruamoko/cl_menu/ProxyView.h | 14 + ruamoko/cl_menu/ProxyView.r | 34 +++ ruamoko/cl_menu/RunToggle.h | 9 + ruamoko/cl_menu/RunToggle.r | 21 ++ ruamoko/cl_menu/options.qc | 5 + ruamoko/cl_menu/options_util.h | 101 ------- ruamoko/cl_menu/options_util.qc | 444 +------------------------------ 30 files changed, 682 insertions(+), 545 deletions(-) create mode 100644 ruamoko/cl_menu/CrosshairCvar.h create mode 100644 ruamoko/cl_menu/CrosshairCvar.r create mode 100644 ruamoko/cl_menu/CrosshairView.h create mode 100644 ruamoko/cl_menu/CrosshairView.r create mode 100644 ruamoko/cl_menu/CvarColor.h create mode 100644 ruamoko/cl_menu/CvarColor.r create mode 100644 ruamoko/cl_menu/CvarColorView.h create mode 100644 ruamoko/cl_menu/CvarColorView.r create mode 100644 ruamoko/cl_menu/CvarObject.h create mode 100644 ruamoko/cl_menu/CvarObject.r create mode 100644 ruamoko/cl_menu/CvarRange.h create mode 100644 ruamoko/cl_menu/CvarRange.r create mode 100644 ruamoko/cl_menu/CvarRangeView.h create mode 100644 ruamoko/cl_menu/CvarRangeView.r create mode 100644 ruamoko/cl_menu/CvarToggle.h create mode 100644 ruamoko/cl_menu/CvarToggle.r create mode 100644 ruamoko/cl_menu/CvarToggleView.h create mode 100644 ruamoko/cl_menu/CvarToggleView.r create mode 100644 ruamoko/cl_menu/MenuGroup.h create mode 100644 ruamoko/cl_menu/MenuGroup.r create mode 100644 ruamoko/cl_menu/MouseToggle.h create mode 100644 ruamoko/cl_menu/MouseToggle.r create mode 100644 ruamoko/cl_menu/ProxyView.h create mode 100644 ruamoko/cl_menu/ProxyView.r create mode 100644 ruamoko/cl_menu/RunToggle.h create mode 100644 ruamoko/cl_menu/RunToggle.r diff --git a/ruamoko/cl_menu/CrosshairCvar.h b/ruamoko/cl_menu/CrosshairCvar.h new file mode 100644 index 000000000..0f3e74e94 --- /dev/null +++ b/ruamoko/cl_menu/CrosshairCvar.h @@ -0,0 +1,11 @@ +#ifndef __CrosshairCvar_h +#define __CrosshairCvar_h + +#include "CvarObject.h" + +@interface CrosshairCvar : CvarObject +-(void) next; +-(integer) crosshair; +@end + +#endif//__CrosshairCvar_h diff --git a/ruamoko/cl_menu/CrosshairCvar.r b/ruamoko/cl_menu/CrosshairCvar.r new file mode 100644 index 000000000..366ae94d0 --- /dev/null +++ b/ruamoko/cl_menu/CrosshairCvar.r @@ -0,0 +1,16 @@ +#include "cvar.h" + +#include "CrosshairCvar.h" + +@implementation CrosshairCvar +-(void) next +{ + local integer val = Cvar_GetInteger (name); + Cvar_SetInteger (name, (val + 1) % 4); +} + +-(integer) crosshair +{ + return Cvar_GetInteger (name); +} +@end diff --git a/ruamoko/cl_menu/CrosshairView.h b/ruamoko/cl_menu/CrosshairView.h new file mode 100644 index 000000000..e95861fa6 --- /dev/null +++ b/ruamoko/cl_menu/CrosshairView.h @@ -0,0 +1,15 @@ +#ifndef __CrosshairView_h +#define __CrosshairView_h + +#include "gui/View.h" +#include "CrosshairCvar.h" + +@interface CrosshairView : View +{ + CrosshairCvar crosshair; +} +-(id)initWithBounds:(Rect)aRect :(CrosshairCvar)_crosshair; +-(void) next; +@end + +#endif//__CrosshairView_h diff --git a/ruamoko/cl_menu/CrosshairView.r b/ruamoko/cl_menu/CrosshairView.r new file mode 100644 index 000000000..c5e9c0a1e --- /dev/null +++ b/ruamoko/cl_menu/CrosshairView.r @@ -0,0 +1,42 @@ +#include "draw.h" +#include "key.h" +#include "sound.h" + +#include "CrosshairView.h" + +@implementation CrosshairView +{ + CrosshairCvar crosshair; +} + +-(id)initWithBounds:(Rect)aRect :(CrosshairCvar)_crosshair +{ + self = [self initWithBounds:aRect]; + crosshair = _crosshair; + return self; +} + +-(void) next +{ + [crosshair next]; + S_LocalSound ("misc/menu2.wav"); +} + +-(void) draw +{ + Draw_Fill (xabs, yabs, xlen, ylen, 0); + Draw_Crosshair ([crosshair crosshair], xabs + xlen / 2, yabs + ylen / 2); +} + +- (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down +{ + switch (key) { + case QFK_RETURN: + case QFM_BUTTON1: + [self next]; + return 1; + default: + return 0; + } +} +@end diff --git a/ruamoko/cl_menu/CvarColor.h b/ruamoko/cl_menu/CvarColor.h new file mode 100644 index 000000000..21de0faed --- /dev/null +++ b/ruamoko/cl_menu/CvarColor.h @@ -0,0 +1,12 @@ +#ifndef __CvarColor_h +#define __CvarColor_h + +#include "CvarObject.h" + +@interface CvarColor : CvarObject +-(void)next; +-(void)prev; +-(integer)value; +@end + +#endif//__CvarColor_h diff --git a/ruamoko/cl_menu/CvarColor.r b/ruamoko/cl_menu/CvarColor.r new file mode 100644 index 000000000..d17f8b1a5 --- /dev/null +++ b/ruamoko/cl_menu/CvarColor.r @@ -0,0 +1,25 @@ +#include "cvar.h" + +#include "options_util.h" +#include "CvarColor.h" + +@implementation CvarColor +-(void)next +{ + local float val = Cvar_GetFloat (name); + val = min_max_cnt (0, 13, 1, val, 1); + Cvar_SetFloat (name, val); +} + +-(void)prev +{ + local float val = Cvar_GetFloat (name); + val = min_max_cnt (0, 13, 1, val, 0); + Cvar_SetFloat (name, val); +} + +-(integer)value +{ + return Cvar_GetInteger (name); +} +@end diff --git a/ruamoko/cl_menu/CvarColorView.h b/ruamoko/cl_menu/CvarColorView.h new file mode 100644 index 000000000..38c5124b2 --- /dev/null +++ b/ruamoko/cl_menu/CvarColorView.h @@ -0,0 +1,17 @@ +#ifndef __CvarColorView_h +#define __CvarColorView_h + +#include "gui/View.h" + +@class CvarColor; + +@interface CvarColorView : View +{ + CvarColor color; +} +-(id)initWithBounds:(Rect)aRect :(CvarColor)_color; +-(void)next; +-(void)prev; +@end + +#endif//__CvarColorView_h diff --git a/ruamoko/cl_menu/CvarColorView.r b/ruamoko/cl_menu/CvarColorView.r new file mode 100644 index 000000000..8a6f16ca9 --- /dev/null +++ b/ruamoko/cl_menu/CvarColorView.r @@ -0,0 +1,51 @@ +#include "draw.h" +#include "key.h" +#include "sound.h" + +#include "CvarColorView.h" +#include "CvarColor.h" + +@implementation CvarColorView +-(id)initWithBounds:(Rect)aRect :(CvarColor)_color +{ + self = [self initWithBounds:aRect]; + color = _color; + return self; +} + +-(void)next +{ + [color next]; + S_LocalSound ("misc/menu2.wav"); +} + +-(void)prev +{ + [color prev]; + S_LocalSound ("misc/menu2.wav"); +} + +-(void)draw +{ + local integer xl; + xl = xlen / 8 - 2; + text_box (xabs, yabs, xl, ylen / 8 - 2); + xl = (xl + 1) & ~1; // text_box does only multiples of 2 + Draw_Fill (xabs + 8, yabs + 8, xl * 8, ylen - 16, + [color value] * 16 + 8); +} + +- (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down +{ + switch (key) { + case QFK_DOWN: + case QFM_WHEEL_DOWN: + [self next]; + return 1; + case QFK_UP: + case QFM_WHEEL_UP: + [self prev]; + return 1; + } +} +@end diff --git a/ruamoko/cl_menu/CvarObject.h b/ruamoko/cl_menu/CvarObject.h new file mode 100644 index 000000000..51586af0b --- /dev/null +++ b/ruamoko/cl_menu/CvarObject.h @@ -0,0 +1,13 @@ +#ifndef __CvarObject_h +#define __CvarObject_h + +#include "Object.h" + +@interface CvarObject : Object +{ + string name; +} +-(id)initWithCvar:(string)cvname; +@end + +#endif//__CvarObject_h diff --git a/ruamoko/cl_menu/CvarObject.r b/ruamoko/cl_menu/CvarObject.r new file mode 100644 index 000000000..fab57fe28 --- /dev/null +++ b/ruamoko/cl_menu/CvarObject.r @@ -0,0 +1,24 @@ +#include "string.h" + +#include "CvarObject.h" + +@implementation CvarObject +-(id)init +{ + self = [super init]; + name = str_new (); + return self; +} + +-(id)initWithCvar:(string)cvname +{ + self = [self init]; + str_copy (name, cvname); + return self; +} + +-(void)dealloc +{ + str_free (name); +} +@end diff --git a/ruamoko/cl_menu/CvarRange.h b/ruamoko/cl_menu/CvarRange.h new file mode 100644 index 000000000..18dc9f4d7 --- /dev/null +++ b/ruamoko/cl_menu/CvarRange.h @@ -0,0 +1,17 @@ +#ifndef __CvarRange_h +#define __CvarRange_h + +#include "CvarObject.h" + +@interface CvarRange : CvarObject +{ + float min, max, step; +} +-(id)initWithCvar:(string)cvname min:(float)_min max:(float)_max step:(float)_step; +-(void)inc; +-(void)dec; +-(float)value; +-(integer)percentage; +@end + +#endif//__CvarRange_h diff --git a/ruamoko/cl_menu/CvarRange.r b/ruamoko/cl_menu/CvarRange.r new file mode 100644 index 000000000..5923fdebb --- /dev/null +++ b/ruamoko/cl_menu/CvarRange.r @@ -0,0 +1,43 @@ +#include "cvar.h" + +#include "options_util.h" +#include "CvarRange.h" + +@implementation CvarRange + +-(id)initWithCvar:(string)cvname min:(float)_min max:(float)_max step:(float)_step +{ + self = [super initWithCvar: cvname]; + + min = _min; + max = _max; + step = _step; + + return self; +} + +-(void)inc +{ + local float val = Cvar_GetFloat (name); + val = min_max_cnt (min, max, step, val, 1); + Cvar_SetFloat (name, val); +} + +-(void)dec +{ + local float val = Cvar_GetFloat (name); + val = min_max_cnt (min, max, step, val, 0); + Cvar_SetFloat (name, val); +} + +-(float)value +{ + return Cvar_GetFloat (name); +} + +-(integer)percentage +{ + return to_percentage(min, max, Cvar_GetFloat (name)); +} + +@end diff --git a/ruamoko/cl_menu/CvarRangeView.h b/ruamoko/cl_menu/CvarRangeView.h new file mode 100644 index 000000000..edbf4cb06 --- /dev/null +++ b/ruamoko/cl_menu/CvarRangeView.h @@ -0,0 +1,22 @@ +#ifndef __CvarRangeView_h +#define __CvarRangeView_h + +#include "gui/Group.h" + +@class Text; +@class Slider; +@class CvarRange; + +@interface CvarRangeView : Group +{ + Text title; + Text value; + Slider slider; + CvarRange range; +} +-(id)initWithBounds:(Rect)aRect title:(string)_title sliderWidth:(integer)width :(CvarRange)_range; +-(void)inc; +-(void)dec; +@end + +#endif//__CvarRangeView_h diff --git a/ruamoko/cl_menu/CvarRangeView.r b/ruamoko/cl_menu/CvarRangeView.r new file mode 100644 index 000000000..759bb1ed7 --- /dev/null +++ b/ruamoko/cl_menu/CvarRangeView.r @@ -0,0 +1,74 @@ +#include "key.h" +#include "sound.h" +#include "string.h" + +#include "gui/Text.h" +#include "gui/Slider.h" +#include "CvarRangeView.h" +#include "CvarRange.h" + +@implementation CvarRangeView + +-(void)update +{ + [slider setIndex:[range percentage]]; + [value setText:ftos ([range value])]; +} + +-(id)initWithBounds:(Rect)aRect title:(string)_title sliderWidth:(integer)width :(CvarRange)_range +{ + local Rect rect; + + self = [super initWithBounds:aRect]; + + range = _range; + + rect = makeRect (0, 0, strlen (_title) * 8, 8); + title = [[Text alloc] initWithBounds:rect text:_title]; + + rect.origin.x += rect.size.width + 8; + rect.size.width = width; + if (rect.origin.x + rect.size.width > xlen) + rect.size.width = xlen - rect.origin.x; + slider = [[Slider alloc] initWithBounds:rect size:100]; + + rect.origin.x += rect.size.width + 8; + rect.size.width = xlen - rect.origin.x; + value = [[Text alloc] initWithBounds:rect]; + + [self addView:title]; + [self addView:slider]; + [self addView:value]; + + [self update]; + + return self; +} + +-(void)inc +{ + [range inc]; + [self update]; + S_LocalSound ("misc/menu3.wav"); +} + +-(void)dec +{ + [range dec]; + [self update]; + S_LocalSound ("misc/menu3.wav"); +} + +- (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down +{ + switch (key) { + case QFK_RIGHT: + [self inc]; + return 1; + case QFK_LEFT: + [self dec]; + return 1; + } +} + +@end diff --git a/ruamoko/cl_menu/CvarToggle.h b/ruamoko/cl_menu/CvarToggle.h new file mode 100644 index 000000000..b02dfadb8 --- /dev/null +++ b/ruamoko/cl_menu/CvarToggle.h @@ -0,0 +1,11 @@ +#ifndef __CvarToggle_h +#define __CvarToggle_h + +#include "CvarObject.h" + +@interface CvarToggle : CvarObject +-(void)toggle; +-(BOOL)value; +@end + +#endif//__CvarToggle_h diff --git a/ruamoko/cl_menu/CvarToggle.r b/ruamoko/cl_menu/CvarToggle.r new file mode 100644 index 000000000..0e6ac89d7 --- /dev/null +++ b/ruamoko/cl_menu/CvarToggle.r @@ -0,0 +1,15 @@ +#include "cvar.h" + +#include "CvarToggle.h" + +@implementation CvarToggle +-(void)toggle +{ + Cvar_Toggle (name); +} + +-(BOOL)value +{ + return Cvar_GetInteger (name); +} +@end diff --git a/ruamoko/cl_menu/CvarToggleView.h b/ruamoko/cl_menu/CvarToggleView.h new file mode 100644 index 000000000..f7710871e --- /dev/null +++ b/ruamoko/cl_menu/CvarToggleView.h @@ -0,0 +1,19 @@ +#ifndef __CvarToggleView_h +#define __CvarToggleView_h + +#include "gui/Group.h" + +@class Text; +@class CvarToggle; + +@interface CvarToggleView : Group +{ + Text title; + Text value; + CvarToggle toggle; +} +-(id)initWithBounds:(Rect)aRect title:(string)_title :(CvarToggle)_toggle; +-(void)toggle; +@end + +#endif//__CvarToggleView_h diff --git a/ruamoko/cl_menu/CvarToggleView.r b/ruamoko/cl_menu/CvarToggleView.r new file mode 100644 index 000000000..7c76399b1 --- /dev/null +++ b/ruamoko/cl_menu/CvarToggleView.r @@ -0,0 +1,57 @@ +#include "key.h" +#include "sound.h" +#include "string.h" + +#include "gui/Text.h" +#include "CvarToggleView.h" + +@implementation CvarToggleView + +-(void)update +{ + [value setText:[toggle value] ? "On" : "Off"]; +} + +-(id)initWithBounds:(Rect)aRect title:(string)_title :(CvarToggle)_toggle +{ + local Rect rect; + + self = [super initWithBounds:aRect]; + + toggle = _toggle; + + rect = makeRect (0, 0, strlen (_title) * 8, 8); + title = [[Text alloc] initWithBounds:rect text:_title]; + + rect.size.width = 3 * 8; + rect.origin.x = xlen - rect.size.width; + value = [[Text alloc] initWithBounds:rect]; + + [self addView:title]; + [self addView:value]; + + [self update]; + + return self; +} + +-(void)toggle +{ + [toggle toggle]; + [self update]; + S_LocalSound ("misc/menu3.wav"); +} + +- (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down +{ + switch (key) { + case QFK_RETURN: + case QFM_BUTTON1: + [self toggle]; + return 1; + default: + return 0; + } +} + +@end diff --git a/ruamoko/cl_menu/Makefile.am b/ruamoko/cl_menu/Makefile.am index 7a5b6643f..0a4c60d95 100644 --- a/ruamoko/cl_menu/Makefile.am +++ b/ruamoko/cl_menu/Makefile.am @@ -28,7 +28,11 @@ EXTRA_DATA= $(menu_data) menu_src= \ client_menu.qc controls_o.qc options.qc options_util.qc servlist.qc \ - Frame.r menu.r HUD.r plistmenu.r ../lib/debug.r + Frame.r menu.r HUD.r plistmenu.r ../lib/debug.r \ + \ + CrosshairCvar.r CrosshairView.r CvarColor.r CvarColorView.r \ + CvarObject.r CvarRange.r CvarRangeView.r CvarToggle.r CvarToggleView.r \ + MenuGroup.r MouseToggle.r ProxyView.r RunToggle.r %.qfo: %.r $(QFCC) $(QCFLAGS) $(QCPPFLAGS) -c -o $@ $< diff --git a/ruamoko/cl_menu/MenuGroup.h b/ruamoko/cl_menu/MenuGroup.h new file mode 100644 index 000000000..9d9bddf9a --- /dev/null +++ b/ruamoko/cl_menu/MenuGroup.h @@ -0,0 +1,14 @@ +#ifndef __MenuGroup_h +#define __MenuGroup_h + +#include "gui/Group.h" + +@interface MenuGroup : Group +{ + integer base; + integer current; +} +-(void)setBase:(integer)b; +@end + +#endif//__MenuGroup_h diff --git a/ruamoko/cl_menu/MenuGroup.r b/ruamoko/cl_menu/MenuGroup.r new file mode 100644 index 000000000..eb3d0fe49 --- /dev/null +++ b/ruamoko/cl_menu/MenuGroup.r @@ -0,0 +1,66 @@ +#include "key.h" +#include "sound.h" + +#include "Array.h" + +#include "options_util.h" +#include "MenuGroup.h" + +@implementation MenuGroup +-(id) init +{ + if ((self = [super init])) + current = base = 0; +} + +-(void)setBase:(integer)b +{ + if (b >= [views count]) + b = [views count] - 1; + if (b < 0) + b = 0; + current = base = b; +} + +- (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down +{ + switch (key) { + case QFK_DOWN: + case QFM_WHEEL_DOWN: + [self next]; + return 1; + case QFK_UP: + case QFM_WHEEL_UP: + [self prev]; + return 1; + default: + return [[views getItemAt:current] + keyEvent:key + unicode:unicode + down:down]; + } +} + +-(void) next +{ + if (++current >= [views count]) + current = base; + S_LocalSound ("misc/menu1.wav"); +} + +-(void) prev +{ + if (--current < base) + current = [views count] - 1; + S_LocalSound ("misc/menu1.wav"); +} + +- (void) draw +{ + local View cur; + + [super draw]; + cur = (View) [views getItemAt:current]; + opt_cursor (cur.xabs - 8, cur.yabs); +} +@end diff --git a/ruamoko/cl_menu/MouseToggle.h b/ruamoko/cl_menu/MouseToggle.h new file mode 100644 index 000000000..e99214191 --- /dev/null +++ b/ruamoko/cl_menu/MouseToggle.h @@ -0,0 +1,10 @@ +#ifndef __MouseToggle_h +#define __MouseToggle_h + +#include "CvarObject.h" + + +@interface MouseToggle : CvarObject +@end + +#endif//__MouseToggle_h diff --git a/ruamoko/cl_menu/MouseToggle.r b/ruamoko/cl_menu/MouseToggle.r new file mode 100644 index 000000000..0919612f7 --- /dev/null +++ b/ruamoko/cl_menu/MouseToggle.r @@ -0,0 +1,19 @@ +#include "cvar.h" + +#include "MouseToggle.h" + +@implementation MouseToggle +-(void)toggle +{ + if (Cvar_GetFloat ("m_pitch") < 0) { + Cvar_SetFloat ("m_pitch", 0.022); + } else { + Cvar_SetFloat ("m_pitch", -0.022); + } +} + +-(BOOL)value +{ + return Cvar_GetFloat ("m_pitch") < 0; +} +@end diff --git a/ruamoko/cl_menu/ProxyView.h b/ruamoko/cl_menu/ProxyView.h new file mode 100644 index 000000000..13ccffe23 --- /dev/null +++ b/ruamoko/cl_menu/ProxyView.h @@ -0,0 +1,14 @@ +#ifndef __ProxyView_h +#define __ProxyView_h + +#include "gui/View.h" + +@interface ProxyView : View +{ + View title; + View view; +} +-(id)initWithBounds:(Rect)aRect title:(View)aTitle view:(View)aView; +@end + +#endif//__ProxyView_h diff --git a/ruamoko/cl_menu/ProxyView.r b/ruamoko/cl_menu/ProxyView.r new file mode 100644 index 000000000..93e680970 --- /dev/null +++ b/ruamoko/cl_menu/ProxyView.r @@ -0,0 +1,34 @@ +#include "ProxyView.h" + +@implementation ProxyView + +-(id)initWithBounds:(Rect)aRect title:(View)aTitle view:(View)aView +{ + self = [super initWithBounds:aRect]; + if (!self) + return self; + + title = aTitle; + view = aView; + return self; +} + +- (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down +{ + return [view keyEvent:key unicode:unicode down:down]; +} + +- (void) draw +{ + [title draw]; + [view draw]; +} + +- (void) setBasePosFromView: (View) aview +{ + [super setBasePosFromView:aview]; + [title setBasePosFromView:self]; + [view setBasePosFromView:self]; +} + +@end diff --git a/ruamoko/cl_menu/RunToggle.h b/ruamoko/cl_menu/RunToggle.h new file mode 100644 index 000000000..7b997d014 --- /dev/null +++ b/ruamoko/cl_menu/RunToggle.h @@ -0,0 +1,9 @@ +#ifndef __RunToggle_h +#define __RunToggle_h + +#include "CvarObject.h" + +@interface RunToggle : CvarObject +@end + +#endif//__RunToggle_h diff --git a/ruamoko/cl_menu/RunToggle.r b/ruamoko/cl_menu/RunToggle.r new file mode 100644 index 000000000..ff6741720 --- /dev/null +++ b/ruamoko/cl_menu/RunToggle.r @@ -0,0 +1,21 @@ +#include "cvar.h" + +#include "RunToggle.h" + +@implementation RunToggle +-(void)toggle +{ + if (Cvar_GetFloat ("cl_forwardspeed") < 400) { + Cvar_SetFloat ("cl_forwardspeed", 400); + Cvar_SetFloat ("cl_backspeed", 400); + } else { + Cvar_SetFloat ("cl_forwardspeed", 200); + Cvar_SetFloat ("cl_backspeed", 200); + } +} + +-(BOOL)value +{ + return Cvar_GetFloat ("cl_forwardspeed") >= 400; +} +@end diff --git a/ruamoko/cl_menu/options.qc b/ruamoko/cl_menu/options.qc index be5db96a4..20ddcc480 100644 --- a/ruamoko/cl_menu/options.qc +++ b/ruamoko/cl_menu/options.qc @@ -39,12 +39,17 @@ #include "plistmenu.h" +#include "gui/Group.h" #include "gui/InputLine.h" #include "gui/Pic.h" #include "gui/Rect.h" #include "gui/Slider.h" #include "gui/Text.h" +#include "CvarToggleView.h" +#include "CvarRangeView.h" +#include "CvarColorView.h" + Group video_options; Group audio_options; diff --git a/ruamoko/cl_menu/options_util.h b/ruamoko/cl_menu/options_util.h index 21e11fdb0..b6c9d38b7 100644 --- a/ruamoko/cl_menu/options_util.h +++ b/ruamoko/cl_menu/options_util.h @@ -1,107 +1,6 @@ #ifndef __options_util_h #define __options_util_h -#include "gui/Group.h" - -@class Text; -@class Slider; - -@interface MenuGroup : Group -{ - integer base; - integer current; -} --(void)setBase:(integer)b; -@end - -@interface CvarObject : Object -{ - string name; -} --(id)initWithCvar:(string)cvname; -@end - -@interface CvarToggle : CvarObject --(void)toggle; --(BOOL)value; -@end - -@interface MouseToggle : CvarObject -@end - -@interface RunToggle : CvarObject -@end - -@interface CvarToggleView : Group -{ - Text title; - Text value; - CvarToggle toggle; -} --(id)initWithBounds:(Rect)aRect title:(string)_title :(CvarToggle)_toggle; --(void)toggle; -@end - -@interface CvarColor : CvarObject --(void)next; --(void)prev; --(integer)value; -@end - -@interface CvarColorView : View -{ - CvarColor color; -} --(id)initWithBounds:(Rect)aRect :(CvarColor)_color; --(void)next; --(void)prev; -@end - -@interface CvarRange : CvarObject -{ - float min, max, step; -} --(id)initWithCvar:(string)cvname min:(float)_min max:(float)_max step:(float)_step; --(void)inc; --(void)dec; --(float)value; --(integer)percentage; -@end - -@interface CvarRangeView : Group -{ - Text title; - Text value; - Slider slider; - CvarRange range; -} --(id)initWithBounds:(Rect)aRect title:(string)_title sliderWidth:(integer)width :(CvarRange)_range; --(void)inc; --(void)dec; -@end - -@interface CrosshairCvar : CvarObject --(void) next; --(integer) crosshair; -@end - -@interface CrosshairView : View -{ - CrosshairCvar crosshair; -} --(id)initWithBounds:(Rect)aRect :(CrosshairCvar)_crosshair; --(void) next; -@end - -@interface ProxyView : View -{ - View title; - View view; -} --(id)initWithBounds:(Rect)aRect title:(View)aTitle view:(View)aView; -@end - - @extern void (integer x, integer y) opt_cursor; @extern void (integer x, integer y, integer spacing, string spacechar, string label, string valstr) draw_item; @extern void (integer x, integer y, integer spacing, string label, string valstr) draw_val_item; diff --git a/ruamoko/cl_menu/options_util.qc b/ruamoko/cl_menu/options_util.qc index f7ca3fe5a..86a3efa35 100644 --- a/ruamoko/cl_menu/options_util.qc +++ b/ruamoko/cl_menu/options_util.qc @@ -24,454 +24,12 @@ Boston, MA 02111-1307, USA */ -#include "debug.h" -#include "cvar.h" #include "draw.h" -#include "system.h" #include "string.h" -#include "key.h" -#include "sound.h" +#include "system.h" -#include "Array.h" -#include "gui/Text.h" -#include "gui/Rect.h" -#include "gui/Slider.h" #include "options_util.h" -@implementation MenuGroup --(id) init -{ - if ((self = [super init])) - current = base = 0; -} - --(void)setBase:(integer)b -{ - if (b >= [views count]) - b = [views count] - 1; - if (b < 0) - b = 0; - current = base = b; -} - -- (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down -{ - switch (key) { - case QFK_DOWN: - case QFM_WHEEL_DOWN: - [self next]; - return 1; - case QFK_UP: - case QFM_WHEEL_UP: - [self prev]; - return 1; - default: - return [[views getItemAt:current] - keyEvent:key - unicode:unicode - down:down]; - } -} - --(void) next -{ - if (++current >= [views count]) - current = base; - S_LocalSound ("misc/menu1.wav"); -} - --(void) prev -{ - if (--current < base) - current = [views count] - 1; - S_LocalSound ("misc/menu1.wav"); -} - -- (void) draw -{ - local View cur; - - [super draw]; - cur = (View) [views getItemAt:current]; - opt_cursor (cur.xabs - 8, cur.yabs); -} -@end - - -@implementation CvarObject --(id)init -{ - self = [super init]; - name = str_new (); - return self; -} - --(id)initWithCvar:(string)cvname -{ - self = [self init]; - str_copy (name, cvname); - return self; -} - --(void)dealloc -{ - str_free (name); -} -@end - -@implementation CvarToggle --(void)toggle -{ - Cvar_Toggle (name); -} - --(BOOL)value -{ - return Cvar_GetInteger (name); -} -@end - -@implementation MouseToggle --(void)toggle -{ - if (Cvar_GetFloat ("m_pitch") < 0) { - Cvar_SetFloat ("m_pitch", 0.022); - } else { - Cvar_SetFloat ("m_pitch", -0.022); - } -} - --(BOOL)value -{ - return Cvar_GetFloat ("m_pitch") < 0; -} -@end - -@implementation RunToggle --(void)toggle -{ - if (Cvar_GetFloat ("cl_forwardspeed") < 400) { - Cvar_SetFloat ("cl_forwardspeed", 400); - Cvar_SetFloat ("cl_backspeed", 400); - } else { - Cvar_SetFloat ("cl_forwardspeed", 200); - Cvar_SetFloat ("cl_backspeed", 200); - } -} - --(BOOL)value -{ - return Cvar_GetFloat ("cl_forwardspeed") >= 400; -} -@end - -@implementation CvarToggleView - --(void)update -{ - [value setText:[toggle value] ? "On" : "Off"]; -} - --(id)initWithBounds:(Rect)aRect title:(string)_title :(CvarToggle)_toggle -{ - local Rect rect; - - self = [super initWithBounds:aRect]; - - toggle = _toggle; - - rect = makeRect (0, 0, strlen (_title) * 8, 8); - title = [[Text alloc] initWithBounds:rect text:_title]; - - rect.size.width = 3 * 8; - rect.origin.x = xlen - rect.size.width; - value = [[Text alloc] initWithBounds:rect]; - - [self addView:title]; - [self addView:value]; - - [self update]; - - return self; -} - --(void)toggle -{ - [toggle toggle]; - [self update]; - S_LocalSound ("misc/menu3.wav"); -} - -- (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down -{ - switch (key) { - case QFK_RETURN: - case QFM_BUTTON1: - [self toggle]; - return 1; - default: - return 0; - } -} - -@end - -@implementation CvarColor --(void)next -{ - local float val = Cvar_GetFloat (name); - val = min_max_cnt (0, 13, 1, val, 1); - Cvar_SetFloat (name, val); -} - --(void)prev -{ - local float val = Cvar_GetFloat (name); - val = min_max_cnt (0, 13, 1, val, 0); - Cvar_SetFloat (name, val); -} - --(integer)value -{ - return Cvar_GetInteger (name); -} -@end - -@implementation CvarColorView --(id)initWithBounds:(Rect)aRect :(CvarColor)_color -{ - self = [self initWithBounds:aRect]; - color = _color; - return self; -} - --(void)next -{ - [color next]; - S_LocalSound ("misc/menu2.wav"); -} - --(void)prev -{ - [color prev]; - S_LocalSound ("misc/menu2.wav"); -} - --(void)draw -{ - local integer xl; - xl = xlen / 8 - 2; - text_box (xabs, yabs, xl, ylen / 8 - 2); - xl = (xl + 1) & ~1; // text_box does only multiples of 2 - Draw_Fill (xabs + 8, yabs + 8, xl * 8, ylen - 16, - [color value] * 16 + 8); -} - -- (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down -{ - switch (key) { - case QFK_DOWN: - case QFM_WHEEL_DOWN: - [self next]; - return 1; - case QFK_UP: - case QFM_WHEEL_UP: - [self prev]; - return 1; - } -} -@end - -@implementation CvarRange - --(id)initWithCvar:(string)cvname min:(float)_min max:(float)_max step:(float)_step -{ - self = [super init]; - - name = str_new (); - str_copy (name, cvname); - min = _min; - max = _max; - step = _step; - - return self; -} - --(void)inc -{ - local float val = Cvar_GetFloat (name); - val = min_max_cnt (min, max, step, val, 1); - Cvar_SetFloat (name, val); -} - --(void)dec -{ - local float val = Cvar_GetFloat (name); - val = min_max_cnt (min, max, step, val, 0); - Cvar_SetFloat (name, val); -} - --(float)value -{ - return Cvar_GetFloat (name); -} - --(integer)percentage -{ - return to_percentage(min, max, Cvar_GetFloat (name)); -} - -@end - -@implementation CvarRangeView - --(void)update -{ - [slider setIndex:[range percentage]]; - [value setText:ftos ([range value])]; -} - --(id)initWithBounds:(Rect)aRect title:(string)_title sliderWidth:(integer)width :(CvarRange)_range -{ - local Rect rect; - - self = [super initWithBounds:aRect]; - - range = _range; - - rect = makeRect (0, 0, strlen (_title) * 8, 8); - title = [[Text alloc] initWithBounds:rect text:_title]; - - rect.origin.x += rect.size.width + 8; - rect.size.width = width; - if (rect.origin.x + rect.size.width > xlen) - rect.size.width = xlen - rect.origin.x; - slider = [[Slider alloc] initWithBounds:rect size:100]; - - rect.origin.x += rect.size.width + 8; - rect.size.width = xlen - rect.origin.x; - value = [[Text alloc] initWithBounds:rect]; - - [self addView:title]; - [self addView:slider]; - [self addView:value]; - - [self update]; - - return self; -} - --(void)inc -{ - [range inc]; - [self update]; - S_LocalSound ("misc/menu3.wav"); -} - --(void)dec -{ - [range dec]; - [self update]; - S_LocalSound ("misc/menu3.wav"); -} - -- (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down -{ - switch (key) { - case QFK_RIGHT: - [self inc]; - return 1; - case QFK_LEFT: - [self dec]; - return 1; - } -} - -@end - -@implementation CrosshairCvar --(void) next -{ - local integer val = Cvar_GetInteger (name); - Cvar_SetInteger (name, (val + 1) % 4); -} - --(integer) crosshair -{ - return Cvar_GetInteger (name); -} -@end - -@implementation CrosshairView -{ - CrosshairCvar crosshair; -} - --(id)initWithBounds:(Rect)aRect :(CrosshairCvar)_crosshair -{ - self = [self initWithBounds:aRect]; - crosshair = _crosshair; - return self; -} - --(void) next -{ - [crosshair next]; - S_LocalSound ("misc/menu2.wav"); -} - --(void) draw -{ - Draw_Fill (xabs, yabs, xlen, ylen, 0); - Draw_Crosshair ([crosshair crosshair], xabs + xlen / 2, yabs + ylen / 2); -} - -- (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down -{ - switch (key) { - case QFK_RETURN: - case QFM_BUTTON1: - [self next]; - return 1; - default: - return 0; - } -} -@end - -@implementation ProxyView - --(id)initWithBounds:(Rect)aRect title:(View)aTitle view:(View)aView -{ - self = [super initWithBounds:aRect]; - if (!self) - return self; - - title = aTitle; - view = aView; - return self; -} - -- (integer) keyEvent:(integer)key unicode:(integer)unicode down:(integer)down -{ - return [view keyEvent:key unicode:unicode down:down]; -} - -- (void) draw -{ - [title draw]; - [view draw]; -} - -- (void) setBasePosFromView: (View) aview -{ - [super setBasePosFromView:aview]; - [title setBasePosFromView:self]; - [view setBasePosFromView:self]; -} - -@end - /* opt_cursor From d6ceaef7d2b49fbe15eb18fca9ccb22cffb97106 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 24 Nov 2010 20:42:07 +0900 Subject: [PATCH 099/115] Whee, 64bit cpus and sizeof. --- libs/util/zone.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/util/zone.c b/libs/util/zone.c index e9f02a20b..e4b5740ae 100644 --- a/libs/util/zone.c +++ b/libs/util/zone.c @@ -263,8 +263,8 @@ Z_Print (memzone_t *zone) for (block = zone->blocklist.next ; ; block = block->next) { Sys_Printf ("block:%p size:%7i tag:%3i ofs:%d\n", - block, block->size - sizeof (memblock_t) - 4, block->tag, - (int) ((byte *) block - (byte *) zone)); + block, block->size - (int) sizeof (memblock_t) - 4, + block->tag, (int) ((byte *) block - (byte *) zone)); if (block->next == &zone->blocklist) break; // all blocks have been hit From abc17c1d9191509293e53b4e1fc7c7fb92de079f Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 23 Nov 2010 10:40:54 +0900 Subject: [PATCH 100/115] New cvar commands from fitzquake. --- include/QF/cvar.h | 30 ++++++------ libs/util/cvar.c | 114 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 130 insertions(+), 14 deletions(-) diff --git a/include/QF/cvar.h b/include/QF/cvar.h index 9ddc8a277..c5e9d75d5 100644 --- a/include/QF/cvar.h +++ b/include/QF/cvar.h @@ -37,23 +37,22 @@ #include "QF/qtypes.h" #include "QF/quakeio.h" -typedef struct cvar_s -{ - const char *name; - const char *string; - int flags; - void (*callback)(struct cvar_s *var); - const char *description; // for "help" command - float value; - int int_val; - vec3_t vec; +typedef struct cvar_s { + const char *name; + const char *string; + const char *default_string; + int flags; + void (*callback)(struct cvar_s *var); + const char *description; // for "help" command + float value; + int int_val; + vec3_t vec; struct cvar_s *next; } cvar_t; -typedef struct cvar_alias_s -{ - char *name; - cvar_t *cvar; +typedef struct cvar_alias_s { + char *name; + cvar_t *cvar; struct cvar_alias_s *next; } cvar_alias_t; @@ -96,6 +95,9 @@ void Cvar_SetROM (cvar_t *var, const char *value); // allows you to change a Cvar's flags without a full Cvar_Get void Cvar_SetFlags (cvar_t *var, int cvarflags); +// reset a Cvar to its default setting +void Cvar_Reset (cvar_t *var); + // returns 0 if not defined or non numeric float Cvar_VariableValue (const char *var_name); diff --git a/libs/util/cvar.c b/libs/util/cvar.c index 2a25d12fc..d31fe87c2 100644 --- a/libs/util/cvar.c +++ b/libs/util/cvar.c @@ -382,6 +382,30 @@ Cvar_Seta_f (void) set_cvar ("seta", CVAR_ARCHIVE); } +static void +Cvar_Inc_f (void) +{ + cvar_t *var; + float inc = 1; + const char *name; + + switch (Cmd_Argc ()) { + default: + case 1: + Sys_Printf ("inc [amount] : increment cvar\n"); + return; + case 3: + inc = atof (Cmd_Argv (2)); + case 2: + name = Cmd_Argv (1); + var = Cvar_FindVar (name); + if (!var) + Sys_Printf ("Unknown variable \"%s\"\n", name); + break; + } + Cvar_SetValue (var, var->value + inc); +} + static void Cvar_Toggle_f (void) { @@ -403,6 +427,84 @@ Cvar_Toggle_f (void) Cvar_Set (var, var->int_val ? "0" : "1"); } +static void +Cvar_Cycle_f (void) +{ + int i; + const char *name; + cvar_t *var; + + if (Cmd_Argc () < 3) { + Sys_Printf ("cycle : cycle cvar through a list of " + "values\n"); + return; + } + + name = Cmd_Argv (1); + var = Cvar_FindVar (name); + if (!var) { + var = Cvar_Get (name, Cmd_Argv (Cmd_Argc () - 1), CVAR_USER_CREATED, + 0, USER_CVAR); + } + + // loop through the args until you find one that matches the current cvar + // value. yes, this will get stuck on a list that contains the same value + // twice. it's not worth dealing with, and i'm not even sure it can be + // dealt with -- johnfitz + for (i = 2; i < Cmd_Argc (); i++) { + // zero is assumed to be a string, even though it could actually be + // zero. The worst case is that the first time you call this command, + // it won't match on zero when it should, but after that, it will be + // comparing string that all had the same source (the user) so it will + // work. + if (atof (Cmd_Argv (i)) == 0) { + if (!strcmp (Cmd_Argv (i), var->string)) + break; + } else { + if (atof (Cmd_Argv (i)) == var->value) + break; + } + } + + if (i == Cmd_Argc ()) + Cvar_Set (var, Cmd_Argv (2)); // no match + else if (i + 1 == Cmd_Argc ()) + Cvar_Set (var, Cmd_Argv (2)); // matched last value in list + else + Cvar_Set (var, Cmd_Argv (i + 1)); // matched earlier in list +} + +static void +Cvar_Reset_f (void) +{ + cvar_t *var; + const char *name; + + switch (Cmd_Argc ()) { + default: + case 1: + Sys_Printf ("reset : reset cvar to default\n"); + break; + case 2: + name = Cmd_Argv (1); + var = Cvar_FindVar (name); + if (!var) + Sys_Printf ("Unknown variable \"%s\"\n", name); + else + Cvar_Reset (var); + break; + } +} + +static void Cvar_ResetAll_f (void) +{ + cvar_t *var; + + for (var = cvar_vars; var; var = var->next) + if (!(var->flags & CVAR_ROM)) + Cvar_Reset (var); +} + static void Cvar_CvarList_f (void) { @@ -488,6 +590,11 @@ Cvar_Init (void) "variablename setting)"); Cmd_AddCommand ("toggle", Cvar_Toggle_f, "Toggle a cvar on or off"); Cmd_AddCommand ("cvarlist", Cvar_CvarList_f, "List all cvars"); + Cmd_AddCommand ("cycle", Cvar_Cycle_f, + "Cycle a cvar through a list of values"); + Cmd_AddCommand ("inc", Cvar_Inc_f, "Increment a cvar"); + Cmd_AddCommand ("reset", Cvar_Reset_f, "Reset a cvar"); + Cmd_AddCommand ("resetall", Cvar_ResetAll_f, "Reset all cvars"); } void @@ -534,6 +641,7 @@ Cvar_Get (const char *name, const char *string, int cvarflags, // Cvar doesn't exist, so we create it var->name = strdup (name); var->string = strdup (string); + var->default_string = strdup (string); var->flags = cvarflags; var->callback = callback; var->description = description; @@ -578,3 +686,9 @@ Cvar_SetFlags (cvar_t *var, int cvarflags) var->flags = cvarflags; } + +VISIBLE void +Cvar_Reset (cvar_t *var) +{ + Cvar_Set (var, var->default_string); +} From 525e20e3e2c6ecff89754fac3e1c1492703b9ee1 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 23 Nov 2010 10:48:10 +0900 Subject: [PATCH 101/115] Bring QW's unlimited beams/explosions into NQ. --- nq/source/cl_main.c | 1 + nq/source/cl_tent.c | 365 +++++++++++++++++++++++++------------------- qw/source/cl_tent.c | 42 +++-- 3 files changed, 225 insertions(+), 183 deletions(-) diff --git a/nq/source/cl_main.c b/nq/source/cl_main.c index 92f52a759..2a30d4977 100644 --- a/nq/source/cl_main.c +++ b/nq/source/cl_main.c @@ -155,6 +155,7 @@ CL_ClearState (void) r_force_fullscreen = 0; CL_Init_Entity (&cl.viewent); + r_view_model = &cl.viewent; SZ_Clear (&cls.message); diff --git a/nq/source/cl_tent.c b/nq/source/cl_tent.c index 4bce89585..a1df6bb22 100644 --- a/nq/source/cl_tent.c +++ b/nq/source/cl_tent.c @@ -50,47 +50,60 @@ static __attribute__ ((used)) const char rcsid[] = #include "compat.h" #include "r_dynamic.h" -#define MAX_BEAMS 8 -#define MAX_BEAM_ENTS 20 +typedef struct tent_s { + struct tent_s *next; + entity_t ent; +} tent_t; + +#define TEMP_BATCH 64 +static tent_t *temp_entities = 0; typedef struct { int entity; struct model_s *model; float endtime; vec3_t start, end; - entity_t ent_list[MAX_BEAM_ENTS]; - int ent_count; - int seed; + tent_t *tents; + int seed; } beam_t; -beam_t cl_beams[MAX_BEAMS]; - -#define MAX_EXPLOSIONS 8 typedef struct { float start; - entity_t ent; + tent_t *tent; } explosion_t; -explosion_t cl_explosions[MAX_EXPLOSIONS]; +typedef struct tent_obj_s { + struct tent_obj_s *next; + union { + beam_t beam; + explosion_t ex; + } to; +} tent_obj_t; -sfx_t *cl_sfx_wizhit; -sfx_t *cl_sfx_knighthit; -sfx_t *cl_sfx_tink1; -sfx_t *cl_sfx_ric1; -sfx_t *cl_sfx_ric2; -sfx_t *cl_sfx_ric3; -sfx_t *cl_sfx_r_exp3; +static tent_obj_t *tent_objects; +static tent_obj_t *cl_beams; +static tent_obj_t *cl_explosions; -model_t *cl_mod_beam; -model_t *cl_mod_bolt; -model_t *cl_mod_bolt2; -model_t *cl_mod_bolt3; -model_t *cl_spr_explod; +static sfx_t *cl_sfx_wizhit; +static sfx_t *cl_sfx_knighthit; +static sfx_t *cl_sfx_tink1; +static sfx_t *cl_sfx_ric1; +static sfx_t *cl_sfx_ric2; +static sfx_t *cl_sfx_ric3; +static sfx_t *cl_sfx_r_exp3; -void -CL_TEnts_Init (void) +static model_t *cl_mod_beam; +static model_t *cl_mod_bolt; +static model_t *cl_mod_bolt2; +static model_t *cl_mod_bolt3; +static model_t *cl_spr_explod; + +static void +CL_TEnts_Precache (int phase) { + if (!phase) + return; cl_sfx_wizhit = S_PrecacheSound ("wizard/hit.wav"); cl_sfx_knighthit = S_PrecacheSound ("hknight/hit.wav"); cl_sfx_tink1 = S_PrecacheSound ("weapons/tink1.wav"); @@ -108,6 +121,13 @@ CL_TEnts_Init (void) cl_mod_beam = cl_mod_bolt; } +void +CL_TEnts_Init (void) +{ + QFS_GamedirCallback (CL_TEnts_Precache); + CL_TEnts_Precache (1); +} + void CL_Init_Entity (entity_t *ent) { @@ -120,81 +140,106 @@ CL_Init_Entity (entity_t *ent) ent->pose1 = ent->pose2 = -1; } +static tent_t * +new_temp_entity (void) +{ + tent_t *tent; + if (!temp_entities) { + int i; + + temp_entities = malloc (TEMP_BATCH * sizeof (tent_t)); + for (i = 0; i < TEMP_BATCH - 1; i++) { + temp_entities[i].next = &temp_entities[i + 1]; + } + temp_entities[i].next = 0; + } + tent = temp_entities; + temp_entities = tent->next; + tent->next = 0; + CL_Init_Entity (&tent->ent); + return tent; +} + +static void +free_temp_entities (tent_t *tents) +{ + tent_t **t = &tents; + + while (*t) + t = &(*t)->next; + *t = temp_entities; + temp_entities = tents; +} + +static tent_obj_t * +new_tent_object (void) +{ + tent_obj_t *tobj; + if (!tent_objects) { + int i; + + tent_objects = malloc (TEMP_BATCH * sizeof (tent_t)); + for (i = 0; i < TEMP_BATCH - 1; i++) + tent_objects[i].next = &tent_objects[i + 1]; + tent_objects[i].next = 0; + } + tobj = tent_objects; + tent_objects = tobj->next; + tobj->next = 0; + return tobj; +} + +static void +free_tent_objects (tent_obj_t *tobjs) +{ + tent_obj_t **t = &tobjs; + + while (*t) + t = &(*t)->next; + *t = tent_objects; + tent_objects = tobjs; +} + void CL_ClearTEnts (void) { - int i; + tent_t *t; + tent_obj_t *to; - memset (&cl_beams, 0, sizeof (cl_beams)); - memset (&cl_explosions, 0, sizeof (cl_explosions)); - for (i = 0; i < MAX_BEAMS; i++) { - int j; - - for (j = 0; j < MAX_BEAM_ENTS; j++) { - CL_Init_Entity (&cl_beams[i].ent_list[j]); - } + for (to = cl_beams; to; to = to->next) { + for (t = to->to.beam.tents; t; t = t->next) + t->ent.efrag = 0; + free_temp_entities (to->to.beam.tents); } - for (i = 0; i < MAX_EXPLOSIONS; i++) { - CL_Init_Entity (&cl_explosions[i].ent); + free_tent_objects (cl_beams); + cl_beams = 0; + + for (to = cl_explosions; to; to = to->next) { + for (t = to->to.ex.tent; t; t = t->next) + t->ent.efrag = 0; + free_temp_entities (to->to.ex.tent); } - r_view_model = &cl.viewent; -} - -static explosion_t * -CL_AllocExplosion (void) -{ - float time; - int index, i; - - for (i = 0; i < MAX_EXPLOSIONS; i++) - if (!cl_explosions[i].ent.model) - return &cl_explosions[i]; - // find the oldest explosion - time = cl.time; - index = 0; - - for (i = 0; i < MAX_EXPLOSIONS; i++) - if (cl_explosions[i].start < time) { - time = cl_explosions[i].start; - index = i; - } - return &cl_explosions[index]; -} - -static beam_t * -beam_alloc (int ent) -{ - int i; - beam_t *b; - - // override any beam with the same entity - for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++) - if (b->entity == ent) - return b; - // find a free beam - for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++) - if (!b->model || b->endtime < cl.time) - return b; - Sys_Printf ("beam list overflow!\n"); - return 0; } static inline void beam_clear (beam_t *b) { - if (b->ent_count) { - entity_t *e = b->ent_list + b->ent_count; + if (b->tents) { + tent_t *t; - while (e != b->ent_list) - R_RemoveEfrags (e-- - 1); - b->ent_count = 0; + for (t = b->tents; t; t = t->next) { + R_RemoveEfrags (&t->ent); + t->ent.efrag = 0; + } + free_temp_entities (b->tents); + b->tents = 0; } } static inline void beam_setup (beam_t *b) { - entity_t *ent; + tent_t *tent; float forward, pitch, yaw, d; int ent_count; vec3_t dist, org; @@ -224,24 +269,25 @@ beam_setup (beam_t *b) d = VectorNormalize (dist); VectorScale (dist, 30, dist); ent_count = ceil (d / 30); - ent_count = min (ent_count, MAX_BEAM_ENTS); - b->ent_count = ent_count; d = 0; while (ent_count--) { - ent = &b->ent_list[ent_count]; - VectorMultAdd (org, d, dist, ent->origin); + tent = new_temp_entity (); + tent->next = b->tents; + b->tents = tent; + + VectorMultAdd (org, d, dist, tent->ent.origin); d += 1.0; - ent->model = b->model; - ent->angles[0] = pitch; - ent->angles[1] = yaw; - if (!ent->efrag) - R_AddEfrags (ent); + tent->ent.model = b->model; + tent->ent.angles[0] = pitch; + tent->ent.angles[1] = yaw; + R_AddEfrags (&tent->ent); } } static void CL_ParseBeam (model_t *m) { + tent_obj_t *to; beam_t *b; int ent; vec3_t start, end; @@ -251,30 +297,35 @@ CL_ParseBeam (model_t *m) MSG_ReadCoordV (net_message, start); MSG_ReadCoordV (net_message, end); - if ((b = beam_alloc (ent))) { - beam_clear (b); - b->entity = ent; - b->model = m; - b->endtime = cl.time + 0.2; - b->seed = rand (); - VectorCopy (end, b->end); - if (b->entity != cl.viewentity) { - // this will be done in CL_UpdateBeams - VectorCopy (start, b->start); - beam_setup (b); - } + to = new_tent_object (); + to->next = cl_beams; + cl_beams = to; + b = &to->to.beam; + b->tents = 0; + + beam_clear (b); + b->entity = ent; + b->model = m; + b->endtime = cl.time + 0.2; + b->seed = rand (); + VectorCopy (end, b->end); + if (b->entity != cl.viewentity) { + // this will be done in CL_UpdateBeams + VectorCopy (start, b->start); + beam_setup (b); } } void CL_ParseTEnt (void) { - byte type; + byte type; dlight_t *dl; - int colorStart, colorLength; + tent_obj_t *to; explosion_t *ex; - vec3_t col, pos; - sfx_t * spike_sound[] = { + int colorStart, colorLength; + vec3_t col, pos; + sfx_t *spike_sound[] = { cl_sfx_ric3, cl_sfx_ric3, cl_sfx_ric2, cl_sfx_ric1, }; @@ -346,18 +397,24 @@ CL_ParseTEnt (void) S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1); // sprite - ex = CL_AllocExplosion (); - VectorCopy (pos, ex->ent.origin); + to = new_tent_object (); + to->next = cl_explosions; + cl_explosions = to; + ex = &to->to.ex; + ex->tent = new_temp_entity (); + + VectorCopy (pos, ex->tent->ent.origin); ex->start = cl.time; //FIXME need better model management if (!cl_spr_explod->cache.data) cl_spr_explod = Mod_ForName ("progs/s_explod.spr", true); - ex->ent.model = cl_spr_explod; + ex->tent->ent.model = cl_spr_explod; break; case TE_TAREXPLOSION: // tarbaby explosion MSG_ReadCoordV (net_message, pos); R_BlobExplosion (pos); + S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1); break; @@ -439,24 +496,33 @@ CL_ParseTEnt (void) } } +#define BEAM_SEED_INTERVAL 72 +#define BEAM_SEED_PRIME 3191 + static void CL_UpdateBeams (void) { + tent_obj_t **to; beam_t *b; - entity_t **ent; - float forward, pitch, yaw, d; - int i; - vec3_t dist, org; + unsigned seed; + tent_t *t; // update lightning - for (i = 0, b = cl_beams; i < MAX_BEAMS; i++, b++) { + for (to = &cl_beams; *to; ) { + b = &(*to)->to.beam; if (!b->endtime) continue; if (!b->model || b->endtime < cl.time) { + tent_obj_t *_to; b->endtime = 0; beam_clear (b); + _to = *to; + *to = _to->next; + _to->next = tent_objects; + tent_objects = _to; continue; } + to = &(*to)->next; // if coming from the player, update the start position if (b->entity == cl.viewentity) { @@ -465,43 +531,13 @@ CL_UpdateBeams (void) beam_setup (b); } - // calculate pitch and yaw - VectorSubtract (b->end, b->start, dist); - - if (dist[1] == 0 && dist[0] == 0) { - yaw = 0; - if (dist[2] > 0) - pitch = 90; - else - pitch = 270; - } else { - yaw = (int) (atan2 (dist[1], dist[0]) * 180 / M_PI); - if (yaw < 0) - yaw += 360; - - forward = sqrt (dist[0] * dist[0] + dist[1] * dist[1]); - pitch = (int) (atan2 (dist[2], forward) * 180 / M_PI); - if (pitch < 0) - pitch += 360; - } + seed = b->seed + ((int) (cl.time * BEAM_SEED_INTERVAL) % + BEAM_SEED_INTERVAL); // add new entities for the lightning - VectorCopy (b->start, org); - d = VectorNormalize (dist); - b->ent_count = 0; - while (d > 0 && b->ent_count < MAX_BEAM_ENTS) { - ent = R_NewEntity (); - if (!ent) - return; - *ent = &b->ent_list[b->ent_count++]; - VectorCopy (org, (*ent)->origin); - (*ent)->model = b->model; - (*ent)->angles[0] = pitch; - (*ent)->angles[1] = yaw; - (*ent)->angles[2] = rand () % 360; - - VectorMultAdd(org, 30, dist, org); - d -= 30; + for (t = b->tents; t; t = t->next) { + seed = seed * BEAM_SEED_PRIME; + t->ent.angles[2] = seed % 360; } } } @@ -509,24 +545,31 @@ CL_UpdateBeams (void) static void CL_UpdateExplosions (void) { - entity_t **ent; + int f; + tent_obj_t **to; explosion_t *ex; - int f, i; + entity_t *ent; - for (i = 0, ex = cl_explosions; i < MAX_EXPLOSIONS; i++, ex++) { - if (!ex->ent.model) - continue; + for (to = &cl_explosions; *to; ) { + ex = &(*to)->to.ex; + ent = &ex->tent->ent; f = 10 * (cl.time - ex->start); - if (f >= ex->ent.model->numframes) { - ex->ent.model = NULL; + if (f >= ent->model->numframes) { + tent_obj_t *_to; + R_RemoveEfrags (ent); + ent->efrag = 0; + free_temp_entities (ex->tent); + _to = *to; + *to = _to->next; + _to->next = tent_objects; + tent_objects = _to; continue; } + to = &(*to)->next; - ent = R_NewEntity (); - if (!ent) - return; - ex->ent.frame = f; - *ent = &ex->ent; + ent->frame = f; + if (!ent->efrag) + R_AddEfrags (ent); } } diff --git a/qw/source/cl_tent.c b/qw/source/cl_tent.c index eb7a3adc2..50f301f54 100644 --- a/qw/source/cl_tent.c +++ b/qw/source/cl_tent.c @@ -62,8 +62,6 @@ typedef struct tent_s { #define TEMP_BATCH 64 static tent_t *temp_entities = 0; -#define MAX_BEAMS 8 - typedef struct { int entity; struct model_s *model; @@ -91,19 +89,19 @@ static tent_obj_t *tent_objects; static tent_obj_t *cl_beams; static tent_obj_t *cl_explosions; -static sfx_t *cl_sfx_wizhit; -static sfx_t *cl_sfx_knighthit; -static sfx_t *cl_sfx_tink1; -static sfx_t *cl_sfx_ric1; -static sfx_t *cl_sfx_ric2; -static sfx_t *cl_sfx_ric3; -static sfx_t *cl_sfx_r_exp3; +static sfx_t *cl_sfx_wizhit; +static sfx_t *cl_sfx_knighthit; +static sfx_t *cl_sfx_tink1; +static sfx_t *cl_sfx_ric1; +static sfx_t *cl_sfx_ric2; +static sfx_t *cl_sfx_ric3; +static sfx_t *cl_sfx_r_exp3; -static model_t *cl_mod_beam; -static model_t *cl_mod_bolt; -static model_t *cl_mod_bolt2; -static model_t *cl_mod_bolt3; -static model_t *cl_spr_explod; +static model_t *cl_mod_beam; +static model_t *cl_mod_bolt; +static model_t *cl_mod_bolt2; +static model_t *cl_mod_bolt3; +static model_t *cl_spr_explod; static void CL_TEnts_Precache (int phase) @@ -325,14 +323,14 @@ CL_ParseBeam (model_t *m) void CL_ParseTEnt (void) { - byte type; - dlight_t *dl; + byte type; + dlight_t *dl; tent_obj_t *to; explosion_t *ex; - int colorStart, colorLength; - int cnt = -1; - vec3_t pos; - sfx_t * spike_sound[] = { + int colorStart, colorLength; + int cnt = -1; + vec3_t pos; + sfx_t *spike_sound[] = { cl_sfx_ric3, cl_sfx_ric3, cl_sfx_ric2, cl_sfx_ric1, }; @@ -556,13 +554,13 @@ CL_UpdateBeams (void) static void CL_UpdateExplosions (void) { - int f; + int f; tent_obj_t **to; explosion_t *ex; + entity_t *ent; for (to = &cl_explosions; *to; ) { ex = &(*to)->to.ex; - entity_t *ent; ent = &ex->tent->ent; f = 10 * (cl.time - ex->start); if (f >= ent->model->numframes) { From 92f84e97a4cda04c65a7e863a699b762bf85ab6e Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 23 Nov 2010 12:48:53 +0900 Subject: [PATCH 102/115] Unlimited loaded models. --- libs/models/model.c | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/libs/models/model.c b/libs/models/model.c index cfce6e53c..78dd98411 100644 --- a/libs/models/model.c +++ b/libs/models/model.c @@ -52,9 +52,10 @@ static __attribute__ ((used)) const char rcsid[] = model_t *loadmodel; char *loadname; // for hunk tags -#define MAX_MOD_KNOWN 512 -model_t mod_known[MAX_MOD_KNOWN]; +#define MOD_BLOCK 16 // allocate 16 models at a time +model_t **mod_known; int mod_numknown; +int mod_maxknown; VISIBLE texture_t *r_notexture_mip; @@ -116,13 +117,13 @@ VISIBLE void Mod_ClearAll (void) { int i; - model_t *mod; + model_t **mod; for (i = 0, mod = mod_known; i < mod_numknown; i++, mod++) { - if (mod->type != mod_alias) - mod->needload = true; - if (mod->type == mod_sprite) - mod->cache.data = 0; + if ((*mod)->type != mod_alias) + (*mod)->needload = true; + if ((*mod)->type == mod_sprite) + (*mod)->cache.data = 0; } } @@ -130,26 +131,32 @@ model_t * Mod_FindName (const char *name) { int i; - model_t *mod; + model_t **mod; if (!name[0]) Sys_Error ("Mod_FindName: empty name"); // search the currently loaded models for (i = 0, mod = mod_known; i < mod_numknown; i++, mod++) - if (!strcmp (mod->name, name)) + if (!strcmp ((*mod)->name, name)) break; if (i == mod_numknown) { - if (mod_numknown == MAX_MOD_KNOWN) - Sys_Error ("mod_numknown == MAX_MOD_KNOWN"); - strcpy (mod->name, name); - mod->needload = true; + if (mod_numknown == mod_maxknown) { + mod_maxknown += MOD_BLOCK; + mod_known = realloc (mod_known, mod_maxknown * sizeof (model_t *)); + mod = mod_known + mod_numknown; + *mod = calloc (MOD_BLOCK, sizeof (model_t)); + for (i = 1; i < MOD_BLOCK; i++) + mod[i] = mod[0] + i; + } + strcpy ((*mod)->name, name); + (*mod)->needload = true; mod_numknown++; - Cache_Add (&mod->cache, mod, Mod_CallbackLoad); + Cache_Add (&(*mod)->cache, *mod, Mod_CallbackLoad); } - return mod; + return *mod; } static model_t * @@ -286,11 +293,11 @@ VISIBLE void Mod_Print (void) { int i; - model_t *mod; + model_t **mod; Sys_Printf ("Cached models:\n"); for (i = 0, mod = mod_known; i < mod_numknown; i++, mod++) { - Sys_Printf ("%8p : %s\n", mod->cache.data, mod->name); + Sys_Printf ("%8p : %s\n", (*mod)->cache.data, (*mod)->name); } } From 8c4fe2f8443b5a4015349a715d2b07725906da5e Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 23 Nov 2010 14:09:30 +0900 Subject: [PATCH 103/115] Rename Sys_DPrintf to Sys_MaskPrintf. We now have finer runtime control over what gets printed. Need to do a SYS_DEV audit, creating new masks as apropriate. --- include/QF/sys.h | 5 +- libs/audio/cd_linux.c | 41 +++++++------ libs/audio/cd_sdl.c | 11 ++-- libs/audio/cd_sgi.c | 18 +++--- libs/audio/cd_win.c | 33 ++++++----- libs/audio/cd_xmms.c | 2 +- libs/audio/renderer/flac.c | 6 +- libs/audio/renderer/midi.c | 2 +- libs/audio/renderer/snd_channels.c | 6 +- libs/audio/renderer/snd_mem.c | 8 +-- libs/audio/renderer/vorbis.c | 6 +- libs/audio/renderer/wav.c | 4 +- libs/audio/targets/snd_win.c | 2 +- libs/gamecode/engine/pr_builtins.c | 5 +- libs/gamecode/engine/pr_load.c | 2 +- libs/gib/gib_tree.c | 4 +- libs/image/tga.c | 2 +- libs/models/alias/gl_mesh.c | 6 +- libs/models/alias/gl_model_alias.c | 4 +- libs/models/brush/gl_model_brush.c | 7 ++- libs/models/gl_model_fullbright.c | 2 +- libs/models/model.c | 2 +- libs/models/trace.c | 2 +- libs/net/net_main.c | 4 +- libs/net/nm/net_dgrm.c | 10 ++-- libs/net/nm/net_udp.c | 2 +- libs/net/nm/net_wins.c | 2 +- libs/object/garbage.c | 12 ++-- libs/qw/msg_backbuf.c | 5 +- libs/ruamoko/rua_obj.c | 4 +- libs/util/cmd.c | 3 +- libs/util/cvar.c | 8 ++- libs/util/plugin.c | 7 ++- libs/util/quakefs.c | 46 ++++++++------- libs/util/sys.c | 4 +- libs/util/zone.c | 12 ++-- libs/video/renderer/gl/gl_draw.c | 5 +- libs/video/renderer/gl/gl_dyn_part.c | 16 +++-- libs/video/renderer/gl/gl_mod_alias.c | 13 +++-- libs/video/renderer/gl/gl_mod_sprite.c | 5 +- libs/video/renderer/gl/gl_rmain.c | 8 +-- libs/video/renderer/gl/gl_rmisc.c | 2 +- libs/video/renderer/gl/gl_screen.c | 6 +- libs/video/renderer/gl/gl_skin.c | 4 +- libs/video/renderer/gl/gl_sky.c | 4 +- libs/video/renderer/r_progs.c | 2 +- libs/video/renderer/sw/d_surf.c | 2 +- libs/video/renderer/sw/sw_ralias.c | 8 ++- libs/video/renderer/sw/sw_rpart.c | 3 +- libs/video/renderer/sw32/d_surf.c | 2 +- libs/video/renderer/sw32/sw32_ralias.c | 8 ++- libs/video/renderer/sw32/sw32_rpart.c | 3 +- libs/video/targets/context_x11.c | 17 +++--- libs/video/targets/dga_check.c | 13 +++-- libs/video/targets/in_common.c | 2 +- libs/video/targets/in_svgalib.c | 13 +++-- libs/video/targets/in_win.c | 5 +- libs/video/targets/in_x11.c | 2 +- libs/video/targets/joy.c | 6 +- libs/video/targets/joy_linux.c | 4 +- libs/video/targets/qfgl_ext.c | 6 +- libs/video/targets/vid.c | 4 +- libs/video/targets/vid_3dfxsvga.c | 11 ++-- libs/video/targets/vid_common_gl.c | 81 ++++++++++++++------------ libs/video/targets/vid_fbdev.c | 2 +- libs/video/targets/vid_glx.c | 5 +- libs/video/targets/vid_sgl.c | 3 +- libs/video/targets/vid_svgalib.c | 2 +- libs/video/targets/vid_x11.c | 38 +++++++----- nq/source/cl_main.c | 9 +-- nq/source/cl_parse.c | 2 +- nq/source/host.c | 4 +- nq/source/sv_cl_phys.c | 8 +-- nq/source/sv_main.c | 7 ++- nq/source/sv_progs.c | 2 +- nq/source/sv_user.c | 3 +- qtv/source/client.c | 11 ++-- qw/source/cl_ents.c | 8 +-- qw/source/cl_main.c | 14 +++-- qw/source/cl_parse.c | 31 +++++----- qw/source/crudefile.c | 4 +- qw/source/pmove.c | 2 +- qw/source/sv_init.c | 4 +- qw/source/sv_main.c | 7 ++- qw/source/sv_pr_cmds.c | 2 +- qw/source/sv_progs.c | 2 +- qw/source/sv_qtv.c | 3 +- qw/source/sv_user.c | 13 +++-- 88 files changed, 409 insertions(+), 331 deletions(-) diff --git a/include/QF/sys.h b/include/QF/sys.h index 888d2d3d6..4b5cd6b44 100644 --- a/include/QF/sys.h +++ b/include/QF/sys.h @@ -69,7 +69,6 @@ void Sys_SetErrPrintf (sys_printf_t func); void Sys_Print (FILE *stream, const char *fmt, va_list args); void Sys_Printf (const char *fmt, ...) __attribute__((format(printf,1,2))); -void Sys_DPrintf (const char *fmt, ...) __attribute__((format(printf,1,2))); void Sys_Error (const char *error, ...) __attribute__((format(printf,1,2), noreturn)); void Sys_Quit (void) __attribute__((noreturn)); void Sys_Shutdown (void); @@ -77,6 +76,10 @@ void Sys_RegisterShutdown (void (*func) (void)); double Sys_DoubleTime (void); void Sys_TimeOfDay(date_t *date); +void Sys_MaskPrintf (int mask, const char *fmt, ...) __attribute__((format(printf,2,3))); +#define SYS_DEV 1 +#define SYS_WARN 3 // bit 0 so developer 1 will pick it up + int Sys_CheckInput (int idle, int net_socket); const char *Sys_ConsoleInput (void); diff --git a/libs/audio/cd_linux.c b/libs/audio/cd_linux.c index 8ff8d0e7b..aeae950fd 100644 --- a/libs/audio/cd_linux.c +++ b/libs/audio/cd_linux.c @@ -89,7 +89,7 @@ I_CDAudio_CloseDoor (void) return; // no cd init'd if (ioctl (cdfile, CDROMCLOSETRAY) == -1) - Sys_DPrintf ("CDAudio: ioctl cdromclosetray failed\n"); + Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromclosetray failed\n"); } static void @@ -99,7 +99,7 @@ I_CDAudio_Eject (void) return; // no cd init'd if (ioctl (cdfile, CDROMEJECT) == -1) - Sys_DPrintf ("CDAudio: ioctl cdromeject failed\n"); + Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromeject failed\n"); } static int @@ -110,12 +110,12 @@ I_CDAudio_GetAudioDiskInfo (void) cdValid = false; if (ioctl (cdfile, CDROMREADTOCHDR, &tochdr) == -1) { - Sys_DPrintf ("CDAudio: ioctl cdromreadtochdr failed\n"); + Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromreadtochdr failed\n"); return -1; } if (tochdr.cdth_trk0 < 1) { - Sys_DPrintf ("CDAudio: no music tracks\n"); + Sys_MaskPrintf (SYS_DEV, "CDAudio: no music tracks\n"); return -1; } @@ -135,7 +135,7 @@ I_CDAudio_Pause (void) return; if (ioctl (cdfile, CDROMPAUSE) == -1) - Sys_DPrintf ("CDAudio: ioctl cdrompause failed\n"); + Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdrompause failed\n"); wasPlaying = playing; playing = false; @@ -151,7 +151,8 @@ I_CDAudio_Stop (void) return; if (ioctl (cdfile, CDROMSTOP) == -1) - Sys_DPrintf ("CDAudio: ioctl cdromstop failed (%d)\n", errno); + Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromstop failed (%d)\n", + errno); wasPlaying = false; playing = false; @@ -188,7 +189,7 @@ I_CDAudio_Play (int track, qboolean looping) entry0.cdte_track = track; entry0.cdte_format = CDROM_MSF; if (ioctl (cdfile, CDROMREADTOCENTRY, &entry0) == -1) { - Sys_DPrintf ("CDAudio: ioctl cdromreadtocentry failed\n"); + Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromreadtocentry failed\n"); return; } entry1.cdte_track = track + 1; @@ -197,7 +198,7 @@ I_CDAudio_Play (int track, qboolean looping) entry1.cdte_track = CDROM_LEADOUT; } if (ioctl (cdfile, CDROMREADTOCENTRY, &entry1) == -1) { - Sys_DPrintf ("CDAudio: ioctl cdromreadtocentry failed\n"); + Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromreadtocentry failed\n"); return; } if (entry0.cdte_ctrl == CDROM_DATA_TRACK) { @@ -219,15 +220,16 @@ I_CDAudio_Play (int track, qboolean looping) msf.cdmsf_sec1 = entry1.cdte_addr.msf.second; msf.cdmsf_frame1 = entry1.cdte_addr.msf.frame; - Sys_DPrintf ("%2d:%02d:%02d %2d:%02d:%02d\n", - msf.cdmsf_min0, - msf.cdmsf_sec0, - msf.cdmsf_frame0, - msf.cdmsf_min1, msf.cdmsf_sec1, msf.cdmsf_frame1); + Sys_MaskPrintf (SYS_DEV, "%2d:%02d:%02d %2d:%02d:%02d\n", + msf.cdmsf_min0, + msf.cdmsf_sec0, + msf.cdmsf_frame0, + msf.cdmsf_min1, msf.cdmsf_sec1, msf.cdmsf_frame1); if (ioctl (cdfile, CDROMPLAYMSF, &msf) == -1) { - Sys_DPrintf ("CDAudio: ioctl cdromplaytrkind failed (%s)\n", - strerror (errno)); + Sys_MaskPrintf (SYS_DEV, + "CDAudio: ioctl cdromplaytrkind failed (%s)\n", + strerror (errno)); return; } @@ -252,7 +254,7 @@ I_CDAudio_Resume (void) return; if (ioctl (cdfile, CDROMRESUME) == -1) - Sys_DPrintf ("CDAudio: ioctl cdromresume failed\n"); + Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromresume failed\n"); playing = true; } @@ -397,7 +399,7 @@ I_CDAudio_Update (void) lastchk = time (NULL) + 2; // two seconds between chks subchnl.cdsc_format = CDROM_MSF; if (ioctl (cdfile, CDROMSUBCHNL, &subchnl) == -1) { - Sys_DPrintf ("CDAudio: ioctl cdromsubchnl failed\n"); + Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromsubchnl failed\n"); playing = false; return; } @@ -422,8 +424,9 @@ Mus_CDChange (cvar_t *mus_cdaudio) cdfile = open (mus_cdaudio->string, O_RDONLY | O_NONBLOCK); if (cdfile == -1) { - Sys_DPrintf ("Mus_CDInit: open of device \"%s\" failed (error %i)\n", - mus_cdaudio->string, errno); + Sys_MaskPrintf (SYS_DEV, + "Mus_CDInit: open device \"%s\" failed (error %i)\n", + mus_cdaudio->string, errno); return; } diff --git a/libs/audio/cd_sdl.c b/libs/audio/cd_sdl.c index 98d8d46ad..e24e0cc3a 100644 --- a/libs/audio/cd_sdl.c +++ b/libs/audio/cd_sdl.c @@ -75,7 +75,7 @@ I_CDAudio_Eject (void) return; if (SDL_CDEject (cd_id)) - Sys_DPrintf ("Unable to eject CD-ROM tray.\n"); + Sys_MaskPrintf (SYS_DEV, "Unable to eject CD-ROM tray.\n"); } static void @@ -87,7 +87,7 @@ I_CDAudio_Pause (void) return; if (SDL_CDPause (cd_id)) - Sys_DPrintf ("CDAudio_Pause: Failed to pause track.\n"); + Sys_MaskPrintf (SYS_DEV, "CDAudio_Pause: Failed to pause track.\n"); } static void @@ -102,7 +102,7 @@ I_CDAudio_Stop (void) return; if (SDL_CDStop (cd_id)) - Sys_DPrintf ("CDAudio_Stop: Failed to stop track.\n"); + Sys_MaskPrintf (SYS_DEV, "CDAudio_Stop: Failed to stop track.\n"); } static void @@ -135,7 +135,8 @@ I_CDAudio_Play (int track, qboolean looping) if (SDL_CDPlay (cd_id, cd_id->track[track].offset, cd_id->track[track].length)) { - Sys_DPrintf ("CDAudio_Play: Unable to play track: %d\n", track + 1); + Sys_MaskPrintf (SYS_DEV, "CDAudio_Play: Unable to play track: %d\n", + track + 1); return; } playLooping = looping; @@ -150,7 +151,7 @@ I_CDAudio_Resume (void) return; if (SDL_CDResume (cd_id)) - Sys_DPrintf ("CDAudio_Resume: Failed tp resume track.\n"); + Sys_MaskPrintf (SYS_DEV, "CDAudio_Resume: Failed tp resume track.\n"); } static void diff --git a/libs/audio/cd_sgi.c b/libs/audio/cd_sgi.c index 64e681723..9209dd563 100644 --- a/libs/audio/cd_sgi.c +++ b/libs/audio/cd_sgi.c @@ -73,7 +73,7 @@ I_SGI_Eject (void) return; // no cd init'd if (CDeject (cdp) == 0) - Sys_DPrintf ("I_SGI_Eject: CDeject failed\n"); + Sys_MaskPrintf (SYS_DEV, "I_SGI_Eject: CDeject failed\n"); } static int @@ -85,7 +85,7 @@ I_SGI_GetState (void) return -1; // no cd init'd if (CDgetstatus (cdp, &cds) == 0) { - Sys_DPrintf ("CDAudio_GetStatus: CDgetstatus failed\n"); + Sys_MaskPrintf (SYS_DEV, "CDAudio_GetStatus: CDgetstatus failed\n"); return -1; } @@ -101,7 +101,7 @@ I_SGI_MaxTrack (void) return -1; // no cd init'd if (CDgetstatus (cdp, &cds) == 0) { - Sys_DPrintf ("I_SGI_MaxTrack: CDgetstatus failed\n"); + Sys_MaskPrintf (SYS_DEV, "I_SGI_MaxTrack: CDgetstatus failed\n"); return -1; } @@ -115,7 +115,7 @@ I_SGI_Pause (void) return; if (CDtogglepause (cdp) == 0) - Sys_DPrintf ("CDAudio_PAUSE: CDtogglepause failed (%d)\n", errno); + Sys_MaskPrintf (SYS_DEV, "CDAudio_PAUSE: CDtogglepause failed (%d)\n", errno); } void @@ -133,7 +133,8 @@ I_SGI_Play (int track, qboolean looping) } if (maxtrack < 0) { - Sys_DPrintf ("CDAudio_Play: Error getting maximum track number\n"); + Sys_MaskPrintf (SYS_DEV, + "CDAudio_Play: Error getting maximum track number\n"); return; } @@ -172,7 +173,7 @@ I_SGI_Play (int track, qboolean looping) } if (CDplaytrack (cdp, track, cdvolume == 0.0 ? 0 : 1) == 0) { - Sys_DPrintf ("CDAudio_Play: CDplay failed (%d)\n", errno); + Sys_MaskPrintf (SYS_DEV, "CDAudio_Play: CDplay failed (%d)\n", errno); return; } @@ -187,7 +188,8 @@ I_SGI_Resume (void) return; if (CDtogglepause (cdp) == 0) - Sys_DPrintf ("CDAudio_Resume: CDtogglepause failed (%d)\n", errno); + Sys_MaskPrintf (SYS_DEV, "CDAudio_Resume: CDtogglepause failed (%d)\n", + errno); } void @@ -209,7 +211,7 @@ I_SGI_Stop (void) return; if (CDstop (cdp) == 0) - Sys_DPrintf ("I_SGI_Stop: CDStop failed (%d)\n", errno); + Sys_MaskPrintf (SYS_DEV, "I_SGI_Stop: CDStop failed (%d)\n", errno); } void diff --git a/libs/audio/cd_win.c b/libs/audio/cd_win.c index 017be873f..c1bfd0a36 100644 --- a/libs/audio/cd_win.c +++ b/libs/audio/cd_win.c @@ -77,7 +77,8 @@ I_CDAudio_CloseDoor (void) dwReturn = mciSendCommand (wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (DWORD_PTR) NULL); if (dwReturn) { - Sys_DPrintf ("MCI_SET_DOOR_CLOSED failed (%li)\n", dwReturn); + Sys_MaskPrintf (SYS_DEV, "MCI_SET_DOOR_CLOSED failed (%li)\n", + dwReturn); } } @@ -89,7 +90,7 @@ I_CDAudio_Eject (void) dwReturn = mciSendCommand (wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, (DWORD_PTR) NULL); if (dwReturn) { - Sys_DPrintf ("MCI_SET_DOOR_OPEN failed (%li)\n", dwReturn); + Sys_MaskPrintf (SYS_DEV, "MCI_SET_DOOR_OPEN failed (%li)\n", dwReturn); } } @@ -106,11 +107,12 @@ I_CDAudio_GetAudioDiskInfo (void) mciSendCommand (wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD_PTR) (LPVOID) & mciStatusParms); if (dwReturn) { - Sys_DPrintf ("CDAudio: drive ready test - get status failed\n"); + Sys_MaskPrintf (SYS_DEV, + "CDAudio: drive ready test - get status failed\n"); return -1; } if (!mciStatusParms.dwReturn) { - Sys_DPrintf ("CDAudio: drive not ready\n"); + Sys_MaskPrintf (SYS_DEV, "CDAudio: drive not ready\n"); return -1; } @@ -119,11 +121,11 @@ I_CDAudio_GetAudioDiskInfo (void) mciSendCommand (wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT, (DWORD_PTR) (LPVOID) & mciStatusParms); if (dwReturn) { - Sys_DPrintf ("CDAudio: get tracks - status failed\n"); + Sys_MaskPrintf (SYS_DEV, "CDAudio: get tracks - status failed\n"); return -1; } if (mciStatusParms.dwReturn < 1) { - Sys_DPrintf ("CDAudio: no music tracks\n"); + Sys_MaskPrintf (SYS_DEV, "CDAudio: no music tracks\n"); return -1; } @@ -154,13 +156,14 @@ static I_CDAudio_MessageHandler (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPa break; case MCI_NOTIFY_FAILURE: - Sys_DPrintf ("MCI_NOTIFY_FAILURE\n"); + Sys_MaskPrintf (SYS_DEV, "MCI_NOTIFY_FAILURE\n"); I_CDAudio_Stop (); cdValid = false; break; default: - Sys_DPrintf ("Unexpected MM_MCINOTIFY type (%i)\n", wParam); + Sys_MaskPrintf (SYS_DEV, "Unexpected MM_MCINOTIFY type (%i)\n", + wParam); return 1; } @@ -184,7 +187,7 @@ I_CDAudio_Pause (void) mciSendCommand (wDeviceID, MCI_PAUSE, 0, (DWORD_PTR) (LPVOID) & mciGenericParms); if (dwReturn) { - Sys_DPrintf ("MCI_PAUSE failed (%li)", dwReturn); + Sys_MaskPrintf (SYS_DEV, "MCI_PAUSE failed (%li)", dwReturn); } wasPlaying = playing; @@ -225,7 +228,7 @@ I_CDAudio_Play (int track, qboolean looping) MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (DWORD_PTR) (LPVOID) & mciStatusParms); if (dwReturn) { - Sys_DPrintf ("MCI_STATUS failed (%li)\n", dwReturn); + Sys_MaskPrintf (SYS_DEV, "MCI_STATUS failed (%li)\n", dwReturn); return; } if (mciStatusParms.dwReturn != MCI_CDA_TRACK_AUDIO) { @@ -240,7 +243,7 @@ I_CDAudio_Play (int track, qboolean looping) MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, (DWORD_PTR) (LPVOID) & mciStatusParms); if (dwReturn) { - Sys_DPrintf ("MCI_STATUS failed (%li)\n", dwReturn); + Sys_MaskPrintf (SYS_DEV, "MCI_STATUS failed (%li)\n", dwReturn); return; } @@ -257,7 +260,7 @@ I_CDAudio_Play (int track, qboolean looping) mciSendCommand (wDeviceID, MCI_PLAY, MCI_NOTIFY | MCI_FROM | MCI_TO, (DWORD_PTR) (LPVOID) & mciPlayParms); if (dwReturn) { - Sys_DPrintf ("CDAudio: MCI_PLAY failed (%li)\n", dwReturn); + Sys_MaskPrintf (SYS_DEV, "CDAudio: MCI_PLAY failed (%li)\n", dwReturn); return; } @@ -289,7 +292,7 @@ I_CDAudio_Resume (void) mciSendCommand (wDeviceID, MCI_PLAY, MCI_TO | MCI_NOTIFY, (DWORD_PTR) (LPVOID) & mciPlayParms); if (dwReturn) { - Sys_DPrintf ("CDAudio: MCI_PLAY failed (%li)\n", dwReturn); + Sys_MaskPrintf (SYS_DEV, "CDAudio: MCI_PLAY failed (%li)\n", dwReturn); return; } playing = true; @@ -302,7 +305,7 @@ I_CDAudio_Shutdown (void) return; I_CDAudio_Stop (); if (mciSendCommand (wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD_PTR) NULL)) - Sys_DPrintf ("CDAudio_Shutdown: MCI_CLOSE failed\n"); + Sys_MaskPrintf (SYS_DEV, "CDAudio_Shutdown: MCI_CLOSE failed\n"); } static void @@ -317,7 +320,7 @@ I_CDAudio_Stop (void) dwReturn = mciSendCommand (wDeviceID, MCI_STOP, 0, (DWORD_PTR) NULL); if (dwReturn) { - Sys_DPrintf ("MCI_STOP failed (%li)", dwReturn); + Sys_MaskPrintf (SYS_DEV, "MCI_STOP failed (%li)", dwReturn); } wasPlaying = false; diff --git a/libs/audio/cd_xmms.c b/libs/audio/cd_xmms.c index 64eb152ea..c9ed2126f 100644 --- a/libs/audio/cd_xmms.c +++ b/libs/audio/cd_xmms.c @@ -152,7 +152,7 @@ I_XMMS_Running (void) break; case -1: // ICH! // inform user - Sys_DPrintf ("XMMSAudio: error, can't fork!?\n"); + Sys_MaskPrintf (SYS_DEV, "XMMSAudio: error, can't fork!?\n"); break; default: // Parent // don't need now :/ diff --git a/libs/audio/renderer/flac.c b/libs/audio/renderer/flac.c index 708ada4bc..1302e8ece 100644 --- a/libs/audio/renderer/flac.c +++ b/libs/audio/renderer/flac.c @@ -412,7 +412,7 @@ flac_get_info (flacfile_t *ff) vc = &ff->vorbis_info->data.vorbis_comment; for (i = 0, ve = vc->comments; i < vc->num_comments; ve++, i++) { - Sys_DPrintf ("%.*s\n", ve->length, ve->entry); + Sys_MaskPrintf (SYS_DEV, "%.*s\n", ve->length, ve->entry); if (strncmp ("CUEPOINT=", (char *) ve->entry, 9) == 0) { char *str = alloca (ve->length + 1); strncpy (str, (char *) ve->entry, ve->length); @@ -463,10 +463,10 @@ SND_LoadFLAC (QFile *file, sfx_t *sfx, char *realname) return -1; } if (info.frames / info.rate < 3) { - Sys_DPrintf ("cache %s\n", realname); + Sys_MaskPrintf (SYS_DEV, "cache %s\n", realname); flac_cache (sfx, realname, ff, info); } else { - Sys_DPrintf ("stream %s\n", realname); + Sys_MaskPrintf (SYS_DEV, "stream %s\n", realname); flac_stream (sfx, realname, ff, info); } return 0; diff --git a/libs/audio/renderer/midi.c b/libs/audio/renderer/midi.c index c2698aac2..fc9f2fbf4 100644 --- a/libs/audio/renderer/midi.c +++ b/libs/audio/renderer/midi.c @@ -198,7 +198,7 @@ SND_LoadMidi (QFile *file, sfx_t *sfx, char *realname) WildMidi_Close (handle); - Sys_DPrintf ("stream %s\n", realname); + Sys_MaskPrintf (SYS_DEV, "stream %s\n", realname); // we init stream here cause we will only ever stream SND_SFX_Stream (sfx, realname, info, midi_stream_open); diff --git a/libs/audio/renderer/snd_channels.c b/libs/audio/renderer/snd_channels.c index 0c10c4f0b..8b2df1a62 100644 --- a/libs/audio/renderer/snd_channels.c +++ b/libs/audio/renderer/snd_channels.c @@ -149,7 +149,7 @@ SND_ScanChannels (int wait) return; if (wait) { - Sys_DPrintf ("scanning channels...\n"); + Sys_MaskPrintf (SYS_DEV, "scanning channels...\n"); do { count = 0; for (i = 0; i < MAX_CHANNELS; i++) { @@ -159,12 +159,12 @@ SND_ScanChannels (int wait) ch->stop = 1; count++; } - Sys_DPrintf ("count = %d\n", count); + Sys_MaskPrintf (SYS_DEV, "count = %d\n", count); #ifdef HAVE_USLEEP usleep (1000); #endif } while (count); - Sys_DPrintf ("scanning done.\n"); + Sys_MaskPrintf (SYS_DEV, "scanning done.\n"); } else { for (i = 0; i < MAX_CHANNELS; i++) { ch = &snd_channels[i]; diff --git a/libs/audio/renderer/snd_mem.c b/libs/audio/renderer/snd_mem.c index c310f6611..d211948dc 100644 --- a/libs/audio/renderer/snd_mem.c +++ b/libs/audio/renderer/snd_mem.c @@ -324,7 +324,7 @@ SND_Load (sfx_t *sfx) Qseek (file, 0, SEEK_SET); #ifdef HAVE_VORBIS if (strnequal ("OggS", buf, 4)) { - Sys_DPrintf ("SND_Load: ogg file\n"); + Sys_MaskPrintf (SYS_DEV, "SND_Load: ogg file\n"); if (SND_LoadOgg (file, sfx, realname) == -1) goto bail; return 0; @@ -332,7 +332,7 @@ SND_Load (sfx_t *sfx) #endif #ifdef HAVE_FLAC if (strnequal ("fLaC", buf, 4)) { - Sys_DPrintf ("SND_Load: flac file\n"); + Sys_MaskPrintf (SYS_DEV, "SND_Load: flac file\n"); if (SND_LoadFLAC (file, sfx, realname) == -1) goto bail; return 0; @@ -340,14 +340,14 @@ SND_Load (sfx_t *sfx) #endif #ifdef HAVE_WILDMIDI if (strnequal ("MThd", buf, 4)) { - Sys_DPrintf ("SND_Load: midi file\n"); + Sys_MaskPrintf (SYS_DEV, "SND_Load: midi file\n"); if (SND_LoadMidi (file, sfx, realname) == -1) goto bail; return 0; } #endif if (strnequal ("RIFF", buf, 4)) { - Sys_DPrintf ("SND_Load: wav file\n"); + Sys_MaskPrintf (SYS_DEV, "SND_Load: wav file\n"); if (SND_LoadWav (file, sfx, realname) == -1) goto bail; return 0; diff --git a/libs/audio/renderer/vorbis.c b/libs/audio/renderer/vorbis.c index ce2588920..cb0ba357b 100644 --- a/libs/audio/renderer/vorbis.c +++ b/libs/audio/renderer/vorbis.c @@ -103,7 +103,7 @@ vorbis_get_info (OggVorbis_File *vf) samples = ov_pcm_total (vf, -1); for (ptr = ov_comment (vf, -1)->user_comments; *ptr; ptr++) { - Sys_DPrintf ("%s\n", *ptr); + Sys_MaskPrintf (SYS_DEV, "%s\n", *ptr); if (strncmp ("CUEPOINT=", *ptr, 9) == 0) { sscanf (*ptr + 9, "%d %d", &sample_start, &sample_count); } @@ -304,10 +304,10 @@ SND_LoadOgg (QFile *file, sfx_t *sfx, char *realname) return -1; } if (info.frames / info.rate < 3) { - Sys_DPrintf ("cache %s\n", realname); + Sys_MaskPrintf (SYS_DEV, "cache %s\n", realname); vorbis_cache (sfx, realname, &vf, info); } else { - Sys_DPrintf ("stream %s\n", realname); + Sys_MaskPrintf (SYS_DEV, "stream %s\n", realname); vorbis_stream (sfx, realname, &vf, info); } return 0; diff --git a/libs/audio/renderer/wav.c b/libs/audio/renderer/wav.c index 1f94daf87..4cbea5be3 100644 --- a/libs/audio/renderer/wav.c +++ b/libs/audio/renderer/wav.c @@ -280,10 +280,10 @@ SND_LoadWav (QFile *file, sfx_t *sfx, char *realname) } if (info.frames / info.rate < 3) { - Sys_DPrintf ("cache %s\n", realname); + Sys_MaskPrintf (SYS_DEV, "cache %s\n", realname); wav_cache (sfx, realname, file, info); } else { - Sys_DPrintf ("stream %s\n", realname); + Sys_MaskPrintf (SYS_DEV, "stream %s\n", realname); wav_stream (sfx, realname, file, info); } return 0; diff --git a/libs/audio/targets/snd_win.c b/libs/audio/targets/snd_win.c index db98a6ac9..ec2a414e5 100644 --- a/libs/audio/targets/snd_win.c +++ b/libs/audio/targets/snd_win.c @@ -315,7 +315,7 @@ SNDDMA_Submit (void) // find which sound blocks have completed while (1) { if (snd_completed == snd_sent) { - Sys_DPrintf ("Sound overrun\n"); + Sys_MaskPrintf (SYS_DEV, "Sound overrun\n"); break; } diff --git a/libs/gamecode/engine/pr_builtins.c b/libs/gamecode/engine/pr_builtins.c index 2590c4740..952ad3e79 100644 --- a/libs/gamecode/engine/pr_builtins.c +++ b/libs/gamecode/engine/pr_builtins.c @@ -206,8 +206,9 @@ PR_RelocateBuiltins (progs_t *pr) ind = pr->bi_map (pr, ind); bi = PR_FindBuiltinNum (pr, ind); if (!bi || !(proc = bi->proc)) { - Sys_DPrintf ("WARNING: Bad builtin call number: %s = #%d\n", - bi_name, -desc->first_statement); + Sys_MaskPrintf (SYS_DEV, + "WARNING: Bad builtin call number: %s = #%d\n", + bi_name, -desc->first_statement); proc = bi_no_function; } func->first_statement = desc->first_statement; diff --git a/libs/gamecode/engine/pr_load.c b/libs/gamecode/engine/pr_load.c index 34e57e51a..58042e70e 100644 --- a/libs/gamecode/engine/pr_load.c +++ b/libs/gamecode/engine/pr_load.c @@ -161,7 +161,7 @@ PR_LoadProgsFile (progs_t *pr, QFile *file, int size, int edicts, int zone) // size of progs themselves pr->progs_size = size + offset_tweak; - Sys_DPrintf ("Programs occupy %iK.\n", size / 1024); + Sys_MaskPrintf (SYS_DEV, "Programs occupy %iK.\n", size / 1024); // round off to next highest whole word address (esp for Alpha) // this ensures that pointers in the engine data area are always // properly aligned diff --git a/libs/gib/gib_tree.c b/libs/gib/gib_tree.c index 9bbde67f2..2bdb8a632 100644 --- a/libs/gib/gib_tree.c +++ b/libs/gib/gib_tree.c @@ -75,13 +75,13 @@ void GIB_Tree_Ref (gib_tree_t ** tp) { (*tp)->refs++; -// Sys_DPrintf ("Ref: %p %u\n", *tp, (*tp)->refs); +// Sys_MaskPrintf (SYS_DEV, "Ref: %p %u\n", *tp, (*tp)->refs); } void GIB_Tree_Unref (gib_tree_t ** tp) { -// Sys_DPrintf ("Unref: %p %u\n", *tp, (*tp)->refs - 1); +// Sys_MaskPrintf (SYS_DEV, "Unref: %p %u\n", *tp, (*tp)->refs - 1); if (!(--(*tp)->refs)) { GIB_Tree_Free_Recursive (*tp); *tp = 0; diff --git a/libs/image/tga.c b/libs/image/tga.c index 6538e2688..12f647004 100644 --- a/libs/image/tga.c +++ b/libs/image/tga.c @@ -235,7 +235,7 @@ skip_colormap (TargaHeader *targa, byte *data) int bpe; if (!targa->colormap_type) return data; - Sys_DPrintf ("LoadTGA: skipping colormap\n"); + Sys_MaskPrintf (SYS_DEV, "LoadTGA: skipping colormap\n"); bpe = (targa->pixel_size +7) / 8; return data + bpe * targa->colormap_length; } diff --git a/libs/models/alias/gl_mesh.c b/libs/models/alias/gl_mesh.c index df48b1287..ada16b9f1 100644 --- a/libs/models/alias/gl_mesh.c +++ b/libs/models/alias/gl_mesh.c @@ -322,8 +322,8 @@ BuildTris (void) add_command (0); // end of list marker - Sys_DPrintf ("%3i tri %3i vert %3i cmd\n", pheader->mdl.numtris, numorder, - numcommands); + Sys_MaskPrintf (SYS_DEV, "%3i tri %3i vert %3i cmd\n", + pheader->mdl.numtris, numorder, numcommands); allverts += numorder; alltris += pheader->mdl.numtris; @@ -434,7 +434,7 @@ Mod_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m, int _s, i } if (remesh) { // build it from scratch - Sys_DPrintf ("meshing %s...\n", m->name); + Sys_MaskPrintf (SYS_DEV, "meshing %s...\n", m->name); BuildTris (); // trifans or lists diff --git a/libs/models/alias/gl_model_alias.c b/libs/models/alias/gl_model_alias.c index 1d7aa531d..482daee97 100644 --- a/libs/models/alias/gl_model_alias.c +++ b/libs/models/alias/gl_model_alias.c @@ -102,8 +102,8 @@ Mod_FloodFillSkin (byte * skin, int skinwidth, int skinheight) } // can't fill to filled color or transparent color (used as visited marker) if ((fillcolor == filledcolor) || (fillcolor == 255)) { - Sys_DPrintf ("not filling skin from %d to %d\n", - fillcolor, filledcolor); + Sys_MaskPrintf (SYS_DEV, "not filling skin from %d to %d\n", + fillcolor, filledcolor); return; } diff --git a/libs/models/brush/gl_model_brush.c b/libs/models/brush/gl_model_brush.c index 78a73d3b6..d5a261872 100644 --- a/libs/models/brush/gl_model_brush.c +++ b/libs/models/brush/gl_model_brush.c @@ -157,13 +157,14 @@ Mod_LoadLighting (bsp_t *bsp) && data[3] == 'T') { ver = LittleLong (((int32_t *) data)[1]); if (ver == 1) { - Sys_DPrintf ("%s loaded", litfilename->str); + Sys_MaskPrintf (SYS_DEV, "%s loaded", litfilename->str); loadmodel->lightdata = data + 8; return; } else - Sys_DPrintf ("Unknown .lit file version (%d)\n", ver); + Sys_MaskPrintf (SYS_DEV, + "Unknown .lit file version (%d)\n", ver); } else - Sys_DPrintf ("Corrupt .lit file (old version?), ignoring\n"); + Sys_MaskPrintf (SYS_DEV, "Corrupt .lit file (old version?)\n"); } } // LordHavoc: oh well, expand the white lighting data diff --git a/libs/models/gl_model_fullbright.c b/libs/models/gl_model_fullbright.c index 3c0f24165..6a86bb08c 100644 --- a/libs/models/gl_model_fullbright.c +++ b/libs/models/gl_model_fullbright.c @@ -76,7 +76,7 @@ Mod_Fullbright (byte *skin, int width, int height, char *name) // Check for fullbright pixels if (Mod_CalcFullbright (skin, ptexels, pixels)) { - Sys_DPrintf ("FB Model ID: '%s'\n", name); + Sys_MaskPrintf (SYS_DEV, "FB Model ID: '%s'\n", name); texnum = GL_LoadTexture (name, width, height, ptexels, true, true, 1); } diff --git a/libs/models/model.c b/libs/models/model.c index 78dd98411..a7d852145 100644 --- a/libs/models/model.c +++ b/libs/models/model.c @@ -272,7 +272,7 @@ Mod_ForName (const char *name, qboolean crash) mod = Mod_FindName (name); - Sys_DPrintf ("Mod_ForName: %s, %p\n", name, mod); + Sys_MaskPrintf (SYS_DEV, "Mod_ForName: %s, %p\n", name, mod); return Mod_LoadModel (mod, crash); } diff --git a/libs/models/trace.c b/libs/models/trace.c index 1ca6b3e8e..d14cd027d 100644 --- a/libs/models/trace.c +++ b/libs/models/trace.c @@ -205,7 +205,7 @@ MOD_TraceLine (hull_t *hull, int num, frac = (start_dist + offset) / (start_dist - end_dist); } else { // get here only when offset is non-zero - Sys_DPrintf ("foo\n"); + Sys_MaskPrintf (SYS_DEV, "foo\n"); frac = 1; side = start_dist < end_dist; } diff --git a/libs/net/net_main.c b/libs/net/net_main.c index 1ed65c06c..4e585a19d 100644 --- a/libs/net/net_main.c +++ b/libs/net/net_main.c @@ -888,9 +888,9 @@ NET_Init (void) } if (*my_ipx_address) - Sys_DPrintf ("IPX address %s\n", my_ipx_address); + Sys_MaskPrintf (SYS_DEV, "IPX address %s\n", my_ipx_address); if (*my_tcpip_address) - Sys_DPrintf ("TCP/IP address %s\n", my_tcpip_address); + Sys_MaskPrintf (SYS_DEV, "TCP/IP address %s\n", my_tcpip_address); } /* diff --git a/libs/net/nm/net_dgrm.c b/libs/net/nm/net_dgrm.c index 8b9fc0d7c..f272e1b70 100644 --- a/libs/net/nm/net_dgrm.c +++ b/libs/net/nm/net_dgrm.c @@ -343,14 +343,14 @@ Datagram_GetMessage (qsocket_t * sock) if (flags & NETFLAG_UNRELIABLE) { if (sequence < sock->unreliableReceiveSequence) { - Sys_DPrintf ("Got a stale datagram\n"); + Sys_MaskPrintf (SYS_DEV, "Got a stale datagram\n"); ret = 0; break; } if (sequence != sock->unreliableReceiveSequence) { count = sequence - sock->unreliableReceiveSequence; droppedDatagrams += count; - Sys_DPrintf ("Dropped %u datagram(s)\n", count); + Sys_MaskPrintf (SYS_DEV, "Dropped %u datagram(s)\n", count); } sock->unreliableReceiveSequence = sequence + 1; @@ -365,15 +365,15 @@ Datagram_GetMessage (qsocket_t * sock) if (flags & NETFLAG_ACK) { if (sequence != (sock->sendSequence - 1)) { - Sys_DPrintf ("Stale ACK received\n"); + Sys_MaskPrintf (SYS_DEV, "Stale ACK received\n"); continue; } if (sequence == sock->ackSequence) { sock->ackSequence++; if (sock->ackSequence != sock->sendSequence) - Sys_DPrintf ("ack sequencing error\n"); + Sys_MaskPrintf (SYS_DEV, "ack sequencing error\n"); } else { - Sys_DPrintf ("Duplicate ACK received\n"); + Sys_MaskPrintf (SYS_DEV, "Duplicate ACK received\n"); continue; } sock->sendMessageLength -= MAX_DATAGRAM; diff --git a/libs/net/nm/net_udp.c b/libs/net/nm/net_udp.c index b89e059e0..56c77e906 100644 --- a/libs/net/nm/net_udp.c +++ b/libs/net/nm/net_udp.c @@ -141,7 +141,7 @@ get_address (int sock) if (ioctl (sock, SIOCGIFADDR, &ifr[i]) == -1) continue; in_addr = (struct sockaddr_in *)&ifr[i].ifr_addr; - Sys_DPrintf ("%s: %s\n", ifr[i].ifr_name, + Sys_MaskPrintf (SYS_DEV, "%s: %s\n", ifr[i].ifr_name, inet_ntoa (in_addr->sin_addr)); addr = *(unsigned *)&in_addr->sin_addr; if (addr != htonl (0x7f000001)) { diff --git a/libs/net/nm/net_wins.c b/libs/net/nm/net_wins.c index e4f6138b6..1a139a36e 100644 --- a/libs/net/nm/net_wins.c +++ b/libs/net/nm/net_wins.c @@ -202,7 +202,7 @@ WINS_Init (void) // determine my name if (pgethostname (buff, MAXHOSTNAMELEN) == SOCKET_ERROR) { - Sys_DPrintf ("Winsock TCP/IP Initialization failed.\n"); + Sys_MaskPrintf (SYS_DEV, "Winsock TCP/IP Initialization failed.\n"); if (--winsock_initialized == 0) pWSACleanup (); return -1; diff --git a/libs/object/garbage.c b/libs/object/garbage.c index 76bb79fa3..4c4692023 100644 --- a/libs/object/garbage.c +++ b/libs/object/garbage.c @@ -51,9 +51,10 @@ Garbage_Do_Mark (Object *root) if (!root->marked) { ObjRefs_t *allrefs; root->marked = true; - Sys_DPrintf ("GC: Marked %s@%p.\n", root->cl->name, root); + Sys_MaskPrintf (SYS_DEV, "GC: Marked %s@%p.\n", root->cl->name, root); if (root->allRefs) - for (allrefs = methodCall(root, allRefs); allrefs; allrefs = allrefs->next) { + for (allrefs = methodCall(root, allRefs); allrefs; + allrefs = allrefs->next) { unsigned int i; for (i = 0; i < allrefs->count; i++) Garbage_Do_Mark (allrefs->objs[i]); @@ -81,7 +82,9 @@ Garbage_Do_Sweep (Object **allobjs) obj->next = junk; junk = obj; junked++; - Sys_DPrintf ("GC: %s@%p is ready for disposal...\n", obj->cl->name, obj); + Sys_MaskPrintf (SYS_DEV, + "GC: %s@%p is ready for disposal...\n", + obj->cl->name, obj); } } else *prevNext = obj->next; @@ -108,7 +111,8 @@ Garbage_Dispose (Object **allobjs, unsigned int amount) junk->next = *allobjs; *allobjs = junk; } else { - Sys_DPrintf ("GC: Disposing of %s@%p...\n", junk->cl->name, junk); + Sys_MaskPrintf (SYS_DEV, "GC: Disposing of %s@%p...\n", + junk->cl->name, junk); Object_Delete (junk); junked--; } diff --git a/libs/qw/msg_backbuf.c b/libs/qw/msg_backbuf.c index 32ff74955..92c9dda70 100644 --- a/libs/qw/msg_backbuf.c +++ b/libs/qw/msg_backbuf.c @@ -50,7 +50,8 @@ PushBackbuf (backbuf_t *rel) { int tail_backbuf; - Sys_DPrintf ("backbuffering %d %s\n", rel->num_backbuf, rel->name); + Sys_MaskPrintf (SYS_DEV, "backbuffering %d %s\n", rel->num_backbuf, + rel->name); tail_backbuf = (rel->head_backbuf + rel->num_backbuf) % MAX_BACK_BUFFERS; memset (&rel->backbuf, 0, sizeof (rel->backbuf)); rel->backbuf.allowoverflow = true; @@ -268,7 +269,7 @@ MSG_Reliable_Send (backbuf_t *rel) return; // will it fit? if (msg->cursize + *size < msg->maxsize) { - Sys_DPrintf ("%s: backbuf %d bytes\n", rel->name, *size); + Sys_MaskPrintf (SYS_DEV, "%s: backbuf %d bytes\n", rel->name, *size); // it'll fit SZ_Write (msg, data, *size); diff --git a/libs/ruamoko/rua_obj.c b/libs/ruamoko/rua_obj.c index b6770bf3d..e07ddcb38 100644 --- a/libs/ruamoko/rua_obj.c +++ b/libs/ruamoko/rua_obj.c @@ -376,8 +376,8 @@ finish_class (progs_t *pr, pr_class_t *class, pointer_t object_ptr) ml = &G_STRUCT (pr, pr_method_list_t, *ml).method_next; *ml = class->methods; } - Sys_DPrintf (" %d %d %d\n", meta->class_pointer, meta->super_class, - class->super_class); + Sys_MaskPrintf (SYS_DEV, " %d %d %d\n", meta->class_pointer, + meta->super_class, class->super_class); } //==================================================================== diff --git a/libs/util/cmd.c b/libs/util/cmd.c index af961c544..9a4daade8 100644 --- a/libs/util/cmd.c +++ b/libs/util/cmd.c @@ -147,7 +147,8 @@ Cmd_AddCommand (const char *cmd_name, xcommand_t function, // fail if the command already exists cmd = (cmd_function_t *) Hash_Find (cmd_hash, cmd_name); if (cmd) { - Sys_DPrintf ("Cmd_AddCommand: %s already defined\n", cmd_name); + Sys_MaskPrintf (SYS_DEV, "Cmd_AddCommand: %s already defined\n", + cmd_name); return 0; } diff --git a/libs/util/cvar.c b/libs/util/cvar.c index d31fe87c2..3040ab37e 100644 --- a/libs/util/cvar.c +++ b/libs/util/cvar.c @@ -237,7 +237,8 @@ Cvar_Set (cvar_t *var, const char *value) return; if (var->flags & CVAR_ROM) { - Sys_DPrintf ("Cvar \"%s\" is read-only, cannot modify\n", var->name); + Sys_MaskPrintf (SYS_DEV, "Cvar \"%s\" is read-only, cannot modify\n", + var->name); return; } @@ -352,8 +353,9 @@ set_cvar (const char *cmd, int orflags) if (var) { if (var->flags & CVAR_ROM) { - Sys_DPrintf ("Cvar \"%s\" is read-only, cannot modify\n", - var_name); + Sys_MaskPrintf (SYS_DEV, + "Cvar \"%s\" is read-only, cannot modify\n", + var_name); } else { Cvar_Set (var, value); Cvar_SetFlags (var, var->flags | orflags); diff --git a/libs/util/plugin.c b/libs/util/plugin.c index 4327196f4..f8a4d7ac4 100644 --- a/libs/util/plugin.c +++ b/libs/util/plugin.c @@ -341,7 +341,7 @@ PI_LoadPlugin (const char *type, const char *name) // try to reopen if (!(dlhand = pi_open_lib (realname, 1))) { Sys_Printf ("Error reopening plugin \"%s\".\n", realname); - Sys_DPrintf ("Reason: \"%s\".\n", pi_error); + Sys_MaskPrintf (SYS_DEV, "Reason: \"%s\".\n", pi_error); return NULL; } @@ -387,8 +387,9 @@ PI_UnloadPlugin (plugin_t *plugin) && plugin->functions->general->p_Shutdown) { plugin->functions->general->p_Shutdown (); } else { - Sys_DPrintf ("Warning: No shutdown function for type %d plugin!\n", - plugin->type); + Sys_MaskPrintf (SYS_DEV, + "Warning: No shutdown function for type %d plugin!\n", + plugin->type); } // remove from the table of loaded plugins diff --git a/libs/util/quakefs.c b/libs/util/quakefs.c index 56fd499c4..77d897d65 100644 --- a/libs/util/quakefs.c +++ b/libs/util/quakefs.c @@ -549,15 +549,15 @@ qfs_build_gamedir (const char **list) gamedir->dir.maps = nva ("%s/maps", gamedir->dir.def); qfs_gamedir = gamedir; - Sys_DPrintf ("%s\n", qfs_gamedir->name); - Sys_DPrintf (" gamedir : %s\n", qfs_gamedir->gamedir); - Sys_DPrintf (" path : %s\n", qfs_gamedir->path); - Sys_DPrintf (" gamecode: %s\n", qfs_gamedir->gamecode); - Sys_DPrintf (" def : %s\n", qfs_gamedir->dir.def); - Sys_DPrintf (" skins : %s\n", qfs_gamedir->dir.skins); - Sys_DPrintf (" models : %s\n", qfs_gamedir->dir.models); - Sys_DPrintf (" sound : %s\n", qfs_gamedir->dir.sound); - Sys_DPrintf (" maps : %s\n", qfs_gamedir->dir.maps); + Sys_MaskPrintf (SYS_DEV, "%s\n", qfs_gamedir->name); + Sys_MaskPrintf (SYS_DEV, " gamedir : %s\n", qfs_gamedir->gamedir); + Sys_MaskPrintf (SYS_DEV, " path : %s\n", qfs_gamedir->path); + Sys_MaskPrintf (SYS_DEV, " gamecode: %s\n", qfs_gamedir->gamecode); + Sys_MaskPrintf (SYS_DEV, " def : %s\n", qfs_gamedir->dir.def); + Sys_MaskPrintf (SYS_DEV, " skins : %s\n", qfs_gamedir->dir.skins); + Sys_MaskPrintf (SYS_DEV, " models : %s\n", qfs_gamedir->dir.models); + Sys_MaskPrintf (SYS_DEV, " sound : %s\n", qfs_gamedir->dir.sound); + Sys_MaskPrintf (SYS_DEV, " maps : %s\n", qfs_gamedir->dir.maps); qfs_process_path (qfs_gamedir->path, dir); free (path); Hash_DelTable (dirs); @@ -575,8 +575,9 @@ qfs_load_config (void) if (*fs_dirconf->string) { dirconf = Sys_ExpandSquiggle (fs_dirconf->string); if (!(f = Qopen (dirconf, "rt"))) - Sys_DPrintf ("Could not load `%s', using builtin defaults\n", - dirconf); + Sys_MaskPrintf (SYS_DEV, + "Could not load `%s', using builtin defaults\n", + dirconf); free (dirconf); } if (!f) @@ -826,8 +827,8 @@ open_file (searchpath_t *search, const char *filename, QFile **gzfile, packfile = pack_find_file (search->pack, filename); if (packfile) { - Sys_DPrintf ("PackFile: %s : %s\n", search->pack->filename, - packfile->name); + Sys_MaskPrintf (SYS_DEV, "PackFile: %s : %s\n", + search->pack->filename, packfile->name); // open a new file on the pakfile if (foundname) { dstring_clearstr (foundname); @@ -852,7 +853,7 @@ open_file (searchpath_t *search, const char *filename, QFile **gzfile, return -1; } - Sys_DPrintf ("FindFile: %s\n", netpath->str); + Sys_MaskPrintf (SYS_DEV, "FindFile: %s\n", netpath->str); *gzfile = qfs_openread (netpath->str, -1, -1, zip); dstring_delete (netpath); @@ -881,7 +882,9 @@ _QFS_FOpenFile (const char *filename, QFile **gzfile, // make sure they're not trying to do weird stuff with our private files path = QFS_CompressPath (filename); if (qfs_contains_updir(path, 1)) { - Sys_DPrintf ("FindFile: %s: attempt to escape directory tree!\n", path); + Sys_MaskPrintf (SYS_DEV, + "FindFile: %s: attempt to escape directory tree!\n", + path); goto error; } @@ -916,7 +919,7 @@ _QFS_FOpenFile (const char *filename, QFile **gzfile, goto ok; } - Sys_DPrintf ("FindFile: can't find %s\n", filename); + Sys_MaskPrintf (SYS_DEV, "FindFile: can't find %s\n", filename); error: *gzfile = NULL; qfs_filesize = -1; @@ -1027,7 +1030,7 @@ qfs_load_pakfile (char *packfile) pack_t *pack = pack_open (packfile); if (pack) - Sys_DPrintf ("Added packfile %s (%i files)\n", + Sys_MaskPrintf (SYS_DEV, "Added packfile %s (%i files)\n", packfile, pack->numfiles); return pack; } @@ -1077,7 +1080,7 @@ qfs_load_gamedir (const char *dir) char **pakfiles = NULL; int i = 0, bufsize = 0, count = 0; - Sys_DPrintf ("qfs_load_gamedir (\"%s\")\n", dir); + Sys_MaskPrintf (SYS_DEV, "qfs_load_gamedir (\"%s\")\n", dir); pakfiles = calloc (1, FBLOCK_SIZE * sizeof (char *)); @@ -1185,7 +1188,8 @@ qfs_add_gamedir (const char *dir) Sys_Printf ("dropping bad directory %s\n", dir); break; } - Sys_DPrintf ("qfs_add_gamedir (\"%s\")\n", f_dir->str); + Sys_MaskPrintf (SYS_DEV, "qfs_add_gamedir (\"%s\")\n", + f_dir->str); qfs_add_dir (f_dir->str); } @@ -1194,7 +1198,7 @@ qfs_add_gamedir (const char *dir) } qfs_expand_userpath (f_dir, dir); - Sys_DPrintf ("qfs_add_gamedir (\"%s\")\n", f_dir->str); + Sys_MaskPrintf (SYS_DEV, "qfs_add_gamedir (\"%s\")\n", f_dir->str); qfs_add_dir (f_dir->str); dstring_delete (f_dir); @@ -1409,7 +1413,7 @@ QFS_Open (const char *path, const char *mode) int write = 0; if (qfs_expand_userpath (full_path, path) == 0) { - Sys_DPrintf ("QFS_Open: %s %s\n", full_path->str, mode); + Sys_MaskPrintf (SYS_DEV, "QFS_Open: %s %s\n", full_path->str, mode); for (m = mode; *m; m++) if (*m == 'w' || *m == '+' || *m == 'a') write = 1; diff --git a/libs/util/sys.c b/libs/util/sys.c index efee61360..5074223f7 100644 --- a/libs/util/sys.c +++ b/libs/util/sys.c @@ -266,11 +266,11 @@ Sys_Printf (const char *fmt, ...) } VISIBLE void -Sys_DPrintf (const char *fmt, ...) +Sys_MaskPrintf (int mask, const char *fmt, ...) { va_list args; - if (!developer || !developer->int_val) + if (!developer || !(developer->int_val & mask)) return; va_start (args, fmt); sys_std_printf_function (fmt, args); diff --git a/libs/util/zone.c b/libs/util/zone.c index e4b5740ae..01e30e7e6 100644 --- a/libs/util/zone.c +++ b/libs/util/zone.c @@ -592,7 +592,7 @@ Cache_Move (cache_system_t * c) // we are clearing up space at the bottom, so allocate it late new = Cache_TryAlloc (c->size, true); if (new) { - Sys_DPrintf ("cache_move ok\n"); + Sys_MaskPrintf (SYS_DEV, "cache_move ok\n"); memcpy (new + 1, c + 1, c->size - sizeof (cache_system_t)); new->user = c->user; @@ -600,7 +600,7 @@ Cache_Move (cache_system_t * c) Cache_Free (c->user); new->user->data = (void *) (new + 1); } else { - Sys_DPrintf ("cache_move failed\n"); + Sys_MaskPrintf (SYS_DEV, "cache_move failed\n"); Cache_Free (c->user); // tough luck... } @@ -856,7 +856,7 @@ Cache_Free (cache_user_t *c) if (cs->readlock) Sys_Error ("Cache_Free: attempt to free locked block"); - Sys_DPrintf ("Cache_Free: freeing '%s' %p\n", cs->name, cs); + Sys_MaskPrintf (SYS_DEV, "Cache_Free: freeing '%s' %p\n", cs->name, cs); Cache_UnlinkLRU (cs); @@ -919,9 +919,9 @@ Cache_Alloc (cache_user_t *c, int size, const char *name) VISIBLE void Cache_Report (void) { - Sys_DPrintf ("%4.1f megabyte data cache\n", - (hunk_size - hunk_high_used - - hunk_low_used) / (float) (1024 * 1024)); + Sys_MaskPrintf (SYS_DEV, "%4.1f megabyte data cache\n", + (hunk_size - hunk_high_used - + hunk_low_used) / (float) (1024 * 1024)); } VISIBLE void diff --git a/libs/video/renderer/gl/gl_draw.c b/libs/video/renderer/gl/gl_draw.c index eb4a8d0e8..471e6c538 100644 --- a/libs/video/renderer/gl/gl_draw.c +++ b/libs/video/renderer/gl/gl_draw.c @@ -134,7 +134,8 @@ Draw_InitText (void) tVAsize = 0; if (tVAsize) { - Sys_DPrintf ("Text: %i maximum vertex elements.\n", tVAsize); + Sys_MaskPrintf (SYS_DEV, "Text: %i maximum vertex elements.\n", + tVAsize); if (textVertices) free (textVertices); @@ -152,7 +153,7 @@ Draw_InitText (void) for (i = 0; i < tVAsize; i++) tVAindices[i] = i; } else { - Sys_DPrintf ("Text: Vertex Array use disabled.\n"); + Sys_MaskPrintf (SYS_DEV, "Text: Vertex Array use disabled.\n"); } } diff --git a/libs/video/renderer/gl/gl_dyn_part.c b/libs/video/renderer/gl/gl_dyn_part.c index 87272c0d0..52742cb0a 100644 --- a/libs/video/renderer/gl/gl_dyn_part.c +++ b/libs/video/renderer/gl/gl_dyn_part.c @@ -161,7 +161,9 @@ R_InitParticles (void) else pVAsize = 0; if (pVAsize) { - Sys_DPrintf ("Particles: %i maximum vertex elements.\n", pVAsize); + Sys_MaskPrintf (SYS_DEV, + "Particles: %i maximum vertex elements.\n", + pVAsize); if (particleVertexArray) free (particleVertexArray); @@ -175,7 +177,8 @@ R_InitParticles (void) for (i = 0; i < pVAsize; i++) pVAindices[i] = i; } else { - Sys_DPrintf ("Particles: Vertex Array use disabled.\n"); + Sys_MaskPrintf (SYS_DEV, + "Particles: Vertex Array use disabled.\n"); } } else { if (particleVertexArray) { @@ -212,7 +215,7 @@ R_ReadPointFile_f (void) return; } - Sys_DPrintf ("Reading %s...\n", name); + Sys_MaskPrintf (SYS_DEV, "Reading %s...\n", name); c = 0; for (;;) { char buf[64]; @@ -224,7 +227,7 @@ R_ReadPointFile_f (void) c++; if (numparticles >= r_maxparticles) { - Sys_DPrintf ("Not enough free particles\n"); + Sys_MaskPrintf (SYS_DEV, "Not enough free particles\n"); break; } else { particle_new (pt_static, part_tex_dot, org, 1.5, vec3_origin, @@ -232,7 +235,7 @@ R_ReadPointFile_f (void) } } Qclose (f); - Sys_DPrintf ("%i points read\n", c); + Sys_MaskPrintf (SYS_DEV, "%i points read\n", c); } static void @@ -1547,7 +1550,8 @@ R_ParticlePhysics (particle_t *part) part->scale -= time2; break; default: - Sys_DPrintf ("unhandled particle type %d\n", part->type); + Sys_MaskPrintf (SYS_DEV, "unhandled particle type %d\n", + part->type); break; } } diff --git a/libs/video/renderer/gl/gl_mod_alias.c b/libs/video/renderer/gl/gl_mod_alias.c index dafeb0285..cae07a45a 100644 --- a/libs/video/renderer/gl/gl_mod_alias.c +++ b/libs/video/renderer/gl/gl_mod_alias.c @@ -257,8 +257,9 @@ GL_GetAliasFrameVerts16 (int frame, aliashdr_t *paliashdr, entity_t *e) if ((frame >= paliashdr->mdl.numframes) || (frame < 0)) { if (developer->int_val) - Sys_DPrintf ("R_AliasSetupFrame: no such frame %d %s\n", frame, - currententity->model->name); + Sys_MaskPrintf (SYS_DEV, + "R_AliasSetupFrame: no such frame %d %s\n", frame, + currententity->model->name); frame = 0; } @@ -363,8 +364,9 @@ GL_GetAliasFrameVerts (int frame, aliashdr_t *paliashdr, entity_t *e) if ((frame >= paliashdr->mdl.numframes) || (frame < 0)) { if (developer->int_val) - Sys_DPrintf ("R_AliasSetupFrame: no such frame %d %s\n", frame, - currententity->model->name); + Sys_MaskPrintf (SYS_DEV, + "R_AliasSetupFrame: no such frame %d %s\n", frame, + currententity->model->name); frame = 0; } @@ -466,7 +468,8 @@ R_AliasGetSkindesc (int skinnum, aliashdr_t *ahdr) maliasskingroup_t *paliasskingroup; if ((skinnum >= ahdr->mdl.numskins) || (skinnum < 0)) { - Sys_DPrintf ("R_AliasSetupSkin: no such skin # %d\n", skinnum); + Sys_MaskPrintf (SYS_DEV, "R_AliasSetupSkin: no such skin # %d\n", + skinnum); skinnum = 0; } diff --git a/libs/video/renderer/gl/gl_mod_sprite.c b/libs/video/renderer/gl/gl_mod_sprite.c index 43f5d9091..f56bf33ab 100644 --- a/libs/video/renderer/gl/gl_mod_sprite.c +++ b/libs/video/renderer/gl/gl_mod_sprite.c @@ -74,7 +74,7 @@ R_GetSpriteFrame (entity_t *currententity) frame = currententity->frame; if ((frame >= psprite->numframes) || (frame < 0)) { - Sys_DPrintf ("R_DrawSprite: no such frame %d\n", frame); + Sys_MaskPrintf (SYS_DEV, "R_DrawSprite: no such frame %d\n", frame); frame = 0; } @@ -260,7 +260,8 @@ R_InitSprites (void) #else sVAsize = 4; #endif - Sys_DPrintf ("Sprites: %i maximum vertex elements.\n", sVAsize); + Sys_MaskPrintf (SYS_DEV, "Sprites: %i maximum vertex elements.\n", + sVAsize); if (spriteVertexArray) free (spriteVertexArray); diff --git a/libs/video/renderer/gl/gl_rmain.c b/libs/video/renderer/gl/gl_rmain.c index e5f0b8b1c..023e21e5a 100644 --- a/libs/video/renderer/gl/gl_rmain.c +++ b/libs/video/renderer/gl/gl_rmain.c @@ -807,15 +807,15 @@ R_InitFishEyeOnce (void) if (fisheye_init_once_completed) return 1; - Sys_DPrintf ("GL_ARB_texture_cube_map "); + Sys_MaskPrintf (SYS_DEV, "GL_ARB_texture_cube_map "); if (QFGL_ExtensionPresent ("GL_ARB_texture_cube_map")) { qfglGetIntegerv (GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB, &gl_cube_map_maxtex); - Sys_DPrintf ("present, max texture size %d.\n", - (int) gl_cube_map_maxtex); + Sys_MaskPrintf (SYS_DEV, "present, max texture size %d.\n", + (int) gl_cube_map_maxtex); gl_cube_map_capable = true; } else { - Sys_DPrintf ("not found.\n"); + Sys_MaskPrintf (SYS_DEV, "not found.\n"); gl_cube_map_capable = false; } fisheye_init_once_completed = true; diff --git a/libs/video/renderer/gl/gl_rmisc.c b/libs/video/renderer/gl/gl_rmisc.c index db369eb1c..264ed3d76 100644 --- a/libs/video/renderer/gl/gl_rmisc.c +++ b/libs/video/renderer/gl/gl_rmisc.c @@ -232,7 +232,7 @@ R_TimeRefresh_f (void) stop = Sys_DoubleTime (); time = stop - start; - Sys_DPrintf ("%f seconds (%f fps)\n", time, 128 / time); + Sys_MaskPrintf (SYS_DEV, "%f seconds (%f fps)\n", time, 128 / time); } VISIBLE void diff --git a/libs/video/renderer/gl/gl_screen.c b/libs/video/renderer/gl/gl_screen.c index cc0721f42..839949808 100644 --- a/libs/video/renderer/gl/gl_screen.c +++ b/libs/video/renderer/gl/gl_screen.c @@ -263,9 +263,9 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs) if (r_speeds->int_val) { // qfglFinish (); time2 = Sys_DoubleTime (); - Sys_DPrintf ("%3i ms %4i wpoly %4i epoly %4i parts\n", - (int) ((time2 - time1) * 1000), c_brush_polys, - c_alias_polys, numparticles); + Sys_MaskPrintf (SYS_DEV, "%3i ms %4i wpoly %4i epoly %4i parts\n", + (int) ((time2 - time1) * 1000), c_brush_polys, + c_alias_polys, numparticles); } GL_FlushText (); diff --git a/libs/video/renderer/gl/gl_skin.c b/libs/video/renderer/gl/gl_skin.c index d3d94040f..c82629f47 100644 --- a/libs/video/renderer/gl/gl_skin.c +++ b/libs/video/renderer/gl/gl_skin.c @@ -221,8 +221,8 @@ Skin_Do_Translation_Model (model_t *model, int skinnum, int slot, skin_t *skin) paliashdr = Cache_Get (&model->cache); if (skinnum < 0 || skinnum >= paliashdr->mdl.numskins) { - Sys_DPrintf ("(%d): Invalid player skin #%d\n", slot, - skinnum); + Sys_MaskPrintf (SYS_DEV, "(%d): Invalid player skin #%d\n", slot, + skinnum); skinnum = 0; } pskindesc = ((maliasskindesc_t *) diff --git a/libs/video/renderer/gl/gl_sky.c b/libs/video/renderer/gl/gl_sky.c index 4bd502017..8ed7c23dd 100644 --- a/libs/video/renderer/gl/gl_sky.c +++ b/libs/video/renderer/gl/gl_sky.c @@ -129,11 +129,11 @@ R_LoadSkys (const char *skyname) targa = LoadImage (name = va ("env/%s%s", skyname, suf[i])); if (!targa || targa->format < 3) { // FIXME Can't do PCX right now - Sys_DPrintf ("Couldn't load %s\n", name); + Sys_MaskPrintf (SYS_DEV, "Couldn't load %s\n", name); // also look in gfx/env, where Darkplaces looks for skies targa = LoadImage (name = va ("gfx/env/%s%s", skyname, suf[i])); if (!targa) { - Sys_DPrintf ("Couldn't load %s\n", name); + Sys_MaskPrintf (SYS_DEV, "Couldn't load %s\n", name); skyloaded = false; continue; } diff --git a/libs/video/renderer/r_progs.c b/libs/video/renderer/r_progs.c index 4539bc016..b5ad6d0e9 100644 --- a/libs/video/renderer/r_progs.c +++ b/libs/video/renderer/r_progs.c @@ -84,7 +84,7 @@ bi_Draw_CachePic (progs_t *pr) qpic_res_t *rpic = Hash_Find (res->pic_hash, path); if (!pic) { - Sys_DPrintf ("can't load %s\n", path); + Sys_MaskPrintf (SYS_DEV, "can't load %s\n", path); R_INT (pr) = 0; return; } diff --git a/libs/video/renderer/sw/d_surf.c b/libs/video/renderer/sw/d_surf.c index de6ebf022..daf5c0eeb 100644 --- a/libs/video/renderer/sw/d_surf.c +++ b/libs/video/renderer/sw/d_surf.c @@ -101,7 +101,7 @@ D_ClearCacheGuard (void) void D_InitCaches (void *buffer, int size) { - Sys_DPrintf ("D_InitCaches: %ik surface cache\n", size/1024); + Sys_MaskPrintf (SYS_DEV, "D_InitCaches: %ik surface cache\n", size/1024); sc_size = size - GUARDSIZE; sc_base = (surfcache_t *) buffer; diff --git a/libs/video/renderer/sw/sw_ralias.c b/libs/video/renderer/sw/sw_ralias.c index ba505f1dd..aa8bb1eaf 100644 --- a/libs/video/renderer/sw/sw_ralias.c +++ b/libs/video/renderer/sw/sw_ralias.c @@ -113,7 +113,7 @@ R_AliasCheckBBox (void) frame = currententity->frame; // TODO: don't repeat this check when drawing? if ((frame >= pmdl->numframes) || (frame < 0)) { - Sys_DPrintf ("No such frame %d %s\n", frame, pmodel->name); + Sys_MaskPrintf (SYS_DEV, "No such frame %d %s\n", frame, pmodel->name); frame = 0; } @@ -558,7 +558,8 @@ R_AliasSetupSkin (void) skinnum = currententity->skinnum; if ((skinnum >= pmdl->numskins) || (skinnum < 0)) { - Sys_DPrintf ("R_AliasSetupSkin: no such skin # %d\n", skinnum); + Sys_MaskPrintf (SYS_DEV, "R_AliasSetupSkin: no such skin # %d\n", + skinnum); skinnum = 0; } @@ -651,7 +652,8 @@ R_AliasSetupFrame (void) frame = currententity->frame; if ((frame >= pmdl->numframes) || (frame < 0)) { - Sys_DPrintf ("R_AliasSetupFrame: no such frame %d\n", frame); + Sys_MaskPrintf (SYS_DEV, "R_AliasSetupFrame: no such frame %d\n", + frame); frame = 0; } diff --git a/libs/video/renderer/sw/sw_rpart.c b/libs/video/renderer/sw/sw_rpart.c index e98279a53..35894d81c 100644 --- a/libs/video/renderer/sw/sw_rpart.c +++ b/libs/video/renderer/sw/sw_rpart.c @@ -832,7 +832,8 @@ R_DrawParticles (void) p->vel[2] -= grav; break; default: - Sys_DPrintf ("unhandled particle type %d\n", p->type); + Sys_MaskPrintf (SYS_DEV, "unhandled particle type %d\n", + p->type); break; } } diff --git a/libs/video/renderer/sw32/d_surf.c b/libs/video/renderer/sw32/d_surf.c index 179151d94..624b85f46 100644 --- a/libs/video/renderer/sw32/d_surf.c +++ b/libs/video/renderer/sw32/d_surf.c @@ -107,7 +107,7 @@ D_ClearCacheGuard (void) void D_InitCaches (void *buffer, int size) { - Sys_DPrintf ("D_InitCaches: %ik surface cache\n", size/1024); + Sys_MaskPrintf (SYS_DEV, "D_InitCaches: %ik surface cache\n", size/1024); sc_size = size - GUARDSIZE; sc_base = (surfcache_t *) buffer; diff --git a/libs/video/renderer/sw32/sw32_ralias.c b/libs/video/renderer/sw32/sw32_ralias.c index 556d38042..5f157a1de 100644 --- a/libs/video/renderer/sw32/sw32_ralias.c +++ b/libs/video/renderer/sw32/sw32_ralias.c @@ -113,7 +113,7 @@ R_AliasCheckBBox (void) frame = currententity->frame; // TODO: don't repeat this check when drawing? if ((frame >= pmdl->numframes) || (frame < 0)) { - Sys_DPrintf ("No such frame %d %s\n", frame, pmodel->name); + Sys_MaskPrintf (SYS_DEV, "No such frame %d %s\n", frame, pmodel->name); frame = 0; } @@ -553,7 +553,8 @@ R_AliasSetupSkin (void) skinnum = currententity->skinnum; if ((skinnum >= pmdl->numskins) || (skinnum < 0)) { - Sys_DPrintf ("R_AliasSetupSkin: no such skin # %d\n", skinnum); + Sys_MaskPrintf (SYS_DEV, "R_AliasSetupSkin: no such skin # %d\n", + skinnum); skinnum = 0; } @@ -646,7 +647,8 @@ R_AliasSetupFrame (void) frame = currententity->frame; if ((frame >= pmdl->numframes) || (frame < 0)) { - Sys_DPrintf ("R_AliasSetupFrame: no such frame %d\n", frame); + Sys_MaskPrintf (SYS_DEV, "R_AliasSetupFrame: no such frame %d\n", + frame); frame = 0; } diff --git a/libs/video/renderer/sw32/sw32_rpart.c b/libs/video/renderer/sw32/sw32_rpart.c index 0afd2750f..8a1d80eac 100644 --- a/libs/video/renderer/sw32/sw32_rpart.c +++ b/libs/video/renderer/sw32/sw32_rpart.c @@ -842,7 +842,8 @@ R_DrawParticles (void) p->vel[2] -= grav; break; default: - Sys_DPrintf ("unhandled particle type %d\n", p->type); + Sys_MaskPrintf (SYS_DEV, "unhandled particle type %d\n", + p->type); break; } } diff --git a/libs/video/targets/context_x11.c b/libs/video/targets/context_x11.c index 6ddfd9e0a..3eefe4f9c 100644 --- a/libs/video/targets/context_x11.c +++ b/libs/video/targets/context_x11.c @@ -128,17 +128,20 @@ configure_notify (XEvent *event) if (vidmode_active) X11_ForceViewPort (); #endif - Sys_DPrintf ("ConfigureNotify: %ld %d %ld %ld %d,%d (%d,%d) %d %ld %d\n", - c->serial, c->send_event, c->event, c->window, c->x, c->y, - c->width, c->height, c->border_width, c->above, - c->override_redirect); + Sys_MaskPrintf (SYS_DEV, + "ConfigureNotify: %ld %d %ld %ld %d,%d (%d,%d) " + "%d %ld %d\n", + c->serial, c->send_event, c->event, c->window, c->x, c->y, + c->width, c->height, c->border_width, c->above, + c->override_redirect); } qboolean X11_AddEvent (int event, void (*event_handler) (XEvent *)) { if (event >= LASTEvent) { - Sys_DPrintf ("event: %d, LASTEvent: %d\n", event, LASTEvent); + Sys_MaskPrintf (SYS_DEV, "event: %d, LASTEvent: %d\n", event, + LASTEvent); return false; } @@ -428,8 +431,8 @@ X11_SetVidMode (int width, int height) } if (found_mode) { - Sys_DPrintf ("VID: Chose video mode: %dx%d\n", - vid.width, vid.height); + Sys_MaskPrintf (SYS_DEV, "VID: Chose video mode: %dx%d\n", + vid.width, vid.height); XF86VidModeSwitchToMode (x_disp, x_screen, vidmodes[best_mode]); diff --git a/libs/video/targets/dga_check.c b/libs/video/targets/dga_check.c index 76ddc92e5..60e0d57b4 100644 --- a/libs/video/targets/dga_check.c +++ b/libs/video/targets/dga_check.c @@ -97,11 +97,11 @@ VID_CheckDGA (Display * dpy, int *maj_ver, int *min_ver, int *hasvideo) } if ((!maj_ver) || (*maj_ver != XDGA_MAJOR_VERSION)) { - Sys_DPrintf ("VID: Incorrect DGA version: %d.%d, \n", *maj_ver, - *min_ver); + Sys_MaskPrintf (SYS_DEV, "VID: Incorrect DGA version: %d.%d, \n", + *maj_ver, *min_ver); return false; } - Sys_DPrintf ("VID: DGA version: %d.%d\n", *maj_ver, *min_ver); + Sys_MaskPrintf (SYS_DEV, "VID: DGA version: %d.%d\n", *maj_ver, *min_ver); if (!hasvideo) hasvideo = &dummy_video; @@ -151,12 +151,13 @@ VID_CheckVMode (Display * dpy, int *maj_ver, int *min_ver) return false; if ((!maj_ver) || (*maj_ver != XF86VIDMODE_MAJOR_VERSION)) { - Sys_DPrintf ("VID: Incorrect VidMode version: %d.%d\n", *maj_ver, - *min_ver); + Sys_MaskPrintf (SYS_DEV, "VID: Incorrect VidMode version: %d.%d\n", + *maj_ver, *min_ver); return false; } - Sys_DPrintf ("VID: VidMode version: %d.%d\n", *maj_ver, *min_ver); + Sys_MaskPrintf (SYS_DEV, "VID: VidMode version: %d.%d\n", + *maj_ver, *min_ver); return true; #else return false; diff --git a/libs/video/targets/in_common.c b/libs/video/targets/in_common.c index 714a62418..78bde8e0c 100644 --- a/libs/video/targets/in_common.c +++ b/libs/video/targets/in_common.c @@ -135,7 +135,7 @@ IN_Shutdown (void) { JOY_Shutdown (); - Sys_DPrintf ("IN_Shutdown\n"); + Sys_MaskPrintf (SYS_DEV, "IN_Shutdown\n"); IN_LL_Shutdown (); IE_Shutdown (); diff --git a/libs/video/targets/in_svgalib.c b/libs/video/targets/in_svgalib.c index 57d2f2ed6..a77c76650 100644 --- a/libs/video/targets/in_svgalib.c +++ b/libs/video/targets/in_svgalib.c @@ -115,7 +115,7 @@ keyhandler (int scancode, int state) default: break; } - //Sys_DPrintf ("%d %02x %02lx %04x %c\n", sc, press, shifts, + //Sys_MaskPrintf (SYS_DEV, "%d %02x %02lx %04x %c\n", sc, press, shifts, // key, ascii > 32 && ascii < 127 ? ascii : '#'); Key_Event (key, ascii, press); } @@ -386,16 +386,17 @@ IN_InitMouse (void) mouserate = atoi (com_argv[COM_CheckParm ("-mrate") + 1]); } #if 0 - Sys_DPrintf ("Mouse: dev=%s,type=%s,speed=%d\n", + Sys_MaskPrintf (SYS_DEV, "Mouse: dev=%s,type=%s,speed=%d\n", mousedev, mice[mtype].name, mouserate); #endif //FIXME: vga_init() opens the mouse automoatically // closing it to ensure its opened how we want it mouse_close(); if (mouse_init ((char *)mousedev, mtype, mouserate)) { - Sys_DPrintf ("No mouse found. Check your libvga.conf mouse settings" - " and that the mouse\n" - "device has appropriate permission settings.\n"); + Sys_MaskPrintf (SYS_DEV, + "No mouse found. Check your libvga.conf mouse settings" + " and that the mouse\n" + "device has appropriate permission settings.\n"); UseMouse = 0; } else { mouse_seteventhandler ((void *) mousehandler); @@ -406,7 +407,7 @@ IN_InitMouse (void) void IN_LL_Shutdown (void) { - Sys_DPrintf ("IN_LL_Shutdown\n"); + Sys_MaskPrintf (SYS_DEV, "IN_LL_Shutdown\n"); if (UseMouse) mouse_close (); diff --git a/libs/video/targets/in_win.c b/libs/video/targets/in_win.c index 059edd6f2..c4ecfdc6b 100644 --- a/libs/video/targets/in_win.c +++ b/libs/video/targets/in_win.c @@ -680,8 +680,9 @@ MapKey (unsigned int keycode, int press, int *k, int *u) break; } - Sys_DPrintf ("%08x %d %02x %02lx %04x %c\n", keycode, press, scan, shifts, - key, uc > 32 && uc < 127 ? uc : '#'); + Sys_MaskPrintf (SYS_DEV, "%08x %d %02x %02lx %04x %c\n", + keycode, press, scan, shifts, + key, uc > 32 && uc < 127 ? uc : '#'); *k = key; *u = uc; } diff --git a/libs/video/targets/in_x11.c b/libs/video/targets/in_x11.c index 3584e046a..19c680c4d 100644 --- a/libs/video/targets/in_x11.c +++ b/libs/video/targets/in_x11.c @@ -712,7 +712,7 @@ IN_LL_ProcessEvents (void) void IN_LL_Shutdown (void) { - Sys_DPrintf ("IN_LL_Shutdown\n"); + Sys_MaskPrintf (SYS_DEV, "IN_LL_Shutdown\n"); in_mouse_avail = 0; if (x_disp) { XAutoRepeatOn (x_disp); diff --git a/libs/video/targets/joy.c b/libs/video/targets/joy.c index dfcbfb5d2..3bf09bf73 100644 --- a/libs/video/targets/joy.c +++ b/libs/video/targets/joy.c @@ -155,7 +155,7 @@ JOY_Init (void) int i; if (JOY_Open () == -1) { - Sys_DPrintf ("JOY: Joystick not found.\n"); + Sys_MaskPrintf (SYS_DEV, "JOY: Joystick not found.\n"); joy_found = false; joy_active = false; return; @@ -164,12 +164,12 @@ JOY_Init (void) joy_found = true; if (!joy_enable->int_val) { - Sys_DPrintf ("JOY: Joystick found, but not enabled.\n"); + Sys_MaskPrintf (SYS_DEV, "JOY: Joystick found, but not enabled.\n"); joy_active = false; JOY_Close (); } - Sys_DPrintf ("JOY: Joystick found and activated.\n"); + Sys_MaskPrintf (SYS_DEV, "JOY: Joystick found and activated.\n"); // Initialize joystick if found and enabled for (i = 0; i < JOY_MAX_BUTTONS; i++) { diff --git a/libs/video/targets/joy_linux.c b/libs/video/targets/joy_linux.c index 4d5fba84f..fff99a3a2 100644 --- a/libs/video/targets/joy_linux.c +++ b/libs/video/targets/joy_linux.c @@ -99,8 +99,8 @@ JOY_Close (void) i = close (joy_handle); if (i) { - Sys_DPrintf ("JOY: Failed to close joystick device!\n"); + Sys_MaskPrintf (SYS_DEV, "JOY: Failed to close joystick device!\n"); } else { - Sys_DPrintf ("JOY_Shutdown\n"); + Sys_MaskPrintf (SYS_DEV, "JOY_Shutdown\n"); } } diff --git a/libs/video/targets/qfgl_ext.c b/libs/video/targets/qfgl_ext.c index ed8dffcf8..bbc042095 100644 --- a/libs/video/targets/qfgl_ext.c +++ b/libs/video/targets/qfgl_ext.c @@ -71,14 +71,14 @@ QFGL_ProcAddress (void *handle, const char *name, qboolean crit) { void *glfunc = NULL; - Sys_DPrintf ("DEBUG: Finding symbol %s ... ", name); + Sys_MaskPrintf (SYS_DEV, "DEBUG: Finding symbol %s ... ", name); glfunc = QFGL_GetProcAddress (handle, name); if (glfunc) { - Sys_DPrintf ("found [%p]\n", glfunc); + Sys_MaskPrintf (SYS_DEV, "found [%p]\n", glfunc); return glfunc; } - Sys_DPrintf ("not found\n"); + Sys_MaskPrintf (SYS_DEV, "not found\n"); if (crit) { if (strncmp ("fxMesa", name, 6) == 0) { diff --git a/libs/video/targets/vid.c b/libs/video/targets/vid.c index d312ae18b..77f006556 100644 --- a/libs/video/targets/vid.c +++ b/libs/video/targets/vid.c @@ -203,13 +203,13 @@ VID_UpdateGamma (cvar_t *vid_gamma) vid.recalc_refdef = 1; // force a surface cache flush if (vid_gamma_avail && vid_system_gamma->int_val) { // Have system, use it - Sys_DPrintf ("Setting hardware gamma to %g\n", gamma); + Sys_MaskPrintf (SYS_DEV, "Setting hardware gamma to %g\n", gamma); VID_BuildGammaTable (1.0); // hardware gamma wants a linear palette VID_SetGamma (gamma); memcpy (vid.palette, vid.basepal, 256 * 3); } else { // We have to hack the palette int i; - Sys_DPrintf ("Setting software gamma to %g\n", gamma); + Sys_MaskPrintf (SYS_DEV, "Setting software gamma to %g\n", gamma); VID_BuildGammaTable (gamma); for (i = 0; i < 256 * 3; i++) vid.palette[i] = gammatable[vid.basepal[i]]; diff --git a/libs/video/targets/vid_3dfxsvga.c b/libs/video/targets/vid_3dfxsvga.c index 285170cad..eacf7ab22 100644 --- a/libs/video/targets/vid_3dfxsvga.c +++ b/libs/video/targets/vid_3dfxsvga.c @@ -176,20 +176,20 @@ GL_Init (void) if (!(dither_select = QFGL_ExtensionAddress ("gl3DfxSetDitherModeEXT"))) return; - Sys_DPrintf ("Dithering: "); + Sys_MaskPrintf (SYS_DEV, "Dithering: "); if ((p = COM_CheckParm ("-dither")) && p < com_argc) { if (strequal (com_argv[p+1], "2x2")) { dither_select (GR_DITHER_2x2); - Sys_DPrintf ("2x2.\n"); + Sys_MaskPrintf (SYS_DEV, "2x2.\n"); } if (strequal (com_argv[p+1], "4x4")) { dither_select (GR_DITHER_4x4); - Sys_DPrintf ("4x4.\n"); + Sys_MaskPrintf (SYS_DEV, "4x4.\n"); } } else { qfglDisable (GL_DITHER); - Sys_DPrintf ("disabled.\n"); + Sys_MaskPrintf (SYS_DEV, "disabled.\n"); } } @@ -326,7 +326,8 @@ VID_Init (unsigned char *palette) vid.initialized = true; - Sys_DPrintf ("Video mode %dx%d initialized.\n", vid.width, vid.height); + Sys_MaskPrintf (SYS_DEV, "Video mode %dx%d initialized.\n", + vid.width, vid.height); vid.recalc_refdef = 1; // force a surface cache flush } diff --git a/libs/video/targets/vid_common_gl.c b/libs/video/targets/vid_common_gl.c index 70baef1d0..edb028bc1 100644 --- a/libs/video/targets/vid_common_gl.c +++ b/libs/video/targets/vid_common_gl.c @@ -197,7 +197,8 @@ gl_multitexture_f (cvar_t *var) qfglDisable (GL_TEXTURE_2D); } else { gl_mtex_fullbright = false; - Sys_DPrintf ("Not enough TMUs for BSP fullbrights.\n"); + Sys_MaskPrintf (SYS_DEV, + "Not enough TMUs for BSP fullbrights.\n"); } } } else { @@ -247,8 +248,10 @@ gl_anisotropy_f (cvar_t * var) } else { aniso = 1.0; if (var) - Sys_DPrintf ("Anisotropy (GL_EXT_texture_filter_anisotropic) is " - "not supported by your hardware and/or drivers.\n"); + Sys_MaskPrintf (SYS_DEV, + "Anisotropy (GL_EXT_texture_filter_anisotropic) " + "is not supported by your hardware and/or " + "drivers.\n"); } } @@ -264,8 +267,9 @@ gl_tessellate_f (cvar_t * var) } else { tess = 0; if (var) - Sys_DPrintf ("TruForm (GL_ATI_pn_triangles) is not supported by " - "your hardware and/or drivers.\n"); + Sys_MaskPrintf (SYS_DEV, + "TruForm (GL_ATI_pn_triangles) is not supported " + "by your hardware and/or drivers.\n"); } } @@ -334,14 +338,14 @@ CheckGLVersionString (void) } else { Sys_Error ("Malformed OpenGL version string!"); } - Sys_DPrintf ("GL_VERSION: %s\n", gl_version); + Sys_MaskPrintf (SYS_DEV, "GL_VERSION: %s\n", gl_version); gl_vendor = (char *) qfglGetString (GL_VENDOR); - Sys_DPrintf ("GL_VENDOR: %s\n", gl_vendor); + Sys_MaskPrintf (SYS_DEV, "GL_VENDOR: %s\n", gl_vendor); gl_renderer = (char *) qfglGetString (GL_RENDERER); - Sys_DPrintf ("GL_RENDERER: %s\n", gl_renderer); + Sys_MaskPrintf (SYS_DEV, "GL_RENDERER: %s\n", gl_renderer); gl_extensions = (char *) qfglGetString (GL_EXTENSIONS); - Sys_DPrintf ("GL_EXTENSIONS: %s\n", gl_extensions); + Sys_MaskPrintf (SYS_DEV, "GL_EXTENSIONS: %s\n", gl_extensions); if (strstr (gl_renderer, "Mesa DRI Mach64")) gl_feature_mach64 = true; @@ -376,15 +380,17 @@ CheckCombineExtensions (void) { if (gl_major >= 1 && gl_minor >= 3) { gl_combine_capable = true; - Sys_DPrintf ("COMBINE active, multitextured doublebright enabled.\n"); + Sys_MaskPrintf (SYS_DEV, "COMBINE active, multitextured doublebright " + "enabled.\n"); } else if (QFGL_ExtensionPresent ("GL_ARB_texture_env_combine")) { gl_combine_capable = true; - Sys_DPrintf ("COMBINE_ARB active, multitextured doublebright " - "enabled.\n"); + Sys_MaskPrintf (SYS_DEV, "COMBINE_ARB active, multitextured " + "doublebright enabled.\n"); } else { gl_combine_capable = false; - Sys_DPrintf ("GL_ARB_texture_env_combine not found. gl_doublebright " - "will have no effect with gl_multitexture on.\n"); + Sys_MaskPrintf (SYS_DEV, "GL_ARB_texture_env_combine not found. " + "gl_doublebright will have no effect with " + "gl_multitexture on.\n"); } } @@ -396,15 +402,15 @@ CheckCombineExtensions (void) static void CheckMultiTextureExtensions (void) { - Sys_DPrintf ("Checking for multitexture: "); + Sys_MaskPrintf (SYS_DEV, "Checking for multitexture: "); if (COM_CheckParm ("-nomtex")) { - Sys_DPrintf ("disabled.\n"); + Sys_MaskPrintf (SYS_DEV, "disabled.\n"); return; } if (gl_major >= 1 && gl_minor >= 3) { qfglGetIntegerv (GL_MAX_TEXTURE_UNITS, &gl_mtex_tmus); if (gl_mtex_tmus >= 2) { - Sys_DPrintf ("enabled, %d TMUs.\n", gl_mtex_tmus); + Sys_MaskPrintf (SYS_DEV, "enabled, %d TMUs.\n", gl_mtex_tmus); qglMultiTexCoord2f = QFGL_ExtensionAddress ("glMultiTexCoord2f"); qglMultiTexCoord2fv = @@ -414,15 +420,16 @@ CheckMultiTextureExtensions (void) if (qglMultiTexCoord2f && gl_mtex_enum) gl_mtex_capable = true; else - Sys_DPrintf ("Multitexture disabled, could not find required " - "functions\n"); + Sys_MaskPrintf (SYS_DEV, "Multitexture disabled, could not " + "find required functions\n"); } else { - Sys_DPrintf ("Multitexture disabled, not enough TMUs.\n"); + Sys_MaskPrintf (SYS_DEV, + "Multitexture disabled, not enough TMUs.\n"); } } else if (QFGL_ExtensionPresent ("GL_ARB_multitexture")) { qfglGetIntegerv (GL_MAX_TEXTURE_UNITS_ARB, &gl_mtex_tmus); if (gl_mtex_tmus >= 2) { - Sys_DPrintf ("enabled, %d TMUs.\n", gl_mtex_tmus); + Sys_MaskPrintf (SYS_DEV, "enabled, %d TMUs.\n", gl_mtex_tmus); qglMultiTexCoord2f = QFGL_ExtensionAddress ("glMultiTexCoord2fARB"); qglMultiTexCoord2fv = @@ -432,13 +439,14 @@ CheckMultiTextureExtensions (void) if (qglMultiTexCoord2f && gl_mtex_enum) gl_mtex_capable = true; else - Sys_DPrintf ("Multitexture disabled, could not find required " - "functions\n"); + Sys_MaskPrintf (SYS_DEV, "Multitexture disabled, could not " + "find required functions\n"); } else { - Sys_DPrintf ("Multitexture disabled, not enough TMUs.\n"); + Sys_MaskPrintf (SYS_DEV, + "Multitexture disabled, not enough TMUs.\n"); } } else { - Sys_DPrintf ("not found.\n"); + Sys_MaskPrintf (SYS_DEV, "not found.\n"); } } @@ -481,7 +489,7 @@ CheckLights (void) specular[4] = {0.1, 0.1, 0.1, 1.0}; qfglGetIntegerv (GL_MAX_LIGHTS, &gl_max_lights); - Sys_DPrintf ("Max GL Lights %d.\n", gl_max_lights); + Sys_MaskPrintf (SYS_DEV, "Max GL Lights %d.\n", gl_max_lights); qfglEnable (GL_LIGHTING); qfglLightModelfv (GL_LIGHT_MODEL_AMBIENT, dark); @@ -516,7 +524,7 @@ VID_SetPalette (unsigned char *palette) QFile *f; // 8 8 8 encoding - Sys_DPrintf ("Converting 8to24\n"); + Sys_MaskPrintf (SYS_DEV, "Converting 8to24\n"); pal = palette; table = d_8to24table; @@ -635,11 +643,11 @@ Tdfx_Init8bitPalette (void) if (!(qgl3DfxSetPaletteEXT = QFGL_ExtensionAddress ("gl3DfxSetPaletteEXT"))) { - Sys_DPrintf ("3DFX_set_global_palette not found.\n"); + Sys_MaskPrintf (SYS_DEV, "3DFX_set_global_palette not found.\n"); return; } - Sys_DPrintf ("3DFX_set_global_palette.\n"); + Sys_MaskPrintf (SYS_DEV, "3DFX_set_global_palette.\n"); oldpal = (char *) d_8to24table; // d_8to24table3dfx; for (i = 0; i < 256; i++) { @@ -653,7 +661,7 @@ Tdfx_Init8bitPalette (void) qgl3DfxSetPaletteEXT ((GLuint *) table); is8bit = true; } else { - Sys_DPrintf ("\n 3DFX_set_global_palette not found."); + Sys_MaskPrintf (SYS_DEV, "\n 3DFX_set_global_palette not found."); } } @@ -678,11 +686,11 @@ Shared_Init8bitPalette (void) if (QFGL_ExtensionPresent ("GL_EXT_shared_texture_palette")) { if (!(qglColorTableEXT = QFGL_ExtensionAddress ("glColorTableEXT"))) { - Sys_DPrintf ("glColorTableEXT not found.\n"); + Sys_MaskPrintf (SYS_DEV, "glColorTableEXT not found.\n"); return; } - Sys_DPrintf ("GL_EXT_shared_texture_palette\n"); + Sys_MaskPrintf (SYS_DEV, "GL_EXT_shared_texture_palette\n"); qfglEnable (GL_SHARED_TEXTURE_PALETTE_EXT); oldPalette = (GLubyte *) d_8to24table; // d_8to24table3dfx; @@ -697,21 +705,22 @@ Shared_Init8bitPalette (void) GL_UNSIGNED_BYTE, (GLvoid *) thePalette); is8bit = true; } else { - Sys_DPrintf ("\n GL_EXT_shared_texture_palette not found."); + Sys_MaskPrintf (SYS_DEV, + "\n GL_EXT_shared_texture_palette not found."); } } void VID_Init8bitPalette (void) { - Sys_DPrintf ("Checking for 8-bit extension: "); + Sys_MaskPrintf (SYS_DEV, "Checking for 8-bit extension: "); if (vid_use8bit->int_val) { Tdfx_Init8bitPalette (); Shared_Init8bitPalette (); if (!is8bit) - Sys_DPrintf ("\n 8-bit extension not found.\n"); + Sys_MaskPrintf (SYS_DEV, "\n 8-bit extension not found.\n"); } else { - Sys_DPrintf ("disabled.\n"); + Sys_MaskPrintf (SYS_DEV, "disabled.\n"); } } diff --git a/libs/video/targets/vid_fbdev.c b/libs/video/targets/vid_fbdev.c index a6a758827..998430792 100644 --- a/libs/video/targets/vid_fbdev.c +++ b/libs/video/targets/vid_fbdev.c @@ -215,7 +215,7 @@ static struct fb_var_screeninfo orig_var; void VID_Shutdown (void) { - Sys_DPrintf ("VID_Shutdown\n"); + Sys_MaskPrintf (SYS_DEV, "VID_Shutdown\n"); if (!fbdev_inited) return; diff --git a/libs/video/targets/vid_glx.c b/libs/video/targets/vid_glx.c index e1cfe4ab4..f0d6ba674 100644 --- a/libs/video/targets/vid_glx.c +++ b/libs/video/targets/vid_glx.c @@ -154,7 +154,7 @@ QFGL_LoadLibrary (void) void VID_Shutdown (void) { - Sys_DPrintf ("VID_Shutdown\n"); + Sys_MaskPrintf (SYS_DEV, "VID_Shutdown\n"); X11_CloseDisplay (); } @@ -242,7 +242,8 @@ VID_Init (unsigned char *palette) VID_Init8bitPalette (); VID_SetPalette (vid.palette); - Sys_DPrintf ("Video mode %dx%d initialized.\n", vid.width, vid.height); + Sys_MaskPrintf (SYS_DEV, "Video mode %dx%d initialized.\n", + vid.width, vid.height); vid.initialized = true; diff --git a/libs/video/targets/vid_sgl.c b/libs/video/targets/vid_sgl.c index 1594954e1..ee61abe45 100644 --- a/libs/video/targets/vid_sgl.c +++ b/libs/video/targets/vid_sgl.c @@ -176,7 +176,8 @@ success: VID_SetPalette (vid.palette); VID_Init8bitPalette (); // Check for 3DFX Extensions and initialize them. - Sys_DPrintf ("Video mode %dx%d initialized.\n", vid.width, vid.height); + Sys_MaskPrintf (SYS_DEV, "Video mode %dx%d initialized.\n", + vid.width, vid.height); vid.initialized = true; diff --git a/libs/video/targets/vid_svgalib.c b/libs/video/targets/vid_svgalib.c index 6bf00d313..625e63f67 100644 --- a/libs/video/targets/vid_svgalib.c +++ b/libs/video/targets/vid_svgalib.c @@ -245,7 +245,7 @@ get_mode (int width, int height, int depth) void VID_Shutdown (void) { - Sys_DPrintf ("VID_Shutdown\n"); + Sys_MaskPrintf (SYS_DEV, "VID_Shutdown\n"); if (!svgalib_inited) return; diff --git a/libs/video/targets/vid_x11.c b/libs/video/targets/vid_x11.c index ec616b405..c4c3da603 100644 --- a/libs/video/targets/vid_x11.c +++ b/libs/video/targets/vid_x11.c @@ -346,8 +346,8 @@ ResetSharedFrameBuffers (void) // attach to the shared memory segment x_shminfo[frm].shmaddr = (void *) shmat (x_shminfo[frm].shmid, 0, 0); - Sys_DPrintf ("VID: shared memory id=%d, addr=0x%lx\n", - x_shminfo[frm].shmid, (long) x_shminfo[frm].shmaddr); + Sys_MaskPrintf (SYS_DEV, "VID: shared memory id=%d, addr=0x%lx\n", + x_shminfo[frm].shmid, (long) x_shminfo[frm].shmaddr); x_framebuffer[frm]->data = x_shminfo[frm].shmaddr; @@ -448,10 +448,12 @@ VID_Init (unsigned char *palette) x_vis = x_visinfo->visual; if (num_visuals > 1) { - Sys_DPrintf ("Found more than one visual id at depth %d:\n", - template.depth); + Sys_MaskPrintf (SYS_DEV, + "Found more than one visual id at depth %d:\n", + template.depth); for (i = 0; i < num_visuals; i++) - Sys_DPrintf (" -visualid %d\n", (int) x_visinfo[i].visualid); + Sys_MaskPrintf (SYS_DEV, " -visualid %d\n", + (int) x_visinfo[i].visualid); } else { if (num_visuals == 0) { if (template_mask == VisualIDMask) { @@ -463,15 +465,21 @@ VID_Init (unsigned char *palette) } if (verbose) { - Sys_DPrintf ("Using visualid %d:\n", (int) x_visinfo->visualid); - Sys_DPrintf (" class %d\n", x_visinfo->class); - Sys_DPrintf (" screen %d\n", x_visinfo->screen); - Sys_DPrintf (" depth %d\n", x_visinfo->depth); - Sys_DPrintf (" red_mask 0x%x\n", (int) x_visinfo->red_mask); - Sys_DPrintf (" green_mask 0x%x\n", (int) x_visinfo->green_mask); - Sys_DPrintf (" blue_mask 0x%x\n", (int) x_visinfo->blue_mask); - Sys_DPrintf (" colormap_size %d\n", x_visinfo->colormap_size); - Sys_DPrintf (" bits_per_rgb %d\n", x_visinfo->bits_per_rgb); + Sys_MaskPrintf (SYS_DEV, "Using visualid %d:\n", + (int) x_visinfo->visualid); + Sys_MaskPrintf (SYS_DEV, " class %d\n", x_visinfo->class); + Sys_MaskPrintf (SYS_DEV, " screen %d\n", x_visinfo->screen); + Sys_MaskPrintf (SYS_DEV, " depth %d\n", x_visinfo->depth); + Sys_MaskPrintf (SYS_DEV, " red_mask 0x%x\n", + (int) x_visinfo->red_mask); + Sys_MaskPrintf (SYS_DEV, " green_mask 0x%x\n", + (int) x_visinfo->green_mask); + Sys_MaskPrintf (SYS_DEV, " blue_mask 0x%x\n", + (int) x_visinfo->blue_mask); + Sys_MaskPrintf (SYS_DEV, " colormap_size %d\n", + x_visinfo->colormap_size); + Sys_MaskPrintf (SYS_DEV, " bits_per_rgb %d\n", + x_visinfo->bits_per_rgb); } /* Setup attributes for main window */ @@ -575,7 +583,7 @@ VID_SetPalette (unsigned char *palette) void VID_Shutdown (void) { - Sys_DPrintf ("VID_Shutdown\n"); + Sys_MaskPrintf (SYS_DEV, "VID_Shutdown\n"); X11_CloseDisplay (); } diff --git a/nq/source/cl_main.c b/nq/source/cl_main.c index 2a30d4977..40f8c4db1 100644 --- a/nq/source/cl_main.c +++ b/nq/source/cl_main.c @@ -219,7 +219,7 @@ CL_Disconnect (void) if (cls.demorecording) CL_Stop_f (); - Sys_DPrintf ("Sending clc_disconnect\n"); + Sys_MaskPrintf (SYS_DEV, "Sending clc_disconnect\n"); SZ_Clear (&cls.message); MSG_WriteByte (&cls.message, clc_disconnect); NET_SendUnreliableMessage (cls.netcon, &cls.message); @@ -262,7 +262,8 @@ CL_EstablishConnection (const char *host) cls.netcon = NET_Connect (host); if (!cls.netcon) Host_Error ("CL_Connect: connect failed\n"); - Sys_DPrintf ("CL_EstablishConnection: connected to %s\n", host); + Sys_MaskPrintf (SYS_DEV, "CL_EstablishConnection: connected to %s\n", + host); cls.demonum = -1; // not in the demo loop now CL_SetState (ca_connected); @@ -282,7 +283,7 @@ CL_SignonReply (void) { char str[8192]; - Sys_DPrintf ("CL_SignonReply: %i\n", cls.signon); + Sys_MaskPrintf (SYS_DEV, "CL_SignonReply: %i\n", cls.signon); switch (cls.signon) { case 1: @@ -698,7 +699,7 @@ CL_SendCmd (void) return; // no message at all if (!NET_CanSendMessage (cls.netcon)) { - Sys_DPrintf ("CL_WriteToServer: can't send\n"); + Sys_MaskPrintf (SYS_DEV, "CL_WriteToServer: can't send\n"); return; } diff --git a/nq/source/cl_parse.c b/nq/source/cl_parse.c index b208fc60d..9407f1d0f 100644 --- a/nq/source/cl_parse.c +++ b/nq/source/cl_parse.c @@ -265,7 +265,7 @@ CL_ParseServerInfo (void) const char *str; int nummodels, numsounds, i; - Sys_DPrintf ("Serverinfo packet received.\n"); + Sys_MaskPrintf (SYS_DEV, "Serverinfo packet received.\n"); S_BlockSound (); S_StopAllSounds (); diff --git a/nq/source/host.c b/nq/source/host.c index 422516e6f..5a7e6fac9 100644 --- a/nq/source/host.c +++ b/nq/source/host.c @@ -146,7 +146,7 @@ Host_EndGame (const char *message, ...) va_start (argptr, message); dvsprintf (str, message, argptr); va_end (argptr); - Sys_DPrintf ("Host_EndGame: %s\n", str->str); + Sys_MaskPrintf (SYS_DEV, "Host_EndGame: %s\n", str->str); if (sv.active) Host_ShutdownServer (false); @@ -512,7 +512,7 @@ Host_ShutdownServer (qboolean crash) void Host_ClearMemory (void) { - Sys_DPrintf ("Clearing memory\n"); + Sys_MaskPrintf (SYS_DEV, "Clearing memory\n"); D_FlushCaches (); Mod_ClearAll (); if (host_hunklevel) diff --git a/nq/source/sv_cl_phys.c b/nq/source/sv_cl_phys.c index 7fa529bad..ac3759969 100644 --- a/nq/source/sv_cl_phys.c +++ b/nq/source/sv_cl_phys.c @@ -64,7 +64,7 @@ SV_CheckStuck (edict_t *ent) VectorCopy (SVvector (ent, origin), org); VectorCopy (SVvector (ent, oldorigin), SVvector (ent, origin)); if (!SV_TestEntityPosition (ent)) { - Sys_DPrintf ("Unstuck.\n"); + Sys_MaskPrintf (SYS_DEV, "Unstuck.\n"); SV_LinkEdict (ent, true); return; } @@ -76,14 +76,14 @@ SV_CheckStuck (edict_t *ent) SVvector (ent, origin)[1] = org[1] + j; SVvector (ent, origin)[2] = org[2] + z; if (!SV_TestEntityPosition (ent)) { - Sys_DPrintf ("Unstuck.\n"); + Sys_MaskPrintf (SYS_DEV, "Unstuck.\n"); SV_LinkEdict (ent, true); return; } } VectorCopy (org, SVvector (ent, origin)); - Sys_DPrintf ("player is stuck.\n"); + Sys_MaskPrintf (SYS_DEV, "player is stuck.\n"); } static qboolean @@ -206,7 +206,7 @@ SV_TryUnstick (edict_t *ent, vec3_t oldvel) if (fabs (oldorg[1] - SVvector (ent, origin)[1]) > 4 || fabs (oldorg[0] - SVvector (ent, origin)[0]) > 4) { -// Sys_DPrintf ("unstuck!\n"); +// Sys_MaskPrintf (SYS_DEV, "unstuck!\n"); return clip; } // go back to the original pos and try again diff --git a/nq/source/sv_main.c b/nq/source/sv_main.c index b9c5e8f2c..b5719b083 100644 --- a/nq/source/sv_main.c +++ b/nq/source/sv_main.c @@ -247,7 +247,8 @@ SV_ConnectClient (int clientnum) client = svs.clients + clientnum; - Sys_DPrintf ("Client %s connected\n", client->netconnection->address); + Sys_MaskPrintf (SYS_DEV, "Client %s connected\n", + client->netconnection->address); edictnum = clientnum + 1; @@ -908,7 +909,7 @@ SV_SpawnServer (const char *server) if (hostname->string[0] == 0) Cvar_Set (hostname, "UNNAMED"); - Sys_DPrintf ("SpawnServer: %s\n", server); + Sys_MaskPrintf (SYS_DEV, "SpawnServer: %s\n", server); svs.changelevel_issued = false; // now safe to issue another // tell all connected clients that we are going to a new level @@ -1039,6 +1040,6 @@ SV_SpawnServer (const char *server) if (host_client->active) SV_SendServerinfo (host_client); - Sys_DPrintf ("Server spawned.\n"); + Sys_MaskPrintf (SYS_DEV, "Server spawned.\n"); S_UnblockSound (); } diff --git a/nq/source/sv_progs.c b/nq/source/sv_progs.c index 244c33680..f796efd83 100644 --- a/nq/source/sv_progs.c +++ b/nq/source/sv_progs.c @@ -486,7 +486,7 @@ SV_LoadProgs (void) sv_range = PR_RANGE_NONE; range = "None"; } - Sys_DPrintf ("Using %s builtin extention mapping\n", range); + Sys_MaskPrintf (SYS_DEV, "Using %s builtin extention mapping\n", range); memset (&sv_globals, 0, sizeof (sv_funcs)); memset (&sv_funcs, 0, sizeof (sv_funcs)); diff --git a/nq/source/sv_user.c b/nq/source/sv_user.c index 6276cb93e..cc824bb1d 100644 --- a/nq/source/sv_user.c +++ b/nq/source/sv_user.c @@ -540,7 +540,8 @@ SV_ReadClientMessage (void) else if (ret == 1) Cmd_ExecuteString (s, src_client); else - Sys_DPrintf ("%s tried to %s\n", host_client->name, s); + Sys_MaskPrintf (SYS_DEV, "%s tried to %s\n", + host_client->name, s); break; case clc_disconnect: diff --git a/qtv/source/client.c b/qtv/source/client.c index 5074b6913..370f00388 100644 --- a/qtv/source/client.c +++ b/qtv/source/client.c @@ -581,11 +581,12 @@ client_parse_message (client_t *cl) MSG_GetReadCount (net_message) - checksumIndex - 1, seq_hash); if (calculatedChecksum != checksum) { - Sys_DPrintf - ("Failed command checksum for %s(%d) (%d != %d)\n", - Info_ValueForKey (cl->userinfo, "name"), - cl->netchan.incoming_sequence, checksum, - calculatedChecksum); + Sys_MaskPrintf (SYS_DEV, + "Failed command checksum for %s(%d) " + "(%d != %d)\n", + Info_ValueForKey (cl->userinfo, "name"), + cl->netchan.incoming_sequence, checksum, + calculatedChecksum); return; } // if (!sv.paused) { diff --git a/qw/source/cl_ents.c b/qw/source/cl_ents.c index b7c2527cb..848a3a9da 100644 --- a/qw/source/cl_ents.c +++ b/qw/source/cl_ents.c @@ -262,7 +262,7 @@ FlushEntityPacket (void) entity_state_t olde, newe; int word; - Sys_DPrintf ("FlushEntityPacket\n"); + Sys_MaskPrintf (SYS_DEV, "FlushEntityPacket\n"); memset (&olde, 0, sizeof (olde)); @@ -303,7 +303,7 @@ CL_ParsePacketEntities (qboolean delta) if (cls.demoplayback2) from = oldpacket = (cls.netchan.incoming_sequence - 1); if ((from & UPDATE_MASK) != (oldpacket & UPDATE_MASK)) - Sys_DPrintf ("WARNING: from mismatch\n"); + Sys_MaskPrintf (SYS_DEV, "WARNING: from mismatch\n"); } else oldpacket = -1; @@ -1078,11 +1078,11 @@ CL_SetUpPlayerPrediction (qboolean dopred) msec = 500 * (playertime - state->state_time); if (msec <= 0 || !dopred) { VectorCopy (state->pls.origin, pplayer->origin); -// Sys_DPrintf ("nopredict\n"); +// Sys_MaskPrintf (SYS_DEV, "nopredict\n"); } else { // predict players movement state->pls.cmd.msec = msec = min (msec, 255); -// Sys_DPrintf ("predict: %i\n", msec); +// Sys_MaskPrintf (SYS_DEV, "predict: %i\n", msec); CL_PredictUsercmd (state, &exact, &state->pls.cmd, false); VectorCopy (exact.pls.origin, pplayer->origin); diff --git a/qw/source/cl_main.c b/qw/source/cl_main.c index 483a1f55f..4086285bb 100644 --- a/qw/source/cl_main.c +++ b/qw/source/cl_main.c @@ -416,7 +416,7 @@ CL_ClearState (void) CL_Init_Entity (&cl.viewent); - Sys_DPrintf ("Clearing memory\n"); + Sys_MaskPrintf (SYS_DEV, "Clearing memory\n"); D_FlushCaches (); Mod_ClearAll (); if (host_hunklevel) // FIXME: check this... @@ -603,10 +603,11 @@ CL_FullServerinfo_f (void) return; } - Sys_DPrintf ("Cmd_Argv (1): '%s'\n", Cmd_Argv (1)); + Sys_MaskPrintf (SYS_DEV, "Cmd_Argv (1): '%s'\n", Cmd_Argv (1)); Info_Destroy (cl.serverinfo); cl.serverinfo = Info_ParseString (Cmd_Argv (1), MAX_SERVERINFO_STRING, 0); - Sys_DPrintf ("cl.serverinfo: '%s'\n", Info_MakeString (cl.serverinfo, 0)); + Sys_MaskPrintf (SYS_DEV, "cl.serverinfo: '%s'\n", + Info_MakeString (cl.serverinfo, 0)); if ((p = Info_ValueForKey (cl.serverinfo, "*qf_version")) && *p) { if (server_version == NULL) @@ -1046,8 +1047,9 @@ CL_ReadPackets (void) // packet from server if (!cls.demoplayback && !NET_CompareAdr (net_from, cls.netchan.remote_address)) { - Sys_DPrintf ("%s:sequenced packet without connection\n", - NET_AdrToString (net_from)); + Sys_MaskPrintf (SYS_DEV, + "%s:sequenced packet without connection\n", + NET_AdrToString (net_from)); continue; } if (!cls.demoplayback2) { @@ -1143,7 +1145,7 @@ CL_SetState (cactive_t state) }; cactive_t old_state = cls.state; - Sys_DPrintf ("CL_SetState (%s)\n", state_names[state]); + Sys_MaskPrintf (SYS_DEV, "CL_SetState (%s)\n", state_names[state]); cls.state = state; if (old_state != state) { if (old_state == ca_active) { diff --git a/qw/source/cl_parse.c b/qw/source/cl_parse.c index 858517770..e6a57540c 100644 --- a/qw/source/cl_parse.c +++ b/qw/source/cl_parse.c @@ -414,7 +414,7 @@ CL_RequestNextDownload (void) break; case dl_none: default: - Sys_DPrintf ("Unknown download type.\n"); + Sys_MaskPrintf (SYS_DEV, "Unknown download type.\n"); } } @@ -650,7 +650,7 @@ CL_NextUpload (void) MSG_WriteByte (&cls.netchan.message, percent); SZ_Write (&cls.netchan.message, buffer, r); - Sys_DPrintf ("UPLOAD: %6d: %d written\n", upload_pos - r, r); + Sys_MaskPrintf (SYS_DEV, "UPLOAD: %6d: %d written\n", upload_pos - r, r); if (upload_pos != upload_size) return; @@ -672,7 +672,7 @@ CL_StartUpload (byte * data, int size) if (upload_data) free (upload_data); - Sys_DPrintf ("Upload starting of %d...\n", size); + Sys_MaskPrintf (SYS_DEV, "Upload starting of %d...\n", size); upload_data = malloc (size); memcpy (upload_data, data, size); @@ -723,7 +723,7 @@ CL_ParseServerData (void) int protover; qboolean cflag = false; - Sys_DPrintf ("Serverdata packet received.\n"); + Sys_MaskPrintf (SYS_DEV, "Serverdata packet received.\n"); // wipe the client_state_t struct CL_ClearState (); @@ -1116,7 +1116,7 @@ CL_SetInfo (void) strncpy (value, MSG_ReadString (net_message), sizeof (value) - 1); key[sizeof (value) - 1] = 0; - Sys_DPrintf ("SETINFO %s: %s=%s\n", player->name, key, value); + Sys_MaskPrintf (SYS_DEV, "SETINFO %s: %s=%s\n", player->name, key, value); if (!player->userinfo) player->userinfo = Info_ParseString ("", MAX_INFO_STRING, 0); @@ -1138,7 +1138,7 @@ CL_ServerInfo (void) strncpy (value, MSG_ReadString (net_message), sizeof (value) - 1); key[sizeof (value) - 1] = 0; - Sys_DPrintf ("SERVERINFO: %s=%s\n", key, value); + Sys_MaskPrintf (SYS_DEV, "SERVERINFO: %s=%s\n", key, value); Info_SetValueForKey (cl.serverinfo, key, value, 0); if (strequal (key, "chase")) { @@ -1333,15 +1333,16 @@ CL_ParseServerMessage (void) s = MSG_ReadString (net_message); if (s[strlen (s) - 1] == '\n') { if (stuffbuf && stuffbuf->str[0]) { - Sys_DPrintf ("stufftext: %s%s\n", stuffbuf->str, s); + Sys_MaskPrintf (SYS_DEV, "stufftext: %s%s\n", + stuffbuf->str, s); Cbuf_AddText (cl_stbuf, stuffbuf->str); dstring_clearstr (stuffbuf); } else { - Sys_DPrintf ("stufftext: %s\n", s); + Sys_MaskPrintf (SYS_DEV, "stufftext: %s\n", s); } Cbuf_AddText (cl_stbuf, s); } else { - Sys_DPrintf ("partial stufftext: %s\n", s); + Sys_MaskPrintf (SYS_DEV, "partial stufftext: %s\n", s); if (!stuffbuf) stuffbuf = dstring_newstr (); dstring_appendstr (stuffbuf, s); @@ -1471,21 +1472,21 @@ CL_ParseServerMessage (void) break; case svc_intermission: - Sys_DPrintf ("svc_intermission\n"); + Sys_MaskPrintf (SYS_DEV, "svc_intermission\n"); cl.intermission = 1; r_force_fullscreen = 1; cl.completed_time = realtime; vid.recalc_refdef = true; // go to full screen - Sys_DPrintf ("intermission simorg: "); + Sys_MaskPrintf (SYS_DEV, "intermission simorg: "); MSG_ReadCoordV (net_message, cl.simorg); for (i = 0; i < 3; i++) - Sys_DPrintf ("%f ", cl.simorg[i]); - Sys_DPrintf ("\nintermission simangles: "); + Sys_MaskPrintf (SYS_DEV, "%f ", cl.simorg[i]); + Sys_MaskPrintf (SYS_DEV, "\nintermission simangles: "); MSG_ReadAngleV (net_message, cl.simangles); for (i = 0; i < 3; i++) - Sys_DPrintf ("%f ", cl.simangles[i]); - Sys_DPrintf ("\n"); + Sys_MaskPrintf (SYS_DEV, "%f ", cl.simangles[i]); + Sys_MaskPrintf (SYS_DEV, "\n"); VectorZero (cl.simvel); // automatic fraglogging (by elmex) diff --git a/qw/source/crudefile.c b/qw/source/crudefile.c index 2b0bc2852..ffa40fc7f 100644 --- a/qw/source/crudefile.c +++ b/qw/source/crudefile.c @@ -184,8 +184,8 @@ CF_CloseAllFiles () for (i = 0; i < cf_filepcount; i++) if (cf_filep[i].file) { - Sys_DPrintf ("Warning: closing Crude File %d left over from last " - "map\n", i); + Sys_MaskPrintf (SYS_DEV, "Warning: closing Crude File %d left " + "over from last map\n", i); CF_Close (i); } } diff --git a/qw/source/pmove.c b/qw/source/pmove.c index db9f48c06..7c3ff6664 100644 --- a/qw/source/pmove.c +++ b/qw/source/pmove.c @@ -720,7 +720,7 @@ NudgePosition (void) } } VectorCopy (base, pmove.origin); -// Sys_DPrintf ("NudgePosition: stuck\n"); +// Sys_MaskPrintf (SYS_DEV, "NudgePosition: stuck\n"); } static void diff --git a/qw/source/sv_init.c b/qw/source/sv_init.c index 919a790e1..3ed9dc0a2 100644 --- a/qw/source/sv_init.c +++ b/qw/source/sv_init.c @@ -309,7 +309,7 @@ SV_SpawnServer (const char *server) int i; struct recorder_s *recorders; - Sys_DPrintf ("SpawnServer: %s\n", server); + Sys_MaskPrintf (SYS_DEV, "SpawnServer: %s\n", server); SV_SaveSpawnparms (); @@ -449,7 +449,7 @@ SV_SpawnServer (const char *server) sv.signon_buffer_size[sv.num_signon_buffers - 1] = sv.signon.cursize; Info_SetValueForKey (svs.info, "map", sv.name, !sv_highchars->int_val); - Sys_DPrintf ("Server spawned.\n"); + Sys_MaskPrintf (SYS_DEV, "Server spawned.\n"); if (sv_map_e->func) GIB_Event_Callback (sv_map_e, 1, server); } diff --git a/qw/source/sv_main.c b/qw/source/sv_main.c index 542130f40..5bf45e03d 100644 --- a/qw/source/sv_main.c +++ b/qw/source/sv_main.c @@ -633,8 +633,8 @@ SVC_Log (void) return; } - Sys_DPrintf ("sending log %i to %s\n", svs.logsequence - 1, - NET_AdrToString (net_from)); + Sys_MaskPrintf (SYS_DEV, "sending log %i to %s\n", svs.logsequence - 1, + NET_AdrToString (net_from)); // snprintf (data, sizeof (data), "stdlog %i\n", svs.logsequence - 1); // strncat (data, (char *) svs.log_buf[((svs.logsequence - 1) & 1)], @@ -1794,7 +1794,8 @@ SV_ReadPackets (void) if (cl->netchan.qport != qport) continue; if (cl->netchan.remote_address.port != net_from.port) { - Sys_DPrintf ("SV_ReadPackets: fixing up a translated port\n"); + Sys_MaskPrintf (SYS_DEV, "SV_ReadPackets: fixing up a " + "translated port\n"); cl->netchan.remote_address.port = net_from.port; } if (Netchan_Process (&cl->netchan)) { diff --git a/qw/source/sv_pr_cmds.c b/qw/source/sv_pr_cmds.c index ae5a0c9d9..aa1b48f37 100644 --- a/qw/source/sv_pr_cmds.c +++ b/qw/source/sv_pr_cmds.c @@ -751,7 +751,7 @@ do_precache (progs_t *pr, const char **cache, int max, const char *name, char *c = Hunk_Alloc (strlen (s) + 1); strcpy (c, s); cache[i] = c; // blah, const - Sys_DPrintf ("%s: %3d %s\n", func, i, s); + Sys_MaskPrintf (SYS_DEV, "%s: %3d %s\n", func, i, s); return; } if (!strcmp (cache[i], s)) diff --git a/qw/source/sv_progs.c b/qw/source/sv_progs.c index 5519c9996..2542739bc 100644 --- a/qw/source/sv_progs.c +++ b/qw/source/sv_progs.c @@ -498,7 +498,7 @@ SV_LoadProgs (void) sv_range = PR_RANGE_NONE; range = "None"; } - Sys_DPrintf ("Using %s builtin extention mapping\n", range); + Sys_MaskPrintf (SYS_DEV, "Using %s builtin extention mapping\n", range); memset (&sv_globals, 0, sizeof (sv_funcs)); memset (&sv_funcs, 0, sizeof (sv_funcs)); diff --git a/qw/source/sv_qtv.c b/qw/source/sv_qtv.c index c5e699542..281b905c9 100644 --- a/qw/source/sv_qtv.c +++ b/qw/source/sv_qtv.c @@ -436,7 +436,8 @@ SV_qtvPacket (int qport) if (proxies[i].netchan.qport != qport) continue; if (proxies[i].netchan.remote_address.port != net_from.port) { - Sys_DPrintf ("SV_ReadPackets: fixing up a translated port\n"); + Sys_MaskPrintf (SYS_DEV, + "SV_ReadPackets: fixing up a translated port\n"); proxies[i].netchan.remote_address.port = net_from.port; } if (Netchan_Process (&proxies[i].netchan)) { diff --git a/qw/source/sv_user.c b/qw/source/sv_user.c index 75b761109..854029db2 100644 --- a/qw/source/sv_user.c +++ b/qw/source/sv_user.c @@ -325,7 +325,7 @@ SV_PreSpawn_f (void *unused) // should be three numbers following containing checksums check = atoi (Cmd_Argv (3)); -// Sys_DPrintf ("Client check = %d\n", check); +// Sys_MaskPrintf (SYS_DEV, , "Client check = %d\n", check); if (sv_mapcheck->int_val && check != sv.worldmodel->checksum && check != sv.worldmodel->checksum2) { @@ -678,7 +678,7 @@ SV_NextUpload (void) net_message->readcount, size); net_message->readcount += size; - Sys_DPrintf ("UPLOAD: %d received\n", size); + Sys_MaskPrintf (SYS_DEV, "UPLOAD: %d received\n", size); if (percent != 100) { MSG_ReliableWrite_Begin (&host_client->backbuf, svc_stufftext, 8); @@ -1925,10 +1925,11 @@ SV_ExecuteClientMessage (client_t *cl) checksumIndex - 1, seq_hash); if (calculatedChecksum != checksum) { - Sys_DPrintf - ("Failed command checksum for %s(%d) (%d != %d)\n", - cl->name, cl->netchan.incoming_sequence, checksum, - calculatedChecksum); + Sys_MaskPrintf (SYS_DEV, + "Failed command checksum for %s(%d) " + "(%d != %d)\n", + cl->name, cl->netchan.incoming_sequence, + checksum, calculatedChecksum); return; } From 31c13d92a2a58634659c88464c679a2477cab884 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 24 Aug 2010 09:53:54 +0900 Subject: [PATCH 104/115] Protocol 666/large map support from FitzQuake. Alpha and lerping aren't implemented yet, but things seem to be working. I can load and play oms2.bsp (Conflagrant Rodent). --- include/QF/bspfile.h | 3 +- include/QF/msg.h | 4 +- include/QF/qdefs.h | 3 - include/netmain.h | 2 +- include/snd_render.h | 2 +- libs/models/brush/model_brush.c | 76 ++++++- libs/util/msg.c | 32 ++- libs/video/renderer/gl/gl_sky.c | 2 +- libs/video/renderer/sw/sw_rsky.c | 4 +- libs/video/renderer/sw32/sw32_rsky.c | 4 +- nq/include/client.h | 6 +- nq/include/game.h | 13 +- nq/include/protocol.h | 103 +++++---- nq/include/server.h | 6 +- nq/source/cl_input.c | 3 +- nq/source/cl_main.c | 6 +- nq/source/cl_parse.c | 303 ++++++++++++++++++-------- nq/source/host.c | 3 + nq/source/sv_main.c | 307 ++++++++++++++++++++++----- nq/source/sv_phys.c | 27 ++- nq/source/sv_pr_cmds.c | 69 +++++- nq/source/sv_user.c | 5 +- qtv/include/server.h | 1 + qw/include/client.h | 1 + qw/include/server.h | 1 + 25 files changed, 758 insertions(+), 228 deletions(-) diff --git a/include/QF/bspfile.h b/include/QF/bspfile.h index e0674aed6..5addb86c6 100644 --- a/include/QF/bspfile.h +++ b/include/QF/bspfile.h @@ -41,11 +41,9 @@ #define MAX_MAP_ENTSTRING 65536 #define MAX_MAP_PLANES 32767 -//#define MAX_MAP_PLANES 8192 #define MAX_MAP_NODES 32767 // because negative shorts are contents #define MAX_MAP_CLIPNODES 32767 // #define MAX_MAP_LEAFS 32767 // -//#define MAX_MAP_LEAFS 8192 #define MAX_MAP_VERTS 65535 #define MAX_MAP_FACES 65535 #define MAX_MAP_MARKSURFACES 65535 @@ -181,6 +179,7 @@ typedef struct texinfo_s { int32_t flags; } texinfo_t; #define TEX_SPECIAL 1 // sky or slime, no lightmap or 256 subdivision +#define TEX_MISSING 2 // this texinfo does not have a texture // note that edge 0 is never used, because negative edge nums are used for // counterclockwise use of the edge in a face diff --git a/include/QF/msg.h b/include/QF/msg.h index bbcaa4620..3442e2f5d 100644 --- a/include/QF/msg.h +++ b/include/QF/msg.h @@ -46,7 +46,8 @@ void MSG_WriteCoordAngleV (sizebuf_t *sb, const vec3_t coord, const vec3_t angles); void MSG_WriteAngle (sizebuf_t *sb, float angle); void MSG_WriteAngleV (sizebuf_t *sb, const vec3_t angles); -void MSG_WriteAngle16 (sizebuf_t *sb, float angle16); +void MSG_WriteAngle16 (sizebuf_t *sb, float angle); +void MSG_WriteAngle16V (sizebuf_t *sb, const vec3_t angle); void MSG_WriteUTF8 (sizebuf_t *sb, unsigned utf8); typedef struct msg_s { @@ -72,6 +73,7 @@ float MSG_ReadAngle (qmsg_t *msg); void MSG_ReadCoordAngleV (qmsg_t *msg, vec3_t coord, vec3_t angles); void MSG_ReadAngleV (qmsg_t *msg, vec3_t angles); float MSG_ReadAngle16 (qmsg_t *msg); +void MSG_ReadAngle16V (qmsg_t *msg, vec3_t angles); int MSG_ReadUTF8 (qmsg_t *msg); //@} diff --git a/include/QF/qdefs.h b/include/QF/qdefs.h index 2908686cd..eb377eb05 100644 --- a/include/QF/qdefs.h +++ b/include/QF/qdefs.h @@ -34,12 +34,9 @@ #define MAX_QPATH 64 #define MAX_CL_STATS 32 #define NUM_CSHIFTS 4 -#define MAX_MODELS 256 -#define MAX_SOUNDS 256 #define MAX_SCOREBOARD 16 #define MAX_SCOREBOARDNAME 32 #define MAX_STYLESTRING 64 -#define MAX_EDICTS 768 #define MAX_LIGHTSTYLES 64 #define clc_stringcmd 4 diff --git a/include/netmain.h b/include/netmain.h index 2ebc26a7f..bfd9a5677 100644 --- a/include/netmain.h +++ b/include/netmain.h @@ -41,7 +41,7 @@ struct qsockaddr #define NET_NAMELEN 64 -#define NET_MAXMESSAGE 8192 +#define NET_MAXMESSAGE 32000 #define NET_HEADERSIZE (2 * sizeof(unsigned int)) #define NET_DATAGRAMSIZE (MAX_DATAGRAM + NET_HEADERSIZE) diff --git a/include/snd_render.h b/include/snd_render.h index bd219de28..e8cb10f00 100644 --- a/include/snd_render.h +++ b/include/snd_render.h @@ -297,7 +297,7 @@ void SND_SFX_Init (void); */ //@{ #define MAX_CHANNELS 512 //!< number of available mixing channels -#define MAX_DYNAMIC_CHANNELS 8 //!< number of dynamic channels +#define MAX_DYNAMIC_CHANNELS 128 //!< number of dynamic channels #define MAX_STATIC_CHANNELS 256 //!< number of static channels extern channel_t snd_channels[MAX_CHANNELS]; //!< pool of available channels extern int snd_total_channels; //!< number of active channels diff --git a/libs/models/brush/model_brush.c b/libs/models/brush/model_brush.c index 45fb0c2ef..f61c03d17 100644 --- a/libs/models/brush/model_brush.c +++ b/libs/models/brush/model_brush.c @@ -357,6 +357,18 @@ Mod_LoadSubmodels (bsp_t *bsp) out->firstface = LittleLong (in->firstface); out->numfaces = LittleLong (in->numfaces); } + + out = loadmodel->submodels; + + if (out->visleafs > MAX_MAP_LEAFS) { + Sys_Error ("Mod_LoadSubmodels: too many visleafs (%d, max = %d) in %s", + out->visleafs, MAX_MAP_LEAFS, loadmodel->name); + } + + if (out->visleafs > 8192) + Sys_MaskPrintf (SYS_WARN, + "%i visleafs exceeds standard limit of 8192.\n", + out->visleafs); } static void @@ -473,8 +485,8 @@ CalcSurfaceExtents (msurface_t *s) s->texturemins[i] = bmins[i] * 16; s->extents[i] = (bmaxs[i] - bmins[i]) * 16; - // FIXME even 512 is really too small, need a saner test - if (!(tex->flags & TEX_SPECIAL) && s->extents[i] > 512) + // FIXME even 2000 is really too small, need a saner test + if (!(tex->flags & TEX_SPECIAL) && s->extents[i] > 2000) Sys_Error ("Bad surface extents: %d %x %d %d", i, tex->flags, s->extents[i], LongSwap (s->extents[i])); } @@ -491,6 +503,11 @@ Mod_LoadFaces (bsp_t *bsp) count = bsp->numfaces; out = Hunk_AllocName (count * sizeof (*out), loadname); + if (count > 32767) { + Sys_MaskPrintf (SYS_WARN, + "%i faces exceeds standard limit of 32767.\n", count); + } + loadmodel->surfaces = out; loadmodel->numsurfaces = count; @@ -566,6 +583,11 @@ Mod_LoadNodes (bsp_t *bsp) count = bsp->numnodes; out = Hunk_AllocName (count * sizeof (*out), loadname); + if (count > 32767) { + Sys_MaskPrintf (SYS_WARN, + "%i nodes exceeds standard limit of 32767.\n", count); + } + loadmodel->nodes = out; loadmodel->numnodes = count; @@ -582,11 +604,22 @@ Mod_LoadNodes (bsp_t *bsp) out->numsurfaces = LittleShort (in->numfaces); for (j = 0; j < 2; j++) { - p = LittleShort (in->children[j]); - if (p >= 0) + // handle > 32k nodes. From darkplaces via fitzquake + p = (unsigned short) LittleShort (in->children[j]); + if (p < count) { out->children[j] = loadmodel->nodes + p; - else - out->children[j] = (mnode_t *) (loadmodel->leafs + (-1 - p)); + } else { + p = 65535 - p; //NOTE this uses 65535 intentionally, -1 is leaf + if (p < loadmodel->numleafs) { + out->children[j] = (mnode_t *) (loadmodel->leafs + p); + } else { + Sys_Printf ("Mod_LoadNodes: invalid leaf index %i " + "(file has only %i leafs)\n", p, + loadmodel->numleafs); + //map it to the solid leaf + out->children[j] = (mnode_t *)(loadmodel->leafs); + } + } } } @@ -605,6 +638,9 @@ Mod_LoadLeafs (bsp_t *bsp) count = bsp->numleafs; out = Hunk_AllocName (count * sizeof (*out), loadname); + if (count > 32767) + Sys_Error ("%i leafs exceeds limit of 32767.\n", count); + loadmodel->leafs = out; loadmodel->numleafs = count; // snprintf(s, sizeof (s), "maps/%s.bsp", @@ -621,8 +657,8 @@ Mod_LoadLeafs (bsp_t *bsp) out->contents = p; out->firstmarksurface = loadmodel->marksurfaces + - LittleShort (in->firstmarksurface); - out->nummarksurfaces = LittleShort (in->nummarksurfaces); + (uint16_t) LittleShort (in->firstmarksurface); + out->nummarksurfaces = (uint16_t) LittleShort (in->nummarksurfaces); p = LittleLong (in->visofs); if (p == -1) @@ -657,6 +693,12 @@ Mod_LoadClipnodes (bsp_t *bsp) count = bsp->numclipnodes; out = Hunk_AllocName (count * sizeof (*out), loadname); + if (count > 32767) { + Sys_MaskPrintf (SYS_WARN, + "%i clilpnodes exceeds standard limit of 32767.\n", + count); + } + loadmodel->clipnodes = out; loadmodel->numclipnodes = count; @@ -688,8 +730,14 @@ Mod_LoadClipnodes (bsp_t *bsp) for (i = 0; i < count; i++, out++, in++) { out->planenum = LittleLong (in->planenum); - out->children[0] = LittleShort (in->children[0]); - out->children[1] = LittleShort (in->children[1]); + if (out->planenum < 0 || out->planenum >= loadmodel->numplanes) + Sys_Error ("Mod_LoadClipnodes: planenum out of bounds"); + out->children[0] = (uint16_t) LittleShort (in->children[0]); + out->children[1] = (uint16_t) LittleShort (in->children[1]); + if (out->children[0] >= count) + out->children[0] -= 65536; + if (out->children[1] >= count) + out->children[1] -= 65536; if ((out->children[0] >= 0 && (out->children[0] < hull->firstclipnode || out->children[0] > hull->lastclipnode)) @@ -748,11 +796,17 @@ Mod_LoadMarksurfaces (bsp_t *bsp) count = bsp->nummarksurfaces; out = Hunk_AllocName (count * sizeof (*out), loadname); + if (count > 32767) { + Sys_MaskPrintf (SYS_WARN, + "%i marksurfaces exceeds standard limit of 32767.\n", + count); + } + loadmodel->marksurfaces = out; loadmodel->nummarksurfaces = count; for (i = 0; i < count; i++) { - j = LittleShort (in[i]); + j = (uint16_t) LittleShort (in[i]); if (j >= loadmodel->numsurfaces) Sys_Error ("Mod_ParseMarksurfaces: bad surface number"); out[i] = loadmodel->surfaces + j; diff --git a/libs/util/msg.c b/libs/util/msg.c index d0fd99539..cc7d1d29d 100644 --- a/libs/util/msg.c +++ b/libs/util/msg.c @@ -160,9 +160,24 @@ MSG_WriteAngleV (sizebuf_t *sb, const vec3_t angles) } VISIBLE void -MSG_WriteAngle16 (sizebuf_t *sb, float angle16) +MSG_WriteAngle16 (sizebuf_t *sb, float angle) { - MSG_WriteShort (sb, (int) (angle16 * (65536.0 / 360.0)) & 65535); + MSG_WriteShort (sb, (int) (angle * (65536.0 / 360.0)) & 65535); +} + +VISIBLE void +MSG_WriteAngle16V (sizebuf_t *sb, const vec3_t angles) +{ + byte *buf; + int i; + unsigned short ang; + + buf = SZ_GetSpace (sb, 6); + for (i = 0; i < 3; i++) { + ang = (int) (angles[i] * (65536.0 / 360.0)) & 65535; + *buf++ = ang & 0xff; + *buf++ = ang >> 8; + } } VISIBLE void @@ -383,6 +398,19 @@ MSG_ReadAngle16 (qmsg_t *msg) return MSG_ReadShort (msg) * (360.0 / 65536.0); } +VISIBLE void +MSG_ReadAngle16V (qmsg_t *msg, vec3_t angles) +{ + int i; + short ang; + + for (i = 0; i < 3; i++) { + ang = MSG_ReadByte (msg); + ang |= MSG_ReadByte (msg) << 8; + angles[i] = ang * (360.0 / 65536.0); + } +} + VISIBLE int MSG_ReadUTF8 (qmsg_t *msg) { diff --git a/libs/video/renderer/gl/gl_sky.c b/libs/video/renderer/gl/gl_sky.c index 8ed7c23dd..35bac1871 100644 --- a/libs/video/renderer/gl/gl_sky.c +++ b/libs/video/renderer/gl/gl_sky.c @@ -110,7 +110,7 @@ vec5_t skyvec[6][4] = { } }; -void +VISIBLE void R_LoadSkys (const char *skyname) { const char *name; diff --git a/libs/video/renderer/sw/sw_rsky.c b/libs/video/renderer/sw/sw_rsky.c index 626c896d2..28fd791a6 100644 --- a/libs/video/renderer/sw/sw_rsky.c +++ b/libs/video/renderer/sw/sw_rsky.c @@ -215,12 +215,10 @@ R_SetSkyFrame (void) /* - R_LoadSkys - Stub function for loading a skybox. Currently we have support for skyboxes only in GL targets, so we just do nothing here. --KB */ -void +VISIBLE void R_LoadSkys (const char *name) { } diff --git a/libs/video/renderer/sw32/sw32_rsky.c b/libs/video/renderer/sw32/sw32_rsky.c index ca1163735..253366bb7 100644 --- a/libs/video/renderer/sw32/sw32_rsky.c +++ b/libs/video/renderer/sw32/sw32_rsky.c @@ -216,12 +216,10 @@ R_SetSkyFrame (void) /* - R_LoadSkys - Stub function for loading a skybox. Currently we have support for skyboxes only in GL targets, so we just do nothing here. --KB */ -void +VISIBLE void R_LoadSkys (const char *name) { } diff --git a/nq/include/client.h b/nq/include/client.h index 322effde0..526eff458 100644 --- a/nq/include/client.h +++ b/nq/include/client.h @@ -215,6 +215,8 @@ typedef struct // frag scoreboard scoreboard_t *scores; // [cl.maxclients] + + unsigned protocol; } client_state_t; @@ -278,8 +280,7 @@ extern struct cvar_s *cl_cshift_powerup; extern struct cvar_s *noskins; -#define MAX_TEMP_ENTITIES 64 // lightning bolts, etc -#define MAX_STATIC_ENTITIES 128 // torches, etc +#define MAX_STATIC_ENTITIES 512 // torches, etc extern client_state_t cl; @@ -290,6 +291,7 @@ extern entity_t cl_static_entities[MAX_STATIC_ENTITIES]; extern int fps_count; +extern void (*write_angles) (sizebuf_t *sb, const vec3_t angles); // cl_main void CL_Init (void); diff --git a/nq/include/game.h b/nq/include/game.h index cf1fbebd4..f40aadaf8 100644 --- a/nq/include/game.h +++ b/nq/include/game.h @@ -34,11 +34,14 @@ #include "QF/qtypes.h" #include "QF/qdefs.h" -#undef MAX_DATAGRAM -#define MAX_DATAGRAM 1024 // max length of unreliable message - -#undef MAX_MSGLEN -#define MAX_MSGLEN 8000 // max length of a reliable message +#define MIN_EDICTS 256 // lowest allowed value for max_edicts +#define MAX_EDICTS 32000 // highest allowed value for max_edicts +#define MAX_DATAGRAM 32000 // max length of unreliable message +#define MAX_MSGLEN 32000 // max length of a reliable message +#define DATAGRAM_MTU 1400 // actual limit for unreliable messages + // to nonlocal clients +#define MAX_MODELS 2048 +#define MAX_SOUNDS 2048 #include #include diff --git a/nq/include/protocol.h b/nq/include/protocol.h index 40c254bdc..c4a17d660 100644 --- a/nq/include/protocol.h +++ b/nq/include/protocol.h @@ -31,7 +31,8 @@ #include "QF/qtypes.h" -#define PROTOCOL_VERSION 15 +#define PROTOCOL_NETQUAKE 15 +#define PROTOCOL_FITZQUAKE 666 // if the high bit of the servercmd is set, the low bits are fast update flags: #define U_MOREBITS (1<<0) @@ -39,7 +40,7 @@ #define U_ORIGIN2 (1<<2) #define U_ORIGIN3 (1<<3) #define U_ANGLE2 (1<<4) -#define U_NOLERP (1<<5) // don't interpolate movement +#define U_STEP (1<<5) // don't interpolate movement #define U_FRAME (1<<6) #define U_SIGNAL (1<<7) // just differentiates from other updates @@ -51,30 +52,16 @@ #define U_SKIN (1<<12) #define U_EFFECTS (1<<13) #define U_LONGENTITY (1<<14) - -// QSG Protocol Extensions (Version 2) ======================================== -// Network definitions for the engine - -#define U_EXTEND1 (1<<15) -#define U_DELTA (1<<16) // no data, while this is set the entity is delta compressed (uses previous frame as a baseline, meaning only things that have changed from the previous frame are sent, except for the forced full update every half second) -#define U_ALPHA (1<<17) // 1 byte, 0.0-1.0 = 0-255 (Unsent if 1) -#define U_SCALE (1<<18) // 1 byte, scale / 16 positive, (Unsent if 1) -#define U_EFFECTS2 (1<<19) // 1 byte, .effects & 0xFF00 -#define U_GLOWSIZE (1<<20) // 1 byte, float/8.0, signed. Unsent if 1 -#define U_GLOWCOLOR (1<<21) // 1 byte, palette index, default, 254. -#define U_COLORMOD (1<<22) // 1 byte, rrrgggbb. Model tinting -#define U_EXTEND2 (1<<23) // Another byte to follow - -#define U_GLOWTRAIL (1<<24) // Leave U_GLOW* trail -#define U_VIEWMODEL (1<<25) // Attach model to view (relative). Owner only -#define U_FRAME2 (1<<26) // 1 byte .frame & 0xFF00 (second byte) -#define U_UNUSED27 (1<<27) // future expansion -#define U_UNUSED28 (1<<28) // future expansion -#define U_UNUSED29 (1<<29) // future expansion -#define U_UNUSED30 (1<<30) // future expansion -#define U_EXTEND3 (1<<31) // another byte to follow, future expansion - -// QSG 2 End ================================================================== +//PROTOCOL_FITZQUAKE -- new bits +#define U_EXTEND1 (1<<15) +#define U_ALPHA (1<<16) // 1 byte, uses ENTALPHA_ENCODE, not sent if equal to baseline +#define U_FRAME2 (1<<17) // 1 byte, this is .frame & 0xFF00 (second byte) +#define U_MODEL2 (1<<18) // 1 byte, this is .modelindex & 0xFF00 (second byte) +#define U_LERPFINISH (1<<19) // 1 byte, 0.0-1.0 maps to 0-255, not sent if exactly 0.1, this is ent->v.nextthink - sv.time, used for lerping +#define U_UNUSED20 (1<<20) +#define U_UNUSED21 (1<<21) +#define U_UNUSED22 (1<<22) +#define U_EXTEND2 (1<<23) // another byte to follow, future expansion #define SU_VIEWHEIGHT (1<<0) #define SU_IDEALPITCH (1<<1) @@ -84,21 +71,55 @@ #define SU_VELOCITY1 (1<<5) #define SU_VELOCITY2 (1<<6) #define SU_VELOCITY3 (1<<7) -//#define SU_AIMENT (1<<8) AVAILABLE BIT +#define SU_UNUSED8 (1<<8) //AVAILABLE BIT #define SU_ITEMS (1<<9) #define SU_ONGROUND (1<<10) // no data follows, the bit is it #define SU_INWATER (1<<11) // no data follows, the bit is it #define SU_WEAPONFRAME (1<<12) #define SU_ARMOR (1<<13) #define SU_WEAPON (1<<14) +// PROTOCOL_FITZQUAKE -- new bits +#define SU_EXTEND1 (1<<15) // another byte to follow +#define SU_WEAPON2 (1<<16) // 1 byte, this is .weaponmodel & 0xFF00 (second byte) +#define SU_ARMOR2 (1<<17) // 1 byte, this is .armorvalue & 0xFF00 (second byte) +#define SU_AMMO2 (1<<18) // 1 byte, this is .currentammo & 0xFF00 (second byte) +#define SU_SHELLS2 (1<<19) // 1 byte, this is .ammo_shells & 0xFF00 (second byte) +#define SU_NAILS2 (1<<20) // 1 byte, this is .ammo_nails & 0xFF00 (second byte) +#define SU_ROCKETS2 (1<<21) // 1 byte, this is .ammo_rockets & 0xFF00 (second byte) +#define SU_CELLS2 (1<<22) // 1 byte, this is .ammo_cells & 0xFF00 (second byte) +#define SU_EXTEND2 (1<<23) // another byte to follow +#define SU_WEAPONFRAME2 (1<<24) // 1 byte, this is .weaponframe & 0xFF00 (second byte) +#define SU_WEAPONALPHA (1<<25) // 1 byte, this is alpha for weaponmodel, uses ENTALPHA_ENCODE, not sent if ENTALPHA_DEFAULT +#define SU_UNUSED26 (1<<26) +#define SU_UNUSED27 (1<<27) +#define SU_UNUSED28 (1<<28) +#define SU_UNUSED29 (1<<29) +#define SU_UNUSED30 (1<<30) +#define SU_EXTEND3 (1<<31) // another byte to follow, future expansion // a sound with no channel is a local-only sound #define SND_VOLUME (1<<0) // a byte #define SND_ATTENUATION (1<<1) // a byte #define SND_LOOPING (1<<2) // a long +// PROTOCOL_FITZQUAKE -- new bits +#define SND_LARGEENTITY (1<<3) // a short + byte (instead of just a short) +#define SND_LARGESOUND (1<<4) // a short soundindex (instead of a byte) #define DEFAULT_SOUND_PACKET_VOLUME 255 #define DEFAULT_SOUND_PACKET_ATTENUATION 1.0 +// PROTOCOL_FITZQUAKE -- flags for entity baseline messages +#define B_LARGEMODEL (1<<0) // modelindex is short instead of byte +#define B_LARGEFRAME (1<<1) // frame is short instead of byte +#define B_ALPHA (1<<2) // 1 byte, uses ENTALPHA_ENCODE, not sent if ENTALPHA_DEFAULT + +// PROTOCOL_FITZQUAKE -- alpha encoding +#define ENTALPHA_DEFAULT 0 //entity's alpha is "default" (i.e. water obeys r_wateralpha) -- must be zero so zeroed out memory works +#define ENTALPHA_ZERO 1 //entity is invisible (lowest possible alpha) +#define ENTALPHA_ONE 255 //entity is fully opaque (highest possible alpha) +#define ENTALPHA_ENCODE(a) (((a)==0)?ENTALPHA_DEFAULT:RINT(CLAMP(1,(a)*254.0f+1,255))) //server convert to byte to send to client +#define ENTALPHA_DECODE(a) (((a)==ENTALPHA_DEFAULT)?1.0f:((float)(a)-1)/(254)) //client convert to float for rendering +#define ENTALPHA_TOSAVE(a) (((a)==ENTALPHA_DEFAULT)?0.0f:(((a)==ENTALPHA_ZERO)?-1.0f:((float)(a)-1)/(254))) //server convert to float for savegame + // defaults for clientinfo messages #define DEFAULT_VIEWHEIGHT 22 @@ -156,13 +177,21 @@ #define svc_spawnstaticsound 29 // [coord3] [byte] samp [byte] vol [byte] aten -#define svc_intermission 30 // [string] music -#define svc_finale 31 // [string] music [string] text +#define svc_intermission 30 // [string] music +#define svc_finale 31 // [string] music [string] text -#define svc_cdtrack 32 // [byte] track [byte] looptrack -#define svc_sellscreen 33 +#define svc_cdtrack 32 // [byte] track [byte] looptrack +#define svc_sellscreen 33 -#define svc_cutscene 34 +#define svc_cutscene 34 + +// PROTOCOL_FITZQUAKE -- new server messages +#define svc_skybox 37 // [string] name +#define svc_bf 40 +#define svc_fog 41 // [byte] density [byte] red [byte] green [byte] blue [float] time +#define svc_spawnbaseline2 42 // support for large modelindex, large framenum, alpha, using flags +#define svc_spawnstatic2 43 // support for large modelindex, large framenum, alpha, using flags +#define svc_spawnstaticsound2 44 // [coord3] [short] samp [byte] vol [byte] aten // client to server =========================================================== @@ -199,13 +228,11 @@ typedef struct entity_state_s { vec3_t origin; vec3_t angles; - int modelindex; - int frame; - int colormap; - int skin; + unsigned short modelindex; + unsigned short frame; int effects; - - // LordHavoc: Endy neglected to mark this as a QSG version 2 thingy... + byte colormap; + byte skin; byte alpha; byte scale; byte glow_size; diff --git a/nq/include/server.h b/nq/include/server.h index 19ef2816a..8dfafff4b 100644 --- a/nq/include/server.h +++ b/nq/include/server.h @@ -89,7 +89,9 @@ typedef struct byte reliable_datagram_buf[MAX_DATAGRAM]; sizebuf_t signon; - byte signon_buf[8192]; + byte signon_buf[MAX_MSGLEN-2]; + + unsigned protocol; } server_t; @@ -213,6 +215,8 @@ extern struct cvar_s *sv_aim; extern struct cvar_s *sv_friction; extern struct cvar_s *sv_stopspeed; +extern struct cvar_s *max_edicts; + extern server_static_t svs; // persistant server info extern server_t sv; // local server diff --git a/nq/source/cl_input.c b/nq/source/cl_input.c index 35290b8d0..98423eb5e 100644 --- a/nq/source/cl_input.c +++ b/nq/source/cl_input.c @@ -75,6 +75,7 @@ kbutton_t in_up, in_down; int in_impulse; +void (*write_angles) (sizebuf_t *sb, const vec3_t angles); static void KeyPress (kbutton_t *b) @@ -555,7 +556,7 @@ CL_SendMove (usercmd_t *cmd) MSG_WriteFloat (&buf, cl.mtime[0]); // so server can get ping times - MSG_WriteAngleV (&buf, cl.viewangles); + write_angles (&buf, cl.viewangles); MSG_WriteShort (&buf, cmd->forwardmove); MSG_WriteShort (&buf, cmd->sidemove); diff --git a/nq/source/cl_main.c b/nq/source/cl_main.c index 40f8c4db1..2d8265135 100644 --- a/nq/source/cl_main.c +++ b/nq/source/cl_main.c @@ -608,7 +608,7 @@ CL_RelinkEntities (void) CL_NewDlight (i, ent->origin, state->effects); if (VectorDistance_fast (state->msg_origins[1], ent->origin) > (256 * 256)) - VectorCopy (ent ->origin, state->msg_origins[1]); + VectorCopy (ent->origin, state->msg_origins[1]); if (ent->model->flags & EF_ROCKET) { dl = R_AllocDlight (i); if (dl) { @@ -729,6 +729,10 @@ CL_SetState (cactive_t state) key_dest = key_console; VID_SetCaption ("Disconnected"); } + if (state == ca_connected) + S_AmbientOn (); + else + S_AmbientOff (); } if (con_module) con_module->data->console->force_commandline = (state != ca_active); diff --git a/nq/source/cl_parse.c b/nq/source/cl_parse.c index 9407f1d0f..b8e96ecea 100644 --- a/nq/source/cl_parse.c +++ b/nq/source/cl_parse.c @@ -43,6 +43,7 @@ static __attribute__ ((used)) const char rcsid[] = #include "QF/cmd.h" #include "QF/console.h" #include "QF/cvar.h" +#include "QF/dstring.h" #include "QF/idparse.h" #include "QF/input.h" #include "QF/msg.h" @@ -50,8 +51,10 @@ static __attribute__ ((used)) const char rcsid[] = #include "QF/screen.h" #include "QF/skin.h" #include "QF/sound.h" // FIXME: DEFAULT_SOUND_PACKET_* +#include "QF/va.h" #include "client.h" +#include "compat.h" #include "host.h" #include "sbar.h" #include "server.h" @@ -100,11 +103,24 @@ const char *svc_strings[] = { "svc_finale", // [string] music [string] text "svc_cdtrack", // [byte] track [byte] looptrack "svc_sellscreen", - "svc_cutscene" + "svc_cutscene", + // end of iD svc + // FIXME switchable extensions? + // protocol 666 + "", + "", + "svc_skybox", + "", + "", + "svc_bf", + "svc_fog", + "svc_spawnbaseline2", + "svc_spawnstatic2", + "svc_spawnstaticsound2", }; float r_gravity; - +dstring_t *centerprint; /* CL_EntityNum @@ -114,9 +130,9 @@ float r_gravity; static cl_entity_state_t * CL_EntityNum (int num) { + if (num < 0 || num >= MAX_EDICTS) + Host_Error ("CL_EntityNum: %i is an invalid number", num); if (num >= cl.num_entities) { - if (num >= MAX_EDICTS) - Host_Error ("CL_EntityNum: %i is an invalid number", num); while (cl.num_entities <= num) { cl_baselines[cl.num_entities].ent = &cl_entities[cl.num_entities]; @@ -147,12 +163,22 @@ CL_ParseStartSoundPacket (void) else attenuation = DEFAULT_SOUND_PACKET_ATTENUATION; - channel = MSG_ReadShort (net_message); - sound_num = MSG_ReadByte (net_message); + if (field_mask & SND_LARGEENTITY) { + ent = (uint16_t) MSG_ReadShort (net_message); + channel = MSG_ReadByte (net_message); + } else { + channel = (uint16_t) MSG_ReadShort (net_message); + ent = channel >> 3; + channel &= 7; + } - ent = channel >> 3; - channel &= 7; + if (field_mask & SND_LARGESOUND) + sound_num = (uint16_t) MSG_ReadShort (net_message); + else + sound_num = MSG_ReadByte (net_message); + if (sound_num >= MAX_SOUNDS) + Host_Error ("CL_ParseStartSoundPacket: %i > MAX_SOUNDS", sound_num); if (ent > MAX_EDICTS) Host_Error ("CL_ParseStartSoundPacket: ent = %i", ent); @@ -275,10 +301,16 @@ CL_ParseServerInfo (void) // parse protocol version number i = MSG_ReadLong (net_message); - if (i != PROTOCOL_VERSION) { - Sys_Printf ("Server returned version %i, not %i", i, PROTOCOL_VERSION); + if (i != PROTOCOL_NETQUAKE && i!= PROTOCOL_FITZQUAKE) { + Sys_Printf ("Server returned version %i, not %i or %i\n", i, + PROTOCOL_NETQUAKE, PROTOCOL_FITZQUAKE); goto done; } + cl.protocol = i; + if (cl.protocol == PROTOCOL_FITZQUAKE) + write_angles = MSG_WriteAngle16V; + else + write_angles = MSG_WriteAngleV; // parse maxclients cl.maxclients = MSG_ReadByte (net_message); if (cl.maxclients < 1 || cl.maxclients > MAX_SCOREBOARD) { @@ -351,6 +383,10 @@ CL_ParseServerInfo (void) // local state cl_entities[0].model = cl.worldmodel = cl.model_precache[1]; + if (!centerprint) + centerprint = dstring_newstr (); + else + dstring_clearstr (centerprint); CL_NewMap (model_precache[1]); Hunk_Check (); // make sure nothing is hurt @@ -389,6 +425,13 @@ CL_ParseUpdate (int bits) i = MSG_ReadByte (net_message); bits |= (i << 8); } + + if (cl.protocol == PROTOCOL_FITZQUAKE) { + if (bits & U_EXTEND1) + bits |= MSG_ReadByte(net_message) << 16; + if (bits & U_EXTEND2) + bits |= MSG_ReadByte(net_message) << 24; + } if (bits & U_LONGENTITY) num = MSG_ReadShort (net_message); @@ -422,26 +465,6 @@ CL_ParseUpdate (int bits) } else modnum = state->baseline.modelindex; - model = cl.model_precache[modnum]; - if (model != ent->model) { - ent->model = model; - // automatic animation (torches, etc) can be either all together - // or randomized - if (model) { - if (model->synctype == ST_RAND) - ent->syncbase = (float) (rand () & 0x7fff) / 0x7fff; - else - ent->syncbase = 0.0; - } else - forcelink = true; // hack to make null model players work - if (num > 0 && num <= cl.maxclients) { - if (!ent->skin) - ent->skin = Skin_NewTempSkin (); - if (ent->skin) - CL_NewTranslation (num - 1, ent->skin); - } - } - if (bits & U_FRAME) ent->frame = MSG_ReadByte (net_message); else @@ -509,50 +532,49 @@ CL_ParseUpdate (int bits) else state->msg_angles[0][2] = state->baseline.angles[2]; - if (bits & U_NOLERP) + if (bits & U_STEP) //FIXME lerping (see fitzquake) forcelink = true; -// QSG Start - if (bits & U_ALPHA) - state->alpha = MSG_ReadByte (net_message); - else + if (cl.protocol == PROTOCOL_FITZQUAKE) { + if (bits & U_ALPHA) + state->alpha = MSG_ReadByte(net_message); + else + state->alpha = state->baseline.alpha; + if (bits & U_FRAME2) + ent->frame |= MSG_ReadByte(net_message) << 8; + if (bits & U_MODEL2) + modnum |= MSG_ReadByte(net_message) << 8; + if (bits & U_LERPFINISH) { + MSG_ReadByte (net_message); //FIXME ignored for now. see fitzquake + } + } else { state->alpha = state->baseline.alpha; - - if (bits & U_SCALE) - state->scale = MSG_ReadByte (net_message); - else state->scale = state->baseline.scale; - - if (bits & U_EFFECTS2) - state->effects = (state->effects & 0xFF) | - (MSG_ReadByte (net_message) << 8); - - if (bits & U_GLOWSIZE) - state->glow_size = MSG_ReadByte (net_message); - else state->glow_size = state->baseline.glow_size; - - if (bits & U_GLOWCOLOR) - state->glow_color = MSG_ReadByte (net_message); - else state->glow_color = state->baseline.glow_color; - - if (bits & U_COLORMOD) - state->colormod = MSG_ReadByte (net_message); - else state->colormod = state->baseline.colormod; + } - if (!(bits & U_EXTEND2)) - goto link; + model = cl.model_precache[modnum]; + if (model != ent->model) { + ent->model = model; + // automatic animation (torches, etc) can be either all together + // or randomized + if (model) { + if (model->synctype == ST_RAND) + ent->syncbase = (float) (rand () & 0x7fff) / 0x7fff; + else + ent->syncbase = 0.0; + } else + forcelink = true; // hack to make null model players work + if (num > 0 && num <= cl.maxclients) { + if (!ent->skin) + ent->skin = Skin_NewTempSkin (); + if (ent->skin) + CL_NewTranslation (num - 1, ent->skin); + } + } - if (bits & U_GLOWTRAIL) - state->effects |= EF_GLOWTRAIL; - - if (bits & U_FRAME2) - ent->frame = (ent->frame & 0xFF) | (MSG_ReadByte (net_message) << 8); -// QSG End - -link: if (forcelink) { // didn't have an update last message VectorCopy (state->msg_origins[0], state->msg_origins[1]); VectorCopy (state->msg_origins[0], ent->origin); @@ -563,18 +585,33 @@ link: } static void -CL_ParseBaseline (cl_entity_state_t *state) +CL_ParseBaseline (cl_entity_state_t *state, int version) { - state->baseline.modelindex = MSG_ReadByte (net_message); - state->baseline.frame = MSG_ReadByte (net_message); + int bits = 0; + + if (version == 2) + bits = MSG_ReadByte (net_message); + + if (bits & B_LARGEMODEL) + state->baseline.modelindex = MSG_ReadShort (net_message); + else + state->baseline.modelindex = MSG_ReadByte (net_message); + + if (bits & B_LARGEFRAME) + state->baseline.frame = MSG_ReadShort (net_message); + else + state->baseline.frame = MSG_ReadByte (net_message); + state->baseline.colormap = MSG_ReadByte (net_message); state->baseline.skin = MSG_ReadByte (net_message); MSG_ReadCoordAngleV (net_message, state->baseline.origin, state->baseline.angles); - // LordHavoc: set up baseline for new effects (alpha, colormod, etc) - state->baseline.alpha = 255; + if (bits & B_ALPHA) + state->baseline.alpha = MSG_ReadByte (net_message); + else + state->baseline.alpha = 255;//FIXME alpha state->baseline.scale = 16; state->baseline.glow_size = 0; state->baseline.glow_color = 254; @@ -587,9 +624,16 @@ CL_ParseBaseline (cl_entity_state_t *state) Server information pertaining to only this client */ static void -CL_ParseClientdata (int bits) +CL_ParseClientdata (void) { int i, j; + int bits; + + bits = (uint16_t) MSG_ReadShort (net_message); + if (bits & SU_EXTEND1) + bits |= MSG_ReadByte (net_message) << 16; + if (bits & SU_EXTEND2) + bits |= MSG_ReadByte (net_message) << 24; if (bits & SU_VIEWHEIGHT) cl.viewheight = ((signed char) MSG_ReadByte (net_message)); @@ -614,6 +658,12 @@ CL_ParseClientdata (int bits) cl.mvelocity[0][i] = 0; } + //FIXME + //if (!VectorCompare (v_punchangles[0], cl.punchangle[0])) { + // VectorCopy (v_punchangles[0], v_punchangles[1]); + // VectorCopy (cl.punchangle, v_punchangles[0]); + //} + // [always sent] if (bits & SU_ITEMS) i = MSG_ReadLong (net_message); @@ -684,10 +734,33 @@ CL_ParseClientdata (int bits) Sbar_Changed (); } } + + if (bits & SU_WEAPON2) + cl.stats[STAT_WEAPON] |= MSG_ReadByte (net_message) << 8; + if (bits & SU_ARMOR2) + cl.stats[STAT_ARMOR] |= MSG_ReadByte (net_message) << 8; + if (bits & SU_AMMO2) + cl.stats[STAT_AMMO] |= MSG_ReadByte (net_message) << 8; + if (bits & SU_SHELLS2) + cl.stats[STAT_SHELLS] |= MSG_ReadByte (net_message) << 8; + if (bits & SU_NAILS2) + cl.stats[STAT_NAILS] |= MSG_ReadByte (net_message) << 8; + if (bits & SU_ROCKETS2) + cl.stats[STAT_ROCKETS] |= MSG_ReadByte (net_message) << 8; + if (bits & SU_CELLS2) + cl.stats[STAT_CELLS] |= MSG_ReadByte (net_message) << 8; + if (bits & SU_WEAPONFRAME2) + cl.stats[STAT_WEAPONFRAME] |= MSG_ReadByte (net_message) << 8; + if (bits & SU_WEAPONALPHA) { + byte alpha = MSG_ReadByte (net_message); + cl.viewent.colormod[3] = ENTALPHA_DECODE (alpha); + } else { + cl.viewent.colormod[3] = 1.0; + } } static void -CL_ParseStatic (void) +CL_ParseStatic (int version) { cl_entity_state_t state; entity_t *ent; @@ -698,11 +771,12 @@ CL_ParseStatic (void) Host_Error ("Too many static entities"); ent = &cl_static_entities[i]; cl.num_statics++; - CL_ParseBaseline (&state); + CL_ParseBaseline (&state, version); // copy it to the current state VectorCopy (state.baseline.origin, ent->origin); VectorCopy (state.baseline.angles, ent->angles); + //FIXME alpha & lerp ent->model = cl.model_precache[state.baseline.modelindex]; ent->frame = state.baseline.frame; ent->colormap = vid.colormap8; @@ -717,20 +791,23 @@ CL_ParseStatic (void) ent->colormod[2] = ((float) (state.baseline.colormod & 3)) * (1.0 / 3.0); } - ent->colormod[3] = state.baseline.alpha / 255.0; + ent->colormod[3] = ENTALPHA_DECODE (state.baseline.alpha); ent->scale = state.baseline.scale / 16.0; R_AddEfrags (ent); } static void -CL_ParseStaticSound (void) +CL_ParseStaticSound (int version) { int sound_num, vol, atten; vec3_t org; MSG_ReadCoordV (net_message, org); - sound_num = MSG_ReadByte (net_message); + if (version == 2) + sound_num = MSG_ReadShort (net_message); + else + sound_num = MSG_ReadByte (net_message); vol = MSG_ReadByte (net_message); atten = MSG_ReadByte (net_message); @@ -747,6 +824,7 @@ void CL_ParseServerMessage (void) { int cmd, i; + const char *str; // if recording demos, copy the message out if (cl_shownet->int_val == 1) @@ -770,13 +848,13 @@ CL_ParseServerMessage (void) return; // end of message } // if the high bit of the command byte is set, it is a fast update - if (cmd & 128) { + if (cmd & U_SIGNAL) { SHOWNET ("fast update"); - CL_ParseUpdate (cmd & 127); + CL_ParseUpdate (cmd & ~U_SIGNAL); continue; } - SHOWNET (svc_strings[cmd]); + SHOWNET (va ("%s(%d)", svc_strings[cmd], cmd)); // other commands switch (cmd) { @@ -794,15 +872,16 @@ CL_ParseServerMessage (void) break; case svc_clientdata: - i = MSG_ReadShort (net_message); - CL_ParseClientdata (i); + CL_ParseClientdata (); break; case svc_version: i = MSG_ReadLong (net_message); - if (i != PROTOCOL_VERSION) + if (i != PROTOCOL_NETQUAKE && i!= PROTOCOL_FITZQUAKE) Host_Error ("CL_ParseServerMessage: Server is protocol %i " - "instead of %i\n", i, PROTOCOL_VERSION); + "instead of %i or %i\n", i, PROTOCOL_NETQUAKE, + PROTOCOL_FITZQUAKE); + cl.protocol = i; break; case svc_disconnect: @@ -813,7 +892,12 @@ CL_ParseServerMessage (void) break; case svc_centerprint: - Sbar_CenterPrint (MSG_ReadString (net_message)); + str = MSG_ReadString (net_message); + if (strcmp (str, centerprint->str)) { + dstring_copystr (centerprint, str); + //FIXME logging + } + Sbar_CenterPrint (str); break; case svc_stufftext: @@ -844,6 +928,7 @@ CL_ParseServerMessage (void) Sys_Error ("svc_lightstyle > MAX_LIGHTSTYLES"); strcpy (r_lightstyle[i].map, MSG_ReadString (net_message)); r_lightstyle[i].length = strlen (r_lightstyle[i].map); + // FIXME extra info break; case svc_sound: @@ -896,10 +981,10 @@ CL_ParseServerMessage (void) case svc_spawnbaseline: i = MSG_ReadShort (net_message); // must use CL_EntityNum () to force cl.num_entities up - CL_ParseBaseline (CL_EntityNum (i)); + CL_ParseBaseline (CL_EntityNum (i), 1); break; case svc_spawnstatic: - CL_ParseStatic (); + CL_ParseStatic (1); break; case svc_temp_entity: CL_ParseTEnt (); @@ -942,7 +1027,7 @@ CL_ParseServerMessage (void) break; case svc_spawnstaticsound: - CL_ParseStaticSound (); + CL_ParseStaticSound (1); break; case svc_cdtrack: @@ -967,7 +1052,12 @@ CL_ParseServerMessage (void) r_force_fullscreen = 1; cl.completed_time = cl.time; vid.recalc_refdef = true; // go to full screen - Sbar_CenterPrint (MSG_ReadString (net_message)); + str = MSG_ReadString (net_message); + if (strcmp (str, centerprint->str)) { + dstring_copystr (centerprint, str); + //FIXME logging + } + Sbar_CenterPrint (str); break; case svc_cutscene: @@ -975,12 +1065,47 @@ CL_ParseServerMessage (void) r_force_fullscreen = 1; cl.completed_time = cl.time; vid.recalc_refdef = true; // go to full screen - Sbar_CenterPrint (MSG_ReadString (net_message)); + str = MSG_ReadString (net_message); + if (strcmp (str, centerprint->str)) { + dstring_copystr (centerprint, str); + //FIXME logging + } + Sbar_CenterPrint (str); break; case svc_sellscreen: Cmd_ExecuteString ("help", src_command); break; + + // PROTOCOL_FITZQUAKE + case svc_skybox: + R_LoadSkys (MSG_ReadString(net_message)); + break; + case svc_bf: + Cmd_ExecuteString ("bf", src_command); + break; + case svc_fog: + { //FIXME implement + float density, red, green, blue, time; + density = MSG_ReadByte (net_message) / 255.0; + red = MSG_ReadByte (net_message) / 255.0; + green = MSG_ReadByte (net_message) / 255.0; + blue = MSG_ReadByte (net_message) / 255.0; + time = MSG_ReadShort (net_message) / 100.0; + time = max (0.0, time); + } + break; + case svc_spawnbaseline2: + i = MSG_ReadShort (net_message); + // must use CL_EntityNum() to force cl.num_entities up + CL_ParseBaseline (CL_EntityNum(i), 2); + break; + case svc_spawnstatic2: + CL_ParseStatic (2); + break; + case svc_spawnstaticsound2: + CL_ParseStaticSound (2); + break; } } } diff --git a/nq/source/host.c b/nq/source/host.c index 5a7e6fac9..79e46d245 100644 --- a/nq/source/host.c +++ b/nq/source/host.c @@ -112,6 +112,7 @@ cvar_t *host_mem_size; cvar_t *host_framerate; cvar_t *host_speeds; +cvar_t *max_edicts; cvar_t *sys_ticrate; cvar_t *serverprofile; @@ -258,6 +259,8 @@ Host_InitLocal (void) host_speeds = Cvar_Get ("host_speeds", "0", CVAR_NONE, NULL, "set for running times"); + max_edicts = Cvar_Get ("max_edicts", "1024", CVAR_NONE, NULL, + "maximum server edicts"); sys_ticrate = Cvar_Get ("sys_ticrate", "0.05", CVAR_NONE, NULL, "None"); serverprofile = Cvar_Get ("serverprofile", "0", CVAR_NONE, NULL, "None"); diff --git a/nq/source/sv_main.c b/nq/source/sv_main.c index b5719b083..3cabad043 100644 --- a/nq/source/sv_main.c +++ b/nq/source/sv_main.c @@ -49,8 +49,36 @@ server_static_t svs; char localmodels[MAX_MODELS][5]; // inline model names for precache +int sv_protocol = PROTOCOL_FITZQUAKE; + entity_state_t baselines[MAX_EDICTS]; +static void +SV_Protocol_f (void) +{ + int i; + + switch (Cmd_Argc ()) { + case 1: + Sys_Printf ("\"sv_protocol\" is \"%i\"\n", sv_protocol); + break; + case 2: + i = atoi (Cmd_Argv (1)); + if (i != PROTOCOL_NETQUAKE && i != PROTOCOL_FITZQUAKE) { + Sys_Printf ("sv_protocol must be %i or %i\n", + PROTOCOL_NETQUAKE, PROTOCOL_FITZQUAKE); + } else { + sv_protocol = i; + if (sv.active) + Sys_Printf ("changes will not take effect until the next " + "level load.\n"); + } + break; + default: + Sys_Printf ("usage: sv_protocol \n"); + break; + } +} void SV_Init (void) @@ -73,6 +101,9 @@ SV_Init (void) sv_aim = Cvar_Get ("sv_aim", "0.93", CVAR_NONE, NULL, "None"); sv_nostep = Cvar_Get ("sv_nostep", "0", CVAR_NONE, NULL, "None"); + Cmd_AddCommand ("sv_protocol", SV_Protocol_f, "set the protocol to be " + "used after the next map load"); + for (i = 0; i < MAX_MODELS; i++) snprintf (localmodels[i], sizeof (localmodels[i]), "*%i", i); } @@ -149,14 +180,25 @@ SV_StartSound (edict_t *entity, int channel, const char *sample, int volume, ent = NUM_FOR_EDICT (&sv_pr_state, entity); - channel = (ent << 3) | channel; - field_mask = 0; if (volume != DEFAULT_SOUND_PACKET_VOLUME) field_mask |= SND_VOLUME; if (attenuation != DEFAULT_SOUND_PACKET_ATTENUATION) field_mask |= SND_ATTENUATION; + if (ent >= 8192) { + if (sv.protocol == PROTOCOL_NETQUAKE) + return; //don't send any info protocol can't support + else + field_mask |= SND_LARGEENTITY; + } + if (sound_num >= 256 || channel >= 8) { + if (sv.protocol == PROTOCOL_NETQUAKE) + return; //don't send any info protocol can't support + else + field_mask |= SND_LARGESOUND; + } + // directed messages go to only the entity on which they are targeted MSG_WriteByte (&sv.datagram, svc_sound); MSG_WriteByte (&sv.datagram, field_mask); @@ -164,8 +206,18 @@ SV_StartSound (edict_t *entity, int channel, const char *sample, int volume, MSG_WriteByte (&sv.datagram, volume); if (field_mask & SND_ATTENUATION) MSG_WriteByte (&sv.datagram, attenuation * 64); - MSG_WriteShort (&sv.datagram, channel); - MSG_WriteByte (&sv.datagram, sound_num); + + if (field_mask & SND_LARGEENTITY) { + MSG_WriteShort (&sv.datagram, ent); + MSG_WriteByte (&sv.datagram, channel); + } else { + MSG_WriteShort (&sv.datagram, (ent << 3 | channel)); + } + if (field_mask & SND_LARGESOUND) + MSG_WriteShort (&sv.datagram, sound_num); + else + MSG_WriteByte (&sv.datagram, sound_num); + VectorBlend (SVvector (entity, mins), SVvector (entity, maxs), 0.5, v); VectorAdd (v, SVvector (entity, origin), v); MSG_WriteCoordV (&sv.datagram, v); @@ -184,6 +236,7 @@ SV_SendServerinfo (client_t *client) { const char **s; char message[2048]; + int i; MSG_WriteByte (&client->message, svc_print); snprintf (message, sizeof (message), "%c\nVersion %s server (%i CRC)", 2, @@ -191,7 +244,7 @@ SV_SendServerinfo (client_t *client) MSG_WriteString (&client->message, message); MSG_WriteByte (&client->message, svc_serverinfo); - MSG_WriteLong (&client->message, PROTOCOL_VERSION); + MSG_WriteLong (&client->message, sv.protocol); MSG_WriteByte (&client->message, svs.maxclients); if (!coop->int_val && deathmatch->int_val) @@ -201,15 +254,19 @@ SV_SendServerinfo (client_t *client) snprintf (message, sizeof (message), "%s", PR_GetString (&sv_pr_state, SVstring (sv.edicts, message))); + message[sizeof (message) - 1] = 0; MSG_WriteString (&client->message, message); - for (s = sv.model_precache + 1; *s; s++) - MSG_WriteString (&client->message, *s); + // send only the first 256 model and sound precaches if protocol 15 + for (i = 0, s = sv.model_precache + 1; *s; s++, i++) + if (sv.protocol != PROTOCOL_NETQUAKE || i < 256) + MSG_WriteString (&client->message, *s); MSG_WriteByte (&client->message, 0); - for (s = sv.sound_precache + 1; *s; s++) - MSG_WriteString (&client->message, *s); + for (i = 0, s = sv.sound_precache + 1; *s; s++, i++) + if (sv.protocol != PROTOCOL_NETQUAKE || i < 256) + MSG_WriteString (&client->message, *s); MSG_WriteByte (&client->message, 0); // send music @@ -385,6 +442,7 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg) float miss; vec3_t org; edict_t *ent; + entity_state_t *baseline; // find the client's PVS VectorAdd (SVvector (clent, origin), SVvector (clent, view_ofs), org); @@ -393,6 +451,8 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg) // send over all entities (excpet the client) that touch the pvs ent = NEXT_EDICT (&sv_pr_state, sv.edicts); for (e = 1; e < sv.num_edicts; e++, ent = NEXT_EDICT (&sv_pr_state, ent)) { + baseline = (entity_state_t*) ent->data; + // ignore if not touching a PV leaf if (ent != clent) { // clent is ALWAYS sent // ignore ents without visible models @@ -400,6 +460,11 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg) !*PR_GetString (&sv_pr_state, SVstring (ent, model))) continue; + // don't send model > 255 for protocol 15 + if (sv.protocol == PROTOCOL_NETQUAKE + && (int) SVfloat (ent, modelindex) & 0xFF00) + continue; + for (i = 0; i < ent->num_leafs; i++) if (pvs[ent->leafnums[i] >> 3] & (1 << (ent->leafnums[i] & 7))) break; @@ -408,51 +473,79 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg) continue; // not visible } - if (msg->maxsize - msg->cursize < 16) { + if (msg->cursize + 24 > msg->maxsize) { Sys_Printf ("packet overflow\n"); return; } // send an update bits = 0; + for (i = 0; i < 3; i++) { - miss = SVvector (ent, origin)[i] - - ((entity_state_t*)ent->data)->origin[i]; + miss = SVvector (ent, origin)[i] - baseline->origin[i]; if (miss < -0.1 || miss > 0.1) bits |= U_ORIGIN1 << i; } - if (SVvector (ent, angles)[0] != - ((entity_state_t*)ent->data)->angles[0]) + if (SVvector (ent, angles)[0] != baseline->angles[0]) bits |= U_ANGLE1; - if (SVvector (ent, angles)[1] != - ((entity_state_t*)ent->data)->angles[1]) + if (SVvector (ent, angles)[1] != baseline->angles[1]) bits |= U_ANGLE2; - if (SVvector (ent, angles)[2] != - ((entity_state_t*)ent->data)->angles[2]) + if (SVvector (ent, angles)[2] != baseline->angles[2]) bits |= U_ANGLE3; if (SVfloat (ent, movetype) == MOVETYPE_STEP) - bits |= U_NOLERP; // don't mess up the step animation + bits |= U_STEP; // don't mess up the step animation - if (((entity_state_t*)ent->data)->colormap != SVfloat (ent, colormap)) + if (baseline->colormap != SVfloat (ent, colormap)) bits |= U_COLORMAP; - if (((entity_state_t*)ent->data)->skin != SVfloat (ent, skin)) + if (baseline->skin != SVfloat (ent, skin)) bits |= U_SKIN; - if (((entity_state_t*)ent->data)->frame != SVfloat (ent, frame)) + if (baseline->frame != SVfloat (ent, frame)) bits |= U_FRAME; - if (((entity_state_t*)ent->data)->effects != SVfloat (ent, effects)) + if (baseline->effects != SVfloat (ent, effects)) bits |= U_EFFECTS; - if (((entity_state_t*)ent->data)->modelindex != SVfloat (ent, - modelindex)) + if (baseline->modelindex != SVfloat (ent, modelindex)) bits |= U_MODEL; +#if 0 + //FIXME finish porting to QF + if (pr_alpha_supported) { + // TODO: find a cleaner place to put this code + eval_t *val; + val = GetEdictFieldValue(ent, "alpha"); + if (val) + ent->alpha = ENTALPHA_ENCODE(val->_float); + } + + //don't send invisible entities unless they have effects + if (ent->alpha == ENTALPHA_ZERO && !ent->v.effects) + continue; +#endif + + if (sv.protocol != PROTOCOL_NETQUAKE) { + //FIXME + //if (ent->baseline.alpha != ent->alpha) + // bits |= U_ALPHA; + if (bits & U_FRAME && (int) SVfloat (ent, frame) & 0xFF00) + bits |= U_FRAME2; + if (bits & U_MODEL && (int) SVfloat (ent, modelindex) & 0xFF00) + bits |= U_MODEL2; + //if (ent->sendinterval) FIXME + // bits |= U_LERPFINISH; + if (bits >= 65536) + bits |= U_EXTEND1; + if (bits >= 16777216) + bits |= U_EXTEND2; + } + + if (e >= 256) bits |= U_LONGENTITY; @@ -464,6 +557,11 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg) if (bits & U_MOREBITS) MSG_WriteByte (msg, bits >> 8); + if (bits & U_EXTEND1) + MSG_WriteByte (msg, bits >> 16); + if (bits & U_EXTEND2) + MSG_WriteByte (msg, bits >> 24); + if (bits & U_LONGENTITY) MSG_WriteShort (msg, e); else @@ -491,6 +589,16 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg) MSG_WriteCoord (msg, SVvector (ent, origin)[2]); if (bits & U_ANGLE3) MSG_WriteAngle (msg, SVvector (ent, angles)[2]); + + //FIXME + //if (bits & U_ALPHA) + // MSG_WriteByte(msg, ent->alpha); + if (bits & U_FRAME2) + MSG_WriteByte(msg, (int) SVfloat (ent, frame) >> 8); + if (bits & U_MODEL2) + MSG_WriteByte(msg, (int) SVfloat (ent, modelindex) >> 8); + if (bits & U_LERPFINISH) + MSG_WriteByte(msg, rint ((SVfloat (ent, nextthink) - sv.time) * 255)); } } @@ -512,6 +620,9 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) int bits, items, i; vec3_t v; edict_t *other; + const char *weaponmodel; + + weaponmodel = PR_GetString (&sv_pr_state, SVstring (ent, weaponmodel)); // send a damage message if (SVfloat (ent, dmg_take) || SVfloat (ent, dmg_save)) { @@ -577,11 +688,42 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) // if (SVfloat (ent, weapon)) bits |= SU_WEAPON; + if (sv.protocol != PROTOCOL_NETQUAKE) { + if (bits & SU_WEAPON && SV_ModelIndex(weaponmodel) & 0xFF00) + bits |= SU_WEAPON2; + if ((int) SVfloat (ent, armorvalue) & 0xFF00) + bits |= SU_ARMOR2; + if ((int) SVfloat (ent, currentammo) & 0xFF00) + bits |= SU_AMMO2; + if ((int) SVfloat (ent, ammo_shells) & 0xFF00) + bits |= SU_SHELLS2; + if ((int) SVfloat (ent, ammo_nails) & 0xFF00) + bits |= SU_NAILS2; + if ((int) SVfloat (ent, ammo_rockets) & 0xFF00) + bits |= SU_ROCKETS2; + if ((int) SVfloat (ent, ammo_cells) & 0xFF00) + bits |= SU_CELLS2; + if (bits & SU_WEAPONFRAME && (int) SVfloat (ent, weaponframe) & 0xFF00) + bits |= SU_WEAPONFRAME2; + //FIXME + //if (bits & SU_WEAPON && ent->alpha != ENTALPHA_DEFAULT) + // bits |= SU_WEAPONALPHA; //for now, weaponalpha = client entity alpha + if (bits >= 65536) + bits |= SU_EXTEND1; + if (bits >= 16777216) + bits |= SU_EXTEND2; + } + // send the data MSG_WriteByte (msg, svc_clientdata); MSG_WriteShort (msg, bits); + if (bits & SU_EXTEND1) + MSG_WriteByte(msg, bits>>16); + if (bits & SU_EXTEND2) + MSG_WriteByte(msg, bits>>24); + if (bits & SU_VIEWHEIGHT) MSG_WriteByte (msg, SVvector (ent, view_ofs)[2]); @@ -603,8 +745,7 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) if (bits & SU_ARMOR) MSG_WriteByte (msg, SVfloat (ent, armorvalue)); if (bits & SU_WEAPON) - MSG_WriteByte (msg, SV_ModelIndex (PR_GetString (&sv_pr_state, SVstring - (ent, weaponmodel)))); + MSG_WriteByte (msg, SV_ModelIndex (weaponmodel)); MSG_WriteShort (msg, SVfloat (ent, health)); MSG_WriteByte (msg, SVfloat (ent, currentammo)); @@ -623,6 +764,26 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg) } } } + + if (bits & SU_WEAPON2) + MSG_WriteByte (msg, SV_ModelIndex(weaponmodel) >> 8); + if (bits & SU_ARMOR2) + MSG_WriteByte (msg, (int) SVfloat (ent, armorvalue) >> 8); + if (bits & SU_AMMO2) + MSG_WriteByte (msg, (int) SVfloat (ent, currentammo) >> 8); + if (bits & SU_SHELLS2) + MSG_WriteByte (msg, (int) SVfloat (ent, ammo_shells) >> 8); + if (bits & SU_NAILS2) + MSG_WriteByte (msg, (int) SVfloat (ent, ammo_nails) >> 8); + if (bits & SU_ROCKETS2) + MSG_WriteByte (msg, (int) SVfloat (ent, ammo_rockets) >> 8); + if (bits & SU_CELLS2) + MSG_WriteByte (msg, (int) SVfloat (ent, ammo_cells) >> 8); + if (bits & SU_WEAPONFRAME2) + MSG_WriteByte (msg, (int) SVfloat (ent, weaponframe) >> 8); + // FIXME + //if (bits & SU_WEAPONALPHA) + // MSG_WriteByte (msg, ent->alpha); //for now, weaponalpha = client entity alpha } static qboolean @@ -635,6 +796,9 @@ SV_SendClientDatagram (client_t *client) msg.maxsize = sizeof (buf); msg.cursize = 0; + if (strcmp (client->netconnection->address, "LOCAL") != 0) + msg.maxsize = DATAGRAM_MTU; + MSG_WriteByte (&msg, svc_time); MSG_WriteFloat (&msg, sv.time); @@ -799,46 +963,81 @@ SV_CreateBaseline (void) { int entnum; edict_t *svent; + entity_state_t *baseline; + int bits; for (entnum = 0; entnum < sv.num_edicts; entnum++) { // get the current server version svent = EDICT_NUM (&sv_pr_state, entnum); + baseline = (entity_state_t *) svent->data; + if (svent->free) continue; if (entnum > svs.maxclients && !SVfloat (svent, modelindex)) continue; // create entity baseline - VectorCopy (SVvector (svent, origin), - ((entity_state_t *) svent->data)->origin); - VectorCopy (SVvector (svent, angles), - ((entity_state_t *) svent->data)->angles); - ((entity_state_t *) svent->data)->frame = SVfloat (svent, frame); - ((entity_state_t *) svent->data)->skin = SVfloat (svent, skin); + VectorCopy (SVvector (svent, origin), baseline->origin); + VectorCopy (SVvector (svent, angles), baseline->angles); + baseline->frame = SVfloat (svent, frame); + baseline->skin = SVfloat (svent, skin); if (entnum > 0 && entnum <= svs.maxclients) { - ((entity_state_t *) svent->data)->colormap = entnum; - ((entity_state_t *) svent->data)->modelindex = SV_ModelIndex - ("progs/player.mdl"); + baseline->colormap = entnum; + baseline->modelindex = SV_ModelIndex ("progs/player.mdl"); + baseline->alpha = ENTALPHA_DEFAULT; } else { - ((entity_state_t *) svent->data)->colormap = 0; - ((entity_state_t *) svent->data)->modelindex = - SV_ModelIndex (PR_GetString (&sv_pr_state, SVstring (svent, - model))); + const char *model; + model = PR_GetString (&sv_pr_state, SVstring (svent, model)); + baseline->colormap = 0; + baseline->modelindex = SV_ModelIndex (model); + baseline->alpha = ENTALPHA_DEFAULT; + } + + bits = 0; + if (sv.protocol == PROTOCOL_NETQUAKE) { + //still want to send baseline in PROTOCOL_NETQUAKE, so reset + //these values + if (baseline->modelindex & 0xFF00) + baseline->modelindex = 0; + if (baseline->frame & 0xFF00) + baseline->frame = 0; + baseline->alpha = ENTALPHA_DEFAULT; + } else { + if (baseline->modelindex & 0xFF00) + bits |= B_LARGEMODEL; + if (baseline->frame & 0xFF00) + bits |= B_LARGEFRAME; + if (baseline->alpha != ENTALPHA_DEFAULT) + bits |= B_ALPHA; } // add to the message - MSG_WriteByte (&sv.signon, svc_spawnbaseline); + if (bits) + MSG_WriteByte (&sv.signon, svc_spawnbaseline2); + else + MSG_WriteByte (&sv.signon, svc_spawnbaseline); + MSG_WriteShort (&sv.signon, entnum); - MSG_WriteByte (&sv.signon, - ((entity_state_t *) svent->data)->modelindex); - MSG_WriteByte (&sv.signon, ((entity_state_t *) svent->data)->frame); - MSG_WriteByte (&sv.signon, ((entity_state_t *) svent->data)->colormap); - MSG_WriteByte (&sv.signon, ((entity_state_t *) svent->data)->skin); + if (bits) + MSG_WriteByte (&sv.signon, bits); - MSG_WriteCoordAngleV (&sv.signon, - ((entity_state_t *) svent->data)->origin, - ((entity_state_t *) svent->data)->angles); + if (bits & B_LARGEMODEL) + MSG_WriteShort (&sv.signon, baseline->modelindex); + else + MSG_WriteByte (&sv.signon, baseline->modelindex); + + if (bits & B_LARGEFRAME) + MSG_WriteShort (&sv.signon, baseline->frame); + else + MSG_WriteByte (&sv.signon, baseline->frame); + MSG_WriteByte (&sv.signon, baseline->colormap); + MSG_WriteByte (&sv.signon, baseline->skin); + + MSG_WriteCoordAngleV (&sv.signon, baseline->origin, baseline->angles); + + if (bits & B_ALPHA) + MSG_WriteByte (&sv.signon, baseline->alpha); } } @@ -935,12 +1134,14 @@ SV_SpawnServer (const char *server) strcpy (sv.name, server); + sv.protocol = sv_protocol; + // load progs to get entity field count - sv.max_edicts = MAX_EDICTS; + sv.max_edicts = bound (MIN_EDICTS, max_edicts->int_val, MAX_EDICTS); SV_LoadProgs (); // init the data field of the edicts - for (i = 0; i < MAX_EDICTS; i++) { + for (i = 0; i < sv.max_edicts; i++) { ent = EDICT_NUM (&sv_pr_state, i); ent->data = &baselines[i]; } @@ -1034,6 +1235,10 @@ SV_SpawnServer (const char *server) // create a baseline for more efficient communications SV_CreateBaseline (); + if (sv.signon.cursize > 8000-2) + Sys_Printf ("%i byte signon buffer exceeds standard limit of 7998.\n", + sv.signon.cursize); + // send serverinfo to all connected clients for (i = 0, host_client = svs.clients; i < svs.maxclients; i++, host_client++) diff --git a/nq/source/sv_phys.c b/nq/source/sv_phys.c index 0d00c5dca..69277e389 100644 --- a/nq/source/sv_phys.c +++ b/nq/source/sv_phys.c @@ -128,6 +128,7 @@ qboolean SV_RunThink (edict_t *ent) { float thinktime; + float oldframe; do { thinktime = SVfloat (ent, nextthink); @@ -138,12 +139,27 @@ SV_RunThink (edict_t *ent) thinktime = sv.time; // don't let things stay in the past. // it is possible to start that way // by a trigger with a local time. + oldframe = SVfloat (ent, frame); + SVfloat (ent, nextthink) = 0; *sv_globals.time = thinktime; sv_pr_think (ent); if (ent->free) return false; +#if 0 //FIXME + ent->sendinterval = false; + if (SVfloat (ent, nextthink) + && (SVfloat (ent, movetype) == MOVETYPE_STEP + || SVfloat (ent, frame) != oldframe)) { + int i; + i = rint ((SVfloat (ent, nextthink) - thinktime) * 255); + if (i >= 0 && i < 256 && i != 25 && i != 26) { + //25 and 26 are close enough to 0.1 to not send + ent->sendinterval = true; + } + } +#endif } while (0); return true; @@ -383,10 +399,11 @@ SV_Push (edict_t *pusher, vec3_t move) float solid_save; int num_moved, i, e; edict_t *check, *block; - edict_t *moved_edict[MAX_EDICTS]; + edict_t **moved_edict; vec3_t entorig; vec3_t mins, maxs, pushorig; - vec3_t moved_from[MAX_EDICTS]; + vec3_t *moved_from; + int mark; VectorAdd (SVvector (pusher, absmin), move, mins); VectorAdd (SVvector (pusher, absmax), move, maxs); @@ -397,6 +414,10 @@ SV_Push (edict_t *pusher, vec3_t move) VectorAdd (SVvector (pusher, origin), move, SVvector (pusher, origin)); SV_LinkEdict (pusher, false); + mark = Hunk_LowMark (); + moved_edict = Hunk_Alloc (sv.num_edicts * sizeof (edict_t *)); + moved_from = Hunk_Alloc (sv.num_edicts * sizeof (vec_t)); + // see if any solid entities are inside the final position num_moved = 0; check = NEXT_EDICT (&sv_pr_state, sv.edicts); @@ -473,8 +494,10 @@ SV_Push (edict_t *pusher, vec3_t move) VectorCopy (moved_from[i], SVvector (moved_edict[i], origin)); SV_LinkEdict (moved_edict[i], false); } + Hunk_FreeToLowMark (mark); return false; } + Hunk_FreeToLowMark (mark); return true; } diff --git a/nq/source/sv_pr_cmds.c b/nq/source/sv_pr_cmds.c index 32746b27c..e2b962e16 100644 --- a/nq/source/sv_pr_cmds.c +++ b/nq/source/sv_pr_cmds.c @@ -262,10 +262,16 @@ PF_setmodel (progs_t *pr) mod = sv.models[(int) SVfloat (e, modelindex)]; // Mod_ForName (m, true); - if (mod) - SetMinMaxSize (pr, e, mod->mins, mod->maxs, true); - else + if (mod) { + // FIXME disabled for now as setting clipmins/maxs is currently + // too messy + //if (mod->type == mod_brush) + // SetMinMaxSize (pr, e, mod->clipmins, mod->clipmaxs, true); + //else + SetMinMaxSize (pr, e, mod->mins, mod->maxs, true); + } else { SetMinMaxSize (pr, e, vec3_origin, vec3_origin, true); + } } /* @@ -370,6 +376,7 @@ PF_ambientsound (progs_t *pr) float *pos; float vol, attenuation; int soundnum; + int large = false; pos = P_VECTOR (pr, 0); samp = P_GSTRING (pr, 1); @@ -385,11 +392,20 @@ PF_ambientsound (progs_t *pr) Sys_Printf ("no precache: %s\n", samp); return; } + if (soundnum > 255) { + if (sv.protocol == PROTOCOL_NETQUAKE) + return; + large = true; + } // add an svc_spawnambient command to the level signon packet - MSG_WriteByte (&sv.signon, svc_spawnstaticsound); + MSG_WriteByte (&sv.signon, + large ? svc_spawnstaticsound2 : svc_spawnstaticsound); MSG_WriteCoordV (&sv.signon, pos); - MSG_WriteByte (&sv.signon, soundnum); + if (large) + MSG_WriteShort (&sv.signon, soundnum); + else + MSG_WriteByte (&sv.signon, soundnum); MSG_WriteByte (&sv.signon, vol * 255); MSG_WriteByte (&sv.signon, attenuation * 64); @@ -1141,22 +1157,57 @@ PF_makestatic (progs_t *pr) { const char *model; edict_t *ent; + int bits = 0; ent = P_EDICT (pr, 0); - - MSG_WriteByte (&sv.signon, svc_spawnstatic); + //if (ent->alpha == ENTALPHA_ZERO) { //FIXME + // //johnfitz -- don't send invisible static entities + // goto nosend; + //} model = PR_GetString (pr, SVstring (ent, model)); - MSG_WriteByte (&sv.signon, SV_ModelIndex (model)); + if (sv.protocol == PROTOCOL_NETQUAKE) { + if (SV_ModelIndex (model) & 0xff00 + || (int) SVfloat (ent, frame) & 0xff00) + goto nosend; + } else { + if (SV_ModelIndex (model) & 0xff00) + bits |= B_LARGEMODEL; + if ((int) SVfloat (ent, frame) & 0xff00) + bits |= B_LARGEFRAME; + //FIXME + //if (ent->alpha != ENTALPHA_DEFAULT) + // bits |= B_ALPHA; + } + + if (bits) { + MSG_WriteByte (&sv.signon, svc_spawnstatic2); + MSG_WriteByte (&sv.signon, bits); + } else { + MSG_WriteByte (&sv.signon, svc_spawnstatic); + } + + if (bits & B_LARGEMODEL) + MSG_WriteShort (&sv.signon, SV_ModelIndex (model)); + else + MSG_WriteByte (&sv.signon, SV_ModelIndex (model)); + + if (bits & B_LARGEFRAME) + MSG_WriteShort (&sv.signon, SVfloat (ent, frame)); + else + MSG_WriteByte (&sv.signon, SVfloat (ent, frame)); - MSG_WriteByte (&sv.signon, SVfloat (ent, frame)); MSG_WriteByte (&sv.signon, SVfloat (ent, colormap)); MSG_WriteByte (&sv.signon, SVfloat (ent, skin)); MSG_WriteCoordAngleV (&sv.signon, SVvector (ent, origin), SVvector (ent, angles)); + //FIXME + //if (bits & B_ALPHA) + // MSG_WriteByte (&sv.signon, ent->alpha); // throw the entity away now +nosend: ED_Free (pr, ent); } diff --git a/nq/source/sv_user.c b/nq/source/sv_user.c index cc824bb1d..3ab3c7a28 100644 --- a/nq/source/sv_user.c +++ b/nq/source/sv_user.c @@ -427,7 +427,10 @@ SV_ReadClientMove (usercmd_t *move) host_client->num_pings++; // read current angles - MSG_ReadAngleV (net_message, angle); + if (sv.protocol == PROTOCOL_NETQUAKE) + MSG_ReadAngleV (net_message, angle); + else + MSG_ReadAngle16V (net_message, angle); VectorCopy (angle, SVvector (host_client->edict, v_angle)); diff --git a/qtv/include/server.h b/qtv/include/server.h index bbb1e6402..4552977ea 100644 --- a/qtv/include/server.h +++ b/qtv/include/server.h @@ -33,6 +33,7 @@ #define __server_h #include "netchan.h" +#include "qw/bothdefs.h" #include "qw/pmove.h" struct client_s; diff --git a/qw/include/client.h b/qw/include/client.h index 6c9d6f0b9..6bddec1fa 100644 --- a/qw/include/client.h +++ b/qw/include/client.h @@ -35,6 +35,7 @@ #include "QF/zone.h" #include "netchan.h" +#include "qw/bothdefs.h" #include "qw/protocol.h" #include "r_local.h" #include "QF/render.h" diff --git a/qw/include/server.h b/qw/include/server.h index bdd637967..6a98ef075 100644 --- a/qw/include/server.h +++ b/qw/include/server.h @@ -39,6 +39,7 @@ #include "host.h" #include "netchan.h" +#include "qw/bothdefs.h" #include "qw/msg_backbuf.h" #include "qw/protocol.h" From cacd2fb895842d1f88c3c92215b3a5792c3b098e Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Fri, 26 Nov 2010 09:22:04 +0900 Subject: [PATCH 105/115] FiztQuake's lerping system. Seems to be mostly working. I get some funny results for zombies, but that might be moving and turning at the same time causing issues. --- include/QF/render.h | 26 +- libs/video/renderer/gl/gl_draw.c | 60 ++++ libs/video/renderer/gl/gl_mod_alias.c | 421 ++++++++++++++------------ nq/include/protocol.h | 4 - nq/source/cl_main.c | 21 +- nq/source/cl_parse.c | 56 ++-- nq/source/cl_tent.c | 2 +- qw/source/cl_ents.c | 2 +- qw/source/cl_tent.c | 2 +- 9 files changed, 355 insertions(+), 239 deletions(-) diff --git a/include/QF/render.h b/include/QF/render.h index ef06c88b7..cee1625e1 100644 --- a/include/QF/render.h +++ b/include/QF/render.h @@ -66,8 +66,14 @@ extern lightstyle_t r_lightstyle[MAX_LIGHTSTYLES]; #define TOP_RANGE 16 // soldier uniform colors #define BOTTOM_RANGE 96 -typedef struct entity_s -{ +#define LERP_MOVESTEP (1<<0) //this is a MOVETYPE_STEP entity, enable movement lerp +#define LERP_RESETANIM (1<<1) //disable anim lerping until next anim frame +#define LERP_RESETANIM2 (1<<2) //set this and previous flag to disable anim lerping for two anim frames +#define LERP_RESETMOVE (1<<3) //disable movement lerping until next origin/angles change +#define LERP_FINISH (1<<4) //use lerpfinish time from server update instead of assuming interval of 0.1 + + +typedef struct entity_s { vec3_t origin; vec3_t old_origin; vec3_t angles; @@ -94,10 +100,18 @@ typedef struct entity_s // splits bmodel, or NULL if not split // Animation interpolation - float frame_start_time; - float frame_interval; - int pose1; - int pose2; + // FIXME separate struct? + byte lerpflags; + float lerpstart; + float lerptime; + float lerpfinish; + short previouspose; + short currentpose; + float movelerpstart; + vec3_t previousorigin; + vec3_t currentorigin; + vec3_t previousangles; //FIXME quaternion? + vec3_t currentangles; } entity_t; // !!! if this is changed, it must be changed in asm_draw.h too !!! diff --git a/libs/video/renderer/gl/gl_draw.c b/libs/video/renderer/gl/gl_draw.c index 471e6c538..664012375 100644 --- a/libs/video/renderer/gl/gl_draw.c +++ b/libs/video/renderer/gl/gl_draw.c @@ -101,6 +101,16 @@ static byte cs_data[8 * 8 * 4] = { 0xff, 0xfe, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + + //From FitzQuake + 255,255,255,255,255,255,255,255, + 255,255,255, 8, 9,255,255,255, + 255,255,255, 6, 8, 2,255,255, + 255, 6, 8, 8, 6, 8, 8,255, + 255,255, 2, 8, 8, 2, 2, 2, + 255,255,255, 7, 8, 2,255,255, + 255,255,255,255, 2, 2,255,255, + 255,255,255,255,255,255,255,255, }; typedef struct { @@ -568,10 +578,60 @@ crosshair_3 (int x, int y) qfglColor3ubv (color_white); } +static void +crosshair_4 (int x, int y) +{ + unsigned char *pColor; + + pColor = (unsigned char *) &d_8to24table[crosshaircolor->int_val]; + qfglColor4ubv (pColor); + qfglBindTexture (GL_TEXTURE_2D, cs_texture); + + qfglBegin (GL_QUADS); + + qfglTexCoord2f (0, 0.5); + qfglVertex2f (x - 7, y - 7); + qfglTexCoord2f (0.5, 0.5); + qfglVertex2f (x + 9, y - 7); + qfglTexCoord2f (0.5, 1); + qfglVertex2f (x + 9, y + 9); + qfglTexCoord2f (0, 1); + qfglVertex2f (x - 7, y + 9); + + qfglEnd (); + qfglColor3ubv (color_white); +} + +static void +crosshair_5 (int x, int y) //FIXME don't use until the data is filled in +{ + unsigned char *pColor; + + pColor = (unsigned char *) &d_8to24table[crosshaircolor->int_val]; + qfglColor4ubv (pColor); + qfglBindTexture (GL_TEXTURE_2D, cs_texture); + + qfglBegin (GL_QUADS); + + qfglTexCoord2f (0.5, 0.5); + qfglVertex2f (x - 7, y - 7); + qfglTexCoord2f (1, 0.5); + qfglVertex2f (x + 9, y - 7); + qfglTexCoord2f (1, 1); + qfglVertex2f (x + 9, y + 9); + qfglTexCoord2f (0.5, 1); + qfglVertex2f (x - 7, y + 9); + + qfglEnd (); + qfglColor3ubv (color_white); +} + static void (*crosshair_func[]) (int x, int y) = { crosshair_1, crosshair_2, crosshair_3, + crosshair_4, + crosshair_5, }; VISIBLE void diff --git a/libs/video/renderer/gl/gl_mod_alias.c b/libs/video/renderer/gl/gl_mod_alias.c index cae07a45a..50481a1f6 100644 --- a/libs/video/renderer/gl/gl_mod_alias.c +++ b/libs/video/renderer/gl/gl_mod_alias.c @@ -76,6 +76,14 @@ typedef struct { int count; } vert_order_t; +typedef struct { + short pose1; + short pose2; + float blend; + vec3_t origin; + vec3_t angles; +} lerpdata_t; + float r_avertexnormals[NUMVERTEXNORMALS][3] = { #include "anorms.h" }; @@ -246,28 +254,102 @@ GL_DrawAliasShadow (aliashdr_t *paliashdr, vert_order_t *vo) } } -static inline vert_order_t * -GL_GetAliasFrameVerts16 (int frame, aliashdr_t *paliashdr, entity_t *e) +static inline void +gl_calc_blend16 (byte *posedata, lerpdata_t *lerpdata, vert_order_t *vo, + int count) { - float interval; - int count, numposes, pose, i; - trivertx16_t *verts; - vert_order_t *vo; blended_vert_t *vo_v; + trivertx16_t *verts; + trivertx16_t *verts1, *verts2; + int i; - if ((frame >= paliashdr->mdl.numframes) || (frame < 0)) { - if (developer->int_val) - Sys_MaskPrintf (SYS_DEV, - "R_AliasSetupFrame: no such frame %d %s\n", frame, - currententity->model->name); - frame = 0; + verts = (trivertx16_t *) posedata; + if (lerpdata->blend == 0.0) { + verts = verts + lerpdata->pose1 * count; + } else if (lerpdata->blend == 1.0) { + verts = verts + lerpdata->pose2 * count; + } else { + verts1 = verts + lerpdata->pose1 * count; + verts2 = verts + lerpdata->pose2 * count; + + for (i = 0, vo_v = vo->verts; i < count; + i++, vo_v++, verts1++, verts2++) { + float *n1, *n2; + + VectorBlend (verts1->v, verts2->v, lerpdata->blend, vo_v->vert); + n1 = r_avertexnormals[verts1->lightnormalindex]; + n2 = r_avertexnormals[verts2->lightnormalindex]; + VectorBlend (n1, n2, lerpdata->blend, vo_v->normal); + if (VectorIsZero (vo_v->normal)) { + if (lerpdata->blend < 0.5) { + VectorCopy (n1, vo_v->normal); + } else { + VectorCopy (n2, vo_v->normal); + } + } + } + return; } - pose = paliashdr->frames[frame].firstpose; - numposes = paliashdr->frames[frame].numposes; - verts = (trivertx16_t *) ((byte *) paliashdr + paliashdr->posedata); + for (i = 0, vo_v = vo->verts; i < count; i++, vo_v++, verts++) { + VectorCopy (verts->v, vo_v->vert); + VectorCopy (r_avertexnormals[verts->lightnormalindex], vo_v->normal); + } +} +static inline void +gl_calc_blend8 (byte *posedata, lerpdata_t *lerpdata, vert_order_t *vo, + int count) +{ + blended_vert_t *vo_v; + trivertx_t *verts; + trivertx_t *verts1, *verts2; + int i; + + verts = (trivertx_t *) posedata; + if (lerpdata->blend == 0.0) { + verts = verts + lerpdata->pose1 * count; + } else if (lerpdata->blend == 1.0) { + verts = verts + lerpdata->pose2 * count; + } else { + verts1 = verts + lerpdata->pose1 * count; + verts2 = verts + lerpdata->pose2 * count; + + for (i = 0, vo_v = vo->verts; i < count; + i++, vo_v++, verts1++, verts2++) { + float *n1, *n2; + + VectorBlend (verts1->v, verts2->v, lerpdata->blend, vo_v->vert); + n1 = r_avertexnormals[verts1->lightnormalindex]; + n2 = r_avertexnormals[verts2->lightnormalindex]; + VectorBlend (n1, n2, lerpdata->blend, vo_v->normal); + if (VectorIsZero (vo_v->normal)) { + if (lerpdata->blend < 0.5) { + VectorCopy (n1, vo_v->normal); + } else { + VectorCopy (n2, vo_v->normal); + } + } + } + return; + } + + for (i = 0, vo_v = vo->verts; i < count; i++, vo_v++, verts++) { + VectorCopy (verts->v, vo_v->vert); + VectorCopy (r_avertexnormals[verts->lightnormalindex], vo_v->normal); + } +} + +static inline vert_order_t * +GL_GetAliasFrameVerts (aliashdr_t *paliashdr, lerpdata_t *lerpdata) +{ + int count; + vert_order_t *vo; + byte *posedata; + + posedata = (byte *) paliashdr + paliashdr->posedata; count = paliashdr->poseverts; + vo = Hunk_TempAlloc (sizeof (*vo) + count * sizeof (blended_vert_t)); vo->order = (int *) ((byte *) paliashdr + paliashdr->commands); vo->verts = (blended_vert_t *) &vo[1]; @@ -278,186 +360,12 @@ GL_GetAliasFrameVerts16 (int frame, aliashdr_t *paliashdr, entity_t *e) vo->tex_coord = NULL; } vo->count = count; - if (numposes > 1) { - interval = paliashdr->frames[frame].interval; - pose += (int) (r_realtime / interval) % numposes; - } else { - /* - One tenth of a second is good for most Quake animations. If - the nextthink is longer then the animation is usually meant - to pause (e.g. check out the shambler magic animation in - shambler.qc). If its shorter then things will still be - smoothed partly, and the jumps will be less noticable - because of the shorter time. So, this is probably a good - assumption. - */ - interval = 0.1; - } - if (gl_lerp_anim->int_val) { - trivertx16_t *verts1, *verts2; - float blend; + if (paliashdr->mdl.ident == HEADER_MDL16) + gl_calc_blend16 (posedata, lerpdata, vo, count); + else + gl_calc_blend8 (posedata, lerpdata, vo, count); - e->frame_interval = interval; - - if (e->pose2 != pose) { - e->frame_start_time = r_realtime; - if (e->pose2 == -1) { - e->pose1 = pose; - } else { - e->pose1 = e->pose2; - } - e->pose2 = pose; - blend = 0.0; - } else if (r_paused) { - blend = 1.0; - } else { - blend = (r_realtime - e->frame_start_time) / e->frame_interval; - blend = min (blend, 1.0); - } - - if (blend == 0.0) { - verts = verts + e->pose1 * count; - } else if (blend == 1.0) { - verts = verts + e->pose2 * count; - } else { - verts1 = verts + e->pose1 * count; - verts2 = verts + e->pose2 * count; - - for (i = 0, vo_v = vo->verts; i < count; - i++, vo_v++, verts1++, verts2++) { - float *n1, *n2; - - VectorBlend (verts1->v, verts2->v, blend, vo_v->vert); - n1 = r_avertexnormals[verts1->lightnormalindex]; - n2 = r_avertexnormals[verts2->lightnormalindex]; - VectorBlend (n1, n2, blend, vo_v->normal); - if (VectorIsZero (vo_v->normal)) { - if (blend < 0.5) { - VectorCopy (n1, vo_v->normal); - } else { - VectorCopy (n2, vo_v->normal); - } - } - } - return vo; - } - } else { - verts += pose * count; - } - - for (i = 0, vo_v = vo->verts; i < count; i++, vo_v++, verts++) { - VectorCopy (verts->v, vo_v->vert); - VectorCopy (r_avertexnormals[verts->lightnormalindex], vo_v->normal); - } - return vo; -} - -static inline vert_order_t * -GL_GetAliasFrameVerts (int frame, aliashdr_t *paliashdr, entity_t *e) -{ - float interval; - int count, numposes, pose, i; - trivertx_t *verts; - vert_order_t *vo; - blended_vert_t *vo_v; - - if ((frame >= paliashdr->mdl.numframes) || (frame < 0)) { - if (developer->int_val) - Sys_MaskPrintf (SYS_DEV, - "R_AliasSetupFrame: no such frame %d %s\n", frame, - currententity->model->name); - frame = 0; - } - - pose = paliashdr->frames[frame].firstpose; - numposes = paliashdr->frames[frame].numposes; - - verts = (trivertx_t *) ((byte *) paliashdr + paliashdr->posedata); - - count = paliashdr->poseverts; - vo = Hunk_TempAlloc (sizeof (*vo) + count * sizeof (blended_vert_t)); - vo->order = (int *) ((byte *) paliashdr + paliashdr->commands); - vo->verts = (blended_vert_t *) &vo[1]; - if (paliashdr->tex_coord) { - vo->tex_coord = (tex_coord_t *) ((byte *) paliashdr + paliashdr->tex_coord); - } else { - vo->tex_coord = NULL; - } - vo->count = count; - - if (numposes > 1) { - interval = paliashdr->frames[frame].interval; - pose += (int) (r_realtime / interval) % numposes; - } else { - /* - One tenth of a second is good for most Quake animations. If - the nextthink is longer then the animation is usually meant - to pause (e.g. check out the shambler magic animation in - shambler.qc). If its shorter then things will still be - smoothed partly, and the jumps will be less noticable - because of the shorter time. So, this is probably a good - assumption. - */ - interval = 0.1; - } - - if (gl_lerp_anim->int_val) { - trivertx_t *verts1, *verts2; - float blend; - - e->frame_interval = interval; - - if (e->pose2 != pose) { - e->frame_start_time = r_realtime; - if (e->pose2 == -1) { - e->pose1 = pose; - } else { - e->pose1 = e->pose2; - } - e->pose2 = pose; - blend = 0.0; - } else if (r_paused) { - blend = 1.0; - } else { - blend = (r_realtime - e->frame_start_time) / e->frame_interval; - blend = min (blend, 1.0); - } - - if (blend == 0.0) { - verts = verts + e->pose1 * count; - } else if (blend == 1.0) { - verts = verts + e->pose2 * count; - } else { - verts1 = verts + e->pose1 * count; - verts2 = verts + e->pose2 * count; - - for (i = 0, vo_v = vo->verts; i < count; - i++, vo_v++, verts1++, verts2++) { - float *n1, *n2; - - VectorBlend (verts1->v, verts2->v, blend, vo_v->vert); - n1 = r_avertexnormals[verts1->lightnormalindex]; - n2 = r_avertexnormals[verts2->lightnormalindex]; - VectorBlend (n1, n2, blend, vo_v->normal); - if (VectorIsZero (vo_v->normal)) { - if (blend < 0.5) { - VectorCopy (n1, vo_v->normal); - } else { - VectorCopy (n2, vo_v->normal); - } - } - } - return vo; - } - } else { - verts += pose * count; - } - - for (i = 0, vo_v = vo->verts; i < count; i++, vo_v++, verts++) { - VectorCopy (verts->v, vo_v->vert); - VectorCopy (r_avertexnormals[verts->lightnormalindex], vo_v->normal); - } return vo; } @@ -468,7 +376,7 @@ R_AliasGetSkindesc (int skinnum, aliashdr_t *ahdr) maliasskingroup_t *paliasskingroup; if ((skinnum >= ahdr->mdl.numskins) || (skinnum < 0)) { - Sys_MaskPrintf (SYS_DEV, "R_AliasSetupSkin: no such skin # %d\n", + Sys_MaskPrintf (SYS_DEV, "R_AliasGetSkindesc: no such skin # %d\n", skinnum); skinnum = 0; } @@ -502,6 +410,118 @@ R_AliasGetSkindesc (int skinnum, aliashdr_t *ahdr) return pskindesc; } +static void +r_alais_setup_lerp (aliashdr_t *paliashdr, entity_t *e, lerpdata_t *lerpdata) +{ + int frame = e->frame; + int posenum, numposes; + + if ((frame >= paliashdr->mdl.numframes) || (frame < 0)) { + Sys_MaskPrintf (SYS_DEV, "r_alais_setup_lerp: no such frame %d %s\n", + frame, currententity->model->name); + frame = 0; + } + + posenum = paliashdr->frames[frame].firstpose; + numposes = paliashdr->frames[frame].numposes; + + if (numposes > 1) { + e->lerptime = paliashdr->frames[frame].interval; + posenum += (int) (r_realtime / e->lerptime) % numposes; + } else { + e->lerptime = 0.1; + } + + if (e->lerpflags & LERP_RESETANIM) { + //kill any lerp in progress + e->lerpstart = 0; + e->previouspose = posenum; + e->currentpose = posenum; + e->lerpflags &= ~LERP_RESETANIM; + } else if (e->currentpose != posenum) { + // pose changed, start new lerp + if (e->lerpflags & LERP_RESETANIM2) { + //defer lerping one more time + e->lerpstart = 0; + e->previouspose = posenum; + e->currentpose = posenum; + e->lerpflags &= ~LERP_RESETANIM2; + } else { + e->lerpstart = r_realtime; + e->previouspose = e->currentpose; + e->currentpose = posenum; + } + } + if (gl_lerp_anim->int_val + /*&& !(e->model->flags & MOD_NOLERP && gl_lerp_anim->int_val != 2)*/) { + float interval = e->lerpfinish - e->lerpstart; + float time = r_realtime - e->lerpstart; + if (e->lerpflags & LERP_FINISH && numposes == 1) + lerpdata->blend = bound (0, (time) / (interval), 1); + else + lerpdata->blend = bound (0, (time) / e->lerptime, 1); + lerpdata->pose1 = e->previouspose; + lerpdata->pose2 = e->currentpose; + } else { + lerpdata->blend = 1; + lerpdata->pose1 = posenum; + lerpdata->pose2 = posenum; + } +} + +static void +r_alias_lerp_transform (entity_t *e, lerpdata_t *lerpdata) +{ + float blend; + vec3_t d; + int i; + + if (e->lerpflags & LERP_RESETMOVE) { + // kill any lerps in progress + e->movelerpstart = 0; + VectorCopy (e->origin, e->previousorigin); + VectorCopy (e->origin, e->currentorigin); + VectorCopy (e->angles, e->previousangles); + VectorCopy (e->angles, e->currentangles); + e->lerpflags &= ~LERP_RESETMOVE; + } else if (!VectorCompare (e->origin, e->currentorigin) + || !VectorCompare (e->angles, e->currentangles)) { + // origin/angles changed, start new lerp + e->movelerpstart = r_realtime; + VectorCopy (e->currentorigin, e->previousorigin); + VectorCopy (e->origin, e->currentorigin); + VectorCopy (e->currentangles, e->previousangles); + VectorCopy (e->angles, e->currentangles); + } + + if (gl_lerp_anim->int_val /* && e != &cl.viewent */ + && e->lerpflags & LERP_MOVESTEP) { + float interval = e->lerpfinish - e->lerpstart; + float time = r_realtime - e->movelerpstart; + if (e->lerpflags & LERP_FINISH) + blend = bound (0, (time) / (interval), 1); + else + blend = bound (0, (time) / 0.1, 1); + + VectorBlend (e->previousorigin, e->currentorigin, blend, + lerpdata->origin); + + //FIXME use quaternions? + VectorSubtract (e->currentangles, e->previousangles, d); + for (i = 0; i < 3; i++) { + if (d[i] > 180) + d[i] -= 360; + if (d[i] < -180) + d[i] += 360; + } + VectorMultAdd (e->previousangles, blend, d, lerpdata->angles); + } else { + //don't lerp + VectorCopy (e->origin, lerpdata->origin); + VectorCopy (e->angles, lerpdata->angles); + } +} + void R_DrawAliasModel (entity_t *e) { @@ -519,14 +539,21 @@ R_DrawAliasModel (entity_t *e) model_t *model; vec3_t dist, scale; vert_order_t *vo; + lerpdata_t lerpdata; + + paliashdr = Cache_Get (&e->model->cache); + r_alais_setup_lerp (paliashdr, e, &lerpdata); + r_alias_lerp_transform (e, &lerpdata); model = e->model; radius = model->radius; if (e->scale != 1.0) radius *= e->scale; - if (R_CullSphere (e->origin, radius)) + if (R_CullSphere (e->origin, radius)) { + Cache_Release (&e->model->cache); return; + } VectorSubtract (r_origin, e->origin, modelorg); @@ -645,7 +672,6 @@ R_DrawAliasModel (entity_t *e) } // locate the proper data - paliashdr = Cache_Get (&e->model->cache); c_alias_polys += paliashdr->mdl.numtris; // if the model has a colorised/external skin, use it, otherwise use @@ -668,11 +694,10 @@ R_DrawAliasModel (entity_t *e) if (paliashdr->mdl.ident == HEADER_MDL16) { VectorScale (paliashdr->mdl.scale, e->scale / 256.0, scale); - vo = GL_GetAliasFrameVerts16 (e->frame, paliashdr, e); } else { VectorScale (paliashdr->mdl.scale, e->scale, scale); - vo = GL_GetAliasFrameVerts (e->frame, paliashdr, e); } + vo = GL_GetAliasFrameVerts (paliashdr, &lerpdata); // setup the transform qfglPushMatrix (); diff --git a/nq/include/protocol.h b/nq/include/protocol.h index c4a17d660..537d45fcc 100644 --- a/nq/include/protocol.h +++ b/nq/include/protocol.h @@ -234,10 +234,6 @@ typedef struct entity_state_s byte colormap; byte skin; byte alpha; - byte scale; - byte glow_size; - byte glow_color; - byte colormod; } entity_state_t; #endif // __protocol_h diff --git a/nq/source/cl_main.c b/nq/source/cl_main.c index 2d8265135..66bccf394 100644 --- a/nq/source/cl_main.c +++ b/nq/source/cl_main.c @@ -530,7 +530,9 @@ CL_RelinkEntities (void) // if the object wasn't included in the last packet, remove it if (state->msgtime != cl.mtime[0]) { ent->model = NULL; - ent->pose1 = ent->pose2 = -1; + //johnfitz -- next time this entity slot is reused, the lerp will + //need to be reset + ent->lerpflags |= LERP_RESETMOVE|LERP_RESETANIM; if (ent->efrag) R_RemoveEfrags (ent); // just became empty continue; @@ -541,6 +543,8 @@ CL_RelinkEntities (void) if (state->forcelink) { // The entity was not updated in the last message so move to the // final spot + VectorCopy (state->msg_origins[0], ent->origin); + VectorCopy (state->msg_angles[0], ent->angles); if (i != cl.viewentity || chase_active->int_val) { if (ent->efrag) R_RemoveEfrags (ent); @@ -556,10 +560,13 @@ CL_RelinkEntities (void) // assume a teleportation, not a motion VectorCopy (state->msg_origins[0], ent->origin); VectorCopy (state->msg_angles[0], ent->angles); - ent->pose1 = ent->pose2 = -1; + ent->lerpflags |= LERP_RESETMOVE; } else { - VectorMultAdd (state->msg_origins[1], f, delta, ent->origin); // interpolate the origin and angles + // FIXME r_lerpmove.value && + if (ent->lerpflags & LERP_MOVESTEP) + f = 1; + VectorMultAdd (state->msg_origins[1], f, delta, ent->origin); for (j = 0; j < 3; j++) { d = state->msg_angles[0][j] - state->msg_angles[1][j]; if (d > 180) @@ -604,6 +611,14 @@ CL_RelinkEntities (void) dl->color[2] = 0.05; dl->color[3] = 0.7; } +#if 0 //FIXME how much do we want this? + //johnfitz -- assume muzzle flash accompanied by muzzle flare, + //which looks bad when lerped + if (ent == &cl_entities[cl.viewentity]) + cl.viewent.lerpflags |= LERP_RESETANIM | LERP_RESETANIM2; + else + ent->lerpflags |= LERP_RESETANIM | LERP_RESETANIM2; +#endif } CL_NewDlight (i, ent->origin, state->effects); if (VectorDistance_fast (state->msg_origins[1], ent->origin) diff --git a/nq/source/cl_parse.c b/nq/source/cl_parse.c index b8e96ecea..738ac0536 100644 --- a/nq/source/cl_parse.c +++ b/nq/source/cl_parse.c @@ -137,6 +137,8 @@ CL_EntityNum (int num) cl_baselines[cl.num_entities].ent = &cl_entities[cl.num_entities]; cl_entities[cl.num_entities].colormap = vid.colormap8; + cl_entities[cl.num_entities].lerpflags |= (LERP_RESETMOVE + | LERP_RESETANIM); cl.num_entities++; } } @@ -450,6 +452,13 @@ CL_ParseUpdate (int bits) else forcelink = false; + if (state->msgtime + 0.2 < cl.mtime[0]) { + //more than 0.2 seconds since the last message (most entities think + //every 0.1 sec) + //if we missed a think, we'd be lerping from the wrong frame + ent->lerpflags |= LERP_RESETANIM; + } + if (forcelink) { // FIXME: do this right (ie, protocol support) ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = ent->colormod[3] = 1.0; @@ -532,8 +541,12 @@ CL_ParseUpdate (int bits) else state->msg_angles[0][2] = state->baseline.angles[2]; - if (bits & U_STEP) //FIXME lerping (see fitzquake) + if (bits & U_STEP) { + ent->lerpflags |= LERP_MOVESTEP; forcelink = true; + } else { + ent->lerpflags &= ~LERP_MOVESTEP; + } if (cl.protocol == PROTOCOL_FITZQUAKE) { if (bits & U_ALPHA) @@ -545,14 +558,14 @@ CL_ParseUpdate (int bits) if (bits & U_MODEL2) modnum |= MSG_ReadByte(net_message) << 8; if (bits & U_LERPFINISH) { - MSG_ReadByte (net_message); //FIXME ignored for now. see fitzquake + float finish_time = MSG_ReadByte (net_message); + ent->lerpfinish = state->msgtime + finish_time / 255; + ent->lerpflags |= LERP_FINISH; + } else { + ent->lerpflags &= ~LERP_FINISH; } } else { state->alpha = state->baseline.alpha; - state->scale = state->baseline.scale; - state->glow_size = state->baseline.glow_size; - state->glow_color = state->baseline.glow_color; - state->colormod = state->baseline.colormod; } model = cl.model_precache[modnum]; @@ -573,6 +586,8 @@ CL_ParseUpdate (int bits) if (ent->skin) CL_NewTranslation (num - 1, ent->skin); } + //johnfitz -- don't lerp animation across model changes + ent->lerpflags |= LERP_RESETANIM; } if (forcelink) { // didn't have an update last message @@ -611,11 +626,7 @@ CL_ParseBaseline (cl_entity_state_t *state, int version) if (bits & B_ALPHA) state->baseline.alpha = MSG_ReadByte (net_message); else - state->baseline.alpha = 255;//FIXME alpha - state->baseline.scale = 16; - state->baseline.glow_size = 0; - state->baseline.glow_color = 254; - state->baseline.colormod = 255; + state->baseline.alpha = ENTALPHA_DEFAULT; } /* @@ -699,6 +710,9 @@ CL_ParseClientdata (void) if (cl.stats[STAT_WEAPON] != i) { cl.stats[STAT_WEAPON] = i; Sbar_Changed (); + //johnfitz -- lerping + if (cl.viewent.model != cl.model_precache[cl.stats[STAT_WEAPON]]) + cl.viewent.lerpflags |= LERP_RESETANIM; } i = MSG_ReadShort (net_message); @@ -774,26 +788,18 @@ CL_ParseStatic (int version) CL_ParseBaseline (&state, version); // copy it to the current state - VectorCopy (state.baseline.origin, ent->origin); - VectorCopy (state.baseline.angles, ent->angles); - //FIXME alpha & lerp ent->model = cl.model_precache[state.baseline.modelindex]; + ent->lerpflags |= LERP_RESETANIM; ent->frame = state.baseline.frame; + ent->colormap = vid.colormap8; ent->skinnum = state.baseline.skin; - if (state.baseline.colormod == 255) { - ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1.0; - } else { - ent->colormod[0] = ((float) ((state.baseline.colormod >> 5) & 7)) * - (1.0 / 7.0); - ent->colormod[1] = ((float) ((state.baseline.colormod >> 2) & 7)) * - (1.0 / 7.0); - ent->colormod[2] = ((float) (state.baseline.colormod & 3)) * - (1.0 / 3.0); - } + VectorSet (1.0, 1.0, 1.0, ent->colormod); ent->colormod[3] = ENTALPHA_DECODE (state.baseline.alpha); - ent->scale = state.baseline.scale / 16.0; + ent->scale = 1.0; + VectorCopy (state.baseline.origin, ent->origin); + VectorCopy (state.baseline.angles, ent->angles); R_AddEfrags (ent); } diff --git a/nq/source/cl_tent.c b/nq/source/cl_tent.c index a1df6bb22..50611c907 100644 --- a/nq/source/cl_tent.c +++ b/nq/source/cl_tent.c @@ -137,7 +137,7 @@ CL_Init_Entity (entity_t *ent) ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = ent->colormod[3] = 1.0; ent->scale = 1.0; - ent->pose1 = ent->pose2 = -1; + ent->lerpflags |= LERP_RESETMOVE|LERP_RESETANIM; } static tent_t * diff --git a/qw/source/cl_ents.c b/qw/source/cl_ents.c index 848a3a9da..1d467c06a 100644 --- a/qw/source/cl_ents.c +++ b/qw/source/cl_ents.c @@ -510,7 +510,7 @@ CL_LinkPacketEntities (void) (*ent)->frame = s1->frame; if ((*ent)->visframe != r_framecount - 1) { - (*ent)->pose1 = (*ent)->pose2 = -1; + (*ent)->lerpflags |= LERP_RESETMOVE|LERP_RESETANIM; // No trail if new this frame VectorCopy (s1->origin, (*ent)->origin); diff --git a/qw/source/cl_tent.c b/qw/source/cl_tent.c index 50f301f54..2ee54026f 100644 --- a/qw/source/cl_tent.c +++ b/qw/source/cl_tent.c @@ -141,7 +141,7 @@ CL_Init_Entity (entity_t *ent) ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = ent->colormod[3] = 1.0; ent->scale = 1.0; - ent->pose1 = ent->pose2 = -1; + ent->lerpflags |= LERP_RESETMOVE|LERP_RESETANIM; } static tent_t * From c526b615b10a0752c8f8254adc3032eb953488f2 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 27 Nov 2010 07:25:47 +0900 Subject: [PATCH 106/115] Tweak server connection handling. Add some \n to the strings and do a Host_Error when the server is using a "bad" protocol version. --- nq/source/cl_parse.c | 2 +- nq/source/sv_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nq/source/cl_parse.c b/nq/source/cl_parse.c index 738ac0536..c2eccf490 100644 --- a/nq/source/cl_parse.c +++ b/nq/source/cl_parse.c @@ -304,7 +304,7 @@ CL_ParseServerInfo (void) // parse protocol version number i = MSG_ReadLong (net_message); if (i != PROTOCOL_NETQUAKE && i!= PROTOCOL_FITZQUAKE) { - Sys_Printf ("Server returned version %i, not %i or %i\n", i, + Host_Error ("Server returned version %i, not %i or %i\n", i, PROTOCOL_NETQUAKE, PROTOCOL_FITZQUAKE); goto done; } diff --git a/nq/source/sv_main.c b/nq/source/sv_main.c index 3cabad043..a8173f7d6 100644 --- a/nq/source/sv_main.c +++ b/nq/source/sv_main.c @@ -239,7 +239,7 @@ SV_SendServerinfo (client_t *client) int i; MSG_WriteByte (&client->message, svc_print); - snprintf (message, sizeof (message), "%c\nVersion %s server (%i CRC)", 2, + snprintf (message, sizeof (message), "%c\nVersion %s server (%i CRC)\n", 2, NQ_VERSION, sv_pr_state.crc); MSG_WriteString (&client->message, message); From f31595781c46899854ccbe24b1503cc2fdb98311 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 27 Nov 2010 08:48:00 +0900 Subject: [PATCH 107/115] Add and used SYS_VID for video/targets masked prints. --- include/QF/sys.h | 1 + libs/video/targets/context_x11.c | 6 +-- libs/video/targets/dga_check.c | 8 ++-- libs/video/targets/in_common.c | 2 +- libs/video/targets/in_svgalib.c | 8 ++-- libs/video/targets/in_win.c | 2 +- libs/video/targets/in_x11.c | 2 +- libs/video/targets/joy.c | 6 +-- libs/video/targets/joy_linux.c | 4 +- libs/video/targets/qfgl_ext.c | 6 +-- libs/video/targets/vid.c | 4 +- libs/video/targets/vid_3dfxsvga.c | 10 ++--- libs/video/targets/vid_common_gl.c | 60 +++++++++++++++--------------- libs/video/targets/vid_fbdev.c | 2 +- libs/video/targets/vid_glx.c | 4 +- libs/video/targets/vid_sgl.c | 2 +- libs/video/targets/vid_svgalib.c | 2 +- libs/video/targets/vid_x11.c | 26 ++++++------- 18 files changed, 78 insertions(+), 77 deletions(-) diff --git a/include/QF/sys.h b/include/QF/sys.h index 4b5cd6b44..3dd38bb87 100644 --- a/include/QF/sys.h +++ b/include/QF/sys.h @@ -79,6 +79,7 @@ void Sys_TimeOfDay(date_t *date); void Sys_MaskPrintf (int mask, const char *fmt, ...) __attribute__((format(printf,2,3))); #define SYS_DEV 1 #define SYS_WARN 3 // bit 0 so developer 1 will pick it up +#define SYS_VID 5 int Sys_CheckInput (int idle, int net_socket); const char *Sys_ConsoleInput (void); diff --git a/libs/video/targets/context_x11.c b/libs/video/targets/context_x11.c index 3eefe4f9c..4a4385d46 100644 --- a/libs/video/targets/context_x11.c +++ b/libs/video/targets/context_x11.c @@ -128,7 +128,7 @@ configure_notify (XEvent *event) if (vidmode_active) X11_ForceViewPort (); #endif - Sys_MaskPrintf (SYS_DEV, + Sys_MaskPrintf (SYS_VID, "ConfigureNotify: %ld %d %ld %ld %d,%d (%d,%d) " "%d %ld %d\n", c->serial, c->send_event, c->event, c->window, c->x, c->y, @@ -140,7 +140,7 @@ qboolean X11_AddEvent (int event, void (*event_handler) (XEvent *)) { if (event >= LASTEvent) { - Sys_MaskPrintf (SYS_DEV, "event: %d, LASTEvent: %d\n", event, + Sys_MaskPrintf (SYS_VID, "event: %d, LASTEvent: %d\n", event, LASTEvent); return false; } @@ -431,7 +431,7 @@ X11_SetVidMode (int width, int height) } if (found_mode) { - Sys_MaskPrintf (SYS_DEV, "VID: Chose video mode: %dx%d\n", + Sys_MaskPrintf (SYS_VID, "VID: Chose video mode: %dx%d\n", vid.width, vid.height); XF86VidModeSwitchToMode (x_disp, x_screen, diff --git a/libs/video/targets/dga_check.c b/libs/video/targets/dga_check.c index 60e0d57b4..1625580a5 100644 --- a/libs/video/targets/dga_check.c +++ b/libs/video/targets/dga_check.c @@ -97,11 +97,11 @@ VID_CheckDGA (Display * dpy, int *maj_ver, int *min_ver, int *hasvideo) } if ((!maj_ver) || (*maj_ver != XDGA_MAJOR_VERSION)) { - Sys_MaskPrintf (SYS_DEV, "VID: Incorrect DGA version: %d.%d, \n", + Sys_MaskPrintf (SYS_VID, "VID: Incorrect DGA version: %d.%d, \n", *maj_ver, *min_ver); return false; } - Sys_MaskPrintf (SYS_DEV, "VID: DGA version: %d.%d\n", *maj_ver, *min_ver); + Sys_MaskPrintf (SYS_VID, "VID: DGA version: %d.%d\n", *maj_ver, *min_ver); if (!hasvideo) hasvideo = &dummy_video; @@ -151,12 +151,12 @@ VID_CheckVMode (Display * dpy, int *maj_ver, int *min_ver) return false; if ((!maj_ver) || (*maj_ver != XF86VIDMODE_MAJOR_VERSION)) { - Sys_MaskPrintf (SYS_DEV, "VID: Incorrect VidMode version: %d.%d\n", + Sys_MaskPrintf (SYS_VID, "VID: Incorrect VidMode version: %d.%d\n", *maj_ver, *min_ver); return false; } - Sys_MaskPrintf (SYS_DEV, "VID: VidMode version: %d.%d\n", + Sys_MaskPrintf (SYS_VID, "VID: VidMode version: %d.%d\n", *maj_ver, *min_ver); return true; #else diff --git a/libs/video/targets/in_common.c b/libs/video/targets/in_common.c index 78bde8e0c..5d87363b3 100644 --- a/libs/video/targets/in_common.c +++ b/libs/video/targets/in_common.c @@ -135,7 +135,7 @@ IN_Shutdown (void) { JOY_Shutdown (); - Sys_MaskPrintf (SYS_DEV, "IN_Shutdown\n"); + Sys_MaskPrintf (SYS_VID, "IN_Shutdown\n"); IN_LL_Shutdown (); IE_Shutdown (); diff --git a/libs/video/targets/in_svgalib.c b/libs/video/targets/in_svgalib.c index a77c76650..430dff57c 100644 --- a/libs/video/targets/in_svgalib.c +++ b/libs/video/targets/in_svgalib.c @@ -115,7 +115,7 @@ keyhandler (int scancode, int state) default: break; } - //Sys_MaskPrintf (SYS_DEV, "%d %02x %02lx %04x %c\n", sc, press, shifts, + //Sys_MaskPrintf (SYS_VID, "%d %02x %02lx %04x %c\n", sc, press, shifts, // key, ascii > 32 && ascii < 127 ? ascii : '#'); Key_Event (key, ascii, press); } @@ -386,14 +386,14 @@ IN_InitMouse (void) mouserate = atoi (com_argv[COM_CheckParm ("-mrate") + 1]); } #if 0 - Sys_MaskPrintf (SYS_DEV, "Mouse: dev=%s,type=%s,speed=%d\n", + Sys_MaskPrintf (SYS_VID, "Mouse: dev=%s,type=%s,speed=%d\n", mousedev, mice[mtype].name, mouserate); #endif //FIXME: vga_init() opens the mouse automoatically // closing it to ensure its opened how we want it mouse_close(); if (mouse_init ((char *)mousedev, mtype, mouserate)) { - Sys_MaskPrintf (SYS_DEV, + Sys_MaskPrintf (SYS_VID, "No mouse found. Check your libvga.conf mouse settings" " and that the mouse\n" "device has appropriate permission settings.\n"); @@ -407,7 +407,7 @@ IN_InitMouse (void) void IN_LL_Shutdown (void) { - Sys_MaskPrintf (SYS_DEV, "IN_LL_Shutdown\n"); + Sys_MaskPrintf (SYS_VID, "IN_LL_Shutdown\n"); if (UseMouse) mouse_close (); diff --git a/libs/video/targets/in_win.c b/libs/video/targets/in_win.c index c4ecfdc6b..3d777a18f 100644 --- a/libs/video/targets/in_win.c +++ b/libs/video/targets/in_win.c @@ -680,7 +680,7 @@ MapKey (unsigned int keycode, int press, int *k, int *u) break; } - Sys_MaskPrintf (SYS_DEV, "%08x %d %02x %02lx %04x %c\n", + Sys_MaskPrintf (SYS_VID, "%08x %d %02x %02lx %04x %c\n", keycode, press, scan, shifts, key, uc > 32 && uc < 127 ? uc : '#'); *k = key; diff --git a/libs/video/targets/in_x11.c b/libs/video/targets/in_x11.c index 19c680c4d..95aa84e2f 100644 --- a/libs/video/targets/in_x11.c +++ b/libs/video/targets/in_x11.c @@ -712,7 +712,7 @@ IN_LL_ProcessEvents (void) void IN_LL_Shutdown (void) { - Sys_MaskPrintf (SYS_DEV, "IN_LL_Shutdown\n"); + Sys_MaskPrintf (SYS_VID, "IN_LL_Shutdown\n"); in_mouse_avail = 0; if (x_disp) { XAutoRepeatOn (x_disp); diff --git a/libs/video/targets/joy.c b/libs/video/targets/joy.c index 3bf09bf73..c4804a6bc 100644 --- a/libs/video/targets/joy.c +++ b/libs/video/targets/joy.c @@ -155,7 +155,7 @@ JOY_Init (void) int i; if (JOY_Open () == -1) { - Sys_MaskPrintf (SYS_DEV, "JOY: Joystick not found.\n"); + Sys_MaskPrintf (SYS_VID, "JOY: Joystick not found.\n"); joy_found = false; joy_active = false; return; @@ -164,12 +164,12 @@ JOY_Init (void) joy_found = true; if (!joy_enable->int_val) { - Sys_MaskPrintf (SYS_DEV, "JOY: Joystick found, but not enabled.\n"); + Sys_MaskPrintf (SYS_VID, "JOY: Joystick found, but not enabled.\n"); joy_active = false; JOY_Close (); } - Sys_MaskPrintf (SYS_DEV, "JOY: Joystick found and activated.\n"); + Sys_MaskPrintf (SYS_VID, "JOY: Joystick found and activated.\n"); // Initialize joystick if found and enabled for (i = 0; i < JOY_MAX_BUTTONS; i++) { diff --git a/libs/video/targets/joy_linux.c b/libs/video/targets/joy_linux.c index fff99a3a2..1a37a7c68 100644 --- a/libs/video/targets/joy_linux.c +++ b/libs/video/targets/joy_linux.c @@ -99,8 +99,8 @@ JOY_Close (void) i = close (joy_handle); if (i) { - Sys_MaskPrintf (SYS_DEV, "JOY: Failed to close joystick device!\n"); + Sys_MaskPrintf (SYS_VID, "JOY: Failed to close joystick device!\n"); } else { - Sys_MaskPrintf (SYS_DEV, "JOY_Shutdown\n"); + Sys_MaskPrintf (SYS_VID, "JOY_Shutdown\n"); } } diff --git a/libs/video/targets/qfgl_ext.c b/libs/video/targets/qfgl_ext.c index bbc042095..513ce4783 100644 --- a/libs/video/targets/qfgl_ext.c +++ b/libs/video/targets/qfgl_ext.c @@ -71,14 +71,14 @@ QFGL_ProcAddress (void *handle, const char *name, qboolean crit) { void *glfunc = NULL; - Sys_MaskPrintf (SYS_DEV, "DEBUG: Finding symbol %s ... ", name); + Sys_MaskPrintf (SYS_VID, "DEBUG: Finding symbol %s ... ", name); glfunc = QFGL_GetProcAddress (handle, name); if (glfunc) { - Sys_MaskPrintf (SYS_DEV, "found [%p]\n", glfunc); + Sys_MaskPrintf (SYS_VID, "found [%p]\n", glfunc); return glfunc; } - Sys_MaskPrintf (SYS_DEV, "not found\n"); + Sys_MaskPrintf (SYS_VID, "not found\n"); if (crit) { if (strncmp ("fxMesa", name, 6) == 0) { diff --git a/libs/video/targets/vid.c b/libs/video/targets/vid.c index 77f006556..96d941b37 100644 --- a/libs/video/targets/vid.c +++ b/libs/video/targets/vid.c @@ -203,13 +203,13 @@ VID_UpdateGamma (cvar_t *vid_gamma) vid.recalc_refdef = 1; // force a surface cache flush if (vid_gamma_avail && vid_system_gamma->int_val) { // Have system, use it - Sys_MaskPrintf (SYS_DEV, "Setting hardware gamma to %g\n", gamma); + Sys_MaskPrintf (SYS_VID, "Setting hardware gamma to %g\n", gamma); VID_BuildGammaTable (1.0); // hardware gamma wants a linear palette VID_SetGamma (gamma); memcpy (vid.palette, vid.basepal, 256 * 3); } else { // We have to hack the palette int i; - Sys_MaskPrintf (SYS_DEV, "Setting software gamma to %g\n", gamma); + Sys_MaskPrintf (SYS_VID, "Setting software gamma to %g\n", gamma); VID_BuildGammaTable (gamma); for (i = 0; i < 256 * 3; i++) vid.palette[i] = gammatable[vid.basepal[i]]; diff --git a/libs/video/targets/vid_3dfxsvga.c b/libs/video/targets/vid_3dfxsvga.c index eacf7ab22..833faee42 100644 --- a/libs/video/targets/vid_3dfxsvga.c +++ b/libs/video/targets/vid_3dfxsvga.c @@ -176,20 +176,20 @@ GL_Init (void) if (!(dither_select = QFGL_ExtensionAddress ("gl3DfxSetDitherModeEXT"))) return; - Sys_MaskPrintf (SYS_DEV, "Dithering: "); + Sys_MaskPrintf (SYS_VID, "Dithering: "); if ((p = COM_CheckParm ("-dither")) && p < com_argc) { if (strequal (com_argv[p+1], "2x2")) { dither_select (GR_DITHER_2x2); - Sys_MaskPrintf (SYS_DEV, "2x2.\n"); + Sys_MaskPrintf (SYS_VID, "2x2.\n"); } if (strequal (com_argv[p+1], "4x4")) { dither_select (GR_DITHER_4x4); - Sys_MaskPrintf (SYS_DEV, "4x4.\n"); + Sys_MaskPrintf (SYS_VID, "4x4.\n"); } } else { qfglDisable (GL_DITHER); - Sys_MaskPrintf (SYS_DEV, "disabled.\n"); + Sys_MaskPrintf (SYS_VID, "disabled.\n"); } } @@ -326,7 +326,7 @@ VID_Init (unsigned char *palette) vid.initialized = true; - Sys_MaskPrintf (SYS_DEV, "Video mode %dx%d initialized.\n", + Sys_MaskPrintf (SYS_VID, "Video mode %dx%d initialized.\n", vid.width, vid.height); vid.recalc_refdef = 1; // force a surface cache flush diff --git a/libs/video/targets/vid_common_gl.c b/libs/video/targets/vid_common_gl.c index edb028bc1..53ef36dca 100644 --- a/libs/video/targets/vid_common_gl.c +++ b/libs/video/targets/vid_common_gl.c @@ -197,7 +197,7 @@ gl_multitexture_f (cvar_t *var) qfglDisable (GL_TEXTURE_2D); } else { gl_mtex_fullbright = false; - Sys_MaskPrintf (SYS_DEV, + Sys_MaskPrintf (SYS_VID, "Not enough TMUs for BSP fullbrights.\n"); } } @@ -248,7 +248,7 @@ gl_anisotropy_f (cvar_t * var) } else { aniso = 1.0; if (var) - Sys_MaskPrintf (SYS_DEV, + Sys_MaskPrintf (SYS_VID, "Anisotropy (GL_EXT_texture_filter_anisotropic) " "is not supported by your hardware and/or " "drivers.\n"); @@ -267,7 +267,7 @@ gl_tessellate_f (cvar_t * var) } else { tess = 0; if (var) - Sys_MaskPrintf (SYS_DEV, + Sys_MaskPrintf (SYS_VID, "TruForm (GL_ATI_pn_triangles) is not supported " "by your hardware and/or drivers.\n"); } @@ -338,14 +338,14 @@ CheckGLVersionString (void) } else { Sys_Error ("Malformed OpenGL version string!"); } - Sys_MaskPrintf (SYS_DEV, "GL_VERSION: %s\n", gl_version); + Sys_MaskPrintf (SYS_VID, "GL_VERSION: %s\n", gl_version); gl_vendor = (char *) qfglGetString (GL_VENDOR); - Sys_MaskPrintf (SYS_DEV, "GL_VENDOR: %s\n", gl_vendor); + Sys_MaskPrintf (SYS_VID, "GL_VENDOR: %s\n", gl_vendor); gl_renderer = (char *) qfglGetString (GL_RENDERER); - Sys_MaskPrintf (SYS_DEV, "GL_RENDERER: %s\n", gl_renderer); + Sys_MaskPrintf (SYS_VID, "GL_RENDERER: %s\n", gl_renderer); gl_extensions = (char *) qfglGetString (GL_EXTENSIONS); - Sys_MaskPrintf (SYS_DEV, "GL_EXTENSIONS: %s\n", gl_extensions); + Sys_MaskPrintf (SYS_VID, "GL_EXTENSIONS: %s\n", gl_extensions); if (strstr (gl_renderer, "Mesa DRI Mach64")) gl_feature_mach64 = true; @@ -380,15 +380,15 @@ CheckCombineExtensions (void) { if (gl_major >= 1 && gl_minor >= 3) { gl_combine_capable = true; - Sys_MaskPrintf (SYS_DEV, "COMBINE active, multitextured doublebright " + Sys_MaskPrintf (SYS_VID, "COMBINE active, multitextured doublebright " "enabled.\n"); } else if (QFGL_ExtensionPresent ("GL_ARB_texture_env_combine")) { gl_combine_capable = true; - Sys_MaskPrintf (SYS_DEV, "COMBINE_ARB active, multitextured " + Sys_MaskPrintf (SYS_VID, "COMBINE_ARB active, multitextured " "doublebright enabled.\n"); } else { gl_combine_capable = false; - Sys_MaskPrintf (SYS_DEV, "GL_ARB_texture_env_combine not found. " + Sys_MaskPrintf (SYS_VID, "GL_ARB_texture_env_combine not found. " "gl_doublebright will have no effect with " "gl_multitexture on.\n"); } @@ -402,15 +402,15 @@ CheckCombineExtensions (void) static void CheckMultiTextureExtensions (void) { - Sys_MaskPrintf (SYS_DEV, "Checking for multitexture: "); + Sys_MaskPrintf (SYS_VID, "Checking for multitexture: "); if (COM_CheckParm ("-nomtex")) { - Sys_MaskPrintf (SYS_DEV, "disabled.\n"); + Sys_MaskPrintf (SYS_VID, "disabled.\n"); return; } if (gl_major >= 1 && gl_minor >= 3) { qfglGetIntegerv (GL_MAX_TEXTURE_UNITS, &gl_mtex_tmus); if (gl_mtex_tmus >= 2) { - Sys_MaskPrintf (SYS_DEV, "enabled, %d TMUs.\n", gl_mtex_tmus); + Sys_MaskPrintf (SYS_VID, "enabled, %d TMUs.\n", gl_mtex_tmus); qglMultiTexCoord2f = QFGL_ExtensionAddress ("glMultiTexCoord2f"); qglMultiTexCoord2fv = @@ -420,16 +420,16 @@ CheckMultiTextureExtensions (void) if (qglMultiTexCoord2f && gl_mtex_enum) gl_mtex_capable = true; else - Sys_MaskPrintf (SYS_DEV, "Multitexture disabled, could not " + Sys_MaskPrintf (SYS_VID, "Multitexture disabled, could not " "find required functions\n"); } else { - Sys_MaskPrintf (SYS_DEV, + Sys_MaskPrintf (SYS_VID, "Multitexture disabled, not enough TMUs.\n"); } } else if (QFGL_ExtensionPresent ("GL_ARB_multitexture")) { qfglGetIntegerv (GL_MAX_TEXTURE_UNITS_ARB, &gl_mtex_tmus); if (gl_mtex_tmus >= 2) { - Sys_MaskPrintf (SYS_DEV, "enabled, %d TMUs.\n", gl_mtex_tmus); + Sys_MaskPrintf (SYS_VID, "enabled, %d TMUs.\n", gl_mtex_tmus); qglMultiTexCoord2f = QFGL_ExtensionAddress ("glMultiTexCoord2fARB"); qglMultiTexCoord2fv = @@ -439,14 +439,14 @@ CheckMultiTextureExtensions (void) if (qglMultiTexCoord2f && gl_mtex_enum) gl_mtex_capable = true; else - Sys_MaskPrintf (SYS_DEV, "Multitexture disabled, could not " + Sys_MaskPrintf (SYS_VID, "Multitexture disabled, could not " "find required functions\n"); } else { - Sys_MaskPrintf (SYS_DEV, + Sys_MaskPrintf (SYS_VID, "Multitexture disabled, not enough TMUs.\n"); } } else { - Sys_MaskPrintf (SYS_DEV, "not found.\n"); + Sys_MaskPrintf (SYS_VID, "not found.\n"); } } @@ -489,7 +489,7 @@ CheckLights (void) specular[4] = {0.1, 0.1, 0.1, 1.0}; qfglGetIntegerv (GL_MAX_LIGHTS, &gl_max_lights); - Sys_MaskPrintf (SYS_DEV, "Max GL Lights %d.\n", gl_max_lights); + Sys_MaskPrintf (SYS_VID, "Max GL Lights %d.\n", gl_max_lights); qfglEnable (GL_LIGHTING); qfglLightModelfv (GL_LIGHT_MODEL_AMBIENT, dark); @@ -524,7 +524,7 @@ VID_SetPalette (unsigned char *palette) QFile *f; // 8 8 8 encoding - Sys_MaskPrintf (SYS_DEV, "Converting 8to24\n"); + Sys_MaskPrintf (SYS_VID, "Converting 8to24\n"); pal = palette; table = d_8to24table; @@ -643,11 +643,11 @@ Tdfx_Init8bitPalette (void) if (!(qgl3DfxSetPaletteEXT = QFGL_ExtensionAddress ("gl3DfxSetPaletteEXT"))) { - Sys_MaskPrintf (SYS_DEV, "3DFX_set_global_palette not found.\n"); + Sys_MaskPrintf (SYS_VID, "3DFX_set_global_palette not found.\n"); return; } - Sys_MaskPrintf (SYS_DEV, "3DFX_set_global_palette.\n"); + Sys_MaskPrintf (SYS_VID, "3DFX_set_global_palette.\n"); oldpal = (char *) d_8to24table; // d_8to24table3dfx; for (i = 0; i < 256; i++) { @@ -661,7 +661,7 @@ Tdfx_Init8bitPalette (void) qgl3DfxSetPaletteEXT ((GLuint *) table); is8bit = true; } else { - Sys_MaskPrintf (SYS_DEV, "\n 3DFX_set_global_palette not found."); + Sys_MaskPrintf (SYS_VID, "\n 3DFX_set_global_palette not found."); } } @@ -686,11 +686,11 @@ Shared_Init8bitPalette (void) if (QFGL_ExtensionPresent ("GL_EXT_shared_texture_palette")) { if (!(qglColorTableEXT = QFGL_ExtensionAddress ("glColorTableEXT"))) { - Sys_MaskPrintf (SYS_DEV, "glColorTableEXT not found.\n"); + Sys_MaskPrintf (SYS_VID, "glColorTableEXT not found.\n"); return; } - Sys_MaskPrintf (SYS_DEV, "GL_EXT_shared_texture_palette\n"); + Sys_MaskPrintf (SYS_VID, "GL_EXT_shared_texture_palette\n"); qfglEnable (GL_SHARED_TEXTURE_PALETTE_EXT); oldPalette = (GLubyte *) d_8to24table; // d_8to24table3dfx; @@ -705,7 +705,7 @@ Shared_Init8bitPalette (void) GL_UNSIGNED_BYTE, (GLvoid *) thePalette); is8bit = true; } else { - Sys_MaskPrintf (SYS_DEV, + Sys_MaskPrintf (SYS_VID, "\n GL_EXT_shared_texture_palette not found."); } } @@ -713,14 +713,14 @@ Shared_Init8bitPalette (void) void VID_Init8bitPalette (void) { - Sys_MaskPrintf (SYS_DEV, "Checking for 8-bit extension: "); + Sys_MaskPrintf (SYS_VID, "Checking for 8-bit extension: "); if (vid_use8bit->int_val) { Tdfx_Init8bitPalette (); Shared_Init8bitPalette (); if (!is8bit) - Sys_MaskPrintf (SYS_DEV, "\n 8-bit extension not found.\n"); + Sys_MaskPrintf (SYS_VID, "\n 8-bit extension not found.\n"); } else { - Sys_MaskPrintf (SYS_DEV, "disabled.\n"); + Sys_MaskPrintf (SYS_VID, "disabled.\n"); } } diff --git a/libs/video/targets/vid_fbdev.c b/libs/video/targets/vid_fbdev.c index 998430792..347f48d57 100644 --- a/libs/video/targets/vid_fbdev.c +++ b/libs/video/targets/vid_fbdev.c @@ -215,7 +215,7 @@ static struct fb_var_screeninfo orig_var; void VID_Shutdown (void) { - Sys_MaskPrintf (SYS_DEV, "VID_Shutdown\n"); + Sys_MaskPrintf (SYS_VID, "VID_Shutdown\n"); if (!fbdev_inited) return; diff --git a/libs/video/targets/vid_glx.c b/libs/video/targets/vid_glx.c index f0d6ba674..6e2bceb3b 100644 --- a/libs/video/targets/vid_glx.c +++ b/libs/video/targets/vid_glx.c @@ -154,7 +154,7 @@ QFGL_LoadLibrary (void) void VID_Shutdown (void) { - Sys_MaskPrintf (SYS_DEV, "VID_Shutdown\n"); + Sys_MaskPrintf (SYS_VID, "VID_Shutdown\n"); X11_CloseDisplay (); } @@ -242,7 +242,7 @@ VID_Init (unsigned char *palette) VID_Init8bitPalette (); VID_SetPalette (vid.palette); - Sys_MaskPrintf (SYS_DEV, "Video mode %dx%d initialized.\n", + Sys_MaskPrintf (SYS_VID, "Video mode %dx%d initialized.\n", vid.width, vid.height); vid.initialized = true; diff --git a/libs/video/targets/vid_sgl.c b/libs/video/targets/vid_sgl.c index ee61abe45..c50697d40 100644 --- a/libs/video/targets/vid_sgl.c +++ b/libs/video/targets/vid_sgl.c @@ -176,7 +176,7 @@ success: VID_SetPalette (vid.palette); VID_Init8bitPalette (); // Check for 3DFX Extensions and initialize them. - Sys_MaskPrintf (SYS_DEV, "Video mode %dx%d initialized.\n", + Sys_MaskPrintf (SYS_VID, "Video mode %dx%d initialized.\n", vid.width, vid.height); vid.initialized = true; diff --git a/libs/video/targets/vid_svgalib.c b/libs/video/targets/vid_svgalib.c index 625e63f67..86e7ca673 100644 --- a/libs/video/targets/vid_svgalib.c +++ b/libs/video/targets/vid_svgalib.c @@ -245,7 +245,7 @@ get_mode (int width, int height, int depth) void VID_Shutdown (void) { - Sys_MaskPrintf (SYS_DEV, "VID_Shutdown\n"); + Sys_MaskPrintf (SYS_VID, "VID_Shutdown\n"); if (!svgalib_inited) return; diff --git a/libs/video/targets/vid_x11.c b/libs/video/targets/vid_x11.c index c4c3da603..79f57fb01 100644 --- a/libs/video/targets/vid_x11.c +++ b/libs/video/targets/vid_x11.c @@ -346,7 +346,7 @@ ResetSharedFrameBuffers (void) // attach to the shared memory segment x_shminfo[frm].shmaddr = (void *) shmat (x_shminfo[frm].shmid, 0, 0); - Sys_MaskPrintf (SYS_DEV, "VID: shared memory id=%d, addr=0x%lx\n", + Sys_MaskPrintf (SYS_VID, "VID: shared memory id=%d, addr=0x%lx\n", x_shminfo[frm].shmid, (long) x_shminfo[frm].shmaddr); x_framebuffer[frm]->data = x_shminfo[frm].shmaddr; @@ -448,11 +448,11 @@ VID_Init (unsigned char *palette) x_vis = x_visinfo->visual; if (num_visuals > 1) { - Sys_MaskPrintf (SYS_DEV, + Sys_MaskPrintf (SYS_VID, "Found more than one visual id at depth %d:\n", template.depth); for (i = 0; i < num_visuals; i++) - Sys_MaskPrintf (SYS_DEV, " -visualid %d\n", + Sys_MaskPrintf (SYS_VID, " -visualid %d\n", (int) x_visinfo[i].visualid); } else { if (num_visuals == 0) { @@ -465,20 +465,20 @@ VID_Init (unsigned char *palette) } if (verbose) { - Sys_MaskPrintf (SYS_DEV, "Using visualid %d:\n", + Sys_MaskPrintf (SYS_VID, "Using visualid %d:\n", (int) x_visinfo->visualid); - Sys_MaskPrintf (SYS_DEV, " class %d\n", x_visinfo->class); - Sys_MaskPrintf (SYS_DEV, " screen %d\n", x_visinfo->screen); - Sys_MaskPrintf (SYS_DEV, " depth %d\n", x_visinfo->depth); - Sys_MaskPrintf (SYS_DEV, " red_mask 0x%x\n", + Sys_MaskPrintf (SYS_VID, " class %d\n", x_visinfo->class); + Sys_MaskPrintf (SYS_VID, " screen %d\n", x_visinfo->screen); + Sys_MaskPrintf (SYS_VID, " depth %d\n", x_visinfo->depth); + Sys_MaskPrintf (SYS_VID, " red_mask 0x%x\n", (int) x_visinfo->red_mask); - Sys_MaskPrintf (SYS_DEV, " green_mask 0x%x\n", + Sys_MaskPrintf (SYS_VID, " green_mask 0x%x\n", (int) x_visinfo->green_mask); - Sys_MaskPrintf (SYS_DEV, " blue_mask 0x%x\n", + Sys_MaskPrintf (SYS_VID, " blue_mask 0x%x\n", (int) x_visinfo->blue_mask); - Sys_MaskPrintf (SYS_DEV, " colormap_size %d\n", + Sys_MaskPrintf (SYS_VID, " colormap_size %d\n", x_visinfo->colormap_size); - Sys_MaskPrintf (SYS_DEV, " bits_per_rgb %d\n", + Sys_MaskPrintf (SYS_VID, " bits_per_rgb %d\n", x_visinfo->bits_per_rgb); } @@ -583,7 +583,7 @@ VID_SetPalette (unsigned char *palette) void VID_Shutdown (void) { - Sys_MaskPrintf (SYS_DEV, "VID_Shutdown\n"); + Sys_MaskPrintf (SYS_VID, "VID_Shutdown\n"); X11_CloseDisplay (); } From dd87274027ed8980e0c0bddfe61848a37ef783fe Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 27 Nov 2010 09:25:29 +0900 Subject: [PATCH 108/115] DGA mouse tweaks. o Check the return value of XF86DGADirectVideo. o Use input_grabbed instead of in_grab for checking whether to enable dga mouse and other grabbed actions. --- libs/video/targets/in_x11.c | 38 ++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/libs/video/targets/in_x11.c b/libs/video/targets/in_x11.c index 95aa84e2f..ea9ca522c 100644 --- a/libs/video/targets/in_x11.c +++ b/libs/video/targets/in_x11.c @@ -87,15 +87,19 @@ static qboolean dga_avail; static qboolean dga_active; static keydest_t old_key_dest = key_none; static int p_mouse_x, p_mouse_y; +static int input_grabbed = 0; static void dga_on (void) { #ifdef HAVE_DGA if (dga_avail && !dga_active) { - XF86DGADirectVideo (x_disp, DefaultScreen (x_disp), + int ret; + ret = XF86DGADirectVideo (x_disp, DefaultScreen (x_disp), XF86DGADirectMouse); - dga_active = true; + Sys_MaskPrintf (SYS_VID, "XF86DGADirectVideo returned %d\n", ret); + if (ret) + dga_active = true; } #endif } @@ -105,8 +109,11 @@ dga_off (void) { #ifdef HAVE_DGA if (dga_avail && dga_active) { - XF86DGADirectVideo (x_disp, DefaultScreen (x_disp), 0); - dga_active = false; + int ret; + ret = XF86DGADirectVideo (x_disp, DefaultScreen (x_disp), 0); + Sys_MaskPrintf (SYS_VID, "XF86DGADirectVideo returned %d\n", ret); + if (ret) + dga_active = false; } #endif } @@ -114,12 +121,12 @@ dga_off (void) static void in_dga_f (cvar_t *var) { - if (in_grab && in_grab->int_val) { - if (var->int_val) { - dga_on (); - } else { - dga_off (); - } + if (var->int_val && input_grabbed) { + Sys_MaskPrintf (SYS_VID, "VID: in_dga_f on\n"); + dga_on (); + } else { + Sys_MaskPrintf (SYS_VID, "VID: in_dga_f off\n"); + dga_off (); } } @@ -617,7 +624,7 @@ event_motion (XEvent *event) in_mouse_x += event->xmotion.x_root; in_mouse_y += event->xmotion.y_root; } else { - if (vid_fullscreen->int_val || in_grab->int_val) { + if (vid_fullscreen->int_val || input_grabbed) { if (!event->xmotion.send_event) { unsigned dist_x = abs (vid.width / 2 - event->xmotion.x); unsigned dist_y = abs (vid.height / 2 - event->xmotion.y); @@ -664,8 +671,6 @@ grab_error (int code, const char *device) void IN_LL_Grab_Input (int grab) { - static int input_grabbed = 0; - if (!x_disp || !x_win) return; @@ -692,14 +697,12 @@ IN_LL_Grab_Input (int grab) return; } input_grabbed = 1; - if (in_dga->int_val) - dga_on (); + in_dga_f (in_dga); } else { XUngrabPointer (x_disp, CurrentTime); XUngrabKeyboard (x_disp, CurrentTime); input_grabbed = 0; - if (in_dga->int_val) - dga_off (); + in_dga_f (in_dga); } } @@ -756,6 +759,7 @@ IN_LL_Init (void) if (!COM_CheckParm ("-nomouse")) { dga_avail = VID_CheckDGA (x_disp, NULL, NULL, NULL); + Sys_MaskPrintf (SYS_VID, "VID_CheckDGA returned %d\n", dga_avail); X11_AddEvent (ButtonPress, &event_button); X11_AddEvent (ButtonRelease, &event_button); From e53ff2a36d63c8764cb334d95c590a5197e2b20d Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 27 Nov 2010 15:10:34 +0900 Subject: [PATCH 109/115] A bit of house keeping. --- libs/video/targets/context_x11.c | 10 +++++++ libs/video/targets/vid.c | 3 ++ libs/video/targets/vid_3dfxsvga.c | 2 -- libs/video/targets/vid_fbdev.c | 1 - libs/video/targets/vid_glx.c | 38 ++++++++++-------------- libs/video/targets/vid_sdl.c | 2 -- libs/video/targets/vid_sdl32.c | 2 -- libs/video/targets/vid_sgl.c | 2 -- libs/video/targets/vid_svgalib.c | 1 - libs/video/targets/vid_wgl.c | 2 -- libs/video/targets/vid_x11.c | 49 ++++++++++--------------------- 11 files changed, 44 insertions(+), 68 deletions(-) diff --git a/libs/video/targets/context_x11.c b/libs/video/targets/context_x11.c index 4a4385d46..d0c617751 100644 --- a/libs/video/targets/context_x11.c +++ b/libs/video/targets/context_x11.c @@ -63,6 +63,7 @@ static __attribute__ ((used)) const char rcsid[] = # include #endif +#include "QF/cmd.h" #include "QF/cvar.h" #include "QF/input.h" #include "QF/qargs.h" @@ -482,9 +483,18 @@ X11_UpdateFullscreen (cvar_t *fullscreen) } } +static void +VID_Center_f (void) +{ + X11_ForceViewPort (); +} + + void X11_Init_Cvars (void) { + Cmd_AddCommand ("vid_center", VID_Center_f, "Center the view port on the " + "quake window in a virtual desktop.\n"); vid_fullscreen = Cvar_Get ("vid_fullscreen", "0", CVAR_ARCHIVE, &X11_UpdateFullscreen, "Toggles fullscreen game mode"); diff --git a/libs/video/targets/vid.c b/libs/video/targets/vid.c index 96d941b37..6968757cb 100644 --- a/libs/video/targets/vid.c +++ b/libs/video/targets/vid.c @@ -39,6 +39,7 @@ static __attribute__ ((used)) const char rcsid[] = #endif #include +#include "QF/console.h" #include "QF/cvar.h" #include "QF/qargs.h" #include "QF/sys.h" @@ -165,6 +166,8 @@ VID_GetWindowSize (int def_w, int def_h) Cvar_Set (con_height, va ("%d", max (con_height->int_val, 200))); Cvar_SetFlags (con_height, con_height->flags | CVAR_ROM); vid.conheight = con_height->int_val; + + Con_CheckResize (); // Now that we have a window size, fix console } /* GAMMA FUNCTIONS */ diff --git a/libs/video/targets/vid_3dfxsvga.c b/libs/video/targets/vid_3dfxsvga.c index 833faee42..9c958fa25 100644 --- a/libs/video/targets/vid_3dfxsvga.c +++ b/libs/video/targets/vid_3dfxsvga.c @@ -303,8 +303,6 @@ VID_Init (unsigned char *palette) attribs[4] = 1; attribs[5] = FXMESA_NONE; - Con_CheckResize (); // Now that we have a window size, fix console - fc = qf_fxMesaCreateContext (0, findres (&vid.width, &vid.height), GR_REFRESH_75Hz, attribs); if (!fc) diff --git a/libs/video/targets/vid_fbdev.c b/libs/video/targets/vid_fbdev.c index 347f48d57..1f4a6af69 100644 --- a/libs/video/targets/vid_fbdev.c +++ b/libs/video/targets/vid_fbdev.c @@ -455,7 +455,6 @@ VID_Init (unsigned char *palette) current_mode = *vmode; ioctl(tty_fd, KDSETMODE, KD_GRAPHICS); VID_SetMode (current_mode.name, palette); - Con_CheckResize (); // Now that we have a window size, fix console VID_InitGamma (palette); VID_SetPalette (vid.palette); diff --git a/libs/video/targets/vid_glx.c b/libs/video/targets/vid_glx.c index 6e2bceb3b..c01177956 100644 --- a/libs/video/targets/vid_glx.c +++ b/libs/video/targets/vid_glx.c @@ -55,7 +55,6 @@ static __attribute__ ((used)) const char rcsid[] = #endif #include "QF/cmd.h" -#include "QF/console.h" #include "QF/cvar.h" #include "QF/input.h" #include "QF/qargs.h" @@ -150,6 +149,21 @@ QFGL_LoadLibrary (void) } #endif // HAVE_DLOPEN +static void +glx_get_functions (void) +{ + GLF_Init (); + + qfglXSwapBuffers = QFGL_ProcAddress (libgl_handle, "glXSwapBuffers", true); + qfglXChooseVisual = QFGL_ProcAddress (libgl_handle, "glXChooseVisual", + true); + qfglXCreateContext = QFGL_ProcAddress (libgl_handle, "glXCreateContext", + true); + qfglXMakeCurrent = QFGL_ProcAddress (libgl_handle, "glXMakeCurrent", true); + + use_gl_procaddress = 1; +} + void VID_Shutdown (void) @@ -172,12 +186,6 @@ GL_EndRendering (void) Sbar_Changed (); } -static void -VID_Center_f (void) -{ - X11_ForceViewPort (); -} - void VID_Init (unsigned char *palette) { @@ -191,19 +199,7 @@ VID_Init (unsigned char *palette) None }; - GLF_Init (); - - qfglXSwapBuffers = QFGL_ProcAddress (libgl_handle, "glXSwapBuffers", true); - qfglXChooseVisual = QFGL_ProcAddress (libgl_handle, "glXChooseVisual", - true); - qfglXCreateContext = QFGL_ProcAddress (libgl_handle, "glXCreateContext", - true); - qfglXMakeCurrent = QFGL_ProcAddress (libgl_handle, "glXMakeCurrent", true); - - use_gl_procaddress = 1; - - Cmd_AddCommand ("vid_center", VID_Center_f, "Center the view port on the " - "quake window in a virtual desktop.\n"); + glx_get_functions (); VID_GetWindowSize (640, 480); @@ -212,8 +208,6 @@ VID_Init (unsigned char *palette) vid.colormap8 = vid_colormap; vid.fullbright = 256 - LittleLong (*((int *) vid.colormap8 + 2048)); - Con_CheckResize (); // Now that we have a window size, fix console - X11_OpenDisplay (); x_visinfo = qfglXChooseVisual (x_disp, x_screen, attrib); diff --git a/libs/video/targets/vid_sdl.c b/libs/video/targets/vid_sdl.c index 1c7fbba5d..8169e82c8 100644 --- a/libs/video/targets/vid_sdl.c +++ b/libs/video/targets/vid_sdl.c @@ -122,8 +122,6 @@ VID_Init (unsigned char *palette) VID_InitBuffers (); // allocate z buffer and surface cache - Con_CheckResize (); // Now that we have a window size, fix console - SDL_ShowCursor (0); // hide the mouse pointer #ifdef _WIN32 diff --git a/libs/video/targets/vid_sdl32.c b/libs/video/targets/vid_sdl32.c index 859f66d31..a7d741872 100644 --- a/libs/video/targets/vid_sdl32.c +++ b/libs/video/targets/vid_sdl32.c @@ -165,8 +165,6 @@ VID_Init (unsigned char *palette) VID_InitBuffers (); // allocate z buffer and surface cache - Con_CheckResize (); // Now that we have a window size, fix console - SDL_ShowCursor (0); // initialize the mouse #ifdef _WIN32 diff --git a/libs/video/targets/vid_sgl.c b/libs/video/targets/vid_sgl.c index c50697d40..bf17bd02b 100644 --- a/libs/video/targets/vid_sgl.c +++ b/libs/video/targets/vid_sgl.c @@ -165,8 +165,6 @@ VID_Init (unsigned char *palette) SDL_Quit (); success: - Con_CheckResize (); // Now that we have a window size, fix console - vid.numpages = 2; GL_Init (); diff --git a/libs/video/targets/vid_svgalib.c b/libs/video/targets/vid_svgalib.c index 86e7ca673..0321355aa 100644 --- a/libs/video/targets/vid_svgalib.c +++ b/libs/video/targets/vid_svgalib.c @@ -383,7 +383,6 @@ VID_Init (unsigned char *palette) /* Set vid parameters */ VID_SetMode (current_mode, palette); - Con_CheckResize (); // Now that we have a window size, fix console VID_InitGamma (palette); VID_SetPalette (vid.palette); diff --git a/libs/video/targets/vid_wgl.c b/libs/video/targets/vid_wgl.c index 03a5b7633..7fc304343 100644 --- a/libs/video/targets/vid_wgl.c +++ b/libs/video/targets/vid_wgl.c @@ -538,8 +538,6 @@ VID_Init (unsigned char *palette) vid.colormap8 = vid_colormap; vid.fullbright = 256 - LittleLong (*((int *) vid.colormap8 + 2048)); - Con_CheckResize (); - #ifdef SPLASH_SCREEN if(hwnd_dialog) DestroyWindow (hwnd_dialog); diff --git a/libs/video/targets/vid_x11.c b/libs/video/targets/vid_x11.c index 79f57fb01..ac7a6050f 100644 --- a/libs/video/targets/vid_x11.c +++ b/libs/video/targets/vid_x11.c @@ -92,8 +92,6 @@ static XShmSegmentInfo x_shminfo[2]; static int current_framebuffer; static XImage *x_framebuffer[2] = { 0, 0 }; -static int verbose = 0; - int VID_options_items = 1; static byte current_palette[768]; @@ -384,13 +382,6 @@ x11_init_buffers (void) vid.conbuffer = vid.buffer; vid.conrowbytes = vid.rowbytes; - Con_CheckResize (); // Now that we have a window size, fix console -} - -static void -VID_Center_f (void) -{ - X11_ForceViewPort (); } /* @@ -408,22 +399,14 @@ VID_Init (unsigned char *palette) int num_visuals; int template_mask; - Cmd_AddCommand ("vid_center", VID_Center_f, "Center the view port on the " - "quake window in a virtual desktop.\n"); - VID_GetWindowSize (320, 200); - vid.width = vid_width->int_val; - vid.height = vid_height->int_val; - vid.numpages = 2; vid.colormap8 = vid_colormap; vid.fullbright = 256 - LittleLong (*((int *) vid.colormap8 + 2048)); srandom (getpid ()); - verbose = COM_CheckParm ("-verbose"); - // open the display X11_OpenDisplay (); @@ -464,23 +447,21 @@ VID_Init (unsigned char *palette) } } - if (verbose) { - Sys_MaskPrintf (SYS_VID, "Using visualid %d:\n", - (int) x_visinfo->visualid); - Sys_MaskPrintf (SYS_VID, " class %d\n", x_visinfo->class); - Sys_MaskPrintf (SYS_VID, " screen %d\n", x_visinfo->screen); - Sys_MaskPrintf (SYS_VID, " depth %d\n", x_visinfo->depth); - Sys_MaskPrintf (SYS_VID, " red_mask 0x%x\n", - (int) x_visinfo->red_mask); - Sys_MaskPrintf (SYS_VID, " green_mask 0x%x\n", - (int) x_visinfo->green_mask); - Sys_MaskPrintf (SYS_VID, " blue_mask 0x%x\n", - (int) x_visinfo->blue_mask); - Sys_MaskPrintf (SYS_VID, " colormap_size %d\n", - x_visinfo->colormap_size); - Sys_MaskPrintf (SYS_VID, " bits_per_rgb %d\n", - x_visinfo->bits_per_rgb); - } + Sys_MaskPrintf (SYS_VID, "Using visualid %d:\n", + (int) x_visinfo->visualid); + Sys_MaskPrintf (SYS_VID, " class %d\n", x_visinfo->class); + Sys_MaskPrintf (SYS_VID, " screen %d\n", x_visinfo->screen); + Sys_MaskPrintf (SYS_VID, " depth %d\n", x_visinfo->depth); + Sys_MaskPrintf (SYS_VID, " red_mask 0x%x\n", + (int) x_visinfo->red_mask); + Sys_MaskPrintf (SYS_VID, " green_mask 0x%x\n", + (int) x_visinfo->green_mask); + Sys_MaskPrintf (SYS_VID, " blue_mask 0x%x\n", + (int) x_visinfo->blue_mask); + Sys_MaskPrintf (SYS_VID, " colormap_size %d\n", + x_visinfo->colormap_size); + Sys_MaskPrintf (SYS_VID, " bits_per_rgb %d\n", + x_visinfo->bits_per_rgb); /* Setup attributes for main window */ X11_SetVidMode (vid.width, vid.height); From 9900aa3d0295ae13ec8eb889d24c8b128330f5fd Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 27 Nov 2010 16:19:04 +0900 Subject: [PATCH 110/115] Fix vid_fullscreen for modern X window managers. We are now compliant with wm-spec 1.4, so fullscreen toggling should always work. --- libs/video/targets/context_x11.c | 76 ++++++++++++++++---------------- 1 file changed, 37 insertions(+), 39 deletions(-) diff --git a/libs/video/targets/context_x11.c b/libs/video/targets/context_x11.c index d0c617751..ffc409cbd 100644 --- a/libs/video/targets/context_x11.c +++ b/libs/video/targets/context_x11.c @@ -104,7 +104,6 @@ static qboolean vidmode_avail = false; static qboolean vidmode_active = false; static qboolean vid_context_created = false; -static int window_x, window_y, window_saved; static int pos_x, pos_y; #ifdef HAVE_VIDMODE @@ -119,6 +118,37 @@ static int accel_numerator; static int accel_denominator; static int accel_threshold; +#define _NET_WM_STATE_REMOVE 0 +#define _NET_WM_STATE_ADD 1 +#define _NET_WM_STATE_TOGGLE 2 +static Atom x_net_state; +static Atom x_net_fullscreen; + +static void +set_fullscreen (int full) +{ + XEvent xev; + + xev.xclient.type = ClientMessage; + xev.xclient.serial = 0; + xev.xclient.send_event = True; + xev.xclient.window = x_win; + xev.xclient.message_type = x_net_state; + xev.xclient.format = 32; + + if (full) + xev.xclient.data.l[0] = _NET_WM_STATE_ADD; + else + xev.xclient.data.l[0] = _NET_WM_STATE_REMOVE; + + xev.xclient.data.l[1] = x_net_fullscreen; + xev.xclient.data.l[2] = 0; + xev.xclient.data.l[3] = 0; + xev.xclient.data.l[4] = 0; + XSendEvent (x_disp, x_root, False, + SubstructureRedirectMask | SubstructureNotifyMask, &xev); +} + static void configure_notify (XEvent *event) { @@ -236,6 +266,10 @@ X11_OpenDisplay (void) XDisplayName (NULL)); } + x_net_state = XInternAtom (x_disp, "_NET_WM_STATE", False); + x_net_fullscreen = XInternAtom (x_disp, "_NET_WM_STATE_FULLSCREEN", + False); + x_screen = DefaultScreen (x_disp); x_root = RootWindow (x_disp, x_screen); @@ -298,28 +332,6 @@ X11_CreateNullCursor (void) XDefineCursor (x_disp, x_win, nullcursor); } -static void -X11_ForceMove (int x, int y) -{ - int nx, ny; - - if (!vid_context_created) - return; - - XMoveWindow (x_disp, x_win, x, y); - X11_WaitForEvent (ConfigureNotify); - nx = pos_x - x; - ny = pos_y - y; - if (nx == 0 || ny == 0) { - return; - } - x -= nx; - y -= ny; - - XMoveWindow (x_disp, x_win, x, y); - X11_WaitForEvent (ConfigureNotify); -} - static Bool check_mouse_event (Display *disp, XEvent *ev, XPointer arg) { @@ -457,27 +469,13 @@ X11_UpdateFullscreen (cvar_t *fullscreen) if (!fullscreen->int_val) { X11_RestoreVidMode (); - if (window_saved) { - X11_ForceMove (window_x, window_y); - window_saved = 0; - } + set_fullscreen (0); IN_UpdateGrab (in_grab); X11_SetMouse (); return; } else { - - window_x = pos_x; - window_y = pos_y; - window_saved = 1; - + set_fullscreen (1); X11_SetVidMode (vid.width, vid.height); - - if (!vidmode_active) { - window_saved = 0; - return; - } - - X11_ForceMove (0, 0); X11_SetMouse (); IN_UpdateGrab (in_grab); } From 185e21e4e4a9e9b12d0566e6e209268447acf6ff Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 27 Nov 2010 16:53:17 +0900 Subject: [PATCH 111/115] Tweak some developer cvar usage. --- libs/audio/renderer/flac.c | 10 ++++------ libs/audio/renderer/vorbis.c | 9 ++++----- libs/gib/gib_init.c | 3 ++- libs/util/cmd.c | 5 +++-- libs/util/zone.c | 2 +- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/libs/audio/renderer/flac.c b/libs/audio/renderer/flac.c index 1302e8ece..c1af83ecc 100644 --- a/libs/audio/renderer/flac.c +++ b/libs/audio/renderer/flac.c @@ -433,15 +433,13 @@ flac_get_info (flacfile_t *ff) info.dataofs = 0; info.datalen = samples * info.channels * sizeof (float); - if (developer->int_val) { - Sys_Printf ("\nBitstream is %d channel, %dHz\n", + Sys_MaskPrintf (SYS_DEV, "\nBitstream is %d channel, %dHz\n", info.channels, info.rate); - Sys_Printf ("\nDecoded length: %d samples (%d bytes)\n", + Sys_MaskPrintf (SYS_DEV, "\nDecoded length: %d samples (%d bytes)\n", info.frames, info.width); - if (vc) { - Sys_Printf ("Encoded by: %.*s\n\n", + if (vc) { + Sys_MaskPrintf (SYS_DEV, "Encoded by: %.*s\n\n", vc->vendor_string.length, vc->vendor_string.entry); - } } return info; diff --git a/libs/audio/renderer/vorbis.c b/libs/audio/renderer/vorbis.c index cb0ba357b..4236c406b 100644 --- a/libs/audio/renderer/vorbis.c +++ b/libs/audio/renderer/vorbis.c @@ -120,13 +120,12 @@ vorbis_get_info (OggVorbis_File *vf) info.dataofs = 0; info.datalen = samples * info.channels * info.width; - if (developer->int_val) { - Sys_Printf ("\nBitstream is %d channel, %dHz\n", + Sys_MaskPrintf (SYS_DEV, "\nBitstream is %d channel, %dHz\n", info.channels, info.rate); - Sys_Printf ("\nDecoded length: %d samples (%d bytes)\n", + Sys_MaskPrintf (SYS_DEV, "\nDecoded length: %d samples (%d bytes)\n", info.frames, info.width); - Sys_Printf ("Encoded by: %s\n\n", ov_comment (vf, -1)->vendor); - } + Sys_MaskPrintf (SYS_DEV, "Encoded by: %s\n\n", + ov_comment (vf, -1)->vendor); return info; } diff --git a/libs/gib/gib_init.c b/libs/gib/gib_init.c index 2c5385d7f..b4cb0bb26 100644 --- a/libs/gib/gib_init.c +++ b/libs/gib/gib_init.c @@ -74,7 +74,8 @@ GIB_Exec_Override_f (void) return; } if (!Cvar_Command () - && (cmd_warncmd->int_val || (developer && developer->int_val))) + && (cmd_warncmd->int_val + || (developer && developer->int_val & SYS_DEV))) Sys_Printf ("execing %s\n", Cmd_Argv (1)); if ((strlen (Cmd_Argv (1)) >= 4 && !strcmp (Cmd_Argv (1) + strlen (Cmd_Argv (1)) - 4, ".gib")) diff --git a/libs/util/cmd.c b/libs/util/cmd.c index 9a4daade8..090b63dc6 100644 --- a/libs/util/cmd.c +++ b/libs/util/cmd.c @@ -131,7 +131,7 @@ Cmd_Command (cbuf_args_t *args) return 0; if (cbuf_active->strict) return -1; - else if (cmd_warncmd->int_val || developer->int_val) + else if (cmd_warncmd->int_val || developer->int_val & SYS_DEV) Sys_Printf ("Unknown command \"%s\"\n", Cmd_Argv (0)); return 0; } @@ -499,7 +499,8 @@ Cmd_Exec_f (void) return; } if (!Cvar_Command () - && (cmd_warncmd->int_val || (developer && developer->int_val))) + && (cmd_warncmd->int_val + || (developer && developer->int_val & SYS_DEV))) Sys_Printf ("execing %s\n", Cmd_Argv (1)); Cbuf_InsertText (cbuf_active, f); Hunk_FreeToLowMark (mark); diff --git a/libs/util/zone.c b/libs/util/zone.c index 01e30e7e6..cceb1c878 100644 --- a/libs/util/zone.c +++ b/libs/util/zone.c @@ -155,7 +155,7 @@ Z_Malloc (memzone_t *zone, int size) { void *buf; - if (!developer || developer->int_val) + if (!developer || developer->int_val & SYS_DEV) Z_CheckHeap (zone); // DEBUG buf = Z_TagMalloc (zone, size, 1); if (!buf) From 813e2010dae3b22da2acc1a2718733a29c044da3 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 27 Nov 2010 20:52:41 +0900 Subject: [PATCH 112/115] Some basic documentation on the QuakeForge file system. --- doc/filesystem.txt | 52 +++++++++++++++++++++++++++++++++++++++++++ doc/quakeforge.dox.in | 1 + doc/quakeforge.txt | 1 + 3 files changed, 54 insertions(+) create mode 100644 doc/filesystem.txt diff --git a/doc/filesystem.txt b/doc/filesystem.txt new file mode 100644 index 000000000..bfe230be8 --- /dev/null +++ b/doc/filesystem.txt @@ -0,0 +1,52 @@ +//unfortunately, have to wrap the docs in a C comment for doxygen +/** +\page filesystem QuakeForge Directory Trees + +The QuakeForge directory trees resemble that of Quake, but have been made +more suitable for multi-user systems. The directory trees have been split +into "shared data" and "user data". + +The shared data tree is intended to be in a read-only location that is +accessible by permitted users of the system. The contents of the shared +data will usually be the game data as extracted from the Quake or mission +pack CDs, or mod data downloaded from the internet. + +The user data tree is intended to be private to the individual user and will +usually be in the user's home directory. The user data tree usually starts +out empty as it is created by QuakeForge when needed, but user configs, +saved games, recorded demos, screen-shots, quakeworld downloads etc will be +written to the user data tree. Also, QuakeC/Ruamoko file access is +generally restricted to the user data tree. Files in the user data tree +take precedence over files in the shared data tree. + +Except for the system configuration file, the user configuration file, and +the directory configuration file, QuakeForge will not read any file outside +of the shared or user data trees. + +The shared data tree is specified by the \c fs_sharepath cvar. The default +value varies depending on the system, but will generally be either \c +/usr/local/share/games/quakeforge or \c /usr/share/games/quakeforge on +Linux or other UNIX like systems, and \c . (the current directory) on +Windows systems. + +The user data tree is specified by the \c fs_userpath cvar. The default +value varies depending on the system, but will generally be \c +~/.quakeforge or \c ~/.local/share/quakeforge on Linux or other UNIX like +systems, and \c . (the current directory) on Windows systems. + +The user data tree and the shared data tree being in the same place is +quite valid, and QuakeForge is smart enough to not search twice for files +when the trees are in the same place. + +Once QuakeForge is running, \c fs_sharepath and \c fs_userpath cannot be +altered. However, they may be altered by setting them in the system +configuration file, the user configuration file, or on the command line. + +The internal layout of the shared and user data trees are, by default, the +same as Quake (an \c id1 directory tree, plus other mod directories), but +with the addition of a \c QF directory which holds QuakeForge specific data +(such as the menus). The structure of the data trees and, more importantly, +the relationship between the mod directories can be configured with the +directory configurtion file (see \ref dirconf). + +*/ diff --git a/doc/quakeforge.dox.in b/doc/quakeforge.dox.in index 97a012aa5..ffbd6a93d 100644 --- a/doc/quakeforge.dox.in +++ b/doc/quakeforge.dox.in @@ -592,6 +592,7 @@ INPUT += @TOPSRC@/doc/connect.txt INPUT += @TOPSRC@/doc/cshifts.txt INPUT += @TOPSRC@/doc/dirconf.txt INPUT += @TOPSRC@/doc/faq.txt +INPUT += @TOPSRC@/doc/filesystem.txt INPUT += @TOPSRC@/doc/mapformat.txt INPUT += @TOPSRC@/doc/quakeforge.txt INPUT += @TOPSRC@/doc/qw-cap-spec.txt diff --git a/doc/quakeforge.txt b/doc/quakeforge.txt index 980023748..ca411ea47 100644 --- a/doc/quakeforge.txt +++ b/doc/quakeforge.txt @@ -11,6 +11,7 @@ of players we can. \li \subpage faq \li \subpage key_binding \li \subpage cshift_cvars +\li \subpage filesystem \li \subpage dirconf \li \subpage qw_cap_spec \li \subpage qw_download_spec From 341726afb9fc8cea978e84d11da5557f75ad00f7 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 28 Nov 2010 11:18:07 +0900 Subject: [PATCH 113/115] Reimplement Qgets using Qgetc. --- libs/util/quakeio.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/libs/util/quakeio.c b/libs/util/quakeio.c index 6bed472d5..f7200471c 100644 --- a/libs/util/quakeio.c +++ b/libs/util/quakeio.c @@ -386,25 +386,22 @@ Qputs (QFile *file, const char *buf) VISIBLE char * Qgets (QFile *file, char *buf, int count) { - char *ret = buf; + char *ret = buf; + char c; - if (file->c != -1) { - *buf++ = file->c; - count--; - file->c = -1; - if (!count) - return ret; + while (buf - ret < count - 1) { + c = Qgetc (file); + if (c < 0) + break; + *buf++ = c; + if (c == '\n') + break; } - if (file->file) - buf = fgets (buf, count, file->file); - else { -#ifdef HAVE_ZLIB - buf = gzgets (file->gzfile, buf, count); -#else + if (buf == ret) return 0; -#endif - } - return buf ? ret : 0; + + *buf++ = 0; + return ret; } VISIBLE int @@ -537,7 +534,7 @@ Qeof (QFile *file) /* Qgetline - Dynamic length version of Qgets. DO NOT free the buffer. + Dynamic length version of Qgets. Do NOT free the buffer. */ VISIBLE const char * Qgetline (QFile *file) From 98a5d591d5b18b0bb9b42795f9a001834c2b97a5 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 28 Nov 2010 11:28:44 +0900 Subject: [PATCH 114/115] Don't read past the end of a sub-file. This fixes a libvobis streaming problem with vorbis files within pak files. --- libs/util/quakeio.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/libs/util/quakeio.c b/libs/util/quakeio.c index f7200471c..642ad3656 100644 --- a/libs/util/quakeio.c +++ b/libs/util/quakeio.c @@ -84,7 +84,9 @@ struct QFile_s { #endif off_t size; off_t start; + off_t pos; int c; + int sub; }; @@ -289,6 +291,7 @@ Qsubopen (const char *path, int offs, int len, int zip) file = Qdopen (fd, zip ? "rbz" : "rb"); file->size = len; file->start = offs; + file->sub = 1; return file; } @@ -317,6 +320,19 @@ Qread (QFile *file, void *buf, int count) offs = 1; file->c = -1; count--; + if (!count) + return 1; + } + if (file->sub) { + // sub-files are always opened in binary mode, so we don't need to + // worry about character translation messing up count/pos. Normal + // files can be left to the operating system to take care of EOF. + if (file->pos + count > file->size) + count = file->size - file->pos; + if (count < 0) + return -1; + if (!count) + return 0; } if (file->file) ret = fread (buf, 1, count, file->file); @@ -326,12 +342,16 @@ Qread (QFile *file, void *buf, int count) #else return -1; #endif + if (file->sub) + file->pos += ret; return ret == -1 ? ret : ret + offs; } VISIBLE int Qwrite (QFile *file, const void *buf, int count) { + if (file->sub) // can't write to a sub-file + return -1; if (file->file) return fwrite (buf, 1, count, file->file); #ifdef HAVE_ZLIB @@ -348,6 +368,8 @@ Qprintf (QFile *file, const char *fmt, ...) va_list args; int ret = -1; + if (file->sub) // can't write to a sub-file + return -1; va_start (args, fmt); if (file->file) ret = vfprintf (file->file, fmt, args); @@ -373,6 +395,8 @@ Qprintf (QFile *file, const char *fmt, ...) VISIBLE int Qputs (QFile *file, const char *buf) { + if (file->sub) // can't write to a sub-file + return -1; if (file->file) return fputs (buf, file->file); #ifdef HAVE_ZLIB @@ -412,6 +436,11 @@ Qgetc (QFile *file) file->c = -1; return c; } + if (file->sub) { + if (file->pos >= file->size) + return EOF; + file->pos++; + } if (file->file) return fgetc (file->file); #ifdef HAVE_ZLIB @@ -425,6 +454,8 @@ Qgetc (QFile *file) VISIBLE int Qputc (QFile *file, int c) { + if (file->sub) // can't write to a sub-file + return -1; if (file->file) return fputc (c, file->file); #ifdef HAVE_ZLIB @@ -446,9 +477,10 @@ Qungetc (QFile *file, int c) VISIBLE int Qseek (QFile *file, long offset, int whence) { + int res; + file->c = -1; if (file->file) { - int res; switch (whence) { case SEEK_SET: res = fseek (file->file, file->start + offset, whence); @@ -472,13 +504,18 @@ Qseek (QFile *file, long offset, int whence) } if (res != -1) res = ftell (file->file) - file->start; + if (file->sub) + file->pos = res; return res; } #ifdef HAVE_ZLIB else { // libz seems to keep track of the true start position itself // doesn't support SEEK_END, though - return gzseek (file->gzfile, offset, whence); + res = gzseek (file->gzfile, offset, whence); + if (file->sub) + file->pos = res; + return res; } #else return -1; @@ -500,6 +537,8 @@ Qtell (QFile *file) #else return -1; #endif + if (file->sub) + file->pos = ret; return ret == -1 ? ret : ret - offs; } @@ -521,6 +560,8 @@ Qeof (QFile *file) { if (file->c != -1) return 0; + if (file->sub) + return file->pos >= file->size; if (file->file) return feof (file->file); #ifdef HAVE_ZLIB From 32bf4aed2bf81b5af7923b43dba711f35563e653 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 28 Nov 2010 14:36:21 +0900 Subject: [PATCH 115/115] get the message name right --- ruamoko/cl_menu/client_menu.qc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruamoko/cl_menu/client_menu.qc b/ruamoko/cl_menu/client_menu.qc index 8d9bb0eea..7951efc50 100644 --- a/ruamoko/cl_menu/client_menu.qc +++ b/ruamoko/cl_menu/client_menu.qc @@ -125,7 +125,7 @@ string (QFile f) get_comment = local string line; local PLItem plist; - plist = [PLItem newFromFile:f]; + plist = [PLItem fromFile:f]; line = [(PLString) [plist getObjectForKey:"comment"] string]; return line; }