- fixed a few places where the wrong sound ID was checked.

This commit is contained in:
Christoph Oelckers 2019-12-16 17:41:44 +01:00
parent 3cba51cfd4
commit fbfb1972b8
3 changed files with 8 additions and 8 deletions

View file

@ -918,7 +918,7 @@ void SoundEngine::StopSoundID(int sound_id)
while (chan != NULL) while (chan != NULL)
{ {
FSoundChan* next = chan->NextChan; FSoundChan* next = chan->NextChan;
if (sound_id == chan->SoundID) if (sound_id == chan->OrgID)
{ {
StopChannel(chan); StopChannel(chan);
} }
@ -940,7 +940,7 @@ void SoundEngine::StopSound (int channel, int sound_id)
while (chan != NULL) while (chan != NULL)
{ {
FSoundChan *next = chan->NextChan; FSoundChan *next = chan->NextChan;
if (chan->SourceType == SOURCE_None && (sound_id == -1 || sound_id == chan->SoundID)) if (chan->SourceType == SOURCE_None && (sound_id == -1 || sound_id == chan->OrgID))
{ {
StopChannel(chan); StopChannel(chan);
} }
@ -964,7 +964,7 @@ void SoundEngine::StopSound(int sourcetype, const void* actor, int channel, int
FSoundChan* next = chan->NextChan; FSoundChan* next = chan->NextChan;
if (chan->SourceType == sourcetype && if (chan->SourceType == sourcetype &&
chan->Source == actor && chan->Source == actor &&
(sound_id == -1? (chan->EntChannel == channel || channel < 0) : (chan->SoundID == sound_id))) (sound_id == -1? (chan->EntChannel == channel || channel < 0) : (chan->OrgID == sound_id)))
{ {
StopChannel(chan); StopChannel(chan);
} }
@ -1074,7 +1074,7 @@ void SoundEngine::ChangeSoundPitch(int sourcetype, const void *source, int chann
{ {
if (chan->SourceType == sourcetype && if (chan->SourceType == sourcetype &&
chan->Source == source && chan->Source == source &&
(sound_id == -1? (chan->EntChannel == channel) : (chan->SoundID == sound_id))) (sound_id == -1? (chan->EntChannel == channel) : (chan->OrgID == sound_id)))
{ {
SetPitch(chan, (float)pitch); SetPitch(chan, (float)pitch);
return; return;

View file

@ -356,7 +356,7 @@ int S_PlaySound3D(int num, int spriteNum, const vec3_t* pos, int flags)
int sndnum = VM_OnEventWithReturn(EVENT_SOUND, spriteNum, screenpeek, num); int sndnum = VM_OnEventWithReturn(EVENT_SOUND, spriteNum, screenpeek, num);
auto const pPlayer = g_player[myconnectindex].ps; auto const pPlayer = g_player[myconnectindex].ps;
if (!soundEngine->isValidSoundId(sndnum) || !SoundEnabled() || (unsigned)spriteNum >= MAXSPRITES || (pPlayer->gm & MODE_MENU) || if (!soundEngine->isValidSoundId(sndnum+1) || !SoundEnabled() || (unsigned)spriteNum >= MAXSPRITES || (pPlayer->gm & MODE_MENU) ||
(pPlayer->timebeforeexit > 0 && pPlayer->timebeforeexit <= GAMETICSPERSEC * 3)) return -1; (pPlayer->timebeforeexit > 0 && pPlayer->timebeforeexit <= GAMETICSPERSEC * 3)) return -1;
int userflags = S_GetUserFlags(sndnum); int userflags = S_GetUserFlags(sndnum);
@ -377,7 +377,7 @@ int S_PlaySound3D(int num, int spriteNum, const vec3_t* pos, int flags)
bool foundone = soundEngine->EnumerateChannels([&](FSoundChan* chan) bool foundone = soundEngine->EnumerateChannels([&](FSoundChan* chan)
{ {
auto sid = chan->SoundID; auto sid = chan->OrgID;
auto flags = ((sound_t*)soundEngine->GetUserData(sid))->flags; auto flags = ((sound_t*)soundEngine->GetUserData(sid))->flags;
return !!(flags & SF_TALK); return !!(flags & SF_TALK);
}); });

View file

@ -359,7 +359,7 @@ void S_Update(void)
int S_PlaySound3D(int sndnum, int spriteNum, const vec3_t* pos, int flags) int S_PlaySound3D(int sndnum, int spriteNum, const vec3_t* pos, int flags)
{ {
auto const pPlayer = g_player[myconnectindex].ps; auto const pPlayer = g_player[myconnectindex].ps;
if (!soundEngine->isValidSoundId(sndnum) || !SoundEnabled() || (unsigned)spriteNum >= MAXSPRITES || (pPlayer->gm & MODE_MENU) || if (!soundEngine->isValidSoundId(sndnum+1) || !SoundEnabled() || (unsigned)spriteNum >= MAXSPRITES || (pPlayer->gm & MODE_MENU) ||
(pPlayer->timebeforeexit > 0 && pPlayer->timebeforeexit <= GAMETICSPERSEC * 3)) return -1; (pPlayer->timebeforeexit > 0 && pPlayer->timebeforeexit <= GAMETICSPERSEC * 3)) return -1;
int userflags = S_GetUserFlags(sndnum); int userflags = S_GetUserFlags(sndnum);
@ -380,7 +380,7 @@ int S_PlaySound3D(int sndnum, int spriteNum, const vec3_t* pos, int flags)
bool foundone = soundEngine->EnumerateChannels([&](FSoundChan* chan) bool foundone = soundEngine->EnumerateChannels([&](FSoundChan* chan)
{ {
auto sid = chan->SoundID; auto sid = chan->OrgID;
auto flags = ((sound_t*)soundEngine->GetUserData(sid))->flags; auto flags = ((sound_t*)soundEngine->GetUserData(sid))->flags;
return !!(flags & SF_TALK); return !!(flags & SF_TALK);
}); });