mirror of
https://github.com/halpz/re3.git
synced 2025-07-26 00:52:51 +00:00
rename clamp macro to Clamp to fix compilation with g++11
This commit is contained in:
@ -1665,7 +1665,7 @@ CAutomobile::PreRender(void)
|
||||
// 1.0 if directly behind car, -1.0 if in front
|
||||
// BUG on PC: Abs of DotProduct is taken
|
||||
float behindness = DotProduct(lookVector, GetForward());
|
||||
behindness = clamp(behindness, -1.0f, 1.0f); // shouldn't be necessary
|
||||
behindness = Clamp(behindness, -1.0f, 1.0f); // shouldn't be necessary
|
||||
// 0.0 if behind car, PI if in front
|
||||
// Abs not necessary
|
||||
float angle = Abs(Acos(behindness));
|
||||
@ -2264,7 +2264,7 @@ CAutomobile::ProcessControlInputs(uint8 pad)
|
||||
0.2f*CTimer::GetTimeStep();
|
||||
nLastControlInput = 0;
|
||||
}
|
||||
m_fSteerInput = clamp(m_fSteerInput, -1.0f, 1.0f);
|
||||
m_fSteerInput = Clamp(m_fSteerInput, -1.0f, 1.0f);
|
||||
|
||||
// Accelerate/Brake
|
||||
float acceleration = (CPad::GetPad(pad)->GetAccelerate() - CPad::GetPad(pad)->GetBrake())/255.0f;
|
||||
@ -2390,7 +2390,7 @@ CAutomobile::FireTruckControl(void)
|
||||
m_fCarGunLR += CPad::GetPad(0)->GetCarGunLeftRight() * 0.00025f * CTimer::GetTimeStep();
|
||||
m_fCarGunUD += CPad::GetPad(0)->GetCarGunUpDown() * 0.0001f * CTimer::GetTimeStep();
|
||||
}
|
||||
m_fCarGunUD = clamp(m_fCarGunUD, 0.05f, 0.3f);
|
||||
m_fCarGunUD = Clamp(m_fCarGunUD, 0.05f, 0.3f);
|
||||
|
||||
|
||||
CVector cannonPos(0.0f, 1.5f, 1.9f);
|
||||
@ -2835,7 +2835,7 @@ CAutomobile::HydraulicControl(void)
|
||||
float limitDiff = extendedLowerLimit - normalLowerLimit;
|
||||
if(limitDiff != 0.0f && Abs(maxDelta/limitDiff) > 0.01f){
|
||||
float f = (maxDelta + limitDiff)/2.0f/limitDiff;
|
||||
f = clamp(f, 0.0f, 1.0f);
|
||||
f = Clamp(f, 0.0f, 1.0f);
|
||||
DMAudio.PlayOneShot(m_audioEntityId, SOUND_CAR_HYDRAULIC_3, f);
|
||||
if(f < 0.4f || f > 0.6f)
|
||||
setPrevRatio = true;
|
||||
|
@ -123,9 +123,9 @@ CBoat::ProcessControl(void)
|
||||
r = 114.75f*(CTimeCycle::GetAmbientRed() + 0.5f*CTimeCycle::GetDirectionalRed());
|
||||
g = 114.75f*(CTimeCycle::GetAmbientGreen() + 0.5f*CTimeCycle::GetDirectionalGreen());
|
||||
b = 114.75f*(CTimeCycle::GetAmbientBlue() + 0.5f*CTimeCycle::GetDirectionalBlue());
|
||||
r = clamp(r, 0, 255);
|
||||
g = clamp(g, 0, 255);
|
||||
b = clamp(b, 0, 255);
|
||||
r = Clamp(r, 0, 255);
|
||||
g = Clamp(g, 0, 255);
|
||||
b = Clamp(b, 0, 255);
|
||||
splashColor.red = r;
|
||||
splashColor.green = g;
|
||||
splashColor.blue = b;
|
||||
@ -134,9 +134,9 @@ CBoat::ProcessControl(void)
|
||||
r = 242.25f*(CTimeCycle::GetAmbientRed() + 0.5f*CTimeCycle::GetDirectionalRed());
|
||||
g = 242.25f*(CTimeCycle::GetAmbientGreen() + 0.5f*CTimeCycle::GetDirectionalGreen());
|
||||
b = 242.25f*(CTimeCycle::GetAmbientBlue() + 0.5f*CTimeCycle::GetDirectionalBlue());
|
||||
r = clamp(r, 0, 255);
|
||||
g = clamp(g, 0, 255);
|
||||
b = clamp(b, 0, 255);
|
||||
r = Clamp(r, 0, 255);
|
||||
g = Clamp(g, 0, 255);
|
||||
b = Clamp(b, 0, 255);
|
||||
jetColor.red = r;
|
||||
jetColor.green = g;
|
||||
jetColor.blue = b;
|
||||
@ -542,17 +542,17 @@ CBoat::ProcessControlInputs(uint8 pad)
|
||||
m_nPadID = 3;
|
||||
|
||||
m_fBrake += (CPad::GetPad(pad)->GetBrake()/255.0f - m_fBrake)*0.1f;
|
||||
m_fBrake = clamp(m_fBrake, 0.0f, 1.0f);
|
||||
m_fBrake = Clamp(m_fBrake, 0.0f, 1.0f);
|
||||
|
||||
if(m_fBrake < 0.05f){
|
||||
m_fBrake = 0.0f;
|
||||
m_fAccelerate += (CPad::GetPad(pad)->GetAccelerate()/255.0f - m_fAccelerate)*0.1f;
|
||||
m_fAccelerate = clamp(m_fAccelerate, 0.0f, 1.0f);
|
||||
m_fAccelerate = Clamp(m_fAccelerate, 0.0f, 1.0f);
|
||||
}else
|
||||
m_fAccelerate = -m_fBrake*0.2f;
|
||||
|
||||
m_fSteeringLeftRight += (-CPad::GetPad(pad)->GetSteeringLeftRight()/128.0f - m_fSteeringLeftRight)*0.2f;
|
||||
m_fSteeringLeftRight = clamp(m_fSteeringLeftRight, -1.0f, 1.0f);
|
||||
m_fSteeringLeftRight = Clamp(m_fSteeringLeftRight, -1.0f, 1.0f);
|
||||
|
||||
float steeringSq = m_fSteeringLeftRight < 0.0f ? -SQR(m_fSteeringLeftRight) : SQR(m_fSteeringLeftRight);
|
||||
m_fSteerAngle = pHandling->fSteeringLock * DEGTORAD(steeringSq);
|
||||
|
@ -52,11 +52,11 @@ CDoor::Process(CVehicle *vehicle)
|
||||
fSpeedDiff = vecSpeedDiff.y - vecSpeedDiff.x;
|
||||
break;
|
||||
}
|
||||
fSpeedDiff = clamp(fSpeedDiff, -0.2f, 0.2f);
|
||||
fSpeedDiff = Clamp(fSpeedDiff, -0.2f, 0.2f);
|
||||
if(Abs(fSpeedDiff) > 0.002f)
|
||||
m_fAngVel += fSpeedDiff;
|
||||
m_fAngVel *= 0.945f;
|
||||
m_fAngVel = clamp(m_fAngVel, -0.3f, 0.3f);
|
||||
m_fAngVel = Clamp(m_fAngVel, -0.3f, 0.3f);
|
||||
|
||||
m_fAngle += m_fAngVel;
|
||||
m_nDoorState = DOORST_SWINGING;
|
||||
|
@ -250,7 +250,7 @@ CHeli::ProcessControl(void)
|
||||
// Move up if too low
|
||||
if(GetPosition().z - 2.0f < groundZ && m_heliStatus != HELI_STATUS_SHOT_DOWN)
|
||||
m_vecMoveSpeed.z += CTimer::GetTimeStep()*0.01f;
|
||||
m_vecMoveSpeed.z = clamp(m_vecMoveSpeed.z, -0.3f, 0.3f);
|
||||
m_vecMoveSpeed.z = Clamp(m_vecMoveSpeed.z, -0.3f, 0.3f);
|
||||
}
|
||||
|
||||
float fTargetDist = vTargetDist.Magnitude();
|
||||
|
@ -430,8 +430,8 @@ CVehicle::FlyingControl(eFlightModel flightModel)
|
||||
}
|
||||
if (CPad::GetPad(0)->GetHorn()) {
|
||||
fYaw = 0.0f;
|
||||
fPitch = clamp(10.0f * DotProduct(m_vecMoveSpeed, GetForward()), -200.0f, 1.3f);
|
||||
fRoll = clamp(10.0f * DotProduct(m_vecMoveSpeed, GetRight()), -200.0f, 1.3f);
|
||||
fPitch = Clamp(10.0f * DotProduct(m_vecMoveSpeed, GetForward()), -200.0f, 1.3f);
|
||||
fRoll = Clamp(10.0f * DotProduct(m_vecMoveSpeed, GetRight()), -200.0f, 1.3f);
|
||||
}
|
||||
ApplyTurnForce(fPitch * GetUp() * fPitchVar * m_fTurnMass * CTimer::GetTimeStep(), GetForward());
|
||||
ApplyTurnForce(fRoll * GetUp() * fRollVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight());
|
||||
|
Reference in New Issue
Block a user