From 3a7c77d7202273945fa121af4fba74c18423f3c0 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sun, 12 Feb 2012 19:00:55 +0100 Subject: [PATCH 1/2] unlimit MAX_MAP_DRAW_INDEXES --- tools/quake3/q3map2/q3map2.h | 6 +++--- tools/quake3/q3map2/surface.c | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 89dbe3c9..f4b88d7a 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -327,7 +327,6 @@ abstracted bsp file #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 #define MAX_MAP_ADVERTISEMENTS 30 @@ -2511,10 +2510,11 @@ Q_EXTERN int numBSPVisBytes Q_ASSIGN( 0 ); Q_EXTERN byte bspVisBytes[ MAX_MAP_VISIBILITY ]; Q_EXTERN int numBSPDrawVerts Q_ASSIGN( 0 ); -Q_EXTERN bspDrawVert_t *bspDrawVerts Q_ASSIGN( NULL ); +Q_EXTERN bspDrawVert_t *bspDrawVerts Q_ASSIGN( NULL ); Q_EXTERN int numBSPDrawIndexes Q_ASSIGN( 0 ); -Q_EXTERN int bspDrawIndexes[ MAX_MAP_DRAW_INDEXES ]; +Q_EXTERN int allocatedBSPDrawIndexes Q_ASSIGN( 0 ); +Q_EXTERN int *bspDrawIndexes Q_ASSIGN(NULL); Q_EXTERN int numBSPDrawSurfaces Q_ASSIGN( 0 ); Q_EXTERN bspDrawSurface_t *bspDrawSurfaces Q_ASSIGN( NULL ); diff --git a/tools/quake3/q3map2/surface.c b/tools/quake3/q3map2/surface.c index e2ec8909..005456ef 100644 --- a/tools/quake3/q3map2/surface.c +++ b/tools/quake3/q3map2/surface.c @@ -2435,8 +2435,7 @@ void EmitDrawIndexes( mapDrawSurface_t *ds, bspDrawSurface_t *out ) /* copy new unique indexes */ for( i = 0; i < ds->numIndexes; i++ ) { - if( numBSPDrawIndexes == MAX_MAP_DRAW_INDEXES ) - Error( "MAX_MAP_DRAW_INDEXES" ); + AUTOEXPAND_BY_REALLOC_BSP(DrawIndexes, 1024); bspDrawIndexes[ numBSPDrawIndexes ] = ds->indexes[ i ]; /* validate the index */ From f8bfc8d1dfd29781a1e71a0943144363d96a1246 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Mon, 13 Feb 2012 11:22:07 +0100 Subject: [PATCH 2/2] fix crash in -bsp --- tools/quake3/q3map2/writebsp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/quake3/q3map2/writebsp.c b/tools/quake3/q3map2/writebsp.c index 106e618f..5321d068 100644 --- a/tools/quake3/q3map2/writebsp.c +++ b/tools/quake3/q3map2/writebsp.c @@ -388,6 +388,7 @@ void BeginBSPFile( void ) /* ydnar: gs mods: set the first 6 drawindexes to 0 1 2 2 1 3 for triangles and quads */ numBSPDrawIndexes = 6; + AUTOEXPAND_BY_REALLOC_BSP(DrawIndexes, 1024); bspDrawIndexes[ 0 ] = 0; bspDrawIndexes[ 1 ] = 1; bspDrawIndexes[ 2 ] = 2;