|
| 1 | +#include "audio/SfxParameters.hpp" |
| 2 | + |
| 3 | +#include <algorithm> |
| 4 | +#include <cstddef> |
| 5 | +#include <iterator> |
| 6 | + |
| 7 | +namespace { |
| 8 | +/// Hardcoded array for translating script index into sfx index |
| 9 | +/// Valid for gta3. |
| 10 | +/// (In origin it also had been hardcoded) |
| 11 | +/// (-1 means unlimited) |
| 12 | +/// @todo some of them should return |
| 13 | +/// random(?) number in range |
| 14 | +/// see comment in second column |
| 15 | +/// @todo: preparing data for VC and SA |
| 16 | +constexpr SoundInstanceData sfxData[] = { |
| 17 | + /// for opcode 018c |
| 18 | + {78, 2857 /*-2871*/, -1}, /// male pain soft |
| 19 | + {79, 2857 /*-2871*/, -1}, /// male pain loud |
| 20 | + {80, 2290 /*-2300*/, -1}, /// female pain soft |
| 21 | + {81, 2290 /*-2300*/, -1}, /// female pain loud |
| 22 | + {82, 161 /*-162*/, -1}, /// item pickup |
| 23 | + {83, 161 /*-162*/, -1}, /// item pickup |
| 24 | + {92, 147, 40}, /// gate start |
| 25 | + {93, 147, 40}, /// gate stop |
| 26 | + {94, 337, -1}, /// checkpoint |
| 27 | + {97, 336, -1}, /// countdown timer 3 |
| 28 | + {98, 336, -1}, /// countdown timer 2 |
| 29 | + {99, 336, -1}, /// countdown timer 1 |
| 30 | + {100, 337, -1}, /// countdown finish |
| 31 | + {106, 176, 50}, /// bullet hit ground |
| 32 | + {107, 177, 50}, |
| 33 | + {108, 178, 50}, |
| 34 | + {110, 389, 80}, /// silent |
| 35 | + {111, 389, 80}, |
| 36 | + {112, 283, 80}, /// payphone |
| 37 | + {114, 151, 60}, /// glass break |
| 38 | + {115, 151, 60}, /// glass break |
| 39 | + {116, 150, 60}, /// glass damage |
| 40 | + {117, 152 /*-155*/, 55}, /// glass shards |
| 41 | + {118, 327, 60}, /// boxes destroyed |
| 42 | + {119, 328, 60}, /// boxes destroyed |
| 43 | + {120, 140 /*-144*/, 60}, /// car collision |
| 44 | + {121, 29, 60}, /// tire collision |
| 45 | + {122, 167 /*-168*/, 20}, /// gun shell drop, |
| 46 | + /// dependent on collision |
| 47 | + /// the player is currently |
| 48 | + /// standing on |
| 49 | + {123, 168, 20}, /// gun shell drop soft |
| 50 | + /// for opcode 018d |
| 51 | + {4, 390, 30}, |
| 52 | + {5, 390, 80}, /// Hepburn Heights |
| 53 | + /// southwest tower |
| 54 | + {6, 391, 30}, |
| 55 | + {7, 391, 80}, /// Hepburn Heights |
| 56 | + /// north tower |
| 57 | + {8, 392, 30}, |
| 58 | + {9, 392, 80}, |
| 59 | + {10, 393, 30}, |
| 60 | + {11, 393, 80}, |
| 61 | + {12, 394, 30}, |
| 62 | + {13, 394, 80}, |
| 63 | + {14, 395, 30}, |
| 64 | + {15, 395, 80}, |
| 65 | + {16, 396, 30}, |
| 66 | + {17, 396, 80}, |
| 67 | + {18, 397, 30}, |
| 68 | + {19, 397, 80}, |
| 69 | + {20, 398, 30}, |
| 70 | + {21, 398, 80}, |
| 71 | + {22, 399, 30}, |
| 72 | + {23, 399, 80}, |
| 73 | + {24, 390, 30}, |
| 74 | + {25, 390, 80}, |
| 75 | + {26, 391, 30}, |
| 76 | + {27, 391, 80}, |
| 77 | + {28, 392, 30}, |
| 78 | + {29, 392, 80}, |
| 79 | + {30, 403, 30}, /// Meeouch Sex Kitten Club |
| 80 | + {31, 403, 80}, |
| 81 | + {32, 404, 30}, /// Sex Club Seven |
| 82 | + {33, 404, 80}, |
| 83 | + {34, 405, 30}, |
| 84 | + {35, 405, 30}, |
| 85 | + {36, 407 /*-408*/, 30}, /// 407 plays continuously |
| 86 | + /// while 408 plays intermittently |
| 87 | + {37, 407 /*-408*/, 30}, /// Liberty City |
| 88 | + /// Sawmills/Bitch'N' Dog Food |
| 89 | + {38, 409, 30}, |
| 90 | + {39, 409, 80}, |
| 91 | + {40, 410 /*-411*/, 30}, /// Both plays continuously |
| 92 | + {41, 410 /*-411*/, 30}, /// Mr. Wong's Laundrette |
| 93 | + {42, 412, 30}, /// Roast Peking Duck |
| 94 | + {43, 412, 80}, |
| 95 | + {44, 413, 30}, /// Cipriani's Ristorante |
| 96 | + {45, 413, 80}, |
| 97 | + {46, 414, 30}, |
| 98 | + {47, 414, 30}, |
| 99 | + {48, 415, 30}, /// Marco's Bistro (no sound) |
| 100 | + {49, 415, 80}, |
| 101 | + {50, 416 /*-419*/, 30}, /// Plays separately and intermittently |
| 102 | + {51, 416 /*-419*/, 80}, /// Francis International Terminal B |
| 103 | + {52, 420 /*-422*/, 30}, |
| 104 | + {53, 420 /*-422*/, 30}, /// Chinatown (no sound) |
| 105 | + {54, 423 /*-425*/, 30}, /// Plays separately and intermittently |
| 106 | + {55, 423 /*-425*/, 80}, |
| 107 | + {56, 426, 30}, |
| 108 | + {57, 426, 80}, /// Portland Docks (no sound) |
| 109 | + {58, 427 /*-431*/, 30}, /// Plays separately and intermittently |
| 110 | + {59, 427 /*-431*/, 80}, /// Left side of Misty's apartment |
| 111 | + {60, 406, 30}, /// Salvatore's place |
| 112 | + {61, 406, 80}, |
| 113 | + {62, 432 /*-434*/, 20}, /// South of Sex Club Seven |
| 114 | + /// 432 plays continuously |
| 115 | + /// while 433-434 |
| 116 | + /// plays separately |
| 117 | + /// and intermittently |
| 118 | + {63, 432 /*-434*/, 80}, |
| 119 | + {64, 435 /*-437*/, 20}, /// East of Portland |
| 120 | + /// Pay 'N' Spray 435 plays |
| 121 | + /// continuously while |
| 122 | + /// 436-437 plays separately |
| 123 | + /// and intermittently |
| 124 | + {65, 435 /*-437*/, 80}, |
| 125 | + {66, 438 /*-440*/, 20}, /// Executive Relief 438 |
| 126 | + /// plays continuously while |
| 127 | + /// 439-440 plays separately |
| 128 | + /// and intermittently |
| 129 | + {67, 438 /*-440*/, 80}, |
| 130 | + {68, 442, 30}, |
| 131 | + {69, 442, 80}, /// Bank of Liberty/Staunton |
| 132 | + /// police HQ alarm |
| 133 | + {70, 441, 30}, |
| 134 | + {71, 441, 80}, /// Old school hall |
| 135 | + {72, 443, 30}, |
| 136 | + {73, 443, 80}, /// Warehouse rave |
| 137 | + {76, 179 /*-184*/, 30}, /// Plays separately and intermittently |
| 138 | + {77, 179 /*-184*/, 80}, /// Staunton police HQ |
| 139 | + {84, 444, 30}, |
| 140 | + {85, 444, 80}, |
| 141 | + {86, 444, 30}, |
| 142 | + {87, 444, 80}, |
| 143 | + {88, 445, 30}, |
| 144 | + {89, 445, 80}, |
| 145 | + {90, 433 /*-434*/, 20}, /// Plays separately and intermittently |
| 146 | + {91, 433 /*-434*/, 80}, /// Right side of Misty's apartment |
| 147 | + {102, 157, 50} /// Callahan Bridge fire |
| 148 | +}; |
| 149 | +} // namespace |
| 150 | + |
| 151 | +const SoundInstanceData* getSoundInstanceData(int scriptId) { |
| 152 | + const auto found = std::find_if(std::begin(sfxData), std::end(sfxData), |
| 153 | + [&scriptId](const SoundInstanceData data) { |
| 154 | + return data.id == scriptId; |
| 155 | + }); |
| 156 | + if (found != std::end(sfxData)) { |
| 157 | + return found; |
| 158 | + } |
| 159 | + return std::begin(sfxData); |
| 160 | +} |
0 commit comments