summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilip Gawin <filip.gawin@zoho.com>2019-11-30 23:52:57 +0100
committerFilip Gawin <filip.gawin@zoho.com>2019-12-01 20:44:43 +0100
commit41c9e6638276b39f8ac897a3def8fea593c601f9 (patch)
treefc521113bf9cafdb4e02eefca9642dbbf680a71d
parentMerge pull request #276 from erorcun/erorcun (diff)
downloadre3-41c9e6638276b39f8ac897a3def8fea593c601f9.tar
re3-41c9e6638276b39f8ac897a3def8fea593c601f9.tar.gz
re3-41c9e6638276b39f8ac897a3def8fea593c601f9.tar.bz2
re3-41c9e6638276b39f8ac897a3def8fea593c601f9.tar.lz
re3-41c9e6638276b39f8ac897a3def8fea593c601f9.tar.xz
re3-41c9e6638276b39f8ac897a3def8fea593c601f9.tar.zst
re3-41c9e6638276b39f8ac897a3def8fea593c601f9.zip
-rw-r--r--src/audio/AudioManager.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index 6a37e462..cdc7812a 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -6492,7 +6492,6 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
float relativeVelocityChange;
float accelerationMultipler;
uint8 wheelInUseCounter;
- uint8 i;
float time;
int baseFreq;
uint8 vol;
@@ -6540,19 +6539,15 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
velocityChange = params->m_fVelocityChange;
relativeVelocityChange = 2.0f * velocityChange / transmission->fMaxVelocity;
- accelerationMultipler = 0.0f;
-
- if(relativeVelocityChange > 1.0f) accelerationMultipler = relativeVelocityChange;
-
+ accelerationMultipler = min(min(1.f, relativeVelocityChange), 0.f);
gasPedalAudio = accelerationMultipler;
currentGear = params->m_pVehicle->m_nCurrentGear;
+
if(transmission->nDriveType == '4') {
wheelInUseCounter = 0;
- i = 0;
- do {
+ for (uint8 i = 0; i < 4; i++){
if(automobile->m_aWheelState[i]) ++wheelInUseCounter;
- ++i;
- } while(i < 4);
+ }
if(wheelInUseCounter > 2) lostTraction = 1;
} else if(transmission->nDriveType == 'F') {
if((automobile->m_aWheelState[0] || automobile->m_aWheelState[2]) &&
@@ -6623,7 +6618,8 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *
if(!nCruising) {
if(accelerateState < 150 || !automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn ||
lostTraction ||
- currentGear < 2u && velocityChange - automobile->m_fVelocityChangeForAudio >= 0.01f) {
+ currentGear < 2 &&
+ velocityChange - automobile->m_fVelocityChangeForAudio < 0.01f) { // here could be used abs
if(!automobile->m_nWheelsOnGround || automobile->bIsHandbrakeOn || lostTraction) {
if(!automobile->m_nWheelsOnGround && automobile->m_nDriveWheelsOnGround ||
(automobile->bIsHandbrakeOn && !bHandbrakeOnLastFrame ||