- backported IsSourcePlayingSomething fix from GZDoom.

This commit is contained in:
Christoph Oelckers 2019-12-19 11:47:47 +01:00
parent c056a53792
commit aa8452a4b0
2 changed files with 7 additions and 7 deletions

View file

@ -804,7 +804,7 @@ void SoundEngine::LoadSound3D(sfxinfo_t *sfx, FSoundLoadBuffer *pBuffer)
{ {
snd = GSnd->LoadSoundBuffered(pBuffer, true); snd = GSnd->LoadSoundBuffered(pBuffer, true);
} }
else else if (sfx->lumpnum >= 0)
{ {
auto sfxdata = ReadSound(sfx->lumpnum); auto sfxdata = ReadSound(sfx->lumpnum);
int size = sfxdata.Size(); 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 (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;
} }
} }
} }

View file

@ -95,8 +95,8 @@ enum
ROLLOFF_Custom // Lookup volume from SNDCURVE ROLLOFF_Custom // Lookup volume from SNDCURVE
}; };
int S_FindSoundByResID(int ndx); int S_FindSound(const char *logicalname);
int S_FindSound(const char* name); int S_FindSoundByResID(int snd_id);
// An index into the S_sfx[] array. // An index into the S_sfx[] array.
class FSoundID class FSoundID
@ -167,10 +167,10 @@ struct FSoundChan : public FISoundChannel
FSoundID SoundID; // Sound ID of playing sound. FSoundID SoundID; // Sound ID of playing sound.
FSoundID OrgID; // Sound ID of sound used to start this channel. FSoundID OrgID; // Sound ID of sound used to start this channel.
float Volume; float Volume;
int EntChannel; // Actor's sound channel.
int16_t Pitch; // Pitch variation. int16_t Pitch; // Pitch variation.
int32_t EntChannel; // Actor's sound channel.
int8_t Priority;
int16_t NearLimit; int16_t NearLimit;
int8_t Priority;
uint8_t SourceType; uint8_t SourceType;
float LimitRange; float LimitRange;
const void *Source; const void *Source;