diff --git a/Launcher2/LauncherMain.cs b/Launcher2/LauncherMain.cs
index a9c615350..b58ec23ef 100644
--- a/Launcher2/LauncherMain.cs
+++ b/Launcher2/LauncherMain.cs
@@ -4,7 +4,6 @@ using Microsoft.Xna.Framework.Input;
using Barotrauma;
using System.Collections.Generic;
using System.Reflection;
-using System.Runtime.InteropServices;
using System.Xml.Linq;
using System.Linq;
using System.Diagnostics;
@@ -25,7 +24,7 @@ namespace Launcher2
string version = AssemblyName.GetAssemblyName("Barotrauma.exe").Version.ToString();
private const string configPath = "config.xml";
- private Barotrauma.GameSettings settings;
+ private GameSettings settings;
private string latestVersionFileList, latestVersionFolder;
@@ -38,28 +37,24 @@ namespace Launcher2
private GUIProgressBar progressBar;
private GUIButton downloadButton;
- GUIButton launchButton;
-
- //public bool FullScreenEnabled
- //{
- // get { return settings.FullScreenEnabled; }
- // set { settings.FullScreenEnabled = value; }
- //}
-
+ private GUIButton launchButton;
+
public bool AutoCheckUpdates
{
get { return settings.AutoCheckUpdates; }
set { settings.AutoCheckUpdates = value; }
}
- Texture2D backgroundTexture, titleTexture;
+ private Texture2D backgroundTexture, titleTexture;
- GraphicsDeviceManager graphics;
- SpriteBatch spriteBatch;
+ private GraphicsDeviceManager graphics;
+ private SpriteBatch spriteBatch;
- int graphicsWidth, graphicsHeight;
+ private RasterizerState scissorTestEnable;
- GUIFrame guiRoot;
+ private int graphicsWidth, graphicsHeight;
+
+ private GUIFrame guiRoot;
public LauncherMain()
: base()
@@ -67,6 +62,8 @@ namespace Launcher2
graphics = new GraphicsDeviceManager(this);
graphics.PreferredBackBufferWidth = 640;
graphics.PreferredBackBufferHeight = 400;
+
+ scissorTestEnable = new RasterizerState() { ScissorTestEnable = true };
IsMouseVisible = true;
@@ -210,7 +207,7 @@ namespace Launcher2
{
GraphicsDevice.Clear(Color.Black);
- spriteBatch.Begin();
+ spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, scissorTestEnable);
spriteBatch.Draw(backgroundTexture,
new Rectangle(0, 0, graphicsWidth, graphicsHeight),
diff --git a/Subsurface/Barotrauma.csproj b/Subsurface/Barotrauma.csproj
index 2eb25ca99..0c0d2c2fe 100644
--- a/Subsurface/Barotrauma.csproj
+++ b/Subsurface/Barotrauma.csproj
@@ -559,6 +559,9 @@
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest
diff --git a/Subsurface/Content/Items/Artifacts/artifacts.xml b/Subsurface/Content/Items/Artifacts/artifacts.xml
index 2d7145c9a..ba1631cc6 100644
--- a/Subsurface/Content/Items/Artifacts/artifacts.xml
+++ b/Subsurface/Content/Items/Artifacts/artifacts.xml
@@ -141,6 +141,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Subsurface/Content/Items/Engine/engine.xml b/Subsurface/Content/Items/Engine/engine.xml
index 3d3ff81b5..41600d1c0 100644
--- a/Subsurface/Content/Items/Engine/engine.xml
+++ b/Subsurface/Content/Items/Engine/engine.xml
@@ -75,11 +75,12 @@
-
+
+
@@ -105,11 +106,12 @@
-
+
+
diff --git a/Subsurface/Content/Items/Engine/radarBlip.png b/Subsurface/Content/Items/Engine/radarBlip.png
new file mode 100644
index 000000000..5c2d7c602
Binary files /dev/null and b/Subsurface/Content/Items/Engine/radarBlip.png differ
diff --git a/Subsurface/Content/Items/Engine/radarOverlay.png b/Subsurface/Content/Items/Engine/radarOverlay.png
index 5b50d0e4d..6f7184665 100644
Binary files a/Subsurface/Content/Items/Engine/radarOverlay.png and b/Subsurface/Content/Items/Engine/radarOverlay.png differ
diff --git a/Subsurface/Content/Items/Tools/tools.xml b/Subsurface/Content/Items/Tools/tools.xml
index e8ae3ced0..1b53bfdbc 100644
--- a/Subsurface/Content/Items/Tools/tools.xml
+++ b/Subsurface/Content/Items/Tools/tools.xml
@@ -198,12 +198,13 @@
-
+
+
diff --git a/Subsurface/Content/Items/Weapons/railgun.xml b/Subsurface/Content/Items/Weapons/railgun.xml
index 2a6ee0ab8..ec3636731 100644
--- a/Subsurface/Content/Items/Weapons/railgun.xml
+++ b/Subsurface/Content/Items/Weapons/railgun.xml
@@ -60,6 +60,7 @@
+
diff --git a/Subsurface/Source/Characters/Animation/HumanoidAnimController.cs b/Subsurface/Source/Characters/Animation/HumanoidAnimController.cs
index 47c309e6b..416133d62 100644
--- a/Subsurface/Source/Characters/Animation/HumanoidAnimController.cs
+++ b/Subsurface/Source/Characters/Animation/HumanoidAnimController.cs
@@ -214,7 +214,7 @@ namespace Barotrauma
Limb leftLeg = GetLimb(LimbType.LeftLeg);
Limb rightLeg = GetLimb(LimbType.RightLeg);
-
+
float getUpSpeed = 0.3f;
float walkCycleSpeed = movement.X * walkAnimSpeed;
if (stairs != null)
@@ -304,8 +304,11 @@ namespace Barotrauma
torso.pullJoint.Enabled = true;
head.pullJoint.Enabled = true;
waist.pullJoint.Enabled = true;
+
+ float floorPos = GetFloorY(colliderPos + new Vector2(Math.Sign(movement.X) * 0.5f, 1.0f));
+ bool onSlope = floorPos > GetColliderBottom().Y + 0.05f;
- if (stairs != null)
+ if (stairs != null || onSlope)
{
torso.pullJoint.WorldAnchorB = new Vector2(
MathHelper.SmoothStep(torso.SimPosition.X, footMid + movement.X * 0.25f, getUpSpeed * 0.8f),
@@ -351,20 +354,23 @@ namespace Barotrauma
//progress the walking animation
walkPos -= (walkCycleSpeed / runningModifier) * 0.8f;
- MoveLimb(leftFoot,
- colliderPos + new Vector2(
- stepSize.X,
- (stepSize.Y > 0.0f) ? stepSize.Y : -0.15f),
- 15.0f, true);
+ for (int i = -1; i < 2; i += 2)
+ {
+ Limb foot = i == -1 ? leftFoot : rightFoot;
+ Limb leg = i == -1 ? leftLeg : rightLeg;
- MoveLimb(rightFoot,
- colliderPos + new Vector2(
- -stepSize.X,
- (-stepSize.Y > 0.0f) ? -stepSize.Y : -0.15f),
- 15.0f, true);
+ Vector2 footPos = stepSize * -i;
+ if (stepSize.Y > 0.0f) stepSize.Y = -0.15f;
- leftFoot.body.SmoothRotate(leftLeg.body.Rotation + MathHelper.PiOver2 * Dir * 1.6f, 20.0f * runningModifier);
- rightFoot.body.SmoothRotate(rightLeg.body.Rotation + MathHelper.PiOver2 * Dir * 1.6f, 20.0f * runningModifier);
+ if (onSlope && stairs == null)
+ {
+ footPos.Y *= 2.0f;
+ }
+ footPos.Y = Math.Min(waist.SimPosition.Y - colliderPos.Y - 0.4f, footPos.Y);
+
+ MoveLimb(foot, footPos + colliderPos, 15.0f, true);
+ foot.body.SmoothRotate(leg.body.Rotation + MathHelper.PiOver2 * Dir * 1.6f, 20.0f * runningModifier);
+ }
if (runningModifier > 1.0f)
{
@@ -435,7 +441,11 @@ namespace Barotrauma
{
footPos = new Vector2(GetCenterOfMass().X + stepSize.X * i * 0.2f, colliderPos.Y - 0.1f);
}
-
+
+ if (stairs == null)
+ {
+ footPos.Y = Math.Max(Math.Min(floorPos, footPos.Y + 0.5f), footPos.Y);
+ }
var foot = i == -1 ? rightFoot : leftFoot;
diff --git a/Subsurface/Source/Characters/Animation/Ragdoll.cs b/Subsurface/Source/Characters/Animation/Ragdoll.cs
index 68271e9af..23fc613b0 100644
--- a/Subsurface/Source/Characters/Animation/Ragdoll.cs
+++ b/Subsurface/Source/Characters/Animation/Ragdoll.cs
@@ -1100,7 +1100,12 @@ namespace Barotrauma
{
PhysicsBody refBody = refLimb == null ? Collider : refLimb.body;
- Vector2 rayStart = refBody.SimPosition;
+ return GetFloorY(refBody.SimPosition);
+ }
+
+ protected float GetFloorY(Vector2 simPosition)
+ {
+ Vector2 rayStart = simPosition;
Vector2 rayEnd = rayStart - new Vector2(0.0f, TorsoPosition);
var lowestLimb = FindLowestLimb();
@@ -1129,7 +1134,7 @@ namespace Barotrauma
}
return closestFraction;
- }
+ }
, rayStart, rayEnd);
@@ -1141,7 +1146,6 @@ namespace Barotrauma
{
return rayStart.Y + (rayEnd.Y - rayStart.Y) * closestFraction;
}
-
}
public void SetPosition(Vector2 simPosition, bool lerp = false)
diff --git a/Subsurface/Source/GUI/GUIListBox.cs b/Subsurface/Source/GUI/GUIListBox.cs
index b44195a25..ed9b57158 100644
--- a/Subsurface/Source/GUI/GUIListBox.cs
+++ b/Subsurface/Source/GUI/GUIListBox.cs
@@ -383,7 +383,8 @@ namespace Barotrauma
if (!scrollBarHidden) scrollBar.Draw(spriteBatch);
- GameMain.CurrGraphicsDevice.ScissorRectangle = frame.Rect;
+ Rectangle prevScissorRect = spriteBatch.GraphicsDevice.ScissorRectangle;
+ spriteBatch.GraphicsDevice.ScissorRectangle = frame.Rect;
int lastVisible = 0;
for (int i = 0; i < children.Count; i++)
@@ -400,8 +401,8 @@ namespace Barotrauma
lastVisible = i;
child.Draw(spriteBatch);
}
-
- GameMain.CurrGraphicsDevice.ScissorRectangle = new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
+
+ spriteBatch.GraphicsDevice.ScissorRectangle = prevScissorRect;
}
private bool IsChildVisible(GUIComponent child)
diff --git a/Subsurface/Source/GUI/GUITextBlock.cs b/Subsurface/Source/GUI/GUITextBlock.cs
index 121ec6650..42a37d8e9 100644
--- a/Subsurface/Source/GUI/GUITextBlock.cs
+++ b/Subsurface/Source/GUI/GUITextBlock.cs
@@ -276,10 +276,14 @@ namespace Barotrauma
if (offset != Vector2.Zero) drawRect.Location += offset.ToPoint();
base.Draw(spriteBatch);
-
+
if (TextGetter != null) Text = TextGetter();
-
- if (overflowClipActive) GameMain.CurrGraphicsDevice.ScissorRectangle = rect;
+
+ Rectangle prevScissorRect = spriteBatch.GraphicsDevice.ScissorRectangle;
+ if (overflowClipActive)
+ {
+ spriteBatch.GraphicsDevice.ScissorRectangle = rect;
+ }
if (!string.IsNullOrEmpty(text))
{
@@ -291,7 +295,10 @@ namespace Barotrauma
SpriteEffects.None, textDepth);
}
- if (overflowClipActive) GameMain.CurrGraphicsDevice.ScissorRectangle = new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
+ if (overflowClipActive)
+ {
+ spriteBatch.GraphicsDevice.ScissorRectangle = prevScissorRect;
+ }
DrawChildren(spriteBatch);
diff --git a/Subsurface/Source/GameMain.cs b/Subsurface/Source/GameMain.cs
index 4ed6562ce..4415a7629 100644
--- a/Subsurface/Source/GameMain.cs
+++ b/Subsurface/Source/GameMain.cs
@@ -7,30 +7,15 @@ using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Barotrauma.Networking;
using Barotrauma.Particles;
-using System.Collections;
using System.Collections.Generic;
using Microsoft.Xna.Framework.Input;
-using System.Xml;
namespace Barotrauma
{
class GameMain : Game
{
- public static GraphicsDeviceManager Graphics;
- static int graphicsWidth, graphicsHeight;
- static SpriteBatch spriteBatch;
-
- public static GameMain Instance;
-
- public static bool WindowActive
- {
- get { return Instance == null || Instance.IsActive; }
- }
-
public static bool DebugDraw;
-
- public static GraphicsDevice CurrGraphicsDevice;
-
+
public static FrameCounter FrameCounter;
public static readonly Version Version = Assembly.GetEntryAssembly().GetName().Version;
@@ -51,21 +36,17 @@ namespace Barotrauma
{
get { return Config.SelectedContentPackage; }
}
-
- public static Level Level;
-
+
public static GameSession GameSession;
public static NetworkMember NetworkMember;
public static ParticleManager ParticleManager;
-
- //public static TextureLoader TextureLoader;
public static World World;
public static LoadingScreen TitleScreen;
- private static bool loadingScreenOpen;
+ private bool loadingScreenOpen;
public static GameSettings Config;
@@ -74,25 +55,35 @@ namespace Barotrauma
private GameTime fixedTime;
- //public static Random localRandom;
- //public static Random random;
+ private static SpriteBatch spriteBatch;
- //private Stopwatch renderTimer;
- //public static int renderTimeElapsed;
-
- public Camera Cam
+ public static GameMain Instance
{
- get { return GameScreen.Cam; }
+ get;
+ private set;
}
+ public static GraphicsDeviceManager GraphicsDeviceManager
+ {
+ get;
+ private set;
+ }
+
public static int GraphicsWidth
{
- get { return graphicsWidth; }
+ get;
+ private set;
}
public static int GraphicsHeight
{
- get { return graphicsHeight; }
+ get;
+ private set;
+ }
+
+ public static bool WindowActive
+ {
+ get { return Instance == null || Instance.IsActive; }
}
public static GameServer Server
@@ -110,23 +101,10 @@ namespace Barotrauma
get;
private set;
}
-
- ///
- /// Total seconds elapsed after startup
- ///
- public double TotalElapsedTime
- {
- get;
- private set;
- }
-
+
public GameMain()
{
- Graphics = new GraphicsDeviceManager(this)
- {
- SynchronizeWithVerticalRetrace = false,
- };
-
+ GraphicsDeviceManager = new GraphicsDeviceManager(this);
Window.Title = "Barotrauma";
Instance = this;
@@ -144,11 +122,8 @@ namespace Barotrauma
Content.RootDirectory = "Content";
FrameCounter = new FrameCounter();
-
- //IsMouseVisible = true;
-
+
IsFixedTimeStep = false;
- //TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 55);
Timing.Accumulator = 0.0f;
fixedTime = new GameTime();
@@ -158,22 +133,21 @@ namespace Barotrauma
FarseerPhysics.Settings.ContinuousPhysics = false;
FarseerPhysics.Settings.VelocityIterations = 1;
FarseerPhysics.Settings.PositionIterations = 1;
-
}
public void ApplyGraphicsSettings()
{
- graphicsWidth = Config.GraphicsWidth;
- graphicsHeight = Config.GraphicsHeight;
- Graphics.SynchronizeWithVerticalRetrace = Config.VSyncEnabled;
-
- Graphics.HardwareModeSwitch = Config.WindowMode != WindowMode.BorderlessWindowed;
+ GraphicsWidth = Config.GraphicsWidth;
+ GraphicsHeight = Config.GraphicsHeight;
+ GraphicsDeviceManager.SynchronizeWithVerticalRetrace = Config.VSyncEnabled;
- Graphics.IsFullScreen = Config.WindowMode == WindowMode.Fullscreen || Config.WindowMode == WindowMode.BorderlessWindowed;
- Graphics.PreferredBackBufferWidth = graphicsWidth;
- Graphics.PreferredBackBufferHeight = graphicsHeight;
-
- Graphics.ApplyChanges();
+ GraphicsDeviceManager.HardwareModeSwitch = Config.WindowMode != WindowMode.BorderlessWindowed;
+
+ GraphicsDeviceManager.IsFullScreen = Config.WindowMode == WindowMode.Fullscreen || Config.WindowMode == WindowMode.BorderlessWindowed;
+ GraphicsDeviceManager.PreferredBackBufferWidth = GraphicsWidth;
+ GraphicsDeviceManager.PreferredBackBufferHeight = GraphicsHeight;
+
+ GraphicsDeviceManager.ApplyChanges();
}
///
@@ -185,9 +159,7 @@ namespace Barotrauma
protected override void Initialize()
{
base.Initialize();
-
- CurrGraphicsDevice = GraphicsDevice;
-
+
ScissorTestEnable = new RasterizerState() { ScissorTestEnable = true };
Hyper.ComponentModel.HyperTypeDescriptionProvider.Add(typeof(Character));
@@ -202,25 +174,25 @@ namespace Barotrauma
///
protected override void LoadContent()
{
- graphicsWidth = GraphicsDevice.Viewport.Width;
- graphicsHeight = GraphicsDevice.Viewport.Height;
-
+ GraphicsWidth = GraphicsDevice.Viewport.Width;
+ GraphicsHeight = GraphicsDevice.Viewport.Height;
+
Sound.Init();
ConvertUnits.SetDisplayUnitToSimUnitRatio(Physics.DisplayToSimRation);
-
- spriteBatch = new SpriteBatch(GraphicsDevice);
- TextureLoader.Init(GraphicsDevice);
+
+ spriteBatch = new SpriteBatch(base.GraphicsDevice);
+ TextureLoader.Init(base.GraphicsDevice);
loadingScreenOpen = true;
- TitleScreen = new LoadingScreen(GraphicsDevice);
+ TitleScreen = new LoadingScreen(base.GraphicsDevice);
loadingCoroutine = CoroutineManager.StartCoroutine(Load());
}
public IEnumerable