Merge branch 'master' into new-netcode

Conflicts:
	Subsurface/Source/Characters/Character.cs
	Subsurface/Source/GUI/GUI.cs
	Subsurface/Source/GUI/LoadingScreen.cs
This commit is contained in:
Regalis
2017-02-13 22:04:28 +02:00
17 changed files with 137 additions and 17 deletions

View File

@@ -1049,6 +1049,9 @@
<Content Include="Content\UI\uiIcons.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\utg_4.mp4">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\waterbump.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@@ -1648,6 +1651,9 @@
<None Include="Content\Sounds\Water\WaterAmbience1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\utg_4.xnb">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\watershader.xnb">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

View File

@@ -49,3 +49,8 @@
/processorParam:DebugMode=Auto
/build:damageshader.fx
#begin utg_4.mp4
/importer:H264Importer
/processor:VideoProcessor
/build:utg_4.mp4

Binary file not shown.

Binary file not shown.

View File

@@ -7,6 +7,8 @@ namespace Barotrauma
{
public class Camera
{
public static bool FollowSub = true;
const float DefaultZoom = 1.0f;
const float ZoomSmoothness = 8.0f;
const float MoveSmoothness = 8.0f;
@@ -186,7 +188,7 @@ namespace Barotrauma
if (GameMain.Config.KeyBind(InputType.Up).IsDown()) moveCam.Y += moveSpeed;
}
if (Screen.Selected == GameMain.GameScreen)
if (Screen.Selected == GameMain.GameScreen && FollowSub)
{
var closestSub = Submarine.FindClosest(WorldViewCenter);
if (closestSub != null)

View File

@@ -1588,6 +1588,8 @@ namespace Barotrauma
Vector2 closestItemPos = closestItem != null ? closestItem.DrawPosition : Vector2.Zero;
closestItemPos.Y = -closestItemPos.Y;
GUI.DrawLine(spriteBatch, closestItemPos - new Vector2(0, 5), closestItemPos + new Vector2(0, 5), Color.Lime, 0, 10);
if (this == controlled || GUI.DisableHUD) return;
Vector2 pos = DrawPosition;
pos.Y = -pos.Y;
@@ -1601,7 +1603,6 @@ namespace Barotrauma
if (this == controlled) return;
if (info != null)
{
Vector2 namePos = new Vector2(pos.X, pos.Y - 110.0f - (5.0f / cam.Zoom)) - GUI.Font.MeasureString(Info.Name) * 0.5f / cam.Zoom;

View File

@@ -34,6 +34,8 @@ namespace Barotrauma
public static void AddToGUIUpdateList(Character character)
{
if (GUI.DisableHUD) return;
if (cprButton != null && cprButton.Visible) cprButton.AddToGUIUpdateList();
if (suicideButton != null && suicideButton.Visible) suicideButton.AddToGUIUpdateList();
@@ -118,6 +120,8 @@ namespace Barotrauma
damageOverlay = new Sprite("Content/UI/damageOverlay.png", Vector2.Zero);
}
if (GUI.DisableHUD) return;
if (character.Inventory != null)
{
for (int i = 0; i < character.Inventory.Items.Length - 1; i++)

View File

@@ -510,6 +510,12 @@ namespace Barotrauma
Submarine.MainSub.GodMode = !Submarine.MainSub.GodMode;
break;
case "lockx":
Submarine.LockX = !Submarine.LockX;
break;
case "locky":
Submarine.LockY = !Submarine.LockY;
break;
case "dumpids":
try
{
@@ -683,6 +689,14 @@ namespace Barotrauma
case "debugdraw":
GameMain.DebugDraw = !GameMain.DebugDraw;
break;
case "disablehud":
case "hud":
GUI.DisableHUD = !GUI.DisableHUD;
GameMain.Instance.IsMouseVisible = !GameMain.Instance.IsMouseVisible;
break;
case "followsub":
Camera.FollowSub = !Camera.FollowSub;
break;
case "drawaitargets":
case "showaitargets":
AITarget.ShowAITargets = !AITarget.ShowAITargets;

View File

@@ -64,6 +64,8 @@ namespace Barotrauma
get { return arrow; }
}
public static bool DisableHUD;
public static void Init(ContentManager content)
{
Font = ToolBox.TryLoadFont("SpriteFont1", content);
@@ -497,8 +499,9 @@ namespace Barotrauma
DebugConsole.Draw(spriteBatch);
if (GUIComponent.MouseOn != null && !string.IsNullOrWhiteSpace(GUIComponent.MouseOn.ToolTip)) GUIComponent.MouseOn.DrawToolTip(spriteBatch);
cursor.Draw(spriteBatch, PlayerInput.LatestMousePosition);
if (!GUI.DisableHUD)
cursor.Draw(spriteBatch, PlayerInput.LatestMousePosition);
}
public static void AddToGUIUpdateList()

View File

@@ -1,6 +1,7 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -23,6 +24,9 @@ namespace Barotrauma
private float? loadState;
Video splashScreenVideo;
VideoPlayer videoPlayer;
public Vector2 TitleSize
{
get { return new Vector2(titleTexture.Width, titleTexture.Height); }
@@ -49,10 +53,23 @@ namespace Barotrauma
get;
set;
}
public LoadingScreen(GraphicsDevice graphics)
{
if (GameMain.Config.EnableSplashScreen)
{
try
{
splashScreenVideo = GameMain.Instance.Content.Load<Video>("utg_4");
}
catch (Exception e)
{
DebugConsole.ThrowError("Failed to load splashscreen", e);
GameMain.Config.EnableSplashScreen = false;
}
}
backgroundTexture = TextureLoader.FromFile("Content/UI/titleBackground.png");
monsterTexture = TextureLoader.FromFile("Content/UI/titleMonster.png");
titleTexture = TextureLoader.FromFile("Content/UI/titleText.png");
@@ -65,6 +82,21 @@ namespace Barotrauma
public void Draw(SpriteBatch spriteBatch, GraphicsDevice graphics, float deltaTime)
{
if (GameMain.Config.EnableSplashScreen && splashScreenVideo != null)
{
try
{
DrawSplashScreen(spriteBatch);
if (videoPlayer != null && videoPlayer.State == MediaState.Playing)
return;
}
catch (Exception e)
{
DebugConsole.ThrowError("Playing splash screen video failed", e);
GameMain.Config.EnableSplashScreen = false;
}
}
drawn = true;
graphics.SetRenderTarget(renderTarget);
@@ -139,14 +171,42 @@ namespace Barotrauma
}
/*public void Update()
private void DrawSplashScreen(SpriteBatch spriteBatch)
{
if (Hull.renderer != null)
if (videoPlayer == null)
{
Hull.renderer.ScrollWater();
videoPlayer = new VideoPlayer();
videoPlayer.Play(splashScreenVideo);
}
}*/
else
{
Texture2D videoTexture = null;
if (videoPlayer.State == MediaState.Stopped)
{
videoPlayer.Dispose();
videoPlayer = null;
splashScreenVideo.Dispose();
splashScreenVideo = null;
}
else
{
videoTexture = videoPlayer.GetTexture();
spriteBatch.Begin();
spriteBatch.Draw(videoTexture, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
spriteBatch.End();
if (PlayerInput.KeyHit(Keys.Space) || PlayerInput.KeyHit(Keys.Enter) || PlayerInput.LeftButtonDown())
{
videoPlayer.Stop();
}
}
}
}
bool drawn;
public IEnumerable<object> DoLoading(IEnumerable<object> loader)
{

View File

@@ -183,7 +183,7 @@ namespace Barotrauma
public override void Draw(SpriteBatch spriteBatch)
{
if (!isRunning) return;
if (!isRunning|| GUI.DisableHUD) return;
CrewManager.Draw(spriteBatch);
@@ -228,7 +228,7 @@ namespace Barotrauma
public override void Update(float deltaTime)
{
if (!isRunning) return;
if (!isRunning || GUI.DisableHUD) return;
base.Update(deltaTime);

View File

@@ -376,6 +376,8 @@ namespace Barotrauma
public void Update(float deltaTime)
{
TaskManager.Update(deltaTime);
if (GUI.DisableHUD) return;
//guiRoot.Update(deltaTime);
infoButton.Update(deltaTime);
@@ -387,6 +389,8 @@ namespace Barotrauma
public void Draw(SpriteBatch spriteBatch)
{
if (GUI.DisableHUD) return;
infoButton.Draw(spriteBatch);
if (gameMode != null) gameMode.Draw(spriteBatch);

View File

@@ -62,6 +62,8 @@ namespace Barotrauma
public static bool VerboseLogging { get; set; }
public bool EnableSplashScreen { get; set; }
public bool UnsavedSettings
{
get
@@ -154,6 +156,8 @@ namespace Barotrauma
VerboseLogging = ToolBox.GetAttributeBool(doc.Root, "verboselogging", false);
EnableSplashScreen = ToolBox.GetAttributeBool(doc.Root, "enablesplashscreen", true);
keyMapping = new KeyOrMouse[Enum.GetNames(typeof(InputType)).Length];
keyMapping[(int)InputType.Up] = new KeyOrMouse(Keys.W);
keyMapping[(int)InputType.Down] = new KeyOrMouse(Keys.S);
@@ -236,7 +240,8 @@ namespace Barotrauma
new XAttribute("autocheckupdates", AutoCheckUpdates),
new XAttribute("musicvolume", musicVolume),
new XAttribute("soundvolume", soundVolume),
new XAttribute("verboselogging", VerboseLogging));
new XAttribute("verboselogging", VerboseLogging),
new XAttribute("enablesplashscreen", EnableSplashScreen));
if (WasGameUpdated)
{

View File

@@ -348,8 +348,16 @@ namespace Barotrauma
{
lightSource.Remove();
if (basicSoundIndex > -1) Sounds.SoundManager.Stop(basicSoundIndex);
if (largeSoundIndex > -1) Sounds.SoundManager.Stop(largeSoundIndex);
if (basicSoundIndex > -1)
{
Sounds.SoundManager.Stop(basicSoundIndex);
basicSoundIndex = -1;
}
if (largeSoundIndex > -1)
{
Sounds.SoundManager.Stop(largeSoundIndex);
largeSoundIndex = -1;
}
hull.RemoveFire(this);
}

View File

@@ -49,6 +49,8 @@ namespace Barotrauma
private set;
}
public static bool LockX, LockY;
public static List<Submarine> SavedSubmarines = new List<Submarine>();
public static readonly Vector2 GridSize = new Vector2(16.0f, 16.0f);
@@ -754,6 +756,11 @@ namespace Barotrauma
if (Level.Loaded == null) return;
if (subBody == null) return;
subBody.Body.LinearVelocity = new Vector2(
LockX ? 0.0f : subBody.Body.LinearVelocity.X,
LockY ? 0.0f : subBody.Body.LinearVelocity.Y);
subBody.Update(deltaTime);

View File

@@ -264,11 +264,11 @@ namespace Barotrauma
{
//only save
// - if the attribute is saveable and it's different from the default value
// - or can be changed in the editor
// - or can be changed in-game or in the editor
bool save = false;
foreach (var attribute in property.Attributes.OfType<HasDefaultValue>())
{
if ((!attribute.isSaveable && !attribute.defaultValue.Equals(value)) ||
if ((attribute.isSaveable && !attribute.defaultValue.Equals(value)) ||
property.Attributes.OfType<Editable>().Any())
{
save = true;

View File

@@ -215,7 +215,8 @@ namespace Barotrauma
if (GameMain.GameSession != null) GameMain.GameSession.Draw(spriteBatch);
if (Character.Controlled == null && Submarine.MainSub != null) DrawSubmarineIndicator(spriteBatch, Submarine.MainSub);
if (Character.Controlled == null && Submarine.MainSub != null && !GUI.DisableHUD)
DrawSubmarineIndicator(spriteBatch, Submarine.MainSub);
GUI.Draw((float)deltaTime, spriteBatch, cam);