]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
fix multiple bugs with the limit extension
authordivverent <divverent@61c419a2-8eb2-4b30-bcec-8cead039b335>
Sat, 14 Feb 2009 18:14:30 +0000 (18:14 +0000)
committerdivverent <divverent@61c419a2-8eb2-4b30-bcec-8cead039b335>
Sat, 14 Feb 2009 18:14:30 +0000 (18:14 +0000)
git-svn-id: svn://svn.icculus.org/netradiant/trunk@191 61c419a2-8eb2-4b30-bcec-8cead039b335

tools/quake3/q3map2/lightmaps_ydnar.c
tools/quake3/q3map2/q3map2.h
tools/quake3/q3map2/writebsp.c

index b4b6349fb4bb2713b7e2d7a6daa3e9ec06228cc6..9e41af4f3158a106b0008857006f04a1c33a9378 100644 (file)
@@ -865,9 +865,9 @@ static int CompareSurfaceInfo( const void *a, const void *b )
        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 */
@@ -997,7 +997,7 @@ void SetupSurfaceLightmaps( void )
                                VectorClear( entityOrigin );
                        
                        /* basic setup */
-                       info->model = model;
+                       info->modelindex = i;
                        info->lm = NULL;
                        info->plane = NULL;
                        info->firstSurfaceCluster = numSurfaceClusters;
index 3224d8e93fcc9b371040f194f5d824b57d028616..4819ff3076292dae2147a5d14821322abb84c527 100644 (file)
@@ -1421,7 +1421,7 @@ rawGridPoint_t;
 
 typedef struct surfaceInfo_s
 {
-       bspModel_t                      *model;
+       int                                     modelindex;
        shaderInfo_t            *si;
        rawLightmap_t           *lm;
        int                                     parentSurfaceNum, childSurfaceNum;
@@ -2328,7 +2328,7 @@ Q_EXTERN int*                             bspLeafSurfaces Q_ASSIGN(NULL);
 
 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 );
index 70a382dd4d0b1f491062efdf3487ad5fb1cbe85b..96e8ce29340b048a328a76c946f1eb8868a3e508 100644 (file)
@@ -199,7 +199,7 @@ recursively emit the bsp nodes
 int EmitDrawNode_r( node_t *node )
 {
        bspNode_t       *n;
-       int                     i;
+       int                     i, n0;
        
        
        /* check for leafnode */
@@ -211,7 +211,8 @@ int EmitDrawNode_r( node_t *node )
        
        /* emit a node */
        AUTOEXPAND_BY_REALLOC_BSP(Nodes, 1024);
-       n = &bspNodes[ numBSPNodes ];
+       n0 = numBSPNodes;
+       n = &bspNodes[ n0 ];
        numBSPNodes++;
        
        VectorCopy (node->mins, n->mins);
@@ -235,6 +236,8 @@ int EmitDrawNode_r( node_t *node )
                {
                        n->children[i] = numBSPNodes;   
                        EmitDrawNode_r (node->children[i]);
+                       // n may have become invalid here, so...
+                       n = &bspNodes[ n0 ];
                }
        }