fix formatting

This commit is contained in:
Garux 2021-10-26 18:16:24 +03:00
parent 977781a621
commit 0c390241c8
52 changed files with 242 additions and 242 deletions

View File

@ -69,7 +69,7 @@ bool CBspPortal::Build( char *def, unsigned int pointCnt, bool bInverse ){
for ( n = 0; n < point_count; n++ )
{
for (; *c != 0 && *c != '('; c++ ) ;
for (; *c != 0 && *c != '('; c++ ){};
if ( *c == 0 ) {
return false;

View File

@ -81,7 +81,7 @@ bool CBspPortal::Build( char *def ){
for ( n = 0; n < point_count; n++ )
{
for (; *c != 0 && *c != '('; c++ ) ;
for (; *c != 0 && *c != '('; c++ ){};
if ( *c == 0 ) {
return false;

View File

@ -122,7 +122,7 @@ const char *WINS_ErrorMessage( int error ){
if ( error == errlist[search].errnum ) {
return errlist[search].errstr;
}
} //end for
}
return "Unknown error";
} //end of the function WINS_ErrorMessage

View File

@ -148,7 +148,7 @@ const char *WINS_ErrorMessage( int error ){
if ( error == errlist[search].errnum ) {
return errlist[search].errstr;
}
} //end for
}
return "Unknown error";
} //end of the function WINS_ErrorMessage

View File

@ -956,7 +956,7 @@ char *_pico_parse( picoParser_t *p, int allowLFs ){
* skips the rest of the current line in parser.
*/
void _pico_parse_skip_rest( picoParser_t *p ){
while ( _pico_parse_ex( p,0,0 ) ) ;
while ( _pico_parse_ex( p,0,0 ) ){};
}
/* _pico_parse_skip_braced:

View File

@ -81,7 +81,7 @@ const picoModule_t *picoModules[] =
const picoModule_t **PicoModuleList( int *numModules ){
/* get module count */
if ( numModules != NULL ) {
for ( ( *numModules ) = 0; picoModules[ *numModules ] != NULL; ( *numModules )++ ) ;
for ( ( *numModules ) = 0; picoModules[ *numModules ] != NULL; ( *numModules )++ ){};
}
/* return list of modules */

View File

@ -297,7 +297,7 @@ public:
// It is safe to disconnect the signal handler currently being invoked.
template<typename InputIterator, typename SignalHandlerInvoke>
inline void invokeSignalHandlers( InputIterator first, InputIterator last, SignalHandlerInvoke invoke ){
while ( first != last && invoke( *first++ ) != SIGNAL_STOP_EMISSION ) ;
while ( first != last && invoke( *first++ ) != SIGNAL_STOP_EMISSION ){};
}
class Signal0 : public SignalBase<SignalHandler>

View File

@ -106,7 +106,7 @@ const GLubyte* qgluErrorString( GLenum errCode ){
if ( errCode == glu_errlist[search].errnum ) {
return (const GLubyte *)glu_errlist[search].errstr;
}
} //end for
}
return (const GLubyte *)"Unknown error";
}

View File

@ -270,7 +270,7 @@ void LoadLBM( const char *filename, byte **picture, byte **palette ){
//
// unpack PBM
//
for ( y = 0 ; y < bmhd.h ; y++, pic_p += bmhd.w )
for ( y = 0; y < bmhd.h; ++y, pic_p += bmhd.w )
{
if ( bmhd.compression == cm_rle1 ) {
body_p = LBMRLEDecompress( (byte *)body_p
@ -586,9 +586,9 @@ void WritePCXfile( const char *filename, byte *data,
// pack the image
pack = &pcx->data;
for ( i = 0 ; i < height ; i++ )
for ( i = 0; i < height; ++i )
{
for ( j = 0 ; j < width ; j++ )
for ( j = 0; j < width; ++j )
{
if ( ( *data & 0xc0 ) != 0xc0 ) {
*pack++ = *data++;
@ -603,7 +603,7 @@ void WritePCXfile( const char *filename, byte *data,
// write the palette
*pack++ = 0x0c; // palette ID byte
for ( i = 0 ; i < 768 ; i++ )
for ( i = 0; i < 768; ++i )
*pack++ = *palette++;
// write output file
@ -723,7 +723,7 @@ void LoadBMP( const char *filename, byte **pic, byte **palette, int *width, int
pos += 1024;
*palette = safe_malloc( 768 );
for ( i = 0 ; i < 256 ; i++ )
for ( i = 0; i < 256; ++i )
{
( *palette )[i * 3 + 0] = bcPalette[i * 4 + 2];
( *palette )[i * 3 + 1] = bcPalette[i * 4 + 1];
@ -743,7 +743,7 @@ void LoadBMP( const char *filename, byte **pic, byte **palette, int *width, int
pos += 768;
*palette = safe_malloc( 768 );
for ( i = 0 ; i < 256 ; i++ ) {
for ( i = 0; i < 256; ++i ) {
( *palette )[i * 3 + 0] = bcPalette[i * 3 + 2];
( *palette )[i * 3 + 1] = bcPalette[i * 3 + 1];
( *palette )[i * 3 + 2] = bcPalette[i * 3 + 0];
@ -786,7 +786,7 @@ void LoadBMP( const char *filename, byte **pic, byte **palette, int *width, int
pos = bfOffBits;
if ( flipped ) {
for ( i = 0 ; i < bcHeight ; i++ ) {
for ( i = 0; i < bcHeight; ++i ) {
memcpy( out + bcWidth * ( bcHeight - 1 - i ), in + pos, bcWidth );
pos += bcWidth;
}
@ -1199,7 +1199,7 @@ void Load32BitImage( const char *name, unsigned **pixels, int *width, int *heig
size = *width * *height;
pixels32 = safe_malloc( size * 4 );
*pixels = (unsigned *)pixels32;
for ( i = 0 ; i < size ; i++ ) {
for ( i = 0; i < size; ++i ) {
v = pixels8[i];
pixels32[i * 4 + 0] = palette[ v * 3 + 0 ];
pixels32[i * 4 + 1] = palette[ v * 3 + 1 ];

View File

@ -243,7 +243,7 @@ winding_t BaseWindingForPlane( const Plane3f& plane ){
max = -BOGUS_RANGE;
x = -1;
for ( i = 0 ; i < 3; i++ )
for ( i = 0; i < 3; ++i )
{
v = fabs( plane.normal()[i] );
if ( v > max ) {
@ -653,7 +653,7 @@ void CheckWinding( const winding_t& w ){
const Plane3f faceplane = WindingPlane( w );
for ( size_t i = 0 ; i < w.size() ; i++ )
for ( size_t i = 0; i < w.size(); ++i )
{
const Vector3& p1 = w[i];
@ -678,7 +678,7 @@ void CheckWinding( const winding_t& w ){
const float edgedist = vector3_dot( p1, edgenormal ) + ON_EPSILON;
// all other points must be on front side
for ( size_t j = 0 ; j < w.size() ; j++ )
for ( size_t j = 0; j < w.size(); ++j )
{
if ( j == i ) {
continue;

View File

@ -189,7 +189,7 @@ void RunThreadsOn( int workcnt, bool showpacifier, void ( *func )( int ) ){
}
else
{
for ( i = 0 ; i < numthreads ; i++ )
for ( i = 0; i < numthreads; ++i )
{
threadhandle[i] = CreateThread(
NULL, // LPSECURITY_ATTRIBUTES lpThreadAttributes,
@ -204,7 +204,7 @@ void RunThreadsOn( int workcnt, bool showpacifier, void ( *func )( int ) ){
NULL ); // LPDWORD lpThreadId
}
for ( i = 0 ; i < numthreads ; i++ )
for ( i = 0; i < numthreads; ++i )
WaitForSingleObject( threadhandle[i], INFINITE );
}
DeleteCriticalSection( &crit );
@ -300,7 +300,7 @@ void RunThreadsOn( int workcnt, bool showpacifier, void ( *func )( int ) ){
Error( "pthread_attr_setstacksize failed" );
}
for ( i = 0 ; i < numthreads ; i++ )
for ( i = 0; i < numthreads; ++i )
{
if ( pthread_create( &work_threads[i], attrib
, (pthread_startroutine_t)func, (pthread_addr_t)i ) == -1 ) {
@ -308,7 +308,7 @@ void RunThreadsOn( int workcnt, bool showpacifier, void ( *func )( int ) ){
}
}
for ( i = 0 ; i < numthreads ; i++ )
for ( i = 0; i < numthreads; ++i )
{
if ( pthread_join( work_threads[i], &status ) == -1 ) {
Error( "pthread_join failed" );
@ -387,7 +387,7 @@ void RunThreadsOn( int workcnt, bool showpacifier, void ( *func )( int ) ){
init_lock( &lck );
for ( i = 0 ; i < numthreads - 1 ; i++ )
for ( i = 0; i < numthreads - 1; ++i )
{
pid[i] = sprocsp( ( void ( * )( void *, size_t ) )func, PR_SALL, (void *)i
, NULL, 0x200000 ); // 2 meg stacks
@ -399,7 +399,7 @@ void RunThreadsOn( int workcnt, bool showpacifier, void ( *func )( int ) ){
func( i );
for ( i = 0 ; i < numthreads - 1 ; i++ )
for ( i = 0; i < numthreads - 1; ++i )
wait( NULL );
threaded = false;
@ -571,14 +571,14 @@ void RunThreadsOn( int workcnt, bool showpacifier, void ( *func )( int ) ){
}
recursive_mutex_init( mattrib );
for ( i = 0 ; i < numthreads ; i++ )
for ( i = 0; i < numthreads; ++i )
{
/* Default pthread attributes: joinable & non-realtime scheduling */
if ( pthread_create( &work_threads[i], &attr, (void *(*)(void *)) func, (void*)(size_t)i ) != 0 ) {
Error( "pthread_create failed" );
}
}
for ( i = 0 ; i < numthreads ; i++ )
for ( i = 0; i < numthreads; ++i )
{
if ( pthread_join( work_threads[i], NULL ) != 0 ) {
Error( "pthread_join failed" );

View File

@ -352,7 +352,7 @@ bool CreateBrushWindings( brush_t& brush ){
brush_t BrushFromBounds( const Vector3& mins, const Vector3& maxs ){
brush_t b;
b.sides.resize( 6 );
for ( int i = 0 ; i < 3 ; i++ )
for ( int i = 0; i < 3; ++i )
{
float dist = maxs[i];
b.sides[i].planenum = FindFloatPlane( g_vector3_axes[i], dist, 1, &maxs );

View File

@ -410,7 +410,7 @@ bool ParseEntity( void ){
void ParseEntities( void ){
entities.clear();
ParseFromMemory( bspEntData.data(), bspEntData.size() );
while ( ParseEntity() ) ;
while ( ParseEntity() ){};
/* ydnar: set number of bsp entities in case a map is loaded on top */
numBSPEntities = entities.size();

View File

@ -73,13 +73,13 @@ void SplitMeshByPlane( mesh_t *in, const Plane3f& plane, mesh_t **front, mesh_t
float frac;
int frontAprox, backAprox;
for ( i = 0 ; i < 2 ; i++ ) {
for ( i = 0; i < 2; ++i ) {
dv = in->verts;
c_front = 0;
c_back = 0;
c_on = 0;
for ( h = 0 ; h < in->height ; h++ ) {
for ( w = 0 ; w < in->width ; w++, dv++ ) {
for ( h = 0; h < in->height; ++h ) {
for ( w = 0; w < in->width; ++w, ++dv ) {
d[h][w] = plane3_distance_to_point( plane, dv->xyz );
if ( d[h][w] > ON_EPSILON ) {
c_front++;
@ -107,7 +107,7 @@ void SplitMeshByPlane( mesh_t *in, const Plane3f& plane, mesh_t **front, mesh_t
// find a split point
split = -1;
for ( w = 0 ; w < in->width - 1 ; w++ ) {
for ( w = 0; w < in->width - 1; ++w ) {
if ( ( d[0][w] < 0 ) != ( d[0][w + 1] < 0 ) ) {
if ( split == -1 ) {
split = w;
@ -129,8 +129,8 @@ void SplitMeshByPlane( mesh_t *in, const Plane3f& plane, mesh_t **front, mesh_t
}
// make sure the split point stays the same for all other rows
for ( h = 1 ; h < in->height ; h++ ) {
for ( w = 0 ; w < in->width - 1 ; w++ ) {
for ( h = 1; h < in->height; ++h ) {
for ( w = 0; w < in->width - 1; ++w ) {
if ( ( d[h][w] < 0 ) != ( d[h][w + 1] < 0 ) ) {
if ( w != split ) {
Sys_Printf( "multiple crossing points for patch -- can't clip\n" );
@ -191,8 +191,8 @@ void SplitMeshByPlane( mesh_t *in, const Plane3f& plane, mesh_t **front, mesh_t
}
// distribute the points
for ( w = 0 ; w < in->width ; w++ ) {
for ( h = 0 ; h < in->height ; h++ ) {
for ( w = 0; w < in->width; ++w ) {
for ( h = 0; h < in->height; ++h ) {
if ( w <= split ) {
f->verts[ h * f->width + w ] = in->verts[ h * in->width + w ];
}
@ -257,14 +257,14 @@ bool ChopPatchSurfaceByBrush( entity_t *e, mapDrawSurface_t *ds, const brush_t *
// only split by the top and bottom planes to avoid
// some messy patch clipping issues
for ( i = 4 ; i <= 5 ; i++ ) {
for ( i = 4; i <= 5; ++i ) {
const plane_t& plane = mapplanes[ b->sides[ i ].planenum ];
SplitMeshByPlane( m, plane.plane, &front, &back );
if ( !back ) {
// nothing actually contained inside
for ( j = 0 ; j < numOutside ; j++ ) {
for ( j = 0; j < numOutside; ++j ) {
FreeMesh( outside[j] );
}
return false;

View File

@ -1961,7 +1961,7 @@ static void FindOutLightmaps( rawLightmap_t *lm, bool fastAllocate ){
else{
i = ( ( numOutLightmaps - LIGHTMAP_RESERVE_COUNT ) / lightmapSearchBlockSize ) * lightmapSearchBlockSize;
}
for ( ; i < numOutLightmaps; i++ )
for ( ; i < numOutLightmaps; ++i )
{
/* get the output lightmap */
olm = &outLightmaps[ i ];

View File

@ -854,7 +854,7 @@ std::array<Vector3, 2> TextureAxisFromPlane( const plane_t& plane ){
float best = 0;
int bestaxis = 0;
for ( int i = 0 ; i < 6 ; i++ )
for ( int i = 0; i < 6; ++i )
{
const float dot = vector3_dot( plane.normal(), baseaxis[i * 3] );
if ( dot > best + 0.0001f ) { /* ydnar: bug 637 fix, suggested by jmonroe */
@ -927,7 +927,7 @@ void QuakeTextureVecs( const plane_t& plane, float shift[ 2 ], float rotate, flo
tv = 2;
}
for ( int i = 0 ; i < 2 ; i++ ) {
for ( int i = 0; i < 2; ++i ) {
const float ns = cosv * vecs[i][sv] - sinv * vecs[i][tv];
const float nt = sinv * vecs[i][sv] + cosv * vecs[i][tv];
vecs[i][sv] = ns;
@ -1244,7 +1244,7 @@ void MoveBrushesToWorld( entity_t *ent ){
/* move patches */
if ( ent->patches != NULL ) {
parseMesh_t *pm;
for ( pm = ent->patches; pm->next != NULL; pm = pm->next ) ;
for ( pm = ent->patches; pm->next != NULL; pm = pm->next ){};
pm->next = entities[ 0 ].patches;
entities[ 0 ].patches = ent->patches;
@ -1683,7 +1683,7 @@ void LoadMapFile( const char *filename, bool onlyLights, bool noCollapseGroups )
buildBrush.sides.reserve( MAX_BUILD_SIDES );
/* parse the map file */
while ( ParseMapEntity( onlyLights, noCollapseGroups ) ) ;
while ( ParseMapEntity( onlyLights, noCollapseGroups ) ){};
/* light loading */
if ( onlyLights ) {

View File

@ -173,7 +173,7 @@ void MakeMeshNormals( mesh_t in ){
wrapWidth = false;
for ( i = 0 ; i < in.height ; i++ ) {
for ( i = 0; i < in.height; ++i ) {
if ( vector3_length( in.verts[i * in.width].xyz - in.verts[i * in.width + in.width - 1].xyz ) > 1.0 ) {
break;
}
@ -183,7 +183,7 @@ void MakeMeshNormals( mesh_t in ){
}
wrapHeight = false;
for ( i = 0 ; i < in.width ; i++ ) {
for ( i = 0; i < in.width; ++i ) {
if ( vector3_length( in.verts[i].xyz - in.verts[i + ( in.height - 1 ) * in.width].xyz ) > 1.0 ) {
break;
}
@ -193,16 +193,16 @@ void MakeMeshNormals( mesh_t in ){
}
for ( i = 0 ; i < in.width ; i++ ) {
for ( j = 0 ; j < in.height ; j++ ) {
for ( i = 0; i < in.width; ++i ) {
for ( j = 0; j < in.height; ++j ) {
count = 0;
dv = &in.verts[j * in.width + i];
const Vector3 base( dv->xyz );
for ( k = 0 ; k < 8 ; k++ ) {
for ( k = 0; k < 8; ++k ) {
around[k].set( 0 );
good[k] = false;
for ( dist = 1 ; dist <= 3 ; dist++ ) {
for ( dist = 1; dist <= 3; ++dist ) {
x = i + neighbors[k][0] * dist;
y = j + neighbors[k][1] * dist;
if ( wrapWidth ) {
@ -238,7 +238,7 @@ void MakeMeshNormals( mesh_t in ){
}
Vector3 sum( 0 );
for ( k = 0 ; k < 8 ; k++ ) {
for ( k = 0; k < 8; ++k ) {
if ( !good[k] || !good[( k + 1 ) & 7] ) {
continue; // didn't get two points
}
@ -320,8 +320,8 @@ mesh_t *SubdivideMesh( mesh_t in, float maxError, float minLength ){
out.width = in.width;
out.height = in.height;
for ( i = 0 ; i < in.width ; i++ ) {
for ( j = 0 ; j < in.height ; j++ ) {
for ( i = 0; i < in.width; ++i ) {
for ( j = 0; j < in.height; ++j ) {
expand[j][i] = in.verts[j * in.width + i];
}
}
@ -329,7 +329,7 @@ mesh_t *SubdivideMesh( mesh_t in, float maxError, float minLength ){
// horizontal subdivisions
for ( j = 0; j + 2 < out.width; j += 2 ) {
// check subdivided midpoints against control points
for ( i = 0 ; i < out.height ; i++ ) {
for ( i = 0; i < out.height; ++i ) {
prevxyz = expand[i][j + 1].xyz - expand[i][j].xyz;
nextxyz = expand[i][j + 2].xyz - expand[i][j + 1].xyz;
midxyz = ( expand[i][j].xyz + expand[i][j + 1].xyz * 2 + expand[i][j + 2].xyz ) * 0.25;
@ -357,12 +357,12 @@ mesh_t *SubdivideMesh( mesh_t in, float maxError, float minLength ){
// insert two columns and replace the peak
out.width += 2;
for ( i = 0 ; i < out.height ; i++ ) {
for ( i = 0; i < out.height; ++i ) {
LerpDrawVert( &expand[i][j], &expand[i][j + 1], &prev );
LerpDrawVert( &expand[i][j + 1], &expand[i][j + 2], &next );
LerpDrawVert( &prev, &next, &mid );
for ( k = out.width - 1 ; k > j + 3 ; k-- ) {
for ( k = out.width - 1; k > j + 3; --k ) {
expand[i][k] = expand[i][k - 2];
}
expand[i][j + 1] = prev;
@ -378,7 +378,7 @@ mesh_t *SubdivideMesh( mesh_t in, float maxError, float minLength ){
// vertical subdivisions
for ( j = 0; j + 2 < out.height; j += 2 ) {
// check subdivided midpoints against control points
for ( i = 0 ; i < out.width ; i++ ) {
for ( i = 0; i < out.width; ++i ) {
prevxyz = expand[j + 1][i].xyz - expand[j][i].xyz;
nextxyz = expand[j + 2][i].xyz - expand[j + 1][i].xyz;
midxyz = ( expand[j][i].xyz + expand[j + 1][i].xyz * 2 + expand[j + 2][i].xyz ) * 0.25;
@ -405,12 +405,12 @@ mesh_t *SubdivideMesh( mesh_t in, float maxError, float minLength ){
// insert two columns and replace the peak
out.height += 2;
for ( i = 0 ; i < out.width ; i++ ) {
for ( i = 0; i < out.width; ++i ) {
LerpDrawVert( &expand[j][i], &expand[j + 1][i], &prev );
LerpDrawVert( &expand[j + 1][i], &expand[j + 2][i], &next );
LerpDrawVert( &prev, &next, &mid );
for ( k = out.height - 1 ; k > j + 3 ; k-- ) {
for ( k = out.height - 1; k > j + 3; --k ) {
expand[k][i] = expand[k - 2][i];
}
expand[j + 1][i] = prev;
@ -426,7 +426,7 @@ mesh_t *SubdivideMesh( mesh_t in, float maxError, float minLength ){
// collapse the verts
out.verts = &expand[0][0];
for ( i = 1 ; i < out.height ; i++ ) {
for ( i = 1; i < out.height; ++i ) {
memmove( &out.verts[i * out.width], expand[i], out.width * sizeof( bspDrawVert_t ) );
}
@ -482,7 +482,7 @@ mesh_t *SubdivideMesh2( mesh_t in, int iterations ){
}
/* keep chopping */
for ( ; iterations > 0; iterations-- )
for ( ; iterations > 0; --iterations )
{
/* horizontal subdivisions */
for ( j = 0; j + 2 < out.width; j += 4 )
@ -500,7 +500,7 @@ mesh_t *SubdivideMesh2( mesh_t in, int iterations ){
LerpDrawVert( &expand[ i ][ j + 1 ], &expand[ i ][ j + 2 ], &next );
LerpDrawVert( &prev, &next, &mid );
for ( k = out.width - 1 ; k > j + 3; k-- )
for ( k = out.width - 1; k > j + 3; --k )
expand [ i ][ k ] = expand[ i ][ k - 2 ];
expand[ i ][ j + 1 ] = prev;
expand[ i ][ j + 2 ] = mid;
@ -576,35 +576,35 @@ mesh_t *RemoveLinearMeshColumnsRows( mesh_t *in ) {
out.width = in->width;
out.height = in->height;
for ( i = 0 ; i < in->width ; i++ ) {
for ( j = 0 ; j < in->height ; j++ ) {
for ( i = 0; i < in->width; ++i ) {
for ( j = 0; j < in->height; ++j ) {
expand[j][i] = in->verts[j * in->width + i];
}
}
for ( j = 1 ; j < out.width - 1; j++ ) {
for ( j = 1; j < out.width - 1; ++j ) {
double maxLength = 0;
for ( i = 0 ; i < out.height ; i++ ) {
for ( i = 0; i < out.height; ++i ) {
value_maximize( maxLength, vector3_length( expand[i][j].xyz - ProjectPointOntoVector( expand[i][j].xyz, expand[i][j - 1].xyz, expand[i][j + 1].xyz ) ) );
}
if ( maxLength < 0.1 ) {
out.width--;
for ( i = 0 ; i < out.height ; i++ ) {
for ( k = j; k < out.width; k++ ) {
for ( i = 0; i < out.height; ++i ) {
for ( k = j; k < out.width; ++k ) {
expand[i][k] = expand[i][k + 1];
}
}
j--;
}
}
for ( j = 1 ; j < out.height - 1; j++ ) {
for ( j = 1; j < out.height - 1; ++j ) {
double maxLength = 0;
for ( i = 0 ; i < out.width ; i++ ) {
for ( i = 0; i < out.width; ++i ) {
value_maximize( maxLength, vector3_length( expand[j][i].xyz - ProjectPointOntoVector( expand[j][i].xyz, expand[j - 1][i].xyz, expand[j + 1][i].xyz ) ) );
}
if ( maxLength < 0.1 ) {
out.height--;
for ( i = 0 ; i < out.width ; i++ ) {
for ( i = 0; i < out.width; ++i ) {
for ( k = j; k < out.height; k++ ) {
expand[k][i] = expand[k + 1][i];
}
@ -614,7 +614,7 @@ mesh_t *RemoveLinearMeshColumnsRows( mesh_t *in ) {
}
// collapse the verts
out.verts = &expand[0][0];
for ( i = 1 ; i < out.height ; i++ ) {
for ( i = 1; i < out.height; ++i ) {
memmove( &out.verts[i * out.width], expand[i], out.width * sizeof( bspDrawVert_t ) );
}
@ -636,8 +636,8 @@ mesh_t *SubdivideMeshQuads( mesh_t *in, float minLength, int maxsize, int *width
out.width = in->width;
out.height = in->height;
for ( i = 0 ; i < in->width ; i++ ) {
for ( j = 0 ; j < in->height ; j++ ) {
for ( i = 0; i < in->width; ++i ) {
for ( j = 0; j < in->height; ++j ) {
expand[j][i] = in->verts[j * in->width + i];
}
}
@ -650,9 +650,9 @@ mesh_t *SubdivideMeshQuads( mesh_t *in, float minLength, int maxsize, int *width
maxsubdivisions = ( maxsize - in->width ) / ( in->width - 1 );
for ( w = 0, j = 0 ; w < in->width - 1; w++, j += subdivisions + 1 ) {
for ( w = 0, j = 0; w < in->width - 1; ++w, j += subdivisions + 1 ) {
double maxLength = 0;
for ( i = 0 ; i < out.height ; i++ ) {
for ( i = 0; i < out.height; ++i ) {
value_maximize( maxLength, vector3_length( expand[i][j + 1].xyz - expand[i][j].xyz ) );
}
@ -665,11 +665,11 @@ mesh_t *SubdivideMeshQuads( mesh_t *in, float minLength, int maxsize, int *width
out.width += subdivisions;
for ( i = 0 ; i < out.height ; i++ ) {
for ( k = out.width - 1 ; k > j + subdivisions; k-- ) {
for ( i = 0; i < out.height; ++i ) {
for ( k = out.width - 1; k > j + subdivisions; --k ) {
expand[i][k] = expand[i][k - subdivisions];
}
for ( k = 1; k <= subdivisions; k++ )
for ( k = 1; k <= subdivisions; ++k )
{
const float amount = (float) k / ( subdivisions + 1 );
LerpDrawVertAmount( &expand[i][j], &expand[i][j + subdivisions + 1], amount, &expand[i][j + k] );
@ -679,9 +679,9 @@ mesh_t *SubdivideMeshQuads( mesh_t *in, float minLength, int maxsize, int *width
maxsubdivisions = ( maxsize - in->height ) / ( in->height - 1 );
for ( h = 0, j = 0 ; h < in->height - 1; h++, j += subdivisions + 1 ) {
for ( h = 0, j = 0; h < in->height - 1; ++h, j += subdivisions + 1 ) {
double maxLength = 0;
for ( i = 0 ; i < out.width ; i++ ) {
for ( i = 0; i < out.width; ++i ) {
value_maximize( maxLength, vector3_length( expand[j + 1][i].xyz - expand[j][i].xyz ) );
}
@ -694,11 +694,11 @@ mesh_t *SubdivideMeshQuads( mesh_t *in, float minLength, int maxsize, int *width
out.height += subdivisions;
for ( i = 0 ; i < out.width ; i++ ) {
for ( k = out.height - 1 ; k > j + subdivisions; k-- ) {
for ( i = 0; i < out.width; ++i ) {
for ( k = out.height - 1; k > j + subdivisions; --k ) {
expand[k][i] = expand[k - subdivisions][i];
}
for ( k = 1; k <= subdivisions; k++ )
for ( k = 1; k <= subdivisions; ++k )
{
const float amount = (float) k / ( subdivisions + 1 );
LerpDrawVertAmount( &expand[j][i], &expand[j + subdivisions + 1][i], amount, &expand[j + k][i] );
@ -708,7 +708,7 @@ mesh_t *SubdivideMeshQuads( mesh_t *in, float minLength, int maxsize, int *width
// collapse the verts
out.verts = &expand[0][0];
for ( i = 1 ; i < out.height ; i++ ) {
for ( i = 1; i < out.height; ++i ) {
memmove( &out.verts[i * out.width], expand[i], out.width * sizeof( bspDrawVert_t ) );
}

View File

@ -401,19 +401,19 @@ void PatchMapDrawSurfs( entity_t *e ){
bordering = safe_calloc( patchCount * patchCount );
// build the bordering matrix
for ( k = 0 ; k < patchCount ; k++ ) {
for ( k = 0; k < patchCount; ++k ) {
bordering[k * patchCount + k] = 1;
for ( l = k + 1 ; l < patchCount ; l++ ) {
for ( l = k + 1; l < patchCount; ++l ) {
check = meshes[k];
scan = meshes[l];
c1 = scan->mesh.width * scan->mesh.height;
v1 = scan->mesh.verts;
for ( i = 0 ; i < c1 ; i++, v1++ ) {
for ( i = 0; i < c1; ++i, ++v1 ) {
c2 = check->mesh.width * check->mesh.height;
v2 = check->mesh.verts;
for ( j = 0 ; j < c2 ; j++, v2++ ) {
for ( j = 0; j < c2; ++j, ++v2 ) {
if ( vector3_equal_epsilon( v1->xyz, v2->xyz, 1.f ) ) {
break;
}

View File

@ -167,8 +167,8 @@ void MakeHeadnodePortals( tree_t& tree ){
tree.outside_node.portals = NULL;
tree.outside_node.opaque = false;
for ( int i = 0 ; i < 3 ; i++ )
for ( int j = 0 ; j < 2 ; j++ )
for ( int i = 0; i < 3; ++i )
for ( int j = 0; j < 2; ++j )
{
portal_t *p = portals[j * 3 + i] = AllocPortal();
@ -184,9 +184,9 @@ void MakeHeadnodePortals( tree_t& tree ){
}
// clip the basewindings by all the other planes
for ( int i = 0 ; i < 6 ; i++ )
for ( int i = 0; i < 6; ++i )
{
for ( int j = 0 ; j < 6 ; j++ )
for ( int j = 0; j < 6; ++j )
{
if ( j == i ) {
continue;

View File

@ -156,7 +156,7 @@ int AddEdge( bspDrawVert_t& dv1, bspDrawVert_t& dv2, bool createNonAxial ) {
}
}
for ( i = 0 ; i < numEdgeLines ; i++ ) {
for ( i = 0; i < numEdgeLines; ++i ) {
e = &edgeLines[i];
if ( !float_equal_epsilon( vector3_dot( v1, e->normal1 ), e->dist1, POINT_ON_LINE_EPSILON )
@ -413,7 +413,7 @@ void FixSurfaceJunctions( mapDrawSurface_t& ds ) {
// rotate the points so that the initial vertex is between
// two non-subdivided edges
for ( i = 0 ; i < numVerts ; i++ ) {
for ( i = 0; i < numVerts; ++i ) {
if ( originals[ ( i + 1 ) % numVerts ] == originals[ i ] ) {
continue;
}
@ -441,12 +441,12 @@ void FixSurfaceJunctions( mapDrawSurface_t& ds ) {
/*
memset ( &verts[numVerts], 0, sizeof( verts[numVerts] ) );
for ( i = 0 ; i < numVerts ; i++ ) {
for ( j = 0 ; j < 10 ; j++ ) {
for ( i = 0; i < numVerts; ++i ) {
for ( j = 0; j < 10; ++j ) {
verts[numVerts].xyz[j] += verts[i].xyz[j];
}
}
for ( j = 0 ; j < 10 ; j++ ) {
for ( j = 0; j < 10; ++j ) {
verts[numVerts].xyz[j] /= numVerts;
}
@ -463,7 +463,7 @@ void FixSurfaceJunctions( mapDrawSurface_t& ds ) {
ds.numVerts = numVerts;
ds.verts = safe_malloc( numVerts * sizeof( *ds.verts ) );
for ( j = 0 ; j < ds.numVerts ; j++ ) {
for ( j = 0; j < ds.numVerts; ++j ) {
ds.verts[j] = verts[ ( j + i ) % ds.numVerts ];
}
}

View File

@ -300,7 +300,7 @@ void CalcVis( void ){
// assemble the leaf vis lists by oring and compressing the portal lists
//
Sys_Printf( "creating leaf vis...\n" );
for ( i = 0 ; i < portalclusters ; i++ )
for ( i = 0; i < portalclusters; ++i )
ClusterMerge( i );
totalvis = 0;

View File

@ -125,7 +125,7 @@ fixedWinding_t *VisChopWinding( fixedWinding_t *in, pstack_t *stack, const visP
counts[0] = counts[1] = counts[2] = 0;
// determine sides for each point
for ( i = 0 ; i < in->numpoints ; i++ )
for ( i = 0; i < in->numpoints; ++i )
{
dists[i] = plane3_distance_to_point( split, in->points[i] );
if ( dists[i] > ON_EPSILON ) {
@ -157,7 +157,7 @@ fixedWinding_t *VisChopWinding( fixedWinding_t *in, pstack_t *stack, const visP
neww->numpoints = 0;
for ( i = 0 ; i < in->numpoints ; i++ )
for ( i = 0; i < in->numpoints; ++i )
{
const Vector3& p1 = in->points[i];
@ -190,7 +190,7 @@ fixedWinding_t *VisChopWinding( fixedWinding_t *in, pstack_t *stack, const visP
const Vector3& p2 = in->points[( i + 1 ) % in->numpoints];
dot = dists[i] / ( dists[i] - dists[i + 1] );
for ( j = 0 ; j < 3 ; j++ )
for ( j = 0; j < 3; ++j )
{ // avoid round off error when possible
if ( split.normal()[j] == 1 ) {
mid[j] = split.dist();
@ -236,14 +236,14 @@ fixedWinding_t *ClipToSeperators( fixedWinding_t *source, fixedWinding_t *pass,
bool fliptest;
// check all combinations
for ( i = 0 ; i < source->numpoints ; i++ )
for ( i = 0; i < source->numpoints; ++i )
{
l = ( i + 1 ) % source->numpoints;
// find a vertex of pass that makes a plane that puts all of the
// vertexes of pass on the front side and all of the vertexes of
// source on the back side
for ( j = 0 ; j < pass->numpoints ; j++ )
for ( j = 0; j < pass->numpoints; ++j )
{
visPlane_t plane;
// if points don't make a valid plane, skip it
@ -257,7 +257,7 @@ fixedWinding_t *ClipToSeperators( fixedWinding_t *source, fixedWinding_t *pass,
//
#if 1
fliptest = false;
for ( k = 0 ; k < source->numpoints ; k++ )
for ( k = 0; k < source->numpoints; ++k )
{
if ( k == i || k == l ) {
continue;
@ -292,7 +292,7 @@ fixedWinding_t *ClipToSeperators( fixedWinding_t *source, fixedWinding_t *pass,
// this is the separating plane
//
counts[0] = counts[1] = counts[2] = 0;
for ( k = 0 ; k < pass->numpoints ; k++ )
for ( k = 0; k < pass->numpoints; ++k )
{
if ( k == j ) {
continue;
@ -444,7 +444,7 @@ void RecursiveLeafFlow( int leafnum, threaddata_t *thread, pstack_t *prevstack )
more = 0;
prevmight = (long *)prevstack->mightsee;
for ( j = 0 ; j < portallongs ; j++ )
for ( j = 0; j < portallongs; ++j )
{
might[j] = prevmight[j] & test[j];
more |= ( might[j] & ~vis[j] );
@ -618,7 +618,7 @@ void PortalFlow( int portalnum ){
data.pstack_head.source = p->winding;
data.pstack_head.portalplane = p->plane;
data.pstack_head.depth = 0;
for ( i = 0 ; i < portallongs ; i++ )
for ( i = 0; i < portallongs; ++i )
( (long *)data.pstack_head.mightsee )[i] = ( (long *)p->portalflood )[i];
RecursiveLeafFlow( p->leaf, &data, &data.pstack_head );
@ -743,7 +743,7 @@ void PassageFlow( int portalnum ){
data.pstack_head.source = p->winding;
data.pstack_head.portalplane = p->plane;
data.pstack_head.depth = 0;
for ( i = 0 ; i < portallongs ; i++ )
for ( i = 0; i < portallongs; ++i )
( (long *)data.pstack_head.mightsee )[i] = ( (long *)p->portalflood )[i];
RecursivePassageFlow( p, &data, &data.pstack_head );
@ -998,7 +998,7 @@ void PassagePortalFlow( int portalnum ){
data.pstack_head.source = p->winding;
data.pstack_head.portalplane = p->plane;
data.pstack_head.depth = 0;
for ( i = 0 ; i < portallongs ; i++ )
for ( i = 0; i < portallongs; ++i )
( (long *)data.pstack_head.mightsee )[i] = ( (long *)p->portalflood )[i];
RecursivePassagePortalFlow( p, &data, &data.pstack_head );
@ -1025,7 +1025,7 @@ fixedWinding_t *PassageChopWinding( fixedWinding_t *in, fixedWinding_t *out, con
counts[0] = counts[1] = counts[2] = 0;
// determine sides for each point
for ( i = 0 ; i < in->numpoints ; i++ )
for ( i = 0; i < in->numpoints; ++i )
{
dists[i] = plane3_distance_to_point( split, in->points[i] );
if ( dists[i] > ON_EPSILON ) {
@ -1056,7 +1056,7 @@ fixedWinding_t *PassageChopWinding( fixedWinding_t *in, fixedWinding_t *out, con
neww->numpoints = 0;
for ( i = 0 ; i < in->numpoints ; i++ )
for ( i = 0; i < in->numpoints; ++i )
{
const Vector3& p1 = in->points[i];
@ -1087,7 +1087,7 @@ fixedWinding_t *PassageChopWinding( fixedWinding_t *in, fixedWinding_t *out, con
const Vector3& p2 = in->points[( i + 1 ) % in->numpoints];
dot = dists[i] / ( dists[i] - dists[i + 1] );
for ( j = 0 ; j < 3 ; j++ )
for ( j = 0; j < 3; ++j )
{ // avoid round off error when possible
if ( split.normal()[j] == 1 ) {
mid[j] = split.dist();
@ -1119,14 +1119,14 @@ int AddSeperators( const fixedWinding_t *source, const fixedWinding_t *pass, boo
numseperators = 0;
// check all combinations
for ( i = 0 ; i < source->numpoints ; i++ )
for ( i = 0; i < source->numpoints; ++i )
{
l = ( i + 1 ) % source->numpoints;
// find a vertex of pass that makes a plane that puts all of the
// vertexes of pass on the front side and all of the vertexes of
// source on the back side
for ( j = 0 ; j < pass->numpoints ; j++ )
for ( j = 0; j < pass->numpoints; ++j )
{
visPlane_t plane;
// if points don't make a valid plane, skip it
@ -1140,7 +1140,7 @@ int AddSeperators( const fixedWinding_t *source, const fixedWinding_t *pass, boo
//
#if 1
fliptest = false;
for ( k = 0 ; k < source->numpoints ; k++ )
for ( k = 0; k < source->numpoints; ++k )
{
if ( k == i || k == l ) {
continue;
@ -1175,7 +1175,7 @@ int AddSeperators( const fixedWinding_t *source, const fixedWinding_t *pass, boo
// this is the separating plane
//
counts[0] = counts[1] = counts[2] = 0;
for ( k = 0 ; k < pass->numpoints ; k++ )
for ( k = 0; k < pass->numpoints; ++k )
{
if ( k == j ) {
continue;
@ -1465,7 +1465,7 @@ void BasePortalVis( int portalnum ){
p->portalflood = safe_calloc( portalbytes );
p->portalvis = safe_calloc( portalbytes );
for ( j = 0, tp = portals ; j < numportals * 2 ; j++, tp++ )
for ( j = 0, tp = portals; j < numportals * 2; ++j, ++tp )
{
if ( j == portalnum ) {
continue;
@ -1507,7 +1507,7 @@ void BasePortalVis( int portalnum ){
w = tp->winding;
for ( k = 0 ; k < w->numpoints ; k++ )
for ( k = 0; k < w->numpoints; ++k )
{
if ( plane3_distance_to_point( p->plane, w->points[k] ) > ON_EPSILON ) {
break;
@ -1518,7 +1518,7 @@ void BasePortalVis( int portalnum ){
}
w = p->winding;
for ( k = 0 ; k < w->numpoints ; k++ )
for ( k = 0; k < w->numpoints; ++k )
{
if ( plane3_distance_to_point( tp->plane, w->points[k] ) < -ON_EPSILON ) {
break;