diff --git a/docs/Complete_list_of_command_line_parameters.htm b/docs/Complete_list_of_command_line_parameters.htm index 7f49e24c..7d553df8 100644 --- a/docs/Complete_list_of_command_line_parameters.htm +++ b/docs/Complete_list_of_command_line_parameters.htm @@ -114,6 +114,7 @@ td.formatted_questions ol { margin-top: 0px; margin-bottom: 0px; }
  • -fs_homepath path: Sets the given path as the game home directory name (fs_home + fs_homebase)
  • -fs_pakpath path: Specify a package directory (can be used more than once to look in multiple paths)
  • -game gamename: Load settings for the given game (default: quake3), -help -game lists available games
  • +
  • -maxmapdrawsurfs N: Sets max amount of mapDrawSurfs, used during .map compilation (-bsp, -convert), default = 131072
  • -subdivisions F: multiplier for patch subdivisions quality
  • -threads N: number of threads to use
  • -v: Verbose mode
  • diff --git a/tools/quake3/q3map2/bsp.cpp b/tools/quake3/q3map2/bsp.cpp index e3b6166b..1299d004 100644 --- a/tools/quake3/q3map2/bsp.cpp +++ b/tools/quake3/q3map2/bsp.cpp @@ -634,7 +634,7 @@ int BSPMain( Args& args ){ Sys_Printf( "--- BSP ---\n" ); doingBSP = true; - mapDrawSurfs = safe_calloc( sizeof( mapDrawSurface_t ) * MAX_MAP_DRAW_SURFS ); + mapDrawSurfs = safe_calloc( sizeof( mapDrawSurface_t ) * max_map_draw_surfs ); numMapDrawSurfs = 0; strClear( tempSource ); diff --git a/tools/quake3/q3map2/convert_bsp.cpp b/tools/quake3/q3map2/convert_bsp.cpp index 82b7911d..79585d7d 100644 --- a/tools/quake3/q3map2/convert_bsp.cpp +++ b/tools/quake3/q3map2/convert_bsp.cpp @@ -952,7 +952,7 @@ static void PseudoCompileBSP( bool need_tree ){ facelist_t faces; tree_t tree{}; - mapDrawSurfs = safe_calloc( sizeof( mapDrawSurface_t ) * MAX_MAP_DRAW_SURFS ); + mapDrawSurfs = safe_calloc( sizeof( mapDrawSurface_t ) * max_map_draw_surfs ); numMapDrawSurfs = 0; BeginBSPFile(); diff --git a/tools/quake3/q3map2/help.cpp b/tools/quake3/q3map2/help.cpp index 89ebd9e3..100a5d6b 100644 --- a/tools/quake3/q3map2/help.cpp +++ b/tools/quake3/q3map2/help.cpp @@ -457,6 +457,7 @@ static void HelpCommon() {"-fs_homepath ", "Sets the given path as the game home directory name (fs_home + fs_homebase)"}, {"-fs_pakpath ", "Specify a package directory (can be used more than once to look in multiple paths)"}, {"-game ", "Load settings for the given game (default: quake3), -help -game lists available games"}, + {"-maxmapdrawsurfs ", "Sets max amount of mapDrawSurfs, used during .map compilation (-bsp, -convert), default = 131072"}, {"-subdivisions ", "multiplier for patch subdivisions quality"}, {"-threads ", "number of threads to use"}, {"-v", "Verbose mode"} diff --git a/tools/quake3/q3map2/main.cpp b/tools/quake3/q3map2/main.cpp index e1274711..b6eabcf4 100644 --- a/tools/quake3/q3map2/main.cpp +++ b/tools/quake3/q3map2/main.cpp @@ -113,6 +113,13 @@ int main( int argc, char **argv ){ while ( args.takeArg( "-threads" ) ) { numthreads = atoi( args.takeNext() ); } + + /* max_map_draw_surfs */ + while ( args.takeArg( "-maxmapdrawsurfs" ) ) { + max_map_draw_surfs = abs( atoi( args.takeNext() ) ); + Sys_Printf( "max_map_draw_surfs = %d, mapDrawSurfs size = %.2f MBytes \n", + max_map_draw_surfs, sizeof( mapDrawSurface_t ) * max_map_draw_surfs / ( 1024.f * 1024.f ) ); + } } /* init model library */ diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 092e97fc..c782f8c5 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -203,8 +203,6 @@ inline bool style_is_valid( int style ){ return LS_NORMAL <= style && style < LS #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 - /* the editor uses these predefined yaw angles to orient entities up or down */ #define ANGLE_UP -1 #define ANGLE_DOWN -2 @@ -1827,6 +1825,7 @@ inline EBrushType g_brushType = EBrushType::Undefined; /* surface stuff */ inline mapDrawSurface_t *mapDrawSurfs; inline int numMapDrawSurfs; +inline int max_map_draw_surfs = 0x20000; inline int numSurfacesByType[ static_cast( ESurfaceType::Shader ) + 1 ]; inline int numStripSurfaces; diff --git a/tools/quake3/q3map2/surface.cpp b/tools/quake3/q3map2/surface.cpp index 791c104a..57d7dc4e 100644 --- a/tools/quake3/q3map2/surface.cpp +++ b/tools/quake3/q3map2/surface.cpp @@ -40,8 +40,8 @@ mapDrawSurface_t *AllocDrawSurface( ESurfaceType type ){ /* bounds check */ - if ( numMapDrawSurfs >= MAX_MAP_DRAW_SURFS ) { - Error( "MAX_MAP_DRAW_SURFS (%d) exceeded", MAX_MAP_DRAW_SURFS ); + if ( numMapDrawSurfs >= max_map_draw_surfs ) { + Error( "max_map_draw_surfs (%d) exceeded, consider -maxmapdrawsurfs to increase", max_map_draw_surfs ); } mapDrawSurface_t *ds = &mapDrawSurfs[ numMapDrawSurfs ]; numMapDrawSurfs++; diff --git a/tools/quake3/q3map2/surface_extra.cpp b/tools/quake3/q3map2/surface_extra.cpp index e86d96cb..21275fa0 100644 --- a/tools/quake3/q3map2/surface_extra.cpp +++ b/tools/quake3/q3map2/surface_extra.cpp @@ -249,7 +249,7 @@ void LoadSurfaceExtraFile( const char *path ){ else { const int surfaceNum = atoi( token ); - if ( surfaceNum < 0 || surfaceNum > MAX_MAP_DRAW_SURFS ) { + if ( surfaceNum < 0 ) { Error( "ReadSurfaceExtraFile(): %s, line %d: bogus surface num %d", srfPath.c_str(), scriptline, surfaceNum ); } while ( surfaceNum >= numSurfaceExtras )