mirror of
https://github.com/dhewm/dhewm3-sdk.git
synced 2024-11-21 20:21:19 +00:00
Fix -Wuninitialized warnings
may be used uninitialized in this function
This commit is contained in:
parent
6ff59d90bf
commit
06a5468d4d
13 changed files with 35 additions and 16 deletions
|
@ -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();
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 ) );
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 ) );
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue