diff --git a/Launcher2/Icon.ico b/Launcher2/Icon.ico index 7d9dec187..5b40528ea 100644 Binary files a/Launcher2/Icon.ico and b/Launcher2/Icon.ico differ diff --git a/Launcher2/LauncherMain.cs b/Launcher2/LauncherMain.cs index f607f340c..75f9d8948 100644 --- a/Launcher2/LauncherMain.cs +++ b/Launcher2/LauncherMain.cs @@ -143,6 +143,11 @@ namespace Launcher2 if (settings.GraphicsWidth == mode.Width && settings.GraphicsHeight == mode.Height) resolutionDD.SelectItem(mode); } + if (resolutionDD.SelectedItemData==null) + { + resolutionDD.SelectItem(GraphicsAdapter.DefaultAdapter.SupportedDisplayModes.Last()); + } + new GUITextBlock(new Rectangle(x, y + 50, 20, 20), "Content package", GUI.Style, Alignment.TopLeft, Alignment.TopLeft, guiRoot); contentPackageDD = new GUIDropDown(new Rectangle(x, y + 70, 200, 20), "", GUI.Style, guiRoot); @@ -153,7 +158,7 @@ namespace Launcher2 if (settings.SelectedContentPackage == contentPackage) contentPackageDD.SelectItem(contentPackage); } - new GUIButton(new Rectangle(x,y+120,150,20), "Package Manager", GUI.Style, guiRoot); + //new GUIButton(new Rectangle(x,y+120,150,20), "Package Manager", GUI.Style, guiRoot); var fullScreenTick = new GUITickBox(new Rectangle(x,y+150,20,20), "Fullscreen", Alignment.TopLeft, guiRoot); fullScreenTick.OnSelected = ToggleFullScreen; diff --git a/Launcher2/Properties/AssemblyInfo.cs b/Launcher2/Properties/AssemblyInfo.cs index 4ddff2475..b63ffe7f1 100644 --- a/Launcher2/Properties/AssemblyInfo.cs +++ b/Launcher2/Properties/AssemblyInfo.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("Launcher2")] +[assembly: AssemblyTitle("Barotrauma Launcher")] [assembly: AssemblyProduct("Launcher2")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyDescription("")] diff --git a/Subsurface/Content/Characters/Human/human.xml b/Subsurface/Content/Characters/Human/human.xml index b81c79cc2..5af2065ec 100644 --- a/Subsurface/Content/Characters/Human/human.xml +++ b/Subsurface/Content/Characters/Human/human.xml @@ -4,7 +4,11 @@ + stepsize="42.0, 12.0" + walkanimspeed="4.58" + movementlerp="0.4" + legtorque="15.0" + thightorque="-5.0"> diff --git a/Subsurface/Source/Characters/Character.cs b/Subsurface/Source/Characters/Character.cs index 74ae1457f..759a8ffa7 100644 --- a/Subsurface/Source/Characters/Character.cs +++ b/Subsurface/Source/Characters/Character.cs @@ -680,17 +680,8 @@ namespace Subsurface public void Update(Camera cam, float deltaTime) { - if (isDead) - { - if (controlled == this) - { - cam.Zoom = MathHelper.Lerp(cam.Zoom, 1.5f, 0.1f); - cam.TargetPos = ConvertUnits.ToDisplayUnits(AnimController.limbs[0].SimPosition); - cam.OffsetAmount = 0.0f; - } - return; - } - + if (isDead) return; + if (PressureProtection==0.0f && (AnimController.CurrentHull == null || AnimController.CurrentHull.LethalPressure >= 100.0f)) { @@ -953,15 +944,40 @@ namespace Subsurface Kill(true); } - private IEnumerable DeathAnim() + private IEnumerable DeathAnim(Camera cam) { - float timer = 8.0f; + float dimDuration = 8.0f; + float timer = 0.0f; - while (timer > 0.0f) + Color prevAmbientLight = Game1.LightManager.AmbientLight; + + while (timer < dimDuration) { AnimController.UpdateAnim(1.0f / 60.0f); - timer -= 1.0f / 60.0f; + timer += 1.0f / 60.0f; + if (cam != null) + { + cam.TargetPos = ConvertUnits.ToDisplayUnits(AnimController.limbs[0].SimPosition); + cam.OffsetAmount = 0.0f; + } + + Game1.LightManager.AmbientLight = Color.Lerp(prevAmbientLight, Color.DarkGray, timer / dimDuration); + + yield return CoroutineStatus.Running; + } + + while (Character.Controlled == this) + { + yield return CoroutineStatus.Running; + } + + float lerpLightBack = 0.0f; + while (lerpLightBack<1.0f) + { + lerpLightBack = Math.Min(lerpLightBack+0.05f,1.0f); + + Game1.LightManager.AmbientLight = Color.Lerp(Color.DarkGray, prevAmbientLight, lerpLightBack); yield return CoroutineStatus.Running; } @@ -985,7 +1001,7 @@ namespace Subsurface } } - CoroutineManager.StartCoroutine(DeathAnim()); + CoroutineManager.StartCoroutine(DeathAnim(Game1.GameScreen.Cam)); health = 0.0f; diff --git a/Subsurface/Source/Characters/HumanoidAnimController.cs b/Subsurface/Source/Characters/HumanoidAnimController.cs index d354043c0..c5280e4bb 100644 --- a/Subsurface/Source/Characters/HumanoidAnimController.cs +++ b/Subsurface/Source/Characters/HumanoidAnimController.cs @@ -11,9 +11,21 @@ namespace Subsurface { private bool aiming; + private float walkAnimSpeed; + + private float movementLerp; + + private float thighTorque; + public HumanoidAnimController(Character character, XElement element) : base(character, element) { + walkAnimSpeed = ToolBox.GetAttributeFloat(element, "walkanimspeed", 4.0f); + walkAnimSpeed = MathHelper.ToRadians(walkAnimSpeed); + + movementLerp = ToolBox.GetAttributeFloat(element, "movementlerp", 0.4f); + + thighTorque = ToolBox.GetAttributeFloat(element, "thightorque", -5.0f); } public override void UpdateAnim(float deltaTime) @@ -26,7 +38,7 @@ namespace Subsurface Vector2 colliderPos = GetLimb(LimbType.Torso).SimPosition; - if (inWater) stairs = null; + //if (inWater) stairs = null; Vector2 rayStart = colliderPos; // at the bottom of the player sprite Vector2 rayEnd = rayStart - new Vector2(0.0f, TorsoPosition); @@ -42,7 +54,7 @@ namespace Subsurface switch (fixture.CollisionCategories) { case Physics.CollisionStairs: - if (inWater) return -1; + if (inWater && TargetMovement.Y < 0.5f) return -1; Structure structure = fixture.Body.UserData as Structure; if (stairs == null && structure!=null) { @@ -155,6 +167,8 @@ namespace Subsurface aiming = false; } + + void UpdateStanding() { Vector2 handPos; @@ -164,6 +178,8 @@ namespace Subsurface Limb head = GetLimb(LimbType.Head); Limb torso = GetLimb(LimbType.Torso); + Limb waist = GetLimb(LimbType.Waist); + Limb leftHand = GetLimb(LimbType.LeftHand); Limb rightHand = GetLimb(LimbType.RightHand); @@ -171,7 +187,7 @@ namespace Subsurface Limb rightLeg = GetLimb(LimbType.RightLeg); float getUpSpeed = 0.3f; - float walkCycleSpeed = head.LinearVelocity.X * 0.08f; + float walkCycleSpeed = head.LinearVelocity.X * walkAnimSpeed; if (stairs != null) { TargetMovement = new Vector2(MathHelper.Clamp(TargetMovement.X, -2.0f, 2.0f), TargetMovement.Y) ; @@ -183,7 +199,6 @@ namespace Subsurface } else { - TargetMovement /= 1.2f; } @@ -200,9 +215,9 @@ namespace Subsurface this.stepSize.X * walkPosX * runningModifier, this.stepSize.Y * walkPosY * runningModifier * runningModifier); - float footMid = (leftFoot.SimPosition.X + rightFoot.SimPosition.X) / 2.0f; + float footMid = waist.SimPosition.X;// (leftFoot.SimPosition.X + rightFoot.SimPosition.X) / 2.0f; - movement = MathUtils.SmoothStep(movement, TargetMovement, 0.4f); + movement = MathUtils.SmoothStep(movement, TargetMovement, movementLerp); movement.Y = 0.0f; //place the anchors of the head and the torso to make the ragdoll stand @@ -230,12 +245,17 @@ namespace Subsurface torso.pullJoint.Enabled = true; torso.pullJoint.WorldAnchorB = MathUtils.SmoothStep(torso.SimPosition, - new Vector2(footMid + movement.X * 0.35f, colliderPos.Y + TorsoPosition), getUpSpeed); + new Vector2(footMid + movement.X * 0.3f, colliderPos.Y + TorsoPosition), getUpSpeed); head.pullJoint.Enabled = true; head.pullJoint.WorldAnchorB = MathUtils.SmoothStep(head.SimPosition, - new Vector2(footMid + movement.X * 0.4f, colliderPos.Y + HeadPosition), getUpSpeed); + new Vector2(footMid + movement.X * (0.2f + runningModifier / 10.0f), colliderPos.Y + HeadPosition), getUpSpeed); + + waist.pullJoint.Enabled = true; + waist.pullJoint.WorldAnchorB = waist.SimPosition + movement*0.1f; + //MathUtils.SmoothStep(waist.SimPosition, + //new Vector2(footMid + movement.X * 0.4f, colliderPos.Y + HeadPosition), getUpSpeed); } @@ -257,31 +277,40 @@ namespace Subsurface (-stepSize.Y > 0.0f) ? -stepSize.Y : -0.15f), 15.0f, true); - if (Math.Sign(stepSize.X) == Math.Sign(Dir)) + leftFoot.body.SmoothRotate(leftLeg.body.Rotation + MathHelper.PiOver2 * Dir * 1.6f, 20.0f * runningModifier); + rightFoot.body.SmoothRotate(rightLeg.body.Rotation + MathHelper.PiOver2 * Dir * 1.6f, 20.0f * runningModifier); + + if (runningModifier>1.0f) { - leftFoot.body.SmoothRotate(leftLeg.body.Rotation + MathHelper.PiOver2 * Dir * 1.6f, 20.0f * runningModifier); - } - else if (Math.Sign(-stepSize.X) == Math.Sign(Dir)) - { - rightFoot.body.SmoothRotate(rightLeg.body.Rotation + MathHelper.PiOver2 * Dir * 1.6f, 20 * runningModifier); + if (walkPosY > 0.0f) + { + GetLimb(LimbType.LeftThigh).body.ApplyTorque(-walkPosY * Dir * Math.Abs(movement.X) * thighTorque); + } + else + { + GetLimb(LimbType.RightThigh).body.ApplyTorque(walkPosY * Dir * Math.Abs(movement.X) * thighTorque); + } } - if (walkPosY > 0.0f) + if (legTorque>0.0f) { - GetLimb(LimbType.LeftThigh).body.ApplyTorque(-walkPosY * Dir * Math.Abs(movement.X) * -5.0f); - } - else - { - GetLimb(LimbType.RightThigh).body.ApplyTorque(walkPosY * Dir * Math.Abs(movement.X) * -5.0f); + if (Math.Sign(walkPosX) != Math.Sign(movement.X)) + { + GetLimb(LimbType.LeftLeg).body.ApplyTorque(-walkPosY * Dir * Math.Abs(movement.X) * legTorque / runningModifier); + } + else + { + GetLimb(LimbType.RightLeg).body.ApplyTorque(walkPosY * Dir * Math.Abs(movement.X) * legTorque / runningModifier); + } } //calculate the positions of hands handPos = torso.SimPosition; - handPos.X = -walkPosX * 0.1f * runningModifier; + handPos.X = -walkPosX * 0.2f;// *runningModifier; float lowerY = -0.6f + runningModifier/3.5f; - handPos.Y = lowerY + (float)(Math.Abs(Math.Sin(walkPos - Math.PI * 1.5f) * 0.1)) / runningModifier; + handPos.Y = lowerY + (float)(Math.Abs(Math.Sin(walkPos - Math.PI * 1.5f) * 0.05)) / runningModifier; Vector2 posAdditon = new Vector2(movement.X*0.07f, 0.0f); if (stairs!=null) @@ -321,11 +350,6 @@ namespace Subsurface } else { - //add torque to the head to do a subtle "breathing" effect - //head.body.ApplyTorque((float)Math.Sin(gameTime.TotalGameTime.TotalMilliseconds / 300) * 0.2f); - - //standing still -> "attach" the feet to the ground - float movementFactor = (movement.X / 4.0f) * movement.X * Math.Sign(movement.X); Vector2 footPos = new Vector2( @@ -337,13 +361,7 @@ namespace Subsurface leftFoot.body.SmoothRotate(Dir * MathHelper.PiOver2, 5.0f); rightFoot.body.SmoothRotate(Dir * MathHelper.PiOver2, 5.0f); - - - - - //handPos = torso.SimPosition; - //handPos.X += movement.X; - //handPos.Y -= 0.4f; + if (!rightHand.Disabled) { // MoveLimb(rightHand, handPos, 0.05f, true); diff --git a/Subsurface/Source/Characters/Limb.cs b/Subsurface/Source/Characters/Limb.cs index b21c6fb77..31b065a97 100644 --- a/Subsurface/Source/Characters/Limb.cs +++ b/Subsurface/Source/Characters/Limb.cs @@ -426,7 +426,7 @@ namespace Subsurface if (pullJoint!=null) { Vector2 pos = ConvertUnits.ToDisplayUnits(pullJoint.WorldAnchorB); - GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)pos.Y, 5, 5), Color.Red, true); + GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)-pos.Y, 5, 5), Color.Red, true); } if (bodyShapeTexture == null) diff --git a/Subsurface/Source/Characters/Ragdoll.cs b/Subsurface/Source/Characters/Ragdoll.cs index 776ceacd6..a8f2b886e 100644 --- a/Subsurface/Source/Characters/Ragdoll.cs +++ b/Subsurface/Source/Characters/Ragdoll.cs @@ -283,13 +283,15 @@ namespace Subsurface } else if (structure.StairDirection!=Direction.None) { - if ((inWater || !(targetMovement.Y>Math.Abs(targetMovement.X/2.0f))) && - lowestLimb.Position.Y < structure.Rect.Y - structure.Rect.Height + 50.0f) + if (targetMovement.Y < 0.5f) { - stairs = null; - return false; + if (inWater || lowestLimb.Position.Y < structure.Rect.Y - structure.Rect.Height + 50.0f) + { + stairs = null; + return false; + } } - + if (targetMovement.Y >= 0.0f && lowestLimb.SimPosition.Y > ConvertUnits.ToSimUnits(structure.Rect.Y - Submarine.GridSize.Y * 8.0f)) { stairs = null; @@ -367,12 +369,14 @@ namespace Subsurface if (limb.pullJoint != null) { Vector2 pos = ConvertUnits.ToDisplayUnits(limb.pullJoint.WorldAnchorA); - GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)-pos.Y, 5, 5), Color.Red, true, 0.01f); + pos.Y = -pos.Y; + GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)pos.Y, 5, 5), Color.Red, true, 0.01f); if (limb.AnimTargetPos == Vector2.Zero) continue; Vector2 pos2 = ConvertUnits.ToDisplayUnits(limb.AnimTargetPos); - GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos2.X, (int)-pos2.Y, 5, 5), Color.Blue, true, 0.01f); + pos2.Y = -pos2.Y; + GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos2.X, (int)pos2.Y, 5, 5), Color.Blue, true, 0.01f); GUI.DrawLine(spriteBatch, pos, pos2, Color.Green); } diff --git a/Subsurface/Source/CoroutineManager.cs b/Subsurface/Source/CoroutineManager.cs index 9b08261bf..c5be073fc 100644 --- a/Subsurface/Source/CoroutineManager.cs +++ b/Subsurface/Source/CoroutineManager.cs @@ -56,12 +56,18 @@ namespace Subsurface break; } } - } + try + { + Coroutines[i].MoveNext(); + } - Coroutines[i].MoveNext(); - + catch (Exception e) + { + DebugConsole.ThrowError("Coroutine "+Coroutines[i]+" threw an exception: "+e.Message); + Coroutines.RemoveAt(i); + } } } diff --git a/Subsurface/Source/GUI/GUITextBlock.cs b/Subsurface/Source/GUI/GUITextBlock.cs index 6f2afa6ed..7ea96e934 100644 --- a/Subsurface/Source/GUI/GUITextBlock.cs +++ b/Subsurface/Source/GUI/GUITextBlock.cs @@ -120,7 +120,7 @@ namespace Subsurface SetTextPos(); - if (rect.Height == 0) + if (rect.Height == 0 && !string.IsNullOrWhiteSpace(Text)) { this.rect.Height = (int)Font.MeasureString(Text).Y; } diff --git a/Subsurface/Source/GameSession/GameModes/TutorialMode.cs b/Subsurface/Source/GameSession/GameModes/TutorialMode.cs index 88b91fa1d..69e8d55a4 100644 --- a/Subsurface/Source/GameSession/GameModes/TutorialMode.cs +++ b/Subsurface/Source/GameSession/GameModes/TutorialMode.cs @@ -400,9 +400,9 @@ namespace Subsurface yield return new WaitForSeconds(1.0f); } - infoBox = CreateInfoFrame("The capacitors consume large amounts of power when they're being charged at a high rate. "+ - "Be cautious to overload the electrical grid or the reactor. They also take some time to recharge, so now is a good "+ - "time to head to the room below to load some shells into the railgun."); + infoBox = CreateInfoFrame("The capacitors consume large amounts of power when they're being charged at a high rate, so "+ + "be careful not to overload the electrical grid or the reactor. They also take some time to recharge, so now is a good "+ + "time to head to the room below and load some shells for the railgun."); var loader = Item.itemList.Find(i => i.Name == "Railgun Loader").GetComponent(); diff --git a/Subsurface/Source/Items/Components/Machines/Pump.cs b/Subsurface/Source/Items/Components/Machines/Pump.cs index f2f7e8471..0198c6b28 100644 --- a/Subsurface/Source/Items/Components/Machines/Pump.cs +++ b/Subsurface/Source/Items/Components/Machines/Pump.cs @@ -38,8 +38,19 @@ namespace Subsurface.Items.Components public Pump(Item item, XElement element) : base(item, element) { - item.linkedTo.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs e) - { GetHulls(); }; + GetHull(); + } + + public override void Move(Vector2 amount) + { + base.Move(amount); + + GetHull(); + } + + public override void OnMapLoaded() + { + GetHull(); } public override void Update(float deltaTime, Camera cam) @@ -77,28 +88,33 @@ namespace Subsurface.Items.Components voltage = 0.0f; } - - private void GetHulls() + + private void GetHull() { - hull1 = null; - hull2 = null; - - foreach (MapEntity e in item.linkedTo) - { - Hull hull = e as Hull; - if (hull == null) continue; - - if (hull1 == null) - { - hull1 = hull; - } - else if (hull2 == null && hull != hull1) - { - hull2 = hull; - break; - } - } + hull1 = Hull.FindHull(item.Position, item.CurrentHull); } + + //private void GetHulls() + //{ + // hull1 = null; + // hull2 = null; + + // foreach (MapEntity e in item.linkedTo) + // { + // Hull hull = e as Hull; + // if (hull == null) continue; + + // if (hull1 == null) + // { + // hull1 = hull; + // } + // else if (hull2 == null && hull != hull1) + // { + // hull2 = hull; + // break; + // } + // } + //} public override void DrawHUD(SpriteBatch spriteBatch, Character character) { diff --git a/Subsurface/Source/Items/Components/Signal/Wire.cs b/Subsurface/Source/Items/Components/Signal/Wire.cs index 8260a7337..c18f608de 100644 --- a/Subsurface/Source/Items/Components/Signal/Wire.cs +++ b/Subsurface/Source/Items/Components/Signal/Wire.cs @@ -287,20 +287,21 @@ namespace Subsurface.Items.Components for (int i = 1; i < Nodes.Count; i++) { - GUI.DrawRectangle(spriteBatch, new Rectangle((int)Nodes[i].X - 3, (int)-Nodes[i].Y -3, 6, 6), Color.Red, true, 0.0f); + GUI.DrawRectangle(spriteBatch, new Rectangle((int)Nodes[i].X - 3, (int)-Nodes[i].Y - 3, 6, 6), Color.Red, true, 0.0f); - if (Vector2.Distance(Game1.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition), Nodes[i]) < 20.0f) + if (GUIComponent.MouseOn == null && + Vector2.Distance(Game1.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition), Nodes[i]) < 20.0f) { GUI.DrawRectangle(spriteBatch, new Rectangle((int)Nodes[i].X - 10, (int)-Nodes[i].Y - 10, 20, 20), Color.Red, false, 0.0f); - if (selectedNodeIndex==null && selectedNodeIndex>0 && selectedNodeIndex0 && selectedNodeIndex 1 && linkedTo[1] != null) - // GUI.DrawLine(sb, new Vector2(Position.X, Position.Y), - // new Vector2(linkedTo[1].Position.X, linkedTo[1].Position.Y), Color.Blue); - - - //GUI.DrawLine(sb, new Vector2(Position.X, -Position.Y), new Vector2(Position.X, -Position.Y)+new Vector2(flowForce.X, -flowForce.Y), Color.LightBlue); - if (!editing) return; Color clr = (open == 0.0f) ? Color.Red : Color.Cyan; - GUI.DrawRectangle(sb, new Rectangle(rect.X, -rect.Y, rect.Width, rect.Height), clr); + GUI.DrawRectangle(sb, new Rectangle(rect.X, -rect.Y, rect.Width, rect.Height), clr*0.5f, true); + + if (isHorizontal) + { + for (int i = 0; i < linkedTo.Count; i++ ) + { + if (linkedTo[i].Rect.Center.X > rect.Center.X) + { + GUI.DrawRectangle(sb, new Rectangle(rect.Right, -rect.Y, 10, rect.Height), Color.Green * 0.3f, true); + } + else + { + GUI.DrawRectangle(sb, new Rectangle(rect.X - 10, -rect.Y, 10, rect.Height), Color.Green * 0.3f, true); + } + } + } + else + { + for (int i = 0; i < linkedTo.Count; i++) + { + if (linkedTo[i].Rect.Y - linkedTo[i].Rect.Height/2.0f > rect.Y) + { + GUI.DrawRectangle(sb, new Rectangle(rect.X, -rect.Y - 10, rect.Width, 10), Color.Green * 0.3f, true); + } + else + { + GUI.DrawRectangle(sb, new Rectangle(rect.X, -rect.Y + rect.Height, rect.Width, 10), Color.Green * 0.3f, true); + } + } + } if (isSelected) { @@ -202,10 +220,6 @@ namespace Subsurface new Vector2(rect.Width + 10, rect.Height + 10), Color.Red); } - - //HUD.DrawLine(sb, new Vector2(position.X, -position.Y), - // isHorizontal ? new Vector2(position.X, -position.Y + size) : new Vector2(position.X + size, -position.Y), - // clr); } public override void Update(Camera cam, float deltaTime) @@ -218,10 +232,7 @@ namespace Subsurface index = Math.Min(index,2); soundIndex = AmbientSoundManager.flowSounds[index].Loop(soundIndex, soundVolume, Position, 2000.0f); - //soundVolume = Math.Max(0.0f, soundVolume-deltaTime); - //Sound.UpdatePosition(soundIndex, Position, 2000.0f); - flowForce = Vector2.Zero; if (open == 0.0f) return; @@ -240,7 +251,7 @@ namespace Subsurface UpdateRoomToRoom(deltaTime); } - if (FlowForce.Length() > 150.0f && flowTargetHull!=null && flowTargetHull.Volume < flowTargetHull.FullVolume) + if (FlowForce.Length() > 150.0f && flowTargetHull != null && flowTargetHull.Volume < flowTargetHull.FullVolume) { //UpdateFlowForce(); diff --git a/Subsurface/Source/Map/Lights/Light.cs b/Subsurface/Source/Map/Lights/LightSource.cs similarity index 99% rename from Subsurface/Source/Map/Lights/Light.cs rename to Subsurface/Source/Map/Lights/LightSource.cs index 5a343f4fb..3b57c26b3 100644 --- a/Subsurface/Source/Map/Lights/Light.cs +++ b/Subsurface/Source/Map/Lights/LightSource.cs @@ -9,7 +9,6 @@ namespace Subsurface.Lights { class LightSource { - private static Texture2D lightTexture; private Color color; diff --git a/Subsurface/Source/Program.cs b/Subsurface/Source/Program.cs index 278d37812..8b88b8480 100644 --- a/Subsurface/Source/Program.cs +++ b/Subsurface/Source/Program.cs @@ -87,13 +87,15 @@ namespace Subsurface sw.WriteLine(sb.ToString()); + sw.Close(); + #if WINDOWS MessageBox.Show( "A crash report (''crashreport.txt'') was saved in the root folder of the game."+ - " If you'd like to help fix this bug, please make a bug report on the Undertow Games forum with the report attached.", + " If you'd like to help fix this bug, please post the report on the Undertow Games forums.", "Oops! Subsurface just crashed.", MessageBoxButtons.OK, MessageBoxIcon.Error); #endif - sw.Close(); + } } #endif diff --git a/Subsurface/Source/Screens/EditMapScreen.cs b/Subsurface/Source/Screens/EditMapScreen.cs index 779eb10b2..8a50933b9 100644 --- a/Subsurface/Source/Screens/EditMapScreen.cs +++ b/Subsurface/Source/Screens/EditMapScreen.cs @@ -24,6 +24,27 @@ namespace Subsurface get { return cam; } } + public string GetSubName() + { + return ((Submarine.Loaded == null) ? "" : Submarine.Loaded.Name); + } + + private string GetItemCount() + { + return "Items: " +Item.itemList.Count; + } + + private string GetStructureCount() + { + return "Structures: " + (MapEntity.mapEntityList.Count - Item.itemList.Count); + } + + private string GetPhysicsBodyCount() + { + return "Physics bodies: " + Game1.World.BodyList.Count; + } + + public EditMapScreen() { cam = new Camera(); @@ -37,15 +58,28 @@ namespace Subsurface //constructionList.OnSelected = MapEntityPrefab.SelectPrefab; //constructionList.CheckSelected = MapEntityPrefab.GetSelected; - GUIButton button = new GUIButton(new Rectangle(0, 50, 100, 20), "Items", Alignment.Left, GUI.Style, GUIpanel); + GUITextBlock nameBlock = new GUITextBlock(new Rectangle(0, 30, 0, 20), "", GUI.Style, Alignment.TopLeft, Alignment.TopLeft, GUIpanel, true, GUI.LargeFont); + nameBlock.TextGetter = GetSubName; + + GUITextBlock itemCount = new GUITextBlock(new Rectangle(0, 80, 0, 20), "", GUI.Style, GUIpanel); + itemCount.TextGetter = GetItemCount; + + GUITextBlock structureCount = new GUITextBlock(new Rectangle(0, 100, 0, 20), "", GUI.Style, GUIpanel); + structureCount.TextGetter = GetStructureCount; + + //GUITextBlock physicsBodyCount = new GUITextBlock(new Rectangle(0, 120, 0, 20), "", GUI.Style, GUIpanel); + //physicsBodyCount.TextGetter = GetPhysicsBodyCount; + + GUIButton button = new GUIButton(new Rectangle(0, 150, 0, 20), "Items", Alignment.Left, GUI.Style, GUIpanel); button.UserData = 0; button.OnClicked = SelectTab; - button = new GUIButton(new Rectangle(0, 80, 100, 20), "Structures", Alignment.Left, GUI.Style, GUIpanel); + button = new GUIButton(new Rectangle(0, 180, 0, 20), "Structures", Alignment.Left, GUI.Style, GUIpanel); button.UserData = 1; button.OnClicked = SelectTab; - button = new GUIButton(new Rectangle(0, 140, 100, 20), "Character mode", Alignment.Left, GUI.Style, GUIpanel); + button = new GUIButton(new Rectangle(0, 220, 0, 20), "Character mode", Alignment.Left, GUI.Style, GUIpanel); + button.ToolTip = "Allows you to pick up and use items. Useful for things such as placing items inside closets, turning devices on/off and doing the wiring."; button.OnClicked = ToggleCharacterMode; GUItabs = new GUIComponent[2]; @@ -130,10 +164,10 @@ namespace Subsurface private bool ToggleCharacterMode(GUIButton button, object obj) { - selectedTab = 0; + selectedTab = -1; characterMode = !characterMode; - button.Color = (characterMode) ? Color.Gold : Color.White; + //button.Color = (characterMode) ? Color.Gold : Color.White; if (characterMode) { @@ -170,16 +204,9 @@ namespace Subsurface /// Provides a snapshot of timing values. public override void Update(double deltaTime) { - //Vector2 mousePosition = new Vector2(PlayerInput.GetMouseState.X, PlayerInput.GetMouseState.Y); - //mousePosition = cam.ScreenToWorld(mousePosition); - //if (!Character.characterList.Contains(dummyCharacter)) - //{ - // CreateDummyCharacter(); - //} - - if (GUIComponent.MouseOn==null) cam.MoveCamera((float)deltaTime); - cam.Zoom = MathHelper.Clamp(cam.Zoom + PlayerInput.ScrollWheelSpeed/1000.0f,0.1f, 2.0f); + if (GUIComponent.MouseOn == null) cam.MoveCamera((float)deltaTime); + cam.Zoom = MathHelper.Clamp(cam.Zoom + PlayerInput.ScrollWheelSpeed / 1000.0f, 0.1f, 2.0f); if (characterMode) { diff --git a/Subsurface/Subsurface.csproj b/Subsurface/Subsurface.csproj index 3cbaaa924..3e1cfe070 100644 --- a/Subsurface/Subsurface.csproj +++ b/Subsurface/Subsurface.csproj @@ -43,6 +43,12 @@ true bin\Windows\Release\ TRACE;WINDOWS + + + .allowedextension + prompt 4 @@ -85,7 +91,7 @@ - + diff --git a/Subsurface/Subsurface.csproj.user b/Subsurface/Subsurface.csproj.user index 693505ea4..c2dd67340 100644 --- a/Subsurface/Subsurface.csproj.user +++ b/Subsurface/Subsurface.csproj.user @@ -11,4 +11,8 @@ false ShowAllFiles + + + + \ No newline at end of file diff --git a/Subsurface_Solution.v12.suo b/Subsurface_Solution.v12.suo index c7e248a4d..d99e1b1d3 100644 Binary files a/Subsurface_Solution.v12.suo and b/Subsurface_Solution.v12.suo differ