]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
make it not loop endlessly :P
authordivverent <divverent@61c419a2-8eb2-4b30-bcec-8cead039b335>
Sun, 4 Oct 2009 15:28:46 +0000 (15:28 +0000)
committerdivverent <divverent@61c419a2-8eb2-4b30-bcec-8cead039b335>
Sun, 4 Oct 2009 15:28:46 +0000 (15:28 +0000)
git-svn-id: svn://svn.icculus.org/netradiant/trunk@399 61c419a2-8eb2-4b30-bcec-8cead039b335

tools/quake3/q3map2/light.c

index 6d3b4c687c773cc09b74e9ebaf5bcd858f603630..e1fbeaca5a769ee7941bf34ea860fbb8c2359ff7 100644 (file)
@@ -1272,8 +1272,8 @@ contribution_t;
 
 void TraceGrid( int num )
 {
-       int                                             i, j, x, y, z, mod, step, numCon, numStyles;
-       float                                   d;
+       int                                             i, j, x, y, z, mod, numCon, numStyles;
+       float                                   d, step;
        vec3_t                                  baseOrigin, cheapColor, color, thisdir;
        rawGridPoint_t                  *gp;
        bspGridPoint_t                  *bgp;
@@ -1311,33 +1311,16 @@ void TraceGrid( int num )
        {
                /* try to nudge the origin around to find a valid point */
                VectorCopy( trace.origin, baseOrigin );
-               for( step = 0.05; step <= 0.5; step += 0.05 )
+               for( step = 0; (step += 0.005) <= 1.0; )
                {
-                       for( i = 0; i < 8; i++ )
-                       {
-                               VectorCopy( baseOrigin, trace.origin );
-                               if( i & 1 )
-                                       trace.origin[ 0 ] += step * gridSize[0];
-                               else
-                                       trace.origin[ 0 ] -= step * gridSize[0];
-                               
-                               if( i & 2 )
-                                       trace.origin[ 1 ] += step * gridSize[1];
-                               else
-                                       trace.origin[ 1 ] -= step * gridSize[1];
+                       VectorCopy( baseOrigin, trace.origin );
+                       trace.origin[ 0 ] += step * (Random() - 0.5) * gridSize[0];
+                       trace.origin[ 1 ] += step * (Random() - 0.5) * gridSize[1];
+                       trace.origin[ 2 ] += step * (Random() - 0.5) * gridSize[2];
                                
-                               if( i & 4 )
-                                       trace.origin[ 2 ] += step * gridSize[2];
-                               else
-                                       trace.origin[ 2 ] -= step * gridSize[2];
-                               
-                               /* ydnar: changed to find cluster num */
-                               trace.cluster = ClusterForPointExt( trace.origin, VERTEX_EPSILON );
-                               if( trace.cluster >= 0 )
-                                       break;
-                       }
-                       
-                       if( i != 8 )
+                       /* ydnar: changed to find cluster num */
+                       trace.cluster = ClusterForPointExt( trace.origin, VERTEX_EPSILON );
+                       if( trace.cluster >= 0 )
                                break;
                }