some CAutomobile fixes

This commit is contained in:
aap 2020-12-31 23:59:45 +01:00
parent 14eb16d5d4
commit 4d1305efb2

View File

@ -809,7 +809,7 @@ CAutomobile::ProcessControl(void)
// dampen springs // dampen springs
for(i = 0; i < 4; i++) for(i = 0; i < 4; i++)
if(m_aSuspensionSpringRatio[i] < 1.0f) if(m_aSuspensionSpringRatio[i] < 0.99999f)
ApplySpringDampening(pHandling->fSuspensionDampingLevel, ApplySpringDampening(pHandling->fSuspensionDampingLevel,
springDirections[i], contactPoints[i], contactSpeeds[i]); springDirections[i], contactPoints[i], contactSpeeds[i]);
@ -850,7 +850,7 @@ CAutomobile::ProcessControl(void)
brake = m_fBrakePedal * pHandling->fBrakeDeceleration * CTimer::GetTimeStep(); brake = m_fBrakePedal * pHandling->fBrakeDeceleration * CTimer::GetTimeStep();
bool neutralHandling = GetStatus() != STATUS_PLAYER && GetStatus() != STATUS_PLAYER_REMOTE && (pHandling->Flags & HANDLING_NEUTRALHANDLING); bool neutralHandling = GetStatus() != STATUS_PLAYER && GetStatus() != STATUS_PLAYER_REMOTE && (pHandling->Flags & HANDLING_NEUTRALHANDLING);
float brakeBiasFront = neutralHandling ? 1.0f : 2.0f*pHandling->fBrakeBias; float brakeBiasFront = neutralHandling ? 1.0f : 2.0f*pHandling->fBrakeBias;
float brakeBiasRear = neutralHandling ? 1.0f : 2.0f*(1.0f-pHandling->fBrakeBias); float brakeBiasRear = neutralHandling ? 1.0f : 2.0f-pHandling->fBrakeBias; // looks like a bug, but it was correct in III...
float tractionBiasFront = neutralHandling ? 1.0f : 2.0f*pHandling->fTractionBias; float tractionBiasFront = neutralHandling ? 1.0f : 2.0f*pHandling->fTractionBias;
float tractionBiasRear = neutralHandling ? 1.0f : 2.0f-tractionBiasFront; float tractionBiasRear = neutralHandling ? 1.0f : 2.0f-tractionBiasFront;
@ -1042,7 +1042,7 @@ CAutomobile::ProcessControl(void)
if(m_aWheelTimer[CARWHEEL_REAR_LEFT] > 0.0f || m_aWheelTimer[CARWHEEL_REAR_RIGHT] > 0.0f){ if(m_aWheelTimer[CARWHEEL_REAR_LEFT] > 0.0f || m_aWheelTimer[CARWHEEL_REAR_RIGHT] > 0.0f){
CVector wheelFwd = GetForward(); CVector wheelFwd = GetForward();
CVector wheelRight = GetRight(); CVector wheelRight = GetRight(); // overwritten for resp. wheel
float rearBrake = brake; float rearBrake = brake;
float rearTraction = traction; float rearTraction = traction;
@ -1073,7 +1073,6 @@ CAutomobile::ProcessControl(void)
else else
fThrust = acceleration; fThrust = acceleration;
wheelFwd = GetForward();
wheelFwd -= DotProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_REAR_LEFT].normal)*m_aWheelColPoints[CARWHEEL_REAR_LEFT].normal; wheelFwd -= DotProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_REAR_LEFT].normal)*m_aWheelColPoints[CARWHEEL_REAR_LEFT].normal;
wheelFwd.Normalise(); wheelFwd.Normalise();
wheelRight = CrossProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_REAR_LEFT].normal); wheelRight = CrossProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_REAR_LEFT].normal);
@ -1110,7 +1109,7 @@ CAutomobile::ProcessControl(void)
#ifdef FIX_BUGS #ifdef FIX_BUGS
// Shouldn't we reset these after the left wheel? // Shouldn't we reset these after the left wheel?
wheelFwd = GetForward(); wheelFwd = GetForward();
wheelRight = GetRight(); wheelRight = GetRight(); // actually useless
#endif #endif
if(m_aWheelTimer[CARWHEEL_REAR_RIGHT] > 0.0f){ if(m_aWheelTimer[CARWHEEL_REAR_RIGHT] > 0.0f){
@ -1119,7 +1118,6 @@ CAutomobile::ProcessControl(void)
else else
fThrust = acceleration; fThrust = acceleration;
wheelFwd = GetForward();
wheelFwd -= DotProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_REAR_RIGHT].normal)*m_aWheelColPoints[CARWHEEL_REAR_RIGHT].normal; wheelFwd -= DotProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_REAR_RIGHT].normal)*m_aWheelColPoints[CARWHEEL_REAR_RIGHT].normal;
wheelFwd.Normalise(); wheelFwd.Normalise();
wheelRight = CrossProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_REAR_RIGHT].normal); wheelRight = CrossProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_REAR_RIGHT].normal);
@ -1167,7 +1165,9 @@ CAutomobile::ProcessControl(void)
if(!IsRealHeli()){ if(!IsRealHeli()){
if(m_aWheelTimer[CARWHEEL_REAR_LEFT] <= 0.0f){ if(m_aWheelTimer[CARWHEEL_REAR_LEFT] <= 0.0f){
if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f) if(bIsHandbrakeOn)
m_aWheelSpeed[CARWHEEL_REAR_LEFT] = 0.0f;
else if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f)
m_aWheelSpeed[CARWHEEL_REAR_LEFT] *= 0.95f; m_aWheelSpeed[CARWHEEL_REAR_LEFT] *= 0.95f;
else{ else{
if(acceleration > 0.0f){ if(acceleration > 0.0f){
@ -1181,7 +1181,9 @@ CAutomobile::ProcessControl(void)
m_aWheelRotation[CARWHEEL_REAR_LEFT] += m_aWheelSpeed[CARWHEEL_REAR_LEFT]; m_aWheelRotation[CARWHEEL_REAR_LEFT] += m_aWheelSpeed[CARWHEEL_REAR_LEFT];
} }
if(m_aWheelTimer[CARWHEEL_REAR_RIGHT] <= 0.0f){ if(m_aWheelTimer[CARWHEEL_REAR_RIGHT] <= 0.0f){
if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f) if(bIsHandbrakeOn)
m_aWheelSpeed[CARWHEEL_REAR_RIGHT] = 0.0f;
else if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f)
m_aWheelSpeed[CARWHEEL_REAR_RIGHT] *= 0.95f; m_aWheelSpeed[CARWHEEL_REAR_RIGHT] *= 0.95f;
else{ else{
if(acceleration > 0.0f){ if(acceleration > 0.0f){