Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop

This commit is contained in:
EvilFactory
2025-07-01 17:55:43 -03:00
19 changed files with 110 additions and 34 deletions
@@ -461,7 +461,10 @@ namespace Barotrauma
Eos.EosAccount.LoginPlatformSpecific();
initialLoadingThread = new Thread(Load);
initialLoadingThread = new Thread(Load)
{
Name = "Load"
};
initialLoadingThread.Start();
}
@@ -265,6 +265,7 @@ namespace Barotrauma.Items.Components
float gainDiff = targetGain - loopingSoundChannel.Gain;
loopingSoundChannel.Gain += Math.Abs(gainDiff) < 0.1f ? gainDiff : Math.Sign(gainDiff) * 0.1f;
loopingSoundChannel.Position = new Vector3(item.WorldPosition, 0.0f);
loopingSound.RoundSound.LastStreamSeekPos = loopingSoundChannel.StreamSeekPos;
}
for (int i = 0; i < playingOneshotSoundChannels.Count; i++)
{
@@ -409,6 +410,10 @@ namespace Barotrauma.Items.Components
loopingSoundChannel.Near = loopingSound.Range * 0.4f;
loopingSoundChannel.Far = loopingSound.Range;
}
if (loopingSound.RoundSound.Stream)
{
loopingSoundChannel.StreamSeekPos = loopingSound.RoundSound.LastStreamSeekPos;
}
}
}
else
@@ -16,6 +16,8 @@ namespace Barotrauma
public readonly bool Stream;
public readonly bool IgnoreMuffling;
public int LastStreamSeekPos;
public readonly bool MuteBackgroundMusic;
public readonly string? Filename;
@@ -152,6 +152,8 @@ namespace Barotrauma
private bool ignoreMuffling;
private RoundSound lastPlayingSound;
private void PlaySound(Entity entity, Hull hull, Vector2 worldPosition)
{
if (sounds.Count == 0) { return; }
@@ -204,6 +206,7 @@ namespace Barotrauma
else
{
soundChannel.Position = new Vector3(worldPosition, 0.0f);
if (lastPlayingSound != null && lastPlayingSound.Stream) { lastPlayingSound.LastStreamSeekPos = soundChannel.StreamSeekPos; }
}
KeepLoopingSoundAlive(soundChannel);
@@ -248,6 +251,11 @@ namespace Barotrauma
ignoreMuffling = selectedSound.IgnoreMuffling;
if (soundChannel != null)
{
if (soundChannel.IsStream && lastPlayingSound == selectedSound)
{
soundChannel.StreamSeekPos = lastPlayingSound.LastStreamSeekPos;
}
lastPlayingSound = selectedSound;
soundChannel.Looping = loopSound;
KeepLoopingSoundAlive(soundChannel);
}