]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/q3map2.h
q3map2/light: rename -fastallocate to -fastlightmapsearch
[xonotic/netradiant.git] / tools / quake3 / q3map2 / q3map2.h
index d3a9432fe11cb0608f99026994c08424dd3a089b..4220725d85417a6edbfe4fc813d0ec234e4265b4 100644 (file)
@@ -32,7 +32,7 @@
 #ifndef Q3MAP2_H
 #define Q3MAP2_H
 
-
+#include "globaldefs.h"
 
 /* version */
 #ifndef Q3MAP_VERSION
@@ -41,8 +41,6 @@
 #define Q3MAP_MOTD      "Your map saw the pretty lights from q3map2's BFG"
 
 
-
-
 /* -------------------------------------------------------------------------------
 
    dependencies
    ------------------------------------------------------------------------------- */
 
 /* platform-specific */
-#if defined( __linux__ ) || defined( __APPLE__ )
-       #define Q_UNIX
-#endif
-
-#ifdef Q_UNIX
+#if GDEF_OS_POSIX
        #include <unistd.h>
        #include <pwd.h>
        #include <limits.h>
 #endif
 
-#ifdef WIN32
+#if GDEF_OS_WINDOWS
        #include <windows.h>
 #endif
 
@@ -72,6 +66,9 @@
 #include "mathlib.h"
 #include "md5lib.h"
 #include "ddslib.h"
+#ifdef BUILD_CRUNCH
+#include "crn_rgba.h"
+#endif // BUILD_CRUNCH
 
 #include "picomodel.h"
 
 
    ------------------------------------------------------------------------------- */
 
-#define MAC_STATIC_HACK         0
-#if defined( __APPLE__ ) && MAC_STATIC_HACK
-       #define MAC_STATIC          static
+#if GDEF_OS_WINDOWS
+       #define Q_stricmp           stricmp
+       #define Q_strncasecmp       strnicmp
 #else
-       #define MAC_STATIC
-#endif
-
-#if 1
-       #ifdef WIN32
-               #define Q_stricmp           stricmp
-               #define Q_strncasecmp       strnicmp
-       #else
-               #define Q_stricmp           strcasecmp
-               #define Q_strncasecmp       strncasecmp
-       #endif
+       #define Q_stricmp           strcasecmp
+       #define Q_strncasecmp       strncasecmp
 #endif
 
 /* macro version */
 #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
 #define HINT_PRIORITY           1000        /* ydnar: force hint splits first and antiportal/areaportal splits last */
 #define ANTIPORTAL_PRIORITY     -1000
 #define AREAPORTAL_PRIORITY     -1000
-#define DETAIL_PRIORITY     -3000
+#define DETAIL_PRIORITY         -3000
 
 #define PSIDE_FRONT             1
 #define PSIDE_BACK              2
 #define RAD_LUXEL_SIZE          3
 #define SUPER_LUXEL_SIZE        4
 #define SUPER_FLAG_SIZE         4
-#define FLAG_FORCE_SUBSAMPLING 1
+#define FLAG_FORCE_SUBSAMPLING  1
 #define FLAG_ALREADY_SUBSAMPLED 2
 #define SUPER_ORIGIN_SIZE       3
 #define SUPER_NORMAL_SIZE       4
@@ -557,6 +560,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  */
@@ -826,7 +830,7 @@ typedef struct face_s
        struct face_s       *next;
        int planenum;
        int priority;
-       //qboolean                      checked;
+       //qboolean checked;
        int compileFlags;
        winding_t           *w;
 }
@@ -958,8 +962,9 @@ typedef struct parseMesh_s
        shaderInfo_t        *shaderInfo;
        shaderInfo_t        *celShader;             /* :) */
 
+       /* jal : entity based _lightmapsamplesize */
+       int lightmapSampleSize;
        /* ydnar: gs mods */
-       int lightmapSampleSize;                     /* jal : entity based _lightmapsamplesize */
        float lightmapScale;
        vec3_t eMins, eMaxs;
        indexMap_t          *im;
@@ -1467,7 +1472,7 @@ typedef struct rawLightmap_s
        float                   *bspLuxels[ MAX_LIGHTMAPS ];
        float                   *radLuxels[ MAX_LIGHTMAPS ];
        float                   *superLuxels[ MAX_LIGHTMAPS ];
-       unsigned char               *superFlags;
+       unsigned char           *superFlags;
        float                   *superOrigins;
        float                   *superNormals;
        int                     *superClusters;
@@ -1523,15 +1528,19 @@ void                        HelpMain(const char* arg);
 game_t                      *GetGame( char *arg );
 void                        InitPaths( int *argc, char **argv );
 
+
 /* fixaas.c */
 int                         FixAASMain( int argc, char **argv );
 
+
 /* bsp.c */
 int                         BSPMain( int argc, char **argv );
 
+
 /* bsp_analyze.c */
 int                         AnalyzeBSPMain( int argc, char **argv );
 
+
 /* bsp_info.c */
 int                         BSPInfoMain( int count, char **fileNames );
 
@@ -1544,6 +1553,7 @@ int                         MiniMapBSPMain( int argc, char **argv );
 /* convert_bsp.c */
 int                         ConvertBSPMain( int argc, char **argv );
 
+
 /* convert_map.c */
 int                         ConvertBSPToMap( char *bspName );
 int                         ConvertBSPToMap_BP( char *bspName );
@@ -1848,7 +1858,7 @@ int                         ImportLightmapsMain( int argc, char **argv );
 
 void                        SetupSurfaceLightmaps( void );
 void                        StitchSurfaceLightmaps( void );
-void                        StoreSurfaceLightmaps( qboolean fastAllocate );
+void                        StoreSurfaceLightmaps( qboolean fastLightmapSearch );
 
 
 /* exportents.c */
@@ -1904,6 +1914,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 );
@@ -1954,21 +1969,21 @@ 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_quakelive.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_nexuiz.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_xonotic.h" /* must be after game_quake3.h as they share defines! */
        ,
                                                                #include "game_tremulous.h" /*LinuxManMikeC: must be after game_quake3.h, depends on #define's set in it */
        ,
-                                                               #include "game_unvanquished.h"
+                                                               #include "game_unvanquished.h" /* must be after game_tremulous.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"
        ,
@@ -1976,13 +1991,15 @@ 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_reaction.h" /* must be after game_quake3.h */
+       ,
+                                                               #include "game_smokinguns.h" /* must be after game_quake3.h */
        ,
                                                                #include "game_darkplaces.h"    /* vortex: darkplaces q1 engine */
        ,
@@ -2038,8 +2055,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 */
@@ -2523,7 +2540,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 );
@@ -2535,11 +2552,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 );
@@ -2550,6 +2567,9 @@ Q_EXTERN bspFog_t bspFogs[ MAX_MAP_FOGS ];
 Q_EXTERN int numBSPAds Q_ASSIGN( 0 );
 Q_EXTERN bspAdvertisement_t bspAds[ MAX_MAP_ADVERTISEMENTS ];
 
+// Used for tex file support, Smokin'Guns globals
+Q_EXTERN qboolean compile_map;
+
 #define AUTOEXPAND_BY_REALLOC( ptr, reqitem, allocated, def ) \
        do \
        { \