diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2020-05-16 13:01:32 +0200 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2020-05-16 13:01:32 +0200 |
commit | c33b93793f71a8cdcdf9d8cbbc69f8873f45113a (patch) | |
tree | 1e6ff19cc88988720ab5d3f43e62d4682b3ddde5 | |
parent | Merge remote-tracking branch 'upstream/miami' into miami (diff) | |
download | re3-c33b93793f71a8cdcdf9d8cbbc69f8873f45113a.tar re3-c33b93793f71a8cdcdf9d8cbbc69f8873f45113a.tar.gz re3-c33b93793f71a8cdcdf9d8cbbc69f8873f45113a.tar.bz2 re3-c33b93793f71a8cdcdf9d8cbbc69f8873f45113a.tar.lz re3-c33b93793f71a8cdcdf9d8cbbc69f8873f45113a.tar.xz re3-c33b93793f71a8cdcdf9d8cbbc69f8873f45113a.tar.zst re3-c33b93793f71a8cdcdf9d8cbbc69f8873f45113a.zip |
-rw-r--r-- | src/vehicles/Automobile.cpp | 14 | ||||
-rw-r--r-- | src/vehicles/Vehicle.cpp | 1 | ||||
-rw-r--r-- | src/vehicles/Vehicle.h | 3 |
3 files changed, 16 insertions, 2 deletions
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index 6e88b997..d1f2faaa 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -4024,10 +4024,22 @@ CAutomobile::PlayCarHorn(void) { int r; + if (m_nAlarmState && m_nAlarmState != -1) + return; + + if (GetStatus() == STATUS_WRECKED) + return; + if(m_nCarHornTimer != 0) return; - r = CGeneral::GetRandomNumber() & 7; + if (m_nCarHornDelay) { + m_nCarHornDelay--; + return; + } + + m_nCarHornDelay = (CGeneral::GetRandomNumber() & 0x7F) + 150; + r = m_nCarHornDelay & 7; if(r < 2){ m_nCarHornTimer = 45; }else if(r < 4){ diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 4149fe6c..e457f964 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -101,6 +101,7 @@ CVehicle::CVehicle(uint8 CreatedBy) m_bSirenOrAlarm = 0; m_nCarHornTimer = 0; m_nCarHornPattern = 0; + m_nCarHornDelay = 0; bPartOfConvoy = false; bCreatedAsPoliceVehicle = false; bParking = false; diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index cdf0595a..c9e6bf93 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -211,8 +211,9 @@ public: uint8 m_bRainAudioCounter; uint8 m_bRainSamplesCounter; uint8 m_nCarHornTimer; - uint8 m_nCarHornPattern; // last horn? + uint8 m_nCarHornPattern; bool m_bSirenOrAlarm; + uint8 m_nCarHornDelay; int8 m_comedyControlState; CStoredCollPoly m_aCollPolys[2]; // poly which is under front/rear part of car float m_fSteerRatio; |