diff options
author | majestic <majesticcoding@gmail.com> | 2020-09-30 12:13:32 +0200 |
---|---|---|
committer | majestic <majesticcoding@gmail.com> | 2020-09-30 12:13:32 +0200 |
commit | d4efd003bc614f20074dd4daf96a2a223ff51bea (patch) | |
tree | cde4b80f479c84fe4a164fe3daef1309785f17be /src/vehicles | |
parent | Experiment (diff) | |
parent | Merge remote-tracking branch 'origin/master' into miami (diff) | |
download | re3-d4efd003bc614f20074dd4daf96a2a223ff51bea.tar re3-d4efd003bc614f20074dd4daf96a2a223ff51bea.tar.gz re3-d4efd003bc614f20074dd4daf96a2a223ff51bea.tar.bz2 re3-d4efd003bc614f20074dd4daf96a2a223ff51bea.tar.lz re3-d4efd003bc614f20074dd4daf96a2a223ff51bea.tar.xz re3-d4efd003bc614f20074dd4daf96a2a223ff51bea.tar.zst re3-d4efd003bc614f20074dd4daf96a2a223ff51bea.zip |
Diffstat (limited to '')
-rw-r--r-- | src/vehicles/Automobile.cpp | 52 | ||||
-rw-r--r-- | src/vehicles/Automobile.h | 3 | ||||
-rw-r--r-- | src/vehicles/Boat.cpp | 4 | ||||
-rw-r--r-- | src/vehicles/CarGen.cpp | 6 | ||||
-rw-r--r-- | src/vehicles/DamageManager.cpp | 2 | ||||
-rw-r--r-- | src/vehicles/Vehicle.cpp | 51 |
6 files changed, 70 insertions, 48 deletions
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index eec44c35..05596e75 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -100,7 +100,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy) } pHandling = mod_HandlingManager.GetHandlingData((eHandlingId)mi->m_handlingId); - pFlyingHandling = mod_HandlingManager.GetFlyingPointer((eHandlingId)mi->m_handlingId); + pFlyingHandling = mod_HandlingManager.GetFlyingPointer((eHandlingId)mi->m_handlingId); m_auto_unused1 = 20.0f; m_auto_unused2 = 0; @@ -1293,7 +1293,7 @@ CAutomobile::ProcessControl(void) // Process front wheels off ground - if(!IsRealHeli()){ + if (!IsRealHeli()) { if(m_aWheelTimer[CARWHEEL_FRONT_LEFT] <= 0.0f){ if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f) m_aWheelSpeed[CARWHEEL_FRONT_LEFT] *= 0.95f; @@ -1384,7 +1384,10 @@ CAutomobile::ProcessControl(void) playRotorSound = true; } }else if((GetModelIndex() == MI_DODO || CVehicle::bAllDodosCheat) && - m_vecMoveSpeed.Magnitude() > 0.0f && CTimer::GetTimeStep() > 0.0f){ +#ifdef FIX_BUGS + !IsRealHeli() && +#endif + m_vecMoveSpeed.Magnitude() > 0.0f && CTimer::GetTimeStep() > 0.0f){ #ifdef ALT_DODO_CHEAT if (bAltDodoCheat) FlyingControl(FLIGHT_MODEL_PLANE); @@ -1397,24 +1400,31 @@ CAutomobile::ProcessControl(void) }else if(GetModelIndex() == MI_RCBARON){ FlyingControl(FLIGHT_MODEL_RCPLANE); }else if(IsRealHeli() || bAllCarCheat){ - // Speed up rotor - if(m_aWheelSpeed[1] < 0.22f && !bIsInWater){ - if(GetModelIndex() == MI_RCRAIDER || GetModelIndex() == MI_RCGOBLIN) - m_aWheelSpeed[1] += 0.003f; - else - m_aWheelSpeed[1] += 0.001f; - } +#ifdef RESTORE_ALLCARSHELI_CHEAT + if (bAllCarCheat) + FlyingControl(FLIGHT_MODEL_HELI); + else +#endif + { + // Speed up rotor + if (m_aWheelSpeed[1] < 0.22f && !bIsInWater) { + if (GetModelIndex() == MI_RCRAIDER || GetModelIndex() == MI_RCGOBLIN) + m_aWheelSpeed[1] += 0.003f; + else + m_aWheelSpeed[1] += 0.001f; + } - // Fly - if(m_aWheelSpeed[1] > 0.15f){ - if(GetModelIndex() == MI_RCRAIDER || GetModelIndex() == MI_RCGOBLIN) - FlyingControl(FLIGHT_MODEL_RCHELI); - else if(m_nWheelsOnGround < 4 && !(GetModelIndex() == MI_SEASPAR && bTouchingWater) || - CPad::GetPad(0)->GetAccelerate() != 0 || CPad::GetPad(0)->GetCarGunUpDown() > 1.0f || - Abs(m_vecMoveSpeed.x) > 0.02f || - Abs(m_vecMoveSpeed.y) > 0.02f || - Abs(m_vecMoveSpeed.z) > 0.02f) - FlyingControl(FLIGHT_MODEL_HELI); + // Fly + if (m_aWheelSpeed[1] > 0.15f) { + if (GetModelIndex() == MI_RCRAIDER || GetModelIndex() == MI_RCGOBLIN) + FlyingControl(FLIGHT_MODEL_RCHELI); + else if (m_nWheelsOnGround < 4 && !(GetModelIndex() == MI_SEASPAR && bTouchingWater) || + CPad::GetPad(0)->GetAccelerate() != 0 || CPad::GetPad(0)->GetCarGunUpDown() > 1.0f || + Abs(m_vecMoveSpeed.x) > 0.02f || + Abs(m_vecMoveSpeed.y) > 0.02f || + Abs(m_vecMoveSpeed.z) > 0.02f) + FlyingControl(FLIGHT_MODEL_HELI); + } } // Blade collision @@ -1486,7 +1496,7 @@ CAutomobile::ProcessControl(void) CMatrix mat; mat.Attach(RwFrameGetMatrix(m_aCarNodes[CAR_BONNET])); CVector blade = mat.GetRight(); - blade = GetMatrix() * blade; + blade = Multiply3x3(blade, GetMatrix()); camDist /= Max(Sqrt(distSq), 0.01f); if(Abs(DotProduct(camDist, blade)) > 0.95f){ DMAudio.PlayOneShot(m_audioEntityId, SOUND_31, 0.0f); diff --git a/src/vehicles/Automobile.h b/src/vehicles/Automobile.h index 3dee998d..b2f0643c 100644 --- a/src/vehicles/Automobile.h +++ b/src/vehicles/Automobile.h @@ -167,4 +167,5 @@ public: static void SetAllTaxiLights(bool set); }; -extern CVector vecHunterGunPos;
\ No newline at end of file +extern CVector vecHunterGunPos; +extern bool bAllCarCheat;
\ No newline at end of file diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp index 086a5002..1664ffd0 100644 --- a/src/vehicles/Boat.cpp +++ b/src/vehicles/Boat.cpp @@ -132,7 +132,11 @@ CBoat::ProcessControl(void) if(bRenderScorched) m_fBuoyancy *= 0.99f; +#ifdef FIX_BUGS + if(FindPlayerPed() && FindPlayerPed()->m_pWanted->m_nWantedLevel > 0 && GetModelIndex() == MI_PREDATOR){ +#else if(FindPlayerPed()->m_pWanted->m_nWantedLevel > 0 && GetModelIndex() == MI_PREDATOR){ +#endif CVehicle *playerVeh = FindPlayerVehicle(); if(playerVeh && playerVeh->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT && (AutoPilot.m_nCarMission == MISSION_RAMPLAYER_FARAWAY || diff --git a/src/vehicles/CarGen.cpp b/src/vehicles/CarGen.cpp index 84a19b82..130bf1e9 100644 --- a/src/vehicles/CarGen.cpp +++ b/src/vehicles/CarGen.cpp @@ -32,7 +32,7 @@ void CCarGenerator::SwitchOff() void CCarGenerator::SwitchOn() { - m_nUsesRemaining = 255; + m_nUsesRemaining = UINT16_MAX; m_nTimer = CalcNextGen(); ++CTheCarGenerators::CurrentActiveCount; } @@ -143,10 +143,10 @@ void CCarGenerator::DoInternalProcessing() m_nVehicleHandle = CPools::GetVehiclePool()->GetIndex(pVehicle); /* I don't think this is a correct comparasion */ #ifdef FIX_BUGS - if (m_nUsesRemaining != 0) + if (m_nUsesRemaining < UINT16_MAX) --m_nUsesRemaining; #else - if (m_nUsesRemaining < -1) + if (m_nUsesRemaining < ~0) --m_nUsesRemaining; #endif m_nTimer = CalcNextGen(); diff --git a/src/vehicles/DamageManager.cpp b/src/vehicles/DamageManager.cpp index e4c28c95..8ba235b7 100644 --- a/src/vehicles/DamageManager.cpp +++ b/src/vehicles/DamageManager.cpp @@ -48,8 +48,10 @@ CDamageManager::FuckCarCompletely(void) #endif } // Why set to no damage? +#ifndef FIX_BUGS m_lightStatus = 0; m_panelStatus = 0; +#endif SetEngineStatus(250); } diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 378a4c0a..2e790e81 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -432,7 +432,12 @@ CVehicle::FlyingControl(eFlightModel flightModel) case FLIGHT_MODEL_RCHELI: case FLIGHT_MODEL_HELI: { - float rm = Pow(pFlyingHandling->fMoveRes, CTimer::GetTimeStep()); +#ifdef RESTORE_ALLCARSHELI_CHEAT + tFlyingHandlingData* flyingHandling = bAllCarCheat && GetStatus() == STATUS_PLAYER && !IsRealHeli() ? mod_HandlingManager.GetFlyingPointer(HANDLING_MAVERICK) : pFlyingHandling; +#else + tFlyingHandlingData* flyingHandling = pFlyingHandling; +#endif + float rm = Pow(flyingHandling->fMoveRes, CTimer::GetTimeStep()); m_vecMoveSpeed *= rm; if (GetStatus() != STATUS_PLAYER && GetStatus() != STATUS_PLAYER_REMOTE) return; @@ -441,11 +446,11 @@ CVehicle::FlyingControl(eFlightModel flightModel) if(fThrust < 0.0f) fThrust *= 2.0f; if(flightModel == FLIGHT_MODEL_RCHELI){ - fThrust = pFlyingHandling->fThrust * fThrust + 0.45f; + fThrust = flyingHandling->fThrust * fThrust + 0.45f; ApplyMoveForce(GRAVITY * CVector(0.0f, 0.0f, 0.5f) * m_fMass * CTimer::GetTimeStep()); }else - fThrust = pFlyingHandling->fThrust * fThrust + 0.95f; - fThrust -= pFlyingHandling->fThrustFallOff * fUpSpeed; + fThrust = flyingHandling->fThrust * fThrust + 0.95f; + fThrust -= flyingHandling->fThrustFallOff * fUpSpeed; if(flightModel == FLIGHT_MODEL_RCHELI && GetPosition().z > 40.0f) fThrust *= 10.0f/(GetPosition().z - 30.0f); else if(GetPosition().z > 80.0f) @@ -453,20 +458,20 @@ CVehicle::FlyingControl(eFlightModel flightModel) ApplyMoveForce(GRAVITY * GetUp() * fThrust * m_fMass * CTimer::GetTimeStep()); if (GetUp().z > 0.0f){ - float upRight = clamp(GetRight().z, -pFlyingHandling->fFormLift, pFlyingHandling->fFormLift); - float upImpulseRight = -upRight * pFlyingHandling->fAttackLift * m_fTurnMass * CTimer::GetTimeStep(); + float upRight = clamp(GetRight().z, -flyingHandling->fFormLift, flyingHandling->fFormLift); + float upImpulseRight = -upRight * flyingHandling->fAttackLift * m_fTurnMass * CTimer::GetTimeStep(); ApplyTurnForce(upImpulseRight * GetUp(), GetRight()); - float upFwd = clamp(GetForward().z, -pFlyingHandling->fFormLift, pFlyingHandling->fFormLift); - float upImpulseFwd = -upFwd * pFlyingHandling->fAttackLift * m_fTurnMass * CTimer::GetTimeStep(); + float upFwd = clamp(GetForward().z, -flyingHandling->fFormLift, flyingHandling->fFormLift); + float upImpulseFwd = -upFwd * flyingHandling->fAttackLift * m_fTurnMass * CTimer::GetTimeStep(); ApplyTurnForce(upImpulseFwd * GetUp(), GetForward()); }else{ - float upRight = GetRight().z < 0.0f ? -pFlyingHandling->fFormLift : pFlyingHandling->fFormLift; - float upImpulseRight = -upRight * pFlyingHandling->fAttackLift * m_fTurnMass * CTimer::GetTimeStep(); + float upRight = GetRight().z < 0.0f ? -flyingHandling->fFormLift : flyingHandling->fFormLift; + float upImpulseRight = -upRight * flyingHandling->fAttackLift * m_fTurnMass * CTimer::GetTimeStep(); ApplyTurnForce(upImpulseRight * GetUp(), GetRight()); - float upFwd = GetForward().z < 0.0f ? -pFlyingHandling->fFormLift : pFlyingHandling->fFormLift; - float upImpulseFwd = -upFwd * pFlyingHandling->fAttackLift * m_fTurnMass * CTimer::GetTimeStep(); + float upFwd = GetForward().z < 0.0f ? -flyingHandling->fFormLift : flyingHandling->fFormLift; + float upImpulseFwd = -upFwd * flyingHandling->fAttackLift * m_fTurnMass * CTimer::GetTimeStep(); ApplyTurnForce(upImpulseFwd * GetUp(), GetForward()); } @@ -490,25 +495,25 @@ CVehicle::FlyingControl(eFlightModel flightModel) fPitch = -CPad::GetPad(0)->GetCarGunUpDown() / 128.0f; if (CPad::GetPad(0)->GetHorn()) { fYaw = 0.0f; - fPitch = clamp(pFlyingHandling->fPitchStab * DotProduct(m_vecMoveSpeed, GetForward()), -200.0f, 1.3f); - fRoll = clamp(pFlyingHandling->fRollStab * DotProduct(m_vecMoveSpeed, GetRight()), -200.0f, 1.3f); + fPitch = clamp(flyingHandling->fPitchStab * DotProduct(m_vecMoveSpeed, GetForward()), -200.0f, 1.3f); + fRoll = clamp(flyingHandling->fRollStab * DotProduct(m_vecMoveSpeed, GetRight()), -200.0f, 1.3f); } - ApplyTurnForce(fPitch * GetUp() * pFlyingHandling->fPitch * m_fTurnMass * CTimer::GetTimeStep(), GetForward()); - ApplyTurnForce(fRoll * GetUp() * pFlyingHandling->fRoll * m_fTurnMass * CTimer::GetTimeStep(), GetRight()); + ApplyTurnForce(fPitch * GetUp() * flyingHandling->fPitch * m_fTurnMass * CTimer::GetTimeStep(), GetForward()); + ApplyTurnForce(fRoll * GetUp() * flyingHandling->fRoll * m_fTurnMass * CTimer::GetTimeStep(), GetRight()); float fSideSpeed = -DotProduct(GetMoveSpeed(), GetRight()); - float fSideSlipAccel = pFlyingHandling->fSideSlip * fSideSpeed * Abs(fSideSpeed); + float fSideSlipAccel = flyingHandling->fSideSlip * fSideSpeed * Abs(fSideSpeed); ApplyMoveForce(m_fMass * GetRight() * fSideSlipAccel * CTimer::GetTimeStep()); - float fYawAccel = pFlyingHandling->fYawStab * fSideSpeed * Abs(fSideSpeed) + pFlyingHandling->fYaw * fYaw; + float fYawAccel = flyingHandling->fYawStab * fSideSpeed * Abs(fSideSpeed) + flyingHandling->fYaw * fYaw; ApplyTurnForce(fYawAccel * GetRight() * m_fTurnMass * CTimer::GetTimeStep(), -GetForward()); - ApplyTurnForce(fYaw * GetForward() * pFlyingHandling->fYaw * m_fTurnMass * CTimer::GetTimeStep(), GetRight()); + ApplyTurnForce(fYaw * GetForward() * flyingHandling->fYaw * m_fTurnMass * CTimer::GetTimeStep(), GetRight()); - float rX = Pow(pFlyingHandling->vecTurnRes.x, CTimer::GetTimeStep()); - float rY = Pow(pFlyingHandling->vecTurnRes.y, CTimer::GetTimeStep()); - float rZ = Pow(pFlyingHandling->vecTurnRes.z, CTimer::GetTimeStep()); + float rX = Pow(flyingHandling->vecTurnRes.x, CTimer::GetTimeStep()); + float rY = Pow(flyingHandling->vecTurnRes.y, CTimer::GetTimeStep()); + float rZ = Pow(flyingHandling->vecTurnRes.z, CTimer::GetTimeStep()); CVector vecTurnSpeed = Multiply3x3(m_vecTurnSpeed, GetMatrix()); - float fResistanceMultiplier = Pow(1.0f / (pFlyingHandling->vecSpeedRes.z * SQR(vecTurnSpeed.z) + 1.0f) * rZ, CTimer::GetTimeStep()); + float fResistanceMultiplier = Pow(1.0f / (flyingHandling->vecSpeedRes.z * SQR(vecTurnSpeed.z) + 1.0f) * rZ, CTimer::GetTimeStep()); float fResistance = vecTurnSpeed.z * fResistanceMultiplier - vecTurnSpeed.z; vecTurnSpeed.x *= rX; vecTurnSpeed.y *= rY; |