diff --git a/Farseer Physics Engine 3.5/Farseer Physics MonoGame.csproj b/Farseer Physics Engine 3.5/Farseer Physics MonoGame.csproj index 9e4d977f5..aa064cac7 100644 --- a/Farseer Physics Engine 3.5/Farseer Physics MonoGame.csproj +++ b/Farseer Physics Engine 3.5/Farseer Physics MonoGame.csproj @@ -26,9 +26,9 @@ x86 true full - false + true bin\WindowsGL\Debug\ - DEBUG;TRACE;WINDOWS + TRACE;DEBUG;WINDOWS prompt 4 diff --git a/Subsurface/Content/Items/Electricity/lights.xml b/Subsurface/Content/Items/Electricity/lights.xml index 021b3179e..34d48a133 100644 --- a/Subsurface/Content/Items/Electricity/lights.xml +++ b/Subsurface/Content/Items/Electricity/lights.xml @@ -7,9 +7,9 @@ Tags="smallitem" pickdistance="150"> - + - + diff --git a/Subsurface/Content/Items/Weapons/railgun.xml b/Subsurface/Content/Items/Weapons/railgun.xml index 474b461c4..6adadcea7 100644 --- a/Subsurface/Content/Items/Weapons/railgun.xml +++ b/Subsurface/Content/Items/Weapons/railgun.xml @@ -32,7 +32,7 @@ - + diff --git a/Subsurface/Data/SavedSubs/Aegir Mark II.gz b/Subsurface/Data/SavedSubs/Aegir Mark II.gz index 615518a1c..5daf6ece2 100644 Binary files a/Subsurface/Data/SavedSubs/Aegir Mark II.gz and b/Subsurface/Data/SavedSubs/Aegir Mark II.gz differ diff --git a/Subsurface/Data/SavedSubs/Vellamo.gz b/Subsurface/Data/SavedSubs/Vellamo.gz index 64666757d..c7013624d 100644 Binary files a/Subsurface/Data/SavedSubs/Vellamo.gz and b/Subsurface/Data/SavedSubs/Vellamo.gz differ diff --git a/Subsurface/Source/Characters/Ragdoll.cs b/Subsurface/Source/Characters/Ragdoll.cs index 58bf9a95f..b2ee4c5ed 100644 --- a/Subsurface/Source/Characters/Ragdoll.cs +++ b/Subsurface/Source/Characters/Ragdoll.cs @@ -163,14 +163,7 @@ namespace Subsurface if (ignorePlatforms == value) return; ignorePlatforms = value; - foreach (Limb l in Limbs) - { - if (l.ignoreCollisions) continue; - - l.body.CollidesWith = (ignorePlatforms) ? - Physics.CollisionWall | Physics.CollisionProjectile | Physics.CollisionStairs - : Physics.CollisionAll & ~Physics.CollisionCharacter & ~Physics.CollisionMisc; - } + UpdateCollisionCategories(); } } @@ -514,12 +507,33 @@ namespace Subsurface public void FindHull() { - Limb torso = GetLimb(LimbType.Torso); - if (torso==null) torso = GetLimb(LimbType.Head); - - currentHull = Hull.FindHull( - ConvertUnits.ToDisplayUnits(torso.SimPosition), + Hull newHull = Hull.FindHull( + ConvertUnits.ToDisplayUnits(refLimb.SimPosition), currentHull); + + if (newHull == currentHull) return; + + currentHull = newHull; + + UpdateCollisionCategories(); + } + + private void UpdateCollisionCategories() + { + Category wall = currentHull == null ? + Physics.CollisionLevel | Physics.CollisionWall + : Physics.CollisionWall; + + Category collisionCategory = (ignorePlatforms) ? + wall | Physics.CollisionProjectile | Physics.CollisionStairs + : wall | Physics.CollisionPlatform | Physics.CollisionStairs; + + foreach (Limb limb in Limbs) + { + if (limb.ignoreCollisions) continue; + + limb.body.CollidesWith = collisionCategory; + } } public void Update(Camera cam, float deltaTime) diff --git a/Subsurface/Source/GUI/GUI.cs b/Subsurface/Source/GUI/GUI.cs index 9df743cb7..0ef39592d 100644 --- a/Subsurface/Source/GUI/GUI.cs +++ b/Subsurface/Source/GUI/GUI.cs @@ -160,39 +160,21 @@ namespace Subsurface public static void DrawRectangle(SpriteBatch sb, Vector2 start, Vector2 size, Color clr, bool isFilled = false, float depth = 0.0f) { - if (isFilled) - { - sb.Draw(t, new Rectangle((int)start.X,(int)start.Y,(int)size.X,(int)size.Y),null,clr); - } - else - { - Vector2 p2 = new Vector2(start.X + size.X, start.Y); - Vector2 p4 = new Vector2(start.X, start.Y + size.Y); - - DrawLine(sb, start, p2, clr, depth); - DrawLine(sb, p2, start + size, clr, depth); - DrawLine(sb, start + size, p4, clr, depth); - DrawLine(sb, p4, start, clr, depth); - } + DrawRectangle(sb, new Rectangle((int)start.X, (int)start.Y, (int)size.X, (int)size.Y), clr, isFilled, depth); } public static void DrawRectangle(SpriteBatch sb, Rectangle rect, Color clr, bool isFilled = false, float depth = 0.0f) { if (isFilled) { - sb.Draw(t, rect, null, clr); + sb.Draw(t, rect, null, clr, 0.0f, Vector2.Zero, SpriteEffects.None, depth); } else { - Vector2 p1 = new Vector2(rect.X, rect.Y); - Vector2 p2 = new Vector2(rect.X + rect.Width, rect.Y); - Vector2 p3 = new Vector2(rect.X + rect.Width, rect.Y + rect.Height); - Vector2 p4 = new Vector2(rect.X, rect.Y + rect.Height); - - DrawLine(sb, p1, p2, clr, depth); - DrawLine(sb, p2, p3, clr, depth); - DrawLine(sb, p3, p4, clr, depth); - DrawLine(sb, p4, p1, clr, depth); + sb.Draw(t, new Rectangle(rect.X, rect.Y, rect.Width, 1), null, clr, 0.0f, Vector2.Zero, SpriteEffects.None, depth); + sb.Draw(t, new Rectangle(rect.X, rect.Y+rect.Height-1, rect.Width, 1), null, clr, 0.0f, Vector2.Zero, SpriteEffects.None, depth); + sb.Draw(t, new Rectangle(rect.X, rect.Y, 1, rect.Height), null, clr, 0.0f, Vector2.Zero, SpriteEffects.None, depth); + sb.Draw(t, new Rectangle(rect.X+rect.Width-1, rect.Y, 1, rect.Height), null, clr, 0.0f, Vector2.Zero, SpriteEffects.None, depth); } } diff --git a/Subsurface/Source/Items/Components/Machines/Controller.cs b/Subsurface/Source/Items/Components/Machines/Controller.cs index ccdfcbaf9..8817ce664 100644 --- a/Subsurface/Source/Items/Components/Machines/Controller.cs +++ b/Subsurface/Source/Items/Components/Machines/Controller.cs @@ -27,9 +27,10 @@ namespace Subsurface.Items.Components Character character; - [HasDefaultValue(1.0f,false)] + [HasDefaultValue(0.0f, false)] public float UserPos { + get { return userPos; } set { userPos = value; } } @@ -80,26 +81,24 @@ namespace Subsurface.Items.Components return; } - ApplyStatusEffects(ActionType.OnActive, deltaTime, character); - if (userPos != 0.0f && character.AnimController.Anim != AnimController.Animation.UsingConstruction) { - Limb torso = character.AnimController.GetLimb(LimbType.Torso); - float torsoX = ConvertUnits.ToDisplayUnits(torso.SimPosition.X); + float torsoX = ConvertUnits.ToDisplayUnits(character.AnimController.RefLimb.SimPosition.X); - if (Math.Abs(torsoX - item.Rect.X + userPos) > 10.0f) + Vector2 diff = new Vector2(item.Rect.X + UserPos - torsoX, 0.0f); + + if (diff!= Vector2.Zero && diff.Length() > 10.0f) { character.AnimController.Anim = AnimController.Animation.None; - character.AnimController.TargetMovement = - new Vector2( - Math.Min(Math.Max(item.Rect.X + userPos - torsoX, -1.0f), 1.0f), - 0.0f); - character.AnimController.TargetDir = (Math.Sign(torsoX - item.Rect.X + userPos) == 1) ? Direction.Right : Direction.Left; + character.AnimController.TargetMovement = new Vector2(Math.Sign(diff.X), 0.0f); + character.AnimController.TargetDir = (Math.Sign(diff.X) == 1) ? Direction.Right : Direction.Left; return; } } + ApplyStatusEffects(ActionType.OnActive, deltaTime, character); + if (limbPositions.Count == 0) return; character.AnimController.Anim = AnimController.Animation.UsingConstruction; @@ -118,20 +117,13 @@ namespace Subsurface.Items.Components fmj.Enabled = true; fmj.WorldAnchorB = position; } - - //foreach (MapEntity e in item.linkedTo) - //{ - // Item linkedItem = e as Item; - // if (linkedItem == null) continue; - // linkedItem.Update(cam, deltaTime); - //} - + item.SendSignal(ToolBox.Vector2ToString(character.CursorPosition), "position_out"); } public override bool Use(float deltaTime, Character activator = null) { - if (character==null || activator!=character || character.SelectedConstruction != item) + if (character == null || activator != character || character.SelectedConstruction != item) { character = null; return false; diff --git a/Subsurface/Source/Items/Components/Power/PowerTransfer.cs b/Subsurface/Source/Items/Components/Power/PowerTransfer.cs index 1661d73b5..ccb6c0afa 100644 --- a/Subsurface/Source/Items/Components/Power/PowerTransfer.cs +++ b/Subsurface/Source/Items/Components/Power/PowerTransfer.cs @@ -101,9 +101,10 @@ namespace Subsurface.Items.Components foreach (Connection c in connections) { + if (!c.IsPower) continue; foreach (Connection recipient in c.Recipients) { - if (recipient == null) continue; + if (recipient == null || !recipient.IsPower) continue; Item it = recipient.Item; if (it == null) continue; diff --git a/Subsurface/Source/Items/Components/Power/Powered.cs b/Subsurface/Source/Items/Components/Power/Powered.cs index 22ff97bc9..999480755 100644 --- a/Subsurface/Source/Items/Components/Power/Powered.cs +++ b/Subsurface/Source/Items/Components/Power/Powered.cs @@ -88,7 +88,7 @@ namespace Subsurface.Items.Components public override void ReceiveSignal(string signal, Connection connection, Item sender, float power) { if (currPowerConsumption == 0.0f) voltage = 0.0f; - if (connection.Name == "power_in" || connection.Name == "power") voltage = power; + if (connection.IsPower) voltage = power; } public override void Update(float deltaTime, Camera cam) diff --git a/Subsurface/Source/Items/Components/Projectile.cs b/Subsurface/Source/Items/Components/Projectile.cs index 80197fed8..f1e2b5f17 100644 --- a/Subsurface/Source/Items/Components/Projectile.cs +++ b/Subsurface/Source/Items/Components/Projectile.cs @@ -97,7 +97,7 @@ namespace Subsurface.Items.Components item.body.FarseerBody.IsBullet = true; item.body.CollisionCategories = Physics.CollisionProjectile; - item.body.CollidesWith = Physics.CollisionCharacter | Physics.CollisionWall; + item.body.CollidesWith = Physics.CollisionCharacter | Physics.CollisionWall | Physics.CollisionLevel; item.Drop(); @@ -155,7 +155,7 @@ namespace Subsurface.Items.Components item.body.FarseerBody.IsBullet = false; item.body.CollisionCategories = Physics.CollisionMisc; - item.body.CollidesWith = Physics.CollisionWall; + item.body.CollidesWith = Physics.CollisionWall | Physics.CollisionLevel; ignoredBodies.Clear(); diff --git a/Subsurface/Source/Items/Components/Signal/Connection.cs b/Subsurface/Source/Items/Components/Signal/Connection.cs index fadfa4262..c0b47827c 100644 --- a/Subsurface/Source/Items/Components/Signal/Connection.cs +++ b/Subsurface/Source/Items/Components/Signal/Connection.cs @@ -30,6 +30,12 @@ namespace Subsurface.Items.Components public readonly int[] wireId; + public bool IsPower + { + get; + private set; + } + public List Recipients { get @@ -69,6 +75,8 @@ namespace Subsurface.Items.Components IsOutput = (element.Name.ToString() == "output"); Name = ToolBox.GetAttributeString(element, "name", (IsOutput) ? "output" : "input"); + IsPower = Name == "power_in" || Name == "power" || Name == "power_out"; + effects = new List(); wireId = new int[MaxLinked]; diff --git a/Subsurface/Source/Items/Components/Signal/LightComponent.cs b/Subsurface/Source/Items/Components/Signal/LightComponent.cs index d9e790142..46ac7e32d 100644 --- a/Subsurface/Source/Items/Components/Signal/LightComponent.cs +++ b/Subsurface/Source/Items/Components/Signal/LightComponent.cs @@ -63,6 +63,21 @@ namespace Subsurface.Items.Components light.Position += amount; } + public override bool IsActive + { + get + { + return base.IsActive; + } + + set + { + if (base.IsActive == value) return; + base.IsActive = value; + light.Color = value ? lightColor : Color.Transparent; + } + } + public LightComponent(Item item, XElement element) : base (item, element) { @@ -122,10 +137,11 @@ namespace Subsurface.Items.Components public override void Draw(SpriteBatch spriteBatch, bool editing) { - if (!IsActive) - { - light.Color = Color.Transparent; - } + if (!editing) return; + + //Vector2 center = new Vector2(item.Rect.Center.X, -item.Rect.Y + item.Rect.Height/2.0f); + + //GUI.DrawLine(spriteBatch, center - Vector2.One * range, center + Vector2.One * range, lightColor); } public override void Remove() diff --git a/Subsurface/Source/Items/Components/Signal/Wire.cs b/Subsurface/Source/Items/Components/Signal/Wire.cs index f5e36e768..7e62b0a16 100644 --- a/Subsurface/Source/Items/Components/Signal/Wire.cs +++ b/Subsurface/Source/Items/Components/Signal/Wire.cs @@ -304,7 +304,7 @@ namespace Subsurface.Items.Components GUI.DrawRectangle(spriteBatch, new Rectangle((int)Nodes[i].X - 3, (int)-Nodes[i].Y - 3, 6, 6), Color.Red, true, 0.0f); if (GUIComponent.MouseOn != null || - Vector2.Distance(GameMain.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition), Nodes[i]) > 20.0f) + Vector2.Distance(GameMain.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition), Nodes[i]) > 10.0f) { continue; } diff --git a/Subsurface/Source/Items/Inventory.cs b/Subsurface/Source/Items/Inventory.cs index 9acced92c..17057458b 100644 --- a/Subsurface/Source/Items/Inventory.cs +++ b/Subsurface/Source/Items/Inventory.cs @@ -252,7 +252,7 @@ namespace Subsurface protected void DrawSlot(SpriteBatch spriteBatch, Rectangle rect, Item item, bool isHighLighted, bool isSubSlot) { - GUI.DrawRectangle(spriteBatch, rect, (isHighLighted ? Color.Red : Color.White)*((isSubSlot) ? 0.1f : 0.3f), true); + GUI.DrawRectangle(spriteBatch, rect, (isHighLighted ? Color.Red : Color.White) * ((isSubSlot) ? 0.1f : 0.3f), true); if (item == null) return; @@ -263,8 +263,8 @@ namespace Subsurface Vector2 pos = new Vector2(rect.X + rect.Width / 2, rect.Y - rect.Height + 20) - GUI.Font.MeasureString(item.Name) * 0.5f; pos.X = (int)pos.X; pos.Y = (int)pos.Y; - spriteBatch.DrawString(GUI.Font, item.Name + " - " + item.ID, pos - new Vector2(1.0f, 1.0f), Color.Black); - spriteBatch.DrawString(GUI.Font, item.Name + " - " + item.ID, pos, Color.White); + spriteBatch.DrawString(GUI.Font, item.Name, pos - new Vector2(1.0f, 1.0f), Color.Black); + spriteBatch.DrawString(GUI.Font, item.Name, pos, Color.White); } if (item.Condition < 100.0f) diff --git a/Subsurface/Source/Items/Item.cs b/Subsurface/Source/Items/Item.cs index d12a04d76..6145af8b5 100644 --- a/Subsurface/Source/Items/Item.cs +++ b/Subsurface/Source/Items/Item.cs @@ -587,7 +587,7 @@ namespace Subsurface foreach (ItemComponent component in components) component.Draw(spriteBatch, editing); - if (!editing || (body!=null && !body.Enabled)) + if (!editing || (body != null && !body.Enabled)) { isHighlighted = false; return; diff --git a/Subsurface/Source/Map/Levels/Level.cs b/Subsurface/Source/Map/Levels/Level.cs index 36df15671..03ce14e27 100644 --- a/Subsurface/Source/Map/Levels/Level.cs +++ b/Subsurface/Source/Map/Levels/Level.cs @@ -664,7 +664,7 @@ int currentTargetIndex = 1; edgeBody.UserData = cell; edgeBody.SleepingAllowed = false; edgeBody.BodyType = BodyType.Kinematic; - edgeBody.CollisionCategories = Physics.CollisionWall | Physics.CollisionLevel; + edgeBody.CollisionCategories = Physics.CollisionLevel; cell.body = edgeBody; bodies.Add(edgeBody); @@ -674,7 +674,7 @@ int currentTargetIndex = 1; { Body shaftBody = BodyFactory.CreateRectangle(GameMain.World, 100.0f, 10.0f, 5.0f); shaftBody.BodyType = BodyType.Kinematic; - shaftBody.CollisionCategories = Physics.CollisionWall | Physics.CollisionLevel; + shaftBody.CollisionCategories = Physics.CollisionLevel; shaftBody.SetTransform(ConvertUnits.ToSimUnits((i==0) ? startPosition : endPosition), 0.0f); shaftBody.SleepingAllowed = false; bodies.Add(shaftBody); diff --git a/Subsurface/Source/Map/Lights/LightManager.cs b/Subsurface/Source/Map/Lights/LightManager.cs index b6d3d57e9..ec7d06687 100644 --- a/Subsurface/Source/Map/Lights/LightManager.cs +++ b/Subsurface/Source/Map/Lights/LightManager.cs @@ -12,7 +12,7 @@ namespace Subsurface.Lights public Color AmbientLight; RenderTarget2D lightMap; - + private static Texture2D alphaClearTexture; private List lights; @@ -21,10 +21,10 @@ namespace Subsurface.Lights public bool LightingEnabled = true; - public RenderTarget2D LightMap - { - get { return lightMap; } - } + //public RenderTarget2D LightMap + //{ + // get { return lightMap; } + //} public LightManager(GraphicsDevice graphics) { @@ -34,7 +34,8 @@ namespace Subsurface.Lights var pp = graphics.PresentationParameters; - lightMap = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight, false, + lightMap = new RenderTarget2D(graphics, + GameMain.GraphicsWidth, GameMain.GraphicsHeight, false, pp.BackBufferFormat, pp.DepthStencilFormat, pp.MultiSampleCount, RenderTargetUsage.DiscardContents); @@ -81,8 +82,10 @@ namespace Subsurface.Lights } } - public void DrawLightmap(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam) + public void UpdateLightMap(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam) { + if (!LightingEnabled) return; + Matrix shadowTransform = cam.ShaderTransform * Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f; @@ -96,7 +99,7 @@ namespace Subsurface.Lights foreach (LightSource light in lights) { - if (light.Color.A < 0.01f || light.Range < 0.01f || light.hullsInRange.Count == 0) continue; + if (light.hullsInRange.Count == 0 || light.Color.A < 0.01f || light.Range < 1.0f) continue; if (!MathUtils.CircleIntersectsRectangle(light.Position, light.Range, viewRect)) continue; //clear alpha to 1 @@ -126,7 +129,7 @@ namespace Subsurface.Lights //foreach (LightSource light in lights) //{ - // if (light.Color.A < 0.01f || light.Range < 0.01f || light.hullsInRange.Count > 0) continue; + // if (light.hullsInRange.Count > 0 || light.Color.A < 0.01f || light.Range < 1.0f) continue; // if (!MathUtils.CircleIntersectsRectangle(light.Position, light.Range, viewRect)) continue; // light.Draw(spriteBatch); @@ -145,6 +148,16 @@ namespace Subsurface.Lights spriteBatch.Draw(alphaClearTexture, new Rectangle(0, 0,graphics.Viewport.Width, graphics.Viewport.Height), Color.White); spriteBatch.End(); } + + public void DrawLightMap(SpriteBatch spriteBatch, Camera cam) + { + if (!LightingEnabled) return; + + //multiply scene with lightmap + spriteBatch.Begin(SpriteSortMode.Immediate, CustomBlendStates.Multiplicative); + spriteBatch.Draw(lightMap, Vector2.Zero, Color.White); + spriteBatch.End(); + } } diff --git a/Subsurface/Source/Map/Lights/LightSource.cs b/Subsurface/Source/Map/Lights/LightSource.cs index d96b532c9..0ed505b0f 100644 --- a/Subsurface/Source/Map/Lights/LightSource.cs +++ b/Subsurface/Source/Map/Lights/LightSource.cs @@ -72,7 +72,7 @@ namespace Subsurface.Lights public void UpdateHullsInRange() { hullsInRange.Clear(); - if (range < 1.0f) return; + if (range < 1.0f || color.A < 0.01f) return; foreach (ConvexHull ch in ConvexHull.list) { diff --git a/Subsurface/Source/Networking/GameClient.cs b/Subsurface/Source/Networking/GameClient.cs index 10ea40173..e03f4b567 100644 --- a/Subsurface/Source/Networking/GameClient.cs +++ b/Subsurface/Source/Networking/GameClient.cs @@ -58,7 +58,7 @@ namespace Subsurface.Networking myCharacter = Character.Controlled; // Create new instance of configs. Parameter is "application Id". It has to be same on client and server. - NetPeerConfiguration config = new NetPeerConfiguration("subsurface"); + NetPeerConfiguration config = new NetPeerConfiguration("barotrauma"); #if DEBUG config.SimulatedLoss = 0.1f; diff --git a/Subsurface/Source/Networking/GameServer.cs b/Subsurface/Source/Networking/GameServer.cs index c23846ece..b611b4d6b 100644 --- a/Subsurface/Source/Networking/GameServer.cs +++ b/Subsurface/Source/Networking/GameServer.cs @@ -42,7 +42,7 @@ namespace Subsurface.Networking this.name = name; this.password = password; - config = new NetPeerConfiguration("subsurface"); + config = new NetPeerConfiguration("barotrauma"); #if DEBUG config.SimulatedLoss = 0.2f; @@ -82,7 +82,7 @@ namespace Subsurface.Networking if (config.EnableUPnP) { - server.UPnP.ForwardPort(config.Port, "subsurface"); + server.UPnP.ForwardPort(config.Port, "barotrauma"); GUIMessageBox upnpBox = new GUIMessageBox("Please wait...", "Attempting UPnP port forwarding", new string[] {"Cancel"} ); upnpBox.Buttons[0].OnClicked = upnpBox.Close; @@ -304,7 +304,7 @@ namespace Subsurface.Networking if (sender.version != GameMain.Version.ToString()) { DisconnectClient(sender, sender.name+" was unable to connect to the server (nonmatching game version)", - "Subsurface version " + GameMain.Version + " required to connect to the server (Your version: " + sender.version + ")"); + "Version " + GameMain.Version + " required to connect to the server (Your version: " + sender.version + ")"); } else if (connectedClients.Find(x => x.name == sender.name && x != sender)!=null) { @@ -460,7 +460,7 @@ namespace Subsurface.Networking } else if (version != GameMain.Version.ToString()) { - inc.SenderConnection.Deny("Subsurface version " + GameMain.Version + " required to connect to the server (Your version: " + version + ")"); + inc.SenderConnection.Deny("Version " + GameMain.Version + " required to connect to the server (Your version: " + version + ")"); DebugConsole.NewMessage(name + " couldn't join the server (wrong game version)", Color.Red); return; } diff --git a/Subsurface/Source/Physics/PhysicsBody.cs b/Subsurface/Source/Physics/PhysicsBody.cs index acb4e5834..f97ee93b6 100644 --- a/Subsurface/Source/Physics/PhysicsBody.cs +++ b/Subsurface/Source/Physics/PhysicsBody.cs @@ -220,15 +220,13 @@ namespace Subsurface this.radius = radius; dir = 1.0f; - - //items only collide with the map + body.CollisionCategories = Physics.CollisionMisc; - body.CollidesWith = Physics.CollisionWall; + body.CollidesWith = Physics.CollisionWall | Physics.CollisionLevel; body.Friction = ToolBox.GetAttributeFloat(element, "friction", 0.3f); body.Restitution = 0.05f; - - + body.BodyType = BodyType.Dynamic; //body.AngularDamping = Limb.LimbAngularDamping; diff --git a/Subsurface/Source/Program.cs b/Subsurface/Source/Program.cs index 0b6a9b028..dca120a86 100644 --- a/Subsurface/Source/Program.cs +++ b/Subsurface/Source/Program.cs @@ -49,12 +49,12 @@ namespace Subsurface StreamWriter sw = new StreamWriter(filePath); StringBuilder sb = new StringBuilder(); - sb.AppendLine("Subsurface crash report (generated on " + DateTime.Now + ")"); + sb.AppendLine("Barotrauma crash report (generated on " + DateTime.Now + ")"); sb.AppendLine("\n"); - sb.AppendLine("Subsurface seems to have crashed. Sorry for the inconvenience! "); + sb.AppendLine("Barotrauma seems to have crashed. Sorry for the inconvenience! "); sb.AppendLine("If you'd like to help fix the bug that caused the crash, please send this file to the developers on the Undertow Games forums."); sb.AppendLine("\n"); - sb.AppendLine("Subsurface version " + GameMain.Version); + sb.AppendLine("Game version " + GameMain.Version); sb.AppendLine("Selected content package: " + GameMain.SelectedPackage.Name); sb.AppendLine("Level seed: "+ ((Level.Loaded == null) ? "no level loaded" : Level.Loaded.Seed)); sb.AppendLine("Loaded submarine: " + ((Submarine.Loaded == null) ? "none" : Submarine.Loaded.Name +" ("+Submarine.Loaded.MD5Hash+")")); diff --git a/Subsurface/Source/Screens/GameScreen.cs b/Subsurface/Source/Screens/GameScreen.cs index 113a25503..1069506b6 100644 --- a/Subsurface/Source/Screens/GameScreen.cs +++ b/Subsurface/Source/Screens/GameScreen.cs @@ -158,7 +158,8 @@ namespace Subsurface public void DrawMap(GraphicsDevice graphics, SpriteBatch spriteBatch) { - if (GameMain.LightManager.LightingEnabled) GameMain.LightManager.DrawLightmap(graphics, spriteBatch, cam); + + GameMain.LightManager.UpdateLightMap(graphics, spriteBatch, cam); //---------------------------------------------------------------------------------------- //1. draw the background, characters and the parts of the submarine that are behind them @@ -167,7 +168,6 @@ namespace Subsurface graphics.SetRenderTarget(renderTarget); graphics.Clear(new Color(11, 18, 26, 255)); - spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque, SamplerState.LinearWrap, DepthStencilState.Default, RasterizerState.CullNone); Vector2 backgroundPos = cam.Position; @@ -274,14 +274,7 @@ namespace Subsurface GameMain.GameSession.Level.SetObserverPosition(cam.WorldViewCenter); } - if (GameMain.LightManager.LightingEnabled) - { - //multiply scene with lightmap - spriteBatch.Begin(SpriteSortMode.Immediate, CustomBlendStates.Multiplicative); - spriteBatch.Draw(GameMain.LightManager.LightMap, Vector2.Zero, Color.White); - spriteBatch.End(); - } - + GameMain.LightManager.DrawLightMap(spriteBatch, cam); //---------------------------------------------------------------------------------------- //3. draw the sections of the map that are on top of the water //---------------------------------------------------------------------------------------- @@ -294,12 +287,8 @@ namespace Subsurface foreach (Character c in Character.CharacterList) c.DrawFront(spriteBatch); Submarine.DrawFront(spriteBatch); - - if (GameMain.GameSession != null && GameMain.GameSession.Level != null) - { - GameMain.GameSession.Level.Draw(spriteBatch); - //Game1.GameSession.Level.SetObserverPosition(cam.WorldViewCenter); - } + + GameMain.GameSession?.Level?.Draw(spriteBatch); spriteBatch.End(); diff --git a/Subsurface/Source/Screens/MainMenuScreen.cs b/Subsurface/Source/Screens/MainMenuScreen.cs index e9661fb7d..ed7e51ae3 100644 --- a/Subsurface/Source/Screens/MainMenuScreen.cs +++ b/Subsurface/Source/Screens/MainMenuScreen.cs @@ -2,9 +2,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Subsurface.Networking; -using System.IO; using System.Xml.Linq; -using System.Collections.Generic; namespace Subsurface { @@ -385,7 +383,7 @@ namespace Subsurface GUI.Draw((float)deltaTime, spriteBatch, null); - spriteBatch.DrawString(GUI.Font, "Subsurface v"+GameMain.Version, new Vector2(10, GameMain.GraphicsHeight-20), Color.White); + spriteBatch.DrawString(GUI.Font, "Barotrauma v"+GameMain.Version, new Vector2(10, GameMain.GraphicsHeight-20), Color.White); spriteBatch.End(); } @@ -410,7 +408,7 @@ namespace Subsurface GameMain.LobbyScreen.Select(); - new GUIMessageBox("Welcome to Subsurface!", "Please note that the single player mode is very unfinished at the moment; "+ + new GUIMessageBox("Welcome to Barotrauma!", "Please note that the single player mode is very unfinished at the moment; "+ "for example, the NPCs don't have an AI yet and there are only a couple of different quests to complete. The multiplayer "+ "mode should be much more enjoyable to play at the moment, so my recommendation is to try out and get a hang of the game mechanics "+ "in the single player mode and then move on to multiplayer. Have fun!\n - Regalis, the main dev of Subsurface", 400, 350); diff --git a/Subsurface/Source/Screens/ServerListScreen.cs b/Subsurface/Source/Screens/ServerListScreen.cs index 66b287a9d..d1a691daa 100644 --- a/Subsurface/Source/Screens/ServerListScreen.cs +++ b/Subsurface/Source/Screens/ServerListScreen.cs @@ -208,7 +208,7 @@ namespace Subsurface var request = new RestRequest("masterserver.php", Method.GET); - request.AddParameter("gamename", "subsurface"); // adds to POST or URL querystring based on Method + request.AddParameter("gamename", "barotrauma"); // adds to POST or URL querystring based on Method request.AddParameter("action", "listservers"); // adds to POST or URL querystring based on Method @@ -327,8 +327,6 @@ namespace Subsurface public override void Update(double deltaTime) { - - menu.Update((float)deltaTime); GUI.Update((float)deltaTime); diff --git a/Subsurface/readme.txt b/Subsurface/readme.txt index d3d4f6d62..c30bff76f 100644 --- a/Subsurface/readme.txt +++ b/Subsurface/readme.txt @@ -1,4 +1,4 @@ -SUBSURFACE +BAROTRAUMA www.undertowgames.com/subsurface Copyright © Undertow Games 2015 @@ -29,9 +29,9 @@ guide for your particular router/application on portforward.com or by practicing your google-fu skills. These are the values that you should use when forwarding a port to your -Subsurface server: +Barotrauma server: -Service/Application: subsurface +Service/Application: barotrauma External Port: The port you have selected for your server (14242 by default) Internal Port: The port you have selected for your server (14242 by default) Protocol: UDP