summaryrefslogtreecommitdiffstats
path: root/src/control/Transmission.cpp
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2019-06-19 23:41:43 +0200
committeraap <aap@papnet.eu>2019-06-19 23:56:27 +0200
commit12f009e708b5969cd42ccf5bfb60be37b70f31d8 (patch)
tree9af4251be23041f3c68d4ccd8a34d6d14f9d6709 /src/control/Transmission.cpp
parentimplemented CObjectData (diff)
downloadre3-12f009e708b5969cd42ccf5bfb60be37b70f31d8.tar
re3-12f009e708b5969cd42ccf5bfb60be37b70f31d8.tar.gz
re3-12f009e708b5969cd42ccf5bfb60be37b70f31d8.tar.bz2
re3-12f009e708b5969cd42ccf5bfb60be37b70f31d8.tar.lz
re3-12f009e708b5969cd42ccf5bfb60be37b70f31d8.tar.xz
re3-12f009e708b5969cd42ccf5bfb60be37b70f31d8.tar.zst
re3-12f009e708b5969cd42ccf5bfb60be37b70f31d8.zip
Diffstat (limited to '')
-rw-r--r--src/control/Transmission.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/control/Transmission.cpp b/src/control/Transmission.cpp
new file mode 100644
index 00000000..aaa24ced
--- /dev/null
+++ b/src/control/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;
+}