Fire sound fix: the sounds were freed after each round without ever loading them again. The sound objects still existed and had some buffer ID assigned though, causing an incorrect clip to be played or OpenAL errors to be thrown on successive rounds. (Now freed sounds always have a buffer ID of -1)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -242,7 +242,11 @@ namespace Barotrauma
|
||||
SoundManager.ClearAlSource(AlBufferId);
|
||||
ALHelper.Check();
|
||||
|
||||
if (oggSound != null) oggSound.Dispose();
|
||||
if (oggSound != null)
|
||||
{
|
||||
oggSound.Dispose();
|
||||
oggSound = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user