transmission done

This commit is contained in:
aap 2020-08-20 10:23:43 +02:00
parent 9fd91e6250
commit 30dadcfb22

View File

@ -4,6 +4,8 @@
#include "HandlingMgr.h" #include "HandlingMgr.h"
#include "Transmission.h" #include "Transmission.h"
//--MIAMI: done
void void
cTransmission::InitGearRatios(void) cTransmission::InitGearRatios(void)
{ {
@ -80,22 +82,15 @@ cTransmission::CalculateDriveAcceleration(const float &gasPedal, uint8 &gear, fl
if(fVelocity > pGearRatio->fShiftUpVelocity){ if(fVelocity > pGearRatio->fShiftUpVelocity){
if(gear != 0 || gasPedal > 0.0f){ if(gear != 0 || gasPedal > 0.0f){
gear++; gear++;
time = 0.0f;
return CalculateDriveAcceleration(gasPedal, gear, time, fVelocity, false); return CalculateDriveAcceleration(gasPedal, gear, time, fVelocity, false);
} }
}else if(fVelocity < pGearRatio->fShiftDownVelocity && gear != 0){ }else if(fVelocity < pGearRatio->fShiftDownVelocity && gear != 0){
if(gear != 1 || gasPedal < 0.0f){ if(gear != 1 || gasPedal < 0.0f){
gear--; gear--;
time = 0.0f;
return CalculateDriveAcceleration(gasPedal, gear, time, fVelocity, false); return CalculateDriveAcceleration(gasPedal, gear, time, fVelocity, false);
} }
} }
if(time > 0.0f){
// changing gears currently, can't accelerate
fAcceleration = 0.0f;
time -= CTimer::GetTimeStepInSeconds();
}else{
float speedMul, accelMul; float speedMul, accelMul;
if(gear < 1){ if(gear < 1){
@ -112,13 +107,13 @@ cTransmission::CalculateDriveAcceleration(const float &gasPedal, uint8 &gear, fl
// This is pretty ugly, could be written more clearly // This is pretty ugly, could be written more clearly
if(Flags & HANDLING_2G_BOOST){ if(Flags & HANDLING_2G_BOOST){
if(gear == 1) if(gear == 1)
accelMul = (Flags & HANDLING_1G_BOOST) ? 3.0f : 2.0f; accelMul = (Flags & HANDLING_1G_BOOST) ? 2.0f : 1.6f;
else if(gear == 2) else if(gear == 2)
accelMul = 1.3f; accelMul = 1.3f;
else else
accelMul = 1.0f; accelMul = 1.0f;
}else if(Flags & HANDLING_1G_BOOST && gear == 1){ }else if(Flags & HANDLING_1G_BOOST && gear == 1){
accelMul = 3.0f; accelMul = 2.0f;
}else }else
accelMul = 1.0f; accelMul = 1.0f;
} }
@ -133,6 +128,5 @@ cTransmission::CalculateDriveAcceleration(const float &gasPedal, uint8 &gear, fl
fAcceleration = gasPedal * accel * CTimer::GetTimeStep(); fAcceleration = gasPedal * accel * CTimer::GetTimeStep();
else else
fAcceleration = 0.0f; fAcceleration = 0.0f;
}
return fAcceleration; return fAcceleration;
} }