From 482ff4562f2ed4806c0e51f96b656a7ad80445c7 Mon Sep 17 00:00:00 2001 From: erorcun Date: Sat, 2 Jan 2021 18:27:11 +0300 Subject: Vehicle: Automobile: fixes and style things --- src/vehicles/Automobile.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/vehicles/Automobile.cpp') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 79d3f6af..e66865da 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -216,6 +216,8 @@ CAutomobile::SetModelIndex(uint32 id) CVector vecDAMAGE_ENGINE_POS_SMALL(-0.1f, -0.1f, 0.0f); CVector vecDAMAGE_ENGINE_POS_BIG(-0.5f, -0.3f, 0.0f); +#pragma optimize("", off) // that's what R* did + void CAutomobile::ProcessControl(void) { @@ -1214,6 +1216,8 @@ CAutomobile::ProcessControl(void) } } +#pragma optimize("", on) + void CAutomobile::Teleport(CVector pos) { -- cgit v1.2.3 From 2e734a47504c13b1d5e5b7382d7c23e74c6ad4b8 Mon Sep 17 00:00:00 2001 From: erorcun Date: Tue, 5 Jan 2021 13:45:20 +0300 Subject: Automobile: more pointless fixes --- src/vehicles/Automobile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/vehicles/Automobile.cpp') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index e66865da..753b853d 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -224,6 +224,7 @@ CAutomobile::ProcessControl(void) int i; float wheelRot; CColModel *colModel; + float brake = 0.0f; if(bUsingSpecialColModel) colModel = &CWorld::Players[CWorld::PlayerInFocus].m_ColModel; @@ -539,7 +540,6 @@ CAutomobile::ProcessControl(void) break; } - float brake; if(skipPhysics){ bHasContacted = false; bIsInSafePosition = false; @@ -725,7 +725,7 @@ CAutomobile::ProcessControl(void) traction *= 4.0f; if(FindPlayerVehicle() && FindPlayerVehicle() == this){ - if(CPad::GetPad(0)->WeaponJustDown()){ + if(CPad::GetPad(0)->CarGunJustDown()){ if(m_bombType == CARBOMB_TIMED){ m_bombType = CARBOMB_TIMEDACTIVE; m_nBombTimer = 7000; -- cgit v1.2.3 From 8eed6ae1794989eb15fe95d867c44c196080c4dd Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 8 Jan 2021 21:50:59 +0200 Subject: Use original names --- src/vehicles/Automobile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/vehicles/Automobile.cpp') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 753b853d..8f034126 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -4582,7 +4582,7 @@ CAutomobile::SetBumperDamage(int32 component, ePanels panel, bool noFlyingCompon int status = Damage.GetPanelStatus(panel); if(m_aCarNodes[component] == nil){ printf("Trying to damage component %d of %s\n", - component, CModelInfo::GetModelInfo(GetModelIndex())->GetName()); + component, CModelInfo::GetModelInfo(GetModelIndex())->GetModelName()); return; } if(status == PANEL_STATUS_SMASHED1){ @@ -4602,7 +4602,7 @@ CAutomobile::SetDoorDamage(int32 component, eDoors door, bool noFlyingComponents int status = Damage.GetDoorStatus(door); if(m_aCarNodes[component] == nil){ printf("Trying to damage component %d of %s\n", - component, CModelInfo::GetModelInfo(GetModelIndex())->GetName()); + component, CModelInfo::GetModelInfo(GetModelIndex())->GetModelName()); return; } -- cgit v1.2.3 From 8aaa3c4884d6ca3e3d46824fbcfa23bb974328d0 Mon Sep 17 00:00:00 2001 From: erorcun Date: Mon, 11 Jan 2021 01:10:24 +0300 Subject: Automobile: fix --- src/vehicles/Automobile.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/vehicles/Automobile.cpp') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 8f034126..ed187849 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -239,17 +239,17 @@ CAutomobile::ProcessControl(void) // Improve grip of vehicles in certain cases bool strongGrip1 = false; bool strongGrip2 = false; - if(FindPlayerVehicle() && this != FindPlayerVehicle() && + if(FindPlayerVehicle() && this != FindPlayerVehicle() && FindPlayerPed()->m_pWanted->m_nWantedLevel > 3 && (AutoPilot.m_nCarMission == MISSION_RAMPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_RAMPLAYER_CLOSE || - AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_CLOSE)){ - if(FindPlayerSpeed().Magnitude() > 0.3f){ - strongGrip1 = true; - if(FindPlayerSpeed().Magnitude() > 0.4f && - m_vecMoveSpeed.Magnitude() < 0.3f) - strongGrip2 = true; - else if((GetPosition() - FindPlayerCoors()).Magnitude() > 50.0f) - strongGrip2 = true; - } + AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_CLOSE) && + FindPlayerSpeed().Magnitude() > 0.3f){ + + strongGrip1 = true; + if(FindPlayerSpeed().Magnitude() > 0.4f && + m_vecMoveSpeed.Magnitude() < 0.3f) + strongGrip2 = true; + else if((GetPosition() - FindPlayerCoors()).Magnitude() > 50.0f) + strongGrip2 = true; } if(bIsBus) -- cgit v1.2.3 From 357b67e3f5ba130f00cd965aeab0eb05fc94d51d Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 17 Jan 2021 10:00:34 +0100 Subject: vehicle fixes --- src/vehicles/Automobile.cpp | 50 ++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'src/vehicles/Automobile.cpp') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index ed187849..d5a0fefa 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -592,7 +592,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 +759,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 +793,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 +830,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 +838,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 +852,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 +874,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 +908,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 +945,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 +953,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 +967,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]; } -- cgit v1.2.3 From 5a47379bf5f011a65c1d0f88a0cb5f2130feb9db Mon Sep 17 00:00:00 2001 From: erorcun Date: Sat, 16 Jan 2021 16:44:59 +0300 Subject: Includes overhaul, fix some compiler warnings --- src/vehicles/Automobile.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/vehicles/Automobile.cpp') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index d5a0fefa..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 -- cgit v1.2.3 From ac0f759b274368b9424222a392d9f28b73980eb0 Mon Sep 17 00:00:00 2001 From: withmorten Date: Tue, 19 Jan 2021 13:35:48 +0100 Subject: make building with Codewarrior 7 possible --- src/vehicles/Automobile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/vehicles/Automobile.cpp') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 966042e2..77173538 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -1,4 +1,4 @@ -#include "common.h" +#include "common.h" #include "main.h" #include "General.h" -- cgit v1.2.3 From 497e0b801ff30cf836887b625752c1643b533a7e Mon Sep 17 00:00:00 2001 From: withmorten Date: Fri, 22 Jan 2021 00:19:44 +0100 Subject: m_nWantedLevel -> GetWantedLevel() --- src/vehicles/Automobile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/vehicles/Automobile.cpp') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 77173538..7e8c4702 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -240,7 +240,7 @@ CAutomobile::ProcessControl(void) // Improve grip of vehicles in certain cases bool strongGrip1 = false; bool strongGrip2 = false; - if(FindPlayerVehicle() && this != FindPlayerVehicle() && FindPlayerPed()->m_pWanted->m_nWantedLevel > 3 && + if(FindPlayerVehicle() && this != FindPlayerVehicle() && FindPlayerPed()->m_pWanted->GetWantedLevel() > 3 && (AutoPilot.m_nCarMission == MISSION_RAMPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_RAMPLAYER_CLOSE || AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_CLOSE) && FindPlayerSpeed().Magnitude() > 0.3f){ -- cgit v1.2.3 From 0f623c23543166a67c7fd1881cc05995dd274bba Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Tue, 26 Jan 2021 19:35:40 +0200 Subject: Use original animation names from VCS --- src/vehicles/Automobile.cpp | 78 ++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 39 deletions(-) (limited to 'src/vehicles/Automobile.cpp') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 7e8c4702..4863b945 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -3058,21 +3058,21 @@ CAutomobile::DoDriveByShootings(void) if(lookingLeft || lookingRight){ if(lookingLeft){ - anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_DRIVEBY_R); + anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_STD_CAR_DRIVEBY_RIGHT); if(anim) anim->blendDelta = -1000.0f; - anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_DRIVEBY_L); + anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_STD_CAR_DRIVEBY_LEFT); if(anim == nil || anim->blendDelta < 0.0f) - CAnimManager::AddAnimation(pDriver->GetClump(), ASSOCGRP_STD, ANIM_DRIVEBY_L); + CAnimManager::AddAnimation(pDriver->GetClump(), ASSOCGRP_STD, ANIM_STD_CAR_DRIVEBY_LEFT); else anim->SetRun(); }else if(pDriver->m_pMyVehicle->pPassengers[0] == nil || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON){ - anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_DRIVEBY_L); + anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_STD_CAR_DRIVEBY_LEFT); if(anim) anim->blendDelta = -1000.0f; - anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_DRIVEBY_R); + anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_STD_CAR_DRIVEBY_RIGHT); if(anim == nil || anim->blendDelta < 0.0f) - CAnimManager::AddAnimation(pDriver->GetClump(), ASSOCGRP_STD, ANIM_DRIVEBY_R); + CAnimManager::AddAnimation(pDriver->GetClump(), ASSOCGRP_STD, ANIM_STD_CAR_DRIVEBY_RIGHT); else anim->SetRun(); } @@ -3083,10 +3083,10 @@ CAutomobile::DoDriveByShootings(void) } }else{ weapon->Reload(); - anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_DRIVEBY_L); + anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_STD_CAR_DRIVEBY_LEFT); if(anim) anim->blendDelta = -1000.0f; - anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_DRIVEBY_R); + anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_STD_CAR_DRIVEBY_RIGHT); if(anim) anim->blendDelta = -1000.0f; } @@ -3094,11 +3094,11 @@ CAutomobile::DoDriveByShootings(void) // TODO: what is this? if(!lookingLeft && m_weaponDoorTimerLeft > 0.0f){ m_weaponDoorTimerLeft = Max(m_weaponDoorTimerLeft - CTimer::GetTimeStep()*0.1f, 0.0f); - ProcessOpenDoor(CAR_DOOR_LF, NUM_ANIMS, m_weaponDoorTimerLeft); + ProcessOpenDoor(CAR_DOOR_LF, ANIM_STD_NUM, m_weaponDoorTimerLeft); } if(!lookingRight && m_weaponDoorTimerRight > 0.0f){ m_weaponDoorTimerRight = Max(m_weaponDoorTimerRight - CTimer::GetTimeStep()*0.1f, 0.0f); - ProcessOpenDoor(CAR_DOOR_RF, NUM_ANIMS, m_weaponDoorTimerRight); + ProcessOpenDoor(CAR_DOOR_RF, ANIM_STD_NUM, m_weaponDoorTimerRight); } } @@ -3736,55 +3736,55 @@ CAutomobile::ProcessOpenDoor(uint32 component, uint32 anim, float time) return; switch(anim){ - case ANIM_CAR_QJACK: - case ANIM_CAR_OPEN_LHS: - case ANIM_CAR_OPEN_RHS: + case ANIM_STD_QUICKJACK: + case ANIM_STD_CAR_OPEN_DOOR_LHS: + case ANIM_STD_CAR_OPEN_DOOR_RHS: ProcessDoorOpenAnimation(this, component, door, time, 0.66f, 0.8f); break; - case ANIM_CAR_CLOSEDOOR_LHS: - case ANIM_CAR_CLOSEDOOR_LOW_LHS: - case ANIM_CAR_CLOSEDOOR_RHS: - case ANIM_CAR_CLOSEDOOR_LOW_RHS: + case ANIM_STD_CAR_CLOSE_DOOR_LHS: + case ANIM_STD_CAR_CLOSE_DOOR_LO_LHS: + case ANIM_STD_CAR_CLOSE_DOOR_RHS: + case ANIM_STD_CAR_CLOSE_DOOR_LO_RHS: ProcessDoorCloseAnimation(this, component, door, time, 0.2f, 0.63f); break; - case ANIM_CAR_ROLLDOOR: - case ANIM_CAR_ROLLDOOR_LOW: + case ANIM_STD_CAR_CLOSE_DOOR_ROLLING_LHS: + case ANIM_STD_CAR_CLOSE_DOOR_ROLLING_LO_LHS: ProcessDoorOpenCloseAnimation(this, component, door, time, 0.1f, 0.6f, 0.95f); break; - case ANIM_CAR_GETOUT_LHS: - case ANIM_CAR_GETOUT_LOW_LHS: - case ANIM_CAR_GETOUT_RHS: - case ANIM_CAR_GETOUT_LOW_RHS: + case ANIM_STD_GETOUT_LHS: + case ANIM_STD_GETOUT_LO_LHS: + case ANIM_STD_GETOUT_RHS: + case ANIM_STD_GETOUT_LO_RHS: ProcessDoorOpenAnimation(this, component, door, time, 0.06f, 0.43f); break; - case ANIM_CAR_CLOSE_LHS: - case ANIM_CAR_CLOSE_RHS: + case ANIM_STD_CAR_CLOSE_LHS: + case ANIM_STD_CAR_CLOSE_RHS: ProcessDoorCloseAnimation(this, component, door, time, 0.1f, 0.23f); break; - case ANIM_CAR_PULLOUT_RHS: - case ANIM_CAR_PULLOUT_LOW_RHS: + case ANIM_STD_CAR_PULL_OUT_PED_RHS: + case ANIM_STD_CAR_PULL_OUT_PED_LO_RHS: OpenDoor(component, door, 1.0f); break; - case ANIM_COACH_OPEN_L: - case ANIM_COACH_OPEN_R: + case ANIM_STD_COACH_OPEN_LHS: + case ANIM_STD_COACH_OPEN_RHS: ProcessDoorOpenAnimation(this, component, door, time, 0.66f, 0.8f); break; - case ANIM_COACH_OUT_L: + case ANIM_STD_COACH_GET_OUT_LHS: ProcessDoorOpenAnimation(this, component, door, time, 0.0f, 0.3f); break; - case ANIM_VAN_OPEN_L: - case ANIM_VAN_OPEN: + case ANIM_STD_VAN_OPEN_DOOR_REAR_LHS: + case ANIM_STD_VAN_OPEN_DOOR_REAR_RHS: ProcessDoorOpenAnimation(this, component, door, time, 0.37f, 0.55f); break; - case ANIM_VAN_CLOSE_L: - case ANIM_VAN_CLOSE: + case ANIM_STD_VAN_CLOSE_DOOR_REAR_LHS: + case ANIM_STD_VAN_CLOSE_DOOR_REAR_RHS: ProcessDoorCloseAnimation(this, component, door, time, 0.5f, 0.8f); break; - case ANIM_VAN_GETOUT_L: - case ANIM_VAN_GETOUT: + case ANIM_STD_VAN_GET_OUT_REAR_LHS: + case ANIM_STD_VAN_GET_OUT_REAR_RHS: ProcessDoorOpenAnimation(this, component, door, time, 0.5f, 0.6f); break; - case NUM_ANIMS: + case ANIM_STD_NUM: OpenDoor(component, door, time); break; } @@ -3879,7 +3879,7 @@ CAutomobile::BlowUpCar(CEntity *culprit) if(!pDriver->IsPlayer()) pDriver->FlagToDestroyWhenNextProcessed(); }else - pDriver->SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f); + pDriver->SetDie(ANIM_STD_KO_FRONT, 4.0f, 0.0f); } for(i = 0; i < m_nNumMaxPassengers; i++){ if(pPassengers[i]){ @@ -3889,7 +3889,7 @@ CAutomobile::BlowUpCar(CEntity *culprit) if(!pPassengers[i]->IsPlayer()) pPassengers[i]->FlagToDestroyWhenNextProcessed(); }else - pPassengers[i]->SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f); + pPassengers[i]->SetDie(ANIM_STD_KO_FRONT, 4.0f, 0.0f); } } -- cgit v1.2.3 From 82ebd8aae1c64f149877897dd1862bf83cad7e5a Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Mon, 22 Feb 2021 17:47:58 +0200 Subject: Fix controls --- src/vehicles/Automobile.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/vehicles/Automobile.cpp') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 4863b945..c2cf26b9 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -333,7 +333,11 @@ CAutomobile::ProcessControl(void) bool playerRemote = false; switch(GetStatus()){ case STATUS_PLAYER_REMOTE: - if(CPad::GetPad(0)->WeaponJustDown()){ +#ifdef FIX_BUGS + if (CPad::GetPad(0)->CarGunJustDown()) { +#else + if (CPad::GetPad(0)->WeaponJustDown()) { +#endif BlowUpCar(FindPlayerPed()); CRemote::TakeRemoteControlledCarFromPlayer(); } @@ -2372,7 +2376,11 @@ void CAutomobile::FireTruckControl(void) { if(this == FindPlayerVehicle()){ - if(!CPad::GetPad(0)->GetWeapon()) +#ifdef FIX_BUGS + if (!CPad::GetPad(0)->GetCarGunFired()) +#else + if (!CPad::GetPad(0)->GetWeapon()) +#endif // FIX_BUGS return; #ifdef FREE_CAM if (!CCamera::bFreeCam) @@ -3054,7 +3062,7 @@ CAutomobile::DoDriveByShootings(void) lookingLeft = true; if(TheCamera.Cams[TheCamera.ActiveCam].LookingRight) lookingRight = true; - } + } if(lookingLeft || lookingRight){ if(lookingLeft){ -- cgit v1.2.3 From 8488dc791aa0f14958c2ac46bbf45e9812e14331 Mon Sep 17 00:00:00 2001 From: erorcun Date: Sun, 28 Feb 2021 17:18:48 +0300 Subject: Pointless fixes --- src/vehicles/Automobile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/vehicles/Automobile.cpp') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index c2cf26b9..c29c0536 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -4050,7 +4050,7 @@ CAutomobile::GetHeightAboveRoad(void) void CAutomobile::PlayCarHorn(void) { - int r; + uint32 r; if(m_nCarHornTimer != 0) return; -- cgit v1.2.3 From 2b67aba94cb6448fb24c869559465eddf2bad069 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 25 Jun 2021 19:03:05 +0300 Subject: Redo ReadSaveBuf + common.h cleanup --- src/vehicles/Automobile.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/vehicles/Automobile.cpp') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index c29c0536..7be6ed0b 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -45,6 +45,7 @@ #include "Object.h" #include "Automobile.h" #include "Wanted.h" +#include "SaveBuf.h" bool bAllCarCheat; // unused @@ -4724,7 +4725,7 @@ void CAutomobile::Load(uint8*& buf) { CVehicle::Load(buf); - Damage = ReadSaveBuf(buf); + ReadSaveBuf(&Damage, buf); SkipSaveBuf(buf, 800 - sizeof(CDamageManager)); SetupDamageAfterLoad(); } -- cgit v1.2.3 From af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f Mon Sep 17 00:00:00 2001 From: erorcun Date: Sat, 26 Jun 2021 00:25:59 +0300 Subject: Revert "Redo ReadSaveBuf + common.h cleanup" This reverts commit 2b67aba94cb6448fb24c869559465eddf2bad069. --- src/vehicles/Automobile.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/vehicles/Automobile.cpp') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 7be6ed0b..c29c0536 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -45,7 +45,6 @@ #include "Object.h" #include "Automobile.h" #include "Wanted.h" -#include "SaveBuf.h" bool bAllCarCheat; // unused @@ -4725,7 +4724,7 @@ void CAutomobile::Load(uint8*& buf) { CVehicle::Load(buf); - ReadSaveBuf(&Damage, buf); + Damage = ReadSaveBuf(buf); SkipSaveBuf(buf, 800 - sizeof(CDamageManager)); SetupDamageAfterLoad(); } -- cgit v1.2.3 From f3a931e1c99372ae4bc224ef482d4052a09580cb Mon Sep 17 00:00:00 2001 From: withmorten Date: Sat, 26 Jun 2021 19:14:46 +0200 Subject: Revert "Revert "Redo ReadSaveBuf + common.h cleanup"" This reverts commit af7573ddbe38e0aaa485877e7ccb2e704b0f5a7f. --- src/vehicles/Automobile.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/vehicles/Automobile.cpp') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index c29c0536..7be6ed0b 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -45,6 +45,7 @@ #include "Object.h" #include "Automobile.h" #include "Wanted.h" +#include "SaveBuf.h" bool bAllCarCheat; // unused @@ -4724,7 +4725,7 @@ void CAutomobile::Load(uint8*& buf) { CVehicle::Load(buf); - Damage = ReadSaveBuf(buf); + ReadSaveBuf(&Damage, buf); SkipSaveBuf(buf, 800 - sizeof(CDamageManager)); SetupDamageAfterLoad(); } -- cgit v1.2.3 From cb3b3855b844c14c0e943c1a7614fc29820cf666 Mon Sep 17 00:00:00 2001 From: withmorten Date: Mon, 28 Jun 2021 13:31:35 +0200 Subject: rename clamp macro to Clamp to fix compilation with g++11 --- src/vehicles/Automobile.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/vehicles/Automobile.cpp') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 7be6ed0b..3de3e12b 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -1665,7 +1665,7 @@ CAutomobile::PreRender(void) // 1.0 if directly behind car, -1.0 if in front // BUG on PC: Abs of DotProduct is taken float behindness = DotProduct(lookVector, GetForward()); - behindness = clamp(behindness, -1.0f, 1.0f); // shouldn't be necessary + behindness = Clamp(behindness, -1.0f, 1.0f); // shouldn't be necessary // 0.0 if behind car, PI if in front // Abs not necessary float angle = Abs(Acos(behindness)); @@ -2264,7 +2264,7 @@ CAutomobile::ProcessControlInputs(uint8 pad) 0.2f*CTimer::GetTimeStep(); nLastControlInput = 0; } - m_fSteerInput = clamp(m_fSteerInput, -1.0f, 1.0f); + m_fSteerInput = Clamp(m_fSteerInput, -1.0f, 1.0f); // Accelerate/Brake float acceleration = (CPad::GetPad(pad)->GetAccelerate() - CPad::GetPad(pad)->GetBrake())/255.0f; @@ -2390,7 +2390,7 @@ CAutomobile::FireTruckControl(void) m_fCarGunLR += CPad::GetPad(0)->GetCarGunLeftRight() * 0.00025f * CTimer::GetTimeStep(); m_fCarGunUD += CPad::GetPad(0)->GetCarGunUpDown() * 0.0001f * CTimer::GetTimeStep(); } - m_fCarGunUD = clamp(m_fCarGunUD, 0.05f, 0.3f); + m_fCarGunUD = Clamp(m_fCarGunUD, 0.05f, 0.3f); CVector cannonPos(0.0f, 1.5f, 1.9f); @@ -2835,7 +2835,7 @@ CAutomobile::HydraulicControl(void) float limitDiff = extendedLowerLimit - normalLowerLimit; if(limitDiff != 0.0f && Abs(maxDelta/limitDiff) > 0.01f){ float f = (maxDelta + limitDiff)/2.0f/limitDiff; - f = clamp(f, 0.0f, 1.0f); + f = Clamp(f, 0.0f, 1.0f); DMAudio.PlayOneShot(m_audioEntityId, SOUND_CAR_HYDRAULIC_3, f); if(f < 0.4f || f > 0.6f) setPrevRatio = true; -- cgit v1.2.3 From 011aafa0435d2c60dc4e0769ed4c93ed1761e3f6 Mon Sep 17 00:00:00 2001 From: withmorten Date: Mon, 5 Jul 2021 18:07:26 +0200 Subject: finish COMPATIBLE_SAVES and FIX_INCOMPATIBLE_SAVES --- src/vehicles/Automobile.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/vehicles/Automobile.cpp') diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 3de3e12b..7d942dcd 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -4717,8 +4717,8 @@ void CAutomobile::Save(uint8*& buf) { CVehicle::Save(buf); - WriteSaveBuf(buf, Damage); - SkipSaveBuf(buf, 800 - sizeof(CDamageManager)); + WriteSaveBuf(buf, Damage); + ZeroSaveBuf(buf, 800 - sizeof(CDamageManager)); } void -- cgit v1.2.3