From aa8452a4b03cfba3440b1ee2295c3e3926286ed2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 19 Dec 2019 11:47:47 +0100 Subject: [PATCH] - backported IsSourcePlayingSomething fix from GZDoom. --- source/common/sound/s_sound.cpp | 6 +++--- source/common/sound/s_soundinternal.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/source/common/sound/s_sound.cpp b/source/common/sound/s_sound.cpp index 56c9202da..60aeeb2cb 100644 --- a/source/common/sound/s_sound.cpp +++ b/source/common/sound/s_sound.cpp @@ -804,7 +804,7 @@ void SoundEngine::LoadSound3D(sfxinfo_t *sfx, FSoundLoadBuffer *pBuffer) { snd = GSnd->LoadSoundBuffered(pBuffer, true); } - else + else if (sfx->lumpnum >= 0) { auto sfxdata = ReadSound(sfx->lumpnum); int size = sfxdata.Size(); @@ -1166,9 +1166,9 @@ bool SoundEngine::IsSourcePlayingSomething (int sourcetype, const void *actor, i { if (chan->SourceType == sourcetype && (sourcetype == SOURCE_None || sourcetype == SOURCE_Unattached || chan->Source == actor)) { - if (channel == 0 || chan->EntChannel == channel) + if ((channel == 0 || chan->EntChannel == channel) && (sound_id <= 0 || chan->OrgID == sound_id)) { - return sound_id <= 0 || chan->OrgID == sound_id; + return true; } } } diff --git a/source/common/sound/s_soundinternal.h b/source/common/sound/s_soundinternal.h index 130db61b7..ae56ca038 100644 --- a/source/common/sound/s_soundinternal.h +++ b/source/common/sound/s_soundinternal.h @@ -95,8 +95,8 @@ enum ROLLOFF_Custom // Lookup volume from SNDCURVE }; -int S_FindSoundByResID(int ndx); -int S_FindSound(const char* name); +int S_FindSound(const char *logicalname); +int S_FindSoundByResID(int snd_id); // An index into the S_sfx[] array. class FSoundID @@ -167,10 +167,10 @@ struct FSoundChan : public FISoundChannel FSoundID SoundID; // Sound ID of playing sound. FSoundID OrgID; // Sound ID of sound used to start this channel. float Volume; + int EntChannel; // Actor's sound channel. int16_t Pitch; // Pitch variation. - int32_t EntChannel; // Actor's sound channel. - int8_t Priority; int16_t NearLimit; + int8_t Priority; uint8_t SourceType; float LimitRange; const void *Source;