diff options
Diffstat (limited to '')
-rw-r--r-- | src/audio/AudioLogic.cpp | 757 | ||||
-rw-r--r-- | src/audio/AudioManager.h | 3 |
2 files changed, 512 insertions, 248 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index ac81523c..ab7c1835 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -37,6 +37,8 @@ #include "Weather.h" #include "ZoneCull.h" #include "sampman.h" +#include <vehicles\Bike.h> + const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); const int policeChannel = channels + 1; @@ -562,116 +564,116 @@ struct tVehicleSampleData { uint8 m_bDoorType; }; -const tVehicleSampleData aVehicleSettings[110] = { {SFX_CAR_REV_2, 2, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9935, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 11487, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_8, 8, SFX_CAR_HORN_PORSCHE, 11025, SFX_CAR_HORN_JEEP, 10928, 1}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_HORN_JEEP, 9935, 2}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 12893, SFX_CAR_HORN_JEEP, 8941, 0}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BMW328, 10706, SFX_CAR_HORN_JEEP, 11922, 1}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_HORN_JEEP, 7948, 2}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_POLICE_SIREN_SLOW, 11556, 2}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 31478, SFX_CAR_HORN_JEEP, 8941, 2}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_BMW328, 9538, SFX_CAR_HORN_JEEP, 12220, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_3, 3, SFX_CAR_HORN_BMW328, 12017, SFX_CAR_HORN_JEEP, 9935, 1}, - {SFX_CAR_REV_2, 2, SFX_CAR_HORN_JEEP, 22295, SFX_CAR_HORN_JEEP, 12200, 1}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS2, 18000, SFX_CAR_HORN_JEEP, 13400, 1}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS, 18286, SFX_CAR_HORN_JEEP, 9935, 2}, - {SFX_CAR_REV_3, 3, SFX_CAR_HORN_PORSCHE, 11025, SFX_CAR_HORN_JEEP, 13600, 1}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 22295, SFX_AMBULANCE_SIREN_SLOW, 8795, 2}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_PORSCHE, 9271, SFX_POLICE_SIREN_SLOW, 16168, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 12170, SFX_CAR_HORN_JEEP, 8000, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_BUS2, 12345, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_2, 2, SFX_CAR_HORN_BMW328, 10796, SFX_CAR_HORN_JEEP, 8543, 1}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_PORSCHE, 9271, SFX_CAR_HORN_JEEP, 9935, 1}, - {SFX_CAR_REV_2, 2, SFX_CAR_HORN_PICKUP, 10924, SFX_CAR_HORN_JEEP, 9935, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_PICKUP, 11025, SFX_ICE_CREAM_TUNE, 11025, 0}, - {SFX_CAR_REV_7, 7, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9935, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 10000, 0}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BMW328, 10706, SFX_POLICE_SIREN_SLOW, 13596, 1}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS, 17260, SFX_POLICE_SIREN_SLOW, 13000, 2}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_PICKUP, 8670, SFX_CAR_HORN_JEEP, 9935, 2}, - {SFX_CAR_REV_8, 8, SFX_CAR_HORN_PORSCHE, 10400, SFX_CAR_HORN_JEEP, 10123, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 26513, SFX_POLICE_SIREN_SLOW, 13596, 0}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_BUS2, 11652, SFX_CAR_HORN_JEEP, 10554, 3}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_HORN_JEEP, 8000, 2}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 28043, SFX_CAR_HORN_JEEP, 9935, 2}, - {SFX_CAR_REV_1, 0, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_HORN_JEEP, 9935, 3}, - {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CESNA_IDLE, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_BUS, 16291, SFX_CAR_HORN_JEEP, 7500, 3}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10233, SFX_CAR_HORN_JEEP, 8935, 0}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_PICKUP, 8670, SFX_CAR_HORN_JEEP, 8935, 0}, - {SFX_CAR_REV_1, 0, SFX_CAR_HORN_PICKUP, 2000, SFX_CAR_HORN_JEEP, 17000, 0}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BMW328, 9003, SFX_CAR_HORN_JEEP, 9935, 1}, - {SFX_CAR_REV_2, 2, SFX_CAR_HORN_PORSCHE, 12375, SFX_CAR_HORN_JEEP, 9935, 1}, - {SFX_CAR_REV_5, 5, SFX_CAR_HORN_BUS2, 15554, SFX_CAR_HORN_JEEP, 9935, 1}, - {SFX_CAR_REV_7, 7, SFX_CAR_HORN_BUS2, 13857, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_7, 7, SFX_CAR_HORN_PICKUP, 10924, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 2}, - {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 20143, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9000, 0}, - {SFX_CAR_REV_6, 6, SFX_CAR_HORN_TRUCK, 28043, SFX_CAR_HORN_JEEP, 9935, 2}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS, 18286, SFX_CAR_HORN_JEEP, 9935, 2}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_4, 4, SFX_CAR_HORN_BUS2, 18000, SFX_CAR_HORN_JEEP, 13400, 1}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0}, - {SFX_CAR_REV_1, 1, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9935, 0} }; +const tVehicleSampleData aVehicleSettings[110] = { {SFX_CAR_REV_10, 13, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9935, 0}, + {SFX_CAR_REV_11, 14, SFX_CAR_HORN_56CHEV, 11487, SFX_CAR_HORN_JEEP, 9900, 0}, + {SFX_CAR_REV_2, 5, SFX_CAR_HORN_PORSCHE, 11025, SFX_CAR_HORN_JEEP, 9890, 1}, + {SFX_CAR_REV_5, 8, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_HORN_JEEP, 9960, 2}, + {SFX_CAR_REV_11, 14, SFX_CAR_HORN_56CHEV, 12893, SFX_CAR_HORN_JEEP, 9500, 0}, + {SFX_CAR_REV_4, 7, SFX_CAR_HORN_BMW328, 10706, SFX_CAR_HORN_JEEP, 9600, 1}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_HORN_JEEP, 9700, 1}, + {SFX_CAR_REV_5, 8, SFX_CAR_HORN_TRUCK, 29711, SFX_POLICE_SIREN_SLOW, 10588, 2}, + {SFX_CAR_REV_5, 8, SFX_CAR_HORN_TRUCK, 31478, SFX_CAR_HORN_JEEP, 9800, 2}, + {SFX_CAR_REV_11, 14, SFX_CAR_HORN_BMW328, 9538, SFX_CAR_HORN_JEEP, 9900, 1}, + {SFX_CAR_REV_11, 14, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_HORN_JEEP, 10000, 0}, + {SFX_CAR_REV_7, 10, SFX_CAR_HORN_BMW328, 12017, SFX_CAR_HORN_JEEP, 9900, 1}, + {SFX_CAR_REV_9, 12, SFX_CAR_HORN_JEEP, 22293, SFX_CAR_HORN_JEEP, 9800, 1}, + {SFX_CAR_REV_3, 6, SFX_CAR_HORN_BUS2, 18000, SFX_CAR_HORN_JEEP, 9700, 0}, + {SFX_CAR_REV_3, 6, SFX_CAR_HORN_BUS, 18286, SFX_CAR_HORN_JEEP, 9600, 0}, + {SFX_CAR_REV_2, 5, SFX_CAR_HORN_PORSCHE, 11025, SFX_CAR_HORN_JEEP, 9500, 1}, + {SFX_CAR_REV_3, 6, SFX_CAR_HORN_JEEP, 22295, SFX_AMBULANCE_SIREN_SLOW, 12688, 0}, + {SFX_CAR_REV_4, 7, SFX_CAR_HORN_PORSCHE, 9271, SFX_POLICE_SIREN_SLOW, 11471, 1}, + {SFX_CAR_REV_11, 14, SFX_CAR_HORN_56CHEV, 12170, SFX_CAR_HORN_JEEP, 9400, 0}, + {SFX_CAR_REV_11, 14, SFX_CAR_HORN_BMW328, 11000, SFX_CAR_HORN_JEEP, 9300, 0}, + {SFX_CAR_REV_10, 13, SFX_CAR_HORN_BMW328, 10796, SFX_CAR_HORN_JEEP, 9200, 1}, + {SFX_CAR_REV_4, 7, SFX_CAR_HORN_BMW328, 10500, SFX_CAR_HORN_JEEP, 9100, 1}, + {SFX_CAR_REV_10, 13, SFX_CAR_HORN_PICKUP, 10924, SFX_CAR_HORN_JEEP, 9000, 0}, + {SFX_CAR_REV_3, 6, SFX_CAR_HORN_PICKUP, 11025, SFX_ICE_CREAM_TUNE, 11025, 0}, + {SFX_CAR_REV_6, 9, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9100, 0}, + {SFX_HELI_APACHE_1, 30, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9200, 1}, + {SFX_CAR_REV_4, 7, SFX_CAR_HORN_BMW328, 10706, SFX_POLICE_SIREN_SLOW, 10511, 1}, + {SFX_CAR_REV_3, 6, SFX_CAR_HORN_BUS, 17260, SFX_POLICE_SIREN_SLOW, 11029, 0}, + {SFX_CAR_REV_3, 6, SFX_CAR_HORN_PICKUP, 8670, SFX_CAR_HORN_JEEP, 9300, 0}, + {SFX_CAR_REV_7, 10, SFX_CAR_HORN_PORSCHE, 10400, SFX_CAR_HORN_JEEP, 9400, 1}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 26513, SFX_POLICE_SIREN_SLOW, 11912, 1}, + {SFX_CAR_REV_5, 8, SFX_CAR_HORN_BUS2, 11652, SFX_CAR_HORN_JEEP, 9500, 3}, + {SFX_CAR_REV_5, 8, SFX_CAR_HORN_TRUCK, 29711, SFX_CAR_HORN_JEEP, 9600, 2}, + {SFX_CAR_REV_5, 8, SFX_CAR_HORN_TRUCK, 28043, SFX_CAR_HORN_JEEP, 9700, 2}, + {SFX_CAR_REV_6, 9, SFX_CAR_HORN_JEEP, 25400, SFX_CAR_HORN_JEEP, 9800, 0}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9900, 1}, + {SFX_CAR_REV_17, 20, SFX_CAR_HORN_JEEP, 26313, SFX_CAR_HORN_JEEP, 10000, 1}, + {SFX_CAR_REV_5, 8, SFX_CAR_HORN_BUS, 16291, SFX_CAR_HORN_JEEP, 10100, 3}, + {SFX_CAR_REV_11, 14, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_HORN_JEEP, 9900, 0}, + {SFX_CAR_REV_11, 14, SFX_CAR_HORN_56CHEV, 10233, SFX_CAR_HORN_JEEP, 9800, 1}, + {SFX_CAR_REV_3, 6, SFX_CAR_HORN_PICKUP, 8670, SFX_CAR_HORN_JEEP, 9700, 0}, + {SFX_RC_REV, 17, SFX_CAR_HORN_PICKUP, 20000, SFX_CAR_HORN_JEEP, 9600, 1}, + {SFX_CAR_REV_11, 14, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9500, 1}, + {SFX_CAR_REV_5, 8, SFX_CAR_HORN_TRUCK, 29000, SFX_CAR_HORN_JEEP, 9400, 2}, + {SFX_CAR_REV_1, 4, SFX_CAR_HORN_BMW328, 9003, SFX_CAR_HORN_JEEP, 9300, 1}, + {SFX_CAR_REV_4, 7, SFX_CAR_HORN_PORSCHE, 12375, SFX_CAR_HORN_JEEP, 9200, 1}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_BUS2, 15554, SFX_CAR_HORN_JEEP, 9100, 1}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_BUS2, 13857, SFX_CAR_HORN_JEEP, 9000, 2}, + {SFX_MOPED_REV, 21, SFX_CAR_HORN_JEEP, 30000, SFX_CAR_HORN_JEEP, 9100, 1}, + {SFX_CAR_REV_7, 10, SFX_CAR_HORN_JEEP, 22043, SFX_CAR_HORN_JEEP, 9200, 0}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9300, 1}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9400, 1}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9500, 1}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9600, 1}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 21043, SFX_CAR_HORN_JEEP, 9700, 1}, + {SFX_CAR_REV_5, 8, SFX_CAR_HORN_TRUCK, 28043, SFX_CAR_HORN_JEEP, 9800, 2}, + {SFX_CAR_REV_3, 6, SFX_CAR_HORN_BUS, 18286, SFX_CAR_HORN_JEEP, 9900, 0}, + {SFX_CAR_REV_12, 15, SFX_CAR_HORN_JEEP, 28500, SFX_CAR_HORN_JEEP, 9800, 1}, + {SFX_CAR_REV_1, 4, SFX_CAR_HORN_56CHEV, 10842, SFX_CAR_HORN_JEEP, 9700, 0}, + {SFX_CAR_REV_8, 11, SFX_CAR_HORN_BUS2, 18000, SFX_CAR_HORN_JEEP, 9700, 0}, + {SFX_SEAPLANE_PRO1, 35, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9700, 1}, + {SFX_CAR_REV_20, 23, SFX_CAR_HORN_JEEP, 27000, SFX_CAR_HORN_JEEP, 9600, 1}, + {SFX_MOPED_REV, 21, SFX_CAR_HORN_JEEP, 31000, SFX_CAR_HORN_JEEP, 9500, 1}, + {SFX_CAR_REV_17, 20, SFX_CAR_HORN_PICKUP, 11000, SFX_CAR_HORN_JEEP, 9400, 1}, + {SFX_RC_REV, 17, SFX_CAR_HORN_JEEP, 30000, SFX_CAR_HORN_JEEP, 15000, 1}, + {SFX_CAR_RC_HELI, 18, SFX_CAR_HORN_JEEP, 30000, SFX_CAR_HORN_JEEP, 15000, 1}, + {SFX_CAR_REV_9, 12, SFX_CAR_HORN_56CHEV, 10300, SFX_CAR_HORN_JEEP, 9100, 0}, + {SFX_CAR_REV_9, 12, SFX_CAR_HORN_56CHEV, 10500, SFX_CAR_HORN_JEEP, 9000, 0}, + {SFX_CAR_REV_19, 22, SFX_CAR_HORN_JEEP, 30000, SFX_CAR_HORN_JEEP, 9000, 1}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9100, 2}, + {SFX_CAR_REV_3, 6, SFX_CAR_HORN_TRUCK, 28000, SFX_CAR_HORN_JEEP, 9200, 2}, + {SFX_CAR_REV_7, 10, SFX_CAR_HORN_PICKUP, 11200, SFX_CAR_HORN_JEEP, 9300, 1}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9400, 1}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9500, 1}, + {SFX_CAR_REV_9, 12, SFX_CAR_HORN_56CHEV, 10700, SFX_CAR_HORN_JEEP, 9600, 0}, + {SFX_CAR_REV_1, 4, SFX_CAR_HORN_BMW328, 9000, SFX_CAR_HORN_JEEP, 9700, 0}, + {SFX_CAR_REV_6, 9, SFX_CAR_HORN_BMW328, 9200, SFX_CAR_HORN_JEEP, 9800, 0}, + {SFX_CAR_REV_7, 10, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9900, 1}, + {SFX_CAR_REV_11, 14, SFX_CAR_HORN_56CHEV, 10540, SFX_CAR_HORN_JEEP, 9935, 2}, + {SFX_CAR_REV_8, 11, SFX_CAR_HORN_PICKUP, 11000, SFX_CAR_HORN_JEEP, 9700, 1}, + {SFX_CAR_REV_2, 5, SFX_CAR_HORN_BMW328, 9500, SFX_CAR_HORN_JEEP, 9800, 1}, + {SFX_CAR_REV_7, 10, SFX_CAR_HORN_BMW328, 9700, SFX_CAR_HORN_JEEP, 9700, 1}, + {SFX_CAR_REV_8, 11, SFX_CAR_HORN_BUS2, 18000, SFX_CAR_HORN_JEEP, 9600, 0}, + {SFX_CAR_REV_3, 6, SFX_CAR_HORN_BUS, 18000, SFX_CAR_HORN_JEEP, 9500, 2}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9400, 1}, + {SFX_CAR_REV_8, 11, SFX_CAR_HORN_JEEP, 27513, SFX_CAR_HORN_JEEP, 9300, 1}, + {SFX_CAR_REV_8, 11, SFX_CAR_HORN_56CHEV, 10700, SFX_CAR_HORN_JEEP, 9200, 0}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9100, 2}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9000, 2}, + {SFX_CAR_REV_10, 13, SFX_CAR_HORN_BUS2, 18000, SFX_CAR_HORN_JEEP, 9100, 2}, + {SFX_CAR_REV_1, 4, SFX_CAR_HORN_BUS2, 17900, SFX_POLICE_SIREN_SLOW, 10511, 2}, + {SFX_CAR_REV_4, 7, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9200, 1}, + {SFX_CAR_REV_8, 11, SFX_CAR_HORN_BMW328, 9600, SFX_CAR_HORN_JEEP, 9300, 1}, + {SFX_CAR_REV_4, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9400, 1}, + {SFX_CAR_REV_7, 10, SFX_CAR_HORN_PORSCHE, 10000, SFX_CAR_HORN_JEEP, 9500, 0}, + {SFX_CAR_REV_6, 9, SFX_CAR_HORN_PORSCHE, 10500, SFX_CAR_HORN_JEEP, 9600, 0}, + {SFX_CAR_REV_10, 13, SFX_CAR_HORN_JEEP, 25513, SFX_CAR_HORN_JEEP, 9700, 1}, + {SFX_CAR_REV_1, 0, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9800, 1}, + {SFX_CAR_REV_3, 6, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9900, 1}, + {SFX_CAR_REV_10, 13, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9800, 1}, + {SFX_CAR_REV_1, 4, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9700, 1}, + {SFX_CAR_RC_HELI, 18, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9600, 1}, + {SFX_CAR_REV_6, 9, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9700, 1}, + {SFX_CAR_REV_7, 10, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9600, 1}, + {SFX_CAR_REV_1, 4, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9500, 1}, + {SFX_CAR_REV_9, 12, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9400, 1}, + {SFX_CAR_REV_2, 5, SFX_CAR_HORN_PORSCHE, 11025, SFX_POLICE_SIREN_SLOW, 11000, 1}, + {SFX_CAR_REV_1, 4, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9200, 1}, + {SFX_CAR_REV_1, 4, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9300, 1}, + {SFX_CAR_REV_1, 4, SFX_CAR_HORN_JEEP, 26513, SFX_CAR_HORN_JEEP, 9400, 1} }; bool bPlayerJustEnteredCar; @@ -704,6 +706,10 @@ cAudioManager::ProcessVehicle(CVehicle *veh) cVehicleParams params; m_sQueueSample.m_vecPos = veh->GetPosition(); + float gas; + float gasPedalAudio; + float tmp; + params.m_bDistanceCalculated = false; params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); params.m_pVehicle = veh; @@ -720,6 +726,7 @@ cAudioManager::ProcessVehicle(CVehicle *veh) else velChange = DotProduct(params.m_pVehicle->m_vecMoveSpeed, params.m_pVehicle->GetForward()); params.m_fVelocityChange = velChange; + params.m_VehicleType = params.m_pVehicle->m_vehType; switch (params.m_pVehicle->m_vehType) { case VEHICLE_TYPE_CAR: UpdateGasPedalAudio((CAutomobile *)veh); @@ -729,6 +736,7 @@ cAudioManager::ProcessVehicle(CVehicle *veh) ((CAutomobile *)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange; break; } + if (params.m_nIndex == DODO) { if (!ProcessVehicleRoadNoise(¶ms)) { ProcessVehicleOneShots(¶ms); @@ -782,6 +790,34 @@ cAudioManager::ProcessVehicle(CVehicle *veh) ProcessPlane(¶ms); ProcessVehicleOneShots(¶ms); break; + case VEHICLE_TYPE_BIKE: + gas = fabs(params.m_pVehicle->m_fGasPedal); + gasPedalAudio = ((CBike*)params.m_pVehicle)->m_fGasPedalAudio; + if (gas <= gasPedalAudio) { + tmp = gasPedalAudio = 0.07f; + if (tmp <= gas) + tmp = gas; + } else { + tmp = gasPedalAudio + 0.09f; + if (tmp < gas) + tmp = gas; + } + ((CBike*)params.m_pVehicle)->m_fGasPedalAudio = tmp; + + if (ProcessVehicleRoadNoise(¶ms)) { + if (CWeather::WetRoads > 0.0f) + ProcessWetRoadNoise(¶ms); + ProcessVehicleSkidding(¶ms); + ProcessVehicleHorn(¶ms); + ProcessVehicleSirenOrAlarm(¶ms); + ProcessCarBombTick(¶ms); + ProcessEngineDamage(¶ms); + ProcessVehicleEngine(¶ms); + //ProcessVehicleFlatTyre(); + } + ProcessVehicleOneShots(¶ms); + ((CBike*)veh)->m_fVelocityChangeForAudio = params.m_fVelocityChange; + break; default: break; } @@ -1060,6 +1096,16 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params) SampleManager.StopChannel(m_nActiveSamples); return; } + if (!params->m_bDistanceCalculated) { + if (params->m_fDistance <= 0.0) + m_sQueueSample.m_fDistance = 0.0; + else + m_sQueueSample.m_fDistance = sqrt(params->m_fDistance); + } + //if (playerVeh == veh /*&& veh->m_modelIndex != DODO(187)*/) { + // ProcessPlayersVehicleEngine(params, params->m_pVehicle); + // return; + //} if (veh->bEngineOn) { CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance); automobile = (CAutomobile *)params->m_pVehicle; @@ -1068,7 +1114,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams *params) return; } if (FindPlayerVehicle() == veh) { - ProcessPlayersVehicleEngine(params, automobile); + ProcessPlayersVehicleEngine(params, params->m_pVehicle); return; } transmission = params->m_pTransmission; @@ -1305,91 +1351,164 @@ cAudioManager::ProcessCesna(cVehicleParams *params) } } -void -cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *automobile) +void cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams* params, CVehicle* veh) { - static int32 GearFreqAdj[] = {6000, 6000, 3400, 1200, 0, -1000}; - - cTransmission *transmission; - float velocityChange; - float relativeVelocityChange; - float accelerationMultipler; - uint8 wheelInUseCounter; - float time; - int baseFreq; - uint8 vol; - int gearNr; - int32 freq; - - int freqModifier; - int soundOffset; - uint8 engineSoundType; - int16 accelerateState; - bool channelUsed; - bool lostTraction; - bool processedAccelSampleStopped; - uint8 currentGear; + static int32 GearFreqAdj[] = { 6000, 6000, 3400, 1200, 0, -1000 }; + double gasPedal; // st6 + tWheelState* wheelState; + CAutomobile* automobile; // ebp + CBike* bike; // edx + float* gasPedalAudioPtr; // edi + uint8 wheelInUseCounter; // cl + int freqModifier; // [esp+Ch] [ebp-74h] + signed int accelerateState; // [esp+20h] [ebp-60h] + bool channelUsed; // [esp+2Ch] [ebp-54h] + bool lostTraction; // [esp+30h] [ebp-50h] + int engineSoundType; // [esp+1Ch] [ebp-64h] + signed int brakeState; // [esp+24h] [ebp-5Ch] + uint8 wheelsOnGround; // [esp+3Ch] [ebp-44h] float gasPedalAudio; - CVector pos; + double relativeVelocityChange; // st6 + float accelerationMultipler; // [esp+50h] [ebp-30h] + float velocityChangeForAudio; + int baseFreq; // ebp + uint8 vol; // bl + + double time; // st7 + + double timeClip; // st4 + int tmp; // edx + int soundOffset; // ebx + char err; // al + unsigned int freq_2; // edi + bool stuckInSand; // cl + + + unsigned int freq; // edi + + bool speedBool; // [esp+28h] [ebp-58h] + + unsigned __int8 currentGear; // [esp+34h] [ebp-4Ch] + char processedAccelSampleStopped; // [esp+38h] [ebp-48h] + char wheelsOnGroundPrev; // [esp+40h] [ebp-40h] + bool PizzaFaggBool; // [esp+44h] [ebp-3Ch] + + CVector pos; // [esp+64h] [ebp-1Ch] + + //67-105 static int16 LastAccel = 0; - static int16 LastBrake = 0; static uint8 CurrentPretendGear = 1; static bool bLostTractionLastFrame = false; static bool bHandbrakeOnLastFrame = false; static int32 nCruising = 0; static bool bAccelSampleStopped = true; + static uint32 curTime = CTimer::GetTimeInMilliseconds(); - lostTraction = false; - processedAccelSampleStopped = false; + lostTraction = 0; + PizzaFaggBool = 0; + processedAccelSampleStopped = 0; if (bPlayerJustEnteredCar) { - bAccelSampleStopped = true; - bPlayerJustEnteredCar = false; + bAccelSampleStopped = 1; + bPlayerJustEnteredCar = 0; nCruising = 0; LastAccel = 0; - bLostTractionLastFrame = false; - LastBrake = 0; - bHandbrakeOnLastFrame = false; + bLostTractionLastFrame = 0; CurrentPretendGear = 1; + bHandbrakeOnLastFrame = 0; } - if (CReplay::IsPlayingBack()) - accelerateState = 255.f * clamp(automobile->m_fGasPedal, 0.0f, 1.0f); - else + //106-157 + if (CReplay::IsPlayingBack()) { + accelerateState = (signed int)(255.0 * clamp(params->m_pVehicle->m_fGasPedal, 0.0, 1.0)); + brakeState = (signed int)(255.0 * clamp(params->m_pVehicle->m_fBrakePedal, 0.0, 1.0)); + } else { accelerateState = Pads[0].GetAccelerate(); - + brakeState = Pads[0].GetBrake(); + } + //158-162 + speedBool = params->m_fVelocityChange >= -0.001; channelUsed = SampleManager.GetChannelUsedFlag(m_nActiveSamples); - transmission = params->m_pTransmission; - velocityChange = params->m_fVelocityChange; - relativeVelocityChange = 2.0f * velocityChange / transmission->fMaxVelocity; - - accelerationMultipler = clamp(relativeVelocityChange, 0.0f, 1.0f); - gasPedalAudio = accelerationMultipler; - currentGear = params->m_pVehicle->m_nCurrentGear; - - switch (transmission->nDriveType) - { - case '4': - wheelInUseCounter = 0; - for (uint8 i = 0; i < ARRAY_SIZE(automobile->m_aWheelState); i++) { - if (automobile->m_aWheelState[i] != WHEEL_STATE_NORMAL) - ++wheelInUseCounter; + //163-184 + if (params->m_pVehicle->m_modelIndex != MI_PIZZABOY + && params->m_pVehicle->m_modelIndex != MI_FAGGIO) { + currentGear = params->m_pVehicle->m_nCurrentGear; + } else { + CurrentPretendGear = params->m_pTransmission->nNumberOfGears; + currentGear = CurrentPretendGear; + if (params->m_pVehicle->bIsHandbrakeOn) { + brakeState = 0; + nCruising = 0; + LastAccel = 0; + accelerateState = 0; + } else { + nCruising = 1; } - if (wheelInUseCounter > 2) - lostTraction = true; - break; - case 'F': - if ((automobile->m_aWheelState[CARWHEEL_FRONT_LEFT] != WHEEL_STATE_NORMAL || automobile->m_aWheelState[CARWHEEL_FRONT_RIGHT] != WHEEL_STATE_NORMAL) && - (automobile->m_aWheelState[CARWHEEL_REAR_LEFT] != WHEEL_STATE_NORMAL || automobile->m_aWheelState[CARWHEEL_REAR_RIGHT] != WHEEL_STATE_NORMAL)) - lostTraction = true; + PizzaFaggBool = true; + } + + //185-205 + switch (params->m_VehicleType) { + case VEHICLE_TYPE_CAR: + automobile = (CAutomobile*)params->m_pVehicle; + wheelsOnGround = automobile->m_nDriveWheelsOnGround; + wheelsOnGroundPrev = automobile->m_nDriveWheelsOnGroundPrev; + gasPedalAudioPtr = (float*)&automobile->m_fGasPedalAudio; + wheelState = automobile->m_aWheelState; + velocityChangeForAudio = automobile->m_fVelocityChangeForAudio; break; - case 'R': - if ((automobile->m_aWheelState[CARWHEEL_REAR_LEFT] != WHEEL_STATE_NORMAL) || (automobile->m_aWheelState[CARWHEEL_REAR_RIGHT] != WHEEL_STATE_NORMAL)) - lostTraction = true; + case VEHICLE_TYPE_BIKE: + bike = (CBike*)params->m_pVehicle; + wheelsOnGround = bike->m_nDriveWheelsOnGround; + wheelsOnGroundPrev = bike->m_nDriveWheelsOnGroundPrev; + gasPedalAudioPtr = &bike->m_fGasPedalAudio; + wheelState = bike->m_aWheelState; + velocityChangeForAudio = bike->m_fVelocityChangeForAudio; break; + //641-644 + default: + //dbgprint(" ** AUDIOLOG: Unrecognised vehicle type %d in ProcessVehicleEngine() * \n", vehType); + return; } - - if (velocityChange != 0.0f) { - time = params->m_pVehicle->m_vecMoveSpeed.z / velocityChange; + if (!PizzaFaggBool) { + //208-253 + switch (params->m_pTransmission->nDriveType) { + case '4': + if (params->m_VehicleType != VEHICLE_TYPE_BIKE) { + wheelInUseCounter = 0; + for (uint8 i = 0; i < ARRAY_SIZE(wheelState); i++) { + if (wheelState[i] != WHEEL_STATE_NORMAL) + ++wheelInUseCounter; + } + if (wheelInUseCounter > 2) + lostTraction = true; + } + break; + case 'F': + if (params->m_VehicleType == VEHICLE_TYPE_BIKE) { + if (wheelState[BIKEWHEEL_FRONT] != WHEEL_STATE_NORMAL) + lostTraction = true; + } else { + if ((wheelState[CARWHEEL_FRONT_LEFT] != WHEEL_STATE_NORMAL || wheelState[CARWHEEL_FRONT_RIGHT] != WHEEL_STATE_NORMAL) && + (wheelState[CARWHEEL_REAR_LEFT] != WHEEL_STATE_NORMAL || wheelState[CARWHEEL_REAR_RIGHT] != WHEEL_STATE_NORMAL)) + lostTraction = true; + } + break; + case 'R': + if (params->m_VehicleType == VEHICLE_TYPE_BIKE) { + if (wheelState[BIKEWHEEL_REAR] != WHEEL_STATE_NORMAL) + lostTraction = true; + } else { + if (wheelState[CARWHEEL_REAR_LEFT] != WHEEL_STATE_NORMAL || wheelState[CARWHEEL_REAR_RIGHT] != WHEEL_STATE_NORMAL) + lostTraction = true; + } + break; + default: + break; + } + } + //254-281 + if (params->m_fVelocityChange != 0.0f) { + time = params->m_pVehicle->m_vecMoveSpeed.z / params->m_fVelocityChange; if (time > 0.0f) freqModifier = -(Min(0.2f, time) * 3000.0f * 5.0f); else @@ -1398,138 +1517,282 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile * freqModifier = -freqModifier; } else freqModifier = 0; - + //282-283 + if (params->m_VehicleType == VEHICLE_TYPE_BIKE && bike->bExtraSpeed) + freqModifier += 1400; + //TODO rewtire this part + //284-349 + tmp = 0; engineSoundType = aVehicleSettings[params->m_nIndex].m_nBank; - soundOffset = 3 * (engineSoundType - CAR_SAMPLEBANKS_OFFSET); + soundOffset = 3 * (engineSoundType - 4); + err = 0; + switch (soundOffset) { + case 0: + tmp = 2526; + break; + case 3: + tmp = 3587; + break; + case 6: + tmp = 4898; + break; + case 9: + tmp = 4003; + break; + case 12: + tmp = 6289; + break; + case 15: + tmp = 2766; + break; + case 18: + tmp = 3523; + break; + case 21: + tmp = 2773; + break; + case 24: + tmp = 2560; + break; + case 27: + tmp = 4228; + break; + case 30: + tmp = 4648; + break; + case 48: + tmp = 3480; + break; + case 54: + tmp = 2380; + break; + case 57: + tmp = 2410; + break; + default: + err = 1; + break; + } + if (!channelUsed || nCruising || err) { + curTime = CTimer::GetTimeInMilliseconds(); + } else { + tmp -= 1000; + if (CTimer::GetTimeInMilliseconds() - curTime > tmp) { + channelUsed = 0; + curTime = CTimer::GetTimeInMilliseconds(); + } + } + //349-366 + relativeVelocityChange = 2.0 * params->m_fVelocityChange / params->m_pTransmission->fMaxVelocity; + accelerationMultipler = clamp(relativeVelocityChange, 0.0, 1.0); + gasPedalAudio = accelerationMultipler; + //367-380 + switch (engineSoundType) { + case 21: + ++soundOffset; + break; + case 22: + soundOffset += 2; + break; + case 23: + soundOffset += 3; + break; + default: + break; + } + //381-476 if (accelerateState <= 0) { if (params->m_fVelocityChange < -0.001f) { if (channelUsed) { SampleManager.StopChannel(m_nActiveSamples); bAccelSampleStopped = true; } - if (automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction) - gasPedalAudio = automobile->m_fGasPedalAudio; + if (wheelsOnGround == 0 || params->m_pVehicle->bIsHandbrakeOn || lostTraction) + gasPedalAudio = *gasPedalAudioPtr; + else if (params->m_VehicleType == VEHICLE_TYPE_BIKE) + gasPedalAudio = 0.0; else gasPedalAudio = Min(1.0f, params->m_fVelocityChange / params->m_pTransmission->fMaxReverseVelocity); - - gasPedalAudio = Max(0.0f, gasPedalAudio); - automobile->m_fGasPedalAudio = gasPedalAudio; + *gasPedalAudioPtr = Max(0.0f, gasPedalAudio); } else if (LastAccel > 0) { if (channelUsed) { SampleManager.StopChannel(m_nActiveSamples); bAccelSampleStopped = true; } nCruising = 0; - if (automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction || - params->m_fVelocityChange < 0.01f && automobile->m_fGasPedalAudio > 0.2f) { - automobile->m_fGasPedalAudio *= 0.6f; - gasPedalAudio = automobile->m_fGasPedalAudio; + if (wheelsOnGround == 0 + || params->m_pVehicle->bIsHandbrakeOn + || lostTraction + || params->m_fVelocityChange < 0.01f && *gasPedalAudioPtr > 0.2f) { + if (!PizzaFaggBool) { + *gasPedalAudioPtr *= 0.6f; + gasPedalAudio = *gasPedalAudioPtr; + } else + gasPedalAudio = 0.0f; } if (gasPedalAudio > 0.05f) { freq = (5000.f * (gasPedalAudio - 0.05f) * 20.f / 19) + 19000; - if (engineSoundType == SAMPLEBANK_CAR_MACKTRUCK) + vol = (25.0 * (gasPedalAudio - 0.05f) * 20.f / 19) + 40; + if (params->m_pVehicle->bIsDrowning) + vol /= 4; + if (engineSoundType == SAMPLEBANK_CAR_COBRA) freq /= 2; - AddPlayerCarSample((25.f * (gasPedalAudio - 0.05f) * 20.f / 19) + 40, freq, (soundOffset + SFX_CAR_FINGER_OFF_ACCEL_1), engineSoundType, 63, - false); + AddPlayerCarSample(vol, freq, soundOffset + SFX_CAR_FINGER_OFF_ACCEL_1, engineSoundType, 63, false); } } freq = (10000.f * gasPedalAudio) + 22050; - if (engineSoundType == SAMPLEBANK_CAR_MACKTRUCK) + vol = 110 - (40.0 * gasPedalAudio); + if (engineSoundType == SAMPLEBANK_CAR_COBRA) freq /= 2; - AddPlayerCarSample(110 - (40.f * gasPedalAudio), freq, (engineSoundType - CAR_SAMPLEBANKS_OFFSET + SFX_CAR_IDLE_1), SAMPLEBANK_MAIN, 52, true); + if (params->m_pVehicle->bIsDrowning) + vol /= 4; + AddPlayerCarSample(vol, freq, engineSoundType + SFX_CAR_IDLE_1 - 4, SAMPLEBANK_MAIN, 52, true); CurrentPretendGear = Max(1, currentGear); - } else { - while (nCruising == 0) { - if (accelerateState < 150 || automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction || - currentGear < 2 && velocityChange - automobile->m_fVelocityChangeForAudio < 0.01f) { // here could be used abs - if (automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction) { - if (automobile->m_nWheelsOnGround == 0 && automobile->m_nDriveWheelsOnGround != 0 || - (automobile->bIsHandbrakeOn && !bHandbrakeOnLastFrame || lostTraction && !bLostTractionLastFrame) && automobile->m_nWheelsOnGround != 0) { - automobile->m_fGasPedalAudio *= 0.6f; + } + //477-515 + else { + if (nCruising == 0){ + stuckInSand = params->m_VehicleType == VEHICLE_TYPE_CAR && ((CAutomobile*)params->m_pVehicle)->bStuckInSand; + if (accelerateState < 150 || wheelsOnGround == 0 || params->m_pVehicle->bIsHandbrakeOn || lostTraction + || currentGear < 2 && params->m_fVelocityChange - velocityChangeForAudio >= 0.01f || brakeState > 0) { + if ((wheelsOnGround && !params->m_pVehicle->bIsHandbrakeOn && !lostTraction || !stuckInSand) + && brakeState <= 0) { + baseFreq = (8000.0f * accelerationMultipler) + 16000; + vol = (25.0f * accelerationMultipler) + 60; + *gasPedalAudioPtr = accelerationMultipler; + } else { + if (wheelsOnGround == 0 && wheelsOnGroundPrev != 0 + || (params->m_pVehicle->bIsHandbrakeOn && !bHandbrakeOnLastFrame || lostTraction && !bLostTractionLastFrame) + && wheelsOnGround != 0) { + *gasPedalAudioPtr *= 0.6f; } freqModifier = 0; - baseFreq = (15000.f * automobile->m_fGasPedalAudio) + 14000; - vol = (25.0f * automobile->m_fGasPedalAudio) + 60; - } else { - baseFreq = (8000.f * accelerationMultipler) + 16000; - vol = (25.0f * accelerationMultipler) + 60; - automobile->m_fGasPedalAudio = accelerationMultipler; + if (engineSoundType != 15 && engineSoundType != 16) + baseFreq = (25000.0f * *gasPedalAudioPtr) + 14000; + else + baseFreq = (15000.0f * *gasPedalAudioPtr) + 14000; + vol = (25.0f * *gasPedalAudioPtr) + 60; } + //516-535 freq = freqModifier + baseFreq; - if (engineSoundType == SAMPLEBANK_CAR_MACKTRUCK) + if (engineSoundType == SAMPLEBANK_CAR_COBRA) freq /= 2; if (channelUsed) { SampleManager.StopChannel(m_nActiveSamples); bAccelSampleStopped = true; } - AddPlayerCarSample(vol, freq, (engineSoundType - CAR_SAMPLEBANKS_OFFSET + SFX_CAR_REV_1), SAMPLEBANK_MAIN, 2, true); + if (params->m_pVehicle->bIsDrowning) + vol /= 4; + AddPlayerCarSample(vol, freq, engineSoundType + SFX_CAR_REV_1 - 4, SAMPLEBANK_MAIN, 2, true); } else { - TranslateEntity(&m_sQueueSample.m_vecPos, &pos); + //536-548 + cAudioManager::TranslateEntity(&m_sQueueSample.m_vecPos, &pos); if (bAccelSampleStopped) { - if (CurrentPretendGear != 1 || currentGear != 2) { - gearNr = currentGear - 1; - if (gearNr < 1) - gearNr = 1; - CurrentPretendGear = gearNr; - } + if (CurrentPretendGear != 1 || currentGear != 2) + CurrentPretendGear = Max(1, currentGear - 1); processedAccelSampleStopped = true; bAccelSampleStopped = false; } - - if (!channelUsed) { - if (!processedAccelSampleStopped) { - if (CurrentPretendGear < params->m_pTransmission->nNumberOfGears - 1) - ++CurrentPretendGear; - else { - nCruising = 1; - break; // while was used just for this fucking place - } + //549- + if (channelUsed) { + SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 120); + SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z); + SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.0f, 12.5f); + freq = (GearFreqAdj[CurrentPretendGear] + freqModifier + 22050) ; + if (engineSoundType == 8) + freq /= 2; + SampleManager.SetChannelFrequency(m_nActiveSamples, freq); + if (!channelUsed) { + SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != false); + SampleManager.StartChannel(m_nActiveSamples); } + } else if (processedAccelSampleStopped) { + curTime = CTimer::GetTimeInMilliseconds(); + params->m_pVehicle->bAudioChangingGear = true; + if (!SampleManager.InitialiseChannel(m_nActiveSamples, soundOffset + SFX_CAR_ACCEL_1, SAMPLEBANK_MAIN)) + return; + SampleManager.SetChannelLoopCount(m_nActiveSamples, 1); + SampleManager.SetChannelLoopPoints(m_nActiveSamples, 0, -1); + SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 120); + SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z); + SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.0f, 12.5f); + freq = (GearFreqAdj[CurrentPretendGear] + freqModifier + 22050); + if (engineSoundType == 8) + freq /= 2; + SampleManager.SetChannelFrequency(m_nActiveSamples, freq); + if (!channelUsed) { + SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != false); + SampleManager.StartChannel(m_nActiveSamples); + } + } else if (CurrentPretendGear < params->m_pTransmission->nNumberOfGears - 1) { + ++CurrentPretendGear; + curTime = CTimer::GetTimeInMilliseconds(); + params->m_pVehicle->bAudioChangingGear = true; if (!SampleManager.InitialiseChannel(m_nActiveSamples, soundOffset + SFX_CAR_ACCEL_1, SAMPLEBANK_MAIN)) return; SampleManager.SetChannelLoopCount(m_nActiveSamples, 1); SampleManager.SetChannelLoopPoints(m_nActiveSamples, 0, -1); - } - SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 85); - SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z); - SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.f, 12.5f); - freq = GearFreqAdj[CurrentPretendGear] + freqModifier + 22050; - if (engineSoundType == SAMPLEBANK_CAR_MACKTRUCK) - freq /= 2; - SampleManager.SetChannelFrequency(m_nActiveSamples, freq); - if (!channelUsed) { - SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != false); - SampleManager.StartChannel(m_nActiveSamples); + SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 120); + SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z); + SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.0f, 12.5f); + freq = (GearFreqAdj[CurrentPretendGear] + freqModifier + 22050); + if (engineSoundType == 8) + freq /= 2; + SampleManager.SetChannelFrequency(m_nActiveSamples, freq); + if (!channelUsed) { + SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != false); + SampleManager.StartChannel(m_nActiveSamples); + } + } else { + nCruising = 1; + params->m_pVehicle->bAudioChangingGear = true; + bAccelSampleStopped = 1; + SampleManager.StopChannel(m_nActiveSamples); + if (PizzaFaggBool || accelerateState >= 150 && wheelsOnGround && brakeState <= 0 && !params->m_pVehicle->bIsHandbrakeOn + && !lostTraction && currentGear >= params->m_pTransmission->nNumberOfGears - 1) { + if (accelerateState >= 220 && params->m_fVelocityChange + 0.001 < velocityChangeForAudio) { + if (nCruising < 800) + ++nCruising; + } else if (nCruising > 3) { + --nCruising; + } + freq = 27 * nCruising + freqModifier + 22050; + if (engineSoundType == 8) + freq /= 2; + AudioManager.AddPlayerCarSample(120, freq, soundOffset + SFX_CAR_AFTER_ACCEL_1, engineSoundType, 64, true); + } else { + nCruising = 0; + } } } - break; - } - if (nCruising != 0) { - bAccelSampleStopped = true; - if (accelerateState < 150 || automobile->m_nWheelsOnGround == 0 || automobile->bIsHandbrakeOn || lostTraction || - currentGear < params->m_pTransmission->nNumberOfGears - 1) { - nCruising = 0; - } else { - if (accelerateState >= 220 && params->m_fVelocityChange + 0.001f < automobile->m_fVelocityChangeForAudio) { + } else { + params->m_pVehicle->bAudioChangingGear = true; + bAccelSampleStopped = 1; + SampleManager.StopChannel(m_nActiveSamples); + if (PizzaFaggBool || accelerateState >= 150 && wheelsOnGround && brakeState <= 0 && !params->m_pVehicle->bIsHandbrakeOn + && !lostTraction && currentGear >= params->m_pTransmission->nNumberOfGears - 1) { + if (accelerateState >= 220 && params->m_fVelocityChange + 0.001 < velocityChangeForAudio) { if (nCruising < 800) ++nCruising; } else if (nCruising > 3) { --nCruising; } freq = 27 * nCruising + freqModifier + 22050; - if (engineSoundType == SAMPLEBANK_CAR_MACKTRUCK) + if (engineSoundType == 8) freq /= 2; - AddPlayerCarSample(85, freq, (soundOffset + SFX_CAR_AFTER_ACCEL_1), engineSoundType, 64, true); + AudioManager.AddPlayerCarSample(120, freq, soundOffset + SFX_CAR_AFTER_ACCEL_1, engineSoundType, 64, true); + } else { + nCruising = 0; } } } LastAccel = accelerateState; - - bHandbrakeOnLastFrame = !!automobile->bIsHandbrakeOn; + bHandbrakeOnLastFrame = params->m_pVehicle->bIsHandbrakeOn; bLostTractionLastFrame = lostTraction; + return; } bool diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index f07a801e..c502cad1 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -143,6 +143,7 @@ public: class cVehicleParams { public: + int32 m_VehicleType; bool m_bDistanceCalculated; float m_fDistance; CVehicle *m_pVehicle; @@ -345,7 +346,7 @@ public: void ProcessPedOneShots(cPedParams *params); void ProcessPhysical(int32 id); void ProcessPlane(cVehicleParams *params); - void ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *automobile); + void ProcessPlayersVehicleEngine(cVehicleParams *params, CVehicle* veh); void ProcessProjectiles(); void ProcessRainOnVehicle(cVehicleParams *params); void ProcessReverb() const; |