bInfo = &surfaceInfos[ *((int*) b) ];
/* model first */
- if( aInfo->model < bInfo->model )
+ if( aInfo->modelindex < bInfo->modelindex )
return 1;
- else if( aInfo->model > bInfo->model )
+ else if( aInfo->modelindex > bInfo->modelindex )
return -1;
/* then lightmap status */
VectorClear( entityOrigin );
/* basic setup */
- info->model = model;
+ info->modelindex = i;
info->lm = NULL;
info->plane = NULL;
info->firstSurfaceCluster = numSurfaceClusters;
typedef struct surfaceInfo_s
{
- bspModel_t *model;
+ int modelindex;
shaderInfo_t *si;
rawLightmap_t *lm;
int parentSurfaceNum, childSurfaceNum;
Q_EXTERN int numBSPLeafBrushes Q_ASSIGN( 0 );
Q_EXTERN int allocatedBSPLeafBrushes Q_ASSIGN( 0 );
-Q_EXTERN int* bspLeafBrushes Q_ASSIGN(0);
+Q_EXTERN int* bspLeafBrushes Q_ASSIGN(NULL);
Q_EXTERN int numBSPBrushes Q_ASSIGN( 0 );
Q_EXTERN int allocatedBSPBrushes Q_ASSIGN( 0 );
int EmitDrawNode_r( node_t *node )
{
bspNode_t *n;
- int i;
+ int i, n0;
/* check for leafnode */
/* emit a node */
AUTOEXPAND_BY_REALLOC_BSP(Nodes, 1024);
- n = &bspNodes[ numBSPNodes ];
+ n0 = numBSPNodes;
+ n = &bspNodes[ n0 ];
numBSPNodes++;
VectorCopy (node->mins, n->mins);
{
n->children[i] = numBSPNodes;
EmitDrawNode_r (node->children[i]);
+ // n may have become invalid here, so...
+ n = &bspNodes[ n0 ];
}
}