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 "Transmission.h"
//--MIAMI: done
void
cTransmission::InitGearRatios(void)
{
@ -80,22 +82,15 @@ cTransmission::CalculateDriveAcceleration(const float &gasPedal, uint8 &gear, fl
if(fVelocity > pGearRatio->fShiftUpVelocity){
if(gear != 0 || gasPedal > 0.0f){
gear++;
time = 0.0f;
return CalculateDriveAcceleration(gasPedal, gear, time, fVelocity, false);
}
}else if(fVelocity < pGearRatio->fShiftDownVelocity && gear != 0){
if(gear != 1 || gasPedal < 0.0f){
gear--;
time = 0.0f;
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;
if(gear < 1){
@ -112,13 +107,13 @@ cTransmission::CalculateDriveAcceleration(const float &gasPedal, uint8 &gear, fl
// This is pretty ugly, could be written more clearly
if(Flags & HANDLING_2G_BOOST){
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)
accelMul = 1.3f;
else
accelMul = 1.0f;
}else if(Flags & HANDLING_1G_BOOST && gear == 1){
accelMul = 3.0f;
accelMul = 2.0f;
}else
accelMul = 1.0f;
}
@ -133,6 +128,5 @@ cTransmission::CalculateDriveAcceleration(const float &gasPedal, uint8 &gear, fl
fAcceleration = gasPedal * accel * CTimer::GetTimeStep();
else
fAcceleration = 0.0f;
}
return fAcceleration;
}