diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2021-01-18 21:59:16 +0100 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2021-01-18 21:59:16 +0100 |
commit | ef59c623fd3ab492ccc8826d21d93fc4be825257 (patch) | |
tree | b68bb54324eaef4bbb14868413cde00245576859 /src/vehicles | |
parent | fix (diff) | |
parent | wrong ifdef (diff) | |
download | re3-ef59c623fd3ab492ccc8826d21d93fc4be825257.tar re3-ef59c623fd3ab492ccc8826d21d93fc4be825257.tar.gz re3-ef59c623fd3ab492ccc8826d21d93fc4be825257.tar.bz2 re3-ef59c623fd3ab492ccc8826d21d93fc4be825257.tar.lz re3-ef59c623fd3ab492ccc8826d21d93fc4be825257.tar.xz re3-ef59c623fd3ab492ccc8826d21d93fc4be825257.tar.zst re3-ef59c623fd3ab492ccc8826d21d93fc4be825257.zip |
Diffstat (limited to 'src/vehicles')
-rw-r--r-- | src/vehicles/Automobile.cpp | 51 | ||||
-rw-r--r-- | src/vehicles/HandlingMgr.h | 4 | ||||
-rw-r--r-- | src/vehicles/Vehicle.h | 5 |
3 files changed, 31 insertions, 29 deletions
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index ed187849..966042e2 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -44,6 +44,7 @@ #include "PlayerPed.h" #include "Object.h" #include "Automobile.h" +#include "Wanted.h" bool bAllCarCheat; // unused @@ -592,7 +593,7 @@ CAutomobile::ProcessControl(void) float fwdSpeed = Abs(DotProduct(m_vecMoveSpeed, GetForward())); CVector contactPoints[4]; // relative to model CVector contactSpeeds[4]; // speed at contact points - CVector springDirections[4]; // normalized, in model space + CVector springDirections[4]; // normalized, in world space for(i = 0; i < 4; i++){ // Set spring under certain circumstances @@ -759,10 +760,10 @@ CAutomobile::ProcessControl(void) CVector wheelRight = Multiply3x3(GetMatrix(), CVector(c, s, 0.0f)); if(m_aWheelTimer[CARWHEEL_FRONT_LEFT] > 0.0f){ - if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier)) - fThrust = 0.0f; - else + if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier)) fThrust = acceleration; + else + fThrust = 0.0f; m_aWheelColPoints[CARWHEEL_FRONT_LEFT].surfaceA = SURFACE_WHEELBASE; float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_FRONT_LEFT])*traction; @@ -793,10 +794,10 @@ CAutomobile::ProcessControl(void) } if(m_aWheelTimer[CARWHEEL_FRONT_RIGHT] > 0.0f){ - if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier)) - fThrust = 0.0f; - else + if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier)) fThrust = acceleration; + else + fThrust = 0.0f; m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].surfaceA = SURFACE_WHEELBASE; float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_FRONT_RIGHT])*traction; @@ -830,9 +831,7 @@ CAutomobile::ProcessControl(void) // Process front wheels off ground if(m_aWheelTimer[CARWHEEL_FRONT_LEFT] <= 0.0f){ - if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f) - m_aWheelSpeed[CARWHEEL_FRONT_LEFT] *= 0.95f; - else{ + if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) && acceleration != 0.0f){ if(acceleration > 0.0f){ if(m_aWheelSpeed[CARWHEEL_FRONT_LEFT] < 2.0f) m_aWheelSpeed[CARWHEEL_FRONT_LEFT] -= 0.2f; @@ -840,13 +839,13 @@ CAutomobile::ProcessControl(void) if(m_aWheelSpeed[CARWHEEL_FRONT_LEFT] > -2.0f) m_aWheelSpeed[CARWHEEL_FRONT_LEFT] += 0.1f; } + }else{ + m_aWheelSpeed[CARWHEEL_FRONT_LEFT] *= 0.95f; } m_aWheelRotation[CARWHEEL_FRONT_LEFT] += m_aWheelSpeed[CARWHEEL_FRONT_LEFT]; } if(m_aWheelTimer[CARWHEEL_FRONT_RIGHT] <= 0.0f){ - if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f) - m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] *= 0.95f; - else{ + if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) && acceleration != 0.0f){ if(acceleration > 0.0f){ if(m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] < 2.0f) m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] -= 0.2f; @@ -854,6 +853,8 @@ CAutomobile::ProcessControl(void) if(m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] > -2.0f) m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] += 0.1f; } + }else{ + m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] *= 0.95f; } m_aWheelRotation[CARWHEEL_FRONT_RIGHT] += m_aWheelSpeed[CARWHEEL_FRONT_RIGHT]; } @@ -874,10 +875,10 @@ CAutomobile::ProcessControl(void) #endif if(m_aWheelTimer[CARWHEEL_REAR_LEFT] > 0.0f){ - if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier)) - fThrust = 0.0f; - else + if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier)) fThrust = acceleration; + else + fThrust = 0.0f; m_aWheelColPoints[CARWHEEL_REAR_LEFT].surfaceA = SURFACE_WHEELBASE; float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_REAR_LEFT])*traction; @@ -908,10 +909,10 @@ CAutomobile::ProcessControl(void) } if(m_aWheelTimer[CARWHEEL_REAR_RIGHT] > 0.0f){ - if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier)) - fThrust = 0.0f; - else + if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier)) fThrust = acceleration; + else + fThrust = 0.0f; m_aWheelColPoints[CARWHEEL_REAR_RIGHT].surfaceA = SURFACE_WHEELBASE; float adhesion = CSurfaceTable::GetAdhesiveLimit(m_aWheelColPoints[CARWHEEL_REAR_RIGHT])*traction; @@ -945,9 +946,7 @@ CAutomobile::ProcessControl(void) // Process rear wheels off ground if(m_aWheelTimer[CARWHEEL_REAR_LEFT] <= 0.0f){ - if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f) - m_aWheelSpeed[CARWHEEL_REAR_LEFT] *= 0.95f; - else{ + if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) && acceleration != 0.0f){ if(acceleration > 0.0f){ if(m_aWheelSpeed[CARWHEEL_REAR_LEFT] < 2.0f) m_aWheelSpeed[CARWHEEL_REAR_LEFT] -= 0.2f; @@ -955,13 +954,13 @@ CAutomobile::ProcessControl(void) if(m_aWheelSpeed[CARWHEEL_REAR_LEFT] > -2.0f) m_aWheelSpeed[CARWHEEL_REAR_LEFT] += 0.1f; } + }else{ + m_aWheelSpeed[CARWHEEL_REAR_LEFT] *= 0.95f; } m_aWheelRotation[CARWHEEL_REAR_LEFT] += m_aWheelSpeed[CARWHEEL_REAR_LEFT]; } if(m_aWheelTimer[CARWHEEL_REAR_RIGHT] <= 0.0f){ - if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f) - m_aWheelSpeed[CARWHEEL_REAR_RIGHT] *= 0.95f; - else{ + if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) && acceleration != 0.0f){ if(acceleration > 0.0f){ if(m_aWheelSpeed[CARWHEEL_REAR_RIGHT] < 2.0f) m_aWheelSpeed[CARWHEEL_REAR_RIGHT] -= 0.2f; @@ -969,6 +968,8 @@ CAutomobile::ProcessControl(void) if(m_aWheelSpeed[CARWHEEL_REAR_RIGHT] > -2.0f) m_aWheelSpeed[CARWHEEL_REAR_RIGHT] += 0.1f; } + }else{ + m_aWheelSpeed[CARWHEEL_REAR_RIGHT] *= 0.95f; } m_aWheelRotation[CARWHEEL_REAR_RIGHT] += m_aWheelSpeed[CARWHEEL_REAR_RIGHT]; } diff --git a/src/vehicles/HandlingMgr.h b/src/vehicles/HandlingMgr.h index 05876201..9848bb74 100644 --- a/src/vehicles/HandlingMgr.h +++ b/src/vehicles/HandlingMgr.h @@ -149,8 +149,8 @@ public: void DisplayHandlingData(CVehicle *, tHandlingData *, uint8, bool); int32 GetHandlingId(const char *name); tHandlingData *GetHandlingData(tVehicleType id) { return &HandlingData[id]; } - bool HasRearWheelDrive(tVehicleType id) { return HandlingData[id].Transmission.nDriveType == 'R'; } - bool HasFrontWheelDrive(tVehicleType id) { return HandlingData[id].Transmission.nDriveType == 'F'; } + bool HasRearWheelDrive(tVehicleType id) { return HandlingData[id].Transmission.nDriveType != 'F'; } + bool HasFrontWheelDrive(tVehicleType id) { return HandlingData[id].Transmission.nDriveType != 'R'; } }; VALIDATE_SIZE(cHandlingDataMgr, 0x3030); extern cHandlingDataMgr mod_HandlingManager; diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index 7066a0ea..a6a4f815 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -3,8 +3,9 @@ #include "Physical.h" #include "AutoPilot.h" #include "ModelIndices.h" -#include "AnimManager.h" -#include "Weapon.h" +#include "AnimationId.h" +#include "WeaponType.h" +#include "Collision.h" class CPed; class CFire; |