]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/q3map2.h
_farplanedist now ignores C_SKY leafs
[xonotic/netradiant.git] / tools / quake3 / q3map2 / q3map2.h
index 689fe64297256b64e4c80ff0d1c40647d3ea5a7a..427c0279b95b4b0d808c2f19ab8d74d06ac9af31 100644 (file)
@@ -122,6 +122,12 @@ constants
 
 ------------------------------------------------------------------------------- */
 
+/* temporary hacks and tests (please keep off in SVN to prevent anyone's legacy map from screwing up) */
+/* 2011-01-10 TTimo says we should turn these on in SVN, so turning on now */
+#define Q3MAP2_EXPERIMENTAL_HIGH_PRECISION_MATH_FIXES  1
+#define Q3MAP2_EXPERIMENTAL_SNAP_NORMAL_FIX            1
+#define Q3MAP2_EXPERIMENTAL_SNAP_PLANE_FIX             1
+
 /* general */
 #define MAX_QPATH                              64
 
@@ -185,7 +191,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
 
@@ -215,7 +221,7 @@ 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             1024
@@ -268,6 +274,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
@@ -279,6 +288,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)))
@@ -307,9 +317,6 @@ abstracted bsp file
 #define MAX_LIGHTMAP_SHADERS   256
 
 /* ok to increase these at the expense of more memory */
-#define        MAX_MAP_ENTITIES                0x1000          //%     0x800   /* ydnar */
-#define        MAX_MAP_ENTSTRING               0x80000         //%     0x40000 /* 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_LEAFS                   0x20000
@@ -518,7 +525,7 @@ general types
 ------------------------------------------------------------------------------- */
 
 /* ydnar: for smaller structs */
-typedef char   qb_t;
+typedef unsigned char  qb_t;
 
 
 /* ydnar: for q3map_tcMod */
@@ -535,6 +542,13 @@ typedef struct surfaceParm_s
 }
 surfaceParm_t;
 
+typedef enum
+{
+       MINIMAP_MODE_GRAY,
+       MINIMAP_MODE_BLACK,
+       MINIMAP_MODE_WHITE
+}
+miniMapMode_t;
 
 typedef struct game_s
 {
@@ -551,16 +565,25 @@ typedef struct game_s
        qboolean                        wolfLight;                                              /* when true, lights work like wolf q3map  */
        int                                     lightmapSize;                                   /* bsp lightmap width/height */
        float                           lightmapGamma;                                  /* default lightmap gamma */
+       qboolean                        lightmapsRGB;                                   /* default lightmap sRGB mode */
+       qboolean                        texturesRGB;                                    /* default texture sRGB mode */
        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                        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 */
@@ -627,6 +650,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
@@ -735,7 +766,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 */
@@ -876,7 +908,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;
 
@@ -927,6 +961,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;
@@ -1024,6 +1059,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;
@@ -1067,6 +1105,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 ];
@@ -1091,7 +1130,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;
 
@@ -1198,6 +1236,7 @@ typedef struct
 {
        int                                     num;
        qboolean                        hint;                   /* true if this portal was created from a hint splitter */
+       qboolean                        sky;                    /* true if this portal belongs to a sky leaf */
        qboolean                        removed;
        visPlane_t                      plane;                  /* normal pointing into neighbor */
        int                                     leaf;                   /* neighbor */
@@ -1284,6 +1323,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 */
@@ -1330,12 +1370,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;
@@ -1427,6 +1469,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;
@@ -1487,11 +1530,15 @@ int                                                     BSPMain( int argc, char **argv );
 
 /* convert_map.c */
 int                                                    ConvertBSPToMap( char *bspName );
+int                                                    ConvertBSPToMap_BP( char *bspName );
 
 
 /* convert_ase.c */
 int                                                    ConvertBSPToASE( char *bspName );
 
+/* convert_obj.c */
+int                                                    ConvertBSPToOBJ( char *bspName );
+
 
 /* brush.c */
 sideRef_t                                      *AllocSideRef( side_t *side, sideRef_t *next );
@@ -1538,11 +1585,11 @@ void                                            MakeNormalVectors( vec3_t forward, vec3_t right, vec3_t up );
 
 
 /* map.c */
-void                                           LoadMapFile( char *filename, qboolean onlyLights );
+void                                           LoadMapFile( char *filename, qboolean onlyLights, qboolean noCollapseGroups );
 int                                                    FindFloatPlane( vec3_t normal, vec_t dist, int numPoints, vec3_t *points );
 int                                                    PlaneTypeForNormal( vec3_t normal );
 void                                           AddBrushBevels( void );
-brush_t                                                *FinishBrush( void );
+brush_t                                                *FinishBrush(qboolean noCollapseGroups);
 
 
 /* portals.c */
@@ -1577,7 +1624,7 @@ void                                              SetLightStyles( void );
 int                                                    EmitShader( const char *shader, int *contentFlags, int *surfaceFlags );
 
 void                                           BeginBSPFile( void );
-void                                           EndBSPFile( void );
+void                                           EndBSPFile( qboolean do_write );
 void                                           EmitBrushes( brush_t *brushes, int *firstBrush, int *numBrushes );
 void                                           EmitFogs( void );
 
@@ -1619,10 +1666,10 @@ 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 );
+void                                           PicoLoadFileFunc( const char *name, byte **buffer, int *bufSize );
+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 );
 
 
@@ -1630,6 +1677,7 @@ void                                              AddTriangleModels( entity_t *e );
 mapDrawSurface_t                       *AllocDrawSurface( surfaceType_t type );
 void                                           FinishSurface( mapDrawSurface_t *ds );
 void                                           StripFaceSurface( mapDrawSurface_t *ds );
+void                                           MaxAreaFaceSurface( mapDrawSurface_t *ds );
 qboolean                                       CalcSurfaceTextureRange( mapDrawSurface_t *ds );
 qboolean                                       CalcLightmapAxis( vec3_t normal, vec3_t axis );
 void                                           ClassifySurfaces( int numSurfs, mapDrawSurface_t *ds );
@@ -1642,7 +1690,7 @@ void                                              ClearSurface( mapDrawSurface_t *ds );
 void                                           AddEntitySurfaceModels( entity_t *e );
 mapDrawSurface_t                       *DrawSurfaceForSide( entity_t *e, brush_t *b, side_t *s, winding_t *w );
 mapDrawSurface_t                       *DrawSurfaceForMesh( entity_t *e, parseMesh_t *p, mesh_t *mesh );
-mapDrawSurface_t                       *DrawSurfaceForFlare( int entNum, vec3_t origin, vec3_t normal, vec3_t color, char *flareShader, int lightStyle );
+mapDrawSurface_t                       *DrawSurfaceForFlare( int entNum, vec3_t origin, vec3_t normal, vec3_t color, const char *flareShader, int lightStyle );
 mapDrawSurface_t                       *DrawSurfaceForShader( char *shader );
 void                                           ClipSidesIntoTree( entity_t *e, tree_t *tree );
 void                                           MakeDebugPortalSurfs( tree_t *tree );
@@ -1696,6 +1744,8 @@ void                                              LoadSurfaceExtraFile( const char *path );
 void                                           ProcessDecals( void );
 void                                           MakeEntityDecals( entity_t *e );
 
+/* map.c */
+void                                           TextureAxisFromPlane( plane_t *pln, vec3_t xv, vec3_t yv );
 
 /* brush_primit.c */
 void                                           ComputeAxisBase( vec3_t normal, vec3_t texX, vec3_t texY);
@@ -1884,6 +1934,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"
@@ -1904,13 +1956,15 @@ Q_EXTERN game_t                         games[]
                                                                ,
                                                                #include "game_qfusion.h"       /* qfusion game */
                                                                ,
+                                                               #include "game_reaction.h" /* must be after game_quake3.h */
+                                                               ,
                                                                #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 */
+                                                               #include "game__null.h" /* null game (must be last item) */
                                                        };
 #endif
 Q_EXTERN game_t                                *game Q_ASSIGN( &games[ 0 ] );
@@ -1960,6 +2014,7 @@ 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 */
 
@@ -1978,8 +2033,35 @@ 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 qboolean           lightmapFill Q_ASSIGN(qfalse);
+Q_EXTERN int                           metaAdequateScore Q_ASSIGN( -1 );
+Q_EXTERN int                           metaGoodScore Q_ASSIGN( -1 );
+Q_EXTERN float                         metaMaxBBoxDistance Q_ASSIGN( -1 );
+
+#if Q3MAP2_EXPERIMENTAL_SNAP_NORMAL_FIX
+// Increasing the normalEpsilon to compensate for new logic in SnapNormal(), where
+// this epsilon is now used to compare against 0 components instead of the 1 or -1
+// components.  Unfortunately, normalEpsilon is also used in PlaneEqual().  So changing
+// this will affect anything that calls PlaneEqual() as well (which are, at the time
+// of this writing, FindFloatPlane() and AddBrushBevels()).
+Q_EXTERN double                                normalEpsilon Q_ASSIGN(0.00005);
+#else
 Q_EXTERN double                                normalEpsilon Q_ASSIGN( 0.00001 );
+#endif
+
+#if Q3MAP2_EXPERIMENTAL_HIGH_PRECISION_MATH_FIXES
+// NOTE: This distanceEpsilon is too small if parts of the map are at maximum world
+// extents (in the range of plus or minus 2^16).  The smallest epsilon at values
+// close to 2^16 is about 0.007, which is greater than distanceEpsilon.  Therefore,
+// maps should be constrained to about 2^15, otherwise slightly undesirable effects
+// may result.  The 0.01 distanceEpsilon used previously is just too coarse in my
+// opinion.  The real fix for this problem is to have 64 bit distances and then make
+// this epsilon even smaller, or to constrain world coordinates to plus minus 2^15
+// (or even 2^14).
+Q_EXTERN double                                distanceEpsilon Q_ASSIGN(0.005);
+#else
 Q_EXTERN double                                distanceEpsilon Q_ASSIGN( 0.01 );
+#endif
 
 
 /* bsp */
@@ -2029,6 +2111,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;
@@ -2082,9 +2165,6 @@ 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;
@@ -2124,6 +2204,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 );
@@ -2158,15 +2239,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 );
@@ -2182,6 +2267,7 @@ 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 float                                         floodlightDirectionScale Q_ASSIGN( 1.0f );
 
 Q_EXTERN qboolean                      dump Q_ASSIGN( qfalse );
 Q_EXTERN qboolean                      debug Q_ASSIGN( qfalse );
@@ -2196,16 +2282,25 @@ Q_EXTERN float                          maxMapDistance Q_ASSIGN( 0 );
 
 /* for run time tweaking of light sources */
 Q_EXTERN float                         pointScale Q_ASSIGN( 7500.0f );
+Q_EXTERN float                         spotScale 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 );
+Q_EXTERN float                         lightmapsRGB Q_ASSIGN( qfalse );
+Q_EXTERN float                         texturesRGB Q_ASSIGN( qfalse );
 Q_EXTERN float                         lightmapExposure Q_ASSIGN( 1.0f );
 Q_EXTERN float                         lightmapCompensate Q_ASSIGN( 1.0f );
 
@@ -2217,6 +2312,7 @@ Q_EXTERN float                            linearScale Q_ASSIGN( 1.0f / 8000.0f );
 
 // for .ase conversion
 Q_EXTERN qboolean                      shadersAsBitmap Q_ASSIGN( qfalse );
+Q_EXTERN qboolean                      lightmapsAsTexcoord Q_ASSIGN( qfalse );
 
 Q_EXTERN light_t                       *lights;
 Q_EXTERN int                           numPointLights;
@@ -2356,7 +2452,8 @@ abstracted bsp globals
 
 Q_EXTERN int                           numEntities Q_ASSIGN( 0 );
 Q_EXTERN int                           numBSPEntities Q_ASSIGN( 0 );
-Q_EXTERN entity_t                      entities[ MAX_MAP_ENTITIES ];
+Q_EXTERN int                           allocatedEntities Q_ASSIGN( 0 );
+Q_EXTERN entity_t*                     entities Q_ASSIGN(NULL);
 
 Q_EXTERN int                           numBSPModels Q_ASSIGN( 0 );
 Q_EXTERN int                           allocatedBSPModels Q_ASSIGN( 0 );
@@ -2367,7 +2464,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 ];
@@ -2432,7 +2530,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"); \
                        } \
@@ -2445,5 +2543,8 @@ Q_EXTERN bspAdvertisement_t       bspAds[ MAX_MAP_ADVERTISEMENTS ];
 
 #define AUTOEXPAND_BY_REALLOC_BSP(suffix, def) AUTOEXPAND_BY_REALLOC(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)
+
 /* end marker */
 #endif