/* 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 )
end += 2;
/* check for overflow */
- if( end > buf + MAX_MAP_ENTSTRING )
+ if( end > buf + allocatedBSPEntData )
Error( "Entity text too long" );
}
bspLightBytes = safe_malloc( numBSPLightBytes );
CopyLump( (bspHeader_t*) header, LUMP_LIGHTMAPS, bspLightBytes, 1 );
- bspEntDataSize = CopyLump( (bspHeader_t*) header, LUMP_ENTITIES, bspEntData, 1);
+ bspEntDataSize = CopyLump_Allocate( (bspHeader_t*) header, LUMP_ENTITIES, (void **) &bspEntData, 1, &allocatedBSPEntData);
CopyLightGridLumps( header );
bspLightBytes = safe_malloc( numBSPLightBytes );
CopyLump( (bspHeader_t*) header, LUMP_LIGHTMAPS, bspLightBytes, 1 );
- bspEntDataSize = CopyLump( (bspHeader_t*) header, LUMP_ENTITIES, bspEntData, 1);
+ bspEntDataSize = CopyLump_Allocate( (bspHeader_t*) header, LUMP_ENTITIES, (void **) &bspEntData, 1, &allocatedBSPEntData);
CopyLightGridLumps( header );
must be within an epsilon distance of the plane
*/
-int FindFloatPlane( vec3_t normal, vec_t dist, int numPoints, vec3_t *points ) // NOTE: this has a side effect on the normal. Good or bad?
+int FindFloatPlane( vec3_t innormal, vec_t dist, int numPoints, vec3_t *points ) // NOTE: this has a side effect on the normal. Good or bad?
#ifdef USE_HASHING
plane_t *p;
vec_t d;
vec3_t centerofweight;
+ vec3_t normal;
VectorClear(centerofweight);
for(i = 0; i < numPoints; ++i)
VectorMA(centerofweight, 1.0 / numPoints, points[i], centerofweight);
/* hash the plane */
+ VectorCopy(innormal, normal);
SnapPlane( normal, &dist, centerofweight );
hash = (PLANE_HASHES - 1) & (int) fabs( dist );
{
int i;
plane_t *p;
+ vec3_t normal;
vec3_t centerofweight;
for(i = 0; i < numPoints; ++i)
VectorMA(centerofweight, 1.0 / numPoints, points[i], centerofweight);
+ VectorCopy(innormal, normal);
SnapPlane( normal, &dist, centerofweight );
for( i = 0, p = mapplanes; i < nummapplanes; i++, p++ )
{
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 ];