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_SMALL(-0.1f, -0.1f, 0.0f);
CVector vecDAMAGE_ENGINE_POS_BIG(-0.5f, -0.3f, 0.0f); CVector vecDAMAGE_ENGINE_POS_BIG(-0.5f, -0.3f, 0.0f);
#pragma optimize("", off) // that's what R* did
void void
CAutomobile::ProcessControl(void) CAutomobile::ProcessControl(void)
{ {
@ -1214,6 +1216,8 @@ CAutomobile::ProcessControl(void)
} }
} }
#pragma optimize("", on)
void void
CAutomobile::Teleport(CVector pos) CAutomobile::Teleport(CVector pos)
{ {

View file

@ -143,7 +143,7 @@ cHandlingDataMgr::LoadHandlingData(void)
case 11: handling->fTractionBias = strtod(word, nil); break; case 11: handling->fTractionBias = strtod(word, nil); break;
case 12: handling->Transmission.nNumberOfGears = atoi(word); break; case 12: handling->Transmission.nNumberOfGears = atoi(word); break;
case 13: handling->Transmission.fMaxVelocity = strtod(word, nil); 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 15: handling->Transmission.nDriveType = word[0]; break;
case 16: handling->Transmission.nEngineType = word[0]; break; case 16: handling->Transmission.nEngineType = word[0]; break;
case 17: handling->fBrakeDeceleration = strtod(word, nil); break; case 17: handling->fBrakeDeceleration = strtod(word, nil); break;

View file

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

View file

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