Vehicle: Automobile: fixes and style things

This commit is contained in:
erorcun 2021-01-02 18:27:11 +03:00
parent 38bca2332d
commit 482ff4562f
4 changed files with 8 additions and 4 deletions

View File

@ -216,6 +216,8 @@ CAutomobile::SetModelIndex(uint32 id)
CVector vecDAMAGE_ENGINE_POS_SMALL(-0.1f, -0.1f, 0.0f);
CVector vecDAMAGE_ENGINE_POS_BIG(-0.5f, -0.3f, 0.0f);
#pragma optimize("", off) // that's what R* did
void
CAutomobile::ProcessControl(void)
{
@ -1214,6 +1216,8 @@ CAutomobile::ProcessControl(void)
}
}
#pragma optimize("", on)
void
CAutomobile::Teleport(CVector pos)
{

View File

@ -143,7 +143,7 @@ cHandlingDataMgr::LoadHandlingData(void)
case 11: handling->fTractionBias = strtod(word, nil); break;
case 12: handling->Transmission.nNumberOfGears = atoi(word); break;
case 13: handling->Transmission.fMaxVelocity = strtod(word, nil); break;
case 14: handling->Transmission.fEngineAcceleration = strtod(word, nil) * 0.4f; break;
case 14: handling->Transmission.fEngineAcceleration = strtod(word, nil) * 0.4; break;
case 15: handling->Transmission.nDriveType = word[0]; break;
case 16: handling->Transmission.nEngineType = word[0]; break;
case 17: handling->fBrakeDeceleration = strtod(word, nil); break;

View File

@ -128,7 +128,7 @@ cTransmission::CalculateDriveAcceleration(const float &gasPedal, uint8 &gear, fl
else
fCheat = 1.0f;
float targetVelocity = Gears[gear].fMaxVelocity*speedMul*fCheat;
float accel = fEngineAcceleration*accelMul * (targetVelocity - fVelocity)/Abs(targetVelocity);
float accel = (targetVelocity - fVelocity) * (fEngineAcceleration*accelMul) / Abs(targetVelocity);
if(Abs(fVelocity) < Abs(Gears[gear].fMaxVelocity*fCheat))
fAcceleration = gasPedal * accel * CTimer::GetTimeStep();
else

View File

@ -531,9 +531,9 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
if(!bBraking){
if(m_fGasPedal < 0.01f){
if(GetModelIndex() == MI_RCBANDIT)
brake = 0.2f * mod_HandlingManager.fWheelFriction / m_fMass;
brake = 0.2f * mod_HandlingManager.fWheelFriction / pHandling->m_fMass;
else
brake = mod_HandlingManager.fWheelFriction / m_fMass;
brake = mod_HandlingManager.fWheelFriction / pHandling->m_fMass;
#ifdef FIX_BUGS
brake *= CTimer::GetTimeStepFix();
#endif