mnsound: simplify mn_stop_sound_effect

This commit is contained in:
rr- 2021-11-05 20:19:24 +01:00 committed by Marcin Kurczewski
parent 10b6cf19dd
commit 63e23dbcb8

View file

@ -392,31 +392,15 @@ void mn_stop_sound_effect(int sfx_num, PHD_3DPOS *pos)
return; return;
} }
if (pos) { for (int i = 0; i < MAX_PLAYING_FX; i++) {
for (int i = 0; i < MAX_PLAYING_FX; i++) { MN_SFX_PLAY_INFO *slot = &SFXPlaying[i];
MN_SFX_PLAY_INFO *slot = &SFXPlaying[i]; if ((slot->mn_flags & MN_FX_USED)
if (slot->mn_flags & MN_FX_USED) { && S_SoundSampleIsPlaying(slot->handle)) {
if (sfx_num >= 0) { if ((!pos && slot->fxnum == sfx_num)
if (slot->pos == pos && slot->fxnum == sfx_num) { || (pos && sfx_num >= 0 && slot->fxnum == sfx_num)
S_SoundStopSample(slot->handle); || (pos && sfx_num < 0)) {
mn_clear_fx_slot(slot); S_SoundStopSample(slot->handle);
return; mn_clear_fx_slot(slot);
}
} else if (slot->pos == pos) {
S_SoundStopSample(slot->handle);
mn_clear_fx_slot(slot);
}
}
}
} else {
for (int i = 0; i < MAX_PLAYING_FX; i++) {
MN_SFX_PLAY_INFO *slot = &SFXPlaying[i];
if (slot->mn_flags & MN_FX_USED) {
if (slot->fxnum == sfx_num
&& S_SoundSampleIsPlaying(slot->handle)) {
S_SoundStopSample(slot->handle);
mn_clear_fx_slot(slot);
}
} }
} }
} }