diff --git a/d3xp/AFEntity.cpp b/d3xp/AFEntity.cpp index 9a3c1d8..f730640 100644 --- a/d3xp/AFEntity.cpp +++ b/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/d3xp/Entity.h b/d3xp/Entity.h index 7d91008..0fe5fb7 100644 --- a/d3xp/Entity.h +++ b/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/d3xp/IK.cpp b/d3xp/IK.cpp index 1844ba2..740accb 100644 --- a/d3xp/IK.cpp +++ b/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/d3xp/SmokeParticles.cpp b/d3xp/SmokeParticles.cpp index 66ee854..8eafa85 100644 --- a/d3xp/SmokeParticles.cpp +++ b/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/d3xp/ai/AI_pathing.cpp b/d3xp/ai/AI_pathing.cpp index 600a92b..3dafa62 100644 --- a/d3xp/ai/AI_pathing.cpp +++ b/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/d3xp/physics/Force_Field.cpp b/d3xp/physics/Force_Field.cpp index 23f50af..8db7022 100644 --- a/d3xp/physics/Force_Field.cpp +++ b/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/d3xp/physics/Physics_AF.cpp b/d3xp/physics/Physics_AF.cpp index 916c78a..7bc55c6 100644 --- a/d3xp/physics/Physics_AF.cpp +++ b/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/game/IK.cpp b/game/IK.cpp index 1844ba2..740accb 100644 --- a/game/IK.cpp +++ b/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/game/SmokeParticles.cpp b/game/SmokeParticles.cpp index 6a64d0f..4c26b1a 100644 --- a/game/SmokeParticles.cpp +++ b/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/game/ai/AI_pathing.cpp b/game/ai/AI_pathing.cpp index 3a48505..308e612 100644 --- a/game/ai/AI_pathing.cpp +++ b/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/game/physics/Force_Field.cpp b/game/physics/Force_Field.cpp index 23f50af..8db7022 100644 --- a/game/physics/Force_Field.cpp +++ b/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/game/physics/Physics_AF.cpp b/game/physics/Physics_AF.cpp index 39c2515..8c8bc0d 100644 --- a/game/physics/Physics_AF.cpp +++ b/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/idlib/geometry/Surface.cpp b/idlib/geometry/Surface.cpp index eb45485..d3b19fc 100644 --- a/idlib/geometry/Surface.cpp +++ b/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;