]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/q3map2.h
new modes for minimap: -black = black on transparent, -white = white on transparent...
[xonotic/netradiant.git] / tools / quake3 / q3map2 / q3map2.h
index 4645477f5c16a66678f37d0447538651e22c20a1..e47bf798962b7eda75b196c5aff654981af735e4 100644 (file)
@@ -35,11 +35,14 @@ several games based on the Quake III Arena engine, in the form of "Q3Map2."
 
 
 /* version */
-#define Q3MAP_VERSION  "2.5.17-div0"
+#ifndef Q3MAP_VERSION
+#error no Q3MAP_VERSION defined
+#endif
 #define Q3MAP_MOTD             "Your map saw the pretty lights from q3map2's BFG"
 
 
 
+
 /* -------------------------------------------------------------------------------
 
 dependencies
@@ -79,8 +82,8 @@ dependencies
 #include "inout.h"
 #include "vfs.h"
 #include "png.h"
-#include "mhash.h"
-
+#include "md4.h"
+#include "radiant_jpeglib.h"
 #include <stdlib.h>
 
 
@@ -193,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,7 +218,7 @@ constants
 #define        MAX_PORTALS                             32768
 #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 */
@@ -234,6 +238,7 @@ constants
 #define LIGHT_FAST_TEMP                        512
 #define LIGHT_FAST_ACTUAL              (LIGHT_FAST | LIGHT_FAST_TEMP)
 #define LIGHT_NEGATIVE                 1024
+#define LIGHT_UNNORMALIZED             2048    /* vortex: do not normalize _color */
 
 #define LIGHT_SUN_DEFAULT              (LIGHT_ATTEN_ANGLE | LIGHT_GRID | LIGHT_SURFACES)
 #define LIGHT_AREA_DEFAULT             (LIGHT_ATTEN_ANGLE | LIGHT_ATTEN_DISTANCE | LIGHT_GRID | LIGHT_SURFACES)        /* q3a and wolf are the same */
@@ -248,6 +253,7 @@ constants
 #define GRID_EPSILON                   0.0f
 
 #define DEFAULT_LIGHTMAP_SAMPLE_SIZE   16
+#define DEFAULT_LIGHTMAP_MIN_SAMPLE_SIZE       0
 #define DEFAULT_LIGHTMAP_SAMPLE_OFFSET 1.0f
 #define DEFAULT_SUBDIVIDE_THRESHOLD            1.0f
 
@@ -266,7 +272,7 @@ constants
 #define SUPER_NORMAL_SIZE              4
 #define SUPER_DELUXEL_SIZE             3
 #define BSP_DELUXEL_SIZE               3
-#define SUPER_FLOODLIGHT_SIZE  1
+#define SUPER_FLOODLIGHT_SIZE  4
 
 #define VERTEX_LUXEL( s, v )   (vertexLuxels[ s ] + ((v) * VERTEX_LUXEL_SIZE))
 #define RAD_VERTEX_LUXEL( s, v )(radVertexLuxels[ s ] + ((v) * VERTEX_LUXEL_SIZE))
@@ -301,27 +307,19 @@ abstracted bsp file
 #define MAX_LIGHTMAP_SHADERS   256
 
 /* ok to increase these at the expense of more memory */
-#define        MAX_MAP_MODELS                  0x400
-#define        MAX_MAP_BRUSHES                 0x8000
 #define        MAX_MAP_ENTITIES                0x1000          //%     0x800   /* ydnar */
 #define        MAX_MAP_ENTSTRING               0x80000         //%     0x40000 /* ydnar */
-#define        MAX_MAP_SHADERS                 0x800           //%     0x400   /* ydnar */
 
 #define        MAX_MAP_AREAS                   0x100           /* MAX_MAP_AREA_BYTES in q_shared must match! */
 #define        MAX_MAP_FOGS                    30                      //& 0x100       /* RBSP (32 - world fog - goggles) */
-#define        MAX_MAP_PLANES                  0x100000        //%     0x20000 /* ydnar for md */
-#define        MAX_MAP_NODES                   0x20000
-#define        MAX_MAP_BRUSHSIDES              0x100000        //%     0x20000 /* ydnar */
 #define        MAX_MAP_LEAFS                   0x20000
-#define        MAX_MAP_LEAFFACES               0x100000        //%     0x20000 /* ydnar */
-#define        MAX_MAP_LEAFBRUSHES             0x40000
 #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_VERTS              0x80000
 #define        MAX_MAP_DRAW_INDEXES    0x80000
 
 #define MAX_MAP_ADVERTISEMENTS 30
@@ -537,6 +535,13 @@ typedef struct surfaceParm_s
 }
 surfaceParm_t;
 
+typedef enum
+{
+       MINIMAP_MODE_GRAY,
+       MINIMAP_MODE_BLACK,
+       MINIMAP_MODE_WHITE
+}
+miniMapMode_t;
 
 typedef struct game_s
 {
@@ -555,6 +560,20 @@ typedef struct game_s
        float                           lightmapGamma;                                  /* default lightmap gamma */
        float                           lightmapExposure;                               /* default lightmap exposure */
        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                        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 */
@@ -635,8 +654,12 @@ typedef enum
        CM_ALPHA_SCALE,
        CM_COLOR_DOT_PRODUCT,
        CM_ALPHA_DOT_PRODUCT,
+       CM_COLOR_DOT_PRODUCT_SCALE,
+       CM_ALPHA_DOT_PRODUCT_SCALE,
        CM_COLOR_DOT_PRODUCT_2,
-       CM_ALPHA_DOT_PRODUCT_2
+       CM_ALPHA_DOT_PRODUCT_2,
+       CM_COLOR_DOT_PRODUCT_2_SCALE,
+       CM_ALPHA_DOT_PRODUCT_2_SCALE
 }
 colorModType_t;
 
@@ -673,6 +696,7 @@ typedef struct shaderInfo_s
        char                            *backShader;                                    /* for surfaces that generate different front and back passes */
        char                            *cloneShader;                                   /* ydnar: for cloning of a surface */
        char                            *remapShader;                                   /* ydnar: remap a shader in final stage */
+       char                            *deprecateShader;                               /* vortex: shader is deprecated and replaced by this on use */
 
        surfaceModel_t          *surfaceModel;                                  /* ydnar: for distribution of models */
        foliage_t                       *foliage;                                               /* ydnar/splash damage: wolf et foliage */
@@ -748,7 +772,13 @@ typedef struct shaderInfo_s
        
        vec3_t                          color;                                                  /* normalized color */
        vec3_t                          averageColor;
-       byte                            lightStyle;
+       byte                            lightStyle;                                     
+
+       /* vortex: per-surface floodlight */
+       float                           floodlightDirectionScale;
+       vec3_t                          floodlightRGB; 
+       float                           floodlightIntensity;
+       float                           floodlightDistance;
        
        qb_t                            lmMergable;                                             /* ydnar */
        int                                     lmCustomWidth, lmCustomHeight;  /* ydnar */
@@ -779,7 +809,7 @@ typedef struct face_s
        struct face_s           *next;
        int                                     planenum;
        int                                     priority;
-       qboolean                        checked;
+       //qboolean                      checked;
        int                                     compileFlags;
        winding_t                       *w;
 }
@@ -791,7 +821,8 @@ typedef struct plane_s
        vec3_t                          normal;
        vec_t                           dist;
        int                                     type;
-       struct plane_s          *hash_chain;
+       int                 counter;
+       int                                     hash_chain;
 }
 plane_t;
 
@@ -1024,7 +1055,7 @@ typedef struct mapDrawSurface_s
        int                                     maxIterations;
        int                                     patchWidth, patchHeight;
        vec3_t                          bounds[ 2 ];
-       
+
        /* ydnar/sd: for foliage */
        int                                     numFoliageInstances;
        
@@ -1072,6 +1103,8 @@ typedef struct
        int                                     mapEntityNum, firstDrawSurf;
        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;
 
@@ -1105,6 +1138,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;
 
@@ -1307,7 +1342,8 @@ 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 */
+
        /* output */
        vec3_t                          hit;
        int                                     compileFlags;   /* for determining surface compile flags traced through */
@@ -1378,6 +1414,13 @@ typedef struct rawLightmap_s
        int                                             numLightClusters, *lightClusters;
        
        int                                             sampleSize, actualSampleSize, axisNum;
+
+       /* vortex: per-surface floodlight */
+       float                                   floodlightDirectionScale;
+       vec3_t                                  floodlightRGB; 
+       float                                   floodlightIntensity;
+       float                                   floodlightDistance;
+
        int                                             entityNum;
        int                                             recvShadows;
        vec3_t                                  mins, maxs, axis, origin, *vecs;
@@ -1420,7 +1463,7 @@ rawGridPoint_t;
 
 typedef struct surfaceInfo_s
 {
-       bspModel_t                      *model;
+       int                                     modelindex;
        shaderInfo_t            *si;
        rawLightmap_t           *lm;
        int                                     parentSurfaceNum, childSurfaceNum;
@@ -1433,8 +1476,6 @@ typedef struct surfaceInfo_s
 }
 surfaceInfo_t;
 
-
-
 /* -------------------------------------------------------------------------------
 
 prototypes
@@ -1568,6 +1609,7 @@ void                                              FreeTreePortals_r( node_t *node );
 void                                           ParsePatch( qboolean onlyLights );
 mesh_t                                         *SubdivideMesh( mesh_t in, float maxError, float minLength );
 void                                           PatchMapDrawSurfs( entity_t *e );
+void                                           TriangulatePatchSurface( entity_t *e , mapDrawSurface_t *ds );
 
 
 /* tjunction.c */
@@ -1622,6 +1664,8 @@ void                                              SubdivideFaceSurfaces( entity_t *e, tree_t *tree );
 void                                           AddEntitySurfaceModels( entity_t *e );
 int                                                    AddSurfaceModels( mapDrawSurface_t *ds );
 void                                           FilterDrawsurfsIntoTree( entity_t *e, tree_t *tree );
+void                                           EmitPatchSurface( entity_t *e, mapDrawSurface_t *ds );
+void                                           EmitTriangleSurface( mapDrawSurface_t *ds );
 
 
 /* surface_fur.c */
@@ -1639,6 +1683,7 @@ void                                              MakeEntityMetaTriangles( entity_t *e );
 void                                           FixMetaTJunctions( void );
 void                                           SmoothMetaTriangles( void );
 void                                           MergeMetaTriangles( void );
+void                                           EmitMetaStats(); // vortex: print meta statistics even in no-verbose mode
 
 
 /* surface_extra.c */
@@ -1652,6 +1697,7 @@ int                                                       GetSurfaceExtraEntityNum( int num );
 int                                                    GetSurfaceExtraCastShadows( int num );
 int                                                    GetSurfaceExtraRecvShadows( int num );
 int                                                    GetSurfaceExtraSampleSize( int num );
+int                                                    GetSurfaceExtraMinSampleSize( int num );
 float                                          GetSurfaceExtraLongestCurve( int num );
 void                                           GetSurfaceExtraLightmapAxis( int num, vec3_t lightmapAxis );
 
@@ -1717,7 +1763,9 @@ float                                             DirtForSample( trace_t *trace );
 void                                           DirtyRawLightmap( int num );
 
 void                                           SetupFloodLight();
-float                                          FloodLightForSample( trace_t *trace );
+void                                           FloodlightRawLightmaps();
+void                                           FloodlightIlluminateLightmap( rawLightmap_t *lm );
+float                                          FloodLightForSample( trace_t *trace , float floodLightDistance, qboolean floodLightLowQuality);
 void                                           FloodLightRawLightmap( int num );
 
 void                                           IlluminateRawLightmap( int num );
@@ -1788,6 +1836,7 @@ void                                              SwapBlock( int *block, int size );
 int                                                    GetLumpElements( bspHeader_t *header, int lump, int size );
 void                                           *GetLump( bspHeader_t *header, int lump );
 int                                                    CopyLump( bspHeader_t *header, int lump, void *dest, int size );
+int                                                    CopyLump_Allocate( bspHeader_t *header, int lump, void **dest, int size, int *allocationVariable );
 void                                           AddLump( FILE *file, bspHeader_t *header, int lumpNum, const void *data, int length );
 
 void                                           LoadBSPFile( const char *filename );
@@ -1799,12 +1848,15 @@ void                                            ParseEntities( void );
 void                                           UnparseEntities( void );
 void                                           PrintEntity( const entity_t *ent );
 void                                           SetKeyValue( entity_t *ent, const char *key, const char *value );
+qboolean                                       KeyExists( const entity_t *ent, const char *key ); /* VorteX: check if key exists */
 const char                                     *ValueForKey( const entity_t *ent, const char *key );
 int                                                    IntForKey( const entity_t *ent, const char *key );
 vec_t                                          FloatForKey( const entity_t *ent, const char *key );
 void                                           GetVectorForKey( const entity_t *ent, const char *key, vec3_t vec );
 entity_t                                       *FindTargetEntity( const char *target );
 void                                           GetEntityShadowFlags( const entity_t *ent, const entity_t *ent2, int *castShadows, int *recvShadows );
+void InjectCommandLine(char **argv, int beginArgs, int endArgs);
+               
 
 
 /* bspfile_ibsp.c */
@@ -1865,6 +1917,12 @@ Q_EXTERN game_t                          games[]
                                                                ,
                                                                #include "game_qfusion.h"       /* qfusion game */
                                                                ,
+                                                               #include "game_darkplaces.h"    /* vortex: darkplaces q1 engine */
+                                                               ,
+                                                               #include "game_dq.h"    /* vortex: deluxe quake game ( darkplaces q1 engine) */
+                                                               ,
+                                                               #include "game_prophecy.h"      /* vortex: prophecy game ( darkplaces q1 engine) */
+                                                               ,
                                                                { NULL }        /* null game */
                                                        };
 #endif
@@ -1913,6 +1971,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 int                           patchSubdivisions Q_ASSIGN( 8 );                /* ydnar: -patchmeta subdivisions */
 
@@ -1929,7 +1989,8 @@ Q_EXTERN qboolean                 emitFlares Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      debugSurfaces Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      debugInset Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      debugPortals Q_ASSIGN( qfalse );
-
+Q_EXTERN qboolean           lightmapTriangleCheck Q_ASSIGN(qfalse);
+Q_EXTERN qboolean           lightmapExtraVisClusterNudge Q_ASSIGN(qfalse);
 Q_EXTERN double                                normalEpsilon Q_ASSIGN( 0.00001 );
 Q_EXTERN double                                distanceEpsilon Q_ASSIGN( 0.01 );
 
@@ -1949,13 +2010,16 @@ Q_EXTERN char                           source[ 1024 ];
 Q_EXTERN char                          outbase[ 32 ];
 
 Q_EXTERN int                           sampleSize;                                             /* lightmap sample size in units */
+Q_EXTERN int                           minSampleSize;                  /* minimum sample size to use at all */
+Q_EXTERN int                           sampleScale;                                    /* vortex: lightmap sample scale (ie quality)*/
 
 Q_EXTERN int                           mapEntityNum Q_ASSIGN( 0 );
 
 Q_EXTERN int                           entitySourceBrushes;
 
-Q_EXTERN plane_t                       mapplanes[ MAX_MAP_PLANES ];    /* mapplanes[ num ^ 1 ] will always be the mirror or mapplanes[ num ] */
-Q_EXTERN int                           nummapplanes;                                   /* nummapplanes will always be even */
+Q_EXTERN plane_t                       *mapplanes Q_ASSIGN(NULL);      /* mapplanes[ num ^ 1 ] will always be the mirror or mapplanes[ num ] */
+Q_EXTERN int                           nummapplanes Q_ASSIGN(0);               /* nummapplanes will always be even */
+Q_EXTERN int                           allocatedmapplanes Q_ASSIGN(0);
 Q_EXTERN int                           numMapPatches;
 Q_EXTERN vec3_t                                mapMins, mapMaxs;
 
@@ -2024,13 +2088,12 @@ 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 ];
-
-/* other bits */
-Q_EXTERN int                           totalvis;
+Q_EXTERN char                          globalCelShader[ MAX_QPATH ];
 
 Q_EXTERN float                         farPlaneDist;   /* rr2do2, rf, mre, ydnar all contributed to this one... */
 
@@ -2073,8 +2136,10 @@ light global variables
 Q_EXTERN qboolean                      wolfLight Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      loMem Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      noStyles Q_ASSIGN( qfalse );
+Q_EXTERN qboolean                      keepLights Q_ASSIGN( qfalse );
 
 Q_EXTERN int                           sampleSize Q_ASSIGN( DEFAULT_LIGHTMAP_SAMPLE_SIZE );
+Q_EXTERN int                           minSampleSize Q_ASSIGN( DEFAULT_LIGHTMAP_MIN_SAMPLE_SIZE );
 Q_EXTERN qboolean                      noVertexLighting Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      noGridLighting Q_ASSIGN( qfalse );
 
@@ -2085,6 +2150,7 @@ Q_EXTERN qboolean                 cpmaHack Q_ASSIGN( qfalse );
 
 Q_EXTERN qboolean                      deluxemap Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      debugDeluxemap Q_ASSIGN( qfalse );
+Q_EXTERN int                           deluxemode Q_ASSIGN( 0 );       /* deluxemap format (0 - modelspace, 1 - tangentspace with renormalization, 2 - tangentspace without renormalization) */
 
 Q_EXTERN qboolean                      fast Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      faster Q_ASSIGN( qfalse );
@@ -2110,6 +2176,7 @@ Q_EXTERN qboolean                 noCollapse Q_ASSIGN( qfalse );
 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 qboolean                      dirty Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      dirtDebug Q_ASSIGN( qfalse );
@@ -2118,12 +2185,13 @@ Q_EXTERN float                          dirtDepth Q_ASSIGN( 128.0f );
 Q_EXTERN float                         dirtScale Q_ASSIGN( 1.0f );
 Q_EXTERN float                         dirtGain Q_ASSIGN( 1.0f );
 
-Q_EXTERN qboolean                      debugnormals Q_ASSIGN( qfalse );
-Q_EXTERN qboolean                      floodlighty Q_ASSIGN( qfalse );
-Q_EXTERN qboolean                      floodlight_lowquality Q_ASSIGN( qfalse );
-Q_EXTERN vec3_t                                floodlightRGB;
-Q_EXTERN float                         floodlightIntensity Q_ASSIGN( 512 );
-Q_EXTERN float                         floodlightDistance Q_ASSIGN( 1024 );
+/* 27: floodlighting */
+Q_EXTERN qboolean                                      debugnormals Q_ASSIGN( qfalse );
+Q_EXTERN qboolean                                      floodlighty Q_ASSIGN( qfalse );
+Q_EXTERN qboolean                                      floodlight_lowquality Q_ASSIGN( qfalse );
+Q_EXTERN vec3_t                                                floodlightRGB;
+Q_EXTERN float                                         floodlightIntensity Q_ASSIGN( 512.0f );
+Q_EXTERN float                                         floodlightDistance Q_ASSIGN( 1024.0f );
 
 Q_EXTERN qboolean                      dump Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      debug Q_ASSIGN( qfalse );
@@ -2141,6 +2209,10 @@ 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 );
+/* vortex: gridscale and gridambientscale */
+Q_EXTERN float                         gridScale Q_ASSIGN( 1.0f );
+Q_EXTERN float                         gridAmbientScale Q_ASSIGN( 1.0f );
 
 /* ydnar: lightmap gamma/compensation */
 Q_EXTERN float                         lightmapGamma Q_ASSIGN( 1.0f );
@@ -2153,6 +2225,9 @@ Q_EXTERN qboolean                 exactPointToPolygon Q_ASSIGN( qtrue );
 Q_EXTERN float                         formFactorValueScale Q_ASSIGN( 3.0f );
 Q_EXTERN float                         linearScale Q_ASSIGN( 1.0f / 8000.0f );
 
+// for .ase conversion
+Q_EXTERN qboolean                      shadersAsBitmap Q_ASSIGN( qfalse );
+
 Q_EXTERN light_t                       *lights;
 Q_EXTERN int                           numPointLights;
 Q_EXTERN int                           numSpotLights;
@@ -2249,6 +2324,9 @@ Q_EXTERN int                              numBSPLightmaps Q_ASSIGN( 0 );
 Q_EXTERN int                           numExtLightmaps Q_ASSIGN( 0 );
 Q_EXTERN outLightmap_t         *outLightmaps Q_ASSIGN( NULL );
 
+/* vortex: per surface floodlight statictics */
+Q_EXTERN int                           numSurfacesFloodlighten Q_ASSIGN( 0 );
+
 /* grid points */
 Q_EXTERN int                           numRawGridPoints Q_ASSIGN( 0 );
 Q_EXTERN rawGridPoint_t                *rawGridPoints Q_ASSIGN( NULL );
@@ -2291,10 +2369,12 @@ Q_EXTERN int                            numBSPEntities Q_ASSIGN( 0 );
 Q_EXTERN entity_t                      entities[ MAX_MAP_ENTITIES ];
 
 Q_EXTERN int                           numBSPModels Q_ASSIGN( 0 );
-Q_EXTERN bspModel_t                    bspModels[ MAX_MAP_MODELS ];
+Q_EXTERN int                           allocatedBSPModels Q_ASSIGN( 0 );
+Q_EXTERN bspModel_t*           bspModels Q_ASSIGN(NULL);
 
 Q_EXTERN int                           numBSPShaders Q_ASSIGN( 0 );
-Q_EXTERN bspShader_t           bspShaders[ MAX_MAP_MODELS ];
+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 ];
@@ -2303,22 +2383,28 @@ Q_EXTERN int                            numBSPLeafs Q_ASSIGN( 0 );
 Q_EXTERN bspLeaf_t                     bspLeafs[ MAX_MAP_LEAFS ];
 
 Q_EXTERN int                           numBSPPlanes Q_ASSIGN( 0 );
-Q_EXTERN bspPlane_t                    bspPlanes[ MAX_MAP_PLANES ];
+Q_EXTERN int                           allocatedBSPPlanes Q_ASSIGN(0);
+Q_EXTERN bspPlane_t                    *bspPlanes;
 
 Q_EXTERN int                           numBSPNodes Q_ASSIGN( 0 );
-Q_EXTERN bspNode_t                     bspNodes[ MAX_MAP_NODES ];
+Q_EXTERN int                           allocatedBSPNodes Q_ASSIGN( 0 );
+Q_EXTERN bspNode_t*                    bspNodes Q_ASSIGN(NULL);
 
 Q_EXTERN int                           numBSPLeafSurfaces Q_ASSIGN( 0 );
-Q_EXTERN int                           bspLeafSurfaces[ MAX_MAP_LEAFFACES ];
+Q_EXTERN int                           allocatedBSPLeafSurfaces Q_ASSIGN( 0 );
+Q_EXTERN int*                          bspLeafSurfaces Q_ASSIGN(NULL);
 
 Q_EXTERN int                           numBSPLeafBrushes Q_ASSIGN( 0 );
-Q_EXTERN int                           bspLeafBrushes[ MAX_MAP_LEAFBRUSHES ];
+Q_EXTERN int                           allocatedBSPLeafBrushes Q_ASSIGN( 0 );
+Q_EXTERN int*                          bspLeafBrushes Q_ASSIGN(NULL);
 
 Q_EXTERN int                           numBSPBrushes Q_ASSIGN( 0 );
-Q_EXTERN bspBrush_t                    bspBrushes[ MAX_MAP_BRUSHES ];
+Q_EXTERN int                           allocatedBSPBrushes Q_ASSIGN( 0 );
+Q_EXTERN bspBrush_t*           bspBrushes Q_ASSIGN(NULL);
 
 Q_EXTERN int                           numBSPBrushSides Q_ASSIGN( 0 );
-Q_EXTERN bspBrushSide_t                bspBrushSides[ MAX_MAP_BRUSHSIDES ];
+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 );
@@ -2347,6 +2433,27 @@ 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) \
+       do \
+       { \
+               if(reqitem >= allocated) \
+               { \
+                       if(allocated == 0) \
+                               allocated = def; \
+                       while(reqitem >= allocated && allocated) \
+                               allocated *= 2; \
+                       if(!allocated || allocated > 2147483647 / sizeof(*ptr)) \
+                       { \
+                               Error(#ptr " over 2 GB"); \
+                       } \
+                       ptr = realloc(ptr, sizeof(*ptr) * allocated); \
+                       if(!ptr) \
+                               Error(#ptr " out of memory"); \
+               } \
+       } \
+       while(0)
+
+#define AUTOEXPAND_BY_REALLOC_BSP(suffix, def) AUTOEXPAND_BY_REALLOC(bsp##suffix, numBSP##suffix, allocatedBSP##suffix, def)
 
 /* end marker */
 #endif