make it not loop endlessly :P

git-svn-id: svn://svn.icculus.org/netradiant/trunk@399 61c419a2-8eb2-4b30-bcec-8cead039b335
This commit is contained in:
divverent 2009-10-04 15:28:46 +00:00
parent ee71ec8dcb
commit 4631d505d9

View File

@ -1272,8 +1272,8 @@ contribution_t;
void TraceGrid( int num ) void TraceGrid( int num )
{ {
int i, j, x, y, z, mod, step, numCon, numStyles; int i, j, x, y, z, mod, numCon, numStyles;
float d; float d, step;
vec3_t baseOrigin, cheapColor, color, thisdir; vec3_t baseOrigin, cheapColor, color, thisdir;
rawGridPoint_t *gp; rawGridPoint_t *gp;
bspGridPoint_t *bgp; bspGridPoint_t *bgp;
@ -1311,25 +1311,12 @@ void TraceGrid( int num )
{ {
/* try to nudge the origin around to find a valid point */ /* try to nudge the origin around to find a valid point */
VectorCopy( trace.origin, baseOrigin ); 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 ); VectorCopy( baseOrigin, trace.origin );
if( i & 1 ) trace.origin[ 0 ] += step * (Random() - 0.5) * gridSize[0];
trace.origin[ 0 ] += step * gridSize[0]; trace.origin[ 1 ] += step * (Random() - 0.5) * gridSize[1];
else trace.origin[ 2 ] += step * (Random() - 0.5) * gridSize[2];
trace.origin[ 0 ] -= step * gridSize[0];
if( i & 2 )
trace.origin[ 1 ] += step * gridSize[1];
else
trace.origin[ 1 ] -= step * gridSize[1];
if( i & 4 )
trace.origin[ 2 ] += step * gridSize[2];
else
trace.origin[ 2 ] -= step * gridSize[2];
/* ydnar: changed to find cluster num */ /* ydnar: changed to find cluster num */
trace.cluster = ClusterForPointExt( trace.origin, VERTEX_EPSILON ); trace.cluster = ClusterForPointExt( trace.origin, VERTEX_EPSILON );
@ -1337,10 +1324,6 @@ void TraceGrid( int num )
break; break;
} }
if( i != 8 )
break;
}
/* can't find a valid point at all */ /* can't find a valid point at all */
if( step > 0.5 ) if( step > 0.5 )
return; return;