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;
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 ];
}
}
void SetLightStyles( void )
{
int i, j, style, numStyles;
- qboolean keepLights;
const char *t;
entity_t *e;
epair_t *ep, *next;
char value[ 10 ];
char lightTargets[ MAX_SWITCHED_LIGHTS ][ 64 ];
int lightStyles[ MAX_SWITCHED_LIGHTS ];
-
-
+
/* ydnar: determine if we keep lights in the bsp */
- t = ValueForKey( &entities[ 0 ], "_keepLights" );
- keepLights = (t[ 0 ] == '1') ? qtrue : qfalse;
+ if (KeyExists(&entities[ 0 ], "_keepLights") == qtrue)
+ {
+ t = ValueForKey( &entities[ 0 ], "_keepLights" );
+ keepLights = (t[ 0 ] == '1') ? qtrue : qfalse;
+ }
/* any light that is controlled (has a targetname) must have a unique style number generated for it */
numStyles = 0;