Initializes the ambient sounds for the current level
| 137 | |
| 138 | // Initializes the ambient sounds for the current level |
| 139 | void InitAmbientSounds() { |
| 140 | // Loop through all ambient sound patterns |
| 141 | for (int p = 0; p < Num_ambient_sound_patterns; p++) { |
| 142 | asp *asp = &Ambient_sound_patterns[p]; |
| 143 | |
| 144 | // Initialize delay |
| 145 | asp->delay = asp->min_delay + (asp->max_delay - asp->min_delay) * randf(); |
| 146 | |
| 147 | // Make sure the probabilities add up |
| 148 | int prob = 0; |
| 149 | for (int s = 0; s < asp->num_sounds; s++) |
| 150 | prob += asp->sounds[s].probability; |
| 151 | if (asp->num_sounds && prob != 100) { |
| 152 | Int3(); |
| 153 | asp->sounds[0].probability += 100 - prob; // make it total 100 |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | #include "ddio.h" |
| 159 | #include "soundload.h" |
no test coverage detected