Merge branch 'master' into moStuff
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">ReleaseLinux</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
@@ -9,7 +9,7 @@
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Barotrauma</RootNamespace>
|
||||
<AssemblyName>Barotrauma</AssemblyName>
|
||||
<AssemblyName>BarotraumaClient</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
@@ -28,37 +28,47 @@
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\Windows\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;WINDOWS;CLIENT</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\bin\Windows\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;WINDOWS;CLIENT</DefineConstants>
|
||||
<AllowedReferenceRelatedFileExtensions>
|
||||
<!-- Prevent default XML and PDB files copied to output in RELEASE.
|
||||
Only *.allowedextension files will be included, which doesn't exist in my case.
|
||||
-->
|
||||
.allowedextension
|
||||
</AllowedReferenceRelatedFileExtensions>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<ReleaseVersion>0.7.0.1</ReleaseVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseLinux|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\bin\ReleaseLinux\</OutputPath>
|
||||
<DefineConstants>TRACE;LINUX;CLIENT</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugLinux|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\DebugLinux\</OutputPath>
|
||||
<DefineConstants>TRACE;LINUX;CLIENT;DEBUG</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseWindows|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\bin\ReleaseWindows\</OutputPath>
|
||||
<DefineConstants>TRACE;WINDOWS;CLIENT</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugWindows|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\DebugWindows\</OutputPath>
|
||||
<DefineConstants>TRACE;WINDOWS;CLIENT;DEBUG</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Source\Camera.cs" />
|
||||
@@ -93,7 +103,6 @@
|
||||
<Compile Include="Source\GameSession\CrewManager.cs" />
|
||||
<Compile Include="Source\GameSession\GameMode.cs" />
|
||||
<Compile Include="Source\GameSession\GameModes\SinglePlayerCampaign.cs" />
|
||||
<Compile Include="Source\GameSession\GameModes\TraitorManager.cs" />
|
||||
<Compile Include="Source\GameSession\GameModes\Tutorials\BasicTutorial.cs" />
|
||||
<Compile Include="Source\GameSession\GameModes\Tutorials\EditorTutorial.cs" />
|
||||
<Compile Include="Source\GameSession\GameModes\Tutorials\TutorialMode.cs" />
|
||||
@@ -221,31 +230,32 @@
|
||||
<Compile Include="Source\Utils\ToolBox.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="MonoGame.Framework, Version=3.6.0.1625, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Condition="$(DefineConstants.Contains('WINDOWS'))" Include="MonoGame.Framework.WindowsDX">
|
||||
<HintPath>..\..\Libraries\NuGet\MonoGame.Framework.WindowsDX.3.6.0.1625\lib\net40\MonoGame.Framework.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NVorbis, Version=0.8.4.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Condition="$(DefineConstants.Contains('WINDOWS'))" Include="PresentationCore" />
|
||||
<Reference Condition="$(DefineConstants.Contains('WINDOWS'))" Include="SharpDX">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Libraries\NuGet\MonoGame.Framework.WindowsDX.3.6.0.1625\lib\net40\SharpDX.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Condition="$(DefineConstants.Contains('WINDOWS'))" Include="NVorbis">
|
||||
<HintPath>..\..\Libraries\NuGet\NVorbis.0.8.5.0\lib\NVorbis.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="OpenTK, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Libraries\NuGet\OpenTK.2.0.0\lib\net20\OpenTK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="RestSharp">
|
||||
<HintPath>..\..\Libraries\NuGet\RestSharp.105.2.3\lib\net45\RestSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SharpDX, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Libraries\NuGet\MonoGame.Framework.WindowsDX.3.6.0.1625\lib\net40\SharpDX.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.XML" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="RestSharp">
|
||||
<HintPath>..\..\Libraries\NuGet\RestSharp.105.2.3\lib\net45\RestSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Condition="$(DefineConstants.Contains('LINUX'))" Include="MonoGame.Framework.DesktopGL">
|
||||
<HintPath>..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.6.0.1625\lib\net40\MonoGame.Framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="freetype6.dll">
|
||||
@@ -257,6 +267,15 @@
|
||||
<Content Include="wrap_oal.dll">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="MonoGame.Framework.dll.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="OpenTK.dll.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="SharpFont.dll.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
|
||||
@@ -281,10 +300,6 @@
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer Physics MonoGame.csproj">
|
||||
<Project>{0aad36e3-51a5-4a07-ab60-5c8a66bd38b7}</Project>
|
||||
<Name>Farseer Physics MonoGame</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.csproj">
|
||||
<Project>{3b8f9edb-6e5e-450c-abc2-ec49075d0b50}</Project>
|
||||
<Name>Hyper.ComponentModel</Name>
|
||||
@@ -297,9 +312,12 @@
|
||||
<Project>{c293db32-fa42-486d-b128-5a12522fae4e}</Project>
|
||||
<Name>SharpFont</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer Physics MonoGame.csproj">
|
||||
<Project>{0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}</Project>
|
||||
<Name>Farseer Physics MonoGame</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="OpenTK.dll.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<dllmap dll="SDL2.dll" os="osx" target="libSDL2-2.0.0.dylib" />
|
||||
<dllmap dll="soft_oal.dll" os="osx" target="libopenal.1.dylib" />
|
||||
<dllmap dll="SDL2.dll" os="linux" cpu="x86" target="./x86/libSDL2-2.0.so.0" />
|
||||
<dllmap dll="soft_oal.dll" os="linux" cpu="x86" target="./x86/libopenal.so.1" />
|
||||
<dllmap dll="SDL2.dll" os="linux" cpu="x86-64" target="./x64/libSDL2-2.0.so.0" />
|
||||
<dllmap dll="soft_oal.dll" os="linux" cpu="x86-64" target="./x64/libopenal.so.1" />
|
||||
</configuration>
|
||||
6
Barotrauma/BarotraumaClient/SharpFont.dll.config
Executable file
6
Barotrauma/BarotraumaClient/SharpFont.dll.config
Executable file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<dllmap dll="freetype6" os="linux" target="libfreetype.so.6" />
|
||||
<dllmap dll="freetype6" os="osx" target="/Library/Frameworks/Mono.framework/Libraries/libfreetype.6.dylib" />
|
||||
<dllmap dll="freetype6" os="freebsd" target="libfreetype.so.6" />
|
||||
</configuration>
|
||||
@@ -61,9 +61,7 @@ namespace Barotrauma
|
||||
ToggleGUIFrame();
|
||||
return false;
|
||||
};
|
||||
|
||||
//UpdateCharacters();
|
||||
|
||||
|
||||
int buttonWidth = 130;
|
||||
int spacing = 20;
|
||||
|
||||
@@ -112,10 +110,6 @@ namespace Barotrauma
|
||||
{
|
||||
var orderButton = new GUIButton(rect, order.Name, null, Alignment.TopCenter, Alignment.Center, "GUITextBox", frame);
|
||||
orderButton.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
||||
/*orderButton.TextColor = Color.White;
|
||||
orderButton.Color = Color.Black * 0.5f;
|
||||
orderButton.HoverColor = Color.LightGray * 0.5f;
|
||||
orderButton.OutlineColor = Color.LightGray * 0.8f;*/
|
||||
orderButton.UserData = order;
|
||||
orderButton.OnClicked = SetOrder;
|
||||
|
||||
@@ -160,24 +154,18 @@ namespace Barotrauma
|
||||
foreach (Character character in aliveCharacters)
|
||||
{
|
||||
int rowCharacterCount = Math.Min(charactersPerRow, aliveCharacters.Count);
|
||||
//if (i >= aliveCharacters.Count - charactersPerRow && aliveCharacters.Count % charactersPerRow > 0) rowCharacterCount = aliveCharacters.Count % charactersPerRow;
|
||||
|
||||
// rowCharacterCount = Math.Min(rowCharacterCount, aliveCharacters.Count - i);
|
||||
int startX = -(150 * rowCharacterCount + spacing * (rowCharacterCount - 1)) / 2;
|
||||
|
||||
|
||||
int x = startX + (150 + spacing) * (i % Math.Min(charactersPerRow, aliveCharacters.Count));
|
||||
int y = (105 + spacing)*((int)Math.Floor((double)i / charactersPerRow));
|
||||
|
||||
GUIButton characterButton = new GUIButton(new Rectangle(x+75, y, 150, 40), "", null, Alignment.TopCenter, "GUITextBox", frame);
|
||||
|
||||
GUIFrame characterFrame = new GUIFrame(new Rectangle(x + 75, y, 150, 100), null, Alignment.TopCenter, null, frame);
|
||||
characterFrame.UserData = character;
|
||||
|
||||
GUIButton characterButton = new GUIButton(new Rectangle(0, 0, 0, 40), "", null, Alignment.TopCenter, "GUITextBox", characterFrame);
|
||||
characterButton.UserData = character;
|
||||
characterButton.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
||||
|
||||
characterButton.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
||||
characterButton.Color = Character.Controlled == character ? Color.Gold : Color.White;
|
||||
/*characterButton.HoverColor = Color.LightGray * 0.5f;
|
||||
characterButton.SelectedColor = Color.Gold * 0.6f;
|
||||
characterButton.OutlineColor = Color.LightGray * 0.8f;*/
|
||||
|
||||
characterFrameBottom = Math.Max(characterFrameBottom, characterButton.Rect.Bottom);
|
||||
|
||||
@@ -198,7 +186,7 @@ namespace Barotrauma
|
||||
var humanAi = character.AIController as HumanAIController;
|
||||
if (humanAi != null && humanAi.CurrentOrder != null)
|
||||
{
|
||||
CreateCharacterOrderFrame(characterButton, humanAi.CurrentOrder, humanAi.CurrentOrderOption);
|
||||
CreateCharacterOrderFrame(characterFrame, humanAi.CurrentOrder, humanAi.CurrentOrderOption);
|
||||
}
|
||||
|
||||
i++;
|
||||
@@ -230,15 +218,18 @@ namespace Barotrauma
|
||||
|
||||
foreach (GUIComponent child in frame.children)
|
||||
{
|
||||
var characterButton = child as GUIButton;
|
||||
Character character = child.UserData as Character;
|
||||
if (character == null) continue;
|
||||
|
||||
var characterButton = child.GetChild<GUIButton>();
|
||||
characterButton.State = GUIComponent.ComponentState.None;
|
||||
|
||||
if (!characterButton.Selected) continue;
|
||||
characterButton.Selected = false;
|
||||
|
||||
CreateCharacterOrderFrame(characterButton, order, "");
|
||||
CreateCharacterOrderFrame(characterButton.Parent, order, "");
|
||||
|
||||
var humanAi = (characterButton.UserData as Character).AIController as HumanAIController;
|
||||
var humanAi = character.AIController as HumanAIController;
|
||||
|
||||
humanAi.SetOrder(order, "");
|
||||
}
|
||||
@@ -258,8 +249,8 @@ namespace Barotrauma
|
||||
|
||||
var existingOrder = characterFrame.children.Find(c => c.UserData is Order);
|
||||
if (existingOrder != null) characterFrame.RemoveChild(existingOrder);
|
||||
|
||||
var orderFrame = new GUIFrame(new Rectangle(-5, characterFrame.Rect.Height, characterFrame.Rect.Width, 30 + order.Options.Length * 15), "InnerFrame", characterFrame);
|
||||
|
||||
var orderFrame = new GUIFrame(new Rectangle(-5, 40, characterFrame.Rect.Width, 30 + order.Options.Length * 15), "InnerFrame", characterFrame);
|
||||
/*orderFrame.OutlineColor = Color.LightGray * 0.5f;*/
|
||||
orderFrame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
||||
orderFrame.UserData = order;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Barotrauma.Networking;
|
||||
using Barotrauma.Networking;
|
||||
using Barotrauma.Particles;
|
||||
using FarseerPhysics;
|
||||
using FarseerPhysics.Dynamics;
|
||||
@@ -178,7 +178,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (GameMain.NetworkMember != null && Character.controlled == this)
|
||||
{
|
||||
string chatMessage = InfoTextManager.GetInfoText("Self_CauseOfDeath." + causeOfDeath.ToString());
|
||||
string chatMessage = TextManager.Get("Self_CauseOfDeath." + causeOfDeath.ToString());
|
||||
if (GameMain.Client != null) chatMessage += " Your chat messages will only be visible to other dead players.";
|
||||
|
||||
GameMain.NetworkMember.AddChatMessage(chatMessage, ChatMessageType.Dead);
|
||||
@@ -290,7 +290,15 @@ namespace Barotrauma
|
||||
string name = Info.DisplayName;
|
||||
if (controlled == null && name != Info.Name) name += " (Disguised)";
|
||||
|
||||
Vector2 namePos = new Vector2(pos.X, pos.Y - 110.0f - (5.0f / cam.Zoom)) - GUI.Font.MeasureString(name) * 0.5f / cam.Zoom;
|
||||
Vector2 namePos = new Vector2(pos.X, pos.Y - 110.0f - (5.0f / cam.Zoom)) - GUI.Font.MeasureString(Info.Name) * 0.5f / cam.Zoom;
|
||||
Vector2 screenSize = new Vector2(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||
Vector2 viewportSize = new Vector2(cam.WorldView.Width, cam.WorldView.Height);
|
||||
namePos.X -= cam.WorldView.X; namePos.Y += cam.WorldView.Y;
|
||||
namePos *= screenSize / viewportSize;
|
||||
namePos.X = (float)Math.Floor(namePos.X); namePos.Y = (float)Math.Floor(namePos.Y);
|
||||
namePos *= viewportSize / screenSize;
|
||||
namePos.X += cam.WorldView.X; namePos.Y -= cam.WorldView.Y;
|
||||
|
||||
Color nameColor = Color.White;
|
||||
|
||||
if (Controlled != null && TeamID != Controlled.TeamID)
|
||||
|
||||
@@ -124,6 +124,8 @@ namespace Barotrauma
|
||||
{
|
||||
character.SelectedCharacter.Inventory.Update(deltaTime);
|
||||
}
|
||||
|
||||
Inventory.UpdateDragging();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,7 +207,7 @@ namespace Barotrauma
|
||||
{
|
||||
grabHoldButton = new GUIButton(
|
||||
new Rectangle(character.SelectedCharacter.Inventory.SlotPositions[0].ToPoint() + new Point(320, -60), new Point(130, 20)),
|
||||
"Grabbing: " + (character.AnimController.GrabLimb == LimbType.Torso ? "Torso" : "Hands"), "");
|
||||
TextManager.Get("Grabbing") + ": " + TextManager.Get(character.AnimController.GrabLimb == LimbType.None ? "Hands" : character.AnimController.GrabLimb.ToString()), "");
|
||||
|
||||
grabHoldButton.OnClicked = (button, userData) =>
|
||||
{
|
||||
@@ -223,7 +225,7 @@ namespace Barotrauma
|
||||
GameMain.Client.CreateEntityEvent(Character.Controlled, new object[] { NetEntityEvent.Type.Control });
|
||||
}
|
||||
|
||||
grabHoldButton.Text = "Grabbing: " + (Character.Controlled.AnimController.GrabLimb == LimbType.Torso ? "Torso" : "Hands");
|
||||
grabHoldButton.Text = TextManager.Get("Grabbing") + ": " + TextManager.Get(character.AnimController.GrabLimb == LimbType.None ? "Hands" : character.AnimController.GrabLimb.ToString());
|
||||
return true;
|
||||
};
|
||||
}
|
||||
@@ -234,6 +236,11 @@ namespace Barotrauma
|
||||
if (grabHoldButton.Visible) grabHoldButton.Draw(spriteBatch);
|
||||
}
|
||||
|
||||
if (character.Inventory != null && !character.LockHands && character.Stun >= -0.1f)
|
||||
{
|
||||
Inventory.DrawDragging(spriteBatch);
|
||||
}
|
||||
|
||||
if (character.FocusedCharacter != null && character.FocusedCharacter.CanBeSelected)
|
||||
{
|
||||
Vector2 startPos = character.DrawPosition + (character.FocusedCharacter.DrawPosition - character.DrawPosition) * 0.7f;
|
||||
@@ -309,12 +316,10 @@ namespace Barotrauma
|
||||
if (suicideButton == null)
|
||||
{
|
||||
suicideButton = new GUIButton(
|
||||
new Rectangle(new Point(GameMain.GraphicsWidth / 2 - 60, 20), new Point(120, 20)), "Give in", "");
|
||||
new Rectangle(new Point(GameMain.GraphicsWidth / 2 - 60, 20), new Point(120, 20)), TextManager.Get("GiveInButton"), "");
|
||||
|
||||
|
||||
suicideButton.ToolTip = GameMain.NetworkMember == null ?
|
||||
"The character can no longer be revived if you give in." :
|
||||
"Let go of your character and enter spectator mode (other players will no longer be able to revive you)";
|
||||
|
||||
suicideButton.ToolTip = TextManager.Get(GameMain.NetworkMember == null ? "GiveInHelpSingleplayer" : "GiveInHelpMultiplayer");
|
||||
|
||||
suicideButton.OnClicked = (button, userData) =>
|
||||
{
|
||||
@@ -344,7 +349,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (GameMain.DebugDraw)
|
||||
{
|
||||
GUI.DrawString(spriteBatch, new Vector2(30, GameMain.GraphicsHeight - 260), "Stun: "+character.Stun, Color.White);
|
||||
GUI.DrawString(spriteBatch, new Vector2(30, GameMain.GraphicsHeight - 260), TextManager.Get("Stun") + ": " + character.Stun, Color.White);
|
||||
}
|
||||
|
||||
if (oxygenBar == null)
|
||||
@@ -364,7 +369,7 @@ namespace Barotrauma
|
||||
oxygenBar.Draw(spriteBatch);
|
||||
if (!oxyMsgShown)
|
||||
{
|
||||
GUI.AddMessage(InfoTextManager.GetInfoText("OxygenBarInfo"), new Vector2(oxygenBar.Rect.Right + 10, oxygenBar.Rect.Y), Alignment.Left, Color.White, 5.0f);
|
||||
GUI.AddMessage(TextManager.Get("OxygenBarInfo"), new Vector2(oxygenBar.Rect.Right + 10, oxygenBar.Rect.Y), Alignment.Left, Color.White, 5.0f);
|
||||
oxyMsgShown = true;
|
||||
}
|
||||
}
|
||||
@@ -394,7 +399,7 @@ namespace Barotrauma
|
||||
|
||||
if (pressureMsgTimer > 0.5f && !pressureMsgShown)
|
||||
{
|
||||
GUI.AddMessage(InfoTextManager.GetInfoText("PressureInfo"), new Vector2(40.0f, healthBar.Rect.Y - 60.0f), Alignment.Left, Color.White, 5.0f);
|
||||
GUI.AddMessage(TextManager.Get("PressureInfo"), new Vector2(40.0f, healthBar.Rect.Y - 60.0f), Alignment.Left, Color.White, 5.0f);
|
||||
pressureMsgShown = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Barotrauma
|
||||
var skills = Job.Skills;
|
||||
skills.Sort((s1, s2) => -s1.Level.CompareTo(s2.Level));
|
||||
|
||||
new GUITextBlock(new Rectangle(x, y, 200, 20), "Skills:", "", frame, font);
|
||||
new GUITextBlock(new Rectangle(x, y, 200, 20), TextManager.Get("Skills") + ":", "", frame, font);
|
||||
y += 20;
|
||||
foreach (Skill skill in skills)
|
||||
{
|
||||
|
||||
@@ -145,6 +145,10 @@ namespace Barotrauma
|
||||
|
||||
float rotation = msg.ReadFloat();
|
||||
|
||||
ReadStatus(msg);
|
||||
|
||||
msg.ReadPadBits();
|
||||
|
||||
int index = 0;
|
||||
if (GameMain.NetworkMember.Character == this)
|
||||
{
|
||||
@@ -193,9 +197,6 @@ namespace Barotrauma
|
||||
IsRemotePlayer = ownerID > 0;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
ReadStatus(msg);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -10,19 +10,19 @@ namespace Barotrauma
|
||||
{
|
||||
if (prevTimer % 0.1f > 0.05f && IncubationTimer % 0.1f < 0.05f)
|
||||
{
|
||||
GUI.AddMessage(InfoTextManager.GetInfoText("HuskDormant"), Color.Red, 4.0f);
|
||||
GUI.AddMessage(TextManager.Get("HuskDormant"), Color.Red, 4.0f);
|
||||
}
|
||||
}
|
||||
else if (IncubationTimer < 1.0f)
|
||||
{
|
||||
if (state == InfectionState.Dormant && Character.Controlled == character)
|
||||
{
|
||||
new GUIMessageBox("", InfoTextManager.GetInfoText("HuskCantSpeak"));
|
||||
new GUIMessageBox("", TextManager.Get("HuskCantSpeak"));
|
||||
}
|
||||
}
|
||||
else if (state != InfectionState.Active && Character.Controlled == character)
|
||||
{
|
||||
new GUIMessageBox("", InfoTextManager.GetInfoText("HuskActivate"));
|
||||
new GUIMessageBox("", TextManager.Get("HuskActivate"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Barotrauma
|
||||
private set;
|
||||
}
|
||||
|
||||
string hitSound;
|
||||
private Sound hitSound;
|
||||
|
||||
public string HitSound
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace Barotrauma
|
||||
static GUIFrame frame;
|
||||
static GUIListBox listBox;
|
||||
static GUITextBox textBox;
|
||||
|
||||
|
||||
public static void Init(GameWindow window)
|
||||
{
|
||||
int x = 20, y = 20;
|
||||
@@ -47,7 +47,7 @@ namespace Barotrauma
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
|
||||
NewMessage("Press F3 to open/close the debug console", Color.Cyan);
|
||||
NewMessage("Enter \"help\" for a list of available console commands", Color.Cyan);
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace Barotrauma
|
||||
{
|
||||
textBox.Text = AutoComplete(textBox.Text);
|
||||
}
|
||||
|
||||
|
||||
if (PlayerInput.KeyHit(Keys.Enter))
|
||||
{
|
||||
ExecuteCommand(textBox.Text);
|
||||
@@ -164,7 +164,7 @@ namespace Barotrauma
|
||||
{
|
||||
listBox.children.RemoveRange(0, listBox.children.Count - MaxMessages);
|
||||
}
|
||||
|
||||
|
||||
Messages.Add(msg);
|
||||
if (Messages.Count > MaxMessages)
|
||||
{
|
||||
@@ -190,10 +190,27 @@ namespace Barotrauma
|
||||
|
||||
private static void InitProjectSpecific()
|
||||
{
|
||||
commands.Add(new Command("autohull", "", (string[] args) =>
|
||||
{
|
||||
if (Screen.Selected != GameMain.SubEditorScreen) return;
|
||||
|
||||
if (MapEntity.mapEntityList.Any(e => e is Hull || e is Gap))
|
||||
{
|
||||
ShowQuestionPrompt("This submarine already has hulls and/or gaps. This command will delete them. Do you want to continue? Y/N",
|
||||
(option) => {
|
||||
if (option.ToLower() == "y") GameMain.SubEditorScreen.AutoHull();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
GameMain.SubEditorScreen.AutoHull();
|
||||
}
|
||||
}));
|
||||
|
||||
commands.Add(new Command("startclient", "", (string[] args) =>
|
||||
{
|
||||
if (args.Length == 0) return;
|
||||
|
||||
|
||||
if (GameMain.Client == null)
|
||||
{
|
||||
GameMain.NetworkMember = new GameClient("Name");
|
||||
@@ -227,7 +244,7 @@ namespace Barotrauma
|
||||
}
|
||||
GameMain.SubEditorScreen.Select();
|
||||
}));
|
||||
|
||||
|
||||
commands.Add(new Command("editcharacter", "", (string[] args) =>
|
||||
{
|
||||
GameMain.CharacterEditorScreen.Select();
|
||||
@@ -249,6 +266,13 @@ namespace Barotrauma
|
||||
{
|
||||
Character.Controlled = character;
|
||||
}
|
||||
},
|
||||
() =>
|
||||
{
|
||||
return new string[][]
|
||||
{
|
||||
Character.CharacterList.Select(c => c.Name).Distinct().ToArray()
|
||||
};
|
||||
}));
|
||||
|
||||
commands.Add(new Command("shake", "", (string[] args) =>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Content;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
@@ -427,12 +427,15 @@ namespace Barotrauma
|
||||
ScreenOverlayColor, true);
|
||||
}
|
||||
|
||||
if (GameMain.DebugDraw)
|
||||
if (GameMain.ShowFPS || GameMain.DebugDraw)
|
||||
{
|
||||
DrawString(spriteBatch, new Vector2(10, 10),
|
||||
DrawString(spriteBatch, new Vector2(10, 10),
|
||||
"FPS: " + (int)GameMain.FrameCounter.AverageFramesPerSecond,
|
||||
Color.White, Color.Black * 0.5f, 0, SmallFont);
|
||||
}
|
||||
|
||||
if (GameMain.DebugDraw)
|
||||
{
|
||||
DrawString(spriteBatch, new Vector2(10, 25),
|
||||
"Physics: " + GameMain.World.UpdateTime,
|
||||
Color.White, Color.Black * 0.5f, 0, SmallFont);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using EventInput;
|
||||
using EventInput;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
@@ -129,7 +129,38 @@ namespace Barotrauma
|
||||
{
|
||||
get { return new Vector2(rect.Center.X, rect.Center.Y); }
|
||||
}
|
||||
|
||||
|
||||
protected Rectangle ClampRect(Rectangle r)
|
||||
{
|
||||
if (parent == null) return r;
|
||||
Rectangle parentRect = parent.ClampRect(parent.rect);
|
||||
if (parentRect.Width <= 0 || parentRect.Height <= 0) return Rectangle.Empty;
|
||||
if (parentRect.X > r.X)
|
||||
{
|
||||
int diff = parentRect.X - r.X;
|
||||
r.X = parentRect.X;
|
||||
r.Width -= diff;
|
||||
}
|
||||
if (parentRect.Y > r.Y)
|
||||
{
|
||||
int diff = parentRect.Y - r.Y;
|
||||
r.Y = parentRect.Y;
|
||||
r.Height -= diff;
|
||||
}
|
||||
if (parentRect.X + parentRect.Width < r.X + r.Width)
|
||||
{
|
||||
int diff = (r.X + r.Width) - (parentRect.X + parentRect.Width);
|
||||
r.Width -= diff;
|
||||
}
|
||||
if (parentRect.Y + parentRect.Height < r.Y + r.Height)
|
||||
{
|
||||
int diff = (r.Y + r.Height) - (parentRect.Y + parentRect.Height);
|
||||
r.Height -= diff;
|
||||
}
|
||||
if (r.Width <= 0 || r.Height <= 0) return Rectangle.Empty;
|
||||
return r;
|
||||
}
|
||||
|
||||
public virtual Rectangle Rect
|
||||
{
|
||||
get { return rect; }
|
||||
@@ -162,7 +193,7 @@ namespace Barotrauma
|
||||
|
||||
public virtual Rectangle MouseRect
|
||||
{
|
||||
get { return CanBeFocused ? rect : Rectangle.Empty; }
|
||||
get { return CanBeFocused ? ClampRect(rect) : Rectangle.Empty; }
|
||||
}
|
||||
|
||||
public Dictionary<ComponentState, List<UISprite>> sprites;
|
||||
|
||||
@@ -283,7 +283,7 @@ namespace Barotrauma
|
||||
{
|
||||
get
|
||||
{
|
||||
return rect;
|
||||
return ClampRect(rect);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Barotrauma
|
||||
|
||||
public GUIMessage(string text, Color color, Vector2 position, float lifeTime, Alignment textAlignment, bool autoCenter)
|
||||
{
|
||||
coloredText = new ColoredText(text, color);
|
||||
coloredText = new ColoredText(text, color, false);
|
||||
pos = position;
|
||||
this.lifeTime = lifeTime;
|
||||
this.Alignment = textAlignment;
|
||||
|
||||
@@ -39,30 +39,33 @@ namespace Barotrauma
|
||||
this.Buttons[0].OnClicked = Close;
|
||||
}
|
||||
|
||||
public GUIMessageBox(string headerText, string text, string[] buttons, int width = DefaultWidth, int height = DefaultHeight, Alignment textAlignment = Alignment.TopLeft, GUIComponent parent = null)
|
||||
public GUIMessageBox(string headerText, string text, string[] buttons, int width = DefaultWidth, int height = 0, Alignment textAlignment = Alignment.TopLeft, GUIComponent parent = null)
|
||||
: base(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight),
|
||||
Color.Black * 0.5f, Alignment.TopLeft, null, parent)
|
||||
{
|
||||
int headerHeight = 30;
|
||||
|
||||
var frame = new GUIFrame(new Rectangle(0, 0, width, height), null, Alignment.Center, "", this);
|
||||
GUI.Style.Apply(frame, "", this);
|
||||
|
||||
if (height == 0)
|
||||
{
|
||||
string wrappedText = ToolBox.WrapText(text, width, GUI.Font);
|
||||
string wrappedText = ToolBox.WrapText(text, frame.Rect.Width - frame.Padding.X - frame.Padding.Z, GUI.Font);
|
||||
string[] lines = wrappedText.Split('\n');
|
||||
foreach (string line in lines)
|
||||
{
|
||||
height += (int)GUI.Font.MeasureString(line).Y;
|
||||
}
|
||||
height += 220;
|
||||
height += string.IsNullOrWhiteSpace(headerText) ? 220 : 220 - headerHeight;
|
||||
}
|
||||
frame.Rect = new Rectangle(frame.Rect.X, GameMain.GraphicsHeight / 2 - height/2, frame.Rect.Width, height);
|
||||
|
||||
var frame = new GUIFrame(new Rectangle(0, 0, width, height), null, Alignment.Center, "", this);
|
||||
GUI.Style.Apply(frame, "", this);
|
||||
|
||||
var header = new GUITextBlock(new Rectangle(0, 0, 0, 30), headerText, null, null, textAlignment, "", frame, true);
|
||||
GUI.Style.Apply(header, "", this);
|
||||
var header = new GUITextBlock(new Rectangle(0, 0, 0, headerHeight), headerText, null, null, textAlignment, "", frame, true);
|
||||
GUI.Style.Apply(header, "", this);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
var textBlock = new GUITextBlock(new Rectangle(0, 30, 0, height - 70), text,
|
||||
var textBlock = new GUITextBlock(new Rectangle(0, string.IsNullOrWhiteSpace(headerText) ? 0 : headerHeight, 0, height - 70), text,
|
||||
null, null, textAlignment, "", frame, true);
|
||||
GUI.Style.Apply(textBlock, "", this);
|
||||
}
|
||||
|
||||
@@ -216,8 +216,7 @@ namespace Barotrauma
|
||||
{
|
||||
textBlock.Flash(color);
|
||||
}
|
||||
|
||||
//MouseState previousMouse;
|
||||
|
||||
public override void Update(float deltaTime)
|
||||
{
|
||||
if (!Visible) return;
|
||||
@@ -225,7 +224,7 @@ namespace Barotrauma
|
||||
if (flashTimer > 0.0f) flashTimer -= deltaTime;
|
||||
if (!Enabled) return;
|
||||
|
||||
if (rect.Contains(PlayerInput.MousePosition) && Enabled &&
|
||||
if (MouseRect.Contains(PlayerInput.MousePosition) && Enabled &&
|
||||
(MouseOn == null || MouseOn == this || IsParentOf(MouseOn) || MouseOn.IsParentOf(this)))
|
||||
{
|
||||
state = ComponentState.Hover;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
|
||||
namespace Barotrauma
|
||||
@@ -63,7 +63,7 @@ namespace Barotrauma
|
||||
|
||||
public override Rectangle MouseRect
|
||||
{
|
||||
get { return box.Rect; }
|
||||
get { return ClampRect(box.Rect); }
|
||||
}
|
||||
|
||||
public override ScalableFont Font
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Barotrauma.Networking;
|
||||
using Barotrauma.Networking;
|
||||
using Barotrauma.Particles;
|
||||
using FarseerPhysics;
|
||||
using FarseerPhysics.Dynamics;
|
||||
@@ -14,6 +14,7 @@ namespace Barotrauma
|
||||
{
|
||||
class GameMain : Game
|
||||
{
|
||||
public static bool ShowFPS = true;
|
||||
public static bool DebugDraw;
|
||||
|
||||
public static FrameCounter FrameCounter;
|
||||
@@ -224,7 +225,7 @@ namespace Barotrauma
|
||||
DebugConsole.Log(SelectedPackage == null ? "No content package selected" : "Content package \"" + SelectedPackage.Name + "\" selected");
|
||||
yield return CoroutineStatus.Running;
|
||||
|
||||
LightManager = new Lights.LightManager(base.GraphicsDevice);
|
||||
LightManager = new Lights.LightManager(base.GraphicsDevice, Content);
|
||||
|
||||
Hull.renderer = new WaterRenderer(base.GraphicsDevice, Content);
|
||||
TitleScreen.LoadState = 1.0f;
|
||||
@@ -292,6 +293,7 @@ namespace Barotrauma
|
||||
yield return CoroutineStatus.Running;
|
||||
|
||||
ParticleManager = new ParticleManager("Content/Particles/ParticlePrefabs.xml", GameScreen.Cam);
|
||||
ParticleManager.LoadPrefabs();
|
||||
DecalManager = new DecalManager("Content/Particles/DecalPrefabs.xml");
|
||||
yield return CoroutineStatus.Running;
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace Barotrauma
|
||||
img.Color = order.Color;
|
||||
img.CanBeFocused = false;
|
||||
|
||||
orderListBox.children[characterIndex].ToolTip = "Order: " + order.Name;
|
||||
orderListBox.children[characterIndex].ToolTip = TextManager.Get("Order") + ": " + order.Name;
|
||||
}
|
||||
|
||||
public bool SelectCharacterOrder(GUIComponent component, object selection)
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace Barotrauma
|
||||
{
|
||||
partial class TraitorManager
|
||||
{
|
||||
public static void CreateStartPopUp(string targetName)
|
||||
{
|
||||
new GUIMessageBox("You are the Traitor!",
|
||||
"Your secret task is to assassinate " + targetName + "! Discretion is an utmost concern; sinking the submarine and killing the entire crew "
|
||||
+ "will arouse suspicion amongst the Fleet. If possible, make the death look like an accident.", 400, 350);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,22 +48,22 @@ namespace Barotrauma
|
||||
|
||||
innerFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
||||
|
||||
var crewButton = new GUIButton(new Rectangle(0, -30, 100, 20), "Crew", "", innerFrame);
|
||||
var crewButton = new GUIButton(new Rectangle(0, -30, 100, 20), TextManager.Get("Crew"), "", innerFrame);
|
||||
crewButton.UserData = InfoFrameTab.Crew;
|
||||
crewButton.OnClicked = SelectInfoFrameTab;
|
||||
|
||||
var missionButton = new GUIButton(new Rectangle(100, -30, 100, 20), "Mission", "", innerFrame);
|
||||
var missionButton = new GUIButton(new Rectangle(100, -30, 100, 20), TextManager.Get("Mission"), "", innerFrame);
|
||||
missionButton.UserData = InfoFrameTab.Mission;
|
||||
missionButton.OnClicked = SelectInfoFrameTab;
|
||||
|
||||
if (GameMain.Server != null)
|
||||
{
|
||||
var manageButton = new GUIButton(new Rectangle(200, -30, 130, 20), "Manage players", "", innerFrame);
|
||||
var manageButton = new GUIButton(new Rectangle(200, -30, 130, 20), TextManager.Get("ManagePlayers"), "", innerFrame);
|
||||
manageButton.UserData = InfoFrameTab.ManagePlayers;
|
||||
manageButton.OnClicked = SelectInfoFrameTab;
|
||||
}
|
||||
|
||||
var closeButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Close", Alignment.BottomCenter, "", innerFrame);
|
||||
var closeButton = new GUIButton(new Rectangle(0, 0, 80, 20), TextManager.Get("Close"), Alignment.BottomCenter, "", innerFrame);
|
||||
closeButton.OnClicked = ToggleInfoFrame;
|
||||
|
||||
}
|
||||
@@ -94,16 +94,14 @@ namespace Barotrauma
|
||||
{
|
||||
if (Mission == null)
|
||||
{
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 50), "No mission", "", infoFrame, true);
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 50), TextManager.Get("NoMission"), "", infoFrame, true);
|
||||
return;
|
||||
}
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 40), Mission.Name, "", infoFrame, GUI.LargeFont);
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 50, 0, 20), "Reward: " + Mission.Reward, "", infoFrame, true);
|
||||
new GUITextBlock(new Rectangle(0, 50, 0, 20), TextManager.Get("MissionReward").Replace("[reward]", Mission.Reward.ToString()), "", infoFrame, true);
|
||||
new GUITextBlock(new Rectangle(0, 70, 0, 50), Mission.Description, "", infoFrame, true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void AddToGUIUpdateList()
|
||||
|
||||
@@ -43,8 +43,12 @@ namespace Barotrauma
|
||||
SoundPlayer.OverrideMusicType = gameOver ? "crewdead" : "endround";
|
||||
}
|
||||
|
||||
string summaryText = InfoTextManager.GetInfoText(gameOver ? "gameover" :
|
||||
(progress ? "progress" : "return"));
|
||||
string summaryText = TextManager.Get(gameOver ? "RoundSummaryGameOver" :
|
||||
(progress ? "RoundSummaryProgress" : "RoundSummaryReturn"));
|
||||
|
||||
summaryText = summaryText
|
||||
.Replace("[sub]", Submarine.MainSub.Name)
|
||||
.Replace("[location]", GameMain.GameSession.StartLocation.Name);
|
||||
|
||||
var infoText = new GUITextBlock(new Rectangle(0, y, 0, 50), summaryText, "", innerFrame, true);
|
||||
y += infoText.Rect.Height;
|
||||
@@ -56,7 +60,7 @@ namespace Barotrauma
|
||||
y += 30 + endText.Text.Split('\n').Length * 20;
|
||||
}
|
||||
|
||||
new GUITextBlock(new Rectangle(0, y, 0, 20), "Crew status:", "", innerFrame, GUI.LargeFont);
|
||||
new GUITextBlock(new Rectangle(0, y, 0, 20), TextManager.Get("RoundSummaryCrewStatus"), "", innerFrame, GUI.LargeFont);
|
||||
y += 30;
|
||||
|
||||
GUIListBox listBox = new GUIListBox(new Rectangle(0,y,0,90), null, Alignment.TopLeft, "", innerFrame, true);
|
||||
@@ -78,25 +82,25 @@ namespace Barotrauma
|
||||
characterInfo.CreateCharacterFrame(characterFrame,
|
||||
characterInfo.Job != null ? (characterInfo.Name + '\n' + "(" + characterInfo.Job.Name + ")") : characterInfo.Name, null);
|
||||
|
||||
string statusText = "OK";
|
||||
string statusText = TextManager.Get("StatusOK");
|
||||
Color statusColor = Color.DarkGreen;
|
||||
|
||||
Character character = characterInfo.Character;
|
||||
if (character == null || character.IsDead)
|
||||
{
|
||||
statusText = InfoTextManager.GetInfoText("CauseOfDeath." + characterInfo.CauseOfDeath.ToString());
|
||||
statusText = TextManager.Get("CauseOfDeath." + characterInfo.CauseOfDeath.ToString());
|
||||
statusColor = Color.DarkRed;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (character.IsUnconscious)
|
||||
{
|
||||
statusText = "Unconscious";
|
||||
statusText = TextManager.Get("Unconscious");
|
||||
statusColor = Color.DarkOrange;
|
||||
}
|
||||
else if (character.Health / character.MaxHealth < 0.8f)
|
||||
{
|
||||
statusText = "Injured";
|
||||
statusText = TextManager.Get("Injured");
|
||||
statusColor = Color.DarkOrange;
|
||||
}
|
||||
}
|
||||
@@ -113,7 +117,7 @@ namespace Barotrauma
|
||||
|
||||
if (GameMain.GameSession.Mission != null)
|
||||
{
|
||||
new GUITextBlock(new Rectangle(0, y, 0, 20), "Mission: " + GameMain.GameSession.Mission.Name, "", innerFrame, GUI.LargeFont);
|
||||
new GUITextBlock(new Rectangle(0, y, 0, 20), TextManager.Get("Mission") + ": " + GameMain.GameSession.Mission.Name, "", innerFrame, GUI.LargeFont);
|
||||
y += 30;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, y, innerFrame.Rect.Width - 170, 0),
|
||||
@@ -127,7 +131,7 @@ namespace Barotrauma
|
||||
|
||||
if (GameMain.GameSession.Mission.Completed && singleplayer)
|
||||
{
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 30), "Reward: " + GameMain.GameSession.Mission.Reward, "", Alignment.BottomLeft, Alignment.BottomLeft, innerFrame);
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 30), TextManager.Get("Reward") + ": " + GameMain.GameSession.Mission.Reward, "", Alignment.BottomLeft, Alignment.BottomLeft, innerFrame);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -52,11 +52,11 @@ namespace Barotrauma
|
||||
{
|
||||
settingsFrame = new GUIFrame(new Rectangle(0, 0, 500, 500), null, Alignment.Center, "");
|
||||
|
||||
new GUITextBlock(new Rectangle(0, -30, 0, 30), "Settings", "", Alignment.TopCenter, Alignment.TopCenter, settingsFrame, false, GUI.LargeFont);
|
||||
new GUITextBlock(new Rectangle(0, -30, 0, 30), TextManager.Get("Settings"), "", Alignment.TopCenter, Alignment.TopCenter, settingsFrame, false, GUI.LargeFont);
|
||||
|
||||
int x = 0, y = 10;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, y, 20, 20), "Resolution", "", Alignment.TopLeft, Alignment.TopLeft, settingsFrame);
|
||||
new GUITextBlock(new Rectangle(0, y, 20, 20), TextManager.Get("Resolution"), "", Alignment.TopLeft, Alignment.TopLeft, settingsFrame);
|
||||
var resolutionDD = new GUIDropDown(new Rectangle(0, y + 20, 180, 20), "", "", settingsFrame);
|
||||
resolutionDD.OnSelected = SelectResolution;
|
||||
|
||||
@@ -82,11 +82,11 @@ namespace Barotrauma
|
||||
//fullScreenTick.OnSelected = ToggleFullScreen;
|
||||
//fullScreenTick.Selected = FullScreenEnabled;
|
||||
|
||||
new GUITextBlock(new Rectangle(x, y, 20, 20), "Display mode", "", Alignment.TopLeft, Alignment.TopLeft, settingsFrame);
|
||||
new GUITextBlock(new Rectangle(x, y, 20, 20), TextManager.Get("DisplayMode"), "", Alignment.TopLeft, Alignment.TopLeft, settingsFrame);
|
||||
var displayModeDD = new GUIDropDown(new Rectangle(x, y + 20, 180, 20), "", "", settingsFrame);
|
||||
displayModeDD.AddItem("Fullscreen", WindowMode.Fullscreen);
|
||||
displayModeDD.AddItem("Windowed", WindowMode.Windowed);
|
||||
displayModeDD.AddItem("Borderless windowed", WindowMode.BorderlessWindowed);
|
||||
displayModeDD.AddItem(TextManager.Get("Fullscreen"), WindowMode.Fullscreen);
|
||||
displayModeDD.AddItem(TextManager.Get("Windowed"), WindowMode.Windowed);
|
||||
displayModeDD.AddItem(TextManager.Get("BorderlessWindowed"), WindowMode.BorderlessWindowed);
|
||||
|
||||
displayModeDD.SelectItem(GameMain.Config.WindowMode);
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Barotrauma
|
||||
|
||||
y += 70;
|
||||
|
||||
GUITickBox vsyncTickBox = new GUITickBox(new Rectangle(0, y, 20, 20), "Enable vertical sync", Alignment.CenterY | Alignment.Left, settingsFrame);
|
||||
GUITickBox vsyncTickBox = new GUITickBox(new Rectangle(0, y, 20, 20), TextManager.Get("EnableVSync"), Alignment.CenterY | Alignment.Left, settingsFrame);
|
||||
vsyncTickBox.OnSelected = (GUITickBox box) =>
|
||||
{
|
||||
VSyncEnabled = !VSyncEnabled;
|
||||
@@ -108,13 +108,13 @@ namespace Barotrauma
|
||||
|
||||
y += 70;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, y, 100, 20), "Sound volume:", "", settingsFrame);
|
||||
new GUITextBlock(new Rectangle(0, y, 100, 20), TextManager.Get("SoundVolume"), "", settingsFrame);
|
||||
GUIScrollBar soundScrollBar = new GUIScrollBar(new Rectangle(0, y + 20, 150, 20), "", 0.1f, settingsFrame);
|
||||
soundScrollBar.BarScroll = SoundVolume;
|
||||
soundScrollBar.OnMoved = ChangeSoundVolume;
|
||||
soundScrollBar.Step = 0.05f;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, y + 40, 100, 20), "Music volume:", "", settingsFrame);
|
||||
new GUITextBlock(new Rectangle(0, y + 40, 100, 20), TextManager.Get("MusicVolume"), "", settingsFrame);
|
||||
GUIScrollBar musicScrollBar = new GUIScrollBar(new Rectangle(0, y + 60, 150, 20), "", 0.1f, settingsFrame);
|
||||
musicScrollBar.BarScroll = MusicVolume;
|
||||
musicScrollBar.OnMoved = ChangeMusicVolume;
|
||||
@@ -123,7 +123,7 @@ namespace Barotrauma
|
||||
x = 200;
|
||||
y = 10;
|
||||
|
||||
new GUITextBlock(new Rectangle(x, y, 20, 20), "Content package", "", Alignment.TopLeft, Alignment.TopLeft, settingsFrame);
|
||||
new GUITextBlock(new Rectangle(x, y, 20, 20), TextManager.Get("ContentPackage"), "", Alignment.TopLeft, Alignment.TopLeft, settingsFrame);
|
||||
var contentPackageDD = new GUIDropDown(new Rectangle(x, y + 20, 200, 20), "", "", settingsFrame);
|
||||
contentPackageDD.OnSelected = SelectContentPackage;
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
y += 50;
|
||||
new GUITextBlock(new Rectangle(x, y, 100, 20), "Controls:", "", settingsFrame);
|
||||
new GUITextBlock(new Rectangle(x, y, 100, 20), TextManager.Get("Controls"), "", settingsFrame);
|
||||
y += 30;
|
||||
var inputNames = Enum.GetNames(typeof(InputType));
|
||||
for (int i = 0; i < inputNames.Length; i++)
|
||||
@@ -151,7 +151,7 @@ namespace Barotrauma
|
||||
y += 20;
|
||||
}
|
||||
|
||||
applyButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Apply", Alignment.BottomRight, "", settingsFrame);
|
||||
applyButton = new GUIButton(new Rectangle(0, 0, 100, 20), TextManager.Get("ApplySettingsButton"), Alignment.BottomRight, "", settingsFrame);
|
||||
applyButton.OnClicked = ApplyClicked;
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ namespace Barotrauma
|
||||
|
||||
if (GameMain.GraphicsWidth != GameMain.Config.GraphicsWidth || GameMain.GraphicsHeight != GameMain.Config.GraphicsHeight)
|
||||
{
|
||||
new GUIMessageBox("Restart required", "You need to restart the game for the resolution changes to take effect.");
|
||||
new GUIMessageBox(TextManager.Get("RestartRequiredLabel"), TextManager.Get("RestartRequiredText"));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -119,7 +120,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
|
||||
public override void Update(float deltaTime, bool subInventory = false)
|
||||
public override void Update(float deltaTime, bool isSubInventory = false)
|
||||
{
|
||||
base.Update(deltaTime);
|
||||
|
||||
@@ -161,19 +162,39 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
draggingItem = null;
|
||||
GUI.PlayUISound(wasPut ? GUISoundType.PickItem : GUISoundType.PickItemFail);
|
||||
}
|
||||
|
||||
if (selectedSlot > -1)
|
||||
|
||||
if (highlightedSubInventorySlot != null)
|
||||
{
|
||||
UpdateSubInventory(deltaTime, selectedSlot);
|
||||
UpdateSubInventory(deltaTime, highlightedSubInventorySlot.SlotIndex);
|
||||
if (highlightedSubInventory.slots == null ||
|
||||
(!highlightedSubInventorySlot.Slot.InteractRect.Contains(PlayerInput.MousePosition) && !highlightedSubInventory.slots.Any(s => s.InteractRect.Contains(PlayerInput.MousePosition))))
|
||||
{
|
||||
highlightedSubInventory = null;
|
||||
highlightedSubInventorySlot = null;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (selectedSlot?.Inventory == this)
|
||||
{
|
||||
var subInventory = GetSubInventory(selectedSlot.SlotIndex);
|
||||
if (subInventory != null)
|
||||
{
|
||||
highlightedSubInventory = subInventory;
|
||||
highlightedSubInventorySlot = selectedSlot;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (character == Character.Controlled)
|
||||
{
|
||||
for (int i = 0; i < capacity; i++)
|
||||
{
|
||||
if (selectedSlot != i &&
|
||||
if ((selectedSlot == null || selectedSlot.SlotIndex != i) &&
|
||||
Items[i] != null && Items[i].CanUseOnSelf && character.HasSelectedItem(Items[i]))
|
||||
{
|
||||
//-3 because selected items are in slots 3 and 4 (hands)
|
||||
@@ -224,7 +245,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
selectedSlot = -1;
|
||||
selectedSlot = null;
|
||||
}
|
||||
|
||||
public void DrawOwn(SpriteBatch spriteBatch)
|
||||
@@ -274,7 +295,7 @@ namespace Barotrauma
|
||||
{
|
||||
for (int i = 0; i < capacity; i++)
|
||||
{
|
||||
if (selectedSlot != i &&
|
||||
if ((selectedSlot == null || selectedSlot.SlotIndex != i) &&
|
||||
Items[i] != null && Items[i].CanUseOnSelf && character.HasSelectedItem(Items[i]))
|
||||
{
|
||||
useOnSelfButton[i - 3].Draw(spriteBatch);
|
||||
@@ -282,15 +303,11 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedSlot > -1)
|
||||
for (int i = 0; i < capacity; i++)
|
||||
{
|
||||
DrawSubInventory(spriteBatch, selectedSlot);
|
||||
|
||||
if (selectedSlot > -1 &&
|
||||
!slots[selectedSlot].IsHighlighted &&
|
||||
(draggingItem == null || draggingItem.Container != Items[selectedSlot]))
|
||||
if (slots[i].IsHighlighted)
|
||||
{
|
||||
selectedSlot = -1;
|
||||
DrawSubInventory(spriteBatch, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
GuiFrame.Draw(spriteBatch);
|
||||
|
||||
if (voltage < minVoltage && powerConsumption > 0.0f) return;
|
||||
if (voltage < minVoltage && currPowerConsumption > 0.0f) return;
|
||||
|
||||
Rectangle velRect = new Rectangle(x + 20, y + 20, width - 40, height - 40);
|
||||
//GUI.DrawRectangle(spriteBatch, velRect, Color.White, false);
|
||||
@@ -136,6 +136,8 @@ namespace Barotrauma.Items.Components
|
||||
public override void UpdateHUD(Character character)
|
||||
{
|
||||
GuiFrame.Update(1.0f / 60.0f);
|
||||
|
||||
if (voltage < minVoltage && currPowerConsumption > 0.0f) return;
|
||||
|
||||
if (Vector2.Distance(PlayerInput.MousePosition, new Vector2(GuiFrame.Rect.Center.X, GuiFrame.Rect.Center.Y)) < 200.0f)
|
||||
{
|
||||
|
||||
@@ -182,8 +182,8 @@ namespace Barotrauma.Items.Components
|
||||
GameServer.Log(Character.Controlled.LogName + " connected a wire from " +
|
||||
Item.Name + " (" + Name + ") to " + otherConnection.item.Name + " (" + otherConnection.Name + ")", ServerLog.MessageType.ItemInteraction);
|
||||
}
|
||||
|
||||
Wires[index] = draggingConnected;
|
||||
|
||||
AddLink(index, draggingConnected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Barotrauma.Items.Components
|
||||
{
|
||||
@@ -36,6 +37,12 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
private static Sprite wireSprite;
|
||||
|
||||
private static Wire draggingWire;
|
||||
private static int? selectedNodeIndex;
|
||||
private static int? highlightedNodeIndex;
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch, bool editing)
|
||||
{
|
||||
if (sections.Count == 0 && !IsActive)
|
||||
@@ -69,7 +76,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
foreach (WireSection section in sections)
|
||||
{
|
||||
section.Draw(spriteBatch, item.Color, drawOffset, depth, 0.3f);
|
||||
section.Draw(spriteBatch, item.Submarine == null ? Color.Green : item.Color, drawOffset, depth, 0.3f);
|
||||
}
|
||||
|
||||
if (IsActive && nodes.Count > 0 && Vector2.Distance(newNodePos, nodes[nodes.Count - 1]) > nodeDistance)
|
||||
@@ -91,14 +98,15 @@ namespace Barotrauma.Items.Components
|
||||
if (item.Submarine != null) drawPos += item.Submarine.Position + item.Submarine.HiddenSubPosition;
|
||||
drawPos.Y = -drawPos.Y;
|
||||
|
||||
if ((highlightedNodeIndex == i && item.IsHighlighted) || (selectedNodeIndex == i && item.IsSelected))
|
||||
{
|
||||
GUI.DrawRectangle(spriteBatch, drawPos + new Vector2(-10, -10), new Vector2(20, 20), Color.Red, false, 0.0f);
|
||||
}
|
||||
|
||||
if (item.IsSelected)
|
||||
{
|
||||
GUI.DrawRectangle(spriteBatch, drawPos + new Vector2(-5, -5), new Vector2(10, 10), item.Color, true, 0.0f);
|
||||
|
||||
if (highlightedNodeIndex == i)
|
||||
{
|
||||
GUI.DrawRectangle(spriteBatch, drawPos + new Vector2(-10, -10), new Vector2(20, 20), Color.Red, false, 0.0f);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -196,28 +204,36 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
//check which wire is highlighted with the cursor
|
||||
Wire highlighted = null;
|
||||
float closestDist = 0.0f;
|
||||
float closestDist = float.PositiveInfinity;
|
||||
foreach (Wire w in wires)
|
||||
{
|
||||
Vector2 mousePos = GameMain.SubEditorScreen.Cam.ScreenToWorld(PlayerInput.MousePosition);
|
||||
if (w.item.Submarine != null) mousePos -= (w.item.Submarine.Position + w.item.Submarine.HiddenSubPosition);
|
||||
|
||||
float dist = 0.0f;
|
||||
if (w.GetClosestNodeIndex(mousePos, highlighted == null ? nodeSelectDist : closestDist, out dist) > -1)
|
||||
int highlightedNode = w.GetClosestNodeIndex(mousePos, highlighted == null ? nodeSelectDist : closestDist, out dist);
|
||||
if (highlightedNode > -1)
|
||||
{
|
||||
highlighted = w;
|
||||
closestDist = dist;
|
||||
if (dist < closestDist)
|
||||
{
|
||||
highlightedNodeIndex = highlightedNode;
|
||||
highlighted = w;
|
||||
closestDist = dist;
|
||||
}
|
||||
}
|
||||
|
||||
if (w.GetClosestSectionIndex(mousePos, highlighted == null ? sectionSelectDist : closestDist, out dist) > -1)
|
||||
{
|
||||
highlighted = w;
|
||||
closestDist = dist;
|
||||
//prefer nodes over sections
|
||||
if (dist + nodeSelectDist * 0.5f < closestDist)
|
||||
{
|
||||
highlightedNodeIndex = null;
|
||||
highlighted = w;
|
||||
closestDist = dist + nodeSelectDist * 0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (highlighted != null)
|
||||
{
|
||||
highlighted.item.IsHighlighted = true;
|
||||
|
||||
@@ -90,14 +90,26 @@ namespace Barotrauma.Items.Components
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight),
|
||||
Color.Green * 0.1f, true);
|
||||
|
||||
Character closestCharacter = null;
|
||||
float closestDist = float.PositiveInfinity;
|
||||
|
||||
foreach (Character c in visibleCharacters)
|
||||
{
|
||||
if (c == character) continue;
|
||||
|
||||
float dist = Vector2.Distance(character.WorldPosition, c.WorldPosition);
|
||||
DrawCharacterInfo(spriteBatch, c, 1.0f - MathHelper.Max((dist - (Range - FadeOutRange)) / FadeOutRange, 0.0f));
|
||||
float dist = Vector2.DistanceSquared(GameMain.GameScreen.Cam.ScreenToWorld(PlayerInput.MousePosition), c.WorldPosition);
|
||||
if (dist < closestDist)
|
||||
{
|
||||
closestCharacter = c;
|
||||
closestDist = dist;
|
||||
}
|
||||
}
|
||||
|
||||
if (closestCharacter != null)
|
||||
{
|
||||
float dist = Vector2.Distance(GameMain.GameScreen.Cam.ScreenToWorld(PlayerInput.MousePosition), closestCharacter.WorldPosition);
|
||||
DrawCharacterInfo(spriteBatch, closestCharacter, 1.0f - MathHelper.Max((dist - (Range - FadeOutRange)) / FadeOutRange, 0.0f));
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawCharacterInfo(SpriteBatch spriteBatch, Character target, float alpha = 1.0f)
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace Barotrauma
|
||||
frame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
|
||||
frame.UserData = item;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 0, 200, 20), "Attempting to fix " + item.Name, "", frame);
|
||||
new GUITextBlock(new Rectangle(0, 0, 200, 20), TextManager.Get("FixHeader").Replace("[itemname]", item.Name), "", frame);
|
||||
|
||||
y = y + 40;
|
||||
foreach (FixRequirement requirement in item.FixRequirements)
|
||||
@@ -60,7 +60,7 @@ namespace Barotrauma
|
||||
reqFrame.UserData = requirement;
|
||||
|
||||
|
||||
var fixButton = new GUIButton(new Rectangle(0, 0, 50, 20), "Fix", "", reqFrame);
|
||||
var fixButton = new GUIButton(new Rectangle(0, 0, 50, 20), TextManager.Get("Fix"), "", reqFrame);
|
||||
fixButton.OnClicked = FixButtonPressed;
|
||||
fixButton.UserData = requirement;
|
||||
|
||||
|
||||
@@ -68,6 +68,22 @@ namespace Barotrauma
|
||||
|
||||
partial class Inventory
|
||||
{
|
||||
protected class SlotReference
|
||||
{
|
||||
public readonly Inventory Inventory;
|
||||
public readonly InventorySlot Slot;
|
||||
public readonly int SlotIndex;
|
||||
|
||||
public bool IsSubSlot;
|
||||
|
||||
public SlotReference(Inventory inventory, InventorySlot slot, int slotIndex, bool isSubSlot)
|
||||
{
|
||||
Inventory = inventory;
|
||||
Slot = slot;
|
||||
SlotIndex = slotIndex;
|
||||
IsSubSlot = isSubSlot;
|
||||
}
|
||||
}
|
||||
|
||||
public static InventorySlot draggingSlot;
|
||||
public static Item draggingItem;
|
||||
@@ -80,9 +96,12 @@ namespace Barotrauma
|
||||
set { slotsPerRow = Math.Max(1, value); }
|
||||
}
|
||||
|
||||
protected int selectedSlot = -1;
|
||||
protected static SlotReference highlightedSubInventorySlot;
|
||||
protected static Inventory highlightedSubInventory;
|
||||
|
||||
protected InventorySlot[] slots;
|
||||
protected static SlotReference selectedSlot;
|
||||
|
||||
public InventorySlot[] slots;
|
||||
|
||||
private Vector2 centerPos;
|
||||
|
||||
@@ -135,6 +154,11 @@ namespace Barotrauma
|
||||
|
||||
slots[i] = new InventorySlot(slotRect);
|
||||
}
|
||||
|
||||
if (selectedSlot != null && selectedSlot.Inventory == this)
|
||||
{
|
||||
selectedSlot = new SlotReference(this, slots[selectedSlot.SlotIndex], selectedSlot.SlotIndex, selectedSlot.IsSubSlot);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Update(float deltaTime, bool subInventory = false)
|
||||
@@ -150,22 +174,8 @@ namespace Barotrauma
|
||||
for (int i = 0; i < capacity; i++)
|
||||
{
|
||||
if (slots[i].Disabled) continue;
|
||||
UpdateSlot(slots[i], i, Items[i], false);
|
||||
UpdateSlot(slots[i], i, Items[i], subInventory);
|
||||
}
|
||||
|
||||
|
||||
if (draggingItem != null &&
|
||||
(draggingSlot == null || (!draggingSlot.InteractRect.Contains(PlayerInput.MousePosition) && draggingItem.ParentInventory == this)))
|
||||
{
|
||||
if (!PlayerInput.LeftButtonHeld())
|
||||
{
|
||||
CreateNetworkEvent();
|
||||
draggingItem.Drop();
|
||||
|
||||
GUI.PlayUISound(GUISoundType.DropItem);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void UpdateSlot(InventorySlot slot, int slotIndex, Item item, bool isSubSlot)
|
||||
@@ -173,20 +183,16 @@ namespace Barotrauma
|
||||
bool mouseOn = slot.InteractRect.Contains(PlayerInput.MousePosition) && !Locked;
|
||||
|
||||
slot.State = GUIComponent.ComponentState.None;
|
||||
|
||||
if (!(this is CharacterInventory) && !mouseOn && selectedSlot == slotIndex)
|
||||
{
|
||||
selectedSlot = -1;
|
||||
}
|
||||
|
||||
|
||||
if (mouseOn &&
|
||||
(draggingItem != null || selectedSlot == slotIndex || selectedSlot == -1))
|
||||
(draggingItem != null || selectedSlot == null || selectedSlot.Slot == slot) &&
|
||||
(highlightedSubInventory == null || highlightedSubInventory == this || highlightedSubInventorySlot?.Slot == slot))
|
||||
{
|
||||
slot.State = GUIComponent.ComponentState.Hover;
|
||||
|
||||
if (!isSubSlot && selectedSlot == -1)
|
||||
if (selectedSlot == null || (!selectedSlot.IsSubSlot && isSubSlot))
|
||||
{
|
||||
selectedSlot = slotIndex;
|
||||
selectedSlot = new SlotReference(this, slot, slotIndex, isSubSlot);
|
||||
}
|
||||
|
||||
if (draggingItem == null)
|
||||
@@ -203,38 +209,29 @@ namespace Barotrauma
|
||||
{
|
||||
doubleClickedItem = item;
|
||||
}
|
||||
|
||||
if (draggingItem != Items[slotIndex])
|
||||
{
|
||||
//selectedSlot = slotIndex;
|
||||
if (TryPutItem(draggingItem, slotIndex, true, Character.Controlled))
|
||||
{
|
||||
if (slots != null) slots[slotIndex].ShowBorderHighlight(Color.White, 0.1f, 0.4f);
|
||||
GUI.PlayUISound(GUISoundType.PickItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (slots != null) slots[slotIndex].ShowBorderHighlight(Color.Red, 0.1f, 0.9f);
|
||||
GUI.PlayUISound(GUISoundType.PickItemFail);
|
||||
}
|
||||
draggingItem = null;
|
||||
draggingSlot = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected Inventory GetSubInventory(int slotIndex)
|
||||
{
|
||||
var item = Items[slotIndex];
|
||||
if (item == null) return null;
|
||||
|
||||
var container = item.GetComponent<ItemContainer>();
|
||||
if (container == null) return null;
|
||||
|
||||
return container.Inventory;
|
||||
}
|
||||
|
||||
public void UpdateSubInventory(float deltaTime, int slotIndex)
|
||||
{
|
||||
var item = Items[slotIndex];
|
||||
if (item == null) return;
|
||||
Inventory subInventory = GetSubInventory(slotIndex);
|
||||
if (subInventory == null) return;
|
||||
|
||||
var container = item.GetComponent<ItemContainer>();
|
||||
if (container == null) return;
|
||||
if (subInventory.slots == null) subInventory.CreateSlots();
|
||||
|
||||
if (container.Inventory.slots == null) container.Inventory.CreateSlots();
|
||||
|
||||
int itemCapacity = container.Capacity;
|
||||
int itemCapacity = subInventory.Items.Length;
|
||||
|
||||
var slot = slots[slotIndex];
|
||||
new Rectangle(slot.Rect.X - 5, slot.Rect.Y - (40 + 10) * itemCapacity - 5,
|
||||
@@ -246,17 +243,17 @@ namespace Barotrauma
|
||||
for (int i = 0; i < itemCapacity; i++)
|
||||
{
|
||||
subRect.Y = subRect.Y - subRect.Height - 10;
|
||||
container.Inventory.slots[i].Rect = subRect;
|
||||
container.Inventory.slots[i].InteractRect = subRect;
|
||||
container.Inventory.slots[i].InteractRect.Inflate(5, 5);
|
||||
subInventory.slots[i].Rect = subRect;
|
||||
subInventory.slots[i].InteractRect = subRect;
|
||||
subInventory.slots[i].InteractRect.Inflate(5, 5);
|
||||
|
||||
}
|
||||
|
||||
container.Inventory.isSubInventory = true;
|
||||
subInventory.isSubInventory = true;
|
||||
|
||||
slots[slotIndex].State = GUIComponent.ComponentState.Hover;
|
||||
|
||||
container.Inventory.Update(deltaTime, true);
|
||||
subInventory.Update(deltaTime, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -274,17 +271,6 @@ namespace Barotrauma
|
||||
DrawSlot(spriteBatch, slots[i], Items[i], drawItem);
|
||||
}
|
||||
|
||||
if (draggingItem != null &&
|
||||
(draggingSlot == null || (!draggingSlot.InteractRect.Contains(PlayerInput.MousePosition) && draggingItem.ParentInventory == this)))
|
||||
{
|
||||
Rectangle dragRect = new Rectangle(
|
||||
(int)PlayerInput.MousePosition.X - 10,
|
||||
(int)PlayerInput.MousePosition.Y - 10,
|
||||
40, 40);
|
||||
|
||||
DrawSlot(spriteBatch, new InventorySlot(dragRect), draggingItem);
|
||||
}
|
||||
|
||||
for (int i = 0; i < capacity; i++)
|
||||
{
|
||||
if (slots[i].InteractRect.Contains(PlayerInput.MousePosition) && !slots[i].Disabled && Items[i] != null)
|
||||
@@ -373,9 +359,57 @@ namespace Barotrauma
|
||||
|
||||
container.Inventory.Draw(spriteBatch, true);
|
||||
|
||||
if (!containerRect.Contains(PlayerInput.MousePosition))
|
||||
}
|
||||
|
||||
public static void UpdateDragging()
|
||||
{
|
||||
if (draggingItem != null && PlayerInput.LeftButtonReleased())
|
||||
{
|
||||
if (draggingItem == null || draggingItem.Container != item) selectedSlot = -1;
|
||||
if (selectedSlot == null)
|
||||
{
|
||||
draggingItem.ParentInventory?.CreateNetworkEvent();
|
||||
draggingItem.Drop();
|
||||
GUI.PlayUISound(GUISoundType.DropItem);
|
||||
}
|
||||
else if (selectedSlot.Inventory.Items[selectedSlot.SlotIndex] != draggingItem)
|
||||
{
|
||||
Inventory selectedInventory = selectedSlot.Inventory;
|
||||
int slotIndex = selectedSlot.SlotIndex;
|
||||
if (selectedInventory.TryPutItem(draggingItem, slotIndex, true, Character.Controlled))
|
||||
{
|
||||
if (selectedInventory.slots != null) selectedInventory.slots[slotIndex].ShowBorderHighlight(Color.White, 0.1f, 0.4f);
|
||||
GUI.PlayUISound(GUISoundType.PickItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (selectedInventory.slots != null) selectedInventory.slots[slotIndex].ShowBorderHighlight(Color.Red, 0.1f, 0.9f);
|
||||
GUI.PlayUISound(GUISoundType.PickItemFail);
|
||||
}
|
||||
draggingItem = null;
|
||||
draggingSlot = null;
|
||||
}
|
||||
|
||||
draggingItem = null;
|
||||
}
|
||||
|
||||
if (selectedSlot != null && !selectedSlot.Slot.InteractRect.Contains(PlayerInput.MousePosition))
|
||||
{
|
||||
selectedSlot = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void DrawDragging(SpriteBatch spriteBatch)
|
||||
{
|
||||
if (draggingItem == null) return;
|
||||
|
||||
if (draggingSlot == null || (!draggingSlot.InteractRect.Contains(PlayerInput.MousePosition)))
|
||||
{
|
||||
Rectangle dragRect = new Rectangle(
|
||||
(int)PlayerInput.MousePosition.X - 10,
|
||||
(int)PlayerInput.MousePosition.Y - 10,
|
||||
40, 40);
|
||||
|
||||
DrawSlot(spriteBatch, new InventorySlot(dragRect), draggingItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -470,7 +470,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
body.FarseerBody.Enabled = false;
|
||||
body.Enabled = false;
|
||||
}
|
||||
|
||||
if ((newPosition - SimPosition).Length() > body.LinearVelocity.Length() * 2.0f)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Barotrauma.Lights;
|
||||
using Barotrauma.Lights;
|
||||
using Barotrauma.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
@@ -76,9 +76,9 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
lightSource.Range = Math.Max(size.X, size.Y) * 10.0f / 2.0f;
|
||||
lightSource.Color = new Color(1.0f, 0.45f, 0.3f) * Rand.Range(0.8f, 1.0f);
|
||||
lightSource.Position = position + Vector2.UnitY * 30.0f;
|
||||
if (Math.Abs((lightSource.Range * 0.2f) - Math.Max(size.X, size.Y)) > 1.0f) lightSource.Range = Math.Max(size.X, size.Y) * 5.0f;
|
||||
if (Vector2.DistanceSquared(lightSource.Position,position) > 5.0f) lightSource.Position = position + Vector2.UnitY * 30.0f;
|
||||
|
||||
if (size.X > 256.0f)
|
||||
{
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace Barotrauma
|
||||
break;
|
||||
}
|
||||
|
||||
if (visibleSprites[i].Position.Z > sprite.Position.Z)
|
||||
if (visibleSprites[i].Position.Z < sprite.Position.Z)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -63,6 +63,7 @@ namespace Barotrauma
|
||||
public void Update(float deltaTime)
|
||||
{
|
||||
dustOffset -= Vector2.UnitY * 10.0f * deltaTime;
|
||||
while (dustOffset.Y <= -1024.0f) dustOffset.Y += 1024.0f;
|
||||
}
|
||||
|
||||
public static VertexPositionColorTexture[] GetColoredVertices(VertexPositionTexture[] vertices, Color color)
|
||||
@@ -108,7 +109,7 @@ namespace Barotrauma
|
||||
Vector2 backgroundPos = cam.WorldViewCenter;
|
||||
|
||||
backgroundPos.Y = -backgroundPos.Y;
|
||||
backgroundPos /= 20.0f;
|
||||
backgroundPos *= 0.05f;
|
||||
|
||||
if (backgroundPos.Y < 1024)
|
||||
{
|
||||
@@ -130,35 +131,38 @@ namespace Barotrauma
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred,
|
||||
BlendState.AlphaBlend,
|
||||
SamplerState.LinearWrap, DepthStencilState.Default, null, null,
|
||||
cam.Transform);
|
||||
|
||||
Vector2 origin = new Vector2(cam.WorldView.X, -cam.WorldView.Y);
|
||||
Vector2 offset = -origin + dustOffset;
|
||||
while (offset.X <= -1024.0f) offset.X += 1024.0f;
|
||||
while (offset.X > 0.0f) offset.X -= 1024.0f;
|
||||
while (offset.Y <= -1024.0f) offset.Y += 1024.0f;
|
||||
while (offset.Y > 0.0f) offset.Y -= 1024.0f;
|
||||
|
||||
if (backgroundSpriteManager != null) backgroundSpriteManager.DrawSprites(spriteBatch, cam);
|
||||
if (backgroundCreatureManager != null) backgroundCreatureManager.Draw(spriteBatch);
|
||||
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
float scale = 1.0f - i * 0.2f;
|
||||
float recipScale = 1.0f / scale;
|
||||
|
||||
//alpha goes from 1.0 to 0.0 when scale is in the range of 0.2-0.1
|
||||
float alpha = (cam.Zoom * scale) < 0.2f ? (cam.Zoom * scale - 0.1f) * 10.0f : 1.0f;
|
||||
//alpha goes from 1.0 to 0.0 when scale is in the range of 0.5-0.25
|
||||
float alpha = (cam.Zoom * scale) < 0.5f ? (cam.Zoom * scale - 0.25f) * 40.0f : 1.0f;
|
||||
if (alpha <= 0.0f) continue;
|
||||
|
||||
Vector2 offset = (new Vector2(cam.WorldViewCenter.X, cam.WorldViewCenter.Y) + dustOffset) * scale;
|
||||
Vector3 origin = new Vector3(cam.WorldView.Width, cam.WorldView.Height, 0.0f) * 0.5f;
|
||||
Vector2 offsetS = offset * scale + new Vector2(cam.WorldView.Width, cam.WorldView.Height) * (1.0f - scale) * 0.5f - new Vector2(256.0f * i);
|
||||
while (offsetS.X <= -1024.0f*scale) offsetS.X += 1024.0f*scale;
|
||||
while (offsetS.X > 0.0f) offsetS.X -= 1024.0f*scale;
|
||||
while (offsetS.Y <= -1024.0f*scale) offsetS.Y += 1024.0f*scale;
|
||||
while (offsetS.Y > 0.0f) offsetS.Y -= 1024.0f*scale;
|
||||
|
||||
dustParticles.SourceRect = new Rectangle(
|
||||
(int)((offset.X - origin.X + (i * 256)) / scale),
|
||||
(int)((-offset.Y - origin.Y + (i * 256)) / scale),
|
||||
(int)((cam.WorldView.Width) / scale),
|
||||
(int)((cam.WorldView.Height) / scale));
|
||||
|
||||
spriteBatch.Draw(dustParticles.Texture,
|
||||
new Vector2(cam.WorldViewCenter.X, -cam.WorldViewCenter.Y),
|
||||
dustParticles.SourceRect, Color.White * alpha, 0.0f,
|
||||
new Vector2(cam.WorldView.Width, cam.WorldView.Height) * 0.5f / scale, scale, SpriteEffects.None, 1.0f - scale);
|
||||
Rectangle srcRect = new Rectangle(0, 0, 2048, 2048);
|
||||
dustParticles.DrawTiled(spriteBatch, origin + offsetS, new Vector2(cam.WorldView.Width - offsetS.X, cam.WorldView.Height - offsetS.Y), Vector2.Zero, srcRect, Color.White * alpha, new Vector2(scale));
|
||||
}
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Content;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
@@ -13,7 +13,11 @@ namespace Barotrauma
|
||||
|
||||
public VertexPositionTexture[] vertices = new VertexPositionTexture[DefaultBufferSize];
|
||||
|
||||
private Effect waterEffect;
|
||||
public Effect waterEffect
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
private BasicEffect basicEffect;
|
||||
|
||||
public int PositionInBuffer = 0;
|
||||
@@ -39,12 +43,7 @@ namespace Barotrauma
|
||||
waterEffect.Parameters["xWaveWidth"].SetValue(0.05f);
|
||||
waterEffect.Parameters["xWaveHeight"].SetValue(0.05f);
|
||||
|
||||
#if WINDOWS
|
||||
//waterEffect.Parameters["xTexture"].SetValue(waterTexture);
|
||||
#endif
|
||||
#if LINUX
|
||||
waterEffect.Parameters["xWaterBumpMap"].SetValue(waterTexture);
|
||||
#endif
|
||||
|
||||
if (basicEffect == null)
|
||||
{
|
||||
@@ -64,13 +63,13 @@ namespace Barotrauma
|
||||
waterEffect.Parameters["xBlurDistance"].SetValue(blurAmount);
|
||||
//waterEffect.CurrentTechnique.Passes[0].Apply();
|
||||
|
||||
#if WINDOWS
|
||||
//#if WINDOWS
|
||||
waterEffect.Parameters["xTexture"].SetValue(texture);
|
||||
spriteBatch.Draw(waterTexture, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
||||
#elif LINUX
|
||||
|
||||
spriteBatch.Draw(texture, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
||||
#endif
|
||||
//#elif LINUX
|
||||
|
||||
// spriteBatch.Draw(texture, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
||||
//#endif
|
||||
spriteBatch.End();
|
||||
}
|
||||
|
||||
@@ -93,7 +92,7 @@ namespace Barotrauma
|
||||
|
||||
basicEffect.CurrentTechnique.Passes[0].Apply();
|
||||
|
||||
graphicsDevice.SamplerStates[0] = SamplerState.LinearWrap;
|
||||
graphicsDevice.SamplerStates[0] = SamplerState.PointWrap;
|
||||
graphicsDevice.DrawUserPrimitives<VertexPositionTexture>(PrimitiveType.TriangleList, vertices, 0, vertices.Length / 3);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Content;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -23,9 +24,24 @@ namespace Barotrauma.Lights
|
||||
|
||||
public Color AmbientLight;
|
||||
|
||||
RenderTarget2D lightMap, losTexture;
|
||||
private float lightmapScale = 0.5f;
|
||||
public RenderTarget2D lightMap
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public RenderTarget2D losTexture
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
BasicEffect lightEffect;
|
||||
|
||||
public Effect losEffect
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
|
||||
private static Texture2D alphaClearTexture;
|
||||
|
||||
@@ -36,35 +52,47 @@ namespace Barotrauma.Lights
|
||||
public bool LightingEnabled = true;
|
||||
|
||||
public bool ObstructVision;
|
||||
LightSource losSource;
|
||||
|
||||
private Texture2D visionCircle;
|
||||
private Sprite visionCircle;
|
||||
|
||||
private Dictionary<Hull, Color> hullAmbientLights;
|
||||
private Dictionary<Hull, Color> smoothedHullAmbientLights;
|
||||
|
||||
private float ambientLightUpdateTimer;
|
||||
|
||||
public LightManager(GraphicsDevice graphics)
|
||||
public LightManager(GraphicsDevice graphics, ContentManager content)
|
||||
{
|
||||
lights = new List<LightSource>();
|
||||
|
||||
AmbientLight = new Color(20, 20, 20, 255);
|
||||
|
||||
visionCircle = Sprite.LoadTexture("Content/Lights/visioncircle.png");
|
||||
//visionCircle = Sprite.LoadTexture("Content/Lights/visioncircle.png");
|
||||
visionCircle = new Sprite("Content/Lights/visioncircle.png", new Vector2(0.2f, 0.5f));
|
||||
|
||||
var pp = graphics.PresentationParameters;
|
||||
|
||||
lightMap = new RenderTarget2D(graphics,
|
||||
GameMain.GraphicsWidth, GameMain.GraphicsHeight, false,
|
||||
(int)(GameMain.GraphicsWidth*lightmapScale), (int)(GameMain.GraphicsHeight*lightmapScale), false,
|
||||
pp.BackBufferFormat, pp.DepthStencilFormat, pp.MultiSampleCount,
|
||||
RenderTargetUsage.DiscardContents);
|
||||
|
||||
losTexture = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||
losTexture = new RenderTarget2D(graphics, (int)(GameMain.GraphicsWidth*lightmapScale), (int)(GameMain.GraphicsHeight*lightmapScale), false, SurfaceFormat.Color, DepthFormat.None);
|
||||
|
||||
losSource = new LightSource(Vector2.Zero, GameMain.GraphicsWidth, Color.White, null, false);
|
||||
losSource.texture = new Texture2D(graphics, 1, 1);
|
||||
losSource.texture.SetData(new Color[] { Color.White });// fill the texture with white
|
||||
|
||||
#if WINDOWS
|
||||
losEffect = content.Load<Effect>("losshader");
|
||||
#else
|
||||
losEffect = content.Load<Effect>("losshader_opengl");
|
||||
#endif
|
||||
|
||||
if (lightEffect == null)
|
||||
{
|
||||
lightEffect = new BasicEffect(GameMain.Instance.GraphicsDevice);
|
||||
lightEffect.VertexColorEnabled = false;
|
||||
lightEffect.VertexColorEnabled = true;
|
||||
|
||||
lightEffect.TextureEnabled = true;
|
||||
lightEffect.Texture = LightSource.LightTexture;
|
||||
@@ -141,9 +169,9 @@ namespace Barotrauma.Lights
|
||||
//clear to some small ambient light
|
||||
graphics.Clear(AmbientLight);
|
||||
graphics.BlendState = BlendState.Additive;
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, null, null, null, cam.Transform * Matrix.CreateScale(new Vector3(lightmapScale, lightmapScale, 1.0f)));
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, null, null, null, cam.Transform);
|
||||
|
||||
Matrix transform = cam.ShaderTransform
|
||||
* Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
|
||||
|
||||
@@ -158,7 +186,7 @@ namespace Barotrauma.Lights
|
||||
}
|
||||
|
||||
lightEffect.World = Matrix.CreateTranslation(offset) * transform;
|
||||
|
||||
|
||||
GameMain.ParticleManager.Draw(spriteBatch, false, null, Particles.ParticleBlendState.Additive);
|
||||
|
||||
if (Character.Controlled != null)
|
||||
@@ -201,56 +229,43 @@ namespace Barotrauma.Lights
|
||||
|
||||
public void UpdateObstructVision(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam, Vector2 lookAtPosition)
|
||||
{
|
||||
if (!LosEnabled && !ObstructVision) return;
|
||||
if (!LosEnabled || ViewTarget == null) return;
|
||||
|
||||
graphics.SetRenderTarget(losTexture);
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, cam.Transform);
|
||||
//--------------------------------------
|
||||
|
||||
graphics.Clear(Color.Black);
|
||||
if (ObstructVision)
|
||||
{
|
||||
//graphics.Clear(Color.Black);
|
||||
|
||||
Vector2 diff = lookAtPosition - ViewTarget.WorldPosition;
|
||||
diff.Y = -diff.Y;
|
||||
float rotation = MathUtils.VectorToAngle(diff);
|
||||
|
||||
Vector2 scale = new Vector2(MathHelper.Clamp(diff.Length()/256.0f, 2.0f, 5.0f), 2.0f);
|
||||
|
||||
spriteBatch.Draw(visionCircle, new Vector2(ViewTarget.WorldPosition.X, -ViewTarget.WorldPosition.Y), null, Color.White, rotation,
|
||||
new Vector2(LightSource.LightTexture.Width*0.2f, LightSource.LightTexture.Height/2), scale, SpriteEffects.None, 0.0f);
|
||||
Vector2 scale = new Vector2(MathHelper.Clamp(diff.Length() / 256.0f, 2.0f, 5.0f), 2.0f) * 0.3f;
|
||||
|
||||
visionCircle.size = new Vector2(visionCircle.SourceRect.Width * scale.X, visionCircle.SourceRect.Height * scale.Y);
|
||||
losSource.overrideLightTexture = visionCircle;
|
||||
losSource.Rotation = rotation;
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.Clear(Color.White);
|
||||
losSource.overrideLightTexture = null;
|
||||
}
|
||||
|
||||
spriteBatch.End();
|
||||
graphics.BlendState = BlendState.Additive;
|
||||
|
||||
//--------------------------------------
|
||||
Vector2 pos = ViewTarget.Position;
|
||||
losSource.Position = pos;
|
||||
losSource.NeedsRecalculation = true;
|
||||
losSource.ParentSub = ViewTarget.Submarine;
|
||||
|
||||
if (LosEnabled && ViewTarget != null)
|
||||
{
|
||||
Vector2 pos = ViewTarget.WorldPosition;
|
||||
Matrix transform = cam.ShaderTransform
|
||||
* Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
|
||||
|
||||
losSource.Draw(spriteBatch, lightEffect, transform);
|
||||
|
||||
Rectangle camView = new Rectangle(cam.WorldView.X, cam.WorldView.Y - cam.WorldView.Height, cam.WorldView.Width, cam.WorldView.Height);
|
||||
graphics.BlendState = BlendState.AlphaBlend;
|
||||
|
||||
Matrix shadowTransform = cam.ShaderTransform
|
||||
* Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
|
||||
|
||||
var convexHulls = ConvexHull.GetHullsInRange(viewTarget.Position, cam.WorldView.Width*0.75f, viewTarget.Submarine);
|
||||
|
||||
if (convexHulls != null)
|
||||
{
|
||||
foreach (ConvexHull convexHull in convexHulls)
|
||||
{
|
||||
if (!convexHull.Intersects(camView)) continue;
|
||||
//if (!camView.Intersects(convexHull.BoundingBox)) continue;
|
||||
|
||||
convexHull.DrawShadows(graphics, cam, pos, shadowTransform);
|
||||
}
|
||||
}
|
||||
}
|
||||
graphics.SetRenderTarget(null);
|
||||
}
|
||||
|
||||
@@ -338,22 +353,11 @@ namespace Barotrauma.Lights
|
||||
{
|
||||
if (!LightingEnabled) return;
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, CustomBlendStates.Multiplicative, null, null, null, effect);
|
||||
spriteBatch.Draw(lightMap, Vector2.Zero, Color.White);
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, CustomBlendStates.Multiplicative, null, null, null, null);
|
||||
spriteBatch.Draw(lightMap, new Rectangle(0,0,GameMain.GraphicsWidth,GameMain.GraphicsHeight), Color.White);
|
||||
spriteBatch.End();
|
||||
}
|
||||
|
||||
public void DrawLOS(SpriteBatch spriteBatch, Effect effect,bool renderingBackground)
|
||||
{
|
||||
if (!LosEnabled || ViewTarget == null) return;
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, renderingBackground ? CustomBlendStates.LOS : CustomBlendStates.Multiplicative, null, null, null, effect);
|
||||
spriteBatch.Draw(losTexture, Vector2.Zero, Color.White);
|
||||
spriteBatch.End();
|
||||
|
||||
if (!renderingBackground) ObstructVision = false;
|
||||
}
|
||||
|
||||
public void ClearLights()
|
||||
{
|
||||
lights.Clear();
|
||||
@@ -376,16 +380,10 @@ namespace Barotrauma.Lights
|
||||
MultiplyWithAlpha = new BlendState();
|
||||
MultiplyWithAlpha.ColorDestinationBlend = MultiplyWithAlpha.AlphaDestinationBlend = Blend.One;
|
||||
MultiplyWithAlpha.ColorSourceBlend = MultiplyWithAlpha.AlphaSourceBlend = Blend.DestinationAlpha;
|
||||
|
||||
LOS = new BlendState();
|
||||
LOS.ColorSourceBlend = LOS.AlphaSourceBlend = Blend.Zero;
|
||||
LOS.ColorDestinationBlend = LOS.AlphaDestinationBlend = Blend.InverseSourceColor;
|
||||
LOS.ColorBlendFunction = LOS.AlphaBlendFunction = BlendFunction.Add;
|
||||
}
|
||||
public static BlendState Multiplicative { get; private set; }
|
||||
public static BlendState WriteToAlpha { get; private set; }
|
||||
public static BlendState MultiplyWithAlpha { get; private set; }
|
||||
public static BlendState LOS { get; private set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -17,8 +17,8 @@ namespace Barotrauma.Lights
|
||||
private Color color;
|
||||
private float range;
|
||||
|
||||
private Sprite overrideLightTexture;
|
||||
private Texture2D texture;
|
||||
public Sprite overrideLightTexture;
|
||||
public Texture2D texture;
|
||||
|
||||
public Sprite LightSprite;
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace Barotrauma.Lights
|
||||
}
|
||||
}
|
||||
|
||||
public LightSource(Vector2 position, float range, Color color, Submarine submarine)
|
||||
public LightSource(Vector2 position, float range, Color color, Submarine submarine, bool addLight=true)
|
||||
{
|
||||
hullsInRange = new List<ConvexHullList>();
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace Barotrauma.Lights
|
||||
|
||||
diffToSub = new Dictionary<Submarine, Vector2>();
|
||||
|
||||
GameMain.LightManager.AddLight(this);
|
||||
if (addLight) GameMain.LightManager.AddLight(this);
|
||||
}
|
||||
|
||||
/*public void DrawShadows(GraphicsDevice graphics, Camera cam, Matrix shadowTransform)
|
||||
@@ -322,6 +322,7 @@ namespace Barotrauma.Lights
|
||||
hulls.AddRange(chList.List);
|
||||
}
|
||||
|
||||
float bounds = range*2;
|
||||
//find convexhull segments that are close enough and facing towards the light source
|
||||
List<Segment> visibleSegments = new List<Segment>();
|
||||
List<SegmentPoint> points = new List<SegmentPoint>();
|
||||
@@ -336,6 +337,10 @@ namespace Barotrauma.Lights
|
||||
{
|
||||
points.Add(s.Start);
|
||||
points.Add(s.End);
|
||||
if (Math.Abs(s.Start.WorldPos.X - drawPos.X) > bounds) bounds = Math.Abs(s.Start.WorldPos.X - drawPos.X);
|
||||
if (Math.Abs(s.Start.WorldPos.Y - drawPos.Y) > bounds) bounds = Math.Abs(s.Start.WorldPos.Y - drawPos.Y);
|
||||
if (Math.Abs(s.End.WorldPos.X - drawPos.X) > bounds) bounds = Math.Abs(s.End.WorldPos.X - drawPos.X);
|
||||
if (Math.Abs(s.End.WorldPos.Y - drawPos.Y) > bounds) bounds = Math.Abs(s.End.WorldPos.Y - drawPos.Y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,14 +349,21 @@ namespace Barotrauma.Lights
|
||||
|
||||
//(might be more effective to calculate if we actually need these extra points)
|
||||
var boundaryCorners = new List<SegmentPoint> {
|
||||
new SegmentPoint(new Vector2(drawPos.X + range*2, drawPos.Y + range*2)),
|
||||
new SegmentPoint(new Vector2(drawPos.X + range*2, drawPos.Y - range*2)),
|
||||
new SegmentPoint(new Vector2(drawPos.X - range*2, drawPos.Y - range*2)),
|
||||
new SegmentPoint(new Vector2(drawPos.X - range*2, drawPos.Y + range*2))
|
||||
new SegmentPoint(new Vector2(drawPos.X + bounds, drawPos.Y + bounds)),
|
||||
new SegmentPoint(new Vector2(drawPos.X + bounds, drawPos.Y - bounds)),
|
||||
new SegmentPoint(new Vector2(drawPos.X - bounds, drawPos.Y - bounds)),
|
||||
new SegmentPoint(new Vector2(drawPos.X - bounds, drawPos.Y + bounds))
|
||||
};
|
||||
|
||||
//points.Clear();
|
||||
points.AddRange(boundaryCorners);
|
||||
|
||||
//visibleSegments.Clear();
|
||||
for (int i=0;i<4;i++)
|
||||
{
|
||||
visibleSegments.Add(new Segment(boundaryCorners[i], boundaryCorners[(i + 1) % 4]));
|
||||
}
|
||||
|
||||
var compareCCW = new CompareSegmentPointCW(drawPos);
|
||||
try
|
||||
{
|
||||
@@ -368,14 +380,16 @@ namespace Barotrauma.Lights
|
||||
}
|
||||
|
||||
List<Vector2> output = new List<Vector2>();
|
||||
//List<Pair<int, Vector2>> preOutput = new List<Pair<int, Vector2>>();
|
||||
|
||||
//remove points that are very close to each other
|
||||
for (int i = 0; i < points.Count - 1; i++)
|
||||
{
|
||||
if (Math.Abs(points[i].WorldPos.X - points[i + 1].WorldPos.X) < 3 &&
|
||||
Math.Abs(points[i].WorldPos.Y - points[i + 1].WorldPos.Y) < 3)
|
||||
if (Math.Abs(points[i].WorldPos.X - points[i + 1].WorldPos.X) < 6 &&
|
||||
Math.Abs(points[i].WorldPos.Y - points[i + 1].WorldPos.Y) < 6)
|
||||
{
|
||||
points.RemoveAt(i + 1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,32 +399,52 @@ namespace Barotrauma.Lights
|
||||
Vector2 dirNormal = new Vector2(-dir.Y, dir.X)*3;
|
||||
|
||||
//do two slightly offset raycasts to hit the segment itself and whatever's behind it
|
||||
Vector2 intersection1 = RayCast(drawPos, drawPos + dir * range * 2 - dirNormal, visibleSegments);
|
||||
Vector2 intersection2 = RayCast(drawPos, drawPos + dir * range * 2 + dirNormal, visibleSegments);
|
||||
Pair<int,Vector2> intersection1 = RayCast(drawPos, drawPos + dir * bounds * 2 - dirNormal, visibleSegments);
|
||||
Pair<int,Vector2> intersection2 = RayCast(drawPos, drawPos + dir * bounds * 2 + dirNormal, visibleSegments);
|
||||
|
||||
//hit almost the same position -> only add one vertex to output
|
||||
if ((Math.Abs(intersection1.X - intersection2.X) < 5 &&
|
||||
Math.Abs(intersection1.Y - intersection2.Y) < 5))
|
||||
if (intersection1.First < 0) return new List<Vector2>();
|
||||
if (intersection2.First < 0) return new List<Vector2>();
|
||||
Segment seg1 = visibleSegments[intersection1.First];
|
||||
Segment seg2 = visibleSegments[intersection2.First];
|
||||
|
||||
bool isPoint1 = MathUtils.LineToPointDistance(seg1.Start.WorldPos, seg1.End.WorldPos, p.WorldPos) < 5.0f;
|
||||
bool isPoint2 = MathUtils.LineToPointDistance(seg2.Start.WorldPos, seg2.End.WorldPos, p.WorldPos) < 5.0f;
|
||||
|
||||
//hit at the current segmentpoint -> place the segmentpoint into the list
|
||||
if (isPoint1 && isPoint2)
|
||||
{
|
||||
output.Add(intersection1);
|
||||
output.Add(p.WorldPos);
|
||||
}
|
||||
else
|
||||
else if (intersection1.First != intersection2.First)
|
||||
{
|
||||
output.Add(intersection1);
|
||||
output.Add(intersection2);
|
||||
output.Add(isPoint1 ? p.WorldPos : intersection1.Second);
|
||||
output.Add(isPoint2 ? p.WorldPos : intersection2.Second);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//remove points that are very close to each other
|
||||
for (int i = 0; i < output.Count - 1; i++)
|
||||
{
|
||||
if (Math.Abs(output[i].X - output[i + 1].X) < 6 &&
|
||||
Math.Abs(output[i].Y - output[i + 1].Y) < 6)
|
||||
{
|
||||
output.RemoveAt(i + 1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
private Vector2 RayCast(Vector2 rayStart, Vector2 rayEnd, List<Segment> segments)
|
||||
private Pair<int,Vector2> RayCast(Vector2 rayStart, Vector2 rayEnd, List<Segment> segments)
|
||||
{
|
||||
float closestDist = 0.0f;
|
||||
Vector2? closestIntersection = null;
|
||||
|
||||
foreach (Segment s in segments)
|
||||
int segment = -1;
|
||||
|
||||
for (int i=0;i<segments.Count;i++)
|
||||
{
|
||||
Segment s = segments[i];
|
||||
Vector2? intersection = MathUtils.GetAxisAlignedLineIntersection(rayStart, rayEnd, s.Start.WorldPos, s.End.WorldPos, s.IsHorizontal);
|
||||
|
||||
if (intersection != null)
|
||||
@@ -420,16 +454,20 @@ namespace Barotrauma.Lights
|
||||
{
|
||||
closestDist = dist;
|
||||
closestIntersection = intersection;
|
||||
segment = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return closestIntersection == null ? rayEnd : (Vector2)closestIntersection;
|
||||
Pair<int,Vector2> retVal = new Pair<int,Vector2>();
|
||||
retVal.Second = closestIntersection == null ? rayEnd : (Vector2)closestIntersection;
|
||||
retVal.First = segment;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
private void CalculateLightVertices(List<Vector2> rayCastHits)
|
||||
{
|
||||
List<VertexPositionTexture> vertices = new List<VertexPositionTexture>();
|
||||
List<VertexPositionColorTexture> vertices = new List<VertexPositionColorTexture>();
|
||||
|
||||
Vector2 drawPos = position;
|
||||
if (ParentSub != null) drawPos += ParentSub.DrawPosition;
|
||||
@@ -446,16 +484,19 @@ namespace Barotrauma.Lights
|
||||
}
|
||||
|
||||
// Add a vertex for the center of the mesh
|
||||
vertices.Add(new VertexPositionTexture(new Vector3(position.X, position.Y, 0),
|
||||
new Vector2(0.5f, 0.5f) + uvOffset));
|
||||
vertices.Add(new VertexPositionColorTexture(new Vector3(position.X, position.Y, 0),
|
||||
Color.White,new Vector2(0.5f, 0.5f) + uvOffset));
|
||||
|
||||
// Add all the other encounter points as vertices
|
||||
// storing their world position as UV coordinates
|
||||
foreach (Vector2 vertex in rayCastHits)
|
||||
for (int i = 0; i < rayCastHits.Count; i++)
|
||||
{
|
||||
Vector2 vertex = rayCastHits[i];
|
||||
Vector2 prevVertex = rayCastHits[i > 0 ? i - 1 : rayCastHits.Count - 1];
|
||||
Vector2 nextVertex = rayCastHits[i < rayCastHits.Count - 1 ? i + 1 : 0];
|
||||
Vector2 rawDiff = vertex - drawPos;
|
||||
Vector2 diff = rawDiff;
|
||||
diff /= range*2.0f;
|
||||
diff /= range * 2.0f;
|
||||
if (overrideLightTexture != null)
|
||||
{
|
||||
Vector2 originDiff = diff;
|
||||
@@ -467,22 +508,52 @@ namespace Barotrauma.Lights
|
||||
diff += uvOffset;
|
||||
}
|
||||
|
||||
vertices.Add(new VertexPositionTexture(new Vector3(position.X + rawDiff.X, position.Y + rawDiff.Y, 0),
|
||||
new Vector2(0.5f, 0.5f) + diff));
|
||||
Vector2 nDiff1 = vertex - nextVertex;
|
||||
float tx = nDiff1.X; nDiff1.X = -nDiff1.Y; nDiff1.Y = tx;
|
||||
nDiff1 /= Math.Max(Math.Abs(nDiff1.X), Math.Abs(nDiff1.Y));
|
||||
Vector2 nDiff2 = prevVertex - vertex;
|
||||
tx = nDiff2.X; nDiff2.X = -nDiff2.Y; nDiff2.Y = tx;
|
||||
nDiff2 /= Math.Max(Math.Abs(nDiff2.X),Math.Abs(nDiff2.Y));
|
||||
Vector2 nDiff = nDiff1 + nDiff2;
|
||||
nDiff /= Math.Max(Math.Abs(nDiff.X), Math.Abs(nDiff.Y));
|
||||
nDiff *= 50.0f;
|
||||
if (Vector2.DistanceSquared(nDiff, rawDiff) > Vector2.DistanceSquared(-nDiff, rawDiff)) nDiff = -nDiff;
|
||||
VertexPositionColorTexture fadeVert = new VertexPositionColorTexture(new Vector3(position.X + rawDiff.X + nDiff.X, position.Y + rawDiff.Y + nDiff.Y, 0),
|
||||
Color.White * 0.0f, new Vector2(0.5f, 0.5f) + diff);
|
||||
|
||||
vertices.Add(new VertexPositionColorTexture(new Vector3(position.X + rawDiff.X, position.Y + rawDiff.Y, 0),
|
||||
Color.White, new Vector2(0.5f, 0.5f) + diff));
|
||||
vertices.Add(fadeVert);
|
||||
}
|
||||
|
||||
// Compute the indices to form triangles
|
||||
List<short> indices = new List<short>();
|
||||
for (int i = 0; i < rayCastHits.Count - 1; i++)
|
||||
for (int i = 0; i < rayCastHits.Count-1; i++)
|
||||
{
|
||||
indices.Add(0);
|
||||
indices.Add((short)((i + 2) % vertices.Count));
|
||||
indices.Add((short)((i + 1) % vertices.Count));
|
||||
indices.Add((short)((i*2 + 3) % vertices.Count));
|
||||
indices.Add((short)((i*2 + 1) % vertices.Count));
|
||||
|
||||
indices.Add((short)((i*2 + 1) % vertices.Count));
|
||||
indices.Add((short)((i*2 + 3) % vertices.Count));
|
||||
indices.Add((short)((i*2 + 4) % vertices.Count));
|
||||
|
||||
indices.Add((short)((i*2 + 2) % vertices.Count));
|
||||
indices.Add((short)((i*2 + 1) % vertices.Count));
|
||||
indices.Add((short)((i*2 + 4) % vertices.Count));
|
||||
}
|
||||
|
||||
indices.Add(0);
|
||||
indices.Add((short)(1));
|
||||
indices.Add((short)(vertices.Count - 1));
|
||||
indices.Add((short)(vertices.Count - 2));
|
||||
|
||||
indices.Add((short)(1));
|
||||
indices.Add((short)(vertices.Count-1));
|
||||
indices.Add((short)(vertices.Count-2));
|
||||
|
||||
indices.Add((short)(1));
|
||||
indices.Add((short)(2));
|
||||
indices.Add((short)(vertices.Count-1));
|
||||
|
||||
vertexCount = vertices.Count;
|
||||
indexCount = indices.Count;
|
||||
@@ -491,19 +562,19 @@ namespace Barotrauma.Lights
|
||||
//now we just create a buffer for 64 verts and make it larger if needed
|
||||
if (lightVolumeBuffer == null)
|
||||
{
|
||||
lightVolumeBuffer = new DynamicVertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionTexture.VertexDeclaration, Math.Max(64, (int)(vertexCount*1.5)), BufferUsage.None);
|
||||
lightVolumeBuffer = new DynamicVertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionColorTexture.VertexDeclaration, Math.Max(64, (int)(vertexCount*1.5)), BufferUsage.None);
|
||||
lightVolumeIndexBuffer = new DynamicIndexBuffer(GameMain.Instance.GraphicsDevice, typeof(short), Math.Max(64*3, (int)(indexCount * 1.5)), BufferUsage.None);
|
||||
}
|
||||
else if (vertexCount > lightVolumeBuffer.VertexCount)
|
||||
else if (vertexCount > lightVolumeBuffer.VertexCount || indexCount > lightVolumeIndexBuffer.IndexCount)
|
||||
{
|
||||
lightVolumeBuffer.Dispose();
|
||||
lightVolumeIndexBuffer.Dispose();
|
||||
|
||||
lightVolumeBuffer = new DynamicVertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionTexture.VertexDeclaration, (int)(vertexCount*1.5), BufferUsage.None);
|
||||
lightVolumeBuffer = new DynamicVertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionColorTexture.VertexDeclaration, (int)(vertexCount*1.5), BufferUsage.None);
|
||||
lightVolumeIndexBuffer = new DynamicIndexBuffer(GameMain.Instance.GraphicsDevice, typeof(short), (int)(indexCount * 1.5), BufferUsage.None);
|
||||
}
|
||||
|
||||
lightVolumeBuffer.SetData<VertexPositionTexture>(vertices.ToArray());
|
||||
|
||||
lightVolumeBuffer.SetData<VertexPositionColorTexture>(vertices.ToArray());
|
||||
lightVolumeIndexBuffer.SetData<short>(indices.ToArray());
|
||||
}
|
||||
|
||||
@@ -562,7 +633,7 @@ namespace Barotrauma.Lights
|
||||
}
|
||||
else
|
||||
{
|
||||
lightEffect.Texture = LightTexture;
|
||||
lightEffect.Texture = texture??LightTexture;
|
||||
}
|
||||
lightEffect.CurrentTechnique.Passes[0].Apply();
|
||||
|
||||
@@ -571,6 +642,7 @@ namespace Barotrauma.Lights
|
||||
|
||||
GameMain.Instance.GraphicsDevice.DrawIndexedPrimitives
|
||||
(
|
||||
//PrimitiveType.LineList, 0, 0, indexCount / 2
|
||||
PrimitiveType.TriangleList, 0, 0, indexCount / 3
|
||||
);
|
||||
}
|
||||
|
||||
@@ -94,24 +94,23 @@ namespace Barotrauma
|
||||
editingHUD.Padding = new Vector4(10, 10, 0, 0);
|
||||
editingHUD.UserData = this;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 0, 100, 20), "Linked submarine", "",
|
||||
new GUITextBlock(new Rectangle(0, 0, 100, 20), TextManager.Get("LinkedSub"), "",
|
||||
Alignment.TopLeft, Alignment.TopLeft, editingHUD, false, GUI.LargeFont);
|
||||
|
||||
var pathBox = new GUITextBox(new Rectangle(10, 30, 300, 20), "", editingHUD);
|
||||
pathBox.Font = GUI.SmallFont;
|
||||
pathBox.Text = filePath;
|
||||
|
||||
var reloadButton = new GUIButton(new Rectangle(320, 30, 80, 20), "Refresh", "", editingHUD);
|
||||
var reloadButton = new GUIButton(new Rectangle(320, 30, 80, 20), TextManager.Get("ReloadLinkedSub"), "", editingHUD);
|
||||
reloadButton.OnClicked = Reload;
|
||||
reloadButton.UserData = pathBox;
|
||||
|
||||
reloadButton.ToolTip = "Reload the linked submarine from the specified file";
|
||||
reloadButton.ToolTip = TextManager.Get("ReloadLinkedSubTooltip");
|
||||
|
||||
y += 20;
|
||||
|
||||
if (!inGame)
|
||||
{
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 20), "Hold space to link to a docking port",
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 20), TextManager.Get("LinkLinkedSub"),
|
||||
"", Alignment.TopRight, Alignment.TopRight, editingHUD, false, GUI.SmallFont);
|
||||
y += 25;
|
||||
|
||||
@@ -125,7 +124,7 @@ namespace Barotrauma
|
||||
|
||||
if (!File.Exists(pathBox.Text))
|
||||
{
|
||||
new GUIMessageBox("Error", "Submarine file \"" + pathBox.Text + "\" not found!");
|
||||
new GUIMessageBox(TextManager.Get("Error"), TextManager.Get("ReloadLinkedSubError").Replace("[file]", pathBox.Text));
|
||||
pathBox.Flash(Color.Red);
|
||||
pathBox.Text = filePath;
|
||||
return false;
|
||||
|
||||
@@ -5,7 +5,6 @@ using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -149,14 +148,17 @@ namespace Barotrauma
|
||||
{
|
||||
float newCutoff = Math.Min((sections[i].damage / prefab.Health), 0.65f);
|
||||
|
||||
if (Math.Abs(newCutoff - Submarine.DamageEffectCutoff) > 0.01f)
|
||||
if (Math.Abs(newCutoff - Submarine.DamageEffectCutoff) > 0.01f || color != Submarine.DamageEffectColor)
|
||||
{
|
||||
damageEffect.Parameters["aCutoff"].SetValue(newCutoff);
|
||||
damageEffect.Parameters["cCutoff"].SetValue(newCutoff * 1.2f);
|
||||
damageEffect.Parameters["inColor"].SetValue(color.ToVector4());
|
||||
|
||||
|
||||
damageEffect.CurrentTechnique.Passes[0].Apply();
|
||||
|
||||
Submarine.DamageEffectCutoff = newCutoff;
|
||||
Submarine.DamageEffectColor = color;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
public static float DamageEffectCutoff;
|
||||
public static Color DamageEffectColor;
|
||||
|
||||
public static void DrawDamageable(SpriteBatch spriteBatch, Effect damageEffect, bool editing = false)
|
||||
{
|
||||
@@ -105,15 +106,13 @@ namespace Barotrauma
|
||||
|
||||
public static bool SaveCurrent(string filePath)
|
||||
{
|
||||
if (Submarine.MainSub == null)
|
||||
if (MainSub == null)
|
||||
{
|
||||
Submarine.MainSub = new Submarine(filePath);
|
||||
// return;
|
||||
MainSub = new Submarine(filePath);
|
||||
}
|
||||
|
||||
Submarine.MainSub.filePath = filePath;
|
||||
|
||||
return Submarine.MainSub.SaveAs(filePath);
|
||||
MainSub.filePath = filePath;
|
||||
return MainSub.SaveAs(filePath);
|
||||
}
|
||||
|
||||
public void CheckForErrors()
|
||||
@@ -122,7 +121,7 @@ namespace Barotrauma
|
||||
|
||||
if (!Hull.hullList.Any())
|
||||
{
|
||||
errorMsgs.Add("No hulls found in the submarine. Hulls determine the \"borders\" of an individual room and are required for water and air distribution to work correctly.");
|
||||
errorMsgs.Add(TextManager.Get("NoHullsWarning"));
|
||||
}
|
||||
|
||||
foreach (Item item in Item.ItemList)
|
||||
@@ -131,25 +130,24 @@ namespace Barotrauma
|
||||
|
||||
if (!item.linkedTo.Any())
|
||||
{
|
||||
errorMsgs.Add("The submarine contains vents which haven't been linked to an oxygen generator. Select a vent and click an oxygen generator while holding space to link them.");
|
||||
errorMsgs.Add(TextManager.Get("DisconnectedVentsWarning"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (WayPoint.WayPointList.Find(wp => !wp.MoveWithLevel && wp.SpawnType == SpawnType.Path) == null)
|
||||
{
|
||||
errorMsgs.Add("No waypoints found in the submarine. AI controlled crew members won't be able to navigate without waypoints.");
|
||||
errorMsgs.Add(TextManager.Get("NoWaypointsWarning"));
|
||||
}
|
||||
|
||||
if (WayPoint.WayPointList.Find(wp => wp.SpawnType == SpawnType.Cargo) == null)
|
||||
{
|
||||
errorMsgs.Add("The submarine doesn't have spawnpoints for cargo (which are used for determining where to place bought items). "
|
||||
+ "To fix this, create a new spawnpoint and change its \"spawn type\" parameter to \"cargo\".");
|
||||
errorMsgs.Add(TextManager.Get("NoCargoSpawnpointWarning"));
|
||||
}
|
||||
|
||||
if (errorMsgs.Any())
|
||||
{
|
||||
new GUIMessageBox("Warning", string.Join("\n\n", errorMsgs), 400, 0);
|
||||
new GUIMessageBox(TextManager.Get("Warning"), string.Join("\n\n", errorMsgs), 400, 0);
|
||||
}
|
||||
|
||||
foreach (MapEntity e in MapEntity.mapEntityList)
|
||||
@@ -157,9 +155,9 @@ namespace Barotrauma
|
||||
if (Vector2.Distance(e.Position, HiddenSubPosition) > 20000)
|
||||
{
|
||||
var msgBox = new GUIMessageBox(
|
||||
"Warning",
|
||||
"One or more structures have been placed very far from the submarine. Show the structures?",
|
||||
new string[] { "Yes", "No" });
|
||||
TextManager.Get("Warning"),
|
||||
TextManager.Get("FarAwayEntitiesWarning"),
|
||||
new string[] { TextManager.Get("Yes"), TextManager.Get("No") });
|
||||
|
||||
msgBox.Buttons[0].OnClicked += (btn, obj) =>
|
||||
{
|
||||
|
||||
@@ -132,10 +132,10 @@ namespace Barotrauma
|
||||
string trimmedName = text.ToLowerInvariant().Trim();
|
||||
assignedJob = JobPrefab.List.Find(jp => jp.Name.ToLowerInvariant() == trimmedName);
|
||||
|
||||
if (assignedJob != null && trimmedName != "none")
|
||||
if (assignedJob != null && trimmedName != TextManager.Get("None").ToLowerInvariant())
|
||||
{
|
||||
textBox.Color = Color.Green;
|
||||
textBox.Text = (assignedJob == null) ? "None" : assignedJob.Name;
|
||||
textBox.Text = (assignedJob == null) ? TextManager.Get("None") : assignedJob.Name;
|
||||
}
|
||||
|
||||
textBox.Deselect();
|
||||
@@ -156,19 +156,19 @@ namespace Barotrauma
|
||||
int height = spawnType == SpawnType.Path ? 100 : 200;
|
||||
int x = GameMain.GraphicsWidth / 2 - width / 2, y = 10;
|
||||
|
||||
editingHUD = new GUIFrame(new Rectangle(x, y, width, height), Color.Black * 0.5f);
|
||||
editingHUD.Padding = new Vector4(10, 10, 0, 0);
|
||||
editingHUD = new GUIFrame(new Rectangle(x, y, width, height));
|
||||
editingHUD.Padding = new Vector4(10, 10, 20, 0);
|
||||
editingHUD.UserData = this;
|
||||
|
||||
if (spawnType == SpawnType.Path)
|
||||
{
|
||||
new GUITextBlock(new Rectangle(0, 0, 100, 20), "Editing waypoint", "", editingHUD);
|
||||
new GUITextBlock(new Rectangle(0, 20, 100, 20), "Hold space to link to another waypoint", "", editingHUD);
|
||||
new GUITextBlock(new Rectangle(0, 0, 100, 20), TextManager.Get("Editing")+" " +TextManager.Get("Waypoint"), "", editingHUD);
|
||||
new GUITextBlock(new Rectangle(0, 20, 100, 20), TextManager.Get("LinkWaypoint"), "", editingHUD);
|
||||
}
|
||||
else
|
||||
{
|
||||
new GUITextBlock(new Rectangle(0, 0, 100, 20), "Editing spawnpoint", "", editingHUD);
|
||||
new GUITextBlock(new Rectangle(0, 25, 100, 20), "Spawn type: ", "", editingHUD);
|
||||
new GUITextBlock(new Rectangle(0, 0, 100, 20), TextManager.Get("Editing") + " " + TextManager.Get("Spawnpoint"), "", editingHUD);
|
||||
new GUITextBlock(new Rectangle(0, 25, 100, 20), TextManager.Get("SpawnType") + ": ", "", editingHUD);
|
||||
|
||||
var spawnTypeText = new GUITextBlock(new Rectangle(0, 25, 200, 20), spawnType.ToString(), "", Alignment.Right, Alignment.TopLeft, editingHUD);
|
||||
|
||||
@@ -182,33 +182,33 @@ namespace Barotrauma
|
||||
|
||||
y = 40 + 20;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, y, 100, 20), "ID Card desc:", Color.Transparent, Color.White, Alignment.TopLeft, null, editingHUD);
|
||||
GUITextBox propertyBox = new GUITextBox(new Rectangle(100, y, 350, 20), "", editingHUD);
|
||||
new GUITextBlock(new Rectangle(0, y, 100, 20), TextManager.Get("IDCardDescription"), "", Alignment.TopLeft, Alignment.CenterLeft, editingHUD, false, GUI.SmallFont);
|
||||
GUITextBox propertyBox = new GUITextBox(new Rectangle(150, y, 0, 20), "", editingHUD);
|
||||
propertyBox.MaxTextLength = 150;
|
||||
propertyBox.Text = idCardDesc;
|
||||
propertyBox.OnEnterPressed = EnterIDCardDesc;
|
||||
propertyBox.OnTextChanged = TextBoxChanged;
|
||||
propertyBox.ToolTip = "Characters spawning at this spawnpoint will have the specified description added to their ID card. This can be used to describe additional access levels their card has on the sub.";
|
||||
propertyBox.ToolTip = TextManager.Get("IDCardDescriptionTooltip");
|
||||
|
||||
y = y + 30;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, y, 100, 20), "ID Card tags:", Color.Transparent, Color.White, Alignment.TopLeft, null, editingHUD);
|
||||
propertyBox = new GUITextBox(new Rectangle(100, y, 350, 20), "", editingHUD);
|
||||
new GUITextBlock(new Rectangle(0, y, 100, 20), TextManager.Get("IDCardTags"), "", Alignment.TopLeft, Alignment.CenterLeft, editingHUD, false, GUI.SmallFont);
|
||||
propertyBox = new GUITextBox(new Rectangle(150, y, 0, 20), "", editingHUD);
|
||||
propertyBox.MaxTextLength = 60;
|
||||
propertyBox.Text = string.Join(", ", idCardTags);
|
||||
propertyBox.OnEnterPressed = EnterIDCardTags;
|
||||
propertyBox.OnTextChanged = TextBoxChanged;
|
||||
propertyBox.ToolTip = "Characters spawning at this spawnpoint will have the specified tags added to their ID card. You can, for example, use these tags to limit access to some parts of the sub.";
|
||||
propertyBox.ToolTip = TextManager.Get("IDCardTagsTooltip");
|
||||
|
||||
y = y + 30;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, y, 100, 20), "Assigned job:", Color.Transparent, Color.White, Alignment.TopLeft, null, editingHUD);
|
||||
propertyBox = new GUITextBox(new Rectangle(100, y, 350, 20), "", editingHUD);
|
||||
new GUITextBlock(new Rectangle(0, y, 100, 20), TextManager.Get("SpawnpointJobs"), "", Alignment.TopLeft, Alignment.CenterLeft, editingHUD, false, GUI.SmallFont);
|
||||
propertyBox = new GUITextBox(new Rectangle(150, y, 0, 20), "", editingHUD);
|
||||
propertyBox.MaxTextLength = 60;
|
||||
propertyBox.Text = (assignedJob == null) ? "None" : assignedJob.Name;
|
||||
propertyBox.OnEnterPressed = EnterAssignedJob;
|
||||
propertyBox.OnTextChanged = TextBoxChanged;
|
||||
propertyBox.ToolTip = "Only characters with the specified job will spawn at this spawnpoint.";
|
||||
propertyBox.ToolTip = TextManager.Get("SpawnpointJobsTooltip");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -756,12 +756,7 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
|
||||
if (respawnAllowed) respawnManager = new RespawnManager(this, GameMain.NetLobbyScreen.UsingShuttle ? GameMain.NetLobbyScreen.SelectedShuttle : null);
|
||||
|
||||
if (isTraitor)
|
||||
{
|
||||
TraitorManager.CreateStartPopUp(traitorTargetName);
|
||||
}
|
||||
|
||||
|
||||
gameStarted = true;
|
||||
|
||||
GameMain.GameScreen.Select();
|
||||
@@ -974,8 +969,14 @@ namespace Barotrauma.Networking
|
||||
|
||||
private void ReadIngameUpdate(NetIncomingMessage inc)
|
||||
{
|
||||
List<IServerSerializable> entities = new List<IServerSerializable>();
|
||||
|
||||
float sendingTime = inc.ReadFloat() - inc.SenderConnection.RemoteTimeOffset;
|
||||
|
||||
ServerNetObject? prevObjHeader = null;
|
||||
long prevBitPos = 0;
|
||||
long prevBytePos = 0;
|
||||
|
||||
ServerNetObject objHeader;
|
||||
while ((objHeader = (ServerNetObject)inc.ReadByte()) != ServerNetObject.END_OF_MESSAGE)
|
||||
{
|
||||
@@ -1004,15 +1005,51 @@ namespace Barotrauma.Networking
|
||||
break;
|
||||
case ServerNetObject.ENTITY_EVENT:
|
||||
case ServerNetObject.ENTITY_EVENT_INITIAL:
|
||||
entityEventManager.Read(objHeader, inc, sendingTime);
|
||||
entityEventManager.Read(objHeader, inc, sendingTime, entities);
|
||||
break;
|
||||
case ServerNetObject.CHAT_MESSAGE:
|
||||
ChatMessage.ClientRead(inc);
|
||||
break;
|
||||
default:
|
||||
DebugConsole.ThrowError("Error while reading update from server (unknown object header \""+objHeader+"\"!)");
|
||||
if (prevObjHeader != null)
|
||||
{
|
||||
DebugConsole.ThrowError("Previous object type: " + prevObjHeader.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugConsole.ThrowError("Error occurred on the very first object!");
|
||||
}
|
||||
DebugConsole.ThrowError("Previous object was " + (inc.Position - prevBitPos) + " bits long (" + (inc.PositionInBytes - prevBytePos) + " bytes)");
|
||||
if (prevObjHeader == ServerNetObject.ENTITY_EVENT || prevObjHeader == ServerNetObject.ENTITY_EVENT_INITIAL)
|
||||
{
|
||||
foreach (IServerSerializable ent in entities)
|
||||
{
|
||||
if (ent == null)
|
||||
{
|
||||
DebugConsole.ThrowError(" - NULL");
|
||||
continue;
|
||||
}
|
||||
Entity e = ent as Entity;
|
||||
DebugConsole.ThrowError(" - "+e.ToString());
|
||||
}
|
||||
}
|
||||
DebugConsole.ThrowError("Writing object data to \"crashreport_object.bin\", please send this file to us at http://github.com/Regalis11/Barotrauma/issues");
|
||||
|
||||
FileStream fl = File.Open("crashreport_object.bin", FileMode.Create);
|
||||
BinaryWriter sw = new BinaryWriter(fl);
|
||||
|
||||
sw.Write(inc.Data, (int)prevBytePos, (int)(inc.LengthBytes - prevBytePos));
|
||||
|
||||
sw.Close();
|
||||
fl.Close();
|
||||
|
||||
throw new Exception("Error while reading update from server: please send us \"crashreport_object.bin\"!");
|
||||
break;
|
||||
}
|
||||
prevObjHeader = objHeader;
|
||||
prevBitPos = inc.Position;
|
||||
prevBytePos = inc.PositionInBytes;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace Barotrauma.Networking
|
||||
/// <summary>
|
||||
/// Read the events from the message, ignoring ones we've already received
|
||||
/// </summary>
|
||||
public void Read(ServerNetObject type, NetIncomingMessage msg, float sendingTime)
|
||||
public void Read(ServerNetObject type, NetIncomingMessage msg, float sendingTime, List<IServerSerializable> entities)
|
||||
{
|
||||
UInt16 unreceivedEntityEventCount = 0;
|
||||
|
||||
@@ -128,6 +128,8 @@ namespace Barotrauma.Networking
|
||||
firstNewID = null;
|
||||
}
|
||||
|
||||
entities.Clear();
|
||||
|
||||
UInt16 firstEventID = msg.ReadUInt16();
|
||||
int eventCount = msg.ReadByte();
|
||||
|
||||
@@ -146,6 +148,7 @@ namespace Barotrauma.Networking
|
||||
byte msgLength = msg.ReadByte();
|
||||
|
||||
IServerSerializable entity = Entity.FindEntityByID(entityID) as IServerSerializable;
|
||||
entities.Add(entity);
|
||||
|
||||
//skip the event if we've already received it or if the entity isn't found
|
||||
if (thisEventID != (UInt16)(lastReceivedID + 1) || entity == null)
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace Barotrauma.Particles
|
||||
private float lifeTime;
|
||||
|
||||
private Vector2 velocityChange;
|
||||
private Vector2 velocityChangeWater;
|
||||
|
||||
private Vector2 drawPosition;
|
||||
private float drawRotation;
|
||||
@@ -46,6 +47,8 @@ namespace Barotrauma.Particles
|
||||
|
||||
private List<Gap> hullGaps;
|
||||
|
||||
private List<ParticleEmitter> subEmitters = new List<ParticleEmitter>();
|
||||
|
||||
private float animState;
|
||||
private int animFrame;
|
||||
|
||||
@@ -71,6 +74,12 @@ namespace Barotrauma.Particles
|
||||
set { velocityChange = value; }
|
||||
}
|
||||
|
||||
public Vector2 VelocityChangeWater
|
||||
{
|
||||
get { return velocityChangeWater; }
|
||||
set { velocityChangeWater = value; }
|
||||
}
|
||||
|
||||
public Vector2 Velocity
|
||||
{
|
||||
get { return velocity; }
|
||||
@@ -90,6 +99,8 @@ namespace Barotrauma.Particles
|
||||
|
||||
animState = 0;
|
||||
animFrame = 0;
|
||||
dragWait = 0;
|
||||
dragVec = Vector2.Zero;
|
||||
|
||||
currentHull = Hull.FindHull(position, hullGuess);
|
||||
|
||||
@@ -121,9 +132,16 @@ namespace Barotrauma.Particles
|
||||
alpha = prefab.StartAlpha;
|
||||
|
||||
velocityChange = prefab.VelocityChangeDisplay;
|
||||
velocityChangeWater = prefab.VelocityChangeWaterDisplay;
|
||||
|
||||
OnChangeHull = null;
|
||||
|
||||
subEmitters.Clear();
|
||||
foreach (ParticleEmitterPrefab emitterPrefab in prefab.SubEmitters)
|
||||
{
|
||||
subEmitters.Add(new ParticleEmitter(emitterPrefab));
|
||||
}
|
||||
|
||||
if (prefab.DeleteOnCollision || prefab.CollidesWithWalls)
|
||||
{
|
||||
hullGaps = currentHull == null ? new List<Gap>() : currentHull.ConnectedGaps;
|
||||
@@ -158,19 +176,26 @@ namespace Barotrauma.Particles
|
||||
rotation += angularVelocity * deltaTime;
|
||||
}
|
||||
|
||||
if (prefab.WaterDrag > 0.0f &&
|
||||
(currentHull == null || (currentHull.Submarine != null && position.Y - currentHull.Submarine.DrawPosition.Y < currentHull.Surface)))
|
||||
bool inWater = (currentHull == null || (currentHull.Submarine != null && position.Y - currentHull.Submarine.DrawPosition.Y < currentHull.Surface));
|
||||
if (inWater)
|
||||
{
|
||||
ApplyDrag(prefab.WaterDrag, deltaTime);
|
||||
velocity.X += velocityChangeWater.X * deltaTime;
|
||||
velocity.Y += velocityChangeWater.Y * deltaTime;
|
||||
if (prefab.WaterDrag > 0.0f)
|
||||
{
|
||||
ApplyDrag(prefab.WaterDrag, deltaTime);
|
||||
}
|
||||
}
|
||||
else if (prefab.Drag > 0.0f)
|
||||
else
|
||||
{
|
||||
ApplyDrag(prefab.Drag, deltaTime);
|
||||
velocity.X += velocityChange.X * deltaTime;
|
||||
velocity.Y += velocityChange.Y * deltaTime;
|
||||
if (prefab.Drag > 0.0f)
|
||||
{
|
||||
ApplyDrag(prefab.Drag, deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
velocity.X += velocityChange.X * deltaTime;
|
||||
velocity.Y += velocityChange.Y * deltaTime;
|
||||
|
||||
size.X += sizeChange.X * deltaTime;
|
||||
size.Y += sizeChange.Y * deltaTime;
|
||||
|
||||
@@ -191,6 +216,11 @@ namespace Barotrauma.Particles
|
||||
lifeTime -= deltaTime;
|
||||
if (lifeTime <= 0.0f || alpha <= 0.0f || size.X <= 0.0f || size.Y <= 0.0f) return false;
|
||||
|
||||
foreach (ParticleEmitter emitter in subEmitters)
|
||||
{
|
||||
emitter.Emit(deltaTime, position, currentHull);
|
||||
}
|
||||
|
||||
if (!prefab.DeleteOnCollision && !prefab.CollidesWithWalls) return true;
|
||||
|
||||
if (currentHull == null)
|
||||
@@ -200,8 +230,7 @@ namespace Barotrauma.Particles
|
||||
{
|
||||
if (prefab.DeleteOnCollision) return false;
|
||||
OnWallCollisionOutside(collidedHull);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -258,7 +287,7 @@ namespace Barotrauma.Particles
|
||||
}
|
||||
else
|
||||
{
|
||||
Hull newHull = Hull.FindHull(position);
|
||||
Hull newHull = Hull.FindHull(position,currentHull);
|
||||
if (newHull != currentHull)
|
||||
{
|
||||
currentHull = newHull;
|
||||
@@ -280,9 +309,12 @@ namespace Barotrauma.Particles
|
||||
return;
|
||||
}
|
||||
if (Math.Abs(velocity.X) < 0.0001f && Math.Abs(velocity.Y) < 0.0001f) return;
|
||||
|
||||
|
||||
//TODO: some better way to handle particle drag
|
||||
//this doesn't work that well because the drag vector is only updated every 0.5 seconds, allowing the particle to accelerate way more than it should
|
||||
//(e.g. a falling particle can freely accelerate for 0.5 seconds before the drag takes effect)
|
||||
dragWait--;
|
||||
if (dragWait<=0)
|
||||
if (dragWait <= 0)
|
||||
{
|
||||
dragWait = 30;
|
||||
|
||||
|
||||
@@ -32,13 +32,11 @@ namespace Barotrauma.Particles
|
||||
this.cam = cam;
|
||||
|
||||
particles = new Particle[MaxParticles];
|
||||
|
||||
LoadPrefabs(configFile);
|
||||
}
|
||||
|
||||
public void LoadPrefabs(string file)
|
||||
public void LoadPrefabs()
|
||||
{
|
||||
XDocument doc = XMLExtensions.TryLoadXml(file);
|
||||
XDocument doc = XMLExtensions.TryLoadXml(ConfigFile);
|
||||
if (doc == null || doc.Root == null) return;
|
||||
|
||||
prefabs = new Dictionary<string, ParticlePrefab>();
|
||||
@@ -47,7 +45,7 @@ namespace Barotrauma.Particles
|
||||
{
|
||||
if (prefabs.ContainsKey(element.Name.ToString()))
|
||||
{
|
||||
DebugConsole.ThrowError("Error in " + file + "! Each particle prefab must have a unique name.");
|
||||
DebugConsole.ThrowError("Error in " + ConfigFile + "! Each particle prefab must have a unique name.");
|
||||
continue;
|
||||
}
|
||||
prefabs.Add(element.Name.ToString(), new ParticlePrefab(element));
|
||||
|
||||
@@ -101,6 +101,20 @@ namespace Barotrauma.Particles
|
||||
}
|
||||
}
|
||||
|
||||
private Vector2 velocityChangeWater;
|
||||
public Vector2 VelocityChangeWaterDisplay { get; private set; }
|
||||
|
||||
[Editable(ToolTip = "How much the velocity of the particle changes per second when in water."), Serialize("0.0,0.0", false)]
|
||||
public Vector2 VelocityChangeWater
|
||||
{
|
||||
get { return velocityChangeWater; }
|
||||
private set
|
||||
{
|
||||
velocityChangeWater = value;
|
||||
VelocityChangeWaterDisplay = ConvertUnits.ToDisplayUnits(value);
|
||||
}
|
||||
}
|
||||
|
||||
[Editable(0.0f, 10000.0f, ToolTip = "Drag applied to the particle when it's moving through water."), Serialize(0.0f, false)]
|
||||
public float CollisionRadius { get; private set; }
|
||||
|
||||
@@ -164,6 +178,8 @@ namespace Barotrauma.Particles
|
||||
|
||||
//----------------------------------------------------
|
||||
|
||||
public readonly List<ParticleEmitterPrefab> SubEmitters = new List<ParticleEmitterPrefab>();
|
||||
|
||||
public Dictionary<string, SerializableProperty> SerializableProperties
|
||||
{
|
||||
get;
|
||||
@@ -191,9 +207,20 @@ namespace Barotrauma.Particles
|
||||
case "animatedsprite":
|
||||
Sprites.Add(new SpriteSheet(subElement));
|
||||
break;
|
||||
case "particleemitter":
|
||||
case "emitter":
|
||||
case "subemitter":
|
||||
SubEmitters.Add(new ParticleEmitterPrefab(subElement));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//if velocity change in water is not given, it defaults to the normal velocity change
|
||||
if (element.Attribute("velocitychangewater") == null)
|
||||
{
|
||||
VelocityChangeWater = VelocityChange;
|
||||
}
|
||||
|
||||
if (element.Attribute("angularvelocity") != null)
|
||||
{
|
||||
AngularVelocityMin = element.GetAttributeFloat("angularvelocity", 0.0f);
|
||||
|
||||
@@ -28,25 +28,25 @@ namespace Barotrauma
|
||||
this.newGameContainer = newGameContainer;
|
||||
this.loadGameContainer = loadGameContainer;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 30), "Selected submarine:", null, null, Alignment.Left, "", newGameContainer);
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 30), TextManager.Get("SelectedSub") + ":", null, null, Alignment.Left, "", newGameContainer);
|
||||
subList = new GUIListBox(new Rectangle(0, 30, 230, newGameContainer.Rect.Height - 100), "", newGameContainer);
|
||||
|
||||
UpdateSubList();
|
||||
|
||||
new GUITextBlock(new Rectangle((int)(subList.Rect.Width + 20), 0, 100, 20),
|
||||
"Save name: ", "", Alignment.Left, Alignment.Left, newGameContainer);
|
||||
TextManager.Get("SaveName") + ": ", "", Alignment.Left, Alignment.Left, newGameContainer);
|
||||
|
||||
saveNameBox = new GUITextBox(new Rectangle((int)(subList.Rect.Width + 30), 30, 180, 20),
|
||||
Alignment.TopLeft, "", newGameContainer);
|
||||
|
||||
new GUITextBlock(new Rectangle((int)(subList.Rect.Width + 20), 60, 100, 20),
|
||||
"Map Seed: ", "", Alignment.Left, Alignment.Left, newGameContainer);
|
||||
TextManager.Get("MapSeed") + ": ", "", Alignment.Left, Alignment.Left, newGameContainer);
|
||||
|
||||
seedBox = new GUITextBox(new Rectangle((int)(subList.Rect.Width + 30), 90, 180, 20),
|
||||
Alignment.TopLeft, "", newGameContainer);
|
||||
seedBox.Text = ToolBox.RandomSeed(8);
|
||||
|
||||
var startButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", Alignment.BottomRight, "", newGameContainer);
|
||||
var startButton = new GUIButton(new Rectangle(0, 0, 100, 30), TextManager.Get("StartCampaignButton"), Alignment.BottomRight, "", newGameContainer);
|
||||
startButton.OnClicked = (GUIButton btn, object userData) =>
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(saveNameBox.Text))
|
||||
@@ -58,10 +58,9 @@ namespace Barotrauma
|
||||
Submarine selectedSub = subList.SelectedData as Submarine;
|
||||
if (selectedSub != null && selectedSub.HasTag(SubmarineTag.Shuttle))
|
||||
{
|
||||
var msgBox = new GUIMessageBox("Shuttle selected",
|
||||
"Most shuttles are not adequately equipped to deal with the dangers of the Europan depths. " +
|
||||
"Are you sure you want to choose a shuttle as your vessel?",
|
||||
new string[] { "Yes", "No" });
|
||||
var msgBox = new GUIMessageBox(TextManager.Get("ShuttleSelected"),
|
||||
TextManager.Get("ShuttleWarning"),
|
||||
new string[] { TextManager.Get("Yes"), TextManager.Get("No") });
|
||||
|
||||
string savePath = SaveUtil.CreateSavePath(isMultiplayer ? SaveUtil.SaveType.Multiplayer : SaveUtil.SaveType.Singleplayer, saveNameBox.Text);
|
||||
msgBox.Buttons[0].OnClicked = (button, obj) => { StartNewGame?.Invoke(selectedSub, savePath, seedBox.Text); return true; };
|
||||
@@ -110,7 +109,7 @@ namespace Barotrauma
|
||||
{
|
||||
textBlock.TextColor = textBlock.TextColor * 0.85f;
|
||||
|
||||
var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "Shuttle", "", Alignment.Left, Alignment.CenterY | Alignment.Right, textBlock, false, GUI.SmallFont);
|
||||
var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), TextManager.Get("Shuttle"), "", Alignment.Left, Alignment.CenterY | Alignment.Right, textBlock, false, GUI.SmallFont);
|
||||
shuttleText.TextColor = textBlock.TextColor * 0.8f;
|
||||
shuttleText.ToolTip = textBlock.ToolTip;
|
||||
}
|
||||
@@ -140,7 +139,7 @@ namespace Barotrauma
|
||||
textBlock.UserData = saveFile;
|
||||
}
|
||||
|
||||
loadGameButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", Alignment.Right | Alignment.Bottom, "", loadGameContainer);
|
||||
loadGameButton = new GUIButton(new Rectangle(0, 0, 100, 30), TextManager.Get("LoadButton"), Alignment.Right | Alignment.Bottom, "", loadGameContainer);
|
||||
loadGameButton.OnClicked = (btn, obj) =>
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(saveList.SelectedData as string)) return false;
|
||||
@@ -176,16 +175,16 @@ namespace Barotrauma
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 20), Path.GetFileNameWithoutExtension(fileName), "", Alignment.TopLeft, Alignment.TopLeft, saveFileFrame, false, GUI.LargeFont);
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 35, 0, 20), "Submarine: ", "", saveFileFrame).Font = GUI.SmallFont;
|
||||
new GUITextBlock(new Rectangle(0, 35, 0, 20), TextManager.Get("Submarine") + ":", "", saveFileFrame).Font = GUI.SmallFont;
|
||||
new GUITextBlock(new Rectangle(15, 52, 0, 20), subName, "", saveFileFrame).Font = GUI.SmallFont;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 70, 0, 20), "Last saved: ", "", saveFileFrame).Font = GUI.SmallFont;
|
||||
new GUITextBlock(new Rectangle(0, 70, 0, 20), TextManager.Get("LastSaved") + ":", "", saveFileFrame).Font = GUI.SmallFont;
|
||||
new GUITextBlock(new Rectangle(15, 85, 0, 20), saveTime, "", saveFileFrame).Font = GUI.SmallFont;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 105, 0, 20), "Map seed: ", "", saveFileFrame).Font = GUI.SmallFont;
|
||||
new GUITextBlock(new Rectangle(0, 105, 0, 20), TextManager.Get("MapSeed") + ":", "", saveFileFrame).Font = GUI.SmallFont;
|
||||
new GUITextBlock(new Rectangle(15, 120, 0, 20), mapseed, "", saveFileFrame).Font = GUI.SmallFont;
|
||||
|
||||
var deleteSaveButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Delete", Alignment.BottomCenter, "", saveFileFrame);
|
||||
var deleteSaveButton = new GUIButton(new Rectangle(0, 0, 100, 20), TextManager.Get("Delete"), Alignment.BottomCenter, "", saveFileFrame);
|
||||
deleteSaveButton.UserData = fileName;
|
||||
deleteSaveButton.OnClicked = DeleteSave;
|
||||
|
||||
|
||||
@@ -56,12 +56,12 @@ namespace Barotrauma
|
||||
|
||||
int crewColumnWidth = Math.Min(300, (container.Rect.Width - 40) / 2);
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 0, 100, 20), "Crew:", "", tabs[(int)Tab.Crew], GUI.LargeFont);
|
||||
new GUITextBlock(new Rectangle(0, 0, 100, 20), TextManager.Get("Crew") + ":", "", tabs[(int)Tab.Crew], GUI.LargeFont);
|
||||
characterList = new GUIListBox(new Rectangle(0, 40, crewColumnWidth, 0), "", tabs[(int)Tab.Crew]);
|
||||
characterList.OnSelected = SelectCharacter;
|
||||
|
||||
hireList = new GUIListBox(new Rectangle(0, 40, 300, 0), "", Alignment.Right, tabs[(int)Tab.Crew]);
|
||||
new GUITextBlock(new Rectangle(0, 0, 300, 20), "Hire:", "", Alignment.Right, Alignment.Left, tabs[(int)Tab.Crew], false, GUI.LargeFont);
|
||||
new GUITextBlock(new Rectangle(0, 0, 300, 20), TextManager.Get("Hire") + ":", "", Alignment.Right, Alignment.Left, tabs[(int)Tab.Crew], false, GUI.LargeFont);
|
||||
hireList.OnSelected = SelectCharacter;
|
||||
|
||||
//---------------------------------------
|
||||
@@ -71,7 +71,7 @@ namespace Barotrauma
|
||||
|
||||
if (GameMain.Client == null)
|
||||
{
|
||||
startButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Start",
|
||||
startButton = new GUIButton(new Rectangle(0, 0, 100, 30), TextManager.Get("StartCampaignButton"),
|
||||
Alignment.BottomRight, "", tabs[(int)Tab.Map]);
|
||||
startButton.OnClicked = (GUIButton btn, object obj) => { StartRound?.Invoke(); return true; };
|
||||
startButton.Enabled = false;
|
||||
@@ -132,7 +132,7 @@ namespace Barotrauma
|
||||
hireList.ClearChildren();
|
||||
hireList.Enabled = false;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 0), "No-one available for hire", Color.Transparent, Color.LightGray, Alignment.Center, Alignment.Center, "", hireList);
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 0), TextManager.Get("HireUnavailable"), Color.Transparent, Color.LightGray, Alignment.Center, Alignment.Center, "", hireList);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -204,8 +204,8 @@ namespace Barotrauma
|
||||
{
|
||||
var mission = GameMain.GameSession.Map.SelectedConnection.Mission;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, titleText.Rect.Height + 20, 0, 20), "Mission: " + mission.Name, "", locationPanel);
|
||||
new GUITextBlock(new Rectangle(0, titleText.Rect.Height + 40, 0, 20), "Reward: " + mission.Reward + " credits", "", locationPanel);
|
||||
new GUITextBlock(new Rectangle(0, titleText.Rect.Height + 20, 0, 20), TextManager.Get("Mission") + ": " + mission.Name, "", locationPanel);
|
||||
new GUITextBlock(new Rectangle(0, titleText.Rect.Height + 40, 0, 20), TextManager.Get("Reward") + ": " + mission.Reward + " " + TextManager.Get("Credits"), "", locationPanel);
|
||||
new GUITextBlock(new Rectangle(0, titleText.Rect.Height + 70, 0, 0), mission.Description, "", Alignment.TopLeft, Alignment.TopLeft, locationPanel, true, GUI.SmallFont);
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ namespace Barotrauma
|
||||
|
||||
public string GetMoney()
|
||||
{
|
||||
return "Money: " + ((GameMain.GameSession == null) ? "0" : string.Format(CultureInfo.InvariantCulture, "{0:N0}", campaign.Money)) + " credits";
|
||||
return TextManager.Get("Credits") + ": " + ((GameMain.GameSession == null) ? "0" : string.Format(CultureInfo.InvariantCulture, "{0:N0}", campaign.Money));
|
||||
}
|
||||
|
||||
private bool SelectCharacter(GUIComponent component, object selection)
|
||||
@@ -375,7 +375,7 @@ namespace Barotrauma
|
||||
|
||||
if (component.Parent == hireList)
|
||||
{
|
||||
GUIButton hireButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Hire", Alignment.BottomCenter, "", characterPreviewFrame);
|
||||
GUIButton hireButton = new GUIButton(new Rectangle(0, 0, 100, 20), TextManager.Get("HireButton"), Alignment.BottomCenter, "", characterPreviewFrame);
|
||||
hireButton.Enabled = campaign.Money >= characterInfo.Salary;
|
||||
hireButton.UserData = characterInfo;
|
||||
hireButton.OnClicked = HireCharacter;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Content;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
@@ -14,7 +14,7 @@ namespace Barotrauma
|
||||
readonly RenderTarget2D renderTargetBackground;
|
||||
readonly RenderTarget2D renderTarget;
|
||||
readonly RenderTarget2D renderTargetWater;
|
||||
readonly RenderTarget2D renderTargetAir;
|
||||
readonly RenderTarget2D renderTargetFinal;
|
||||
|
||||
private Effect damageEffect;
|
||||
|
||||
@@ -27,9 +27,9 @@ namespace Barotrauma
|
||||
cam.Translate(new Vector2(-10.0f, 50.0f));
|
||||
|
||||
renderTargetBackground = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||
renderTarget = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||
renderTarget = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight, false, SurfaceFormat.Color, DepthFormat.None, 0, RenderTargetUsage.PreserveContents);
|
||||
renderTargetWater = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||
renderTargetAir = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||
renderTargetFinal = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight, false, SurfaceFormat.Color, DepthFormat.None);
|
||||
|
||||
|
||||
#if LINUX
|
||||
@@ -97,7 +97,6 @@ namespace Barotrauma
|
||||
|
||||
public void DrawMap(GraphicsDevice graphics, SpriteBatch spriteBatch)
|
||||
{
|
||||
|
||||
foreach (Submarine sub in Submarine.Loaded)
|
||||
{
|
||||
sub.UpdateTransform();
|
||||
@@ -113,197 +112,138 @@ namespace Barotrauma
|
||||
GameMain.LightManager.UpdateObstructVision(graphics, spriteBatch, cam, Character.Controlled.CursorWorldPosition);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
//1. draw the background, characters and the parts of the submarine that are behind them
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
graphics.SetRenderTarget(renderTargetBackground);
|
||||
|
||||
if (Level.Loaded == null)
|
||||
{
|
||||
graphics.Clear(new Color(11, 18, 26, 255));
|
||||
}
|
||||
else
|
||||
{
|
||||
//graphics.Clear(new Color(255, 255, 255, 255));
|
||||
Level.Loaded.DrawBack(graphics, spriteBatch, cam);
|
||||
}
|
||||
|
||||
//draw structures that are in water and not part of any sub (e.g. ruins)
|
||||
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, cam.Transform);
|
||||
Submarine.DrawBack(spriteBatch, false, s => s is Structure && s.Submarine == null);
|
||||
spriteBatch.End();
|
||||
|
||||
//draw alpha blended particles that are in water and behind subs
|
||||
//draw alpha blended particles that are in water and behind subs
|
||||
#if LINUX
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.None, null, null, cam.Transform);
|
||||
#else
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.None, null, null, cam.Transform);
|
||||
#endif
|
||||
GameMain.ParticleManager.Draw(spriteBatch, true, false, Particles.ParticleBlendState.AlphaBlend);
|
||||
spriteBatch.End();
|
||||
|
||||
//draw additive particles that are in water and behind subs
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, DepthStencilState.Default, null, null, cam.Transform);
|
||||
GameMain.ParticleManager.Draw(spriteBatch, true, false, Particles.ParticleBlendState.Additive);
|
||||
spriteBatch.End();
|
||||
|
||||
//draw submarine structures that are behind water
|
||||
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, cam.Transform);
|
||||
Submarine.DrawBack(spriteBatch, false, s => s is Structure && s.Submarine != null);
|
||||
spriteBatch.End();
|
||||
GameMain.ParticleManager.Draw(spriteBatch, true, false, Particles.ParticleBlendState.AlphaBlend);
|
||||
spriteBatch.End();
|
||||
|
||||
//draw additive particles that are in water and behind subs
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, DepthStencilState.None, null, null, cam.Transform);
|
||||
GameMain.ParticleManager.Draw(spriteBatch, true, false, Particles.ParticleBlendState.Additive);
|
||||
spriteBatch.End();
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.None, null, null, cam.Transform);
|
||||
Submarine.DrawBack(spriteBatch, false, s => s is Structure && ((Structure)s).ResizeVertical && ((Structure)s).ResizeHorizontal);
|
||||
foreach (Structure s in Structure.WallList)
|
||||
{
|
||||
if ((s.ResizeVertical != s.ResizeHorizontal) && s.CastShadow)
|
||||
{
|
||||
GUI.DrawRectangle(spriteBatch, new Vector2(s.DrawPosition.X-s.WorldRect.Width/2,-s.DrawPosition.Y-s.WorldRect.Height/2), new Vector2(s.WorldRect.Width, s.WorldRect.Height), Color.Black, true);
|
||||
}
|
||||
}
|
||||
spriteBatch.End();
|
||||
graphics.SetRenderTarget(renderTarget);
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred,
|
||||
BlendState.Opaque);
|
||||
spriteBatch.Draw(renderTargetBackground, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
||||
spriteBatch.End();
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
||||
BlendState.AlphaBlend,
|
||||
null, null, null, null,
|
||||
cam.Transform);
|
||||
|
||||
Submarine.DrawBack(spriteBatch, false, s => !(s is Structure));
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.None, null, null, null);
|
||||
spriteBatch.Draw(renderTargetBackground, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
||||
spriteBatch.End();
|
||||
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, DepthStencilState.None, null, null, cam.Transform);
|
||||
Submarine.DrawBack(spriteBatch, false, s => !(s is Structure));
|
||||
Submarine.DrawBack(spriteBatch, false, s => s is Structure && !(((Structure)s).ResizeVertical && ((Structure)s).ResizeHorizontal));
|
||||
foreach (Character c in Character.CharacterList) c.Draw(spriteBatch);
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
//draw the rendertarget and particles that are only supposed to be drawn in water into renderTargetWater
|
||||
graphics.SetRenderTarget(renderTargetWater);
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque);
|
||||
spriteBatch.Draw(renderTarget, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), waterColor);
|
||||
spriteBatch.End();
|
||||
|
||||
//draw alpha blended particles that are inside a sub
|
||||
#if LINUX
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
||||
#else
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
||||
#endif
|
||||
GameMain.ParticleManager.Draw(spriteBatch, true, true, Particles.ParticleBlendState.AlphaBlend);
|
||||
spriteBatch.End();
|
||||
|
||||
//draw additive particles that are inside a sub
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, DepthStencilState.Default, null, null, cam.Transform);
|
||||
GameMain.ParticleManager.Draw(spriteBatch, true, true, Particles.ParticleBlendState.Additive);
|
||||
spriteBatch.End();
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
//draw the rendertarget and particles that are only supposed to be drawn in air into renderTargetAir
|
||||
|
||||
graphics.SetRenderTarget(renderTargetAir);
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque);
|
||||
spriteBatch.Draw(renderTarget, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
||||
spriteBatch.End();
|
||||
|
||||
//draw alpha blended particles that are not in water
|
||||
#if LINUX
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
||||
#else
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
||||
#endif
|
||||
GameMain.ParticleManager.Draw(spriteBatch, false, null, Particles.ParticleBlendState.AlphaBlend);
|
||||
spriteBatch.End();
|
||||
|
||||
//draw additive particles that are not in water
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
||||
GameMain.ParticleManager.Draw(spriteBatch, false, null, Particles.ParticleBlendState.Additive);
|
||||
spriteBatch.End();
|
||||
|
||||
if (Character.Controlled != null && GameMain.LightManager.LosEnabled)
|
||||
{
|
||||
graphics.SetRenderTarget(renderTarget);
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred,
|
||||
BlendState.Opaque, null, null, null, lightBlur.Effect);
|
||||
|
||||
spriteBatch.Draw(renderTargetBackground, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
||||
BlendState.AlphaBlend, SamplerState.LinearWrap,
|
||||
null, null, null,
|
||||
cam.Transform);
|
||||
|
||||
Submarine.DrawDamageable(spriteBatch, null, false);
|
||||
Submarine.DrawFront(spriteBatch, false, s => s is Structure);
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
GameMain.LightManager.DrawLOS(spriteBatch, lightBlur.Effect, true);
|
||||
}
|
||||
|
||||
graphics.SetRenderTarget(null);
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
//2. pass the renderTarget to the water shader to do the water effect
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
Hull.renderer.RenderBack(spriteBatch, renderTargetWater);
|
||||
|
||||
Array.Clear(Hull.renderer.vertices, 0, Hull.renderer.vertices.Length);
|
||||
Hull.renderer.PositionInBuffer = 0;
|
||||
foreach (Hull hull in Hull.hullList)
|
||||
{
|
||||
hull.Render(graphics, cam);
|
||||
}
|
||||
|
||||
Hull.renderer.Render(graphics, cam, renderTargetAir, Cam.ShaderTransform);
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
//3. draw the sections of the map that are on top of the water
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
||||
BlendState.AlphaBlend, SamplerState.LinearWrap,
|
||||
null, null, null,
|
||||
cam.Transform);
|
||||
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, null, null, cam.Transform);
|
||||
|
||||
Submarine.DrawFront(spriteBatch, false, null);
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Immediate,
|
||||
BlendState.NonPremultiplied, SamplerState.LinearWrap,
|
||||
null, null,
|
||||
damageEffect,
|
||||
cam.Transform);
|
||||
//draw the rendertarget and particles that are only supposed to be drawn in water into renderTargetWater
|
||||
graphics.SetRenderTarget(renderTargetWater);
|
||||
|
||||
Submarine.DrawDamageable(spriteBatch, damageEffect, false);
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque);
|
||||
spriteBatch.Draw(renderTarget, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), waterColor);
|
||||
spriteBatch.End();
|
||||
|
||||
spriteBatch.End();
|
||||
//draw alpha blended particles that are inside a sub
|
||||
#if LINUX
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
||||
#else
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
||||
#endif
|
||||
GameMain.ParticleManager.Draw(spriteBatch, true, true, Particles.ParticleBlendState.AlphaBlend);
|
||||
spriteBatch.End();
|
||||
|
||||
GameMain.LightManager.DrawLightMap(spriteBatch, lightBlur.Effect);
|
||||
graphics.SetRenderTarget(renderTarget);
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
||||
BlendState.AlphaBlend, SamplerState.LinearWrap,
|
||||
null, null, null,
|
||||
cam.Transform);
|
||||
//draw alpha blended particles that are not in water
|
||||
#if LINUX
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
||||
#else
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
||||
#endif
|
||||
GameMain.ParticleManager.Draw(spriteBatch, false, null, Particles.ParticleBlendState.AlphaBlend);
|
||||
spriteBatch.End();
|
||||
|
||||
if (Level.Loaded != null) Level.Loaded.DrawFront(spriteBatch);
|
||||
//draw additive particles that are not in water
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, DepthStencilState.None, null, null, cam.Transform);
|
||||
GameMain.ParticleManager.Draw(spriteBatch, false, null, Particles.ParticleBlendState.Additive);
|
||||
spriteBatch.End();
|
||||
|
||||
foreach (Character c in Character.CharacterList) c.DrawFront(spriteBatch, cam);
|
||||
graphics.SetRenderTarget(renderTargetFinal);
|
||||
Hull.renderer.RenderBack(spriteBatch, renderTargetWater);
|
||||
|
||||
spriteBatch.End();
|
||||
Array.Clear(Hull.renderer.vertices, 0, Hull.renderer.vertices.Length);
|
||||
Hull.renderer.PositionInBuffer = 0;
|
||||
foreach (Hull hull in Hull.hullList)
|
||||
{
|
||||
hull.Render(graphics, cam);
|
||||
}
|
||||
|
||||
if (Character.Controlled != null && GameMain.LightManager.LosEnabled)
|
||||
{
|
||||
GameMain.LightManager.DrawLOS(spriteBatch, lightBlur.Effect, false);
|
||||
Hull.renderer.Render(graphics, cam, renderTarget, Cam.ShaderTransform);
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Immediate,
|
||||
BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.None, RasterizerState.CullNone, null);
|
||||
spriteBatch.Begin(SpriteSortMode.Immediate,
|
||||
BlendState.NonPremultiplied, SamplerState.LinearWrap,
|
||||
null, null,
|
||||
damageEffect,
|
||||
cam.Transform);
|
||||
Submarine.DrawDamageable(spriteBatch, damageEffect, false);
|
||||
spriteBatch.End();
|
||||
|
||||
float r = Math.Min(CharacterHUD.damageOverlayTimer * 0.5f, 0.5f);
|
||||
spriteBatch.Draw(renderTarget, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight),
|
||||
Color.Lerp(GameMain.LightManager.AmbientLight * 0.5f, Color.Red, r));
|
||||
//draw additive particles that are inside a sub
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, DepthStencilState.Default, null, null, cam.Transform);
|
||||
GameMain.ParticleManager.Draw(spriteBatch, true, true, Particles.ParticleBlendState.Additive);
|
||||
spriteBatch.End();
|
||||
if (GameMain.LightManager.LightingEnabled)
|
||||
{
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, Lights.CustomBlendStates.Multiplicative, null, DepthStencilState.None, null, null, null);
|
||||
spriteBatch.Draw(GameMain.LightManager.lightMap, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
||||
spriteBatch.End();
|
||||
}
|
||||
|
||||
spriteBatch.End();
|
||||
}
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.None, null, null, cam.Transform);
|
||||
foreach (Character c in Character.CharacterList) c.DrawFront(spriteBatch, cam);
|
||||
|
||||
if (Level.Loaded != null) Level.Loaded.DrawFront(spriteBatch);
|
||||
spriteBatch.End();
|
||||
|
||||
graphics.SetRenderTarget(null);
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque, SamplerState.PointClamp, DepthStencilState.None, null, null, null);
|
||||
if (GameMain.LightManager.LosEnabled && Character.Controlled!=null)
|
||||
{
|
||||
float r = Math.Min(CharacterHUD.damageOverlayTimer * 0.5f, 0.5f);
|
||||
spriteBatch.Draw(renderTargetBackground, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight),
|
||||
Color.Lerp(GameMain.LightManager.AmbientLight * 0.5f, Color.Red, r));
|
||||
spriteBatch.End();
|
||||
GameMain.LightManager.losEffect.CurrentTechnique = GameMain.LightManager.losEffect.Techniques["LosShader"];
|
||||
GameMain.LightManager.losEffect.Parameters["xTexture"].SetValue(renderTargetFinal);
|
||||
GameMain.LightManager.losEffect.Parameters["xLosTexture"].SetValue(GameMain.LightManager.losTexture);
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, null, GameMain.LightManager.losEffect, null);
|
||||
}
|
||||
spriteBatch.Draw(renderTargetFinal, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
||||
spriteBatch.End();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,16 +44,16 @@ namespace Barotrauma
|
||||
Alignment.BottomLeft, Alignment.BottomLeft, topPanel);
|
||||
moneyText.TextGetter = GetMoney;
|
||||
|
||||
GUIButton button = new GUIButton(new Rectangle(-240, 0, 100, 30), "Map", null, Alignment.BottomRight, "", topPanel);
|
||||
GUIButton button = new GUIButton(new Rectangle(-240, 0, 100, 30), TextManager.Get("Map"), null, Alignment.BottomRight, "", topPanel);
|
||||
button.UserData = CampaignUI.Tab.Map;
|
||||
button.OnClicked = SelectTab;
|
||||
SelectTab(button, button.UserData);
|
||||
|
||||
button = new GUIButton(new Rectangle(-120, 0, 100, 30), "Crew", null, Alignment.BottomRight, "", topPanel);
|
||||
button = new GUIButton(new Rectangle(-120, 0, 100, 30), TextManager.Get("Crew"), null, Alignment.BottomRight, "", topPanel);
|
||||
button.UserData = CampaignUI.Tab.Crew;
|
||||
button.OnClicked = SelectTab;
|
||||
|
||||
button = new GUIButton(new Rectangle(0, 0, 100, 30), "Store", null, Alignment.BottomRight, "", topPanel);
|
||||
button = new GUIButton(new Rectangle(0, 0, 100, 30), TextManager.Get("Store"), null, Alignment.BottomRight, "", topPanel);
|
||||
button.UserData = CampaignUI.Tab.Store;
|
||||
button.OnClicked = SelectTab;
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
|
||||
locationTitle.Text = "Location: " + campaign.Map.CurrentLocation.Name;
|
||||
locationTitle.Text = TextManager.Get("Location") + ": " + campaign.Map.CurrentLocation.Name;
|
||||
|
||||
bottomPanel.ClearChildren();
|
||||
campaignUI = new CampaignUI(campaign, bottomPanel);
|
||||
|
||||
@@ -38,41 +38,41 @@ namespace Barotrauma
|
||||
290, y,
|
||||
500, 360);
|
||||
|
||||
GUIButton button = new GUIButton(new Rectangle(50, y, 200, 30), "Tutorial", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
||||
GUIButton button = new GUIButton(new Rectangle(50, y, 200, 30), TextManager.Get("TutorialButton"), null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
||||
|
||||
button.Color = button.Color * 0.8f;
|
||||
button.OnClicked = TutorialButtonClicked;
|
||||
|
||||
button = new GUIButton(new Rectangle(50, y + 60, 200, 30), "New Game", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
||||
button = new GUIButton(new Rectangle(50, y + 60, 200, 30), TextManager.Get("NewGameButton"), null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
||||
button.Color = button.Color * 0.8f;
|
||||
button.UserData = Tab.NewGame;
|
||||
button.OnClicked = SelectTab;
|
||||
|
||||
button = new GUIButton(new Rectangle(50, y + 100, 200, 30), "Load Game", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
||||
button = new GUIButton(new Rectangle(50, y + 100, 200, 30), TextManager.Get("LoadGameButton"), null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
||||
button.Color = button.Color * 0.8f;
|
||||
button.UserData = Tab.LoadGame;
|
||||
button.OnClicked = SelectTab;
|
||||
|
||||
button = new GUIButton(new Rectangle(50, y + 160, 200, 30), "Join Server", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
||||
button = new GUIButton(new Rectangle(50, y + 160, 200, 30), TextManager.Get("JoinServerButton"), null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
||||
button.Color = button.Color * 0.8f;
|
||||
//button.UserData = (int)Tabs.JoinServer;
|
||||
button.OnClicked = JoinServerClicked;
|
||||
|
||||
button = new GUIButton(new Rectangle(50, y + 200, 200, 30), "Host Server", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
||||
button = new GUIButton(new Rectangle(50, y + 200, 200, 30), TextManager.Get("HostServerButton"), null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
||||
button.Color = button.Color * 0.8f;
|
||||
button.UserData = Tab.HostServer;
|
||||
button.OnClicked = SelectTab;
|
||||
|
||||
button = new GUIButton(new Rectangle(50, y + 260, 200, 30), "Submarine Editor", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
||||
button = new GUIButton(new Rectangle(50, y + 260, 200, 30), TextManager.Get("SubEditorButton"), null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
||||
button.Color = button.Color * 0.8f;
|
||||
button.OnClicked = (GUIButton btn, object userdata) => { GameMain.SubEditorScreen.Select(); return true; };
|
||||
|
||||
button = new GUIButton(new Rectangle(50, y + 320, 200, 30), "Settings", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
||||
button = new GUIButton(new Rectangle(50, y + 320, 200, 30), TextManager.Get("SettingsButton"), null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
||||
button.Color = button.Color * 0.8f;
|
||||
button.UserData = Tab.Settings;
|
||||
button.OnClicked = SelectTab;
|
||||
|
||||
button = new GUIButton(new Rectangle(0, 0, 150, 30), "Quit", Alignment.BottomRight, "", buttonsTab);
|
||||
button = new GUIButton(new Rectangle(0, 0, 150, 30), TextManager.Get("QuitButton"), Alignment.BottomRight, "", buttonsTab);
|
||||
button.Color = button.Color * 0.8f;
|
||||
button.OnClicked = QuitClicked;
|
||||
|
||||
@@ -93,15 +93,15 @@ namespace Barotrauma
|
||||
|
||||
menuTabs[(int)Tab.HostServer] = new GUIFrame(panelRect, "");
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 0, 100, 30), "Server Name:", "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
|
||||
new GUITextBlock(new Rectangle(0, 0, 100, 30), TextManager.Get("ServerName"), "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
|
||||
serverNameBox = new GUITextBox(new Rectangle(160, 0, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, "", menuTabs[(int)Tab.HostServer]);
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 50, 100, 30), "Server port:", "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
|
||||
new GUITextBlock(new Rectangle(0, 50, 100, 30), TextManager.Get("ServerPort"), "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
|
||||
portBox = new GUITextBox(new Rectangle(160, 50, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, "", menuTabs[(int)Tab.HostServer]);
|
||||
portBox.Text = NetConfig.DefaultPort.ToString();
|
||||
portBox.ToolTip = "Server port";
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 100, 100, 30), "Max players:", "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
|
||||
new GUITextBlock(new Rectangle(0, 100, 100, 30), TextManager.Get("MaxPlayers"), "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
|
||||
maxPlayersBox = new GUITextBox(new Rectangle(195, 100, 30, 30), null, null, Alignment.TopLeft, Alignment.Center, "", menuTabs[(int)Tab.HostServer]);
|
||||
maxPlayersBox.Text = "8";
|
||||
maxPlayersBox.Enabled = false;
|
||||
@@ -114,19 +114,16 @@ namespace Barotrauma
|
||||
plusPlayersBox.UserData = 1;
|
||||
plusPlayersBox.OnClicked = ChangeMaxPlayers;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 150, 100, 30), "Password (optional):", "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
|
||||
new GUITextBlock(new Rectangle(0, 150, 100, 30), TextManager.Get("Password"), "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
|
||||
passwordBox = new GUITextBox(new Rectangle(160, 150, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, "", menuTabs[(int)Tab.HostServer]);
|
||||
|
||||
isPublicBox = new GUITickBox(new Rectangle(10, 200, 20, 20), "Public server", Alignment.TopLeft, menuTabs[(int)Tab.HostServer]);
|
||||
isPublicBox.ToolTip = "Public servers are shown in the list of available servers in the \"Join Server\" -tab";
|
||||
|
||||
|
||||
useUpnpBox = new GUITickBox(new Rectangle(10, 250, 20, 20), "Attempt UPnP port forwarding", Alignment.TopLeft, menuTabs[(int)Tab.HostServer]);
|
||||
useUpnpBox.ToolTip = "UPnP can be used for forwarding ports on your router to allow players join the server."
|
||||
+ " However, UPnP isn't supported by all routers, so you may need to setup port forwards manually"
|
||||
+" if players are unable to join the server (see the readme for instructions).";
|
||||
isPublicBox = new GUITickBox(new Rectangle(10, 200, 20, 20), TextManager.Get("PublicServer"), Alignment.TopLeft, menuTabs[(int)Tab.HostServer]);
|
||||
isPublicBox.ToolTip = TextManager.Get("PublicServerToolTip");
|
||||
|
||||
GUIButton hostButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", Alignment.BottomRight, "", menuTabs[(int)Tab.HostServer]);
|
||||
useUpnpBox = new GUITickBox(new Rectangle(10, 250, 20, 20), TextManager.Get("AttemptUPnP"), Alignment.TopLeft, menuTabs[(int)Tab.HostServer]);
|
||||
useUpnpBox.ToolTip = TextManager.Get("AttemptUPnPToolTip");
|
||||
|
||||
GUIButton hostButton = new GUIButton(new Rectangle(0, 0, 100, 30), TextManager.Get("StartServerButton"), Alignment.BottomRight, "", menuTabs[(int)Tab.HostServer]);
|
||||
hostButton.OnClicked = HostServerClicked;
|
||||
|
||||
this.game = game;
|
||||
@@ -179,8 +176,10 @@ namespace Barotrauma
|
||||
{
|
||||
if (GameMain.Config.UnsavedSettings)
|
||||
{
|
||||
var applyBox = new GUIMessageBox("Apply changes?", "Do you want to apply the settings or discard the changes?",
|
||||
new string[] {"Apply", "Discard"});
|
||||
var applyBox = new GUIMessageBox(
|
||||
TextManager.Get("ApplySettingsLabel"),
|
||||
TextManager.Get("ApplySettingsQuestion"),
|
||||
new string[] { TextManager.Get("ApplySettingsYes"), TextManager.Get("ApplySettingsNo") });
|
||||
applyBox.Buttons[0].OnClicked += applyBox.Close;
|
||||
applyBox.Buttons[0].OnClicked += ApplySettings;
|
||||
applyBox.Buttons[0].UserData = tab;
|
||||
@@ -216,7 +215,9 @@ namespace Barotrauma
|
||||
|
||||
if (GameMain.GraphicsWidth != GameMain.Config.GraphicsWidth || GameMain.GraphicsHeight != GameMain.Config.GraphicsHeight)
|
||||
{
|
||||
new GUIMessageBox("Restart required", "You need to restart the game for the resolution changes to take effect.");
|
||||
new GUIMessageBox(
|
||||
TextManager.Get("RestartRequiredLabel"),
|
||||
TextManager.Get("RestartRequiredText"));
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -354,7 +355,7 @@ namespace Barotrauma
|
||||
|
||||
if (selectedSub == null)
|
||||
{
|
||||
new GUIMessageBox("Submarine not selected", "Please select a submarine");
|
||||
new GUIMessageBox(TextManager.Get("SubNotSelected"), TextManager.Get("SelectSubRequest"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -186,11 +186,11 @@ namespace Barotrauma
|
||||
if (GameMain.Server != null)
|
||||
{
|
||||
if (!GameMain.Server.AutoRestart || GameMain.Server.ConnectedClients.Count == 0) return "";
|
||||
return "Restarting in " + ToolBox.SecondsToReadableTime(Math.Max(GameMain.Server.AutoRestartTimer, 0));
|
||||
return TextManager.Get("RestartingIn") + " " + ToolBox.SecondsToReadableTime(Math.Max(GameMain.Server.AutoRestartTimer, 0));
|
||||
}
|
||||
|
||||
if (autoRestartTimer == 0.0f) return "";
|
||||
return "Restarting in " + ToolBox.SecondsToReadableTime(Math.Max(autoRestartTimer, 0));
|
||||
return TextManager.Get("RestartingIn") + " " + ToolBox.SecondsToReadableTime(Math.Max(autoRestartTimer, 0));
|
||||
}
|
||||
|
||||
public NetLobbyScreen()
|
||||
@@ -251,20 +251,20 @@ namespace Barotrauma
|
||||
int columnWidth = infoFrame.Rect.Width / 3 - 5;
|
||||
int columnX = 0;
|
||||
|
||||
new GUITextBlock(new Rectangle(columnX, 110, columnWidth, 30), "Submarine:", "", defaultModeContainer);
|
||||
new GUITextBlock(new Rectangle(columnX, 110, columnWidth, 30), TextManager.Get("Submarine"), "", defaultModeContainer);
|
||||
subList = new GUIListBox(new Rectangle(columnX, 140, columnWidth, defaultModeContainer.Rect.Height - 170), Color.White, "", defaultModeContainer);
|
||||
subList.OnSelected = VotableClicked;
|
||||
|
||||
var voteText = new GUITextBlock(new Rectangle(columnX, 110, columnWidth, 30), "Votes: ", "", Alignment.TopLeft, Alignment.TopRight, defaultModeContainer);
|
||||
var voteText = new GUITextBlock(new Rectangle(columnX, 110, columnWidth, 30), TextManager.Get("Votes"), "", Alignment.TopLeft, Alignment.TopRight, defaultModeContainer);
|
||||
voteText.UserData = "subvotes";
|
||||
voteText.Visible = false;
|
||||
|
||||
|
||||
columnX += columnWidth + 20;
|
||||
|
||||
|
||||
//respawn shuttle ------------------------------------------------------------------
|
||||
|
||||
shuttleTickBox = new GUITickBox(new Rectangle(columnX, 110, 20, 20), "Respawn shuttle:",Alignment.Left, defaultModeContainer);
|
||||
shuttleTickBox = new GUITickBox(new Rectangle(columnX, 110, 20, 20), TextManager.Get("RespawnShuttle"), Alignment.Left, defaultModeContainer);
|
||||
shuttleList = new GUIDropDown(new Rectangle(columnX, 140, 200, 20), "", "", defaultModeContainer);
|
||||
shuttleTickBox.Selected = true;
|
||||
shuttleTickBox.OnSelected = (GUITickBox box) =>
|
||||
@@ -276,11 +276,11 @@ namespace Barotrauma
|
||||
|
||||
//gamemode ------------------------------------------------------------------
|
||||
|
||||
new GUITextBlock(new Rectangle(columnX, 170, 0, 30), "Game mode: ", "", defaultModeContainer);
|
||||
new GUITextBlock(new Rectangle(columnX, 170, 0, 30), TextManager.Get("GameMode"), "", defaultModeContainer);
|
||||
modeList = new GUIListBox(new Rectangle(columnX, 200, columnWidth, defaultModeContainer.Rect.Height - 230), "", defaultModeContainer);
|
||||
modeList.OnSelected = VotableClicked;
|
||||
|
||||
voteText = new GUITextBlock(new Rectangle(columnX, 170, columnWidth, 30), "Votes: ", "", Alignment.TopLeft, Alignment.TopRight, defaultModeContainer);
|
||||
voteText = new GUITextBlock(new Rectangle(columnX, 170, columnWidth, 30), TextManager.Get("Votes"), "", Alignment.TopLeft, Alignment.TopRight, defaultModeContainer);
|
||||
voteText.UserData = "modevotes";
|
||||
voteText.Visible = false;
|
||||
|
||||
@@ -300,7 +300,7 @@ namespace Barotrauma
|
||||
|
||||
//mission type ------------------------------------------------------------------
|
||||
|
||||
missionTypeBlock = new GUITextBlock(new Rectangle(columnX, -10, 300, 20), "Mission type:", "", Alignment.BottomLeft, Alignment.CenterLeft, defaultModeContainer);
|
||||
missionTypeBlock = new GUITextBlock(new Rectangle(columnX, -10, 300, 20), TextManager.Get("MissionType"), "", Alignment.BottomLeft, Alignment.CenterLeft, defaultModeContainer);
|
||||
missionTypeBlock.Padding = Vector4.Zero;
|
||||
missionTypeBlock.UserData = 0;
|
||||
|
||||
@@ -309,7 +309,7 @@ namespace Barotrauma
|
||||
missionTypeButtons[0] = new GUIButton(new Rectangle(100, 0, 20, 20), "<", Alignment.BottomLeft, "", missionTypeBlock);
|
||||
missionTypeButtons[0].UserData = -1;
|
||||
|
||||
new GUITextBlock(new Rectangle(120, 0, 80, 20), "Random", "", Alignment.BottomLeft, Alignment.Center, missionTypeBlock).UserData = 0;
|
||||
new GUITextBlock(new Rectangle(120, 0, 80, 20), TextManager.Get("Random"), "", Alignment.BottomLeft, Alignment.Center, missionTypeBlock).UserData = 0;
|
||||
|
||||
missionTypeButtons[1] = new GUIButton(new Rectangle(200, 0, 20, 20), ">", Alignment.BottomLeft, "", missionTypeBlock);
|
||||
missionTypeButtons[1].UserData = 1;
|
||||
@@ -332,7 +332,7 @@ namespace Barotrauma
|
||||
//seed ------------------------------------------------------------------
|
||||
|
||||
new GUITextBlock(new Rectangle(columnX, 110, 180, 20),
|
||||
"Level Seed: ", "", Alignment.Left, Alignment.TopLeft, defaultModeContainer);
|
||||
TextManager.Get("LevelSeed"), "", Alignment.Left, Alignment.TopLeft, defaultModeContainer);
|
||||
|
||||
seedBox = new GUITextBox(new Rectangle(columnX, 140, columnWidth / 2, 20),
|
||||
Alignment.TopLeft, "", defaultModeContainer);
|
||||
@@ -341,14 +341,14 @@ namespace Barotrauma
|
||||
|
||||
//traitor probability ------------------------------------------------------------------
|
||||
|
||||
new GUITextBlock(new Rectangle(columnX, 170, 20, 20), "Traitors:", "", defaultModeContainer);
|
||||
new GUITextBlock(new Rectangle(columnX, 170, 20, 20), TextManager.Get("Traitors"), "", defaultModeContainer);
|
||||
|
||||
traitorProbabilityButtons = new GUIButton[2];
|
||||
|
||||
traitorProbabilityButtons[0] = new GUIButton(new Rectangle(columnX, 195, 20, 20), "<", "", defaultModeContainer);
|
||||
traitorProbabilityButtons[0].UserData = -1;
|
||||
|
||||
traitorProbabilityText = new GUITextBlock(new Rectangle(columnX + 20, 195, 80, 20), "No", null, null, Alignment.Center, "", defaultModeContainer);
|
||||
traitorProbabilityText = new GUITextBlock(new Rectangle(columnX + 20, 195, 80, 20), TextManager.Get("No"), null, null, Alignment.Center, "", defaultModeContainer);
|
||||
|
||||
traitorProbabilityButtons[1] = new GUIButton(new Rectangle(columnX + 100, 195, 20, 20), ">", "", defaultModeContainer);
|
||||
traitorProbabilityButtons[1].UserData = 1;
|
||||
@@ -356,7 +356,7 @@ namespace Barotrauma
|
||||
|
||||
//automatic restart ------------------------------------------------------------------
|
||||
|
||||
autoRestartBox = new GUITickBox(new Rectangle(columnX, 230, 20, 20), "Automatic restart", Alignment.TopLeft, defaultModeContainer);
|
||||
autoRestartBox = new GUITickBox(new Rectangle(columnX, 230, 20, 20), TextManager.Get("AutoRestart"), Alignment.TopLeft, defaultModeContainer);
|
||||
autoRestartBox.OnSelected = ToggleAutoRestart;
|
||||
|
||||
var restartText = new GUITextBlock(new Rectangle(columnX, 255, 20, 20), "", "", defaultModeContainer);
|
||||
@@ -374,7 +374,7 @@ namespace Barotrauma
|
||||
serverMessage.Wrap = true;
|
||||
serverMessage.OnTextChanged = UpdateServerMessage;
|
||||
|
||||
var showLogButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Server Log", Alignment.TopRight, "", infoFrame);
|
||||
var showLogButton = new GUIButton(new Rectangle(0, 0, 100, 20), TextManager.Get("ServerLog"), Alignment.TopRight, "", infoFrame);
|
||||
showLogButton.UserData = "showlog";
|
||||
showLogButton.OnClicked = (GUIButton button, object userData) =>
|
||||
{
|
||||
@@ -436,13 +436,13 @@ namespace Barotrauma
|
||||
|
||||
InfoFrame.FindChild("showlog").Visible = GameMain.Server != null;
|
||||
|
||||
campaignViewButton = new GUIButton(new Rectangle(-80, 0, 120, 30), "Campaign view", Alignment.BottomRight, "", defaultModeContainer);
|
||||
campaignViewButton = new GUIButton(new Rectangle(-80, 0, 120, 30), TextManager.Get("CampaignView"), Alignment.BottomRight, "", defaultModeContainer);
|
||||
campaignViewButton.OnClicked = (btn, obj) => { ToggleCampaignView(true); return true; };
|
||||
campaignViewButton.Visible = false;
|
||||
|
||||
if (myPlayerFrame.children.Find(c => c.UserData as string == "playyourself") == null)
|
||||
{
|
||||
var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame);
|
||||
var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), TextManager.Get("PlayYourself"), Alignment.TopLeft, myPlayerFrame);
|
||||
playYourself.Selected = GameMain.NetworkMember.CharacterInfo != null;
|
||||
playYourself.OnSelected = TogglePlayYourself;
|
||||
playYourself.UserData = "playyourself";
|
||||
@@ -476,10 +476,10 @@ namespace Barotrauma
|
||||
missionTypeButtons[0].OnClicked = ToggleMissionType;
|
||||
missionTypeButtons[1].OnClicked = ToggleMissionType;
|
||||
|
||||
StartButton = new GUIButton(new Rectangle(0, 0, 80, 30), "Start", Alignment.BottomRight, "", defaultModeContainer);
|
||||
StartButton = new GUIButton(new Rectangle(0, 0, 80, 30), TextManager.Get("StartGameButton"), Alignment.BottomRight, "", defaultModeContainer);
|
||||
StartButton.OnClicked = GameMain.Server.StartGameClicked;
|
||||
|
||||
GUIButton settingsButton = new GUIButton(new Rectangle(-110, 0, 80, 20), "Settings", Alignment.TopRight, "", infoFrame);
|
||||
GUIButton settingsButton = new GUIButton(new Rectangle(-110, 0, 80, 20), TextManager.Get("ServerSettingsButton"), Alignment.TopRight, "", infoFrame);
|
||||
settingsButton.OnClicked = GameMain.Server.ToggleSettingsFrame;
|
||||
settingsButton.UserData = "settingsButton";
|
||||
|
||||
@@ -513,7 +513,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (GameMain.Client.GameStarted)
|
||||
{
|
||||
GUIButton spectateButton = new GUIButton(new Rectangle(0, 0, 80, 30), "Spectate", Alignment.BottomRight, "", infoFrame);
|
||||
GUIButton spectateButton = new GUIButton(new Rectangle(0, 0, 80, 30), TextManager.Get("SpectateButton"), Alignment.BottomRight, "", infoFrame);
|
||||
spectateButton.OnClicked = GameMain.Client.SpectateClicked;
|
||||
spectateButton.UserData = "spectateButton";
|
||||
}
|
||||
@@ -532,7 +532,7 @@ namespace Barotrauma
|
||||
if (GameMain.Client == null) return;
|
||||
|
||||
infoFrame.RemoveChild(infoFrame.children.Find(c => c.UserData as string == "spectateButton"));
|
||||
GUIButton spectateButton = new GUIButton(new Rectangle(0, 0, 80, 30), "Spectate", Alignment.BottomRight, "", infoFrame);
|
||||
GUIButton spectateButton = new GUIButton(new Rectangle(0, 0, 80, 30), TextManager.Get("SpectateButton"), Alignment.BottomRight, "", infoFrame);
|
||||
spectateButton.OnClicked = GameMain.Client.SpectateClicked;
|
||||
spectateButton.UserData = "spectateButton";
|
||||
}
|
||||
@@ -543,7 +543,7 @@ namespace Barotrauma
|
||||
{
|
||||
myPlayerFrame.ClearChildren();
|
||||
|
||||
var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame);
|
||||
var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), TextManager.Get("PlayYourself"), Alignment.TopLeft, myPlayerFrame);
|
||||
playYourself.Selected = GameMain.NetworkMember.CharacterInfo != null;
|
||||
playYourself.OnSelected = TogglePlayYourself;
|
||||
playYourself.UserData = "playyourself";
|
||||
@@ -555,19 +555,19 @@ namespace Barotrauma
|
||||
toggleHead.UserData = 1;
|
||||
toggleHead.OnClicked = ToggleHead;
|
||||
|
||||
new GUITextBlock(new Rectangle(100, 30, 200, 30), "Gender: ", "", myPlayerFrame);
|
||||
new GUITextBlock(new Rectangle(100, 30, 200, 30), TextManager.Get("Gender"), "", myPlayerFrame);
|
||||
|
||||
GUIButton maleButton = new GUIButton(new Rectangle(100, 50, 60, 20), "Male",
|
||||
GUIButton maleButton = new GUIButton(new Rectangle(100, 50, 60, 20), TextManager.Get("Male"),
|
||||
Alignment.TopLeft, "", myPlayerFrame);
|
||||
maleButton.UserData = Gender.Male;
|
||||
maleButton.OnClicked += SwitchGender;
|
||||
|
||||
GUIButton femaleButton = new GUIButton(new Rectangle(170, 50, 60, 20), "Female",
|
||||
GUIButton femaleButton = new GUIButton(new Rectangle(170, 50, 60, 20), TextManager.Get("Female"),
|
||||
Alignment.TopLeft, "", myPlayerFrame);
|
||||
femaleButton.UserData = Gender.Female;
|
||||
femaleButton.OnClicked += SwitchGender;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 120, 20, 30), "Job preferences:", "", myPlayerFrame);
|
||||
new GUITextBlock(new Rectangle(0, 120, 20, 30), TextManager.Get("JobPreferences"), "", myPlayerFrame);
|
||||
|
||||
jobList = new GUIListBox(new Rectangle(0, 150, 0, 0), "", myPlayerFrame);
|
||||
jobList.Enabled = false;
|
||||
@@ -626,9 +626,9 @@ namespace Barotrauma
|
||||
GameMain.NetworkMember.CharacterInfo = null;
|
||||
GameMain.NetworkMember.Character = null;
|
||||
|
||||
new GUITextBlock(Rectangle.Empty, "Playing as a spectator", "", Alignment.Center, Alignment.Center, myPlayerFrame, true);
|
||||
new GUITextBlock(Rectangle.Empty, TextManager.Get("PlayingAsSpectator"), "", Alignment.Center, Alignment.Center, myPlayerFrame, true);
|
||||
|
||||
var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame);
|
||||
var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), TextManager.Get("PlayYourself"), Alignment.TopLeft, myPlayerFrame);
|
||||
playYourself.OnSelected = TogglePlayYourself;
|
||||
playYourself.UserData = "playyourself";
|
||||
}
|
||||
@@ -763,12 +763,12 @@ namespace Barotrauma
|
||||
if (matchingSub == null)
|
||||
{
|
||||
subTextBlock.TextColor = new Color(subTextBlock.TextColor, 0.5f);
|
||||
subTextBlock.ToolTip = "Submarine not found in your submarine folder";
|
||||
subTextBlock.ToolTip = TextManager.Get("SubNotFound");
|
||||
}
|
||||
else if (matchingSub.MD5Hash.Hash != sub.MD5Hash.Hash)
|
||||
{
|
||||
subTextBlock.TextColor = new Color(subTextBlock.TextColor, 0.5f);
|
||||
subTextBlock.ToolTip = "Your version of the submarine doesn't match the servers version";
|
||||
subTextBlock.ToolTip = TextManager.Get("SubDoesntMatch");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -780,7 +780,7 @@ namespace Barotrauma
|
||||
|
||||
if (sub.HasTag(SubmarineTag.Shuttle))
|
||||
{
|
||||
var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "Shuttle", "", Alignment.Left, Alignment.CenterY | Alignment.Right, subTextBlock, false, GUI.SmallFont);
|
||||
var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), TextManager.Get("Shuttle"), "", Alignment.Left, Alignment.CenterY | Alignment.Right, subTextBlock, false, GUI.SmallFont);
|
||||
shuttleText.TextColor = subTextBlock.TextColor * 0.8f;
|
||||
shuttleText.ToolTip = subTextBlock.ToolTip;
|
||||
}
|
||||
@@ -896,14 +896,14 @@ namespace Barotrauma
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 25, 150, 15), selectedClient.Connection.RemoteEndPoint.Address.ToString(), "", playerFrameInner);
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 45, 0, 15), "Rank", "", playerFrameInner);
|
||||
var rankDropDown = new GUIDropDown(new Rectangle(0, 70, 150, 20), "Rank", "", playerFrameInner);
|
||||
new GUITextBlock(new Rectangle(0, 45, 0, 15), TextManager.Get("Rank"), "", playerFrameInner);
|
||||
var rankDropDown = new GUIDropDown(new Rectangle(0, 70, 150, 20), TextManager.Get("Rank"), "", playerFrameInner);
|
||||
rankDropDown.UserData = selectedClient;
|
||||
foreach (PermissionPreset permissionPreset in PermissionPreset.List)
|
||||
{
|
||||
rankDropDown.AddItem(permissionPreset.Name, permissionPreset, permissionPreset.Description);
|
||||
}
|
||||
rankDropDown.AddItem("Custom", null);
|
||||
rankDropDown.AddItem(TextManager.Get("CustomRank"), null);
|
||||
|
||||
PermissionPreset currentPreset = PermissionPreset.List.Find(p =>
|
||||
p.Permissions == selectedClient.Permissions &&
|
||||
@@ -929,7 +929,7 @@ namespace Barotrauma
|
||||
permissionsBox.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
||||
permissionsBox.UserData = selectedClient;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 100, permissionsBox.Rect.Width, 15), "Permissions:", "", playerFrameInner);
|
||||
new GUITextBlock(new Rectangle(0, 100, permissionsBox.Rect.Width, 15), TextManager.Get("Permissions"), "", playerFrameInner);
|
||||
int x = 0, y = 0;
|
||||
foreach (ClientPermissions permission in Enum.GetValues(typeof(ClientPermissions)))
|
||||
{
|
||||
@@ -972,7 +972,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 100, (int)(playerFrameInner.Rect.Width * 0.5f), 15), "Permitted console commands:", "", Alignment.TopRight, Alignment.TopLeft, playerFrameInner, true);
|
||||
new GUITextBlock(new Rectangle(0, 100, (int)(playerFrameInner.Rect.Width * 0.5f), 15), TextManager.Get("PermittedConsoleCommands"), "", Alignment.TopRight, Alignment.TopLeft, playerFrameInner, true);
|
||||
var commandList = new GUIListBox(new Rectangle(0, 125, (int)(playerFrameInner.Rect.Width * 0.5f), 160), "", Alignment.TopRight, playerFrameInner);
|
||||
commandList.UserData = selectedClient;
|
||||
foreach (DebugConsole.Command command in DebugConsole.Commands)
|
||||
@@ -1007,7 +1007,7 @@ namespace Barotrauma
|
||||
|
||||
if (GameMain.Server != null || GameMain.Client.HasPermission(ClientPermissions.Kick))
|
||||
{
|
||||
var kickButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Kick", Alignment.BottomLeft, "", playerFrameInner);
|
||||
var kickButton = new GUIButton(new Rectangle(0, 0, 80, 20), TextManager.Get("Kick"), Alignment.BottomLeft, "", playerFrameInner);
|
||||
kickButton.UserData = obj;
|
||||
kickButton.OnClicked += KickPlayer;
|
||||
kickButton.OnClicked += ClosePlayerFrame;
|
||||
@@ -1015,18 +1015,18 @@ namespace Barotrauma
|
||||
|
||||
if (GameMain.Server != null || GameMain.Client.HasPermission(ClientPermissions.Ban))
|
||||
{
|
||||
var banButton = new GUIButton(new Rectangle(90, 0, 80, 20), "Ban", Alignment.BottomLeft, "", playerFrameInner);
|
||||
var banButton = new GUIButton(new Rectangle(90, 0, 80, 20), TextManager.Get("Ban"), Alignment.BottomLeft, "", playerFrameInner);
|
||||
banButton.UserData = obj;
|
||||
banButton.OnClicked += BanPlayer;
|
||||
banButton.OnClicked += ClosePlayerFrame;
|
||||
|
||||
var rangebanButton = new GUIButton(new Rectangle(180, 0, 80, 20), "Ban range", Alignment.BottomLeft, "", playerFrameInner);
|
||||
var rangebanButton = new GUIButton(new Rectangle(180, 0, 80, 20), TextManager.Get("BanRange"), Alignment.BottomLeft, "", playerFrameInner);
|
||||
rangebanButton.UserData = obj;
|
||||
rangebanButton.OnClicked += BanPlayerRange;
|
||||
rangebanButton.OnClicked += ClosePlayerFrame;
|
||||
}
|
||||
|
||||
var closeButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Close", Alignment.BottomRight, "", playerFrameInner);
|
||||
var closeButton = new GUIButton(new Rectangle(0, 0, 100, 20), TextManager.Get("Close"), Alignment.BottomRight, "", playerFrameInner);
|
||||
closeButton.OnClicked = ClosePlayerFrame;
|
||||
|
||||
return false;
|
||||
@@ -1163,7 +1163,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, chatBox.Rect.Width - 20, 0),
|
||||
(message.Type == ChatMessageType.Private ? "[PM] " : "") + message.TextWithSender,
|
||||
(message.Type == ChatMessageType.Private ? TextManager.Get("PrivateMessageTag") + " " : "") + message.TextWithSender,
|
||||
((chatBox.CountChildren % 2) == 0) ? Color.Transparent : Color.Black * 0.1f, message.Color,
|
||||
Alignment.Left, Alignment.TopLeft, "", null, true, GUI.SmallFont);
|
||||
msg.UserData = message;
|
||||
@@ -1281,7 +1281,7 @@ namespace Barotrauma
|
||||
campaignUI = new CampaignUI(GameMain.GameSession.GameMode as CampaignMode, campaignContainer);
|
||||
campaignUI.StartRound = () => { GameMain.Server.StartGame(); };
|
||||
|
||||
var backButton = new GUIButton(new Rectangle(0, -20, 100, 30), "Back", "", campaignContainer);
|
||||
var backButton = new GUIButton(new Rectangle(0, -20, 100, 30), TextManager.Get("Back"), "", campaignContainer);
|
||||
backButton.OnClicked += (btn, obj) => { ToggleCampaignView(false); return true; };
|
||||
|
||||
int buttonX = backButton.Rect.Width + 50;
|
||||
@@ -1297,7 +1297,7 @@ namespace Barotrauma
|
||||
buttonX += 110;
|
||||
}
|
||||
|
||||
var moneyText = new GUITextBlock(new Rectangle(120,0,200,20), "Money", "", Alignment.BottomLeft, Alignment.TopLeft, campaignContainer);
|
||||
var moneyText = new GUITextBlock(new Rectangle(120,0,200,20), TextManager.Get("Credit"), "", Alignment.BottomLeft, Alignment.TopLeft, campaignContainer);
|
||||
moneyText.TextGetter = campaignUI.GetMoney;
|
||||
|
||||
var restartText = new GUITextBlock(new Rectangle(-backButton.Rect.Width - 30, -10, 130, 30), "", "", Alignment.BottomRight, Alignment.BottomRight, campaignContainer);
|
||||
@@ -1332,7 +1332,7 @@ namespace Barotrauma
|
||||
if (jobPrefab == null) return false;
|
||||
|
||||
jobInfoFrame = jobPrefab.CreateInfoFrame();
|
||||
GUIButton closeButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Close", Alignment.BottomRight, "", jobInfoFrame.children[0]);
|
||||
GUIButton closeButton = new GUIButton(new Rectangle(0, 0, 100, 20), TextManager.Get("Close"), Alignment.BottomRight, "", jobInfoFrame.children[0]);
|
||||
closeButton.OnClicked = CloseJobInfo;
|
||||
return true;
|
||||
}
|
||||
@@ -1410,22 +1410,19 @@ namespace Barotrauma
|
||||
string errorMsg = "";
|
||||
if (sub == null)
|
||||
{
|
||||
errorMsg = "Submarine \"" + subName + "\" was selected by the server. Matching file not found in your submarine folder. ";
|
||||
errorMsg = TextManager.Get("SubNotFoundError").Replace("[subname]", subName) + " ";
|
||||
}
|
||||
else if (sub.MD5Hash.Hash == null)
|
||||
{
|
||||
errorMsg = "Couldn't load submarine \"" + subName + "\". The file may be corrupted. ";
|
||||
|
||||
errorMsg = TextManager.Get("SubLoadError").Replace("[subname]", subName) + " ";
|
||||
if (matchingListSub != null) matchingListSub.TextColor = Color.Red;
|
||||
}
|
||||
else
|
||||
{
|
||||
errorMsg = "Your version of the submarine file \"" + sub.Name + "\" doesn't match the server's version!\n"
|
||||
+ "Your MD5 hash: " + sub.MD5Hash.ShortHash + "\n"
|
||||
+ "Server's MD5 hash: " + Md5Hash.GetShortHash(md5Hash) + "\n";
|
||||
errorMsg = TextManager.Get("SubDoesntMatchError").Replace("[subname]", sub.Name).Replace("[myhash]", sub.MD5Hash.ShortHash).Replace("[serverhash]", Md5Hash.GetShortHash(md5Hash)) + " ";
|
||||
}
|
||||
|
||||
errorMsg += "Do you want to download the file from the server host?";
|
||||
errorMsg += TextManager.Get("DownloadSubQuestion");
|
||||
|
||||
//already showing a message about the same sub
|
||||
if (GUIMessageBox.MessageBoxes.Any(mb => mb.UserData as string == "request" + subName))
|
||||
@@ -1433,7 +1430,7 @@ namespace Barotrauma
|
||||
return false;
|
||||
}
|
||||
|
||||
var requestFileBox = new GUIMessageBox("Submarine not found!", errorMsg, new string[] { "Yes", "No" }, 400, 300);
|
||||
var requestFileBox = new GUIMessageBox(TextManager.Get("DownloadSubLabel"), errorMsg, new string[] { TextManager.Get("Yes"), TextManager.Get("No") }, 400, 300);
|
||||
requestFileBox.UserData = "request" + subName;
|
||||
requestFileBox.Buttons[0].UserData = new string[] { subName, md5Hash };
|
||||
requestFileBox.Buttons[0].OnClicked += requestFileBox.Close;
|
||||
|
||||
@@ -15,10 +15,12 @@ namespace Barotrauma
|
||||
class Emitter : ISerializableEntity
|
||||
{
|
||||
public float EmitTimer;
|
||||
|
||||
[Editable(), Serialize("0.0,0.0", false)]
|
||||
|
||||
public float BurstTimer;
|
||||
|
||||
[Editable(), Serialize("0.0,360.0", false)]
|
||||
public Vector2 AngleRange { get; private set; }
|
||||
|
||||
|
||||
[Editable(), Serialize("0.0,0.0", false)]
|
||||
public Vector2 VelocityRange { get; private set; }
|
||||
|
||||
@@ -26,8 +28,12 @@ namespace Barotrauma
|
||||
public Vector2 ScaleRange { get; private set; }
|
||||
|
||||
[Editable(), Serialize(0, false)]
|
||||
public int ParticleAmount { get; private set; }
|
||||
[Editable(), Serialize(0.0f, false)]
|
||||
public int ParticleBurstAmount { get; private set; }
|
||||
|
||||
[Editable(), Serialize(1.0f, false)]
|
||||
public float ParticleBurstInterval { get; private set; }
|
||||
|
||||
[Editable(), Serialize(1.0f, false)]
|
||||
public float ParticlesPerSecond { get; private set; }
|
||||
|
||||
public string Name
|
||||
@@ -46,6 +52,11 @@ namespace Barotrauma
|
||||
|
||||
public Emitter()
|
||||
{
|
||||
ScaleRange = Vector2.One;
|
||||
AngleRange = new Vector2(0.0f, 360.0f);
|
||||
ParticleBurstAmount = 1;
|
||||
ParticleBurstInterval = 1.0f;
|
||||
|
||||
SerializableProperties = SerializableProperty.GetProperties(this);
|
||||
}
|
||||
}
|
||||
@@ -76,7 +87,7 @@ namespace Barotrauma
|
||||
cam = new Camera();
|
||||
|
||||
guiRoot = new GUIFrame(Rectangle.Empty, null, null);
|
||||
|
||||
|
||||
leftPanel = new GUIFrame(new Rectangle(0, 0, 150, GameMain.GraphicsHeight), "GUIFrameLeft", guiRoot);
|
||||
leftPanel.Padding = new Vector4(10.0f, 20.0f, 10.0f, 20.0f);
|
||||
|
||||
@@ -150,7 +161,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
private void SerializeAll()
|
||||
{
|
||||
{
|
||||
XDocument doc = XMLExtensions.TryLoadXml(GameMain.ParticleManager.ConfigFile);
|
||||
if (doc == null || doc.Root == null) return;
|
||||
|
||||
@@ -179,6 +190,7 @@ namespace Barotrauma
|
||||
|
||||
private void SerializeToClipboard(ParticlePrefab prefab)
|
||||
{
|
||||
#if WINDOWS
|
||||
if (prefab == null) return;
|
||||
|
||||
XmlWriterSettings settings = new XmlWriterSettings();
|
||||
@@ -197,6 +209,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
Clipboard.SetText(sb.ToString());
|
||||
#endif
|
||||
}
|
||||
|
||||
public override void Update(double deltaTime)
|
||||
@@ -208,6 +221,8 @@ namespace Barotrauma
|
||||
if (selectedPrefab != null)
|
||||
{
|
||||
emitter.EmitTimer += (float)deltaTime;
|
||||
emitter.BurstTimer += (float)deltaTime;
|
||||
|
||||
|
||||
if (emitter.ParticlesPerSecond > 0)
|
||||
{
|
||||
@@ -219,10 +234,15 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < emitter.ParticleAmount; i++)
|
||||
if (emitter.BurstTimer > emitter.ParticleBurstInterval)
|
||||
{
|
||||
Emit(Vector2.Zero);
|
||||
for (int i = 0; i < emitter.ParticleBurstAmount; i++)
|
||||
{
|
||||
Emit(Vector2.Zero);
|
||||
}
|
||||
emitter.BurstTimer = 0.0f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GameMain.ParticleManager.Update((float)deltaTime);
|
||||
|
||||
@@ -57,12 +57,12 @@ namespace Barotrauma
|
||||
menu = new GUIFrame(panelRect, null, Alignment.Center, "");
|
||||
menu.Padding = new Vector4(40.0f, 40.0f, 40.0f, 20.0f);
|
||||
|
||||
new GUITextBlock(new Rectangle(0, -25, 0, 30), "Join Server", "", Alignment.CenterX, Alignment.CenterX, menu, false, GUI.LargeFont);
|
||||
new GUITextBlock(new Rectangle(0, -25, 0, 30), TextManager.Get("JoinServer"), "", Alignment.CenterX, Alignment.CenterX, menu, false, GUI.LargeFont);
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 30, 0, 30), "Your Name:", "", menu);
|
||||
new GUITextBlock(new Rectangle(0, 30, 0, 30), TextManager.Get("YourName"), "", menu);
|
||||
clientNameBox = new GUITextBox(new Rectangle(0, 60, 200, 30), "", menu);
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 100, 0, 30), "Server IP:", "", menu);
|
||||
new GUITextBlock(new Rectangle(0, 100, 0, 30), TextManager.Get("ServerIP"), "", menu);
|
||||
ipBox = new GUITextBox(new Rectangle(0, 130, 200, 30), "", menu);
|
||||
|
||||
int middleX = (int)(width * 0.35f);
|
||||
@@ -80,35 +80,35 @@ namespace Barotrauma
|
||||
|
||||
ScalableFont font = GUI.SmallFont; // serverList.Rect.Width < 400 ? GUI.SmallFont : GUI.Font;
|
||||
|
||||
new GUITextBlock(new Rectangle(middleX, 30, 0, 30), "Password", "", menu).Font = font;
|
||||
new GUITextBlock(new Rectangle(middleX, 30, 0, 30), TextManager.Get("Password"), "", menu).Font = font;
|
||||
|
||||
new GUITextBlock(new Rectangle(middleX + columnX[0], 30, 0, 30), "Name", "", menu).Font = font;
|
||||
new GUITextBlock(new Rectangle(middleX + columnX[1], 30, 0, 30), "Players", "", menu).Font = font;
|
||||
new GUITextBlock(new Rectangle(middleX + columnX[2], 30, 0, 30), "Round started", "", menu).Font = font;
|
||||
new GUITextBlock(new Rectangle(middleX + columnX[0], 30, 0, 30), TextManager.Get("ServerListName"), "", menu).Font = font;
|
||||
new GUITextBlock(new Rectangle(middleX + columnX[1], 30, 0, 30), TextManager.Get("ServerListPlayers"), "", menu).Font = font;
|
||||
new GUITextBlock(new Rectangle(middleX + columnX[2], 30, 0, 30), TextManager.Get("ServerListRoundStarted"), "", menu).Font = font;
|
||||
|
||||
joinButton = new GUIButton(new Rectangle(-170, 0, 150, 30), "Refresh", Alignment.BottomRight, "", menu);
|
||||
joinButton = new GUIButton(new Rectangle(-170, 0, 150, 30), TextManager.Get("ServerListRefresh"), Alignment.BottomRight, "", menu);
|
||||
joinButton.OnClicked = RefreshServers;
|
||||
|
||||
joinButton = new GUIButton(new Rectangle(0,0,150,30), "Join", Alignment.BottomRight, "", menu);
|
||||
joinButton = new GUIButton(new Rectangle(0,0,150,30), TextManager.Get("ServerListJoin"), Alignment.BottomRight, "", menu);
|
||||
joinButton.OnClicked = JoinServer;
|
||||
|
||||
//--------------------------------------------------------
|
||||
|
||||
int y = 180;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, y, 200, 30), "Filter servers:", "", menu);
|
||||
new GUITextBlock(new Rectangle(0, y, 200, 30), TextManager.Get("FilterServers"), "", menu);
|
||||
searchBox = new GUITextBox(new Rectangle(0, y + 30, 200, 30), "", menu);
|
||||
searchBox.OnTextChanged += (txtBox, txt) => { FilterServers(); return true; };
|
||||
filterPassword = new GUITickBox(new Rectangle(0, y + 60, 30, 30), "No password required", Alignment.TopLeft, menu);
|
||||
filterPassword = new GUITickBox(new Rectangle(0, y + 60, 30, 30), TextManager.Get("FilterPassword"), Alignment.TopLeft, menu);
|
||||
filterPassword.OnSelected += (tickBox) => { FilterServers(); return true; };
|
||||
filterFull = new GUITickBox(new Rectangle(0, y + 90, 30, 30), "Hide full servers", Alignment.TopLeft, menu);
|
||||
filterFull = new GUITickBox(new Rectangle(0, y + 90, 30, 30), TextManager.Get("FilterFullServers"), Alignment.TopLeft, menu);
|
||||
filterFull.OnSelected += (tickBox) => { FilterServers(); return true; };
|
||||
filterEmpty = new GUITickBox(new Rectangle(0, y + 120, 30, 30), "Hide empty servers", Alignment.TopLeft, menu);
|
||||
filterEmpty = new GUITickBox(new Rectangle(0, y + 120, 30, 30), TextManager.Get("FilterEmptyServers"), Alignment.TopLeft, menu);
|
||||
filterEmpty.OnSelected += (tickBox) => { FilterServers(); return true; };
|
||||
|
||||
//--------------------------------------------------------
|
||||
|
||||
GUIButton button = new GUIButton(new Rectangle(-20, -20, 100, 30), "Back", Alignment.TopLeft, "", menu);
|
||||
GUIButton button = new GUIButton(new Rectangle(-20, -20, 100, 30), TextManager.Get("Back"), Alignment.TopLeft, "", menu);
|
||||
button.OnClicked = GameMain.MainMenuScreen.SelectTab;
|
||||
button.SelectedColor = button.Color;
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace Barotrauma
|
||||
|
||||
if (serverList.children.All(c => !c.Visible))
|
||||
{
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 20), "No matching servers found.", "", serverList).UserData = "noresults";
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 20), TextManager.Get("NoMatchingServers"), "", serverList).UserData = "noresults";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace Barotrauma
|
||||
if (waitingForRefresh) return false;
|
||||
serverList.ClearChildren();
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 20), "Refreshing server list...", "", serverList);
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 20), TextManager.Get("RefreshingServerList"), "", serverList);
|
||||
|
||||
CoroutineManager.StartCoroutine(WaitForRefresh());
|
||||
|
||||
@@ -192,16 +192,16 @@ namespace Barotrauma
|
||||
private void UpdateServerList(string masterServerData)
|
||||
{
|
||||
serverList.ClearChildren();
|
||||
|
||||
|
||||
if (string.IsNullOrWhiteSpace(masterServerData))
|
||||
{
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 20), "Couldn't find any servers", "", serverList);
|
||||
new GUITextBlock(new Rectangle(0, 0, 0, 20), TextManager.Get("NoServers"), "", serverList);
|
||||
return;
|
||||
}
|
||||
|
||||
if (masterServerData.Substring(0, 5).ToLowerInvariant() == "error")
|
||||
{
|
||||
DebugConsole.ThrowError("Error while connecting to master server ("+masterServerData+")!");
|
||||
DebugConsole.ThrowError("Error while connecting to master server (" + masterServerData + ")!");
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -284,7 +284,7 @@ namespace Barotrauma
|
||||
{
|
||||
serverList.ClearChildren();
|
||||
restRequestHandle.Abort();
|
||||
new GUIMessageBox("Connection error", "Couldn't connect to master server (request timed out).");
|
||||
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"), TextManager.Get("MasterServerTimeOutError"));
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
yield return CoroutineStatus.Running;
|
||||
@@ -293,28 +293,37 @@ namespace Barotrauma
|
||||
if (masterServerResponse.ErrorException != null)
|
||||
{
|
||||
serverList.ClearChildren();
|
||||
new GUIMessageBox("Connection error", "Error while connecting to master server {" + masterServerResponse.ErrorException + "}");
|
||||
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"), TextManager.Get("MasterServerErrorException").Replace("[error]", masterServerResponse.ErrorException.ToString()));
|
||||
}
|
||||
else if (masterServerResponse.StatusCode != System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
serverList.ClearChildren();
|
||||
|
||||
|
||||
switch (masterServerResponse.StatusCode)
|
||||
{
|
||||
case System.Net.HttpStatusCode.NotFound:
|
||||
new GUIMessageBox("Connection error",
|
||||
"Error while connecting to master server (404 - \"" + NetConfig.MasterServerUrl + "\" not found)");
|
||||
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"),
|
||||
TextManager.Get("MasterServerError404")
|
||||
.Replace("[masterserverurl]", NetConfig.MasterServerUrl)
|
||||
.Replace("[statuscode]", masterServerResponse.StatusCode.ToString())
|
||||
.Replace("[statusdescription]", masterServerResponse.StatusDescription));
|
||||
break;
|
||||
case System.Net.HttpStatusCode.ServiceUnavailable:
|
||||
new GUIMessageBox("Connection error",
|
||||
"Error while connecting to master server (505 - Service Unavailable) " +
|
||||
"The master server may be down for maintenance or temporarily overloaded. Please try again after in a few moments.");
|
||||
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"),
|
||||
TextManager.Get("MasterServerErrorUnavailable")
|
||||
.Replace("[masterserverurl]", NetConfig.MasterServerUrl)
|
||||
.Replace("[statuscode]", masterServerResponse.StatusCode.ToString())
|
||||
.Replace("[statusdescription]", masterServerResponse.StatusDescription));
|
||||
break;
|
||||
default:
|
||||
new GUIMessageBox("Connection error",
|
||||
"Error while connecting to master server (" + masterServerResponse.StatusCode + ": " + masterServerResponse.StatusDescription + ")");
|
||||
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"),
|
||||
TextManager.Get("MasterServerError404")
|
||||
.Replace("[masterserverurl]", NetConfig.MasterServerUrl)
|
||||
.Replace("[statuscode]", masterServerResponse.StatusCode.ToString())
|
||||
.Replace("[statusdescription]", masterServerResponse.StatusDescription));
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -353,10 +362,10 @@ namespace Barotrauma
|
||||
return true;
|
||||
}
|
||||
|
||||
public void JoinServer(string ip, bool hasPassword, string msg = "Password required")
|
||||
/*public void JoinServer(string ip, bool hasPassword, string msg = "Password required")
|
||||
{
|
||||
CoroutineManager.StartCoroutine(ConnectToServer(ip));
|
||||
}
|
||||
}*/
|
||||
|
||||
private IEnumerable<object> ConnectToServer(string ip)
|
||||
{
|
||||
|
||||
@@ -59,17 +59,17 @@ namespace Barotrauma
|
||||
|
||||
private string GetItemCount()
|
||||
{
|
||||
return "Items: " +Item.ItemList.Count;
|
||||
return TextManager.Get("Items") + ": " + Item.ItemList.Count;
|
||||
}
|
||||
|
||||
private string GetStructureCount()
|
||||
{
|
||||
return "Structures: " + (MapEntity.mapEntityList.Count - Item.ItemList.Count);
|
||||
return TextManager.Get("Structures") + ": " + (MapEntity.mapEntityList.Count - Item.ItemList.Count);
|
||||
}
|
||||
|
||||
private string GetTotalHullVolume()
|
||||
{
|
||||
return "Total Hull Volume:\n" + Hull.hullList.Sum(h => h.Volume);
|
||||
return TextManager.Get("TotalHullVolume") + ":\n" + Hull.hullList.Sum(h => h.Volume);
|
||||
}
|
||||
|
||||
private string GetSelectedHullVolume()
|
||||
@@ -86,16 +86,16 @@ namespace Barotrauma
|
||||
}
|
||||
});
|
||||
buoyancyVol *= neutralPercentage;
|
||||
string retVal = "Selected Hull Volume:\n" + selectedVol;
|
||||
string retVal = TextManager.Get("SelectedHullVolume") + ":\n" + selectedVol;
|
||||
if (selectedVol > 0.0f && buoyancyVol > 0.0f)
|
||||
{
|
||||
if (buoyancyVol / selectedVol < 1.0f)
|
||||
{
|
||||
retVal += " (optimal NeutralBallastLevel is " + (buoyancyVol / selectedVol).ToString("0.00") + ")";
|
||||
retVal += " (" + TextManager.Get("OptimalBallastLevel").Replace("[value]", (buoyancyVol / selectedVol).ToString("0.00")) + ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
retVal += " (insufficient volume for buoyancy control)";
|
||||
retVal += " (" + TextManager.Get("InsufficientBallast") + ")";
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
@@ -103,7 +103,7 @@ namespace Barotrauma
|
||||
|
||||
private string GetPhysicsBodyCount()
|
||||
{
|
||||
return "Physics bodies: " + GameMain.World.BodyList.Count;
|
||||
return TextManager.Get("PhysicsBodies") + ": " + GameMain.World.BodyList.Count;
|
||||
}
|
||||
|
||||
public bool CharacterMode
|
||||
@@ -137,7 +137,7 @@ namespace Barotrauma
|
||||
GUITextBlock selectedHullVolume = new GUITextBlock(new Rectangle(0, 30, 0, 20), "", "", hullVolumeFrame, GUI.SmallFont);
|
||||
selectedHullVolume.TextGetter = GetSelectedHullVolume;
|
||||
|
||||
var button = new GUIButton(new Rectangle(0, 0, 70, 20), "Open...", "", topPanel);
|
||||
var button = new GUIButton(new Rectangle(0, 0, 70, 20), TextManager.Get("OpenSubButton"), "", topPanel);
|
||||
button.OnClicked = (GUIButton btn, object data) =>
|
||||
{
|
||||
saveFrame = null;
|
||||
@@ -147,7 +147,7 @@ namespace Barotrauma
|
||||
return true;
|
||||
};
|
||||
|
||||
button = new GUIButton(new Rectangle(80,0,70,20), "Save", "", topPanel);
|
||||
button = new GUIButton(new Rectangle(80,0,70,20), TextManager.Get("SaveSubButton"), "", topPanel);
|
||||
button.OnClicked = (GUIButton btn, object data) =>
|
||||
{
|
||||
loadFrame = null;
|
||||
@@ -160,11 +160,8 @@ namespace Barotrauma
|
||||
var nameLabel = new GUITextBlock(new Rectangle(170, 0, 150, 20), "", "", Alignment.TopLeft, Alignment.CenterLeft, topPanel, false, GUI.LargeFont);
|
||||
nameLabel.TextGetter = GetSubName;
|
||||
|
||||
linkedSubBox = new GUIDropDown(new Rectangle(750, 0, 200, 20), "Add submarine", "", topPanel);
|
||||
linkedSubBox.ToolTip =
|
||||
"Places another submarine into the current submarine file. " +
|
||||
"Can be used for adding things such as smaller vessels, " +
|
||||
"escape pods or detachable sections into the main submarine.";
|
||||
linkedSubBox = new GUIDropDown(new Rectangle(750, 0, 200, 20), TextManager.Get("AddSubButton"), "", topPanel);
|
||||
linkedSubBox.ToolTip = TextManager.Get("AddSubToolTip");
|
||||
|
||||
foreach (Submarine sub in Submarine.SavedSubmarines)
|
||||
{
|
||||
@@ -196,7 +193,7 @@ namespace Barotrauma
|
||||
GUItabs[i] = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), "");
|
||||
GUItabs[i].Padding = new Vector4(10.0f, 30.0f, 10.0f, 20.0f);
|
||||
|
||||
new GUITextBlock(new Rectangle(-200, 0, 100, 15), "Filter", "", Alignment.TopRight, Alignment.CenterRight, GUItabs[i], false, GUI.SmallFont);
|
||||
new GUITextBlock(new Rectangle(-200, 0, 100, 15), TextManager.Get("FilterMapEntities"), "", Alignment.TopRight, Alignment.CenterRight, GUItabs[i], false, GUI.SmallFont);
|
||||
|
||||
GUITextBox searchBox = new GUITextBox(new Rectangle(-20, 0, 180, 15), null,null, Alignment.TopRight, Alignment.CenterLeft, "", GUItabs[i]);
|
||||
searchBox.Font = GUI.SmallFont;
|
||||
@@ -244,37 +241,37 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
y += 10;
|
||||
button = new GUIButton(new Rectangle(0, y, 0, 20), "Character mode", Alignment.Left, "", leftPanel);
|
||||
button.ToolTip = "Allows you to pick up and use items. Useful for things such as placing items inside closets, turning devices on/off and doing the wiring.";
|
||||
button = new GUIButton(new Rectangle(0, y, 0, 20), TextManager.Get("CharacterModeButton"), Alignment.Left, "", leftPanel);
|
||||
button.ToolTip = TextManager.Get("CharacterModeToolTip");
|
||||
button.OnClicked = ToggleCharacterMode;
|
||||
|
||||
y += 25;
|
||||
button = new GUIButton(new Rectangle(0, y, 0, 20), "Wiring mode", Alignment.Left, "", leftPanel);
|
||||
//button.ToolTip = "Allows you to pick up and use items. Useful for things such as placing items inside closets, turning devices on/off and doing the wiring.";
|
||||
button = new GUIButton(new Rectangle(0, y, 0, 20), TextManager.Get("WiringModeButton"), Alignment.Left, "", leftPanel);
|
||||
button.ToolTip = TextManager.Get("WiringModeToolTip");
|
||||
button.OnClicked = ToggleWiringMode;
|
||||
|
||||
y += 35;
|
||||
button = new GUIButton(new Rectangle(0, y, 0, 20), "Generate waypoints", Alignment.Left, "", leftPanel);
|
||||
button.ToolTip = "AI controlled crew members require waypoints to navigate around the sub.";
|
||||
button = new GUIButton(new Rectangle(0, y, 0, 20), TextManager.Get("GenerateWaypointsButton"), Alignment.Left, "", leftPanel);
|
||||
button.ToolTip = TextManager.Get("GenerateWaypointsToolTip");
|
||||
button.OnClicked = GenerateWaypoints;
|
||||
|
||||
y += 30;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, y, 0, 20), "Show:", "", leftPanel);
|
||||
new GUITextBlock(new Rectangle(0, y, 0, 20), TextManager.Get("ShowEntitiesLabel"), "", leftPanel);
|
||||
|
||||
var tickBox = new GUITickBox(new Rectangle(0,y+20,20,20), "Waypoints", Alignment.TopLeft, leftPanel);
|
||||
var tickBox = new GUITickBox(new Rectangle(0,y+20,20,20), TextManager.Get("ShowWaypoints"), Alignment.TopLeft, leftPanel);
|
||||
tickBox.OnSelected = (GUITickBox obj) => { WayPoint.ShowWayPoints = !WayPoint.ShowWayPoints; return true; };
|
||||
tickBox.Selected = true;
|
||||
tickBox = new GUITickBox(new Rectangle(0, y + 45, 20, 20), "Spawnpoints", Alignment.TopLeft, leftPanel);
|
||||
tickBox = new GUITickBox(new Rectangle(0, y + 45, 20, 20), TextManager.Get("ShowSpawnpoints"), Alignment.TopLeft, leftPanel);
|
||||
tickBox.OnSelected = (GUITickBox obj) => { WayPoint.ShowSpawnPoints = !WayPoint.ShowSpawnPoints; return true; };
|
||||
tickBox.Selected = true;
|
||||
tickBox = new GUITickBox(new Rectangle(0, y + 70, 20, 20), "Links", Alignment.TopLeft, leftPanel);
|
||||
tickBox = new GUITickBox(new Rectangle(0, y + 70, 20, 20), TextManager.Get("ShowLinks"), Alignment.TopLeft, leftPanel);
|
||||
tickBox.OnSelected = (GUITickBox obj) => { Item.ShowLinks = !Item.ShowLinks; return true; };
|
||||
tickBox.Selected = true;
|
||||
tickBox = new GUITickBox(new Rectangle(0, y + 95, 20, 20), "Hulls", Alignment.TopLeft, leftPanel);
|
||||
tickBox = new GUITickBox(new Rectangle(0, y + 95, 20, 20), TextManager.Get("ShowHulls"), Alignment.TopLeft, leftPanel);
|
||||
tickBox.OnSelected = (GUITickBox obj) => { Hull.ShowHulls = !Hull.ShowHulls; return true; };
|
||||
tickBox.Selected = true;
|
||||
tickBox = new GUITickBox(new Rectangle(0, y + 120, 20, 20), "Gaps", Alignment.TopLeft, leftPanel);
|
||||
tickBox = new GUITickBox(new Rectangle(0, y + 120, 20, 20), TextManager.Get("ShowGaps"), Alignment.TopLeft, leftPanel);
|
||||
tickBox.OnSelected = (GUITickBox obj) => { Gap.ShowGaps = !Gap.ShowGaps; return true; };
|
||||
tickBox.Selected = true;
|
||||
|
||||
@@ -282,7 +279,7 @@ namespace Barotrauma
|
||||
|
||||
if (y < GameMain.GraphicsHeight - 100)
|
||||
{
|
||||
new GUITextBlock(new Rectangle(0, y, 0, 15), "Previously used:", "", leftPanel);
|
||||
new GUITextBlock(new Rectangle(0, y, 0, 15), TextManager.Get("PreviouslyUsedLabel"), "", leftPanel);
|
||||
|
||||
previouslyUsedList = new GUIListBox(new Rectangle(0, y + 20, 0, Math.Min(GameMain.GraphicsHeight - y - 80, 150)), "", leftPanel);
|
||||
previouslyUsedList.OnSelected = SelectPrefab;
|
||||
@@ -376,17 +373,20 @@ namespace Barotrauma
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(nameBox.Text))
|
||||
{
|
||||
GUI.AddMessage("Name your submarine before saving it", Color.Red, 3.0f);
|
||||
GUI.AddMessage(TextManager.Get("SubNameMissingWarning"), Color.Red, 3.0f);
|
||||
|
||||
nameBox.Flash();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (nameBox.Text.Contains("../"))
|
||||
|
||||
foreach (char illegalChar in Path.GetInvalidFileNameChars())
|
||||
{
|
||||
DebugConsole.ThrowError("Illegal symbols in filename (../)");
|
||||
nameBox.Flash();
|
||||
return false;
|
||||
if (nameBox.Text.Contains(illegalChar))
|
||||
{
|
||||
GUI.AddMessage(TextManager.Get("SubNameIllegalCharsWarning").Replace("[illegalchar]", illegalChar.ToString()), Color.Red, 3.0f);
|
||||
nameBox.Flash();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
string savePath = nameBox.Text + ".sub";
|
||||
@@ -403,7 +403,7 @@ namespace Barotrauma
|
||||
Submarine.SaveCurrent(savePath);
|
||||
Submarine.MainSub.CheckForErrors();
|
||||
|
||||
GUI.AddMessage("Submarine saved to " + Submarine.MainSub.FilePath, Color.Green, 3.0f);
|
||||
GUI.AddMessage(TextManager.Get("SubSavedNotification").Replace("[filepath]", Submarine.MainSub.FilePath), Color.Green, 3.0f);
|
||||
|
||||
Submarine.RefreshSavedSubs();
|
||||
linkedSubBox.ClearChildren();
|
||||
@@ -429,11 +429,11 @@ namespace Barotrauma
|
||||
saveFrame = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), "", null);
|
||||
saveFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
||||
|
||||
new GUITextBlock(new Rectangle(0,0,200,30), "Save submarine", "", saveFrame, GUI.LargeFont);
|
||||
new GUITextBlock(new Rectangle(0,0,200,30), TextManager.Get("SaveSubDialogHeader"), "", saveFrame, GUI.LargeFont);
|
||||
|
||||
y += 30;
|
||||
|
||||
new GUITextBlock(new Rectangle(0,y,150,20), "Name:", "", saveFrame);
|
||||
new GUITextBlock(new Rectangle(0,y,150,20), TextManager.Get("SaveSubDialogName"), "", saveFrame);
|
||||
y += 20;
|
||||
|
||||
nameBox = new GUITextBox(new Rectangle(5, y, 250, 20), "", saveFrame);
|
||||
@@ -442,7 +442,7 @@ namespace Barotrauma
|
||||
|
||||
y += 30;
|
||||
|
||||
new GUITextBlock(new Rectangle(0, y, 150, 20), "Description:", "", saveFrame);
|
||||
new GUITextBlock(new Rectangle(0, y, 150, 20), TextManager.Get("SaveSubDialogDescription"), "", saveFrame);
|
||||
y += 20;
|
||||
|
||||
var descriptionBox = new GUITextBox(new Rectangle(5, y, 0, 100), null, null, Alignment.TopLeft,
|
||||
@@ -452,7 +452,7 @@ namespace Barotrauma
|
||||
descriptionBox.OnTextChanged = ChangeSubDescription;
|
||||
|
||||
y += descriptionBox.Rect.Height + 15;
|
||||
new GUITextBlock(new Rectangle(0, y, 150, 20), "Settings:", "", saveFrame);
|
||||
new GUITextBlock(new Rectangle(0, y, 150, 20), TextManager.Get("SaveSubDialogSettings"), "", saveFrame);
|
||||
|
||||
y += 20;
|
||||
|
||||
@@ -492,10 +492,10 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
var saveButton = new GUIButton(new Rectangle(-90, 0, 80, 20), "Save", Alignment.Right | Alignment.Bottom, "", saveFrame);
|
||||
var saveButton = new GUIButton(new Rectangle(-90, 0, 80, 20), TextManager.Get("SaveSubButton"), Alignment.Right | Alignment.Bottom, "", saveFrame);
|
||||
saveButton.OnClicked = SaveSub;
|
||||
|
||||
var cancelButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Cancel", Alignment.Right | Alignment.Bottom, "", saveFrame);
|
||||
var cancelButton = new GUIButton(new Rectangle(0, 0, 80, 20), TextManager.Get("Cancel"), Alignment.Right | Alignment.Bottom, "", saveFrame);
|
||||
cancelButton.OnClicked = (GUIButton btn, object userdata) =>
|
||||
{
|
||||
saveFrame = null;
|
||||
@@ -537,13 +537,13 @@ namespace Barotrauma
|
||||
|
||||
if (sub.HasTag(SubmarineTag.Shuttle))
|
||||
{
|
||||
var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "Shuttle", "", Alignment.Left, Alignment.CenterY | Alignment.Right, textBlock, false, GUI.SmallFont);
|
||||
var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), TextManager.Get("Shuttle"), "", Alignment.Left, Alignment.CenterY | Alignment.Right, textBlock, false, GUI.SmallFont);
|
||||
shuttleText.TextColor = textBlock.TextColor * 0.8f;
|
||||
shuttleText.ToolTip = textBlock.ToolTip;
|
||||
}
|
||||
}
|
||||
|
||||
var deleteButton = new GUIButton(new Rectangle(0, 0, 70, 20), "Delete", Alignment.BottomLeft, "", loadFrame);
|
||||
var deleteButton = new GUIButton(new Rectangle(0, 0, 70, 20), TextManager.Get("Delete"), Alignment.BottomLeft, "", loadFrame);
|
||||
deleteButton.Enabled = false;
|
||||
deleteButton.UserData = "delete";
|
||||
deleteButton.OnClicked = (btn, userdata) =>
|
||||
@@ -558,10 +558,10 @@ namespace Barotrauma
|
||||
return true;
|
||||
};
|
||||
|
||||
var loadButton = new GUIButton(new Rectangle(-90, 0, 80, 20), "Load", Alignment.Right | Alignment.Bottom, "", loadFrame);
|
||||
var loadButton = new GUIButton(new Rectangle(-90, 0, 80, 20), TextManager.Get("Load"), Alignment.Right | Alignment.Bottom, "", loadFrame);
|
||||
loadButton.OnClicked = LoadSub;
|
||||
|
||||
var cancelButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Cancel", Alignment.Right | Alignment.Bottom, "", loadFrame);
|
||||
var cancelButton = new GUIButton(new Rectangle(0, 0, 80, 20), TextManager.Get("Cancel"), Alignment.Right | Alignment.Bottom, "", loadFrame);
|
||||
cancelButton.OnClicked = (GUIButton btn, object userdata) =>
|
||||
{
|
||||
loadFrame = null;
|
||||
@@ -595,7 +595,10 @@ namespace Barotrauma
|
||||
{
|
||||
if (sub == null) return;
|
||||
|
||||
var msgBox = new GUIMessageBox("Delete file?", "Are you sure you want to delete \"" + sub.Name + "\"", new string[] { "OK", "Cancel" });
|
||||
var msgBox = new GUIMessageBox(
|
||||
TextManager.Get("DeleteDialogLabel"),
|
||||
TextManager.Get("DeleteDialogQuestion").Replace("[file]", sub.Name),
|
||||
new string[] { TextManager.Get("Yes"), TextManager.Get("Cancel") });
|
||||
msgBox.Buttons[0].OnClicked += (btn, userData) =>
|
||||
{
|
||||
try
|
||||
@@ -606,7 +609,7 @@ namespace Barotrauma
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugConsole.ThrowError("Couldn't delete file \"" + sub.FilePath + "\"!", e);
|
||||
DebugConsole.ThrowError(TextManager.Get("DeleteFileError").Replace("[file]", sub.FilePath), e);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
@@ -901,7 +904,305 @@ namespace Barotrauma
|
||||
previouslyUsedList.RemoveChild(textBlock);
|
||||
previouslyUsedList.children.Insert(0, textBlock);
|
||||
}
|
||||
|
||||
public void AutoHull()
|
||||
{
|
||||
for (int i = 0; i < MapEntity.mapEntityList.Count; i++)
|
||||
{
|
||||
MapEntity h = MapEntity.mapEntityList[i];
|
||||
if (h is Hull || h is Gap)
|
||||
{
|
||||
h.Remove();
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
List<Vector2> wallPoints = new List<Vector2>();
|
||||
Vector2 min = Vector2.Zero;
|
||||
Vector2 max = Vector2.Zero;
|
||||
|
||||
List<MapEntity> mapEntityList = new List<MapEntity>();
|
||||
|
||||
foreach (MapEntity e in MapEntity.mapEntityList)
|
||||
{
|
||||
if (e is Item)
|
||||
{
|
||||
Item it = e as Item;
|
||||
Door door = it.GetComponent<Door>();
|
||||
if (door != null)
|
||||
{
|
||||
int halfW = e.WorldRect.Width / 2;
|
||||
wallPoints.Add(new Vector2(e.WorldRect.X + halfW, -e.WorldRect.Y + e.WorldRect.Height));
|
||||
mapEntityList.Add(it);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(e is Structure)) continue;
|
||||
Structure s = e as Structure;
|
||||
if (!s.HasBody) continue;
|
||||
mapEntityList.Add(e);
|
||||
|
||||
if (e.Rect.Width > e.Rect.Height)
|
||||
{
|
||||
int halfH = e.WorldRect.Height / 2;
|
||||
wallPoints.Add(new Vector2(e.WorldRect.X, -e.WorldRect.Y + halfH));
|
||||
wallPoints.Add(new Vector2(e.WorldRect.X + e.WorldRect.Width, -e.WorldRect.Y + halfH));
|
||||
}
|
||||
else
|
||||
{
|
||||
int halfW = e.WorldRect.Width / 2;
|
||||
wallPoints.Add(new Vector2(e.WorldRect.X + halfW, -e.WorldRect.Y));
|
||||
wallPoints.Add(new Vector2(e.WorldRect.X + halfW, -e.WorldRect.Y + e.WorldRect.Height));
|
||||
}
|
||||
}
|
||||
|
||||
min = wallPoints[0];
|
||||
max = wallPoints[0];
|
||||
for (int i = 0; i < wallPoints.Count; i++)
|
||||
{
|
||||
min.X = Math.Min(min.X, wallPoints[i].X);
|
||||
min.Y = Math.Min(min.Y, wallPoints[i].Y);
|
||||
max.X = Math.Max(max.X, wallPoints[i].X);
|
||||
max.Y = Math.Max(max.Y, wallPoints[i].Y);
|
||||
}
|
||||
|
||||
List<Rectangle> hullRects = new List<Rectangle>();
|
||||
hullRects.Add(new Rectangle((int)min.X, (int)min.Y, (int)(max.X - min.X), (int)(max.Y - min.Y)));
|
||||
foreach (Vector2 point in wallPoints)
|
||||
{
|
||||
MathUtils.SplitRectanglesHorizontal(hullRects, point);
|
||||
MathUtils.SplitRectanglesVertical(hullRects, point);
|
||||
}
|
||||
|
||||
hullRects.Sort((a, b) =>
|
||||
{
|
||||
if (a.Y < b.Y) return -1;
|
||||
if (a.Y > b.Y) return 1;
|
||||
if (a.X < b.X) return -1;
|
||||
if (a.X > b.X) return 1;
|
||||
return 0;
|
||||
});
|
||||
|
||||
for (int i = 0; i < hullRects.Count - 1; i++)
|
||||
{
|
||||
Rectangle rect = hullRects[i];
|
||||
if (hullRects[i + 1].Y > rect.Y) continue;
|
||||
|
||||
Vector2 hullRPoint = new Vector2(rect.X + rect.Width - 8, rect.Y + rect.Height / 2);
|
||||
Vector2 hullLPoint = new Vector2(rect.X, rect.Y + rect.Height / 2);
|
||||
|
||||
MapEntity container = null;
|
||||
foreach (MapEntity e in mapEntityList)
|
||||
{
|
||||
Rectangle entRect = e.WorldRect;
|
||||
entRect.Y = -entRect.Y;
|
||||
if (entRect.Contains(hullRPoint))
|
||||
{
|
||||
if (!entRect.Contains(hullLPoint)) container = e;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (container == null)
|
||||
{
|
||||
rect.Width += hullRects[i + 1].Width;
|
||||
hullRects[i] = rect;
|
||||
hullRects.RemoveAt(i + 1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (MapEntity e in mapEntityList)
|
||||
{
|
||||
Rectangle entRect = e.WorldRect;
|
||||
if (entRect.Width < entRect.Height) continue;
|
||||
entRect.Y = -entRect.Y - 16;
|
||||
for (int i = 0; i < hullRects.Count; i++)
|
||||
{
|
||||
Rectangle hullRect = hullRects[i];
|
||||
if (entRect.Intersects(hullRect))
|
||||
{
|
||||
if (hullRect.Y < entRect.Y)
|
||||
{
|
||||
hullRect.Height = Math.Max((entRect.Y + 16 + entRect.Height / 2) - hullRect.Y, hullRect.Height);
|
||||
hullRects[i] = hullRect;
|
||||
}
|
||||
else if (hullRect.Y + hullRect.Height <= entRect.Y + 16 + entRect.Height)
|
||||
{
|
||||
hullRects.RemoveAt(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (MapEntity e in mapEntityList)
|
||||
{
|
||||
Rectangle entRect = e.WorldRect;
|
||||
if (entRect.Width < entRect.Height) continue;
|
||||
entRect.Y = -entRect.Y;
|
||||
for (int i = 0; i < hullRects.Count; i++)
|
||||
{
|
||||
Rectangle hullRect = hullRects[i];
|
||||
if (entRect.Intersects(hullRect))
|
||||
{
|
||||
if (hullRect.Y >= entRect.Y - 8 && hullRect.Y + hullRect.Height <= entRect.Y + entRect.Height + 8)
|
||||
{
|
||||
hullRects.RemoveAt(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < hullRects.Count;)
|
||||
{
|
||||
Rectangle hullRect = hullRects[i];
|
||||
Vector2 point = new Vector2(hullRect.X+2, hullRect.Y+hullRect.Height/2);
|
||||
MapEntity container = null;
|
||||
foreach (MapEntity e in mapEntityList)
|
||||
{
|
||||
Rectangle entRect = e.WorldRect;
|
||||
entRect.Y = -entRect.Y;
|
||||
if (entRect.Contains(point))
|
||||
{
|
||||
container = e;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (container == null)
|
||||
{
|
||||
hullRects.RemoveAt(i);
|
||||
continue;
|
||||
}
|
||||
|
||||
while (hullRects[i].Y <= hullRect.Y)
|
||||
{
|
||||
i++;
|
||||
if (i >= hullRects.Count) break;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = hullRects.Count-1; i >= 0;)
|
||||
{
|
||||
Rectangle hullRect = hullRects[i];
|
||||
Vector2 point = new Vector2(hullRect.X+hullRect.Width-2, hullRect.Y+hullRect.Height/2);
|
||||
MapEntity container = null;
|
||||
foreach (MapEntity e in mapEntityList)
|
||||
{
|
||||
Rectangle entRect = e.WorldRect;
|
||||
entRect.Y = -entRect.Y;
|
||||
if (entRect.Contains(point))
|
||||
{
|
||||
container = e;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (container == null)
|
||||
{
|
||||
hullRects.RemoveAt(i); i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
while (hullRects[i].Y >= hullRect.Y)
|
||||
{
|
||||
i--;
|
||||
if (i < 0) break;
|
||||
}
|
||||
}
|
||||
|
||||
hullRects.Sort((a, b) =>
|
||||
{
|
||||
if (a.X < b.X) return -1;
|
||||
if (a.X > b.X) return 1;
|
||||
if (a.Y < b.Y) return -1;
|
||||
if (a.Y > b.Y) return 1;
|
||||
return 0;
|
||||
});
|
||||
|
||||
for (int i = 0; i < hullRects.Count - 1; i++)
|
||||
{
|
||||
Rectangle rect = hullRects[i];
|
||||
if (hullRects[i + 1].Width != rect.Width) continue;
|
||||
if (hullRects[i + 1].X > rect.X) continue;
|
||||
|
||||
Vector2 hullBPoint = new Vector2(rect.X + rect.Width / 2, rect.Y + rect.Height - 8);
|
||||
Vector2 hullUPoint = new Vector2(rect.X + rect.Width / 2, rect.Y);
|
||||
|
||||
MapEntity container = null;
|
||||
foreach (MapEntity e in mapEntityList)
|
||||
{
|
||||
Rectangle entRect = e.WorldRect;
|
||||
entRect.Y = -entRect.Y;
|
||||
if (entRect.Contains(hullBPoint))
|
||||
{
|
||||
if (!entRect.Contains(hullUPoint)) container = e;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (container == null)
|
||||
{
|
||||
rect.Height += hullRects[i + 1].Height;
|
||||
hullRects[i] = rect;
|
||||
hullRects.RemoveAt(i + 1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < hullRects.Count;i++)
|
||||
{
|
||||
Rectangle rect = hullRects[i];
|
||||
rect.Y -= 16;
|
||||
rect.Height += 32;
|
||||
hullRects[i] = rect;
|
||||
}
|
||||
|
||||
hullRects.Sort((a, b) =>
|
||||
{
|
||||
if (a.Y < b.Y) return -1;
|
||||
if (a.Y > b.Y) return 1;
|
||||
if (a.X < b.X) return -1;
|
||||
if (a.X > b.X) return 1;
|
||||
return 0;
|
||||
});
|
||||
|
||||
for (int i = 0; i < hullRects.Count; i++)
|
||||
{
|
||||
for (int j = i+1; j < hullRects.Count; j++)
|
||||
{
|
||||
if (hullRects[j].Y <= hullRects[i].Y) continue;
|
||||
if (hullRects[j].Intersects(hullRects[i]))
|
||||
{
|
||||
Rectangle rect = hullRects[i];
|
||||
rect.Height = hullRects[j].Y - rect.Y;
|
||||
hullRects[i] = rect;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (Rectangle rect in hullRects)
|
||||
{
|
||||
Rectangle hullRect = rect;
|
||||
hullRect.Y = -hullRect.Y;
|
||||
Hull newHull = new Hull(MapEntityPrefab.Find("Hull"),
|
||||
hullRect,
|
||||
Submarine.MainSub);
|
||||
}
|
||||
|
||||
foreach (MapEntity e in mapEntityList)
|
||||
{
|
||||
if (!(e is Structure)) continue;
|
||||
if (!(e as Structure).IsPlatform) continue;
|
||||
|
||||
Rectangle gapRect = e.WorldRect;
|
||||
gapRect.Y -= 8;
|
||||
gapRect.Height = 16;
|
||||
Gap newGap = new Gap(MapEntityPrefab.Find("Gap"),
|
||||
gapRect);
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddToGUIUpdateList()
|
||||
{
|
||||
if (tutorial != null) tutorial.AddToGUIUpdateList();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.IO;
|
||||
@@ -186,18 +186,23 @@ namespace Barotrauma
|
||||
|
||||
public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Vector2 startOffset, Color color)
|
||||
{
|
||||
DrawTiled(spriteBatch, pos, targetSize, startOffset, sourceRect, color);
|
||||
DrawTiled(spriteBatch, pos, targetSize, startOffset, sourceRect, color, Vector2.One);
|
||||
}
|
||||
|
||||
public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Vector2 startOffset, Rectangle sourceRect, Color color)
|
||||
{
|
||||
DrawTiled(spriteBatch, pos, targetSize, startOffset, sourceRect, color, Vector2.One);
|
||||
}
|
||||
|
||||
public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Vector2 startOffset, Rectangle sourceRect, Color color, Vector2 scale)
|
||||
{
|
||||
//pos.X = (int)pos.X;
|
||||
//pos.Y = (int)pos.Y;
|
||||
|
||||
//how many times the texture needs to be drawn on the x-axis
|
||||
int xTiles = (int)Math.Ceiling((targetSize.X + startOffset.X) / sourceRect.Width);
|
||||
int xTiles = (int)Math.Ceiling((targetSize.X + startOffset.X) / (sourceRect.Width*scale.X));
|
||||
//how many times the texture needs to be drawn on the y-axis
|
||||
int yTiles = (int)Math.Ceiling((targetSize.Y + startOffset.Y) / sourceRect.Height);
|
||||
int yTiles = (int)Math.Ceiling((targetSize.Y + startOffset.Y) / (sourceRect.Height*scale.Y));
|
||||
|
||||
Vector2 position = pos - startOffset;
|
||||
Rectangle drawRect = sourceRect;
|
||||
@@ -211,11 +216,11 @@ namespace Barotrauma
|
||||
|
||||
if (x == xTiles - 1)
|
||||
{
|
||||
drawRect.Width -= (int)((position.X + sourceRect.Width) - (pos.X + targetSize.X));
|
||||
drawRect.Width -= (int)((position.X + sourceRect.Width*scale.X) - (pos.X + targetSize.X));
|
||||
}
|
||||
else
|
||||
{
|
||||
drawRect.Width = sourceRect.Width;
|
||||
drawRect.Width = (int)(sourceRect.Width*scale.X);
|
||||
}
|
||||
|
||||
if (position.X < pos.X)
|
||||
@@ -234,11 +239,11 @@ namespace Barotrauma
|
||||
|
||||
if (y == yTiles - 1)
|
||||
{
|
||||
drawRect.Height -= (int)((position.Y + sourceRect.Height) - (pos.Y + targetSize.Y));
|
||||
drawRect.Height -= (int)((position.Y + sourceRect.Height*scale.Y) - (pos.Y + targetSize.Y));
|
||||
}
|
||||
else
|
||||
{
|
||||
drawRect.Height = sourceRect.Height;
|
||||
drawRect.Height = (int)(sourceRect.Height*scale.Y);
|
||||
}
|
||||
|
||||
if (position.Y < pos.Y)
|
||||
@@ -252,10 +257,10 @@ namespace Barotrauma
|
||||
spriteBatch.Draw(texture, position,
|
||||
drawRect, color, rotation, Vector2.Zero, 1.0f, effects, depth);
|
||||
|
||||
position.Y += sourceRect.Height;
|
||||
position.Y += sourceRect.Height*scale.Y;
|
||||
}
|
||||
|
||||
position.X += sourceRect.Width;
|
||||
position.X += sourceRect.Width*scale.X;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.IO;
|
||||
using Color = Microsoft.Xna.Framework.Color;
|
||||
@@ -44,7 +44,7 @@ namespace Barotrauma
|
||||
try
|
||||
{
|
||||
|
||||
using (Stream fileStream = File.OpenRead(path))
|
||||
using (Stream fileStream = File.OpenRead(path))
|
||||
{
|
||||
var texture = Texture2D.FromStream(_graphicsDevice, fileStream);
|
||||
texture = PreMultiplyAlpha(texture);
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MonoGame.Framework.DesktopGL" version="3.6.0.1625" targetFramework="net45" />
|
||||
<package id="MonoGame.Framework.WindowsDX" version="3.6.0.1625" targetFramework="net45" />
|
||||
<package id="NVorbis" version="0.8.5.0" targetFramework="net45" />
|
||||
<package id="OpenTK" version="2.0.0" targetFramework="net45" />
|
||||
<package id="RestSharp" version="105.2.3" targetFramework="net45" />
|
||||
<package id="SharpDX" version="4.0.1" targetFramework="net45" />
|
||||
</packages>
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">ReleaseLinux</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProjectGuid>{85232B20-074D-4723-B0C6-91495391E448}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
@@ -27,30 +27,47 @@
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>..\bin\Windows\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;WINDOWS;SERVER</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>..\bin\Windows\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;WINDOWS;SERVER</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<ReleaseVersion>0.7.0.1</ReleaseVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseLinux|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\bin\ReleaseLinux</OutputPath>
|
||||
<DefineConstants>TRACE;SERVER</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugLinux|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\DebugLinux</OutputPath>
|
||||
<DefineConstants>TRACE;SERVER;DEBUG</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseWindows|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\bin\ReleaseWindows</OutputPath>
|
||||
<DefineConstants>TRACE;SERVER</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugWindows|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\DebugWindows</OutputPath>
|
||||
<DefineConstants>TRACE;SERVER;DEBUG</DefineConstants>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Barotrauma.Networking;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Barotrauma
|
||||
@@ -94,6 +95,13 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
NewMessage("Set gamemode to " + GameMain.NetLobbyScreen.SelectedModeName, Color.Cyan);
|
||||
},
|
||||
() =>
|
||||
{
|
||||
return new string[][]
|
||||
{
|
||||
GameModePreset.list.Select(gm => gm.Name).ToArray()
|
||||
};
|
||||
}));
|
||||
|
||||
commands.Add(new Command("mission", "mission [name]/[index]: Select the mission type for the next round. The parameter can either be the name or the index number of the mission type (0 = first mission type, 1 = second mission type, etc).", (string[] args) =>
|
||||
@@ -108,6 +116,13 @@ namespace Barotrauma
|
||||
GameMain.NetLobbyScreen.MissionTypeName = string.Join(" ", args);
|
||||
}
|
||||
NewMessage("Set mission to " + GameMain.NetLobbyScreen.MissionTypeName, Color.Cyan);
|
||||
},
|
||||
() =>
|
||||
{
|
||||
return new string[][]
|
||||
{
|
||||
Mission.MissionTypes.ToArray()
|
||||
};
|
||||
}));
|
||||
|
||||
commands.Add(new Command("sub|submarine", "submarine [name]: Select the submarine for the next round.", (string[] args) =>
|
||||
@@ -120,6 +135,13 @@ namespace Barotrauma
|
||||
}
|
||||
sub = GameMain.NetLobbyScreen.SelectedSub;
|
||||
NewMessage("Selected sub: " + sub.Name + (sub.HasTag(SubmarineTag.Shuttle) ? " (shuttle)" : ""), Color.Cyan);
|
||||
},
|
||||
() =>
|
||||
{
|
||||
return new string[][]
|
||||
{
|
||||
Submarine.Loaded.Select(s => s.Name).ToArray()
|
||||
};
|
||||
}));
|
||||
|
||||
commands.Add(new Command("shuttle", "shuttle [name]: Select the specified submarine as the respawn shuttle for the next round.", (string[] args) =>
|
||||
@@ -132,6 +154,13 @@ namespace Barotrauma
|
||||
}
|
||||
shuttle = GameMain.NetLobbyScreen.SelectedShuttle;
|
||||
NewMessage("Selected shuttle: " + shuttle.Name + (shuttle.HasTag(SubmarineTag.Shuttle) ? "" : " (not shuttle)"), Color.Cyan);
|
||||
},
|
||||
() =>
|
||||
{
|
||||
return new string[][]
|
||||
{
|
||||
Submarine.Loaded.Select(s => s.Name).ToArray()
|
||||
};
|
||||
}));
|
||||
|
||||
commands.Add(new Command("startgame|startround|start", "start/startgame/startround: Start a new round.", (string[] args) =>
|
||||
|
||||
@@ -3,6 +3,7 @@ using FarseerPhysics.Dynamics;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Xml.Linq;
|
||||
@@ -133,24 +134,32 @@ namespace Barotrauma
|
||||
|
||||
Timing.Accumulator = 0.0;
|
||||
|
||||
DateTime prevTime = DateTime.Now;
|
||||
|
||||
double frequency = (double)Stopwatch.Frequency;
|
||||
if (frequency <= 1500)
|
||||
{
|
||||
DebugConsole.NewMessage("WARNING: Stopwatch frequency under 1500 ticks per second. Expect significant syncing accuracy issues.", Color.Yellow);
|
||||
}
|
||||
|
||||
Stopwatch stopwatch = Stopwatch.StartNew();
|
||||
long prevTicks = stopwatch.ElapsedTicks;
|
||||
while (ShouldRun)
|
||||
{
|
||||
Timing.Accumulator += ((float)(DateTime.Now.Subtract(prevTime).Milliseconds) / 1000.0)/Timing.Step;
|
||||
prevTime = DateTime.Now;
|
||||
while (Timing.Accumulator>0.0)
|
||||
long currTicks = stopwatch.ElapsedTicks;
|
||||
Timing.Accumulator += (double)(currTicks - prevTicks) / frequency;
|
||||
prevTicks = currTicks;
|
||||
while (Timing.Accumulator>=Timing.Step)
|
||||
{
|
||||
DebugConsole.Update();
|
||||
if (Screen.Selected != null) Screen.Selected.Update((float)Timing.Step);
|
||||
Server.Update((float)Timing.Step);
|
||||
CoroutineManager.Update((float)Timing.Step, (float)Timing.Step);
|
||||
|
||||
Timing.Accumulator -= 1.0;
|
||||
|
||||
Timing.Accumulator -= Timing.Step;
|
||||
}
|
||||
int frameTime = DateTime.Now.Subtract(prevTime).Milliseconds;
|
||||
Thread.Sleep(Math.Max((int)(Timing.Step * 1000.0) - frameTime/2,0));
|
||||
int frameTime = (int)(((double)(stopwatch.ElapsedTicks - prevTicks) / frequency)*1000.0);
|
||||
Thread.Sleep(Math.Max(((int)(Timing.Step * 1000.0) - frameTime)/2,0));
|
||||
}
|
||||
stopwatch.Stop();
|
||||
|
||||
CloseServer();
|
||||
|
||||
|
||||
@@ -5,14 +5,10 @@ using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
#if WINDOWS
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
#if WINDOWS || LINUX
|
||||
/// <summary>
|
||||
/// The main class.
|
||||
/// </summary>
|
||||
@@ -86,5 +82,4 @@ namespace Barotrauma
|
||||
sw.Close();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace Microsoft.Xna.Framework
|
||||
// |-------|-------|-------|-------
|
||||
// A B G R
|
||||
private uint _packedValue;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Constructs an RGBA color from a packed value.
|
||||
/// The value is a 32-bit unsigned integer, with R in the least significant octet.
|
||||
@@ -384,8 +384,8 @@ namespace Microsoft.Xna.Framework
|
||||
this._packedValue = (this._packedValue & 0x00ffffff) | ((uint)value << 24);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
/// <summary>
|
||||
/// Compares whether two <see cref="Color"/> instances are equal.
|
||||
/// </summary>
|
||||
/// <param name="a"><see cref="Color"/> instance on the left of the equal sign.</param>
|
||||
@@ -395,13 +395,13 @@ namespace Microsoft.Xna.Framework
|
||||
{
|
||||
return (a._packedValue == b._packedValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
/// <summary>
|
||||
/// Compares whether two <see cref="Color"/> instances are not equal.
|
||||
/// </summary>
|
||||
/// <param name="a"><see cref="Color"/> instance on the left of the not equal sign.</param>
|
||||
/// <param name="b"><see cref="Color"/> instance on the right of the not equal sign.</param>
|
||||
/// <returns><c>true</c> if the instances are not equal; <c>false</c> otherwise.</returns>
|
||||
/// <returns><c>true</c> if the instances are not equal; <c>false</c> otherwise.</returns>
|
||||
public static bool operator !=(Color a, Color b)
|
||||
{
|
||||
return (a._packedValue != b._packedValue);
|
||||
@@ -415,7 +415,7 @@ namespace Microsoft.Xna.Framework
|
||||
{
|
||||
return this._packedValue.GetHashCode();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Compares whether current instance is equal to specified object.
|
||||
/// </summary>
|
||||
@@ -444,8 +444,8 @@ namespace Microsoft.Xna.Framework
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
/// <summary>
|
||||
/// AliceBlue color (R:240,G:248,B:255,A:255).
|
||||
/// </summary>
|
||||
public static Color AliceBlue
|
||||
@@ -466,13 +466,13 @@ namespace Microsoft.Xna.Framework
|
||||
/// <summary>
|
||||
/// Aqua color (R:0,G:255,B:255,A:255).
|
||||
/// </summary>
|
||||
public static Color Aqua
|
||||
public static Color Aqua
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
/// <summary>
|
||||
/// Aquamarine color (R:127,G:255,B:212,A:255).
|
||||
/// </summary>
|
||||
public static Color Aquamarine
|
||||
@@ -484,13 +484,13 @@ namespace Microsoft.Xna.Framework
|
||||
/// <summary>
|
||||
/// Azure color (R:240,G:255,B:255,A:255).
|
||||
/// </summary>
|
||||
public static Color Azure
|
||||
public static Color Azure
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
/// <summary>
|
||||
/// Beige color (R:245,G:245,B:220,A:255).
|
||||
/// </summary>
|
||||
public static Color Beige
|
||||
@@ -610,13 +610,13 @@ namespace Microsoft.Xna.Framework
|
||||
/// <summary>
|
||||
/// Cornsilk color (R:255,G:248,B:220,A:255).
|
||||
/// </summary>
|
||||
public static Color Cornsilk
|
||||
public static Color Cornsilk
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
/// <summary>
|
||||
/// Crimson color (R:220,G:20,B:60,A:255).
|
||||
/// </summary>
|
||||
public static Color Crimson
|
||||
@@ -637,13 +637,13 @@ namespace Microsoft.Xna.Framework
|
||||
/// <summary>
|
||||
/// DarkBlue color (R:0,G:0,B:139,A:255).
|
||||
/// </summary>
|
||||
public static Color DarkBlue
|
||||
public static Color DarkBlue
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
/// <summary>
|
||||
/// DarkCyan color (R:0,G:139,B:139,A:255).
|
||||
/// </summary>
|
||||
public static Color DarkCyan
|
||||
@@ -664,13 +664,13 @@ namespace Microsoft.Xna.Framework
|
||||
/// <summary>
|
||||
/// DarkGray color (R:169,G:169,B:169,A:255).
|
||||
/// </summary>
|
||||
public static Color DarkGray
|
||||
public static Color DarkGray
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
/// <summary>
|
||||
/// DarkGreen color (R:0,G:100,B:0,A:255).
|
||||
/// </summary>
|
||||
public static Color DarkGreen
|
||||
@@ -733,7 +733,7 @@ namespace Microsoft.Xna.Framework
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// DarkSalmon color (R:233,G:150,B:122,A:255).
|
||||
/// </summary>
|
||||
public static Color DarkSalmon
|
||||
@@ -850,7 +850,7 @@ namespace Microsoft.Xna.Framework
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Fuchsia color (R:255,G:0,B:255,A:255).
|
||||
/// </summary>
|
||||
public static Color Fuchsia
|
||||
@@ -1496,7 +1496,7 @@ namespace Microsoft.Xna.Framework
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// SaddleBrown color (R:139,G:69,B:19,A:255).
|
||||
/// </summary>
|
||||
public static Color SaddleBrown
|
||||
@@ -1504,7 +1504,7 @@ namespace Microsoft.Xna.Framework
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Salmon color (R:250,G:128,B:114,A:255).
|
||||
/// </summary>
|
||||
@@ -1532,7 +1532,7 @@ namespace Microsoft.Xna.Framework
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// SeaShell color (R:255,G:245,B:238,A:255).
|
||||
/// </summary>
|
||||
public static Color SeaShell
|
||||
@@ -1541,7 +1541,7 @@ namespace Microsoft.Xna.Framework
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Sienna color (R:160,G:82,B:45,A:255).
|
||||
/// </summary>
|
||||
public static Color Sienna
|
||||
@@ -1550,7 +1550,7 @@ namespace Microsoft.Xna.Framework
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Silver color (R:192,G:192,B:192,A:255).
|
||||
/// </summary>
|
||||
public static Color Silver
|
||||
@@ -1649,7 +1649,7 @@ namespace Microsoft.Xna.Framework
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Turquoise color (R:64,G:224,B:208,A:255).
|
||||
/// </summary>
|
||||
public static Color Turquoise
|
||||
@@ -1670,12 +1670,12 @@ namespace Microsoft.Xna.Framework
|
||||
/// <summary>
|
||||
/// Wheat color (R:245,G:222,B:179,A:255).
|
||||
/// </summary>
|
||||
public static Color Wheat
|
||||
public static Color Wheat
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// White color (R:255,G:255,B:255,A:255).
|
||||
/// </summary>
|
||||
@@ -1722,7 +1722,7 @@ namespace Microsoft.Xna.Framework
|
||||
/// <returns>Interpolated <see cref="Color"/>.</returns>
|
||||
public static Color Lerp(Color value1, Color value2, Single amount)
|
||||
{
|
||||
amount = MathHelper.Clamp(amount, 0, 1);
|
||||
amount = MathHelper.Clamp(amount, 0, 1);
|
||||
return new Color(
|
||||
(int)MathHelper.Lerp(value1.R, value2.R, amount),
|
||||
(int)MathHelper.Lerp(value1.G, value2.G, amount),
|
||||
@@ -1730,24 +1730,24 @@ namespace Microsoft.Xna.Framework
|
||||
(int)MathHelper.Lerp(value1.A, value2.A, amount) );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Multiply <see cref="Color"/> by value.
|
||||
/// </summary>
|
||||
/// <param name="value">Source <see cref="Color"/>.</param>
|
||||
/// <param name="scale">Multiplicator.</param>
|
||||
/// <returns>Multiplication result.</returns>
|
||||
public static Color Multiply(Color value, float scale)
|
||||
{
|
||||
return new Color((int)(value.R * scale), (int)(value.G * scale), (int)(value.B * scale), (int)(value.A * scale));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
public static Color Multiply(Color value, float scale)
|
||||
{
|
||||
return new Color((int)(value.R * scale), (int)(value.G * scale), (int)(value.B * scale), (int)(value.A * scale));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiply <see cref="Color"/> by value.
|
||||
/// </summary>
|
||||
/// <param name="value">Source <see cref="Color"/>.</param>
|
||||
/// <param name="scale">Multiplicator.</param>
|
||||
/// <returns>Multiplication result.</returns>
|
||||
public static Color operator *(Color value, float scale)
|
||||
public static Color operator *(Color value, float scale)
|
||||
{
|
||||
return new Color((int)(value.R * scale), (int)(value.G * scale), (int)(value.B * scale), (int)(value.A * scale));
|
||||
}
|
||||
@@ -1769,7 +1769,7 @@ namespace Microsoft.Xna.Framework
|
||||
{
|
||||
return new Vector4(R / 255.0f, G / 255.0f, B / 255.0f, A / 255.0f);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets packed value of this <see cref="Color"/>.
|
||||
/// </summary>
|
||||
@@ -1800,8 +1800,8 @@ namespace Microsoft.Xna.Framework
|
||||
/// {R:[red] G:[green] B:[blue] A:[alpha]}
|
||||
/// </summary>
|
||||
/// <returns><see cref="String"/> representation of this <see cref="Color"/>.</returns>
|
||||
public override string ToString ()
|
||||
{
|
||||
public override string ToString ()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(25);
|
||||
sb.Append("{R:");
|
||||
sb.Append(R);
|
||||
@@ -1813,9 +1813,9 @@ namespace Microsoft.Xna.Framework
|
||||
sb.Append(A);
|
||||
sb.Append("}");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Translate a non-premultipled alpha <see cref="Color"/> to a <see cref="Color"/> that contains premultiplied alpha.
|
||||
/// </summary>
|
||||
/// <param name="vector">A <see cref="Vector4"/> representing color.</param>
|
||||
@@ -1824,8 +1824,8 @@ namespace Microsoft.Xna.Framework
|
||||
{
|
||||
return new Color(vector.X * vector.W, vector.Y * vector.W, vector.Z * vector.W, vector.W);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
/// <summary>
|
||||
/// Translate a non-premultipled alpha <see cref="Color"/> to a <see cref="Color"/> that contains premultiplied alpha.
|
||||
/// </summary>
|
||||
/// <param name="r">Red component value.</param>
|
||||
@@ -1839,15 +1839,15 @@ namespace Microsoft.Xna.Framework
|
||||
}
|
||||
|
||||
#region IEquatable<Color> Members
|
||||
|
||||
/// <summary>
|
||||
|
||||
/// <summary>
|
||||
/// Compares whether current instance is equal to specified <see cref="Color"/>.
|
||||
/// </summary>
|
||||
/// <param name="other">The <see cref="Color"/> to compare.</param>
|
||||
/// <returns><c>true</c> if the instances are equal; <c>false</c> otherwise.</returns>
|
||||
public bool Equals(Color other)
|
||||
{
|
||||
return this.PackedValue == other.PackedValue;
|
||||
return this.PackedValue == other.PackedValue;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Microsoft.Xna.Framework.Graphics
|
||||
/// <summary>
|
||||
/// No options specified.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
None = 0,
|
||||
/// <summary>
|
||||
/// Render the sprite reversed along the X axis.
|
||||
/// </summary>
|
||||
|
||||
@@ -44,15 +44,15 @@ namespace Microsoft.Xna.Framework.Input
|
||||
/// Identifies the state of a keyboard key.
|
||||
/// </summary>
|
||||
public enum KeyState
|
||||
{
|
||||
/// <summary>
|
||||
/// Key is released.
|
||||
/// </summary>
|
||||
Up,
|
||||
{
|
||||
/// <summary>
|
||||
/// Key is released.
|
||||
/// </summary>
|
||||
Up,
|
||||
|
||||
/// <summary>
|
||||
/// Key is pressed.
|
||||
/// </summary>
|
||||
Down,
|
||||
}
|
||||
/// <summary>
|
||||
/// Key is pressed.
|
||||
/// </summary>
|
||||
Down,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Microsoft.Xna.Framework.Input
|
||||
/// <summary>
|
||||
/// Holds the state of keystrokes by a keyboard.
|
||||
/// </summary>
|
||||
public struct KeyboardState
|
||||
public struct KeyboardState
|
||||
{
|
||||
// Used for the common situation where GetPressedKeys will return an empty array
|
||||
static Keys[] empty = new Keys[0];
|
||||
|
||||
@@ -6,648 +6,648 @@ namespace Microsoft.Xna.Framework.Input
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the keys on a keyboard.
|
||||
/// </summary>
|
||||
public enum Keys
|
||||
{
|
||||
/// </summary>
|
||||
public enum Keys
|
||||
{
|
||||
/// <summary>
|
||||
/// Reserved.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
None = 0,
|
||||
/// <summary>
|
||||
/// BACKSPACE key.
|
||||
/// </summary>
|
||||
Back = 8,
|
||||
Back = 8,
|
||||
/// <summary>
|
||||
/// TAB key.
|
||||
/// </summary>
|
||||
Tab = 9,
|
||||
Tab = 9,
|
||||
/// <summary>
|
||||
/// ENTER key.
|
||||
/// </summary>
|
||||
Enter = 13,
|
||||
Enter = 13,
|
||||
/// <summary>
|
||||
/// CAPS LOCK key.
|
||||
/// </summary>
|
||||
CapsLock = 20,
|
||||
CapsLock = 20,
|
||||
/// <summary>
|
||||
/// ESC key.
|
||||
/// </summary>
|
||||
Escape = 27,
|
||||
Escape = 27,
|
||||
/// <summary>
|
||||
/// SPACEBAR key.
|
||||
/// </summary>
|
||||
Space = 32,
|
||||
Space = 32,
|
||||
/// <summary>
|
||||
/// PAGE UP key.
|
||||
/// </summary>
|
||||
PageUp = 33,
|
||||
PageUp = 33,
|
||||
/// <summary>
|
||||
/// PAGE DOWN key.
|
||||
/// </summary>
|
||||
PageDown = 34,
|
||||
PageDown = 34,
|
||||
/// <summary>
|
||||
/// END key.
|
||||
/// </summary>
|
||||
End = 35,
|
||||
End = 35,
|
||||
/// <summary>
|
||||
/// HOME key.
|
||||
/// </summary>
|
||||
Home = 36,
|
||||
Home = 36,
|
||||
/// <summary>
|
||||
/// LEFT ARROW key.
|
||||
/// </summary>
|
||||
Left = 37,
|
||||
Left = 37,
|
||||
/// <summary>
|
||||
/// UP ARROW key.
|
||||
/// </summary>
|
||||
Up = 38,
|
||||
Up = 38,
|
||||
/// <summary>
|
||||
/// RIGHT ARROW key.
|
||||
/// </summary>
|
||||
Right = 39,
|
||||
Right = 39,
|
||||
/// <summary>
|
||||
/// DOWN ARROW key.
|
||||
/// </summary>
|
||||
Down = 40,
|
||||
Down = 40,
|
||||
/// <summary>
|
||||
/// SELECT key.
|
||||
/// </summary>
|
||||
Select = 41,
|
||||
Select = 41,
|
||||
/// <summary>
|
||||
/// PRINT key.
|
||||
/// </summary>
|
||||
Print = 42,
|
||||
Print = 42,
|
||||
/// <summary>
|
||||
/// EXECUTE key.
|
||||
/// </summary>
|
||||
Execute = 43,
|
||||
Execute = 43,
|
||||
/// <summary>
|
||||
/// PRINT SCREEN key.
|
||||
/// </summary>
|
||||
PrintScreen = 44,
|
||||
PrintScreen = 44,
|
||||
/// <summary>
|
||||
/// INS key.
|
||||
/// </summary>
|
||||
Insert = 45,
|
||||
Insert = 45,
|
||||
/// <summary>
|
||||
/// DEL key.
|
||||
/// </summary>
|
||||
Delete = 46,
|
||||
Delete = 46,
|
||||
/// <summary>
|
||||
/// HELP key.
|
||||
/// </summary>
|
||||
Help = 47,
|
||||
Help = 47,
|
||||
/// <summary>
|
||||
/// Used for miscellaneous characters; it can vary by keyboard.
|
||||
/// </summary>
|
||||
D0 = 48,
|
||||
D0 = 48,
|
||||
/// <summary>
|
||||
/// Used for miscellaneous characters; it can vary by keyboard.
|
||||
/// </summary>
|
||||
D1 = 49,
|
||||
D1 = 49,
|
||||
/// <summary>
|
||||
/// Used for miscellaneous characters; it can vary by keyboard.
|
||||
/// </summary>
|
||||
D2 = 50,
|
||||
D2 = 50,
|
||||
/// <summary>
|
||||
/// Used for miscellaneous characters; it can vary by keyboard.
|
||||
/// </summary>
|
||||
D3 = 51,
|
||||
D3 = 51,
|
||||
/// <summary>
|
||||
/// Used for miscellaneous characters; it can vary by keyboard.
|
||||
/// </summary>
|
||||
D4 = 52,
|
||||
D4 = 52,
|
||||
/// <summary>
|
||||
/// Used for miscellaneous characters; it can vary by keyboard.
|
||||
/// </summary>
|
||||
D5 = 53,
|
||||
D5 = 53,
|
||||
/// <summary>
|
||||
/// Used for miscellaneous characters; it can vary by keyboard.
|
||||
/// </summary>
|
||||
D6 = 54,
|
||||
D6 = 54,
|
||||
/// <summary>
|
||||
/// Used for miscellaneous characters; it can vary by keyboard.
|
||||
/// </summary>
|
||||
D7 = 55,
|
||||
D7 = 55,
|
||||
/// <summary>
|
||||
/// Used for miscellaneous characters; it can vary by keyboard.
|
||||
/// </summary>
|
||||
D8 = 56,
|
||||
D8 = 56,
|
||||
/// <summary>
|
||||
/// Used for miscellaneous characters; it can vary by keyboard.
|
||||
/// </summary>
|
||||
D9 = 57,
|
||||
D9 = 57,
|
||||
/// <summary>
|
||||
/// A key.
|
||||
/// </summary>
|
||||
A = 65,
|
||||
A = 65,
|
||||
/// <summary>
|
||||
/// B key.
|
||||
/// </summary>
|
||||
B = 66,
|
||||
B = 66,
|
||||
/// <summary>
|
||||
/// C key.
|
||||
/// </summary>
|
||||
C = 67,
|
||||
C = 67,
|
||||
/// <summary>
|
||||
/// D key.
|
||||
/// </summary>
|
||||
D = 68,
|
||||
D = 68,
|
||||
/// <summary>
|
||||
/// E key.
|
||||
/// </summary>
|
||||
E = 69,
|
||||
E = 69,
|
||||
/// <summary>
|
||||
/// F key.
|
||||
/// </summary>
|
||||
F = 70,
|
||||
F = 70,
|
||||
/// <summary>
|
||||
/// G key.
|
||||
/// </summary>
|
||||
G = 71,
|
||||
G = 71,
|
||||
/// <summary>
|
||||
/// H key.
|
||||
/// </summary>
|
||||
H = 72,
|
||||
H = 72,
|
||||
/// <summary>
|
||||
/// I key.
|
||||
/// </summary>
|
||||
I = 73,
|
||||
I = 73,
|
||||
/// <summary>
|
||||
/// J key.
|
||||
/// </summary>
|
||||
J = 74,
|
||||
J = 74,
|
||||
/// <summary>
|
||||
/// K key.
|
||||
/// </summary>
|
||||
K = 75,
|
||||
K = 75,
|
||||
/// <summary>
|
||||
/// L key.
|
||||
/// </summary>
|
||||
L = 76,
|
||||
L = 76,
|
||||
/// <summary>
|
||||
/// M key.
|
||||
/// </summary>
|
||||
M = 77,
|
||||
M = 77,
|
||||
/// <summary>
|
||||
/// N key.
|
||||
/// </summary>
|
||||
N = 78,
|
||||
N = 78,
|
||||
/// <summary>
|
||||
/// O key.
|
||||
/// </summary>
|
||||
O = 79,
|
||||
O = 79,
|
||||
/// <summary>
|
||||
/// P key.
|
||||
/// </summary>
|
||||
P = 80,
|
||||
P = 80,
|
||||
/// <summary>
|
||||
/// Q key.
|
||||
/// </summary>
|
||||
Q = 81,
|
||||
Q = 81,
|
||||
/// <summary>
|
||||
/// R key.
|
||||
/// </summary>
|
||||
R = 82,
|
||||
R = 82,
|
||||
/// <summary>
|
||||
/// S key.
|
||||
/// </summary>
|
||||
S = 83,
|
||||
S = 83,
|
||||
/// <summary>
|
||||
/// T key.
|
||||
/// </summary>
|
||||
T = 84,
|
||||
T = 84,
|
||||
/// <summary>
|
||||
/// U key.
|
||||
/// </summary>
|
||||
U = 85,
|
||||
U = 85,
|
||||
/// <summary>
|
||||
/// V key.
|
||||
/// </summary>
|
||||
V = 86,
|
||||
V = 86,
|
||||
/// <summary>
|
||||
/// W key.
|
||||
/// </summary>
|
||||
W = 87,
|
||||
W = 87,
|
||||
/// <summary>
|
||||
/// X key.
|
||||
/// </summary>
|
||||
X = 88,
|
||||
X = 88,
|
||||
/// <summary>
|
||||
/// Y key.
|
||||
/// </summary>
|
||||
Y = 89,
|
||||
Y = 89,
|
||||
/// <summary>
|
||||
/// Z key.
|
||||
/// </summary>
|
||||
Z = 90,
|
||||
Z = 90,
|
||||
/// <summary>
|
||||
/// Left Windows key.
|
||||
/// </summary>
|
||||
LeftWindows = 91,
|
||||
LeftWindows = 91,
|
||||
/// <summary>
|
||||
/// Right Windows key.
|
||||
/// </summary>
|
||||
RightWindows = 92,
|
||||
RightWindows = 92,
|
||||
/// <summary>
|
||||
/// Applications key.
|
||||
/// </summary>
|
||||
Apps = 93,
|
||||
Apps = 93,
|
||||
/// <summary>
|
||||
/// Computer Sleep key.
|
||||
/// </summary>
|
||||
Sleep = 95,
|
||||
Sleep = 95,
|
||||
/// <summary>
|
||||
/// Numeric keypad 0 key.
|
||||
/// </summary>
|
||||
NumPad0 = 96,
|
||||
NumPad0 = 96,
|
||||
/// <summary>
|
||||
/// Numeric keypad 1 key.
|
||||
/// </summary>
|
||||
NumPad1 = 97,
|
||||
NumPad1 = 97,
|
||||
/// <summary>
|
||||
/// Numeric keypad 2 key.
|
||||
/// </summary>
|
||||
NumPad2 = 98,
|
||||
NumPad2 = 98,
|
||||
/// <summary>
|
||||
/// Numeric keypad 3 key.
|
||||
/// </summary>
|
||||
NumPad3 = 99,
|
||||
NumPad3 = 99,
|
||||
/// <summary>
|
||||
/// Numeric keypad 4 key.
|
||||
/// </summary>
|
||||
NumPad4 = 100,
|
||||
NumPad4 = 100,
|
||||
/// <summary>
|
||||
/// Numeric keypad 5 key.
|
||||
/// </summary>
|
||||
NumPad5 = 101,
|
||||
NumPad5 = 101,
|
||||
/// <summary>
|
||||
/// Numeric keypad 6 key.
|
||||
/// </summary>
|
||||
NumPad6 = 102,
|
||||
NumPad6 = 102,
|
||||
/// <summary>
|
||||
/// Numeric keypad 7 key.
|
||||
/// </summary>
|
||||
NumPad7 = 103,
|
||||
NumPad7 = 103,
|
||||
/// <summary>
|
||||
/// Numeric keypad 8 key.
|
||||
/// </summary>
|
||||
NumPad8 = 104,
|
||||
NumPad8 = 104,
|
||||
/// <summary>
|
||||
/// Numeric keypad 9 key.
|
||||
/// </summary>
|
||||
NumPad9 = 105,
|
||||
NumPad9 = 105,
|
||||
/// <summary>
|
||||
/// Multiply key.
|
||||
/// </summary>
|
||||
Multiply = 106,
|
||||
Multiply = 106,
|
||||
/// <summary>
|
||||
/// Add key.
|
||||
/// </summary>
|
||||
Add = 107,
|
||||
Add = 107,
|
||||
/// <summary>
|
||||
/// Separator key.
|
||||
/// </summary>
|
||||
Separator = 108,
|
||||
Separator = 108,
|
||||
/// <summary>
|
||||
/// Subtract key.
|
||||
/// </summary>
|
||||
Subtract = 109,
|
||||
Subtract = 109,
|
||||
/// <summary>
|
||||
/// Decimal key.
|
||||
/// </summary>
|
||||
Decimal = 110,
|
||||
Decimal = 110,
|
||||
/// <summary>
|
||||
/// Divide key.
|
||||
/// </summary>
|
||||
Divide = 111,
|
||||
Divide = 111,
|
||||
/// <summary>
|
||||
/// F1 key.
|
||||
/// </summary>
|
||||
F1 = 112,
|
||||
F1 = 112,
|
||||
/// <summary>
|
||||
/// F2 key.
|
||||
/// </summary>
|
||||
F2 = 113,
|
||||
F2 = 113,
|
||||
/// <summary>
|
||||
/// F3 key.
|
||||
/// </summary>
|
||||
F3 = 114,
|
||||
F3 = 114,
|
||||
/// <summary>
|
||||
/// F4 key.
|
||||
/// </summary>
|
||||
F4 = 115,
|
||||
F4 = 115,
|
||||
/// <summary>
|
||||
/// F5 key.
|
||||
/// </summary>
|
||||
F5 = 116,
|
||||
F5 = 116,
|
||||
/// <summary>
|
||||
/// F6 key.
|
||||
/// </summary>
|
||||
F6 = 117,
|
||||
F6 = 117,
|
||||
/// <summary>
|
||||
/// F7 key.
|
||||
/// </summary>
|
||||
F7 = 118,
|
||||
F7 = 118,
|
||||
/// <summary>
|
||||
/// F8 key.
|
||||
/// </summary>
|
||||
F8 = 119,
|
||||
F8 = 119,
|
||||
/// <summary>
|
||||
/// F9 key.
|
||||
/// </summary>
|
||||
F9 = 120,
|
||||
F9 = 120,
|
||||
/// <summary>
|
||||
/// F10 key.
|
||||
/// </summary>
|
||||
F10 = 121,
|
||||
F10 = 121,
|
||||
/// <summary>
|
||||
/// F11 key.
|
||||
/// </summary>
|
||||
F11 = 122,
|
||||
F11 = 122,
|
||||
/// <summary>
|
||||
/// F12 key.
|
||||
/// </summary>
|
||||
F12 = 123,
|
||||
F12 = 123,
|
||||
/// <summary>
|
||||
/// F13 key.
|
||||
/// </summary>
|
||||
F13 = 124,
|
||||
F13 = 124,
|
||||
/// <summary>
|
||||
/// F14 key.
|
||||
/// </summary>
|
||||
F14 = 125,
|
||||
F14 = 125,
|
||||
/// <summary>
|
||||
/// F15 key.
|
||||
/// </summary>
|
||||
F15 = 126,
|
||||
F15 = 126,
|
||||
/// <summary>
|
||||
/// F16 key.
|
||||
/// </summary>
|
||||
F16 = 127,
|
||||
F16 = 127,
|
||||
/// <summary>
|
||||
/// F17 key.
|
||||
/// </summary>
|
||||
F17 = 128,
|
||||
F17 = 128,
|
||||
/// <summary>
|
||||
/// F18 key.
|
||||
/// </summary>
|
||||
F18 = 129,
|
||||
F18 = 129,
|
||||
/// <summary>
|
||||
/// F19 key.
|
||||
/// </summary>
|
||||
F19 = 130,
|
||||
F19 = 130,
|
||||
/// <summary>
|
||||
/// F20 key.
|
||||
/// </summary>
|
||||
F20 = 131,
|
||||
F20 = 131,
|
||||
/// <summary>
|
||||
/// F21 key.
|
||||
/// </summary>
|
||||
F21 = 132,
|
||||
F21 = 132,
|
||||
/// <summary>
|
||||
/// F22 key.
|
||||
/// </summary>
|
||||
F22 = 133,
|
||||
F22 = 133,
|
||||
/// <summary>
|
||||
/// F23 key.
|
||||
/// </summary>
|
||||
F23 = 134,
|
||||
F23 = 134,
|
||||
/// <summary>
|
||||
/// F24 key.
|
||||
/// </summary>
|
||||
F24 = 135,
|
||||
F24 = 135,
|
||||
/// <summary>
|
||||
/// NUM LOCK key.
|
||||
/// </summary>
|
||||
NumLock = 144,
|
||||
NumLock = 144,
|
||||
/// <summary>
|
||||
/// SCROLL LOCK key.
|
||||
/// </summary>
|
||||
Scroll = 145,
|
||||
Scroll = 145,
|
||||
/// <summary>
|
||||
/// Left SHIFT key.
|
||||
/// </summary>
|
||||
LeftShift = 160,
|
||||
LeftShift = 160,
|
||||
/// <summary>
|
||||
/// Right SHIFT key.
|
||||
/// </summary>
|
||||
RightShift = 161,
|
||||
RightShift = 161,
|
||||
/// <summary>
|
||||
/// Left CONTROL key.
|
||||
/// </summary>
|
||||
LeftControl = 162,
|
||||
LeftControl = 162,
|
||||
/// <summary>
|
||||
/// Right CONTROL key.
|
||||
/// </summary>
|
||||
RightControl = 163,
|
||||
RightControl = 163,
|
||||
/// <summary>
|
||||
/// Left ALT key.
|
||||
/// </summary>
|
||||
LeftAlt = 164,
|
||||
LeftAlt = 164,
|
||||
/// <summary>
|
||||
/// Right ALT key.
|
||||
/// </summary>
|
||||
RightAlt = 165,
|
||||
RightAlt = 165,
|
||||
/// <summary>
|
||||
/// Browser Back key.
|
||||
/// </summary>
|
||||
BrowserBack = 166,
|
||||
BrowserBack = 166,
|
||||
/// <summary>
|
||||
/// Browser Forward key.
|
||||
/// </summary>
|
||||
BrowserForward = 167,
|
||||
BrowserForward = 167,
|
||||
/// <summary>
|
||||
/// Browser Refresh key.
|
||||
/// </summary>
|
||||
BrowserRefresh = 168,
|
||||
BrowserRefresh = 168,
|
||||
/// <summary>
|
||||
/// Browser Stop key.
|
||||
/// </summary>
|
||||
BrowserStop = 169,
|
||||
BrowserStop = 169,
|
||||
/// <summary>
|
||||
/// Browser Search key.
|
||||
/// </summary>
|
||||
BrowserSearch = 170,
|
||||
BrowserSearch = 170,
|
||||
/// <summary>
|
||||
/// Browser Favorites key.
|
||||
/// </summary>
|
||||
BrowserFavorites = 171,
|
||||
BrowserFavorites = 171,
|
||||
/// <summary>
|
||||
/// Browser Start and Home key.
|
||||
/// </summary>
|
||||
BrowserHome = 172,
|
||||
/// <summary>
|
||||
BrowserHome = 172,
|
||||
/// <summary>
|
||||
/// Volume Mute key.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
VolumeMute = 173,
|
||||
/// <summary>
|
||||
/// Volume Down key.
|
||||
/// </summary>
|
||||
VolumeDown = 174,
|
||||
VolumeDown = 174,
|
||||
/// <summary>
|
||||
/// Volume Up key.
|
||||
/// </summary>
|
||||
VolumeUp = 175,
|
||||
VolumeUp = 175,
|
||||
/// <summary>
|
||||
/// Next Track key.
|
||||
/// </summary>
|
||||
MediaNextTrack = 176,
|
||||
MediaNextTrack = 176,
|
||||
/// <summary>
|
||||
/// Previous Track key.
|
||||
/// </summary>
|
||||
MediaPreviousTrack = 177,
|
||||
MediaPreviousTrack = 177,
|
||||
/// <summary>
|
||||
/// Stop Media key.
|
||||
/// </summary>
|
||||
MediaStop = 178,
|
||||
MediaStop = 178,
|
||||
/// <summary>
|
||||
/// Play/Pause Media key.
|
||||
/// </summary>
|
||||
MediaPlayPause = 179,
|
||||
MediaPlayPause = 179,
|
||||
/// <summary>
|
||||
/// Start Mail key.
|
||||
/// </summary>
|
||||
LaunchMail = 180,
|
||||
LaunchMail = 180,
|
||||
/// <summary>
|
||||
/// Select Media key.
|
||||
/// </summary>
|
||||
SelectMedia = 181,
|
||||
SelectMedia = 181,
|
||||
/// <summary>
|
||||
/// Start Application 1 key.
|
||||
/// </summary>
|
||||
LaunchApplication1 = 182,
|
||||
LaunchApplication1 = 182,
|
||||
/// <summary>
|
||||
/// Start Application 2 key.
|
||||
/// </summary>
|
||||
LaunchApplication2 = 183,
|
||||
LaunchApplication2 = 183,
|
||||
/// <summary>
|
||||
/// The OEM Semicolon key on a US standard keyboard.
|
||||
/// </summary>
|
||||
OemSemicolon = 186,
|
||||
OemSemicolon = 186,
|
||||
/// <summary>
|
||||
/// For any country/region, the '+' key.
|
||||
/// </summary>
|
||||
OemPlus = 187,
|
||||
OemPlus = 187,
|
||||
/// <summary>
|
||||
/// For any country/region, the ',' key.
|
||||
/// </summary>
|
||||
OemComma = 188,
|
||||
OemComma = 188,
|
||||
/// <summary>
|
||||
/// For any country/region, the '-' key.
|
||||
/// </summary>
|
||||
OemMinus = 189,
|
||||
OemMinus = 189,
|
||||
/// <summary>
|
||||
/// For any country/region, the '.' key.
|
||||
/// </summary>
|
||||
OemPeriod = 190,
|
||||
OemPeriod = 190,
|
||||
/// <summary>
|
||||
/// The OEM question mark key on a US standard keyboard.
|
||||
/// </summary>
|
||||
OemQuestion = 191,
|
||||
OemQuestion = 191,
|
||||
/// <summary>
|
||||
/// The OEM tilde key on a US standard keyboard.
|
||||
/// </summary>
|
||||
OemTilde = 192,
|
||||
OemTilde = 192,
|
||||
/// <summary>
|
||||
/// The OEM open bracket key on a US standard keyboard.
|
||||
/// </summary>
|
||||
OemOpenBrackets = 219,
|
||||
OemOpenBrackets = 219,
|
||||
/// <summary>
|
||||
/// The OEM pipe key on a US standard keyboard.
|
||||
/// </summary>
|
||||
OemPipe = 220,
|
||||
OemPipe = 220,
|
||||
/// <summary>
|
||||
/// The OEM close bracket key on a US standard keyboard.
|
||||
/// </summary>
|
||||
OemCloseBrackets = 221,
|
||||
OemCloseBrackets = 221,
|
||||
/// <summary>
|
||||
/// The OEM singled/double quote key on a US standard keyboard.
|
||||
/// </summary>
|
||||
OemQuotes = 222,
|
||||
OemQuotes = 222,
|
||||
/// <summary>
|
||||
/// Used for miscellaneous characters; it can vary by keyboard.
|
||||
/// </summary>
|
||||
Oem8 = 223,
|
||||
Oem8 = 223,
|
||||
/// <summary>
|
||||
/// The OEM angle bracket or backslash key on the RT 102 key keyboard.
|
||||
/// </summary>
|
||||
OemBackslash = 226,
|
||||
OemBackslash = 226,
|
||||
/// <summary>
|
||||
/// IME PROCESS key.
|
||||
/// </summary>
|
||||
ProcessKey = 229,
|
||||
ProcessKey = 229,
|
||||
/// <summary>
|
||||
/// Attn key.
|
||||
/// </summary>
|
||||
Attn = 246,
|
||||
Attn = 246,
|
||||
/// <summary>
|
||||
/// CrSel key.
|
||||
/// </summary>
|
||||
Crsel = 247,
|
||||
Crsel = 247,
|
||||
/// <summary>
|
||||
/// ExSel key.
|
||||
/// </summary>
|
||||
Exsel = 248,
|
||||
Exsel = 248,
|
||||
/// <summary>
|
||||
/// Erase EOF key.
|
||||
/// </summary>
|
||||
EraseEof = 249,
|
||||
EraseEof = 249,
|
||||
/// <summary>
|
||||
/// Play key.
|
||||
/// </summary>
|
||||
Play = 250,
|
||||
Play = 250,
|
||||
/// <summary>
|
||||
/// Zoom key.
|
||||
/// </summary>
|
||||
Zoom = 251,
|
||||
Zoom = 251,
|
||||
/// <summary>
|
||||
/// PA1 key.
|
||||
/// </summary>
|
||||
Pa1 = 253,
|
||||
Pa1 = 253,
|
||||
/// <summary>
|
||||
/// CLEAR key.
|
||||
/// </summary>
|
||||
OemClear = 254,
|
||||
OemClear = 254,
|
||||
/// <summary>
|
||||
/// Green ChatPad key.
|
||||
/// </summary>
|
||||
ChatPadGreen = 0xCA,
|
||||
ChatPadGreen = 0xCA,
|
||||
/// <summary>
|
||||
/// Orange ChatPad key.
|
||||
/// </summary>
|
||||
ChatPadOrange = 0xCB,
|
||||
ChatPadOrange = 0xCB,
|
||||
/// <summary>
|
||||
/// PAUSE key.
|
||||
/// </summary>
|
||||
Pause = 0x13,
|
||||
Pause = 0x13,
|
||||
/// <summary>
|
||||
/// IME Convert key.
|
||||
/// </summary>
|
||||
ImeConvert = 0x1c,
|
||||
ImeConvert = 0x1c,
|
||||
/// <summary>
|
||||
/// IME NoConvert key.
|
||||
/// </summary>
|
||||
ImeNoConvert = 0x1d,
|
||||
ImeNoConvert = 0x1d,
|
||||
/// <summary>
|
||||
/// Kana key on Japanese keyboards.
|
||||
/// </summary>
|
||||
Kana = 0x15,
|
||||
Kana = 0x15,
|
||||
/// <summary>
|
||||
/// Kanji key on Japanese keyboards.
|
||||
/// </summary>
|
||||
Kanji = 0x19,
|
||||
Kanji = 0x19,
|
||||
/// <summary>
|
||||
/// OEM Auto key.
|
||||
/// </summary>
|
||||
OemAuto = 0xf3,
|
||||
OemAuto = 0xf3,
|
||||
/// <summary>
|
||||
/// OEM Copy key.
|
||||
/// </summary>
|
||||
OemCopy = 0xf2,
|
||||
OemCopy = 0xf2,
|
||||
/// <summary>
|
||||
/// OEM Enlarge Window key.
|
||||
/// </summary>
|
||||
OemEnlW = 0xf4
|
||||
}
|
||||
OemEnlW = 0xf4
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace Microsoft.Xna.Framework
|
||||
/// </summary>
|
||||
/// <param name="a"><see cref="Point"/> instance on the left of the not equal sign.</param>
|
||||
/// <param name="b"><see cref="Point"/> instance on the right of the not equal sign.</param>
|
||||
/// <returns><c>true</c> if the instances are not equal; <c>false</c> otherwise.</returns>
|
||||
/// <returns><c>true</c> if the instances are not equal; <c>false</c> otherwise.</returns>
|
||||
public static bool operator !=(Point a, Point b)
|
||||
{
|
||||
return !a.Equals(b);
|
||||
|
||||
@@ -138,12 +138,12 @@ namespace Microsoft.Xna.Framework
|
||||
/// <returns>The result of the quaternion addition.</returns>
|
||||
public static Quaternion Add(Quaternion quaternion1, Quaternion quaternion2)
|
||||
{
|
||||
Quaternion quaternion;
|
||||
quaternion.X = quaternion1.X + quaternion2.X;
|
||||
quaternion.Y = quaternion1.Y + quaternion2.Y;
|
||||
quaternion.Z = quaternion1.Z + quaternion2.Z;
|
||||
quaternion.W = quaternion1.W + quaternion2.W;
|
||||
return quaternion;
|
||||
Quaternion quaternion;
|
||||
quaternion.X = quaternion1.X + quaternion2.X;
|
||||
quaternion.Y = quaternion1.Y + quaternion2.Y;
|
||||
quaternion.Z = quaternion1.Z + quaternion2.Z;
|
||||
quaternion.W = quaternion1.W + quaternion2.W;
|
||||
return quaternion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -154,10 +154,10 @@ namespace Microsoft.Xna.Framework
|
||||
/// <param name="result">The result of the quaternion addition as an output parameter.</param>
|
||||
public static void Add(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result)
|
||||
{
|
||||
result.X = quaternion1.X + quaternion2.X;
|
||||
result.Y = quaternion1.Y + quaternion2.Y;
|
||||
result.Z = quaternion1.Z + quaternion2.Z;
|
||||
result.W = quaternion1.W + quaternion2.W;
|
||||
result.X = quaternion1.X + quaternion2.X;
|
||||
result.Y = quaternion1.Y + quaternion2.Y;
|
||||
result.Z = quaternion1.Z + quaternion2.Z;
|
||||
result.W = quaternion1.W + quaternion2.W;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -171,8 +171,8 @@ namespace Microsoft.Xna.Framework
|
||||
/// <param name="value2">The second <see cref="Quaternion"/> to concatenate.</param>
|
||||
/// <returns>The result of rotation of <paramref name="value1"/> followed by <paramref name="value2"/> rotation.</returns>
|
||||
public static Quaternion Concatenate(Quaternion value1, Quaternion value2)
|
||||
{
|
||||
Quaternion quaternion;
|
||||
{
|
||||
Quaternion quaternion;
|
||||
|
||||
float x1 = value1.X;
|
||||
float y1 = value1.Y;
|
||||
@@ -180,17 +180,17 @@ namespace Microsoft.Xna.Framework
|
||||
float w1 = value1.W;
|
||||
|
||||
float x2 = value2.X;
|
||||
float y2 = value2.Y;
|
||||
float z2 = value2.Z;
|
||||
float w2 = value2.W;
|
||||
float y2 = value2.Y;
|
||||
float z2 = value2.Z;
|
||||
float w2 = value2.W;
|
||||
|
||||
quaternion.X = ((x2 * w1) + (x1 * w2)) + ((y2 * z1) - (z2 * y1));
|
||||
quaternion.Y = ((y2 * w1) + (y1 * w2)) + ((z2 * x1) - (x2 * z1));
|
||||
quaternion.Z = ((z2 * w1) + (z1 * w2)) + ((x2 * y1) - (y2 * x1));
|
||||
quaternion.W = (w2 * w1) - (((x2 * x1) + (y2 * y1)) + (z2 * z1));
|
||||
quaternion.X = ((x2 * w1) + (x1 * w2)) + ((y2 * z1) - (z2 * y1));
|
||||
quaternion.Y = ((y2 * w1) + (y1 * w2)) + ((z2 * x1) - (x2 * z1));
|
||||
quaternion.Z = ((z2 * w1) + (z1 * w2)) + ((x2 * y1) - (y2 * x1));
|
||||
quaternion.W = (w2 * w1) - (((x2 * x1) + (y2 * y1)) + (z2 * z1));
|
||||
|
||||
return quaternion;
|
||||
}
|
||||
return quaternion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Quaternion"/> that contains concatenation between two quaternion.
|
||||
@@ -199,7 +199,7 @@ namespace Microsoft.Xna.Framework
|
||||
/// <param name="value2">The second <see cref="Quaternion"/> to concatenate.</param>
|
||||
/// <param name="result">The result of rotation of <paramref name="value1"/> followed by <paramref name="value2"/> rotation as an output parameter.</param>
|
||||
public static void Concatenate(ref Quaternion value1, ref Quaternion value2, out Quaternion result)
|
||||
{
|
||||
{
|
||||
float x1 = value1.X;
|
||||
float y1 = value1.Y;
|
||||
float z1 = value1.Z;
|
||||
@@ -224,11 +224,11 @@ namespace Microsoft.Xna.Framework
|
||||
/// Transforms this quaternion into its conjugated version.
|
||||
/// </summary>
|
||||
public void Conjugate()
|
||||
{
|
||||
X = -X;
|
||||
Y = -Y;
|
||||
Z = -Z;
|
||||
}
|
||||
{
|
||||
X = -X;
|
||||
Y = -Y;
|
||||
Z = -Z;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Quaternion"/> that contains conjugated version of the specified quaternion.
|
||||
@@ -236,9 +236,9 @@ namespace Microsoft.Xna.Framework
|
||||
/// <param name="value">The quaternion which values will be used to create the conjugated version.</param>
|
||||
/// <returns>The conjugate version of the specified quaternion.</returns>
|
||||
public static Quaternion Conjugate(Quaternion value)
|
||||
{
|
||||
return new Quaternion(-value.X,-value.Y,-value.Z,value.W);
|
||||
}
|
||||
{
|
||||
return new Quaternion(-value.X,-value.Y,-value.Z,value.W);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Quaternion"/> that contains conjugated version of the specified quaternion.
|
||||
@@ -246,12 +246,12 @@ namespace Microsoft.Xna.Framework
|
||||
/// <param name="value">The quaternion which values will be used to create the conjugated version.</param>
|
||||
/// <param name="result">The conjugated version of the specified quaternion as an output parameter.</param>
|
||||
public static void Conjugate(ref Quaternion value, out Quaternion result)
|
||||
{
|
||||
result.X = -value.X;
|
||||
result.Y = -value.Y;
|
||||
result.Z = -value.Z;
|
||||
result.W = value.W;
|
||||
}
|
||||
{
|
||||
result.X = -value.X;
|
||||
result.Y = -value.Y;
|
||||
result.Z = -value.Z;
|
||||
result.W = value.W;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -265,10 +265,10 @@ namespace Microsoft.Xna.Framework
|
||||
/// <returns>The new quaternion builded from axis and angle.</returns>
|
||||
public static Quaternion CreateFromAxisAngle(Vector3 axis, float angle)
|
||||
{
|
||||
float half = angle * 0.5f;
|
||||
float sin = (float)Math.Sin(half);
|
||||
float cos = (float)Math.Cos(half);
|
||||
return new Quaternion(axis.X * sin, axis.Y * sin, axis.Z * sin, cos);
|
||||
float half = angle * 0.5f;
|
||||
float sin = (float)Math.Sin(half);
|
||||
float cos = (float)Math.Cos(half);
|
||||
return new Quaternion(axis.X * sin, axis.Y * sin, axis.Z * sin, cos);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -280,12 +280,12 @@ namespace Microsoft.Xna.Framework
|
||||
public static void CreateFromAxisAngle(ref Vector3 axis, float angle, out Quaternion result)
|
||||
{
|
||||
float half = angle * 0.5f;
|
||||
float sin = (float)Math.Sin(half);
|
||||
float cos = (float)Math.Cos(half);
|
||||
result.X = axis.X * sin;
|
||||
result.Y = axis.Y * sin;
|
||||
result.Z = axis.Z * sin;
|
||||
result.W = cos;
|
||||
float sin = (float)Math.Sin(half);
|
||||
float cos = (float)Math.Cos(half);
|
||||
result.X = axis.X * sin;
|
||||
result.Y = axis.Y * sin;
|
||||
result.Z = axis.Z * sin;
|
||||
result.W = cos;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -304,51 +304,51 @@ namespace Microsoft.Xna.Framework
|
||||
float half;
|
||||
float scale = matrix.M11 + matrix.M22 + matrix.M33;
|
||||
|
||||
if (scale > 0.0f)
|
||||
{
|
||||
if (scale > 0.0f)
|
||||
{
|
||||
sqrt = (float)Math.Sqrt(scale + 1.0f);
|
||||
quaternion.W = sqrt * 0.5f;
|
||||
quaternion.W = sqrt * 0.5f;
|
||||
sqrt = 0.5f / sqrt;
|
||||
|
||||
quaternion.X = (matrix.M23 - matrix.M32) * sqrt;
|
||||
quaternion.Y = (matrix.M31 - matrix.M13) * sqrt;
|
||||
quaternion.Z = (matrix.M12 - matrix.M21) * sqrt;
|
||||
quaternion.X = (matrix.M23 - matrix.M32) * sqrt;
|
||||
quaternion.Y = (matrix.M31 - matrix.M13) * sqrt;
|
||||
quaternion.Z = (matrix.M12 - matrix.M21) * sqrt;
|
||||
|
||||
return quaternion;
|
||||
}
|
||||
if ((matrix.M11 >= matrix.M22) && (matrix.M11 >= matrix.M33))
|
||||
{
|
||||
return quaternion;
|
||||
}
|
||||
if ((matrix.M11 >= matrix.M22) && (matrix.M11 >= matrix.M33))
|
||||
{
|
||||
sqrt = (float) Math.Sqrt(1.0f + matrix.M11 - matrix.M22 - matrix.M33);
|
||||
half = 0.5f / sqrt;
|
||||
|
||||
quaternion.X = 0.5f * sqrt;
|
||||
quaternion.Y = (matrix.M12 + matrix.M21) * half;
|
||||
quaternion.Z = (matrix.M13 + matrix.M31) * half;
|
||||
quaternion.W = (matrix.M23 - matrix.M32) * half;
|
||||
quaternion.X = 0.5f * sqrt;
|
||||
quaternion.Y = (matrix.M12 + matrix.M21) * half;
|
||||
quaternion.Z = (matrix.M13 + matrix.M31) * half;
|
||||
quaternion.W = (matrix.M23 - matrix.M32) * half;
|
||||
|
||||
return quaternion;
|
||||
}
|
||||
if (matrix.M22 > matrix.M33)
|
||||
{
|
||||
return quaternion;
|
||||
}
|
||||
if (matrix.M22 > matrix.M33)
|
||||
{
|
||||
sqrt = (float) Math.Sqrt(1.0f + matrix.M22 - matrix.M11 - matrix.M33);
|
||||
half = 0.5f / sqrt;
|
||||
|
||||
quaternion.X = (matrix.M21 + matrix.M12) * half;
|
||||
quaternion.Y = 0.5f * sqrt;
|
||||
quaternion.Z = (matrix.M32 + matrix.M23) * half;
|
||||
quaternion.W = (matrix.M31 - matrix.M13) * half;
|
||||
quaternion.X = (matrix.M21 + matrix.M12) * half;
|
||||
quaternion.Y = 0.5f * sqrt;
|
||||
quaternion.Z = (matrix.M32 + matrix.M23) * half;
|
||||
quaternion.W = (matrix.M31 - matrix.M13) * half;
|
||||
|
||||
return quaternion;
|
||||
}
|
||||
return quaternion;
|
||||
}
|
||||
sqrt = (float) Math.Sqrt(1.0f + matrix.M33 - matrix.M11 - matrix.M22);
|
||||
half = 0.5f / sqrt;
|
||||
half = 0.5f / sqrt;
|
||||
|
||||
quaternion.X = (matrix.M31 + matrix.M13) * half;
|
||||
quaternion.Y = (matrix.M32 + matrix.M23) * half;
|
||||
quaternion.Z = 0.5f * sqrt;
|
||||
quaternion.W = (matrix.M12 - matrix.M21) * half;
|
||||
|
||||
return quaternion;
|
||||
quaternion.X = (matrix.M31 + matrix.M13) * half;
|
||||
quaternion.Y = (matrix.M32 + matrix.M23) * half;
|
||||
quaternion.Z = 0.5f * sqrt;
|
||||
quaternion.W = (matrix.M12 - matrix.M21) * half;
|
||||
|
||||
return quaternion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -417,7 +417,7 @@ namespace Microsoft.Xna.Framework
|
||||
/// <param name="roll">Roll around the z axis in radians.</param>
|
||||
/// <returns>A new quaternion from the concatenated yaw, pitch, and roll angles.</returns>
|
||||
public static Quaternion CreateFromYawPitchRoll(float yaw, float pitch, float roll)
|
||||
{
|
||||
{
|
||||
float halfRoll = roll * 0.5f;
|
||||
float halfPitch = pitch * 0.5f;
|
||||
float halfYaw = yaw * 0.5f;
|
||||
@@ -442,8 +442,8 @@ namespace Microsoft.Xna.Framework
|
||||
/// <param name="pitch">Pitch around the x axis in radians.</param>
|
||||
/// <param name="roll">Roll around the z axis in radians.</param>
|
||||
/// <param name="result">A new quaternion from the concatenated yaw, pitch, and roll angles as an output parameter.</param>
|
||||
public static void CreateFromYawPitchRoll(float yaw, float pitch, float roll, out Quaternion result)
|
||||
{
|
||||
public static void CreateFromYawPitchRoll(float yaw, float pitch, float roll, out Quaternion result)
|
||||
{
|
||||
float halfRoll = roll * 0.5f;
|
||||
float halfPitch = pitch * 0.5f;
|
||||
float halfYaw = yaw * 0.5f;
|
||||
@@ -474,25 +474,25 @@ namespace Microsoft.Xna.Framework
|
||||
public static Quaternion Divide(Quaternion quaternion1, Quaternion quaternion2)
|
||||
{
|
||||
Quaternion quaternion;
|
||||
float x = quaternion1.X;
|
||||
float y = quaternion1.Y;
|
||||
float z = quaternion1.Z;
|
||||
float w = quaternion1.W;
|
||||
float num14 = (((quaternion2.X * quaternion2.X) + (quaternion2.Y * quaternion2.Y)) + (quaternion2.Z * quaternion2.Z)) + (quaternion2.W * quaternion2.W);
|
||||
float num5 = 1f / num14;
|
||||
float num4 = -quaternion2.X * num5;
|
||||
float num3 = -quaternion2.Y * num5;
|
||||
float num2 = -quaternion2.Z * num5;
|
||||
float num = quaternion2.W * num5;
|
||||
float num13 = (y * num2) - (z * num3);
|
||||
float num12 = (z * num4) - (x * num2);
|
||||
float num11 = (x * num3) - (y * num4);
|
||||
float num10 = ((x * num4) + (y * num3)) + (z * num2);
|
||||
quaternion.X = ((x * num) + (num4 * w)) + num13;
|
||||
quaternion.Y = ((y * num) + (num3 * w)) + num12;
|
||||
quaternion.Z = ((z * num) + (num2 * w)) + num11;
|
||||
quaternion.W = (w * num) - num10;
|
||||
return quaternion;
|
||||
float x = quaternion1.X;
|
||||
float y = quaternion1.Y;
|
||||
float z = quaternion1.Z;
|
||||
float w = quaternion1.W;
|
||||
float num14 = (((quaternion2.X * quaternion2.X) + (quaternion2.Y * quaternion2.Y)) + (quaternion2.Z * quaternion2.Z)) + (quaternion2.W * quaternion2.W);
|
||||
float num5 = 1f / num14;
|
||||
float num4 = -quaternion2.X * num5;
|
||||
float num3 = -quaternion2.Y * num5;
|
||||
float num2 = -quaternion2.Z * num5;
|
||||
float num = quaternion2.W * num5;
|
||||
float num13 = (y * num2) - (z * num3);
|
||||
float num12 = (z * num4) - (x * num2);
|
||||
float num11 = (x * num3) - (y * num4);
|
||||
float num10 = ((x * num4) + (y * num3)) + (z * num2);
|
||||
quaternion.X = ((x * num) + (num4 * w)) + num13;
|
||||
quaternion.Y = ((y * num) + (num3 * w)) + num12;
|
||||
quaternion.Z = ((z * num) + (num2 * w)) + num11;
|
||||
quaternion.W = (w * num) - num10;
|
||||
return quaternion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -504,23 +504,23 @@ namespace Microsoft.Xna.Framework
|
||||
public static void Divide(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result)
|
||||
{
|
||||
float x = quaternion1.X;
|
||||
float y = quaternion1.Y;
|
||||
float z = quaternion1.Z;
|
||||
float w = quaternion1.W;
|
||||
float num14 = (((quaternion2.X * quaternion2.X) + (quaternion2.Y * quaternion2.Y)) + (quaternion2.Z * quaternion2.Z)) + (quaternion2.W * quaternion2.W);
|
||||
float num5 = 1f / num14;
|
||||
float num4 = -quaternion2.X * num5;
|
||||
float num3 = -quaternion2.Y * num5;
|
||||
float num2 = -quaternion2.Z * num5;
|
||||
float num = quaternion2.W * num5;
|
||||
float num13 = (y * num2) - (z * num3);
|
||||
float num12 = (z * num4) - (x * num2);
|
||||
float num11 = (x * num3) - (y * num4);
|
||||
float num10 = ((x * num4) + (y * num3)) + (z * num2);
|
||||
result.X = ((x * num) + (num4 * w)) + num13;
|
||||
result.Y = ((y * num) + (num3 * w)) + num12;
|
||||
result.Z = ((z * num) + (num2 * w)) + num11;
|
||||
result.W = (w * num) - num10;
|
||||
float y = quaternion1.Y;
|
||||
float z = quaternion1.Z;
|
||||
float w = quaternion1.W;
|
||||
float num14 = (((quaternion2.X * quaternion2.X) + (quaternion2.Y * quaternion2.Y)) + (quaternion2.Z * quaternion2.Z)) + (quaternion2.W * quaternion2.W);
|
||||
float num5 = 1f / num14;
|
||||
float num4 = -quaternion2.X * num5;
|
||||
float num3 = -quaternion2.Y * num5;
|
||||
float num2 = -quaternion2.Z * num5;
|
||||
float num = quaternion2.W * num5;
|
||||
float num13 = (y * num2) - (z * num3);
|
||||
float num12 = (z * num4) - (x * num2);
|
||||
float num11 = (x * num3) - (y * num4);
|
||||
float num10 = ((x * num4) + (y * num3)) + (z * num2);
|
||||
result.X = ((x * num) + (num4 * w)) + num13;
|
||||
result.Y = ((y * num) + (num3 * w)) + num12;
|
||||
result.Z = ((z * num) + (num2 * w)) + num11;
|
||||
result.W = (w * num) - num10;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -572,7 +572,7 @@ namespace Microsoft.Xna.Framework
|
||||
/// <returns><c>true</c> if the instances are equal; <c>false</c> otherwise.</returns>
|
||||
public bool Equals(Quaternion other)
|
||||
{
|
||||
return X == other.X &&
|
||||
return X == other.X &&
|
||||
Y == other.Y &&
|
||||
Z == other.Z &&
|
||||
W == other.W;
|
||||
@@ -599,13 +599,13 @@ namespace Microsoft.Xna.Framework
|
||||
public static Quaternion Inverse(Quaternion quaternion)
|
||||
{
|
||||
Quaternion quaternion2;
|
||||
float num2 = (((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y)) + (quaternion.Z * quaternion.Z)) + (quaternion.W * quaternion.W);
|
||||
float num = 1f / num2;
|
||||
quaternion2.X = -quaternion.X * num;
|
||||
quaternion2.Y = -quaternion.Y * num;
|
||||
quaternion2.Z = -quaternion.Z * num;
|
||||
quaternion2.W = quaternion.W * num;
|
||||
return quaternion2;
|
||||
float num2 = (((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y)) + (quaternion.Z * quaternion.Z)) + (quaternion.W * quaternion.W);
|
||||
float num = 1f / num2;
|
||||
quaternion2.X = -quaternion.X * num;
|
||||
quaternion2.Y = -quaternion.Y * num;
|
||||
quaternion2.Z = -quaternion.Z * num;
|
||||
quaternion2.W = quaternion.W * num;
|
||||
return quaternion2;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -616,11 +616,11 @@ namespace Microsoft.Xna.Framework
|
||||
public static void Inverse(ref Quaternion quaternion, out Quaternion result)
|
||||
{
|
||||
float num2 = (((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y)) + (quaternion.Z * quaternion.Z)) + (quaternion.W * quaternion.W);
|
||||
float num = 1f / num2;
|
||||
result.X = -quaternion.X * num;
|
||||
result.Y = -quaternion.Y * num;
|
||||
result.Z = -quaternion.Z * num;
|
||||
result.W = quaternion.W * num;
|
||||
float num = 1f / num2;
|
||||
result.X = -quaternion.X * num;
|
||||
result.Y = -quaternion.Y * num;
|
||||
result.Z = -quaternion.Z * num;
|
||||
result.W = quaternion.W * num;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -631,7 +631,7 @@ namespace Microsoft.Xna.Framework
|
||||
/// <returns>The magnitude of the quaternion components.</returns>
|
||||
public float Length()
|
||||
{
|
||||
return (float) Math.Sqrt((X * X) + (Y * Y) + (Z * Z) + (W * W));
|
||||
return (float) Math.Sqrt((X * X) + (Y * Y) + (Z * Z) + (W * W));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -655,30 +655,30 @@ namespace Microsoft.Xna.Framework
|
||||
public static Quaternion Lerp(Quaternion quaternion1, Quaternion quaternion2, float amount)
|
||||
{
|
||||
float num = amount;
|
||||
float num2 = 1f - num;
|
||||
Quaternion quaternion = new Quaternion();
|
||||
float num5 = (((quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y)) + (quaternion1.Z * quaternion2.Z)) + (quaternion1.W * quaternion2.W);
|
||||
if (num5 >= 0f)
|
||||
{
|
||||
quaternion.X = (num2 * quaternion1.X) + (num * quaternion2.X);
|
||||
quaternion.Y = (num2 * quaternion1.Y) + (num * quaternion2.Y);
|
||||
quaternion.Z = (num2 * quaternion1.Z) + (num * quaternion2.Z);
|
||||
quaternion.W = (num2 * quaternion1.W) + (num * quaternion2.W);
|
||||
}
|
||||
else
|
||||
{
|
||||
quaternion.X = (num2 * quaternion1.X) - (num * quaternion2.X);
|
||||
quaternion.Y = (num2 * quaternion1.Y) - (num * quaternion2.Y);
|
||||
quaternion.Z = (num2 * quaternion1.Z) - (num * quaternion2.Z);
|
||||
quaternion.W = (num2 * quaternion1.W) - (num * quaternion2.W);
|
||||
}
|
||||
float num4 = (((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y)) + (quaternion.Z * quaternion.Z)) + (quaternion.W * quaternion.W);
|
||||
float num3 = 1f / ((float) Math.Sqrt((double) num4));
|
||||
quaternion.X *= num3;
|
||||
quaternion.Y *= num3;
|
||||
quaternion.Z *= num3;
|
||||
quaternion.W *= num3;
|
||||
return quaternion;
|
||||
float num2 = 1f - num;
|
||||
Quaternion quaternion = new Quaternion();
|
||||
float num5 = (((quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y)) + (quaternion1.Z * quaternion2.Z)) + (quaternion1.W * quaternion2.W);
|
||||
if (num5 >= 0f)
|
||||
{
|
||||
quaternion.X = (num2 * quaternion1.X) + (num * quaternion2.X);
|
||||
quaternion.Y = (num2 * quaternion1.Y) + (num * quaternion2.Y);
|
||||
quaternion.Z = (num2 * quaternion1.Z) + (num * quaternion2.Z);
|
||||
quaternion.W = (num2 * quaternion1.W) + (num * quaternion2.W);
|
||||
}
|
||||
else
|
||||
{
|
||||
quaternion.X = (num2 * quaternion1.X) - (num * quaternion2.X);
|
||||
quaternion.Y = (num2 * quaternion1.Y) - (num * quaternion2.Y);
|
||||
quaternion.Z = (num2 * quaternion1.Z) - (num * quaternion2.Z);
|
||||
quaternion.W = (num2 * quaternion1.W) - (num * quaternion2.W);
|
||||
}
|
||||
float num4 = (((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y)) + (quaternion.Z * quaternion.Z)) + (quaternion.W * quaternion.W);
|
||||
float num3 = 1f / ((float) Math.Sqrt((double) num4));
|
||||
quaternion.X *= num3;
|
||||
quaternion.Y *= num3;
|
||||
quaternion.Z *= num3;
|
||||
quaternion.W *= num3;
|
||||
return quaternion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -691,28 +691,28 @@ namespace Microsoft.Xna.Framework
|
||||
public static void Lerp(ref Quaternion quaternion1, ref Quaternion quaternion2, float amount, out Quaternion result)
|
||||
{
|
||||
float num = amount;
|
||||
float num2 = 1f - num;
|
||||
float num5 = (((quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y)) + (quaternion1.Z * quaternion2.Z)) + (quaternion1.W * quaternion2.W);
|
||||
if (num5 >= 0f)
|
||||
{
|
||||
result.X = (num2 * quaternion1.X) + (num * quaternion2.X);
|
||||
result.Y = (num2 * quaternion1.Y) + (num * quaternion2.Y);
|
||||
result.Z = (num2 * quaternion1.Z) + (num * quaternion2.Z);
|
||||
result.W = (num2 * quaternion1.W) + (num * quaternion2.W);
|
||||
}
|
||||
else
|
||||
{
|
||||
result.X = (num2 * quaternion1.X) - (num * quaternion2.X);
|
||||
result.Y = (num2 * quaternion1.Y) - (num * quaternion2.Y);
|
||||
result.Z = (num2 * quaternion1.Z) - (num * quaternion2.Z);
|
||||
result.W = (num2 * quaternion1.W) - (num * quaternion2.W);
|
||||
}
|
||||
float num4 = (((result.X * result.X) + (result.Y * result.Y)) + (result.Z * result.Z)) + (result.W * result.W);
|
||||
float num3 = 1f / ((float) Math.Sqrt((double) num4));
|
||||
result.X *= num3;
|
||||
result.Y *= num3;
|
||||
result.Z *= num3;
|
||||
result.W *= num3;
|
||||
float num2 = 1f - num;
|
||||
float num5 = (((quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y)) + (quaternion1.Z * quaternion2.Z)) + (quaternion1.W * quaternion2.W);
|
||||
if (num5 >= 0f)
|
||||
{
|
||||
result.X = (num2 * quaternion1.X) + (num * quaternion2.X);
|
||||
result.Y = (num2 * quaternion1.Y) + (num * quaternion2.Y);
|
||||
result.Z = (num2 * quaternion1.Z) + (num * quaternion2.Z);
|
||||
result.W = (num2 * quaternion1.W) + (num * quaternion2.W);
|
||||
}
|
||||
else
|
||||
{
|
||||
result.X = (num2 * quaternion1.X) - (num * quaternion2.X);
|
||||
result.Y = (num2 * quaternion1.Y) - (num * quaternion2.Y);
|
||||
result.Z = (num2 * quaternion1.Z) - (num * quaternion2.Z);
|
||||
result.W = (num2 * quaternion1.W) - (num * quaternion2.W);
|
||||
}
|
||||
float num4 = (((result.X * result.X) + (result.Y * result.Y)) + (result.Z * result.Z)) + (result.W * result.W);
|
||||
float num3 = 1f / ((float) Math.Sqrt((double) num4));
|
||||
result.X *= num3;
|
||||
result.Y *= num3;
|
||||
result.Z *= num3;
|
||||
result.W *= num3;
|
||||
|
||||
}
|
||||
|
||||
@@ -730,33 +730,33 @@ namespace Microsoft.Xna.Framework
|
||||
public static Quaternion Slerp(Quaternion quaternion1, Quaternion quaternion2, float amount)
|
||||
{
|
||||
float num2;
|
||||
float num3;
|
||||
Quaternion quaternion;
|
||||
float num = amount;
|
||||
float num4 = (((quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y)) + (quaternion1.Z * quaternion2.Z)) + (quaternion1.W * quaternion2.W);
|
||||
bool flag = false;
|
||||
if (num4 < 0f)
|
||||
{
|
||||
flag = true;
|
||||
num4 = -num4;
|
||||
}
|
||||
if (num4 > 0.999999f)
|
||||
{
|
||||
num3 = 1f - num;
|
||||
num2 = flag ? -num : num;
|
||||
}
|
||||
else
|
||||
{
|
||||
float num5 = (float) Math.Acos((double) num4);
|
||||
float num6 = (float) (1.0 / Math.Sin((double) num5));
|
||||
num3 = ((float) Math.Sin((double) ((1f - num) * num5))) * num6;
|
||||
num2 = flag ? (((float) -Math.Sin((double) (num * num5))) * num6) : (((float) Math.Sin((double) (num * num5))) * num6);
|
||||
}
|
||||
quaternion.X = (num3 * quaternion1.X) + (num2 * quaternion2.X);
|
||||
quaternion.Y = (num3 * quaternion1.Y) + (num2 * quaternion2.Y);
|
||||
quaternion.Z = (num3 * quaternion1.Z) + (num2 * quaternion2.Z);
|
||||
quaternion.W = (num3 * quaternion1.W) + (num2 * quaternion2.W);
|
||||
return quaternion;
|
||||
float num3;
|
||||
Quaternion quaternion;
|
||||
float num = amount;
|
||||
float num4 = (((quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y)) + (quaternion1.Z * quaternion2.Z)) + (quaternion1.W * quaternion2.W);
|
||||
bool flag = false;
|
||||
if (num4 < 0f)
|
||||
{
|
||||
flag = true;
|
||||
num4 = -num4;
|
||||
}
|
||||
if (num4 > 0.999999f)
|
||||
{
|
||||
num3 = 1f - num;
|
||||
num2 = flag ? -num : num;
|
||||
}
|
||||
else
|
||||
{
|
||||
float num5 = (float) Math.Acos((double) num4);
|
||||
float num6 = (float) (1.0 / Math.Sin((double) num5));
|
||||
num3 = ((float) Math.Sin((double) ((1f - num) * num5))) * num6;
|
||||
num2 = flag ? (((float) -Math.Sin((double) (num * num5))) * num6) : (((float) Math.Sin((double) (num * num5))) * num6);
|
||||
}
|
||||
quaternion.X = (num3 * quaternion1.X) + (num2 * quaternion2.X);
|
||||
quaternion.Y = (num3 * quaternion1.Y) + (num2 * quaternion2.Y);
|
||||
quaternion.Z = (num3 * quaternion1.Z) + (num2 * quaternion2.Z);
|
||||
quaternion.W = (num3 * quaternion1.W) + (num2 * quaternion2.W);
|
||||
return quaternion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -769,31 +769,31 @@ namespace Microsoft.Xna.Framework
|
||||
public static void Slerp(ref Quaternion quaternion1, ref Quaternion quaternion2, float amount, out Quaternion result)
|
||||
{
|
||||
float num2;
|
||||
float num3;
|
||||
float num = amount;
|
||||
float num4 = (((quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y)) + (quaternion1.Z * quaternion2.Z)) + (quaternion1.W * quaternion2.W);
|
||||
bool flag = false;
|
||||
if (num4 < 0f)
|
||||
{
|
||||
flag = true;
|
||||
num4 = -num4;
|
||||
}
|
||||
if (num4 > 0.999999f)
|
||||
{
|
||||
num3 = 1f - num;
|
||||
num2 = flag ? -num : num;
|
||||
}
|
||||
else
|
||||
{
|
||||
float num5 = (float) Math.Acos((double) num4);
|
||||
float num6 = (float) (1.0 / Math.Sin((double) num5));
|
||||
num3 = ((float) Math.Sin((double) ((1f - num) * num5))) * num6;
|
||||
num2 = flag ? (((float) -Math.Sin((double) (num * num5))) * num6) : (((float) Math.Sin((double) (num * num5))) * num6);
|
||||
}
|
||||
result.X = (num3 * quaternion1.X) + (num2 * quaternion2.X);
|
||||
result.Y = (num3 * quaternion1.Y) + (num2 * quaternion2.Y);
|
||||
result.Z = (num3 * quaternion1.Z) + (num2 * quaternion2.Z);
|
||||
result.W = (num3 * quaternion1.W) + (num2 * quaternion2.W);
|
||||
float num3;
|
||||
float num = amount;
|
||||
float num4 = (((quaternion1.X * quaternion2.X) + (quaternion1.Y * quaternion2.Y)) + (quaternion1.Z * quaternion2.Z)) + (quaternion1.W * quaternion2.W);
|
||||
bool flag = false;
|
||||
if (num4 < 0f)
|
||||
{
|
||||
flag = true;
|
||||
num4 = -num4;
|
||||
}
|
||||
if (num4 > 0.999999f)
|
||||
{
|
||||
num3 = 1f - num;
|
||||
num2 = flag ? -num : num;
|
||||
}
|
||||
else
|
||||
{
|
||||
float num5 = (float) Math.Acos((double) num4);
|
||||
float num6 = (float) (1.0 / Math.Sin((double) num5));
|
||||
num3 = ((float) Math.Sin((double) ((1f - num) * num5))) * num6;
|
||||
num2 = flag ? (((float) -Math.Sin((double) (num * num5))) * num6) : (((float) Math.Sin((double) (num * num5))) * num6);
|
||||
}
|
||||
result.X = (num3 * quaternion1.X) + (num2 * quaternion2.X);
|
||||
result.Y = (num3 * quaternion1.Y) + (num2 * quaternion2.Y);
|
||||
result.Z = (num3 * quaternion1.Z) + (num2 * quaternion2.Z);
|
||||
result.W = (num3 * quaternion1.W) + (num2 * quaternion2.W);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -809,11 +809,11 @@ namespace Microsoft.Xna.Framework
|
||||
public static Quaternion Subtract(Quaternion quaternion1, Quaternion quaternion2)
|
||||
{
|
||||
Quaternion quaternion;
|
||||
quaternion.X = quaternion1.X - quaternion2.X;
|
||||
quaternion.Y = quaternion1.Y - quaternion2.Y;
|
||||
quaternion.Z = quaternion1.Z - quaternion2.Z;
|
||||
quaternion.W = quaternion1.W - quaternion2.W;
|
||||
return quaternion;
|
||||
quaternion.X = quaternion1.X - quaternion2.X;
|
||||
quaternion.Y = quaternion1.Y - quaternion2.Y;
|
||||
quaternion.Z = quaternion1.Z - quaternion2.Z;
|
||||
quaternion.W = quaternion1.W - quaternion2.W;
|
||||
return quaternion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -825,9 +825,9 @@ namespace Microsoft.Xna.Framework
|
||||
public static void Subtract(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result)
|
||||
{
|
||||
result.X = quaternion1.X - quaternion2.X;
|
||||
result.Y = quaternion1.Y - quaternion2.Y;
|
||||
result.Z = quaternion1.Z - quaternion2.Z;
|
||||
result.W = quaternion1.W - quaternion2.W;
|
||||
result.Y = quaternion1.Y - quaternion2.Y;
|
||||
result.Z = quaternion1.Z - quaternion2.Z;
|
||||
result.W = quaternion1.W - quaternion2.W;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -843,23 +843,23 @@ namespace Microsoft.Xna.Framework
|
||||
public static Quaternion Multiply(Quaternion quaternion1, Quaternion quaternion2)
|
||||
{
|
||||
Quaternion quaternion;
|
||||
float x = quaternion1.X;
|
||||
float y = quaternion1.Y;
|
||||
float z = quaternion1.Z;
|
||||
float w = quaternion1.W;
|
||||
float num4 = quaternion2.X;
|
||||
float num3 = quaternion2.Y;
|
||||
float num2 = quaternion2.Z;
|
||||
float num = quaternion2.W;
|
||||
float num12 = (y * num2) - (z * num3);
|
||||
float num11 = (z * num4) - (x * num2);
|
||||
float num10 = (x * num3) - (y * num4);
|
||||
float num9 = ((x * num4) + (y * num3)) + (z * num2);
|
||||
quaternion.X = ((x * num) + (num4 * w)) + num12;
|
||||
quaternion.Y = ((y * num) + (num3 * w)) + num11;
|
||||
quaternion.Z = ((z * num) + (num2 * w)) + num10;
|
||||
quaternion.W = (w * num) - num9;
|
||||
return quaternion;
|
||||
float x = quaternion1.X;
|
||||
float y = quaternion1.Y;
|
||||
float z = quaternion1.Z;
|
||||
float w = quaternion1.W;
|
||||
float num4 = quaternion2.X;
|
||||
float num3 = quaternion2.Y;
|
||||
float num2 = quaternion2.Z;
|
||||
float num = quaternion2.W;
|
||||
float num12 = (y * num2) - (z * num3);
|
||||
float num11 = (z * num4) - (x * num2);
|
||||
float num10 = (x * num3) - (y * num4);
|
||||
float num9 = ((x * num4) + (y * num3)) + (z * num2);
|
||||
quaternion.X = ((x * num) + (num4 * w)) + num12;
|
||||
quaternion.Y = ((y * num) + (num3 * w)) + num11;
|
||||
quaternion.Z = ((z * num) + (num2 * w)) + num10;
|
||||
quaternion.W = (w * num) - num9;
|
||||
return quaternion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -871,11 +871,11 @@ namespace Microsoft.Xna.Framework
|
||||
public static Quaternion Multiply(Quaternion quaternion1, float scaleFactor)
|
||||
{
|
||||
Quaternion quaternion;
|
||||
quaternion.X = quaternion1.X * scaleFactor;
|
||||
quaternion.Y = quaternion1.Y * scaleFactor;
|
||||
quaternion.Z = quaternion1.Z * scaleFactor;
|
||||
quaternion.W = quaternion1.W * scaleFactor;
|
||||
return quaternion;
|
||||
quaternion.X = quaternion1.X * scaleFactor;
|
||||
quaternion.Y = quaternion1.Y * scaleFactor;
|
||||
quaternion.Z = quaternion1.Z * scaleFactor;
|
||||
quaternion.W = quaternion1.W * scaleFactor;
|
||||
return quaternion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -887,9 +887,9 @@ namespace Microsoft.Xna.Framework
|
||||
public static void Multiply(ref Quaternion quaternion1, float scaleFactor, out Quaternion result)
|
||||
{
|
||||
result.X = quaternion1.X * scaleFactor;
|
||||
result.Y = quaternion1.Y * scaleFactor;
|
||||
result.Z = quaternion1.Z * scaleFactor;
|
||||
result.W = quaternion1.W * scaleFactor;
|
||||
result.Y = quaternion1.Y * scaleFactor;
|
||||
result.Z = quaternion1.Z * scaleFactor;
|
||||
result.W = quaternion1.W * scaleFactor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -901,21 +901,21 @@ namespace Microsoft.Xna.Framework
|
||||
public static void Multiply(ref Quaternion quaternion1, ref Quaternion quaternion2, out Quaternion result)
|
||||
{
|
||||
float x = quaternion1.X;
|
||||
float y = quaternion1.Y;
|
||||
float z = quaternion1.Z;
|
||||
float w = quaternion1.W;
|
||||
float num4 = quaternion2.X;
|
||||
float num3 = quaternion2.Y;
|
||||
float num2 = quaternion2.Z;
|
||||
float num = quaternion2.W;
|
||||
float num12 = (y * num2) - (z * num3);
|
||||
float num11 = (z * num4) - (x * num2);
|
||||
float num10 = (x * num3) - (y * num4);
|
||||
float num9 = ((x * num4) + (y * num3)) + (z * num2);
|
||||
result.X = ((x * num) + (num4 * w)) + num12;
|
||||
result.Y = ((y * num) + (num3 * w)) + num11;
|
||||
result.Z = ((z * num) + (num2 * w)) + num10;
|
||||
result.W = (w * num) - num9;
|
||||
float y = quaternion1.Y;
|
||||
float z = quaternion1.Z;
|
||||
float w = quaternion1.W;
|
||||
float num4 = quaternion2.X;
|
||||
float num3 = quaternion2.Y;
|
||||
float num2 = quaternion2.Z;
|
||||
float num = quaternion2.W;
|
||||
float num12 = (y * num2) - (z * num3);
|
||||
float num11 = (z * num4) - (x * num2);
|
||||
float num10 = (x * num3) - (y * num4);
|
||||
float num9 = ((x * num4) + (y * num3)) + (z * num2);
|
||||
result.X = ((x * num) + (num4 * w)) + num12;
|
||||
result.Y = ((y * num) + (num3 * w)) + num11;
|
||||
result.Z = ((z * num) + (num2 * w)) + num10;
|
||||
result.W = (w * num) - num9;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -929,7 +929,7 @@ namespace Microsoft.Xna.Framework
|
||||
/// <returns>The result of the quaternion negation.</returns>
|
||||
public static Quaternion Negate(Quaternion quaternion)
|
||||
{
|
||||
return new Quaternion(-quaternion.X, -quaternion.Y, -quaternion.Z, -quaternion.W);
|
||||
return new Quaternion(-quaternion.X, -quaternion.Y, -quaternion.Z, -quaternion.W);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -940,9 +940,9 @@ namespace Microsoft.Xna.Framework
|
||||
public static void Negate(ref Quaternion quaternion, out Quaternion result)
|
||||
{
|
||||
result.X = -quaternion.X;
|
||||
result.Y = -quaternion.Y;
|
||||
result.Z = -quaternion.Z;
|
||||
result.W = -quaternion.W;
|
||||
result.Y = -quaternion.Y;
|
||||
result.Z = -quaternion.Z;
|
||||
result.W = -quaternion.W;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -954,11 +954,11 @@ namespace Microsoft.Xna.Framework
|
||||
/// </summary>
|
||||
public void Normalize()
|
||||
{
|
||||
float num = 1f / ((float) Math.Sqrt((X * X) + (Y * Y) + (Z * Z) + (W * W)));
|
||||
X *= num;
|
||||
Y *= num;
|
||||
Z *= num;
|
||||
W *= num;
|
||||
float num = 1f / ((float) Math.Sqrt((X * X) + (Y * Y) + (Z * Z) + (W * W)));
|
||||
X *= num;
|
||||
Y *= num;
|
||||
Z *= num;
|
||||
W *= num;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -969,12 +969,12 @@ namespace Microsoft.Xna.Framework
|
||||
public static Quaternion Normalize(Quaternion quaternion)
|
||||
{
|
||||
Quaternion result;
|
||||
float num = 1f / ((float) Math.Sqrt((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y) + (quaternion.Z * quaternion.Z) + (quaternion.W * quaternion.W)));
|
||||
float num = 1f / ((float) Math.Sqrt((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y) + (quaternion.Z * quaternion.Z) + (quaternion.W * quaternion.W)));
|
||||
result.X = quaternion.X * num;
|
||||
result.Y = quaternion.Y * num;
|
||||
result.Z = quaternion.Z * num;
|
||||
result.W = quaternion.W * num;
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -984,11 +984,11 @@ namespace Microsoft.Xna.Framework
|
||||
/// <param name="result">The unit length quaternion an output parameter.</param>
|
||||
public static void Normalize(ref Quaternion quaternion, out Quaternion result)
|
||||
{
|
||||
float num = 1f / ((float) Math.Sqrt((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y) + (quaternion.Z * quaternion.Z) + (quaternion.W * quaternion.W)));
|
||||
result.X = quaternion.X * num;
|
||||
result.Y = quaternion.Y * num;
|
||||
result.Z = quaternion.Z * num;
|
||||
result.W = quaternion.W * num;
|
||||
float num = 1f / ((float) Math.Sqrt((quaternion.X * quaternion.X) + (quaternion.Y * quaternion.Y) + (quaternion.Z * quaternion.Z) + (quaternion.W * quaternion.W)));
|
||||
result.X = quaternion.X * num;
|
||||
result.Y = quaternion.Y * num;
|
||||
result.Z = quaternion.Z * num;
|
||||
result.W = quaternion.W * num;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -1025,11 +1025,11 @@ namespace Microsoft.Xna.Framework
|
||||
public static Quaternion operator +(Quaternion quaternion1, Quaternion quaternion2)
|
||||
{
|
||||
Quaternion quaternion;
|
||||
quaternion.X = quaternion1.X + quaternion2.X;
|
||||
quaternion.Y = quaternion1.Y + quaternion2.Y;
|
||||
quaternion.Z = quaternion1.Z + quaternion2.Z;
|
||||
quaternion.W = quaternion1.W + quaternion2.W;
|
||||
return quaternion;
|
||||
quaternion.X = quaternion1.X + quaternion2.X;
|
||||
quaternion.Y = quaternion1.Y + quaternion2.Y;
|
||||
quaternion.Z = quaternion1.Z + quaternion2.Z;
|
||||
quaternion.W = quaternion1.W + quaternion2.W;
|
||||
return quaternion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1041,25 +1041,25 @@ namespace Microsoft.Xna.Framework
|
||||
public static Quaternion operator /(Quaternion quaternion1, Quaternion quaternion2)
|
||||
{
|
||||
Quaternion quaternion;
|
||||
float x = quaternion1.X;
|
||||
float y = quaternion1.Y;
|
||||
float z = quaternion1.Z;
|
||||
float w = quaternion1.W;
|
||||
float num14 = (((quaternion2.X * quaternion2.X) + (quaternion2.Y * quaternion2.Y)) + (quaternion2.Z * quaternion2.Z)) + (quaternion2.W * quaternion2.W);
|
||||
float num5 = 1f / num14;
|
||||
float num4 = -quaternion2.X * num5;
|
||||
float num3 = -quaternion2.Y * num5;
|
||||
float num2 = -quaternion2.Z * num5;
|
||||
float num = quaternion2.W * num5;
|
||||
float num13 = (y * num2) - (z * num3);
|
||||
float num12 = (z * num4) - (x * num2);
|
||||
float num11 = (x * num3) - (y * num4);
|
||||
float num10 = ((x * num4) + (y * num3)) + (z * num2);
|
||||
quaternion.X = ((x * num) + (num4 * w)) + num13;
|
||||
quaternion.Y = ((y * num) + (num3 * w)) + num12;
|
||||
quaternion.Z = ((z * num) + (num2 * w)) + num11;
|
||||
quaternion.W = (w * num) - num10;
|
||||
return quaternion;
|
||||
float x = quaternion1.X;
|
||||
float y = quaternion1.Y;
|
||||
float z = quaternion1.Z;
|
||||
float w = quaternion1.W;
|
||||
float num14 = (((quaternion2.X * quaternion2.X) + (quaternion2.Y * quaternion2.Y)) + (quaternion2.Z * quaternion2.Z)) + (quaternion2.W * quaternion2.W);
|
||||
float num5 = 1f / num14;
|
||||
float num4 = -quaternion2.X * num5;
|
||||
float num3 = -quaternion2.Y * num5;
|
||||
float num2 = -quaternion2.Z * num5;
|
||||
float num = quaternion2.W * num5;
|
||||
float num13 = (y * num2) - (z * num3);
|
||||
float num12 = (z * num4) - (x * num2);
|
||||
float num11 = (x * num3) - (y * num4);
|
||||
float num10 = ((x * num4) + (y * num3)) + (z * num2);
|
||||
quaternion.X = ((x * num) + (num4 * w)) + num13;
|
||||
quaternion.Y = ((y * num) + (num3 * w)) + num12;
|
||||
quaternion.Z = ((z * num) + (num2 * w)) + num11;
|
||||
quaternion.W = (w * num) - num10;
|
||||
return quaternion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1078,14 +1078,14 @@ namespace Microsoft.Xna.Framework
|
||||
/// </summary>
|
||||
/// <param name="quaternion1"><see cref="Quaternion"/> instance on the left of the not equal sign.</param>
|
||||
/// <param name="quaternion2"><see cref="Quaternion"/> instance on the right of the not equal sign.</param>
|
||||
/// <returns><c>true</c> if the instances are not equal; <c>false</c> otherwise.</returns>
|
||||
/// <returns><c>true</c> if the instances are not equal; <c>false</c> otherwise.</returns>
|
||||
public static bool operator !=(Quaternion quaternion1, Quaternion quaternion2)
|
||||
{
|
||||
if (((quaternion1.X == quaternion2.X) && (quaternion1.Y == quaternion2.Y)) && (quaternion1.Z == quaternion2.Z))
|
||||
{
|
||||
return (quaternion1.W != quaternion2.W);
|
||||
}
|
||||
return true;
|
||||
{
|
||||
return (quaternion1.W != quaternion2.W);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1097,23 +1097,23 @@ namespace Microsoft.Xna.Framework
|
||||
public static Quaternion operator *(Quaternion quaternion1, Quaternion quaternion2)
|
||||
{
|
||||
Quaternion quaternion;
|
||||
float x = quaternion1.X;
|
||||
float y = quaternion1.Y;
|
||||
float z = quaternion1.Z;
|
||||
float w = quaternion1.W;
|
||||
float num4 = quaternion2.X;
|
||||
float num3 = quaternion2.Y;
|
||||
float num2 = quaternion2.Z;
|
||||
float num = quaternion2.W;
|
||||
float num12 = (y * num2) - (z * num3);
|
||||
float num11 = (z * num4) - (x * num2);
|
||||
float num10 = (x * num3) - (y * num4);
|
||||
float num9 = ((x * num4) + (y * num3)) + (z * num2);
|
||||
quaternion.X = ((x * num) + (num4 * w)) + num12;
|
||||
quaternion.Y = ((y * num) + (num3 * w)) + num11;
|
||||
quaternion.Z = ((z * num) + (num2 * w)) + num10;
|
||||
quaternion.W = (w * num) - num9;
|
||||
return quaternion;
|
||||
float x = quaternion1.X;
|
||||
float y = quaternion1.Y;
|
||||
float z = quaternion1.Z;
|
||||
float w = quaternion1.W;
|
||||
float num4 = quaternion2.X;
|
||||
float num3 = quaternion2.Y;
|
||||
float num2 = quaternion2.Z;
|
||||
float num = quaternion2.W;
|
||||
float num12 = (y * num2) - (z * num3);
|
||||
float num11 = (z * num4) - (x * num2);
|
||||
float num10 = (x * num3) - (y * num4);
|
||||
float num9 = ((x * num4) + (y * num3)) + (z * num2);
|
||||
quaternion.X = ((x * num) + (num4 * w)) + num12;
|
||||
quaternion.Y = ((y * num) + (num3 * w)) + num11;
|
||||
quaternion.Z = ((z * num) + (num2 * w)) + num10;
|
||||
quaternion.W = (w * num) - num9;
|
||||
return quaternion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1125,11 +1125,11 @@ namespace Microsoft.Xna.Framework
|
||||
public static Quaternion operator *(Quaternion quaternion1, float scaleFactor)
|
||||
{
|
||||
Quaternion quaternion;
|
||||
quaternion.X = quaternion1.X * scaleFactor;
|
||||
quaternion.Y = quaternion1.Y * scaleFactor;
|
||||
quaternion.Z = quaternion1.Z * scaleFactor;
|
||||
quaternion.W = quaternion1.W * scaleFactor;
|
||||
return quaternion;
|
||||
quaternion.X = quaternion1.X * scaleFactor;
|
||||
quaternion.Y = quaternion1.Y * scaleFactor;
|
||||
quaternion.Z = quaternion1.Z * scaleFactor;
|
||||
quaternion.W = quaternion1.W * scaleFactor;
|
||||
return quaternion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1141,11 +1141,11 @@ namespace Microsoft.Xna.Framework
|
||||
public static Quaternion operator -(Quaternion quaternion1, Quaternion quaternion2)
|
||||
{
|
||||
Quaternion quaternion;
|
||||
quaternion.X = quaternion1.X - quaternion2.X;
|
||||
quaternion.Y = quaternion1.Y - quaternion2.Y;
|
||||
quaternion.Z = quaternion1.Z - quaternion2.Z;
|
||||
quaternion.W = quaternion1.W - quaternion2.W;
|
||||
return quaternion;
|
||||
quaternion.X = quaternion1.X - quaternion2.X;
|
||||
quaternion.Y = quaternion1.Y - quaternion2.Y;
|
||||
quaternion.Z = quaternion1.Z - quaternion2.Z;
|
||||
quaternion.W = quaternion1.W - quaternion2.W;
|
||||
return quaternion;
|
||||
|
||||
}
|
||||
|
||||
@@ -1157,11 +1157,11 @@ namespace Microsoft.Xna.Framework
|
||||
public static Quaternion operator -(Quaternion quaternion)
|
||||
{
|
||||
Quaternion quaternion2;
|
||||
quaternion2.X = -quaternion.X;
|
||||
quaternion2.Y = -quaternion.Y;
|
||||
quaternion2.Z = -quaternion.Z;
|
||||
quaternion2.W = -quaternion.W;
|
||||
return quaternion2;
|
||||
quaternion2.X = -quaternion.X;
|
||||
quaternion2.Y = -quaternion.Y;
|
||||
quaternion2.Z = -quaternion.Z;
|
||||
quaternion2.W = -quaternion.W;
|
||||
return quaternion2;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -236,7 +236,7 @@ namespace Microsoft.Xna.Framework
|
||||
/// <param name="x">The x coordinate of the point to check for containment.</param>
|
||||
/// <param name="y">The y coordinate of the point to check for containment.</param>
|
||||
/// <returns><c>true</c> if the provided coordinates lie inside this <see cref="Rectangle"/>; <c>false</c> otherwise.</returns>
|
||||
public bool Contains(int x, int y)
|
||||
public bool Contains(int x, int y)
|
||||
{
|
||||
return ((((this.X <= x) && (x < (this.X + this.Width))) && (this.Y <= y)) && (y < (this.Y + this.Height)));
|
||||
}
|
||||
@@ -251,7 +251,7 @@ namespace Microsoft.Xna.Framework
|
||||
{
|
||||
return ((((this.X <= x) && (x < (this.X + this.Width))) && (this.Y <= y)) && (y < (this.Y + this.Height)));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether or not the provided <see cref="Point"/> lies within the bounds of this <see cref="Rectangle"/>.
|
||||
/// </summary>
|
||||
@@ -517,7 +517,7 @@ namespace Microsoft.Xna.Framework
|
||||
result.Width = Math.Max(value1.Right, value2.Right) - result.X;
|
||||
result.Height = Math.Max(value1.Bottom, value2.Bottom) - result.Y;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1120,7 +1120,7 @@ namespace Microsoft.Xna.Framework
|
||||
/// </summary>
|
||||
/// <param name="value1"><see cref="Vector4"/> instance on the left of the not equal sign.</param>
|
||||
/// <param name="value2"><see cref="Vector4"/> instance on the right of the not equal sign.</param>
|
||||
/// <returns><c>true</c> if the instances are not equal; <c>false</c> otherwise.</returns>
|
||||
/// <returns><c>true</c> if the instances are not equal; <c>false</c> otherwise.</returns>
|
||||
public static bool operator !=(Vector4 value1, Vector4 value2)
|
||||
{
|
||||
return !(value1 == value2);
|
||||
|
||||
@@ -226,7 +226,7 @@
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)Content\damageshader.fx" />
|
||||
<Content Include="$(MSBuildThisFileDirectory)Content\InfoTexts.xml">
|
||||
<Content Include="$(MSBuildThisFileDirectory)Content\Texts.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Artifacts\alientools.png">
|
||||
@@ -766,6 +766,9 @@
|
||||
<None Include="$(MSBuildThisFileDirectory)Content\blurshader.xnb">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)Content\blurshader_opengl.xnb">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)Content\Characters\Carrier\alarm1.ogg">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
@@ -907,6 +910,9 @@
|
||||
<None Include="$(MSBuildThisFileDirectory)Content\damageshader.xnb">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)Content\damageshader_opengl.xnb">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)Content\Exo2-Light.otf">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
@@ -1054,6 +1060,12 @@
|
||||
<None Include="$(MSBuildThisFileDirectory)Content\Items\Weapons\syringegun.ogg">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)Content\losshader.xnb">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)Content\losshader_opengl.xnb">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="$(MSBuildThisFileDirectory)Content\Map\TutorialSub.sub">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
@@ -1485,8 +1497,8 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\MultiplayerCampaign.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\TraitorManager.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameSession.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\InfoTextManager.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSettings.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Source\TextManager.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Source\Items\CharacterInventory.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Source\Items\Components\DockingPort.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Source\Items\Components\Door.cs" />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Character name="carrier" humanoid="false" health="1000" doesbleed="false">
|
||||
<Character name="carrier" humanoid="false" health="1000" doesbleed="false" usebloodparticles="false">
|
||||
|
||||
<sound file="Content/Characters/Carrier/alarm1.ogg" state="Attack" range="2000"/>
|
||||
<sound file="Content/Characters/Carrier/carrier1.ogg" state="Attack" range="2000"/>
|
||||
|
||||
@@ -54,12 +54,12 @@
|
||||
|
||||
<limb id = "8" width="50" height="320">
|
||||
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="755,552,137,470" depth="0.08" origin="0.5,0.5"/>
|
||||
<attack range="1400" damagerange="1300" duration="0.5" damage="30" stun="5.0" force="100" torque="-100" structuredamage="500" damagetype="slash"/>
|
||||
<attack range="1000" hitdetectiontype="Contact" duration="0.25" damage="30" stun="5.0" force="100" torque="-100" structuredamage="500" damagetype="slash"/>
|
||||
</limb>
|
||||
|
||||
<limb id = "9" width="50" height="320">
|
||||
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="892,552,137,470" depth="0.08" origin="0.6,0.5"/>
|
||||
<attack range="1400" damagerange="1300" duration="0.5" damage="30" stun="5.0" force="100" torque="100" structuredamage="500" damagetype="slash"/>
|
||||
<attack range="1000" hitdetectiontype="Contact" duration="0.25" damage="30" stun="5.0" force="100" torque="100" structuredamage="500" damagetype="slash"/>
|
||||
</limb>
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Character name="fractalguardian" humanoid="false" health="500.0" doesbleed="false">
|
||||
<Character name="fractalguardian" humanoid="false" health="500.0" doesbleed="false" usebloodparticles="false">
|
||||
|
||||
<sound file="Content/Characters/Fractalguardian/guardian1.ogg" state="Attack" range="3000" />
|
||||
<sound file="Content/Characters/Fractalguardian/guardian2.ogg" state="Attack" range="3000" />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Character name="fractalguardian" humanoid="false" health="800.0" doesbleed="false">
|
||||
<Character name="fractalguardian" humanoid="false" health="800.0" doesbleed="false" usebloodparticles="false">
|
||||
|
||||
<sound file="Content/Characters/Fractalguardian/guardian1.ogg" state="Attack" range="3000" />
|
||||
<sound file="Content/Characters/Fractalguardian/guardian2.ogg" state="Attack" range="3000" />
|
||||
|
||||
@@ -31,6 +31,12 @@
|
||||
/processorParam:DebugMode=Auto
|
||||
/build:damageshader.fx
|
||||
|
||||
#begin losshader.fx
|
||||
/importer:EffectImporter
|
||||
/processor:EffectProcessor
|
||||
/processorParam:DebugMode=Auto
|
||||
/build:losshader.fx
|
||||
|
||||
#begin utg_4.mp4
|
||||
/importer:H264Importer
|
||||
/processor:VideoProcessor
|
||||
|
||||
44
Barotrauma/BarotraumaShared/Content/Content_opengl.mgcb
Normal file
44
Barotrauma/BarotraumaShared/Content/Content_opengl.mgcb
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
#----------------------------- Global Properties ----------------------------#
|
||||
|
||||
/outputDir:bin/$(Platform)
|
||||
/intermediateDir:obj/$(Platform)
|
||||
/platform:DesktopGL
|
||||
/config:
|
||||
/profile:Reach
|
||||
/compress:False
|
||||
|
||||
#-------------------------------- References --------------------------------#
|
||||
|
||||
|
||||
#---------------------------------- Content ---------------------------------#
|
||||
|
||||
#begin watershader_opengl.fx
|
||||
/importer:EffectImporter
|
||||
/processor:EffectProcessor
|
||||
/processorParam:DebugMode=Auto
|
||||
/build:watershader_opengl.fx
|
||||
|
||||
#begin blurshader_opengl.fx
|
||||
/importer:EffectImporter
|
||||
/processor:EffectProcessor
|
||||
/processorParam:DebugMode=Auto
|
||||
/build:blurshader_opengl.fx
|
||||
|
||||
#begin damageshader_opengl.fx
|
||||
/importer:EffectImporter
|
||||
/processor:EffectProcessor
|
||||
/processorParam:DebugMode=Auto
|
||||
/build:damageshader_opengl.fx
|
||||
|
||||
#begin losshader_opengl.fx
|
||||
/importer:EffectImporter
|
||||
/processor:EffectProcessor
|
||||
/processorParam:DebugMode=Auto
|
||||
/build:losshader_opengl.fx
|
||||
|
||||
#begin utg_4.mp4
|
||||
/importer:H264Importer
|
||||
/processor:VideoProcessor
|
||||
/build:utg_4.mp4
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<infotexts>
|
||||
<progress>[sub] has made its way to [location].</progress>
|
||||
<progress>[sub] has arrived at [location].</progress>
|
||||
<return>[sub] has returned to [location].</return>
|
||||
<gameover>The ocean has claimed [sub] and its crew.</gameover>
|
||||
|
||||
<OxygenBarInfo>Running out of oxygen!</OxygenBarInfo>
|
||||
<PressureInfo>Water pressure increasing!</PressureInfo>
|
||||
|
||||
<CauseOfDeath.Damage>Succumbed to their injuries</CauseOfDeath.Damage>
|
||||
<CauseOfDeath.Bloodloss>Bled out</CauseOfDeath.Bloodloss>
|
||||
<CauseOfDeath.Drowning>Drowned</CauseOfDeath.Drowning>
|
||||
<CauseOfDeath.Suffocation>Suffocated</CauseOfDeath.Suffocation>
|
||||
<CauseOfDeath.Pressure>Crushed by water pressure</CauseOfDeath.Pressure>
|
||||
<CauseOfDeath.Burn>Burned to death</CauseOfDeath.Burn>
|
||||
<CauseOfDeath.Husk>Taken over by a parasite</CauseOfDeath.Husk>
|
||||
<CauseOfDeath.Disconnected>Disconnected</CauseOfDeath.Disconnected>
|
||||
|
||||
<Self_CauseOfDeath.Damage>You have succumbed to your injuries.</Self_CauseOfDeath.Damage>
|
||||
<Self_CauseOfDeath.Bloodloss>You have bled out.</Self_CauseOfDeath.Bloodloss>
|
||||
<Self_CauseOfDeath.Drowning>You have drowned.</Self_CauseOfDeath.Drowning>
|
||||
<Self_CauseOfDeath.Suffocation>You have suffocated.</Self_CauseOfDeath.Suffocation>
|
||||
<Self_CauseOfDeath.Pressure>You have been crushed by water pressure.</Self_CauseOfDeath.Pressure>
|
||||
<Self_CauseOfDeath.Burn>You have burned to death.</Self_CauseOfDeath.Burn>
|
||||
<Self_CauseOfDeath.Husk>The parasite has taken over your body.</Self_CauseOfDeath.Husk>
|
||||
<Self_CauseOfDeath.Disconnected>You were disconnected from the server.</Self_CauseOfDeath.Disconnected>
|
||||
|
||||
<HuskDormant>Your throat feels sore</HuskDormant>
|
||||
<HuskDormant>Your feel feverish</HuskDormant>
|
||||
<HuskDormant>It feels as if something was stuck in your throat</HuskDormant>
|
||||
<HuskDormant>Your muscles are aching</HuskDormant>
|
||||
|
||||
<HuskCantSpeak>You feel something moving in your throat. You try to scream but no sound comes out.</HuskCantSpeak>
|
||||
|
||||
<HuskActivate>A strange chitinous appendage bursts out from your mouth. Use it to inject eggs into a living body by pressing [Attack]!</HuskActivate>
|
||||
|
||||
|
||||
</infotexts>
|
||||
@@ -91,9 +91,8 @@
|
||||
|
||||
<Item
|
||||
name="Oxygenite Shard"
|
||||
category="Alien"
|
||||
|
||||
tags="alien,smallitem"
|
||||
category="Alien"
|
||||
tags="alien,smallitem,oxygensource"
|
||||
impacttolerance="8">
|
||||
|
||||
<Deconstruct time="20">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<Item
|
||||
name="Oxygen Tank"
|
||||
category="Equipment,Misc"
|
||||
Tags="smallitem"
|
||||
Tags="smallitem,oxygensource"
|
||||
|
||||
price="50">
|
||||
|
||||
|
||||
@@ -208,4 +208,4 @@
|
||||
<output name="state_out"/>
|
||||
</ConnectionPanel>
|
||||
</Item>
|
||||
</Items>
|
||||
</Items>
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
<Reactor canbeselected = "true">
|
||||
<GuiFrame rect="0,0,760,460" alignment="Center" style="ItemUI"/>
|
||||
<RequiredSkill name="Construction" level="30"/>
|
||||
<StatusEffect type="InWater" target="This" Temperature="-500.0"/>
|
||||
<StatusEffect type="OnActive" target="Contained" targetnames="Fuel Rod, Heat Absorber, Temperature Control Circuit" Condition="-0.1" />
|
||||
<sound file="reactor.ogg" type="OnActive" range="2000.0" volume="FissionRate" volumemultiplier="0.02" loop="true"/>
|
||||
@@ -55,8 +56,7 @@
|
||||
|
||||
<Item
|
||||
name="Fuel Rod"
|
||||
Tags="smallitem"
|
||||
|
||||
Tags="smallitem,reactorfuel"
|
||||
price="200">
|
||||
|
||||
<Deconstruct time="10">
|
||||
@@ -75,8 +75,7 @@
|
||||
|
||||
<Item
|
||||
name="Incendium Fuel Rod"
|
||||
Tags="smallitem"
|
||||
|
||||
Tags="smallitem,reactorfuel"
|
||||
spritecolor="0.5,0.0,0.0,1.0">
|
||||
|
||||
<Deconstruct time="10">
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
|
||||
<StatusEffect type="OnUse" Condition="-100.0" stun="10.0" disabledeltatime="true">
|
||||
<sound file="Content/Items/Weapons/bigexplosion.ogg"/>
|
||||
<Explosion range="1000.0" structuredamage="1000" damage="1000" stun="10" force="50.0" severlimbsprobability="0.8" decal="explosion" decalsize="1.0"/>
|
||||
<Explosion range="1000.0" structuredamage="1000" damage="1000" stun="10" force="50.0" severlimbsprobability="1.0" decal="explosion" decalsize="1.0"/>
|
||||
</StatusEffect>
|
||||
|
||||
<StatusEffect type="OnActive" target="This">
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<sprite texture="Content/Particles/spatter.png" sourcerect="128,0,128,128"/>
|
||||
<sprite texture="Content/Particles/spatter.png" sourcerect="0,128,128,128"/>
|
||||
</watersplash>
|
||||
|
||||
|
||||
<mist
|
||||
startsizemin="0.4,0.4" startsizemax="0.5,0.5"
|
||||
sizechangemin="0.25,0.25" sizechangemax="0.3,0.3"
|
||||
@@ -81,7 +81,122 @@
|
||||
velocitychange="0.0, 0.0">
|
||||
<animatedsprite texture="Content/Particles/Smoke.png" sourcerect="0,0,4096,4096" columns="8" rows="8" origin="0.5,0.5"/>
|
||||
</waterblood>
|
||||
|
||||
<bloodtrail
|
||||
lifetime="0.5"
|
||||
angularvelocitymin="0"
|
||||
angularvelocitymax="0"
|
||||
startrotationmin="0"
|
||||
startrotationmax="360"
|
||||
rotatetodirection="False"
|
||||
drag="0"
|
||||
waterdrag="0.8"
|
||||
velocitychange="0,0"
|
||||
collisionradius="30"
|
||||
collideswithwalls="False"
|
||||
deleteoncollision="False"
|
||||
friction="0.01"
|
||||
restitution="0.2"
|
||||
startsizemin="0.6,0.6"
|
||||
startsizemax="1,1"
|
||||
sizechangemin="0.2,0.2"
|
||||
sizechangemax="0.5,0.5"
|
||||
growtime="0.05"
|
||||
startcolor="0.4941176,0,0,0.4941176"
|
||||
startalpha="0.5"
|
||||
colorchange="0,0,0,-1"
|
||||
drawtarget="Both"
|
||||
blendstate="AlphaBlend"
|
||||
animduration="1"
|
||||
loopanim="True">
|
||||
<sprite texture="Content/Particles/spatter.png" sourcerect="0,0,128,128"/>
|
||||
<sprite texture="Content/Particles/spatter.png" sourcerect="128,0,128,128"/>
|
||||
<sprite texture="Content/Particles/spatter.png" sourcerect="0,128,128,128"/>
|
||||
</bloodtrail>
|
||||
|
||||
<gib
|
||||
lifetime="5"
|
||||
angularvelocitymin="-500"
|
||||
angularvelocitymax="500"
|
||||
startrotationmin="0"
|
||||
startrotationmax="360"
|
||||
rotatetodirection="True"
|
||||
drag="0"
|
||||
waterdrag="0.3"
|
||||
velocitychange="0,-8"
|
||||
velocitychangewater="0,-1"
|
||||
collisionradius="10"
|
||||
collideswithwalls="True"
|
||||
deleteoncollision="False"
|
||||
friction="0.5"
|
||||
restitution="0.1"
|
||||
startsizemin="0.3,0.3"
|
||||
startsizemax="0.6,0.6"
|
||||
sizechangemin="-0.1,-0.1"
|
||||
sizechangemax="-0.1,-0.1"
|
||||
growtime="0"
|
||||
startcolor="0.2980392,0,0,1"
|
||||
startalpha="1"
|
||||
colorchange="0,0,0,-0.3"
|
||||
drawtarget="Both"
|
||||
blendstate="AlphaBlend"
|
||||
animduration="1"
|
||||
loopanim="True">
|
||||
<sprite texture="Content/Particles/shrapnel.png" sourcerect="0,64,32,32"/>
|
||||
<sprite texture="Content/Particles/shrapnel.png" sourcerect="32,64,32,32"/>
|
||||
<sprite texture="Content/Particles/shrapnel.png" sourcerect="64,64,32,32"/>
|
||||
<sprite texture="Content/Particles/shrapnel.png" sourcerect="96,64,32,32"/>
|
||||
<sprite texture="Content/Particles/shrapnel.png" sourcerect="128,64,32,32"/>
|
||||
<sprite texture="Content/Particles/shrapnel.png" sourcerect="160,64,48,32"/>
|
||||
<sprite texture="Content/Particles/shrapnel.png" sourcerect="208,64,48,32"/>
|
||||
</gib>
|
||||
|
||||
<heavygib
|
||||
lifetime="1"
|
||||
angularvelocitymin="-500"
|
||||
angularvelocitymax="500"
|
||||
startrotationmin="0"
|
||||
startrotationmax="360"
|
||||
rotatetodirection="False"
|
||||
drag="0"
|
||||
waterdrag="0.3"
|
||||
velocitychange="0,-8"
|
||||
velocitychangewater="0,-1"
|
||||
collisionradius="10"
|
||||
collideswithwalls="True"
|
||||
deleteoncollision="True"
|
||||
friction="0.5"
|
||||
restitution="0.5"
|
||||
startsizemin="0.8,0.8"
|
||||
startsizemax="1,1"
|
||||
sizechangemin="-0.5,-0.5"
|
||||
sizechangemax="-0.5,-0.5"
|
||||
growtime="0"
|
||||
startcolor="0.2980392,0,0,1"
|
||||
startalpha="1"
|
||||
colorchange="0,0,0,-0.3"
|
||||
drawtarget="Both"
|
||||
blendstate="AlphaBlend"
|
||||
animduration="1"
|
||||
loopanim="True">
|
||||
<sprite texture="Content/Particles/shrapnel.png" sourcerect="0,64,32,32"/>
|
||||
<sprite texture="Content/Particles/shrapnel.png" sourcerect="32,64,32,32"/>
|
||||
<sprite texture="Content/Particles/shrapnel.png" sourcerect="64,64,32,32"/>
|
||||
<sprite texture="Content/Particles/shrapnel.png" sourcerect="96,64,32,32"/>
|
||||
<sprite texture="Content/Particles/shrapnel.png" sourcerect="128,64,32,32"/>
|
||||
<sprite texture="Content/Particles/shrapnel.png" sourcerect="160,64,48,32"/>
|
||||
<sprite texture="Content/Particles/shrapnel.png" sourcerect="208,64,48,32"/>
|
||||
|
||||
<ParticleEmitter
|
||||
particle="bloodtrail"
|
||||
particlespersecond="10"
|
||||
position="0,0"
|
||||
anglemin="0"
|
||||
anglemax="360"
|
||||
velocitymin="10"
|
||||
velocitymax="20"/>
|
||||
</heavygib>
|
||||
|
||||
<spark
|
||||
startsizemin="0.5,0.2" startsizemax="1.0,0.7"
|
||||
sizechangemin="-0.5,-0.5" sizechangemax="-1.0,-1.0"
|
||||
@@ -314,7 +429,7 @@
|
||||
startcolor="1.0, 1.0, 1.0" startalpha="1.0"
|
||||
colorchange="0.0, 0.0, 0.0, -0.3"
|
||||
lifetime="10.0"
|
||||
drawtarget="both"
|
||||
drawtarget="water"
|
||||
collideswithwalls="true"
|
||||
collisionradius="10.0"
|
||||
restitution="0.2"
|
||||
|
||||
314
Barotrauma/BarotraumaShared/Content/Texts.xml
Normal file
314
Barotrauma/BarotraumaShared/Content/Texts.xml
Normal file
@@ -0,0 +1,314 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<infotexts>
|
||||
<!-- Main menu buttons -->
|
||||
<TutorialButton>Tutorial</TutorialButton>
|
||||
<NewGameButton>New Game</NewGameButton>
|
||||
<LoadGameButton>Load Game</LoadGameButton>
|
||||
<JoinServerButton>Join Server</JoinServerButton>
|
||||
<HostServerButton>Host Server</HostServerButton>
|
||||
<SubEditorButton>Submarine Editor</SubEditorButton>
|
||||
<SettingsButton>Settings</SettingsButton>
|
||||
<QuitButton>Quit</QuitButton>
|
||||
|
||||
<!-- Host server menu -->
|
||||
<ServerName>Server name</ServerName>
|
||||
<ServerPort>Server port</ServerPort>
|
||||
<MaxPlayers>Max players</MaxPlayers>
|
||||
<Password>Password</Password>
|
||||
<PublicServer>Public server</PublicServer>
|
||||
<PublicServerToolTip>Public servers are shown in the list of available servers in the "Join Server" -tab.</PublicServerToolTip>
|
||||
<AttemptUPnP>Attempt UPnP port forwarding</AttemptUPnP>
|
||||
<AttemptUPnPToolTip>UPnP can be used for forwarding ports on your router to allow players join the server. However, UPnP isn't supported by all routers, so you may need to setup port forwards manually if players are unable to join the server (see the readme for instructions).</AttemptUPnPToolTip>
|
||||
<StartServerButton>Start</StartServerButton>
|
||||
|
||||
<!-- Settings menu -->
|
||||
<Settings>Settings</Settings>
|
||||
<Resolution>Resolution</Resolution>
|
||||
<DisplayMode>Display mode</DisplayMode>
|
||||
<Fullscreen>Fullscreen</Fullscreen>
|
||||
<Windowed>Windowed</Windowed>
|
||||
<BorderlessWindowed>Borderless windowed</BorderlessWindowed>
|
||||
<EnableVSync>Enable vertical sync</EnableVSync>
|
||||
<SoundVolume>Sound volume</SoundVolume>
|
||||
<MusicVolume>Music volume</MusicVolume>
|
||||
<Controls>Controls</Controls>
|
||||
<ContentPackage>Content package</ContentPackage>
|
||||
<ApplySettingsButton>Apply</ApplySettingsButton>
|
||||
<ApplySettingsLabel>Apply changes?</ApplySettingsLabel>
|
||||
<ApplySettingsQuestion>Do you want to apply the settings or discard the changes?</ApplySettingsQuestion>
|
||||
<ApplySettingsYes>Apply</ApplySettingsYes>
|
||||
<ApplySettingsNo>Discard</ApplySettingsNo>
|
||||
<RestartRequiredLabel>Restart required</RestartRequiredLabel>
|
||||
<RestartRequiredText>You need to restart the game for the resolution changes to take effect.</RestartRequiredText>
|
||||
|
||||
<!-- Round summary -->
|
||||
<RoundSummaryProgress>[sub] has made its way to [location].</RoundSummaryProgress>
|
||||
<RoundSummaryProgress>[sub] has arrived at [location].</RoundSummaryProgress>
|
||||
<RoundSummaryReturn>[sub] has returned to [location].</RoundSummaryReturn>
|
||||
<RoundSummaryGameOver>The ocean has claimed [sub] and its crew.</RoundSummaryGameOver>
|
||||
<RoundSummaryCrewStatus>Crew status</RoundSummaryCrewStatus>
|
||||
|
||||
<!-- Character HUD -->
|
||||
<OxygenBarInfo>Running out of oxygen!</OxygenBarInfo>
|
||||
<PressureInfo>Water pressure increasing!</PressureInfo>
|
||||
<Grabbing>Grabbing</Grabbing>
|
||||
<Stun>Stun</Stun>
|
||||
|
||||
|
||||
<!-- Status -->
|
||||
<StatusOK>OK</StatusOK>
|
||||
<Unconscious>Unconscious</Unconscious>
|
||||
<Injured>Injured</Injured>
|
||||
|
||||
<!-- Limbs -->
|
||||
<LeftHand>Left hand</LeftHand>
|
||||
<RightHand>Right hand</RightHand>
|
||||
<Hands>Hands</Hands>
|
||||
<LeftArm>Left arm</LeftArm>
|
||||
<RightArm>Right arm</RightArm>
|
||||
<LeftLeg>Left leg</LeftLeg>
|
||||
<RightLeg>Right leg</RightLeg>
|
||||
<LeftFoot>Left foot</LeftFoot>
|
||||
<RightFoot>Right foot</RightFoot>
|
||||
<Head>Head</Head>
|
||||
<Torso>Torso</Torso>
|
||||
<Tail>Tail</Tail>
|
||||
<Legs>Legs</Legs>
|
||||
<RightThigh>Right thigh</RightThigh>
|
||||
<LeftThigh>Left thigh</LeftThigh>
|
||||
<Waist>Waist</Waist>
|
||||
|
||||
<!-- Misc -->
|
||||
<Yes>Yes</Yes>
|
||||
<No>No</No>
|
||||
<OK>OK</OK>
|
||||
<Skills>Skills</Skills>
|
||||
<Male>Male</Male>
|
||||
<Female>Female</Female>
|
||||
<Order>Order</Order>
|
||||
<Submarine>Submarine</Submarine>
|
||||
<Shuttle>Shuttle</Shuttle>
|
||||
<RespawnShuttle>Respawn shuttle</RespawnShuttle>
|
||||
<Editing>Editing</Editing>
|
||||
<Error>Error</Error>
|
||||
<Warning>Warning</Warning>
|
||||
<None>None</None>
|
||||
<Close>Close</Close>
|
||||
<Cancel>Cancel</Cancel>
|
||||
<Delete>Delete</Delete>
|
||||
<Load>Load</Load>
|
||||
<Back>Back</Back>
|
||||
<ManagePlayers>Manage players</ManagePlayers>
|
||||
|
||||
<DeleteDialogLabel>Delete file?</DeleteDialogLabel>
|
||||
<DeleteDialogQuestion>Are you sure you want to delete "[file]"?</DeleteDialogQuestion>
|
||||
<DeleteFileError>Could not delete file "[file]"!</DeleteFileError>
|
||||
|
||||
<!-- Pronouns -->
|
||||
<PronounMale>He</PronounMale>
|
||||
<PronounPossessiveMale>His</PronounPossessiveMale>
|
||||
<PronounReflexiveMale>Himself</PronounReflexiveMale>
|
||||
<PronounFemale>She</PronounFemale>
|
||||
<PronounPossessiveFemale>Her</PronounPossessiveFemale>
|
||||
<PronounReflexiveFemale>Herself</PronounReflexiveFemale>
|
||||
|
||||
<!-- Mission info -->
|
||||
<NoMission>No mission</NoMission>
|
||||
<MissionReward>Reward: [reward]</MissionReward>
|
||||
|
||||
<!-- Campaign setup menu -->
|
||||
<LoadButton>Load</LoadButton>
|
||||
<DeleteButton>Delete</DeleteButton>
|
||||
<SubNotSelected>Submarine not selected!</SubNotSelected>
|
||||
<SelectSubRequest>Please select a submarine.</SelectSubRequest>
|
||||
<SelectedSub>Selected submarine</SelectedSub>
|
||||
<SaveName>Save name</SaveName>
|
||||
<LastSaved>Last saved</LastSaved>
|
||||
<MapSeed>Map seed</MapSeed>
|
||||
<StartCampaignButton>Start</StartCampaignButton>
|
||||
|
||||
<ShuttleSelected>Shuttle selected</ShuttleSelected>
|
||||
<ShuttleWarning>Most shuttles are not adequately equipped to deal with the dangers of the Europan depths. Are you sure you want to choose a shuttle as your vessel?</ShuttleWarning>
|
||||
|
||||
<!-- Campaign menu -->
|
||||
<Map>Map</Map>
|
||||
<Crew>Crew</Crew>
|
||||
<Store>Store</Store>
|
||||
<Hire>Hire</Hire>
|
||||
<Location>Location</Location>
|
||||
<HireUnavailable>No-one available for hire.</HireUnavailable>
|
||||
<Mission>Mission</Mission>
|
||||
<Reward>Reward</Reward>
|
||||
<Credit>Credit</Credit>
|
||||
<Credits>Credits</Credits>
|
||||
|
||||
<!-- Server list -->
|
||||
<JoinServer>Join server</JoinServer>
|
||||
<YourName>Your name</YourName>
|
||||
<ServerIP>Server IP</ServerIP>
|
||||
<ServerListName>Name</ServerListName>
|
||||
<ServerListPlayers>Players</ServerListPlayers>
|
||||
<ServerListRoundStarted>Round started</ServerListRoundStarted>
|
||||
<ServerListRefresh>Refresh</ServerListRefresh>
|
||||
<ServerListJoin>Join</ServerListJoin>
|
||||
<FilterServers>Filter servers</FilterServers>
|
||||
<FilterPassword>No password required</FilterPassword>
|
||||
<FilterFullServers>Hide full servers</FilterFullServers>
|
||||
<FilterEmptyServers>Hide empty servers</FilterEmptyServers>
|
||||
<NoMatchingServers>No matching servers found.</NoMatchingServers>
|
||||
<RefreshingServerList>Refreshing server list...</RefreshingServerList>
|
||||
<NoServers>Could not find any servers.</NoServers>
|
||||
<MasterServerErrorLabel>Connection error</MasterServerErrorLabel>
|
||||
<MasterServerTimeOutError>Could not connect to master server (request timed out).</MasterServerTimeOutError>
|
||||
<MasterServerErrorException>Error while connecting to master server { [error] }</MasterServerErrorException>
|
||||
<MasterServerError404>Error while connecting to master server (404 - [masterserverurl] not found)</MasterServerError404>
|
||||
<MasterServerErrorUnavailable>Error while connecting to master server (505 - Service Unavailable). The master server may be down for maintenance or temporarily overloaded. Please try again after in a few moments.</MasterServerErrorUnavailable>
|
||||
<MasterServerErrorDefault>Error while connecting to master server ([statuscode]: [statusdescription])</MasterServerErrorDefault>
|
||||
|
||||
<!-- Server lobby -->
|
||||
<RestartingIn>Restarting in</RestartingIn>
|
||||
<Votes>Votes</Votes>
|
||||
<GameMode>Game mode</GameMode>
|
||||
<MissionType>Mission type</MissionType>
|
||||
<Random>Random</Random>
|
||||
<LevelSeed>Level seed</LevelSeed>
|
||||
<Traitors>Traitors</Traitors>
|
||||
<AutoRestart>Automatic restart</AutoRestart>
|
||||
<ServerLog>Server log</ServerLog>
|
||||
<CampaignView>Campaign view</CampaignView>
|
||||
<PlayYourself>Play yourself</PlayYourself>
|
||||
<StartGameButton>Start</StartGameButton>
|
||||
<ServerSettingsButton>Settings</ServerSettingsButton>
|
||||
<SpectateButton>Spectate</SpectateButton>
|
||||
<Gender>Gender</Gender>
|
||||
<JobPreferences>Job preferences</JobPreferences>
|
||||
<PlayingAsSpectator>Playing as a spectator</PlayingAsSpectator>
|
||||
<SubNotFound>Submarine not found in your submarine folder</SubNotFound>
|
||||
<SubDoesntMatch>Your version of the submarine doesn't match the servers version</SubDoesntMatch>
|
||||
<Rank>Rank</Rank>
|
||||
<CustomRank>Custom</CustomRank>
|
||||
<Permissions>Permissions</Permissions>
|
||||
<PermittedConsoleCommands>Permitted console commands</PermittedConsoleCommands>
|
||||
<Kick>Kick</Kick>
|
||||
<Ban>Ban</Ban>
|
||||
<BanRange>Ban range</BanRange>
|
||||
<PrivateMessageTag>[PM]</PrivateMessageTag>
|
||||
<SubNotFoundError>Submarine [subname] was selected by the server. Matching file not found in your submarine folder.</SubNotFoundError>
|
||||
<SubLoadError>Could not load submarine [subname]. The file may be corrupted.</SubLoadError>
|
||||
<SubDoesntMatchError>Your version of the submarine file [subname] does not match the server's version!\nYour MD5 hash: [myhash]\nServer's MD5 hash: [serverhash]\n</SubDoesntMatchError>
|
||||
<DownloadSubLabel>Submarine not found!</DownloadSubLabel>
|
||||
<DownloadSubQuestion>Do you want to download the file from the server host?</DownloadSubQuestion>
|
||||
|
||||
<!-- Sub editor -->
|
||||
<Items>Items</Items>
|
||||
<Structures>Structures</Structures>
|
||||
<TotalHullVolume>Total hull volume</TotalHullVolume>
|
||||
<SelectedHullVolume>Selected hull volume</SelectedHullVolume>
|
||||
<OptimalBallastLevel>optimal neutral ballast level is [value]</OptimalBallastLevel>
|
||||
<InsufficientBallast>insufficient volume for buoyancy control</InsufficientBallast>
|
||||
<PhysicsBodies>Physics bodies</PhysicsBodies>
|
||||
<OpenSubButton>Open...</OpenSubButton>
|
||||
<SaveSubButton>Save</SaveSubButton>
|
||||
<AddSubButton>Add submarine</AddSubButton>
|
||||
<AddSubToolTip>Places another submarine into the current submarine file. Can be used for adding things such as smaller vessels, escape pods or detachable sections into the main submarine.</AddSubToolTip>
|
||||
<FilterMapEntities>Filter</FilterMapEntities>
|
||||
<CharacterModeButton>Character mode</CharacterModeButton>
|
||||
<CharacterModeToolTip>Allows you to pick up and use items. Useful for things such as placing items inside closets, turning devices on/off and doing the wiring.</CharacterModeToolTip>
|
||||
<WiringModeButton>Wiring mode</WiringModeButton>
|
||||
<WiringModeToolTip>Allows you to connect wires between items.</WiringModeToolTip>
|
||||
<GenerateWaypointsButton>Generate waypoints</GenerateWaypointsButton>
|
||||
<GenerateWaypointsToolTip>AI controlled crew members require waypoints to navigate around the sub.</GenerateWaypointsToolTip>
|
||||
<ShowEntitiesLabel>Show</ShowEntitiesLabel>
|
||||
<ShowWaypoints>Waypoints</ShowWaypoints>
|
||||
<ShowSpawnpoints>Spawnpoints</ShowSpawnpoints>
|
||||
<ShowLinks>Links</ShowLinks>
|
||||
<ShowHulls>Hulls</ShowHulls>
|
||||
<ShowGaps>Gaps</ShowGaps>
|
||||
<PreviouslyUsedLabel>Previously used</PreviouslyUsedLabel>
|
||||
<SubNameMissingWarning>Name your submarine before saving it.</SubNameMissingWarning>
|
||||
<SubNameIllegalCharsWarning>Illegal symbols in filename ([illegalchar])</SubNameIllegalCharsWarning>
|
||||
<SubSavedNotification>Submarine saved to [filepath].</SubSavedNotification>
|
||||
<SaveSubDialogHeader>Save submarine</SaveSubDialogHeader>
|
||||
<SaveSubDialogName>Name</SaveSubDialogName>
|
||||
<SaveSubDialogDescription>Description</SaveSubDialogDescription>
|
||||
<SaveSubDialogSettings>Settings</SaveSubDialogSettings>
|
||||
<NoHullsWarning>No hulls found in the submarine. Hulls determine the "borders" of an individual room and are required for water and air distribution to work correctly.</NoHullsWarning>
|
||||
<DisconnectedVentsWarning>The submarine contains vents which haven't been linked to an oxygen generator. Select a vent and click an oxygen generator while holding space to link them.</DisconnectedVentsWarning>
|
||||
<NoWaypointsWarning>No waypoints found in the submarine. AI controlled crew members won't be able to navigate without waypoints.</NoWaypointsWarning>
|
||||
<NoCargoSpawnpointWarning>"The submarine does not have spawnpoints for cargo (which are used for determining where to place bought items). To fix this, create a new spawnpoint and change its "spawn type" parameter to "cargo".</NoCargoSpawnpointWarning>
|
||||
<FarAwayEntitiesWarning>One or more structures have been placed very far from the submarine. Show the structures?</FarAwayEntitiesWarning>
|
||||
|
||||
<!-- Waypoints -->
|
||||
<Waypoint>Waypoint</Waypoint>
|
||||
<LinkWaypoint>Hold space to link to another waypoint</LinkWaypoint>
|
||||
<Spawnpoint>Spawnpoint</Spawnpoint>
|
||||
<SpawnType>Spawn type</SpawnType>
|
||||
<IDCardDescription>ID Card description</IDCardDescription>
|
||||
<IDCardDescriptionTooltip>Characters spawning at this spawnpoint will have the specified description added to their ID card. This can be used to describe additional access levels their card has on the sub.</IDCardDescriptionTooltip>
|
||||
<IDCardTags>ID Card tags</IDCardTags>
|
||||
<IDCardTagsTooltip>Characters spawning at this spawnpoint will have the specified tags added to their ID card. You can, for example, use these tags to limit access to some parts of the sub.</IDCardTagsTooltip>
|
||||
<SpawnpointJobs>Assigned jobs</SpawnpointJobs>
|
||||
<SpawnpointJobsTooltip>Only characters with the specified job will spawn at this spawnpoint.</SpawnpointJobsTooltip>
|
||||
|
||||
<!-- Linked subs -->
|
||||
<LinkedSub>Linked submarine</LinkedSub>
|
||||
<ReloadLinkedSub>Refresh</ReloadLinkedSub>
|
||||
<ReloadLinkedSubTooltip>Reload the linked submarine from the specified file</ReloadLinkedSubTooltip>
|
||||
<LinkLinkedSub>Hold space to link to a docking port</LinkLinkedSub>
|
||||
<ReloadLinkedSubError>Submarine file [file] not found!</ReloadLinkedSubError>
|
||||
|
||||
<!-- Chat -->
|
||||
<SpamFilterKicked>You have been kicked by the spam filter.</SpamFilterKicked>
|
||||
<SpamFilterBlocked>You have been blocked by the spam filter. Try again after 10 seconds.</SpamFilterBlocked>
|
||||
|
||||
<!-- Item fixing -->
|
||||
<FixHeader>Attempting to fix [itemname]</FixHeader>
|
||||
<FixButton>Fix</FixButton>
|
||||
|
||||
<!-- Traitors -->
|
||||
<NewTraitor>New traitor</NewTraitor>
|
||||
<TraitorStartMessage>You are the Traitor! Your secret task is to assassinate [targetname]! Discretion is an utmost concern; sinking the submarine and killing the entire crew will arouse suspicion amongst the Fleet. If possible, make the death look like an accident.</TraitorStartMessage>
|
||||
<TraitorMoreAgentsMessage>It is possible that there are other agents on this submarine. You don't know their names, but you do have a method of communication. Use the code words to greet the agent and code response to respond. Disguise such words in a normal-looking phrase so the crew doesn't suspect anything.\n\nThe code words are: [codewords].\nThe code response is: [coderesponse].</TraitorMoreAgentsMessage>
|
||||
<TraitorStartMessageServer>[traitorname] is the traitor and the target is [targetname].</TraitorStartMessageServer>
|
||||
|
||||
<TraitorEndMessageSuccess>[traitorname] was a traitor! [Genderpronounpossessive] task was to assassinate [targetname]. The task was successful.</TraitorEndMessageSuccess>
|
||||
<TraitorEndMessageSuccessTraitorDead>[traitorname] was a traitor! [Genderpronounpossessive] task was to assassinate [targetname]. The task was successful, but the traitor did not make it out alive either.</TraitorEndMessageSuccessTraitorDead>
|
||||
<TraitorEndMessageSuccessTraitorDetained>[traitorname] was a traitor! [Genderpronounpossessive] task was to assassinate [targetname]. The task was successful, but the traitor was succesfully detained.</TraitorEndMessageSuccessTraitorDetained>
|
||||
<TraitorEndMessageFailure>[traitorname] was a traitor! [Genderpronounpossessive] task was to assassinate [targetname]. The task was unsuccessful.</TraitorEndMessageFailure>
|
||||
<TraitorEndMessageFailureTraitorDead>[traitorname] was a traitor! [Genderpronounpossessive] task was to assassinate [targetname], but [genderpronoun] got [genderpronounreflexive] killed before completing it.</TraitorEndMessageFailureTraitorDead>
|
||||
<TraitorEndMessageFailureTraitorDetained>[traitorname] was a traitor! [Genderpronounpossessive] task was to assassinate [targetname]. The task failed - [genderpronoun] was successfully detained.</TraitorEndMessageFailureTraitorDetained>
|
||||
|
||||
<!-- Causes of death -->
|
||||
<CauseOfDeath.Damage>Succumbed to their injuries</CauseOfDeath.Damage>
|
||||
<CauseOfDeath.Bloodloss>Bled out</CauseOfDeath.Bloodloss>
|
||||
<CauseOfDeath.Drowning>Drowned</CauseOfDeath.Drowning>
|
||||
<CauseOfDeath.Suffocation>Suffocated</CauseOfDeath.Suffocation>
|
||||
<CauseOfDeath.Pressure>Crushed by water pressure</CauseOfDeath.Pressure>
|
||||
<CauseOfDeath.Burn>Burned to death</CauseOfDeath.Burn>
|
||||
<CauseOfDeath.Husk>Taken over by a parasite</CauseOfDeath.Husk>
|
||||
<CauseOfDeath.Disconnected>Disconnected</CauseOfDeath.Disconnected>
|
||||
|
||||
<Self_CauseOfDeath.Damage>You have succumbed to your injuries.</Self_CauseOfDeath.Damage>
|
||||
<Self_CauseOfDeath.Bloodloss>You have bled out.</Self_CauseOfDeath.Bloodloss>
|
||||
<Self_CauseOfDeath.Drowning>You have drowned.</Self_CauseOfDeath.Drowning>
|
||||
<Self_CauseOfDeath.Suffocation>You have suffocated.</Self_CauseOfDeath.Suffocation>
|
||||
<Self_CauseOfDeath.Pressure>You have been crushed by water pressure.</Self_CauseOfDeath.Pressure>
|
||||
<Self_CauseOfDeath.Burn>You have burned to death.</Self_CauseOfDeath.Burn>
|
||||
<Self_CauseOfDeath.Husk>The parasite has taken over your body.</Self_CauseOfDeath.Husk>
|
||||
<Self_CauseOfDeath.Disconnected>You were disconnected from the server.</Self_CauseOfDeath.Disconnected>
|
||||
|
||||
<GiveInButton>Give in</GiveInButton>
|
||||
<GiveInHelpMultiplayer>Let go of your character and enter spectator mode (other players will no longer be able to revive you)</GiveInHelpMultiplayer>
|
||||
<GiveInHelpSingleplayer>"The character can no longer be revived if you give in."</GiveInHelpSingleplayer>
|
||||
|
||||
<!-- Huskification -->
|
||||
<HuskDormant>Your throat feels sore</HuskDormant>
|
||||
<HuskDormant>Your feel feverish</HuskDormant>
|
||||
<HuskDormant>It feels as if something was stuck in your throat</HuskDormant>
|
||||
<HuskDormant>Your muscles are aching</HuskDormant>
|
||||
<HuskCantSpeak>You feel something moving in your throat. You try to scream but no sound comes out.</HuskCantSpeak>
|
||||
<HuskActivate>A strange chitinous appendage bursts out from your mouth. Use it to inject eggs into a living body by pressing [Attack]!</HuskActivate>
|
||||
|
||||
|
||||
|
||||
</infotexts>
|
||||
33
Barotrauma/BarotraumaShared/Content/blurshader_opengl.fx
Normal file
33
Barotrauma/BarotraumaShared/Content/blurshader_opengl.fx
Normal file
@@ -0,0 +1,33 @@
|
||||
// Pixel shader applies a one dimensional gaussian blur filter.
|
||||
// This is used twice by the bloom postprocess, first to
|
||||
// blur horizontally, and then again to blur vertically.
|
||||
|
||||
sampler TextureSampler : register(s0);
|
||||
|
||||
#define SAMPLE_COUNT 15
|
||||
|
||||
float2 SampleOffsets[SAMPLE_COUNT];
|
||||
float SampleWeights[SAMPLE_COUNT];
|
||||
|
||||
|
||||
float4 PixelShaderF(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float4 c = 0;
|
||||
|
||||
// Combine a number of weighted image filter taps.
|
||||
for (int i = 0; i < SAMPLE_COUNT; i++)
|
||||
{
|
||||
c += tex2D(TextureSampler, texCoord + SampleOffsets[i]) * SampleWeights[i];
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
technique GaussianBlur
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
PixelShader = compile ps_2_0 PixelShaderF();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,10 +1,11 @@
|
||||
|
||||
Texture xTexture;
|
||||
Texture2D xTexture;
|
||||
sampler TextureSampler : register (s0) = sampler_state { Texture = <xTexture>; };
|
||||
|
||||
Texture xStencil;
|
||||
Texture2D xStencil;
|
||||
sampler StencilSampler = sampler_state { Texture = <xStencil>; };
|
||||
|
||||
float4 inColor;
|
||||
|
||||
float aCutoff;
|
||||
float aMultiplier;
|
||||
@@ -14,9 +15,9 @@ float cMultiplier;
|
||||
|
||||
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float4 c = tex2D(TextureSampler, texCoord);
|
||||
float4 c = xTexture.Sample(TextureSampler, texCoord) * inColor;
|
||||
|
||||
float4 stencilColor = tex2D(StencilSampler, texCoord);
|
||||
float4 stencilColor = xStencil.Sample(StencilSampler, texCoord);
|
||||
|
||||
float aDiff = stencilColor.a - aCutoff;
|
||||
|
||||
|
||||
Binary file not shown.
39
Barotrauma/BarotraumaShared/Content/damageshader_opengl.fx
Normal file
39
Barotrauma/BarotraumaShared/Content/damageshader_opengl.fx
Normal file
@@ -0,0 +1,39 @@
|
||||
|
||||
Texture xTexture;
|
||||
sampler TextureSampler : register (s0) = sampler_state { Texture = <xTexture>; };
|
||||
|
||||
Texture xStencil;
|
||||
sampler StencilSampler = sampler_state { Texture = <xStencil>; };
|
||||
|
||||
float4 inColor;
|
||||
|
||||
float aCutoff;
|
||||
float aMultiplier;
|
||||
|
||||
float cCutoff;
|
||||
float cMultiplier;
|
||||
|
||||
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float4 c = tex2D(TextureSampler, texCoord) * inColor;
|
||||
|
||||
float4 stencilColor = tex2D(StencilSampler, texCoord);
|
||||
|
||||
float aDiff = stencilColor.a - aCutoff;
|
||||
|
||||
clip(aDiff);
|
||||
|
||||
float cDiff = stencilColor.a - cCutoff;
|
||||
|
||||
return float4(
|
||||
lerp(stencilColor.rgb, c.rgb, clamp(cDiff * cMultiplier, 0.0f, 1.0f)),
|
||||
min(aDiff * aMultiplier, c.a));
|
||||
}
|
||||
|
||||
technique StencilShader
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
PixelShader = compile ps_2_0 main();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
24
Barotrauma/BarotraumaShared/Content/losshader.fx
Normal file
24
Barotrauma/BarotraumaShared/Content/losshader.fx
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
Texture2D xTexture;
|
||||
sampler TextureSampler : register (s0) = sampler_state { Texture = <xTexture>; };
|
||||
|
||||
Texture2D xLosTexture;
|
||||
sampler LosSampler = sampler_state { Texture = <xLosTexture>; };
|
||||
|
||||
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float4 losColor = xLosTexture.Sample(LosSampler, texCoord);
|
||||
float4 sample = xTexture.Sample(TextureSampler, texCoord);
|
||||
|
||||
float4 outColor = float4(sample.x*losColor.x, sample.y*losColor.x, sample.z*losColor.x, losColor.x);
|
||||
|
||||
return outColor;
|
||||
}
|
||||
|
||||
technique LosShader
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
PixelShader = compile ps_4_0_level_9_1 main();
|
||||
}
|
||||
}
|
||||
BIN
Barotrauma/BarotraumaShared/Content/losshader.xnb
Normal file
BIN
Barotrauma/BarotraumaShared/Content/losshader.xnb
Normal file
Binary file not shown.
24
Barotrauma/BarotraumaShared/Content/losshader_opengl.fx
Normal file
24
Barotrauma/BarotraumaShared/Content/losshader_opengl.fx
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
Texture2D xTexture;
|
||||
sampler TextureSampler : register (s0) = sampler_state { Texture = <xTexture>; };
|
||||
|
||||
Texture2D xLosTexture;
|
||||
sampler LosSampler = sampler_state { Texture = <xLosTexture>; };
|
||||
|
||||
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float4 losColor = tex2D(LosSampler, texCoord);
|
||||
float4 sample = tex2D(TextureSampler, texCoord);
|
||||
|
||||
float4 outColor = float4(sample.x*losColor.x, sample.y*losColor.x, sample.z*losColor.x, losColor.x);
|
||||
|
||||
return outColor;
|
||||
}
|
||||
|
||||
technique LosShader
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
PixelShader = compile ps_2_0 main();
|
||||
}
|
||||
}
|
||||
BIN
Barotrauma/BarotraumaShared/Content/losshader_opengl.xnb
Normal file
BIN
Barotrauma/BarotraumaShared/Content/losshader_opengl.xnb
Normal file
Binary file not shown.
@@ -1,13 +1,9 @@
|
||||
float xBlurDistance;
|
||||
|
||||
Texture xTexture;
|
||||
Texture2D xTexture;
|
||||
sampler TextureSampler = sampler_state { Texture = <xTexture>; };
|
||||
|
||||
Texture xLosTexture;
|
||||
sampler LosSampler = sampler_state { Texture = <xLosTexture>; };
|
||||
|
||||
|
||||
Texture xWaterBumpMap;
|
||||
Texture2D xWaterBumpMap;
|
||||
sampler WaterBumpSampler =
|
||||
sampler_state
|
||||
{
|
||||
@@ -26,8 +22,8 @@ float2 xBumpPos;
|
||||
|
||||
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float4 bumpColor = tex2D(WaterBumpSampler, texCoord+xWavePos+xBumpPos);
|
||||
bumpColor = (bumpColor + tex2D(WaterBumpSampler, texCoord-xWavePos*2.0f+xBumpPos))*0.5f;
|
||||
float4 bumpColor = xWaterBumpMap.Sample(WaterBumpSampler, texCoord+xWavePos+xBumpPos);
|
||||
bumpColor = (bumpColor + xWaterBumpMap.Sample(WaterBumpSampler, texCoord-xWavePos*2.0f+xBumpPos))*0.5f;
|
||||
|
||||
float2 samplePos = texCoord;
|
||||
|
||||
@@ -35,26 +31,16 @@ float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoor
|
||||
samplePos.y+=(bumpColor.g-0.5f)*xWaveHeight;
|
||||
|
||||
float4 sample;
|
||||
sample = tex2D( TextureSampler, float2(samplePos.x+xBlurDistance, samplePos.y+xBlurDistance));
|
||||
sample += tex2D( TextureSampler, float2(samplePos.x-xBlurDistance, samplePos.y-xBlurDistance));
|
||||
sample += tex2D( TextureSampler, float2(samplePos.x+xBlurDistance, samplePos.y-xBlurDistance));
|
||||
sample += tex2D( TextureSampler, float2(samplePos.x-xBlurDistance, samplePos.y+xBlurDistance));
|
||||
sample = xTexture.Sample( TextureSampler, float2(samplePos.x+xBlurDistance, samplePos.y+xBlurDistance));
|
||||
sample += xTexture.Sample( TextureSampler, float2(samplePos.x-xBlurDistance, samplePos.y-xBlurDistance));
|
||||
sample += xTexture.Sample( TextureSampler, float2(samplePos.x+xBlurDistance, samplePos.y-xBlurDistance));
|
||||
sample += xTexture.Sample( TextureSampler, float2(samplePos.x-xBlurDistance, samplePos.y+xBlurDistance));
|
||||
|
||||
sample = sample * 0.25;
|
||||
|
||||
return sample;
|
||||
}
|
||||
|
||||
float4 main2(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float4 losColor = tex2D(LosSampler, texCoord);
|
||||
|
||||
float4 outColor = float4(losColor.x, losColor.y, losColor.z, color.w);
|
||||
|
||||
return outColor;
|
||||
}
|
||||
|
||||
|
||||
technique WaterShader
|
||||
{
|
||||
pass Pass1
|
||||
@@ -62,11 +48,3 @@ technique WaterShader
|
||||
PixelShader = compile ps_4_0_level_9_1 main();
|
||||
}
|
||||
}
|
||||
|
||||
technique LosShader
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
PixelShader = compile ps_4_0_level_9_1 main2();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
50
Barotrauma/BarotraumaShared/Content/watershader_opengl.fx
Normal file
50
Barotrauma/BarotraumaShared/Content/watershader_opengl.fx
Normal file
@@ -0,0 +1,50 @@
|
||||
float xBlurDistance;
|
||||
|
||||
Texture xTexture;
|
||||
sampler TextureSampler = sampler_state { Texture = <xTexture>; };
|
||||
|
||||
Texture xWaterBumpMap;
|
||||
sampler WaterBumpSampler =
|
||||
sampler_state
|
||||
{
|
||||
Texture = <xWaterBumpMap>;
|
||||
MagFilter = LINEAR;
|
||||
MinFilter = LINEAR;
|
||||
MipFilter = LINEAR;
|
||||
AddressU = WRAP;
|
||||
AddressV = WRAP;
|
||||
};
|
||||
|
||||
float xWaveWidth;
|
||||
float xWaveHeight;
|
||||
float2 xWavePos;
|
||||
float2 xBumpPos;
|
||||
|
||||
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float4 bumpColor = tex2D(WaterBumpSampler, texCoord+xWavePos+xBumpPos);
|
||||
bumpColor = (bumpColor + tex2D(WaterBumpSampler, texCoord-xWavePos*2.0f+xBumpPos))*0.5f;
|
||||
|
||||
float2 samplePos = texCoord;
|
||||
|
||||
samplePos.x+=(bumpColor.r-0.5f)*xWaveWidth;
|
||||
samplePos.y+=(bumpColor.g-0.5f)*xWaveHeight;
|
||||
|
||||
float4 sample;
|
||||
sample = tex2D( TextureSampler, float2(samplePos.x+xBlurDistance, samplePos.y+xBlurDistance));
|
||||
sample += tex2D( TextureSampler, float2(samplePos.x-xBlurDistance, samplePos.y-xBlurDistance));
|
||||
sample += tex2D( TextureSampler, float2(samplePos.x+xBlurDistance, samplePos.y-xBlurDistance));
|
||||
sample += tex2D( TextureSampler, float2(samplePos.x-xBlurDistance, samplePos.y+xBlurDistance));
|
||||
|
||||
sample = sample * 0.25;
|
||||
|
||||
return sample;
|
||||
}
|
||||
|
||||
technique WaterShader
|
||||
{
|
||||
pass Pass1
|
||||
{
|
||||
PixelShader = compile ps_2_0 main();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user