diff --git a/contrib/bobtoolz/DBobView.cpp b/contrib/bobtoolz/DBobView.cpp index c9abc8b0..e221f635 100644 --- a/contrib/bobtoolz/DBobView.cpp +++ b/contrib/bobtoolz/DBobView.cpp @@ -58,7 +58,7 @@ DBobView::~DBobView(){ void DBobView::render( RenderStateFlags state ) const { gl().glBegin( GL_LINE_STRIP ); - for ( int i = 0; i < nPathCount; i++ ) + for ( int i = 0; i < nPathCount; ++i ) gl().glVertex3fv( path[i] ); gl().glEnd(); @@ -149,7 +149,7 @@ bool DBobView::CalculateTrajectory( vec3_t start, vec3_t apex, float multiplier, path.reset( new vec3_t[points] ); float interval = multiplier * flight_time / points; - for ( int i = 0; i < points; i++ ) + for ( int i = 0; i < points; ++i ) { float ltime = interval * i; diff --git a/contrib/bobtoolz/DBrush.cpp b/contrib/bobtoolz/DBrush.cpp index cbb16ef6..377dd4cd 100644 --- a/contrib/bobtoolz/DBrush.cpp +++ b/contrib/bobtoolz/DBrush.cpp @@ -79,13 +79,13 @@ int DBrush::BuildPoints(){ return 0; // with only 3 faces u can't have a bounded soild } - for ( std::list::const_iterator p1 = faceList.begin(); p1 != faceList.end(); p1++ ) + for ( std::list::const_iterator p1 = faceList.begin(); p1 != faceList.end(); ++p1 ) { std::list::const_iterator p2 = p1; - for ( p2++; p2 != faceList.end(); p2++ ) + for ( ++p2; p2 != faceList.end(); ++p2 ) { std::list::const_iterator p3 = p2; - for ( p3++; p3 != faceList.end(); p3++ ) + for ( ++p3; p3 != faceList.end(); ++p3 ) { vec3_t pnt; if ( ( *p1 )->PlaneIntersection( *p2, *p3, pnt ) ) { @@ -201,7 +201,7 @@ int DBrush::RemoveRedundantPlanes(){ { std::list::iterator p2 = p1; - for ( p2++; p2 != faceList.end(); p2++ ) + for ( ++p2; p2 != faceList.end(); ++p2 ) { if ( **p1 == **p2 ) { if ( !strcmp( ( *p1 )->m_shader.c_str(), "textures/common/caulk" ) ) { @@ -345,7 +345,7 @@ bool DBrush::IsCutByPlane( DPlane *cuttingPlane ){ return true; } - for ( chkPnt++ = pointList.begin(); chkPnt != pointList.end(); chkPnt++ ) + for ( ++chkPnt; chkPnt != pointList.end(); ++chkPnt ) { dist = cuttingPlane->DistanceToPoint( ( *chkPnt )->_pnt ); @@ -527,7 +527,7 @@ void DBrush::BuildBounds(){ VectorCopy( ( *first )->_pnt, bbox_max ); std::list::const_iterator point = pointList.begin(); - for ( point++; point != pointList.end(); point++ ) + for ( ++point; point != pointList.end(); ++point ) { if ( ( *point )->_pnt[0] > bbox_max[0] ) { bbox_max[0] = ( *point )->_pnt[0]; @@ -672,13 +672,13 @@ void DBrush::BuildFromWinding( DWinding *w ){ DWinding* w2; w2 = w->CopyWinding(); int i; - for ( i = 0; i < w2->numpoints; i++ ) + for ( i = 0; i < w2->numpoints; ++i ) VectorAdd( w2->p[i], wPlane->normal, w2->p[i] ); AddFace( w2->p[0], w2->p[1], w2->p[2], NULL ); AddFace( w->p[2], w->p[1], w->p[0], NULL ); - for ( i = 0; i < w->numpoints - 1; i++ ) + for ( i = 0; i < w->numpoints - 1; ++i ) AddFace( w2->p[i], w->p[i], w->p[i + 1], NULL ); AddFace( w2->p[w->numpoints - 1], w->p[w->numpoints - 1], w->p[0], NULL ); @@ -711,7 +711,7 @@ void DBrush::SaveToFile( FILE *pFile ){ void DBrush::Rotate( vec3_t vOrigin, vec3_t vRotation ){ for ( DPlane *plane : faceList ) { - for ( int i = 0; i < 3; i++ ) + for ( int i = 0; i < 3; ++i ) VectorRotate( plane->points[i], vRotation, vOrigin ); plane->Rebuild(); diff --git a/contrib/bobtoolz/DEntity.cpp b/contrib/bobtoolz/DEntity.cpp index a6cfd042..6d5feadc 100644 --- a/contrib/bobtoolz/DEntity.cpp +++ b/contrib/bobtoolz/DEntity.cpp @@ -116,14 +116,14 @@ bool DEntity::LoadFromPrt( char *filename ){ ClearEPairs(); bool build = false; - for ( unsigned int i = 0; i < portals.node_count; i++ ) + for ( unsigned int i = 0; i < portals.node_count; ++i ) { build = false; DBrush* brush = NewBrush(); - for ( unsigned int j = 0; j < portals.node[i].portal_count; j++ ) + for ( unsigned int j = 0; j < portals.node[i].portal_count; ++j ) { - for ( unsigned int k = 0; k < portals.node[i].portal[j].point_count - 2; k++ ) + for ( unsigned int k = 0; k < portals.node[i].portal[j].point_count - 2; ++k ) { vec3_t v1, v2, normal, n; VectorSubtract( portals.node[i].portal[j].point[k + 2].p, portals.node[i].portal[j].point[k + 1].p, v1 ); diff --git a/contrib/bobtoolz/DPatch.cpp b/contrib/bobtoolz/DPatch.cpp index 52804b9f..ca29281f 100644 --- a/contrib/bobtoolz/DPatch.cpp +++ b/contrib/bobtoolz/DPatch.cpp @@ -61,9 +61,9 @@ void DPatch::BuildInRadiant( scene::Node* entity ){ GlobalPatchCreator().Patch_setShader( patch, texture ); GlobalPatchCreator().Patch_resize( patch, height, width ); PatchControlMatrix matrix = GlobalPatchCreator().Patch_getControlPoints( patch ); - for ( int x = 0; x < width; x++ ) + for ( int x = 0; x < width; ++x ) { - for ( int y = 0; y < height; y++ ) + for ( int y = 0; y < height; ++y ) { PatchControl& p = matrix( x, y ); p.m_vertex[0] = points[x][y].xyz[0]; @@ -88,8 +88,8 @@ void DPatch::BuildInRadiant( scene::Node* entity ){ b->pPatch = Patch_Alloc(); b->pPatch->setDims( width, height ); - for ( int x = 0; x < width; x++ ) - for ( int y = 0; y < height; y++ ) + for ( int x = 0; x < width; ++x ) + for ( int y = 0; y < height; ++y ) CopyDrawVert( &points[x][y], &pm->ctrl[x][y] ); /* if( entity ) @@ -130,9 +130,9 @@ void DPatch::LoadFromPatch( scene::Instance& patch ){ width = static_cast( matrix.x() ); height = static_cast( matrix.y() ); - for ( int x = 0; x < width; x++ ) + for ( int x = 0; x < width; ++x ) { - for ( int y = 0; y < height; y++ ) + for ( int y = 0; y < height; ++y ) { PatchControl& p = matrix( x, y ); points[x][y].xyz[0] = p.m_vertex[0]; @@ -150,9 +150,9 @@ void DPatch::LoadFromPatch( scene::Instance& patch ){ width = brush->pPatch->getWidth(); height = brush->pPatch->getHeight(); - for ( int x = 0; x < height; x++ ) + for ( int x = 0; x < height; ++x ) { - for ( int y = 0; y < width; y++ ) + for ( int y = 0; y < width; ++y ) { float *p = brush->pPatch->ctrlAt( ROW, x, y ); p[0] = points[x][y].xyz[0]; @@ -185,7 +185,7 @@ void Build1dArray( vec3_t* array, const drawVert_t points[MAX_PATCH_WIDTH][MAX_P step = 1; } - for ( i = 0; i < number; i++ ) + for ( i = 0; i < number; ++i ) { VectorCopy( points[x][y].xyz, array[i] ); @@ -199,7 +199,7 @@ void Build1dArray( vec3_t* array, const drawVert_t points[MAX_PATCH_WIDTH][MAX_P } void Print1dArray( vec3_t* array, int size ){ - for ( int i = 0; i < size; i++ ) + for ( int i = 0; i < size; ++i ) globalOutputStream() << '(' << array[i][0] << ' ' << array[i][1] << ' ' << array[i][2] << ")\t"; globalOutputStream() << '\n'; } @@ -208,7 +208,7 @@ bool Compare1dArrays( vec3_t* a1, vec3_t* a2, int size ){ int i; bool equal = true; - for ( i = 0; i < size; i++ ) + for ( i = 0; i < size; ++i ) { if ( !VectorCompare( a1[i], a2[size - i - 1] ) ) { equal = false; @@ -248,9 +248,9 @@ patch_merge_t DPatch::IsMergable( const DPatch& other ){ p2ArraySizes[2] = other.width; p2ArraySizes[3] = other.height; - for ( i = 0; i < 4; i++ ) + for ( i = 0; i < 4; ++i ) { - for ( j = 0; j < 4; j++ ) + for ( j = 0; j < 4; ++j ) { if ( p1ArraySizes[i] == p2ArraySizes[j] ) { if ( Compare1dArrays( p1Array[i], p2Array[j], p1ArraySizes[i] ) ) { @@ -297,12 +297,12 @@ DPatch* DPatch::MergePatches( patch_merge_t merge_info, DPatch& p1, DPatch& p2 ) newPatch->width = p1.width; newPatch->SetTexture( p1.texture ); - for ( int y = 0; y < p1.height; y++ ) - for ( int x = 0; x < p1.width; x++ ) + for ( int y = 0; y < p1.height; ++y ) + for ( int x = 0; x < p1.width; ++x ) newPatch->points[x][y] = p1.points[x][y]; - for ( int y = 1; y < p2.height; y++ ) - for ( int x = 0; x < p2.width; x++ ) + for ( int y = 1; y < p2.height; ++y ) + for ( int x = 0; x < p2.width; ++x ) newPatch->points[x][( y + p1.height - 1 )] = p2.points[x][y]; // newPatch->Invert(); @@ -312,9 +312,9 @@ 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++ ) + for ( j = 0; j < height / 2; ++j ) { std::swap( points[i][height - 1 - j], points[i][j] ); } @@ -335,9 +335,9 @@ void DPatch::Invert(){ newPatch->width = p1->width; newPatch->SetTexture( p1->texture ); - for( int x = 0; x < p1->height; x++ ) + for( int x = 0; x < p1->height; ++x ) { - for( int y = 0; y < p1->width; y++ ) + for( int y = 0; y < p1->width; ++y ) { newPatch->points[x][y] = p1->points[x][y]; } @@ -349,9 +349,9 @@ void DPatch::Invert(){ void DPatch::DebugPrint() { globalOutputStream() << "width: " << width << "\theight: " << height << '\n'; - for( int x = 0; x < height; x++ ) + for( int x = 0; x < height; ++x ) { - for( int y = 0; y < width; y++ ) + for( int y = 0; y < width; ++y ) { globalOutputStream() << "\t(" << points[x][y].xyz[0] << ' ' << points[x][y].xyz[1] << ' ' << points[x][y].xyz[2] << ")\t"; } @@ -364,9 +364,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 @@ -382,9 +382,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 @@ -410,16 +410,16 @@ std::list DPatch::SplitCols(){ int x, y; if ( height >= 5 ) { - for ( i = 0; i < ( height - 1 ) / 2; i++ ) + for ( i = 0; i < ( height - 1 ) / 2; ++i ) { DPatch p; p.width = width; p.height = MIN_PATCH_HEIGHT; p.SetTexture( texture ); - for ( x = 0; x < p.width; x++ ) + for ( x = 0; x < p.width; ++x ) { - for ( y = 0; y < MIN_PATCH_HEIGHT; y++ ) + for ( y = 0; y < MIN_PATCH_HEIGHT; ++y ) { p.points[x][y] = points[x][( i * 2 ) + y]; } @@ -440,7 +440,7 @@ std::list DPatch::SplitRows(){ int x, y; if ( width >= 5 ) { - for ( i = 0; i < ( width - 1 ) / 2; i++ ) + for ( i = 0; i < ( width - 1 ) / 2; ++i ) { DPatch p; @@ -448,9 +448,9 @@ std::list DPatch::SplitRows(){ p.height = height; p.SetTexture( texture ); - for ( x = 0; x < MIN_PATCH_WIDTH; x++ ) + for ( x = 0; x < MIN_PATCH_WIDTH; ++x ) { - for ( y = 0; y < p.height; y++ ) + for ( y = 0; y < p.height; ++y ) { p.points[x][y] = points[( i * 2 ) + x][y]; } diff --git a/contrib/bobtoolz/DPlane.cpp b/contrib/bobtoolz/DPlane.cpp index b25f6b89..731e2edb 100644 --- a/contrib/bobtoolz/DPlane.cpp +++ b/contrib/bobtoolz/DPlane.cpp @@ -147,7 +147,7 @@ DWinding DPlane::BaseWindingForPlane() const { max = -131072; x = -1; - for ( i = 0; i < 3; i++ ) + for ( i = 0; i < 3; ++i ) { v = fabs( normal[i] ); if ( v > max ) { diff --git a/contrib/bobtoolz/DShape.cpp b/contrib/bobtoolz/DShape.cpp index a1f08d64..b6fccffc 100644 --- a/contrib/bobtoolz/DShape.cpp +++ b/contrib/bobtoolz/DShape.cpp @@ -59,7 +59,7 @@ void DShape::BuildRegularPrism( vec3_t min, vec3_t max, int nSides, bool bAlignT //----- Build Polygon Vertices ----- int i; - for ( i = 0; i < nSides; i++ ) + for ( i = 0; i < nSides; ++i ) { VectorCopy( origin, vc[i] ); VectorCopy( origin, vd[i] ); @@ -83,7 +83,7 @@ void DShape::BuildRegularPrism( vec3_t min, vec3_t max, int nSides, bool bAlignT DBrush* pB = m_Container.GetWorldSpawn()->NewBrush(); - for ( i = 1; i <= nSides; i++ ) + for ( i = 1; i <= nSides; ++i ) pB->AddFace( vc[i - 1], vc[i], vd[i], GetCurrentTexture(), false ); pB->AddFace( vc[2], vc[1], vc[0], "textures/common/caulk", false ); @@ -116,7 +116,7 @@ void DShape::BuildInversePrism( vec3_t min, vec3_t max, int nSides, bool bAlignT //----- Build Polygon Vertices ----- int i; - for ( i = 0; i < nSides; i++ ) + for ( i = 0; i < nSides; ++i ) { VectorCopy( origin, va[i] ); VectorCopy( origin, vb[i] ); @@ -136,7 +136,7 @@ void DShape::BuildInversePrism( vec3_t min, vec3_t max, int nSides, bool bAlignT //---------------------------------- - for ( i = 1; i <= nSides; i++ ) + for ( i = 1; i <= nSides; ++i ) { DBrush* pB = GetBoundingCube( min, max, "textures/common/caulk" ); @@ -192,7 +192,7 @@ void DShape::BuildBorderedPrism( vec3_t min, vec3_t max, int nSides, int nBorder //----- Build Polygon Vertices ----- int i; - for ( i = 0; i < nSides; i++ ) + for ( i = 0; i < nSides; ++i ) { VectorCopy( origin, va[i] ); VectorCopy( origin, vb[i] ); @@ -232,7 +232,7 @@ void DShape::BuildBorderedPrism( vec3_t min, vec3_t max, int nSides, int nBorder //---------------------------------- - for ( i = 1; i <= nSides; i++ ) + for ( i = 1; i <= nSides; ++i ) { DBrush* pB = GetBoundingCube( min, max, "textures/common/caulk" ); diff --git a/contrib/bobtoolz/DTrainDrawer.cpp b/contrib/bobtoolz/DTrainDrawer.cpp index 045cd780..e39588a0 100644 --- a/contrib/bobtoolz/DTrainDrawer.cpp +++ b/contrib/bobtoolz/DTrainDrawer.cpp @@ -87,7 +87,7 @@ void CalculateSpline_r( vec3_t* v, int count, vec3_t out, float tension ) { vec3_t* v2 = new vec3_t[count - 1]; - for ( int i = 0; i < count - 1; i++ ) { + for ( int i = 0; i < count - 1; ++i ) { VectorSubtract( v[i + 1], v[i], dist ); VectorMA( v[i], tension, dist, v2[i] ); } @@ -203,7 +203,7 @@ public: if ( control ) { AddSplineControl( control, pSP ); - for ( int j = 2;; j++ ) { + for ( int j = 2;; ++j ) { char buffer[32]; sprintf( buffer, "control%i", j ); diff --git a/contrib/bobtoolz/DTreePlanter.cpp b/contrib/bobtoolz/DTreePlanter.cpp index ba49e70f..61478f16 100644 --- a/contrib/bobtoolz/DTreePlanter.cpp +++ b/contrib/bobtoolz/DTreePlanter.cpp @@ -62,7 +62,7 @@ SignalHandlerResult DTreePlanter::mouseDown( const WindowVector& position, Butto const scene::Path* pThisEntity = NULL; int entpos; - for ( int i = 0; i < 256; i++ ) { + for ( int i = 0; i < 256; ++i ) { sprintf( buffer, m_linkName, i ); pThisEntity = FindEntityFromTargetname( buffer ); @@ -197,7 +197,7 @@ void DTreePlanter::DropEntsToGround() { void MakeChain( int linkNum, const char* linkName ) { char buffer[256]; int i; - for ( i = 0; i < linkNum; i++ ) { + for ( i = 0; i < linkNum; ++i ) { DEntity e( "info_train_spline_main" ); sprintf( buffer, "%s_pt%i", linkName, i ); @@ -216,7 +216,7 @@ void MakeChain( int linkNum, const char* linkName ) { e.BuildInRadiant( false ); } - for ( i = 0; i < linkNum - 1; i++ ) { + for ( i = 0; i < linkNum - 1; ++i ) { DEntity e( "info_train_spline_control" ); sprintf( buffer, "%s_ctl%i", linkName, i ); diff --git a/contrib/bobtoolz/DWinding.cpp b/contrib/bobtoolz/DWinding.cpp index 7d1ee751..567e5e6b 100644 --- a/contrib/bobtoolz/DWinding.cpp +++ b/contrib/bobtoolz/DWinding.cpp @@ -71,7 +71,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 ); @@ -88,7 +88,7 @@ void DWinding::RemoveColinearPoints(){ vec3_t p2[MAX_POINTS_ON_WINDING]; int nump = 0; - for ( int i = 0; i < numpoints; i++ ) + for ( int i = 0; i < numpoints; ++i ) { int j = ( i + 1 ) % numpoints; int k = ( i + numpoints - 1 ) % numpoints; @@ -126,9 +126,9 @@ 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++ ) + for ( int j = 0; j < 3; ++j ) { vec_t v = p[i][j]; if ( v < mins[j] ) { @@ -143,7 +143,7 @@ void DWinding::WindingBounds( vec3_t mins, vec3_t maxs ){ void DWinding::WindingCentre( vec3_t centre ){ VectorCopy( vec3_origin, centre ); - for ( int i = 0; i < numpoints; i++ ) + for ( int i = 0; i < numpoints; ++i ) VectorAdd( p[i], centre, centre ); float scale = 1.0f / numpoints; @@ -179,7 +179,7 @@ int DWinding::WindingOnPlaneSide( vec3_t normal, vec_t dist ){ bool front = false; bool back = false; - for ( int i = 0; i < numpoints; i++ ) + for ( int i = 0; i < numpoints; ++i ) { vec_t d = DotProduct( p[i], normal ) - dist; if ( d < -ON_EPSILON ) { @@ -223,12 +223,12 @@ void DWinding::CheckWinding(){ DPlane* wPlane = WindingPlane(); int i; - for ( i = 0; i < numpoints; i++ ) + for ( i = 0; i < numpoints; ++i ) { p1 = p[i]; int j; - for ( j = 0; j < 3; j++ ) + for ( j = 0; j < 3; ++j ) if ( p1[j] > BOGUS_RANGE || p1[j] < -BOGUS_RANGE ) { globalWarningStream() << "CheckFace: BOGUS_RANGE: " << p1[j] << '\n'; } @@ -254,7 +254,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; @@ -274,7 +274,7 @@ DWinding* DWinding::ReverseWinding(){ auto *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; @@ -292,7 +292,7 @@ bool DWinding::ChopWindingInPlace( const DPlane* chopPlane, vec_t epsilon ){ } // determine sides for each point - for ( int i = 0; i < numpoints; i++ ) + for ( int i = 0; i < numpoints; ++i ) { dists[i] = DotProduct( p[i], chopPlane->normal ) - chopPlane->_d; @@ -327,7 +327,7 @@ bool DWinding::ChopWindingInPlace( const DPlane* chopPlane, vec_t epsilon ){ f.AllocWinding( maxpts ); f.numpoints = 0; - for ( int i = 0; i < numpoints; i++ ) + for ( int i = 0; i < numpoints; ++i ) { const vec3_t& p1 = p[i]; @@ -351,7 +351,7 @@ bool DWinding::ChopWindingInPlace( const DPlane* chopPlane, vec_t epsilon ){ const vec_t dot = dists[i] / ( dists[i] - dists[i + 1] ); vec3_t mid; - for ( int j = 0; j < 3; j++ ) + for ( int j = 0; j < 3; ++j ) { if ( chopPlane->normal[j] == 1 ) { mid[j] = chopPlane->_d; @@ -390,7 +390,7 @@ void DWinding::ClipWindingEpsilon( DPlane* chopPlane, vec_t epsilon, DWinding ** // determine sides for each point int i; - for ( i = 0; i < numpoints; i++ ) + for ( i = 0; i < numpoints; ++i ) { vec_t dot = -chopPlane->DistanceToPoint( p[i] ); dists[i] = dot; @@ -436,7 +436,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]; @@ -465,7 +465,7 @@ void DWinding::ClipWindingEpsilon( DPlane* chopPlane, vec_t epsilon, DWinding ** p2 = p[( i + 1 ) % numpoints]; vec_t dot = dists[i] / ( dists[i] - dists[i + 1] ); - for ( int j = 0; j < 3; j++ ) + for ( int j = 0; j < 3; ++j ) { if ( chopPlane->normal[j] == 1 ) { mid[j] = chopPlane->_d; diff --git a/contrib/bobtoolz/ScriptParser.cpp b/contrib/bobtoolz/ScriptParser.cpp index effa6459..71c37f52 100644 --- a/contrib/bobtoolz/ScriptParser.cpp +++ b/contrib/bobtoolz/ScriptParser.cpp @@ -254,7 +254,7 @@ void CScriptParser::LoadScript( const char* pScript ) { } void CScriptParser::AddBreakChar( char c ) { - for ( int i = 0; i < SP_MAX_BREAKCHARS; i++ ) { + for ( int i = 0; i < SP_MAX_BREAKCHARS; ++i ) { if ( !m_breakChars[i] ) { m_breakChars[i] = c; return; @@ -265,7 +265,7 @@ void CScriptParser::AddBreakChar( char c ) { } bool CScriptParser::IsBreakChar( char c ) { - for ( int i = 0; i < SP_MAX_BREAKCHARS; i++ ) { + for ( int i = 0; i < SP_MAX_BREAKCHARS; ++i ) { if ( !m_breakChars[i] ) { return false; } diff --git a/contrib/bobtoolz/bsploader.cpp b/contrib/bobtoolz/bsploader.cpp index 2afba32f..67ff1f41 100644 --- a/contrib/bobtoolz/bsploader.cpp +++ b/contrib/bobtoolz/bsploader.cpp @@ -103,7 +103,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] ); } } @@ -122,7 +122,7 @@ void SwapBSPFile() { // 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 ); // } @@ -153,7 +153,7 @@ void SwapBSPFile() { ( (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] ); @@ -173,7 +173,7 @@ void SwapBSPFile() { 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 fc8363f6..d60f2096 100644 --- a/contrib/bobtoolz/cportals.cpp +++ b/contrib/bobtoolz/cportals.cpp @@ -67,9 +67,9 @@ bool CBspPortal::Build( char *def, unsigned int pointCnt, bool bInverse ){ point = new CBspPoint[point_count]; - for ( n = 0; n < point_count; n++ ) + for ( n = 0; n < point_count; ++n ) { - for (; *c != 0 && *c != '('; c++ ){}; + for (; *c != 0 && *c != '('; ++c ){}; if ( *c == 0 ) { return false; @@ -195,7 +195,7 @@ void CPortals::Load(){ node = new CBspNode[node_count]; unsigned int i; - for ( i = 0; i < p_count; i++ ) + for ( i = 0; i < p_count; ++i ) { if ( !fgets( buf, LINE_BUF, in ) ) { fclose( in ); @@ -214,7 +214,7 @@ void CPortals::Load(){ node[node2].portal_count++; } - for ( i = 0; i < p_count2; i++ ) + for ( i = 0; i < p_count2; ++i ) { if ( !fgets( buf, LINE_BUF, in ) ) { fclose( in ); @@ -232,7 +232,7 @@ void CPortals::Load(){ node[node1].portal_count++; } - for ( i = 0; i < node_count; i++ ) + for ( i = 0; i < node_count; ++i ) node[i].portal = new CBspPortal[node[i].portal_count]; fclose( in ); @@ -245,7 +245,7 @@ void CPortals::Load(){ fgets( buf, LINE_BUF, in ); unsigned int n; - for ( n = 0; n < p_count; n++ ) + for ( n = 0; n < p_count; ++n ) { if ( !fgets( buf, LINE_BUF, in ) ) { fclose( in ); @@ -281,7 +281,7 @@ void CPortals::Load(){ } } - for ( n = 0; n < p_count2; n++ ) + for ( n = 0; n < p_count2; ++n ) { if ( !fgets( buf, LINE_BUF, in ) ) { fclose( in ); diff --git a/contrib/bobtoolz/funchandlers-GTK.cpp b/contrib/bobtoolz/funchandlers-GTK.cpp index 562fe092..6fe87361 100644 --- a/contrib/bobtoolz/funchandlers-GTK.cpp +++ b/contrib/bobtoolz/funchandlers-GTK.cpp @@ -326,7 +326,7 @@ void DoBuildStairs(){ // Build The Steps - for ( int i = 0; i < numSteps; i++ ) + for ( int i = 0; i < numSteps; ++i ) { if ( rs.style == STYLE_BOB ) { Build_StairStep_Wedge( rs.direction, vMin, vMax, rs.mainTexture, rs.riserTexture, rs.bUseDetail ); @@ -716,7 +716,7 @@ void DoFlipTerrain() { brushes[0] = &GlobalSelectionSystem().ultimateSelected(); brushes[1] = &GlobalSelectionSystem().penultimateSelected(); //ensure we have only Brushes selected. - for ( i = 0; i < 2; i++ ) + for ( i = 0; i < 2; ++i ) { if ( !Node_isBrush( brushes[i]->path().top() ) ) { //DoMessageBox( "No brushes selected, select ONLY brushes", "Error", EMessageBoxType::Error ); @@ -727,7 +727,7 @@ void DoFlipTerrain() { DBrush Brushes[2]; DPlane* Planes[2]; pntTripple Points[2]; - for ( i = 0; i < 2; i++ ) { + for ( i = 0; i < 2; ++i ) { Brushes[i].LoadFromBrush( *brushes[i], false ); if ( !( Planes[i] = Brushes[i].FindPlaneWithClosestNormal( vUp ) ) || Brushes[i].FindPointsForPlane( Planes[i], Points[i], 3 ) != 3 ) { //DoMessageBox( "Error", "Error", EMessageBoxType::Error ); @@ -744,8 +744,8 @@ void DoFlipTerrain() { int dontmatch[2] = { -1, -1 }; bool found = false; - for ( i = 0; i < 3; i++ ) { - for ( int j = 0; j < 3 && !found; j++ ) { + for ( i = 0; i < 3; ++i ) { + for ( int j = 0; j < 3 && !found; ++j ) { if ( VectorCompare( ( Points[0] )[i]->_pnt, ( Points[1] )[j]->_pnt ) ) { found = true; break; @@ -763,8 +763,8 @@ void DoFlipTerrain() { return; } - for ( i = 0; i < 3; i++ ) { - for ( int j = 0; j < 3 && !found; j++ ) { + for ( i = 0; i < 3; ++i ) { + for ( int j = 0; j < 3 && !found; ++j ) { if ( VectorCompare( ( Points[1] )[i]->_pnt, ( Points[0] )[j]->_pnt ) ) { found = true; break; @@ -787,7 +787,7 @@ void DoFlipTerrain() { vec3_t plnpntsshr[3]; VectorCopy( ( Points[0] )[dontmatch[0]]->_pnt, plnpnts1[0] ); - for ( i = 0; i < 3; i++ ) { + for ( i = 0; i < 3; ++i ) { if ( dontmatch[0] != i ) { VectorCopy( ( Points[0] )[i]->_pnt, plnpnts1[1] ); break; @@ -796,7 +796,7 @@ void DoFlipTerrain() { VectorCopy( ( Points[1] )[dontmatch[1]]->_pnt, plnpnts1[2] ); VectorCopy( ( Points[1] )[dontmatch[1]]->_pnt, plnpnts2[0] ); - for ( i = 0; i < 3; i++ ) { + for ( i = 0; i < 3; ++i ) { if ( dontmatch[1] != i && !VectorCompare( ( Points[1] )[i]->_pnt, plnpnts1[1] ) ) { VectorCopy( ( Points[1] )[i]->_pnt, plnpnts2[1] ); break; @@ -814,7 +814,7 @@ void DoFlipTerrain() { } plnpntsshr[2][2] -= 16; - for ( i = 0; i < 3; i++ ) { + for ( i = 0; i < 3; ++i ) { if ( mins2[i] < mins1[i] ) { mins1[i] = mins2[i]; } @@ -863,7 +863,7 @@ void DoFlipTerrain() { newBrushes[1]->AddFace( plnpntsshr[2], plnpntsshr[1], plnpntsshr[0], "textures/common/caulk", true ); } - for ( i = 0; i < 2; i++ ) { + for ( i = 0; i < 2; ++i ) { newBrushes[i]->RemoveRedundantPlanes(); newBrushes[i]->BuildInRadiant( false, NULL, brushes[i]->path().parent().get_pointer() ); Path_deleteTop( brushes[i]->path() ); diff --git a/contrib/bobtoolz/funchandlers.cpp b/contrib/bobtoolz/funchandlers.cpp index a49a2aad..d74c7e9c 100644 --- a/contrib/bobtoolz/funchandlers.cpp +++ b/contrib/bobtoolz/funchandlers.cpp @@ -230,7 +230,7 @@ void StairBuilder( vec3_t vMin, vec3_t vMax ){ // Build The Steps - for ( int i = 0; i < numSteps; i++ ) + for ( int i = 0; i < numSteps; ++i ) { if ( style == STYLE_BOB ) { Build_StairStep_Wedge( direction, vMin, vMax, "textures/common/caulk", (LPCTSTR)stairDlg.m_riserTexture, stairDlg.m_bDetail ); diff --git a/contrib/bobtoolz/misc.cpp b/contrib/bobtoolz/misc.cpp index 9a7196bb..58da0e9f 100644 --- a/contrib/bobtoolz/misc.cpp +++ b/contrib/bobtoolz/misc.cpp @@ -124,7 +124,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'; @@ -144,7 +144,7 @@ char* UnixToDosPath( char* path ){ #ifndef WIN32 return path; #else - for ( char* p = path; *p; p++ ) + for ( char* p = path; *p; ++p ) { if ( *p == '/' ) { *p = '\\'; diff --git a/contrib/bobtoolz/shapes.cpp b/contrib/bobtoolz/shapes.cpp index e4d893fe..4a92bc39 100644 --- a/contrib/bobtoolz/shapes.cpp +++ b/contrib/bobtoolz/shapes.cpp @@ -930,9 +930,9 @@ void MakeBevel( vec3_t vMin, vec3_t vMax ){ x_3[0] = 0; x_3[1] = 0; x_3[2] = 64; y_3[0] = 0; y_3[1] = 64; y_3[2] = 64; z_3[0] = 0; z_3[1] = 32; z_3[2] = 64;*/ - 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 ) { PatchControl& p = matrix( i, j ); p.m_vertex[0] = x_3[i]; @@ -941,9 +941,9 @@ 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++ ) + for ( int j = 0; j < 1; ++j ) { PatchControl& p = matrix( i, 2 - j ); PatchControl& q = matrix( i, j ); @@ -975,7 +975,7 @@ void BuildCornerStairs( vec3_t vMin, vec3_t vMax, int nSteps, const char* mainTe vTop[2] = vMin[2] + height; int i; - for ( i = 0; i <= nSteps; i++ ) + for ( i = 0; i <= nSteps; ++i ) { VectorCopy( centre, topPoints[i] ); VectorCopy( centre, botPoints[i] ); @@ -991,10 +991,10 @@ void BuildCornerStairs( vec3_t vMin, vec3_t vMax, int nSteps, const char* mainTe } vec3_t tp[3]; - for ( int j = 0; j < 3; j++ ) + for ( int j = 0; j < 3; ++j ) VectorCopy( topPoints[j], tp[j] ); - for ( i = 0; i < nSteps; i++ ) + for ( i = 0; i < nSteps; ++i ) { NodeSmartReference brush( GlobalBrushCreator().createBrush() ); vec3_t v1, v2, v3, v5, v6, v7; @@ -1015,7 +1015,7 @@ void BuildCornerStairs( vec3_t vMin, vec3_t vMax, int nSteps, const char* mainTe AddFaceWithTexture( brush, v1, v3, v6, "textures/common/caulk", false ); AddFaceWithTexture( brush, v5, v6, v3, "textures/common/caulk", false ); - for ( int j = 0; j < 3; j++ ) + for ( int j = 0; j < 3; ++j ) tp[j][2] = vTop[2]; AddFaceWithTexture( brush, tp[2], tp[1], tp[0], mainTexture, false ); diff --git a/contrib/bobtoolz/visfind.cpp b/contrib/bobtoolz/visfind.cpp index cae49c11..d9258109 100644 --- a/contrib/bobtoolz/visfind.cpp +++ b/contrib/bobtoolz/visfind.cpp @@ -145,7 +145,7 @@ void bsp_bitvectorsubtract( byte *first, byte *second, byte *out, int length ){ int i; - for ( i = 0; i < length; i++ ) + for ( i = 0; i < length; ++i ) *( out + i ) = *( first + i ) & ~( *( second + i ) ); } @@ -153,8 +153,8 @@ int bsp_countclusters( byte *bitvector, int length ){ int i, j, c; c = 0; - for ( i = 0; i < length; i++ ) - for ( j = 0; j < 8; j++ ) + for ( i = 0; i < length; ++i ) + for ( j = 0; j < 8; ++j ) if ( ( *( bitvector + i ) & ( 1 << j ) ) ) { c++; } @@ -165,8 +165,8 @@ int bsp_countclusters_mask( byte *bitvector, byte *maskvector, int length ){ int i, j, c; c = 0; - for ( i = 0; i < length; i++ ) - for ( j = 0; j < 8; j++ ) + for ( i = 0; i < length; ++i ) + for ( j = 0; j < 8; ++j ) if ( ( *( bitvector + i ) & ( 1 << j ) ) && ( *( maskvector + i ) & ( 1 << j ) ) ) { c++; } diff --git a/contrib/meshtex/MeshEntity.cpp b/contrib/meshtex/MeshEntity.cpp index 6341a8ae..2d0d304d 100644 --- a/contrib/meshtex/MeshEntity.cpp +++ b/contrib/meshtex/MeshEntity.cpp @@ -585,9 +585,9 @@ MeshEntity::UpdatePosMinMax(PositionAxis axis) // Iterate over all control points to find the min and max values. _posMin[axis] = _meshData(0, 0).m_vertex[axis]; _posMax[axis] = _posMin[axis]; - for (unsigned rowIndex = 0; rowIndex < _numSlices[ROW_SLICE_TYPE]; rowIndex++) + for (unsigned rowIndex = 0; rowIndex < _numSlices[ROW_SLICE_TYPE]; ++rowIndex) { - for (unsigned colIndex = 0; colIndex < _numSlices[COL_SLICE_TYPE]; colIndex++) + for (unsigned colIndex = 0; colIndex < _numSlices[COL_SLICE_TYPE]; ++colIndex) { float current = _meshData(rowIndex, colIndex).m_vertex[axis]; if (current < _posMin[axis]) @@ -620,9 +620,9 @@ MeshEntity::UpdateTexMinMax(TextureAxis axis) // Iterate over all control points to find the min and max values. _texMin[axis] = _meshData(0, 0).m_texcoord[axis]; _texMax[axis] = _texMin[axis]; - for (unsigned rowIndex = 0; rowIndex < _numSlices[ROW_SLICE_TYPE]; rowIndex++) + for (unsigned rowIndex = 0; rowIndex < _numSlices[ROW_SLICE_TYPE]; ++rowIndex) { - for (unsigned colIndex = 0; colIndex < _numSlices[COL_SLICE_TYPE]; colIndex++) + for (unsigned colIndex = 0; colIndex < _numSlices[COL_SLICE_TYPE]; ++colIndex) { float current = _meshData(rowIndex, colIndex).m_texcoord[axis]; if (current < _texMin[axis]) @@ -978,9 +978,9 @@ MeshEntity::Shift(TextureAxis axis, float shift) { // Iterate over all control points and add the offset. - for (unsigned rowIndex = 0; rowIndex < _numSlices[ROW_SLICE_TYPE]; rowIndex++) + for (unsigned rowIndex = 0; rowIndex < _numSlices[ROW_SLICE_TYPE]; ++rowIndex) { - for (unsigned colIndex = 0; colIndex < _numSlices[COL_SLICE_TYPE]; colIndex++) + for (unsigned colIndex = 0; colIndex < _numSlices[COL_SLICE_TYPE]; ++colIndex) { _meshData(rowIndex, colIndex).m_texcoord[axis] += shift; } @@ -1006,9 +1006,9 @@ MeshEntity::Scale(TextureAxis axis, UpdateTexMinMax(axis); // Iterate over all control points and apply the scale factor. - for (unsigned rowIndex = 0; rowIndex < _numSlices[ROW_SLICE_TYPE]; rowIndex++) + for (unsigned rowIndex = 0; rowIndex < _numSlices[ROW_SLICE_TYPE]; ++rowIndex) { - for (unsigned colIndex = 0; colIndex < _numSlices[COL_SLICE_TYPE]; colIndex++) + for (unsigned colIndex = 0; colIndex < _numSlices[COL_SLICE_TYPE]; ++colIndex) { // Leave the current minimum edge in place and scale out from that. _meshData(rowIndex, colIndex).m_texcoord[axis] = @@ -1270,7 +1270,7 @@ MeshEntity::EstimateSegmentLength(float startPosition, float xr = 0.5f * (endPosition - startPosition); float s = 0.0f; - for (unsigned j = 1; j <= 5; j++) { + for (unsigned j = 1; j <= 5; ++j) { float dx = xr * x[j]; s += w[j] * (SliceParametricSpeed(xm + dx, context) + SliceParametricSpeed(xm - dx, context)); @@ -1407,9 +1407,9 @@ MeshEntity::CopyControlTexFromValues(TextureAxis axis, const Matrix& values) { // Iterate over all control points and just do a straight copy. - for (unsigned rowIndex = 0; rowIndex < _numSlices[ROW_SLICE_TYPE]; rowIndex++) + for (unsigned rowIndex = 0; rowIndex < _numSlices[ROW_SLICE_TYPE]; ++rowIndex) { - for (unsigned colIndex = 0; colIndex < _numSlices[COL_SLICE_TYPE]; colIndex++) + for (unsigned colIndex = 0; colIndex < _numSlices[COL_SLICE_TYPE]; ++colIndex) { _meshData(rowIndex, colIndex).m_texcoord[axis] = values(rowIndex, colIndex); @@ -1499,9 +1499,9 @@ MeshEntity::CopyValuesFromControlTex(TextureAxis axis, Matrix& values) { // Iterate over all control points and just do a straight copy. - for (unsigned rowIndex = 0; rowIndex < _numSlices[ROW_SLICE_TYPE]; rowIndex++) + for (unsigned rowIndex = 0; rowIndex < _numSlices[ROW_SLICE_TYPE]; ++rowIndex) { - for (unsigned colIndex = 0; colIndex < _numSlices[COL_SLICE_TYPE]; colIndex++) + for (unsigned colIndex = 0; colIndex < _numSlices[COL_SLICE_TYPE]; ++colIndex) { values(rowIndex, colIndex) = _meshData(rowIndex, colIndex).m_texcoord[axis]; @@ -1572,7 +1572,7 @@ MeshEntity::GenScaledDistanceValues(SliceType sliceType, } // Iterate over the slices that need to be measured. - for (int slice = firstSlice; slice <= lastSlice; slice++) + for (int slice = firstSlice; slice <= lastSlice; ++slice) { // Some aspects of the SlicePatchContext will vary as we move from patch // to patch, but we can go ahead and calculate now any stuff that is @@ -1615,7 +1615,7 @@ MeshEntity::GenScaledDistanceValues(SliceType sliceType, // even/odd nature of the alignment slice. float slicewiseFraction = (float)((alignSlice & 0x1) + 1) / 2.0f; // Iterate over the control points greater than the alignment point. - for (int halfPatch = alignSlice + 1; halfPatch < (int)SliceSize(sliceType); halfPatch++) + for (int halfPatch = alignSlice + 1; halfPatch < (int)SliceSize(sliceType); ++halfPatch) { // Find the slice-of-other-kind that defines the patch edge orthogonal // to our slice. @@ -1644,7 +1644,7 @@ MeshEntity::GenScaledDistanceValues(SliceType sliceType, // depending on the even/odd nature of the alignment slice. slicewiseFraction = (float)((alignSlice - 1) & 0x1) / 2.0f; // Iterate over the control points less than the alignment point. - for (int halfPatch = alignSlice - 1; halfPatch >= 0; halfPatch--) + for (int halfPatch = alignSlice - 1; halfPatch >= 0; --halfPatch) { // Find the slice-of-other-kind that defines the patch edge orthogonal // to our slice. @@ -1687,7 +1687,7 @@ MeshEntity::GenScaledDistanceValues(SliceType sliceType, // Iterate over the slices we're processing and adjust the distance values // (remember that this may just be the reference slice). - for (int slice = firstSlice; slice <= lastSlice; slice++) + for (int slice = firstSlice; slice <= lastSlice; ++slice) { // Figure out what we're going to divide the distances by. float scaleFactor; @@ -1722,7 +1722,7 @@ MeshEntity::GenScaledDistanceValues(SliceType sliceType, rawScaleOrTiles; } // Adjust the distances for this slice by the divisor we calculated. - for (unsigned halfPatch = 0; halfPatch < SliceSize(sliceType); halfPatch++) + for (unsigned halfPatch = 0; halfPatch < SliceSize(sliceType); ++halfPatch) { MatrixElement(values, sliceType, slice, halfPatch) /= scaleFactor; } @@ -1735,9 +1735,9 @@ MeshEntity::GenScaledDistanceValues(SliceType sliceType, // (These loops also copy the reference slice to itself, which is fine.) if (refSlice != NULL && !refSlice->totalLengthOnly) { - for (unsigned slice = 0; slice < _numSlices[sliceType]; slice++) + for (unsigned slice = 0; slice < _numSlices[sliceType]; ++slice) { - for (unsigned halfPatch = 0; halfPatch < SliceSize(sliceType); halfPatch++) + for (unsigned halfPatch = 0; halfPatch < SliceSize(sliceType); ++halfPatch) { MatrixElement(values, sliceType, slice, halfPatch) = MatrixElement(values, sliceType, refSlice->index, halfPatch); @@ -1792,9 +1792,9 @@ MeshEntity::GeneralFunctionInt(const GeneralFunctionFactors& factors, } // Iterate over all values and apply the equation. - for (int rowIndex = 0; rowIndex < (int)_numSlices[ROW_SLICE_TYPE]; rowIndex++) + for (int rowIndex = 0; rowIndex < (int)_numSlices[ROW_SLICE_TYPE]; ++rowIndex) { - for (int colIndex = 0; colIndex < (int)_numSlices[COL_SLICE_TYPE]; colIndex++) + for (int colIndex = 0; colIndex < (int)_numSlices[COL_SLICE_TYPE]; ++colIndex) { newValues(rowIndex, colIndex) = factors.oldValue * oldValues(rowIndex, colIndex) + diff --git a/contrib/prtview/portals.cpp b/contrib/prtview/portals.cpp index bc336bf1..0459fb78 100644 --- a/contrib/prtview/portals.cpp +++ b/contrib/prtview/portals.cpp @@ -60,7 +60,7 @@ bool CBspPortal::Build( char *def ){ for ( auto& p : point ) { - for (; *c != 0 && *c != '('; c++ ){}; + for (; *c != 0 && *c != '('; ++c ){}; if ( *c == 0 ) { return false; diff --git a/libs/ddslib/ddslib.c b/libs/ddslib/ddslib.c index 03b01f80..c2f537f5 100644 --- a/libs/ddslib/ddslib.c +++ b/libs/ddslib/ddslib.c @@ -305,12 +305,12 @@ static void DDSDecodeColorBlock( unsigned int *pixel, ddsColorBlock_t *block, in /* r steps through lines in y */ - for ( r = 0; r < 4; r++, pixel += ( width - 4 ) ) /* no width * 4 as unsigned int ptr inc will * 4 */ + for ( r = 0; r < 4; ++r, pixel += ( width - 4 ) ) /* no width * 4 as unsigned int ptr inc will * 4 */ { /* width * 4 bytes per pixel per line, each j dxtc row is 4 lines of pixels */ /* n steps through pixels */ - for ( n = 0; n < 4; n++ ) + for ( n = 0; n < 4; ++n ) { bits = block->row[ r ] & masks[ n ]; bits >>= shift[ n ]; @@ -365,12 +365,12 @@ static void DDSDecodeAlphaExplicit( unsigned int *pixel, ddsAlphaBlockExplicit_t color.b = 0; /* walk rows */ - for ( row = 0; row < 4; row++, pixel += ( width - 4 ) ) + for ( row = 0; row < 4; ++row, pixel += ( width - 4 ) ) { word = DDSLittleShort( alphaBlock->row[ row ] ); /* walk pixels */ - for ( pix = 0; pix < 4; pix++ ) + for ( pix = 0; pix < 4; ++pix ) { /* zero the alpha bits of image pixel */ *pixel &= alphaZero; @@ -468,9 +468,9 @@ static void DDSDecodeAlpha3BitLinear( unsigned int *pixel, ddsAlphaBlock3BitLine bits[ 3 ][ 3 ] = (unsigned char) ( stuff & 0x00000007 ); /* decode the codes into alpha values */ - for ( row = 0; row < 4; row++ ) + for ( row = 0; row < 4; ++row ) { - for ( pix = 0; pix < 4; pix++ ) + for ( pix = 0; pix < 4; ++pix ) { aColors[ row ][ pix ].r = 0; aColors[ row ][ pix ].g = 0; @@ -480,9 +480,9 @@ static void DDSDecodeAlpha3BitLinear( unsigned int *pixel, ddsAlphaBlock3BitLine } /* write out alpha values to the image bits */ - for ( row = 0; row < 4; row++, pixel += width - 4 ) + for ( row = 0; row < 4; ++row, pixel += width - 4 ) { - for ( pix = 0; pix < 4; pix++ ) + for ( pix = 0; pix < 4; ++pix ) { /* zero the alpha bits of image pixel */ *pixel &= alphaZero; @@ -513,13 +513,13 @@ static int DDSDecompressDXT1( ddsBuffer_t *dds, int width, int height, unsigned yBlocks = height / 4; /* walk y */ - for ( y = 0; y < yBlocks; y++ ) + for ( y = 0; y < yBlocks; ++y ) { /* 8 bytes per block */ block = (ddsColorBlock_t*) ( (char *) dds->data + y * xBlocks * 8 ); /* walk x */ - for ( x = 0; x < xBlocks; x++, block++ ) + for ( x = 0; x < xBlocks; ++x, ++block ) { DDSGetColorBlockColors( block, colors ); pixel = (unsigned int*) ( pixels + x * 16 + ( y * 4 ) * width * 4 ); @@ -558,13 +558,13 @@ static int DDSDecompressDXT3( ddsBuffer_t *dds, int width, int height, unsigned alphaZero = *( (unsigned int*) &colors[ 0 ] ); /* walk y */ - for ( y = 0; y < yBlocks; y++ ) + for ( y = 0; y < yBlocks; ++y ) { /* 8 bytes per block, 1 block for alpha, 1 block for color */ block = (ddsColorBlock_t*) ( (char *) dds->data + y * xBlocks * 16 ); /* walk x */ - for ( x = 0; x < xBlocks; x++, block++ ) + for ( x = 0; x < xBlocks; ++x, ++block ) { /* get alpha block */ alphaBlock = (ddsAlphaBlockExplicit_t*) block; @@ -613,13 +613,13 @@ static int DDSDecompressDXT5( ddsBuffer_t *dds, int width, int height, unsigned alphaZero = *( (unsigned int*) &colors[ 0 ] ); /* walk y */ - for ( y = 0; y < yBlocks; y++ ) + for ( y = 0; y < yBlocks; ++y ) { /* 8 bytes per block, 1 block for alpha, 1 block for color */ block = (ddsColorBlock_t*) ( (char *) dds->data + y * xBlocks * 16 ); /* walk x */ - for ( x = 0; x < xBlocks; x++, block++ ) + for ( x = 0; x < xBlocks; ++x, ++block ) { /* get alpha block */ alphaBlock = (ddsAlphaBlock3BitLinear_t*) block; @@ -694,10 +694,10 @@ static int DDSDecompressARGB8888( ddsBuffer_t *dds, int width, int height, unsig out = pixels; /* walk y */ - for ( y = 0; y < height; y++ ) + for ( y = 0; y < height; ++y ) { /* walk x */ - for ( x = 0; x < width; x++ ) + for ( x = 0; x < width; ++x ) { *out++ = *in++; *out++ = *in++; diff --git a/libs/etclib.c b/libs/etclib.c index 5bb98b1b..a7a7fced 100644 --- a/libs/etclib.c +++ b/libs/etclib.c @@ -40,7 +40,7 @@ static void ETC_DecodeETC1SubBlock( byte *out, bool outRGBA, int r, int g, int b } } - for ( i = 0; i < 8; i++ ) + for ( i = 0; i < 8; ++i ) { int x, y, k, delta; int qr, qg, qb; diff --git a/libs/gtkutil/glfont.cpp b/libs/gtkutil/glfont.cpp index 99b203aa..bbcdce25 100644 --- a/libs/gtkutil/glfont.cpp +++ b/libs/gtkutil/glfont.cpp @@ -35,8 +35,8 @@ void gray_to_texture( const unsigned int x_max, const unsigned int y_max, const const unsigned char backgroundColorG = 0; const unsigned char backgroundColorB = 0; - for( y = 0; y < y_max; y++ ) { - for( x = 0; x < x_max; x++ ) { + for( y = 0; y < y_max; ++y ) { + for( x = 0; x < x_max; ++x ) { const unsigned int iter = ( y * x_max + x ) * 4; if( x == 0 || y == 0 || x == 1 || y == 1 ) { out[iter] = fontColorB; @@ -62,8 +62,8 @@ void gray_to_texture( const unsigned int x_max, const unsigned int y_max, const } bitmapIter = 0; - for( y = 0; y < y_max; y++ ) { - for( x = 0; x < x_max; x++ ) { + for( y = 0; y < y_max; ++y ) { + for( x = 0; x < x_max; ++x ) { const unsigned int iter = ( y * x_max + x ) * 4; if( x == 0 || y == 0 || x == ( x_max - 1 ) || y == ( y_max - 1 ) ) { continue; @@ -195,7 +195,7 @@ public: if( a == 1.0 ) { do { row -= bitmap.width; - for( unsigned int i = 0; i < bitmap.width; i++ ) + for( unsigned int i = 0; i < bitmap.width; ++i ) *t++ = rgb | ( ( guint32 ) row[i] ); } while( row != row_end ); @@ -204,7 +204,7 @@ public: do { row -= bitmap.width; - for( unsigned int i = 0; i < bitmap.width; i++ ) + for( unsigned int i = 0; i < bitmap.width; ++i ) * t++ = rgb | ( ( guint32 )( a* row[i] ) ); } while( row != row_end ); } @@ -224,8 +224,8 @@ public: const unsigned char backgroundColorG = 64; const unsigned char backgroundColorB = 64; - for( y = 0; y < y_max; y++ ) { - for( x = 0; x < x_max; x++ ) { + for( y = 0; y < y_max; ++y ) { + for( x = 0; x < x_max; ++x ) { const unsigned int iter = ( y * x_max + x ) * 4; if( x == 0 || y == 0 || x == ( x_max - 1 ) || y == ( y_max - 1 ) ) { buf[iter] = backgroundColorB; @@ -270,8 +270,8 @@ public: unsigned char backgroundColorG = 0; unsigned char backgroundColorB = 0; - for( y = 0; y < y_max; y++ ) { - for( x = 0; x < x_max; x++ ) { + for( y = 0; y < y_max; ++y ) { + for( x = 0; x < x_max; ++x ) { const unsigned int iter = ( y * x_max + x ) * 4; if( x == 0 || y == 0 || x == 1 || y == 1 ) { buf[iter] = fontColorB; @@ -297,8 +297,8 @@ public: } bitmapIter = 0; - for( y = 0; y < y_max; y++ ) { - for( x = 0; x < x_max; x++ ) { + for( y = 0; y < y_max; ++y ) { + for( x = 0; x < x_max; ++x ) { const unsigned int iter = ( y * x_max + x ) * 4; if( x == 0 || y == 0 || x == ( x_max - 1 ) || y == ( y_max - 1 ) ) { continue; @@ -336,8 +336,8 @@ public: unsigned char fontColorG = colour[1]; unsigned char fontColorB = colour[2]; - for( y = 0; y < y_max; y++ ) { - for( x = 0; x < x_max; x++ ) { + for( y = 0; y < y_max; ++y ) { + for( x = 0; x < x_max; ++x ) { const unsigned int iter = ( y * x_max + x ) * 4; if( x == 0 || y == 0 || x == ( x_max - 1 ) || y == ( y_max - 1 ) ) { buf[iter] = fontColorB; @@ -472,7 +472,7 @@ GLFont *glfont_create( const char* font_string ){ * for each row of chars, call glXUseXFont to build the bitmaps. */ - for ( i = firstrow; i <= lastrow; i++ ) + for ( i = firstrow; i <= lastrow; ++i ) { glXUseXFont( fontInfo->fid, firstbitmap, last - first + 1, font_list_base + firstbitmap ); firstbitmap += 256; diff --git a/libs/l_net/l_net_wins.c b/libs/l_net/l_net_wins.c index fb3685a0..bccadcb2 100644 --- a/libs/l_net/l_net_wins.c +++ b/libs/l_net/l_net_wins.c @@ -160,13 +160,11 @@ ERROR_STRUCT errlist[] = { const char *WINS_ErrorMessage( int error ){ - int search = 0; - if ( !error ) { return "No error occurred"; } - for ( search = 0; errlist[search].errstr; search++ ) { + for ( int search = 0; errlist[search].errstr; ++search ) { if ( error == errlist[search].errnum ) { return errlist[search].errstr; } @@ -208,14 +206,14 @@ bool WINS_Init( void ){ { // see if it's a text IP address (well, close enough) - for ( p = buff; *p; p++ ) + for ( p = buff; *p; ++p ) if ( ( *p < '0' || *p > '9' ) && *p != '.' ) { break; } // if it is a real name, strip off the domain; we only want the host if ( *p ) { - for ( i = 0; i < 15; i++ ) + for ( i = 0; i < 15; ++i ) if ( buff[i] == '.' ) { break; } diff --git a/libs/mathlib/bbox.c b/libs/mathlib/bbox.c index 6b20d877..3c9b95d2 100644 --- a/libs/mathlib/bbox.c +++ b/libs/mathlib/bbox.c @@ -42,7 +42,7 @@ void aabb_extend_by_point( aabb_t *aabb, const vec3_t point ){ #if 1 int i; vec_t min, max, displacement; - for ( i = 0; i < 3; i++ ) + for ( i = 0; i < 3; ++i ) { displacement = point[i] - aabb->origin[i]; if ( fabs( displacement ) > aabb->extents[i] ) { @@ -87,7 +87,7 @@ void aabb_extend_by_point( aabb_t *aabb, const vec3_t point ){ void aabb_extend_by_aabb( aabb_t *aabb, const aabb_t *aabb_src ){ int i; vec_t min, max, displacement, difference; - for ( i = 0; i < 3; i++ ) + for ( i = 0; i < 3; ++i ) { displacement = aabb_src->origin[i] - aabb->origin[i]; difference = aabb_src->extents[i] - aabb->extents[i]; @@ -126,7 +126,7 @@ void aabb_extend_by_vec3( aabb_t *aabb, vec3_t extension ){ int aabb_test_point( const aabb_t *aabb, const vec3_t point ){ int i; - for ( i = 0; i < 3; i++ ) + for ( i = 0; i < 3; ++i ) if ( fabs( point[i] - aabb->origin[i] ) >= aabb->extents[i] ) { return 0; } @@ -135,7 +135,7 @@ int aabb_test_point( const aabb_t *aabb, const vec3_t point ){ int aabb_test_aabb( const aabb_t *aabb, const aabb_t *aabb_src ){ int i; - for ( i = 0; i < 3; i++ ) + for ( i = 0; i < 3; ++i ) if ( fabs( aabb_src->origin[i] - aabb->origin[i] ) > ( fabs( aabb->extents[i] ) + fabs( aabb_src->extents[i] ) ) ) { return 0; } @@ -184,7 +184,7 @@ int aabb_intersect_ray( const aabb_t *aabb, const ray_t *ray, vec3_t intersectio /* Find candidate planes; this loop can be avoided if rays cast all from the eye(assume perspective view) */ - for ( i = 0; i < NUMDIM; i++ ) + for ( i = 0; i < NUMDIM; ++i ) { if ( origin[i] < ( aabb->origin[i] - aabb->extents[i] ) ) { quadrant[i] = LEFT; @@ -210,7 +210,7 @@ int aabb_intersect_ray( const aabb_t *aabb, const ray_t *ray, vec3_t intersectio /* Calculate T distances to candidate planes */ - for ( i = 0; i < NUMDIM; i++ ) + for ( i = 0; i < NUMDIM; ++i ) { if ( quadrant[i] != MIDDLE && direction[i] != 0. ) { maxT[i] = ( candidatePlane[i] - origin[i] ) / direction[i]; @@ -222,7 +222,7 @@ int aabb_intersect_ray( const aabb_t *aabb, const ray_t *ray, vec3_t intersectio /* Get largest of the maxT's for final choice of intersection */ whichPlane = 0; - for ( i = 1; i < NUMDIM; i++ ) + for ( i = 1; i < NUMDIM; ++i ) if ( maxT[whichPlane] < maxT[i] ) { whichPlane = i; } @@ -231,7 +231,7 @@ int aabb_intersect_ray( const aabb_t *aabb, const ray_t *ray, vec3_t intersectio if ( maxT[whichPlane] < 0. ) { return 0; } - for ( i = 0; i < NUMDIM; i++ ) + for ( i = 0; i < NUMDIM; ++i ) { if ( whichPlane != i ) { intersection[i] = (vec_t)( origin[i] + maxT[whichPlane] * direction[i] ); @@ -314,7 +314,7 @@ void aabb_for_bbox( aabb_t *aabb, const bbox_t *bbox ){ VectorScale( bbox->axes[0], bbox->aabb.extents[0], temp[0] ); VectorScale( bbox->axes[1], bbox->aabb.extents[1], temp[1] ); VectorScale( bbox->axes[2], bbox->aabb.extents[2], temp[2] ); - for ( i = 0; i < 3; i++ ) aabb->extents[i] = (vec_t)( fabs( temp[0][i] ) + fabs( temp[1][i] ) + fabs( temp[2][i] ) ); + for ( i = 0; i < 3; ++i ) aabb->extents[i] = (vec_t)( fabs( temp[0][i] ) + fabs( temp[1][i] ) + fabs( temp[2][i] ) ); } void aabb_for_area( aabb_t *aabb, vec3_t area_tl, vec3_t area_br, int axis ){ diff --git a/libs/mathlib/m4x4.c b/libs/mathlib/m4x4.c index 9a4470b9..ee3b4376 100644 --- a/libs/mathlib/m4x4.c +++ b/libs/mathlib/m4x4.c @@ -646,7 +646,7 @@ void m4x4_multiply_by_m4x4( m4x4_t dst, const m4x4_t src ){ #else vec_t * p = dst; - for ( int i = 0; i < 4; i++ ) + for ( int i = 0; i < 4; ++i ) { dst1 = src[0] * p[0]; dst1 += src[1] * p[4]; @@ -731,7 +731,7 @@ void m4x4_premultiply_by_m4x4( m4x4_t dst, const m4x4_t src ){ #else vec_t* p = dst; - for ( int i = 0; i < 4; i++ ) + for ( int i = 0; i < 4; ++i ) { dst1 = src[0] * p[0]; dst2 = src[1] * p[0]; @@ -1360,8 +1360,8 @@ void m4x4_transpose( m4x4_t matrix ){ int i, j; float temp, *p1, *p2; - for ( i = 1; i < 4; i++ ) { - for ( j = 0; j < i; j++ ) { + for ( i = 1; i < 4; ++i ) { + for ( j = 0; j < i; ++j ) { p1 = matrix + ( j * 4 + i ); p2 = matrix + ( i * 4 + j ); temp = *p1; @@ -1519,7 +1519,7 @@ void m3x3_multiply_by_m3x3( m3x3_t matrix, const m3x3_t matrix_src ){ float out1, out2, out3; int i; - for ( i = 0; i < 3; i++ ) + for ( i = 0; i < 3; ++i ) { out1 = matrix_src[0] * pDest[0]; out1 += matrix_src[1] * pDest[3]; @@ -1593,7 +1593,7 @@ int m3_inverse( m3x3_t mr, m3x3_t ma ){ void m4_submat( m4x4_t mr, m3x3_t mb, int i, int j ){ int ti, tj, idst, jdst; - for ( ti = 0; ti < 4; ti++ ) + for ( ti = 0; ti < 4; ++ti ) { if ( ti < i ) { idst = ti; @@ -1605,7 +1605,7 @@ void m4_submat( m4x4_t mr, m3x3_t mb, int i, int j ){ continue; } - for ( tj = 0; tj < 4; tj++ ) + for ( tj = 0; tj < 4; ++tj ) { if ( tj < j ) { jdst = tj; @@ -1627,7 +1627,7 @@ float m4_det( m4x4_t mr ){ m3x3_t msub3; int n; - for ( n = 0; n < 4; n++, i *= -1 ) + for ( n = 0; n < 4; ++n, i *= -1 ) { m4_submat( mr, msub3, 0, n ); @@ -1652,8 +1652,8 @@ int m4x4_invert( m4x4_t matrix ){ m4x4_assign( m4x4_temp, matrix ); - for ( i = 0; i < 4; i++ ) - for ( j = 0; j < 4; j++ ) + for ( i = 0; i < 4; ++i ) + for ( j = 0; j < 4; ++j ) { sign = 1 - ( ( i + j ) % 2 ) * 2; @@ -1676,16 +1676,16 @@ void m4x4_solve_ge( m4x4_t matrix, vec4_t x ){ float recip, ratio; float* p; - for ( r = 0; r < 4; r++ ) + for ( r = 0; r < 4; ++r ) { aug[r] = 0; indx[r] = r; } - for ( r = 0; r < 4; r++ ) + for ( r = 0; r < 4; ++r ) { scale[r] = 0; - for ( c = 0; c < 4; c++, p++ ) + for ( c = 0; c < 4; ++c, ++p ) { if ( fabs( *p ) > scale[r] ) { scale[r] = (float)fabs( *p ); @@ -1693,10 +1693,10 @@ void m4x4_solve_ge( m4x4_t matrix, vec4_t x ){ } } - for ( c = 0; c < 3; c++ ) + for ( c = 0; c < 3; ++c ) { pivot = 0; - for ( r = c; r < 4; r++ ) + for ( r = c; r < 4; ++r ) { f = (float)fabs( matrix[( indx[r] << 2 ) + c] ) / scale[indx[r]]; if ( f > pivot ) { @@ -1711,24 +1711,24 @@ void m4x4_solve_ge( m4x4_t matrix, vec4_t x ){ recip = 1 / matrix[( indx[c] << 2 ) + c]; - for ( r = c + 1; r < 4; r++ ) + for ( r = c + 1; r < 4; ++r ) { p = matrix + ( indx[r] << 2 ); ratio = p[c] * recip; - for ( i = c + 1; i < 4; i++ ) + for ( i = c + 1; i < 4; ++i ) p[i] -= ratio * matrix[( indx[c] << 2 ) + i]; aug[indx[r]] -= ratio * aug[indx[c]]; } } x[indx[3]] = aug[indx[3]] / matrix[( indx[3] << 2 ) + 3]; - for ( r = 2; r >= 0; r-- ) + for ( r = 2; r >= 0; --r ) { f = aug[indx[r]]; p = matrix + ( indx[r] << 2 ); recip = 1 / p[r]; - for ( c = ( r + 1 ); c < 4; c++ ) + for ( c = ( r + 1 ); c < 4; ++c ) { f -= ( p[c] * x[indx[c]] ); } @@ -1749,16 +1749,16 @@ int matrix_solve_ge( vec_t* matrix, vec_t* aug, vec3_t x ){ float ratio; float* p; - for ( r = 0; r < N; r++ ) + for ( r = 0; r < N; ++r ) { indx[r] = r; } - for ( r = 0; r < N; r++ ) + for ( r = 0; r < N; ++r ) { p = matrix + r; scale[r] = 0; - for ( c = 0; c < N; c++, p++ ) + for ( c = 0; c < N; ++c, ++p ) { if ( fabs( *p ) > scale[r] ) { scale[r] = (float)fabs( *p ); @@ -1766,11 +1766,11 @@ int matrix_solve_ge( vec_t* matrix, vec_t* aug, vec3_t x ){ } } - for ( c = 0; c < N; c++ ) + for ( c = 0; c < N; ++c ) { pivot = 0; best = -1; - for ( r = c; r < N; r++ ) + for ( r = c; r < N; ++r ) { f = (float)fabs( matrix[( indx[r] * N ) + c] ) / scale[indx[r]]; if ( f > pivot ) { @@ -1787,22 +1787,22 @@ int matrix_solve_ge( vec_t* matrix, vec_t* aug, vec3_t x ){ indx[c] = indx[best]; indx[best] = i; - for ( r = c + 1; r < N; r++ ) + for ( r = c + 1; r < N; ++r ) { p = matrix + ( indx[r] * N ); ratio = p[c] / matrix[( indx[c] * N ) + c]; - for ( i = c + 1; i < N; i++ ) p[i] -= ratio * matrix[( indx[c] * N ) + i]; + for ( i = c + 1; i < N; ++i ) p[i] -= ratio * matrix[( indx[c] * N ) + i]; aug[indx[r]] -= ratio * aug[indx[c]]; } } x[N - 1] = aug[indx[N - 1]] / matrix[( indx[N - 1] * N ) + N - 1]; - for ( r = 1; r >= 0; r-- ) + for ( r = 1; r >= 0; --r ) { f = aug[indx[r]]; p = matrix + ( indx[r] * N ); - for ( c = ( r + 1 ); c < N; c++ ) f -= ( p[c] * x[c] ); + for ( c = ( r + 1 ); c < N; ++c ) f -= ( p[c] * x[c] ); x[r] = f / p[r]; } return 0; @@ -1810,12 +1810,12 @@ int matrix_solve_ge( vec_t* matrix, vec_t* aug, vec3_t x ){ #ifdef YOU_WANT_IT_TO_BORK /* Gaussian elimination */ -for ( i = 0; i < 4; i++ ) +for ( i = 0; i < 4; ++i ) { - for ( j = ( i + 1 ); j < 4; j++ ) + for ( j = ( i + 1 ); j < 4; ++j ) { ratio = matrix[j][i] / matrix[i][i]; - for ( count = i; count < n; count++ ) { + for ( count = i; count < n; ++count ) { matrix[j][count] -= ( ratio * matrix[i][count] ); } b[j] -= ( ratio * b[i] ); @@ -1824,10 +1824,10 @@ for ( i = 0; i < 4; i++ ) /* Back substitution */ x[n - 1] = b[n - 1] / matrix[n - 1][n - 1]; -for ( i = ( n - 2 ); i >= 0; i-- ) +for ( i = ( n - 2 ); i >= 0; --i ) { temp = b[i]; - for ( j = ( i + 1 ); j < n; j++ ) + for ( j = ( i + 1 ); j < n; ++j ) { temp -= ( matrix[i][j] * x[j] ); } diff --git a/libs/mathlib/mathlib.c b/libs/mathlib/mathlib.c index b6733886..358b0830 100644 --- a/libs/mathlib/mathlib.c +++ b/libs/mathlib/mathlib.c @@ -39,7 +39,7 @@ bool VectorIsOnAxis( vec3_t v ){ int i, zeroComponentCount; zeroComponentCount = 0; - for ( i = 0; i < 3; i++ ) + for ( i = 0; i < 3; ++i ) { if ( v[i] == 0.0 ) { zeroComponentCount++; @@ -62,7 +62,7 @@ bool VectorIsOnAxis( vec3_t v ){ bool VectorIsOnAxialPlane( vec3_t v ){ int i; - for ( i = 0; i < 3; i++ ) + for ( i = 0; i < 3; ++i ) { if ( v[i] == 0.0 ) { // The zero vector will be on axial plane. @@ -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; } @@ -252,7 +252,7 @@ void VectorRotate( vec3_t vIn, vec3_t vRotation, vec3_t out ){ nIndex[1][0] = 2; nIndex[1][1] = 0; nIndex[2][0] = 0; nIndex[2][1] = 1; - for ( i = 0; i < 3; i++ ) + for ( i = 0; i < 3; ++i ) { if ( vRotation[i] != 0 ) { float dAngle = vRotation[i] * Q_PI / 180.0f; @@ -282,7 +282,7 @@ void VectorPolar( vec3_t v, float radius, float theta, float phi ){ void VectorSnap( vec3_t v ){ int i; - for ( i = 0; i < 3; i++ ) + for ( i = 0; i < 3; ++i ) { v[i] = (vec_t)FLOAT_TO_INTEGER( v[i] ); } @@ -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] ) { @@ -552,7 +552,7 @@ void PerpendicularVector( vec3_t dst, const vec3_t src ){ /* ** find the smallest magnitude axially aligned vector */ - for ( pos = 0, i = 0; i < 3; i++ ) + for ( pos = 0, i = 0; i < 3; ++i ) { if ( fabs( src[i] ) < minelem ) { pos = i; @@ -631,7 +631,7 @@ void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, MatrixMultiply( m, zrot, tmpmat ); MatrixMultiply( tmpmat, im, rot ); - for ( i = 0; i < 3; i++ ) { + for ( i = 0; i < 3; ++i ) { dst[i] = rot[i][0] * point[0] + rot[i][1] * point[1] + rot[i][2] * point[2]; } } diff --git a/libs/xml/xmltextags.cpp b/libs/xml/xmltextags.cpp index bf64e602..310f403f 100644 --- a/libs/xml/xmltextags.cpp +++ b/libs/xml/xmltextags.cpp @@ -382,7 +382,7 @@ int XmlTagBuilder::RenameShaderTag( const char* oldtag, CopiedString newtag ){ } xmlNodeSetPtr nodePtr = result->nodesetval; if ( !xmlXPathNodeSetIsEmpty( nodePtr ) ) { - for ( int i = 0; i < nodePtr->nodeNr; i++ ) + for ( int i = 0; i < nodePtr->nodeNr; ++i ) { xmlNodePtr ptrContent = nodePtr->nodeTab[i]; char* content = (char*)xmlNodeGetContent( ptrContent ); @@ -419,7 +419,7 @@ bool XmlTagBuilder::DeleteShaderTag( const char* shader, const char* tag ){ } if ( !xmlXPathNodeSetIsEmpty( nodePtr ) ) { - for ( int i = 0; i < nodePtr->nodeNr; i++ ) + for ( int i = 0; i < nodePtr->nodeNr; ++i ) { xmlNodePtr ptrContent = nodePtr->nodeTab[i]; char* content = (char*)(xmlChar*)xmlNodeGetContent( ptrContent ); @@ -494,7 +494,7 @@ void XmlTagBuilder::GetShaderTags( const char* shader, std::vector } if ( !xmlXPathNodeSetIsEmpty( nodePtr ) ) { - for ( int i = 0; i < nodePtr->nodeNr; i++ ) + for ( int i = 0; i < nodePtr->nodeNr; ++i ) { tags.push_back( CopiedString( (char*)xmlNodeGetContent( nodePtr->nodeTab[i] ) ) ); } @@ -522,7 +522,7 @@ void XmlTagBuilder::GetUntagged( std::set& shaders ){ if ( !xmlXPathNodeSetIsEmpty( nodePtr ) ) { xmlNodePtr ptr; - for ( int i = 0; i < nodePtr->nodeNr; i++ ) + for ( int i = 0; i < nodePtr->nodeNr; ++i ) { ptr = nodePtr->nodeTab[i]; shaders.insert( (char*)xmlGetProp( ptr, (const xmlChar*)"path" ) ); @@ -550,7 +550,7 @@ void XmlTagBuilder::GetAllTags( std::set& tags ){ } if ( !xmlXPathNodeSetIsEmpty( nodePtr ) ) { - for ( int i = 0; i < nodePtr->nodeNr; i++ ) + for ( int i = 0; i < nodePtr->nodeNr; ++i ) { tags.insert( CopiedString( (char*)xmlNodeGetContent( nodePtr->nodeTab[i] ) ) ); } @@ -579,7 +579,7 @@ void XmlTagBuilder::TagSearch( const char* expression, std::set& p if ( !xmlXPathNodeSetIsEmpty( nodePtr ) ) { xmlNodePtr ptr; xmlChar* xmlattrib; - for ( int i = 0; i < nodePtr->nodeNr; i++ ) + for ( int i = 0; i < nodePtr->nodeNr; ++i ) { ptr = nodePtr->nodeTab[i]; xmlattrib = xmlGetProp( ptr, (const xmlChar*)"path" ); diff --git a/plugins/assmodel/model.cpp b/plugins/assmodel/model.cpp index e81035c7..f153d933 100644 --- a/plugins/assmodel/model.cpp +++ b/plugins/assmodel/model.cpp @@ -292,7 +292,7 @@ private: for ( size_t t = 0; t < mesh->mNumFaces; ++t ){ const aiFace& face = mesh->mFaces[t]; // if( face.mNumIndices == 3 ) - for ( size_t i = 0; i < 3; i++ ){ + for ( size_t i = 0; i < 3; ++i ){ m_indices[idCopied++] = face.mIndices[i]; } } diff --git a/plugins/entity/light.cpp b/plugins/entity/light.cpp index 139dcb9e..328a6928 100644 --- a/plugins/entity/light.cpp +++ b/plugins/entity/light.cpp @@ -248,7 +248,7 @@ void drawtri( float * a, float * b, float * c, int div, Vector3 radiiPoints[SPHE radiiPoints[k++] = Vector3( c[0], c[1], c[2] ); } else { float ab[3], ac[3], bc[3]; - for( int i = 0; i < 3; i++ ) { + for( int i = 0; i < 3; ++i ) { ab[i] = ( a[i] + b[i] ) / 2; ac[i] = ( a[i] + c[i] ) / 2; bc[i] = ( b[i] + c[i] ) / 2; @@ -265,7 +265,7 @@ void drawtri( float * a, float * b, float * c, int div, Vector3 radiiPoints[SPHE void sphere_construct_fill( Vector3 radiiPoints[SPHERE_FILL_POINTS] ){ int k = 0; - for( int i = 0; i < 20; i++ ) + for( int i = 0; i < 20; ++i ) drawtri( vdata[tindices[i][0]], vdata[tindices[i][1]], vdata[tindices[i][2]], SPHERE_FILL_DIV, radiiPoints, k ); } @@ -334,7 +334,7 @@ void sphere_draw_wire( const Vector3& origin, float radius, int sides ){ { gl().glBegin( GL_LINE_LOOP ); - for ( int i = 0; i <= sides; i++ ) + for ( int i = 0; i <= sides; ++i ) { double ds = sin( ( i * 2 * c_pi ) / sides ); double dc = cos( ( i * 2 * c_pi ) / sides ); @@ -352,7 +352,7 @@ void sphere_draw_wire( const Vector3& origin, float radius, int sides ){ { gl().glBegin( GL_LINE_LOOP ); - for ( int i = 0; i <= sides; i++ ) + for ( int i = 0; i <= sides; ++i ) { double ds = sin( ( i * 2 * c_pi ) / sides ); double dc = cos( ( i * 2 * c_pi ) / sides ); @@ -370,7 +370,7 @@ void sphere_draw_wire( const Vector3& origin, float radius, int sides ){ { gl().glBegin( GL_LINE_LOOP ); - for ( int i = 0; i <= sides; i++ ) + for ( int i = 0; i <= sides; ++i ) { double ds = sin( ( i * 2 * c_pi ) / sides ); double dc = cos( ( i * 2 * c_pi ) / sides ); @@ -406,7 +406,7 @@ void light_draw_radius_wire( const Vector3& origin, const std::array& void sphere_construct_wire( Vector3 radiiPoints[SPHERE_WIRE_POINTS] ){ int k = 0; - for ( int i = 0; i < SPHERE_WIRE_SIDES; i++ ) + for ( int i = 0; i < SPHERE_WIRE_SIDES; ++i ) { double ds = sin( ( i * 2 * c_pi ) / SPHERE_WIRE_SIDES ); double dc = cos( ( i * 2 * c_pi ) / SPHERE_WIRE_SIDES ); @@ -419,7 +419,7 @@ void sphere_construct_wire( Vector3 radiiPoints[SPHERE_WIRE_POINTS] ){ ); } - for ( int i = 0; i < SPHERE_WIRE_SIDES; i++ ) + for ( int i = 0; i < SPHERE_WIRE_SIDES; ++i ) { double ds = sin( ( i * 2 * c_pi ) / SPHERE_WIRE_SIDES ); double dc = cos( ( i * 2 * c_pi ) / SPHERE_WIRE_SIDES ); @@ -432,7 +432,7 @@ void sphere_construct_wire( Vector3 radiiPoints[SPHERE_WIRE_POINTS] ){ ); } - for ( int i = 0; i < SPHERE_WIRE_SIDES; i++ ) + for ( int i = 0; i < SPHERE_WIRE_SIDES; ++i ) { double ds = sin( ( i * 2 * c_pi ) / SPHERE_WIRE_SIDES ); double dc = cos( ( i * 2 * c_pi ) / SPHERE_WIRE_SIDES ); @@ -453,7 +453,7 @@ void sphere_draw_wire( const Vector3& origin, float radius, const Vector3 radiiP { gl().glBegin( GL_LINE_LOOP ); - for ( int i = 0; i < SPHERE_WIRE_SIDES; i++ ) + for ( int i = 0; i < SPHERE_WIRE_SIDES; ++i ) { gl().glVertex3fv( vector3_to_array( vector3_added( origin, vector3_scaled( radiiPoints[k++], radius ) ) ) ); } diff --git a/plugins/entity/targetable.h b/plugins/entity/targetable.h index 5126a65f..c4e08f5a 100644 --- a/plugins/entity/targetable.h +++ b/plugins/entity/targetable.h @@ -71,7 +71,7 @@ public: len *= 0.0625; // half / 8 Vector3 arrow( start ); - for ( unsigned int i = 0, count = ( len < 32 ) ? 1 : static_cast( len * 0.0625 ); i < count; i++ ) + for ( unsigned int i = 0, count = ( len < 32 ) ? 1 : static_cast( len * 0.0625 ); i < count; ++i ) { vector3_add( arrow, vector3_scaled( dir, ( len < 32 ) ? len : 32 ) ); gl().glVertex3fv( vector3_to_array( arrow ) ); diff --git a/plugins/image/bmp.cpp b/plugins/image/bmp.cpp index e626fc77..d9573697 100644 --- a/plugins/image/bmp.cpp +++ b/plugins/image/bmp.cpp @@ -107,11 +107,11 @@ public: template void ReadBMP( PointerInputStream& inputStream, byte* bmpRGBA, int rows, int columns, ReadPixel readPixel ){ - for ( int row = rows - 1; row >= 0; row-- ) + for ( int row = rows - 1; row >= 0; --row ) { byte* pixbuf = bmpRGBA + row * columns * 4; - for ( int column = 0; column < columns; column++ ) + for ( int column = 0; column < columns; ++column ) { readPixel( inputStream, pixbuf ); } diff --git a/plugins/image/jpeg.cpp b/plugins/image/jpeg.cpp index 4bdc07ae..19a0de18 100644 --- a/plugins/image/jpeg.cpp +++ b/plugins/image/jpeg.cpp @@ -269,7 +269,7 @@ static void j_putRGBScanline( unsigned char* jpegline, int widthPix, unsigned ch int offset = row * widthPix * 4; int count; - for ( count = 0; count < widthPix; count++ ) + for ( count = 0; count < widthPix; ++count ) { unsigned char iRed, iBlu, iGrn; unsigned char *oRed, *oBlu, *oGrn, *oAlp; @@ -295,7 +295,7 @@ static void j_putRGBAScanline( unsigned char* jpegline, int widthPix, unsigned c int offset = row * widthPix * 4; int count; - for ( count = 0; count < widthPix; count++ ) + for ( count = 0; count < widthPix; ++count ) { unsigned char iRed, iBlu, iGrn, iAlp; unsigned char *oRed, *oBlu, *oGrn, *oAlp; @@ -328,7 +328,7 @@ static void j_putGrayScanlineToRGB( unsigned char* jpegline, int widthPix, unsig int offset = row * widthPix * 4; int count; - for ( count = 0; count < widthPix; count++ ) + for ( count = 0; count < widthPix; ++count ) { unsigned char iGray; unsigned char *oRed, *oBlu, *oGrn, *oAlp; diff --git a/plugins/image/ktx.cpp b/plugins/image/ktx.cpp index e12fc36a..35705244 100644 --- a/plugins/image/ktx.cpp +++ b/plugins/image/ktx.cpp @@ -252,7 +252,7 @@ static void KTX_DecodeETC1( PointerInputStream& istream, Image& image ){ blockrowsize = 4; } blockrowsize *= 4; - for ( unsigned int blockrow = 0; blockrow < blockrows; blockrow++ ) + for ( unsigned int blockrow = 0; blockrow < blockrows; ++blockrow ) { memcpy( p + blockrow * stride, rgba + blockrow * 16, blockrowsize ); } @@ -379,9 +379,9 @@ Image* LoadKTXBuff( PointerInputStream& istream ){ unsigned int inRowLength = width * decoder->GetPixelSize(); unsigned int inPadding = ( ( inRowLength + 3 ) & ~3 ) - inRowLength; byte* out = image->getRGBAPixels(); - for ( unsigned int y = 0; y < height; y++ ) + for ( unsigned int y = 0; y < height; ++y ) { - for ( unsigned int x = 0; x < width; x++, out += 4 ) + for ( unsigned int x = 0; x < width; ++x, out += 4 ) { decoder->Decode( istream, out ); } diff --git a/plugins/image/pcx.cpp b/plugins/image/pcx.cpp index 15d72390..f619d8a5 100644 --- a/plugins/image/pcx.cpp +++ b/plugins/image/pcx.cpp @@ -137,7 +137,7 @@ void LoadPCXBuff( byte* buffer, std::size_t len, byte **pic, byte **palette, int lsize = pcx.color_planes * pcx.bytes_per_line; /* go scanline by scanline */ - for ( y = 0; y <= pcx.ymax; y++, pix += pcx.xmax + 1 ) + for ( y = 0; y <= pcx.ymax; ++y, pix += pcx.xmax + 1 ) { /* do a scanline */ for ( x = 0; x <= pcx.xmax; ) @@ -195,7 +195,7 @@ Image* LoadPCX32Buff( byte* buffer, std::size_t length ){ auto *image = new RGBAImage( width, height ); c = ( width ) * ( height ); pic32 = image->getRGBAPixels(); - for ( i = 0; i < c; i++ ) + for ( i = 0; i < c; ++i ) { p = pic8[i]; pic32[0] = palette[p * 3]; diff --git a/plugins/imagehl/hlw.cpp b/plugins/imagehl/hlw.cpp index da88a1a8..8174e39b 100644 --- a/plugins/imagehl/hlw.cpp +++ b/plugins/imagehl/hlw.cpp @@ -111,11 +111,11 @@ Image* LoadHLWBuff( byte* buffer ){ auto *image = new RGBAImage( columns, rows ); - for ( row = 0; row < rows; row++ ) + for ( row = 0; row < rows; ++row ) { pixbuf = image->getRGBAPixels() + row * columns * 4; - for ( column = 0; column < columns; column++ ) + for ( column = 0; column < columns; ++column ) { int palIndex; diff --git a/plugins/imagehl/mip.cpp b/plugins/imagehl/mip.cpp index 31f9f72d..b15a4350 100644 --- a/plugins/imagehl/mip.cpp +++ b/plugins/imagehl/mip.cpp @@ -176,12 +176,12 @@ Image* LoadMIPBuff( byte* buffer ){ auto *image = new RGBAImage( columns, rows ); //Sys_Printf( "lpMip->width = %i, lpMip->height = %i, lpMip->offsets[0] = %i, lpMip->offsets[1] = %i, lpMip->offsets[2] = %i, lpMip->offsets[3] = %i, numPixels = %i\n", lpMip->width, lpMip->height, lpMip->offsets[0], lpMip->offsets[1], lpMip->offsets[2], lpMip->offsets[3], numPixels ); - //for ( i = 0; i < sizeof( *lpMip ); i++ ) + //for ( i = 0; i < sizeof( *lpMip ); ++i ) // Sys_Printf( "%02x", (int) ( (unsigned char *)lpMip )[i] ); pixbuf = image->getRGBAPixels(); - for ( i = 0; i < numPixels; i++ ) + for ( i = 0; i < numPixels; ++i ) { int palIndex = *buf_p++; *pixbuf++ = palette[palIndex * 3]; diff --git a/plugins/imagehl/sprite.cpp b/plugins/imagehl/sprite.cpp index 4ee8b7c5..fc3a1041 100644 --- a/plugins/imagehl/sprite.cpp +++ b/plugins/imagehl/sprite.cpp @@ -179,11 +179,11 @@ Image* LoadIDSPBuff( byte *buffer ){ spriteframe = (dspriteframe_t *)( palette + ( 256 * 3 ) + 4 ); // what are those 4 extra bytes ? what's missing ? buf_p = (byte *)( spriteframe + 1 ); - for ( row = 0; row < rows; row++ ) + for ( row = 0; row < rows; ++row ) { pixbuf = image->getRGBAPixels() + row * columns * 4; - for ( column = 0; column < columns; column++ ) + for ( column = 0; column < columns; ++column ) { int palIndex; diff --git a/plugins/imagepng/plugin.cpp b/plugins/imagepng/plugin.cpp index 4b335074..f539e1e6 100644 --- a/plugins/imagepng/plugin.cpp +++ b/plugins/imagepng/plugin.cpp @@ -149,7 +149,7 @@ Image* LoadPNGBuff( unsigned char* fbuffer ){ row_pointers = (png_byte**) malloc( ( height ) * sizeof( png_byte* ) ); int i; - for ( i = 0; i < ( height ); i++ ) + for ( i = 0; i < ( height ); ++i ) row_pointers[i] = (png_byte*)( image->getRGBAPixels() ) + i * 4 * ( width ); // actual read diff --git a/plugins/md3model/md3.cpp b/plugins/md3model/md3.cpp index 7c3bab1e..fde4b4f2 100644 --- a/plugins/md3model/md3.cpp +++ b/plugins/md3model/md3.cpp @@ -231,7 +231,7 @@ int MD3Surface_read( Surface& surface, unsigned char* buffer ){ PointerInputStream stStream( buffer + md3Surface.ofsSt ); // read verts into vertex array - xyz, st, normal - for ( int i = 0; i < md3Surface.numVerts; i++ ) + for ( int i = 0; i < md3Surface.numVerts; ++i ) { md3XyzNormal_t md3Xyz; istream_read_md3XyzNormal( xyzNormalStream, md3Xyz ); @@ -253,7 +253,7 @@ int MD3Surface_read( Surface& surface, unsigned char* buffer ){ surface.indices().reserve( md3Surface.numTriangles * 3 ); PointerInputStream inputStream( buffer + md3Surface.ofsTriangles ); - for ( int i = 0; i < md3Surface.numTriangles; i++ ) + for ( int i = 0; i < md3Surface.numTriangles; ++i ) { md3Triangle_t md3Triangle; istream_read_md3Triangle( inputStream, md3Triangle ); diff --git a/plugins/md3model/mdc.cpp b/plugins/md3model/mdc.cpp index f10b4872..ad044c62 100644 --- a/plugins/md3model/mdc.cpp +++ b/plugins/md3model/mdc.cpp @@ -188,7 +188,7 @@ unsigned int MDCSurface_read( Surface& surface, const byte* buffer ){ PointerInputStream xyzStream( buffer + mdcSurface.ofsXyzNormals ); PointerInputStream stStream( buffer + mdcSurface.ofsSt ); // read verts into vertex array - xyz, st, normal - for ( std::size_t i = 0; i < mdcSurface.numVerts; i++ ) + for ( std::size_t i = 0; i < mdcSurface.numVerts; ++i ) { mdcXyzNormal_t mdcXyzNormal; istream_read_mdcXyzNormal( xyzStream, mdcXyzNormal ); @@ -210,7 +210,7 @@ unsigned int MDCSurface_read( Surface& surface, const byte* buffer ){ PointerInputStream triangleStream( buffer + mdcSurface.ofsTriangles ); - for ( std::size_t i = 0; i < mdcSurface.numTriangles; i++ ) + for ( std::size_t i = 0; i < mdcSurface.numTriangles; ++i ) { mdcTriangle_t triangle; istream_read_mdcTriangle( triangleStream, triangle ); @@ -241,7 +241,7 @@ void MDCModel_read( Model& model, const byte* buffer ){ const byte* surfacePosition = buffer + header.ofsSurfaces; - for ( std::size_t i = 0; i < header.numSurfaces; i++ ) + for ( std::size_t i = 0; i < header.numSurfaces; ++i ) { surfacePosition += MDCSurface_read( model.newSurface(), surfacePosition ); } diff --git a/plugins/md3model/mdl.cpp b/plugins/md3model/mdl.cpp index dc3cb1c0..3c3f9119 100644 --- a/plugins/md3model/mdl.cpp +++ b/plugins/md3model/mdl.cpp @@ -148,7 +148,7 @@ void MDLSurface_read( Surface& surface, const byte* buffer, const char* name ){ { bool found = false; - for ( int i = 0; i < header.numframes && found == false; i++ ) + for ( int i = 0; i < header.numframes && found == false; ++i ) { switch ( istream_read_int32_le( inputStream ) ) { diff --git a/plugins/md3model/mdlimage.cpp b/plugins/md3model/mdlimage.cpp index 55998e7f..e3d2544d 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]]; @@ -131,9 +131,9 @@ Image* LoadMDLImageBuff( byte* buffer ){ auto *image = new RGBAImage( skinwidth, skinheight ); unsigned char* pRGBA = image->getRGBAPixels(); - for ( int i = 0; i < ( skinheight ); i++ ) + for ( int i = 0; i < ( skinheight ); ++i ) { - for ( int j = 0; j < ( skinwidth ); j++ ) + for ( int j = 0; j < ( skinwidth ); ++j ) { byte index = istream_read_byte( inputStream ); *pRGBA++ = mdl_palette[index * 3 + 0]; diff --git a/plugins/spritemodel/spritemodel.cpp b/plugins/spritemodel/spritemodel.cpp index 5ac78199..17cfa054 100644 --- a/plugins/spritemodel/spritemodel.cpp +++ b/plugins/spritemodel/spritemodel.cpp @@ -57,7 +57,7 @@ void CSpriteModel::Construct( IShader *pShader ){ md3Surface_t *pSurface = (md3Surface_t *)(((unsigned char *)pHeader) + pHeader->ofsSurfaces); m_nSurfaces = pHeader->numSurfaces; CMD3Surface* surfaces = new CMD3Surface[m_nSurfaces]; - for (int i = 0; i < m_nSurfaces; i++ ) + for (int i = 0; i < m_nSurfaces; ++i ) { surfaces[i].Construct(pSurface); pSurface = (md3Surface_t *) ((( char * ) pSurface) + pSurface->ofsEnd); @@ -159,7 +159,7 @@ bool CSpriteModel::TestRay( const ray_t *ray, vec_t *dist ) const if ( aabb_test_ray( &m_BBox, ray ) == 0 ) return false; - for( int i = 0; i < m_nSurfaces; i++ ) + for( int i = 0; i < m_nSurfaces; ++i ) { if( m_children[i].TestRay( ray, &depth_local ) ) { diff --git a/radiant/brush_primit.cpp b/radiant/brush_primit.cpp index 234c2e8d..ec042d73 100644 --- a/radiant/brush_primit.cpp +++ b/radiant/brush_primit.cpp @@ -423,7 +423,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] ) { @@ -558,7 +558,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 ); @@ -836,14 +836,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] ); } @@ -985,7 +985,7 @@ void ShiftTextureRelative_Camera( face_t *f, int x, int y ){ Vector3 C; VectorClear( C ); int i; - for ( i = 0; i < f->face_winding->numpoints; i++ ) + for ( i = 0; i < f->face_winding->numpoints; ++i ) { VectorAdd( C,f->face_winding->point_at( i ),C ); } diff --git a/radiant/brushmanip.cpp b/radiant/brushmanip.cpp index cedf2e42..5a6a64c0 100644 --- a/radiant/brushmanip.cpp +++ b/radiant/brushmanip.cpp @@ -234,9 +234,9 @@ void Brush_ConstructSphere( Brush& brush, const AABB& bounds, std::size_t sides, double dt = 2 * c_pi / sides; double dp = c_pi / sides; - for ( std::size_t i = 0; i < sides; i++ ) + for ( std::size_t i = 0; i < sides; ++i ) { - for ( std::size_t j = 0; j < sides - 1; j++ ) + for ( std::size_t j = 0; j < sides - 1; ++j ) { double t = i * dt; double p = float( j * dp - c_pi / 2 ); @@ -251,7 +251,7 @@ void Brush_ConstructSphere( Brush& brush, const AABB& bounds, std::size_t sides, { double p = ( sides - 1 ) * dp - c_pi / 2; - for ( std::size_t i = 0; i < sides; i++ ) + for ( std::size_t i = 0; i < sides; ++i ) { double t = i * dt; @@ -285,7 +285,7 @@ void Brush_ConstructRock( Brush& brush, const AABB& bounds, std::size_t sides, c const Vector3& mid = bounds.origin; Vector3 planepts[3]; - for ( std::size_t j = 0; j < sides; j++ ) + for ( std::size_t j = 0; j < sides; ++j ) { planepts[0][0] = rand() - ( RAND_MAX / 2 ); planepts[0][1] = rand() - ( RAND_MAX / 2 ); @@ -376,7 +376,7 @@ void Brush_ConstructIcosahedron( Brush& brush, const AABB& bounds, std::size_t s std::vector> pointCloud; - for( int i = 0; i < 20; i++ ){ + for( int i = 0; i < 20; ++i ){ drawtri( vdata[tindices[i][0]], vdata[tindices[i][1]], vdata[tindices[i][2]], subdivisions, truncate, pointCloud ); } @@ -475,7 +475,7 @@ void ConstructRegionBrushes( scene::Node* brushes[6], const Vector3& region_mins const Vector3 mins( region_mins - Vector3( 32 ) ); // vary maxs - for ( std::size_t i = 0; i < 3; i++ ) + for ( std::size_t i = 0; i < 3; ++i ) { Vector3 maxs( region_maxs + Vector3( 32 ) ); maxs[i] = region_mins[i]; @@ -488,7 +488,7 @@ void ConstructRegionBrushes( scene::Node* brushes[6], const Vector3& region_mins const Vector3 maxs( region_maxs + Vector3( 32 ) ); // vary mins - for ( std::size_t i = 0; i < 3; i++ ) + for ( std::size_t i = 0; i < 3; ++i ) { Vector3 mins( region_mins - Vector3( 32 ) ); mins[i] = region_maxs[i]; diff --git a/radiant/brushtokens.h b/radiant/brushtokens.h index a919a96f..85535824 100644 --- a/radiant/brushtokens.h +++ b/radiant/brushtokens.h @@ -96,7 +96,7 @@ inline bool FaceTexdef_Valve220_importTokens( FaceTexdef& texdef, Tokeniser& tok inline bool FacePlane_importTokens( FacePlane& facePlane, Tokeniser& tokeniser ){ // parse planepts - for ( std::size_t i = 0; i < 3; i++ ) + for ( std::size_t i = 0; i < 3; ++i ) { RETURN_FALSE_IF_FAIL( Tokeniser_parseToken( tokeniser, "(" ) ); for ( std::size_t j = 0; j < 3; ++j ) @@ -270,10 +270,10 @@ inline void FacePlane_Doom3_exportTokens( const FacePlane& facePlane, TokenWrite inline void FacePlane_exportTokens( const FacePlane& facePlane, TokenWriter& writer ){ // write planepts - for ( std::size_t i = 0; i < 3; i++ ) + for ( std::size_t i = 0; i < 3; ++i ) { writer.writeToken( "(" ); - for ( std::size_t j = 0; j < 3; j++ ) + for ( std::size_t j = 0; j < 3; ++j ) { writer.writeFloat( Face::m_quantise( facePlane.planePoints()[i][j] ) ); } @@ -286,7 +286,7 @@ inline void FaceTexdef_BP_exportTokens( const FaceTexdef& faceTexdef, TokenWrite writer.writeToken( "(" ); { writer.writeToken( "(" ); - for ( std::size_t i = 0; i < 3; i++ ) + for ( std::size_t i = 0; i < 3; ++i ) { writer.writeFloat( faceTexdef.m_projection.m_brushprimit_texdef.coords[0][i] ); } @@ -294,7 +294,7 @@ inline void FaceTexdef_BP_exportTokens( const FaceTexdef& faceTexdef, TokenWrite } { writer.writeToken( "(" ); - for ( std::size_t i = 0; i < 3; i++ ) + for ( std::size_t i = 0; i < 3; ++i ) { writer.writeFloat( faceTexdef.m_projection.m_brushprimit_texdef.coords[1][i] ); } diff --git a/radiant/brushxml.h b/radiant/brushxml.h index be37ae9c..8f4dbb9f 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 43b283e8..8644bfee 100644 --- a/radiant/camwindow.cpp +++ b/radiant/camwindow.cpp @@ -300,7 +300,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]; @@ -2134,7 +2134,7 @@ void CamWnd::draw(){ void CamWnd::BenchMark(){ Timer timer; timer.start(); - 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 363cbe58..44e4c383 100644 --- a/radiant/eclass_def.cpp +++ b/radiant/eclass_def.cpp @@ -231,7 +231,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 != ')' ) { @@ -249,7 +249,7 @@ EntityClass *Eclass_InitFromText( const char *text ){ // get the flags: advance past the first \n while ( *text && *text++ != '\n' ){}; - 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 == nullptr || p > text ) { diff --git a/radiant/entityinspector.cpp b/radiant/entityinspector.cpp index 6602830a..1ebbb95f 100644 --- a/radiant/entityinspector.cpp +++ b/radiant/entityinspector.cpp @@ -882,7 +882,7 @@ void SpawnFlags_setEntityClass( EntityClass* eclass ){ g_spawnflag_count = 0; // 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 ( !string_empty( eclass->flagnames[i] ) ) { spawn_table[g_spawnflag_count++] = i; @@ -1237,7 +1237,7 @@ QWidget* EntityInspector_constructWindow( QWidget* toplevel ){ auto *grid = g_spawnflagsTable = new QGridLayout; grid->setAlignment( Qt::AlignmentFlag::AlignLeft ); vbox->addLayout( grid ); - for ( int i = 0; i < MAX_FLAGS; i++ ) + for ( int i = 0; i < MAX_FLAGS; ++i ) { auto *check = g_entitySpawnflagsCheck[i] = new QCheckBox; grid->addWidget( check, i / 4, i % 4 ); diff --git a/radiant/environment.cpp b/radiant/environment.cpp index 8f94e8f3..a5514271 100644 --- a/radiant/environment.cpp +++ b/radiant/environment.cpp @@ -35,16 +35,16 @@ const char** g_argv; void args_init( int argc, char* argv[] ){ int i, j, k; - for ( i = 1; i < argc; i++ ) + for ( i = 1; i < argc; ++i ) { - for ( k = i; k < argc; k++ ) + for ( k = i; k < argc; ++k ) if ( argv[k] != 0 ) { break; } if ( k > i ) { k -= i; - for ( j = i + k; j < argc; j++ ) + for ( j = i + k; j < argc; ++j ) argv[j - k] = argv[j]; argc -= k; } diff --git a/radiant/feedback.cpp b/radiant/feedback.cpp index b4f625fb..e42b253f 100644 --- a/radiant/feedback.cpp +++ b/radiant/feedback.cpp @@ -165,7 +165,7 @@ void CWindingMsg::saxEndElement( message_info_t *ctx, const xmlChar *name ){ sscanf( c, "%i ", &numpoints ); int i = 0; - for (; i < numpoints; i++ ) + for (; i < numpoints; ++i ) { c = strchr( c + 1, '(' ); if ( c ) { // even if we are given the number of points when the cycle begins .. don't trust it too much @@ -205,7 +205,7 @@ void CWindingMsg::Draw2D( VIEWTYPE vt ){ gl().glPointSize( 4 ); gl().glBegin( GL_POINTS ); - for ( i = 0; i < numpoints; i++ ) + for ( i = 0; i < numpoints; ++i ) gl().glVertex2f( wt[i][nDim1], wt[i][nDim2] ); gl().glEnd(); gl().glPointSize( 1 ); @@ -215,7 +215,7 @@ void CWindingMsg::Draw2D( VIEWTYPE vt ){ gl().glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); gl().glColor4f( 0.133f, 0.4f, 1.0f, 0.5f ); gl().glBegin( GL_POLYGON ); - for ( i = 0; i < numpoints; i++ ) + for ( i = 0; i < numpoints; ++i ) gl().glVertex2f( wt[i][nDim1], wt[i][nDim2] ); gl().glEnd(); gl().glDisable( GL_BLEND ); diff --git a/radiant/mru.cpp b/radiant/mru.cpp index c7bd19dc..f1091c3a 100644 --- a/radiant/mru.cpp +++ b/radiant/mru.cpp @@ -90,17 +90,16 @@ void MRU_SetText( std::size_t index, const char *filename ){ } void MRU_AddFile( const char *str ){ - std::size_t i; const char* text; // check if file is already in our list - for ( i = 0; i < MRU_used; i++ ) + for ( std::size_t i = 0; i < MRU_used; ++i ) { text = MRU_GetText( i ); if ( strcmp( text, str ) == 0 ) { // reorder menu - for (; i > 0; i-- ) + for (; i > 0; --i ) MRU_SetText( i, MRU_GetText( i - 1 ) ); MRU_SetText( 0, str ); @@ -114,7 +113,7 @@ void MRU_AddFile( const char *str ){ } // move items down - for ( i = MRU_used - 1; i > 0; i-- ) + for ( std::size_t i = MRU_used - 1; i > 0; --i ) MRU_SetText( i, MRU_GetText( i - 1 ) ); MRU_SetText( 0, str ); @@ -152,7 +151,7 @@ void MRU_Activate( std::size_t index ){ { MRU_used--; - for ( std::size_t i = index; i < MRU_used; i++ ) + for ( std::size_t i = index; i < MRU_used; ++i ) MRU_SetText( i, MRU_GetText( i + 1 ) ); if ( MRU_used == 0 ) { diff --git a/radiant/patch.cpp b/radiant/patch.cpp index 2c34a155..0b76742b 100644 --- a/radiant/patch.cpp +++ b/radiant/patch.cpp @@ -264,7 +264,7 @@ void Patch::UpdateCachedData(){ #if 0 { Array::iterator first = m_tess.m_indices.begin(); - for ( std::size_t s = 0; s < m_tess.m_numStrips; s++ ) + for ( std::size_t s = 0; s < m_tess.m_numStrips; ++s ) { Array::iterator last = first + m_tess.m_lenStrips; @@ -345,10 +345,10 @@ void Patch::Redisperse( EMatrixMajor mt ){ return; } - for ( h = 0; h < height; h++ ) + for ( h = 0; h < height; ++h ) { p1 = m_ctrl.data() + ( h * row_stride ); - for ( w = 0; w < width; w++ ) + for ( w = 0; w < width; ++w ) { p2 = p1 + col_stride; p3 = p2 + col_stride; @@ -387,7 +387,7 @@ void Patch::Smooth( EMatrixMajor mt ){ } wrap = true; - for ( h = 0; h < height; h++ ) + for ( h = 0; h < height; ++h ) { p1 = m_ctrl.data() + ( h * row_stride ); p2 = p1 + ( 2 * width ) * col_stride; @@ -399,10 +399,10 @@ void Patch::Smooth( EMatrixMajor mt ){ } } - for ( h = 0; h < height; h++ ) + for ( h = 0; h < height; ++h ) { p1 = m_ctrl.data() + ( h * row_stride ) + col_stride; - for ( w = 0; w < width - 1; w++ ) + for ( w = 0; w < width - 1; ++w ) { p2 = p1 + col_stride; p3 = p2 + col_stride; @@ -467,14 +467,14 @@ Patch* Patch::MakeCap( Patch* patch, EPatchCap eType, EMatrixMajor mt, bool bFir std::size_t nIndex = ( bFirst ) ? 0 : height - 1; if ( mt == ROW ) { - for ( i = 0; i < width; i++ ) + for ( i = 0; i < width; ++i ) { p[( bFirst ) ? i : ( width - 1 ) - i] = ctrlAt( nIndex, i ).m_vertex; } } else { - for ( i = 0; i < width; i++ ) + for ( i = 0; i < width; ++i ) { p[( bFirst ) ? i : ( width - 1 ) - i] = ctrlAt( i, nIndex ).m_vertex; } @@ -554,9 +554,9 @@ void Patch::SetTextureRepeat( float s, float t ){ const float ti = ( t == 0? 1.f : t ) / ( m_height - 1 ); PatchControl *pDest = m_ctrl.data(); - for ( h = 0, tc = 0.0f; h < m_height; h++, tc += ti ) + for ( h = 0, tc = 0.0f; h < m_height; ++h, tc += ti ) { - for ( w = 0, sc = 0.0f; w < m_width; w++, sc += si ) + for ( w = 0, sc = 0.0f; w < m_width; ++w, sc += si ) { pDest->m_texcoord[0] = sc; pDest->m_texcoord[1] = tc; @@ -1029,7 +1029,7 @@ void Patch::RemovePoints( EMatrixMajor mt, bool bFirst ){ ++pos; } - for ( std::size_t w = 0; w != width; w++ ) + for ( std::size_t w = 0; w != width; ++w ) { PatchControl* p1 = tmp.data() + ( w * col_stride ); PatchControl* p2 = m_ctrl.data() + ( w * col_stride2 ); @@ -1045,13 +1045,13 @@ void Patch::RemovePoints( EMatrixMajor mt, bool bFirst ){ p1 = tmp.data() + ( w * col_stride + pos * row_stride ); p2 = m_ctrl.data() + ( w * col_stride2 + pos * row_stride2 ); - for ( std::size_t i = 0; i < 3; i++ ) + for ( std::size_t i = 0; i < 3; ++i ) { ( p2 - row_stride2 )->m_vertex[i] = ( ( p1 + 2 * row_stride )->m_vertex[i] + ( p1 - 2 * row_stride )->m_vertex[i] ) * 0.5f; ( p2 - row_stride2 )->m_vertex[i] = ( p2 - row_stride2 )->m_vertex[i] + ( 2.0f * ( ( p1 )->m_vertex[i] - ( p2 - row_stride2 )->m_vertex[i] ) ); } - for ( std::size_t i = 0; i < 2; i++ ) + for ( std::size_t i = 0; i < 2; ++i ) { ( p2 - row_stride2 )->m_texcoord[i] = ( ( p1 + 2 * row_stride )->m_texcoord[i] + ( p1 - 2 * row_stride )->m_texcoord[i] ) * 0.5f; @@ -1276,10 +1276,10 @@ void Patch::constructPlane( const AABB& aabb, int axis, std::size_t width, std:: PatchControl* pCtrl = m_ctrl.data(); vTmp[y] = vStart[y]; - for ( std::size_t h = 0; h < m_height; h++ ) + for ( std::size_t h = 0; h < m_height; ++h ) { vTmp[x] = vStart[x]; - for ( std::size_t w = 0; w < m_width; w++, ++pCtrl ) + for ( std::size_t w = 0; w < m_width; ++w, ++pCtrl ) { pCtrl->m_vertex = vTmp; vTmp[x] += xAdj; @@ -1359,11 +1359,11 @@ void Patch::ConstructPrefab( const AABB& aabb, EPatchPrefab eType, int axis, std return; } - for ( std::size_t h = 0; h < 3; h++, pStart += 9 ) + for ( std::size_t h = 0; h < 3; ++h, pStart += 9 ) { pIndex = pCylIndex; PatchControl* pCtrl = pStart; - for ( std::size_t w = 0; w < 8; w++, pCtrl++ ) + for ( std::size_t w = 0; w < 8; ++w, ++pCtrl ) { pCtrl->m_vertex[x] = vPos[pIndex[0]][x]; pCtrl->m_vertex[y] = vPos[pIndex[1]][y]; @@ -1377,7 +1377,7 @@ void Patch::ConstructPrefab( const AABB& aabb, EPatchPrefab eType, int axis, std case EPatchPrefab::SqCylinder: { PatchControl* pCtrl = m_ctrl.data(); - for ( std::size_t h = 0; h < 3; h++, pCtrl += 9 ) + for ( std::size_t h = 0; h < 3; ++h, pCtrl += 9 ) { pCtrl[8].m_vertex = pCtrl[0].m_vertex; } @@ -1388,7 +1388,7 @@ void Patch::ConstructPrefab( const AABB& aabb, EPatchPrefab eType, int axis, std case EPatchPrefab::Cylinder: { PatchControl* pCtrl = m_ctrl.data(); - for ( std::size_t h = 0; h < 3; h++, pCtrl += 9 ) + for ( std::size_t h = 0; h < 3; ++h, pCtrl += 9 ) { pCtrl[0].m_vertex = pCtrl[8].m_vertex; } @@ -1397,14 +1397,14 @@ void Patch::ConstructPrefab( const AABB& aabb, EPatchPrefab eType, int axis, std case EPatchPrefab::Cone: { PatchControl* pCtrl = m_ctrl.data(); - for ( std::size_t h = 0; h < 2; h++, pCtrl += 9 ) + for ( std::size_t h = 0; h < 2; ++h, pCtrl += 9 ) { pCtrl[0].m_vertex = pCtrl[8].m_vertex; } } { PatchControl* pCtrl = m_ctrl.data() + 9 * 2; - for ( std::size_t w = 0; w < 9; w++, pCtrl++ ) + for ( std::size_t w = 0; w < 9; ++w, ++pCtrl ) { pCtrl->m_vertex[x] = vPos[1][x]; pCtrl->m_vertex[y] = vPos[1][y]; @@ -1415,14 +1415,14 @@ void Patch::ConstructPrefab( const AABB& aabb, EPatchPrefab eType, int axis, std case EPatchPrefab::Sphere: { PatchControl* pCtrl = m_ctrl.data() + 9; - for ( std::size_t h = 0; h < 3; h++, pCtrl += 9 ) + for ( std::size_t h = 0; h < 3; ++h, pCtrl += 9 ) { pCtrl[0].m_vertex = pCtrl[8].m_vertex; } } { PatchControl* pCtrl = m_ctrl.data(); - for ( std::size_t w = 0; w < 9; w++, pCtrl++ ) + for ( std::size_t w = 0; w < 9; ++w, ++pCtrl ) { pCtrl->m_vertex[x] = vPos[1][x]; pCtrl->m_vertex[y] = vPos[1][y]; @@ -1431,7 +1431,7 @@ void Patch::ConstructPrefab( const AABB& aabb, EPatchPrefab eType, int axis, std } { PatchControl* pCtrl = m_ctrl.data() + ( 9 * 4 ); - for ( std::size_t w = 0; w < 9; w++, pCtrl++ ) + for ( std::size_t w = 0; w < 9; ++w, ++pCtrl ) { pCtrl->m_vertex[x] = vPos[1][x]; pCtrl->m_vertex[y] = vPos[1][y]; @@ -1537,10 +1537,10 @@ void Patch::ConstructPrefab( const AABB& aabb, EPatchPrefab eType, int axis, std setDims( 3, 3 ); PatchControl* pCtrl = m_ctrl.data(); - for ( std::size_t h = 0; h < 3; h++ ) + for ( std::size_t h = 0; h < 3; ++h ) { pIndex = pBevIndex; - for ( std::size_t w = 0; w < 3; w++, pIndex += 2, pCtrl++ ) + for ( std::size_t w = 0; w < 3; ++w, pIndex += 2, ++pCtrl ) { pCtrl->m_vertex[x] = vPos[pIndex[0]][x]; pCtrl->m_vertex[y] = vPos[pIndex[1]][y]; @@ -1562,10 +1562,10 @@ void Patch::ConstructPrefab( const AABB& aabb, EPatchPrefab eType, int axis, std setDims( 5, 3 ); PatchControl* pCtrl = m_ctrl.data(); - for ( std::size_t h = 0; h < 3; h++ ) + for ( std::size_t h = 0; h < 3; ++h ) { pIndex = pEndIndex; - for ( std::size_t w = 0; w < 5; w++, pIndex += 2, pCtrl++ ) + for ( std::size_t w = 0; w < 5; ++w, pIndex += 2, ++pCtrl ) { pCtrl->m_vertex[x] = vPos[pIndex[0]][x]; pCtrl->m_vertex[y] = vPos[pIndex[1]][y]; @@ -1590,10 +1590,10 @@ void Patch::ConstructPrefab( const AABB& aabb, EPatchPrefab eType, int axis, std } void Patch::RenderDebug( RenderStateFlags state ) const { - for ( std::size_t i = 0; i < m_tess.m_numStrips; i++ ) + for ( std::size_t i = 0; i < m_tess.m_numStrips; ++i ) { gl().glBegin( GL_QUAD_STRIP ); - for ( std::size_t j = 0; j < m_tess.m_lenStrips; j++ ) + for ( std::size_t j = 0; j < m_tess.m_lenStrips; ++j ) { gl().glNormal3fv( normal3f_to_array( ( m_tess.m_vertices.data() + m_tess.m_indices[i * m_tess.m_lenStrips + j] )->normal ) ); gl().glTexCoord2fv( texcoord2f_to_array( ( m_tess.m_vertices.data() + m_tess.m_indices[i * m_tess.m_lenStrips + j] )->texcoord ) ); @@ -1607,9 +1607,9 @@ void RenderablePatchSolid::RenderNormals() const { const std::size_t width = m_tess.m_numStrips + 1; const std::size_t height = m_tess.m_lenStrips >> 1; gl().glBegin( GL_LINES ); - for ( std::size_t i = 0; i < width; i++ ) + for ( std::size_t i = 0; i < width; ++i ) { - for ( std::size_t j = 0; j < height; j++ ) + for ( std::size_t j = 0; j < height; ++j ) { { Vector3 vNormal( @@ -2595,9 +2595,9 @@ void Patch::BuildVertexArray(){ m_tess.m_numStrips = m_tess.m_nArrayHeight - 1; m_tess.m_lenStrips = m_tess.m_nArrayWidth * 2; - for ( std::size_t i = 0; i < m_tess.m_nArrayWidth; i++ ) + for ( std::size_t i = 0; i < m_tess.m_nArrayWidth; ++i ) { - for ( std::size_t j = 0; j < m_tess.m_numStrips; j++ ) + for ( std::size_t j = 0; j < m_tess.m_numStrips; ++j ) { m_tess.m_indices[( j * m_tess.m_lenStrips ) + i * 2] = RenderIndex( j * m_tess.m_nArrayWidth + i ); m_tess.m_indices[( j * m_tess.m_lenStrips ) + i * 2 + 1] = RenderIndex( ( j + 1 ) * m_tess.m_nArrayWidth + i ); @@ -2612,9 +2612,9 @@ void Patch::BuildVertexArray(){ m_tess.m_numStrips = m_tess.m_nArrayWidth - 1; m_tess.m_lenStrips = m_tess.m_nArrayHeight * 2; - for ( std::size_t i = 0; i < m_tess.m_nArrayHeight; i++ ) + for ( std::size_t i = 0; i < m_tess.m_nArrayHeight; ++i ) { - for ( std::size_t j = 0; j < m_tess.m_numStrips; j++ ) + for ( std::size_t j = 0; j < m_tess.m_numStrips; ++j ) { m_tess.m_indices[( j * m_tess.m_lenStrips ) + i * 2] = RenderIndex( ( ( m_tess.m_nArrayHeight - 1 ) - i ) * m_tess.m_nArrayWidth + j ); m_tess.m_indices[( j * m_tess.m_lenStrips ) + i * 2 + 1] = RenderIndex( ( ( m_tess.m_nArrayHeight - 1 ) - i ) * m_tess.m_nArrayWidth + j + 1 ); @@ -2940,14 +2940,14 @@ void Patch::createThickenedOpposite( const Patch& sourcePatch, //check if certain seams are required + cycling in normals calculation is needed //( endpoints != startpoints ) - not a cylinder or something - for ( std::size_t col = 0; col < m_width; col++ ){ + for ( std::size_t col = 0; col < m_width; ++col ){ if( vector3_length_squared( sourcePatch.ctrlAt( 0, col ).m_vertex - sourcePatch.ctrlAt( m_height - 1, col ).m_vertex ) > 0.1f ){ //globalOutputStream() << "yes12.\n"; no12 = false; break; } } - for ( std::size_t row = 0; row < m_height; row++ ){ + for ( std::size_t row = 0; row < m_height; ++row ){ if( vector3_length_squared( sourcePatch.ctrlAt( row, 0 ).m_vertex - sourcePatch.ctrlAt( row, m_width - 1 ).m_vertex ) > 0.1f ){ no34 = false; //globalOutputStream() << "yes34.\n"; @@ -2955,9 +2955,9 @@ void Patch::createThickenedOpposite( const Patch& sourcePatch, } } - for ( std::size_t col = 0; col < m_width; col++ ) + for ( std::size_t col = 0; col < m_width; ++col ) { - for ( std::size_t row = 0; row < m_height; row++ ) + for ( std::size_t row = 0; row < m_height; ++row ) { // The current control vertex on the other patch const PatchControl& curCtrl = sourcePatch.ctrlAt( row, col ); @@ -3259,7 +3259,7 @@ void Patch::createThickenedWall( const Patch& sourcePatch, int col = 0; // Now go through the control vertices with these calculated stepsize - for ( int idx = start; idx <= end; idx += incr, col++ ) { + for ( int idx = start; idx <= end; idx += incr, ++col ) { Vector3 sourceCoord = sourceCtrl[idx].m_vertex; Vector3 targetCoord = targetCtrl[idx].m_vertex; Vector3 middleCoord = ( sourceCoord + targetCoord ) / 2; diff --git a/radiant/patch.h b/radiant/patch.h index c941a649..951db8ee 100644 --- a/radiant/patch.h +++ b/radiant/patch.h @@ -266,7 +266,7 @@ public: void render( RenderStateFlags state ) const override { gl().glVertexPointer( 3, GL_FLOAT, sizeof( ArbitraryMeshVertex ), &m_tess.m_vertices.data()->vertex ); const RenderIndex* strip_indices = m_tess.m_indices.data(); - for ( std::size_t i = 0; i < m_tess.m_numStrips; i++, strip_indices += m_tess.m_lenStrips ) + for ( std::size_t i = 0; i < m_tess.m_numStrips; ++i, strip_indices += m_tess.m_lenStrips ) { gl().glDrawElements( GL_QUAD_STRIP, GLsizei( m_tess.m_lenStrips ), RenderIndexTypeID, strip_indices ); } @@ -301,7 +301,7 @@ public: } gl().glVertexPointer( 3, GL_FLOAT, sizeof( ArbitraryMeshVertex ), &m_tess.m_vertices.data()->vertex ); const RenderIndex* strip_indices = m_tess.m_indices.data(); - for ( std::size_t i = 0; i < m_tess.m_numStrips; i++, strip_indices += m_tess.m_lenStrips ) + for ( std::size_t i = 0; i < m_tess.m_numStrips; ++i, strip_indices += m_tess.m_lenStrips ) { gl().glDrawElements( GL_QUAD_STRIP, GLsizei( m_tess.m_lenStrips ), RenderIndexTypeID, strip_indices ); } @@ -639,7 +639,7 @@ public: void testSelect( Selector& selector, SelectionTest& test ){ SelectionIntersection best; IndexPointer::index_type* pIndex = m_tess.m_indices.data(); - for ( std::size_t s = 0; s < m_tess.m_numStrips; s++ ) + for ( std::size_t s = 0; s < m_tess.m_numStrips; ++s ) { test.TestQuadStrip( vertexpointer_arbitrarymeshvertex( m_tess.m_vertices.data() ), IndexPointer( pIndex, m_tess.m_lenStrips ), best ); pIndex += m_tess.m_lenStrips; @@ -1081,11 +1081,11 @@ inline bool Patch_importMatrix( Patch& patch, Tokeniser& tokeniser ){ tokeniser.nextLine(); RETURN_FALSE_IF_FAIL( Tokeniser_parseToken( tokeniser, "(" ) ); { - for ( std::size_t c = 0; c < patch.getWidth(); c++ ) + for ( std::size_t c = 0; c < patch.getWidth(); ++c ) { tokeniser.nextLine(); RETURN_FALSE_IF_FAIL( Tokeniser_parseToken( tokeniser, "(" ) ); - for ( std::size_t r = 0; r < patch.getHeight(); r++ ) + for ( std::size_t r = 0; r < patch.getHeight(); ++r ) { RETURN_FALSE_IF_FAIL( Tokeniser_parseToken( tokeniser, "(" ) ); @@ -1203,10 +1203,10 @@ inline void Patch_exportMatrix( const Patch& patch, TokenWriter& writer ){ // write matrix writer.writeToken( "(" ); writer.nextLine(); - for ( std::size_t c = 0; c < patch.getWidth(); c++ ) + for ( std::size_t c = 0; c < patch.getWidth(); ++c ) { writer.writeToken( "(" ); - for ( std::size_t r = 0; r < patch.getHeight(); r++ ) + for ( std::size_t r = 0; r < patch.getHeight(); ++r ) { writer.writeToken( "(" ); diff --git a/radiant/points.cpp b/radiant/points.cpp index 4541af54..9c6e8159 100644 --- a/radiant/points.cpp +++ b/radiant/points.cpp @@ -153,7 +153,7 @@ void CPointfile::GenerateDisplayList(){ gl().glNewList( m_displaylist, GL_COMPILE ); gl().glBegin( GL_LINE_STRIP ); - for ( std::size_t i = 0; i < s_num_points; i++ ) + for ( std::size_t i = 0; i < s_num_points; ++i ) gl().glVertex3fv( vector3_to_array( s_pointvecs[i] ) ); gl().glEnd(); gl().glLineWidth( 1 ); diff --git a/radiant/qgl.cpp b/radiant/qgl.cpp index 11b76c85..3809b98b 100644 --- a/radiant/qgl.cpp +++ b/radiant/qgl.cpp @@ -58,8 +58,7 @@ GLU_ERROR_STRUCT glu_errlist[] = { }; const GLubyte* qgluErrorString( GLenum errCode ){ - int search = 0; - for ( search = 0; glu_errlist[search].errstr; search++ ) + for ( int search = 0; glu_errlist[search].errstr; ++search ) { if ( errCode == glu_errlist[search].errnum ) { return (const GLubyte *)glu_errlist[search].errstr; diff --git a/radiant/selection.cpp b/radiant/selection.cpp index e8d88668..4faf9af7 100644 --- a/radiant/selection.cpp +++ b/radiant/selection.cpp @@ -739,7 +739,7 @@ public: start[2] == 0 ? 1 : 1 + delta[2] / start[2] ); /* try bbox way */ - for( std::size_t i = 0; i < 3; i++ ){ + for( std::size_t i = 0; i < 3; ++i ){ if( m_chosen_extent[i] > 0.0625f && m_axis[i] != 0.f ){ //epsilon to prevent super high scale for set of models, having really small extent, formed by origins scale[i] = ( m_chosen_extent[i] + delta[i] ) / m_chosen_extent[i]; if( g_modifiers.ctrl() ){ // snap bbox dimension size to grid @@ -749,7 +749,7 @@ public: } } if( g_modifiers.shift() ){ // scale all axes equally - for( std::size_t i = 0; i < 3; i++ ){ + for( std::size_t i = 0; i < 3; ++i ){ if( m_axis[i] == 0.f ){ scale[i] = vector3_dot( scale, vector3_scaled( m_axis, m_axis ) ); } @@ -816,7 +816,7 @@ public: ); //globalOutputStream() << "m_start: " << m_start << " start: " << start << " delta: " << delta << '\n'; - for( std::size_t i = 0; i < 3; i++ ){ + for( std::size_t i = 0; i < 3; ++i ){ if( m_chosen_extent[i] > 0.0625f && start[i] != 0.f ){ scale[i] = ( m_chosen_extent[i] + delta[i] ) / m_chosen_extent[i]; if( g_modifiers.ctrl() ){ // snap bbox dimension size to grid @@ -828,13 +828,13 @@ public: //globalOutputStream() << "pre snap scale: " << scale << '\n'; if( g_modifiers.shift() ){ // snap 2 axes equally float bestscale = ignore_axis != 0 ? scale[0] : scale[1]; - for( std::size_t i = ignore_axis != 0 ? 1 : 2; i < 3; i++ ){ + for( std::size_t i = ignore_axis != 0 ? 1 : 2; i < 3; ++i ){ if( ignore_axis != i && fabs( scale[i] ) < fabs( bestscale ) ){ bestscale = scale[i]; } //globalOutputStream() << "bestscale: " << bestscale << '\n'; } - for( std::size_t i = 0; i < 3; i++ ){ + for( std::size_t i = 0; i < 3; ++i ){ if( ignore_axis != i ){ scale[i] = ( scale[i] < 0.f ) ? -fabs( bestscale ) : fabs( bestscale ); } @@ -8134,7 +8134,7 @@ void RadiantSelectionSystem::setCustomTransformOrigin( const Vector3& origin, co if ( !nothingSelected() && transformOrigin_isTranslatable() ) { //globalOutputStream() << origin << '\n'; - for( std::size_t i = 0; i < 3; i++ ){ + for( std::size_t i = 0; i < 3; ++i ){ float value = origin[i]; if( set[i] ){ float bestsnapDist = fabs( m_bounds.origin[i] - value ); diff --git a/radiant/texmanip.cpp b/radiant/texmanip.cpp index bf24aaac..917df8ef 100644 --- a/radiant/texmanip.cpp +++ b/radiant/texmanip.cpp @@ -44,7 +44,7 @@ void R_ResampleTextureLerpLine( const byte *in, byte *out, int inwidth, int outw fstep = (int) ( inwidth * 65536.0f / outwidth ); endx = ( inwidth - 1 ); if ( bytesperpixel == 4 ) { - for ( j = 0, f = 0; j < outwidth; j++, f += fstep ) + for ( j = 0, f = 0; j < outwidth; ++j, f += fstep ) { xi = f >> 16; if ( xi != oldx ) { @@ -69,7 +69,7 @@ void R_ResampleTextureLerpLine( const byte *in, byte *out, int inwidth, int outw } } else if ( bytesperpixel == 3 ) { - for ( j = 0, f = 0; j < outwidth; j++, f += fstep ) + for ( j = 0, f = 0; j < outwidth; ++j, f += fstep ) { xi = f >> 16; if ( xi != oldx ) { @@ -129,7 +129,7 @@ void R_ResampleTexture( const void *indata, int inwidth, int inheight, void *out R_ResampleTextureLerpLine( inrow, row1, inwidth, outwidth, bytesperpixel ); R_ResampleTextureLerpLine( inrow + inwidth4, row2, inwidth, outwidth, bytesperpixel ); - for ( i = 0, f = 0; i < outheight; i++, f += fstep ) + for ( i = 0, f = 0; i < outheight; ++i, f += fstep ) { yi = f >> 16; if ( yi < endy ) { @@ -225,7 +225,7 @@ void R_ResampleTexture( const void *indata, int inwidth, int inheight, void *out oldy = 0; R_ResampleTextureLerpLine( inrow, row1, inwidth, outwidth, bytesperpixel ); R_ResampleTextureLerpLine( inrow + inwidth3, row2, inwidth, outwidth, bytesperpixel ); - for ( i = 0, f = 0; i < outheight; i++, f += fstep ) + for ( i = 0, f = 0; i < outheight; ++i, f += fstep ) { yi = f >> 16; if ( yi < endy ) { @@ -317,9 +317,9 @@ void GL_MipReduce( byte *in, byte *out, int width, int height, int destwidth, in width2 = width >> 1; height2 = height >> 1; nextrow = width << 2; - for ( y = 0; y < height2; y++ ) + for ( y = 0; y < height2; ++y ) { - for ( x = 0; x < width2; x++ ) + for ( x = 0; x < width2; ++x ) { out[0] = (byte) ( ( in[0] + in[4] + in[nextrow ] + in[nextrow + 4] ) >> 2 ); out[1] = (byte) ( ( in[1] + in[5] + in[nextrow + 1] + in[nextrow + 5] ) >> 2 ); @@ -335,9 +335,9 @@ void GL_MipReduce( byte *in, byte *out, int width, int height, int destwidth, in { // reduce width width2 = width >> 1; - for ( y = 0; y < height; y++ ) + for ( y = 0; y < height; ++y ) { - for ( x = 0; x < width2; x++ ) + for ( x = 0; x < width2; ++x ) { out[0] = (byte) ( ( in[0] + in[4] ) >> 1 ); out[1] = (byte) ( ( in[1] + in[5] ) >> 1 ); @@ -355,9 +355,9 @@ void GL_MipReduce( byte *in, byte *out, int width, int height, int destwidth, in // reduce height height2 = height >> 1; nextrow = width << 2; - for ( y = 0; y < height2; y++ ) + for ( y = 0; y < height2; ++y ) { - for ( x = 0; x < width; x++ ) + for ( x = 0; x < width; ++x ) { out[0] = (byte) ( ( in[0] + in[nextrow ] ) >> 1 ); out[1] = (byte) ( ( in[1] + in[nextrow + 1] ) >> 1 ); diff --git a/radiant/textures.cpp b/radiant/textures.cpp index 4f937574..220111fc 100644 --- a/radiant/textures.cpp +++ b/radiant/textures.cpp @@ -136,12 +136,12 @@ byte g_gammatable[256]; void ResampleGamma( float fGamma ){ int i, inf; if ( fGamma == 1.0 ) { - for ( i = 0; i < 256; i++ ) + for ( i = 0; i < 256; ++i ) g_gammatable[i] = i; } else { - for ( i = 0; i < 256; i++ ) + for ( i = 0; i < 256; ++i ) { inf = (int)( 255 * pow( static_cast( ( i + 0.5 ) / 255.5 ), static_cast( fGamma ) ) + 0.5 ); if ( inf < 0 ) { @@ -178,7 +178,7 @@ void LoadTextureRGBA( qtexture_t* q, unsigned char* pPixels, int nWidth, int nHe // resample texture gamma according to user settings for ( int i = 0; i < ( nCount * 4 ); i += 4 ) { - for ( int j = 0; j < 3; j++ ) + for ( int j = 0; j < 3; ++j ) { total[j] += ( pPixels + i )[j]; byte b = ( pPixels + i )[j]; @@ -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 bd68bd74..80b8f5c6 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 1d3b7130..e50606bb 100644 --- a/radiant/xywindow.cpp +++ b/radiant/xywindow.cpp @@ -735,7 +735,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 diff --git a/tools/quake3/common/jpeg.cpp b/tools/quake3/common/jpeg.cpp index 83a05694..e070cfd6 100644 --- a/tools/quake3/common/jpeg.cpp +++ b/tools/quake3/common/jpeg.cpp @@ -261,7 +261,7 @@ static void j_putRGBScanline( unsigned char* jpegline, int widthPix, unsigned ch int offset = row * widthPix * 4; int count; - for ( count = 0; count < widthPix; count++ ) + for ( count = 0; count < widthPix; ++count ) { unsigned char iRed, iBlu, iGrn; unsigned char *oRed, *oBlu, *oGrn, *oAlp; @@ -287,7 +287,7 @@ static void j_putRGBAScanline( unsigned char* jpegline, int widthPix, unsigned c int offset = row * widthPix * 4; int count; - for ( count = 0; count < widthPix; count++ ) + for ( count = 0; count < widthPix; ++count ) { unsigned char iRed, iBlu, iGrn /* , iAlp */; unsigned char *oRed, *oBlu, *oGrn, *oAlp; @@ -315,7 +315,7 @@ static void j_putGrayScanlineToRGB( unsigned char* jpegline, int widthPix, unsig int offset = row * widthPix * 4; int count; - for ( count = 0; count < widthPix; count++ ) + for ( count = 0; count < widthPix; ++count ) { unsigned char iGray; unsigned char *oRed, *oBlu, *oGrn, *oAlp; diff --git a/tools/quake3/common/polylib.cpp b/tools/quake3/common/polylib.cpp index 2c4ec8d6..f08cf8e2 100644 --- a/tools/quake3/common/polylib.cpp +++ b/tools/quake3/common/polylib.cpp @@ -58,7 +58,7 @@ winding_t AllocWinding( int points ){ void RemoveColinearPoints( winding_t& w ){ winding_t p = AllocWinding( w.size() ); - for ( size_t i = 0; i < w.size(); i++ ) + for ( size_t i = 0; i < w.size(); ++i ) { const size_t j = winding_next( w, i ); const size_t k = winding_next( w, j ); @@ -91,7 +91,7 @@ Plane3f WindingPlane( const winding_t& w ){ float WindingArea( const winding_t& w ){ float total = 0; - for ( size_t i = 2; i < w.size(); i++ ) + for ( size_t i = 2; i < w.size(); ++i ) { total += 0.5 * vector3_length( vector3_cross( w[i - 1] - w[0], w[i] - w[0] ) ); } @@ -148,7 +148,7 @@ winding_accu_t BaseWindingForPlaneAccu( const Plane3& plane ){ max = 0.56; // 1 / sqrt( 1^2 + 1^2 + 1^2 ) = 0.577350269 x = -1; - for ( i = 0; i < 3; i++ ) { + for ( i = 0; i < 3; ++i ) { v = fabs( plane.normal()[i] ); if ( v > max ) { x = i; @@ -319,7 +319,7 @@ std::pair ClipWindingEpsilonStrict( const winding_t& in int counts[3] = { 0 }; // determine sides for each point - for ( size_t i = 0; i < in.size(); i++ ) + for ( size_t i = 0; i < in.size(); ++i ) { dists[i] = plane3_distance_to_point( plane, in[i] ); @@ -354,7 +354,7 @@ std::pair ClipWindingEpsilonStrict( const winding_t& in winding_t front = AllocWinding( maxpts ); winding_t back = AllocWinding( maxpts ); - for ( size_t i = 0; i < in.size(); i++ ) + for ( size_t i = 0; i < in.size(); ++i ) { const Vector3& p1 = in[i]; @@ -379,7 +379,7 @@ std::pair ClipWindingEpsilonStrict( const winding_t& in const Vector3& p2 = in[winding_next( in, i )]; const double dot = dists[i] / ( dists[i] - dists[i + 1] ); Vector3 mid; - for ( size_t j = 0; j < 3; j++ ) + for ( size_t j = 0; j < 3; ++j ) { // avoid round off error when possible if ( plane.normal()[j] == 1 ) { mid[j] = plane.dist(); @@ -464,7 +464,7 @@ void ChopWindingInPlaceAccu( winding_accu_t& inout, const Plane3& plane, float c static const double smallestEpsilonAllowed = ( (double) VEC_SMALLEST_EPSILON_AROUND_ONE ) * 0.5; const double fineEpsilon = std::max( smallestEpsilonAllowed, (double) crudeEpsilon ); - for ( size_t i = 0; i < inout.size(); i++ ) + for ( size_t i = 0; i < inout.size(); ++i ) { dists[i] = plane3_distance_to_point( plane, inout[i] ); if ( dists[i] > fineEpsilon ) { @@ -498,7 +498,7 @@ void ChopWindingInPlaceAccu( winding_accu_t& inout, const Plane3& plane, float c winding_accu_t f; f.reserve( counts[eSideFront] + 2 ); - for ( size_t i = 0; i < inout.size(); i++ ) + for ( size_t i = 0; i < inout.size(); ++i ) { const DoubleVector3& p1 = inout[i]; @@ -522,7 +522,7 @@ void ChopWindingInPlaceAccu( winding_accu_t& inout, const Plane3& plane, float c // w is in the range (0,1). const double w = dists[i] / ( dists[i] - dists[i + 1] ); DoubleVector3 mid; - for ( size_t j = 0; j < 3; j++ ) + for ( size_t j = 0; j < 3; ++j ) { // Avoid round-off error when possible. Check axis-aligned normal. if ( plane.normal()[j] == 1 ) { @@ -556,7 +556,7 @@ void ChopWindingInPlace( winding_t& inout, const Plane3f& plane, float epsilon ) int counts[3] = { 0 }; // determine sides for each point - for ( size_t i = 0; i < in.size(); i++ ) + for ( size_t i = 0; i < in.size(); ++i ) { dists[i] = plane3_distance_to_point( plane, in[i] ); if ( dists[i] > epsilon ) { @@ -585,7 +585,7 @@ void ChopWindingInPlace( winding_t& inout, const Plane3f& plane, float epsilon ) winding_t f = AllocWinding( in.size() + 4 ); // cant use counts[0]+2 because of fp grouping errors - for ( size_t i = 0; i < in.size(); i++ ) + for ( size_t i = 0; i < in.size(); ++i ) { const Vector3& p1 = in[i]; @@ -607,7 +607,7 @@ void ChopWindingInPlace( winding_t& inout, const Plane3f& plane, float epsilon ) const double dot = dists[i] / ( dists[i] - dists[i + 1] ); Vector3 mid; - for ( size_t j = 0; j < 3; j++ ) + for ( size_t j = 0; j < 3; ++j ) { // avoid round off error when possible if ( plane.normal()[j] == 1 ) { mid[j] = plane.dist(); @@ -757,12 +757,12 @@ void AddWindingToConvexHull( const winding_t& w, winding_t& hull, const Vecto return id >= numHullPoints? id - numHullPoints : id; }; // calculate hull side vectors - for ( j = 0; j < numHullPoints; j++ ) { + for ( j = 0; j < numHullPoints; ++j ) { hullDirs[j] = vector3_cross( normal, VectorNormalized( hullPoints[wrap( j + 1 )] - hullPoints[j] ) ); } outside = false; - for ( j = 0; j < numHullPoints; j++ ) { + for ( j = 0; j < numHullPoints; ++j ) { const double d = vector3_dot( p - hullPoints[j], hullDirs[j] ); if ( d >= ON_EPSILON ) { outside = true; @@ -776,7 +776,7 @@ void AddWindingToConvexHull( const winding_t& w, winding_t& hull, const Vecto } // find the back side to front side transition - for ( j = 0; j < numHullPoints; j++ ) { + for ( j = 0; j < numHullPoints; ++j ) { if ( !hullSide[ j ] && hullSide[ wrap( j + 1 ) ] ) { break; } @@ -791,7 +791,7 @@ void AddWindingToConvexHull( const winding_t& w, winding_t& hull, const Vecto // copy over all points that aren't double fronts j = wrap( j + 1 ); - for ( k = 0; k < numHullPoints; k++ ) { + for ( k = 0; k < numHullPoints; ++k ) { if ( hullSide[ wrap( j + k ) ] && hullSide[ wrap( j + k + 1 ) ] ) { continue; } diff --git a/tools/quake3/common/qimagelib.cpp b/tools/quake3/common/qimagelib.cpp index 0fae334d..e776d062 100644 --- a/tools/quake3/common/qimagelib.cpp +++ b/tools/quake3/common/qimagelib.cpp @@ -523,7 +523,7 @@ void LoadPCX( const char *filename, byte **pic, byte **palette, int *width, int lsize = pcx->color_planes * pcx->bytes_per_line; /* go scanline by scanline */ - for ( y = 0; y <= pcx->ymax; y++, pix += pcx->xmax + 1 ) + for ( y = 0; y <= pcx->ymax; ++y, pix += pcx->xmax + 1 ) { /* do a scanline */ runLength = 0; @@ -933,7 +933,7 @@ void LoadTGABuffer( const byte *f, const size_t dataSize, byte **pic, int *width return; } if ( targa_header.colormap_size == 24 ) { - for ( x = 0; x < targa_header.colormap_length; x++ ) + for ( x = 0; x < targa_header.colormap_length; ++x ) { palette[x * 4 + 2] = *fin++; palette[x * 4 + 1] = *fin++; @@ -942,7 +942,7 @@ void LoadTGABuffer( const byte *f, const size_t dataSize, byte **pic, int *width } } else if ( targa_header.colormap_size == 32 ) { - for ( x = 0; x < targa_header.colormap_length; x++ ) + for ( x = 0; x < targa_header.colormap_length; ++x ) { palette[x * 4 + 2] = *fin++; palette[x * 4 + 1] = *fin++; @@ -1391,7 +1391,7 @@ static bool KTX_DecodeETC1( const byte* in, size_t inSize, unsigned int width, u blockrowsize = 4; } blockrowsize *= 4; - for ( blockrow = 0; blockrow < blockrows; blockrow++ ) + for ( blockrow = 0; blockrow < blockrows; ++blockrow ) { memcpy( p + blockrow * stride, rgba + blockrow * 16, blockrowsize ); } @@ -1475,10 +1475,10 @@ void LoadKTXBufferFirstImage( const byte *buffer, size_t bufSize, byte **pic, in Error( "LoadKTX: Image is truncated" ); } - for ( y = 0; y < height; y++ ) + for ( y = 0; y < height; ++y ) { unsigned int x; - for ( x = 0; x < width; x++, buffer += pixelSize, pixels += 4 ) + for ( x = 0; x < width; ++x, buffer += pixelSize, pixels += 4 ) { ktxFormat->decode( buffer, bigEndian, pixels ); } diff --git a/tools/quake3/q3map2/brush.cpp b/tools/quake3/q3map2/brush.cpp index 5746f62f..a5c60194 100644 --- a/tools/quake3/q3map2/brush.cpp +++ b/tools/quake3/q3map2/brush.cpp @@ -92,7 +92,7 @@ Vector3 SnapWeldVector( const Vector3& a, const Vector3& b ){ Vector3 out; /* do each element */ - for ( int i = 0; i < 3; i++ ) + for ( int i = 0; i < 3; ++i ) { /* round to integer */ const float ai = std::rint( a[ i ] ); @@ -143,7 +143,7 @@ static DoubleVector3 SnapWeldVectorAccu( const DoubleVector3& a, const DoubleVec DoubleVector3 out; - for ( int i = 0; i < 3; i++ ) + for ( int i = 0; i < 3; ++i ) { const double ai = std::rint( a[i] ); const double bi = std::rint( b[i] ); @@ -663,7 +663,7 @@ static std::pair SplitBrush( const brush_t& brush, int planenu // split it for real brush_t b[2]{ brush, brush }; - for ( int i = 0; i < 2; i++ ) + for ( int i = 0; i < 2; ++i ) { b[i].sides.clear(); } @@ -676,7 +676,7 @@ static std::pair SplitBrush( const brush_t& brush, int planenu winding_t cw[2]; std::tie( cw[0], cw[1] ) = ClipWindingEpsilonStrict( side.winding, plane, 0 /*PLANESIDE_EPSILON*/ ); /* strict, in parallel case we get the face back because it also is the midwinding */ - for ( int i = 0; i < 2; i++ ) + for ( int i = 0; i < 2; ++i ) { if ( !cw[i].empty() ) { side_t& cs = b[i].sides.emplace_back( side ); @@ -688,7 +688,7 @@ static std::pair SplitBrush( const brush_t& brush, int planenu // see if we have valid polygons on both sides - for ( int i = 0; i < 2; i++ ) + for ( int i = 0; i < 2; ++i ) { if ( b[i].sides.size() < 3 || !BoundBrush( b[i] ) ) { if ( b[i].sides.size() >= 3 ) { @@ -715,7 +715,7 @@ static std::pair SplitBrush( const brush_t& brush, int planenu } // add the midwinding to both sides - for ( int i = 0; i < 2; i++ ) + for ( int i = 0; i < 2; ++i ) { side_t& cs = b[i].sides.emplace_back(); @@ -729,7 +729,7 @@ static std::pair SplitBrush( const brush_t& brush, int planenu } } - for ( int i = 0; i < 2; i++ ) + for ( int i = 0; i < 2; ++i ) { if ( BrushVolume( b[i] ) < 1.0 ) { b[i].sides.clear(); diff --git a/tools/quake3/q3map2/bspfile_rbsp.cpp b/tools/quake3/q3map2/bspfile_rbsp.cpp index 0024540a..559fa13b 100644 --- a/tools/quake3/q3map2/bspfile_rbsp.cpp +++ b/tools/quake3/q3map2/bspfile_rbsp.cpp @@ -133,9 +133,9 @@ static void AddLightGridLumps( FILE *file, rbspHeader_t& header ){ /* compare light */ bool bad = false; - for ( int k = 0; ( k < MAX_LIGHTMAPS && !bad ); k++ ) + for ( int k = 0; ( k < MAX_LIGHTMAPS && !bad ); ++k ) { - for ( int c = 0; c < 3; c++ ) + for ( int c = 0; c < 3; ++c ) { if ( abs( (int) in.ambient[ k ][ c ] - (int) out.ambient[ k ][ c ] ) > LG_EPSILON || abs( (int) in.directed[ k ][ c ] - (int) out.directed[ k ][ c ] ) > LG_EPSILON ) { diff --git a/tools/quake3/q3map2/convert_ase.cpp b/tools/quake3/q3map2/convert_ase.cpp index c3b20c93..d183b993 100644 --- a/tools/quake3/q3map2/convert_ase.cpp +++ b/tools/quake3/q3map2/convert_ase.cpp @@ -83,7 +83,7 @@ static void ConvertSurface( FILE *f, int modelNum, int surfaceNum, const Vector3 /* export vertex xyz */ fprintf( f, "\t\t*MESH_VERTEX_LIST\t{\r\n" ); - for ( int i = 0; i < ds.numVerts; i++ ) + for ( int i = 0; i < ds.numVerts; ++i ) { const bspDrawVert_t& dv = bspDrawVerts[ ds.firstVert + i ]; fprintf( f, "\t\t\t*MESH_VERTEX\t%d\t%f\t%f\t%f\r\n", i, dv.xyz[ 0 ], dv.xyz[ 1 ], dv.xyz[ 2 ] ); @@ -106,7 +106,7 @@ static void ConvertSurface( FILE *f, int modelNum, int surfaceNum, const Vector3 /* export vertex st */ fprintf( f, "\t\t*MESH_NUMTVERTEX\t%d\r\n", ds.numVerts ); fprintf( f, "\t\t*MESH_TVERTLIST\t{\r\n" ); - for ( int i = 0; i < ds.numVerts; i++ ) + for ( int i = 0; i < ds.numVerts; ++i ) { const bspDrawVert_t& dv = bspDrawVerts[ ds.firstVert + i ]; if ( lightmapsAsTexcoord ) { @@ -181,7 +181,7 @@ static void ConvertModel( FILE *f, int modelNum, const Vector3& origin, const st const bspModel_t& model = bspModels[ modelNum ]; /* go through each drawsurf in the model */ - for ( int i = 0; i < model.numBSPSurfaces; i++ ) + for ( int i = 0; i < model.numBSPSurfaces; ++i ) { ConvertSurface( f, modelNum, model.firstBSPSurface + i, origin, lmIndices ); } @@ -342,7 +342,7 @@ int ConvertBSPToASE( char *bspName ){ if ( lightmapsAsTexcoord ) { numLightmapsASE = Convert_CountLightmaps( dirname ); fprintf( f, "\t*MATERIAL_COUNT\t%d\r\n", numLightmapsASE ); - for ( int i = 0; i < numLightmapsASE; i++ ) + for ( int i = 0; i < numLightmapsASE; ++i ) ConvertLightmap( f, base, i ); Convert_ReferenceLightmaps( base, lmIndices ); } diff --git a/tools/quake3/q3map2/convert_bsp.cpp b/tools/quake3/q3map2/convert_bsp.cpp index f9125cb2..c7c6a506 100644 --- a/tools/quake3/q3map2/convert_bsp.cpp +++ b/tools/quake3/q3map2/convert_bsp.cpp @@ -169,7 +169,7 @@ int AnalyzeBSP( Args& args ){ Sys_Printf( "---------------------------------------\n" ); /* analyze each lump */ - for ( i = 0; i < 100; i++ ) + for ( i = 0; i < 100; ++i ) { /* call of duty swapped lump pairs */ if ( lumpSwap ) { @@ -214,7 +214,7 @@ int AnalyzeBSP( Args& args ){ else { /* guess based on size/count */ - for ( lumpTest = lumpTests; lumpTest->radix > 0; lumpTest++ ) + for ( lumpTest = lumpTests; lumpTest->radix > 0; ++lumpTest ) { if ( ( length % lumpTest->radix ) != 0 ) { continue; diff --git a/tools/quake3/q3map2/convert_map.cpp b/tools/quake3/q3map2/convert_map.cpp index fd97ab98..ea5afbfd 100644 --- a/tools/quake3/q3map2/convert_map.cpp +++ b/tools/quake3/q3map2/convert_map.cpp @@ -199,7 +199,7 @@ static void bspBrush_to_buildBrush( const bspBrush_t& brush ){ if ( force ){ int notNoShader = 0; modelclip = true; - for ( int i = 0; i < brush.numSides; i++ ) + for ( int i = 0; i < brush.numSides; ++i ) { /* get side */ const bspBrushSide_t& side = bspBrushSides[ brush.firstSide + i ]; @@ -221,7 +221,7 @@ static void bspBrush_to_buildBrush( const bspBrush_t& brush ){ } /* iterate through bsp brush sides */ - for ( int i = 0; i < brush.numSides; i++ ) + for ( int i = 0; i < brush.numSides; ++i ) { /* get side */ const bspBrushSide_t& side = bspBrushSides[ brush.firstSide + i ]; @@ -643,7 +643,7 @@ static void ConvertBrush( FILE *f, int bspBrushNum, const Vector3& origin, bool #if 0 /* iterate through the brush sides (ignore the first 6 bevel planes) */ -for ( i = 0; i < brush->numSides; i++ ) +for ( i = 0; i < brush->numSides; ++i ) { /* get side */ side = &bspBrushSides[ brush->firstSide + i ]; @@ -680,7 +680,7 @@ for ( i = 0; i < brush->numSides; i++ ) } /* offset by origin */ - for ( j = 0; j < 3; j++ ) + for ( j = 0; j < 3; ++j ) VectorAdd( pts[ j ], origin, pts[ j ] ); /* print brush side */ @@ -744,13 +744,13 @@ static void ConvertPatch( FILE *f, int num, const bspDrawSurface_t& ds, const Ve fprintf( f, "\t\t\t(\n" ); /* iterate through the verts */ - for ( int x = 0; x < ds.patchWidth; x++ ) + for ( int x = 0; x < ds.patchWidth; ++x ) { /* start row */ fprintf( f, "\t\t\t\t(" ); /* iterate through the row */ - for ( int y = 0; y < ds.patchHeight; y++ ) + for ( int y = 0; y < ds.patchHeight; ++y ) { /* get vert */ const bspDrawVert_t& dv = bspDrawVerts[ ds.firstVert + ( y * ds.patchWidth ) + x ]; @@ -785,7 +785,7 @@ static void ConvertModel( FILE *f, const bspModel_t& model, const Vector3& origi } /* go through each brush in the model */ - for ( int i = 0; i < model.numBSPBrushes; i++ ) + for ( int i = 0; i < model.numBSPBrushes; ++i ) { if( fast ) ConvertBrushFast( f, model.firstBSPBrush + i, origin, brushPrimitives ); @@ -794,7 +794,7 @@ static void ConvertModel( FILE *f, const bspModel_t& model, const Vector3& origi } /* go through each drawsurf in the model */ - for ( int i = 0; i < model.numBSPSurfaces; i++ ) + for ( int i = 0; i < model.numBSPSurfaces; ++i ) { const int num = i + model.firstBSPSurface; const bspDrawSurface_t& ds = bspDrawSurfaces[ num ]; diff --git a/tools/quake3/q3map2/convert_obj.cpp b/tools/quake3/q3map2/convert_obj.cpp index 27f53fb5..5da9b197 100644 --- a/tools/quake3/q3map2/convert_obj.cpp +++ b/tools/quake3/q3map2/convert_obj.cpp @@ -88,7 +88,7 @@ static void ConvertSurfaceToOBJ( FILE *f, int modelNum, int surfaceNum, const Ve } /* export vertex */ - for ( int i = 0; i < ds.numVerts; i++ ) + for ( int i = 0; i < ds.numVerts; ++i ) { const bspDrawVert_t& dv = bspDrawVerts[ ds.firstVert + i ]; fprintf( f, "# vertex %d\r\n", i + objVertexCount + 1 ); @@ -129,7 +129,7 @@ static void ConvertModelToOBJ( FILE *f, int modelNum, const Vector3& origin, con const bspModel_t& model = bspModels[ modelNum ]; /* go through each drawsurf in the model */ - for ( int i = 0; i < model.numBSPSurfaces; i++ ) + for ( int i = 0; i < model.numBSPSurfaces; ++i ) { ConvertSurfaceToOBJ( f, modelNum, model.firstBSPSurface + i, origin, lmIndices ); } @@ -152,7 +152,7 @@ static void ConvertShaderToMTL( FILE *f, const bspShader_t& shader ){ : StringStream<64>( si.shaderImage->filename ); /* blender hates this, so let's not do it - for( char *c = filename; *c; c++ ) + for( char *c = filename; *c; ++c ) if( *c == '/' ) *c = '\\'; */ @@ -189,9 +189,9 @@ static void ConvertLightmapToMTL( FILE *f, const char *base, int lightmapNum ){ int Convert_CountLightmaps( const char* dirname ){ int lightmapCount; //FIXME numBSPLightmaps is 0, must be bspLightBytes / ( g_game->lightmapSize * g_game->lightmapSize * 3 ) - for ( lightmapCount = 0; lightmapCount < numBSPLightmaps; lightmapCount++ ) + for ( lightmapCount = 0; lightmapCount < numBSPLightmaps; ++lightmapCount ) ; - for ( ; ; lightmapCount++ ) + for ( ; ; ++lightmapCount ) { char buf[1024]; std::snprintf( buf, std::size( buf ), "%s/" EXTERNAL_LIGHTMAP, dirname, lightmapCount ); @@ -322,7 +322,7 @@ int ConvertBSPToOBJ( char *bspName ){ } if ( lightmapsAsTexcoord ) { - for ( int i = firstLightmap; i <= lastLightmap; i++ ) + for ( int i = firstLightmap; i <= lastLightmap; ++i ) ConvertLightmapToMTL( fmtl, base, i ); } diff --git a/tools/quake3/q3map2/decals.cpp b/tools/quake3/q3map2/decals.cpp index b2b760d9..2603579f 100644 --- a/tools/quake3/q3map2/decals.cpp +++ b/tools/quake3/q3map2/decals.cpp @@ -132,12 +132,12 @@ static bool MakeTextureMatrix( decalProjector_t *dp, const Plane3f& projection, vecs[ 2 ] = -projection.normal(); /* calculate transform axis */ - for ( i = 0; i < 3; i++ ){ + for ( i = 0; i < 3; ++i ){ axis[ i ] = vecs[ i ]; lengths[ i ] = VectorNormalize( axis[ i ] ); } - for ( i = 0; i < 2; i++ ) - for ( j = 0; j < 3; j++ ) + for ( i = 0; i < 2; ++i ) + for ( j = 0; j < 3; ++j ) dp->texMat[ i ][ j ] = lengths[ i ] != 0.0 ? ( axis[ i ][ j ] / lengths[ i ] ) : 0.0; //% dp->texMat[ i ][ j ] = fabs( vecs[ i ][ j ] ) > 0.0 ? ( 1.0 / vecs[ i ][ j ] ) : 0.0; //% dp->texMat[ i ][ j ] = axis[ i ][ j ] > 0.0 ? ( 1.0 / axis[ i ][ j ] ) : 0.0; @@ -165,17 +165,17 @@ static bool MakeTextureMatrix( decalProjector_t *dp, const Plane3f& projection, texDeltas[ 2 ] = b->st - c->st; /* walk st */ - for ( i = 0; i < 2; i++ ) + for ( i = 0; i < 2; ++i ) { /* walk xyz */ - for ( j = 0; j < 3; j++ ) + for ( j = 0; j < 3; ++j ) { /* clear deltas */ delta = 0.0; texDelta = 0.0; /* walk deltas */ - for ( k = 0; k < 3; k++ ) + for ( k = 0; k < 3; ++k ) { if ( fabs( deltas[ k ][ j ] ) > delta && fabs( texDeltas[ k ][ i ] ) > texDelta ) { @@ -261,7 +261,7 @@ static void TransformDecalProjector( decalProjector_t *in, const Vector3 (&axis) out->radius2 = in->radius2; /* translate planes */ - for ( int i = 0; i < in->numPlanes; i++ ) + for ( int i = 0; i < in->numPlanes; ++i ) { out->planes[ i ].a = vector3_dot( in->planes[ i ].normal(), axis[ 0 ] ); out->planes[ i ].b = vector3_dot( in->planes[ i ].normal(), axis[ 1 ] ); @@ -270,7 +270,7 @@ static void TransformDecalProjector( decalProjector_t *in, const Vector3 (&axis) } /* translate texture matrix */ - for ( int i = 0; i < 2; i++ ) + for ( int i = 0; i < 2; ++i ) { out->texMat[ i ][ 0 ] = vector3_dot( in->texMat[ i ].vec3(), axis[ 0 ] ); out->texMat[ i ][ 1 ] = vector3_dot( in->texMat[ i ].vec3(), axis[ 1 ] ); @@ -317,7 +317,7 @@ static int MakeDecalProjector( shaderInfo_t *si, const Plane3f& projection, floa /* bound the projector */ dp->minmax.clear(); - for ( i = 0; i < numVerts; i++ ) + for ( i = 0; i < numVerts; ++i ) { dp->minmax.extend( dv[ i ]->xyz ); dp->minmax.extend( dv[ i ]->xyz + projection.normal() * distance ); @@ -338,7 +338,7 @@ static int MakeDecalProjector( shaderInfo_t *si, const Plane3f& projection, floa dp->planes[ 1 ].dist() = vector3_dot( dv[ 0 ]->xyz + projection.normal() * distance, dp->planes[ 1 ].normal() ); /* make the side planes */ - for ( i = 0; i < numVerts; i++ ) + for ( i = 0; i < numVerts; ++i ) { j = ( i + 1 ) % numVerts; if ( !PlaneFromPoints( dp->planes[ i + 2 ], dv[ j ]->xyz, dv[ i ]->xyz, dv[ i ]->xyz + projection.normal() * distance ) ) { @@ -424,9 +424,9 @@ void ProcessDecals(){ vert.xyz += e.origin; /* iterate through the mesh quads */ - for ( int y = 0; y < ( mesh->height - 1 ); y++ ) + for ( int y = 0; y < ( mesh->height - 1 ); ++y ) { - for ( int x = 0; x < ( mesh->width - 1 ); x++ ) + for ( int x = 0; x < ( mesh->width - 1 ); ++x ) { /* set indexes */ const int pw[ 5 ] = { @@ -518,7 +518,7 @@ static void ProjectDecalOntoWinding( decalProjector_t *dp, mapDrawSurface_t *ds, } /* walk list of planes */ - for ( i = 0; i < dp->numPlanes; i++ ) + for ( i = 0; i < dp->numPlanes; ++i ) { /* chop winding by the plane */ auto [front, back] = ClipWindingEpsilonStrict( w, dp->planes[ i ], 0.0625f ); /* strict, if identical plane we don't want to keep it */ @@ -556,7 +556,7 @@ static void ProjectDecalOntoWinding( decalProjector_t *dp, mapDrawSurface_t *ds, ds2->verts = safe_calloc( ds2->numVerts * sizeof( *ds2->verts ) ); /* set vertexes */ - for ( i = 0; i < ds2->numVerts; i++ ) + for ( i = 0; i < ds2->numVerts; ++i ) { /* get vertex */ dv = &ds2->verts[ i ]; @@ -573,7 +573,7 @@ static void ProjectDecalOntoWinding( decalProjector_t *dp, mapDrawSurface_t *ds, dv->st[ 1 ] = vector3_dot( dv->xyz, dp->texMat[ 1 ].vec3() ) + dp->texMat[ 1 ][ 3 ]; /* set color */ - for ( j = 0; j < MAX_LIGHTMAPS; j++ ) + for ( j = 0; j < MAX_LIGHTMAPS; ++j ) { dv->color[ j ] = { 255, 255, 255, color_to_byte( alpha ) }; } @@ -632,9 +632,9 @@ static void ProjectDecalOntoPatch( decalProjector_t *dp, mapDrawSurface_t *ds ){ FreeMesh( subdivided ); /* iterate through the mesh quads */ - for ( int y = 0; y < ( mesh->height - 1 ); y++ ) + for ( int y = 0; y < ( mesh->height - 1 ); ++y ) { - for ( int x = 0; x < ( mesh->width - 1 ); x++ ) + for ( int x = 0; x < ( mesh->width - 1 ); ++x ) { /* set indexes */ const int pw[ 5 ] = { @@ -724,7 +724,7 @@ void MakeEntityDecals( const entity_t& e ){ Timer timer; /* walk the list of decal projectors */ - for ( i = 0; i < numProjectors; i++ ) + for ( i = 0; i < numProjectors; ++i ) { /* print pacifier */ if ( const int f = 10 * i / numProjectors; f != fOld ) { diff --git a/tools/quake3/q3map2/facebsp.cpp b/tools/quake3/q3map2/facebsp.cpp index 432b93f8..4a806125 100644 --- a/tools/quake3/q3map2/facebsp.cpp +++ b/tools/quake3/q3map2/facebsp.cpp @@ -54,7 +54,7 @@ static void SelectSplitPlaneNum( const node_t *node, const facelist_t& list, int /* ydnar 2002-09-21: changed blocksize to be a vector, so mappers can specify a 3 element value */ /* if it is crossing a block boundary, force a split */ - for ( int i = 0; i < 3; i++ ) + for ( int i = 0; i < 3; ++i ) { if ( blockSize[ i ] <= 0 ) { continue; diff --git a/tools/quake3/q3map2/fog.cpp b/tools/quake3/q3map2/fog.cpp index 141ecbfd..a702721a 100644 --- a/tools/quake3/q3map2/fog.cpp +++ b/tools/quake3/q3map2/fog.cpp @@ -200,7 +200,7 @@ static void SplitMeshByPlane( mesh_t *in, const Plane3f& plane, mesh_t **front, } // clip the crossing line - for ( h = 0; h < in->height; h++ ) + for ( h = 0; h < in->height; ++h ) { dv = &f->verts[ h * f->width + split + 1 ]; v1 = &in->verts[ h * in->width + split ]; @@ -209,7 +209,7 @@ static void SplitMeshByPlane( mesh_t *in, const Plane3f& plane, mesh_t **front, frac = d[h][split] / ( d[h][split] - d[h][split + 1] ); /* interpolate */ - //% for( i = 0; i < 10; i++ ) + //% for( i = 0; i < 10; ++i ) //% dv->xyz[ i ] = v1->xyz[ i ] + frac * (v2->xyz[ i ] - v1->xyz[ i ]); //% dv->xyz[10] = 0; // set all 4 colors to 0 LerpDrawVertAmount( v1, v2, frac, dv ); @@ -278,7 +278,7 @@ static bool ChopPatchSurfaceByBrush( mapDrawSurface_t *ds, const brush_t *b ){ /* all of outside fragments become separate drawsurfs */ numFogPatchFragments += numOutside; - for ( i = 0; i < numOutside; i++ ) + for ( i = 0; i < numOutside; ++i ) { /* transpose and invert the chopped patch (fixes potential crash. fixme: why?) */ outside[ i ] = TransposeMesh( outside[ i ] ); @@ -332,7 +332,7 @@ winding_t WindingFromDrawSurf( const mapDrawSurface_t *ds ){ const int max = std::min( ds->numVerts, 256 ); Vector3 p[256]; - for ( int i = 0; i < max; i++ ) { + for ( int i = 0; i < max; ++i ) { p[i] = ds->verts[i].xyz; } @@ -459,7 +459,7 @@ void FogDrawSurfaces( const entity_t& e ){ /* clip each surface into this, but don't clip any of the resulting fragments to the same brush */ numBaseDrawSurfs = numMapDrawSurfs; - for ( int i = 0; i < numBaseDrawSurfs; i++ ) + for ( int i = 0; i < numBaseDrawSurfs; ++i ) { /* get the drawsurface */ mapDrawSurface_t *ds = &mapDrawSurfs[ i ]; diff --git a/tools/quake3/q3map2/image.cpp b/tools/quake3/q3map2/image.cpp index c5051737..f0c06b1b 100644 --- a/tools/quake3/q3map2/image.cpp +++ b/tools/quake3/q3map2/image.cpp @@ -211,7 +211,7 @@ static void LoadPNGBuffer( byte *buffer, int size, byte **pixels, int *width, in /* create row pointers */ rowPointers = safe_malloc( h * sizeof( byte* ) ); - for ( i = 0; i < h; i++ ) + for ( i = 0; i < h; ++i ) rowPointers[ i ] = *pixels + ( i * w * 4 ); /* read the png */ diff --git a/tools/quake3/q3map2/light.cpp b/tools/quake3/q3map2/light.cpp index 10e9ea27..0f05b661 100644 --- a/tools/quake3/q3map2/light.cpp +++ b/tools/quake3/q3map2/light.cpp @@ -550,7 +550,7 @@ static void CreateEntityLights(){ } /* jitter the light */ - for ( int j = 1; j < numSamples; j++ ) + for ( int j = 1; j < numSamples; ++j ) { /* create a light */ light_t& light2 = lights.emplace_front( light ); @@ -588,7 +588,7 @@ static void CreateSurfaceLights(){ const bool nss = entities[ 0 ].boolForKey( "_noshadersun" ); /* walk the list of surfaces */ - for ( size_t i = 0; i < bspDrawSurfaces.size(); i++ ) + for ( size_t i = 0; i < bspDrawSurfaces.size(); ++i ) { /* get surface and other bits */ bspDrawSurface_t *ds = &bspDrawSurfaces[ i ]; @@ -687,13 +687,13 @@ static void SetEntityOrigins(){ } /* set origin for all surfaces for this model */ - for ( int j = 0; j < dm.numBSPSurfaces; j++ ) + for ( int j = 0; j < dm.numBSPSurfaces; ++j ) { /* get drawsurf */ const bspDrawSurface_t& ds = bspDrawSurfaces[ dm.firstBSPSurface + j ]; /* set its verts */ - for ( int k = 0; k < ds.numVerts; k++ ) + for ( int k = 0; k < ds.numVerts; ++k ) { yDrawVerts[ ds.firstVert + k ].xyz += origin; } @@ -1174,7 +1174,7 @@ void LightingAtSample( trace_t *trace, byte styles[ MAX_LIGHTMAPS ], Vector3 (&c /* clear colors */ - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) colors[ lightmapNum ].set( 0 ); /* ydnar: normalmap */ @@ -1189,13 +1189,13 @@ void LightingAtSample( trace_t *trace, byte styles[ MAX_LIGHTMAPS ], Vector3 (&c } /* ydnar: trace to all the list of lights pre-stored in tw */ - for ( i = 0; i < trace->numLights && trace->lights[ i ] != NULL; i++ ) + for ( i = 0; i < trace->numLights && trace->lights[ i ] != NULL; ++i ) { /* set light */ trace->light = trace->lights[ i ]; /* style check */ - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { if ( styles[ lightmapNum ] == trace->light->style || styles[ lightmapNum ] == LS_NONE ) { @@ -1565,7 +1565,7 @@ static void TraceGrid( int num ){ trace.inhibitRadius = DEFAULT_INHIBIT_RADIUS; trace.testAll = true; - for ( k = 0; k < 2; k++ ) + for ( k = 0; k < 2; ++k ) { if ( k == 0 ) { // upper hemisphere trace.normal = g_vector3_axis_z; @@ -1602,7 +1602,7 @@ static void TraceGrid( int num ){ go back and separate all the light into directed and ambient */ numStyles = 1; - for ( i = 0; i < numCon; i++ ) + for ( i = 0; i < numCon; ++i ) { /* get relative directed strength */ d = vector3_dot( contributions[ i ].dir, thisdir ); @@ -1610,7 +1610,7 @@ static void TraceGrid( int num ){ d = std::max( 0.f, gridAmbientDirectionality + d * ( gridDirectionality - gridAmbientDirectionality ) ); /* find appropriate style */ - for ( j = 0; j < numStyles; j++ ) + for ( j = 0; j < numStyles; ++j ) { if ( gp->styles[ j ] == contributions[ i ].style ) { break; @@ -1662,7 +1662,7 @@ static void TraceGrid( int num ){ /* store off sample */ - for ( i = 0; i < MAX_LIGHTMAPS; i++ ) + for ( i = 0; i < MAX_LIGHTMAPS; ++i ) { #if 0 /* do some fudging to keep the ambient from being too low (2003-07-05: 0.25 -> 0.125) */ @@ -1673,7 +1673,7 @@ static void TraceGrid( int num ){ /* set minimum light and copy off to bytes */ Vector3 color = gp->ambient[ i ]; - for ( j = 0; j < 3; j++ ) + for ( j = 0; j < 3; ++j ) value_maximize( color[ j ], minGridLight[ j ] ); /* vortex: apply gridscale and gridambientscale here */ @@ -1721,7 +1721,7 @@ static void SetupGrid(){ /* quantize it */ const Vector3 oldGridSize = gridSize; - for ( int i = 0; i < 3; i++ ) + for ( int i = 0; i < 3; ++i ) gridSize[ i ] = std::max( 8.f, std::floor( gridSize[ i ] ) ); /* ydnar: increase gridSize until grid count is smaller than max allowed */ @@ -1729,7 +1729,7 @@ static void SetupGrid(){ for( int j = 0; ; ) { /* get world bounds */ - for ( int i = 0; i < 3; i++ ) + for ( int i = 0; i < 3; ++i ) { gridMins[ i ] = gridSize[ i ] * ceil( bspModels[ 0 ].minmax.mins[ i ] / gridSize[ i ] ); const float max = gridSize[ i ] * floor( bspModels[ 0 ].minmax.maxs[ i ] / gridSize[ i ] ); @@ -1857,7 +1857,7 @@ static void WriteBSPFileAfterLight( const char *bspFileName ){ out.shaderNum = EmitShader( String64( lmPathStart, "nomipmaps", su ), nullptr, nullptr ); out.fogNum = -1; - for ( int i = 0; i < MAX_LIGHTMAPS; i++ ) + for ( int i = 0; i < MAX_LIGHTMAPS; ++i ) { out.lightmapNum[ i ] = -3; out.lightmapStyles[ i ] = LS_NONE; diff --git a/tools/quake3/q3map2/light_bounce.cpp b/tools/quake3/q3map2/light_bounce.cpp index 92ae690f..29df2953 100644 --- a/tools/quake3/q3map2/light_bounce.cpp +++ b/tools/quake3/q3map2/light_bounce.cpp @@ -59,7 +59,7 @@ static void RadClipWindingEpsilon( radWinding_t *in, const Vector3& normal, floa counts[ 0 ] = counts[ 1 ] = counts[ 2 ] = 0; /* determine sides for each point */ - for ( i = 0; i < in->numVerts; i++ ) + for ( i = 0; i < in->numVerts; ++i ) { dists[ i ] = vector3_dot( in->verts[ i ].xyz, normal ) - dist; if ( dists[ i ] > epsilon ) { @@ -93,7 +93,7 @@ static void RadClipWindingEpsilon( radWinding_t *in, const Vector3& normal, floa maxPoints = in->numVerts + 4; /* do individual verts */ - for ( i = 0; i < in->numVerts; i++ ) + for ( i = 0; i < in->numVerts; ++i ) { /* do simple vertex copies first */ const radVert_t& v1 = in->verts[ i ]; @@ -124,7 +124,7 @@ static void RadClipWindingEpsilon( radWinding_t *in, const Vector3& normal, floa /* average vertex values */ radVert_t mid; /* color */ - for ( k = 0; k < MAX_LIGHTMAPS; k++ ){ + for ( k = 0; k < MAX_LIGHTMAPS; ++k ){ mid.color[ k ] = v1.color[ k ] + ( v2.color[ k ] - v1.color[ k ] ) * dot; } /* xyz, normal */ @@ -132,7 +132,7 @@ static void RadClipWindingEpsilon( radWinding_t *in, const Vector3& normal, floa mid.normal = v1.normal + ( v2.normal - v1.normal ) * dot; /* st, lightmap */ mid.st = v1.st + ( v2.st - v1.st ) * dot; - for ( k = 0; k < MAX_LIGHTMAPS; k++ ) + for ( k = 0; k < MAX_LIGHTMAPS; ++k ) mid.lightmap[ k ] = v1.lightmap[ k ] + ( v2.lightmap[ k ] - v1.lightmap[ k ] ) * dot; /* normalize the averaged normal */ @@ -232,7 +232,7 @@ static void RadSample( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm, /* sample vertex colors if no lightmap or this is the initial pass */ if ( lm == NULL || lm->radLuxels[ lightmapNum ] == NULL || !bouncing ) { - for ( samples = 0; samples < rw->numVerts; samples++ ) + for ( samples = 0; samples < rw->numVerts; ++samples ) { /* multiply by texture color */ if ( !RadSampleImage( si->lightImage->pixels, si->lightImage->width, si->lightImage->height, rw->verts[ samples ].st, textureColor ) ) { @@ -258,7 +258,7 @@ static void RadSample( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm, else { /* fracture the winding into a fan (including degenerate tris) */ - for ( v = 1; v < ( rw->numVerts - 1 ) && samples < MAX_SAMPLES; v++ ) + for ( v = 1; v < ( rw->numVerts - 1 ) && samples < MAX_SAMPLES; ++v ) { /* get a triangle */ rv[ 0 ] = &rw->verts[ 0 ]; @@ -266,11 +266,11 @@ static void RadSample( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm, rv[ 2 ] = &rw->verts[ v + 1 ]; /* this code is embarrassing (really should just rasterize the triangle) */ - for ( i = 1; i < SAMPLE_GRANULARITY && samples < MAX_SAMPLES; i++ ) + for ( i = 1; i < SAMPLE_GRANULARITY && samples < MAX_SAMPLES; ++i ) { - for ( j = 1; j < SAMPLE_GRANULARITY && samples < MAX_SAMPLES; j++ ) + for ( j = 1; j < SAMPLE_GRANULARITY && samples < MAX_SAMPLES; ++j ) { - for ( k = 1; k < SAMPLE_GRANULARITY && samples < MAX_SAMPLES; k++ ) + for ( k = 1; k < SAMPLE_GRANULARITY && samples < MAX_SAMPLES; ++k ) { /* create a blend vector (barycentric coordinates) */ DoubleVector3 blend( i, j, k ); @@ -280,7 +280,7 @@ static void RadSample( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm, Vector2 st( 0, 0 ); Vector2 lightmap( 0, 0 ); alphaI = 0.0f; - for ( l = 0; l < 3; l++ ) + for ( l = 0; l < 3; ++l ) { st += rv[ l ]->st * blend[ l ]; lightmap += rv[ l ]->lightmap[ 0 ] * blend[ l ]; @@ -376,7 +376,7 @@ static void RadSubdivideDiffuseLight( int lightmapNum, bspDrawSurface_t *ds, raw minmax.extend( vert.xyz ); /* subdivide if necessary */ - for ( i = 0; i < 3; i++ ) + for ( i = 0; i < 3; ++i ) { if ( minmax.maxs[ i ] - minmax.mins[ i ] > subdivide ) { auto front = std::make_unique(); @@ -397,7 +397,7 @@ static void RadSubdivideDiffuseLight( int lightmapNum, bspDrawSurface_t *ds, raw /* check area */ area = 0.0f; - for ( i = 2; i < rw->numVerts; i++ ) + for ( i = 2; i < rw->numVerts; ++i ) { area += 0.5f * vector3_length( vector3_cross( rw->verts[ i - 1 ].xyz - rw->verts[ 0 ].xyz, rw->verts[ i ].xyz - rw->verts[ 0 ].xyz ) ); } @@ -542,7 +542,7 @@ static void RadSubdivideDiffuseLight( int lightmapNum, bspDrawSurface_t *ds, raw /* create a regular winding */ splash.w = AllocWinding( rw->numVerts ); - for ( i = 0; i < rw->numVerts; i++ ) + for ( i = 0; i < rw->numVerts; ++i ) splash.w.push_back( rw->verts[rw->numVerts - 1 - i].xyz + normal * si->backsplashDistance ); splash.origin = normal * si->backsplashDistance + light.origin; @@ -606,7 +606,7 @@ void RadLightForTriangles( int num, int lightmapNum, rawLightmap_t *lm, const sh for ( i = 0; i < ds->numIndexes; i += 3 ) { /* copy each vert */ - for ( j = 0; j < 3; j++ ) + for ( j = 0; j < 3; ++j ) { /* get vertex index and rad vertex luxel */ v = ds->firstVert + bspDrawIndexes[ ds->firstIndex + i + j ]; @@ -615,7 +615,7 @@ void RadLightForTriangles( int num, int lightmapNum, rawLightmap_t *lm, const sh memcpy( &rw.verts[ j ], &yDrawVerts[ v ], sizeof( bspDrawVert_t ) ); /* fix colors */ - for ( k = 0; k < MAX_LIGHTMAPS; k++ ) + for ( k = 0; k < MAX_LIGHTMAPS; ++k ) { rw.verts[ j ].color[ k ].rgb() = getRadVertexLuxel( k, ds->firstVert + bspDrawIndexes[ ds->firstIndex + i + j ] ); rw.verts[ j ].color[ k ].alpha() = yDrawVerts[ v ].color[ k ].alpha(); @@ -644,7 +644,7 @@ void RadLightForPatch( int num, int lightmapNum, rawLightmap_t *lm, const shader /* construct a bogus vert list with color index stuffed into color[ 0 ] */ bspDrawVert_t *bogus = safe_malloc( ds.numVerts * sizeof( bspDrawVert_t ) ); memcpy( bogus, &yDrawVerts[ ds.firstVert ], ds.numVerts * sizeof( bspDrawVert_t ) ); - for ( int i = 0; i < ds.numVerts; i++ ) + for ( int i = 0; i < ds.numVerts; ++i ) bogus[ i ].color[ 0 ][ 0 ] = i; /* build a subdivided mesh identical to shadow facets for this patch */ @@ -672,9 +672,9 @@ void RadLightForPatch( int num, int lightmapNum, rawLightmap_t *lm, const shader } /* iterate through the mesh quads */ - for ( int y = 0; y < ( mesh->height - 1 ); y++ ) + for ( int y = 0; y < ( mesh->height - 1 ); ++y ) { - for ( int x = 0; x < ( mesh->width - 1 ); x++ ) + for ( int x = 0; x < ( mesh->width - 1 ); ++x ) { /* set indexes */ const int pw[ 5 ] = { @@ -707,13 +707,13 @@ void RadLightForPatch( int num, int lightmapNum, rawLightmap_t *lm, const shader if ( planar ) { radWinding_t rw; rw.numVerts = 4; - for ( int v = 0; v < 4; v++ ) + for ( int v = 0; v < 4; ++v ) { /* get most everything */ memcpy( &rw.verts[ v ], dv[ v ], sizeof( bspDrawVert_t ) ); /* fix colors */ - for ( int i = 0; i < MAX_LIGHTMAPS; i++ ) + for ( int i = 0; i < MAX_LIGHTMAPS; ++i ) { rw.verts[ v ].color[ i ].rgb() = getRadVertexLuxel( i, ds.firstVert + dv[ v ]->color[ 0 ][ 0 ] ); rw.verts[ v ].color[ i ].alpha() = dv[ v ]->color[ i ].alpha(); @@ -729,9 +729,9 @@ void RadLightForPatch( int num, int lightmapNum, rawLightmap_t *lm, const shader { radWinding_t rw; rw.numVerts = 3; - for ( int t = 0; t < 2; t++ ) + for ( int t = 0; t < 2; ++t ) { - for ( int v = 0; v < 3 + t; v++ ) + for ( int v = 0; v < 3 + t; ++v ) { /* get "other" triangle (stupid hacky logic, but whatevah) */ if ( v == 1 && t == 1 ) { @@ -742,7 +742,7 @@ void RadLightForPatch( int num, int lightmapNum, rawLightmap_t *lm, const shader memcpy( &rw.verts[ v ], dv[ v ], sizeof( bspDrawVert_t ) ); /* fix colors */ - for ( int i = 0; i < MAX_LIGHTMAPS; i++ ) + for ( int i = 0; i < MAX_LIGHTMAPS; ++i ) { rw.verts[ v ].color[ i ].rgb() = getRadVertexLuxel( i, ds.firstVert + dv[ v ]->color[ 0 ][ 0 ] ); rw.verts[ v ].color[ i ].alpha() = dv[ v ]->color[ i ].alpha(); @@ -812,7 +812,7 @@ static void RadLight( int num ){ numDiffuseSurfaces++; /* iterate through styles (this could be more efficient, yes) */ - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { /* switch on type */ if ( ds->lightmapStyles[ lightmapNum ] != LS_NONE && ds->lightmapStyles[ lightmapNum ] != LS_UNUSED ) { diff --git a/tools/quake3/q3map2/light_trace.cpp b/tools/quake3/q3map2/light_trace.cpp index fe1e3699..d66bbccd 100644 --- a/tools/quake3/q3map2/light_trace.cpp +++ b/tools/quake3/q3map2/light_trace.cpp @@ -123,7 +123,7 @@ static int AddTraceInfo( traceInfo_t *ti ){ int num; /* find an existing info */ - for ( num = firstTraceInfo; num < numTraceInfos; num++ ) + for ( num = firstTraceInfo; num < numTraceInfos; ++num ) { if ( traceInfos[ num ].si == ti->si && traceInfos[ num ].surfaceNum == ti->surfaceNum && @@ -368,7 +368,7 @@ void ClipTraceWinding( traceWinding_t *tw, const Plane3f& plane, traceWinding_t back->numVerts = 0; /* classify points */ - for ( i = 0; i < tw->numVerts; i++ ) + for ( i = 0; i < tw->numVerts; ++i ) { dists[ i ] = plane3_distance_to_point( plane, tw->v[ i ].xyz ); if ( dists[ i ] < -TW_ON_EPSILON ) { @@ -403,7 +403,7 @@ void ClipTraceWinding( traceWinding_t *tw, const Plane3f& plane, traceWinding_t back->numVerts = 0; /* split the winding */ - for ( i = 0; i < tw->numVerts; i++ ) + for ( i = 0; i < tw->numVerts; ++i ) { /* radix */ j = ( i + 1 ) % tw->numVerts; @@ -452,7 +452,7 @@ void ClipTraceWinding( traceWinding_t *tw, const Plane3f& plane, traceWinding_t /* generate a split point */ frac = dists[ i ] / ( dists[ i ] - dists[ j ] ); - for ( k = 0; k < 3; k++ ) + for ( k = 0; k < 3; ++k ) { /* minimize fp precision errors */ if ( plane.normal()[ k ] == 1.0f ) { @@ -596,13 +596,13 @@ static void SubdivideTraceNode_r( int nodeNum, int depth ){ node->minmax.clear(); DoubleVector3 average( 0 ); count = 0; - for ( i = 0; i < node->numItems; i++ ) + for ( i = 0; i < node->numItems; ++i ) { /* get winding */ tw = &traceWindings[ node->items[ i ] ]; /* walk its verts */ - for ( j = 0; j < tw->numVerts; j++ ) + for ( j = 0; j < tw->numVerts; ++j ) { node->minmax.extend( tw->v[ j ].xyz ); average += tw->v[ j ].xyz; @@ -673,7 +673,7 @@ static void SubdivideTraceNode_r( int nodeNum, int depth ){ backNode->items = safe_malloc( backNode->maxItems * sizeof( *backNode->items ) ); /* filter windings into child nodes */ - for ( i = 0; i < node->numItems; i++ ) + for ( i = 0; i < node->numItems; ++i ) { /* get winding */ tw = &traceWindings[ node->items[ i ] ]; @@ -772,7 +772,7 @@ static int TriangulateTraceNode_r( int nodeNum ){ node->items = safe_malloc( node->maxItems * sizeof( tt ) ); /* walk winding list */ - for ( i = 0; i < numWindings; i++ ) + for ( i = 0; i < numWindings; ++i ) { /* get winding */ tw = &traceWindings[ windings[ i ] ]; @@ -782,7 +782,7 @@ static int TriangulateTraceNode_r( int nodeNum ){ tt.v[ 0 ] = tw->v[ 0 ]; /* walk vertex list */ - for ( j = 1; j + 1 < tw->numVerts; j++ ) + for ( j = 1; j + 1 < tw->numVerts; ++j ) { /* set verts */ tt.v[ 1 ] = tw->v[ j ]; @@ -825,7 +825,7 @@ static void PopulateWithBSPModel( const bspModel_t& model, const Matrix4& transf /* walk the list of surfaces in this model and fill out the info structs */ - for ( int i = 0; i < model.numBSPSurfaces; i++ ) + for ( int i = 0; i < model.numBSPSurfaces; ++i ) { /* get surface and info */ const bspDrawSurface_t& ds = bspDrawSurfaces[ model.firstBSPSurface + i ]; @@ -907,9 +907,9 @@ static void PopulateWithBSPModel( const bspModel_t& model, const Matrix4& transf const bspDrawVert_t *verts = mesh->verts; /* subdivide each quad to place the models */ - for ( int y = 0; y < ( mesh->height - 1 ); y++ ) + for ( int y = 0; y < ( mesh->height - 1 ); ++y ) { - for ( int x = 0; x < ( mesh->width - 1 ); x++ ) + for ( int x = 0; x < ( mesh->width - 1 ); ++x ) { /* set indexes */ const int pw[ 5 ] = { @@ -1219,10 +1219,10 @@ void SetupTraceNodes(){ file = SafeOpenWrite( filename, "wt" ); /* walk node list */ - for ( i = 0; i < numTraceWindings; i++ ) + for ( i = 0; i < numTraceWindings; ++i ) { tw = &traceWindings[ i ]; - for ( j = 0; j < tw->numVerts + 1; j++ ) + for ( j = 0; j < tw->numVerts + 1; ++j ) fprintf( file, "%f %f %f\n", tw->v[ j % tw->numVerts ].xyz[ 0 ], tw->v[ j % tw->numVerts ].xyz[ 1 ], tw->v[ j % tw->numVerts ].xyz[ 2 ] ); } @@ -1338,7 +1338,7 @@ static bool TraceTriangle( traceInfo_t *ti, traceTriangle_t *tt, trace_t *trace /* if hitpoint is really close to trace origin (sample point), then check for self-shadowing */ if ( depth <= SELF_SHADOW_EPSILON ) { /* don't self-shadow */ - for ( i = 0; i < trace->numSurfaces; i++ ) + for ( i = 0; i < trace->numSurfaces; ++i ) { if ( ti->surfaceNum == trace->surfaces[ i ] ) { return false; @@ -1428,7 +1428,7 @@ static bool TraceWinding( traceWinding_t *tw, trace_t *trace ){ tt.v[ 0 ] = tw->v[ 0 ]; /* walk vertex list */ - for ( i = 1; i + 1 < tw->numVerts; i++ ) + for ( i = 1; i + 1 < tw->numVerts; ++i ) { /* set verts */ tt.v[ 1 ] = tw->v[ i ]; @@ -1625,13 +1625,13 @@ void TraceLine( trace_t *trace ){ } /* walk node list */ - for ( i = 0; i < trace->numTestNodes; i++ ) + for ( i = 0; i < trace->numTestNodes; ++i ) { /* get node */ node = &traceNodes[ trace->testNodes[ i ] ]; /* walk node item list */ - for ( j = 0; j < node->numItems; j++ ) + for ( j = 0; j < node->numItems; ++j ) { tt = &traceTriangles[ node->items[ j ] ]; ti = &traceInfos[ tt->infoNum ]; diff --git a/tools/quake3/q3map2/light_ydnar.cpp b/tools/quake3/q3map2/light_ydnar.cpp index 647f09d4..66549d58 100644 --- a/tools/quake3/q3map2/light_ydnar.cpp +++ b/tools/quake3/q3map2/light_ydnar.cpp @@ -74,7 +74,7 @@ Vector3b ColorToBytes( const Vector3& color, float scale ){ /* muck with it */ gamma = 1.0f / lightmapGamma; - for ( i = 0; i < 3; i++ ) + for ( i = 0; i < 3; ++i ) { /* handle negative light */ if ( sample[ i ] < 0.0f ) { @@ -119,7 +119,7 @@ Vector3b ColorToBytes( const Vector3& color, float scale ){ /* contrast */ if ( lightmapContrast != 1.0f ){ - for ( i = 0; i < 3; i++ ){ + for ( i = 0; i < 3; ++i ){ sample[i] = std::max( 0.f, lightmapContrast * ( sample[i] - 128 ) + 128 ); } /* clamp with color normalization */ @@ -193,7 +193,7 @@ void SmoothNormals(){ value_maximize( maxShadeAngle, shadeAngle ); /* flag its verts */ - for ( int j = 0; j < ds.numVerts; j++ ) + for ( int j = 0; j < ds.numVerts; ++j ) { const int f = ds.firstVert + j; shadeAngles[ f ] = shadeAngle; @@ -213,7 +213,7 @@ void SmoothNormals(){ Timer timer; /* go through the list of vertexes */ - for ( int i = 0; i < numBSPDrawVerts; i++ ) + for ( int i = 0; i < numBSPDrawVerts; ++i ) { /* print pacifier */ if ( const int f = 10 * i / numBSPDrawVerts; f != fOld ) { @@ -232,7 +232,7 @@ void SmoothNormals(){ int numVotes = 0; /* build a table of coincident vertexes */ - for ( int j = i; j < numBSPDrawVerts && numVerts < MAX_SAMPLES; j++ ) + for ( int j = i; j < numBSPDrawVerts && numVerts < MAX_SAMPLES; ++j ) { /* already smoothed? */ if ( smoothed[ j ] ) { @@ -263,7 +263,7 @@ void SmoothNormals(){ /* see if this normal has already been voted */ int k; - for ( k = 0; k < numVotes; k++ ) + for ( k = 0; k < numVotes; ++k ) { if ( vector3_equal_epsilon( bspDrawVerts[ j ].normal, votes[ k ], EQUAL_NORMAL_EPSILON ) ) { break; @@ -286,7 +286,7 @@ void SmoothNormals(){ /* average normal */ if ( VectorNormalize( average ) != 0 ) { /* smooth */ - for ( int j = 0; j < numVerts; j++ ) + for ( int j = 0; j < numVerts; ++j ) yDrawVerts[ indexes[ j ] ].normal = average; } } @@ -441,7 +441,7 @@ int ClusterForPointExt( const Vector3& point, float epsilon ){ /* transparent leaf, so check point against all brushes in the leaf */ const int *brushes = &bspLeafBrushes[ leaf.firstBSPLeafBrush ]; const int numBSPBrushes = leaf.numBSPLeafBrushes; - for ( int i = 0; i < numBSPBrushes; i++ ) + for ( int i = 0; i < numBSPBrushes; ++i ) { /* get parts */ const int b = brushes[ i ]; @@ -455,7 +455,7 @@ int ClusterForPointExt( const Vector3& point, float epsilon ){ const bspBrush_t& brush = bspBrushes[ b ]; /* check point against all planes */ bool inside = true; - for ( int j = 0; j < brush.numSides && inside; j++ ) + for ( int j = 0; j < brush.numSides && inside; ++j ) { const bspPlane_t& plane = bspPlanes[ bspBrushSides[ brush.firstSide + j ].planeNum ]; if ( plane3_distance_to_point( plane, point ) > epsilon ) { @@ -493,7 +493,7 @@ static int ClusterForPointExtFilter( const Vector3& point, float epsilon, int nu } /* filter */ - for ( i = 0; i < numClusters; i++ ) + for ( i = 0; i < numClusters; ++i ) { if ( cluster == clusters[ i ] || ClusterVisible( cluster, clusters[ i ] ) ) { return cluster; @@ -529,7 +529,7 @@ static int ShaderForPointInLeaf( const Vector3& point, int leafNum, float epsilo /* transparent leaf, so check point against all brushes in the leaf */ const int *brushes = &bspLeafBrushes[ leaf.firstBSPLeafBrush ]; const int numBSPBrushes = leaf.numBSPLeafBrushes; - for ( int i = 0; i < numBSPBrushes; i++ ) + for ( int i = 0; i < numBSPBrushes; ++i ) { /* get parts */ const bspBrush_t& brush = bspBrushes[ brushes[ i ] ]; @@ -538,7 +538,7 @@ static int ShaderForPointInLeaf( const Vector3& point, int leafNum, float epsilo bool inside = true; allSurfaceFlags = 0; allContentFlags = 0; - for ( int j = 0; j < brush.numSides && inside; j++ ) + for ( int j = 0; j < brush.numSides && inside; ++j ) { const bspBrushSide_t& side = bspBrushSides[ brush.firstSide + j ]; const bspPlane_t& plane = bspPlanes[ side.planeNum ]; @@ -756,7 +756,7 @@ static int MapSingleLuxel( rawLightmap_t *lm, const surfaceInfo_t *info, const b if ( lm->vecs != NULL ) { /* calculate an origin for the sample from the lightmap vectors */ origin = lm->origin; - for ( i = 0; i < 3; i++ ) + for ( i = 0; i < 3; ++i ) { /* add unless it's the axis, which is taken care of later */ if ( i == lm->axisNum ) { @@ -783,9 +783,9 @@ static int MapSingleLuxel( rawLightmap_t *lm, const surfaceInfo_t *info, const b Plane3f hostplane; PlaneFromPoints( hostplane, worldverts[0], worldverts[1], worldverts[2] ); - for ( j = 0; j < 3; j++ ) + for ( j = 0; j < 3; ++j ) { - for ( i = 0; i < 3; i++ ) + for ( i = 0; i < 3; ++i ) { Plane3f sideplane; //build plane using 2 edges and a normal @@ -941,7 +941,7 @@ static void MapTriangle_r( rawLightmap_t *lm, const surfaceInfo_t *info, const T { /* find the longest edge and split it */ float maxDist = 0; - for ( int i = 0; i < 3; i++ ) + for ( int i = 0; i < 3; ++i ) { /* get dist */ const float dist = vector2_length_squared( tri[ i ]->lightmap[ 0 ] - tri[ ( i + 1 ) % 3 ]->lightmap[ 0 ] ); @@ -1027,7 +1027,7 @@ static bool MapTriangle( rawLightmap_t *lm, const surfaceInfo_t *info, const Tri return true; } - for ( int i = 0; i < 3; i++ ) + for ( int i = 0; i < 3; ++i ) { /* get verts */ const Vector2& a = tri[ i ]->lightmap[ 0 ]; @@ -1059,7 +1059,7 @@ static void MapQuad_r( rawLightmap_t *lm, const surfaceInfo_t *info, const QuadR { /* find the longest edge and split it */ float maxDist = 0; - for ( int i = 0; i < 4; i++ ) + for ( int i = 0; i < 4; ++i ) { /* get dist */ const float dist = vector2_length_squared( quad[ i ]->lightmap[ 0 ] - quad[ ( i + 1 ) % 4 ]->lightmap[ 0 ] ); @@ -1184,13 +1184,13 @@ void MapRawLightmap( int rawLightmapNum ){ ----------------------------------------------------------------- */ /* walk the list of surfaces on this raw lightmap */ - for ( n = 0; n < lm->numLightSurfaces; n++ ) + for ( n = 0; n < lm->numLightSurfaces; ++n ) { /* with > 1 surface per raw lightmap, clear occluded */ if ( n > 0 ) { - for ( y = 0; y < lm->sh; y++ ) + for ( y = 0; y < lm->sh; ++y ) { - for ( x = 0; x < lm->sw; x++ ) + for ( x = 0; x < lm->sw; ++x ) { /* get cluster */ int& cluster = lm->getSuperCluster( x, y ); @@ -1221,7 +1221,7 @@ void MapRawLightmap( int rawLightmapNum ){ const bspDrawVert_t *verts = &yDrawVerts[ ds.firstVert ]; /* map the triangles */ - for ( mapNonAxial = 0; mapNonAxial < 2; mapNonAxial++ ) + for ( mapNonAxial = 0; mapNonAxial < 2; ++mapNonAxial ) for ( i = 0; i < ds.numIndexes; i += 3 ) MapTriangle( lm, info, TriRef{ &verts[ bspDrawIndexes[ ds.firstIndex + i ] ], @@ -1260,11 +1260,11 @@ void MapRawLightmap( int rawLightmapNum ){ /* map the mesh quads */ #if 0 - for ( mapNonAxial = 0; mapNonAxial < 2; mapNonAxial++ ) + for ( mapNonAxial = 0; mapNonAxial < 2; ++mapNonAxial ) { - for ( y = 0; y < ( mesh->height - 1 ); y++ ) + for ( y = 0; y < ( mesh->height - 1 ); ++y ) { - for ( x = 0; x < ( mesh->width - 1 ); x++ ) + for ( x = 0; x < ( mesh->width - 1 ); ++x ) { /* set indexes */ const int pw[ 5 ] = { @@ -1294,9 +1294,9 @@ void MapRawLightmap( int rawLightmapNum ){ #else - for ( y = 0; y < ( mesh->height - 1 ); y++ ) + for ( y = 0; y < ( mesh->height - 1 ); ++y ) { - for ( x = 0; x < ( mesh->width - 1 ); x++ ) + for ( x = 0; x < ( mesh->width - 1 ); ++x ) { /* set indexes */ const int pw[ 5 ] = { @@ -1318,7 +1318,7 @@ void MapRawLightmap( int rawLightmapNum ){ continue; } - for ( mapNonAxial = 0; mapNonAxial < 2; mapNonAxial++ ) + for ( mapNonAxial = 0; mapNonAxial < 2; ++mapNonAxial ) { /* get drawverts and map first triangle */ MapTriangle( lm, info, TriRef{ @@ -1351,9 +1351,9 @@ void MapRawLightmap( int rawLightmapNum ){ ----------------------------------------------------------------- */ /* walk the luxels */ - for ( y = 0; y < lm->sh; y++ ) + for ( y = 0; y < lm->sh; ++y ) { - for ( x = 0; x < lm->sw; x++ ) + for ( x = 0; x < lm->sw; ++x ) { /* get luxel */ SuperLuxel& luxel = lm->getSuperLuxel( 0, x, y ); @@ -1386,9 +1386,9 @@ void MapRawLightmap( int rawLightmapNum ){ radius = std::max( 1, superSample / 2 ) + 1; for ( pass = 2.0f; pass <= radius; pass += 1.0f ) { - for ( y = 0; y < lm->sh; y++ ) + for ( y = 0; y < lm->sh; ++y ) { - for ( x = 0; x < lm->sw; x++ ) + for ( x = 0; x < lm->sw; ++x ) { /* only look at unmapped luxels */ if ( lm->getSuperCluster( x, y ) != CLUSTER_UNMAPPED ) { @@ -1400,13 +1400,13 @@ void MapRawLightmap( int rawLightmapNum ){ fake.normal.set( 0 ); fake.lightmap[ 0 ] = Vector2( x, y ); //% 0.0001 + x; //% 0.0001 + y; samples = 0.0f; - for ( sy = ( y - 1 ); sy <= ( y + 1 ); sy++ ) + for ( sy = ( y - 1 ); sy <= ( y + 1 ); ++sy ) { if ( sy < 0 || sy >= lm->sh ) { continue; } - for ( sx = ( x - 1 ); sx <= ( x + 1 ); sx++ ) + for ( sx = ( x - 1 ); sx <= ( x + 1 ); ++sx ) { if ( sx < 0 || sx >= lm->sw || ( sx == x && sy == y ) ) { continue; @@ -1450,9 +1450,9 @@ void MapRawLightmap( int rawLightmapNum ){ ----------------------------------------------------------------- */ /* walk the luxels */ - for ( y = 0; y < lm->sh; y++ ) + for ( y = 0; y < lm->sh; ++y ) { - for ( x = 0; x < lm->sw; x++ ) + for ( x = 0; x < lm->sw; ++x ) { /* get luxel */ SuperLuxel& luxel = lm->getSuperLuxel( 0, x, y ); @@ -1475,9 +1475,9 @@ void MapRawLightmap( int rawLightmapNum ){ /* debug code */ #if 0 Sys_Printf( "\n" ); - for ( y = 0; y < lm->sh; y++ ) + for ( y = 0; y < lm->sh; ++y ) { - for ( x = 0; x < lm->sw; x++ ) + for ( x = 0; x < lm->sw; ++x ) { const int cluster = lm->getSuperCluster( x, y ); const Vector3& origin = lm->getSuperOrigin( x, y ); @@ -1489,7 +1489,7 @@ void MapRawLightmap( int rawLightmapNum ){ /* check if within the bounding boxes of all surfaces referenced */ MinMax minmax; - for ( n = 0; n < lm->numLightSurfaces; n++ ) + for ( n = 0; n < lm->numLightSurfaces; ++n ) { info = &surfaceInfos[ lightSurfaces[ lm->firstLightSurface + n ] ]; minmax.extend( info->minmax ); @@ -1544,10 +1544,10 @@ void SetupDirt(){ /* iterate angle */ angle = 0.0f; - for ( i = 0, angle = 0.0f; i < DIRT_NUM_ANGLE_STEPS; i++, angle += angleStep ) + for ( i = 0, angle = 0.0f; i < DIRT_NUM_ANGLE_STEPS; ++i, angle += angleStep ) { /* iterate elevation */ - for ( j = 0, elevation = elevationStep * 0.5f; j < DIRT_NUM_ELEVATION_STEPS; j++, elevation += elevationStep ) + for ( j = 0, elevation = elevationStep * 0.5f; j < DIRT_NUM_ELEVATION_STEPS; ++j, elevation += elevationStep ) { dirtVectors[ numDirtVectors ][ 0 ] = sin( elevation ) * cos( angle ); dirtVectors[ numDirtVectors ][ 1 ] = sin( elevation ) * sin( angle ); @@ -1605,7 +1605,7 @@ static float DirtForSample( trace_t *trace ){ /* 1 = random mode, 0 (well everything else) = non-random mode */ if ( dirtMode == 1 ) { /* iterate */ - for ( i = 0; i < numDirtVectors; i++ ) + for ( i = 0; i < numDirtVectors; ++i ) { /* get random vector */ angle = Random() * degrees_to_radians( 360.0f ); @@ -1632,7 +1632,7 @@ static float DirtForSample( trace_t *trace ){ else { /* iterate through ordered vectors */ - for ( i = 0; i < numDirtVectors; i++ ) + for ( i = 0; i < numDirtVectors; ++i ) { /* transform vector into tangent space */ const Vector3 direction = myRt * dirtVectors[ i ][ 0 ] + myUp * dirtVectors[ i ][ 1 ] + normal * dirtVectors[ i ][ 2 ]; @@ -1712,7 +1712,7 @@ void DirtyRawLightmap( int rawLightmapNum ){ /* twosided lighting (may or may not be a good idea for lightmapped stuff) */ trace.twoSided = false; - for ( i = 0; i < trace.numSurfaces; i++ ) + for ( i = 0; i < trace.numSurfaces; ++i ) { /* get surface */ info = &surfaceInfos[ trace.surfaces[ i ] ]; @@ -1725,7 +1725,7 @@ void DirtyRawLightmap( int rawLightmapNum ){ } noDirty = false; - for ( i = 0; i < trace.numSurfaces; i++ ) + for ( i = 0; i < trace.numSurfaces; ++i ) { /* get surface */ info = &surfaceInfos[ trace.surfaces[ i ] ]; @@ -1738,9 +1738,9 @@ void DirtyRawLightmap( int rawLightmapNum ){ } /* gather dirt */ - for ( y = 0; y < lm->sh; y++ ) + for ( y = 0; y < lm->sh; ++y ) { - for ( x = 0; x < lm->sw; x++ ) + for ( x = 0; x < lm->sw; ++x ) { /* get luxel */ const int cluster = lm->getSuperCluster( x, y ); @@ -1774,9 +1774,9 @@ void DirtyRawLightmap( int rawLightmapNum ){ //% return; /* filter dirt */ - for ( y = 0; y < lm->sh; y++ ) + for ( y = 0; y < lm->sh; ++y ) { - for ( x = 0; x < lm->sw; x++ ) + for ( x = 0; x < lm->sw; ++x ) { /* get luxel */ float& dirt = lm->getSuperDirt( x, y ); @@ -1784,13 +1784,13 @@ void DirtyRawLightmap( int rawLightmapNum ){ /* filter dirt by adjacency to unmapped luxels */ average = dirt; samples = 1.0f; - for ( sy = ( y - 1 ); sy <= ( y + 1 ); sy++ ) + for ( sy = ( y - 1 ); sy <= ( y + 1 ); ++sy ) { if ( sy < 0 || sy >= lm->sh ) { continue; } - for ( sx = ( x - 1 ); sx <= ( x + 1 ); sx++ ) + for ( sx = ( x - 1 ); sx <= ( x + 1 ); ++sx ) { if ( sx < 0 || sx >= lm->sw || ( sx == x && sy == y ) ) { continue; @@ -1925,7 +1925,7 @@ static void SubsampleRawLuxel_r( rawLightmap_t *lm, trace_t *trace, const Vector lighted = 0; /* make 2x2 subsample stamp */ - for ( b = 0; b < 4; b++ ) + for ( b = 0; b < 4; ++b ) { /* set origin */ origin[ b ] = sampleOrigin; @@ -1970,7 +1970,7 @@ static void SubsampleRawLuxel_r( rawLightmap_t *lm, trace_t *trace, const Vector if ( ( lightLuxel.count + 1.0f ) < lightSamples && ( total[ 0 ] > 4.0f || total[ 1 ] > 4.0f || total[ 2 ] > 4.0f ) && lighted != 0 && lighted != mapped ) { - for ( b = 0; b < 4; b++ ) + for ( b = 0; b < 4; ++b ) { if ( cluster[ b ] < 0 ) { continue; @@ -1987,7 +1987,7 @@ static void SubsampleRawLuxel_r( rawLightmap_t *lm, trace_t *trace, const Vector direction = *lightDeluxel; } samples = 1; - for ( b = 0; b < 4; b++ ) + for ( b = 0; b < 4; ++b ) { if ( cluster[ b ] < 0 ) { continue; @@ -2126,7 +2126,7 @@ static void CreateTraceLightsForBounds( const MinMax& minmax, const Vector3 *nor /* check against pvs cluster */ if ( numClusters > 0 && clusters != NULL ) { - for ( i = 0; i < numClusters; i++ ) + for ( i = 0; i < numClusters; ++i ) { if ( ClusterVisible( light.cluster, clusters[ i ] ) ) { break; @@ -2198,7 +2198,7 @@ static void CreateTraceLightsForSurface( int num, trace_t *trace ){ /* get the mins/maxs for the dsurf */ MinMax minmax; Vector3 normal = bspDrawVerts[ ds.firstVert ].normal; - for ( int i = 0; i < ds.numVerts; i++ ) + for ( int i = 0; i < ds.numVerts; ++i ) { const bspDrawVert_t& dv = yDrawVerts[ ds.firstVert + i ]; minmax.extend( dv.xyz ); @@ -2254,7 +2254,7 @@ void IlluminateRawLightmap( int rawLightmapNum ){ /* twosided lighting (may or may not be a good idea for lightmapped stuff) */ trace.twoSided = false; - for ( i = 0; i < trace.numSurfaces; i++ ) + for ( i = 0; i < trace.numSurfaces; ++i ) { /* get surface */ info = &surfaceInfos[ trace.surfaces[ i ] ]; @@ -2279,9 +2279,9 @@ void IlluminateRawLightmap( int rawLightmapNum ){ /* test debugging state */ if ( debugSurfaces || debugAxis || debugCluster || debugOrigin || dirtDebug || normalmap ) { /* debug fill the luxels */ - for ( y = 0; y < lm->sh; y++ ) + for ( y = 0; y < lm->sh; ++y ) { - for ( x = 0; x < lm->sw; x++ ) + for ( x = 0; x < lm->sw; ++x ) { /* get cluster */ const int cluster = lm->getSuperCluster( x, y ); @@ -2354,9 +2354,9 @@ void IlluminateRawLightmap( int rawLightmapNum ){ //% memset( lm->superLuxels[ 0 ], 0, llSize ); /* set ambient color */ - for ( y = 0; y < lm->sh; y++ ) + for ( y = 0; y < lm->sh; ++y ) { - for ( x = 0; x < lm->sw; x++ ) + for ( x = 0; x < lm->sw; ++x ) { /* get cluster */ SuperLuxel& luxel = lm->getSuperLuxel( 0, x, y ); @@ -2382,7 +2382,7 @@ void IlluminateRawLightmap( int rawLightmapNum ){ /* clear styled lightmaps */ size = lm->sw * lm->sh * sizeof( *lm->superLuxels[0] ); - for ( lightmapNum = 1; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 1; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { if ( lm->superLuxels[ lightmapNum ] != NULL ) { memset( lm->superLuxels[ lightmapNum ], 0, size ); @@ -2394,13 +2394,13 @@ void IlluminateRawLightmap( int rawLightmapNum ){ //% Sys_Printf( "Lightmap %9d: 0 lights, axis: %.2f, %.2f, %.2f\n", rawLightmapNum, lm->axis[ 0 ], lm->axis[ 1 ], lm->axis[ 2 ] ); /* walk light list */ - for ( i = 0; i < trace.numLights; i++ ) + for ( i = 0; i < trace.numLights; ++i ) { /* setup trace */ trace.light = trace.lights[ i ]; /* style check */ - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { if ( lm->styles[ lightmapNum ] == trace.light->style || lm->styles[ lightmapNum ] == LS_NONE ) { @@ -2440,9 +2440,9 @@ void IlluminateRawLightmap( int rawLightmapNum ){ } /* initial pass, one sample per luxel */ - for ( y = 0; y < lm->sh; y++ ) + for ( y = 0; y < lm->sh; ++y ) { - for ( x = 0; x < lm->sw; x++ ) + for ( x = 0; x < lm->sw; ++x ) { /* get cluster */ const int cluster = lm->getSuperCluster( x, y ); @@ -2502,9 +2502,9 @@ void IlluminateRawLightmap( int rawLightmapNum ){ /* 2003-09-27: changed it so filtering disamples supersampling, as it would waste time */ if ( lightSamples > 1 || lightRandomSamples ) { /* walk luxels */ - for ( y = 0; y < ( lm->sh - 1 ); y++ ) + for ( y = 0; y < ( lm->sh - 1 ); ++y ) { - for ( x = 0; x < ( lm->sw - 1 ); x++ ) + for ( x = 0; x < ( lm->sw - 1 ); ++x ) { /* setup */ mapped = 0; @@ -2512,7 +2512,7 @@ void IlluminateRawLightmap( int rawLightmapNum ){ Vector3 total( 0 ); /* test 2x2 stamp */ - for ( t = 0; t < 4; t++ ) + for ( t = 0; t < 4; ++t ) { /* set sample coords */ sx = x + tests[ t ][ 0 ]; @@ -2545,7 +2545,7 @@ void IlluminateRawLightmap( int rawLightmapNum ){ /* if all 4 pixels are either in shadow or light, then don't subsample */ if ( lighted != 0 && lighted != mapped ) { - for ( t = 0; t < 4; t++ ) + for ( t = 0; t < 4; ++t ) { /* set sample coords */ sx = x + tests[ t ][ 0 ]; @@ -2588,9 +2588,9 @@ void IlluminateRawLightmap( int rawLightmapNum ){ /* tertiary pass, apply dirt map (ambient occlusion) */ if ( 0 && dirty ) { /* walk luxels */ - for ( y = 0; y < lm->sh; y++ ) + for ( y = 0; y < lm->sh; ++y ) { - for ( x = 0; x < lm->sw; x++ ) + for ( x = 0; x < lm->sw; ++x ) { /* get cluster */ if ( lm->getSuperCluster( x, y ) < 0 ) { @@ -2617,9 +2617,9 @@ void IlluminateRawLightmap( int rawLightmapNum ){ } /* copy to permanent luxels */ - for ( y = 0; y < lm->sh; y++ ) + for ( y = 0; y < lm->sh; ++y ) { - for ( x = 0; x < lm->sw; x++ ) + for ( x = 0; x < lm->sw; ++x ) { /* get cluster and origin */ if ( lm->getSuperCluster( x, y ) < 0 ) { @@ -2634,13 +2634,13 @@ void IlluminateRawLightmap( int rawLightmapNum ){ samples = 0.0f; /* cheaper distance-based filtering */ - for ( sy = ( y - luxelFilterRadius ); sy <= ( y + luxelFilterRadius ); sy++ ) + for ( sy = ( y - luxelFilterRadius ); sy <= ( y + luxelFilterRadius ); ++sy ) { if ( sy < 0 || sy >= lm->sh ) { continue; } - for ( sx = ( x - luxelFilterRadius ); sx <= ( x + luxelFilterRadius ); sx++ ) + for ( sx = ( x - luxelFilterRadius ); sx <= ( x + luxelFilterRadius ); ++sx ) { if ( sx < 0 || sx >= lm->sw ) { continue; @@ -2740,16 +2740,16 @@ void IlluminateRawLightmap( int rawLightmapNum ){ } if ( debugnormals ) { - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { /* early out */ if ( lm->superLuxels[ lightmapNum ] == NULL ) { continue; } - for ( y = 0; y < lm->sh; y++ ) + for ( y = 0; y < lm->sh; ++y ) { - for ( x = 0; x < lm->sw; x++ ) + for ( x = 0; x < lm->sw; ++x ) { /* get cluster */ //% if( lm->getSuperCluster( x, y ) < 0 ) @@ -2767,7 +2767,7 @@ void IlluminateRawLightmap( int rawLightmapNum ){ if ( dirty ) { /* walk lightmaps */ - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { /* early out */ if ( lm->superLuxels[ lightmapNum ] == NULL ) { @@ -2775,9 +2775,9 @@ void IlluminateRawLightmap( int rawLightmapNum ){ } /* apply dirt to each luxel */ - for ( y = 0; y < lm->sh; y++ ) + for ( y = 0; y < lm->sh; ++y ) { - for ( x = 0; x < lm->sw; x++ ) + for ( x = 0; x < lm->sw; ++x ) { /* get cluster */ //% if( lm->getSuperCluster( x, y ) < 0 ) // TODO why not do this check? These pixels should be zero anyway @@ -2804,7 +2804,7 @@ void IlluminateRawLightmap( int rawLightmapNum ){ ----------------------------------------------------------------- */ /* walk lightmaps */ - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { /* early out */ if ( lm->superLuxels[ lightmapNum ] == NULL ) { @@ -2812,9 +2812,9 @@ void IlluminateRawLightmap( int rawLightmapNum ){ } /* average occluded luxels from neighbors */ - for ( y = 0; y < lm->sh; y++ ) + for ( y = 0; y < lm->sh; ++y ) { - for ( x = 0; x < lm->sw; x++ ) + for ( x = 0; x < lm->sw; ++x ) { /* get particulars */ int& cluster = lm->getSuperCluster( x, y ); @@ -2844,13 +2844,13 @@ void IlluminateRawLightmap( int rawLightmapNum ){ samples = 0.0f; /* walk 3x3 matrix */ - for ( sy = ( y - 1 ); sy <= ( y + 1 ); sy++ ) + for ( sy = ( y - 1 ); sy <= ( y + 1 ); ++sy ) { if ( sy < 0 || sy >= lm->sh ) { continue; } - for ( sx = ( x - 1 ); sx <= ( x + 1 ); sx++ ) + for ( sx = ( x - 1 ); sx <= ( x + 1 ); ++sx ) { if ( sx < 0 || sx >= lm->sw || ( sx == x && sy == y ) ) { continue; @@ -2907,14 +2907,14 @@ void IlluminateRawLightmap( int rawLightmapNum ){ #if 0 // audit pass - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { /* early out */ if ( lm->superLuxels[ lightmapNum ] == NULL ) { continue; } - for ( y = 0; y < lm->sh; y++ ) - for ( x = 0; x < lm->sw; x++ ) + for ( y = 0; y < lm->sh; ++y ) + for ( x = 0; x < lm->sw; ++x ) { /* get cluster */ cluster = SUPER_CLUSTER( x, y ); @@ -2998,7 +2998,7 @@ void IlluminateVertexes( int num ){ memset( avgColors, 0, sizeof( avgColors ) ); /* walk the surface verts */ - for ( i = 0; i < ds->numVerts; i++ ) + for ( i = 0; i < ds->numVerts; ++i ) { /* get vertex luxel */ Vector3& radVertLuxel = getRadVertexLuxel( 0, ds->firstVert + i ); @@ -3061,7 +3061,7 @@ void IlluminateVertexes( int num ){ LightingAtSample( &trace, ds->vertexStyles, colors ); /* store */ - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { /* r7 dirt */ colors[ lightmapNum ] *= dirt; @@ -3081,16 +3081,16 @@ void IlluminateVertexes( int num ){ }; if ( !vector3_component_greater( getRadVertexLuxel( 0, ds->firstVert + i ), ambientColor ) ) { /* nudge the sample point around a bit */ - for ( x = 0; x < 5; x++ ) + for ( x = 0; x < 5; ++x ) { /* two's complement 0, 1, -1, 2, -2, etc */ x1 = ( ( x >> 1 ) ^ ( x & 1 ? -1 : 0 ) ) + ( x & 1 ); - for ( y = 0; y < 5; y++ ) + for ( y = 0; y < 5; ++y ) { y1 = ( ( y >> 1 ) ^ ( y & 1 ? -1 : 0 ) ) + ( y & 1 ); - for ( z = 0; z < 5; z++ ) + for ( z = 0; z < 5; ++z ) { z1 = ( ( z >> 1 ) ^ ( z & 1 ? -1 : 0 ) ) + ( z & 1 ); @@ -3123,7 +3123,7 @@ void IlluminateVertexes( int num ){ LightingAtSample( &trace, ds->vertexStyles, colors ); /* store */ - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { /* r7 dirt */ colors[ lightmapNum ] *= dirt; @@ -3147,7 +3147,7 @@ void IlluminateVertexes( int num ){ /* add to average? */ if ( vector3_component_greater( getRadVertexLuxel( 0, ds->firstVert + i ), ambientColor ) ) { numAvg++; - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { avgColors[ lightmapNum ] += getRadVertexLuxel( lightmapNum, ds->firstVert + i ); } @@ -3160,7 +3160,7 @@ void IlluminateVertexes( int num ){ /* set average color */ if ( numAvg > 0 ) { - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) avgColors[ lightmapNum ] *= ( 1.0f / numAvg ); } else @@ -3169,11 +3169,11 @@ void IlluminateVertexes( int num ){ } /* clean up and store vertex color */ - for ( i = 0; i < ds->numVerts; i++ ) + for ( i = 0; i < ds->numVerts; ++i ) { /* store average in occluded vertexes */ if ( getRadVertexLuxel( 0, ds->firstVert + i )[ 0 ] < 0.0f ) { - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { getRadVertexLuxel( lightmapNum, ds->firstVert + i ) = avgColors[ lightmapNum ]; @@ -3183,7 +3183,7 @@ void IlluminateVertexes( int num ){ } /* store it */ - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { /* get luxels */ Vector3& vertLuxel = getVertexLuxel( lightmapNum, ds->firstVert + i ); @@ -3211,7 +3211,7 @@ void IlluminateVertexes( int num ){ ----------------------------------------------------------------- */ /* set styles from lightmap */ - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) ds->vertexStyles[ lightmapNum ] = lm->styles[ lightmapNum ]; /* get max search radius */ @@ -3219,10 +3219,10 @@ void IlluminateVertexes( int num ){ /* walk the surface verts */ verts = &yDrawVerts[ ds->firstVert ]; - for ( i = 0; i < ds->numVerts; i++ ) + for ( i = 0; i < ds->numVerts; ++i ) { /* do each lightmap */ - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { /* early out */ if ( lm->superLuxels[ lightmapNum ] == NULL ) { @@ -3261,16 +3261,16 @@ void IlluminateVertexes( int num ){ /* increasing radius */ radVertLuxel.set( 0 ); samples = 0.0f; - for ( radius = 0; radius < maxRadius && samples <= 0.0f; radius++ ) + for ( radius = 0; radius < maxRadius && samples <= 0.0f; ++radius ) { /* sample within radius */ - for ( sy = ( y - radius ); sy <= ( y + radius ); sy++ ) + for ( sy = ( y - radius ); sy <= ( y + radius ); ++sy ) { if ( sy < 0 || sy >= lm->sh ) { continue; } - for ( sx = ( x - radius ); sx <= ( x + radius ); sx++ ) + for ( sx = ( x - radius ); sx <= ( x + radius ); ++sx ) { if ( sx < 0 || sx >= lm->sw ) { continue; @@ -3343,7 +3343,7 @@ void SetupBrushesFlags( int mask_any, int test_any, int mask_all, int test_all ) int numOpaqueBrushes = 0; /* walk the list of worldspawn brushes */ - for ( int i = 0; i < bspModels[ 0 ].numBSPBrushes; i++ ) + for ( int i = 0; i < bspModels[ 0 ].numBSPBrushes; ++i ) { /* get brush */ const int b = bspModels[ 0 ].firstBSPBrush + i; @@ -3352,7 +3352,7 @@ void SetupBrushesFlags( int mask_any, int test_any, int mask_all, int test_all ) /* check all sides */ compileFlags = 0; allCompileFlags = ~( 0 ); - for ( int j = 0; j < brush.numSides; j++ ) + for ( int j = 0; j < brush.numSides; ++j ) { /* do bsp shader calculations */ const bspBrushSide_t& side = bspBrushSides[ brush.firstSide + j ]; @@ -3450,16 +3450,16 @@ void SetupEnvelopes( bool forGrid, bool fastFlag ){ /* invalid cluster? */ if ( light->cluster < 0 ) { /* nudge the sample point around a bit */ - for ( int x = 0; x < 4; x++ ) + for ( int x = 0; x < 4; ++x ) { /* two's complement 0, 1, -1, 2, -2, etc */ const int x1 = ( ( x >> 1 ) ^ ( x & 1 ? -1 : 0 ) ) + ( x & 1 ); - for ( int y = 0; y < 4; y++ ) + for ( int y = 0; y < 4; ++y ) { const int y1 = ( ( y >> 1 ) ^ ( y & 1 ? -1 : 0 ) ) + ( y & 1 ); - for ( int z = 0; z < 4; z++ ) + for ( int z = 0; z < 4; ++z ) { const int z1 = ( ( z >> 1 ) ^ ( z & 1 ? -1 : 0 ) ) + ( z & 1 ); @@ -3694,10 +3694,10 @@ void SetupFloodLight(){ /* iterate angle */ angle = 0.0f; - for ( i = 0, angle = 0.0f; i < FLOODLIGHT_NUM_ANGLE_STEPS; i++, angle += angleStep ) + for ( i = 0, angle = 0.0f; i < FLOODLIGHT_NUM_ANGLE_STEPS; ++i, angle += angleStep ) { /* iterate elevation */ - for ( j = 0, elevation = elevationStep * 0.5f; j < FLOODLIGHT_NUM_ELEVATION_STEPS; j++, elevation += elevationStep ) + for ( j = 0, elevation = elevationStep * 0.5f; j < FLOODLIGHT_NUM_ELEVATION_STEPS; ++j, elevation += elevationStep ) { floodVectors[ numFloodVectors ][ 0 ] = sin( elevation ) * cos( angle ); floodVectors[ numFloodVectors ][ 1 ] = sin( elevation ) * sin( angle ); @@ -3801,7 +3801,7 @@ float FloodLightForSample( trace_t *trace, float floodLightDistance, bool floodL /* vortex: optimise floodLightLowQuality a bit */ if ( floodLightLowQuality ) { /* iterate through ordered vectors */ - for ( i = 0; i < numFloodVectors; i++ ) + for ( i = 0; i < numFloodVectors; ++i ) if ( rand() % 10 != 0 ) { continue; } @@ -3809,7 +3809,7 @@ float FloodLightForSample( trace_t *trace, float floodLightDistance, bool floodL else { /* iterate through ordered vectors */ - for ( i = 0; i < numFloodVectors; i++ ) + for ( i = 0; i < numFloodVectors; ++i ) { vecs++; @@ -3888,7 +3888,7 @@ static void FloodLightRawLightmapPass( rawLightmap_t *lm, Vector3& lmFloodLightR /* twosided lighting (may or may not be a good idea for lightmapped stuff) */ //trace.twoSided = false; - for ( i = 0; i < trace.numSurfaces; i++ ) + for ( i = 0; i < trace.numSurfaces; ++i ) { /* get surface */ info = &surfaceInfos[ trace.surfaces[ i ] ]; @@ -3901,9 +3901,9 @@ static void FloodLightRawLightmapPass( rawLightmap_t *lm, Vector3& lmFloodLightR } /* gather floodlight */ - for ( y = 0; y < lm->sh; y++ ) + for ( y = 0; y < lm->sh; ++y ) { - for ( x = 0; x < lm->sw; x++ ) + for ( x = 0; x < lm->sw; ++x ) { /* get luxel */ const int cluster = lm->getSuperCluster( x, y ); @@ -3937,9 +3937,9 @@ static void FloodLightRawLightmapPass( rawLightmap_t *lm, Vector3& lmFloodLightR #if 0 /* filter "dirt" */ - for ( y = 0; y < lm->sh; y++ ) + for ( y = 0; y < lm->sh; ++y ) { - for ( x = 0; x < lm->sw; x++ ) + for ( x = 0; x < lm->sw; ++x ) { /* get luxel */ SuperFloodLight& floodlight = lm->getSuperFloodLight( x, y ); @@ -3947,13 +3947,13 @@ static void FloodLightRawLightmapPass( rawLightmap_t *lm, Vector3& lmFloodLightR /* filter dirt by adjacency to unmapped luxels */ average = floodlight.value[0]; samples = 1.0f; - for ( sy = ( y - 1 ); sy <= ( y + 1 ); sy++ ) + for ( sy = ( y - 1 ); sy <= ( y + 1 ); ++sy ) { if ( sy < 0 || sy >= lm->sh ) { continue; } - for ( sx = ( x - 1 ); sx <= ( x + 1 ); sx++ ) + for ( sx = ( x - 1 ); sx <= ( x + 1 ); ++sx ) { if ( sx < 0 || sx >= lm->sw || ( sx == x && sy == y ) ) { continue; @@ -4028,7 +4028,7 @@ static void FloodlightIlluminateLightmap( rawLightmap_t *lm ){ int x, y, lightmapNum; /* walk lightmaps */ - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { /* early out */ if ( lm->superLuxels[ lightmapNum ] == NULL ) { @@ -4039,9 +4039,9 @@ static void FloodlightIlluminateLightmap( rawLightmap_t *lm ){ continue; /* apply floodlight to each luxel */ - for ( y = 0; y < lm->sh; y++ ) + for ( y = 0; y < lm->sh; ++y ) { - for ( x = 0; x < lm->sw; x++ ) + for ( x = 0; x < lm->sw; ++x ) { /* get floodlight */ const SuperFloodLight& floodlight = lm->getSuperFloodLight( x, y ); diff --git a/tools/quake3/q3map2/lightmaps_ydnar.cpp b/tools/quake3/q3map2/lightmaps_ydnar.cpp index 6938d4d8..77fd9e26 100644 --- a/tools/quake3/q3map2/lightmaps_ydnar.cpp +++ b/tools/quake3/q3map2/lightmaps_ydnar.cpp @@ -131,7 +131,7 @@ void ExportLightmaps(){ Q_mkdir( dirname ); /* iterate through the lightmaps */ - for ( i = 0, lightmap = bspLightBytes.data(); lightmap < ( bspLightBytes.data() + bspLightBytes.size() ); i++, lightmap += ( g_game->lightmapSize * g_game->lightmapSize * 3 ) ) + for ( i = 0, lightmap = bspLightBytes.data(); lightmap < ( bspLightBytes.data() + bspLightBytes.size() ); ++i, lightmap += ( g_game->lightmapSize * g_game->lightmapSize * 3 ) ) { /* write a tga image out */ sprintf( filename, "%s/lightmap_%04d.tga", dirname, i ); @@ -212,7 +212,7 @@ int ImportLightmapsMain( Args& args ){ Q_mkdir( dirname ); /* iterate through the lightmaps */ - for ( i = 0, lightmap = bspLightBytes.data(); lightmap < ( bspLightBytes.data() + bspLightBytes.size() ); i++, lightmap += ( g_game->lightmapSize * g_game->lightmapSize * 3 ) ) + for ( i = 0, lightmap = bspLightBytes.data(); lightmap < ( bspLightBytes.data() + bspLightBytes.size() ); ++i, lightmap += ( g_game->lightmapSize * g_game->lightmapSize * 3 ) ) { /* read a tga image */ sprintf( filename, "%s/lightmap_%04d.tga", dirname, i ); @@ -239,10 +239,10 @@ int ImportLightmapsMain( Args& args ){ /* copy the pixels */ in = pixels; - for ( y = 1; y <= g_game->lightmapSize; y++ ) + for ( y = 1; y <= g_game->lightmapSize; ++y ) { out = lightmap + ( ( g_game->lightmapSize - y ) * g_game->lightmapSize * 3 ); - for ( x = 0; x < g_game->lightmapSize; x++, in += 4, out += 3 ) + for ( x = 0; x < g_game->lightmapSize; ++x, in += 4, out += 3 ) std::copy_n( in, 3, out ); } @@ -308,7 +308,7 @@ static void FinishRawLightmap( rawLightmap_t *lm ){ /* count clusters */ lm->numLightClusters = 0; - for ( i = 0; i < lm->numLightSurfaces; i++ ) + for ( i = 0; i < lm->numLightSurfaces; ++i ) { /* get surface info */ info = &surfaceInfos[ lightSurfaces[ lm->firstLightSurface + i ] ]; @@ -320,19 +320,19 @@ static void FinishRawLightmap( rawLightmap_t *lm ){ /* allocate buffer for clusters and copy */ lm->lightClusters = safe_malloc( lm->numLightClusters * sizeof( *lm->lightClusters ) ); c = 0; - for ( i = 0; i < lm->numLightSurfaces; i++ ) + for ( i = 0; i < lm->numLightSurfaces; ++i ) { /* get surface info */ info = &surfaceInfos[ lightSurfaces[ lm->firstLightSurface + i ] ]; /* add surface clusters */ - for ( j = 0; j < info->numSurfaceClusters; j++ ) + for ( j = 0; j < info->numSurfaceClusters; ++j ) lm->lightClusters[ c++ ] = surfaceClusters[ info->firstSurfaceCluster + j ]; } /* set styles */ lm->styles[ 0 ] = LS_NORMAL; - for ( i = 1; i < MAX_LIGHTMAPS; i++ ) + for ( i = 1; i < MAX_LIGHTMAPS; ++i ) lm->styles[ i ] = LS_NONE; /* set supersampling size */ @@ -417,7 +417,7 @@ static void FinishRawLightmap( rawLightmap_t *lm ){ } size = lm->sw * lm->sh; sc = lm->superClusters; - for ( i = 0; i < size; i++ ) + for ( i = 0; i < size; ++i ) ( *sc++ ) = CLUSTER_UNMAPPED; /* deluxemap allocation */ @@ -479,9 +479,9 @@ static bool AddPatchToRawLightmap( int num, rawLightmap_t *lm ){ /* find the longest distance on each row/column */ verts = mesh->verts; - for ( int y = 0; y < mesh->height; y++ ) + for ( int y = 0; y < mesh->height; ++y ) { - for ( int x = 0; x < mesh->width; x++ ) + for ( int x = 0; x < mesh->width; ++x ) { /* get width */ if ( x + 1 < mesh->width ) { @@ -501,7 +501,7 @@ static bool AddPatchToRawLightmap( int num, rawLightmap_t *lm ){ /* determine lightmap width */ length = 0; - for ( int x = 0; x < ( mesh->width - 1 ); x++ ) + for ( int x = 0; x < ( mesh->width - 1 ); ++x ) length += widthTable[ x ]; lm->w = lm->sampleSize != 0 ? ceil( length / lm->sampleSize ) + 1 : 0; value_maximize( lm->w, ds.patchWidth ); @@ -510,7 +510,7 @@ static bool AddPatchToRawLightmap( int num, rawLightmap_t *lm ){ /* determine lightmap height */ length = 0; - for ( int y = 0; y < ( mesh->height - 1 ); y++ ) + for ( int y = 0; y < ( mesh->height - 1 ); ++y ) length += heightTable[ y ]; lm->h = lm->sampleSize != 0 ? ceil( length / lm->sampleSize ) + 1 : 0; value_maximize( lm->h, ds.patchHeight ); @@ -524,10 +524,10 @@ static bool AddPatchToRawLightmap( int num, rawLightmap_t *lm ){ lm->wrap[ 0 ] = true; lm->wrap[ 1 ] = true; verts = &yDrawVerts[ ds.firstVert ]; - for ( int y = 0; y < ds.patchHeight; y++ ) + for ( int y = 0; y < ds.patchHeight; ++y ) { t = ( tBasis * y ) + 0.5f; - for ( int x = 0; x < ds.patchWidth; x++ ) + for ( int x = 0; x < ds.patchWidth; ++x ) { s = ( sBasis * x ) + 0.5f; verts[ ( y * ds.patchWidth ) + x ].lightmap[ 0 ][ 0 ] = s * superSample; @@ -643,7 +643,7 @@ static bool AddSurfaceToRawLightmap( int num, rawLightmap_t *lm ){ sampleSize = lm->sampleSize; /* round to the lightmap resolution */ - for ( i = 0; i < 3; i++ ) + for ( i = 0; i < 3; ++i ) { mins[ i ] = sampleSize * floor( lm->minmax.mins[ i ] / sampleSize ); maxs[ i ] = sampleSize * ceil( lm->minmax.maxs[ i ] / sampleSize ); @@ -739,7 +739,7 @@ static bool AddSurfaceToRawLightmap( int num, rawLightmap_t *lm ){ lm->axisNum = axisNum; /* walk the list of surfaces on this raw lightmap */ - for ( n = 0; n < lm->numLightSurfaces; n++ ) + for ( n = 0; n < lm->numLightSurfaces; ++n ) { /* get surface */ num2 = lightSurfaces[ lm->firstLightSurface + n ]; @@ -747,7 +747,7 @@ static bool AddSurfaceToRawLightmap( int num, rawLightmap_t *lm ){ verts = &yDrawVerts[ ds2->firstVert ]; /* set the lightmap texture coordinates in yDrawVerts in [0, superSample * lm->customWidth] space */ - for ( i = 0; i < ds2->numVerts; i++ ) + for ( i = 0; i < ds2->numVerts; ++i ) { delta = verts[ i ].xyz - origin; s = vector3_dot( delta, vecs[ 0 ] ) + 0.5f; @@ -789,7 +789,7 @@ static bool AddSurfaceToRawLightmap( int num, rawLightmap_t *lm ){ lm->vecs[ 2 ] = ds->lightmapVecs[ 2 ]; /* project stepped lightmap blocks and subtract to get planevecs */ - for ( i = 0; i < 2; i++ ) + for ( i = 0; i < 2; ++i ) { normalized = vecs[ i ]; len = VectorNormalize( normalized ); @@ -872,7 +872,7 @@ struct CompareSurfaceInfo } /* then lightmap axis */ - for ( int i = 0; i < 3; i++ ) + for ( int i = 0; i < 3; ++i ) { if ( aInfo.axis[ i ] < bInfo.axis[ i ] ) { return false; @@ -890,7 +890,7 @@ struct CompareSurfaceInfo return true; } else if ( aInfo.plane != NULL && bInfo.plane != NULL ) { - for ( int i = 0; i < 3; i++ ) + for ( int i = 0; i < 3; ++i ) { if ( aInfo.plane->normal()[ i ] < bInfo.plane->normal()[ i ] ) { return false; @@ -909,7 +909,7 @@ struct CompareSurfaceInfo } /* then position in world */ - for ( int i = 0; i < 3; i++ ) + for ( int i = 0; i < 3; ++i ) { if ( aInfo.minmax.mins[ i ] < bInfo.minmax.mins[ i ] ) { return false; @@ -961,7 +961,7 @@ void SetupSurfaceLightmaps(){ /* allocate a list for per-surface info */ surfaceInfos = safe_calloc( numBSPDrawSurfaces * sizeof( *surfaceInfos ) ); - for ( i = 0; i < numBSPDrawSurfaces; i++ ) + for ( i = 0; i < numBSPDrawSurfaces; ++i ) surfaceInfos[ i ].childSurfaceNum = -1; /* allocate a list of surface indexes to be sorted */ @@ -971,7 +971,7 @@ void SetupSurfaceLightmaps(){ for ( const bspModel_t& model : bspModels ) { /* walk the list of surfaces in this model and fill out the info structs */ - for ( j = 0; j < model.numBSPSurfaces; j++ ) + for ( j = 0; j < model.numBSPSurfaces; ++j ) { /* make surface index */ num = model.firstBSPSurface + j; @@ -1012,7 +1012,7 @@ void SetupSurfaceLightmaps(){ /* determine surface bounds */ info->minmax.clear(); - for ( k = 0; k < ds->numVerts; k++ ) + for ( k = 0; k < ds->numVerts; ++k ) { g_mapMinmax.extend( yDrawVerts[ ds->firstVert + k ].xyz ); info->minmax.extend( yDrawVerts[ ds->firstVert + k ].xyz ); @@ -1027,7 +1027,7 @@ void SetupSurfaceLightmaps(){ } /* test leaf surfaces */ - for ( s = 0; s < leaf.numBSPLeafSurfaces; s++ ) + for ( s = 0; s < leaf.numBSPLeafSurfaces; ++s ) { if ( bspLeafSurfaces[ leaf.firstBSPLeafSurface + s ] == num ) { if ( numSurfaceClusters >= maxSurfaceClusters ) { @@ -1075,7 +1075,7 @@ void SetupSurfaceLightmaps(){ rawLightmaps = safe_calloc( numSurfsLightmapped * sizeof( *rawLightmaps ) ); /* walk the list of sorted surfaces */ - for ( i = 0; i < numBSPDrawSurfaces; i++ ) + for ( i = 0; i < numBSPDrawSurfaces; ++i ) { /* get info and attempt early out */ num = sortSurfaces[ i ]; @@ -1125,7 +1125,7 @@ void SetupSurfaceLightmaps(){ { /* walk the list of surfaces again */ added = false; - for ( j = i + 1; j < numBSPDrawSurfaces && !lm->finished; j++ ) + for ( j = i + 1; j < numBSPDrawSurfaces && !lm->finished; ++j ) { /* get info and attempt early out */ num2 = sortSurfaces[ j ]; @@ -1157,7 +1157,7 @@ void SetupSurfaceLightmaps(){ } /* allocate vertex luxel storage */ - for ( k = 0; k < MAX_LIGHTMAPS; k++ ) + for ( k = 0; k < MAX_LIGHTMAPS; ++k ) { vertexLuxels[ k ] = safe_calloc( bspDrawVerts.size() * sizeof( *vertexLuxels[ 0 ] ) ); radVertexLuxels[ k ] = safe_calloc( bspDrawVerts.size() * sizeof( *radVertexLuxels[ 0 ] ) ); @@ -1204,7 +1204,7 @@ void StitchSurfaceLightmaps(){ /* walk the list of raw lightmaps */ numStitched = 0; - for ( i = 0; i < numRawLightmaps; i++ ) + for ( i = 0; i < numRawLightmaps; ++i ) { /* print pacifier */ if ( const int f = 10 * i / numRawLightmaps; f != fOld ) { @@ -1217,7 +1217,7 @@ void StitchSurfaceLightmaps(){ /* walk rest of lightmaps */ numCandidates = 0; - for ( j = i + 1; j < numRawLightmaps && numCandidates < MAX_STITCH_CANDIDATES; j++ ) + for ( j = i + 1; j < numRawLightmaps && numCandidates < MAX_STITCH_CANDIDATES; ++j ) { /* get lightmap b */ b = &rawLightmaps[ j ]; @@ -1232,9 +1232,9 @@ void StitchSurfaceLightmaps(){ } /* walk luxels */ - for ( y = 0; y < a->sh; y++ ) + for ( y = 0; y < a->sh; ++y ) { - for ( x = 0; x < a->sw; x++ ) + for ( x = 0; x < a->sw; ++x ) { /* ignore unmapped/unlit luxels */ lm = a; @@ -1251,7 +1251,7 @@ void StitchSurfaceLightmaps(){ const Vector3& normal = lm->getSuperNormal( x, y ); /* walk candidate list */ - for ( j = 0; j < numCandidates; j++ ) + for ( j = 0; j < numCandidates; ++j ) { /* get candidate */ b = c[ j ]; @@ -1269,9 +1269,9 @@ void StitchSurfaceLightmaps(){ Vector3 average( 0 ); numLuxels = 0; totalColor = 0.0f; - for ( y2 = 0; y2 < b->sh && numLuxels < MAX_STITCH_LUXELS; y2++ ) + for ( y2 = 0; y2 < b->sh && numLuxels < MAX_STITCH_LUXELS; ++y2 ) { - for ( x2 = 0; x2 < b->sw && numLuxels < MAX_STITCH_LUXELS; x2++ ) + for ( x2 = 0; x2 < b->sw && numLuxels < MAX_STITCH_LUXELS; ++x2 ) { /* ignore same luxels */ if ( a == b && abs( x - x2 ) <= 1 && abs( y - y2 ) <= 1 ) { @@ -1373,9 +1373,9 @@ static bool CompareBSPLuxels( rawLightmap_t *a, int aNum, rawLightmap_t *b, int /* compare luxels */ double delta = 0.0; double total = 0.0; - for ( int y = 0; y < a->h; y++ ) + for ( int y = 0; y < a->h; ++y ) { - for ( int x = 0; x < a->w; x++ ) + for ( int x = 0; x < a->w; ++x ) { /* increment total */ total += 1.0; @@ -1450,9 +1450,9 @@ static bool MergeBSPLuxels( rawLightmap_t *a, int aNum, rawLightmap_t *b, int bN } /* merge luxels */ - for ( y = 0; y < a->h; y++ ) + for ( y = 0; y < a->h; ++y ) { - for ( x = 0; x < a->w; x++ ) + for ( x = 0; x < a->w; ++x ) { /* get luxels */ Vector3& aLuxel = a->getBspLuxel( aNum, x, y ); @@ -1497,7 +1497,7 @@ static bool ApproximateLuxel( rawLightmap_t *lm, const bspDrawVert_t& dv ){ const int y = std::clamp( int( dv.lightmap[ 0 ][ 1 ] / superSample ), 0, lm->h - 1 ); /* walk list */ - for ( int lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( int lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { /* early out */ if ( lm->styles[ lightmapNum ] == LS_NONE ) { @@ -1518,7 +1518,7 @@ static bool ApproximateLuxel( rawLightmap_t *lm, const bspDrawVert_t& dv ){ /* styles are not affected by minlight */ if ( lightmapNum == 0 ) { - for ( int i = 0; i < 3; i++ ) + for ( int i = 0; i < 3; ++i ) { /* set min color */ value_maximize( color[ i ], minLight[ i ] ); @@ -1531,7 +1531,7 @@ static bool ApproximateLuxel( rawLightmap_t *lm, const bspDrawVert_t& dv ){ Color4b vcb( ColorToBytes( vertexColor, 1.0f ), 0 ); /* compare */ - for ( int i = 0; i < 3; i++ ) + for ( int i = 0; i < 3; ++i ) { if ( abs( cb[ i ] - vcb[ i ] ) > approximateTolerance ) { return false; @@ -1562,7 +1562,7 @@ static bool ApproximateTriangle_r( rawLightmap_t *lm, const TriRef& tri ){ { /* find the longest edge and split it */ float maxDist = 0; - for ( int i = 0; i < 3; i++ ) + for ( int i = 0; i < 3; ++i ) { const float dist = vector2_length( tri[ i ]->lightmap[ 0 ] - tri[ ( i + 1 ) % 3 ]->lightmap[ 0 ] ); if ( dist > maxDist ) { @@ -1617,7 +1617,7 @@ static bool ApproximateLightmap( rawLightmap_t *lm ){ } /* don't approx lightmaps with styles */ - for ( int i = 1; i < MAX_LIGHTMAPS; i++ ) + for ( int i = 1; i < MAX_LIGHTMAPS; ++i ) { if ( lm->styles[ i ] != LS_NONE ) { return false; @@ -1629,7 +1629,7 @@ static bool ApproximateLightmap( rawLightmap_t *lm ){ bool approximated = true; /* walk the list of surfaces on this raw lightmap */ - for ( int n = 0; n < lm->numLightSurfaces; n++ ) + for ( int n = 0; n < lm->numLightSurfaces; ++n ) { /* get surface */ const int num = lightSurfaces[ lm->firstLightSurface + n ]; @@ -1697,9 +1697,9 @@ static bool ApproximateLightmap( rawLightmap_t *lm ){ /* map the mesh quads */ info.approximated = true; - for ( int y = 0; y < ( mesh->height - 1 ) && info.approximated; y++ ) + for ( int y = 0; y < ( mesh->height - 1 ) && info.approximated; ++y ) { - for ( int x = 0; x < ( mesh->width - 1 ) && info.approximated; x++ ) + for ( int x = 0; x < ( mesh->width - 1 ) && info.approximated; ++x ) { /* set indexes */ const int pw[ 5 ] = { @@ -1855,7 +1855,7 @@ static void FindOutLightmaps( rawLightmap_t *lm, bool fastAllocate ){ /* set default lightmap number (-3 = LIGHTMAP_BY_VERTEX) */ - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) lm->outLightmapNums[ lightmapNum ] = -3; /* can this lightmap be approximated with vertex color? */ @@ -1864,7 +1864,7 @@ static void FindOutLightmaps( rawLightmap_t *lm, bool fastAllocate ){ } /* walk list */ - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { /* early out */ if ( lm->styles[ lightmapNum ] == LS_NONE ) { @@ -1880,10 +1880,10 @@ static void FindOutLightmaps( rawLightmap_t *lm, bool fastAllocate ){ ok = false; if ( lightmapNum > 0 && outLightmaps != NULL ) { /* loop twice */ - for ( j = 0; j < 2; j++ ) + for ( j = 0; j < 2; ++j ) { /* try identical position */ - for ( i = 0; i < numOutLightmaps; i++ ) + for ( i = 0; i < numOutLightmaps; ++i ) { /* get the output lightmap */ olm = &outLightmaps[ i ]; @@ -1909,9 +1909,9 @@ static void FindOutLightmaps( rawLightmap_t *lm, bool fastAllocate ){ /* try shifting */ else { - for ( sy = -1; sy <= 1; sy++ ) + for ( sy = -1; sy <= 1; ++sy ) { - for ( sx = -1; sx <= 1; sx++ ) + for ( sx = -1; sx <= 1; ++sx ) { x = lm->lightmapX[ 0 ] + sx * ( olm->customWidth >> 1 ); //% lm->w; y = lm->lightmapY[ 0 ] + sy * ( olm->customHeight >> 1 ); //% lm->h; @@ -2063,13 +2063,13 @@ static void FindOutLightmaps( rawLightmap_t *lm, bool fastAllocate ){ olm->numLightmaps++; /* add shaders */ - for ( i = 0; i < lm->numLightSurfaces; i++ ) + for ( i = 0; i < lm->numLightSurfaces; ++i ) { /* get surface info */ info = &surfaceInfos[ lightSurfaces[ lm->firstLightSurface + i ] ]; /* test for shader */ - for ( j = 0; j < olm->numShaders; j++ ) + for ( j = 0; j < olm->numShaders; ++j ) { if ( olm->shaders[ j ] == info->si ) { break; @@ -2096,9 +2096,9 @@ static void FindOutLightmaps( rawLightmap_t *lm, bool fastAllocate ){ } /* mark the bits used */ - for ( y = 0; y < yMax; y++ ) + for ( y = 0; y < yMax; ++y ) { - for ( x = 0; x < xMax; x++ ) + for ( x = 0; x < xMax; ++x ) { /* get luxel */ const Vector3& luxel = lm->getBspLuxel( lightmapNum, x, y ); @@ -2122,7 +2122,7 @@ static void FindOutLightmaps( rawLightmap_t *lm, bool fastAllocate ){ /* styles are not affected by minlight */ if ( lightmapNum == 0 ) { - for ( i = 0; i < 3; i++ ) + for ( i = 0; i < 3; ++i ) { value_maximize( color[ i ], minLight[ i ] ); } @@ -2170,7 +2170,7 @@ struct CompareRawLightmap const int min = std::min( alm.numLightSurfaces, blm.numLightSurfaces ); /* iterate */ - for ( int i = 0; i < min; i++ ) + for ( int i = 0; i < min; ++i ) { /* get surface info */ const surfaceInfo_t& aInfo = surfaceInfos[ lightSurfaces[ alm.firstLightSurface + i ] ]; @@ -2185,7 +2185,7 @@ struct CompareRawLightmap /* test style count */ diff = 0; - for ( int i = 0; i < MAX_LIGHTMAPS; i++ ) + for ( int i = 0; i < MAX_LIGHTMAPS; ++i ) diff += blm.styles[ i ] - alm.styles[ i ]; if ( diff != 0 ) { return diff < 0; @@ -2363,13 +2363,13 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ numTwins = 0; numTwinLuxels = 0; numSolidLightmaps = 0; - for ( i = 0; i < numRawLightmaps; i++ ) + for ( i = 0; i < numRawLightmaps; ++i ) { /* get lightmap */ lm = &rawLightmaps[ i ]; /* walk individual lightmaps */ - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { /* early outs */ if ( lm->superLuxels[ lightmapNum ] == NULL ) { @@ -2392,9 +2392,9 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ } /* average supersampled luxels */ - for ( y = 0; y < lm->h; y++ ) + for ( y = 0; y < lm->h; ++y ) { - for ( x = 0; x < lm->w; x++ ) + for ( x = 0; x < lm->w; ++x ) { /* subsample */ samples = 0.0f; @@ -2403,9 +2403,9 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ sample.set( 0 ); occludedSample.set( 0 ); dirSample.set( 0 ); - for ( ly = 0; ly < superSample; ly++ ) + for ( ly = 0; ly < superSample; ++ly ) { - for ( lx = 0; lx < superSample; lx++ ) + for ( lx = 0; lx < superSample; ++lx ) { /* sample luxel */ sx = x * superSample + lx; @@ -2513,9 +2513,9 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ MinMax colorMinmax; /* clean up and store into bsp luxels */ - for ( y = 0; y < lm->h; y++ ) + for ( y = 0; y < lm->h; ++y ) { - for ( x = 0; x < lm->w; x++ ) + for ( x = 0; x < lm->w; ++x ) { /* get luxels */ const SuperLuxel& luxel = lm->getSuperLuxel( lightmapNum, x, y ); @@ -2533,7 +2533,7 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ lm->used++; /* fix negative samples */ - for ( j = 0; j < 3; j++ ) + for ( j = 0; j < 3; ++j ) { value_maximize( sample[ j ], 0.0f ); } @@ -2546,13 +2546,13 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ samples = 0.0f; /* fixme: why is this disabled?? */ - for ( sy = ( y - 1 ); sy <= ( y + 1 ); sy++ ) + for ( sy = ( y - 1 ); sy <= ( y + 1 ); ++sy ) { if ( sy < 0 || sy >= lm->h ) { continue; } - for ( sx = ( x - 1 ); sx <= ( x + 1 ); sx++ ) + for ( sx = ( x - 1 ); sx <= ( x + 1 ); ++sx ) { if ( sx < 0 || sx >= lm->w || ( sx == x && sy == y ) ) { continue; @@ -2579,7 +2579,7 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ lm->used++; /* fix negative samples */ - for ( j = 0; j < 3; j++ ) + for ( j = 0; j < 3; ++j ) { value_maximize( sample[ j ], 0.0f ); } @@ -2632,7 +2632,7 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ /* if all lightmaps aren't solid, then none of them are solid */ if ( lm->solid[ lightmapNum ] != lm->solid[ 0 ] ) { - for ( y = 0; y < MAX_LIGHTMAPS; y++ ) + for ( y = 0; y < MAX_LIGHTMAPS; ++y ) { if ( lm->solid[ y ] ) { numSolidLightmaps--; @@ -2644,7 +2644,7 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ /* wrap bsp luxels if necessary */ if ( lm->wrap[ 0 ] ) { - for ( y = 0; y < lm->h; y++ ) + for ( y = 0; y < lm->h; ++y ) { Vector3& bspLuxel = lm->getBspLuxel( lightmapNum, 0, y ); Vector3& bspLuxel2 = lm->getBspLuxel( lightmapNum, lm->w - 1, y ); @@ -2657,7 +2657,7 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ } } if ( lm->wrap[ 1 ] ) { - for ( x = 0; x < lm->w; x++ ) + for ( x = 0; x < lm->w; ++x ) { Vector3& bspLuxel = lm->getBspLuxel( lightmapNum, x, 0 ); Vector3& bspLuxel2 = lm->getBspLuxel( lightmapNum, x, lm->h - 1 ); @@ -2685,15 +2685,15 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ Sys_Printf( "converting..." ); - for ( i = 0; i < numRawLightmaps; i++ ) + for ( i = 0; i < numRawLightmaps; ++i ) { /* get lightmap */ lm = &rawLightmaps[ i ]; /* walk lightmap samples */ - for ( y = 0; y < lm->sh; y++ ) + for ( y = 0; y < lm->sh; ++y ) { - for ( x = 0; x < lm->sw; x++ ) + for ( x = 0; x < lm->sw; ++x ) { /* get normal and deluxel */ Vector3& bspDeluxel = lm->getBspDeluxel( x, y ); @@ -2755,7 +2755,7 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ /* note it */ Sys_Printf( "blending..." ); - for ( i = 0; i < numRawLightmaps; i++ ) + for ( i = 0; i < numRawLightmaps; ++i ) { Vector3 myColor; float myBrightness; @@ -2764,7 +2764,7 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ lm = &rawLightmaps[ i ]; /* walk individual lightmaps */ - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { /* early outs */ if ( lm->superLuxels[ lightmapNum ] == NULL ) { @@ -2772,9 +2772,9 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ } /* walk lightmap samples */ - for ( y = 0; y < lm->sh; y++ ) + for ( y = 0; y < lm->sh; ++y ) { - for ( x = 0; x < lm->sw; x++ ) + for ( x = 0; x < lm->sw; ++x ) { /* get luxel */ Vector3& bspLuxel = lm->getBspLuxel( lightmapNum, x, y ); @@ -2803,9 +2803,9 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ timer.start(); /* set all twin refs to null */ - for ( i = 0; i < numRawLightmaps; i++ ) + for ( i = 0; i < numRawLightmaps; ++i ) { - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { rawLightmaps[ i ].twins[ lightmapNum ] = NULL; rawLightmaps[ i ].twinNums[ lightmapNum ] = -1; @@ -2814,13 +2814,13 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ } /* walk the list of raw lightmaps */ - for ( i = 0; i < numRawLightmaps; i++ ) + for ( i = 0; i < numRawLightmaps; ++i ) { /* get lightmap */ lm = &rawLightmaps[ i ]; /* walk lightmaps */ - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { /* early outs */ if ( lm->bspLuxels[ lightmapNum ] == NULL || @@ -2829,13 +2829,13 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ } /* find all lightmaps that are virtually identical to this one */ - for ( j = i + 1; j < numRawLightmaps; j++ ) + for ( j = i + 1; j < numRawLightmaps; ++j ) { /* get lightmap */ lm2 = &rawLightmaps[ j ]; /* walk lightmaps */ - for ( lightmapNum2 = 0; lightmapNum2 < MAX_LIGHTMAPS; lightmapNum2++ ) + for ( lightmapNum2 = 0; lightmapNum2 < MAX_LIGHTMAPS; ++lightmapNum2 ) { /* early outs */ if ( lm2->bspLuxels[ lightmapNum2 ] == NULL || @@ -2882,7 +2882,7 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ } /* fill it out and sort it */ - for ( i = 0; i < numRawLightmaps; i++ ) + for ( i = 0; i < numRawLightmaps; ++i ) sortLightmaps[ i ] = i; std::sort( sortLightmaps, sortLightmaps + numRawLightmaps, CompareRawLightmap() ); @@ -2901,7 +2901,7 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ /* kill all existing output lightmaps */ if ( outLightmaps != NULL ) { - for ( i = 0; i < numOutLightmaps; i++ ) + for ( i = 0; i < numOutLightmaps; ++i ) { free( outLightmaps[ i ].lightBits ); free( outLightmaps[ i ].bspLightBytes ); @@ -2916,20 +2916,20 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ numExtLightmaps = 0; /* find output lightmap */ - for ( i = 0; i < numRawLightmaps; i++ ) + for ( i = 0; i < numRawLightmaps; ++i ) { lm = &rawLightmaps[ sortLightmaps[ i ] ]; FindOutLightmaps( lm, fastAllocate ); } /* set output numbers in twinned lightmaps */ - for ( i = 0; i < numRawLightmaps; i++ ) + for ( i = 0; i < numRawLightmaps; ++i ) { /* get lightmap */ lm = &rawLightmaps[ sortLightmaps[ i ] ]; /* walk lightmaps */ - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { /* get twin */ lm2 = lm->twins[ lightmapNum ]; @@ -2969,7 +2969,7 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ } /* walk the list of output lightmaps */ - for ( i = 0; i < numOutLightmaps; i++ ) + for ( i = 0; i < numOutLightmaps; ++i ) { /* get output lightmap */ olm = &outLightmaps[ i ]; @@ -3032,7 +3032,7 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ } /* delete unused external lightmaps */ - for ( i = numExtLightmaps; i; i++ ) + for ( i = numExtLightmaps; i; ++i ) { /* determine if file exists */ sprintf( filename, "%s/" EXTERNAL_LIGHTMAP, dirname, i ); @@ -3084,7 +3084,7 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ /* set vertex data */ dv = &bspDrawVerts[ ds->firstVert ]; dvParent = &bspDrawVerts[ parent->firstVert ]; - for ( j = 0; j < ds->numVerts; j++ ) + for ( j = 0; j < ds->numVerts; ++j ) { memcpy( dv[ j ].lightmap, dvParent[ j ].lightmap, sizeof( dv[ j ].lightmap ) ); memcpy( dv[ j ].color, dvParent[ j ].color, sizeof( dv[ j ].color ) ); @@ -3096,7 +3096,7 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ /* handle vertex lit or approximated surfaces */ else if ( lm == NULL || lm->outLightmapNums[ 0 ] < 0 ) { - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { ds->lightmapNum[ lightmapNum ] = -3; ds->lightmapStyles[ lightmapNum ] = ds->vertexStyles[ lightmapNum ]; @@ -3107,7 +3107,7 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ else { /* walk lightmaps */ - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { /* set style */ ds->lightmapStyles[ lightmapNum ] = lm->styles[ lightmapNum ]; @@ -3136,7 +3136,7 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ /* calc lightmap st coords */ dv = &bspDrawVerts[ ds->firstVert ]; ydv = &yDrawVerts[ ds->firstVert ]; - for ( j = 0; j < ds->numVerts; j++ ) + for ( j = 0; j < ds->numVerts; ++j ) { if ( lm->solid[ lightmapNum ] ) { dv[ j ].lightmap[ lightmapNum ][ 0 ] = lmx + ( 0.5f / (float) olm->customWidth ); @@ -3153,10 +3153,10 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ /* store vertex colors */ dv = &bspDrawVerts[ ds->firstVert ]; - for ( j = 0; j < ds->numVerts; j++ ) + for ( j = 0; j < ds->numVerts; ++j ) { /* walk lightmaps */ - for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { Vector3 color; /* handle unused style */ @@ -3170,7 +3170,7 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ /* set minimum light */ if ( lightmapNum == 0 ) { - for ( k = 0; k < 3; k++ ) + for ( k = 0; k < 3; ++k ) value_maximize( color[ k ], minVertexLight[ k ] ); } } @@ -3195,7 +3195,7 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){ const bool dfEqual = ( info->si->styleMarker == 2 || info->si->implicitMap == EImplicitMap::Masked ); /* generate stages for styled lightmaps */ - for ( lightmapNum = 1; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ ) + for ( lightmapNum = 1; lightmapNum < MAX_LIGHTMAPS; ++lightmapNum ) { /* early out */ style = lm->styles[ lightmapNum ]; diff --git a/tools/quake3/q3map2/map.cpp b/tools/quake3/q3map2/map.cpp index 00717a82..819d9732 100644 --- a/tools/quake3/q3map2/map.cpp +++ b/tools/quake3/q3map2/map.cpp @@ -167,7 +167,7 @@ static bool SnapNormal( Vector3& normal ){ /* - for ( i = 0; i < 30; i++ ) + for ( i = 0; i < 30; ++i ) { double x, y, z, length; x = (double) 1.0; @@ -186,7 +186,7 @@ static bool SnapNormal( Vector3& normal ){ Error( "vectorNormalize test completed" ); */ - for ( i = 0; i < 3; i++ ) + for ( i = 0; i < 3; ++i ) { if ( normal[i] != 0.0 && -normalEpsilon < normal[i] && normal[i] < normalEpsilon ) { normal[i] = 0.0; @@ -207,7 +207,7 @@ static bool SnapNormal( Vector3& normal ){ /* Sys_Printf( "normalEpsilon is %f\n", normalEpsilon ); - for ( i = 0;; i++ ) + for ( i = 0;; ++i ) { normal[0] = 1.0; normal[1] = 0.0; @@ -235,7 +235,7 @@ static bool SnapNormal( Vector3& normal ){ // We may consider adjusting the epsilon to a larger value when we make this // code fix. - for ( i = 0; i < 3; i++ ) + for ( i = 0; i < 3; ++i ) { if ( fabs( normal[ i ] - 1 ) < normalEpsilon ) { normal.set( 0 ); @@ -346,7 +346,7 @@ int FindFloatPlane( const Plane3f& inplane, int numPoints, const Vector3 *points const int hash = ( PLANE_HASHES - 1 ) & (int) fabs( plane.dist() ); /* search the border bins as well */ - for ( int i = -1; i <= 1; i++ ) + for ( int i = -1; i <= 1; ++i ) { const int h = ( hash + i ) & ( PLANE_HASHES - 1 ); for ( int pidx = planehash[ h ] - 1; pidx != -1; pidx = mapplanes[pidx].hash_chain - 1 ) @@ -363,7 +363,7 @@ int FindFloatPlane( const Plane3f& inplane, int numPoints, const Vector3 *points /* ydnar: test supplied points against this plane */ int j; - for ( j = 0; j < numPoints; j++ ) + for ( j = 0; j < numPoints; ++j ) { // NOTE: When dist approaches 2^16, the resolution of 32 bit floating // point number is greatly decreased. The distanceEpsilon cannot be @@ -399,7 +399,7 @@ int FindFloatPlane( const Plane3f& inplane, int numPoints, const Vector3 *points #else SnapPlane( plane ); #endif - for ( i = 0, p = mapplanes; i < nummapplanes; i++, p++ ) + for ( i = 0, p = mapplanes; i < nummapplanes; ++i, ++p ) { if ( !PlaneEqual( *p, plane ) ) { continue; @@ -409,7 +409,7 @@ int FindFloatPlane( const Plane3f& inplane, int numPoints, const Vector3 *points //% return i; /* ydnar: test supplied points against this plane */ - for ( j = 0; j < numPoints; j++ ) + for ( j = 0; j < numPoints; ++j ) { if ( fabs( plane3_distance_to_point( p->plane, points[ j ] ) ) > distanceEpsilon ) { break; @@ -571,8 +571,8 @@ void AddBrushBevels(){ // add the axial planes // size_t order = 0; - for ( size_t axis = 0; axis < 3; axis++ ) { - for ( int dir = -1; dir <= 1; dir += 2, order++ ) { + for ( size_t axis = 0; axis < 3; ++axis ) { + for ( int dir = -1; dir <= 1; dir += 2, ++order ) { // see if the plane is already present size_t i = 0; for ( ; i < sides.size(); ++i ) @@ -658,7 +658,7 @@ void AddBrushBevels(){ // test the non-axial plane edges for ( size_t i = 6; i < sides.size(); ++i ) { - for ( size_t j = 0; j < sides[i].winding.size(); j++ ) { + for ( size_t j = 0; j < sides[i].winding.size(); ++j ) { Vector3 vec = sides[i].winding[j] - sides[i].winding[winding_next( sides[i].winding, j )]; if ( VectorNormalize( vec ) < 0.5f ) { continue; @@ -674,7 +674,7 @@ void AddBrushBevels(){ //% Sys_Printf( "-------------\n" ); // try the six possible slanted axials from this edge - for ( int axis = 0; axis < 3; axis++ ) { + for ( int axis = 0; axis < 3; ++axis ) { for ( int dir = -1; dir <= 1; dir += 2 ) { // construct a plane Vector3 vec2( 0 ); @@ -1386,7 +1386,7 @@ static void LoadEntityIndexMap( entity_t& e ){ /* convert to bytes */ const int size = w * h; pixels = safe_malloc( size ); - for ( int i = 0; i < size; i++ ) + for ( int i = 0; i < size; ++i ) { pixels[ i ] = ( ( pixels32[ i ] & 0xFF ) * numLayers ) / 256; if ( pixels[ i ] >= numLayers ) { @@ -1407,7 +1407,7 @@ static void LoadEntityIndexMap( entity_t& e ){ /* fix up out-of-range values */ const int size = w * h; - for ( int i = 0; i < size; i++ ) + for ( int i = 0; i < size; ++i ) { if ( pixels[ i ] >= numLayers ) { pixels[ i ] = numLayers - 1; diff --git a/tools/quake3/q3map2/mesh.cpp b/tools/quake3/q3map2/mesh.cpp index 8c8ffbfb..5c58ad82 100644 --- a/tools/quake3/q3map2/mesh.cpp +++ b/tools/quake3/q3map2/mesh.cpp @@ -44,7 +44,7 @@ bspDrawVert_t LerpDrawVert( const bspDrawVert_t& a, const bspDrawVert_t& b ){ out.xyz = vector3_mid( a.xyz, b.xyz ); out.st = vector2_mid( a.st, b.st ); - for ( int k = 0; k < MAX_LIGHTMAPS; k++ ) + for ( int k = 0; k < MAX_LIGHTMAPS; ++k ) { out.lightmap[ k ] = vector2_mid( a.lightmap[ k ], b.lightmap[ k ] ); for( int i = 0; i < 4; ++i ) @@ -75,7 +75,7 @@ void LerpDrawVertAmount( bspDrawVert_t *a, bspDrawVert_t *b, float amount, bspDr out->st = a->st + ( b->st - a->st ) * amount; - for ( int k = 0; k < MAX_LIGHTMAPS; k++ ) + for ( int k = 0; k < MAX_LIGHTMAPS; ++k ) { out->lightmap[ k ] = a->lightmap[ k ] + ( b->lightmap[ k ] - a->lightmap[ k ] ) * amount; for( int i = 0; i < 4; ++i ) @@ -422,7 +422,7 @@ int IterationsForCurve( float len, int subdivisions ){ /* calculate the number of subdivisions */ - for ( iterations = 0; iterations < 3; iterations++ ) + for ( iterations = 0; iterations < 3; ++iterations ) { facets = subdivisions * 16 * pow( 2, iterations ); if ( facets >= len ) { @@ -448,9 +448,9 @@ mesh_t *SubdivideMesh2( mesh_t in, int iterations ){ /* initial setup */ out.width = in.width; out.height = in.height; - for ( int i = 0; i < in.width; i++ ) + for ( int i = 0; i < in.width; ++i ) { - for ( int j = 0; j < in.height; j++ ) + for ( int j = 0; j < in.height; ++j ) expand[ j ][ i ] = in.verts[ j * in.width + i ]; } @@ -467,7 +467,7 @@ mesh_t *SubdivideMesh2( mesh_t in, int iterations ){ /* insert two columns and replace the peak */ out.width += 2; - for ( int i = 0; i < out.height; i++ ) + for ( int i = 0; i < out.height; ++i ) { for ( int k = out.width - 1; k > j + 3; --k ) expand [ i ][ k ] = expand[ i ][ k - 2 ]; @@ -489,9 +489,9 @@ mesh_t *SubdivideMesh2( mesh_t in, int iterations ){ /* insert two columns and replace the peak */ out.height += 2; - for ( int i = 0; i < out.width; i++ ) + for ( int i = 0; i < out.width; ++i ) { - for ( int k = out.height - 1; k > j + 3; k-- ) + for ( int k = out.height - 1; k > j + 3; --k ) expand[ k ][ i ] = expand[ k - 2 ][ i ]; expand[ j + 3 ][ i ] = LerpDrawVert( expand[ j + 1 ][ i ], expand[ j + 2 ][ i ] ); @@ -503,7 +503,7 @@ mesh_t *SubdivideMesh2( mesh_t in, int iterations ){ /* collapse the verts */ out.verts = &expand[ 0 ][ 0 ]; - for ( int i = 1; i < out.height; i++ ) + for ( int i = 1; i < out.height; ++i ) memmove( &out.verts[ i * out.width ], expand[ i ], out.width * sizeof( bspDrawVert_t ) ); /* return to sender */ @@ -572,7 +572,7 @@ mesh_t *RemoveLinearMeshColumnsRows( mesh_t *in ) { if ( maxLength < 0.1 ) { out.height--; for ( i = 0; i < out.width; ++i ) { - for ( k = j; k < out.height; k++ ) { + for ( k = j; k < out.height; ++k ) { expand[k][i] = expand[k + 1][i]; } } diff --git a/tools/quake3/q3map2/model.cpp b/tools/quake3/q3map2/model.cpp index 590095ea..0d74c532 100644 --- a/tools/quake3/q3map2/model.cpp +++ b/tools/quake3/q3map2/model.cpp @@ -1162,7 +1162,7 @@ void InsertModel( const char *name, const char *skin, int frame, const Matrix4& ds->indexes = safe_calloc( ds->numIndexes * sizeof( ds->indexes[ 0 ] ) ); // Sys_Printf( "verts %i idx %i\n", ds->numVerts, ds->numIndexes ); /* copy vertexes */ - for ( i = 0; i < ds->numVerts; i++ ) + for ( i = 0; i < ds->numVerts; ++i ) { /* get vertex */ bspDrawVert_t& dv = ds->verts[ i ]; @@ -1199,7 +1199,7 @@ void InsertModel( const char *name, const char *skin, int frame, const Matrix4& /* set lightmap/color bits */ { const aiColor4D color = mesh->HasVertexColors( 0 )? mesh->mColors[0][i] : aiColor4D( 1 ); - for ( j = 0; j < MAX_LIGHTMAPS; j++ ) + for ( j = 0; j < MAX_LIGHTMAPS; ++j ) { dv.lightmap[ j ] = { 0, 0 }; if ( spawnFlags & eColorToAlpha ) { // spawnflag 32: model color -> alpha hack @@ -1221,7 +1221,7 @@ void InsertModel( const char *name, const char *skin, int frame, const Matrix4& size_t idCopied = 0; for ( const aiFace& face : Span( mesh->mFaces, mesh->mNumFaces ) ){ // if( face.mNumIndices == 3 ) - for ( size_t i = 0; i < 3; i++ ){ + for ( size_t i = 0; i < 3; ++i ){ ds->indexes[idCopied++] = face.mIndices[i]; } if( transform_lefthanded ){ diff --git a/tools/quake3/q3map2/patch.cpp b/tools/quake3/q3map2/patch.cpp index b00ead56..52deb025 100644 --- a/tools/quake3/q3map2/patch.cpp +++ b/tools/quake3/q3map2/patch.cpp @@ -71,7 +71,7 @@ static void ExpandLongestCurve( float *longestCurve, const Vector3& a, const Vec /* determine length */ last = a; - for ( i = 0, len = 0.0f, t = 0.0f; i < APPROX_SUBDIVISION; i++, t += ( 1.0f / APPROX_SUBDIVISION ) ) + for ( i = 0, len = 0.0f, t = 0.0f; i < APPROX_SUBDIVISION; ++i, t += ( 1.0f / APPROX_SUBDIVISION ) ) { /* calculate delta */ delta = ab * ( 1.0f - t ) + bc * t; @@ -136,7 +136,7 @@ static void ExpandMaxIterations( int *maxIterations, int maxError, const Vector3 mid = ( prev + next ) * 0.5f; /* push points out */ - for ( j = numPoints - 1; j > i + 3; j-- ) + for ( j = numPoints - 1; j > i + 3; --j ) points[ j ] = points[ j - 2 ]; /* insert new points */ @@ -157,7 +157,7 @@ static void ExpandMaxIterations( int *maxIterations, int maxError, const Vector3 } /* eliminate linear sections */ - for ( i = 0; i + 2 < numPoints; i++ ) + for ( i = 0; i + 2 < numPoints; ++i ) { /* create vectors */ Vector3 delta = points[ i + 1 ] - points[ i ]; @@ -167,7 +167,7 @@ static void ExpandMaxIterations( int *maxIterations, int maxError, const Vector3 /* if either edge is degenerate, then eliminate it */ if ( len < 0.0625f || len2 < 0.0625f || vector3_dot( delta, delta2 ) >= 1.0f ) { - for ( j = i + 1; j + 1 < numPoints; j++ ) + for ( j = i + 1; j + 1 < numPoints; ++j ) points[ j ] = points[ j + 1 ]; numPoints--; continue; diff --git a/tools/quake3/q3map2/shaders.cpp b/tools/quake3/q3map2/shaders.cpp index d16a6cd7..9cfc4d42 100644 --- a/tools/quake3/q3map2/shaders.cpp +++ b/tools/quake3/q3map2/shaders.cpp @@ -167,7 +167,7 @@ static void TCModIdentity( tcMod_t& mod ){ static void TCModMultiply( const tcMod_t& a, const tcMod_t& b, tcMod_t& out ){ - for ( int i = 0; i < 3; i++ ) + for ( int i = 0; i < 3; ++i ) { out[ i ][ 0 ] = ( a[ i ][ 0 ] * b[ 0 ][ 0 ] ) + ( a[ i ][ 1 ] * b[ 1 ][ 0 ] ) + ( a[ i ][ 2 ] * b[ 2 ][ 0 ] ); out[ i ][ 1 ] = ( a[ i ][ 0 ] * b[ 0 ][ 1 ] ) + ( a[ i ][ 1 ] * b[ 1 ][ 1 ] ) + ( a[ i ][ 2 ] * b[ 2 ][ 1 ] ); @@ -605,9 +605,9 @@ static void FinishShader( shaderInfo_t& si ){ /* find pixel coordinates best matching the average color of the image */ float bestDist = 99999999.f; const Vector2 o( 1.0f / si.shaderImage->width, 1.0f / si.shaderImage->height ); - for ( y = 0, st[ 1 ] = 0.0f; y < si.shaderImage->height; y++, st[ 1 ] += o[ 1 ] ) + for ( y = 0, st[ 1 ] = 0.0f; y < si.shaderImage->height; ++y, st[ 1 ] += o[ 1 ] ) { - for ( x = 0, st[ 0 ] = 0.0f; x < si.shaderImage->width; x++, st[ 0 ] += o[ 0 ] ) + for ( x = 0, st[ 0 ] = 0.0f; x < si.shaderImage->width; ++x, st[ 0 ] += o[ 0 ] ) { /* sample the shader image */ Color4f color; @@ -692,7 +692,7 @@ static void LoadShaderImages( shaderInfo_t& si ){ /* create default and average colors */ const int count = si.lightImage->width * si.lightImage->height; Color4f color( 0, 0, 0, 0 ); - for ( int i = 0; i < count; i++ ) + for ( int i = 0; i < count; ++i ) { color[ 0 ] += si.lightImage->pixels[ i * 4 + 0 ]; color[ 1 ] += si.lightImage->pixels[ i * 4 + 1 ]; @@ -784,7 +784,7 @@ static void Parse1DMatrixAppend( ShaderTextCollector& text, int x, float *m ){ if ( !text.GetToken( true ) || !strEqual( token, "(" ) ) { Error( "Parse1DMatrixAppend(): line %d: ( not found!\nFile location be: %s\n", scriptline, g_strLoadedFileLocation ); } - for ( int i = 0; i < x; i++ ) + for ( int i = 0; i < x; ++i ) { if ( !text.GetToken( false ) ) { Error( "Parse1DMatrixAppend(): line %d: Number not found!\nFile location be: %s\n", scriptline, g_strLoadedFileLocation ); @@ -1466,7 +1466,7 @@ static void ParseShaderFile( const char *filename ){ else if ( striEqual( token, "ivector" ) ) { Parse1DMatrixAppend( text, 3, si.vecs[ 0 ].data() ); Parse1DMatrixAppend( text, 3, si.vecs[ 1 ].data() ); - for ( size_t i = 0; i < 3; i++ ) + for ( size_t i = 0; i < 3; ++i ) { si.vecs[ 0 ][ i ] = si.vecs[ 0 ][ i ] ? 1.0 / si.vecs[ 0 ][ i ] : 0; si.vecs[ 1 ][ i ] = si.vecs[ 1 ][ i ] ? 1.0 / si.vecs[ 1 ][ i ] : 0; @@ -1832,7 +1832,7 @@ void LoadShaderInfo(){ const int count = vfsGetFileCount( filename ); /* load them all */ - for ( int i = 0; i < count; i++ ) + for ( int i = 0; i < count; ++i ) { /* load shader list */ LoadScriptFile( filename, i ); diff --git a/tools/quake3/q3map2/surface.cpp b/tools/quake3/q3map2/surface.cpp index c5b7272e..100152f5 100644 --- a/tools/quake3/q3map2/surface.cpp +++ b/tools/quake3/q3map2/surface.cpp @@ -258,7 +258,7 @@ void TidyEntitySurfaces( const entity_t& e ){ out = &mapDrawSurfs[ i ]; /* walk the surface list again until a proper surface is found */ - for ( ; j < numMapDrawSurfs; j++ ) + for ( ; j < numMapDrawSurfs; ++j ) { /* get in surface */ in = &mapDrawSurfs[ j ]; @@ -294,7 +294,7 @@ static Vector2 CalcSurfaceTextureBias( const mapDrawSurface_t *ds ){ Vector2 mins( 999999, 999999 ), maxs( -999999, -999999 ), bias; for ( const bspDrawVert_t& vert : Span( ds->verts, ds->numVerts ) ) { - for ( int j = 0; j < 2; j++ ) + for ( int j = 0; j < 2; ++j ) { value_minimize( mins[ j ], vert.st[ j ] ); value_maximize( maxs[ j ], vert.st[ j ] ); @@ -302,7 +302,7 @@ static Vector2 CalcSurfaceTextureBias( const mapDrawSurface_t *ds ){ } /* clamp to integer range and calculate surface bias values */ - for ( int i = 0; i < 2; i++ ) + for ( int i = 0; i < 2; ++i ) bias[ i ] = floor( 0.5f * ( mins[ i ] + maxs[ i ] ) ); return bias; @@ -378,7 +378,7 @@ void ClassifySurfaces( int numSurfs, mapDrawSurface_t *ds ){ /* walk the list of surfaces */ - for ( ; numSurfs > 0; numSurfs--, ds++ ) + for ( ; numSurfs > 0; --numSurfs, ++ds ) { /* ignore bogus (or flare) surfaces */ if ( ds->type == ESurfaceType::Bad || ds->numVerts <= 0 ) { @@ -493,10 +493,10 @@ void ClassifySurfaces( int numSurfs, mapDrawSurface_t *ds ){ { /* find best lightmap axis */ int bestAxis; - for ( bestAxis = 0; bestAxis < 6; bestAxis++ ) + for ( bestAxis = 0; bestAxis < 6; ++bestAxis ) { int i; - for ( i = 0; i < ds->numVerts; i++ ) + for ( i = 0; i < ds->numVerts; ++i ) { //% Sys_Printf( "Comparing %1.3f %1.3f %1.3f to %1.3f %1.3f %1.3f\n", //% ds->verts[ i ].normal[ 0 ], ds->verts[ i ].normal[ 1 ], ds->verts[ i ].normal[ 2 ], @@ -579,7 +579,7 @@ static byte GetShaderIndexForPoint( const indexMap_t *im, const MinMax& eMinmax, #if 0 /* legacy precision fudges for terrain */ Vector3 mins, maxs; - for ( int i = 0; i < 3; i++ ) + for ( int i = 0; i < 3; ++i ) { mins[ i ] = floor( eMinmax.mins[ i ] + 0.1 ); maxs[ i ] = floor( eMinmax.maxs[ i ] + 0.1 ); @@ -723,7 +723,7 @@ mapDrawSurface_t *DrawSurfaceForSide( const entity_t& e, const brush_t& b, const indexed = true; /* get shader indexes for each point */ - for ( size_t i = 0; i < w.size(); i++ ) + for ( size_t i = 0; i < w.size(); ++i ) { shaderIndexes[ i ] = GetShaderIndexForPoint( b.im, b.eMinmax, w[ i ] ); offsets[ i ] = b.im->offsets[ shaderIndexes[ i ] ]; @@ -768,7 +768,7 @@ mapDrawSurface_t *DrawSurfaceForSide( const entity_t& e, const brush_t& b, const ComputeAxisBase( mapplanes[ s.planenum ].normal(), texX, texY ); /* create the vertexes */ - for ( size_t j = 0; j < w.size(); j++ ) + for ( size_t j = 0; j < w.size(); ++j ) { /* get the drawvert */ dv = ds->verts + j; @@ -781,7 +781,7 @@ mapDrawSurface_t *DrawSurfaceForSide( const entity_t& e, const brush_t& b, const /* round the xyz to a given precision and translate by origin */ if( g_brushSnap ) - for ( size_t i = 0; i < 3; i++ ) + for ( size_t i = 0; i < 3; ++i ) dv->xyz[ i ] = SNAP_INT_TO_FLOAT * floor( dv->xyz[ i ] * SNAP_FLOAT_TO_INT + 0.5 ); vTranslated = dv->xyz + e.originbrush_origin; @@ -881,7 +881,7 @@ mapDrawSurface_t *DrawSurfaceForMesh( const entity_t& e, parseMesh_t *p, mesh_t /* store off the original (potentially bad) normals */ MakeMeshNormals( *copy ); - for ( i = 0; i < numVerts; i++ ) + for ( i = 0; i < numVerts; ++i ) mesh->verts[ i ].normal = copy->verts[ i ].normal; /* put the mesh on the curve */ @@ -889,7 +889,7 @@ mapDrawSurface_t *DrawSurfaceForMesh( const entity_t& e, parseMesh_t *p, mesh_t /* find new normals (to take into account degenerate/flipped edges */ MakeMeshNormals( *copy ); - for ( i = 0; i < numVerts; i++ ) + for ( i = 0; i < numVerts; ++i ) { /* ydnar: only copy normals that are significantly different from the originals */ if ( vector3_dot( copy->verts[ i ].normal, mesh->verts[ i ].normal ) < 0.75f ) { @@ -906,7 +906,7 @@ mapDrawSurface_t *DrawSurfaceForMesh( const entity_t& e, parseMesh_t *p, mesh_t indexed = true; /* get shader indexes for each point */ - for ( i = 0; i < numVerts; i++ ) + for ( i = 0; i < numVerts; ++i ) { shaderIndexes[ i ] = GetShaderIndexForPoint( p->im, p->eMinmax, mesh->verts[ i ].xyz ); offsets[ i ] = p->im->offsets[ shaderIndexes[ i ] ]; @@ -954,7 +954,7 @@ mapDrawSurface_t *DrawSurfaceForMesh( const entity_t& e, parseMesh_t *p, mesh_t } /* test each vert */ - for ( i = 1; i < ds->numVerts && planar; i++ ) + for ( i = 1; i < ds->numVerts && planar; ++i ) { /* normal test */ if ( !VectorCompare( plane.normal(), mesh->verts[ i ].normal ) ) { @@ -979,7 +979,7 @@ mapDrawSurface_t *DrawSurfaceForMesh( const entity_t& e, parseMesh_t *p, mesh_t } /* walk the verts to do special stuff */ - for ( i = 0; i < ds->numVerts; i++ ) + for ( i = 0; i < ds->numVerts; ++i ) { /* get the drawvert */ dv = &ds->verts[ i ]; @@ -1130,7 +1130,7 @@ static void SubdivideFace_r( const entity_t& e, const brush_t& brush, const side WindingExtendBounds( w, bounds ); /* split the face */ - for ( axis = 0; axis < 3; axis++ ) + for ( axis = 0; axis < 3; ++axis ) { Vector3 planePoint( 0 ); Plane3f plane( 0, 0, 0, 0 ); @@ -1419,7 +1419,7 @@ static void CullSides( entity_t& e ){ /* find first common point */ first = -1; - for ( k = 0; k < numPoints; k++ ) + for ( k = 0; k < numPoints; ++k ) { if ( VectorCompare( w1[ 0 ], w2[ k ] ) ) { first = k; @@ -1454,7 +1454,7 @@ static void CullSides( entity_t& e ){ /* compare the rest of the points */ l = first; - for ( k = 0; k < numPoints; k++ ) + for ( k = 0; k < numPoints; ++k ) { if ( !vector3_equal_epsilon( w1[ k ], w2[ l ], CULL_EPSILON ) ) { k = 100000; @@ -1752,7 +1752,7 @@ static int FilterWindingIntoTree_r( winding_t& w, mapDrawSurface_t *ds, node_t * /* 'fatten' the winding by the shader mins/maxs (parsed from vertexDeform move) */ /* note this winding is completely invalid (concave, nonplanar, etc) */ winding_t fat( w.size() * 3 + 3 ); - for ( size_t i = 0; i < w.size(); i++ ) + for ( size_t i = 0; i < w.size(); ++i ) { fat[ i ] = w[ i ]; fat[ i + ( w.size() + 1 ) ] = w[ i ] + si->minmax.mins; @@ -1953,7 +1953,7 @@ static int FilterFoliageIntoTree( mapDrawSurface_t *ds, tree_t& tree ){ /* walk origin list */ refs = 0; - for ( f = 0; f < ds->numFoliageInstances; f++ ) + for ( f = 0; f < ds->numFoliageInstances; ++f ) { /* get instance */ instance = ds->verts + ds->patchHeight + f; @@ -1977,7 +1977,7 @@ static int FilterFoliageIntoTree( mapDrawSurface_t *ds, tree_t& tree ){ } /* use point filtering as well */ - for ( i = 0; i < ( ds->numVerts - ds->numFoliageInstances ); i++ ) + for ( i = 0; i < ( ds->numVerts - ds->numFoliageInstances ); ++i ) { refs += FilterPointIntoTree_r( instance->xyz + ds->verts[ i ].xyz, ds, tree.headnode ); } @@ -2060,7 +2060,7 @@ static int FindDrawIndexes( int numIndexes, const int *indexes ){ /* handle 3 indexes as a special case for performance */ if ( numIndexes == 3 ) { /* run through all indexes */ - for ( i = 0; i < numTestIndexes; i++ ) + for ( i = 0; i < numTestIndexes; ++i ) { /* test 3 indexes */ if ( indexes[ 0 ] == bspDrawIndexes[ i ] && @@ -2076,7 +2076,7 @@ static int FindDrawIndexes( int numIndexes, const int *indexes ){ } /* handle 4 or more indexes */ - for ( i = 0; i < numTestIndexes; i++ ) + for ( i = 0; i < numTestIndexes; ++i ) { /* test first 4 indexes */ if ( indexes[ 0 ] == bspDrawIndexes[ i ] && @@ -2089,7 +2089,7 @@ static int FindDrawIndexes( int numIndexes, const int *indexes ){ } /* test the remainder */ - for ( j = 4; j < numIndexes; j++ ) + for ( j = 4; j < numIndexes; ++j ) { if ( indexes[ j ] != bspDrawIndexes[ i + j ] ) { break; @@ -2119,7 +2119,7 @@ static void EmitDrawIndexes( const mapDrawSurface_t *ds, bspDrawSurface_t& out ) out.numIndexes = ds->numIndexes; if ( out.firstIndex == int( bspDrawIndexes.size() ) ) { /* copy new unique indexes */ - for ( int i = 0; i < ds->numIndexes; i++ ) + for ( int i = 0; i < ds->numIndexes; ++i ) { auto& index = bspDrawIndexes.emplace_back( ds->indexes[ i ] ); @@ -2162,7 +2162,7 @@ static void EmitFlareSurface( mapDrawSurface_t *ds ){ out.fogNum = ds->fogNum; /* RBSP */ - for ( int i = 0; i < MAX_LIGHTMAPS; i++ ) + for ( int i = 0; i < MAX_LIGHTMAPS; ++i ) { out.lightmapNum[ i ] = -3; out.lightmapStyles[ i ] = LS_NONE; @@ -2196,9 +2196,9 @@ static void EmitPatchSurface( const entity_t& e, mapDrawSurface_t *ds ){ vector3_negate( vert.normal ); /* walk the verts again, but this time reverse their order */ - for ( int j = 0; j < ds->patchHeight; j++ ) + for ( int j = 0; j < ds->patchHeight; ++j ) { - for ( int i = 0; i < ( ds->patchWidth / 2 ); i++ ) + for ( int i = 0; i < ( ds->patchWidth / 2 ); ++i ) { std::swap( ds->verts[ j * ds->patchWidth + i ], ds->verts[ j * ds->patchWidth + ( ds->patchWidth - i - 1 ) ] ); @@ -2241,7 +2241,7 @@ static void EmitPatchSurface( const entity_t& e, mapDrawSurface_t *ds ){ out.fogNum = ds->fogNum; /* RBSP */ - for ( int i = 0; i < MAX_LIGHTMAPS; i++ ) + for ( int i = 0; i < MAX_LIGHTMAPS; ++i ) { out.lightmapNum[ i ] = -3; out.lightmapStyles[ i ] = LS_NONE; @@ -2376,7 +2376,7 @@ static void OptimizeTriangleSurface( mapDrawSurface_t *ds ){ memcpy( indexes, ds->indexes, ds->numIndexes * sizeof( *indexes ) ); /* setup */ - for ( i = 0; i <= VERTEX_CACHE_SIZE && i < ds->numIndexes; i++ ) + for ( i = 0; i <= VERTEX_CACHE_SIZE && i < ds->numIndexes; ++i ) vertexCache[ i ] = indexes[ i ]; /* add triangles in a vertex cache-aware order */ @@ -2397,7 +2397,7 @@ static void OptimizeTriangleSurface( mapDrawSurface_t *ds ){ /* score the triangle */ score = 0; - for ( k = 0; k < VERTEX_CACHE_SIZE; k++ ) + for ( k = 0; k < VERTEX_CACHE_SIZE; ++k ) { if ( indexes[ j ] == vertexCache[ k ] || indexes[ j + 1 ] == vertexCache[ k ] || indexes[ j + 2 ] == vertexCache[ k ] ) { score++; @@ -2425,9 +2425,9 @@ static void OptimizeTriangleSurface( mapDrawSurface_t *ds ){ /* valid triangle? */ if ( best >= 0 ) { /* add triangle to vertex cache */ - for ( j = 0; j < 3; j++ ) + for ( j = 0; j < 3; ++j ) { - for ( k = 0; k < VERTEX_CACHE_SIZE; k++ ) + for ( k = 0; k < VERTEX_CACHE_SIZE; ++k ) { if ( indexes[ best + j ] == vertexCache[ k ] ) { break; @@ -2436,7 +2436,7 @@ static void OptimizeTriangleSurface( mapDrawSurface_t *ds ){ if ( k >= VERTEX_CACHE_SIZE ) { /* pop off top of vertex cache */ - for ( k = VERTEX_CACHE_SIZE; k > 0; k-- ) + for ( k = VERTEX_CACHE_SIZE; k > 0; --k ) vertexCache[ k ] = vertexCache[ k - 1 ]; /* add vertex */ @@ -2557,7 +2557,7 @@ static void EmitTriangleSurface( mapDrawSurface_t *ds ){ } /* RBSP */ - for ( int i = 0; i < MAX_LIGHTMAPS; i++ ) + for ( int i = 0; i < MAX_LIGHTMAPS; ++i ) { out.lightmapNum[ i ] = -3; out.lightmapStyles[ i ] = LS_NONE; @@ -2946,7 +2946,7 @@ static int AddSurfaceModels( mapDrawSurface_t *ds, entity_t& entity ){ centroid.color[ 0 ] = { 255, 255, 255, color_to_byte( alpha / ds->numVerts ) }; /* walk fanned triangles */ - for ( int i = 0; i < ds->numVerts; i++ ) + for ( int i = 0; i < ds->numVerts; ++i ) { /* create models */ const int n = AddSurfaceModelsToTriangle_r( ds, model, TriRef{ @@ -2978,9 +2978,9 @@ static int AddSurfaceModels( mapDrawSurface_t *ds, entity_t& entity ){ FreeMesh( subdivided ); /* subdivide each quad to place the models */ - for ( int y = 0; y < ( mesh->height - 1 ); y++ ) + for ( int y = 0; y < ( mesh->height - 1 ); ++y ) { - for ( int x = 0; x < ( mesh->width - 1 ); x++ ) + for ( int x = 0; x < ( mesh->width - 1 ); ++x ) { /* set indexes */ const int pw[ 5 ] = { diff --git a/tools/quake3/q3map2/surface_foliage.cpp b/tools/quake3/q3map2/surface_foliage.cpp index dcd730be..d166d84d 100644 --- a/tools/quake3/q3map2/surface_foliage.cpp +++ b/tools/quake3/q3map2/surface_foliage.cpp @@ -79,7 +79,7 @@ static void SubdivideFoliageTriangle_r( mapDrawSurface_t *ds, const foliage_t& f float maxDist = 0.0f; fi->xyz.set( 0 ); fi->normal.set( 0 ); - for ( int i = 0; i < 3; i++ ) + for ( int i = 0; i < 3; ++i ) { const float dist = vector3_length_squared( tri[ i ]->xyz - tri[ ( i + 1 ) % 3 ]->xyz ); @@ -204,9 +204,9 @@ void Foliage( mapDrawSurface_t *src, entity_t& entity ){ const bspDrawVert_t *verts = mesh->verts; /* map the mesh quads */ - for ( int y = 0; y < ( mesh->height - 1 ); y++ ) + for ( int y = 0; y < ( mesh->height - 1 ); ++y ) { - for ( int x = 0; x < ( mesh->width - 1 ); x++ ) + for ( int x = 0; x < ( mesh->width - 1 ); ++x ) { /* set indexes */ const int pw[ 5 ] = { @@ -254,7 +254,7 @@ void Foliage( mapDrawSurface_t *src, entity_t& entity ){ InsertModel( foliage.model.c_str(), NULL, 0, matrix4_scale_for_vec3( Vector3( foliage.scale ) ), NULL, NULL, entity, src->castShadows, src->recvShadows, 0, src->lightmapScale, 0, 0, clipDepthGlobal ); /* walk each new surface */ - for ( int i = oldNumMapDrawSurfs; i < numMapDrawSurfs; i++ ) + for ( int i = oldNumMapDrawSurfs; i < numMapDrawSurfs; ++i ) { /* get surface */ mapDrawSurface_t& ds = mapDrawSurfs[ i ]; @@ -277,7 +277,7 @@ void Foliage( mapDrawSurface_t *src, entity_t& entity ){ ds.verts = verts; /* copy the verts */ - for ( int j = 0; j < ds.numFoliageInstances; j++ ) + for ( int j = 0; j < ds.numFoliageInstances; ++j ) { /* get vert (foliage instance) */ bspDrawVert_t& fi = ds.verts[ ds.numVerts + j ]; diff --git a/tools/quake3/q3map2/surface_meta.cpp b/tools/quake3/q3map2/surface_meta.cpp index 37f53181..a37baae9 100644 --- a/tools/quake3/q3map2/surface_meta.cpp +++ b/tools/quake3/q3map2/surface_meta.cpp @@ -395,9 +395,9 @@ static void TriangulatePatchSurface( const entity_t& e, mapDrawSurface_t *ds ){ ds->verts = mesh->verts; /* iterate through the mesh quads */ - for ( int y = 0; y < ( mesh->height - 1 ); y++ ) + for ( int y = 0; y < ( mesh->height - 1 ); ++y ) { - for ( int x = 0; x < ( mesh->width - 1 ); x++ ) + for ( int x = 0; x < ( mesh->width - 1 ); ++x ) { /* set indexes */ const int pw[ 5 ] = { @@ -666,12 +666,12 @@ static void FanFaceSurface( mapDrawSurface_t *ds ){ /* add up the drawverts to create a centroid */ centroid = &verts[ 0 ]; - for ( i = 1, dv = &verts[ 1 ]; i < ( ds->numVerts + 1 ); i++, dv++ ) + for ( i = 1, dv = &verts[ 1 ]; i < ( ds->numVerts + 1 ); ++i, ++dv ) { centroid->xyz += dv->xyz; centroid->normal += dv->normal; centroid->st += dv->st; - for ( k = 0; k < MAX_LIGHTMAPS; k++ ){ + for ( k = 0; k < MAX_LIGHTMAPS; ++k ){ color[ k ] += dv->color[ k ]; centroid->lightmap[ k ] += dv->lightmap[ k ]; } @@ -684,7 +684,7 @@ static void FanFaceSurface( mapDrawSurface_t *ds ){ centroid->normal = verts[ 1 ].normal; } centroid->st *= iv; - for ( k = 0; k < MAX_LIGHTMAPS; k++ ){ + for ( k = 0; k < MAX_LIGHTMAPS; ++k ){ centroid->lightmap[ k ] *= iv; centroid->color[ k ] = color_to_byte( color[ k ] / ds->numVerts ); } @@ -695,7 +695,7 @@ static void FanFaceSurface( mapDrawSurface_t *ds ){ /* fill indexes in triangle fan order */ ds->numIndexes = 0; ds->indexes = safe_malloc( ds->numVerts * 3 * sizeof( int ) ); - for ( i = 1; i < ds->numVerts; i++ ) + for ( i = 1; i < ds->numVerts; ++i ) { a = 0; b = i; @@ -743,7 +743,7 @@ void StripFaceSurface( mapDrawSurface_t *ds ){ /* ydnar: find smallest coordinate */ int least = 0; if ( ds->shaderInfo != NULL && !ds->shaderInfo->autosprite ) { - for ( int i = 0; i < ds->numVerts; i++ ) + for ( int i = 0; i < ds->numVerts; ++i ) { /* get points */ const Vector3& v1 = ds->verts[ i ].xyz; @@ -998,7 +998,7 @@ void FixMetaTJunctions(){ /* walk triangle list */ numTJuncs = 0; - for ( i = 0; i < numMetaTriangles; i++ ) + for ( i = 0; i < numMetaTriangles; ++i ) { /* get triangle */ tri = &metaTriangles[ i ]; @@ -1022,7 +1022,7 @@ void FixMetaTJunctions(){ CreateEdge( plane, metaVerts[ tri->indexes[ 2 ] ].xyz, metaVerts[ tri->indexes[ 0 ] ].xyz, &edges[ 2 ] ); /* walk meta vert list */ - for ( j = 0; j < numMetaVerts; j++ ) + for ( j = 0; j < numMetaVerts; ++j ) { /* get vert */ const Vector3 pt = metaVerts[ j ].xyz; @@ -1033,7 +1033,7 @@ void FixMetaTJunctions(){ } /* skip this point if it already exists in the triangle */ - for ( k = 0; k < 3; k++ ) + for ( k = 0; k < 3; ++k ) { if ( vector3_equal_epsilon( pt, metaVerts[ tri->indexes[ k ] ].xyz, TJ_POINT_EPSILON ) ) { break; @@ -1044,7 +1044,7 @@ void FixMetaTJunctions(){ } /* walk edges */ - for ( k = 0; k < 3; k++ ) + for ( k = 0; k < 3; ++k ) { /* ignore bogus edges */ if ( fabs( edges[ k ].kingpinLength ) < TJ_EDGE_EPSILON ) { @@ -1424,7 +1424,7 @@ static int AddMetaTriangleToSurface( mapDrawSurface_t *ds, const metaTriangle_t& /* 2004-02-24: scale lightmap test size by 2 to catch larger brush faces */ /* 2004-04-11: reverting to actual lightmap size */ const float lmMax = ( ds->sampleSize * ( ds->shaderInfo->lmCustomWidth - 1 ) ); - for ( i = 0; i < 3; i++ ) + for ( i = 0; i < 3; ++i ) { if ( ( minmax.maxs[ i ] - minmax.mins[ i ] ) > lmMax ) { memcpy( ds, &old, sizeof( *ds ) ); diff --git a/tools/quake3/q3map2/tjunction.cpp b/tools/quake3/q3map2/tjunction.cpp index 52329532..9c1e6535 100644 --- a/tools/quake3/q3map2/tjunction.cpp +++ b/tools/quake3/q3map2/tjunction.cpp @@ -169,7 +169,7 @@ static int AddEdge( bspDrawVert_t& dv1, bspDrawVert_t& dv2, bool createNonAxial */ static void AddSurfaceEdges( mapDrawSurface_t& ds ){ - for ( int i = 0; i < ds.numVerts; i++ ) + for ( int i = 0; i < ds.numVerts; ++i ) { /* save the edge number in the lightmap field so we don't need to look it up again */ bspDrawVert_edge_index_write( ds.verts[ i ], AddEdge( ds.verts[ i ], ds.verts[ ( i + 1 ) % ds.numVerts ], false ) ); diff --git a/tools/quake3/q3map2/tree.cpp b/tools/quake3/q3map2/tree.cpp index 0992da05..a87ee050 100644 --- a/tools/quake3/q3map2/tree.cpp +++ b/tools/quake3/q3map2/tree.cpp @@ -103,7 +103,7 @@ void FreeTree( tree_t& tree ){ //=============================================================== static void PrintTree_r( const node_t *node, int depth ){ - for ( int i = 0; i < depth; i++ ) + for ( int i = 0; i < depth; ++i ) Sys_Printf( " " ); if ( node->planenum == PLANENUM_LEAF ) { if ( node->brushlist.empty() ) { diff --git a/tools/quake3/q3map2/vis.cpp b/tools/quake3/q3map2/vis.cpp index a180d97f..9ba8473a 100644 --- a/tools/quake3/q3map2/vis.cpp +++ b/tools/quake3/q3map2/vis.cpp @@ -524,15 +524,15 @@ static fixedWinding_t *TryMergeWinding( fixedWinding_t *f1, fixedWinding_t *f2, p1 = p2 = NULL; // stop compiler warning j = 0; // - for ( i = 0; i < f1->numpoints; i++ ) + for ( i = 0; i < f1->numpoints; ++i ) { p1 = &f1->points[i]; p2 = &f1->points[( i + 1 ) % f1->numpoints]; - for ( j = 0; j < f2->numpoints; j++ ) + for ( j = 0; j < f2->numpoints; ++j ) { p3 = &f2->points[j]; p4 = &f2->points[( j + 1 ) % f2->numpoints]; - for ( k = 0; k < 3; k++ ) + for ( k = 0; k < 3; ++k ) { if ( fabs( ( *p1 )[k] - ( *p4 )[k] ) > 0.1 ) { //EQUAL_EPSILON) //ME break; @@ -620,19 +620,19 @@ static void MergeLeafPortals(){ nummerges = 0; hintsmerged = 0; - for ( i = 0; i < portalclusters; i++ ) + for ( i = 0; i < portalclusters; ++i ) { leaf = &leafs[i]; if ( leaf->merged >= 0 ) { continue; } - for ( j = 0; j < leaf->numportals; j++ ) + for ( j = 0; j < leaf->numportals; ++j ) { p1 = leaf->portals[j]; if ( p1->removed ) { continue; } - for ( k = j + 1; k < leaf->numportals; k++ ) + for ( k = j + 1; k < leaf->numportals; ++k ) { p2 = leaf->portals[k]; if ( p2->removed ) { diff --git a/tools/quake3/q3map2/visflow.cpp b/tools/quake3/q3map2/visflow.cpp index f8eac5e9..cd274dc2 100644 --- a/tools/quake3/q3map2/visflow.cpp +++ b/tools/quake3/q3map2/visflow.cpp @@ -416,7 +416,7 @@ static void RecursiveLeafFlow( int leafnum, threaddata_t *thread, pstack_t *prev pstack_t *s; s = &thread->pstack_head; - for ( j = 0; s->next && j < sizeof( portaltrace ) / sizeof( int ) - 1; j++, s = s->next ) + for ( j = 0; s->next && j < sizeof( portaltrace ) / sizeof( int ) - 1; ++j, s = s->next ) { if ( s->portal->num != portaltrace[j] ) break; @@ -530,7 +530,7 @@ static void RecursiveLeafFlow( int leafnum, threaddata_t *thread, pstack_t *prev #ifdef SEPERATORCACHE if ( stack.numseperators[0] ) { - for ( n = 0; n < stack.numseperators[0]; n++ ) + for ( n = 0; n < stack.numseperators[0]; ++n ) { stack.pass = VisChopWinding( stack.pass, &stack, stack.seperators[0][n] ); if ( !stack.pass ) { @@ -554,7 +554,7 @@ static void RecursiveLeafFlow( int leafnum, threaddata_t *thread, pstack_t *prev #ifdef SEPERATORCACHE if ( stack.numseperators[1] ) { - for ( n = 0; n < stack.numseperators[1]; n++ ) + for ( n = 0; n < stack.numseperators[1]; ++n ) { stack.pass = VisChopWinding( stack.pass, &stack, stack.seperators[1][n] ); if ( !stack.pass ) { @@ -654,7 +654,7 @@ static void RecursivePassageFlow( vportal_t *portal, threaddata_t *thread, pstac passage = portal->passages; nextpassage = passage; // check all portals for flowing into other leafs - for ( i = 0; i < leaf->numportals; i++, passage = nextpassage ) + for ( i = 0; i < leaf->numportals; ++i, passage = nextpassage ) { p = leaf->portals[i]; if ( p->removed ) { @@ -681,7 +681,7 @@ static void RecursivePassageFlow( vportal_t *portal, threaddata_t *thread, pstac portalvis = (long *) p->portalflood; } more = 0; - for ( j = 0; j < portallongs; j++ ) + for ( j = 0; j < portallongs; ++j ) { if ( *might ) { *might &= *cansee & *portalvis; @@ -786,7 +786,7 @@ static void RecursivePassagePortalFlow( vportal_t *portal, threaddata_t *thread, passage = portal->passages; nextpassage = passage; // check all portals for flowing into other leafs - for ( i = 0; i < leaf->numportals; i++, passage = nextpassage ) + for ( i = 0; i < leaf->numportals; ++i, passage = nextpassage ) { p = leaf->portals[i]; if ( p->removed ) { @@ -810,7 +810,7 @@ static void RecursivePassagePortalFlow( vportal_t *portal, threaddata_t *thread, portalvis = (long *) p->portalflood; } more = 0; - for ( j = 0; j < portallongs; j++ ) + for ( j = 0; j < portallongs; ++j ) { if ( *might ) { *might &= *cansee & *portalvis; @@ -900,7 +900,7 @@ static void RecursivePassagePortalFlow( vportal_t *portal, threaddata_t *thread, #ifdef SEPERATORCACHE if ( stack.numseperators[0] ) { - for ( n = 0; n < stack.numseperators[0]; n++ ) + for ( n = 0; n < stack.numseperators[0]; ++n ) { stack.pass = VisChopWinding( stack.pass, &stack, stack.seperators[0][n] ); if ( !stack.pass ) { @@ -924,7 +924,7 @@ static void RecursivePassagePortalFlow( vportal_t *portal, threaddata_t *thread, #ifdef SEPERATORCACHE if ( stack.numseperators[1] ) { - for ( n = 0; n < stack.numseperators[1]; n++ ) + for ( n = 0; n < stack.numseperators[1]; ++n ) { stack.pass = VisChopWinding( stack.pass, &stack, stack.seperators[1][n] ); if ( !stack.pass ) { @@ -1265,7 +1265,7 @@ void CreatePassages( int portalnum ){ numsee = 0; //create the passage->cansee - for ( j = 0; j < numportals * 2; j++ ) + for ( j = 0; j < numportals * 2; ++j ) { p = &portals[j]; if ( p->removed ) { @@ -1277,14 +1277,14 @@ void CreatePassages( int portalnum ){ if ( !bit_is_enabled( portal->portalflood, j ) ) { continue; } - for ( k = 0; k < numseperators; k++ ) + for ( k = 0; k < numseperators; ++k ) { //if completely at the back of the separator plane if ( plane3_distance_to_point( seperators[k], p->origin ) < -p->radius + ON_EPSILON ) { break; } w = p->winding; - for ( n = 0; n < w->numpoints; n++ ) + for ( n = 0; n < w->numpoints; ++n ) { //if at the front of the separator if ( plane3_distance_to_point( seperators[k], w->points[n] ) > ON_EPSILON ) { @@ -1313,7 +1313,7 @@ void CreatePassages( int portalnum ){ } - for ( k = 0; k < numseperators; k++ ) + for ( k = 0; k < numseperators; ++k ) { /* ydnar: this is a shitty crutch */ //% if ( in.numpoints > MAX_POINTS_ON_FIXED_WINDING ) Sys_Printf( "[%d]", p->winding->numpoints ); diff --git a/tools/quake3/q3map2/writebsp.cpp b/tools/quake3/q3map2/writebsp.cpp index f625615e..aec98df8 100644 --- a/tools/quake3/q3map2/writebsp.cpp +++ b/tools/quake3/q3map2/writebsp.cpp @@ -268,7 +268,7 @@ void SetLightStyles(){ } /* find this targetname */ - for ( j = 0; j < numStyles; j++ ) + for ( j = 0; j < numStyles; ++j ) if ( lightStyles[ j ] == style && strEqual( lightTargets[ j ], t ) ) { break; }