v1.6.17.0 (Unto the Breach update)
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
using Barotrauma.Extensions;
|
||||
using Barotrauma.IO;
|
||||
using Barotrauma.Sounds;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Barotrauma.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -16,6 +15,8 @@ namespace Barotrauma
|
||||
private const float MusicLerpSpeed = 1.0f;
|
||||
private const float UpdateMusicInterval = 5.0f;
|
||||
|
||||
public const float MuffleFilterFrequency = 600;
|
||||
|
||||
const int MaxMusicChannels = 6;
|
||||
|
||||
private readonly static BackgroundMusic[] currentMusic = new BackgroundMusic[MaxMusicChannels];
|
||||
@@ -28,9 +29,9 @@ namespace Barotrauma
|
||||
private static float updateMusicTimer;
|
||||
|
||||
//ambience
|
||||
private static Sound waterAmbienceIn => SoundPrefab.WaterAmbienceIn.ActivePrefab.Sound;
|
||||
private static Sound waterAmbienceOut => SoundPrefab.WaterAmbienceOut.ActivePrefab.Sound;
|
||||
private static Sound waterAmbienceMoving => SoundPrefab.WaterAmbienceMoving.ActivePrefab.Sound;
|
||||
private static SoundPrefab waterAmbienceIn => SoundPrefab.WaterAmbienceIn.ActivePrefab;
|
||||
private static SoundPrefab waterAmbienceOut => SoundPrefab.WaterAmbienceOut.ActivePrefab;
|
||||
private static SoundPrefab waterAmbienceMoving => SoundPrefab.WaterAmbienceMoving.ActivePrefab;
|
||||
private static readonly HashSet<SoundChannel> waterAmbienceChannels = new HashSet<SoundChannel>();
|
||||
|
||||
private static float ambientSoundTimer;
|
||||
@@ -213,9 +214,9 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
updateWaterAmbience(waterAmbienceIn, ambienceVolume * (1.0f - movementSoundVolume) * insideSubFactor);
|
||||
updateWaterAmbience(waterAmbienceMoving, ambienceVolume * movementSoundVolume * insideSubFactor);
|
||||
updateWaterAmbience(waterAmbienceOut, 1.0f - insideSubFactor);
|
||||
updateWaterAmbience(waterAmbienceIn.Sound, ambienceVolume * (1.0f - movementSoundVolume) * insideSubFactor * waterAmbienceIn.Volume);
|
||||
updateWaterAmbience(waterAmbienceMoving.Sound, ambienceVolume * movementSoundVolume * insideSubFactor * waterAmbienceMoving.Volume);
|
||||
updateWaterAmbience(waterAmbienceOut.Sound, (1.0f - insideSubFactor) * waterAmbienceOut.Volume);
|
||||
}
|
||||
|
||||
private static void UpdateWaterFlowSounds(float deltaTime)
|
||||
@@ -956,7 +957,7 @@ namespace Barotrauma
|
||||
PlayDamageSound(damageType, damage, bodyPosition, 800.0f);
|
||||
}
|
||||
|
||||
public static void PlayDamageSound(string damageType, float damage, Vector2 position, float range = 2000.0f, IEnumerable<Identifier> tags = null)
|
||||
public static void PlayDamageSound(string damageType, float damage, Vector2 position, float range = 2000.0f, IEnumerable<Identifier> tags = null, float gain = 1.0f)
|
||||
{
|
||||
var suitableSounds = damageSounds.Where(s =>
|
||||
s.DamageType == damageType &&
|
||||
@@ -972,7 +973,7 @@ namespace Barotrauma
|
||||
s.DamageRange == Vector2.Zero || (randomizedDamage >= s.DamageRange.X && randomizedDamage <= s.DamageRange.Y));
|
||||
|
||||
var damageSound = suitableSounds.GetRandomUnsynced();
|
||||
damageSound?.Sound?.Play(1.0f, range, position, muffle: !damageSound.IgnoreMuffling && ShouldMuffleSound(Character.Controlled, position, range, null));
|
||||
damageSound?.Sound?.Play(gain, range, position, muffle: !damageSound.IgnoreMuffling && ShouldMuffleSound(Character.Controlled, position, range, null));
|
||||
}
|
||||
|
||||
public static void PlayUISound(GUISoundType soundType)
|
||||
|
||||
Reference in New Issue
Block a user