(46e39d26c) v0.9.0.4

This commit is contained in:
Joonas Rikkonen
2019-05-27 17:26:35 +03:00
parent 9364b3839a
commit 5208b922d8
25 changed files with 348 additions and 337 deletions
@@ -202,8 +202,6 @@
<Compile Include="$(MSBuildThisFileDirectory)Source\Screens\SubEditorScreen.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Source\Screens\SubEditorScreen.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Serialization\SerializableEntityEditor.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Source\Serialization\SerializableEntityEditor.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Sounds\OggSound.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Source\Sounds\OggSound.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Sounds\OpenAL\Al.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Sounds\OpenAL\Alc.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Sounds\Sound.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Source\Sounds\Sound.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Sounds\SoundChannel.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Source\Sounds\SoundChannel.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Source\Sounds\SoundFilters.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Source\Sounds\SoundFilters.cs" />
@@ -118,6 +118,9 @@
<Content Include="MonoGame.Framework.dll.config"> <Content Include="MonoGame.Framework.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="OpenTK.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Shaders\solidcolor_opengl.fx" /> <Content Include="Shaders\solidcolor_opengl.fx" />
<Content Include="SharpFont.dll.config"> <Content Include="SharpFont.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -365,9 +368,8 @@
<Target Name="AfterBuild"> <Target Name="AfterBuild">
<!-- Write version number to a "Version.txt" file in the output folder --> <!-- Write version number to a "Version.txt" file in the output folder -->
<GetAssemblyIdentity AssemblyFiles="$(TargetPath)"> <GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
<Output TaskParameter="Assemblies" ItemName="CurrentAssembly" /> <Output TaskParameter="Assemblies" ItemName="CurrentAssembly" />
</GetAssemblyIdentity> </GetAssemblyIdentity>
<Exec Command="echo v%(CurrentAssembly.Version) &gt; $(TargetDir)Version.txt"> <Exec Command="echo v%(CurrentAssembly.Version) &gt; $(TargetDir)Version.txt"></Exec>
</Exec>
</Target> </Target>
</Project> </Project>
@@ -117,6 +117,9 @@
<Content Include="MonoGame.Framework.dll.config"> <Content Include="MonoGame.Framework.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="OpenTK.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Shaders\solidcolor_opengl.fx" /> <Content Include="Shaders\solidcolor_opengl.fx" />
<Content Include="SharpFont.dll.config"> <Content Include="SharpFont.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Binary file not shown.
@@ -0,0 +1,25 @@
<configuration>
<dllmap os="linux" dll="opengl32.dll" target="libGL.so.1"/>
<dllmap os="linux" dll="glu32.dll" target="libGLU.so.1"/>
<dllmap os="linux" dll="openal32.dll" target="libopenal.so.1"/>
<dllmap os="linux" dll="alut.dll" target="libalut.so.0"/>
<dllmap os="linux" dll="opencl.dll" target="libOpenCL.so"/>
<dllmap os="linux" dll="libX11" target="libX11.so.6"/>
<dllmap os="linux" dll="libXi" target="libXi.so.6"/>
<!-- <dllmap os="linux" dll="SDL2.dll" target="libSDL2-2.0.so.0"/> -->
<dllmap os="osx" dll="opengl32.dll" target="/System/Library/Frameworks/OpenGL.framework/OpenGL"/>
<dllmap os="osx" dll="openal32.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
<dllmap os="osx" dll="alut.dll" target="/System/Library/Frameworks/OpenAL.framework/OpenAL" />
<dllmap os="osx" dll="libGLES.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="libGLESv1_CM.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="libGLESv2.dll" target="/System/Library/Frameworks/OpenGLES.framework/OpenGLES" />
<dllmap os="osx" dll="opencl.dll" target="/System/Library/Frameworks/OpenCL.framework/OpenCL"/>
<dllmap os="osx" dll="SDL2.dll" target="libSDL2.dylib"/>
<!-- XQuartz compatibility (X11 on Mac) -->
<dllmap os="osx" dll="libGL.so.1" target="/usr/X11/lib/libGL.dylib"/>
<dllmap os="osx" dll="libX11" target="/usr/X11/lib/libX11.dylib"/>
<dllmap os="osx" dll="libXcursor.so.1" target="/usr/X11/lib/libXcursor.dylib"/>
<dllmap os="osx" dll="libXi" target="/usr/X11/lib/libXi.dylib"/>
<dllmap os="osx" dll="libXinerama" target="/usr/X11/lib/libXinerama.dylib"/>
<dllmap os="osx" dll="libXrandr.so.2" target="/usr/X11/lib/libXrandr.dylib"/>
</configuration>
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.9.0.3")] [assembly: AssemblyVersion("0.9.0.4")]
[assembly: AssemblyFileVersion("0.9.0.3")] [assembly: AssemblyFileVersion("0.9.0.4")]
+2 -33
View File
@@ -92,9 +92,6 @@ namespace Barotrauma
public static GameSettings Config; public static GameSettings Config;
public static int DisplayWidth { get; private set; }
public static int DisplayHeight { get; private set; }
private CoroutineHandle loadingCoroutine; private CoroutineHandle loadingCoroutine;
private bool hasLoaded; private bool hasLoaded;
@@ -195,35 +192,8 @@ namespace Barotrauma
FarseerPhysics.Settings.PositionIterations = 1; FarseerPhysics.Settings.PositionIterations = 1;
} }
public void RequestGraphicsSettings() public void ApplyGraphicsSettings()
{ {
#if WINDOWS
if (WindowActive)
{
#endif
ApplyGraphicsSettings();
#if WINDOWS
}
#endif
}
private void ApplyGraphicsSettings()
{
#if !OSX
if (Config.WindowMode == WindowMode.Fullscreen &&
GraphicsDeviceManager.IsFullScreen && !GraphicsDeviceManager.HardwareModeSwitch &&
(GraphicsDeviceManager.PreferredBackBufferWidth != Config.GraphicsWidth ||
GraphicsDeviceManager.PreferredBackBufferHeight != Config.GraphicsHeight))
{
DisplayMode minMode = GraphicsAdapter.DefaultAdapter.SupportedDisplayModes.First(m => m.Format == SurfaceFormat.Color);
GraphicsDeviceManager.PreferredBackBufferWidth = minMode.Width;
GraphicsDeviceManager.PreferredBackBufferHeight = minMode.Height;
GraphicsDeviceManager.IsFullScreen = false;
GraphicsDeviceManager.ApplyChanges();
Thread.Sleep(100);
}
#endif
GraphicsWidth = Config.GraphicsWidth; GraphicsWidth = Config.GraphicsWidth;
GraphicsHeight = Config.GraphicsHeight; GraphicsHeight = Config.GraphicsHeight;
if (Config.WindowMode == WindowMode.BorderlessWindowed) if (Config.WindowMode == WindowMode.BorderlessWindowed)
@@ -238,14 +208,13 @@ namespace Barotrauma
GraphicsDeviceManager.PreferredBackBufferWidth = GraphicsWidth; GraphicsDeviceManager.PreferredBackBufferWidth = GraphicsWidth;
GraphicsDeviceManager.PreferredBackBufferHeight = GraphicsHeight; GraphicsDeviceManager.PreferredBackBufferHeight = GraphicsHeight;
SetWindowMode(Config.WindowMode); SetWindowMode(Config.WindowMode);
GraphicsDeviceManager.ApplyChanges();
defaultViewport = GraphicsDevice.Viewport; defaultViewport = GraphicsDevice.Viewport;
OnResolutionChanged?.Invoke(); OnResolutionChanged?.Invoke();
} }
private void SetWindowMode(WindowMode windowMode) public void SetWindowMode(WindowMode windowMode)
{ {
WindowMode = windowMode; WindowMode = windowMode;
GraphicsDeviceManager.HardwareModeSwitch = Config.WindowMode != WindowMode.BorderlessWindowed; GraphicsDeviceManager.HardwareModeSwitch = Config.WindowMode != WindowMode.BorderlessWindowed;
@@ -8,7 +8,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Xml.Linq; using System.Xml.Linq;
using Barotrauma.Extensions;
namespace Barotrauma namespace Barotrauma
{ {
@@ -3,7 +3,7 @@ using Barotrauma.Networking;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Input;
using OpenAL; using OpenTK.Audio.OpenAL;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
@@ -242,16 +242,6 @@ namespace Barotrauma
#endif #endif
displayModeDD.OnSelected = (guiComponent, obj) => displayModeDD.OnSelected = (guiComponent, obj) =>
{ {
displayModeDD.SelectItem(WindowMode.Fullscreen);
}
else
{
displayModeDD.SelectItem(GameMain.Config.WindowMode);
}
#endif
displayModeDD.OnSelected = (guiComponent, obj) =>
{
PauseOnFocusLost = tickBox.Selected;
UnsavedSettings = true; UnsavedSettings = true;
GameMain.Config.WindowMode = (WindowMode)guiComponent.UserData; GameMain.Config.WindowMode = (WindowMode)guiComponent.UserData;
#if !LINUX #if !LINUX
@@ -465,7 +455,7 @@ namespace Barotrauma
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), audioSliders.RectTransform), TextManager.Get("VoiceChat")); new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), audioSliders.RectTransform), TextManager.Get("VoiceChat"));
IList<string> deviceNames = Alc.GetStringList((IntPtr)null, Alc.CaptureDeviceSpecifier); IList<string> deviceNames = Alc.GetString((IntPtr)null, AlcGetStringList.CaptureDeviceSpecifier);
foreach (string name in deviceNames) foreach (string name in deviceNames)
{ {
DebugConsole.NewMessage(name + " " + name.Length.ToString(), Color.Lime); DebugConsole.NewMessage(name + " " + name.Length.ToString(), Color.Lime);
@@ -484,10 +474,10 @@ namespace Barotrauma
if (string.IsNullOrWhiteSpace(VoiceCaptureDevice)) VoiceCaptureDevice = deviceNames[0]; if (string.IsNullOrWhiteSpace(VoiceCaptureDevice)) VoiceCaptureDevice = deviceNames[0];
#if (!OSX) #if (!OSX)
var deviceList = new GUIDropDown(new RectTransform(new Vector2(1.0f, 0.05f), audioSliders.RectTransform), VoiceCaptureDevice, deviceNames.Count); var deviceList = new GUIDropDown(new RectTransform(new Vector2(1.0f, 0.05f), audioSliders.RectTransform), TextManager.EnsureUTF8(VoiceCaptureDevice), deviceNames.Count);
foreach (string name in deviceNames) foreach (string name in deviceNames)
{ {
deviceList.AddItem(name, name); deviceList.AddItem(TextManager.EnsureUTF8(name), name);
} }
deviceList.OnSelected = (GUIComponent selected, object obj) => deviceList.OnSelected = (GUIComponent selected, object obj) =>
{ {
@@ -499,7 +489,7 @@ namespace Barotrauma
}; };
#else #else
var suavemente = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), audioSliders.RectTransform), var suavemente = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), audioSliders.RectTransform),
TextManager.AddPunctuation(':', TextManager.Get("CurrentDevice"), VoiceCaptureDevice)) TextManager.AddPunctuation(':', TextManager.Get("CurrentDevice"), TextManager.EnsureUTF8(VoiceCaptureDevice)))
{ {
ToolTip = TextManager.Get("CurrentDeviceToolTip.OSX"), ToolTip = TextManager.Get("CurrentDeviceToolTip.OSX"),
TextAlignment = Alignment.CenterX TextAlignment = Alignment.CenterX
@@ -514,7 +504,7 @@ namespace Barotrauma
if (VoiceCaptureDevice == deviceNames[0]) return true; if (VoiceCaptureDevice == deviceNames[0]) return true;
VoipCapture.ChangeCaptureDevice(deviceNames[0]); VoipCapture.ChangeCaptureDevice(deviceNames[0]);
suavemente.Text = TextManager.AddPunctuation(':', TextManager.Get("CurrentDevice"), VoiceCaptureDevice); suavemente.Text = TextManager.AddPunctuation(':', TextManager.Get("CurrentDevice"), TextManager.EnsureUTF8(VoiceCaptureDevice));
suavemente.Flash(Color.Blue); suavemente.Flash(Color.Blue);
return true; return true;
@@ -51,7 +51,7 @@ namespace Barotrauma
{ {
itemInUseWarning = new GUITextBlock(new RectTransform(new Point(10), GUI.Canvas), "", itemInUseWarning = new GUITextBlock(new RectTransform(new Point(10), GUI.Canvas), "",
textColor: Color.Orange, color: Color.Black, textColor: Color.Orange, color: Color.Black,
textAlignment:Alignment.Center, style: "OuterGlow"); textAlignment: Alignment.Center, style: "OuterGlow");
} }
return itemInUseWarning; return itemInUseWarning;
} }
@@ -662,7 +662,7 @@ namespace Barotrauma
new Rectangle( new Rectangle(
20, 20, 20, 20,
GameMain.GraphicsWidth - 40, GameMain.GraphicsWidth - 40,
HUDLayoutSettings.InventoryTopY > 0 ? HUDLayoutSettings.InventoryTopY - 20 : GameMain.GraphicsHeight - 80)); HUDLayoutSettings.InventoryTopY > 0 ? HUDLayoutSettings.InventoryTopY - 40 : GameMain.GraphicsHeight - 80));
foreach (ItemComponent ic in activeHUDs) foreach (ItemComponent ic in activeHUDs)
{ {
@@ -740,9 +740,9 @@ namespace Barotrauma
} }
} }
if (itemInUseWarning != null && mergedHUDRect != Rectangle.Empty) if (mergedHUDRect != Rectangle.Empty)
{ {
itemInUseWarning.Visible = false; if (itemInUseWarning != null) { itemInUseWarning.Visible = false; }
foreach (Character otherCharacter in Character.CharacterList) foreach (Character otherCharacter in Character.CharacterList)
{ {
if (otherCharacter != character && if (otherCharacter != character &&
@@ -1,6 +1,6 @@
using Lidgren.Network; using Lidgren.Network;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using OpenAL; using OpenTK.Audio.OpenAL;
using System; using System;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@@ -69,7 +69,7 @@ namespace Barotrauma.Networking
VoipConfig.SetupEncoding(); VoipConfig.SetupEncoding();
//set up capture device //set up capture device
captureDevice = Alc.CaptureOpenDevice(deviceName, VoipConfig.FREQUENCY, Al.FormatMono16, VoipConfig.BUFFER_SIZE * 5); captureDevice = Alc.CaptureOpenDevice(deviceName, VoipConfig.FREQUENCY, ALFormat.Mono16, VoipConfig.BUFFER_SIZE * 5);
if (captureDevice == IntPtr.Zero) if (captureDevice == IntPtr.Zero)
{ {
@@ -88,20 +88,20 @@ namespace Barotrauma.Networking
return; return;
} }
int alError = Al.GetError(); ALError alError = AL.GetError();
int alcError = Alc.GetError(captureDevice); AlcError alcError = Alc.GetError(captureDevice);
if (alcError != Alc.NoError) if (alcError != AlcError.NoError)
{ {
throw new Exception("Failed to open capture device: " + alcError.ToString() + " (ALC)"); throw new Exception("Failed to open capture device: " + alcError.ToString() + " (ALC)");
} }
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to open capture device: " + alError.ToString() + " (AL)"); throw new Exception("Failed to open capture device: " + alError.ToString() + " (AL)");
} }
Alc.CaptureStart(captureDevice); Alc.CaptureStart(captureDevice);
alcError = Alc.GetError(captureDevice); alcError = Alc.GetError(captureDevice);
if (alcError != Alc.NoError) if (alcError != AlcError.NoError)
{ {
throw new Exception("Failed to start capturing: " + alcError.ToString()); throw new Exception("Failed to start capturing: " + alcError.ToString());
} }
@@ -132,11 +132,11 @@ namespace Barotrauma.Networking
short[] uncompressedBuffer = new short[VoipConfig.BUFFER_SIZE]; short[] uncompressedBuffer = new short[VoipConfig.BUFFER_SIZE];
while (capturing) while (capturing)
{ {
int alcError; AlcError alcError;
Alc.GetInteger(captureDevice, Alc.EnumCaptureSamples, out int sampleCount); Alc.GetInteger(captureDevice, AlcGetInteger.CaptureSamples, 1, out int sampleCount);
alcError = Alc.GetError(captureDevice); alcError = Alc.GetError(captureDevice);
if (alcError != Alc.NoError) if (alcError != AlcError.NoError)
{ {
throw new Exception("Failed to determine sample count: " + alcError.ToString()); throw new Exception("Failed to determine sample count: " + alcError.ToString());
} }
@@ -160,7 +160,7 @@ namespace Barotrauma.Networking
} }
alcError = Alc.GetError(captureDevice); alcError = Alc.GetError(captureDevice);
if (alcError != Alc.NoError) if (alcError != AlcError.NoError)
{ {
throw new Exception("Failed to capture samples: " + alcError.ToString()); throw new Exception("Failed to capture samples: " + alcError.ToString());
} }
@@ -138,7 +138,7 @@ namespace Barotrauma
DebugConsole.NewMessage("Display size set to " + GameMain.Config.GraphicsWidth + "x" + GameMain.Config.GraphicsHeight, Microsoft.Xna.Framework.Color.Red); DebugConsole.NewMessage("Display size set to " + GameMain.Config.GraphicsWidth + "x" + GameMain.Config.GraphicsHeight, Microsoft.Xna.Framework.Color.Red);
game.RequestGraphicsSettings(); game.ApplyGraphicsSettings();
return true; return true;
default: default:
@@ -1,5 +1,5 @@
using System; using System;
using OpenAL; using OpenTK.Audio.OpenAL;
using NVorbis; using NVorbis;
using System.Collections.Generic; using System.Collections.Generic;
@@ -21,7 +21,7 @@ namespace Barotrauma.Sounds
reader = new VorbisReader(filename); reader = new VorbisReader(filename);
ALFormat = reader.Channels == 1 ? Al.FormatMono16 : Al.FormatStereo16; ALFormat = reader.Channels == 1 ? ALFormat.Mono16 : ALFormat.Stereo16;
SampleRate = reader.SampleRate; SampleRate = reader.SampleRate;
if (!stream) if (!stream)
@@ -35,26 +35,26 @@ namespace Barotrauma.Sounds
CastBuffer(floatBuffer, shortBuffer, readSamples); CastBuffer(floatBuffer, shortBuffer, readSamples);
Al.BufferData(ALBuffer, ALFormat, shortBuffer, AL.BufferData((int)ALBuffer, ALFormat, shortBuffer,
readSamples * sizeof(short), SampleRate); readSamples * sizeof(short), SampleRate);
int alError = Al.GetError(); ALError alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to set buffer data for non-streamed audio! "+Al.GetErrorString(alError)); throw new Exception("Failed to set buffer data for non-streamed audio! "+AL.GetErrorString(alError));
} }
MuffleBuffer(floatBuffer, SampleRate, reader.Channels); MuffleBuffer(floatBuffer, SampleRate, reader.Channels);
CastBuffer(floatBuffer, shortBuffer, readSamples); CastBuffer(floatBuffer, shortBuffer, readSamples);
Al.BufferData(ALMuffledBuffer, ALFormat, shortBuffer, AL.BufferData((int)ALMuffledBuffer, ALFormat, shortBuffer,
readSamples * sizeof(short), SampleRate); readSamples * sizeof(short), SampleRate);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to set buffer data for non-streamed audio! " + Al.GetErrorString(alError)); throw new Exception("Failed to set buffer data for non-streamed audio! " + AL.GetErrorString(alError));
} }
reader.Dispose(); reader.Dispose();
@@ -1,5 +1,5 @@
using System; using System;
using OpenAL; using OpenTK.Audio.OpenAL;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using System.IO; using System.IO;
@@ -57,7 +57,7 @@ namespace Barotrauma.Sounds
get { return !Stream ? alMuffledBuffer : 0; } get { return !Stream ? alMuffledBuffer : 0; }
} }
public int ALFormat public ALFormat ALFormat
{ {
get; get;
protected set; protected set;
@@ -91,26 +91,26 @@ namespace Barotrauma.Sounds
if (!stream) if (!stream)
{ {
Al.GenBuffer(out alBuffer); AL.GenBuffer(out alBuffer);
int alError = Al.GetError(); ALError alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to create OpenAL buffer for non-streamed sound: " + Al.GetErrorString(alError)); throw new Exception("Failed to create OpenAL buffer for non-streamed sound: " + AL.GetErrorString(alError));
} }
if (!Al.IsBuffer(alBuffer)) if (!AL.IsBuffer(alBuffer))
{ {
throw new Exception("Generated OpenAL buffer is invalid!"); throw new Exception("Generated OpenAL buffer is invalid!");
} }
Al.GenBuffer(out alMuffledBuffer); AL.GenBuffer(out alMuffledBuffer);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to create OpenAL buffer for non-streamed sound: " + Al.GetErrorString(alError)); throw new Exception("Failed to create OpenAL buffer for non-streamed sound: " + AL.GetErrorString(alError));
} }
if (!Al.IsBuffer(alMuffledBuffer)) if (!AL.IsBuffer(alMuffledBuffer))
{ {
throw new Exception("Generated OpenAL buffer is invalid!"); throw new Exception("Generated OpenAL buffer is invalid!");
} }
@@ -186,32 +186,32 @@ namespace Barotrauma.Sounds
Owner.KillChannels(this); Owner.KillChannels(this);
if (alBuffer != 0) if (alBuffer != 0)
{ {
if (!Al.IsBuffer(alBuffer)) if (!AL.IsBuffer(alBuffer))
{ {
throw new Exception("Buffer to delete is invalid!"); throw new Exception("Buffer to delete is invalid!");
} }
Al.DeleteBuffer(alBuffer); alBuffer = 0; AL.DeleteBuffer(ref alBuffer); alBuffer = 0;
int alError = Al.GetError(); ALError alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to delete OpenAL buffer for non-streamed sound: " + Al.GetErrorString(alError)); throw new Exception("Failed to delete OpenAL buffer for non-streamed sound: " + AL.GetErrorString(alError));
} }
} }
if (alMuffledBuffer != 0) if (alMuffledBuffer != 0)
{ {
if (!Al.IsBuffer(alMuffledBuffer)) if (!AL.IsBuffer(alMuffledBuffer))
{ {
throw new Exception("Buffer to delete is invalid!"); throw new Exception("Buffer to delete is invalid!");
} }
Al.DeleteBuffer(alMuffledBuffer); alMuffledBuffer = 0; AL.DeleteBuffer(ref alMuffledBuffer); alMuffledBuffer = 0;
int alError = Al.GetError(); ALError alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to delete OpenAL buffer for non-streamed sound: " + Al.GetErrorString(alError)); throw new Exception("Failed to delete OpenAL buffer for non-streamed sound: " + AL.GetErrorString(alError));
} }
} }
@@ -1,5 +1,5 @@
using System; using System;
using OpenAL; using OpenTK.Audio.OpenAL;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using System.Collections.Generic; using System.Collections.Generic;
@@ -15,49 +15,49 @@ namespace Barotrauma.Sounds
public SoundSourcePool(int sourceCount = SoundManager.SOURCE_COUNT) public SoundSourcePool(int sourceCount = SoundManager.SOURCE_COUNT)
{ {
int alError = Al.NoError; ALError alError = ALError.NoError;
ALSources = new uint[sourceCount]; ALSources = new uint[sourceCount];
for (int i = 0; i < sourceCount; i++) for (int i = 0; i < sourceCount; i++)
{ {
Al.GenSource(out ALSources[i]); AL.GenSource(out ALSources[i]);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Error generating alSource[" + i.ToString() + "]: " + Al.GetErrorString(alError)); throw new Exception("Error generating alSource[" + i.ToString() + "]: " + AL.GetErrorString(alError));
} }
if (!Al.IsSource(ALSources[i])) if (!AL.IsSource(ALSources[i]))
{ {
throw new Exception("Generated alSource[" + i.ToString() + "] is invalid!"); throw new Exception("Generated alSource[" + i.ToString() + "] is invalid!");
} }
Al.SourceStop(ALSources[i]); AL.SourceStop(ALSources[i]);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Error stopping newly generated alSource[" + i.ToString() + "]: " + Al.GetErrorString(alError)); throw new Exception("Error stopping newly generated alSource[" + i.ToString() + "]: " + AL.GetErrorString(alError));
} }
Al.Sourcef(ALSources[i], Al.MinGain, 0.0f); AL.Source(ALSources[i], ALSourcef.MinGain, 0.0f);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Error setting min gain: " + Al.GetErrorString(alError)); throw new Exception("Error setting min gain: " + AL.GetErrorString(alError));
} }
Al.Sourcef(ALSources[i], Al.MaxGain, 1.0f); AL.Source(ALSources[i], ALSourcef.MaxGain, 1.0f);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Error setting max gain: " + Al.GetErrorString(alError)); throw new Exception("Error setting max gain: " + AL.GetErrorString(alError));
} }
Al.Sourcef(ALSources[i], Al.RolloffFactor, 1.0f); AL.Source(ALSources[i], ALSourcef.RolloffFactor, 1.0f);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Error setting rolloff factor: " + Al.GetErrorString(alError)); throw new Exception("Error setting rolloff factor: " + AL.GetErrorString(alError));
} }
} }
} }
@@ -66,11 +66,11 @@ namespace Barotrauma.Sounds
{ {
for (int i = 0; i < ALSources.Length; i++) for (int i = 0; i < ALSources.Length; i++)
{ {
Al.DeleteSource(ALSources[i]); AL.DeleteSource(ref ALSources[i]);
int alError = Al.GetError(); ALError alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to delete ALSources[" + i.ToString() + "]: " + Al.GetErrorString(alError)); throw new Exception("Failed to delete ALSources[" + i.ToString() + "]: " + AL.GetErrorString(alError));
} }
} }
ALSources = null; ALSources = null;
@@ -95,35 +95,35 @@ namespace Barotrauma.Sounds
if (position != null) if (position != null)
{ {
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex); uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
Al.Sourcei(alSource, Al.SourceRelative, Al.False); AL.Source(alSource, ALSourceb.SourceRelative, false);
int alError = Al.GetError(); ALError alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to enable source's relative flag: " + Al.GetErrorString(alError)); throw new Exception("Failed to enable source's relative flag: " + AL.GetErrorString(alError));
} }
Al.Source3f(alSource, Al.Position, position.Value.X, position.Value.Y, position.Value.Z); AL.Source(alSource, ALSource3f.Position, position.Value.X, position.Value.Y, position.Value.Z);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to set source's position: " + Al.GetErrorString(alError)); throw new Exception("Failed to set source's position: " + AL.GetErrorString(alError));
} }
} }
else else
{ {
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex); uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
Al.Sourcei(alSource, Al.SourceRelative, Al.True); AL.Source(alSource, ALSourceb.SourceRelative, true);
int alError = Al.GetError(); ALError alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to disable source's relative flag: " + Al.GetErrorString(alError)); throw new Exception("Failed to disable source's relative flag: " + AL.GetErrorString(alError));
} }
Al.Source3f(alSource, Al.Position, 0.0f, 0.0f, 0.0f); AL.Source(alSource, ALSource3f.Position, 0.0f, 0.0f, 0.0f);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to reset source's position: " + Al.GetErrorString(alError)); throw new Exception("Failed to reset source's position: " + AL.GetErrorString(alError));
} }
} }
} }
@@ -140,12 +140,12 @@ namespace Barotrauma.Sounds
if (ALSourceIndex < 0) return; if (ALSourceIndex < 0) return;
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex); uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
Al.Sourcef(alSource, Al.ReferenceDistance, near); AL.Source(alSource, ALSourcef.ReferenceDistance, near);
int alError = Al.GetError(); ALError alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to set source's reference distance: " + Al.GetErrorString(alError)); throw new Exception("Failed to set source's reference distance: " + AL.GetErrorString(alError));
} }
} }
} }
@@ -161,11 +161,11 @@ namespace Barotrauma.Sounds
if (ALSourceIndex < 0) return; if (ALSourceIndex < 0) return;
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex); uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
Al.Sourcef(alSource, Al.MaxDistance, far); AL.Source(alSource, ALSourcef.MaxDistance, far);
int alError = Al.GetError(); ALError alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to set source's max distance: " + Al.GetErrorString(alError)); throw new Exception("Failed to set source's max distance: " + AL.GetErrorString(alError));
} }
} }
} }
@@ -185,11 +185,11 @@ namespace Barotrauma.Sounds
float effectiveGain = gain; float effectiveGain = gain;
if (category != null) effectiveGain *= Sound.Owner.GetCategoryGainMultiplier(category); if (category != null) effectiveGain *= Sound.Owner.GetCategoryGainMultiplier(category);
Al.Sourcef(alSource, Al.Gain, effectiveGain); AL.Source(alSource, ALSourcef.Gain, effectiveGain);
int alError = Al.GetError(); ALError alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to set source's gain: " + Al.GetErrorString(alError)); throw new Exception("Failed to set source's gain: " + AL.GetErrorString(alError));
} }
} }
} }
@@ -207,11 +207,11 @@ namespace Barotrauma.Sounds
if (!IsStream) if (!IsStream)
{ {
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex); uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
Al.Sourcei(alSource, Al.Looping, looping ? Al.True : Al.False); AL.Source(alSource, ALSourceb.Looping, looping);
int alError = Al.GetError(); ALError alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to set source's looping state: " + Al.GetErrorString(alError)); throw new Exception("Failed to set source's looping state: " + AL.GetErrorString(alError));
} }
} }
} }
@@ -242,41 +242,41 @@ namespace Barotrauma.Sounds
if (!IsStream) if (!IsStream)
{ {
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex); uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
int playbackPos; Al.GetSourcei(alSource, Al.SampleOffset, out playbackPos); int playbackPos; AL.GetSource(alSource, ALGetSourcei.SampleOffset, out playbackPos);
int alError = Al.GetError(); ALError alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to get source's playback position: " + Al.GetErrorString(alError)); throw new Exception("Failed to get source's playback position: " + AL.GetErrorString(alError));
} }
Al.SourceStop(alSource); AL.SourceStop(alSource);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to stop source: " + Al.GetErrorString(alError)); throw new Exception("Failed to stop source: " + AL.GetErrorString(alError));
} }
Al.Sourcei(alSource, Al.Buffer, muffled ? (int)Sound.ALMuffledBuffer : (int)Sound.ALBuffer); AL.BindBufferToSource(alSource,(uint)(muffled ? Sound.ALMuffledBuffer : Sound.ALBuffer));
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to bind buffer to source: " + Al.GetErrorString(alError)); throw new Exception("Failed to bind buffer to source: " + AL.GetErrorString(alError));
} }
Al.SourcePlay(alSource); AL.SourcePlay(alSource);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to replay source: " + Al.GetErrorString(alError)); throw new Exception("Failed to replay source: " + AL.GetErrorString(alError));
} }
Al.Sourcei(alSource, Al.SampleOffset, playbackPos); AL.Source(alSource, ALSourcei.SampleOffset, playbackPos);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to reset playback position: " + Al.GetErrorString(alError)); throw new Exception("Failed to reset playback position: " + AL.GetErrorString(alError));
} }
} }
} }
@@ -324,13 +324,11 @@ namespace Barotrauma.Sounds
{ {
if (ALSourceIndex < 0) return false; if (ALSourceIndex < 0) return false;
if (IsStream && !reachedEndSample) return true; if (IsStream && !reachedEndSample) return true;
int state; bool playing = AL.GetSourceState(Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex)) == ALSourceState.Playing;
Al.GetSourcei(Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), Al.SourceState, out state); ALError alError = AL.GetError();
bool playing = state == Al.Playing; if (alError != ALError.NoError)
int alError = Al.GetError();
if (alError != Al.NoError)
{ {
throw new Exception("Failed to determine playing state from source: " + Al.GetErrorString(alError)); throw new Exception("Failed to determine playing state from source: " + AL.GetErrorString(alError));
} }
return playing; return playing;
} }
@@ -359,47 +357,47 @@ namespace Barotrauma.Sounds
{ {
if (!IsStream) if (!IsStream)
{ {
Al.Sourcei(sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), Al.Buffer, 0); AL.BindBufferToSource(sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), 0);
int alError = Al.GetError(); ALError alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to reset source buffer: " + Al.GetErrorString(alError)); throw new Exception("Failed to reset source buffer: " + AL.GetErrorString(alError));
} }
if (!Al.IsBuffer(sound.ALBuffer)) if (!AL.IsBuffer(sound.ALBuffer))
{ {
throw new Exception(sound.Filename + " has an invalid buffer!"); throw new Exception(sound.Filename + " has an invalid buffer!");
} }
uint alBuffer = sound.Owner.GetCategoryMuffle(category) || muffle ? sound.ALMuffledBuffer : sound.ALBuffer; uint alBuffer = sound.Owner.GetCategoryMuffle(category) || muffle ? sound.ALMuffledBuffer : sound.ALBuffer;
Al.Sourcei(sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), Al.Buffer, (int)alBuffer); AL.BindBufferToSource(sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), alBuffer);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to bind buffer to source (" + ALSourceIndex.ToString() + ":" + sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex) + "," + sound.ALBuffer.ToString() + "): " + Al.GetErrorString(alError)); throw new Exception("Failed to bind buffer to source (" + ALSourceIndex.ToString() + ":" + sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex) + "," + sound.ALBuffer.ToString() + "): " + AL.GetErrorString(alError));
} }
Al.SourcePlay(sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex)); AL.SourcePlay(sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex));
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to play source: " + Al.GetErrorString(alError)); throw new Exception("Failed to play source: " + AL.GetErrorString(alError));
} }
} }
else else
{ {
Al.Sourcei(sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), Al.Buffer, (int)sound.ALBuffer); AL.BindBufferToSource(sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), (uint)sound.ALBuffer);
int alError = Al.GetError(); ALError alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to reset source buffer: " + Al.GetErrorString(alError)); throw new Exception("Failed to reset source buffer: " + AL.GetErrorString(alError));
} }
Al.Sourcei(sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), Al.Looping, Al.False); AL.Source(sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), ALSourceb.Looping, false);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to set stream looping state: " + Al.GetErrorString(alError)); throw new Exception("Failed to set stream looping state: " + AL.GetErrorString(alError));
} }
streamShortBuffer = new short[STREAM_BUFFER_SIZE]; streamShortBuffer = new short[STREAM_BUFFER_SIZE];
@@ -408,15 +406,15 @@ namespace Barotrauma.Sounds
emptyBuffers = new List<uint>(); emptyBuffers = new List<uint>();
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
Al.GenBuffer(out streamBuffers[i]); AL.GenBuffer(out streamBuffers[i]);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to generate stream buffers: " + Al.GetErrorString(alError)); throw new Exception("Failed to generate stream buffers: " + AL.GetErrorString(alError));
} }
if (!Al.IsBuffer(streamBuffers[i])) if (!AL.IsBuffer(streamBuffers[i]))
{ {
throw new Exception("Generated streamBuffer[" + i.ToString() + "] is invalid!"); throw new Exception("Generated streamBuffer[" + i.ToString() + "] is invalid!");
} }
@@ -447,57 +445,57 @@ namespace Barotrauma.Sounds
{ {
if (ALSourceIndex >= 0) if (ALSourceIndex >= 0)
{ {
Al.SourceStop(Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex)); AL.SourceStop(Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex));
int alError = Al.GetError(); ALError alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to stop source: " + Al.GetErrorString(alError)); throw new Exception("Failed to stop source: " + AL.GetErrorString(alError));
} }
if (IsStream) if (IsStream)
{ {
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex); uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
Al.SourceStop(alSource); AL.SourceStop(alSource);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to stop streamed source: " + Al.GetErrorString(alError)); throw new Exception("Failed to stop streamed source: " + AL.GetErrorString(alError));
} }
int buffersToUnqueue = 0; int buffersToUnqueue = 0;
uint[] unqueuedBuffers = null; int[] unqueuedBuffers = null;
buffersToUnqueue = 0; buffersToUnqueue = 0;
Al.GetSourcei(alSource, Al.BuffersProcessed, out buffersToUnqueue); AL.GetSource(alSource, ALGetSourcei.BuffersProcessed, out buffersToUnqueue);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to determine processed buffers from streamed source: " + Al.GetErrorString(alError)); throw new Exception("Failed to determine processed buffers from streamed source: " + AL.GetErrorString(alError));
} }
unqueuedBuffers = new uint[buffersToUnqueue]; unqueuedBuffers = new int[buffersToUnqueue];
Al.SourceUnqueueBuffers(alSource, buffersToUnqueue, unqueuedBuffers); AL.SourceUnqueueBuffers((int)alSource, buffersToUnqueue, unqueuedBuffers);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to unqueue buffers from streamed source: " + Al.GetErrorString(alError)); throw new Exception("Failed to unqueue buffers from streamed source: " + AL.GetErrorString(alError));
} }
Al.Sourcei(alSource, Al.Buffer, 0); AL.BindBufferToSource(alSource, 0);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to reset buffer for streamed source: " + Al.GetErrorString(alError)); throw new Exception("Failed to reset buffer for streamed source: " + AL.GetErrorString(alError));
} }
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
Al.DeleteBuffer(streamBuffers[i]); AL.DeleteBuffer(ref streamBuffers[i]);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to delete streamBuffers[" + i.ToString() + "] ("+streamBuffers[i].ToString()+"): " + Al.GetErrorString(alError)); throw new Exception("Failed to delete streamBuffers[" + i.ToString() + "] ("+streamBuffers[i].ToString()+"): " + AL.GetErrorString(alError));
} }
} }
@@ -505,11 +503,11 @@ namespace Barotrauma.Sounds
} }
else else
{ {
Al.Sourcei(Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), Al.Buffer, 0); AL.BindBufferToSource(Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), 0);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to unbind buffer to non-streamed source: " + Al.GetErrorString(alError)); throw new Exception("Failed to unbind buffer to non-streamed source: " + AL.GetErrorString(alError));
} }
} }
@@ -528,49 +526,47 @@ namespace Barotrauma.Sounds
{ {
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex); uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
int state; bool playing = AL.GetSourceState(alSource) == ALSourceState.Playing;
Al.GetSourcei(Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), Al.SourceState, out state); ALError alError = AL.GetError();
bool playing = state == Al.Playing; if (alError != ALError.NoError)
int alError = Al.GetError();
if (alError != Al.NoError)
{ {
throw new Exception("Failed to determine playing state from streamed source: " + Al.GetErrorString(alError)); throw new Exception("Failed to determine playing state from streamed source: " + AL.GetErrorString(alError));
} }
int buffersToUnqueue = 0; int buffersToUnqueue = 0;
uint[] unqueuedBuffers = null; int[] unqueuedBuffers = null;
if (!startedPlaying) if (!startedPlaying)
{ {
buffersToUnqueue = 0; buffersToUnqueue = 0;
Al.GetSourcei(alSource, Al.BuffersProcessed, out buffersToUnqueue); AL.GetSource(alSource, ALGetSourcei.BuffersProcessed, out buffersToUnqueue);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to determine processed buffers from streamed source: " + Al.GetErrorString(alError)); throw new Exception("Failed to determine processed buffers from streamed source: " + AL.GetErrorString(alError));
} }
unqueuedBuffers = new uint[buffersToUnqueue+emptyBuffers.Count]; unqueuedBuffers = new int[buffersToUnqueue+emptyBuffers.Count];
Al.SourceUnqueueBuffers(alSource, buffersToUnqueue, unqueuedBuffers); AL.SourceUnqueueBuffers((int)alSource, buffersToUnqueue, unqueuedBuffers);
for (int i = 0; i < emptyBuffers.Count; i++) for (int i = 0; i < emptyBuffers.Count; i++)
{ {
unqueuedBuffers[buffersToUnqueue + i] = emptyBuffers[i]; unqueuedBuffers[buffersToUnqueue + i] = (int)emptyBuffers[i];
} }
buffersToUnqueue += emptyBuffers.Count; buffersToUnqueue += emptyBuffers.Count;
emptyBuffers.Clear(); emptyBuffers.Clear();
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to unqueue buffers from streamed source: " + Al.GetErrorString(alError)); throw new Exception("Failed to unqueue buffers from streamed source: " + AL.GetErrorString(alError));
} }
} }
else else
{ {
startedPlaying = false; startedPlaying = false;
buffersToUnqueue = 4; buffersToUnqueue = 4;
unqueuedBuffers = new uint[4]; unqueuedBuffers = new int[4];
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
unqueuedBuffers[i] = streamBuffers[i]; unqueuedBuffers[i] = (int)streamBuffers[i];
} }
} }
@@ -616,20 +612,20 @@ namespace Barotrauma.Sounds
if (readSamples > 0) if (readSamples > 0)
{ {
Al.BufferData<short>(unqueuedBuffers[i], Sound.ALFormat, buffer, readSamples, Sound.SampleRate); AL.BufferData<short>(unqueuedBuffers[i], Sound.ALFormat, buffer, readSamples, Sound.SampleRate);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to assign data to stream buffer: " + throw new Exception("Failed to assign data to stream buffer: " +
Al.GetErrorString(alError) + ": " + unqueuedBuffers[i].ToString() + "/" + unqueuedBuffers.Length + ", readSamples: " + readSamples); AL.GetErrorString(alError) + ": " + unqueuedBuffers[i].ToString() + "/" + unqueuedBuffers.Length + ", readSamples: " + readSamples);
} }
Al.SourceQueueBuffer(alSource, unqueuedBuffers[i]); AL.SourceQueueBuffer((int)alSource, unqueuedBuffers[i]);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to queue buffer[" + i.ToString() + "] to stream: " + Al.GetErrorString(alError)); throw new Exception("Failed to queue buffer[" + i.ToString() + "] to stream: " + AL.GetErrorString(alError));
} }
} }
else if (readSamples < 0) else if (readSamples < 0)
@@ -642,10 +638,9 @@ namespace Barotrauma.Sounds
} }
} }
Al.GetSourcei(alSource, Al.SourceState, out state); if (AL.GetSourceState(alSource) != ALSourceState.Playing)
if (state != Al.Playing)
{ {
Al.SourcePlay(alSource); AL.SourcePlay(alSource);
} }
} }
} }
@@ -2,7 +2,7 @@
using System.Threading; using System.Threading;
using System.Collections.Generic; using System.Collections.Generic;
using System.Xml.Linq; using System.Xml.Linq;
using OpenAL; using OpenTK.Audio.OpenAL;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using System.Linq; using System.Linq;
using System.IO; using System.IO;
@@ -20,7 +20,7 @@ namespace Barotrauma.Sounds
} }
private IntPtr alcDevice; private IntPtr alcDevice;
private IntPtr alcContext; private OpenTK.ContextHandle alcContext;
public enum SourcePoolIndex public enum SourcePoolIndex
{ {
@@ -42,11 +42,11 @@ namespace Barotrauma.Sounds
{ {
if (Disabled) { return; } if (Disabled) { return; }
listenerPosition = value; listenerPosition = value;
Al.Listener3f(Al.Position,value.X,value.Y,value.Z); AL.Listener(ALListener3f.Position,value.X,value.Y,value.Z);
int alError = Al.GetError(); ALError alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to set listener position: " + Al.GetErrorString(alError)); throw new Exception("Failed to set listener position: " + AL.GetErrorString(alError));
} }
} }
} }
@@ -59,11 +59,11 @@ namespace Barotrauma.Sounds
{ {
if (Disabled) { return; } if (Disabled) { return; }
listenerOrientation[0] = value.X; listenerOrientation[1] = value.Y; listenerOrientation[2] = value.Z; listenerOrientation[0] = value.X; listenerOrientation[1] = value.Y; listenerOrientation[2] = value.Z;
Al.Listenerfv(Al.Orientation, listenerOrientation); AL.Listener(ALListenerfv.Orientation, ref listenerOrientation);
int alError = Al.GetError(); ALError alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to set listener target vector: " + Al.GetErrorString(alError)); throw new Exception("Failed to set listener target vector: " + AL.GetErrorString(alError));
} }
} }
} }
@@ -74,11 +74,11 @@ namespace Barotrauma.Sounds
{ {
if (Disabled) { return; } if (Disabled) { return; }
listenerOrientation[3] = value.X; listenerOrientation[4] = value.Y; listenerOrientation[5] = value.Z; listenerOrientation[3] = value.X; listenerOrientation[4] = value.Y; listenerOrientation[5] = value.Z;
Al.Listenerfv(Al.Orientation, listenerOrientation); AL.Listener(ALListenerfv.Orientation, ref listenerOrientation);
int alError = Al.GetError(); ALError alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to set listener up vector: " + Al.GetErrorString(alError)); throw new Exception("Failed to set listener up vector: " + AL.GetErrorString(alError));
} }
} }
} }
@@ -92,11 +92,11 @@ namespace Barotrauma.Sounds
if (Disabled) { return; } if (Disabled) { return; }
if (Math.Abs(ListenerGain - value) < 0.001f) { return; } if (Math.Abs(ListenerGain - value) < 0.001f) { return; }
listenerGain = value; listenerGain = value;
Al.Listenerf(Al.Gain, listenerGain); AL.Listener(ALListenerf.Gain, listenerGain);
int alError = Al.GetError(); ALError alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
throw new Exception("Failed to set listener gain: " + Al.GetErrorString(alError)); throw new Exception("Failed to set listener gain: " + AL.GetErrorString(alError));
} }
} }
} }
@@ -126,8 +126,8 @@ namespace Barotrauma.Sounds
return; return;
} }
int alcError = Alc.GetError(alcDevice); AlcError alcError = Alc.GetError(alcDevice);
if (alcError != Alc.NoError) if (alcError != AlcError.NoError)
{ {
//The audio device probably wasn't ready, this happens quite often //The audio device probably wasn't ready, this happens quite often
//Just wait a while and try again //Just wait a while and try again
@@ -136,7 +136,7 @@ namespace Barotrauma.Sounds
alcDevice = Alc.OpenDevice(null); alcDevice = Alc.OpenDevice(null);
alcError = Alc.GetError(alcDevice); alcError = Alc.GetError(alcDevice);
if (alcError != Alc.NoError) if (alcError != AlcError.NoError)
{ {
DebugConsole.ThrowError("Error initializing ALC device: " + alcError.ToString() + ". Disabling audio playback..."); DebugConsole.ThrowError("Error initializing ALC device: " + alcError.ToString() + ". Disabling audio playback...");
Disabled = true; Disabled = true;
@@ -161,14 +161,14 @@ namespace Barotrauma.Sounds
} }
alcError = Alc.GetError(alcDevice); alcError = Alc.GetError(alcDevice);
if (alcError != Alc.NoError) if (alcError != AlcError.NoError)
{ {
DebugConsole.ThrowError("Error after assigning ALC context: " + alcError.ToString() + ". Disabling audio playback..."); DebugConsole.ThrowError("Error after assigning ALC context: " + alcError.ToString() + ". Disabling audio playback...");
Disabled = true; Disabled = true;
return; return;
} }
int alError = Al.NoError; ALError alError = ALError.NoError;
sourcePools = new SoundSourcePool[2]; sourcePools = new SoundSourcePool[2];
sourcePools[(int)SourcePoolIndex.Default] = new SoundSourcePool(SOURCE_COUNT); sourcePools[(int)SourcePoolIndex.Default] = new SoundSourcePool(SOURCE_COUNT);
@@ -177,12 +177,12 @@ namespace Barotrauma.Sounds
sourcePools[(int)SourcePoolIndex.Voice] = new SoundSourcePool(8); sourcePools[(int)SourcePoolIndex.Voice] = new SoundSourcePool(8);
playingChannels[(int)SourcePoolIndex.Voice] = new SoundChannel[8]; playingChannels[(int)SourcePoolIndex.Voice] = new SoundChannel[8];
Al.DistanceModel(Al.LinearDistanceClamped); AL.DistanceModel(ALDistanceModel.LinearDistanceClamped);
alError = Al.GetError(); alError = AL.GetError();
if (alError != Al.NoError) if (alError != ALError.NoError)
{ {
DebugConsole.ThrowError("Error setting distance model: " + Al.GetErrorString(alError) + ". Disabling audio playback..."); DebugConsole.ThrowError("Error setting distance model: " + AL.GetErrorString(alError) + ". Disabling audio playback...");
Disabled = true; Disabled = true;
return; return;
} }
@@ -239,7 +239,7 @@ namespace Barotrauma.Sounds
{ {
if (Disabled || srcInd < 0 || srcInd >= sourcePools[(int)poolIndex].ALSources.Length) return 0; if (Disabled || srcInd < 0 || srcInd >= sourcePools[(int)poolIndex].ALSources.Length) return 0;
if (!Al.IsSource(sourcePools[(int)poolIndex].ALSources[srcInd])) if (!AL.IsSource(sourcePools[(int)poolIndex].ALSources[srcInd]))
{ {
throw new Exception("alSources[" + srcInd.ToString() + "] is invalid!"); throw new Exception("alSources[" + srcInd.ToString() + "] is invalid!");
} }
@@ -276,8 +276,8 @@ namespace Barotrauma.Sounds
{ {
for (int i = 0; i < sourcePools[0].ALSources.Length; i++) for (int i = 0; i < sourcePools[0].ALSources.Length; i++)
{ {
Al.Sourcef(sourcePools[0].ALSources[i], Al.MaxGain, i == ind ? 1.0f : 0.0f); AL.Source(sourcePools[0].ALSources[i], ALSourcef.MaxGain, i == ind ? 1.0f : 0.0f);
Al.Sourcef(sourcePools[0].ALSources[i], Al.MinGain, 0.0f); AL.Source(sourcePools[0].ALSources[i], ALSourcef.MinGain, 0.0f);
} }
} }
#endif #endif
@@ -514,7 +514,7 @@ namespace Barotrauma.Sounds
sourcePools[(int)SourcePoolIndex.Default]?.Dispose(); sourcePools[(int)SourcePoolIndex.Default]?.Dispose();
sourcePools[(int)SourcePoolIndex.Voice]?.Dispose(); sourcePools[(int)SourcePoolIndex.Voice]?.Dispose();
if (!Alc.MakeContextCurrent(IntPtr.Zero)) if (!Alc.MakeContextCurrent(OpenTK.ContextHandle.Zero))
{ {
throw new Exception("Failed to detach the current ALC context! (error code: " + Alc.GetError(alcDevice).ToString() + ")"); throw new Exception("Failed to detach the current ALC context! (error code: " + Alc.GetError(alcDevice).ToString() + ")");
} }
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using OpenAL; using OpenTK.Audio.OpenAL;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
@@ -21,7 +21,7 @@ namespace Barotrauma.Sounds
public VideoSound(SoundManager owner, string filename, int sampleRate, Video vid) : base(owner, filename, true, false) public VideoSound(SoundManager owner, string filename, int sampleRate, Video vid) : base(owner, filename, true, false)
{ {
ALFormat = Al.FormatStereo16; ALFormat = ALFormat.Stereo16;
SampleRate = sampleRate; SampleRate = sampleRate;
sampleQueue = new Queue<short[]>(); sampleQueue = new Queue<short[]>();
@@ -1,6 +1,6 @@
using Barotrauma.Networking; using Barotrauma.Networking;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using OpenAL; using OpenTK.Audio.OpenAL;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -58,7 +58,7 @@ namespace Barotrauma.Sounds
{ {
VoipConfig.SetupEncoding(); VoipConfig.SetupEncoding();
ALFormat = Al.FormatMono16; ALFormat = ALFormat.Mono16;
SampleRate = VoipConfig.FREQUENCY; SampleRate = VoipConfig.FREQUENCY;
queue = q; queue = q;
@@ -39,7 +39,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWindows|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWindows|x64'">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<OutputPath>..\bin\ReleaseWindows\</OutputPath> <OutputPath>..\bin\ReleaseWindows\</OutputPath>
<DefineConstants>TRACE;WINDOWS;CLIENT;X64</DefineConstants> <DefineConstants>TRACE;WINDOWS;CLIENT</DefineConstants>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
@@ -49,7 +49,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugWindows|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugWindows|x64'">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<OutputPath>..\bin\DebugWindows\</OutputPath> <OutputPath>..\bin\DebugWindows\</OutputPath>
<DefineConstants>TRACE;DEBUG;WINDOWS;CLIENT;X64</DefineConstants> <DefineConstants>TRACE;WINDOWS;CLIENT;DEBUG</DefineConstants>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
@@ -60,7 +60,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWindows|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseWindows|x86'">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<OutputPath>..\bin\x86\ReleaseWindows\</OutputPath> <OutputPath>..\bin\x86\ReleaseWindows\</OutputPath>
<DefineConstants>TRACE;WINDOWS;CLIENT;X86</DefineConstants> <DefineConstants>TRACE;WINDOWS;CLIENT</DefineConstants>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
@@ -70,7 +70,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugWindows|x86'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugWindows|x86'">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<OutputPath>..\bin\x86\DebugWindows\</OutputPath> <OutputPath>..\bin\x86\DebugWindows\</OutputPath>
<DefineConstants>TRACE;DEBUG;WINDOWS;CLIENT;X86</DefineConstants> <DefineConstants>TRACE;WINDOWS;CLIENT;DEBUG</DefineConstants>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>x86</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
@@ -95,6 +95,9 @@
<Reference Include="NVorbis, Version=0.8.6.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="NVorbis, Version=0.8.6.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\Libraries\NuGet\NVorbis.0.8.6\lib\net35\NVorbis.dll</HintPath> <HintPath>..\..\Libraries\NuGet\NVorbis.0.8.6\lib\net35\NVorbis.dll</HintPath>
</Reference> </Reference>
<Reference Include="OpenTK, Version=3.0.1.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<HintPath>..\..\Libraries\NuGet\OpenTK.3.0.1\lib\net20\OpenTK.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\Libraries\NuGet\RestSharp.105.2.3\lib\net45\RestSharp.dll</HintPath> <HintPath>..\..\Libraries\NuGet\RestSharp.105.2.3\lib\net45\RestSharp.dll</HintPath>
@@ -212,18 +215,18 @@
<Content Include="Shaders\losshader.fx" /> <Content Include="Shaders\losshader.fx" />
<Content Include="Shaders\postprocess.fx" /> <Content Include="Shaders\postprocess.fx" />
<Content Include="Shaders\watershader.fx" /> <Content Include="Shaders\watershader.fx" />
<Content Include="wrap_oal.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="MonoGame.Framework.dll.config"> <Content Include="MonoGame.Framework.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="OpenTK.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="SharpFont.dll.config"> <Content Include="SharpFont.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="soft_oal_x64.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="soft_oal_x86.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0"> <BootstrapperPackage Include=".NETFramework,Version=v4.0">
@@ -8,6 +8,7 @@
<package id="NLog" version="4.3.8" targetFramework="net45" /> <package id="NLog" version="4.3.8" targetFramework="net45" />
<package id="nVLC" version="3.0.0" targetFramework="net45" /> <package id="nVLC" version="3.0.0" targetFramework="net45" />
<package id="NVorbis" version="0.8.6" targetFramework="net45" /> <package id="NVorbis" version="0.8.6" targetFramework="net45" />
<package id="OpenTK" version="3.0.1" targetFramework="net45" />
<package id="RestSharp" version="105.2.3" targetFramework="net45" /> <package id="RestSharp" version="105.2.3" targetFramework="net45" />
<package id="SharpDX" version="4.2.0" targetFramework="net45" /> <package id="SharpDX" version="4.2.0" targetFramework="net45" />
<package id="SharpDX.Direct2D1" version="4.2.0" targetFramework="net45" /> <package id="SharpDX.Direct2D1" version="4.2.0" targetFramework="net45" />
Binary file not shown.
@@ -159,14 +159,8 @@ namespace Barotrauma
public void StartRound(Level level, bool reloadSub = true, bool loadSecondSub = false, bool mirrorLevel = false) public void StartRound(Level level, bool reloadSub = true, bool loadSecondSub = false, bool mirrorLevel = false)
{ {
#if CLIENT #if CLIENT
if (GameMain.Client == null) GameMain.LightManager.LosEnabled = GameMain.Client == null || GameMain.Client.CharacterInfo != null;
{ if (GameMain.Client == null) GameMain.LightManager.LosMode = GameMain.Config.LosMode;
GameMain.LightManager.LosMode = GameMain.Config.LosMode;
}
else
{
GameMain.LightManager.LosEnabled = GameMain.Client.CharacterInfo != null;
}
#endif #endif
this.Level = level; this.Level = level;
Binary file not shown.
Binary file not shown.
+32
View File
@@ -1,3 +1,35 @@
---------------------------------------------------------------------------------------------------------
v0.9.0.4
---------------------------------------------------------------------------------------------------------
- Fixed "Steam authentication failed" errors when trying to reconnect to a server after cancelling the
connection.
- Fixed clients occasionally failing to spawn items when playing using a different language than the server,
which caused them to get kicked.
- Fixed extra cargo failing to spawn in multiplayer when playing using a different language than the server.
- Fixed legacy items failing to load if a sub is saved with a language other than English and the language
then changed to something else.
- Fixed excessively small password input box when connecting to servers.
- Fixed a bug that occasionally caused items to drop from the inventory when moving items between
inventory slots in the multiplayer.
- Prevent junction boxes from getting damaged due to overvoltage in the engineering tutorial.
- Fixed structures getting scaled incorrectly when cloning a structure with a non-default scale in the
submarine editor.
- Fixed occasional crashes when leaving a multiplayer session while the "cinematic" at the end of the round
is still playing.
- Fixed items not being moved to the humanhusk's inventory when a huskified player dies (= clothes and
other gear seemed to magically disappear when the character "resurrected" as an AI husk).
- Fixed clients not seeing turrets rotating at their end when another client is operating the turret.
- Fixed hitscan projectiles (revolver rounds) going through walls if the weapon is fired while its
barrel is partially inside the wall.
- Fixed welding tools being able to weld doors and burn characters through walls.
- Fixed bots reporting leaks when there are holes in the interior walls.
- Fixes to the colliders of some of the shuttle wall pieces.
- Fixed Linux version crashing when attempting to browse for files in the Steam Workshop menu.
- Fixed credits not resizing when resolution is changed.
- Added an upper limit to impact damage done to ragdolls, preventing characters from getting instakilled if
a Moloch or another large monster smashes against the sub hard enough.
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------
v0.9.0.3 v0.9.0.3
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------