X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=tools%2Fquake3%2Fq3map2%2Fq3map2.h;h=5721ae255ef06c70ce98c9ce4b93de95dcea28ab;hb=6790eb7048a160e04b84ee6305a9e830e23415d8;hp=7d6cb9a47fd45fc2692985aa0233f57267b54c83;hpb=131c36f6be58bba507a42f767533b061b721dfec;p=xonotic%2Fnetradiant.git diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 7d6cb9a4..5721ae25 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -48,11 +48,7 @@ ------------------------------------------------------------------------------- */ /* platform-specific */ -#if GDEF_OS_LINUX || GDEF_OS_MACOS - #define Q_UNIX -#endif - -#ifdef Q_UNIX +#if GDEF_OS_POSIX #include #include #include @@ -64,12 +60,13 @@ /* general */ -#include "version.h" /* ttimo: might want to guard that if built outside of the GtkRadiant tree */ - #include "cmdlib.h" #include "mathlib.h" #include "md5lib.h" #include "ddslib.h" +#ifdef BUILD_CRUNCH +#include "crn_rgba.h" +#endif // BUILD_CRUNCH #include "picomodel.h" @@ -90,21 +87,21 @@ ------------------------------------------------------------------------------- */ -#define MAC_STATIC_HACK 0 -#if GDEF_OS_MACOS && MAC_STATIC_HACK - #define MAC_STATIC static +#if GDEF_OS_WINDOWS + #define Q_stricmp stricmp + #define Q_strncasecmp strnicmp #else - #define MAC_STATIC + #define Q_stricmp strcasecmp + #define Q_strncasecmp strncasecmp #endif -#if 1 - #if GDEF_OS_WINDOWS - #define Q_stricmp stricmp - #define Q_strncasecmp strnicmp - #else - #define Q_stricmp strcasecmp - #define Q_strncasecmp strncasecmp - #endif +// hack to declare and define in the same file +#ifdef MAIN_C + #define Q_EXTERN + #define Q_ASSIGN( a ) = a +#else + #define Q_EXTERN extern + #define Q_ASSIGN( a ) #endif /* macro version */ @@ -127,10 +124,10 @@ /* general */ #define MAX_QPATH 64 -#define MAX_IMAGES 512 +#define MAX_IMAGES 2048 #define DEFAULT_IMAGE "*default" -#define MAX_MODELS 512 +#define MAX_MODELS 2048 #define DEF_BACKSPLASH_FRACTION 0.05f /* 5% backsplash by default */ #define DEF_BACKSPLASH_DISTANCE 23 @@ -177,6 +174,21 @@ #define C_DETAIL 0x08000000 /* THIS MUST BE THE SAME AS IN RADIANT! */ +/* new tex surface flags, like Smokin'Guns */ +#define TEX_SURF_METAL 0x00001000 +#define TEX_SURF_WOOD 0x00080000 +#define TEX_SURF_CLOTH 0x00100000 +#define TEX_SURF_DIRT 0x00200000 +#define TEX_SURF_GLASS 0x00400000 +#define TEX_SURF_PLANT 0x00800000 +#define TEX_SURF_SAND 0x01000000 +#define TEX_SURF_SNOW 0x02000000 +#define TEX_SURF_STONE 0x04000000 +#define TEX_SURF_WATER 0x08000000 +#define TEX_SURF_GRASS 0x10000000 +#define TEX_SURF_BREAKABLE 0x20000000 + + /* shadow flags */ #define WORLDSPAWN_CAST_SHADOWS 1 #define WORLDSPAWN_RECV_SHADOWS 1 @@ -545,6 +557,13 @@ typedef enum } miniMapMode_t; +typedef enum +{ + MINIMAP_SIDECAR_NONE, + MINIMAP_SIDECAR_UNVANQUISHED +} +miniMapSidecarFormat_t; + typedef struct game_s { char *arg; /* -game matches this */ @@ -555,6 +574,7 @@ typedef struct game_s int maxLMSurfaceVerts; /* default maximum meta surface verts */ int maxSurfaceVerts; /* default maximum surface verts */ int maxSurfaceIndexes; /* default maximum surface indexes (tris * 3) */ + qboolean texFile; /* enable per shader prefix surface flags and .tex file */ qboolean emitFlares; /* when true, emit flare surfaces */ char *flareShader; /* default flare shader (MUST BE SET) */ qboolean wolfLight; /* when true, lights work like wolf q3map */ @@ -580,6 +600,7 @@ typedef struct game_s qboolean miniMapKeepAspect; /* minimap keep aspect ratio by letterboxing */ miniMapMode_t miniMapMode; /* minimap mode */ char *miniMapNameFormat; /* minimap name format */ + miniMapSidecarFormat_t miniMapSidecarFormat; /* minimap sidecar format */ char *bspIdent; /* 4-letter bsp file prefix */ int bspVersion; /* bsp version to use */ qboolean lumpSwap; /* cod-style len/ofs order */ @@ -1000,7 +1021,7 @@ typedef enum } surfaceType_t; -char *surfaceTypes[ NUM_SURFACE_TYPES ] +Q_EXTERN char *surfaceTypes[ NUM_SURFACE_TYPES ] #ifndef MAIN_C ; #else @@ -1812,6 +1833,7 @@ void RadFreeLights(); /* light_ydnar.c */ void ColorToBytes( const float *color, byte *colorBytes, float scale ); +void ColorToBytesNonZero( const float *color, byte *colorBytes, float scale ); void SmoothNormals( void ); void MapRawLightmap( int num ); @@ -1852,7 +1874,7 @@ int ImportLightmapsMain( int argc, char **argv ); void SetupSurfaceLightmaps( void ); void StitchSurfaceLightmaps( void ); -void StoreSurfaceLightmaps( qboolean fastAllocate ); +void StoreSurfaceLightmaps( qboolean fastAllocate, qboolean storeForReal ); /* exportents.c */ @@ -1908,6 +1930,11 @@ void LoadBSPFile( const char *filename ); void WriteBSPFile( const char *filename ); void PrintBSPFileSizes( void ); +void WriteTexFile( char *name ); +void LoadSurfaceFlags( char *filename ); +int GetSurfaceParm( const char *tex ); +void RestoreSurfaceFlags( char *filename ); + epair_t *ParseEPair( void ); void ParseEntities( void ); void UnparseEntities( void ); @@ -1941,14 +1968,6 @@ void WriteRBSPFile( const char *filename ); ------------------------------------------------------------------------------- */ -#ifdef MAIN_C - #define Q_EXTERN - #define Q_ASSIGN( a ) = a -#else - #define Q_EXTERN extern - #define Q_ASSIGN( a ) -#endif - /* game support */ Q_EXTERN game_t games[] #ifndef MAIN_C @@ -1958,21 +1977,31 @@ Q_EXTERN game_t games[] { #include "game_quake3.h" , - #include "game_quakelive.h" /* most be after game_quake3.h as they share defines! */ + #include "game_nexuiz.h" /* must be after game_quake3.h as they share defines! */ , - #include "game_nexuiz.h" /* most be after game_quake3.h as they share defines! */ + #include "game_oa.h" /* must be after game_quake3.h as they share defines! */ , - #include "game_xonotic.h" /* most be after game_quake3.h as they share defines! */ + #include "game_q3rally.h" /* must be after game_quake3.h as they share defines! */ + , + #include "game_quakelive.h" /* must be after game_quake3.h as they share defines! */ + , + #include "game_reaction.h" /* must be after game_quake3.h */ , - #include "game_tremulous.h" /*LinuxManMikeC: must be after game_quake3.h, depends on #define's set in it */ + #include "game_smokinguns.h" /* must be after game_quake3.h */ , - #include "game_unvanquished.h" + #include "game_tremulous.h" /* LinuxManMikeC: must be after game_quake3.h, depends on #define's set in it */ + , + #include "game_unvanquished.h" /* must be after game_tremulous.h as they share defines! */ + , + #include "game_wop.h" /* must be after game_quake3.h as they share defines! */ + , + #include "game_xonotic.h" /* must be after game_quake3.h as they share defines! */ , #include "game_tenebrae.h" , #include "game_wolf.h" , - #include "game_wolfet.h" /* most be after game_wolf.h as they share defines! */ + #include "game_wolfet.h" /* must be after game_wolf.h as they share defines! */ , #include "game_etut.h" , @@ -1980,17 +2009,19 @@ Q_EXTERN game_t games[] , #include "game_sof2.h" , - #include "game_jk2.h" /* most be after game_sof2.h as they share defines! */ + #include "game_jk2.h" /* must be after game_sof2.h as they share defines! */ , - #include "game_ja.h" /* most be after game_jk2.h as they share defines! */ + #include "game_ja.h" /* must be after game_jk2.h as they share defines! */ , - #include "game_qfusion.h" /* qfusion game */ + #include "game_qfusion.h" /* qfusion game */ , - #include "game_reaction.h" /* must be after game_quake3.h */ + #include "game_warsow.h" /* must be after game_qfusion.h as they share defines! */ + , + #include "game_warfork.h" /* must be after game_qfusion.h as they share defines! */ , - #include "game_darkplaces.h" /* vortex: darkplaces q1 engine */ + #include "game_darkplaces.h" /* darkplaces q1 engine */ , - #include "game_dq.h" /* vortex: deluxe quake game ( darkplaces q1 engine) */ + #include "game_dq.h" /* deluxe quake game ( darkplaces q1 engine) */ , #include "game_prophecy.h" /* vortex: prophecy game ( darkplaces q1 engine) */ , @@ -2023,7 +2054,6 @@ Q_EXTERN float jitters[ MAX_JITTERS ]; /* commandline arguments */ -Q_EXTERN qboolean verbose; Q_EXTERN qboolean verboseEntities Q_ASSIGN( qfalse ); Q_EXTERN qboolean force Q_ASSIGN( qfalse ); Q_EXTERN qboolean infoMode Q_ASSIGN( qfalse ); @@ -2042,8 +2072,8 @@ Q_EXTERN qboolean nofog Q_ASSIGN( qfalse ); Q_EXTERN qboolean noHint Q_ASSIGN( qfalse ); /* ydnar */ Q_EXTERN qboolean renameModelShaders Q_ASSIGN( qfalse ); /* ydnar */ Q_EXTERN qboolean skyFixHack Q_ASSIGN( qfalse ); /* ydnar */ -Q_EXTERN qboolean bspAlternateSplitWeights Q_ASSIGN( qfalse ); /* 27 */ -Q_EXTERN qboolean deepBSP Q_ASSIGN( qfalse ); /* div0 */ +Q_EXTERN qboolean bspAlternateSplitWeights Q_ASSIGN( qfalse ); /* 27 */ +Q_EXTERN qboolean deepBSP Q_ASSIGN( qfalse ); /* div0 */ Q_EXTERN qboolean maxAreaFaceSurface Q_ASSIGN( qfalse ); /* divVerent */ Q_EXTERN int patchSubdivisions Q_ASSIGN( 8 ); /* ydnar: -patchmeta subdivisions */ @@ -2527,7 +2557,7 @@ Q_EXTERN int allocatedBSPBrushSides Q_ASSIGN( 0 ); Q_EXTERN bspBrushSide_t* bspBrushSides Q_ASSIGN( NULL ); Q_EXTERN int numBSPLightBytes Q_ASSIGN( 0 ); -Q_EXTERN byte *bspLightBytes Q_ASSIGN( NULL ); +Q_EXTERN byte *bspLightBytes Q_ASSIGN( NULL ); //% Q_EXTERN int numBSPGridPoints Q_ASSIGN( 0 ); //% Q_EXTERN byte *bspGridPoints Q_ASSIGN( NULL ); @@ -2539,11 +2569,11 @@ Q_EXTERN int numBSPVisBytes Q_ASSIGN( 0 ); Q_EXTERN byte bspVisBytes[ MAX_MAP_VISIBILITY ]; Q_EXTERN int numBSPDrawVerts Q_ASSIGN( 0 ); -Q_EXTERN bspDrawVert_t *bspDrawVerts Q_ASSIGN( NULL ); +Q_EXTERN bspDrawVert_t *bspDrawVerts Q_ASSIGN( NULL ); Q_EXTERN int numBSPDrawIndexes Q_ASSIGN( 0 ); Q_EXTERN int allocatedBSPDrawIndexes Q_ASSIGN( 0 ); -Q_EXTERN int *bspDrawIndexes Q_ASSIGN( NULL ); +Q_EXTERN int *bspDrawIndexes Q_ASSIGN( NULL ); Q_EXTERN int numBSPDrawSurfaces Q_ASSIGN( 0 ); Q_EXTERN bspDrawSurface_t *bspDrawSurfaces Q_ASSIGN( NULL ); @@ -2554,28 +2584,46 @@ Q_EXTERN bspFog_t bspFogs[ MAX_MAP_FOGS ]; Q_EXTERN int numBSPAds Q_ASSIGN( 0 ); Q_EXTERN bspAdvertisement_t bspAds[ MAX_MAP_ADVERTISEMENTS ]; -#define AUTOEXPAND_BY_REALLOC( ptr, reqitem, allocated, def ) \ +// Used for tex file support, Smokin'Guns globals +Q_EXTERN qboolean compile_map; + +#define _AUTOEXPAND_BY_REALLOC( ptr, reqitem, allocated, def, fillWithZeros ) \ do \ { \ + int prevAllocated = allocated; \ if ( reqitem >= allocated ) \ { \ if ( allocated == 0 ) { \ - allocated = def; } \ + allocated = def; \ + } \ while ( reqitem >= allocated && allocated ) \ + { \ allocated *= 2; \ + } \ if ( !allocated || allocated > 2147483647 / (int)sizeof( *ptr ) ) \ { \ Error( #ptr " over 2 GB" ); \ } \ ptr = realloc( ptr, sizeof( *ptr ) * allocated ); \ if ( !ptr ) { \ - Error( #ptr " out of memory" ); } \ + Error( #ptr " out of memory" ); \ + } \ + if ( fillWithZeros ) \ + { \ + memset( ptr + ( sizeof( *ptr ) * prevAllocated ), 0 , sizeof( *ptr ) * ( allocated - prevAllocated ) ); \ + } \ } \ } \ while ( 0 ) +#define AUTOEXPAND_BY_REALLOC( ptr, reqitem, allocated, def ) _AUTOEXPAND_BY_REALLOC( ptr, reqitem, allocated, def, qfalse ) + +#define AUTOEXPAND_BY_REALLOC0( ptr, reqitem, allocated, def ) _AUTOEXPAND_BY_REALLOC( ptr, reqitem, allocated, def, qtrue ) + #define AUTOEXPAND_BY_REALLOC_BSP( suffix, def ) AUTOEXPAND_BY_REALLOC( bsp##suffix, numBSP##suffix, allocatedBSP##suffix, def ) +#define AUTOEXPAND_BY_REALLOC0_BSP( suffix, def ) AUTOEXPAND_BY_REALLOC0( bsp##suffix, numBSP##suffix, allocatedBSP##suffix, def ) + #define Image_LinearFloatFromsRGBFloat( c ) ( ( ( c ) <= 0.04045f ) ? ( c ) * ( 1.0f / 12.92f ) : (float)pow( ( ( c ) + 0.055f ) * ( 1.0f / 1.055f ), 2.4f ) ) #define Image_sRGBFloatFromLinearFloat( c ) ( ( ( c ) < 0.0031308f ) ? ( c ) * 12.92f : 1.055f * (float)pow( ( c ), 1.0f / 2.4f ) - 0.055f )