diff --git a/source/common/sound/s_sound.cpp b/source/common/sound/s_sound.cpp index 6bc202b80..3b923a7f8 100644 --- a/source/common/sound/s_sound.cpp +++ b/source/common/sound/s_sound.cpp @@ -918,7 +918,7 @@ void SoundEngine::StopSoundID(int sound_id) while (chan != NULL) { FSoundChan* next = chan->NextChan; - if (sound_id == chan->SoundID) + if (sound_id == chan->OrgID) { StopChannel(chan); } @@ -940,7 +940,7 @@ void SoundEngine::StopSound (int channel, int sound_id) while (chan != NULL) { 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); } @@ -964,7 +964,7 @@ void SoundEngine::StopSound(int sourcetype, const void* actor, int channel, int FSoundChan* next = chan->NextChan; if (chan->SourceType == sourcetype && 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); } @@ -1074,7 +1074,7 @@ void SoundEngine::ChangeSoundPitch(int sourcetype, const void *source, int chann { if (chan->SourceType == sourcetype && 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); return; diff --git a/source/duke3d/src/sounds.cpp b/source/duke3d/src/sounds.cpp index 4cfaf39b0..e9e6c7117 100644 --- a/source/duke3d/src/sounds.cpp +++ b/source/duke3d/src/sounds.cpp @@ -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); 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; 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) { - auto sid = chan->SoundID; + auto sid = chan->OrgID; auto flags = ((sound_t*)soundEngine->GetUserData(sid))->flags; return !!(flags & SF_TALK); }); diff --git a/source/rr/src/sounds.cpp b/source/rr/src/sounds.cpp index 475bc6837..bb9ad1be8 100644 --- a/source/rr/src/sounds.cpp +++ b/source/rr/src/sounds.cpp @@ -359,7 +359,7 @@ void S_Update(void) int S_PlaySound3D(int sndnum, int spriteNum, const vec3_t* pos, int flags) { 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; 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) { - auto sid = chan->SoundID; + auto sid = chan->OrgID; auto flags = ((sound_t*)soundEngine->GetUserData(sid))->flags; return !!(flags & SF_TALK); });