summaryrefslogtreecommitdiffstats
path: root/src/vehicles/Automobile.cpp
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2021-08-29 18:32:22 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2021-08-29 18:32:22 +0200
commit453f8c05a4fc2ef03ba1d4f7bac43ba871c52fbd (patch)
treeb1586ab27437633e49c795c2e1277f6ca4877cfa /src/vehicles/Automobile.cpp
parentfix (diff)
downloadre3-453f8c05a4fc2ef03ba1d4f7bac43ba871c52fbd.tar
re3-453f8c05a4fc2ef03ba1d4f7bac43ba871c52fbd.tar.gz
re3-453f8c05a4fc2ef03ba1d4f7bac43ba871c52fbd.tar.bz2
re3-453f8c05a4fc2ef03ba1d4f7bac43ba871c52fbd.tar.lz
re3-453f8c05a4fc2ef03ba1d4f7bac43ba871c52fbd.tar.xz
re3-453f8c05a4fc2ef03ba1d4f7bac43ba871c52fbd.tar.zst
re3-453f8c05a4fc2ef03ba1d4f7bac43ba871c52fbd.zip
Diffstat (limited to 'src/vehicles/Automobile.cpp')
-rw-r--r--src/vehicles/Automobile.cpp34
1 files changed, 28 insertions, 6 deletions
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index 61aa00b2..b0f21af7 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -206,7 +206,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy)
m_pBombRigger = nil;
m_bombType = CARBOMB_NONE;
- bUnknownFlag = false;
+ bDriverLastFrame = false;
if(m_nDoorLock == CARLOCK_UNLOCKED &&
(id == MI_POLICE || id == MI_ENFORCER || id == MI_RHINO))
@@ -344,8 +344,19 @@ CAutomobile::ProcessControl(void)
ScanForCrimes();
}
- // TODO(LCS)? re-inline this and change where bDriverLastFrame is set
- ActivateBombWhenEntered();
+ if (pDriver) {
+ if (!bDriverLastFrame && m_bombType == CARBOMB_ONIGNITIONACTIVE) {
+ // If someone enters the car and there is a bomb, detonate
+ m_nBombTimer = 1000;
+ m_pBlowUpEntity = m_pBombRigger;
+ if (m_pBlowUpEntity)
+ m_pBlowUpEntity->RegisterReference((CEntity**)&m_pBlowUpEntity);
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TICK, 1.0f);
+ }
+ bDriverLastFrame = true;
+ }
+ else
+ bDriverLastFrame = false;
// Process driver
if(pDriver){
@@ -939,9 +950,20 @@ CAutomobile::ProcessControl(void)
traction *= 4.0f;
if(FindPlayerVehicle() && FindPlayerVehicle() == this)
- if(CPad::GetPad(0)->CarGunJustDown())
- // TODO(LCS)? re-inline this from CVehicle
- ActivateBomb();
+ if (CPad::GetPad(0)->CarGunJustDown()) {
+ if (m_bombType == CARBOMB_TIMED) {
+ m_bombType = CARBOMB_TIMEDACTIVE;
+ m_nBombTimer = 7000;
+ m_pBlowUpEntity = FindPlayerPed();
+ CGarages::TriggerMessage("GA_12", -1, 3000, -1);
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TIMED_ACTIVATED, 1.0f);
+ }
+ else if (m_bombType == CARBOMB_ONIGNITION) {
+ m_bombType = CARBOMB_ONIGNITIONACTIVE;
+ CGarages::TriggerMessage("GA_12", -1, 3000, -1);
+ DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_ONIGNITION_ACTIVATED, 1.0f);
+ }
+ }
if(FindPlayerVehicle() != this && (strongGrip1 || CVehicle::bCheat3)){
traction *= 1.2f;