diff --git a/contrib/bkgrnd2d/bkgrnd2d.cpp b/contrib/bkgrnd2d/bkgrnd2d.cpp index c53f0169..085d404e 100644 --- a/contrib/bkgrnd2d/bkgrnd2d.cpp +++ b/contrib/bkgrnd2d/bkgrnd2d.cpp @@ -250,16 +250,16 @@ static bool get_selection_bounds( vec3_t mins, vec3_t maxs ){ return false; } - for ( i = 0 ; i < 3 ; i++ ) + for ( i = 0; i < 3; i++ ) { mins[i] = 99999; maxs[i] = -99999; } - for ( b = selected_brushes->next ; b != selected_brushes ; b = b->next ) + for ( b = selected_brushes->next; b != selected_brushes; b = b->next ) { if ( b->owner->eclass->fixedsize ) { - for ( i = 0 ; i < 3 ; i++ ) + for ( i = 0; i < 3; i++ ) { if ( b->owner->origin[i] < mins[i] ) { mins[i] = b->owner->origin[i]; @@ -271,7 +271,7 @@ static bool get_selection_bounds( vec3_t mins, vec3_t maxs ){ } else { - for ( i = 0 ; i < 3 ; i++ ) + for ( i = 0; i < 3; i++ ) { if ( b->mins[i] < mins[i] ) { mins[i] = b->mins[i]; diff --git a/contrib/bkgrnd2d/plugin.cpp b/contrib/bkgrnd2d/plugin.cpp index 29d0deba..67ec8296 100644 --- a/contrib/bkgrnd2d/plugin.cpp +++ b/contrib/bkgrnd2d/plugin.cpp @@ -150,7 +150,7 @@ public: } virtual void activate() const { bi->func(); - return ; + return; } virtual EType getType() const { return bi->type; diff --git a/contrib/bobtoolz/DPatch.cpp b/contrib/bobtoolz/DPatch.cpp index 26a6e541..fc55a904 100644 --- a/contrib/bobtoolz/DPatch.cpp +++ b/contrib/bobtoolz/DPatch.cpp @@ -326,7 +326,7 @@ DPatch* DPatch::MergePatches( patch_merge_t merge_info, DPatch& p1, DPatch& p2 ) void DPatch::Invert(){ int i, j; - for ( i = 0 ; i < width ; i++ ) + for ( i = 0; i < width; i++ ) { for ( j = 0; j < height / 2; j++ ) { @@ -378,9 +378,9 @@ void DPatch::Transpose(){ int i, j; if ( width > height ) { - for ( i = 0 ; i < height ; i++ ) + for ( i = 0; i < height; i++ ) { - for ( j = i + 1 ; j < width ; j++ ) + for ( j = i + 1; j < width; j++ ) { if ( j < height ) { // swap the value @@ -396,9 +396,9 @@ void DPatch::Transpose(){ } else { - for ( i = 0 ; i < width ; i++ ) + for ( i = 0; i < width; i++ ) { - for ( j = i + 1 ; j < height ; j++ ) + for ( j = i + 1; j < height; j++ ) { if ( j < width ) { // swap the value diff --git a/contrib/bobtoolz/DPlane.cpp b/contrib/bobtoolz/DPlane.cpp index 24624f1b..f405e63c 100644 --- a/contrib/bobtoolz/DPlane.cpp +++ b/contrib/bobtoolz/DPlane.cpp @@ -153,7 +153,7 @@ DWinding* DPlane::BaseWindingForPlane(){ max = -131072; x = -1; - for ( i = 0 ; i < 3; i++ ) + for ( i = 0; i < 3; i++ ) { v = (float)fabs( normal[i] ); if ( v > max ) { diff --git a/contrib/bobtoolz/DWinding.cpp b/contrib/bobtoolz/DWinding.cpp index ae0714cf..454ac4d6 100644 --- a/contrib/bobtoolz/DWinding.cpp +++ b/contrib/bobtoolz/DWinding.cpp @@ -62,7 +62,7 @@ vec_t DWinding::WindingArea(){ vec_t total; total = 0; - for ( int i = 2; i < numpoints ; i++ ) + for ( int i = 2; i < numpoints; i++ ) { VectorSubtract( p[i - 1], p[0], d1 ); VectorSubtract( p[i], p[0], d2 ); @@ -117,7 +117,7 @@ void DWinding::WindingBounds( vec3_t mins, vec3_t maxs ){ VectorCopy( mins, p[0] ); VectorCopy( maxs, p[0] ); - for ( int i = 1; i < numpoints ; i++ ) + for ( int i = 1; i < numpoints; i++ ) { for ( int j = 0; j < 3; j++ ) { @@ -229,7 +229,7 @@ void DWinding::CheckWinding(){ edgedist = DotProduct( p1, edgenormal ); // all other points must be on front side - for ( j = 0 ; j < numpoints ; j++ ) + for ( j = 0; j < numpoints; j++ ) { if ( j == i ) { continue; @@ -249,7 +249,7 @@ DWinding* DWinding::ReverseWinding(){ DWinding* c = new DWinding; c->AllocWinding( numpoints ); - for ( int i = 0; i < numpoints ; i++ ) + for ( int i = 0; i < numpoints; i++ ) VectorCopy( p[numpoints - 1 - i], c->p[i] ); return c; @@ -414,7 +414,7 @@ void DWinding::ClipWindingEpsilon( DPlane* chopPlane, vec_t epsilon, DWinding ** *front = f; *back = b; - for ( i = 0; i < numpoints ; i++ ) + for ( i = 0; i < numpoints; i++ ) { p1 = p[i]; diff --git a/contrib/bobtoolz/bsploader.cpp b/contrib/bobtoolz/bsploader.cpp index 468ca147..a1e6f678 100644 --- a/contrib/bobtoolz/bsploader.cpp +++ b/contrib/bobtoolz/bsploader.cpp @@ -97,7 +97,7 @@ void SwapBlock( int *block, int sizeOfBlock ) { int i; sizeOfBlock >>= 2; - for ( i = 0 ; i < sizeOfBlock ; i++ ) { + for ( i = 0; i < sizeOfBlock; i++ ) { block[i] = LittleLong( block[i] ); } } @@ -116,7 +116,7 @@ void SwapBSPFile( void ) { // SwapBlock( (int *)dmodels, nummodels * sizeof( dmodels[0] ) ); // shaders (don't swap the name) -// for ( i = 0 ; i < numShaders ; i++ ) { +// for ( i = 0; i < numShaders; i++ ) { // dshaders[i].contentFlags = LittleLong( dshaders[i].contentFlags ); // dshaders[i].surfaceFlags = LittleLong( dshaders[i].surfaceFlags ); // } @@ -147,7 +147,7 @@ void SwapBSPFile( void ) { ( (int *)&visBytes )[1] = LittleLong( ( (int *)&visBytes )[1] ); // drawverts (don't swap colors ) - for ( i = 0 ; i < numDrawVerts ; i++ ) { + for ( i = 0; i < numDrawVerts; i++ ) { drawVerts[i].lightmap[0] = LittleFloat( drawVerts[i].lightmap[0] ); drawVerts[i].lightmap[1] = LittleFloat( drawVerts[i].lightmap[1] ); drawVerts[i].st[0] = LittleFloat( drawVerts[i].st[0] ); @@ -167,7 +167,7 @@ void SwapBSPFile( void ) { SwapBlock( (int *)drawSurfaces, numDrawSurfaces * sizeof( drawSurfaces[0] ) ); // fogs -// for ( i = 0 ; i < numFogs ; i++ ) { +// for ( i = 0; i < numFogs; i++ ) { // dfogs[i].brushNum = LittleLong( dfogs[i].brushNum ); // dfogs[i].visibleSide = LittleLong( dfogs[i].visibleSide ); // } diff --git a/contrib/bobtoolz/cportals.cpp b/contrib/bobtoolz/cportals.cpp index 7a7d229c..6674f169 100644 --- a/contrib/bobtoolz/cportals.cpp +++ b/contrib/bobtoolz/cportals.cpp @@ -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; diff --git a/contrib/bobtoolz/misc.cpp b/contrib/bobtoolz/misc.cpp index 39d6bafa..0cd8d940 100644 --- a/contrib/bobtoolz/misc.cpp +++ b/contrib/bobtoolz/misc.cpp @@ -129,7 +129,7 @@ char* TranslateString( char *buf ){ std::size_t l = strlen( buf ); char* out = buf2; - for ( std::size_t i = 0 ; i < l ; i++ ) + for ( std::size_t i = 0; i < l; i++ ) { if ( buf[i] == '\n' ) { *out++ = '\r'; diff --git a/contrib/bobtoolz/shapes.cpp b/contrib/bobtoolz/shapes.cpp index 06e90bda..4c9e020b 100644 --- a/contrib/bobtoolz/shapes.cpp +++ b/contrib/bobtoolz/shapes.cpp @@ -622,7 +622,7 @@ void MakeBevel( vec3_t vMin, vec3_t vMax ){ } } //does invert the matrix, else the patch face is on wrong side. - for ( int i = 0 ; i < 3 ; i++ ) + for ( int i = 0; i < 3; i++ ) { for ( int j = 0; j < 1; j++ ) { diff --git a/contrib/hydratoolz/plugin.cpp b/contrib/hydratoolz/plugin.cpp index d43ab7af..4b695633 100644 --- a/contrib/hydratoolz/plugin.cpp +++ b/contrib/hydratoolz/plugin.cpp @@ -291,7 +291,7 @@ GSList *AddToWadList( GSList *wadlist, const char *shadername, const char *wad ) wadname = strdup( wad ); } - for ( GSList *l = wadlist; l != NULL ; l = l->next ) + for ( GSList *l = wadlist; l != NULL; l = l->next ) { if ( string_equal_nocase( (char *)l->data,wadname ) ) { free( wadname ); @@ -380,7 +380,7 @@ void UpdateWadKeyPair( void ){ } else { - for ( f = b->brush_faces ; f ; f = f->next ) + for ( f = b->brush_faces; f; f = f->next ) { wadlist = AddToWadList( wadlist, f->pShader->getName(),NULL ); } @@ -397,7 +397,7 @@ void UpdateWadKeyPair( void ){ } else { - for ( f = b->brush_faces ; f ; f = f->next ) + for ( f = b->brush_faces; f; f = f->next ) { wadlist = AddToWadList( wadlist, f->pShader->getName(),NULL ); } diff --git a/contrib/prtview/portals.cpp b/contrib/prtview/portals.cpp index fcf0eec2..55d754d7 100644 --- a/contrib/prtview/portals.cpp +++ b/contrib/prtview/portals.cpp @@ -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; diff --git a/libs/l_net/l_net_berkley.c b/libs/l_net/l_net_berkley.c index f2018ae9..25ca1b74 100644 --- a/libs/l_net/l_net_berkley.c +++ b/libs/l_net/l_net_berkley.c @@ -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 diff --git a/libs/l_net/l_net_wins.c b/libs/l_net/l_net_wins.c index 48bc7e76..331f7d1b 100644 --- a/libs/l_net/l_net_wins.c +++ b/libs/l_net/l_net_wins.c @@ -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 diff --git a/libs/mathlib/mathlib.c b/libs/mathlib/mathlib.c index e88d9b54..a264d326 100644 --- a/libs/mathlib/mathlib.c +++ b/libs/mathlib/mathlib.c @@ -101,7 +101,7 @@ vec_t VectorLength( const vec3_t v ){ float length; length = 0.0f; - for ( i = 0 ; i < 3 ; i++ ) + for ( i = 0; i < 3; i++ ) length += v[i] * v[i]; length = (float)sqrt( length ); @@ -111,7 +111,7 @@ vec_t VectorLength( const vec3_t v ){ bool VectorCompare( const vec3_t v1, const vec3_t v2 ){ int i; - for ( i = 0 ; i < 3 ; i++ ) + for ( i = 0; i < 3; i++ ) if ( fabs( v1[i] - v2[i] ) > EQUAL_EPSILON ) { return false; } @@ -290,7 +290,7 @@ void VectorSnap( vec3_t v ){ void VectorISnap( vec3_t point, int snap ){ int i; - for ( i = 0 ; i < 3 ; i++ ) + for ( i = 0; i < 3; i++ ) { point[i] = (vec_t)FLOAT_SNAP( point[i], snap ); } @@ -298,7 +298,7 @@ void VectorISnap( vec3_t point, int snap ){ void VectorFSnap( vec3_t point, float snap ){ int i; - for ( i = 0 ; i < 3 ; i++ ) + for ( i = 0; i < 3; i++ ) { point[i] = (vec_t)FLOAT_SNAP( point[i], snap ); } @@ -344,7 +344,7 @@ void AddPointToBounds( vec3_t v, vec3_t mins, vec3_t maxs ){ } } - for ( i = 0 ; i < 3 ; i++ ) + for ( i = 0; i < 3; i++ ) { val = v[i]; if ( val < mins[i] ) { diff --git a/libs/picomodel/picointernal.c b/libs/picomodel/picointernal.c index b58f0b00..4405f82f 100644 --- a/libs/picomodel/picointernal.c +++ b/libs/picomodel/picointernal.c @@ -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: diff --git a/libs/picomodel/picomodel.c b/libs/picomodel/picomodel.c index 0a62adee..1dd19195 100644 --- a/libs/picomodel/picomodel.c +++ b/libs/picomodel/picomodel.c @@ -480,7 +480,7 @@ void PicoFreeShader( picoShader_t *shader ){ picoShader_t *PicoFindShader( picoModel_t *model, char *name, int caseSensitive ){ int i; - + /* sanity checks */ if ( model == NULL || name == NULL ) { /* sea: null name fix */ return NULL; @@ -2249,7 +2249,7 @@ void PicoAddTriangleToModel( picoModel_t *model, picoVec3_t** xyz, picoVec3_t** picoSurface_t* workSurface = NULL; /* see if a surface already has the shader */ - for ( i = 0 ; i < model->numSurfaces ; i++ ) + for ( i = 0; i < model->numSurfaces; i++ ) { workSurface = model->surface[i]; if ( !name || !strcmp( workSurface->name, name ) ) { @@ -2275,7 +2275,7 @@ void PicoAddTriangleToModel( picoModel_t *model, picoVec3_t** xyz, picoVec3_t** } /* add the triangle data to the surface */ - for ( i = 0 ; i < 3 ; i++ ) + for ( i = 0; i < 3; i++ ) { /* get the next free spot in the index array */ int newVertIndex = PicoGetSurfaceNumIndexes( workSurface ); @@ -2293,11 +2293,11 @@ void PicoAddTriangleToModel( picoModel_t *model, picoVec3_t** xyz, picoVec3_t** PicoSetSurfaceNormal( workSurface, vertDataIndex, *normals[i] ); /* make sure to copy over all available ST's and colors for the vertex */ - for ( j = 0 ; j < numColors ; j++ ) + for ( j = 0; j < numColors; j++ ) { PicoSetSurfaceColor( workSurface, j, vertDataIndex, colors[i][j] ); } - for ( j = 0 ; j < numSTs ; j++ ) + for ( j = 0; j < numSTs; j++ ) { PicoSetSurfaceST( workSurface, j, vertDataIndex, st[i][j] ); } diff --git a/libs/picomodel/picomodules.c b/libs/picomodel/picomodules.c index 4e7b2e9e..d5727aff 100644 --- a/libs/picomodel/picomodules.c +++ b/libs/picomodel/picomodules.c @@ -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 */ diff --git a/libs/picomodel/pm_ase.c b/libs/picomodel/pm_ase.c index bab7e013..86fa6062 100644 --- a/libs/picomodel/pm_ase.c +++ b/libs/picomodel/pm_ase.c @@ -259,7 +259,7 @@ typedef aseFace_t* aseFacesIter_t; picoSurface_t* PicoModelFindOrAddSurface( picoModel_t *model, picoShader_t* shader ){ /* see if a surface already has the shader */ int i = 0; - for ( ; i < model->numSurfaces ; i++ ) + for ( ; i < model->numSurfaces; i++ ) { picoSurface_t* workSurface = model->surface[i]; if ( workSurface->shader == shader ) { @@ -377,7 +377,7 @@ static void _ase_submit_triangles_unshared( picoModel_t* model, aseMaterial_t* m picoSurface_t* surface = PicoModelFindOrAddSurface( model, subMtl->shader ); int j; /* we pull the data from the vertex, color and texcoord arrays using the face index data */ - for ( j = 0 ; j < 3 ; j++ ) + for ( j = 0; j < 3; j++ ) { picoIndex_t index = (picoIndex_t)( ( ( i - faces ) * 3 ) + j ); picoIndex_t size = (picoIndex_t)aseUniqueIndices_size( &indices ); @@ -433,7 +433,7 @@ static void _ase_submit_triangles( picoModel_t* model, aseMaterial_t* materials, picoIndex_t smooth[3]; int j; /* we pull the data from the vertex, color and texcoord arrays using the face index data */ - for ( j = 0 ; j < 3 ; j++ ) + for ( j = 0; j < 3; j++ ) { xyz[j] = &vertices[( *i ).indices[j]].xyz; normal[j] = &vertices[( *i ).indices[j]].normal; diff --git a/libs/signal/signal.h b/libs/signal/signal.h index 72632eab..e1e1333b 100644 --- a/libs/signal/signal.h +++ b/libs/signal/signal.h @@ -297,7 +297,7 @@ public: // It is safe to disconnect the signal handler currently being invoked. template 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 diff --git a/plugins/entity/targetable.h b/plugins/entity/targetable.h index f110533e..27a1a65c 100644 --- a/plugins/entity/targetable.h +++ b/plugins/entity/targetable.h @@ -195,7 +195,7 @@ public: Vector3 hack( 0.57735f, 0.57735f, 0.57735f ); int maxI = 0; float max = 0; - for ( int i = 0; i < 3 ; ++i ){ + for ( int i = 0; i < 3; ++i ){ if ( dir[i] < 0 ){ hack[i] *= -1.f; } diff --git a/plugins/md3model/mdlimage.cpp b/plugins/md3model/mdlimage.cpp index 3ab4e9e0..8a2adad2 100644 --- a/plugins/md3model/mdlimage.cpp +++ b/plugins/md3model/mdlimage.cpp @@ -50,12 +50,12 @@ void Texture_InitPalette( byte *pal ){ gamma = 1.0; //g_qeglobals.d_savedinfo.fGamma; if ( gamma == 1.0 ) { - for ( i = 0 ; i < 256 ; i++ ) + for ( i = 0; i < 256; i++ ) gammatable[i] = i; } else { - for ( i = 0 ; i < 256 ; i++ ) + for ( i = 0; i < 256; i++ ) { inf = (int)( 255 * pow( ( i + 0.5 ) / 255.5, gamma ) + 0.5 ); if ( inf < 0 ) { @@ -68,7 +68,7 @@ void Texture_InitPalette( byte *pal ){ } } - for ( i = 0 ; i < 256 ; i++ ) + for ( i = 0; i < 256; i++ ) { r = gammatable[pal[0]]; g = gammatable[pal[1]]; diff --git a/radiant/brush_primit.cpp b/radiant/brush_primit.cpp index c930f8eb..7739edd5 100644 --- a/radiant/brush_primit.cpp +++ b/radiant/brush_primit.cpp @@ -429,7 +429,7 @@ void AddPointToBounds( const Vector3& v, Vector3& mins, Vector3& maxs ){ int i; float val; - for ( i = 0 ; i < 3 ; i++ ) + for ( i = 0; i < 3; i++ ) { val = v[i]; if ( val < mins[i] ) { @@ -564,7 +564,7 @@ void EmitBrushPrimitTextureCoordinates( face_t * f, Winding * w ){ ConvertTexMatWithQTexture( &f->brushprimit_texdef, 0, &f->brushprimit_texdef, f->pShader->getTexture() ); } int i; - for ( i = 0 ; i < w.numpoints ; i++ ) + for ( i = 0; i < w.numpoints; i++ ) { x = vector3_dot( w.point_at( i ),texX ); y = vector3_dot( w.point_at( i ),texY ); @@ -842,14 +842,14 @@ void TextureLockTransformation_BrushPrimit( face_t *f ){ } else { - for ( j = 0 ; j < 3 ; j++ ) + for ( j = 0; j < 3; j++ ) rOrig[j] = vector3_dot( vector3_subtracted( Orig, txl_origin ), txl_matrix[j] ) + txl_origin[j]; - for ( j = 0 ; j < 3 ; j++ ) + for ( j = 0; j < 3; j++ ) rvecS[j] = vector3_dot( vector3_subtracted( texS, txl_origin ), txl_matrix[j] ) + txl_origin[j]; - for ( j = 0 ; j < 3 ; j++ ) + for ( j = 0; j < 3; j++ ) rvecT[j] = vector3_dot( vector3_subtracted( texT, txl_origin ), txl_matrix[j] ) + txl_origin[j]; // we also need the axis base of the target plane, apply the transformation matrix to the normal too.. - for ( j = 0 ; j < 3 ; j++ ) + for ( j = 0; j < 3; j++ ) rNormal[j] = vector3_dot( f->plane.normal, txl_matrix[j] ); } @@ -1103,7 +1103,7 @@ void BPTexdef_Rotate( brushprimit_texdef_t& bp_td, float angle ){ const float y1 = bp_td.coords[1][1]; const float s = sin( degrees_to_radians( -angle ) ); const float c = cos( degrees_to_radians( -angle ) ); - bp_td.coords[0][0] = x * c - y * s ; + bp_td.coords[0][0] = x * c - y * s; bp_td.coords[0][1] = x * s + y * c; bp_td.coords[1][0] = x1 * c - y1 * s; bp_td.coords[1][1] = x1 * s + y1 * c; diff --git a/radiant/brushmanip.cpp b/radiant/brushmanip.cpp index b181faca..e3d11084 100644 --- a/radiant/brushmanip.cpp +++ b/radiant/brushmanip.cpp @@ -141,7 +141,7 @@ void Brush_ConstructPrism( Brush& brush, const AABB& bounds, std::size_t sides, brush.addPlane( planepts[0], planepts[1], planepts[2], shader, projection ); - for ( std::size_t i = 0 ; i < sides ; ++i ) + for ( std::size_t i = 0; i < sides; ++i ) { const double sv = sin( i * c_2pi / sides ); const double cv = cos( i * c_2pi / sides ); @@ -192,7 +192,7 @@ void Brush_ConstructCone( Brush& brush, const AABB& bounds, std::size_t sides, c brush.addPlane( planepts[0], planepts[1], planepts[2], shader, projection ); - for ( std::size_t i = 0 ; i < sides ; ++i ) + for ( std::size_t i = 0; i < sides; ++i ) { double sv = sin( i * 3.14159265 * 2 / sides ); double cv = cos( i * 3.14159265 * 2 / sides ); diff --git a/radiant/brushxml.h b/radiant/brushxml.h index 11be5b49..f9e20a8d 100644 --- a/radiant/brushxml.h +++ b/radiant/brushxml.h @@ -217,9 +217,9 @@ inline void FacePlane_exportXML( const FacePlane& facePlane, XMLImporter& import { // write planepts - for ( int i = 0 ; i < 3 ; i++ ) + for ( int i = 0; i < 3; i++ ) { - for ( int j = 0 ; j < 3 ; j++ ) + for ( int j = 0; j < 3; j++ ) { importer << Face::m_quantise( facePlane.planePoints()[i][j] ) << ' '; } diff --git a/radiant/camwindow.cpp b/radiant/camwindow.cpp index f0c58e79..b581c6a0 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -251,7 +251,7 @@ void Camera_updateProjection( camera_t& camera ){ } void Camera_updateVectors( camera_t& camera ){ - for ( int i = 0 ; i < 3 ; i++ ) + for ( int i = 0; i < 3; i++ ) { camera.vright[i] = camera.modelview[( i << 2 ) + 0]; camera.vup[i] = camera.modelview[( i << 2 ) + 1]; @@ -2215,7 +2215,7 @@ void CamWnd::draw(){ void CamWnd::BenchMark(){ double dStart = Sys_DoubleTime(); - for ( int i = 0 ; i < 100 ; i++ ) + for ( int i = 0; i < 100; i++ ) { Vector3 angles; angles[CAMERA_ROLL] = 0; diff --git a/radiant/eclass_def.cpp b/radiant/eclass_def.cpp index b74f79cb..45951fd5 100644 --- a/radiant/eclass_def.cpp +++ b/radiant/eclass_def.cpp @@ -235,7 +235,7 @@ EntityClass *Eclass_InitFromText( const char *text ){ return 0; } - for ( int i = 0 ; i < 2 ; i++ ) + for ( int i = 0; i < 2; i++ ) { while ( *text != ')' ) { @@ -262,7 +262,7 @@ EntityClass *Eclass_InitFromText( const char *text ){ { // any remaining words are parm flags const char* p = parms; - for ( std::size_t i = 0 ; i < MAX_FLAGS ; i++ ) + for ( std::size_t i = 0; i < MAX_FLAGS; i++ ) { p = COM_Parse( p ); if ( !p ) { diff --git a/radiant/eclass_doom3.cpp b/radiant/eclass_doom3.cpp index 35e51a3e..a2c75b08 100644 --- a/radiant/eclass_doom3.cpp +++ b/radiant/eclass_doom3.cpp @@ -505,7 +505,7 @@ static bool EntityClass_parse( EntityClass& entityClass, Tokeniser& tokeniser ){ CopiedString tmp( key ); //ASSERT_MESSAGE( !string_equal_n( key, "editor_", 7 ), "unsupported editor key: " << makeQuoted( key ) ); if ( string_equal_n( key, "editor_", 7 ) ) { - globalErrorStream() << "unsupported editor key " << makeQuoted( key ) ; + globalErrorStream() << "unsupported editor key " << makeQuoted( key ); } EntityClassAttribute& attribute = EntityClass_insertAttribute( entityClass, key ).second; attribute.m_type = "string"; diff --git a/radiant/entityinspector.cpp b/radiant/entityinspector.cpp index 637cb8ab..ff4a872c 100644 --- a/radiant/entityinspector.cpp +++ b/radiant/entityinspector.cpp @@ -1003,7 +1003,7 @@ void SurfaceFlags_setEntityClass( EntityClass* eclass ){ { // do a first pass to count the spawn flags, don't touch the widgets, we don't know in what state they are - for ( int i = 0 ; i < MAX_FLAGS ; i++ ) + for ( int i = 0; i < MAX_FLAGS; i++ ) { if ( eclass->flagnames[i] && eclass->flagnames[i][0] != 0 && strcmp( eclass->flagnames[i],"-" ) ) { spawn_table[spawnflag_count] = i; diff --git a/radiant/qgl.cpp b/radiant/qgl.cpp index 627a6429..8e0b3936 100644 --- a/radiant/qgl.cpp +++ b/radiant/qgl.cpp @@ -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"; } diff --git a/radiant/selection.cpp b/radiant/selection.cpp index a6fe4a6d..e52cd799 100644 --- a/radiant/selection.cpp +++ b/radiant/selection.cpp @@ -554,7 +554,7 @@ public: vector3_scale( delta, m_axis ); Vector3 start( vector3_snapped( m_start, GetSnapGridSize() != 0.f ? GetSnapGridSize() : 1e-3f ) ); - for ( std::size_t i = 0; i < 3 ; ++i ){ //prevent snapping to 0 with big gridsize + for ( std::size_t i = 0; i < 3; ++i ){ //prevent snapping to 0 with big gridsize if( float_snapped( m_start[i], 1e-3f ) != 0.f && start[i] == 0.f ){ start[i] = GetSnapGridSize(); } @@ -627,7 +627,7 @@ public: delta = vector3_scaled( delta, m_axis ) + vector3_scaled( delta, m_axis2 ); Vector3 start( vector3_snapped( m_start, GetSnapGridSize() != 0.f ? GetSnapGridSize() : 1e-3f ) ); - for ( std::size_t i = 0; i < 3 ; ++i ){ //prevent snapping to 0 with big gridsize + for ( std::size_t i = 0; i < 3; ++i ){ //prevent snapping to 0 with big gridsize if( float_snapped( m_start[i], 1e-3f ) != 0.f && start[i] == 0.f ){ start[i] = GetSnapGridSize(); } @@ -6190,7 +6190,7 @@ public: case eUV: { const Vector3 uv_origin = matrix4_transformed_point( m_local2tex, m_origin ); - const Vector3 uv_start{ m_selectedV->vertex.x(), m_selectedU->vertex.y(), 0 } ; + const Vector3 uv_start{ m_selectedV->vertex.x(), m_selectedU->vertex.y(), 0 }; const Vector3 uv_current{ ( m_selectedV->vertex + matrix4_transformed_point( m_local2tex, current ) - matrix4_transformed_point( m_local2tex, m_start ) ).x(), ( m_selectedU->vertex + matrix4_transformed_point( m_local2tex, current ) - matrix4_transformed_point( m_local2tex, m_start ) ).y(), 0 }; @@ -6550,7 +6550,7 @@ public: current = vector3_subtracted( current, m_start ); if( snap ){ - for ( std::size_t i = 0; i < 3 ; ++i ){ + for ( std::size_t i = 0; i < 3; ++i ){ if( fabs( current[i] ) >= fabs( current[(i + 1) % 3] ) ){ current[(i + 1) % 3] = 0.f; } @@ -6561,7 +6561,7 @@ public: } bool set[3] = { true, true, true }; - for ( std::size_t i = 0; i < 3 ; ++i ){ + for ( std::size_t i = 0; i < 3; ++i ){ if( fabs( current[i] ) < 1e-3f ){ set[i] = false; } diff --git a/radiant/surfacedialog.cpp b/radiant/surfacedialog.cpp index cd599258..1751623a 100644 --- a/radiant/surfacedialog.cpp +++ b/radiant/surfacedialog.cpp @@ -482,7 +482,7 @@ void SurfaceInspector_ProjectTexture( GtkWidget* widget, EProjectTexture type ){ direction = g_vector3_axes[GlobalXYWnd_getCurrentViewType()]; break; case eProjectCam: - //direction = -g_pParentWnd->GetCamWnd()->getCamera().vpn ; + //direction = -g_pParentWnd->GetCamWnd()->getCamera().vpn; direction = -Camera_getViewVector( *g_pParentWnd->GetCamWnd() ); break; } diff --git a/radiant/textures.cpp b/radiant/textures.cpp index 5032eafa..bf9e6914 100644 --- a/radiant/textures.cpp +++ b/radiant/textures.cpp @@ -278,12 +278,12 @@ void Texture_InitPalette( byte *pal ){ gamma = g_texture_globals.fGamma; if ( gamma == 1.0 ) { - for ( i = 0 ; i < 256 ; i++ ) + for ( i = 0; i < 256; i++ ) gammatable[i] = i; } else { - for ( i = 0 ; i < 256 ; i++ ) + for ( i = 0; i < 256; i++ ) { inf = (int)( 255 * pow( ( i + 0.5 ) / 255.5, gamma ) + 0.5 ); if ( inf < 0 ) { @@ -296,7 +296,7 @@ void Texture_InitPalette( byte *pal ){ } } - for ( i = 0 ; i < 256 ; i++ ) + for ( i = 0; i < 256; i++ ) { r = gammatable[pal[0]]; g = gammatable[pal[1]]; diff --git a/radiant/winding.cpp b/radiant/winding.cpp index 566ea5c6..39f43f6c 100644 --- a/radiant/winding.cpp +++ b/radiant/winding.cpp @@ -128,7 +128,7 @@ void Winding_createInfinite( FixedWinding& winding, const Plane3& plane, double #if 0 double max = -infinity; int x = -1; - for ( int i = 0 ; i < 3; i++ ) + for ( int i = 0; i < 3; i++ ) { double d = fabs( plane.normal()[i] ); if ( d > max ) { diff --git a/radiant/xywindow.cpp b/radiant/xywindow.cpp index f4df5a6e..f84dce2b 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -911,7 +911,7 @@ void XYWnd::NewBrushDrag( int x, int y, bool square, bool cube ){ } } - for ( int i = 0 ; i < 3 ; i++ ) + for ( int i = 0; i < 3; i++ ) { if ( mins[i] == maxs[i] ) return; // don't create a degenerate brush @@ -1535,14 +1535,14 @@ void XYWnd::XY_DrawGrid( void ) { glBegin( GL_LINES ); int i = 0; - for ( x = xb ; x < xe ; x += minor_step, ++i ) { + for ( x = xb; x < xe; x += minor_step, ++i ) { if ( ( i & mask ) != 0 ) { glVertex2f( x, yb ); glVertex2f( x, ye ); } } i = 0; - for ( y = yb ; y < ye ; y += minor_step, ++i ) { + for ( y = yb; y < ye; y += minor_step, ++i ) { if ( ( i & mask ) != 0 ) { glVertex2f( xb, y ); glVertex2f( xe, y ); @@ -1556,11 +1556,11 @@ void XYWnd::XY_DrawGrid( void ) { glColor4fv( vector4_to_array( Vector4( g_xywindow_globals.color_gridmajor, a ) ) ); glBegin( GL_LINES ); - for ( x = xb ; x <= xe ; x += step ) { + for ( x = xb; x <= xe; x += step ) { glVertex2f( x, yb ); glVertex2f( x, ye ); } - for ( y = yb ; y <= ye ; y += step ) { + for ( y = yb; y <= ye; y += step ) { glVertex2f( xb, y ); glVertex2f( xe, y ); } @@ -1584,14 +1584,14 @@ void XYWnd::XY_DrawGrid( void ) { glBegin( GL_LINES ); int i = 0; - for ( x = xb_ ; x < xe_ ; x += minor_step, ++i ) { + for ( x = xb_; x < xe_; x += minor_step, ++i ) { if ( ( i & mask ) != 0 ) { glVertex2f( x, yb_ ); glVertex2f( x, ye_ ); } } i = 0; - for ( y = yb_ ; y < ye_ ; y += minor_step, ++i ) { + for ( y = yb_; y < ye_; y += minor_step, ++i ) { if ( ( i & mask ) != 0 ) { glVertex2f( xb_, y ); glVertex2f( xe_, y ); @@ -1605,11 +1605,11 @@ void XYWnd::XY_DrawGrid( void ) { glColor4fv( vector4_to_array( Vector4( g_xywindow_globals.color_gridmajor, .5f ) ) ); glBegin( GL_LINES ); - for ( x = xb_ ; x <= xe_ ; x += step ) { + for ( x = xb_; x <= xe_; x += step ) { glVertex2f( x, yb_ ); glVertex2f( x, ye_ ); } - for ( y = yb_ ; y <= ye_ ; y += step ) { + for ( y = yb_; y <= ye_; y += step ) { glVertex2f( xb_, y ); glVertex2f( xe_, y ); } @@ -1625,12 +1625,12 @@ void XYWnd::XY_DrawGrid( void ) { const float offx = m_vOrigin[nDim2] + h - ( 1 + GlobalOpenGL().m_font->getPixelHeight() ) / m_fScale; const float offy = m_vOrigin[nDim1] - w + 4 / m_fScale; const float fontDescent = ( GlobalOpenGL().m_font->getPixelDescent() - 1 ) / m_fScale; - for ( x = xb - fmod( xb, stepx ); x <= xe ; x += stepx ) { + for ( x = xb - fmod( xb, stepx ); x <= xe; x += stepx ) { glRasterPos2f( x, offx ); sprintf( text, "%g", x ); GlobalOpenGL().drawString( text ); } - for ( y = yb - fmod( yb, stepy ); y <= ye ; y += stepy ) { + for ( y = yb - fmod( yb, stepy ); y <= ye; y += stepy ) { glRasterPos2f( offy, y - fontDescent ); sprintf( text, "%g", y ); GlobalOpenGL().drawString( text ); @@ -1708,14 +1708,14 @@ void XYWnd::XY_DrawBlockGrid(){ glBegin( GL_LINES ); - for ( x = xb ; x <= xe ; x += g_xywindow_globals_private.blockSize ) + for ( x = xb; x <= xe; x += g_xywindow_globals_private.blockSize ) { glVertex2f( x, yb ); glVertex2f( x, ye ); } if ( m_viewType == XY ) { - for ( y = yb ; y <= ye ; y += g_xywindow_globals_private.blockSize ) + for ( y = yb; y <= ye; y += g_xywindow_globals_private.blockSize ) { glVertex2f( xb, y ); glVertex2f( xe, y ); @@ -1728,8 +1728,8 @@ void XYWnd::XY_DrawBlockGrid(){ // draw coordinate text if needed if ( m_viewType == XY && m_fScale > .1 ) { - for ( x = xb ; x < xe ; x += g_xywindow_globals_private.blockSize ) - for ( y = yb ; y < ye ; y += g_xywindow_globals_private.blockSize ) + for ( x = xb; x < xe; x += g_xywindow_globals_private.blockSize ) + for ( y = yb; y < ye; y += g_xywindow_globals_private.blockSize ) { glRasterPos2f( x + ( g_xywindow_globals_private.blockSize / 2 ), y + ( g_xywindow_globals_private.blockSize / 2 ) ); sprintf( text, "%i,%i",(int)floor( x / g_xywindow_globals_private.blockSize ), (int)floor( y / g_xywindow_globals_private.blockSize ) ); diff --git a/tools/quake3/common/imagelib.cpp b/tools/quake3/common/imagelib.cpp index c116ae99..85d12165 100644 --- a/tools/quake3/common/imagelib.cpp +++ b/tools/quake3/common/imagelib.cpp @@ -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; } @@ -1132,7 +1132,7 @@ void WriteTGA( const char *filename, const byte *data, int width, int height ) { // swap rgb to bgr c = 18 + width * height * 4; - for ( i = 18 ; i < c ; i += 4 ) + for ( i = 18; i < c; i += 4 ) { buffer[i] = data[i - 18 + 2]; // blue buffer[i + 1] = data[i - 18 + 1]; // green @@ -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 ]; diff --git a/tools/quake3/common/inout.cpp b/tools/quake3/common/inout.cpp index 7b95f950..ae6c6075 100644 --- a/tools/quake3/common/inout.cpp +++ b/tools/quake3/common/inout.cpp @@ -148,7 +148,7 @@ void xml_Select( const char *msg, int entitynum, int brushnum, bool bError ){ sprintf( buf, "Entity %i, Brush %i: %s", entitynum, brushnum, msg ); node = xmlNewNode( NULL, (const xmlChar*)"select" ); xmlNodeAddContent( node, (const xmlChar*)buf ); - level[0] = (int)'0' + ( bError ? SYS_ERR : SYS_WRN ) ; + level[0] = (int)'0' + ( bError ? SYS_ERR : SYS_WRN ); level[1] = 0; xmlSetProp( node, (const xmlChar*)"level", (const xmlChar *)level ); // a 'select' information diff --git a/tools/quake3/common/polylib.cpp b/tools/quake3/common/polylib.cpp index 8bf743fc..9cdad3d9 100644 --- a/tools/quake3/common/polylib.cpp +++ b/tools/quake3/common/polylib.cpp @@ -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; diff --git a/tools/quake3/common/threads.cpp b/tools/quake3/common/threads.cpp index 30ec6e81..ba29fa9c 100644 --- a/tools/quake3/common/threads.cpp +++ b/tools/quake3/common/threads.cpp @@ -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" ); diff --git a/tools/quake3/common/unzip.cpp b/tools/quake3/common/unzip.cpp index 599ba145..ba77f2d0 100644 --- a/tools/quake3/common/unzip.cpp +++ b/tools/quake3/common/unzip.cpp @@ -1275,7 +1275,7 @@ static int unzlocal_getShort (FILE* fin, uLong *pX) return UNZ_OK; /* - uLong x ; + uLong x; int i; int err; @@ -1306,7 +1306,7 @@ static int unzlocal_getLong (FILE *fin, uLong *pX) return UNZ_OK; /* - uLong x ; + uLong x; int i; int err; @@ -1417,13 +1417,13 @@ static uLong unzlocal_SearchCentralDir(FILE *fin) uBackRead = 4; while (uBackReaduMaxBack) uBackRead = uMaxBack; else uBackRead+=BUFREADCOMMENT; - uReadPos = uSizeFile-uBackRead ; + uReadPos = uSizeFile-uBackRead; uReadSize = ((BUFREADCOMMENT+4) < (uSizeFile-uReadPos)) ? (BUFREADCOMMENT+4) : (uSizeFile-uReadPos); @@ -1478,7 +1478,7 @@ extern unzFile unzOpen (const char* path) unz_s us; unz_s *s; uLong central_pos,uL; - FILE * fin ; + FILE * fin; uLong number_disk; /* number of the current dist, used for spaning ZIP, unsupported, always 0*/ @@ -1606,13 +1606,13 @@ static void unzlocal_DosDateToTmuDate (uLong ulDosDate, tm_unz* ptm) { uLong uDate; uDate = (uLong)(ulDosDate>>16); - ptm->tm_mday = (uInt)(uDate&0x1f) ; - ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ; - ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ; + ptm->tm_mday = (uInt)(uDate&0x1f); + ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1); + ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980); ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800); - ptm->tm_min = (uInt) ((ulDosDate&0x7E0)/0x20) ; - ptm->tm_sec = (uInt) (2*(ulDosDate&0x1f)) ; + ptm->tm_min = (uInt) ((ulDosDate&0x7E0)/0x20); + ptm->tm_sec = (uInt) (2*(ulDosDate&0x1f)); } /* @@ -1701,7 +1701,7 @@ static int unzlocal_GetCurrentFileInfoInternal (unzFile file, lSeek+=file_info.size_filename; if ((err==UNZ_OK) && (szFileName!=NULL)) { - uLong uSizeRead ; + uLong uSizeRead; if (file_info.size_filenamepos_in_central_dir += SIZECENTRALDIRITEM + s->cur_file_info.size_filename + - s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment ; + s->cur_file_info.size_file_extra + s->cur_file_info.size_file_comment; s->num_file++; err = unzlocal_GetCurrentFileInfoInternal(file,&s->cur_file_info, &s->cur_file_info_internal, @@ -1887,8 +1887,8 @@ extern int unzLocateFile (unzFile file, const char *szFileName, int iCaseSensiti err = unzGoToNextFile(file); } - s->num_file = num_fileSaved ; - s->pos_in_central_dir = pos_in_central_dirSaved ; + s->num_file = num_fileSaved; + s->pos_in_central_dir = pos_in_central_dirSaved; return err; } @@ -2060,9 +2060,9 @@ extern int unzOpenCurrentFile (unzFile file) */ } pfile_in_zip_read_info->rest_read_compressed = - s->cur_file_info.compressed_size ; + s->cur_file_info.compressed_size; pfile_in_zip_read_info->rest_read_uncompressed = - s->cur_file_info.uncompressed_size ; + s->cur_file_info.uncompressed_size; pfile_in_zip_read_info->pos_in_zipfile = @@ -2144,12 +2144,12 @@ extern int unzReadCurrentFile (unzFile file, void *buf, unsigned len) if (pfile_in_zip_read_info->compression_method==0) { - uInt uDoCopy,i ; + uInt uDoCopy,i; if (pfile_in_zip_read_info->stream.avail_out < pfile_in_zip_read_info->stream.avail_in) - uDoCopy = pfile_in_zip_read_info->stream.avail_out ; + uDoCopy = pfile_in_zip_read_info->stream.avail_out; else - uDoCopy = pfile_in_zip_read_info->stream.avail_in ; + uDoCopy = pfile_in_zip_read_info->stream.avail_in; for (i=0;istream.next_out+i) = @@ -2287,7 +2287,7 @@ extern int unzGetLocalExtrafield (unzFile file,void *buf,unsigned len) if (len>size_to_read) read_now = (uInt)size_to_read; else - read_now = (uInt)len ; + read_now = (uInt)len; if (read_now==0) return 0; @@ -2351,7 +2351,7 @@ extern int unzCloseCurrentFile (unzFile file) extern int unzGetGlobalComment (unzFile file, char *szComment, uLong uSizeBuf) { unz_s* s; - uLong uReadThis ; + uLong uReadThis; if (file==NULL) return UNZ_PARAMERROR; s=(unz_s*)file; diff --git a/tools/quake3/q3map2/brush.cpp b/tools/quake3/q3map2/brush.cpp index b2b94ff6..7ff2a1af 100644 --- a/tools/quake3/q3map2/brush.cpp +++ b/tools/quake3/q3map2/brush.cpp @@ -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 ); diff --git a/tools/quake3/q3map2/bsp.cpp b/tools/quake3/q3map2/bsp.cpp index 0395eb02..794d67f8 100644 --- a/tools/quake3/q3map2/bsp.cpp +++ b/tools/quake3/q3map2/bsp.cpp @@ -675,7 +675,7 @@ int BSPMain( Args& args ){ Sys_Printf( "Leaving light entities on map after compile\n" ); } while ( args.takeArg( "-nodetail" ) ) { - Sys_Printf( "Ignoring detail brushes\n" ) ; + Sys_Printf( "Ignoring detail brushes\n" ); nodetail = true; } while ( args.takeArg( "-fulldetail" ) ) { diff --git a/tools/quake3/q3map2/bspfile_abstract.cpp b/tools/quake3/q3map2/bspfile_abstract.cpp index f3fbe50c..785fe7dc 100644 --- a/tools/quake3/q3map2/bspfile_abstract.cpp +++ b/tools/quake3/q3map2/bspfile_abstract.cpp @@ -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(); diff --git a/tools/quake3/q3map2/facebsp.cpp b/tools/quake3/q3map2/facebsp.cpp index dd5a260f..d28f5411 100644 --- a/tools/quake3/q3map2/facebsp.cpp +++ b/tools/quake3/q3map2/facebsp.cpp @@ -113,7 +113,7 @@ static void SelectSplitPlaneNum( const node_t *node, const facelist_t& list, int //Base score = 20000 perfectly balanced value = 20000 - ( abs( front - back ) ); value -= plane.counter; // If we've already used this plane sometime in the past try not to use it again - value -= facing ; // if we're going to have alot of other surfs use this plane, we want to get it in quickly. + value -= facing; // if we're going to have alot of other surfs use this plane, we want to get it in quickly. value -= splits * 5; //more splits = bad value += sizeBias * 10; //We want a huge score bias based on plane size } diff --git a/tools/quake3/q3map2/fog.cpp b/tools/quake3/q3map2/fog.cpp index 4920a046..4d5f8ec4 100644 --- a/tools/quake3/q3map2/fog.cpp +++ b/tools/quake3/q3map2/fog.cpp @@ -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; diff --git a/tools/quake3/q3map2/lightmaps_ydnar.cpp b/tools/quake3/q3map2/lightmaps_ydnar.cpp index ec00a857..e11c498c 100644 --- a/tools/quake3/q3map2/lightmaps_ydnar.cpp +++ b/tools/quake3/q3map2/lightmaps_ydnar.cpp @@ -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 ]; diff --git a/tools/quake3/q3map2/map.cpp b/tools/quake3/q3map2/map.cpp index d3ac9623..8462bf3e 100644 --- a/tools/quake3/q3map2/map.cpp +++ b/tools/quake3/q3map2/map.cpp @@ -854,7 +854,7 @@ std::array 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 */ @@ -889,16 +889,16 @@ void QuakeTextureVecs( const plane_t& plane, float shift[ 2 ], float rotate, flo // rotate axis if ( rotate == 0 ) { - sinv = 0 ; cosv = 1; + sinv = 0; cosv = 1; } else if ( rotate == 90 ) { - sinv = 1 ; cosv = 0; + sinv = 1; cosv = 0; } else if ( rotate == 180 ) { - sinv = 0 ; cosv = -1; + sinv = 0; cosv = -1; } else if ( rotate == 270 ) { - sinv = -1 ; cosv = 0; + sinv = -1; cosv = 0; } else { @@ -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 ) { diff --git a/tools/quake3/q3map2/mesh.cpp b/tools/quake3/q3map2/mesh.cpp index ac3a8d4a..482fbb7c 100644 --- a/tools/quake3/q3map2/mesh.cpp +++ b/tools/quake3/q3map2/mesh.cpp @@ -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,16 +320,16 @@ 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]; } } // horizontal subdivisions - for ( j = 0 ; j + 2 < out.width ; j += 2 ) { + 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; @@ -376,9 +376,9 @@ mesh_t *SubdivideMesh( mesh_t in, float maxError, float minLength ){ } // vertical subdivisions - for ( j = 0 ; j + 2 < out.height ; j += 2 ) { + 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 ) ); } diff --git a/tools/quake3/q3map2/patch.cpp b/tools/quake3/q3map2/patch.cpp index c46dae8c..e714d9f0 100644 --- a/tools/quake3/q3map2/patch.cpp +++ b/tools/quake3/q3map2/patch.cpp @@ -390,7 +390,7 @@ void PatchMapDrawSurfs( entity_t *e ){ Sys_FPrintf( SYS_VRB, "--- PatchMapDrawSurfs ---\n" ); patchCount = 0; - for ( pm = e->patches ; pm ; pm = pm->next ) { + for ( pm = e->patches; pm; pm = pm->next ) { meshes[patchCount] = pm; patchCount++; } @@ -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; } diff --git a/tools/quake3/q3map2/portals.cpp b/tools/quake3/q3map2/portals.cpp index a3cea609..f4c2922e 100644 --- a/tools/quake3/q3map2/portals.cpp +++ b/tools/quake3/q3map2/portals.cpp @@ -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; diff --git a/tools/quake3/q3map2/tjunction.cpp b/tools/quake3/q3map2/tjunction.cpp index 982bff14..6994ba06 100644 --- a/tools/quake3/q3map2/tjunction.cpp +++ b/tools/quake3/q3map2/tjunction.cpp @@ -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 ) @@ -350,7 +350,7 @@ void FixSurfaceJunctions( mapDrawSurface_t& ds ) { p = e->chain->prev; } - for ( ; p != e->chain ; ) { + for ( ; p != e->chain; ) { if ( start < end ) { if ( p->intercept > end - ON_EPSILON ) { break; @@ -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 ]; } } diff --git a/tools/quake3/q3map2/vis.cpp b/tools/quake3/q3map2/vis.cpp index d073bcc0..cb6d1666 100644 --- a/tools/quake3/q3map2/vis.cpp +++ b/tools/quake3/q3map2/vis.cpp @@ -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; @@ -582,7 +582,7 @@ fixedWinding_t *TryMergeWinding( fixedWinding_t *f1, fixedWinding_t *f2, const V newf = NewFixedWinding( f1->numpoints + f2->numpoints ); // copy first polygon - for ( k = ( i + 1 ) % f1->numpoints ; k != i ; k = ( k + 1 ) % f1->numpoints ) + for ( k = ( i + 1 ) % f1->numpoints; k != i; k = ( k + 1 ) % f1->numpoints ) { if ( k == ( i + 1 ) % f1->numpoints && !keep2 ) { continue; @@ -593,7 +593,7 @@ fixedWinding_t *TryMergeWinding( fixedWinding_t *f1, fixedWinding_t *f2, const V } // copy second polygon - for ( l = ( j + 1 ) % f2->numpoints ; l != j ; l = ( l + 1 ) % f2->numpoints ) + for ( l = ( j + 1 ) % f2->numpoints; l != j; l = ( l + 1 ) % f2->numpoints ) { if ( l == ( j + 1 ) % f2->numpoints && !keep1 ) { continue; diff --git a/tools/quake3/q3map2/visflow.cpp b/tools/quake3/q3map2/visflow.cpp index 36a25c32..883ab15c 100644 --- a/tools/quake3/q3map2/visflow.cpp +++ b/tools/quake3/q3map2/visflow.cpp @@ -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;