diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index de36851cf..84bae3b4e 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -73,6 +73,8 @@ void deletesprite(int num) { if (sprite[num].picnum == MUSICANDSFX && hittype[num].temp_data[0] == 1) S_StopSound(sprite[num].lotag, num); + else + S_RelinkActorSound(num, -1); ::deletesprite(num); } diff --git a/source/games/duke/src/sounds.cpp b/source/games/duke/src/sounds.cpp index 76740b076..8d16b2831 100644 --- a/source/games/duke/src/sounds.cpp +++ b/source/games/duke/src/sounds.cpp @@ -482,6 +482,12 @@ int S_PlayActorSound(int soundNum, int spriteNum, int channel, EChanFlags flags) S_PlaySound3D(soundNum, spriteNum, &sprite[spriteNum].pos, channel, flags); } +void S_RelinkActorSound(int from, int to) +{ + FVector3 pos = GetSoundPos(&sprite[from].pos); + soundEngine->RelinkSound(SOURCE_Actor, &sprite[from], to == -1 ? nullptr : &sprite[to], &pos); +} + void S_StopSound(int sndNum, int sprNum, int channel) { if (sprNum < -1 || sprNum >= MAXSPRITES) return; diff --git a/source/games/duke/src/sounds.h b/source/games/duke/src/sounds.h index 2412d73f0..56d015451 100644 --- a/source/games/duke/src/sounds.h +++ b/source/games/duke/src/sounds.h @@ -43,6 +43,7 @@ int S_DefineSound(unsigned index, const char* filename, int ps, int pe, int pr, int S_PlaySound(int num, int channel = CHAN_AUTO, EChanFlags flags = 0, float vol =0.8f); int S_PlaySound3D(int num, int spriteNum, const vec3_t* pos, int channel = CHAN_AUTO, EChanFlags flags = 0); int S_PlayActorSound(int soundNum, int spriteNum, int channel = CHAN_AUTO, EChanFlags flags = 0); +void S_RelinkActorSound(int from, int to); void S_MenuSound(void); void S_StopSound(int sndNum, int sprNum = -1, int flags = -1);