MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / InitAmbientSounds

Function InitAmbientSounds

Descent3/ambient.cpp:139–156  ·  view source on GitHub ↗

Initializes the ambient sounds for the current level

Source from the content-addressed store, hash-verified

137
138// Initializes the ambient sounds for the current level
139void 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"

Callers 1

StartLevelSoundsFunction · 0.85

Calls 1

randfFunction · 0.85

Tested by

no test coverage detected