mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
sounds variability + first step fix
This commit is contained in:
parent
87dd1dd6b2
commit
bfc3182ed3
4 changed files with 23 additions and 9 deletions
|
|
@ -249,6 +249,12 @@ speakerid_t audio::play(
|
|||
int priority,
|
||||
int channel
|
||||
) {
|
||||
if (!sound->variants.empty()) {
|
||||
size_t index = rand() % (sound->variants.size() + 1);
|
||||
if (index < sound->variants.size()) {
|
||||
sound = sound->variants.at(index).get();
|
||||
}
|
||||
}
|
||||
Speaker* speaker = sound->newInstance(priority, channel);
|
||||
if (speaker == nullptr) {
|
||||
remove_lower_priority_speaker(priority);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue