Merge branch 'master' into new-netcode
Conflicts: Subsurface/Properties/AssemblyInfo.cs
This commit is contained in:
@@ -21,12 +21,12 @@ namespace Barotrauma
|
||||
public Vector2 CenterPosition;
|
||||
|
||||
public Vector2 TitlePosition;
|
||||
|
||||
private float? loadState;
|
||||
|
||||
private float? loadState;
|
||||
#if !LINUX
|
||||
Video splashScreenVideo;
|
||||
VideoPlayer videoPlayer;
|
||||
|
||||
#endif
|
||||
public Vector2 TitleSize
|
||||
{
|
||||
get { return new Vector2(titleTexture.Width, titleTexture.Height); }
|
||||
@@ -56,19 +56,23 @@ namespace Barotrauma
|
||||
|
||||
public LoadingScreen(GraphicsDevice graphics)
|
||||
{
|
||||
#if !LINUX
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
backgroundTexture = TextureLoader.FromFile("Content/UI/titleBackground.png");
|
||||
monsterTexture = TextureLoader.FromFile("Content/UI/titleMonster.png");
|
||||
@@ -82,6 +86,7 @@ namespace Barotrauma
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch, GraphicsDevice graphics, float deltaTime)
|
||||
{
|
||||
#if !LINUX
|
||||
if (GameMain.Config.EnableSplashScreen && splashScreenVideo != null)
|
||||
{
|
||||
try
|
||||
@@ -96,6 +101,7 @@ namespace Barotrauma
|
||||
GameMain.Config.EnableSplashScreen = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
drawn = true;
|
||||
|
||||
@@ -171,6 +177,7 @@ namespace Barotrauma
|
||||
|
||||
}
|
||||
|
||||
#if !LINUX
|
||||
private void DrawSplashScreen(SpriteBatch spriteBatch)
|
||||
{
|
||||
if (videoPlayer == null)
|
||||
@@ -206,6 +213,7 @@ namespace Barotrauma
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool drawn;
|
||||
public IEnumerable<object> DoLoading(IEnumerable<object> loader)
|
||||
|
||||
@@ -241,7 +241,9 @@ namespace Barotrauma
|
||||
while (!SoundPlayer.Initialized)
|
||||
{
|
||||
i++;
|
||||
TitleScreen.LoadState = Math.Min((float)TitleScreen.LoadState + 0.5f*i, 70.0f);
|
||||
TitleScreen.LoadState = SoundPlayer.SoundCount == 0 ?
|
||||
30.0f :
|
||||
Math.Min(30.0f + 40.0f * i / Math.Max(SoundPlayer.SoundCount, 1), 70.0f);
|
||||
yield return CoroutineStatus.Running;
|
||||
}
|
||||
|
||||
|
||||
@@ -303,7 +303,7 @@ namespace Barotrauma.Tutorials
|
||||
foreach (Structure s in Structure.WallList)
|
||||
{
|
||||
if (s.CastShadow || !s.HasBody) continue;
|
||||
|
||||
|
||||
if (s.Rect.Right > steering.Item.CurrentHull.Rect.Right) windows.Add(s);
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ namespace Barotrauma.Tutorials
|
||||
}
|
||||
if (broken) break;
|
||||
}
|
||||
|
||||
if (broken) break;
|
||||
|
||||
yield return CoroutineStatus.Running;
|
||||
} while (!broken);
|
||||
@@ -459,8 +459,6 @@ namespace Barotrauma.Tutorials
|
||||
yield return CoroutineStatus.Running;
|
||||
}
|
||||
|
||||
moloch.AnimController.SetPosition(ConvertUnits.ToSimUnits(Character.Controlled.WorldPosition + Vector2.UnitY * 600.0f));
|
||||
|
||||
infoBox = CreateInfoFrame("Now we're ready to shoot! Select the railgun controller.");
|
||||
|
||||
while (Character.Controlled.SelectedConstruction == null || Character.Controlled.SelectedConstruction.Name != "Railgun Controller")
|
||||
@@ -468,11 +466,18 @@ namespace Barotrauma.Tutorials
|
||||
yield return CoroutineStatus.Running;
|
||||
}
|
||||
|
||||
moloch.AnimController.SetPosition(ConvertUnits.ToSimUnits(Character.Controlled.WorldPosition + Vector2.UnitY * 600.0f));
|
||||
|
||||
infoBox = CreateInfoFrame("Use the right mouse button to aim and wait for the creature to come closer. When you're ready to shoot, "
|
||||
+ "press the left mouse button.");
|
||||
|
||||
while (!moloch.IsDead)
|
||||
{
|
||||
if (moloch.WorldPosition.Y > Character.Controlled.WorldPosition.Y + 600.0f)
|
||||
{
|
||||
moloch.AIController.SteeringManager.SteeringManual(CoroutineManager.DeltaTime, Character.Controlled.WorldPosition - moloch.WorldPosition);
|
||||
}
|
||||
|
||||
moloch.AIController.SelectTarget(Character.Controlled.AiTarget);
|
||||
yield return CoroutineStatus.Running;
|
||||
}
|
||||
|
||||
@@ -272,11 +272,7 @@ namespace Barotrauma.Items.Components
|
||||
dir = dir == Direction.Left ? Direction.Right : Direction.Left;
|
||||
}
|
||||
|
||||
if (userPos.X != 0.0f)
|
||||
{
|
||||
float diff = (item.Rect.X + UserPos.X) - item.Rect.Center.X;
|
||||
userPos.X = item.Rect.Center.X - diff - item.Rect.X;
|
||||
}
|
||||
userPos.X = -UserPos.X;
|
||||
|
||||
for (int i = 0; i < limbPositions.Count; i++)
|
||||
{
|
||||
|
||||
@@ -263,6 +263,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
var request = new RestRequest("masterserver3.php", Method.GET);
|
||||
request.AddParameter("action", "refreshserver");
|
||||
request.AddParameter("serverport", Port);
|
||||
request.AddParameter("gamestarted", gameStarted ? 1 : 0);
|
||||
request.AddParameter("currplayers", connectedClients.Count);
|
||||
request.AddParameter("maxplayers", config.MaximumConnections);
|
||||
@@ -1889,6 +1890,7 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
var request = new RestRequest("masterserver2.php", Method.GET);
|
||||
request.AddParameter("action", "removeserver");
|
||||
request.AddParameter("serverport", Port);
|
||||
|
||||
restClient.Execute(request);
|
||||
restClient = null;
|
||||
|
||||
@@ -188,6 +188,7 @@ namespace Barotrauma.Networking
|
||||
if (radio == null || !sender.HasEquippedItem(radio)) return false;
|
||||
|
||||
var radioComponent = radio.GetComponent<WifiComponent>();
|
||||
if (radioComponent == null) return false;
|
||||
return radioComponent.HasRequiredContainedItems(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -564,7 +564,7 @@ namespace Barotrauma
|
||||
{
|
||||
//if there are more than 2 positions in the buffer,
|
||||
//increase the interpolation speed to catch up with the server
|
||||
float speedMultiplier = 0.9f + (float)Math.Pow((positionBuffer.Count - 2) / 5.0f, 2.0f);
|
||||
float speedMultiplier = (float)Math.Pow(1.0f + (positionBuffer.Count - 2) / 10.0f, 2.0f);
|
||||
|
||||
netInterpolationState += (deltaTime * speedMultiplier) / (next.Timestamp - prev.Timestamp);
|
||||
|
||||
|
||||
@@ -215,8 +215,17 @@ namespace Barotrauma
|
||||
|
||||
if (GameMain.GameSession != null) GameMain.GameSession.Draw(spriteBatch);
|
||||
|
||||
if (Character.Controlled == null && Submarine.MainSub != null && !GUI.DisableHUD)
|
||||
DrawSubmarineIndicator(spriteBatch, Submarine.MainSub);
|
||||
if (Character.Controlled == null && !GUI.DisableHUD)
|
||||
{
|
||||
for (int i = 0; i < Submarine.MainSubs.Length; i++)
|
||||
{
|
||||
if (Submarine.MainSubs[i] != null)
|
||||
{
|
||||
Color indicatorColor = i == 0 ? Color.LightBlue * 0.5f : Color.Red * 0.5f;
|
||||
DrawSubmarineIndicator(spriteBatch, Submarine.MainSubs[i], indicatorColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GUI.Draw((float)deltaTime, spriteBatch, cam);
|
||||
|
||||
@@ -435,7 +444,7 @@ namespace Barotrauma
|
||||
|
||||
}
|
||||
|
||||
private void DrawSubmarineIndicator(SpriteBatch spriteBatch, Submarine submarine)
|
||||
private void DrawSubmarineIndicator(SpriteBatch spriteBatch, Submarine submarine, Color color)
|
||||
{
|
||||
Vector2 subDiff = submarine.WorldPosition - cam.WorldViewCenter;
|
||||
|
||||
@@ -447,11 +456,11 @@ namespace Barotrauma
|
||||
cam.WorldToScreen(cam.WorldViewCenter) +
|
||||
new Vector2(normalizedSubDiff.X * GameMain.GraphicsWidth * 0.4f, -normalizedSubDiff.Y * GameMain.GraphicsHeight * 0.4f);
|
||||
|
||||
GUI.SubmarineIcon.Draw(spriteBatch, iconPos, Color.LightBlue * 0.5f);
|
||||
GUI.SubmarineIcon.Draw(spriteBatch, iconPos, color);
|
||||
|
||||
Vector2 arrowOffset = normalizedSubDiff * GUI.SubmarineIcon.size.X * 0.7f;
|
||||
arrowOffset.Y = -arrowOffset.Y;
|
||||
GUI.Arrow.Draw(spriteBatch, iconPos + arrowOffset, Color.LightBlue * 0.5f, MathUtils.VectorToAngle(arrowOffset) + MathHelper.PiOver2);
|
||||
GUI.Arrow.Draw(spriteBatch, iconPos + arrowOffset, color, MathUtils.VectorToAngle(arrowOffset) + MathHelper.PiOver2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,11 +90,18 @@ namespace Barotrauma
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public static int SoundCount;
|
||||
|
||||
public static IEnumerable<object> Init()
|
||||
{
|
||||
OverrideMusicType = null;
|
||||
|
||||
XDocument doc = ToolBox.TryLoadXml("Content/Sounds/sounds.xml");
|
||||
if (doc == null) yield return CoroutineStatus.Failure;
|
||||
|
||||
SoundCount = 16 + doc.Root.Elements().Count();
|
||||
|
||||
startDrone = Sound.Load("Content/Sounds/startDrone.ogg", false);
|
||||
startDrone.Play();
|
||||
|
||||
@@ -116,12 +123,7 @@ namespace Barotrauma
|
||||
SplashSounds[i] = Sound.Load("Content/Sounds/Water/Splash"+(i)+".ogg", false);
|
||||
yield return CoroutineStatus.Running;
|
||||
}
|
||||
|
||||
XDocument doc = ToolBox.TryLoadXml("Content/Sounds/sounds.xml");
|
||||
if (doc == null) yield return CoroutineStatus.Failure;
|
||||
|
||||
yield return CoroutineStatus.Running;
|
||||
|
||||
|
||||
var xMusic = doc.Root.Elements("music").ToList();
|
||||
|
||||
if (xMusic.Any())
|
||||
@@ -178,8 +180,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
miscSounds = miscSoundList.ToLookup(kvp => kvp.Key, kvp => kvp.Value);
|
||||
|
||||
miscSounds = miscSoundList.ToLookup(kvp => kvp.Key, kvp => kvp.Value);
|
||||
|
||||
Initialized = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user