summaryrefslogtreecommitdiffstats
path: root/src/vehicles/Automobile.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/vehicles/Automobile.cpp51
1 files changed, 26 insertions, 25 deletions
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index ed187849..966042e2 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -44,6 +44,7 @@
#include "PlayerPed.h"
#include "Object.h"
#include "Automobile.h"
+#include "Wanted.h"
bool bAllCarCheat; // unused
@@ -592,7 +593,7 @@ CAutomobile::ProcessControl(void)
float fwdSpeed = Abs(DotProduct(m_vecMoveSpeed, GetForward()));
CVector contactPoints[4]; // relative to model
CVector contactSpeeds[4]; // speed at contact points
- CVector springDirections[4]; // normalized, in model space
+ CVector springDirections[4]; // normalized, in world space
for(i = 0; i < 4; i++){
// Set spring under certain circumstances
@@ -759,10 +760,10 @@ CAutomobile::ProcessControl(void)
CVector wheelRight = Multiply3x3(GetMatrix(), CVector(c, s, 0.0f));
if(m_aWheelTimer[CARWHEEL_FRONT_LEFT] > 0.0f){
- if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier))
- fThrust = 0.0f;
- else
+ if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier))
fThrust = acceleration;
+ else
+ fThrust = 0.0f;
m_aWheelColPoints[CARWHEEL_FRONT_LEFT].surfaceA = SURFACE_WHEELBASE;
float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_FRONT_LEFT])*traction;
@@ -793,10 +794,10 @@ CAutomobile::ProcessControl(void)
}
if(m_aWheelTimer[CARWHEEL_FRONT_RIGHT] > 0.0f){
- if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier))
- fThrust = 0.0f;
- else
+ if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier))
fThrust = acceleration;
+ else
+ fThrust = 0.0f;
m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].surfaceA = SURFACE_WHEELBASE;
float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_FRONT_RIGHT])*traction;
@@ -830,9 +831,7 @@ CAutomobile::ProcessControl(void)
// Process front wheels off ground
if(m_aWheelTimer[CARWHEEL_FRONT_LEFT] <= 0.0f){
- if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f)
- m_aWheelSpeed[CARWHEEL_FRONT_LEFT] *= 0.95f;
- else{
+ if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) && acceleration != 0.0f){
if(acceleration > 0.0f){
if(m_aWheelSpeed[CARWHEEL_FRONT_LEFT] < 2.0f)
m_aWheelSpeed[CARWHEEL_FRONT_LEFT] -= 0.2f;
@@ -840,13 +839,13 @@ CAutomobile::ProcessControl(void)
if(m_aWheelSpeed[CARWHEEL_FRONT_LEFT] > -2.0f)
m_aWheelSpeed[CARWHEEL_FRONT_LEFT] += 0.1f;
}
+ }else{
+ m_aWheelSpeed[CARWHEEL_FRONT_LEFT] *= 0.95f;
}
m_aWheelRotation[CARWHEEL_FRONT_LEFT] += m_aWheelSpeed[CARWHEEL_FRONT_LEFT];
}
if(m_aWheelTimer[CARWHEEL_FRONT_RIGHT] <= 0.0f){
- if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f)
- m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] *= 0.95f;
- else{
+ if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) && acceleration != 0.0f){
if(acceleration > 0.0f){
if(m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] < 2.0f)
m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] -= 0.2f;
@@ -854,6 +853,8 @@ CAutomobile::ProcessControl(void)
if(m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] > -2.0f)
m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] += 0.1f;
}
+ }else{
+ m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] *= 0.95f;
}
m_aWheelRotation[CARWHEEL_FRONT_RIGHT] += m_aWheelSpeed[CARWHEEL_FRONT_RIGHT];
}
@@ -874,10 +875,10 @@ CAutomobile::ProcessControl(void)
#endif
if(m_aWheelTimer[CARWHEEL_REAR_LEFT] > 0.0f){
- if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier))
- fThrust = 0.0f;
- else
+ if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier))
fThrust = acceleration;
+ else
+ fThrust = 0.0f;
m_aWheelColPoints[CARWHEEL_REAR_LEFT].surfaceA = SURFACE_WHEELBASE;
float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_REAR_LEFT])*traction;
@@ -908,10 +909,10 @@ CAutomobile::ProcessControl(void)
}
if(m_aWheelTimer[CARWHEEL_REAR_RIGHT] > 0.0f){
- if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier))
- fThrust = 0.0f;
- else
+ if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier))
fThrust = acceleration;
+ else
+ fThrust = 0.0f;
m_aWheelColPoints[CARWHEEL_REAR_RIGHT].surfaceA = SURFACE_WHEELBASE;
float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_REAR_RIGHT])*traction;
@@ -945,9 +946,7 @@ CAutomobile::ProcessControl(void)
// Process rear wheels off ground
if(m_aWheelTimer[CARWHEEL_REAR_LEFT] <= 0.0f){
- if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f)
- m_aWheelSpeed[CARWHEEL_REAR_LEFT] *= 0.95f;
- else{
+ if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) && acceleration != 0.0f){
if(acceleration > 0.0f){
if(m_aWheelSpeed[CARWHEEL_REAR_LEFT] < 2.0f)
m_aWheelSpeed[CARWHEEL_REAR_LEFT] -= 0.2f;
@@ -955,13 +954,13 @@ CAutomobile::ProcessControl(void)
if(m_aWheelSpeed[CARWHEEL_REAR_LEFT] > -2.0f)
m_aWheelSpeed[CARWHEEL_REAR_LEFT] += 0.1f;
}
+ }else{
+ m_aWheelSpeed[CARWHEEL_REAR_LEFT] *= 0.95f;
}
m_aWheelRotation[CARWHEEL_REAR_LEFT] += m_aWheelSpeed[CARWHEEL_REAR_LEFT];
}
if(m_aWheelTimer[CARWHEEL_REAR_RIGHT] <= 0.0f){
- if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f)
- m_aWheelSpeed[CARWHEEL_REAR_RIGHT] *= 0.95f;
- else{
+ if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) && acceleration != 0.0f){
if(acceleration > 0.0f){
if(m_aWheelSpeed[CARWHEEL_REAR_RIGHT] < 2.0f)
m_aWheelSpeed[CARWHEEL_REAR_RIGHT] -= 0.2f;
@@ -969,6 +968,8 @@ CAutomobile::ProcessControl(void)
if(m_aWheelSpeed[CARWHEEL_REAR_RIGHT] > -2.0f)
m_aWheelSpeed[CARWHEEL_REAR_RIGHT] += 0.1f;
}
+ }else{
+ m_aWheelSpeed[CARWHEEL_REAR_RIGHT] *= 0.95f;
}
m_aWheelRotation[CARWHEEL_REAR_RIGHT] += m_aWheelSpeed[CARWHEEL_REAR_RIGHT];
}