new implementation for car fly enhancment

This commit is contained in:
Roman Masanin 2020-09-30 13:37:43 +03:00
parent fae4c73ad3
commit db0758690e
2 changed files with 14 additions and 3 deletions

View File

@ -1390,7 +1390,7 @@ CAutomobile::ProcessControl(void)
m_vecMoveSpeed.Magnitude() > 0.0f && CTimer::GetTimeStep() > 0.0f){ m_vecMoveSpeed.Magnitude() > 0.0f && CTimer::GetTimeStep() > 0.0f){
#ifdef ALT_DODO_CHEAT #ifdef ALT_DODO_CHEAT
if (bAltDodoCheat) if (bAltDodoCheat)
FlyingControl(FLIGHT_MODEL_PLANE); FlyingControl(FLIGHT_MODEL_PLANE_UNUSED);
else else
#endif #endif
if(GetModelIndex() == MI_DODO) if(GetModelIndex() == MI_DODO)

View File

@ -351,14 +351,25 @@ CVehicle::FlyingControl(eFlightModel flightModel)
fSteerUD *= -fSteerMult; fSteerUD *= -fSteerMult;
// thrust // thrust
float fHandlingThrust = pFlyingHandling->fThrust;
float fThrustFallOff = pFlyingHandling->fThrustFallOff;
float fThrustFallOffBack = pFlyingHandling->fThrustFallOff * 8.0f;
#ifdef ALT_DODO_CHEAT
if (bAltDodoCheat && !IsRealPlane()) {
fHandlingThrust = pHandling->Transmission.fEngineAcceleration;
fHandlingThrust *= pHandling->Transmission.nDriveType == '4' ? 4 : 2;
fThrustFallOff = 0.7f / pHandling->Transmission.fMaxVelocity;
fThrustFallOffBack = 0.7f / pHandling->Transmission.fMaxReverseVelocity;
}
#endif // ALT_DOOD_CHEAT
float fForwSpeed = DotProduct(GetMoveSpeed(), GetForward()); float fForwSpeed = DotProduct(GetMoveSpeed(), GetForward());
CVector vecTail = GetColModel()->boundingBox.min.y * GetForward(); CVector vecTail = GetColModel()->boundingBox.min.y * GetForward();
float fThrust = (CPad::GetPad(0)->GetAccelerate() - CPad::GetPad(0)->GetBrake()) / 255.0f; float fThrust = (CPad::GetPad(0)->GetAccelerate() - CPad::GetPad(0)->GetBrake()) / 255.0f;
float fThrustAccel; float fThrustAccel;
if(fForwSpeed > 0.0f || fThrust > 0.0f) if(fForwSpeed > 0.0f || fThrust > 0.0f)
fThrustAccel = (fThrust - pFlyingHandling->fThrustFallOff * fForwSpeed) * pFlyingHandling->fThrust; fThrustAccel = (fThrust - fThrustFallOff * fForwSpeed) * fHandlingThrust;
else else
fThrustAccel = Min(fThrust - 8.0f * pFlyingHandling->fThrustFallOff * fForwSpeed, 0.0f) * pFlyingHandling->fThrust; fThrustAccel = Min(fThrust - fThrustFallOffBack * fForwSpeed, 0.0f) * fHandlingThrust;
if(flightModel == FLIGHT_MODEL_PLANE_UNUSED) if(flightModel == FLIGHT_MODEL_PLANE_UNUSED)
fThrustAccel *= 0.3f; fThrustAccel *= 0.3f;
else if(flightModel == FLIGHT_MODEL_PLANE) else if(flightModel == FLIGHT_MODEL_PLANE)