diff --git a/Subsurface/Source/Camera.cs b/Subsurface/Source/Camera.cs index 372c66ee8..922e7d2f4 100644 --- a/Subsurface/Source/Camera.cs +++ b/Subsurface/Source/Camera.cs @@ -165,7 +165,7 @@ namespace Barotrauma } } - public void MoveCamera(float deltaTime) + public void MoveCamera(float deltaTime, bool allowMove = true, bool allowZoom = true) { prevPosition = position; prevZoom = zoom; @@ -175,7 +175,7 @@ namespace Barotrauma Vector2 moveCam = Vector2.Zero; if (targetPos == Vector2.Zero) { - if (GUIComponent.KeyboardDispatcher.Subscriber == null) + if (allowMove && GUIComponent.KeyboardDispatcher.Subscriber == null) { if (PlayerInput.KeyDown(Keys.LeftShift)) moveSpeed *= 2.0f; if (PlayerInput.KeyDown(Keys.LeftControl)) moveSpeed *= 0.5f; @@ -197,11 +197,14 @@ namespace Barotrauma moveCam = moveCam * deltaTime * 60.0f; - Vector2 mouseInWorld = ScreenToWorld(PlayerInput.MousePosition); - Vector2 diffViewCenter; - diffViewCenter = ((mouseInWorld - Position) * Zoom); - Zoom = MathHelper.Clamp(zoom + (PlayerInput.ScrollWheelSpeed / 1000.0f) * zoom, GameMain.DebugDraw ? 0.01f : 0.1f, 2.0f); - if (!PlayerInput.KeyDown(Keys.F)) Position = mouseInWorld - (diffViewCenter / Zoom); + if (allowZoom) + { + Vector2 mouseInWorld = ScreenToWorld(PlayerInput.MousePosition); + Vector2 diffViewCenter; + diffViewCenter = ((mouseInWorld - Position) * Zoom); + Zoom = MathHelper.Clamp(zoom + (PlayerInput.ScrollWheelSpeed / 1000.0f) * zoom, GameMain.DebugDraw ? 0.01f : 0.1f, 2.0f); + if (!PlayerInput.KeyDown(Keys.F)) Position = mouseInWorld - (diffViewCenter / Zoom); + } } else { diff --git a/Subsurface/Source/Screens/EditMapScreen.cs b/Subsurface/Source/Screens/EditMapScreen.cs index 025f050c4..93e9ebc79 100644 --- a/Subsurface/Source/Screens/EditMapScreen.cs +++ b/Subsurface/Source/Screens/EditMapScreen.cs @@ -304,19 +304,15 @@ namespace Barotrauma if (Submarine.MainSub != null) { cam.Position = Submarine.MainSub.Position + Submarine.MainSub.HiddenSubPosition; - //nameBox.Text = Submarine.MainSub.Name; - //descriptionBox.Text = ToolBox.LimitString(Submarine.MainSub.Description, 15); } else { cam.Position = Submarine.HiddenSubStartPosition; - //if (nameBox != null) nameBox.Text = ""; - //descriptionBox.Text = ""; Submarine.MainSub = new Submarine(Path.Combine(Submarine.SavePath, "Unnamed.sub"), "", false); } - //nameBox.Deselect(); + SoundPlayer.OverrideMusicType = "none"; cam.UpdateTransform(); } @@ -335,6 +331,8 @@ namespace Barotrauma if (wiringMode) ToggleWiringMode(); + SoundPlayer.OverrideMusicType = null; + if (dummyCharacter != null) { dummyCharacter.Remove(); @@ -843,7 +841,11 @@ namespace Barotrauma string name = ToolBox.LimitString(mapEntityPrefab.Name,15); - var textBlock = new GUITextBlock(new Rectangle(0,0,0,15), name, GUI.Style, previouslyUsedList); + var textBlock = new GUITextBlock( + new Rectangle(0,0,0,10), + ToolBox.LimitString(name, GUI.SmallFont, previouslyUsedList.Rect.Width), + GUI.Style, previouslyUsedList, GUI.SmallFont); + textBlock.UserData = mapEntityPrefab; previouslyUsedList.RemoveChild(textBlock); @@ -903,7 +905,7 @@ namespace Barotrauma hullVolumeFrame.Visible = MapEntity.SelectedList.Any(s => s is Hull); - cam.MoveCamera((float)deltaTime); + cam.MoveCamera((float)deltaTime, true, GUIComponent.MouseOn == null); if (characterMode || wiringMode) { diff --git a/Subsurface/Source/Sounds/SoundPlayer.cs b/Subsurface/Source/Sounds/SoundPlayer.cs index 9053d899e..2854f2e17 100644 --- a/Subsurface/Source/Sounds/SoundPlayer.cs +++ b/Subsurface/Source/Sounds/SoundPlayer.cs @@ -247,7 +247,11 @@ namespace Barotrauma List suitableMusic = GetSuitableMusicClips(); - if (suitableMusic.Count > 0 && !suitableMusic.Contains(currentMusic)) + if (suitableMusic.Count == 0) + { + targetMusic = null; + } + else if (!suitableMusic.Contains(currentMusic)) { int index = Rand.Int(suitableMusic.Count);