diff --git a/Subsurface/Content/Items/Weapons/weapons.xml b/Subsurface/Content/Items/Weapons/weapons.xml index 486ba31d5..b4a5ff050 100644 --- a/Subsurface/Content/Items/Weapons/weapons.xml +++ b/Subsurface/Content/Items/Weapons/weapons.xml @@ -67,8 +67,8 @@ - + diff --git a/Subsurface/Source/Characters/AI/EnemyAIController.cs b/Subsurface/Source/Characters/AI/EnemyAIController.cs index 58b4242eb..e1b237122 100644 --- a/Subsurface/Source/Characters/AI/EnemyAIController.cs +++ b/Subsurface/Source/Characters/AI/EnemyAIController.cs @@ -518,8 +518,8 @@ namespace Barotrauma if (wallAttack) { - message.WriteRangedSingle(wallAttackPos.X, -50.0f, 50.0f, 10); - message.WriteRangedSingle(wallAttackPos.Y, -50.0f, 50.0f, 10); + message.WriteRangedSingle(MathHelper.Clamp(wallAttackPos.X, -50.0f, 50.0f), -50.0f, 50.0f, 10); + message.WriteRangedSingle(MathHelper.Clamp(wallAttackPos.Y, -50.0f, 50.0f), -50.0f, 50.0f, 10); } //message.Write(Velocity.X); diff --git a/Subsurface/Source/Characters/AICharacter.cs b/Subsurface/Source/Characters/AICharacter.cs index 57f0d9e38..2f265fe20 100644 --- a/Subsurface/Source/Characters/AICharacter.cs +++ b/Subsurface/Source/Characters/AICharacter.cs @@ -95,10 +95,10 @@ namespace Barotrauma { if (limb.ignoreCollisions) continue; - if (limb.SimPosition.Length() > NetConfig.AllowedRagdollDistance) return false; + if (limb.SimPosition.Length() > NetConfig.CharacterIgnoreDistance) return false; - message.WriteRangedSingle(limb.body.SimPosition.X, -NetConfig.AllowedRagdollDistance, NetConfig.AllowedRagdollDistance, 16); - message.WriteRangedSingle(limb.body.SimPosition.Y, -NetConfig.AllowedRagdollDistance, NetConfig.AllowedRagdollDistance, 16); + message.WriteRangedSingle(limb.body.SimPosition.X, -NetConfig.CharacterIgnoreDistance, NetConfig.CharacterIgnoreDistance, 16); + message.WriteRangedSingle(limb.body.SimPosition.Y, -NetConfig.CharacterIgnoreDistance, NetConfig.CharacterIgnoreDistance, 16); message.Write(limb.body.Rotation); @@ -114,11 +114,11 @@ namespace Barotrauma message.Write((float)NetTime.Now); message.Write(AnimController.TargetDir == Direction.Right); - message.WriteRangedSingle(AnimController.TargetMovement.X, -1.0f, 1.0f, 8); - message.WriteRangedSingle(AnimController.TargetMovement.Y, -1.0f, 1.0f, 8); + message.WriteRangedSingle(MathHelper.Clamp(AnimController.TargetMovement.X, -1.0f, 1.0f), -1.0f, 1.0f, 8); + message.WriteRangedSingle(MathHelper.Clamp(AnimController.TargetMovement.X, -1.0f, 1.0f), -1.0f, 1.0f, 8); - message.WriteRangedSingle(AnimController.RefLimb.SimPosition.X, -NetConfig.AllowedRagdollDistance, NetConfig.AllowedRagdollDistance, 16); - message.WriteRangedSingle(AnimController.RefLimb.SimPosition.X, -NetConfig.AllowedRagdollDistance, NetConfig.AllowedRagdollDistance, 16); + message.WriteRangedSingle(AnimController.RefLimb.SimPosition.X, -NetConfig.CharacterIgnoreDistance, NetConfig.CharacterIgnoreDistance, 16); + message.WriteRangedSingle(AnimController.RefLimb.SimPosition.Y, -NetConfig.CharacterIgnoreDistance, NetConfig.CharacterIgnoreDistance, 16); //message.Write(AnimController.RefLimb.LinearVelocity.X); //message.Write(AnimController.RefLimb.LinearVelocity.Y); @@ -196,8 +196,8 @@ namespace Barotrauma targetMovement.X = message.ReadRangedSingle(-1.0f, 1.0f, 8); targetMovement.Y = message.ReadRangedSingle(-1.0f, 1.0f, 8); - pos.X = message.ReadRangedSingle(-1.0f, 1.0f, 8); - pos.Y = message.ReadRangedSingle(-1.0f, 1.0f, 8); + pos.X = message.ReadRangedSingle(-NetConfig.CharacterIgnoreDistance, NetConfig.CharacterIgnoreDistance, 16); + pos.Y = message.ReadRangedSingle(-NetConfig.CharacterIgnoreDistance, NetConfig.CharacterIgnoreDistance, 16); //vel.X = message.ReadFloat(); //vel.Y = message.ReadFloat(); diff --git a/Subsurface/Source/Characters/Character.cs b/Subsurface/Source/Characters/Character.cs index 654d8610c..43d157e00 100644 --- a/Subsurface/Source/Characters/Character.cs +++ b/Subsurface/Source/Characters/Character.cs @@ -1077,9 +1077,14 @@ namespace Barotrauma if (GameMain.Client!=null) chatMessage += " Your chat messages will only be visible to other dead players."; GameMain.NetworkMember.AddChatMessage(chatMessage, ChatMessageType.Dead); - GameMain.LightManager.LosEnabled = false; + GameMain.LightManager.LosEnabled = false; - new NetworkEvent(NetworkEventType.KillCharacter, ID, true, causeOfDeath); + new NetworkEvent(NetworkEventType.KillCharacter, ID, true, causeOfDeath); + } + //if it's an ai character, only let the server kill it + else if (GameMain.Server != null && this is AICharacter) + { + new NetworkEvent(NetworkEventType.KillCharacter, ID, true, causeOfDeath); } //otherwise don't kill the character unless received a message about the character dying else if (!isNetworkMessage) @@ -1210,8 +1215,13 @@ namespace Barotrauma { Vector2 relativeCursorPosition = cursorPosition - Position; - message.WriteRangedSingle(relativeCursorPosition.X, -2000.0f, 2000.0f, 8); - message.WriteRangedSingle(relativeCursorPosition.Y, -2000.0f, 2000.0f, 8); + if (relativeCursorPosition.Length()>4950.0f) + { + relativeCursorPosition = Vector2.Normalize(relativeCursorPosition) * 4950.0f; + } + + message.WriteRangedSingle(relativeCursorPosition.X, -5000.0f, 5000.0f, 16); + message.WriteRangedSingle(relativeCursorPosition.Y, -5000.0f, 5000.0f, 16); } else { @@ -1397,8 +1407,8 @@ namespace Barotrauma if (secondaryKeyState) { relativeCursorPos = new Vector2( - message.ReadRangedSingle(-2000.0f, 2000.0f, 8), - message.ReadRangedSingle(-2000.0f, 2000.0f, 8)); + message.ReadRangedSingle(-5000.0f, 5000.0f, 16), + message.ReadRangedSingle(-5000.0f, 5000.0f, 16)); } else { diff --git a/Subsurface/Source/Characters/HumanoidAnimController.cs b/Subsurface/Source/Characters/HumanoidAnimController.cs index 66055a29d..e77cb263d 100644 --- a/Subsurface/Source/Characters/HumanoidAnimController.cs +++ b/Subsurface/Source/Characters/HumanoidAnimController.cs @@ -832,16 +832,17 @@ namespace Barotrauma if (itemPos == Vector2.Zero) { - if (character.SelectedItems[0] == item) - { - transformedHoldPos = rightHand.pullJoint.WorldAnchorA - transformedHandlePos[0]; - itemAngle = (rightHand.Rotation + (holdAngle - MathHelper.PiOver2) * Dir); - } + if (character.SelectedItems[1] == item) { transformedHoldPos = leftHand.pullJoint.WorldAnchorA - transformedHandlePos[1]; itemAngle = (leftHand.Rotation + (holdAngle - MathHelper.PiOver2) * Dir); } + if (character.SelectedItems[0] == item) + { + transformedHoldPos = rightHand.pullJoint.WorldAnchorA - transformedHandlePos[0]; + itemAngle = (rightHand.Rotation + (holdAngle - MathHelper.PiOver2) * Dir); + } } else { diff --git a/Subsurface/Source/Characters/Ragdoll.cs b/Subsurface/Source/Characters/Ragdoll.cs index fe01e2bd4..9f8835052 100644 --- a/Subsurface/Source/Characters/Ragdoll.cs +++ b/Subsurface/Source/Characters/Ragdoll.cs @@ -279,6 +279,8 @@ namespace Barotrauma { limb.sprite.Depth = startDepth + limb.sprite.Depth * 0.0001f; } + + FindLowestLimb(); } public bool OnLimbCollision(Fixture f1, Fixture f2, Contact contact) diff --git a/Subsurface/Source/Items/Components/Holdable/MeleeWeapon.cs b/Subsurface/Source/Items/Components/Holdable/MeleeWeapon.cs index 7fe6922b1..4d902b2f5 100644 --- a/Subsurface/Source/Items/Components/Holdable/MeleeWeapon.cs +++ b/Subsurface/Source/Items/Components/Holdable/MeleeWeapon.cs @@ -68,6 +68,7 @@ namespace Barotrauma.Items.Components { item.body.FarseerBody.IgnoreCollisionWith(l.body.FarseerBody); + if (character.AnimController.InWater) continue; if (l.type == LimbType.LeftFoot || l.type == LimbType.LeftThigh || l.type == LimbType.LeftLeg) continue; if (l.type == LimbType.Head || l.type == LimbType.Torso) diff --git a/Subsurface/Source/Items/Components/Holdable/Pickable.cs b/Subsurface/Source/Items/Components/Holdable/Pickable.cs index 260887a64..6b383140f 100644 --- a/Subsurface/Source/Items/Components/Holdable/Pickable.cs +++ b/Subsurface/Source/Items/Components/Holdable/Pickable.cs @@ -95,8 +95,10 @@ namespace Barotrauma.Items.Components if (item.body!= null && !item.body.Enabled) { Limb rightHand = picker.AnimController.GetLimb(LimbType.RightHand); + item.SetTransform(rightHand.SimPosition, 0.0f); item.body.Enabled = true; + } picker.Inventory.RemoveItem(item); picker = null; diff --git a/Subsurface/Source/Items/Components/Machines/Radar.cs b/Subsurface/Source/Items/Components/Machines/Radar.cs index 7940096da..9560934b9 100644 --- a/Subsurface/Source/Items/Components/Machines/Radar.cs +++ b/Subsurface/Source/Items/Components/Machines/Radar.cs @@ -59,7 +59,7 @@ namespace Barotrauma.Items.Components else { pingState = 0.0f; - } + } } public override bool Use(float deltaTime, Character character = null) @@ -201,6 +201,8 @@ namespace Barotrauma.Items.Components prevPos = pos; } + + voltage = 0.0f; } private void DrawMarker(SpriteBatch spriteBatch, string label, Vector2 position, float scale, Vector2 center, float radius) diff --git a/Subsurface/Source/Items/Components/Machines/Reactor.cs b/Subsurface/Source/Items/Components/Machines/Reactor.cs index 5bc195f42..8e2754a90 100644 --- a/Subsurface/Source/Items/Components/Machines/Reactor.cs +++ b/Subsurface/Source/Items/Components/Machines/Reactor.cs @@ -427,7 +427,7 @@ namespace Barotrauma.Items.Components { message.Write(autoTemp); message.WriteRangedSingle(temperature, 0.0f, 10000.0f, 16); - message.WriteRangedSingle(shutDownTemp, 0.0f, 10000.0f, 7); + message.WriteRangedSingle(shutDownTemp, 0.0f, 10000.0f, 8); message.WriteRangedSingle(coolingRate, 0.0f, 100.0f, 8); message.WriteRangedSingle(fissionRate, 0.0f, 100.0f, 8); @@ -443,8 +443,8 @@ namespace Barotrauma.Items.Components { newAutoTemp = message.ReadBoolean(); newTemperature = message.ReadRangedSingle(0.0f, 10000.0f, 16); - newShutDownTemp = message.ReadRangedSingle(0.0f, 10000.0f, 7); - newShutDownTemp = MathUtils.Round(newShutDownTemp, 100.0f); + newShutDownTemp = message.ReadRangedSingle(0.0f, 10000.0f, 8); + newShutDownTemp = MathUtils.RoundTowardsClosest(newShutDownTemp, 100.0f); newCoolingRate = message.ReadRangedSingle(0.0f, 100.0f, 8); newFissionRate = message.ReadRangedSingle(0.0f, 100.0f, 8); diff --git a/Subsurface/Source/Items/Components/Machines/Steering.cs b/Subsurface/Source/Items/Components/Machines/Steering.cs index 2fb7040e4..38ae89fa9 100644 --- a/Subsurface/Source/Items/Components/Machines/Steering.cs +++ b/Subsurface/Source/Items/Components/Machines/Steering.cs @@ -27,7 +27,7 @@ namespace Barotrauma.Items.Components private bool valueChanged; private float autopilotRayCastTimer; - + bool AutoPilot { get { return autoPilot; } @@ -104,6 +104,7 @@ namespace Barotrauma.Items.Components } item.SendSignal(targetVelocity.X.ToString(CultureInfo.InvariantCulture), "velocity_x_out"); + item.SendSignal((-targetVelocity.Y).ToString(CultureInfo.InvariantCulture), "velocity_y_out"); } diff --git a/Subsurface/Source/Items/Components/Signal/Connection.cs b/Subsurface/Source/Items/Components/Signal/Connection.cs index 2d5b64e96..685197230 100644 --- a/Subsurface/Source/Items/Components/Signal/Connection.cs +++ b/Subsurface/Source/Items/Components/Signal/Connection.cs @@ -281,6 +281,7 @@ namespace Barotrauma.Items.Components if (!PlayerInput.LeftButtonDown()) { panel.Item.NewComponentEvent(panel, true, true); + //draggingConnected.Drop(character); draggingConnected = null; } } @@ -318,6 +319,8 @@ namespace Barotrauma.Items.Components if (index>-1 && wireComponent!=null && !Wires.Contains(wireComponent)) { + wireComponent.RemoveConnection(item); + Wires[index] = wireComponent; wireComponent.Connect(this); } @@ -325,15 +328,15 @@ namespace Barotrauma.Items.Components //far away -> disconnect if the wire is linked to this connector else { - int index = FindWireIndex(draggingConnected); - if (index>-1) - { - Wires[index].RemoveConnection(this); - //Wires[index].Item.SetTransform(item.SimPosition, 0.0f); - //Wires[index].Item.Drop(); - //Wires[index].Item.body.Enabled = true; - Wires[index] = null; - } + //int index = FindWireIndex(draggingConnected); + //if (index>-1) + //{ + // Wires[index].RemoveConnection(this); + // //Wires[index].Item.SetTransform(item.SimPosition, 0.0f); + // //Wires[index].Item.Drop(); + // //Wires[index].Item.body.Enabled = true; + // Wires[index] = null; + //} } } diff --git a/Subsurface/Source/Items/Components/Signal/ConnectionPanel.cs b/Subsurface/Source/Items/Components/Signal/ConnectionPanel.cs index 2f4ff91f2..838eb95e3 100644 --- a/Subsurface/Source/Items/Components/Signal/ConnectionPanel.cs +++ b/Subsurface/Source/Items/Components/Signal/ConnectionPanel.cs @@ -36,6 +36,10 @@ namespace Barotrauma.Items.Components public override void DrawHUD(SpriteBatch spriteBatch, Character character) { if (character != Character.Controlled || character != user) return; + + if (character.GetInputState(InputType.Select) && + character.SelectedConstruction==this.item) character.SelectedConstruction = null; + Connection.DrawConnections(spriteBatch, this, character); } diff --git a/Subsurface/Source/Items/Components/Signal/Wire.cs b/Subsurface/Source/Items/Components/Signal/Wire.cs index ca42763e1..f312e35b8 100644 --- a/Subsurface/Source/Items/Components/Signal/Wire.cs +++ b/Subsurface/Source/Items/Components/Signal/Wire.cs @@ -57,9 +57,23 @@ namespace Barotrauma.Items.Components return null; } + public void RemoveConnection(Item item) + { + for (int i = 0; i<2; i++) + { + if (connections[i]==null || connections[i].Item!=item) continue; + + for (int n = 0; n< connections[i].Wires.Length; n++) + { + if (connections[i].Wires[n] == this) connections[i].Wires[n] = null; + } + connections[i] = null; + } + } + public void RemoveConnection(Connection connection) { - if (connection == connections[0]) connections[0] = null; + if (connection == connections[0]) connections[0] = null; if (connection == connections[1]) connections[1] = null; } @@ -407,6 +421,13 @@ namespace Barotrauma.Items.Components } + public override void Remove() + { + ClearConnections(); + + base.Remove(); + } + public override void FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetOutgoingMessage message) { message.Write((byte)Math.Min(Nodes.Count, 10)); diff --git a/Subsurface/Source/Items/Components/Turret.cs b/Subsurface/Source/Items/Components/Turret.cs index 62a2ce1f3..ff617ef98 100644 --- a/Subsurface/Source/Items/Components/Turret.cs +++ b/Subsurface/Source/Items/Components/Turret.cs @@ -130,12 +130,13 @@ namespace Barotrauma.Items.Components Projectile projectileComponent = null; //search for a projectile from linked containers Item projectile = null; + Item projectileContainer = null; foreach (MapEntity e in item.linkedTo) { - Item container = e as Item; - if (container == null) continue; + projectileContainer = e as Item; + if (projectileContainer == null) continue; - ItemContainer containerComponent = container.GetComponent(); + ItemContainer containerComponent = projectileContainer.GetComponent(); if (containerComponent == null) continue; for (int i = 0; i < containerComponent.inventory.items.Length; i++) @@ -182,7 +183,7 @@ namespace Barotrauma.Items.Components projectile.SetTransform(ConvertUnits.ToSimUnits(new Vector2(item.Rect.X + barrelPos.X, item.Rect.Y - barrelPos.Y)), -rotation); projectileComponent.Use(deltaTime); - item.RemoveContained(projectile); + projectileContainer.RemoveContained(projectile); return true; } diff --git a/Subsurface/Source/Items/Inventory.cs b/Subsurface/Source/Items/Inventory.cs index 4b89da197..382400e62 100644 --- a/Subsurface/Source/Items/Inventory.cs +++ b/Subsurface/Source/Items/Inventory.cs @@ -179,7 +179,7 @@ namespace Barotrauma UpdateSlot(spriteBatch, slotRect, i, items[i], false); } - if (draggingItem != null && !draggingItemSlot.Contains(PlayerInput.MousePosition)) + if (draggingItem != null && !draggingItemSlot.Contains(PlayerInput.MousePosition) && draggingItem.container == this.Owner) { if (PlayerInput.GetMouseState.LeftButton == ButtonState.Pressed) { @@ -198,6 +198,7 @@ namespace Barotrauma } DropItem(draggingItem); + //draggingItem = null; } } } diff --git a/Subsurface/Source/Items/Item.cs b/Subsurface/Source/Items/Item.cs index 037c7224e..d9696d903 100644 --- a/Subsurface/Source/Items/Item.cs +++ b/Subsurface/Source/Items/Item.cs @@ -333,7 +333,19 @@ namespace Barotrauma public void SetTransform(Vector2 simPosition, float rotation) { - if (body != null) body.SetTransform(simPosition, rotation); + if (body != null) + { + try + { + body.SetTransform(simPosition, rotation); + } + catch (Exception e) + { +#if DEBUG + DebugConsole.ThrowError("Failed to set item transform", e); +#endif + } + } Vector2 displayPos = ConvertUnits.ToDisplayUnits(simPosition); @@ -803,7 +815,7 @@ namespace Barotrauma foreach (Item item in itemList) { if (ignoredItems!=null && ignoredItems.Contains(item)) continue; - if (hull != item.CurrentHull && (hull==null || (item.Rect.Height(); @@ -813,7 +825,7 @@ namespace Barotrauma { Rectangle transformedTrigger = item.TransformTrigger(trigger); - if (!Submarine.RectContains(transformedTrigger, displayPos))continue; + if (!Submarine.RectContains(transformedTrigger, displayPos)) continue; Vector2 triggerCenter = new Vector2( diff --git a/Subsurface/Source/Items/ItemInventory.cs b/Subsurface/Source/Items/ItemInventory.cs index c15ba1478..3acbf3209 100644 --- a/Subsurface/Source/Items/ItemInventory.cs +++ b/Subsurface/Source/Items/ItemInventory.cs @@ -17,7 +17,7 @@ namespace Barotrauma { item.Drop(); item.body.Enabled = true; - item.body.SetTransform(container.Item.SimPosition, 0.0f); + item.SetTransform(container.Item.SimPosition, 0.0f); } public override int FindAllowedSlot(Item item) diff --git a/Subsurface/Source/Map/Hull.cs b/Subsurface/Source/Map/Hull.cs index 5f586dbbd..f77300f5d 100644 --- a/Subsurface/Source/Map/Hull.cs +++ b/Subsurface/Source/Map/Hull.cs @@ -484,6 +484,7 @@ namespace Barotrauma try { float newPercentage = message.ReadRangedSingle(0.0f, 1.5f, 6); + newVolume = newPercentage * FullVolume; } catch diff --git a/Subsurface/Source/Map/Structure.cs b/Subsurface/Source/Map/Structure.cs index e0c2a21a7..3e73a182f 100644 --- a/Subsurface/Source/Map/Structure.cs +++ b/Subsurface/Source/Map/Structure.cs @@ -23,8 +23,6 @@ namespace Barotrauma public float lastSentDamage; - public float lastUpdate; - public bool isHighLighted; public WallSection(Rectangle rect) @@ -56,6 +54,8 @@ namespace Barotrauma private WallSection[] sections; bool isHorizontal; + + public float lastUpdate; public override Sprite Sprite { @@ -451,8 +451,8 @@ namespace Barotrauma if (damage != sections[sectionIndex].damage && Math.Abs(sections[sectionIndex].lastSentDamage - damage)>5.0f) { - new NetworkEvent(NetworkEventType.WallDamage, ID, false, sectionIndex); - sections[sectionIndex].lastSentDamage = damage; + new NetworkEvent(NetworkEventType.WallDamage, ID, false); + //sections[sectionIndex].lastSentDamage = damage; } if (damage < prefab.MaxHealth*0.5f) @@ -638,48 +638,32 @@ namespace Barotrauma public override bool FillNetworkData(NetworkEventType type, NetOutgoingMessage message, object data) { - int sectionIndex = 0; - byte byteIndex = 0; - - try - { - sectionIndex = (int)data; - byteIndex = (byte)sectionIndex; - } - catch - { - return false; - } - message.Write((float)NetTime.Now); - message.Write(byteIndex); - message.WriteRangedSingle(sections[sectionIndex].damage/Health, 0.0f, 1.0f, 8); + + for (int i = 0; i < sections.Length; i++) + { + if (Math.Abs(sections[i].damage - sections[i].lastSentDamage) < 0.1f) continue; + message.Write((byte)i); + message.WriteRangedSingle(sections[i].damage / Health, 0.0f, 1.0f, 8); + + sections[i].lastSentDamage = sections[i].damage; + } return true; } public override void ReadNetworkData(NetworkEventType type, NetIncomingMessage message) { - int sectionIndex = 0; - float damage = 0.0f; - float updateTime = 0.0f; + float updateTime = message.ReadFloat(); + if (updateTime < lastUpdate) return; - try + while (message.Position <= message.LengthBits-8) { - updateTime = message.ReadFloat(); - sectionIndex = message.ReadByte(); - damage = message.ReadRangedSingle(0.0f, 1.0f, 8) * Health; - } - catch - { - return; - } + byte sectionIndex = message.ReadByte(); + float damage = message.ReadRangedSingle(0.0f, 1.0f, 8) * Health; - if (sections[sectionIndex].lastUpdate != 0.0f && updateTime < sections[sectionIndex].lastUpdate) return; - - sections[sectionIndex].lastUpdate = updateTime; - SetDamage(sectionIndex, damage); - + SetDamage(sectionIndex, damage); + } } } diff --git a/Subsurface/Source/Program.cs b/Subsurface/Source/Program.cs index f70f20a8b..dd2d14c37 100644 --- a/Subsurface/Source/Program.cs +++ b/Subsurface/Source/Program.cs @@ -95,6 +95,8 @@ namespace Barotrauma "Oops! Subsurface just crashed.", MessageBoxButtons.OK, MessageBoxIcon.Error); #endif + Sounds.SoundManager.Dispose(); + } } diff --git a/Subsurface/Source/Screens/EditMapScreen.cs b/Subsurface/Source/Screens/EditMapScreen.cs index 5a4c68f78..335fed863 100644 --- a/Subsurface/Source/Screens/EditMapScreen.cs +++ b/Subsurface/Source/Screens/EditMapScreen.cs @@ -309,6 +309,7 @@ namespace Barotrauma if (dummyCharacter.SelectedConstruction == dummyCharacter.ClosestItem) { dummyCharacter.SelectedConstruction.DrawHUD(spriteBatch, dummyCharacter); + } else { @@ -329,6 +330,8 @@ namespace Barotrauma } GUI.Draw((float)deltaTime, spriteBatch, cam); + + if (!PlayerInput.LeftButtonDown()) Inventory.draggingItem = null; spriteBatch.End(); diff --git a/Subsurface/Source/Screens/GameScreen.cs b/Subsurface/Source/Screens/GameScreen.cs index 20a499de7..102f35380 100644 --- a/Subsurface/Source/Screens/GameScreen.cs +++ b/Subsurface/Source/Screens/GameScreen.cs @@ -81,9 +81,7 @@ namespace Barotrauma GameMain.GameSession.Submarine.ApplyForce(targetMovement * 100000.0f); } #endif - - - //dustOffset -= Vector2.UnitY * 100.0f * (float)deltaTime; + dustOffset -= Vector2.UnitY * 10.0f * (float)deltaTime; if (GameMain.GameSession!=null) GameMain.GameSession.Update((float)deltaTime); //EventManager.Update(gameTime); @@ -208,7 +206,7 @@ namespace Barotrauma BackgroundSpriteManager.Draw(spriteBatch); - backgroundPos = new Vector2(cam.WorldView.X, cam.WorldView.Y); + backgroundPos = new Vector2(cam.WorldView.X, cam.WorldView.Y) + dustOffset; if (Level.Loaded != null) backgroundPos -= Level.Loaded.Position; Rectangle viewRect = cam.WorldView; diff --git a/Subsurface/Source/Utils/MathUtils.cs b/Subsurface/Source/Utils/MathUtils.cs index 9c355344f..645e46eb2 100644 --- a/Subsurface/Source/Utils/MathUtils.cs +++ b/Subsurface/Source/Utils/MathUtils.cs @@ -22,6 +22,11 @@ namespace Barotrauma (float)Math.Floor(value / div) * div; } + public static float RoundTowardsClosest(float value, float div) + { + return (float)Math.Round(value / div) * div; + } + public static float VectorToAngle(Vector2 vector) { return (float)Math.Atan2(vector.Y, vector.X); diff --git a/Subsurface_Solution.v12.suo b/Subsurface_Solution.v12.suo index 7d29b3848..37dfb929e 100644 Binary files a/Subsurface_Solution.v12.suo and b/Subsurface_Solution.v12.suo differ