Skip to content

Commit

Permalink
v1.6.18.1 (Unto the Breach Hotfix 1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Regalis11 committed Oct 28, 2024
1 parent a29662c commit 7eac44e
Show file tree
Hide file tree
Showing 47 changed files with 245 additions and 123 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ partial void DamageParticles(float deltaTime, Vector2 worldPosition)

if (sound != null)
{
SoundPlayer.PlaySound(sound.Sound, worldPosition, sound.Volume, sound.Range, ignoreMuffling: sound.IgnoreMuffling, freqMult: sound.GetRandomFrequencyMultiplier());
SoundPlayer.PlaySound(sound, worldPosition);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ partial void UpdateProjSpecific(float deltaTime)
{
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; }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,11 +392,7 @@ private void PlaySound(ItemSound itemSound, Vector2 position)
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;
Expand All @@ -407,7 +403,7 @@ private void PlaySound(ItemSound itemSound, Vector2 position)
{
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); }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,11 +475,8 @@ private void ApplyTemperatureBoost(float amount)
if (sound != null)
{
SoundPlayer.PlaySound(
sound.Sound,
sound,
item.WorldPosition,
sound.Volume,
sound.Range,
freqMult: sound.GetRandomFrequencyMultiplier(),
hullGuess: item.CurrentHull);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ private void PlaySound(RoundSound sound, Vector2 position)
{
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;
Expand All @@ -244,7 +244,7 @@ private void PlaySound(RoundSound sound, Vector2 position)
}
else
{
SoundPlayer.PlaySound(sound.Sound, position, sound.Volume, sound.Range, ignoreMuffling: sound.IgnoreMuffling, freqMult: sound.GetRandomFrequencyMultiplier());
SoundPlayer.PlaySound(sound, position);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,14 @@ partial void UpdateProjSpecific(float deltaTime)
{
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;}
}
}
Expand All @@ -246,7 +246,7 @@ partial void UpdateProjSpecific(float deltaTime)
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)
Expand Down Expand Up @@ -275,7 +275,7 @@ partial void UpdateProjSpecific(float deltaTime)
{
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; }
}
}
Expand Down
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaClient/ClientSource/Items/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ public void Draw(SpriteBatch spriteBatch, bool editing, bool back = true, Color?
fadeInBrokenSprite.Sprite.effects ^= SpriteEffects;
}

if (body == null)
if (body == null || body.BodyType == BodyType.Static)
{
if (Prefab.ResizeHorizontal || Prefab.ResizeVertical)
{
Expand Down
3 changes: 3 additions & 0 deletions Barotrauma/BarotraumaClient/ClientSource/Map/RoundSound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class RoundSound
public readonly bool Stream;
public readonly bool IgnoreMuffling;

public readonly bool MuteBackgroundMusic;

public readonly string? Filename;

private RoundSound(ContentXElement element, Sound sound)
Expand All @@ -26,6 +28,7 @@ private RoundSound(ContentXElement element, Sound sound)
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"));
Expand Down
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaClient/ClientSource/Map/WayPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ private GUIComponent CreateEditingHUD()
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,11 @@ or ServerPacketHeader.PING_REQUEST
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.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public void RandomizeCrew()
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());
Expand Down
15 changes: 11 additions & 4 deletions Barotrauma/BarotraumaClient/ClientSource/Screens/NetLobbyScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2708,13 +2708,18 @@ private void UpdatePlayerFrame(CharacterInfo characterInfo, bool allowEditing, G

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
Expand Down Expand Up @@ -4015,7 +4020,9 @@ public override void Update(double deltaTime)
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 ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ var selectedLanguages
.ToArray();

bool inSelectedCall = false;
languageDropdown.AfterSelected = (_, userData) =>
languageDropdown.OnSelected = (_, userData) =>
{
if (inSelectedCall) { return true; }
try
Expand All @@ -465,33 +465,38 @@ var selectedLanguages

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
Expand Down
2 changes: 2 additions & 0 deletions Barotrauma/BarotraumaClient/ClientSource/Sounds/Sound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public int SampleRate
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,8 @@ public bool IsStream
private readonly uint[] unqueuedBuffers;
private readonly float[] streamBufferAmplitudes;

public bool MuteBackgroundMusic;

public int StreamSeekPos
{
get { return streamSeekPos; }
Expand Down
36 changes: 34 additions & 2 deletions Barotrauma/BarotraumaClient/ClientSource/Sounds/SoundPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,20 @@ public static SoundChannel PlaySound(string soundTag, Vector2 position, float? v
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)
{
Expand All @@ -501,7 +513,12 @@ public static SoundChannel PlaySound(Sound sound, Vector2 position, float? volum
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()
Expand Down Expand Up @@ -673,6 +690,17 @@ private static void UpdateMusic(float deltaTime)
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++)
{
Expand Down Expand Up @@ -729,6 +757,10 @@ private static void UpdateMusic(float deltaTime)
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ partial void ApplyProjSpecific(float deltaTime, Entity entity, IReadOnlyList<ISe
else
{
angle = -item.RotationRad;
if (item.FlippedX) { angle += MathHelper.Pi; }
particleRotation = item.RotationRad;
}
entityAngleAssigned = true;
Expand Down
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaClient/LinuxClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product>
<Version>1.6.17.0</Version>
<Version>1.6.18.1</Version>
<Copyright>Copyright © FakeFish 2018-2024</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName>
Expand Down
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaClient/MacClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product>
<Version>1.6.17.0</Version>
<Version>1.6.18.1</Version>
<Copyright>Copyright © FakeFish 2018-2024</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName>
Expand Down
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaClient/WindowsClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma</Product>
<Version>1.6.17.0</Version>
<Version>1.6.18.1</Version>
<Copyright>Copyright © FakeFish 2018-2024</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>Barotrauma</AssemblyName>
Expand Down
2 changes: 1 addition & 1 deletion Barotrauma/BarotraumaServer/LinuxServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RootNamespace>Barotrauma</RootNamespace>
<Authors>FakeFish, Undertow Games</Authors>
<Product>Barotrauma Dedicated Server</Product>
<Version>1.6.17.0</Version>
<Version>1.6.18.1</Version>
<Copyright>Copyright © FakeFish 2018-2023</Copyright>
<Platforms>AnyCPU;x64</Platforms>
<AssemblyName>DedicatedServer</AssemblyName>
Expand Down
Loading

0 comments on commit 7eac44e

Please sign in to comment.