]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/bspfile_abstract.c
Revert "also load DDS files the way DarkPlaces stores them (does DDS loading even...
[xonotic/netradiant.git] / tools / quake3 / q3map2 / bspfile_abstract.c
index cf059ca00aedc27c2ec12286528f6105ff6702f0..ef78160f737ad15bd9e35586f09f33aafd53f54e 100644 (file)
@@ -331,8 +331,6 @@ 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 )
 {
-       int             length, offset;
-       
        /* get lump length and offset */
        *allocationVariable = header->lumps[ lump ].length / size;
        *dest = realloc(*dest, size * *allocationVariable);
@@ -644,13 +642,22 @@ void UnparseEntities( void )
        
        
        /* setup */
+       AUTOEXPAND_BY_REALLOC(bspEntData, 0, allocatedBSPEntData, 1024);
        buf = bspEntData;
        end = buf;
        *end = 0;
+
        
        /* run through entity list */
        for( i = 0; i < numBSPEntities && i < numEntities; i++ )
        {
+               {
+                       int sz = end - buf;
+                       AUTOEXPAND_BY_REALLOC(bspEntData, sz + 65536, allocatedBSPEntData, 1024);
+                       buf = bspEntData;
+                       end = buf + sz;
+               }
+
                /* get epair */
                ep = entities[ i ].epairs;
                if( ep == NULL )
@@ -687,7 +694,7 @@ void UnparseEntities( void )
                end += 2;
                
                /* check for overflow */
-               if( end > buf + MAX_MAP_ENTSTRING )
+               if( end > buf + allocatedBSPEntData )
                        Error( "Entity text too long" );
        }