Unstable v0.1300.0.0 (February 19th 2021)
This commit is contained in:
@@ -195,14 +195,21 @@ namespace Barotrauma
|
||||
{
|
||||
case "music":
|
||||
var newMusicClip = new BackgroundMusic(soundElement);
|
||||
musicClips.AddIfNotNull(newMusicClip);
|
||||
if (loadedSoundElements != null)
|
||||
if (File.Exists(newMusicClip.File))
|
||||
{
|
||||
if (newMusicClip.Type.Equals("menu", StringComparison.OrdinalIgnoreCase))
|
||||
musicClips.AddIfNotNull(newMusicClip);
|
||||
if (loadedSoundElements != null)
|
||||
{
|
||||
targetMusic[0] = newMusicClip;
|
||||
if (newMusicClip.Type.Equals("menu", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
targetMusic[0] = newMusicClip;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugConsole.NewMessage($"Music file \"{newMusicClip.File}\" not found.");
|
||||
}
|
||||
break;
|
||||
case "splash":
|
||||
SplashSounds.AddIfNotNull(GameMain.SoundManager.LoadSound(soundElement, false));
|
||||
@@ -411,7 +418,11 @@ namespace Barotrauma
|
||||
if (animController.HeadInWater)
|
||||
{
|
||||
ambienceVolume = 1.0f;
|
||||
ambienceVolume += animController.Limbs[0].LinearVelocity.Length();
|
||||
float limbSpeed = animController.Limbs[0].LinearVelocity.Length();
|
||||
if (MathUtils.IsValid(limbSpeed))
|
||||
{
|
||||
ambienceVolume += limbSpeed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,6 +466,13 @@ namespace Barotrauma
|
||||
GameAnalyticsManager.AddErrorEventOnce("SoundPlayer.UpdateWaterAmbience:InvalidVolume", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
||||
movementSoundVolume = 0.0f;
|
||||
}
|
||||
if (!MathUtils.IsValid(insideSubFactor))
|
||||
{
|
||||
string errorMsg = "Failed to update water ambience volume - inside sub value invalid (" + insideSubFactor + ")";
|
||||
DebugConsole.Log(errorMsg);
|
||||
GameAnalyticsManager.AddErrorEventOnce("SoundPlayer.UpdateWaterAmbience:InvalidVolume", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
||||
insideSubFactor = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
@@ -477,9 +495,10 @@ namespace Barotrauma
|
||||
break;
|
||||
}
|
||||
|
||||
// Consider the volume set in sounds.xml
|
||||
if (sound != null) { volume *= sound.BaseGain; }
|
||||
if (sound == null) { continue; }
|
||||
|
||||
// Consider the volume set in sounds.xml
|
||||
volume *= sound.BaseGain;
|
||||
if ((waterAmbienceChannels[i] == null || !waterAmbienceChannels[i].IsPlaying) && volume > 0.01f)
|
||||
{
|
||||
waterAmbienceChannels[i] = sound.Play(volume, "waterambience");
|
||||
@@ -759,7 +778,7 @@ namespace Barotrauma
|
||||
return PlaySound(sound, position, volume ?? sound.BaseGain, range ?? sound.BaseFar, 1.0f, hullGuess);
|
||||
}
|
||||
|
||||
public static SoundChannel PlaySound(Sound sound, Vector2 position, float? volume = null, float? range = null, float? freqMult = null, Hull hullGuess = null)
|
||||
public static SoundChannel PlaySound(Sound sound, Vector2 position, float? volume = null, float? range = null, float? freqMult = null, Hull hullGuess = null, bool ignoreMuffling = false)
|
||||
{
|
||||
if (sound == null)
|
||||
{
|
||||
@@ -774,7 +793,7 @@ namespace Barotrauma
|
||||
{
|
||||
return null;
|
||||
}
|
||||
bool muffle = !sound.IgnoreMuffling && ShouldMuffleSound(Character.Controlled, position, far, hullGuess);
|
||||
bool muffle = !ignoreMuffling && ShouldMuffleSound(Character.Controlled, position, far, hullGuess);
|
||||
return sound.Play(volume ?? sound.BaseGain, far, freqMult ?? 1.0f, position, muffle: muffle);
|
||||
}
|
||||
|
||||
@@ -875,7 +894,17 @@ namespace Barotrauma
|
||||
if (currentMusic[i] == null || (musicChannel[i] == null || !musicChannel[i].IsPlaying))
|
||||
{
|
||||
DisposeMusicChannel(i);
|
||||
currentMusic[i] = GameMain.SoundManager.LoadSound(targetMusic[i].File, true);
|
||||
try
|
||||
{
|
||||
currentMusic[i] = GameMain.SoundManager.LoadSound(targetMusic[i].File, true);
|
||||
}
|
||||
catch (System.IO.InvalidDataException e)
|
||||
{
|
||||
DebugConsole.ThrowError($"Failed to load the music clip \"{targetMusic[i].File}\".", e);
|
||||
musicClips.Remove(targetMusic[i]);
|
||||
targetMusic[i] = null;
|
||||
break;
|
||||
}
|
||||
musicChannel[i] = currentMusic[i].Play(0.0f, "music");
|
||||
if (targetMusic[i].ContinueFromPreviousTime)
|
||||
{
|
||||
@@ -959,7 +988,7 @@ namespace Barotrauma
|
||||
return "wreck";
|
||||
}
|
||||
|
||||
if (Level.IsLoadedOutpost && Character.Controlled.Submarine == Level.Loaded.StartOutpost)
|
||||
if (Level.IsLoadedOutpost)
|
||||
{
|
||||
// Only return music type for location types which have music tracks defined
|
||||
var locationType = Level.Loaded.StartLocation?.Type?.Identifier?.ToLowerInvariant();
|
||||
@@ -971,13 +1000,17 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
Submarine targetSubmarine = Character.Controlled?.Submarine;
|
||||
if ((targetSubmarine != null && targetSubmarine.AtDamageDepth) ||
|
||||
(GameMain.GameScreen != null && Screen.Selected == GameMain.GameScreen && Level.Loaded != null && Level.Loaded.GetRealWorldDepth(GameMain.GameScreen.Cam.Position.Y) > Level.Loaded.RealWorldCrushDepth))
|
||||
if (targetSubmarine != null && targetSubmarine.AtDamageDepth)
|
||||
{
|
||||
return "deep";
|
||||
}
|
||||
if (GameMain.GameScreen != null && Screen.Selected == GameMain.GameScreen && Submarine.MainSub != null &&
|
||||
Level.Loaded != null && Level.Loaded.GetRealWorldDepth(GameMain.GameScreen.Cam.Position.Y) > Submarine.MainSub.RealWorldCrushDepth)
|
||||
{
|
||||
return "deep";
|
||||
}
|
||||
|
||||
if (targetSubmarine != null)
|
||||
if (targetSubmarine != null)
|
||||
{
|
||||
float floodedArea = 0.0f;
|
||||
float totalArea = 0.0f;
|
||||
@@ -1001,7 +1034,7 @@ namespace Barotrauma
|
||||
foreach (Character character in Character.CharacterList)
|
||||
{
|
||||
if (character.IsDead || !character.Enabled) continue;
|
||||
if (!(character.AIController is EnemyAIController enemyAI) || (!enemyAI.AttackHumans && !enemyAI.AttackRooms)) { continue; }
|
||||
if (!(character.AIController is EnemyAIController enemyAI) || !enemyAI.Enabled || (!enemyAI.AttackHumans && !enemyAI.AttackRooms)) { continue; }
|
||||
|
||||
if (targetSubmarine != null)
|
||||
{
|
||||
@@ -1025,7 +1058,8 @@ namespace Barotrauma
|
||||
{
|
||||
return "levelend";
|
||||
}
|
||||
if (Timing.TotalTime < GameMain.GameSession.RoundStartTime + 120.0)
|
||||
if (Timing.TotalTime < GameMain.GameSession.RoundStartTime + 120.0 &&
|
||||
Level.Loaded?.Type == LevelData.LevelType.LocationConnection)
|
||||
{
|
||||
return "start";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user