mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-11-05 09:25:54 +00:00
vehicle fixes
This commit is contained in:
parent
72b25cd3a8
commit
913a001375
|
@ -151,7 +151,7 @@ void PickUpChicksCheat()
|
|||
if ( FindPlayerVehicle() && (FindPlayerVehicle()->IsCar() || FindPlayerVehicle()->IsBike()) )
|
||||
{
|
||||
CVehicle *vehicle = FindPlayerVehicle();
|
||||
if ( FindPlayerVehicle()->m_vehType == 5 )
|
||||
if ( FindPlayerVehicle()->IsBike() )
|
||||
{
|
||||
if ( vehicle->pPassengers[0] )
|
||||
vehicle->pPassengers[0]->SetObjective(OBJECTIVE_LEAVE_CAR, vehicle);
|
||||
|
|
|
@ -547,21 +547,21 @@ CPhysical::ApplyGravity(void)
|
|||
return;
|
||||
#ifdef WALLCLIMB_CHEAT
|
||||
if (gGravityCheat && this == FindPlayerVehicle()) {
|
||||
static CVector v1(0.0f, 0.0f, 1.0f), v2(0.0f, 0.0f, 1.0f);
|
||||
CVector prop = GetPosition() - (GetUp() + GetUp());
|
||||
static CVector gravityUp(0.0f, 0.0f, 1.0f), surfaceUp(0.0f, 0.0f, 1.0f);
|
||||
CVector belowCar = GetPosition() - 2.0f*GetUp();
|
||||
CColPoint point;
|
||||
CEntity* entity;
|
||||
if (CWorld::ProcessLineOfSight(GetPosition(), prop, point, entity, true, false, false, false, false, false))
|
||||
v2 = point.normal;
|
||||
if (CWorld::ProcessLineOfSight(GetPosition(), belowCar, point, entity, true, false, false, false, false, false))
|
||||
surfaceUp = point.normal;
|
||||
else
|
||||
v2 = CVector(0.0f, 0.0f, 1.0f);
|
||||
float coef = clamp(CTimer::GetTimeStep() * 0.5f, 0.05f, 0.8f);
|
||||
v1 = v1 * (1.0f - coef) + v2 * coef;
|
||||
if (v1.MagnitudeSqr() < 0.1f)
|
||||
v1 = CVector(0.0f, 0.0f, 1.0f);
|
||||
surfaceUp = CVector(0.0f, 0.0f, 1.0f);
|
||||
float t = clamp(CTimer::GetTimeStep() * 0.5f, 0.05f, 0.8f);
|
||||
gravityUp = gravityUp * (1.0f - t) + surfaceUp * t;
|
||||
if (gravityUp.MagnitudeSqr() < 0.1f)
|
||||
gravityUp = CVector(0.0f, 0.0f, 1.0f);
|
||||
else
|
||||
v1.Normalise();
|
||||
m_vecMoveSpeed -= GRAVITY * CTimer::GetTimeStep() * v1;
|
||||
gravityUp.Normalise();
|
||||
m_vecMoveSpeed -= GRAVITY * CTimer::GetTimeStep() * gravityUp;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -737,7 +737,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
|
||||
|
@ -925,10 +925,10 @@ CAutomobile::ProcessControl(void)
|
|||
CVector wheelFwd, wheelRight, tmp;
|
||||
|
||||
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;
|
||||
|
||||
wheelFwd = GetForward();
|
||||
wheelFwd -= DotProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_FRONT_LEFT].normal)*m_aWheelColPoints[CARWHEEL_FRONT_LEFT].normal;
|
||||
|
@ -968,10 +968,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;
|
||||
|
||||
wheelFwd = GetForward();
|
||||
wheelFwd -= DotProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].normal)*m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].normal;
|
||||
|
@ -1015,9 +1015,7 @@ CAutomobile::ProcessControl(void)
|
|||
|
||||
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;
|
||||
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;
|
||||
|
@ -1025,13 +1023,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;
|
||||
|
@ -1039,6 +1037,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];
|
||||
}
|
||||
|
@ -1065,7 +1065,7 @@ CAutomobile::ProcessControl(void)
|
|||
if(m_fTireTemperature > 2.0f)
|
||||
m_fTireTemperature = 2.0f;
|
||||
}
|
||||
}else if(m_doingBurnout && !mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier)){
|
||||
}else if(m_doingBurnout && mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier)){
|
||||
rearBrake = 0.0f;
|
||||
rearTraction = 0.0f;
|
||||
// BUG: missing timestep
|
||||
|
@ -1075,10 +1075,10 @@ CAutomobile::ProcessControl(void)
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
wheelFwd -= DotProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_REAR_LEFT].normal)*m_aWheelColPoints[CARWHEEL_REAR_LEFT].normal;
|
||||
wheelFwd.Normalise();
|
||||
|
@ -1120,10 +1120,10 @@ CAutomobile::ProcessControl(void)
|
|||
#endif
|
||||
|
||||
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;
|
||||
|
||||
wheelFwd -= DotProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_REAR_RIGHT].normal)*m_aWheelColPoints[CARWHEEL_REAR_RIGHT].normal;
|
||||
wheelFwd.Normalise();
|
||||
|
@ -1159,7 +1159,7 @@ CAutomobile::ProcessControl(void)
|
|||
}
|
||||
}
|
||||
|
||||
if(m_doingBurnout && !mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) &&
|
||||
if(m_doingBurnout && mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) &&
|
||||
(m_aWheelState[CARWHEEL_REAR_LEFT] == WHEEL_STATE_SPINNING || m_aWheelState[CARWHEEL_REAR_RIGHT] == WHEEL_STATE_SPINNING)){
|
||||
m_fTireTemperature += 0.001f*CTimer::GetTimeStep();
|
||||
if(m_fTireTemperature > 3.0f)
|
||||
|
@ -1174,9 +1174,7 @@ CAutomobile::ProcessControl(void)
|
|||
if(m_aWheelTimer[CARWHEEL_REAR_LEFT] <= 0.0f){
|
||||
if(bIsHandbrakeOn)
|
||||
m_aWheelSpeed[CARWHEEL_REAR_LEFT] = 0.0f;
|
||||
else if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f)
|
||||
m_aWheelSpeed[CARWHEEL_REAR_LEFT] *= 0.95f;
|
||||
else{
|
||||
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;
|
||||
|
@ -1184,15 +1182,15 @@ 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(bIsHandbrakeOn)
|
||||
m_aWheelSpeed[CARWHEEL_REAR_RIGHT] = 0.0f;
|
||||
else if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f)
|
||||
m_aWheelSpeed[CARWHEEL_REAR_RIGHT] *= 0.95f;
|
||||
else{
|
||||
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;
|
||||
|
@ -1200,6 +1198,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];
|
||||
}
|
||||
|
@ -1215,10 +1215,10 @@ CAutomobile::ProcessControl(void)
|
|||
CVector wheelFwd, wheelRight, tmp;
|
||||
|
||||
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;
|
||||
|
||||
wheelFwd = GetForward();
|
||||
wheelFwd -= DotProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_FRONT_LEFT].normal)*m_aWheelColPoints[CARWHEEL_FRONT_LEFT].normal;
|
||||
|
@ -1258,10 +1258,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;
|
||||
|
||||
wheelFwd = GetForward();
|
||||
wheelFwd -= DotProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].normal)*m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].normal;
|
||||
|
@ -1305,9 +1305,7 @@ CAutomobile::ProcessControl(void)
|
|||
|
||||
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;
|
||||
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;
|
||||
|
@ -1315,13 +1313,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;
|
||||
|
@ -1329,6 +1327,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];
|
||||
}
|
||||
|
|
|
@ -273,7 +273,7 @@ public:
|
|||
tBikeHandlingData *GetBikePointer(uint8 id) { return &BikeHandlingData[id-HANDLING_BIKE]; }
|
||||
tFlyingHandlingData *GetFlyingPointer(uint8 id);
|
||||
tBoatHandlingData *GetBoatPointer(uint8 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'; }
|
||||
};
|
||||
extern cHandlingDataMgr mod_HandlingManager;
|
||||
|
|
Loading…
Reference in a new issue