From 695b7865d3905c280e828d6555f4691cf3187a41 Mon Sep 17 00:00:00 2001 From: Ivaylo Draganov Date: Mon, 29 Nov 2021 20:59:48 +0200 Subject: [PATCH] fixup! Add support for non-overlapping sound notifications --- OpenRA.Game/Sound/Sound.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/OpenRA.Game/Sound/Sound.cs b/OpenRA.Game/Sound/Sound.cs index d9772d5f21..949dae16de 100644 --- a/OpenRA.Game/Sound/Sound.cs +++ b/OpenRA.Game/Sound/Sound.cs @@ -388,6 +388,7 @@ namespace OpenRA } var name = prefix + clip + suffix; + var actorId = voicedActor != null && voicedActor.World.Selection.Contains(voicedActor) ? 0 : id; if (!string.IsNullOrEmpty(name) && (p == null || p == p.World.LocalPlayer)) { @@ -398,10 +399,10 @@ namespace OpenRA else return false; } - else if (currentSounds.ContainsKey(id) && !currentSounds[id].Complete) + else if (currentSounds.ContainsKey(actorId) && !currentSounds[actorId].Complete) { if (pool.AllowInterrupt) - soundEngine.StopSound(currentSounds[id]); + soundEngine.StopSound(currentSounds[actorId]); else return false; } @@ -410,8 +411,8 @@ namespace OpenRA false, relative, pos, InternalSoundVolume * volumeModifier * pool.VolumeModifier, attenuateVolume); - if (id != 0) - currentSounds[id] = sound; + if (voicedActor != null) + currentSounds[actorId] = sound; else currentNotifications[name] = sound; }