summaryrefslogtreecommitdiffstats
path: root/src/vehicles/Vehicle.cpp
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-06-05 15:09:45 +0200
committeraap <aap@papnet.eu>2020-06-05 15:09:45 +0200
commit1bfb01d5f52e64e4b2d6557e2b7c3f6618671da3 (patch)
tree8ea52a3d6c8a17e42244e464c69639c0fde5431d /src/vehicles/Vehicle.cpp
parentfix (diff)
downloadre3-1bfb01d5f52e64e4b2d6557e2b7c3f6618671da3.tar
re3-1bfb01d5f52e64e4b2d6557e2b7c3f6618671da3.tar.gz
re3-1bfb01d5f52e64e4b2d6557e2b7c3f6618671da3.tar.bz2
re3-1bfb01d5f52e64e4b2d6557e2b7c3f6618671da3.tar.lz
re3-1bfb01d5f52e64e4b2d6557e2b7c3f6618671da3.tar.xz
re3-1bfb01d5f52e64e4b2d6557e2b7c3f6618671da3.tar.zst
re3-1bfb01d5f52e64e4b2d6557e2b7c3f6618671da3.zip
Diffstat (limited to '')
-rw-r--r--src/vehicles/Vehicle.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp
index 764e49cc..ad8bc4d5 100644
--- a/src/vehicles/Vehicle.cpp
+++ b/src/vehicles/Vehicle.cpp
@@ -5,6 +5,8 @@
#include "Timer.h"
#include "Pad.h"
#include "Vehicle.h"
+#include "Bike.h"
+#include "Automobile.h"
#include "Pools.h"
#include "HandlingMgr.h"
#include "CarCtrl.h"
@@ -893,7 +895,7 @@ float fTweakBikeWheelTurnForce = 2.0f;
void
CVehicle::ProcessBikeWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelContactSpeed, CVector &wheelContactPoint,
- int32 wheelsOnGround, float thrust, float brake, float adhesion, float unk, int8 wheelId, float *wheelSpeed, tWheelState *wheelState, eBikeWheelSpecial special, uint16 wheelStatus)
+ int32 wheelsOnGround, float thrust, float brake, float adhesion, float destabTraction, int8 wheelId, float *wheelSpeed, tWheelState *wheelState, eBikeWheelSpecial special, uint16 wheelStatus)
{
// BUG: using statics here is probably a bad idea
static bool bAlreadySkidding = false; // this is never reset
@@ -1010,14 +1012,14 @@ CVehicle::ProcessBikeWheel(CVector &wheelFwd, CVector &wheelRight, CVector &whee
right *= adhesion * tractionLoss / l;
fwd *= adhesion * tractionLoss / l;
- if(unk < 1.0f)
- right *= unk;
- }else if(unk < 1.0f){
+ if(destabTraction < 1.0f)
+ right *= destabTraction;
+ }else if(destabTraction < 1.0f){
if(!bAlreadySkidding)
- unk *= pHandling->fTractionLoss;
- if(sq(adhesion*unk) < speedSq){
+ destabTraction *= pHandling->fTractionLoss;
+ if(sq(adhesion*destabTraction) < speedSq){
float l = Sqrt(speedSq);
- right *= adhesion * unk / l;
+ right *= adhesion * destabTraction / l;
}
}
@@ -1030,15 +1032,14 @@ CVehicle::ProcessBikeWheel(CVector &wheelFwd, CVector &wheelRight, CVector &whee
float impulse = speed*m_fMass;
float turnImpulse = speed*GetMass(wheelContactPoint, direction);
CVector vTurnImpulse = turnImpulse * direction;
- float turnRight = DotProduct(vTurnImpulse, GetRight());
ApplyMoveForce(impulse * direction);
+ float turnRight = DotProduct(vTurnImpulse, GetRight());
float contactRight = DotProduct(wheelContactPoint, GetRight());
float contactFwd = DotProduct(wheelContactPoint, GetForward());
- if(wheelId != CARWHEEL_REAR_LEFT ||
- !bBraking && !bReversing)
+ if(wheelId != BIKEWHEEL_REAR || !bBraking && !bReversing)
ApplyTurnForce((vTurnImpulse - turnRight*GetRight()) * fTweakBikeWheelTurnForce,
wheelContactPoint - contactRight*GetRight());