summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-10-08 00:26:34 +0200
committereray orçunus <erayorcunus@gmail.com>2020-10-08 00:26:34 +0200
commit0409907438170ec8f6ab841c5562155019b52d19 (patch)
tree1f5e271c7f3447686fb8b9e5715e9fba14bc19c2 /src
parentMerge branch 'master' of https://github.com/GTAmodding/re3 (diff)
parentlittle renamings & librw update (diff)
downloadre3-0409907438170ec8f6ab841c5562155019b52d19.tar
re3-0409907438170ec8f6ab841c5562155019b52d19.tar.gz
re3-0409907438170ec8f6ab841c5562155019b52d19.tar.bz2
re3-0409907438170ec8f6ab841c5562155019b52d19.tar.lz
re3-0409907438170ec8f6ab841c5562155019b52d19.tar.xz
re3-0409907438170ec8f6ab841c5562155019b52d19.tar.zst
re3-0409907438170ec8f6ab841c5562155019b52d19.zip
Diffstat (limited to 'src')
-rw-r--r--src/vehicles/Vehicle.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp
index 82754fe9..bc77b011 100644
--- a/src/vehicles/Vehicle.cpp
+++ b/src/vehicles/Vehicle.cpp
@@ -290,18 +290,18 @@ CVehicle::FlyingControl(eFlightModel flightModel)
case FLIGHT_MODEL_SEAPLANE:
{
// thrust
+ float fThrust = flightModel == FLIGHT_MODEL_RCPLANE ? fRCAeroThrust : fSeaThrust;
+ float fThrustFallOff = flightModel == FLIGHT_MODEL_RCPLANE ? fRCPropFallOff : fSeaPropFallOff;
+
float fForwSpeed = DotProduct(GetMoveSpeed(), GetForward());
CVector vecTail = GetColModel()->boundingBox.min.y * GetForward();
- float fThrust = (CPad::GetPad(0)->GetAccelerate() - CPad::GetPad(0)->GetBrake()) / 255.0f;
+ float fPedalState = (CPad::GetPad(0)->GetAccelerate() - CPad::GetPad(0)->GetBrake()) / 255.0f;
if (fForwSpeed > 0.1f || (flightModel == FLIGHT_MODEL_RCPLANE && fForwSpeed > 0.02f))
- fThrust += 1.0f;
- else if (fForwSpeed > 0.0f && fThrust < 0.0f)
- fThrust = 0.0f;
- float fThrustAccel;
- if (flightModel == FLIGHT_MODEL_RCPLANE)
- fThrustAccel = (fThrust - fRCPropFallOff * fForwSpeed) * fRCAeroThrust;
- else
- fThrustAccel = (fThrust - fSeaPropFallOff * fForwSpeed) * fSeaThrust;
+ fPedalState += 1.0f;
+ else if (fForwSpeed > 0.0f && fPedalState < 0.0f)
+ fPedalState = 0.0f;
+ float fThrustAccel = (fPedalState - fThrustFallOff * fForwSpeed) * fThrust;
+
ApplyMoveForce(fThrustAccel * GetForward() * m_fMass * CTimer::GetTimeStep());
// left/right
@@ -353,12 +353,12 @@ CVehicle::FlyingControl(eFlightModel flightModel)
fPitchAccel = fSeaTailMult * fTail * Abs(fTail) + fSeaPitchMult * fSteerUD * fForwSpeed;
ApplyTurnForce(fPitchAccel * m_fTurnMass * GetUp() * CTimer::GetTimeStep(), vecTail);
- float fLift = -DotProduct(GetMoveSpeed(), GetUp()) / Max(0.01f, GetMoveSpeed().Magnitude());
+ float fLift = DotProduct(GetMoveSpeed(), GetUp()) / Max(0.01f, GetMoveSpeed().Magnitude()); //accel*angle
float fLiftAccel;
if (flightModel == FLIGHT_MODEL_RCPLANE)
- fLiftAccel = (fRCAttackLiftMult * fLift + fRCFormLiftMult) * fForwSpeed * fForwSpeed;
+ fLiftAccel = (fRCFormLiftMult - fRCAttackLiftMult * fLift) * SQR(fForwSpeed);
else
- fLiftAccel = (fSeaAttackLiftMult * fLift + fSeaFormLiftMult) * fForwSpeed * fForwSpeed;
+ fLiftAccel = (fSeaFormLiftMult - fSeaAttackLiftMult * fLift) * SQR(fForwSpeed);
float fLiftImpulse = fLiftAccel * m_fMass * CTimer::GetTimeStep();
if (GRAVITY * CTimer::GetTimeStep() * m_fMass < fLiftImpulse) {
if (flightModel == FLIGHT_MODEL_RCPLANE && GetPosition().z > 50.0f)