Allow cash ticking sound to overlap

This commit is contained in:
Gustas
2022-10-11 15:58:37 +03:00
committed by Matthias Mailänder
parent fde4f8d0e5
commit 347148e02f
6 changed files with 72 additions and 49 deletions

View File

@@ -401,36 +401,49 @@ namespace OpenRA
if (!string.IsNullOrEmpty(name) && (p == null || p == p.World.LocalPlayer))
{
if (currentNotifications.TryGetValue(name, out var currentNotification))
ISound PlaySound()
{
if (!currentNotification.Complete)
var volume = InternalSoundVolume * volumeModifier * pool.VolumeModifier;
return soundEngine.Play2D(sounds[name], false, relative, pos, volume, attenuateVolume);
}
if (pool.Type == SoundPool.InterruptType.Overlap)
{
if (PlaySound() == null)
return false;
}
else if (voicedActor == null)
{
if (currentNotifications.TryGetValue(name, out var currentNotification) && !currentNotification.Complete)
{
if (pool.AllowInterrupt)
if (pool.Type == SoundPool.InterruptType.Interrupt)
soundEngine.StopSound(currentNotification);
else
else if (pool.Type == SoundPool.InterruptType.DoNotPlay)
return false;
}
}
else if (currentSounds.TryGetValue(actorId, out var currentSound))
{
if (!currentSound.Complete)
{
if (pool.AllowInterrupt)
soundEngine.StopSound(currentSound);
else
return false;
}
}
var volume = InternalSoundVolume * volumeModifier * pool.VolumeModifier;
var sound = soundEngine.Play2D(sounds[name], false, relative, pos, volume, attenuateVolume);
if (sound == null)
return false;
if (voicedActor != null)
currentSounds[actorId] = sound;
var sound = PlaySound();
if (sound == null)
return false;
else
currentNotifications[name] = sound;
}
else
currentNotifications[name] = sound;
{
if (currentSounds.TryGetValue(actorId, out var currentSound) && !currentSound.Complete)
{
if (pool.Type == SoundPool.InterruptType.Interrupt)
soundEngine.StopSound(currentSound);
else if (pool.Type == SoundPool.InterruptType.DoNotPlay)
return false;
}
var sound = PlaySound();
if (sound == null)
return false;
else
currentSounds[actorId] = sound;
}
}
return true;