]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/q3map2.h
add a missing VectorClear
[xonotic/netradiant.git] / tools / quake3 / q3map2 / q3map2.h
index 0a6f3f3d5ce21cb355b417dcad923b4db64b36cf..b0e5f4725019955b37e7cc080ffa869ae1a38c5e 100644 (file)
@@ -83,7 +83,7 @@ dependencies
 #include "vfs.h"
 #include "png.h"
 #include "md4.h"
-
+#include "radiant_jpeglib.h"
 #include <stdlib.h>
 
 
@@ -185,7 +185,7 @@ constants
 /* bsp */
 #define        MAX_PATCH_SIZE                  32
 #define        MAX_BRUSH_SIDES                 1024
-#define MAX_BUILD_SIDES                        300
+#define MAX_BUILD_SIDES                        1024
 
 #define        MAX_EXPANDED_AXIS               128
 
@@ -196,6 +196,7 @@ constants
 #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        PSIDE_FRONT                             1
 #define        PSIDE_BACK                              2
@@ -214,10 +215,10 @@ constants
 
 #define        PORTALFILE                              "PRT1"
 
-#define        MAX_PORTALS                             32768
+#define        MAX_PORTALS                             0x20000 /* same as MAX_MAP_PORTALS */
 #define MAX_SEPERATORS                 MAX_POINTS_ON_WINDING
 #define        MAX_POINTS_ON_FIXED_WINDING     24      /* ydnar: increased this from 12 at the expense of more memory */
-#define        MAX_PORTALS_ON_LEAF             128
+#define        MAX_PORTALS_ON_LEAF             1024
 
 
 /* light */
@@ -267,6 +268,9 @@ constants
 #define BSP_LUXEL_SIZE                 3
 #define RAD_LUXEL_SIZE                 3
 #define SUPER_LUXEL_SIZE               4
+#define SUPER_FLAG_SIZE                        4
+#define FLAG_FORCE_SUBSAMPLING 1
+#define FLAG_ALREADY_SUBSAMPLED 2
 #define SUPER_ORIGIN_SIZE              3
 #define SUPER_NORMAL_SIZE              4
 #define SUPER_DELUXEL_SIZE             3
@@ -278,6 +282,7 @@ constants
 #define BSP_LUXEL( s, x, y )   (lm->bspLuxels[ s ] + ((((y) * lm->w) + (x)) * BSP_LUXEL_SIZE))
 #define RAD_LUXEL( s, x, y )   (lm->radLuxels[ s ] + ((((y) * lm->w) + (x)) * RAD_LUXEL_SIZE))
 #define SUPER_LUXEL( s, x, y ) (lm->superLuxels[ s ] + ((((y) * lm->sw) + (x)) * SUPER_LUXEL_SIZE))
+#define SUPER_FLAG( x, y )     (lm->superFlags + ((((y) * lm->sw) + (x)) * SUPER_FLAG_SIZE))
 #define SUPER_DELUXEL( x, y )  (lm->superDeluxels + ((((y) * lm->sw) + (x)) * SUPER_DELUXEL_SIZE))
 #define BSP_DELUXEL( x, y )            (lm->bspDeluxels + ((((y) * lm->w) + (x)) * BSP_DELUXEL_SIZE))
 #define SUPER_CLUSTER( x, y )  (lm->superClusters + (((y) * lm->sw) + (x)))
@@ -315,7 +320,8 @@ abstracted bsp file
 #define        MAX_MAP_PORTALS                 0x20000
 #define        MAX_MAP_LIGHTING                0x800000
 #define        MAX_MAP_LIGHTGRID               0x100000        //%     0x800000 /* ydnar: set to points, not bytes */
-#define        MAX_MAP_VISIBILITY              0x200000
+#define MAX_MAP_VISCLUSTERS     0x4000 // <= MAX_MAP_LEAFS
+#define        MAX_MAP_VISIBILITY              (VIS_HEADER_SIZE + MAX_MAP_VISCLUSTERS * (((MAX_MAP_VISCLUSTERS + 63) & ~63) >> 3))
 
 #define        MAX_MAP_DRAW_SURFS              0x20000
 #define        MAX_MAP_DRAW_INDEXES    0x80000
@@ -533,6 +539,13 @@ typedef struct surfaceParm_s
 }
 surfaceParm_t;
 
+typedef enum
+{
+       MINIMAP_MODE_GRAY,
+       MINIMAP_MODE_BLACK,
+       MINIMAP_MODE_WHITE
+}
+miniMapMode_t;
 
 typedef struct game_s
 {
@@ -553,12 +566,19 @@ typedef struct game_s
        float                           lightmapCompensate;                             /* default lightmap compensate value */
        float                           gridScale;                                              /* vortex: default lightgrid scale (affects both directional and ambient spectres) */
        float                           gridAmbientScale;                               /* vortex: default lightgrid ambient spectre scale */
+       qboolean                        lightAngleHL;                                   /* jal: use half-lambert curve for light angle attenuation */
        qboolean                        noStyles;                                               /* use lightstyles hack or not */
        qboolean                        keepLights;                                             /* keep light entities on bsp */
        int                                     patchSubdivisions;                              /* default patch subdivisions tolerance */
        qboolean                        patchShadows;                                   /* patch casting enabled */
        qboolean                        deluxeMap;                                              /* compile deluxemaps */
        int                                     deluxeMode;                                             /* deluxemap mode (0 - modelspace, 1 - tangentspace with renormalization, 2 - tangentspace without renormalization) */
+       int                 miniMapSize;                    /* minimap size */
+       float               miniMapSharpen;                 /* minimap sharpening coefficient */
+       float               miniMapBorder;                  /* minimap border amount */
+       qboolean            miniMapKeepAspect;              /* minimap keep aspect ratio by letterboxing */
+       miniMapMode_t       miniMapMode;                    /* minimap mode */
+       char                *miniMapNameFormat;             /* minimap name format */
        char                            *bspIdent;                                              /* 4-letter bsp file prefix */
        int                                     bspVersion;                                             /* bsp version to use */
        qboolean                        lumpSwap;                                               /* cod-style len/ofs order */
@@ -625,6 +645,14 @@ typedef struct remap_s
 }
 remap_t;
 
+typedef struct skinfile_s
+{
+       struct skinfile_s       *next;
+       char                            name[ 1024 ];
+       char                            to[ MAX_QPATH ];
+}
+skinfile_t;
+
 
 /* wingdi.h hack, it's the same: 0 */
 #undef CM_NONE
@@ -733,7 +761,8 @@ typedef struct shaderInfo_s
        qb_t                            noFog;                                                  /* ydnar: supress fogging */
        qb_t                            clipModel;                                              /* ydnar: solid model hack */
        qb_t                            noVertexLight;                                  /* ydnar: leave vertex color alone */
-       
+       qb_t                            noDirty;                                                /* jal: do not apply the dirty pass to this surface */
+
        byte                            styleMarker;                                    /* ydnar: light styles hack */
        
        float                           vertexScale;                                    /* vertex light scale */
@@ -794,7 +823,7 @@ typedef struct face_s
        struct face_s           *next;
        int                                     planenum;
        int                                     priority;
-       qboolean                        checked;
+       //qboolean                      checked;
        int                                     compileFlags;
        winding_t                       *w;
 }
@@ -874,7 +903,9 @@ typedef struct brush_s
        shaderInfo_t            *celShader;                     /* :) */
        
        /* ydnar: gs mods */
+       int                                     lightmapSampleSize; /* jal : entity based _lightmapsamplesize */
        float                           lightmapScale;
+       float                           shadeAngleDegrees; /* jal : entity based _shadeangle */
        vec3_t                          eMins, eMaxs;
        indexMap_t                      *im;
 
@@ -925,6 +956,7 @@ typedef struct parseMesh_s
        shaderInfo_t            *celShader;                             /* :) */
        
        /* ydnar: gs mods */
+       int                                     lightmapSampleSize;             /* jal : entity based _lightmapsamplesize */
        float                           lightmapScale;
        vec3_t                          eMins, eMaxs;
        indexMap_t                      *im;
@@ -1022,6 +1054,9 @@ typedef struct mapDrawSurface_s
        
        /* ydnar: per-surface (per-entity, actually) lightmap sample size scaling */
        float                           lightmapScale;
+
+       /* jal: per-surface (per-entity, actually) shadeangle */
+       float                           shadeAngleDegrees;
        
        /* ydnar: surface classification */
        vec3_t                          mins, maxs;
@@ -1065,6 +1100,7 @@ typedef struct metaTriangle_s
        shaderInfo_t            *si;
        side_t                          *side;
        int                                     entityNum, surfaceNum, planeNum, fogNum, sampleSize, castShadows, recvShadows;
+       float                           shadeAngleDegrees;
        vec4_t                          plane;
        vec3_t                          lightmapAxis;
        int                                     indexes[ 3 ];
@@ -1089,7 +1125,6 @@ typedef struct
        int                                     firstBrush, numBrushes;         /* only valid during BSP compile */
        epair_t                         *epairs;
        vec3_t                          originbrush_origin;
-       qboolean                        forceNormalSmoothing; /* vortex: true if entity has _smoothnormals/_sn/_smooth key */
 }
 entity_t;
 
@@ -1123,6 +1158,8 @@ typedef struct node_s
        entity_t                        *occupant;              /* for leak file testing */
 
        struct portal_s         *portals;               /* also on nodes during construction */
+
+       qboolean            has_structural_children;
 }
 node_t;
 
@@ -1280,6 +1317,7 @@ typedef struct light_s
        float                           radiusByDist;   /* for spotlights */
        float                           fade;                   /* ydnar: from wolf, for linear lights */
        float                           angleScale;             /* ydnar: stolen from vlight for K */
+       float                           extraDist;              /* "extra dimension" distance of the light, to kill hot spots */
 
        float                           add;                    /* ydnar: used for area lights */
        float                           envelope;               /* ydnar: units until falloff < tolerance */
@@ -1326,12 +1364,14 @@ typedef struct
        /* input and output */
        vec3_t                          color;                  /* starts out at full color, may be reduced if transparent surfaces are crossed */
        vec3_t                          colorNoShadow;  /* result color with no shadow casting */
+       vec3_t                          directionContribution; /* result contribution to the deluxe map */
 
        /* output */
        vec3_t                          hit;
        int                                     compileFlags;   /* for determining surface compile flags traced through */
        qboolean                        passSolid;
        qboolean                        opaque;
+       vec_t                   forceSubsampling; /* needs subsampling (alphashadow), value = max color contribution possible from it */
        
        /* working data */
        int                                     numTestNodes;
@@ -1423,6 +1463,7 @@ typedef struct rawLightmap_s
        float                                   *bspLuxels[ MAX_LIGHTMAPS ];
        float                                   *radLuxels[ MAX_LIGHTMAPS ];
        float                                   *superLuxels[ MAX_LIGHTMAPS ];
+       unsigned char                           *superFlags;
        float                                   *superOrigins;
        float                                   *superNormals;
        int                                             *superClusters;
@@ -1616,9 +1657,9 @@ tree_t                                            *FaceBSP( face_t *list );
 /* model.c */
 void                                           PicoPrintFunc( int level, const char *str );
 void                                           PicoLoadFileFunc( char *name, byte **buffer, int *bufSize );
-picoModel_t                                    *FindModel( char *name, int frame );
-picoModel_t                                    *LoadModel( char *name, int frame );
-void                                           InsertModel( char *name, int frame, m4x4_t transform, remap_t *remap, shaderInfo_t *celShader, int eNum, int castShadows, int recvShadows, int spawnFlags, float lightmapScale );
+picoModel_t                                    *FindModel( const char *name, int frame );
+picoModel_t                                    *LoadModel( const char *name, int frame );
+void                                           InsertModel( const char *name, int skin, int frame, m4x4_t transform, remap_t *remap, shaderInfo_t *celShader, int eNum, int castShadows, int recvShadows, int spawnFlags, float lightmapScale, int lightmapSampleSize, float shadeAngle );
 void                                           AddTriangleModels( entity_t *e );
 
 
@@ -1880,6 +1921,8 @@ Q_EXTERN game_t                           games[]
                                                                ,
                                                                #include "game_nexuiz.h"/* most 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_tremulous.h" /*LinuxManMikeC: must be after game_quake3.h, depends on #define's set in it */
                                                                ,
                                                                #include "game_tenebrae.h"
@@ -1955,6 +1998,8 @@ 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                      maxAreaFaceSurface Q_ASSIGN( qfalse );                  /* divVerent */
 
 Q_EXTERN int                           patchSubdivisions Q_ASSIGN( 8 );                /* ydnar: -patchmeta subdivisions */
 
@@ -2024,6 +2069,7 @@ Q_EXTERN int                              numMapDrawSurfs;
 Q_EXTERN int                           numSurfacesByType[ NUM_SURFACE_TYPES ];
 Q_EXTERN int                           numClearedSurfaces;
 Q_EXTERN int                           numStripSurfaces;
+Q_EXTERN int                           numMaxAreaSurfaces;
 Q_EXTERN int                           numFanSurfaces;
 Q_EXTERN int                           numMergedSurfaces;
 Q_EXTERN int                           numMergedVerts;
@@ -2070,15 +2116,13 @@ Q_EXTERN qboolean                       fastvis;
 Q_EXTERN qboolean                      noPassageVis;
 Q_EXTERN qboolean                      passageVisOnly;
 Q_EXTERN qboolean                      mergevis;
+Q_EXTERN qboolean                      mergevisportals;
 Q_EXTERN qboolean                      nosort;
 Q_EXTERN qboolean                      saveprt;
 Q_EXTERN qboolean                      hint;   /* ydnar */
 Q_EXTERN char                          inbase[ MAX_QPATH ];
 Q_EXTERN char                          globalCelShader[ MAX_QPATH ];
 
-/* other bits */
-Q_EXTERN int                           totalvis;
-
 Q_EXTERN float                         farPlaneDist;   /* rr2do2, rf, mre, ydnar all contributed to this one... */
 
 Q_EXTERN int                           numportals;
@@ -2118,6 +2162,7 @@ light global variables
 
 /* commandline arguments */
 Q_EXTERN qboolean                      wolfLight Q_ASSIGN( qfalse );
+Q_EXTERN float                         extraDist Q_ASSIGN( 0.0f );
 Q_EXTERN qboolean                      loMem Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      noStyles Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      keepLights Q_ASSIGN( qfalse );
@@ -2152,15 +2197,19 @@ Q_EXTERN qboolean                       shade Q_ASSIGN( qfalse );
 Q_EXTERN float                         shadeAngleDegrees Q_ASSIGN( 0.0f );
 Q_EXTERN int                           superSample Q_ASSIGN( 0 );
 Q_EXTERN int                           lightSamples Q_ASSIGN( 1 );
+Q_EXTERN qboolean                      lightRandomSamples Q_ASSIGN( qfalse );
+Q_EXTERN int                           lightSamplesSearchBoxSize Q_ASSIGN( 1 );
 Q_EXTERN qboolean                      filter Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      dark Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      sunOnly Q_ASSIGN( qfalse );
 Q_EXTERN int                           approximateTolerance Q_ASSIGN( 0 );
 Q_EXTERN qboolean                      noCollapse Q_ASSIGN( qfalse );
+Q_EXTERN int                           lightmapSearchBlockSize Q_ASSIGN( 0 );
 Q_EXTERN qboolean                      exportLightmaps Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      externalLightmaps Q_ASSIGN( qfalse );
 Q_EXTERN int                           lmCustomSize Q_ASSIGN( LIGHTMAP_WIDTH );
 Q_EXTERN char *                                lmCustomDir Q_ASSIGN( NULL );
+Q_EXTERN int                           lmLimitSize Q_ASSIGN( 0 );
 
 Q_EXTERN qboolean                      dirty Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      dirtDebug Q_ASSIGN( qfalse );
@@ -2193,10 +2242,16 @@ Q_EXTERN float                          pointScale Q_ASSIGN( 7500.0f );
 Q_EXTERN float                         areaScale Q_ASSIGN( 0.25f );
 Q_EXTERN float                         skyScale Q_ASSIGN( 1.0f );
 Q_EXTERN float                         bounceScale Q_ASSIGN( 0.25f );
+
+/* jal: alternative angle attenuation curve */
+Q_EXTERN qboolean                      lightAngleHL Q_ASSIGN( qfalse );
  
 /* vortex: gridscale and gridambientscale */
 Q_EXTERN float                         gridScale Q_ASSIGN( 1.0f );
 Q_EXTERN float                         gridAmbientScale Q_ASSIGN( 1.0f );
+Q_EXTERN float                         gridDirectionality Q_ASSIGN( 1.0f );
+Q_EXTERN float                         gridAmbientDirectionality Q_ASSIGN( 0.0f );
+Q_EXTERN qboolean                      inGrid Q_ASSIGN(0);
 
 /* ydnar: lightmap gamma/compensation */
 Q_EXTERN float                         lightmapGamma Q_ASSIGN( 1.0f );
@@ -2361,7 +2416,8 @@ Q_EXTERN int                              allocatedBSPShaders Q_ASSIGN( 0 );
 Q_EXTERN bspShader_t*          bspShaders Q_ASSIGN(0);
 
 Q_EXTERN int                           bspEntDataSize Q_ASSIGN( 0 );
-Q_EXTERN char                          bspEntData[ MAX_MAP_ENTSTRING ];
+Q_EXTERN int                           allocatedBSPEntData Q_ASSIGN( 0 );
+Q_EXTERN char                          *bspEntData Q_ASSIGN(0);
 
 Q_EXTERN int                           numBSPLeafs Q_ASSIGN( 0 );
 Q_EXTERN bspLeaf_t                     bspLeafs[ MAX_MAP_LEAFS ];
@@ -2426,7 +2482,7 @@ Q_EXTERN bspAdvertisement_t       bspAds[ MAX_MAP_ADVERTISEMENTS ];
                                allocated = def; \
                        while(reqitem >= allocated && allocated) \
                                allocated *= 2; \
-                       if(!allocated || allocated > 2147483647 / sizeof(*ptr)) \
+                       if(!allocated || allocated > 2147483647 / (int)sizeof(*ptr)) \
                        { \
                                Error(#ptr " over 2 GB"); \
                        } \