CVehicle fixes and cleanup

This commit is contained in:
aap 2021-08-04 13:54:26 +02:00
parent 4a047f56bc
commit bec1cbc1cb
3 changed files with 17 additions and 19 deletions

View File

@ -287,7 +287,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
bHeadStuckInCollision = false; bHeadStuckInCollision = false;
bDeadPedInFrontOfCar = false; bDeadPedInFrontOfCar = false;
m_gangFlags = 0xFF; m_gangFlags = ~0;
bStayInCarOnJack = false; bStayInCarOnJack = false;

View File

@ -841,7 +841,8 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
#ifdef FIX_BUGS #ifdef FIX_BUGS
// contactSpeedFwd is independent of framerate but fwd has timestep as a factor // contactSpeedFwd is independent of framerate but fwd has timestep as a factor
// so we probably have to fix this // so we probably have to fix this
fwd *= CTimer::GetTimeStepFix(); // better get rid of it here too
//fwd *= CTimer::GetTimeStepFix();
#endif #endif
if(!bBraking){ if(!bBraking){
@ -977,7 +978,8 @@ CVehicle::ProcessBikeWheel(CVector &wheelFwd, CVector &wheelRight, CVector &whee
#ifdef FIX_BUGS #ifdef FIX_BUGS
// contactSpeedRight is independent of framerate but right has timestep as a factor // contactSpeedRight is independent of framerate but right has timestep as a factor
// so we probably have to fix this // so we probably have to fix this
right *= CTimer::GetTimeStepFix(); // see above
//right *= CTimer::GetTimeStepFix();
#endif #endif
if(wheelStatus == WHEEL_STATUS_BURST){ if(wheelStatus == WHEEL_STATUS_BURST){
@ -1002,7 +1004,8 @@ CVehicle::ProcessBikeWheel(CVector &wheelFwd, CVector &wheelRight, CVector &whee
#ifdef FIX_BUGS #ifdef FIX_BUGS
// contactSpeedFwd is independent of framerate but fwd has timestep as a factor // contactSpeedFwd is independent of framerate but fwd has timestep as a factor
// so we probably have to fix this // so we probably have to fix this
fwd *= CTimer::GetTimeStepFix(); // see above
//fwd *= CTimer::GetTimeStepFix();
#endif #endif
if(!bBraking){ if(!bBraking){
@ -1514,8 +1517,7 @@ CVehicle::MakeNonDraggedPedsLeaveVehicle(CPed *ped1, CPed *ped2, CPlayerPed *&pl
if(p && p != ped1 && !p->bStayInCarOnJack){ if(p && p != ped1 && !p->bStayInCarOnJack){
peds[numPeds++] = p; peds[numPeds++] = p;
// uhh what? // uhh what?
if(i < 1 && !ped1IsDriver) if(i > 0 || ped1IsDriver)
continue;
peds2[numPeds2++] = p; peds2[numPeds2++] = p;
} }
} }
@ -1566,9 +1568,7 @@ CVehicle::ProcessDelayedExplosion(void)
if(IsCar() && ((CAutomobile*)this)->m_bombType == CARBOMB_TIMEDACTIVE && (m_nBombTimer & 0xFE00) != (prev & 0xFE00)) if(IsCar() && ((CAutomobile*)this)->m_bombType == CARBOMB_TIMEDACTIVE && (m_nBombTimer & 0xFE00) != (prev & 0xFE00))
DMAudio.PlayOneShot(m_audioEntityId, SOUND_CAR_BOMB_TICK, 0.0f); DMAudio.PlayOneShot(m_audioEntityId, SOUND_CAR_BOMB_TICK, 0.0f);
if (m_nBombTimer != 0) if (m_nBombTimer == 0)
return;
BlowUpCar(m_pBlowUpEntity); BlowUpCar(m_pBlowUpEntity);
} }
@ -1690,7 +1690,7 @@ CVehicle::CanPedOpenLocks(CPed *ped)
if(m_nDoorLock == CARLOCK_LOCKED || if(m_nDoorLock == CARLOCK_LOCKED ||
m_nDoorLock == CARLOCK_LOCKED_INITIALLY || m_nDoorLock == CARLOCK_LOCKED_INITIALLY ||
m_nDoorLock == CARLOCK_LOCKED_PLAYER_INSIDE || m_nDoorLock == CARLOCK_LOCKED_PLAYER_INSIDE ||
m_nDoorLock == CARLOCK_SKIP_SHUT_DOORS) m_nDoorLock == CARLOCK_LOCKED_BUT_CAN_BE_DAMAGED)
return false; return false;
if(ped->IsPlayer() && m_nDoorLock == CARLOCK_LOCKOUT_PLAYER_ONLY) if(ped->IsPlayer() && m_nDoorLock == CARLOCK_LOCKOUT_PLAYER_ONLY)
return false; return false;
@ -1702,7 +1702,7 @@ CVehicle::CanDoorsBeDamaged(void)
{ {
return m_nDoorLock == CARLOCK_NOT_USED || return m_nDoorLock == CARLOCK_NOT_USED ||
m_nDoorLock == CARLOCK_UNLOCKED || m_nDoorLock == CARLOCK_UNLOCKED ||
m_nDoorLock == CARLOCK_SKIP_SHUT_DOORS; m_nDoorLock == CARLOCK_LOCKED_BUT_CAN_BE_DAMAGED;
} }
bool bool
@ -1975,9 +1975,7 @@ CVehicle::RemovePassenger(CPed *p)
bool bool
CVehicle::IsDriver(CPed *ped) CVehicle::IsDriver(CPed *ped)
{ {
if(ped == nil) return ped && ped == pDriver;
return false;
return ped == pDriver;
} }
bool bool
@ -2028,7 +2026,7 @@ CVehicle::ProcessCarAlarm(void)
{ {
uint32 step; uint32 step;
if(!IsAlarmOn()) if(m_nAlarmState == 0 || m_nAlarmState == -1)
return; return;
step = CTimer::GetTimeStepInMilliseconds(); step = CTimer::GetTimeStepInMilliseconds();

View File

@ -60,7 +60,7 @@ enum eCarLock {
CARLOCK_LOCKED_PLAYER_INSIDE, CARLOCK_LOCKED_PLAYER_INSIDE,
CARLOCK_LOCKED_INITIALLY, CARLOCK_LOCKED_INITIALLY,
CARLOCK_FORCE_SHUT_DOORS, CARLOCK_FORCE_SHUT_DOORS,
CARLOCK_SKIP_SHUT_DOORS CARLOCK_LOCKED_BUT_CAN_BE_DAMAGED
}; };
enum eBombType enum eBombType
@ -271,7 +271,7 @@ public:
uint8 m_bRainSamplesCounter; uint8 m_bRainSamplesCounter;
uint32 m_nCarHornTimer; uint32 m_nCarHornTimer;
uint8 m_nCarHornPattern; uint8 m_nCarHornPattern;
bool m_bSirenOrAlarm; uint8 m_bSirenOrAlarm;
uint8 m_nCarHornDelay; uint8 m_nCarHornDelay;
int8 m_comedyControlState; int8 m_comedyControlState;
CStoredCollPoly m_aCollPolys[2]; // poly which is under front/rear part of car CStoredCollPoly m_aCollPolys[2]; // poly which is under front/rear part of car