mirror of
https://github.com/halpz/re3.git
synced 2025-07-03 07:30:50 +00:00
added wrappers around math functions
This commit is contained in:
@ -53,7 +53,7 @@ CDoor::Process(CVehicle *vehicle)
|
||||
break;
|
||||
}
|
||||
fSpeedDiff = clamp(fSpeedDiff, -0.2f, 0.2f);
|
||||
if(fabs(fSpeedDiff) > 0.002f)
|
||||
if(Abs(fSpeedDiff) > 0.002f)
|
||||
m_fAngVel += fSpeedDiff;
|
||||
m_fAngVel *= 0.945f;
|
||||
m_fAngVel = clamp(m_fAngVel, -0.3f, 0.3f);
|
||||
@ -76,7 +76,7 @@ CDoor::Process(CVehicle *vehicle)
|
||||
float
|
||||
CDoor::RetAngleWhenClosed(void)
|
||||
{
|
||||
if(fabs(m_fMaxAngle) < fabs(m_fMinAngle))
|
||||
if(Abs(m_fMaxAngle) < Abs(m_fMinAngle))
|
||||
return m_fMaxAngle;
|
||||
else
|
||||
return m_fMinAngle;
|
||||
@ -85,7 +85,7 @@ CDoor::RetAngleWhenClosed(void)
|
||||
float
|
||||
CDoor::RetAngleWhenOpen(void)
|
||||
{
|
||||
if(fabs(m_fMaxAngle) < fabs(m_fMinAngle))
|
||||
if(Abs(m_fMaxAngle) < Abs(m_fMinAngle))
|
||||
return m_fMinAngle;
|
||||
else
|
||||
return m_fMaxAngle;
|
||||
@ -104,7 +104,7 @@ bool
|
||||
CDoor::IsFullyOpen(void)
|
||||
{
|
||||
// why -0.5? that's around 28 deg less than fully open
|
||||
if(fabs(m_fAngle) < fabs(RetAngleWhenOpen()) - 0.5f)
|
||||
if(Abs(m_fAngle) < Abs(RetAngleWhenOpen()) - 0.5f)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ CVehicle::FlyingControl(eFlightModel flightModel)
|
||||
ApplyTurnForce(impulse*GetUp(), 2.0f*GetUp() + com);
|
||||
|
||||
|
||||
m_vecTurnSpeed.y *= powf(0.9f, CTimer::GetTimeStep());
|
||||
m_vecTurnSpeed.y *= Pow(0.9f, CTimer::GetTimeStep());
|
||||
moveSpeed = m_vecMoveSpeed.MagnitudeSqr();
|
||||
if(moveSpeed > 2.25f)
|
||||
m_vecMoveSpeed *= 1.5f/sqrt(moveSpeed);
|
||||
@ -296,7 +296,7 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
|
||||
}
|
||||
|
||||
if(brake > adhesion){
|
||||
if(fabs(contactSpeedFwd) > 0.005f)
|
||||
if(Abs(contactSpeedFwd) > 0.005f)
|
||||
*wheelState = WHEEL_STATE_STATIC;
|
||||
}else {
|
||||
if(fwd > 0.0f){
|
||||
@ -317,7 +317,7 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
|
||||
*wheelState = WHEEL_STATE_2;
|
||||
}
|
||||
|
||||
float l = sqrt(sq(right) + sq(fwd));
|
||||
float l = Sqrt(sq(right) + sq(fwd));
|
||||
float tractionLoss = bAlreadySkidding ? 1.0f : m_handling->fTractionLoss;
|
||||
right *= adhesion * tractionLoss / l;
|
||||
fwd *= adhesion * tractionLoss / l;
|
||||
@ -552,9 +552,9 @@ CVehicle::CanPedExitCar(void)
|
||||
if(m_vecMoveSpeed.MagnitudeSqr() > 0.005f)
|
||||
return false;
|
||||
// if car is slow enough, check turn speed
|
||||
if(fabs(m_vecTurnSpeed.x) > 0.01f ||
|
||||
fabs(m_vecTurnSpeed.y) > 0.01f ||
|
||||
fabs(m_vecTurnSpeed.z) > 0.01f)
|
||||
if(Abs(m_vecTurnSpeed.x) > 0.01f ||
|
||||
Abs(m_vecTurnSpeed.y) > 0.01f ||
|
||||
Abs(m_vecTurnSpeed.z) > 0.01f)
|
||||
return false;
|
||||
return true;
|
||||
}else{
|
||||
@ -564,9 +564,9 @@ CVehicle::CanPedExitCar(void)
|
||||
if(m_vecMoveSpeed.MagnitudeSqr() >= 0.005f)
|
||||
return false;
|
||||
// if car is slow enough, check turn speed
|
||||
if(fabs(m_vecTurnSpeed.x) >= 0.01f ||
|
||||
fabs(m_vecTurnSpeed.y) >= 0.01f ||
|
||||
fabs(m_vecTurnSpeed.z) >= 0.01f)
|
||||
if(Abs(m_vecTurnSpeed.x) >= 0.01f ||
|
||||
Abs(m_vecTurnSpeed.y) >= 0.01f ||
|
||||
Abs(m_vecTurnSpeed.z) >= 0.01f)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user