]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/q3map2.h
Merge branch 'master' of git://de.git.xonotic.org/xonotic/netradiant
[xonotic/netradiant.git] / tools / quake3 / q3map2 / q3map2.h
index 0294be7d7243fc8bfc578a7431557a7be735c65a..64494462e356e9dbfc3f175b2447730f2a52ee76 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
 
@@ -311,8 +317,8 @@ 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_ENTITIES                0x8000          //%     0x800   /* ydnar */
+#define        MAX_MAP_ENTSTRING               0x400000        //%     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) */
@@ -522,7 +528,7 @@ general types
 ------------------------------------------------------------------------------- */
 
 /* ydnar: for smaller structs */
-typedef char   qb_t;
+typedef unsigned char  qb_t;
 
 
 /* ydnar: for q3map_tcMod */
@@ -1524,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 );
@@ -1575,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 */
@@ -1614,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 );
 
@@ -1656,7 +1666,7 @@ tree_t                                            *FaceBSP( face_t *list );
 
 /* model.c */
 void                                           PicoPrintFunc( int level, const char *str );
-void                                           PicoLoadFileFunc( char *name, byte **buffer, int *bufSize );
+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 );
@@ -1667,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 );
@@ -1679,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 );
@@ -1733,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);
@@ -1943,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 ] );
@@ -2018,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 */
@@ -2197,6 +2239,7 @@ 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 );
@@ -2224,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 );
@@ -2265,6 +2309,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;