diff options
author | aap <aap@papnet.eu> | 2019-07-07 13:09:11 +0200 |
---|---|---|
committer | aap <aap@papnet.eu> | 2019-07-07 13:09:11 +0200 |
commit | 53023eb65bdcde43e341c1ecb7cf0c7f8ee524fb (patch) | |
tree | fc65a6c40fa719f9d43be9e0e15be79c490135e0 /src/vehicles/Transmission.cpp | |
parent | finished CPhysical (diff) | |
download | re3-53023eb65bdcde43e341c1ecb7cf0c7f8ee524fb.tar re3-53023eb65bdcde43e341c1ecb7cf0c7f8ee524fb.tar.gz re3-53023eb65bdcde43e341c1ecb7cf0c7f8ee524fb.tar.bz2 re3-53023eb65bdcde43e341c1ecb7cf0c7f8ee524fb.tar.lz re3-53023eb65bdcde43e341c1ecb7cf0c7f8ee524fb.tar.xz re3-53023eb65bdcde43e341c1ecb7cf0c7f8ee524fb.tar.zst re3-53023eb65bdcde43e341c1ecb7cf0c7f8ee524fb.zip |
Diffstat (limited to 'src/vehicles/Transmission.cpp')
-rw-r--r-- | src/vehicles/Transmission.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/vehicles/Transmission.cpp b/src/vehicles/Transmission.cpp new file mode 100644 index 00000000..2be25cbb --- /dev/null +++ b/src/vehicles/Transmission.cpp @@ -0,0 +1,37 @@ +#include "common.h" +#include "patcher.h" +#include "Transmission.h" + +void +cTransmission::InitGearRatios(void) +{ + static tGear *pGearRatio0 = nil; + static tGear *pGearRatio1 = nil; + int i; + float velocityDiff; + + memset(Gears, 0, sizeof(Gears)); + + for(i = 1; i <= nNumberOfGears; i++){ + pGearRatio0 = &Gears[i-1]; + pGearRatio1 = &Gears[i]; + + pGearRatio1->fMaxVelocity = (float)i / nNumberOfGears * fMaxVelocity; + + velocityDiff = pGearRatio1->fMaxVelocity - pGearRatio0->fMaxVelocity; + + if(i >= nNumberOfGears){ + pGearRatio1->fShiftUpVelocity = fMaxVelocity; + }else{ + Gears[i+1].fShiftDownVelocity = velocityDiff*0.42f + pGearRatio0->fMaxVelocity; + pGearRatio1->fShiftUpVelocity = velocityDiff*0.6667f + pGearRatio0->fMaxVelocity; + } + } + + // Reverse gear + Gears[0].fMaxVelocity = fMaxReverseVelocity; + Gears[0].fShiftUpVelocity = -0.01f; + Gears[0].fShiftDownVelocity = fMaxReverseVelocity; + + Gears[1].fShiftDownVelocity = -0.01f; +} |