try to eliminate MAX_MAP_PLANES limits
git-svn-id: svn://svn.icculus.org/netradiant/trunk@198 61c419a2-8eb2-4b30-bcec-8cead039b335
This commit is contained in:
parent
cf6c8123dd
commit
6a04feabc5
|
|
@ -481,7 +481,7 @@ void LoadIBSPFile( const char *filename )
|
|||
|
||||
numBSPModels = CopyLump_Allocate( (bspHeader_t*) header, LUMP_MODELS, (void **) &bspModels, sizeof( bspModel_t ), &allocatedBSPModels );
|
||||
|
||||
numBSPPlanes = CopyLump( (bspHeader_t*) header, LUMP_PLANES, bspPlanes, sizeof( bspPlane_t ) );
|
||||
numBSPPlanes = CopyLump_Allocate( (bspHeader_t*) header, LUMP_PLANES, (void **) &bspPlanes, sizeof( bspPlane_t ), &allocatedBSPPlanes );
|
||||
|
||||
numBSPLeafs = CopyLump( (bspHeader_t*) header, LUMP_LEAFS, bspLeafs, sizeof( bspLeaf_t ) );
|
||||
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ void LoadRBSPFile( const char *filename )
|
|||
|
||||
numBSPModels = CopyLump_Allocate( (bspHeader_t*) header, LUMP_MODELS, (void **) &bspModels, sizeof( bspModel_t ), &allocatedBSPModels );
|
||||
|
||||
numBSPPlanes = CopyLump( (bspHeader_t*) header, LUMP_PLANES, bspPlanes, sizeof( bspPlane_t ) );
|
||||
numBSPPlanes = CopyLump_Allocate( (bspHeader_t*) header, LUMP_PLANES, (void **) &bspPlanes, sizeof( bspPlane_t ), &allocatedBSPPlanes );
|
||||
|
||||
numBSPLeafs = CopyLump( (bspHeader_t*) header, LUMP_LEAFS, bspLeafs, sizeof( bspLeaf_t ) );
|
||||
|
||||
|
|
|
|||
|
|
@ -482,7 +482,7 @@ static void ConvertModel( FILE *f, bspModel_t *model, int modelNum, vec3_t origi
|
|||
VectorCopy( bspPlanes[ i ].normal, mapplanes[ i ].normal );
|
||||
mapplanes[ i ].dist = bspPlanes[ i ].dist;
|
||||
mapplanes[ i ].type = PlaneTypeForNormal( mapplanes[ i ].normal );
|
||||
mapplanes[ i ].hash_chain = NULL;
|
||||
mapplanes[ i ].hash_chain = 0;
|
||||
}
|
||||
|
||||
/* allocate a build brush */
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ several games based on the Quake III Arena engine, in the form of "Q3Map2."
|
|||
#define USE_HASHING
|
||||
#define PLANE_HASHES 8192
|
||||
|
||||
plane_t *planehash[ PLANE_HASHES ];
|
||||
int planehash[ PLANE_HASHES ];
|
||||
|
||||
int c_boxbevels;
|
||||
int c_edgebevels;
|
||||
|
|
@ -96,7 +96,7 @@ void AddPlaneToHash( plane_t *p )
|
|||
hash = (PLANE_HASHES - 1) & (int) fabs( p->dist );
|
||||
|
||||
p->hash_chain = planehash[hash];
|
||||
planehash[hash] = p;
|
||||
planehash[hash] = p - mapplanes + 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -115,8 +115,7 @@ int CreateNewFloatPlane (vec3_t normal, vec_t dist)
|
|||
}
|
||||
|
||||
// create a new plane
|
||||
if (nummapplanes+2 > MAX_MAP_PLANES)
|
||||
Error ("MAX_MAP_PLANES");
|
||||
AUTOEXPAND_BY_REALLOC(mapplanes, nummapplanes+1, allocatedmapplanes, 1024);
|
||||
|
||||
p = &mapplanes[nummapplanes];
|
||||
VectorCopy (normal, p->normal);
|
||||
|
|
@ -219,6 +218,7 @@ int FindFloatPlane( vec3_t normal, vec_t dist, int numPoints, vec3_t *points ) /
|
|||
|
||||
{
|
||||
int i, j, hash, h;
|
||||
int pidx;
|
||||
plane_t *p;
|
||||
vec_t d;
|
||||
vec3_t centerofweight;
|
||||
|
|
@ -235,8 +235,10 @@ int FindFloatPlane( vec3_t normal, vec_t dist, int numPoints, vec3_t *points ) /
|
|||
for( i = -1; i <= 1; i++ )
|
||||
{
|
||||
h = (hash + i) & (PLANE_HASHES - 1);
|
||||
for( p = planehash[ h ]; p != NULL; p = p->hash_chain )
|
||||
for( pidx = planehash[ h ] - 1; pidx != -1; pidx = mapplanes[pidx].hash_chain - 1 )
|
||||
{
|
||||
p = &mapplanes[pidx];
|
||||
|
||||
/* do standard plane compare */
|
||||
if( !PlaneEqual( p, normal, dist ) )
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -409,20 +409,11 @@ void InsertModel( char *name, int frame, m4x4_t transform, remap_t *remap, shade
|
|||
((si->compileFlags & C_TRANSLUCENT) || !(si->compileFlags & C_SOLID)) )
|
||||
continue;
|
||||
|
||||
/* overflow check */
|
||||
if( (nummapplanes + 64) >= (MAX_MAP_PLANES >> 1) )
|
||||
continue;
|
||||
|
||||
/* walk triangle list */
|
||||
for( i = 0; i < ds->numIndexes; i += 3 )
|
||||
{
|
||||
/* overflow hack */
|
||||
if( (nummapplanes + 64) >= (MAX_MAP_PLANES >> 1) )
|
||||
{
|
||||
Sys_Printf( "WARNING: MAX_MAP_PLANES (%d) hit generating clip brushes for model %s.\n",
|
||||
MAX_MAP_PLANES, name );
|
||||
break;
|
||||
}
|
||||
AUTOEXPAND_BY_REALLOC(mapplanes, (nummapplanes+64) << 1, allocatedmapplanes, 1024);
|
||||
|
||||
/* make points and back points */
|
||||
for( j = 0; j < 3; j++ )
|
||||
|
|
|
|||
|
|
@ -310,7 +310,6 @@ abstracted bsp file
|
|||
|
||||
#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) */
|
||||
#define MAX_MAP_PLANES 0x200000 //% 0x20000 /* ydnar for md */
|
||||
#define MAX_MAP_LEAFS 0x20000
|
||||
#define MAX_MAP_PORTALS 0x20000
|
||||
#define MAX_MAP_LIGHTING 0x800000
|
||||
|
|
@ -791,7 +790,7 @@ typedef struct plane_s
|
|||
vec3_t normal;
|
||||
vec_t dist;
|
||||
int type;
|
||||
struct plane_s *hash_chain;
|
||||
int hash_chain;
|
||||
}
|
||||
plane_t;
|
||||
|
||||
|
|
@ -1961,8 +1960,9 @@ Q_EXTERN int mapEntityNum Q_ASSIGN( 0 );
|
|||
|
||||
Q_EXTERN int entitySourceBrushes;
|
||||
|
||||
Q_EXTERN plane_t mapplanes[ MAX_MAP_PLANES ]; /* mapplanes[ num ^ 1 ] will always be the mirror or mapplanes[ num ] */
|
||||
Q_EXTERN int nummapplanes; /* nummapplanes will always be even */
|
||||
Q_EXTERN plane_t *mapplanes Q_ASSIGN(NULL); /* mapplanes[ num ^ 1 ] will always be the mirror or mapplanes[ num ] */
|
||||
Q_EXTERN int nummapplanes Q_ASSIGN(0); /* nummapplanes will always be even */
|
||||
Q_EXTERN int allocatedmapplanes Q_ASSIGN(0);
|
||||
Q_EXTERN int numMapPatches;
|
||||
Q_EXTERN vec3_t mapMins, mapMaxs;
|
||||
|
||||
|
|
@ -2317,7 +2317,8 @@ Q_EXTERN int numBSPLeafs Q_ASSIGN( 0 );
|
|||
Q_EXTERN bspLeaf_t bspLeafs[ MAX_MAP_LEAFS ];
|
||||
|
||||
Q_EXTERN int numBSPPlanes Q_ASSIGN( 0 );
|
||||
Q_EXTERN bspPlane_t bspPlanes[ MAX_MAP_PLANES ];
|
||||
Q_EXTERN int allocatedBSPPlanes Q_ASSIGN(0);
|
||||
Q_EXTERN bspPlane_t *bspPlanes;
|
||||
|
||||
Q_EXTERN int numBSPNodes Q_ASSIGN( 0 );
|
||||
Q_EXTERN int allocatedBSPNodes Q_ASSIGN( 0 );
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ void EmitPlanes( void )
|
|||
mp = mapplanes;
|
||||
for( i = 0; i < nummapplanes; i++, mp++ )
|
||||
{
|
||||
AUTOEXPAND_BY_REALLOC_BSP(Planes, 1024);
|
||||
bp = &bspPlanes[ numBSPPlanes ];
|
||||
VectorCopy( mp->normal, bp->normal );
|
||||
bp->dist = mp->dist;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user