v1.6.18.1 (Unto the Breach Hotfix 1)

This commit is contained in:
Regalis11
2024-10-28 15:03:46 +02:00
parent a29662c074
commit 7eac44ea7d
47 changed files with 246 additions and 124 deletions
@@ -48,7 +48,7 @@ namespace Barotrauma
if (sound != null)
{
SoundPlayer.PlaySound(sound.Sound, worldPosition, sound.Volume, sound.Range, ignoreMuffling: sound.IgnoreMuffling, freqMult: sound.GetRandomFrequencyMultiplier());
SoundPlayer.PlaySound(sound, worldPosition);
}
}
}
@@ -1,5 +1,4 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -141,7 +141,7 @@ namespace Barotrauma.Items.Components
{
if (chargeSound != null)
{
chargeSoundChannel = SoundPlayer.PlaySound(chargeSound.Sound, item.WorldPosition, chargeSound.Volume, chargeSound.Range, ignoreMuffling: chargeSound.IgnoreMuffling, freqMult: chargeSound.GetRandomFrequencyMultiplier());
chargeSoundChannel = SoundPlayer.PlaySound(chargeSound, item.WorldPosition, hullGuess: item.CurrentHull);
if (chargeSoundChannel != null) { chargeSoundChannel.Looping = true; }
}
}
@@ -392,11 +392,7 @@ namespace Barotrauma.Items.Components
float volume = GetSoundVolume(itemSound);
if (volume <= 0.0001f) { return; }
loopingSound = itemSound;
loopingSoundChannel = loopingSound.RoundSound.Sound.Play(
new Vector3(position.X, position.Y, 0.0f),
0.01f,
freqMult: itemSound.RoundSound.GetRandomFrequencyMultiplier(),
muffle: SoundPlayer.ShouldMuffleSound(Character.Controlled, position, loopingSound.Range, Character.Controlled?.CurrentHull));
loopingSoundChannel = SoundPlayer.PlaySound(loopingSound.RoundSound, position, volume: 0.01f, hullGuess: item.CurrentHull);
loopingSoundChannel.Looping = true;
//TODO: tweak
loopingSoundChannel.Near = loopingSound.Range * 0.4f;
@@ -407,7 +403,7 @@ namespace Barotrauma.Items.Components
{
float volume = GetSoundVolume(itemSound);
if (volume <= 0.0001f) { return; }
var channel = SoundPlayer.PlaySound(itemSound.RoundSound.Sound, position, volume, itemSound.Range, itemSound.RoundSound.GetRandomFrequencyMultiplier(), item.CurrentHull, ignoreMuffling: itemSound.RoundSound.IgnoreMuffling);
var channel = SoundPlayer.PlaySound(itemSound.RoundSound, position, volume, hullGuess: item.CurrentHull);
if (channel != null) { playingOneshotSoundChannels.Add(channel); }
}
}
@@ -475,11 +475,8 @@ namespace Barotrauma.Items.Components
if (sound != null)
{
SoundPlayer.PlaySound(
sound.Sound,
sound,
item.WorldPosition,
sound.Volume,
sound.Range,
freqMult: sound.GetRandomFrequencyMultiplier(),
hullGuess: item.CurrentHull);
}
}
@@ -229,7 +229,7 @@ namespace Barotrauma.Items.Components
{
if (reelSoundChannel is not { IsPlaying: true })
{
reelSoundChannel = SoundPlayer.PlaySound(sound.Sound, position, sound.Volume, sound.Range, ignoreMuffling: sound.IgnoreMuffling, freqMult: sound.GetRandomFrequencyMultiplier());
reelSoundChannel = SoundPlayer.PlaySound(sound, position);
if (reelSoundChannel != null)
{
reelSoundChannel.Looping = true;
@@ -244,7 +244,7 @@ namespace Barotrauma.Items.Components
}
else
{
SoundPlayer.PlaySound(sound.Sound, position, sound.Volume, sound.Range, ignoreMuffling: sound.IgnoreMuffling, freqMult: sound.GetRandomFrequencyMultiplier());
SoundPlayer.PlaySound(sound, position);
}
}
@@ -227,14 +227,14 @@ namespace Barotrauma.Items.Components
{
if (moveSoundChannel == null && startMoveSound != null)
{
moveSoundChannel = SoundPlayer.PlaySound(startMoveSound.Sound, item.WorldPosition, startMoveSound.Volume, startMoveSound.Range, ignoreMuffling: startMoveSound.IgnoreMuffling, freqMult: startMoveSound.GetRandomFrequencyMultiplier());
moveSoundChannel = SoundPlayer.PlaySound(startMoveSound, item.WorldPosition, hullGuess: item.CurrentHull);
}
else if (moveSoundChannel == null || !moveSoundChannel.IsPlaying)
{
if (moveSound != null)
{
moveSoundChannel?.FadeOutAndDispose();
moveSoundChannel = SoundPlayer.PlaySound(moveSound.Sound, item.WorldPosition, moveSound.Volume, moveSound.Range, ignoreMuffling: moveSound.IgnoreMuffling, freqMult: moveSound.GetRandomFrequencyMultiplier());
moveSoundChannel = SoundPlayer.PlaySound(moveSound, item.WorldPosition, hullGuess: item.CurrentHull);
if (moveSoundChannel != null) { moveSoundChannel.Looping = true;}
}
}
@@ -246,7 +246,7 @@ namespace Barotrauma.Items.Components
if (endMoveSound != null && moveSoundChannel.Sound != endMoveSound.Sound)
{
moveSoundChannel.FadeOutAndDispose();
moveSoundChannel = SoundPlayer.PlaySound(endMoveSound.Sound, item.WorldPosition, endMoveSound.Volume, endMoveSound.Range, ignoreMuffling: endMoveSound.IgnoreMuffling, freqMult: endMoveSound.GetRandomFrequencyMultiplier());
moveSoundChannel = SoundPlayer.PlaySound(endMoveSound, item.WorldPosition, hullGuess: item.CurrentHull);
if (moveSoundChannel != null) { moveSoundChannel.Looping = false; }
}
else if (!moveSoundChannel.IsPlaying)
@@ -275,7 +275,7 @@ namespace Barotrauma.Items.Components
{
if (chargeSound != null)
{
chargeSoundChannel = SoundPlayer.PlaySound(chargeSound.Sound, item.WorldPosition, chargeSound.Volume, chargeSound.Range, ignoreMuffling: chargeSound.IgnoreMuffling, freqMult: chargeSound.GetRandomFrequencyMultiplier());
chargeSoundChannel = SoundPlayer.PlaySound(chargeSound, item.WorldPosition, hullGuess: item.CurrentHull);
if (chargeSoundChannel != null) { chargeSoundChannel.Looping = true; }
}
}
@@ -408,7 +408,7 @@ namespace Barotrauma
fadeInBrokenSprite.Sprite.effects ^= SpriteEffects;
}
if (body == null)
if (body == null || body.BodyType == BodyType.Static)
{
if (Prefab.ResizeHorizontal || Prefab.ResizeVertical)
{
@@ -16,6 +16,8 @@ namespace Barotrauma
public readonly bool Stream;
public readonly bool IgnoreMuffling;
public readonly bool MuteBackgroundMusic;
public readonly string? Filename;
private RoundSound(ContentXElement element, Sound sound)
@@ -26,6 +28,7 @@ namespace Barotrauma
Range = element.GetAttributeFloat("range", 1000.0f);
Volume = element.GetAttributeFloat("volume", 1.0f);
IgnoreMuffling = element.GetAttributeBool("dontmuffle", false);
MuteBackgroundMusic = element.GetAttributeBool("MuteBackgroundMusic", false);
FrequencyMultiplierRange = new Vector2(1.0f);
string freqMultAttr = element.GetAttributeString("frequencymultiplier", element.GetAttributeString("frequency", "1.0"));
@@ -437,7 +437,7 @@ namespace Barotrauma
jobDropDown.AddItem(TextManager.Get("Any"), null);
foreach (JobPrefab jobPrefab in JobPrefab.Prefabs)
{
if (jobPrefab.HiddenJob) { continue; }
if (jobPrefab.Name.IsNullOrWhiteSpace()) { continue; }
jobDropDown.AddItem(jobPrefab.Name, jobPrefab);
}
jobDropDown.SelectItem(AssignedJob);
@@ -763,6 +763,11 @@ namespace Barotrauma.Networking
case ServerPacketHeader.CANCEL_STARTGAME:
DebugConsole.Log("Received CANCEL_STARTGAME packet.");
GameMain.NetLobbyScreen?.CloseStartRoundWarning();
if (GameMain.NetLobbyScreen?.ReadyToStartBox is { } readyToStartBox)
{
readyToStartBox.Selected = false;
SetReadyToStart(readyToStartBox);
}
break;
case ServerPacketHeader.STARTGAME:
DebugConsole.Log("Received STARTGAME packet.");
@@ -291,7 +291,7 @@ namespace Barotrauma
if (characterInfos.Count >= 3) { break; }
}
}
characterInfos.Sort((a, b) => Math.Sign(b.Job.MinKarma - a.Job.MinKarma));
characterInfos.Sort((a, b) => Math.Sign(a.Job.CampaignSetupUIOrder - b.Job.CampaignSetupUIOrder));
characterInfoColumns.ClearChildren();
CharacterMenus?.ForEach(m => m.Dispose());
@@ -2708,13 +2708,18 @@ namespace Barotrauma
if (newTeamPreference == CharacterTeamType.None
&& GameMain.Client?.ServerSettings?.PvpTeamSelectionMode == PvpTeamSelectionMode.PlayerChoice) { return false; } // Already handled by delegate above
var oldPreference = MultiplayerPreferences.Instance.TeamPreference;
MultiplayerPreferences.Instance.TeamPreference = newTeamPreference;
UpdateSelectedSub(newTeamPreference);
GameMain.Client?.ForceNameJobTeamUpdate();
if (newTeamPreference != oldPreference)
{
GameMain.Client?.ForceNameJobTeamUpdate();
GameSettings.SaveCurrentConfig();
}
RefreshPvpTeamSelectionButtons();
GameSettings.SaveCurrentConfig();
UpdateDisembarkPointListFromServerSettings();
//need to update job preferences and close the selection frame
//because the team selection might affect the uniform sprite and the loadouts
@@ -4015,7 +4020,9 @@ namespace Barotrauma
JobSelectionFrame.Visible = false;
}
if (GUI.MouseOn?.UserData is JobVariant jobPrefab && GUI.MouseOn.Style?.Name == "JobVariantButton")
if (GUI.MouseOn?.UserData is JobVariant jobPrefab &&
GUI.MouseOn.Style?.Name == "JobVariantButton" &&
GUI.MouseOn.Parent != null)
{
if (jobVariantTooltip?.UserData is not JobVariant prevVisibleVariant ||
prevVisibleVariant.Prefab != jobPrefab.Prefab ||
@@ -448,7 +448,7 @@ namespace Barotrauma
.ToArray();
bool inSelectedCall = false;
languageDropdown.AfterSelected = (_, userData) =>
languageDropdown.OnSelected = (_, userData) =>
{
if (inSelectedCall) { return true; }
try
@@ -465,33 +465,38 @@ namespace Barotrauma
bool noneSelected = langTickboxes.All(tb => !tb.Selected);
bool allSelected = langTickboxes.All(tb => tb.Selected);
if (allSelected != allTickbox.Selected)
{
allTickbox.Selected = allSelected;
}
if (allSelected)
{
languageDropdown.Text = TextManager.Get(allLanguagesKey);
}
else if (noneSelected)
{
languageDropdown.Text = TextManager.Get("None");
}
var languages = languageDropdown.SelectedDataMultiple.OfType<LanguageIdentifier>();
ServerListFilters.Instance.SetAttribute(languageKey, string.Join(", ", languages));
GameSettings.SaveCurrentConfig();
return true;
}
finally
{
inSelectedCall = false;
FilterServers();
}
};
languageDropdown.AfterSelected = (_, userData) =>
{
bool noneSelected = langTickboxes.All(tb => !tb.Selected);
bool allSelected = langTickboxes.All(tb => tb.Selected);
if (allSelected)
{
languageDropdown.Text = TextManager.Get(allLanguagesKey);
}
else if (noneSelected)
{
languageDropdown.Text = TextManager.Get("None");
}
var languages = languageDropdown.SelectedDataMultiple.OfType<LanguageIdentifier>();
ServerListFilters.Instance.SetAttribute(languageKey, string.Join(", ", languages));
GameSettings.SaveCurrentConfig();
FilterServers();
return true;
};
}
// Filter Tags
@@ -62,6 +62,8 @@ namespace Barotrauma.Sounds
public float BaseNear;
public float BaseFar;
public bool MuteBackgroundMusic;
public Sound(SoundManager owner, string filename, bool stream, bool streamsReliably, ContentXElement xElement = null, bool getFullPath = true)
{
Owner = owner;
@@ -434,6 +434,8 @@ namespace Barotrauma.Sounds
private readonly uint[] unqueuedBuffers;
private readonly float[] streamBufferAmplitudes;
public bool MuteBackgroundMusic;
public int StreamSeekPos
{
get { return streamSeekPos; }
@@ -484,8 +484,20 @@ namespace Barotrauma
if (sound == null) { return null; }
return PlaySound(sound, position, volume ?? sound.BaseGain, range ?? sound.BaseFar, 1.0f, hullGuess);
}
public static SoundChannel PlaySound(RoundSound sound, Vector2 position, float? volume = null, Hull hullGuess = null)
{
return PlaySound(
sound.Sound,
position,
volume ?? sound.Volume,
sound.Range,
ignoreMuffling: sound.IgnoreMuffling,
hullGuess: hullGuess,
freqMult: sound.GetRandomFrequencyMultiplier(),
muteBackgroundMusic: sound.MuteBackgroundMusic);
}
public static SoundChannel PlaySound(Sound sound, Vector2 position, float? volume = null, float? range = null, float? freqMult = null, Hull hullGuess = null, bool ignoreMuffling = false)
public static SoundChannel PlaySound(Sound sound, Vector2 position, float? volume = null, float? range = null, float? freqMult = null, Hull hullGuess = null, bool ignoreMuffling = false, bool muteBackgroundMusic = false)
{
if (sound == null)
{
@@ -501,7 +513,12 @@ namespace Barotrauma
return null;
}
bool muffle = !ignoreMuffling && ShouldMuffleSound(Character.Controlled, position, far, hullGuess);
return sound.Play(volume ?? sound.BaseGain, far, freqMult ?? 1.0f, position, muffle: muffle);
var channel = sound.Play(volume ?? sound.BaseGain, far, freqMult ?? 1.0f, position, muffle: muffle);
if (channel != null)
{
channel.MuteBackgroundMusic = muteBackgroundMusic;
}
return channel;
}
public static void DisposeDisabledMusic()
@@ -673,6 +690,17 @@ namespace Barotrauma
updateMusicTimer = UpdateMusicInterval;
}
bool muteBackgroundMusic = false;
for (int i = 0; i < SoundManager.SourceCount; i++)
{
SoundChannel playingSoundChannel = GameMain.SoundManager.GetSoundChannelFromIndex(SoundManager.SourcePoolIndex.Default, i);
if (playingSoundChannel is { MuteBackgroundMusic: true, IsPlaying: true })
{
muteBackgroundMusic = true;
break;
}
}
int activeTrackCount = targetMusic.Count(m => m != null);
for (int i = 0; i < MaxMusicChannels; i++)
{
@@ -729,6 +757,10 @@ namespace Barotrauma
musicChannel[i].Looping = true;
}
float targetGain = targetMusic[i].Volume;
if (muteBackgroundMusic)
{
targetGain = 0.0f;
}
if (targetMusic[i].DuckVolume)
{
targetGain *= (float)Math.Sqrt(1.0f / activeTrackCount);
@@ -93,6 +93,7 @@ namespace Barotrauma
else
{
angle = -item.RotationRad;
if (item.FlippedX) { angle += MathHelper.Pi; }
particleRotation = item.RotationRad;
}
entityAngleAssigned = true;