From 19d3d793e757fd7e90c6fc1e442b7d09b5042778 Mon Sep 17 00:00:00 2001 From: Regalis Date: Sat, 13 Aug 2016 18:26:40 +0300 Subject: [PATCH] Artifacts don't have to be inside the main sub when exiting, gap particle positioning bugfix, waypoints that aren't inside a hull are displayed in blue (easier to spot waypoint issues), a warning is displayed if trying to choose a shuttle as the submarine in SP, random sub selection in MP ignores shuttles --- Subsurface/Content/Items/MiniMap/item.xml | 2 -- .../Source/Events/Missions/SalvageMission.cs | 2 +- Subsurface/Source/GUI/GUIListBox.cs | 4 +-- Subsurface/Source/Map/Gap.cs | 3 +- Subsurface/Source/Map/WayPoint.cs | 5 +-- Subsurface/Source/Screens/EditMapScreen.cs | 4 +-- Subsurface/Source/Screens/MainMenuScreen.cs | 36 ++++++++++++++++--- Subsurface/Source/Screens/NetLobbyScreen.cs | 6 +++- Subsurface/Source/Screens/ServerListScreen.cs | 3 +- 9 files changed, 48 insertions(+), 17 deletions(-) diff --git a/Subsurface/Content/Items/MiniMap/item.xml b/Subsurface/Content/Items/MiniMap/item.xml index a5cb84fb9..0d6cee66a 100644 --- a/Subsurface/Content/Items/MiniMap/item.xml +++ b/Subsurface/Content/Items/MiniMap/item.xml @@ -6,8 +6,6 @@ - - diff --git a/Subsurface/Source/Events/Missions/SalvageMission.cs b/Subsurface/Source/Events/Missions/SalvageMission.cs index e0309ea79..5751ee291 100644 --- a/Subsurface/Source/Events/Missions/SalvageMission.cs +++ b/Subsurface/Source/Events/Missions/SalvageMission.cs @@ -78,7 +78,7 @@ namespace Barotrauma public override void End() { - if (item.CurrentHull == null || item.Removed) return; + if (item.CurrentHull == null || !item.CurrentHull.Submarine.AtEndPosition || item.Removed) return; item.Remove(); GiveReward(); diff --git a/Subsurface/Source/GUI/GUIListBox.cs b/Subsurface/Source/GUI/GUIListBox.cs index 0573a458c..21fc2f8ca 100644 --- a/Subsurface/Source/GUI/GUIListBox.cs +++ b/Subsurface/Source/GUI/GUIListBox.cs @@ -172,11 +172,11 @@ namespace Barotrauma scrollBar.BarScroll = 0.0f; } - public void Select(object selection, bool force = false) + public void Select(object userData, bool force = false) { for (int i = 0; i < children.Count; i++) { - if (!children[i].UserData.Equals(selection)) continue; + if (!children[i].UserData.Equals(userData)) continue; Select(i, force); diff --git a/Subsurface/Source/Map/Gap.cs b/Subsurface/Source/Map/Gap.cs index 7c266cac7..c1388b78b 100644 --- a/Subsurface/Source/Map/Gap.cs +++ b/Subsurface/Source/Map/Gap.cs @@ -259,7 +259,6 @@ namespace Barotrauma particle.Size = particle.Size * Math.Min(Math.Abs(flowForce.X / 1000.0f), 5.0f); } - if (Math.Abs(flowForce.X) > 300.0f) { pos.X += Math.Sign(flowForce.X) * 10.0f; @@ -387,7 +386,7 @@ namespace Barotrauma else if (dir == 1) { if (!(hull1.Volume > 0.0f)) return; - //lowerSurface = hull2.Surface - hull2.WaveY[1]; + lowerSurface = hull2.Surface - hull2.WaveY[hull2.WaveY.Length - 1]; flowTargetHull = hull2; diff --git a/Subsurface/Source/Map/WayPoint.cs b/Subsurface/Source/Map/WayPoint.cs index 715f71e15..3c8eeb2c1 100644 --- a/Subsurface/Source/Map/WayPoint.cs +++ b/Subsurface/Source/Map/WayPoint.cs @@ -133,9 +133,10 @@ namespace Barotrauma if (Submarine!=null) drawPos += Submarine.DrawPosition; drawPos.Y = -drawPos.Y; - Color clr = (isSelected) ? Color.Red : Color.White; + Color clr = currentHull == null ? Color.Blue : Color.White; + if (isSelected) clr = Color.Red; if (isHighlighted) clr = Color.DarkRed; - + int iconX = iconIndices[(int)spawnType]*IconSize % iconTexture.Width; int iconY = (int)(Math.Floor(iconIndices[(int)spawnType]*IconSize / (float)iconTexture.Width))*IconSize; diff --git a/Subsurface/Source/Screens/EditMapScreen.cs b/Subsurface/Source/Screens/EditMapScreen.cs index b33aac9b0..5d267449c 100644 --- a/Subsurface/Source/Screens/EditMapScreen.cs +++ b/Subsurface/Source/Screens/EditMapScreen.cs @@ -454,9 +454,9 @@ namespace Barotrauma { GUITextBlock textBlock = new GUITextBlock( new Rectangle(0, 0, 0, 25), - sub.Name, + ToolBox.LimitString(sub.Name, GUI.Font, subList.Rect.Width - 80), GUI.Style, - Alignment.Left, Alignment.CenterY | Alignment.Right, subList); + Alignment.Left, Alignment.CenterY | Alignment.Left, subList); textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f); textBlock.UserData = sub; textBlock.ToolTip = sub.FilePath; diff --git a/Subsurface/Source/Screens/MainMenuScreen.cs b/Subsurface/Source/Screens/MainMenuScreen.cs index 86e0741d1..15512548f 100644 --- a/Subsurface/Source/Screens/MainMenuScreen.cs +++ b/Subsurface/Source/Screens/MainMenuScreen.cs @@ -108,6 +108,8 @@ namespace Barotrauma if (sub.HasTag(SubmarineTag.Shuttle)) { + textBlock.TextColor = textBlock.TextColor * 0.85f; + var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "Shuttle", GUI.Style, Alignment.Left, Alignment.CenterY | Alignment.Right, textBlock, false, GUI.SmallFont); shuttleText.TextColor = textBlock.TextColor * 0.8f; } @@ -129,7 +131,29 @@ namespace Barotrauma button = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", Alignment.BottomRight, GUI.Style, menuTabs[(int)Tab.NewGame]); - button.OnClicked = StartGame; + button.OnClicked = (GUIButton btn, object userData) => + { + 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"}); + + msgBox.Buttons[0].OnClicked = StartGame; + msgBox.Buttons[0].OnClicked += msgBox.Close; + + msgBox.Buttons[1].OnClicked = msgBox.Close; + return false; + } + + StartGame(btn, userData); + + return true; + }; + + // Submarine selectedSub = subList.SelectedData as Submarine; //---------------------------------------------------------------------- @@ -485,7 +509,7 @@ namespace Barotrauma spriteBatch.End(); } - private bool StartGame(GUIButton button, object obj) + private bool StartGame(GUIButton button, object userData) { if (string.IsNullOrEmpty(saveNameBox.Text)) return false; @@ -498,8 +522,12 @@ namespace Barotrauma } Submarine selectedSub = subList.SelectedData as Submarine; - if (selectedSub == null) return false; - + if (selectedSub == null) + { + new GUIMessageBox("Submarine not selected", "Please select a submarine"); + return false; + } + if (!Directory.Exists(SaveUtil.TempPath)) { Directory.CreateDirectory(SaveUtil.TempPath); diff --git a/Subsurface/Source/Screens/NetLobbyScreen.cs b/Subsurface/Source/Screens/NetLobbyScreen.cs index c505567eb..a5ecaaa8d 100644 --- a/Subsurface/Source/Screens/NetLobbyScreen.cs +++ b/Subsurface/Source/Screens/NetLobbyScreen.cs @@ -423,7 +423,11 @@ namespace Barotrauma GameMain.Server.Voting.ResetVotes(GameMain.Server.ConnectedClients); if (GameMain.Server.RandomizeSeed) LevelSeed = ToolBox.RandomSeed(8); - if (GameMain.Server.SubSelectionMode == SelectionMode.Random) subList.Select(Rand.Range(0,subList.CountChildren)); + if (GameMain.Server.SubSelectionMode == SelectionMode.Random) + { + var nonShuttles = subList.children.FindAll(c => c.UserData is Submarine && !((Submarine)c.UserData).HasTag(SubmarineTag.Shuttle)); + subList.Select(nonShuttles[Rand.Range(0, nonShuttles.Count)].UserData); + } if (GameMain.Server.ModeSelectionMode == SelectionMode.Random) modeList.Select(Rand.Range(0, modeList.CountChildren)); } else if (GameMain.Client != null) diff --git a/Subsurface/Source/Screens/ServerListScreen.cs b/Subsurface/Source/Screens/ServerListScreen.cs index 00d464ed9..6380ffd5c 100644 --- a/Subsurface/Source/Screens/ServerListScreen.cs +++ b/Subsurface/Source/Screens/ServerListScreen.cs @@ -352,7 +352,8 @@ namespace Barotrauma { graphics.Clear(Color.CornflowerBlue); - GameMain.GameScreen.DrawMap(graphics, spriteBatch); + GameMain.TitleScreen.DrawLoadingText = false; + GameMain.TitleScreen.Draw(spriteBatch, graphics, (float)deltaTime); spriteBatch.Begin();