diff --git a/neo/cm/CollisionModel_load.cpp b/neo/cm/CollisionModel_load.cpp index 234d7a36..e12a0e90 100644 --- a/neo/cm/CollisionModel_load.cpp +++ b/neo/cm/CollisionModel_load.cpp @@ -2025,8 +2025,8 @@ idCollisionModelManagerLocal::R_CreateAxialBSPTree ================ */ cm_node_t *idCollisionModelManagerLocal::R_CreateAxialBSPTree( cm_model_t *model, cm_node_t *node, const idBounds &bounds ) { - int planeType; - float planeDist; + int planeType = 0; + float planeDist = 0.0f; cm_polygonRef_t *pref, *nextpref, *prevpref; cm_brushRef_t *bref, *nextbref, *prevbref; cm_node_t *frontNode, *backNode, *n; diff --git a/neo/d3xp/AFEntity.cpp b/neo/d3xp/AFEntity.cpp index 9a3c1d81..f730640f 100644 --- a/neo/d3xp/AFEntity.cpp +++ b/neo/d3xp/AFEntity.cpp @@ -3215,7 +3215,7 @@ void idHarvestable::Init(idEntity* parent) { parent->SetSkin(declManager->FindSkin(skin.c_str())); } - idEntity* head; + idEntity* head = NULL; if(parent->IsType(idActor::Type)) { idActor* withHead = (idActor*)parent; head = withHead->GetHeadEntity(); @@ -3358,7 +3358,7 @@ void idHarvestable::BeginBurn() { parent->GetRenderEntity()->noShadow = true; parent->SetShaderParm( SHADERPARM_TIME_OF_DEATH, gameLocal.slow.time * 0.001f ); - idEntity* head; + idEntity* head = NULL; if(parent->IsType(idActor::Type)) { idActor* withHead = (idActor*)parent; head = withHead->GetHeadEntity(); diff --git a/neo/d3xp/Entity.h b/neo/d3xp/Entity.h index 7d910081..0fe5fb7e 100644 --- a/neo/d3xp/Entity.h +++ b/neo/d3xp/Entity.h @@ -561,10 +561,12 @@ public: ID_INLINE SetTimeState::SetTimeState() { activated = false; + previousFast = false; } ID_INLINE SetTimeState::SetTimeState( int timeGroup ) { activated = false; + previousFast = false; PushState( timeGroup ); } diff --git a/neo/d3xp/IK.cpp b/neo/d3xp/IK.cpp index 1844ba2e..740accb5 100644 --- a/neo/d3xp/IK.cpp +++ b/neo/d3xp/IK.cpp @@ -561,7 +561,7 @@ idIK_Walk::Evaluate ================ */ void idIK_Walk::Evaluate( void ) { - int i, newPivotFoot; + int i, newPivotFoot = 0; float modelHeight, jointHeight, lowestHeight, floorHeights[MAX_LEGS]; float shift, smallestShift, newHeight, step, newPivotYaw, height, largestAnkleHeight; idVec3 modelOrigin, normal, hipDir, kneeDir, start, end, jointOrigins[MAX_LEGS]; diff --git a/neo/d3xp/SmokeParticles.cpp b/neo/d3xp/SmokeParticles.cpp index 66ee8547..8eafa859 100644 --- a/neo/d3xp/SmokeParticles.cpp +++ b/neo/d3xp/SmokeParticles.cpp @@ -251,7 +251,7 @@ bool idSmokeParticles::EmitSmoke( const idDeclParticle *smoke, const int systemS } // find an activeSmokeStage that matches this - activeSmokeStage_t *active; + activeSmokeStage_t *active = NULL; int i; for ( i = 0 ; i < activeStages.Num() ; i++ ) { active = &activeStages[i]; diff --git a/neo/d3xp/ai/AI_pathing.cpp b/neo/d3xp/ai/AI_pathing.cpp index 600a92b4..3dafa622 100644 --- a/neo/d3xp/ai/AI_pathing.cpp +++ b/neo/d3xp/ai/AI_pathing.cpp @@ -185,6 +185,9 @@ void GetPointOutsideObstacles( const obstacle_t *obstacles, const int numObstacl } } + if (i == 0) + return; + newPoint = point - ( bestd + PUSH_OUTSIDE_OBSTACLES ) * bestPlane.ToVec2(); if ( PointInsideObstacle( obstacles, numObstacles, newPoint ) == -1 ) { point = newPoint; @@ -423,6 +426,7 @@ int GetObstacles( const idPhysics *physics, const idAAS *aas, const idEntity *ig lastVerts[0] = lastVerts[1] = 0; lastEdgeNormal.Zero(); + nextEdgeNormal.Zero(); nextVerts[0] = nextVerts[1] = 0; for ( i = 0; i < numWallEdges && numObstacles < MAX_OBSTACLES; i++ ) { aas->GetEdge( wallEdges[i], start, end ); diff --git a/neo/d3xp/physics/Force_Field.cpp b/neo/d3xp/physics/Force_Field.cpp index 23f50af9..8db70222 100644 --- a/neo/d3xp/physics/Force_Field.cpp +++ b/neo/d3xp/physics/Force_Field.cpp @@ -161,6 +161,8 @@ void idForce_Field::Evaluate( int time ) { bounds.FromTransformedBounds( clipModel->GetBounds(), clipModel->GetOrigin(), clipModel->GetAxis() ); numClipModels = gameLocal.clip.ClipModelsTouchingBounds( bounds, -1, clipModelList, MAX_GENTITIES ); + torque.Zero(); + for ( i = 0; i < numClipModels; i++ ) { cm = clipModelList[ i ]; @@ -208,7 +210,7 @@ void idForce_Field::Evaluate( int time ) { } default: { gameLocal.Error( "idForce_Field: invalid type" ); - break; + return; } } @@ -250,7 +252,7 @@ void idForce_Field::Evaluate( int time ) { } default: { gameLocal.Error( "idForce_Field: invalid apply type" ); - break; + return; } } } diff --git a/neo/d3xp/physics/Physics_AF.cpp b/neo/d3xp/physics/Physics_AF.cpp index 916c78a2..7bc55c66 100644 --- a/neo/d3xp/physics/Physics_AF.cpp +++ b/neo/d3xp/physics/Physics_AF.cpp @@ -633,6 +633,7 @@ void idAFConstraint_BallAndSocketJoint::Evaluate( float invTimeStep ) { c1.SubVec3(0) = -( invTimeStep * ERROR_REDUCTION ) * ( a2 + master->GetWorldOrigin() - ( a1 + body1->GetWorldOrigin() ) ); } else { + a2.Zero(); c1.SubVec3(0) = -( invTimeStep * ERROR_REDUCTION ) * ( anchor2 - ( a1 + body1->GetWorldOrigin() ) ); } @@ -4481,7 +4482,7 @@ idAFTree::Factor void idAFTree::Factor( void ) const { int i, j; idAFBody *body; - idAFConstraint *child; + idAFConstraint *child = NULL; idMatX childI; childI.SetData( 6, 6, MATX_ALLOCA( 6 * 6 ) ); diff --git a/neo/framework/DeclParticle.cpp b/neo/framework/DeclParticle.cpp index 6d29e088..87d15851 100644 --- a/neo/framework/DeclParticle.cpp +++ b/neo/framework/DeclParticle.cpp @@ -937,6 +937,9 @@ void idParticleStage::ParticleOrigin( particleGen_t *g, idVec3 &origin ) const { dir.Normalize(); dir[2] += directionParms[0]; break; + default: + common->Error( "idParticleStage::ParticleOrigin: bad direction" ); + return; } } @@ -1044,6 +1047,8 @@ int idParticleStage::ParticleVerts( particleGen_t *g, idVec3 origin, idDrawVert int numTrails = idMath::Ftoi( orientationParms[0] ); float trailTime = orientationParms[1]; + stepLeft.Zero(); + if ( trailTime == 0 ) { trailTime = 0.5f; } diff --git a/neo/game/IK.cpp b/neo/game/IK.cpp index 1844ba2e..740accb5 100644 --- a/neo/game/IK.cpp +++ b/neo/game/IK.cpp @@ -561,7 +561,7 @@ idIK_Walk::Evaluate ================ */ void idIK_Walk::Evaluate( void ) { - int i, newPivotFoot; + int i, newPivotFoot = 0; float modelHeight, jointHeight, lowestHeight, floorHeights[MAX_LEGS]; float shift, smallestShift, newHeight, step, newPivotYaw, height, largestAnkleHeight; idVec3 modelOrigin, normal, hipDir, kneeDir, start, end, jointOrigins[MAX_LEGS]; diff --git a/neo/game/SmokeParticles.cpp b/neo/game/SmokeParticles.cpp index 6a64d0ff..4c26b1ae 100644 --- a/neo/game/SmokeParticles.cpp +++ b/neo/game/SmokeParticles.cpp @@ -237,7 +237,7 @@ bool idSmokeParticles::EmitSmoke( const idDeclParticle *smoke, const int systemS } // find an activeSmokeStage that matches this - activeSmokeStage_t *active; + activeSmokeStage_t *active = NULL; int i; for ( i = 0 ; i < activeStages.Num() ; i++ ) { active = &activeStages[i]; diff --git a/neo/game/ai/AI_pathing.cpp b/neo/game/ai/AI_pathing.cpp index 3a48505f..308e6128 100644 --- a/neo/game/ai/AI_pathing.cpp +++ b/neo/game/ai/AI_pathing.cpp @@ -185,6 +185,9 @@ void GetPointOutsideObstacles( const obstacle_t *obstacles, const int numObstacl } } + if (i == 0) + return; + newPoint = point - ( bestd + PUSH_OUTSIDE_OBSTACLES ) * bestPlane.ToVec2(); if ( PointInsideObstacle( obstacles, numObstacles, newPoint ) == -1 ) { point = newPoint; @@ -423,6 +426,7 @@ int GetObstacles( const idPhysics *physics, const idAAS *aas, const idEntity *ig lastVerts[0] = lastVerts[1] = 0; lastEdgeNormal.Zero(); + nextEdgeNormal.Zero(); nextVerts[0] = nextVerts[1] = 0; for ( i = 0; i < numWallEdges && numObstacles < MAX_OBSTACLES; i++ ) { aas->GetEdge( wallEdges[i], start, end ); diff --git a/neo/game/physics/Force_Field.cpp b/neo/game/physics/Force_Field.cpp index 23f50af9..8db70222 100644 --- a/neo/game/physics/Force_Field.cpp +++ b/neo/game/physics/Force_Field.cpp @@ -161,6 +161,8 @@ void idForce_Field::Evaluate( int time ) { bounds.FromTransformedBounds( clipModel->GetBounds(), clipModel->GetOrigin(), clipModel->GetAxis() ); numClipModels = gameLocal.clip.ClipModelsTouchingBounds( bounds, -1, clipModelList, MAX_GENTITIES ); + torque.Zero(); + for ( i = 0; i < numClipModels; i++ ) { cm = clipModelList[ i ]; @@ -208,7 +210,7 @@ void idForce_Field::Evaluate( int time ) { } default: { gameLocal.Error( "idForce_Field: invalid type" ); - break; + return; } } @@ -250,7 +252,7 @@ void idForce_Field::Evaluate( int time ) { } default: { gameLocal.Error( "idForce_Field: invalid apply type" ); - break; + return; } } } diff --git a/neo/game/physics/Physics_AF.cpp b/neo/game/physics/Physics_AF.cpp index 39c2515b..8c8bc0d7 100644 --- a/neo/game/physics/Physics_AF.cpp +++ b/neo/game/physics/Physics_AF.cpp @@ -633,6 +633,7 @@ void idAFConstraint_BallAndSocketJoint::Evaluate( float invTimeStep ) { c1.SubVec3(0) = -( invTimeStep * ERROR_REDUCTION ) * ( a2 + master->GetWorldOrigin() - ( a1 + body1->GetWorldOrigin() ) ); } else { + a2.Zero(); c1.SubVec3(0) = -( invTimeStep * ERROR_REDUCTION ) * ( anchor2 - ( a1 + body1->GetWorldOrigin() ) ); } @@ -4480,7 +4481,7 @@ idAFTree::Factor void idAFTree::Factor( void ) const { int i, j; idAFBody *body; - idAFConstraint *child; + idAFConstraint *child = NULL; idMatX childI; childI.SetData( 6, 6, MATX_ALLOCA( 6 * 6 ) ); diff --git a/neo/idlib/geometry/Surface.cpp b/neo/idlib/geometry/Surface.cpp index eb45485f..d3b19fcd 100644 --- a/neo/idlib/geometry/Surface.cpp +++ b/neo/idlib/geometry/Surface.cpp @@ -680,7 +680,8 @@ bool idSurface::IsPolytope( const float epsilon ) const { } for ( i = 0; i < indexes.Num(); i += 3 ) { - plane.FromPoints( verts[indexes[i+0]].xyz, verts[indexes[i+1]].xyz, verts[indexes[i+2]].xyz ); + if (!plane.FromPoints( verts[indexes[i+0]].xyz, verts[indexes[i+1]].xyz, verts[indexes[i+2]].xyz )) + return false; for ( j = 0; j < verts.Num(); j++ ) { if ( plane.Side( verts[j].xyz, epsilon ) == SIDE_FRONT ) { @@ -784,7 +785,7 @@ idSurface::RayIntersection */ bool idSurface::RayIntersection( const idVec3 &start, const idVec3 &dir, float &scale, bool backFaceCull ) const { int i, i0, i1, i2, s0, s1, s2; - float d, s; + float d, s = 0.0f; byte *sidedness; idPluecker rayPl, pl; idPlane plane; @@ -811,13 +812,15 @@ bool idSurface::RayIntersection( const idVec3 &start, const idVec3 &dir, float & s2 = sidedness[abs(i2)] ^ INTSIGNBITSET( i2 ); if ( s0 & s1 & s2 ) { - plane.FromPoints( verts[indexes[i+0]].xyz, verts[indexes[i+1]].xyz, verts[indexes[i+2]].xyz ); + if (!plane.FromPoints( verts[indexes[i+0]].xyz, verts[indexes[i+1]].xyz, verts[indexes[i+2]].xyz )) + return false; plane.RayIntersection( start, dir, s ); if ( idMath::Fabs( s ) < idMath::Fabs( scale ) ) { scale = s; } } else if ( !backFaceCull && !(s0 | s1 | s2) ) { - plane.FromPoints( verts[indexes[i+0]].xyz, verts[indexes[i+1]].xyz, verts[indexes[i+2]].xyz ); + if (!plane.FromPoints( verts[indexes[i+0]].xyz, verts[indexes[i+1]].xyz, verts[indexes[i+2]].xyz )) + return false; plane.RayIntersection( start, dir, s ); if ( idMath::Fabs( s ) < idMath::Fabs( scale ) ) { scale = s; diff --git a/neo/renderer/Image_init.cpp b/neo/renderer/Image_init.cpp index e91673b7..69e4200c 100644 --- a/neo/renderer/Image_init.cpp +++ b/neo/renderer/Image_init.cpp @@ -638,6 +638,9 @@ static void getCubeVector(int i, int cubesize, int x, int y, float *vector) { vector[1] = -tc; vector[2] = -1.0; break; + default: + common->Error ("getCubeVector: invalid cube map face index"); + return; } mag = idMath::InvSqrt(vector[0]*vector[0] + vector[1]*vector[1] + vector[2]*vector[2]); @@ -652,7 +655,7 @@ static void getCubeVector(int i, int cubesize, int x, int y, float *vector) { * access the cube map. */ static void makeNormalizeVectorCubeMap( idImage *image ) { - float vector[3]; + float vector[3] = { }; int i, x, y; byte *pixels[6]; int size; diff --git a/neo/renderer/ModelDecal.cpp b/neo/renderer/ModelDecal.cpp index 62911619..ae8bfb54 100644 --- a/neo/renderer/ModelDecal.cpp +++ b/neo/renderer/ModelDecal.cpp @@ -354,7 +354,8 @@ void idRenderModelDecal::CreateDecal( const idRenderModel *model, const decalPro fw[j] = stri->verts[stri->indexes[index+j]].xyz; dir = fw[j].ToVec3() - localInfo.projectionOrigin; - localInfo.boundingPlanes[NUM_DECAL_BOUNDING_PLANES - 1].RayIntersection( fw[j].ToVec3(), dir, scale ); + if (!localInfo.boundingPlanes[NUM_DECAL_BOUNDING_PLANES - 1].RayIntersection( fw[j].ToVec3(), dir, scale )) + scale = 0.0f; dir = fw[j].ToVec3() + scale * dir; fw[j].s = localInfo.textureAxis[0].Distance( dir ); fw[j].t = localInfo.textureAxis[1].Distance( dir ); diff --git a/neo/renderer/Model_lwo.cpp b/neo/renderer/Model_lwo.cpp index 5fd89100..1ae3f1ba 100644 --- a/neo/renderer/Model_lwo.cpp +++ b/neo/renderer/Model_lwo.cpp @@ -338,7 +338,7 @@ Read an ENVL chunk from an LWO2 file. lwEnvelope *lwGetEnvelope( idFile *fp, int cksize ) { lwEnvelope *env; - lwKey *key; + lwKey *key = NULL; lwPlugin *plug; unsigned int id; unsigned short sz; @@ -1821,8 +1821,8 @@ Read an lwSurface from an LWOB file. lwSurface *lwGetSurface5( idFile *fp, int cksize, lwObject *obj ) { lwSurface *surf; - lwTexture *tex; - lwPlugin *shdr; + lwTexture *tex = NULL; + lwPlugin *shdr = NULL; char *s; float v[ 3 ]; unsigned int id, flags; @@ -1987,7 +1987,7 @@ lwSurface *lwGetSurface5( idFile *fp, int cksize, lwObject *obj ) case ID_TFLG: flags = getU2( fp ); - if ( flags & 1 ) i = 0; + i = 0; if ( flags & 2 ) i = 1; if ( flags & 4 ) i = 2; tex->axis = i; @@ -2079,6 +2079,7 @@ lwSurface *lwGetSurface5( idFile *fp, int cksize, lwObject *obj ) break; case ID_SDAT: + if ( !shdr ) goto Fail; shdr->data = getbytes( fp, sz ); break; diff --git a/neo/renderer/RenderWorld_portals.cpp b/neo/renderer/RenderWorld_portals.cpp index 28b8fe68..6ce6aafc 100644 --- a/neo/renderer/RenderWorld_portals.cpp +++ b/neo/renderer/RenderWorld_portals.cpp @@ -330,7 +330,7 @@ void idRenderWorldLocal::FloodLightThroughArea_r( idRenderLightLocal *light, int portal_t* p; float d; portalArea_t * area; - const portalStack_t *check, *firstPortalStack; + const portalStack_t *check, *firstPortalStack = NULL; portalStack_t newStack; int i, j; idVec3 v1, v2; diff --git a/neo/renderer/draw_arb2.cpp b/neo/renderer/draw_arb2.cpp index c51e2d3d..2529b90f 100644 --- a/neo/renderer/draw_arb2.cpp +++ b/neo/renderer/draw_arb2.cpp @@ -368,7 +368,7 @@ void R_LoadARBProgram( int progIndex ) { fullPath += progs[progIndex].name; char *fileBuffer; char *buffer; - char *start, *end; + char *start = NULL, *end; common->Printf( "%s", fullPath.c_str() ); @@ -405,14 +405,14 @@ void R_LoadARBProgram( int progIndex ) { common->Printf( ": GL_VERTEX_PROGRAM_ARB not available\n" ); return; } - start = strstr( (char *)buffer, "!!ARBvp" ); + start = strstr( buffer, "!!ARBvp" ); } if ( progs[progIndex].target == GL_FRAGMENT_PROGRAM_ARB ) { if ( !glConfig.ARBFragmentProgramAvailable ) { common->Printf( ": GL_FRAGMENT_PROGRAM_ARB not available\n" ); return; } - start = strstr( (char *)buffer, "!!ARBfp" ); + start = strstr( buffer, "!!ARBfp" ); } if ( !start ) { common->Printf( ": !!ARB not found\n" ); @@ -430,7 +430,7 @@ void R_LoadARBProgram( int progIndex ) { qglGetError(); qglProgramStringARB( progs[progIndex].target, GL_PROGRAM_FORMAT_ASCII_ARB, - strlen( start ), (unsigned char *)start ); + strlen( start ), start ); err = qglGetError(); qglGetIntegerv( GL_PROGRAM_ERROR_POSITION_ARB, (GLint *)&ofs ); @@ -439,7 +439,7 @@ void R_LoadARBProgram( int progIndex ) { common->Printf( "\nGL_PROGRAM_ERROR_STRING_ARB: %s\n", str ); if ( ofs < 0 ) { common->Printf( "GL_PROGRAM_ERROR_POSITION_ARB < 0 with error\n" ); - } else if ( ofs >= (int)strlen( (char *)start ) ) { + } else if ( ofs >= (int)strlen( start ) ) { common->Printf( "error at end of program\n" ); } else { common->Printf( "error at %i:\n%s", ofs, start + ofs ); diff --git a/neo/renderer/tr_deform.cpp b/neo/renderer/tr_deform.cpp index f6a25605..acdc11a5 100644 --- a/neo/renderer/tr_deform.cpp +++ b/neo/renderer/tr_deform.cpp @@ -532,7 +532,10 @@ static void R_FlareDeform( drawSurf_t *surf ) { idDrawVert *ac = (idDrawVert *)_alloca16( newTri->numVerts * sizeof( idDrawVert ) ); // find the plane - plane.FromPoints( tri->verts[tri->indexes[0]].xyz, tri->verts[tri->indexes[1]].xyz, tri->verts[tri->indexes[2]].xyz ); + if (!plane.FromPoints( tri->verts[tri->indexes[0]].xyz, tri->verts[tri->indexes[1]].xyz, tri->verts[tri->indexes[2]].xyz )) { + common->Warning( "R_FlareDeform: plane.FromPoints failed" ); + return; + } // if viewer is behind the plane, draw nothing R_GlobalPointToLocal( surf->space->modelMatrix, tr.viewDef->renderView.vieworg, localViewer ); diff --git a/neo/renderer/tr_light.cpp b/neo/renderer/tr_light.cpp index 244e9ffc..4cb0445e 100644 --- a/neo/renderer/tr_light.cpp +++ b/neo/renderer/tr_light.cpp @@ -1248,8 +1248,8 @@ void R_AddDrawSurf( const srfTriangles_t *tri, const viewEntity_t *space, const shaderParms = renderEntity->shaderParms; } - float oldFloatTime; - int oldTime; + float oldFloatTime = 0.0f; + int oldTime = 0; if ( space->entityDef && space->entityDef->parms.timeGroup ) { oldFloatTime = tr.viewDef->floatTime; @@ -1481,8 +1481,8 @@ void R_AddModelSurfaces( void ) { } } - float oldFloatTime; - int oldTime; + float oldFloatTime = 0.0f; + int oldTime = 0; game->SelectTimeGroup( vEntity->entityDef->parms.timeGroup ); diff --git a/neo/renderer/tr_rendertools.cpp b/neo/renderer/tr_rendertools.cpp index b25485f8..7bf961f3 100644 --- a/neo/renderer/tr_rendertools.cpp +++ b/neo/renderer/tr_rendertools.cpp @@ -1760,7 +1760,7 @@ RB_DrawText */ static void RB_DrawText( const char *text, const idVec3 &origin, float scale, const idVec4 &color, const idMat3 &viewAxis, const int align ) { int i, j, len, num, index, charIndex, line; - float textLen, spacing; + float textLen = 0.0f, spacing; idVec3 org, p1, p2; if ( text && *text ) { @@ -1773,6 +1773,7 @@ static void RB_DrawText( const char *text, const idVec3 &origin, float scale, co line = 0; } + org.Zero(); len = strlen( text ); for ( i = 0; i < len; i++ ) { diff --git a/neo/tools/compilers/aas/AASReach.cpp b/neo/tools/compilers/aas/AASReach.cpp index 5a86e7f5..5f9cf9c0 100644 --- a/neo/tools/compilers/aas/AASReach.cpp +++ b/neo/tools/compilers/aas/AASReach.cpp @@ -329,6 +329,15 @@ bool idAASReach::Reachability_Step_Barrier_WaterJump_WalkOffLedge( int area1num, } } + floor_bestArea1FloorEdgeNum = 0; + + floor_bestStart.Zero(); + floor_bestEnd.Zero(); + floor_bestNormal.Zero(); + water_bestStart.Zero(); + water_bestEnd.Zero(); + water_bestNormal.Zero(); + floor_foundReach = false; floor_bestDist = 99999; floor_bestLength = 0; diff --git a/neo/tools/compilers/aas/BrushBSP.cpp b/neo/tools/compilers/aas/BrushBSP.cpp index 3784e86c..c77d1a6a 100644 --- a/neo/tools/compilers/aas/BrushBSP.cpp +++ b/neo/tools/compilers/aas/BrushBSP.cpp @@ -1116,7 +1116,7 @@ idBrushBSP::MakeNodePortal void idBrushBSP::MakeNodePortal( idBrushBSPNode *node ) { idBrushBSPPortal *newPortal, *p; idWinding *w; - int side; + int side = 0; w = BaseWindingForNode( node ); @@ -1179,6 +1179,7 @@ void idBrushBSP::SplitNodePortals( idBrushBSPNode *node ) { } else { common->Error( "idBrushBSP::SplitNodePortals: mislinked portal" ); + return; } nextPortal = p->next[side]; @@ -1363,8 +1364,8 @@ void idBrushBSP::LeakFile( const idStr &fileName ) { int count, next, s; idVec3 mid; idFile *lineFile; - idBrushBSPNode *node, *nextNode; - idBrushBSPPortal *p, *nextPortal; + idBrushBSPNode *node, *nextNode = NULL; + idBrushBSPPortal *p, *nextPortal = NULL; idStr qpath, name; if ( !outside->occupied ) { diff --git a/neo/tools/compilers/dmap/leakfile.cpp b/neo/tools/compilers/dmap/leakfile.cpp index 7cbe5ae5..b9d0bb67 100644 --- a/neo/tools/compilers/dmap/leakfile.cpp +++ b/neo/tools/compilers/dmap/leakfile.cpp @@ -79,8 +79,8 @@ void LeakFile (tree_t *tree) while (node->occupied > 1) { int next; - uPortal_t *p, *nextportal; - node_t *nextnode; + uPortal_t *p, *nextportal = NULL; + node_t *nextnode = NULL; int s; // find the best portal exit diff --git a/neo/tools/compilers/dmap/optimize.cpp b/neo/tools/compilers/dmap/optimize.cpp index 78ab3035..075ba7b3 100644 --- a/neo/tools/compilers/dmap/optimize.cpp +++ b/neo/tools/compilers/dmap/optimize.cpp @@ -632,6 +632,7 @@ static void RemoveIfColinear( optVertex_t *ov, optIsland_t *island ) { e = e->v2link; } else { common->Error( "RemoveIfColinear: mislinked edge" ); + return; } } @@ -653,6 +654,7 @@ static void RemoveIfColinear( optVertex_t *ov, optIsland_t *island ) { v1 = e1->v1; } else { common->Error( "RemoveIfColinear: mislinked edge" ); + return; } if ( e2->v1 == v2 ) { v3 = e2->v2; @@ -660,10 +662,12 @@ static void RemoveIfColinear( optVertex_t *ov, optIsland_t *island ) { v3 = e2->v1; } else { common->Error( "RemoveIfColinear: mislinked edge" ); + return; } if ( v1 == v3 ) { common->Error( "RemoveIfColinear: mislinked edge" ); + return; } // they must point in opposite directions @@ -707,6 +711,7 @@ static void RemoveIfColinear( optVertex_t *ov, optIsland_t *island ) { // v2 should have no edges now if ( v2->edges ) { common->Error( "RemoveIfColinear: didn't remove properly" ); + return; } @@ -942,6 +947,7 @@ static void CreateOptTri( optVertex_t *first, optEdge_t *e1, optEdge_t *e2, optI second = e1->v1; } else { common->Error( "CreateOptTri: mislinked edge" ); + return; } if ( e2->v1 == first ) { @@ -950,10 +956,12 @@ static void CreateOptTri( optVertex_t *first, optEdge_t *e1, optEdge_t *e2, optI third = e2->v1; } else { common->Error( "CreateOptTri: mislinked edge" ); + return; } if ( !IsTriangleValid( first, second, third ) ) { common->Error( "CreateOptTri: invalid" ); + return; } //DrawEdges( island ); @@ -984,6 +992,7 @@ static void CreateOptTri( optVertex_t *first, optEdge_t *e1, optEdge_t *e2, optI opposite = opposite->v2link; } else { common->Error( "BuildOptTriangles: mislinked edge" ); + return; } } @@ -1088,8 +1097,8 @@ Generate a new list of triangles from the optEdeges ==================== */ static void BuildOptTriangles( optIsland_t *island ) { - optVertex_t *ov, *second, *third, *middle; - optEdge_t *e1, *e1Next, *e2, *e2Next, *check, *checkNext; + optVertex_t *ov, *second = NULL, *third = NULL, *middle = NULL; + optEdge_t *e1, *e1Next = NULL, *e2, *e2Next = NULL, *check, *checkNext = NULL; // free them FreeOptTriangles( island ); diff --git a/neo/tools/compilers/renderbump/renderbump.cpp b/neo/tools/compilers/renderbump/renderbump.cpp index aa20abdb..77b77da5 100644 --- a/neo/tools/compilers/renderbump/renderbump.cpp +++ b/neo/tools/compilers/renderbump/renderbump.cpp @@ -1168,7 +1168,7 @@ void RenderBump_f( const idCmdArgs &args ) { int i, j; const char *cmdLine; int numRenderBumps; - renderBump_t *renderBumps, *rb; + renderBump_t *renderBumps, *rb = NULL; renderBump_t opt; int startTime, endTime; @@ -1381,6 +1381,7 @@ void RenderBumpFlat_f( const idCmdArgs &args ) { if ( i != ( args.Argc() - 1 ) ) { common->Error( "usage: renderBumpFlat [-size width height] asefile" ); + return; } common->Printf( "Final image size: %i, %i\n", width, height ); @@ -1547,6 +1548,8 @@ void RenderBumpFlat_f( const idCmdArgs &args ) { GLimp_SwapBuffers(); qglReadPixels( 0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buffer ); + c = width * height; + if ( colorPass ) { // add to the sum buffer for ( i = 0 ; i < c ; i++ ) { @@ -1557,7 +1560,6 @@ void RenderBumpFlat_f( const idCmdArgs &args ) { } } else { // normalize - c = width * height; for ( i = 0 ; i < c ; i++ ) { idVec3 v;