fixup! Add support for non-overlapping sound notifications

This commit is contained in:
Ivaylo Draganov
2021-11-29 20:59:48 +02:00
committed by abcdefg30
parent fa6ff32f65
commit 695b7865d3

View File

@@ -388,6 +388,7 @@ namespace OpenRA
} }
var name = prefix + clip + suffix; 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)) if (!string.IsNullOrEmpty(name) && (p == null || p == p.World.LocalPlayer))
{ {
@@ -398,10 +399,10 @@ namespace OpenRA
else else
return false; return false;
} }
else if (currentSounds.ContainsKey(id) && !currentSounds[id].Complete) else if (currentSounds.ContainsKey(actorId) && !currentSounds[actorId].Complete)
{ {
if (pool.AllowInterrupt) if (pool.AllowInterrupt)
soundEngine.StopSound(currentSounds[id]); soundEngine.StopSound(currentSounds[actorId]);
else else
return false; return false;
} }
@@ -410,8 +411,8 @@ namespace OpenRA
false, relative, pos, false, relative, pos,
InternalSoundVolume * volumeModifier * pool.VolumeModifier, attenuateVolume); InternalSoundVolume * volumeModifier * pool.VolumeModifier, attenuateVolume);
if (id != 0) if (voicedActor != null)
currentSounds[id] = sound; currentSounds[actorId] = sound;
else else
currentNotifications[name] = sound; currentNotifications[name] = sound;
} }