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..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 @@ -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 "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 "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 912590416..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.67) +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 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 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: 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 f222db91c..ffbd6a93d 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. @@ -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 @@ -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 diff --git a/include/QF/bspfile.h b/include/QF/bspfile.h index 99ee5b05a..5addb86c6 100644 --- a/include/QF/bspfile.h +++ b/include/QF/bspfile.h @@ -33,36 +33,34 @@ // 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_NODES 32767 // because negative shorts are contents +#define MAX_MAP_CLIPNODES 32767 // +#define MAX_MAP_LEAFS 32767 // +#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,227 +70,263 @@ #define BSPVERSION 29 #define Q2BSPVERSION 38 -#define TOOLVERSION 2 +#define TOOLVERSION 2 typedef struct lump_s { - int fileofs; - int 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]; - int headnode[MAX_MAP_HULLS]; - int visleafs; // not including the solid leaf 0 - int 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 { - int version; - lump_t lumps[HEADER_LUMPS]; + 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 +#define MIPLEVELS 4 typedef struct miptex_s { - char name[16]; - unsigned int width, height; - unsigned int 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; - int 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 { - 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; + 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 +#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 typedef struct dedge_s { - unsigned short v[2]; // vertex numbers + uint16_t v[2]; // vertex numbers } dedge_t; -#define MAXLIGHTMAPS 4 +#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 + 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 { - 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]; + byte ambient_level[NUM_AMBIENTS]; } dleaf_t; //============================================================================ typedef struct bsp_s { - int nummodels; - dmodel_t *models; + int own_header; + dheader_t *header; - int visdatasize; - byte *visdata; + int own_models; + int nummodels; + dmodel_t *models; - int lightdatasize; - byte *lightdata; + int own_visdata; + size_t visdatasize; + byte *visdata; - int texdatasize; - byte *texdata; // (dmiptexlump_t) + int own_lightdata; + size_t lightdatasize; + byte *lightdata; - int entdatasize; - char *entdata; + int own_texdata; + size_t texdatasize; + byte *texdata; // (dmiptexlump_t) - int numleafs; - dleaf_t *leafs; + int own_entdata; + size_t entdatasize; + char *entdata; - int numplanes; - dplane_t *planes; + int own_leafs; + int numleafs; + dleaf_t *leafs; - int numvertexes; - dvertex_t *vertexes; + int own_planes; + int numplanes; + dplane_t *planes; - int numnodes; - dnode_t *nodes; + int own_vertexes; + int numvertexes; + dvertex_t *vertexes; - int numtexinfo; - texinfo_t *texinfo; + int own_nodes; + int numnodes; + dnode_t *nodes; - int numfaces; - dface_t *faces; + int own_texinfo; + int numtexinfo; + texinfo_t *texinfo; - int numclipnodes; - dclipnode_t *clipnodes; + int own_faces; + int numfaces; + dface_t *faces; - int numedges; - dedge_t *edges; + int own_clipnodes; + int numclipnodes; + dclipnode_t *clipnodes; - int nummarksurfaces; - unsigned short *marksurfaces; + int own_edges; + int numedges; + dedge_t *edges; - int numsurfedges; - int *surfedges; + int own_marksurfaces; + int nummarksurfaces; + uint16_t *marksurfaces; + + int own_surfedges; + int numsurfedges; + int32_t *surfedges; } bsp_t; -bsp_t *LoadBSPMem (void *mem, int size); -bsp_t *LoadBSPFile (QFile *file, int size); -void WriteBSPFile (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); -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_AddMarkSurface (bsp_t *bsp, unsigned short 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); +/** 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. -#endif // __bspfile_h_ + \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); +void BSP_Free (bsp_t *bsp); +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, 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/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/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/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/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/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/include/QF/sys.h b/include/QF/sys.h index 888d2d3d6..3dd38bb87 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,11 @@ 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 +#define SYS_VID 5 + int Sys_CheckInput (int idle, int net_socket); const char *Sys_ConsoleInput (void); diff --git a/include/netmain.h b/include/netmain.h index 10d3d0bf8..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) @@ -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/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/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/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 000000000..ed596b4a1 Binary files /dev/null and b/include/win32/resources/icon1XP.ico differ 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); } 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..c1af83ecc 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); @@ -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; @@ -463,10 +461,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 75ec6f9ed..8b2df1a62 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; @@ -148,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++) { @@ -158,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]; @@ -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_val) + dot = -dot; if (snd_shm->channels == 1) { rscale = 1.0; 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/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; diff --git a/libs/audio/renderer/vorbis.c b/libs/audio/renderer/vorbis.c index ce2588920..4236c406b 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); } @@ -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; } @@ -304,10 +303,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 0ee193fa2..4cbea5be3 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; @@ -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/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/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_debug.c b/libs/gamecode/engine/pr_debug.c index 2e4be5697..15e87287a 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"); @@ -204,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) @@ -217,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; @@ -536,6 +541,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) { @@ -608,7 +615,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'", @@ -724,7 +734,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 +754,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); @@ -879,6 +889,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_load.c b/libs/gamecode/engine/pr_load.c index d7b2d76ae..58042e70e 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,9 +154,14 @@ 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; - Sys_DPrintf ("Programs occupy %iK.\n", size / 1024); + pr->progs_size = size + offset_tweak; + 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 @@ -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; diff --git a/libs/gamecode/engine/pr_opcode.c b/libs/gamecode/engine/pr_opcode.c index f98a3300c..12ecfff9f 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, @@ -1202,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: @@ -1221,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; @@ -1303,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: @@ -1311,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: @@ -1325,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: @@ -1335,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; } } 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; } 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/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 5418f72e9..d5a261872 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,38 @@ 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) { - Sys_DPrintf ("%s loaded", litfilename->str); + ver = LittleLong (((int32_t *) data)[1]); + if (ver == 1) { + Sys_MaskPrintf (SYS_DEV, "%s loaded", litfilename->str); loadmodel->lightdata = data + 8; return; } else - Sys_DPrintf ("Unknown .lit file version (%d)\n", i); + 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 - 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..f61c03d17 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; @@ -363,19 +357,29 @@ Mod_LoadSubmodels (lump_t *l) 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 -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 +392,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; @@ -483,26 +485,29 @@ 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])); } } 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); + if (count > 32767) { + Sys_MaskPrintf (SYS_WARN, + "%i faces exceeds standard limit of 32767.\n", count); + } + loadmodel->surfaces = out; loadmodel->numsurfaces = count; @@ -568,18 +573,21 @@ 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); + if (count > 32767) { + Sys_MaskPrintf (SYS_WARN, + "%i nodes exceeds standard limit of 32767.\n", count); + } + loadmodel->nodes = out; loadmodel->numnodes = count; @@ -596,11 +604,22 @@ Mod_LoadNodes (lump_t *l) 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); + } + } } } @@ -608,19 +627,20 @@ 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); + 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", @@ -637,8 +657,8 @@ Mod_LoadLeafs (lump_t *l) 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) @@ -663,18 +683,22 @@ 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); + if (count > 32767) { + Sys_MaskPrintf (SYS_WARN, + "%i clilpnodes exceeds standard limit of 32767.\n", + count); + } + loadmodel->clipnodes = out; loadmodel->numclipnodes = count; @@ -706,8 +730,14 @@ Mod_LoadClipnodes (lump_t *l) 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)) @@ -756,23 +786,27 @@ 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); + 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; @@ -780,15 +814,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 +832,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 +859,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/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 222344b36..a7d852145 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,35 +131,41 @@ 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 * 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 +188,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")) { @@ -265,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); } @@ -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); } } 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/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 570cb52de..4e585a19d 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; @@ -890,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/ruamoko/rua_plist.c b/libs/ruamoko/rua_plist.c index db1efe9c8..2c48d6583 100644 --- a/libs/ruamoko/rua_plist.c +++ b/libs/ruamoko/rua_plist.c @@ -48,55 +48,172 @@ 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_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) { + 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,125 +221,218 @@ 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[] = { + {"PL_GetFromFile", bi_PL_GetFromFile, -1}, {"PL_GetPropertyList", bi_PL_GetPropertyList, -1}, {"PL_WritePropertyList", bi_PL_WritePropertyList, -1}, {"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 +440,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 +453,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/libs/ruamoko/rua_qfile.c b/libs/ruamoko/rua_qfile.c index 26f6b5268..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) { @@ -182,7 +190,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); diff --git a/libs/util/bspfile.c b/libs/util/bspfile.c index de3b0d4ad..1d7845dd9 100644 --- a/libs/util/bspfile.c +++ b/libs/util/bspfile.c @@ -47,13 +47,26 @@ 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; - dmodel_t *d; + int c, i, j; + dmiptexlump_t *mtl; + dmodel_t *d; - // models + 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); + } + if (cb) + cb (bsp, cbdata); + } + + // models for (i=0 ; inummodels ; i++) { d = &bsp->models[i]; @@ -157,13 +170,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,29 +189,35 @@ swap_bsp (bsp_t *bsp, int todisk) } bsp_t * -LoadBSPMem (void *mem, int size) +LoadBSPMem (void *mem, size_t mem_size, void (*cb) (const bsp_t *, void *), + void *cbdata) { - dheader_t *header = mem; bsp_t *bsp; - 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); #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); \ - } \ - bsp->num##n /= sizeof (bsp->n[0]); \ + 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; \ + bsp->num##n = size / 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); @@ -214,14 +233,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); \ - } \ - bsp->n##size /= sizeof (bsp->n[0]); \ + 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; \ + bsp->n##size = size; \ } while (0) SET_LUMP (LUMP_LIGHTING, lightdata); @@ -229,35 +249,32 @@ do { \ SET_LUMP (LUMP_ENTITIES, entdata); SET_LUMP (LUMP_TEXTURES, texdata); - - swap_bsp (bsp, 0); + swap_bsp (bsp, 0, cb, cbdata); return bsp; } VISIBLE bsp_t * -LoadBSPFile (QFile *file, int size) +LoadBSPFile (QFile *file, size_t size) { void *buf; bsp_t *bsp; buf = malloc (size); Qread (file, buf, size); - bsp = LoadBSPMem (buf, size); - free (buf); + bsp = LoadBSPMem (buf, size, 0, 0); + bsp->own_header = 1; return bsp; } /* WriteBSPFile - - Swaps the bsp file in place, so it should not be referenced again */ VISIBLE void -WriteBSPFile (bsp_t *bsp, QFile *file) -{ - int size; - dheader_t *header; +WriteBSPFile (const bsp_t *bsp, QFile *file) +{ + size_t size; byte *data; + bsp_t tbsp; #define ROUND(x) (((x) + 3) & ~3) @@ -275,27 +292,31 @@ 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); - - 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 +332,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 +351,10 @@ do { \ SET_LUMP (LUMP_ENTITIES, entdata); SET_LUMP (LUMP_TEXTURES, texdata); - Qwrite (file, header, size); - free (header); + swap_bsp (&tbsp, 1, 0, 0); + + Qwrite (file, tbsp.header, size); + free (tbsp.header); } VISIBLE bsp_t * @@ -334,121 +364,157 @@ BSP_New (void) } VISIBLE void -BSP_AddPlane (bsp_t *bsp, dplane_t *plane) +BSP_Free (bsp_t *bsp) { - bsp->planes = realloc (bsp->planes, - (bsp->numplanes + 1) * sizeof (dplane_t)); +#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, 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) { - 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_AddVertex (bsp_t *bsp, const 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_AddNode (bsp_t *bsp, const 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_AddTexinfo (bsp_t *bsp, const 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_AddFace (bsp_t *bsp, const 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_AddClipnode (bsp_t *bsp, const 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, unsigned short marksurface) +BSP_AddMarkSurface (bsp_t *bsp, int marksurface) { - bsp->marksurfaces = realloc (bsp->marksurfaces, - (bsp->nummarksurfaces + 1) - * sizeof (unsigned short)); + 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 (int)); + REALLOC (surfedges); bsp->surfedges[bsp->numsurfedges++] = surfedge; } VISIBLE void -BSP_AddEdge (bsp_t *bsp, dedge_t *edge) +BSP_AddEdge (bsp_t *bsp, const 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_AddModel (bsp_t *bsp, const 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, int lightdatasize) +BSP_AddLighting (bsp_t *bsp, const byte *lightdata, size_t lightdatasize) { + OWN (lightdata); bsp->lightdatasize = lightdatasize; bsp->lightdata = malloc (lightdatasize); memcpy (bsp->lightdata, lightdata, lightdatasize); } VISIBLE void -BSP_AddVisibility (bsp_t *bsp, byte *visdata, int visdatasize) +BSP_AddVisibility (bsp_t *bsp, const byte *visdata, size_t visdatasize) { + OWN (visdata); bsp->visdatasize = visdatasize; bsp->visdata = malloc (visdatasize); memcpy (bsp->visdata, visdata, visdatasize); } VISIBLE void -BSP_AddEntities (bsp_t *bsp, char *entdata, int entdatasize) +BSP_AddEntities (bsp_t *bsp, const char *entdata, size_t entdatasize) { + OWN (entdata); bsp->entdatasize = entdatasize; bsp->entdata = malloc (entdatasize); memcpy (bsp->entdata, entdata, entdatasize); } VISIBLE void -BSP_AddTextures (bsp_t *bsp, byte *texdata, int texdatasize) +BSP_AddTextures (bsp_t *bsp, const byte *texdata, size_t texdatasize) { + OWN (texdata); bsp->texdatasize = texdatasize; bsp->texdata = malloc (texdatasize); memcpy (bsp->texdata, texdata, texdatasize); diff --git a/libs/util/cmd.c b/libs/util/cmd.c index af961c544..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; } @@ -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; } @@ -498,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/cvar.c b/libs/util/cvar.c index 2a25d12fc..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); @@ -382,6 +384,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 +429,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 +592,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 +643,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 +688,9 @@ Cvar_SetFlags (cvar_t *var, int cvarflags) var->flags = cvarflags; } + +VISIBLE void +Cvar_Reset (cvar_t *var) +{ + Cvar_Set (var, var->default_string); +} 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/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 20808d751..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) @@ -630,7 +631,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 +643,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 +661,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 * @@ -825,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); @@ -841,7 +843,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); @@ -851,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); @@ -880,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; } @@ -915,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; @@ -1026,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; } @@ -1076,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 *)); @@ -1180,11 +1184,12 @@ 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; } - 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); } @@ -1193,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); @@ -1408,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/quakeio.c b/libs/util/quakeio.c index 75667d1b1..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; }; @@ -216,12 +218,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; @@ -288,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; } @@ -316,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); @@ -325,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 @@ -347,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); @@ -372,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 @@ -385,25 +410,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 @@ -414,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 @@ -427,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 @@ -448,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); @@ -474,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; @@ -502,6 +537,8 @@ Qtell (QFile *file) #else return -1; #endif + if (file->sub) + file->pos = ret; return ret == -1 ? ret : ret - offs; } @@ -523,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 @@ -536,7 +575,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) 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; diff --git a/libs/util/sys.c b/libs/util/sys.c index 6be131f44..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); @@ -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; diff --git a/libs/util/zone.c b/libs/util/zone.c index 3317cbe38..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) @@ -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); @@ -261,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, 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 @@ -590,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; @@ -598,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... } @@ -854,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); @@ -917,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..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 { @@ -134,7 +144,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 +163,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"); } } @@ -567,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_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..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,27 +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_DPrintf ("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]; @@ -277,185 +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_DPrintf ("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; } @@ -466,7 +376,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_AliasGetSkindesc: no such skin # %d\n", + skinnum); skinnum = 0; } @@ -499,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) { @@ -516,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); @@ -642,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 @@ -665,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/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..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; @@ -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/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/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/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; 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/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/libs/video/targets/context_x11.c b/libs/video/targets/context_x11.c index 6ddfd9e0a..ffc409cbd 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" @@ -103,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 @@ -118,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) { @@ -128,17 +159,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_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, + 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_VID, "event: %d, LASTEvent: %d\n", event, + LASTEvent); return false; } @@ -232,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); @@ -294,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) { @@ -428,8 +444,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_VID, "VID: Chose video mode: %dx%d\n", + vid.width, vid.height); XF86VidModeSwitchToMode (x_disp, x_screen, vidmodes[best_mode]); @@ -453,35 +469,30 @@ 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); } } +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/dga_check.c b/libs/video/targets/dga_check.c index ed5335eb7..1625580a5 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" @@ -93,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_VID, "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_VID, "VID: DGA version: %d.%d\n", *maj_ver, *min_ver); if (!hasvideo) hasvideo = &dummy_video; @@ -147,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_VID, "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_VID, "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..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_DPrintf ("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 57d2f2ed6..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_DPrintf ("%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,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_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_DPrintf ("No mouse found. Check your libvga.conf mouse settings" - " and that the mouse\n" - "device has appropriate permission settings.\n"); + Sys_MaskPrintf (SYS_VID, + "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_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 059edd6f2..3d777a18f 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_VID, "%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..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); } } @@ -712,7 +715,7 @@ IN_LL_ProcessEvents (void) void IN_LL_Shutdown (void) { - Sys_DPrintf ("IN_LL_Shutdown\n"); + Sys_MaskPrintf (SYS_VID, "IN_LL_Shutdown\n"); in_mouse_avail = 0; if (x_disp) { XAutoRepeatOn (x_disp); @@ -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); diff --git a/libs/video/targets/joy.c b/libs/video/targets/joy.c index dfcbfb5d2..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_DPrintf ("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_DPrintf ("JOY: Joystick found, but not enabled.\n"); + Sys_MaskPrintf (SYS_VID, "JOY: Joystick found, but not enabled.\n"); joy_active = false; JOY_Close (); } - Sys_DPrintf ("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 4d5fba84f..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_DPrintf ("JOY: Failed to close joystick device!\n"); + Sys_MaskPrintf (SYS_VID, "JOY: Failed to close joystick device!\n"); } else { - Sys_DPrintf ("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 ed8dffcf8..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_DPrintf ("DEBUG: Finding symbol %s ... ", name); + Sys_MaskPrintf (SYS_VID, "DEBUG: Finding symbol %s ... ", name); glfunc = QFGL_GetProcAddress (handle, name); if (glfunc) { - Sys_DPrintf ("found [%p]\n", glfunc); + Sys_MaskPrintf (SYS_VID, "found [%p]\n", glfunc); return glfunc; } - Sys_DPrintf ("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 d312ae18b..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 */ @@ -203,13 +206,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_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_DPrintf ("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 285170cad..9c958fa25 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_VID, "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_VID, "2x2.\n"); } if (strequal (com_argv[p+1], "4x4")) { dither_select (GR_DITHER_4x4); - Sys_DPrintf ("4x4.\n"); + Sys_MaskPrintf (SYS_VID, "4x4.\n"); } } else { qfglDisable (GL_DITHER); - Sys_DPrintf ("disabled.\n"); + Sys_MaskPrintf (SYS_VID, "disabled.\n"); } } @@ -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) @@ -326,7 +324,8 @@ VID_Init (unsigned char *palette) vid.initialized = true; - Sys_DPrintf ("Video mode %dx%d initialized.\n", vid.width, vid.height); + 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 70baef1d0..53ef36dca 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_VID, + "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_VID, + "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_VID, + "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_VID, "GL_VERSION: %s\n", gl_version); gl_vendor = (char *) qfglGetString (GL_VENDOR); - Sys_DPrintf ("GL_VENDOR: %s\n", gl_vendor); + Sys_MaskPrintf (SYS_VID, "GL_VENDOR: %s\n", gl_vendor); gl_renderer = (char *) qfglGetString (GL_RENDERER); - Sys_DPrintf ("GL_RENDERER: %s\n", gl_renderer); + Sys_MaskPrintf (SYS_VID, "GL_RENDERER: %s\n", gl_renderer); gl_extensions = (char *) qfglGetString (GL_EXTENSIONS); - Sys_DPrintf ("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; @@ -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_VID, "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_VID, "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_VID, "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_VID, "Checking for multitexture: "); if (COM_CheckParm ("-nomtex")) { - Sys_DPrintf ("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_DPrintf ("enabled, %d TMUs.\n", gl_mtex_tmus); + Sys_MaskPrintf (SYS_VID, "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_VID, "Multitexture disabled, could not " + "find required functions\n"); } else { - Sys_DPrintf ("Multitexture disabled, not enough TMUs.\n"); + 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_DPrintf ("enabled, %d TMUs.\n", gl_mtex_tmus); + Sys_MaskPrintf (SYS_VID, "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_VID, "Multitexture disabled, could not " + "find required functions\n"); } else { - Sys_DPrintf ("Multitexture disabled, not enough TMUs.\n"); + Sys_MaskPrintf (SYS_VID, + "Multitexture disabled, not enough TMUs.\n"); } } else { - Sys_DPrintf ("not found.\n"); + Sys_MaskPrintf (SYS_VID, "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_VID, "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_VID, "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_VID, "3DFX_set_global_palette not found.\n"); return; } - Sys_DPrintf ("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++) { @@ -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_VID, "\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_VID, "glColorTableEXT not found.\n"); return; } - Sys_DPrintf ("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; @@ -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_VID, + "\n GL_EXT_shared_texture_palette not found."); } } void VID_Init8bitPalette (void) { - Sys_DPrintf ("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_DPrintf ("\n 8-bit extension not found.\n"); + Sys_MaskPrintf (SYS_VID, "\n 8-bit extension not found.\n"); } else { - Sys_DPrintf ("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 a6a758827..1f4a6af69 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_VID, "VID_Shutdown\n"); if (!fbdev_inited) return; @@ -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 e1cfe4ab4..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,11 +149,26 @@ 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) { - Sys_DPrintf ("VID_Shutdown\n"); + Sys_MaskPrintf (SYS_VID, "VID_Shutdown\n"); X11_CloseDisplay (); } @@ -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); @@ -242,7 +236,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_VID, "Video mode %dx%d initialized.\n", + vid.width, vid.height); vid.initialized = true; 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 1594954e1..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 (); @@ -176,7 +174,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_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 6bf00d313..0321355aa 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_VID, "VID_Shutdown\n"); if (!svgalib_inited) return; @@ -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 ec616b405..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]; @@ -346,8 +344,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_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; @@ -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 (); @@ -448,10 +431,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_VID, + "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_VID, " -visualid %d\n", + (int) x_visinfo[i].visualid); } else { if (num_visuals == 0) { if (template_mask == VisualIDMask) { @@ -462,17 +447,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_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); @@ -575,7 +564,7 @@ VID_SetPalette (unsigned char *palette) void VID_Shutdown (void) { - Sys_DPrintf ("VID_Shutdown\n"); + Sys_MaskPrintf (SYS_VID, "VID_Shutdown\n"); X11_CloseDisplay (); } 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..537d45fcc 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,18 +228,12 @@ 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; - byte glow_color; - byte colormod; } entity_state_t; #endif // __protocol_h 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 92f52a759..66bccf394 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); @@ -218,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); @@ -261,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); @@ -281,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: @@ -528,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; @@ -539,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); @@ -554,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) @@ -602,11 +611,19 @@ 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) > (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) { @@ -697,7 +714,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; } @@ -727,6 +744,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 b208fc60d..c2eccf490 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,13 +130,15 @@ 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]; cl_entities[cl.num_entities].colormap = vid.colormap8; + cl_entities[cl.num_entities].lerpflags |= (LERP_RESETMOVE + | LERP_RESETANIM); cl.num_entities++; } } @@ -147,12 +165,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); @@ -265,7 +293,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 (); @@ -275,10 +303,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) { + Host_Error ("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 +385,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 +427,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); @@ -407,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; @@ -422,26 +474,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 +541,55 @@ CL_ParseUpdate (int bits) else state->msg_angles[0][2] = state->baseline.angles[2]; - if (bits & U_NOLERP) + if (bits & U_STEP) { + ent->lerpflags |= LERP_MOVESTEP; forcelink = true; + } else { + ent->lerpflags &= ~LERP_MOVESTEP; + } -// 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) { + 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; + } - if (bits & U_SCALE) - state->scale = MSG_ReadByte (net_message); - else - state->scale = state->baseline.scale; + 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); + } + //johnfitz -- don't lerp animation across model changes + ent->lerpflags |= LERP_RESETANIM; + } - 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; - - 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,22 +600,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; - state->baseline.scale = 16; - state->baseline.glow_size = 0; - state->baseline.glow_color = 254; - state->baseline.colormod = 255; + if (bits & B_ALPHA) + state->baseline.alpha = MSG_ReadByte (net_message); + else + state->baseline.alpha = ENTALPHA_DEFAULT; } /* @@ -587,9 +635,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 +669,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); @@ -649,6 +710,9 @@ CL_ParseClientdata (int bits) 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); @@ -684,10 +748,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,39 +785,35 @@ 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); 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); - } - ent->colormod[3] = state.baseline.alpha / 255.0; - ent->scale = state.baseline.scale / 16.0; + VectorSet (1.0, 1.0, 1.0, ent->colormod); + ent->colormod[3] = ENTALPHA_DECODE (state.baseline.alpha); + ent->scale = 1.0; + VectorCopy (state.baseline.origin, ent->origin); + VectorCopy (state.baseline.angles, ent->angles); 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 +830,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 +854,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 +878,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 +898,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 +934,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 +987,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 +1033,7 @@ CL_ParseServerMessage (void) break; case svc_spawnstaticsound: - CL_ParseStaticSound (); + CL_ParseStaticSound (1); break; case svc_cdtrack: @@ -967,7 +1058,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 +1071,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/cl_tent.c b/nq/source/cl_tent.c index 4bce89585..50611c907 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) { @@ -117,84 +137,109 @@ 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 * +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/nq/source/host.c b/nq/source/host.c index c51872026..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; @@ -146,7 +147,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); @@ -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"); @@ -487,7 +490,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", @@ -512,7 +515,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 553e1689b..a8173f7d6 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,14 +236,15 @@ 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, + snprintf (message, sizeof (message), "%c\nVersion %s server (%i CRC)\n", 2, NQ_VERSION, sv_pr_state.crc); 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 @@ -247,7 +304,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; @@ -384,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); @@ -392,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 @@ -399,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; @@ -407,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; @@ -463,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 @@ -490,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)); } } @@ -511,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)) { @@ -576,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]); @@ -602,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)); @@ -622,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 @@ -634,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); @@ -798,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); } } @@ -858,7 +1058,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); @@ -908,7 +1108,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 @@ -934,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]; } @@ -1033,12 +1235,16 @@ 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++) 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_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_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..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)); @@ -540,7 +543,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/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/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/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" diff --git a/qw/source/cl_ents.c b/qw/source/cl_ents.c index b7c2527cb..1d467c06a 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; @@ -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); @@ -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/cl_tent.c b/qw/source/cl_tent.c index eb7a3adc2..2ee54026f 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) @@ -143,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 * @@ -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) { 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; } 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/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/Makefile.am b/ruamoko/cl_menu/Makefile.am index a51951a92..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 + 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/client_menu.qc b/ruamoko/cl_menu/client_menu.qc index 91a8bfe6a..7951efc50 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" @@ -122,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 fromFile:f]; line = [(PLString) [plist getObjectForKey:"comment"] string]; - [plist release]; return line; } @@ -561,9 +557,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": @@ -588,3 +584,8 @@ void () menu_init = void () menu_draw_hud = { }; + +void menu_post () +{ + [AutoreleasePool release]; +} 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.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 93abbd23d..20ddcc480 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" @@ -36,15 +37,18 @@ #include "options_util.h" #include "qfs.h" -#include "PropertyList.h" +#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" -PLItem menu_plist; +#include "CvarToggleView.h" +#include "CvarRangeView.h" +#include "CvarColorView.h" Group video_options; Group audio_options; @@ -101,128 +105,6 @@ InputLine network_config_iactive; * Video settings menu code ****************************/ -void dprint (string str) = #0; - -id object_from_plist (PLItem plist); - -id -class_from_plist (PLDictionary pldict) -{ - local @param [8]params; - 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"); - return NIL; - } - 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].pointer_val = 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); - } - return obj; -} - -id -array_from_plist (PLArray plarray) -{ - local Array array; - local integer i, count; - - array = [[Array alloc] init]; - count = [plarray count]; - for (i = 0; i < count; i++) - [array addItem: object_from_plist ([plarray getObjectAtIndex:i])]; - return array; -} - -id -string_from_plist (PLString plstring) -{ - local string str = [plstring string]; - local string tmp; - local integer xp, yp, xl, yl; - local PLItem item; - - if (str_mid (str, 0, 1) == "[") { - tmp = "(" + str_mid (str, 1, -1) + ")"; - item = [PLItem newFromString: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 [[Rect alloc] initWithComponents:xp :yp :xl :yl]; - } - return NIL; -} - -id -object_from_plist (PLItem plist) -{ - switch ([plist type]) { - case QFDictionary: - return class_from_plist ((PLDictionary) plist); - case QFArray: - return array_from_plist ((PLArray) plist); - case QFBinary: - return NIL; - case QFString: - return string_from_plist ((PLString) plist); - } -} - -PLItem read_plist (void) -{ - local string plist_data; - local QFile file; - local PLItem plist; - - file = QFS_OpenFile ("menu.plist"); - if (!file) { - dprint ("could not load menu.plist\n"); - return NIL; - } - plist_data = Qreadstring (file, Qfilesize (file)); - Qclose (file); - plist = [PLItem newFromString:plist_data]; - str_free (plist_data); - return plist; -} - /* DRAW_video_options @@ -248,16 +130,19 @@ KEY_video_options = Menu function for the video options menu. */ -void () +void (PLItem plist) 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 (plist) { + ret = object_from_plist ([plist getObjectForKey:"video_options"]); + video_options = ret.pointer_val; + } Menu_End (); }; @@ -292,16 +177,19 @@ KEY_audio_options = Makes the audio menu */ -void () +void (PLItem plist) 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 (plist) { + ret = object_from_plist ([plist getObjectForKey:"audio_options"]); + audio_options = ret.pointer_val; + } Menu_End (); }; @@ -359,93 +247,36 @@ 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 Menu make function for control options */ -void () +void (PLItem plist) 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 = [[Rect alloc] initWithComponents: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]; - - [rect release]; - - 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 (plist) { + ret = object_from_plist ([plist getObjectForKey:"control_options"]); + control_options = ret.pointer_val; + } Menu_End (); + //MENU_control_binding (); FIXME how to hook in the bindings menu? }; /*********************************************** @@ -494,7 +325,7 @@ DRAW_feature_options = Makes the feature option menu */ -void () +void (PLItem plist) MENU_feature_options = { local Rect rect; @@ -523,7 +354,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 +362,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 (); @@ -680,7 +509,7 @@ CB_ME_player_options = Makes the player option menu */ -void () +void (PLItem plist) MENU_player_options = { local Rect rect; @@ -720,17 +549,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 +567,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); @@ -852,7 +679,7 @@ CB_ME_network_options = Makes the network option menu */ -void () +void (PLItem plist) MENU_network_options = { local id view; @@ -879,7 +706,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]; @@ -913,8 +740,9 @@ void () MENU_options = { local integer spacing = 120; + local PLItem plist; - menu_plist = read_plist (); + plist = read_plist ("menu.plist"); Menu_Begin (54, 72, ""); Menu_FadeScreen (1); @@ -922,12 +750,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 (); }; 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 1029804f6..86a3efa35 100644 --- a/ruamoko/cl_menu/options_util.qc +++ b/ruamoko/cl_menu/options_util.qc @@ -24,455 +24,12 @@ Boston, MA 02111-1307, USA */ -#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 = [[Rect alloc] initWithComponents: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 = [[Rect alloc] initWithComponents: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 -void traceon () = #0; -@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) setBasePos: (Point) pos -{ - [super setBasePos:pos]; - local Point point = [[Point alloc] initWithComponents:xabs :yabs]; - [title setBasePos:point]; - [view setBasePos:point]; - [point release]; -} - -@end - /* opt_cursor 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; +} 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..d3cf023ad 100644 --- a/ruamoko/gui/Group.r +++ b/ruamoko/gui/Group.r @@ -37,12 +37,18 @@ [self setBasePos: x y:y]; } -- (void) setBasePos: (Point) pos +- (void) setBasePos: (integer) x y: (integer) y { - [super setBasePos:pos]; - local Point point = [[Point alloc] initWithComponents:xabs :yabs]; - [views makeObjectsPerformSelector:@selector (setBasePos:) withObject:point]; - [point release]; + [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]; } - (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..c713cccb8 100644 --- a/ruamoko/gui/View.r +++ b/ruamoko/gui/View.r @@ -38,15 +38,21 @@ return flags & 1; } -- (void) setBasePos: (integer) x y: (integer) y +- (Point) basePos { - local Point point = [[Point alloc] initWithComponents:x :y]; - [self setBasePos:point]; - [point release]; + return makePoint (xabs, yabs); } -- (void) setBasePos: (Point)pos +- (void) setBasePos: (integer) x y: (integer) y { + local Point point = {x, y}; + xabs = xpos + x; + yabs = ypos + y; +} + +- (void) setBasePosFromView: (View) view +{ + Point pos = [view basePos]; xabs = xpos + pos.x; yabs = ypos + pos.y; } 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/include/PropertyList.h b/ruamoko/include/PropertyList.h index 381efc53b..c75d9b571 100644 --- a/ruamoko/include/PropertyList.h +++ b/ruamoko/include/PropertyList.h @@ -13,7 +13,8 @@ + (PLItem) newArray; + (PLItem) newData:(void[]) data size:(integer) len; + (PLItem) newString:(string) str; -+ (PLItem) newFromString:(string) str; ++ (PLItem) fromString:(string) str; ++ (PLItem) fromFile:(QFile) file; - initWithItem:(plitem_t) item; - initWithOwnItem:(plitem_t) item; 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 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..7626eeac5 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 { @@ -23,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; diff --git a/ruamoko/include/plist.h b/ruamoko/include/plist.h index 4cb52ba1a..02d8cfd0e 100644 --- a/ruamoko/include/plist.h +++ b/ruamoko/include/plist.h @@ -1,16 +1,20 @@ #ifndef __ruamoko_plist_h #define __ruamoko_plist_h -struct plitem_s {integer [2] dummy;}; -#define PL_TEST(item) (item.dummy[0] || item.dummy[1]) +#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; @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 +22,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/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; } 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..9281d7446 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,8 @@ BOOL (id object) object_is_meta_class = #0; - (id) autorelease { - + autoreleaseIMP (autoreleaseClass, autoreleaseSelector, self); + return self; } - (unsigned) retainCount diff --git a/ruamoko/lib/PropertyList.r b/ruamoko/lib/PropertyList.r index ebded2a73..a0a66e320 100644 --- a/ruamoko/lib/PropertyList.r +++ b/ruamoko/lib/PropertyList.r @@ -22,9 +22,14 @@ 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]; +} + ++ (PLItem) fromFile:(QFile) file +{ + return [[PLItem itemClass: PL_GetFromFile (file)] autorelease]; } + itemClass:(plitem_t) item @@ -111,12 +116,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 +157,7 @@ - (PLItem) getObjectAtIndex:(integer) index { - return [PLItem itemClass: PL_ObjectAtIndex (item, index)]; + return [[PLItem itemClass: PL_ObjectAtIndex (item, index)] autorelease]; } - addObject:(PLItem) object diff --git a/ruamoko/lib/plist.r b/ruamoko/lib/plist.r index afaae7f92..5fdeada13 100644 --- a/ruamoko/lib/plist.r +++ b/ruamoko/lib/plist.r @@ -1,10 +1,12 @@ #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; 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 +14,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/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 */ 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]), []) diff --git a/tools/qfbsp/include/brush.h b/tools/qfbsp/include/brush.h index bfdd2e625..492ec56e2 100644 --- a/tools/qfbsp/include/brush.h +++ b/tools/qfbsp/include/brush.h @@ -28,27 +28,63 @@ #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 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]; +/** Allocate a new brush. + + \return Pointer to the new brush. +*/ +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); -int PlaneTypeForNormal (vec3_t normal); -int FindPlane (plane_t *dplane, int *side); + +/** 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 (const plane_t *dplane, int *side); + +//@} #endif//qfbsp_brush_h diff --git a/tools/qfbsp/include/bsp5.h b/tools/qfbsp/include/bsp5.h index 87570adf2..78d73398a 100644 --- a/tools/qfbsp/include/bsp5.h +++ b/tools/qfbsp/include/bsp5.h @@ -23,109 +23,119 @@ #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; - 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 -// 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 - // 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; ///< portals on this leaf + 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 +/** Formatted printing with verbosity control. -extern int valid; + Behaves the same as printf except it prints only when verbose is true. +*/ +void qprintf (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); -extern qboolean worldmodel; +extern int valid; + +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); //============================================================================= extern bsp_t *bsp; +//@} + #endif//qfbsp_bsp5_h diff --git a/tools/qfbsp/include/csg4.h b/tools/qfbsp/include/csg4.h index 3b18c3667..12391b19c 100644 --- a/tools/qfbsp/include/csg4.h +++ b/tools/qfbsp/include/csg4.h @@ -25,18 +25,66 @@ #include "QF/bspfile.h" +/** \defgroup qfbsp_csg4 CSG Functions + \ingroup qfbsp +*/ +//@{ + struct plane_s; 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); -struct visfacet_s *NewFaceFromFace (struct visfacet_s *in); +/** 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 (const 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); +//@} + #endif//qfbsp_csg4_h diff --git a/tools/qfbsp/include/draw.h b/tools/qfbsp/include/draw.h index a31832939..2ba109fd3 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; @@ -32,21 +37,23 @@ 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); + +//@} #endif//qfbsp_draw_h diff --git a/tools/qfbsp/include/map.h b/tools/qfbsp/include/map.h index c468f448c..dbaf3469d 100644 --- a/tools/qfbsp/include/map.h +++ b/tools/qfbsp/include/map.h @@ -25,53 +25,104 @@ #include "bsp5.h" -#define MAX_FACES 256 -typedef struct mface_s -{ +/** \defgroup qfbsp_map Map Parser + \ingroup qfbsp +*/ +//@{ + +#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; +/** In-memory representation of an entity as parsed from the map script. +*/ +typedef struct { + 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; -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); +/** Load and parse the map script. -int FindMiptex (const char *name); + Fills in the ::mapbrushes, ::entities and ::miptex arrays. -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); + \param filename Path of the map script to parse. +*/ +void LoadMapFile (const char *filename); -void WriteEntitiesToString (void); +/** 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 (const 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 (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. + + \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 (const 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 diff --git a/tools/qfbsp/include/merge.h b/tools/qfbsp/include/merge.h index a4a5cb49c..c2d0601b8 100644 --- a/tools/qfbsp/include/merge.h +++ b/tools/qfbsp/include/merge.h @@ -23,9 +23,47 @@ #ifndef qfbsp_merge_h #define qfbsp_merge_h -void MergePlaneFaces (surface_t *plane); +/** \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. + \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/include/options.h b/tools/qfbsp/include/options.h index 032260903..d99ccf20e 100644 --- a/tools/qfbsp/include/options.h +++ b/tools/qfbsp/include/options.h @@ -31,32 +31,41 @@ #include "QF/qtypes.h" +/** \defgroup qfbsp_options Command-line Options Parsing + \ingroup qfbsp +*/ +//@{ + 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 smart_leak; + 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; 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 7873aac9e..c90fc04ed 100644 --- a/tools/qfbsp/include/outside.h +++ b/tools/qfbsp/include/outside.h @@ -23,7 +23,25 @@ #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. + + 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/include/portals.h b/tools/qfbsp/include/portals.h index 4b29d1b1a..723352352 100644 --- a/tools/qfbsp/include/portals.h +++ b/tools/qfbsp/include/portals.h @@ -23,20 +23,73 @@ #ifndef qfbsp_portals_h #define qfbsp_portals_h +/** \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. +*/ +//@{ + 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 +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); + +/** 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/include/readbsp.h b/tools/qfbsp/include/readbsp.h index c89113269..24c5c9df0 100644 --- a/tools/qfbsp/include/readbsp.h +++ b/tools/qfbsp/include/readbsp.h @@ -23,10 +23,31 @@ #ifndef qfbsp_readbsp_h #define qfbsp_readbsp_h +/** \defgroup qfbsp_readbsp BSP Reading Functions + \ingroup qfbsp +*/ +//@{ + +/** 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 diff --git a/tools/qfbsp/include/region.h b/tools/qfbsp/include/region.h index 879132fa0..8b2619d4d 100644 --- a/tools/qfbsp/include/region.h +++ b/tools/qfbsp/include/region.h @@ -23,8 +23,19 @@ #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. + + \param headnode The root of the map's bsp. +*/ 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 e8c06a9b0..f0c28a96d 100644 --- a/tools/qfbsp/include/solidbsp.h +++ b/tools/qfbsp/include/solidbsp.h @@ -25,14 +25,30 @@ #include "QF/qtypes.h" +/** \defgroup qfbsp_solidbsp BSP Creation Functions + \ingroup qfbsp +*/ +//@{ + struct visfacet_s; 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/include/surfaces.h b/tools/qfbsp/include/surfaces.h index 128d7578c..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; @@ -36,10 +41,66 @@ 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); + +/** 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/include/tjunc.h b/tools/qfbsp/include/tjunc.h index e78a076c4..db70394aa 100644 --- a/tools/qfbsp/include/tjunc.h +++ b/tools/qfbsp/include/tjunc.h @@ -23,8 +23,19 @@ #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. + + \param headnode The current node in the bsp tree. +*/ 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 863a64b80..4faae3552 100644 --- a/tools/qfbsp/include/winding.h +++ b/tools/qfbsp/include/winding.h @@ -25,20 +25,99 @@ #include "QF/mathlib.h" +/** \defgroup qfbsp_winding Winding Manipulation + \ingroup qfbsp +*/ +//@{ + 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); +/** 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 (const 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); -winding_t *CopyWinding (winding_t *w); -winding_t *CopyWindingReverse (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 (const 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 (const 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); +//@} + #endif//qfbsp_winding_h diff --git a/tools/qfbsp/include/writebsp.h b/tools/qfbsp/include/writebsp.h index 0de07b16a..111c9ff20 100644 --- a/tools/qfbsp/include/writebsp.h +++ b/tools/qfbsp/include/writebsp.h @@ -25,16 +25,60 @@ #include "QF/bspfile.h" +/** \defgroup qfbsp_writebsp BSP Writing Functions + \ingroup qfbsp +*/ +//@{ + 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); -void WriteDrawNodes (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 (const struct node_s *headnode); + +/** Write the model information for the clipping hull. + + \param hullnum The number of this clipping hull. +*/ void BumpModel (int hullnum); -int FindFinalPlane (dplane_t *p); +/** 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 (const 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); +//@} + #endif//qfbsp_writebsp_h diff --git a/tools/qfbsp/source/brush.c b/tools/qfbsp/source/brush.c index a3347af5a..24c5d07f0 100644 --- a/tools/qfbsp/source/brush.c +++ b/tools/qfbsp/source/brush.c @@ -35,8 +35,13 @@ #include "bsp5.h" #include "draw.h" #include "options.h" +#include "surfaces.h" #include "winding.h" +/** \addtogroup qfbsp_brush +*/ +//@{ + int numbrushplanes; plane_t planes[MAX_MAP_PLANES]; @@ -45,13 +50,25 @@ mface_t faces[MAX_FACES]; // beveled clipping hull can generate many extra static entity_t *CurrentEntity; -/* - CheckFace +brush_t * +AllocBrush (void) +{ + brush_t *b; - Note: this will not catch 0 area polygons + b = malloc (sizeof (brush_t)); + memset (b, 0, sizeof (brush_t)); + + return b; +} + +/** Check the face for validity. + + \param f The face to check. + + \note Does not catch 0 area polygons. */ static void -CheckFace (face_t *f) +CheckFace (const face_t *f) { int i, j; vec_t *p1, *p2; @@ -75,8 +92,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) @@ -108,20 +124,30 @@ CheckFace (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, vec3_t v) +AddToBounds (brushset_t *bs, const vec3_t v) { int i; @@ -134,9 +160,10 @@ AddToBounds (brushset_t *bs, vec3_t v) } int -PlaneTypeForNormal (vec3_t normal) +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,20 +180,33 @@ PlaneTypeForNormal (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 #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; @@ -178,6 +218,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; @@ -194,6 +236,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]); @@ -204,19 +247,15 @@ 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) +FindPlane (const plane_t *dplane, int *side) { int i; plane_t *dp, pl; @@ -238,7 +277,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; } @@ -261,6 +300,11 @@ FindPlane (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) { @@ -274,6 +318,9 @@ FindTargetEntity (const char *targetname) } #define ZERO_EPSILON 0.001 + +/** Create the faces of the active brush. +*/ static void CreateBrushFaces (void) { @@ -369,9 +416,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); @@ -408,7 +455,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; @@ -438,7 +485,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]; @@ -494,7 +541,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; @@ -530,7 +577,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; @@ -632,13 +679,13 @@ ExpandBrush (int hullnum) Converts a mapbrush to a bsp brush */ -static brush_t * -LoadBrush (mbrush_t *mb, int hullnum) +static brush_t * +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) { @@ -709,7 +756,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; @@ -773,3 +820,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 2a62ec83c..0de15cd58 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,8 +36,13 @@ static __attribute__ ((used)) const char rcsid[] = #include "draw.h" #include "merge.h" #include "solidbsp.h" +#include "surfaces.h" #include "winding.h" +/** \addtogroup qfbsp_csg4 +*/ +//@{ + /* NOTES @@ -51,15 +56,8 @@ int brushfaces; int csgfaces; int csgmergefaces; - -/* - NewFaceFromFace - - Duplicates the non point information of a face, used by SplitFace and - MergeFace. -*/ -face_t * -NewFaceFromFace (face_t *in) +face_t * +NewFaceFromFace (const face_t *in) { face_t *newf; @@ -123,15 +121,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) @@ -144,18 +142,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]); } @@ -172,10 +174,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) @@ -206,10 +208,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) @@ -228,13 +233,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; @@ -268,6 +267,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) { @@ -290,12 +297,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; @@ -323,15 +325,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 @@ -349,19 +353,24 @@ 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 - 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 @@ -377,3 +386,5 @@ CSGFaces (brushset_t *bs) return surfhead; } + +//@} diff --git a/tools/qfbsp/source/map.c b/tools/qfbsp/source/map.c index 9bd0322d7..bbd6db7d8 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]; @@ -513,9 +517,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); @@ -523,9 +527,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)) @@ -552,7 +556,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; @@ -570,7 +574,7 @@ void WriteEntitiesToString (void) { dstring_t *buf; - epair_t *ep; + const epair_t *ep; int i; buf = dstring_newstr (); @@ -590,3 +594,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 5745eabb0..91a21e8f5 100644 --- a/tools/qfbsp/source/merge.c +++ b/tools/qfbsp/source/merge.c @@ -31,22 +31,31 @@ static __attribute__ ((used)) const char rcsid[] = #include "csg4.h" #include "draw.h" #include "merge.h" +#include "surfaces.h" #include "winding.h" +/** \addtogroup qfbsp_merge +*/ +//@{ + #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; @@ -68,10 +77,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]; @@ -148,13 +157,13 @@ found_edge: } qboolean mergedebug; -face_t * +face_t * 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); @@ -175,7 +184,7 @@ MergeFaceToList (face_t *face, face_t *list) return face; } -face_t * +face_t * FreeMergeListScraps (face_t *merged) { face_t *head, *next; @@ -211,7 +220,7 @@ MergePlaneFaces (surface_t *plane) } void -MergeAll (surface_t * surfhead) +MergeAll (surface_t *surfhead) { face_t *f; int mergefaces; @@ -231,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..de0aaad7b 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) @@ -33,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) { } @@ -63,31 +67,33 @@ 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/options.c b/tools/qfbsp/source/options.c index 2a10a5c92..71b3ab1c6 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[] = { @@ -61,9 +65,10 @@ 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'}, + {"subdivide", required_argument, 0, 's'}, {"wadpath", required_argument, 0, 'w'}, {"watervis", no_argument, 0, 'W'}, {NULL, 0, NULL, 0} @@ -105,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" @@ -134,7 +140,7 @@ DecodeArgs (int argc, char **argv) break; case 'v': // verbose options.verbosity += 1; - break; + break; case 'h': // help usage (0); break; @@ -176,6 +182,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; @@ -195,7 +204,7 @@ DecodeArgs (int argc, char **argv) usage (1); } } - + if (options.extract) { options.bspfile = strdup (argv[optind++]); } else { @@ -238,3 +247,5 @@ DecodeArgs (int argc, char **argv) return optind; } + +//@} diff --git a/tools/qfbsp/source/outside.c b/tools/qfbsp/source/outside.c index bfdc7ff71..08ea2e8d8 100644 --- a/tools/qfbsp/source/outside.c +++ b/tools/qfbsp/source/outside.c @@ -33,10 +33,20 @@ 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. + + \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) +PointInLeaf (node_t *node, const vec3_t point) { vec_t d; @@ -47,6 +57,11 @@ PointInLeaf (node_t *node, vec3_t point) return node; } +/** Set the distance to a node from all reachable nodes. + + \param n The current node. + \param dist The distance to the original node. +*/ static void FloodEntDist_r (node_t *n, int dist) { @@ -73,8 +88,17 @@ 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) +PlaceOccupant (int num, const vec3_t point, node_t *headnode) { node_t *n; @@ -88,15 +112,20 @@ 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. + + \param n2 The second portal. + \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; @@ -134,13 +163,66 @@ 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) +{ + int i; + int next, side; + const node_t *n, *nextnode; + const portal_t *p, *p2; + vec3_t wc; + const 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; -/* - 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) @@ -156,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], @@ -176,6 +258,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); @@ -188,6 +272,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 +313,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)) { @@ -259,6 +351,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; @@ -268,9 +363,11 @@ 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); return true; } + +//@} diff --git a/tools/qfbsp/source/portals.c b/tools/qfbsp/source/portals.c index 8774b4a3e..f150718c6 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,9 +38,42 @@ 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 +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); +} + +/** 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) { @@ -55,6 +89,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) { @@ -87,6 +128,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) { @@ -120,10 +165,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) @@ -144,7 +190,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; @@ -168,6 +216,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++) { @@ -180,11 +229,15 @@ 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) +PlaneFromWinding (const winding_t *w, plane_t *plane) { vec3_t v1, v2; @@ -198,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) { @@ -211,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 - w = BaseWindingForPlane (&planes[node->planenum]); + /// 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) { @@ -246,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; @@ -254,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; @@ -262,11 +324,15 @@ 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]); + + /// 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 DivideWinding (p->winding, plane, &frontwinding, &backwinding); @@ -308,11 +374,6 @@ CutNodePortals_r (node_t *node) CutNodePortals_r (b); } -/* - PortalizeWorld - - Builds the exact polyhedrons for the nodes and leafs -*/ void PortalizeWorld (node_t *headnode) { @@ -323,11 +384,6 @@ PortalizeWorld (node_t *headnode) CutNodePortals_r (headnode); } -/* - PortalizeWorldDetail - - Like PortalizeWorld, but stop at detail nodes - Alexander Malmberg. -*/ void PortalizeWorldDetail (node_t *headnode) { @@ -369,8 +425,14 @@ 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) +HasContents (const node_t *n, int cont) { if (n->contents == cont) return 1; @@ -381,8 +443,13 @@ 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) +ShareContents (const node_t *n1, const node_t *n2) { if (n1->contents) { if (n1->contents == CONTENTS_SOLID) @@ -396,8 +463,15 @@ 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. + + \note 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) +SameContents (const node_t *n1, const node_t *n2) { if (n1->contents == CONTENTS_SOLID || n2->contents == CONTENTS_SOLID) return 0; @@ -414,13 +488,19 @@ 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) +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]); @@ -461,11 +541,14 @@ 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) +WritePortalLeafs_r (const node_t *n) { if (!n->contents) { WritePortalLeafs_r (n->children[0]); @@ -476,6 +559,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) { @@ -493,6 +581,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) { @@ -562,3 +654,5 @@ WritePortalfile (node_t *headnode) fclose (pf); } + +//@} diff --git a/tools/qfbsp/source/qfbsp.c b/tools/qfbsp/source/qfbsp.c index b8a15d41a..c82bad5bd 100644 --- a/tools/qfbsp/source/qfbsp.c +++ b/tools/qfbsp/source/qfbsp.c @@ -59,15 +59,16 @@ static __attribute__ ((used)) const char rcsid[] = #include "writebsp.h" #include "tjunc.h" +/** \addtogroup qfbsp +*/ +//@{ + options_t options; 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 +78,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 +89,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) { @@ -221,7 +144,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 @@ -290,6 +213,7 @@ UpdateEntLump (void) if (!f) Sys_Error ("couldn't open %s. %s", options.bspfile, strerror(errno)); WriteBSPFile (bsp, f); + BSP_Free (bsp); Qclose (f); } @@ -380,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; @@ -495,6 +415,7 @@ ProcessFile (void) extract_entities (); if (options.extract_hull) extract_hull (); + BSP_Free (bsp); return; } @@ -503,6 +424,7 @@ ProcessFile (void) if (options.onlyents) { UpdateEntLump (); + BSP_Free (bsp); return; } @@ -527,6 +449,7 @@ ProcessFile (void) WriteEntitiesToString (); FinishBSPFile (); + BSP_Free (bsp); } int @@ -563,3 +486,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..59701f45b 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; @@ -100,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)); @@ -122,7 +126,7 @@ load_marksurfaces (void) static void load_faces (void) { - dface_t *f; + const dface_t *f; int i, j; winding_t *points; @@ -160,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)); @@ -182,7 +186,7 @@ load_leafs (void) static void load_nodes (void) { - dnode_t *n; + const dnode_t *n; face_t *f; int i, j; @@ -259,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); } @@ -369,10 +374,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; @@ -405,7 +410,7 @@ extract_textures (void) void extract_entities (void) { - char *entfile; + const char *entfile; int i; QFile *ef; @@ -427,7 +432,7 @@ void extract_hull (void) { // hullfile = output_file (".c"); - char *hullfile; + const char *hullfile; int i, j; QFile *hf; @@ -474,3 +479,5 @@ extract_hull (void) } Qprintf (hf, "};\n"); } + +//@} diff --git a/tools/qfbsp/source/region.c b/tools/qfbsp/source/region.c index 2e2ace668..24b95da39 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" @@ -37,6 +37,10 @@ static __attribute__ ((used)) const char rcsid[] = #include "surfaces.h" #include "winding.h" +/** \addtogroup qfbsp_region +*/ +//@{ + /* input ----- @@ -132,7 +136,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 +269,7 @@ GrowNodeRegions (node_t *headnode) vec3_t dir; vec3_t origin; vec3_t p[2]; - } + } for all faces for all edges @@ -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 20a124d98..d0ff65c96 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; @@ -48,23 +52,31 @@ 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) +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; // 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 +88,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 +104,7 @@ FaceSide (face_t *in, plane_t *split) backcount = 1; } } + } if (!frontcount) return SIDE_BACK; @@ -100,13 +114,20 @@ 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) +static surface_t * +ChooseMidPlaneFromList (surface_t *surfaces, + const vec3_t mins, const vec3_t maxs) { int j, l; plane_t *plane; @@ -158,13 +179,19 @@ 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, +static surface_t * +ChoosePlaneFromList (surface_t *surfaces, const vec3_t mins, const vec3_t maxs, qboolean usefloors, qboolean usedetail) { face_t *f; @@ -255,13 +282,14 @@ 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 * +static surface_t * SelectPartition (surface_t *surfaces, int *detail) { int i, j; @@ -273,11 +301,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; @@ -294,13 +323,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); @@ -318,15 +348,8 @@ SelectPartition (surface_t *surfaces, int *detail) return ChoosePlaneFromList (surfaces, mins, maxs, true, true); } -//============================================================================ - -/* - CalcSurfaceInfo - - Calculates the bounding box -*/ void -CalcSurfaceInfo (surface_t * surf) +CalcSurfaceInfo (surface_t *surf) { face_t *f; int i, j; @@ -344,16 +367,24 @@ 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]; } + } } } +/** 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) @@ -478,11 +509,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) @@ -547,12 +578,12 @@ 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 * +static face_t * LinkNodeFaces (surface_t *surface) { face_t *list, *new, **prevptr, *f; @@ -584,6 +615,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) { @@ -641,7 +677,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; @@ -676,3 +712,5 @@ SolidBSP (surface_t *surfhead, qboolean midsplit) return headnode; } + +//@} diff --git a/tools/qfbsp/source/surfaces.c b/tools/qfbsp/source/surfaces.c index 1f39c687a..644438305 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 @@ -46,14 +50,55 @@ static __attribute__ ((used)) const char rcsid[] = */ surface_t newcopy_t; int subdivides; +int c_activefaces, c_peakfaces; +int c_activesurfaces, c_peaksurfaces; -/* - SubdivideFace +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); +} - 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) { @@ -109,12 +154,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) { @@ -142,7 +181,7 @@ GatherNodeFaces_r (node_t *node) } } -surface_t * +surface_t * GatherNodeFaces (node_t *headnode) { memset (validfaces, 0, sizeof (validfaces)); @@ -150,8 +189,6 @@ GatherNodeFaces (node_t *headnode) return BuildSurfaces (); } -//=========================================================================== - typedef struct hashvert_s { struct hashvert_s *next; vec3_t point; @@ -172,14 +209,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) { @@ -209,8 +246,13 @@ 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) +HashVec (const vec3_t vec) { unsigned h; @@ -221,8 +263,13 @@ 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) +GetVertex (const vec3_t in, int planenum) { hashvert_t *hv; int h, i; @@ -282,17 +329,21 @@ 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) +GetEdge (const vec3_t p1, const vec3_t p2, face_t *f) { dedge_t edge; int v1, v2, i; @@ -301,8 +352,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] @@ -312,7 +367,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; @@ -323,6 +378,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) { @@ -338,6 +397,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) { @@ -372,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 4556a6185..0a831d609 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" @@ -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; @@ -67,8 +71,13 @@ 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) +InitHash (const vec3_t mins, const vec3_t maxs) { int newsize[2]; vec3_t size; @@ -91,8 +100,13 @@ 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) +HashVec (const vec3_t vec) { unsigned h; @@ -103,6 +117,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) { @@ -111,34 +133,52 @@ 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 * -FindEdge (vec3_t p1, vec3_t p2, vec_t *t1, vec_t *t2) +/** 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 (const vec3_t p1, const vec3_t p2, vec_t *t1, vec_t *t2) { int h; vec3_t dir, origin; @@ -158,6 +198,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; @@ -166,29 +207,14 @@ 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; } + // create a new wedge if (numwedges == MAXWEDGES) Sys_Error ("FindEdge: numwedges == MAXWEDGES"); w = &wedges[numwedges]; @@ -206,6 +232,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) { @@ -234,8 +270,13 @@ 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) +AddEdge (const vec3_t p1, const vec3_t p2) { wedge_t *w; vec_t t1, t2; @@ -246,8 +287,12 @@ 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) +AddFaceEdges (const face_t *f) { int i, j; @@ -259,6 +304,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) { @@ -297,8 +349,6 @@ FixFaceEdges (face_t *f) newlist = f; } -//============================================================================ - static void tjunc_find_r (node_t *node) { @@ -315,6 +365,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) { @@ -349,9 +403,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]); @@ -364,6 +416,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); @@ -378,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 5e27e8fcd..b087e69cb 100644 --- a/tools/qfbsp/source/winding.c +++ b/tools/qfbsp/source/winding.c @@ -40,10 +40,14 @@ static __attribute__ ((used)) const char rcsid[] = #include "bsp5.h" #include "winding.h" +/** \addtogroup qfbsp_winding +*/ +//@{ + int c_activewindings, c_peakwindings; winding_t * -BaseWindingForPlane (plane_t *p) +BaseWindingForPlane (const plane_t *p) { int i, x; vec_t max, v; @@ -107,7 +111,7 @@ BaseWindingForPlane (plane_t *p) } winding_t * -CopyWinding (winding_t *w) +CopyWinding (const winding_t *w) { size_t size; winding_t *c; @@ -119,7 +123,7 @@ CopyWinding (winding_t *w) } winding_t * -CopyWindingReverse (winding_t *w) +CopyWindingReverse (const winding_t *w) { int i; size_t size; @@ -135,17 +139,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 +237,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) @@ -320,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 a712a1952..a5aeddfc9 100644 --- a/tools/qfbsp/source/writebsp.c +++ b/tools/qfbsp/source/writebsp.c @@ -45,19 +45,18 @@ static __attribute__ ((used)) const char rcsid[] = #include "options.h" #include "writebsp.h" +/** \addtogroup qfbsp_writebsp +*/ +//@{ + int headclipnode; int firstface; -/* - FindFinalPlane - - Used to find plane index numbers for clip nodes read from child processes -*/ 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++) { @@ -65,11 +64,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; } @@ -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) { @@ -97,9 +99,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); @@ -118,13 +118,19 @@ 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) { dclipnode_t cn; int num, c, i; - // FIXME: free more stuff? + // FIXME: free more stuff? if (node->planenum == -1) { num = node->contents; free (node); @@ -142,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) { @@ -155,8 +155,12 @@ 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) +WriteLeaf (const node_t *node) { dleaf_t leaf_p; face_t **fp, *f; @@ -187,18 +191,24 @@ 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); } +/** Recursively write the draw nodes of the map bsp. + + \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; 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); @@ -229,7 +239,7 @@ WriteDrawNodes_r (node_t *node) } void -WriteDrawNodes (node_t *headnode) +WriteDrawNodes (const node_t *headnode) { dmodel_t bm; int start, i; @@ -244,6 +254,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,15 +272,11 @@ 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? } -/* - BumpModel - - Used by the clipping hull processes that need to store only headclipnode -*/ void BumpModel (int hullnum) { @@ -287,8 +295,11 @@ 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) +TEX_InitFromWad (const char *path) { wadlist_t *wl; wad_t *wad; @@ -312,8 +323,18 @@ 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) +LoadLump (const char *name, dstring_t *dest) { int r; int ofs = dest->size; @@ -352,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) { @@ -388,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) { @@ -433,8 +463,6 @@ WriteMiptex (void) if (res == -1) Sys_Error ("couldn't open %s[.gz]", wad); - AddAnimatingTextures (); - wad = w; if (!wad || !*wad) break; @@ -445,6 +473,8 @@ WriteMiptex (void) free (wad_list); dstring_delete (fullpath); + AddAnimatingTextures (); + data = dstring_new (); data->size = sizeof (dmiptexlump_t); dstring_adjust (data); @@ -498,3 +528,5 @@ FinishBSPFile (void) WriteBSPFile (bsp, f); Qclose (f); } + +//@} 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 c79f8a99e..28b66c41d 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; @@ -1977,6 +1980,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 +2014,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; } @@ -2129,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"); @@ -2513,7 +2524,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; @@ -2634,7 +2645,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/function.c b/tools/qfcc/source/function.c index e5ca0bd0e..3d4a80f91 100644 --- a/tools/qfcc/source/function.c +++ b/tools/qfcc/source/function.c @@ -346,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) { @@ -355,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) { 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) { 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/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 * 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 3033dc1c3..f92d57f3d 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 '}' ';' @@ -365,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"); @@ -592,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/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); } 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..b261a25bf --- /dev/null +++ b/tools/qfcc/test/nil.r @@ -0,0 +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 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/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 797265c80..0a2947a85 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 @@ -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) @@ -126,21 +128,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; } @@ -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"); @@ -848,7 +884,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 (); 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); } 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 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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +