diff --git a/Subsurface/Source/Map/FireSource.cs b/Subsurface/Source/Map/FireSource.cs index 83c113986..d8d57e419 100644 --- a/Subsurface/Source/Map/FireSource.cs +++ b/Subsurface/Source/Map/FireSource.cs @@ -66,10 +66,10 @@ namespace Barotrauma hull = Hull.FindHull(worldPosition, spawningHull); if (hull == null || (!networkEvent && GameMain.Client!=null)) return; - if (fireSoundBasic==null) + if (fireSoundBasic == null) { - fireSoundBasic = Sound.Load("Content/Sounds/fire.ogg"); - fireSoundLarge = Sound.Load("Content/Sounds/firelarge.ogg"); + fireSoundBasic = Sound.Load("Content/Sounds/fire.ogg", false); + fireSoundLarge = Sound.Load("Content/Sounds/firelarge.ogg", false); } hull.AddFireSource(this, !networkEvent); @@ -78,13 +78,8 @@ namespace Barotrauma this.position = worldPosition - new Vector2(-5.0f, 5.0f) - Submarine.Position; - lightSource = new LightSource(this.position, 50.0f, new Color(1.0f, 0.9f, 0.7f), hull == null ? null : hull.Submarine); - - - - //this.position.Y = hull.Rect.Y - hull.Rect.Height; - + size = new Vector2(10.0f, 10.0f); } @@ -356,12 +351,12 @@ namespace Barotrauma lightSource.Remove(); - if (basicSoundIndex > -1) + if (basicSoundIndex > 0) { Sounds.SoundManager.Stop(basicSoundIndex); basicSoundIndex = -1; } - if (largeSoundIndex > -1) + if (largeSoundIndex > 0) { Sounds.SoundManager.Stop(largeSoundIndex); largeSoundIndex = -1; diff --git a/Subsurface/Source/Sounds/Sound.cs b/Subsurface/Source/Sounds/Sound.cs index 9ce6c8079..34714f97d 100644 --- a/Subsurface/Source/Sounds/Sound.cs +++ b/Subsurface/Source/Sounds/Sound.cs @@ -242,7 +242,11 @@ namespace Barotrauma SoundManager.ClearAlSource(AlBufferId); ALHelper.Check(); - if (oggSound != null) oggSound.Dispose(); + if (oggSound != null) + { + oggSound.Dispose(); + oggSound = null; + } } diff --git a/Subsurface/Source/Sounds/SoundManager.cs b/Subsurface/Source/Sounds/SoundManager.cs index e1184e983..4b1202da9 100644 --- a/Subsurface/Source/Sounds/SoundManager.cs +++ b/Subsurface/Source/Sounds/SoundManager.cs @@ -75,8 +75,8 @@ namespace Barotrauma.Sounds public static int Play(Sound sound, Vector2 position, float volume = 1.0f, float lowPassGain = 0.0f, bool loop=false) { - if (Disabled) return -1; - + if (Disabled || sound.AlBufferId == -1) return -1; + for (int i = 1; i < DefaultSourceCount; i++) { //find a source that's free to use (not playing or paused)