summaryrefslogtreecommitdiffstats
path: root/src/vehicles/Vehicle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/vehicles/Vehicle.cpp')
-rw-r--r--src/vehicles/Vehicle.cpp44
1 files changed, 28 insertions, 16 deletions
diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp
index a41e0fa0..e684aad7 100644
--- a/src/vehicles/Vehicle.cpp
+++ b/src/vehicles/Vehicle.cpp
@@ -134,6 +134,7 @@ CVehicle::CVehicle(uint8 CreatedBy)
bCreatedAsPoliceVehicle = false;
bRestingOnPhysical = false;
bParking = false;
+ m_bGarageTurnedLightsOff = false;
bCanPark = CGeneral::GetRandomNumberInRange(0.0f, 1.0f) < 0.0f; // never true. probably doesn't work very well
bIsVan = false;
bIsBus = false;
@@ -218,8 +219,8 @@ void
CVehicle::SetModelIndex(uint32 id)
{
CEntity::SetModelIndex(id);
- m_aExtras[0] = CVehicleModelInfo::ms_compsUsed[0];
- m_aExtras[1] = CVehicleModelInfo::ms_compsUsed[1];
+ m_aExtras[0] = CVehicleModelInfo::mspInfo->ms_compsUsed[0];
+ m_aExtras[1] = CVehicleModelInfo::mspInfo->ms_compsUsed[1];
m_nNumMaxPassengers = CVehicleModelInfo::GetMaximumNumberOfPassengersFromNumberOfDoors(id);
}
@@ -772,7 +773,9 @@ CVehicle::BladeColSectorList(CPtrList &list, CColModel &rotorColModel, CMatrix &
}
-float fBurstSpeedMax = 0.3f;
+float WS_ALREADY_SPINNING_LOSS = 0.2f;
+float WS_TRAC_FRAC_LIMIT = 0.3f;
+float fBurstSpeedMax = 0.2f;
float fBurstTyreMod = 0.13f;
void
@@ -800,13 +803,15 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
float contactSpeedFwd = DotProduct(wheelContactSpeed, wheelFwd);
float contactSpeedRight = DotProduct(wheelContactSpeed, wheelRight);
- if(*wheelState != WHEEL_STATE_NORMAL)
+ adhesion *= CTimer::GetTimeStep();
+ if(*wheelState != WHEEL_STATE_NORMAL){
bAlreadySkidding = true;
+ adhesion *= pHandling->fTractionLoss;
+ if(*wheelState == WHEEL_STATE_SPINNING && (GetStatus() == STATUS_PLAYER || GetStatus() == STATUS_PLAYER_REMOTE))
+ adhesion *= 1.0f - Abs(m_fGasPedal) * WS_ALREADY_SPINNING_LOSS;
+ }
*wheelState = WHEEL_STATE_NORMAL;
- adhesion *= CTimer::GetTimeStep();
- if(bAlreadySkidding)
- adhesion *= pHandling->fTractionLoss;
// moving sideways
if(contactSpeedRight != 0.0f){
@@ -846,13 +851,15 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
if(!bBraking){
if(m_fGasPedal < 0.01f){
if(IsBike())
- brake = 0.6f * mod_HandlingManager.fWheelFriction / (pHandling->fMass + 200.0f);
- else if(pHandling->fMass < 500.0f)
- brake = 0.2f * mod_HandlingManager.fWheelFriction / pHandling->fMass;
+ brake = 0.6f * mod_HandlingManager.fWheelFriction / (pHandling->GetMass() + 200.0f);
+ else if(IsPlane())
+ brake = 0.0f;
+ else if(pHandling->GetMass() < 500.0f)
+ brake = 0.1f * mod_HandlingManager.fWheelFriction / pHandling->GetMass();
else if(GetModelIndex() == MI_RCBANDIT)
- brake = 0.2f * mod_HandlingManager.fWheelFriction / pHandling->fMass;
+ brake = 0.2f * mod_HandlingManager.fWheelFriction / pHandling->GetMass();
else
- brake = mod_HandlingManager.fWheelFriction / pHandling->fMass;
+ brake = mod_HandlingManager.fWheelFriction / pHandling->GetMass();
#ifdef FIX_BUGS
brake *= CTimer::GetTimeStepFix();
#endif
@@ -876,7 +883,10 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
float speedSq = sq(right) + sq(fwd);
if(sq(adhesion) < speedSq){
if(*wheelState != WHEEL_STATE_FIXED){
- if(bDriving && contactSpeedFwd < 0.2f)
+ float tractionLimit = WS_TRAC_FRAC_LIMIT;
+ if(contactSpeedFwd > 0.15f && (wheelId == CARWHEEL_FRONT_LEFT || wheelId == CARWHEEL_FRONT_RIGHT))
+ tractionLimit *= 2.0f;
+ if(bDriving && tractionLimit*adhesion < Abs(fwd))
*wheelState = WHEEL_STATE_SPINNING;
else
*wheelState = WHEEL_STATE_SKIDDING;
@@ -884,6 +894,8 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
float l = Sqrt(speedSq);
float tractionLoss = bAlreadySkidding ? 1.0f : pHandling->fTractionLoss;
+ if(*wheelState == WHEEL_STATE_SPINNING && (GetStatus() == STATUS_PLAYER || GetStatus() == STATUS_PLAYER_REMOTE))
+ tractionLoss *= 1.0f - Abs(m_fGasPedal) * WS_ALREADY_SPINNING_LOSS;
right *= adhesion * tractionLoss / l;
fwd *= adhesion * tractionLoss / l;
}
@@ -892,7 +904,7 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
CVector totalSpeed = fwd*wheelFwd + right*wheelRight;
CVector turnDirection = totalSpeed;
- bool separateTurnForce = false; // BUG: not initialized on PC
+ bool separateTurnForce = false;
if(pHandling->fSuspensionAntidiveMultiplier > 0.0f){
if(bBraking){
separateTurnForce = true;
@@ -929,6 +941,7 @@ float fBurstBikeSpeedMax = 0.12f;
float fBurstBikeTyreMod = 0.05f;
float fTweakBikeWheelTurnForce = 2.0f;
+//--LCS: done
void
CVehicle::ProcessBikeWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelContactSpeed, CVector &wheelContactPoint,
int32 wheelsOnGround, float thrust, float brake, float adhesion, float destabTraction, int8 wheelId, float *wheelSpeed, tWheelState *wheelState, eBikeWheelSpecial special, uint16 wheelStatus)
@@ -1849,8 +1862,7 @@ CVehicle::SetDriver(CPed *driver)
case MI_TAXI:
case MI_CABBIE:
- case MI_ZEBRA:
- case MI_KAUFMAN:
+ case MI_BORGNINE:
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 12;
break;