diff --git a/Report20151010-1429.vspx b/Report20151010-1429.vspx deleted file mode 100644 index 57f40c253..000000000 Binary files a/Report20151010-1429.vspx and /dev/null differ diff --git a/Report20151010-1451.vspx b/Report20151010-1451.vspx deleted file mode 100644 index d578c0c9c..000000000 Binary files a/Report20151010-1451.vspx and /dev/null differ diff --git a/Subsurface/Barotrauma.csproj b/Subsurface/Barotrauma.csproj index dd85d1914..890bf0651 100644 --- a/Subsurface/Barotrauma.csproj +++ b/Subsurface/Barotrauma.csproj @@ -60,6 +60,7 @@ + @@ -1124,9 +1125,9 @@ {49ba1c69-6104-41ac-a5d8-b54fa9f696e8} Lidgren.Network - + {1e6bf44d-6e31-40cc-8321-3d5958c983e7} - Subsurface_content + Barotrauma_content diff --git a/Subsurface/Content/Items/Weapons/weapons.xml b/Subsurface/Content/Items/Weapons/weapons.xml index 4e52c7076..5872eba7f 100644 --- a/Subsurface/Content/Items/Weapons/weapons.xml +++ b/Subsurface/Content/Items/Weapons/weapons.xml @@ -20,7 +20,8 @@ + price="500" + tags="weapon"> @@ -45,7 +46,7 @@ name="Stun Grenade" pickdistance="200" price="200" - tags="smallitem"> + tags="smallitem,weapon"> @@ -60,7 +61,7 @@ diff --git a/Subsurface/Source/Characters/AI/CrewCommander.cs b/Subsurface/Source/Characters/AI/CrewCommander.cs index 06fdf8dc6..cea3f0d34 100644 --- a/Subsurface/Source/Characters/AI/CrewCommander.cs +++ b/Subsurface/Source/Characters/AI/CrewCommander.cs @@ -48,36 +48,54 @@ namespace Barotrauma frame = new GUIFrame(Rectangle.Empty, Color.Black * 0.3f); frame.Padding = new Vector4(200.0f, 100.0f, 200.0f, 100.0f); - UpdateCharacters(); + //UpdateCharacters(); - int x = 0, y = 150; - foreach (Order order in Order.PrefabList) - { - if (order.ItemComponentType!=null) + int buttonWidth = 130; + int spacing = 10; + + int y = 250; + + for (int n = 0; n<2; n++) + { + + List orders = (n==0) ? + Order.PrefabList.FindAll(o => o.ItemComponentType == null) : + Order.PrefabList.FindAll(o=> o.ItemComponentType!=null); + + int startX = (int)-(buttonWidth * orders.Count + spacing * (orders.Count - 1)) / 2; + + int i=0; + foreach (Order order in orders) { - var matchingItems = Item.ItemList.FindAll(i => i.components.Find(ic => ic.GetType() == order.ItemComponentType) != null); - int y2 = y; - foreach (Item it in matchingItems) + int x = startX + (buttonWidth + spacing) * (i % orders.Count); + + if (order.ItemComponentType!=null) { - var newOrder = new Order(order, it.components.Find(ic => ic.GetType() == order.ItemComponentType)); + var matchingItems = Item.ItemList.FindAll(it => it.components.Find(ic => ic.GetType() == order.ItemComponentType) != null); + int y2 = y; + foreach (Item it in matchingItems) + { + var newOrder = new Order(order, it.components.Find(ic => ic.GetType() == order.ItemComponentType)); - var button = new GUIButton(new Rectangle(x, y2, 150, 20), order.Name, GUI.Style, frame); - button.UserData = newOrder; - button.OnClicked = SetOrder; - y2 += 25; + var button = new GUIButton(new Rectangle(x+buttonWidth/2, y2, buttonWidth, 20), order.Name, Alignment.TopCenter, GUI.Style, frame); + button.UserData = newOrder; + button.OnClicked = SetOrder; + y2 += 25; + } } - } - else - { - var button = new GUIButton(new Rectangle(x, y, 150, 20), order.Name, GUI.Style, frame); - button.UserData = order; - button.OnClicked = SetOrder; + else + { + var button = new GUIButton(new Rectangle(x + buttonWidth / 2, y, buttonWidth, 20), order.Name, Alignment.TopCenter, GUI.Style, frame); + button.UserData = order; + button.OnClicked = SetOrder; + } + i++; } - - - x += 160; + y += 80; } + + } public void UpdateCharacters() @@ -97,12 +115,30 @@ namespace Barotrauma frame.RemoveChild(child); } - int x = 0, y = 0; - foreach (Character character in crewManager.characters) - { - if (character.IsDead) continue; + List aliveCharacters = crewManager.characters.FindAll(c => !c.IsDead); - GUIButton characterButton = new GUIButton(new Rectangle(x, y, 150, 40), "", Color.Transparent, null, frame); + int charactersPerRow = 4; + + int spacing = 5; + + + int rows = (int)Math.Ceiling((double)aliveCharacters.Count / charactersPerRow); + + int i = 0; + foreach (Character character in aliveCharacters) + { + int rowCharacterCount = Math.Min(charactersPerRow, aliveCharacters.Count); + if (aliveCharacters.Count - i < charactersPerRow-1) rowCharacterCount = aliveCharacters.Count % charactersPerRow; + + // rowCharacterCount = Math.Min(rowCharacterCount, aliveCharacters.Count - i); + int startX = (int)-(150 * rowCharacterCount + spacing * (rowCharacterCount - 1)) / 2; + + + int x = startX + (150 + spacing) * (i % Math.Min(charactersPerRow, aliveCharacters.Count)); + int y = (105 + spacing)*((int)Math.Floor((double)i / charactersPerRow)); + + GUIButton characterButton = new GUIButton(new Rectangle(x+75, y, 150, 40), "", Color.Black, Alignment.TopCenter, null, frame); + characterButton.UserData = character; characterButton.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f); @@ -113,8 +149,10 @@ namespace Barotrauma } else { + characterButton.Color = Color.Black * 0.5f; characterButton.HoverColor = Color.LightGray * 0.5f; characterButton.SelectedColor = Color.Gold * 0.5f; + characterButton.OutlineColor = Color.LightGray * 0.8f; } string name = character.Info.Name.Replace(' ', '\n'); @@ -130,7 +168,7 @@ namespace Barotrauma new GUIImage(new Rectangle(-10, -5, 0, 0), character.AnimController.Limbs[0].sprite, Alignment.Left, characterButton); - x += 160; + i++; } } diff --git a/Subsurface/Source/Characters/AI/EnemyAIController.cs b/Subsurface/Source/Characters/AI/EnemyAIController.cs index e777daa91..3c6d2c4b4 100644 --- a/Subsurface/Source/Characters/AI/EnemyAIController.cs +++ b/Subsurface/Source/Characters/AI/EnemyAIController.cs @@ -56,6 +56,11 @@ namespace Barotrauma private float sight; //how far the NPC can hear targets from (0.0 = deaf, 1.0 = hears every target within soundRange) private float hearing; + + public AITarget SelectedAiTarget + { + get { return selectedAiTarget; } + } public EnemyAIController(Character c, string file) : base(c) { diff --git a/Subsurface/Source/Characters/AI/HumanAIController.cs b/Subsurface/Source/Characters/AI/HumanAIController.cs index 7032a4502..6ab49fa46 100644 --- a/Subsurface/Source/Characters/AI/HumanAIController.cs +++ b/Subsurface/Source/Characters/AI/HumanAIController.cs @@ -32,6 +32,8 @@ namespace Barotrauma public override void Update(float deltaTime) { + Character.ClearInputs(); + steeringManager = Character.AnimController.CurrentHull == null ? outdoorsSteeringManager : indoorsSteeringManager; if (updateObjectiveTimer>0.0f) @@ -45,15 +47,14 @@ namespace Barotrauma } objectiveManager.DoCurrentObjective(deltaTime); - - //if (Character.Controlled != null) - //{ - // steeringManager.SteeringSeek(Character.Controlled.Position); - //} - + Character.AnimController.IgnorePlatforms = (-Character.AnimController.TargetMovement.Y > Math.Abs(Character.AnimController.TargetMovement.X)); - if (Math.Abs(Character.AnimController.TargetMovement.X) > 0.1f && !Character.AnimController.InWater) + if (Character.IsKeyDown(InputType.Aim)) + { + Character.AnimController.TargetDir = Character.CursorPosition.X > Character.Position.X ? Direction.Right : Direction.Left; + } + else if (Math.Abs(Character.AnimController.TargetMovement.X) > 0.1f && !Character.AnimController.InWater) { Character.AnimController.TargetDir = Character.AnimController.TargetMovement.X > 0.0f ? Direction.Right : Direction.Left; } @@ -64,6 +65,14 @@ namespace Barotrauma steeringManager.Update(moveSpeed); } + public override void OnAttacked(IDamageable attacker, float amount) + { + var enemy = attacker as Character; + if (enemy == null) return; + + objectiveManager.AddObjective(new AIObjectiveCombat(Character, enemy)); + } + public void SetOrder(Order order, string option) { objectiveManager.SetOrder(order, option); diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveCombat.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveCombat.cs new file mode 100644 index 000000000..ee91e3efc --- /dev/null +++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveCombat.cs @@ -0,0 +1,132 @@ +using Microsoft.Xna.Framework; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Barotrauma +{ + class AIObjectiveCombat : AIObjective + { + const float CoolDown = 10.0f; + + private Character enemy; + + private AIObjectiveFindSafety escapeObjective; + + float coolDownTimer; + + private readonly float enemyStrength; + + public AIObjectiveCombat (Character character, Character enemy) + : base(character, "") + { + this.enemy = enemy; + + foreach (Limb limb in enemy.AnimController.Limbs) + { + if (limb.attack == null) continue; + enemyStrength += limb.attack.GetDamage(1.0f); + } + + coolDownTimer = CoolDown; + + } + + protected override void Act(float deltaTime) + { + coolDownTimer -= deltaTime; + + var weapon = character.Inventory.FindItem("weapon"); + + if (weapon==null) + { + Escape(deltaTime); + } + else + { + if (!character.SelectedItems.Contains(weapon)) + { + character.Inventory.TryPutItem(weapon, 3, false); + weapon.Equip(character); + } + character.CursorPosition = enemy.Position; + character.SetInput(InputType.Aim, false, true); + + Vector2 enemyDiff = Vector2.Normalize(enemy.Position - character.Position); + float weaponAngle = ((weapon.body.Dir == 1.0f) ? weapon.body.Rotation : weapon.body.Rotation - MathHelper.Pi); + Vector2 weaponDir = new Vector2((float)Math.Cos(weaponAngle), (float)Math.Sin(weaponAngle)); + + if (Vector2.Dot(enemyDiff, weaponDir)<0.9f) return; + + List ignoredBodies = new List(); + foreach (Limb limb in character.AnimController.Limbs) + { + ignoredBodies.Add(limb.body.FarseerBody); + } + + var pickedBody = Submarine.PickBody(character.SimPosition, enemy.SimPosition, ignoredBodies); + if (pickedBody != null && pickedBody.UserData as Limb == null) return; + + weapon.Use(deltaTime, character); + } + } + + private void Escape(float deltaTime) + { + if (escapeObjective == null) + { + escapeObjective = new AIObjectiveFindSafety(character); + } + + if (enemy.AnimController.CurrentHull == character.AnimController.CurrentHull) + { + escapeObjective.OverrideCurrentHullSafety = 0.0f; + } + else + { + escapeObjective.OverrideCurrentHullSafety = null; + } + + escapeObjective.TryComplete(deltaTime); + + if (Vector2.Distance(character.SimPosition, enemy.SimPosition) < 3.0f) + { + character.AIController.SteeringManager.SteeringManual(deltaTime, character.SimPosition - enemy.SimPosition); + } + else + { + coolDownTimer = CoolDown; + } + } + + public override bool IsCompleted() + { + return enemy.IsDead || coolDownTimer <= 0.0f; + } + + public override float GetPriority(Character character) + { + //clamp the strength to the health of this character + //(it doesn't make a difference whether the enemy does 200 or 600 damage, it's one hit kill anyway) + + float enemyDanger = Math.Min(enemyStrength, character.Health) + enemy.Health / 10.0f; + + EnemyAIController enemyAI = enemy.AIController as EnemyAIController; + if (enemyAI != null) + { + if (enemyAI.SelectedAiTarget == character.AiTarget) enemyDanger *= 2.0f; + } + + return Math.Max(enemyDanger, 30.0f); + } + + public override bool IsDuplicate(AIObjective otherObjective) + { + AIObjectiveCombat objective = otherObjective as AIObjectiveCombat; + if (objective == null) return false; + + return objective.enemy == enemy; + } + } +} diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveContainItem.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveContainItem.cs index a6f65822a..de32a9fbc 100644 --- a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveContainItem.cs +++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveContainItem.cs @@ -17,6 +17,7 @@ namespace Barotrauma bool isCompleted; + public bool IgnoreAlreadyContainedItems; public AIObjectiveContainItem(Character character, string itemName, ItemContainer container) : base (character, "") @@ -47,14 +48,16 @@ namespace Barotrauma var itemToContain = character.Inventory.FindItem(itemName); if (itemToContain == null) { - AddSubObjective(new AIObjectiveGetItem(character, itemName)); + var getItem = new AIObjectiveGetItem(character, itemName); + getItem.IgnoreContainedItems = IgnoreAlreadyContainedItems; + AddSubObjective(getItem); return; } if (Vector2.Distance(character.SimPosition, container.Item.SimPosition) > container.Item.PickDistance - || !container.Item.IsInsideTrigger(character.Position)) + && !container.Item.IsInsideTrigger(character.Position)) { - AddSubObjective(new AIObjectiveGoTo(container.Item.SimPosition, character)); + AddSubObjective(new AIObjectiveGoTo(container.Item, character)); return; } @@ -65,7 +68,9 @@ namespace Barotrauma public override bool IsDuplicate(AIObjective otherObjective) { AIObjectiveContainItem objective = otherObjective as AIObjectiveContainItem; - return (objective != null); + if (objective == null) return false; + + return objective.itemName == itemName && objective.container == container; } diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs index b796169b5..ef24f98d1 100644 --- a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs +++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveFindSafety.cs @@ -11,13 +11,15 @@ namespace Barotrauma const float SearchHullInterval = 3.0f; const float MinSafety = 50.0f; - AIObjectiveGoTo gotoObjective; + private AIObjectiveGoTo goToObjective; private List unreachable; - - float currenthullSafety; - float searchHullTimer; + private float currenthullSafety; + + private float searchHullTimer; + + public float? OverrideCurrentHullSafety; public AIObjectiveFindSafety(Character character) : base(character, "") @@ -27,20 +29,24 @@ namespace Barotrauma protected override void Act(float deltaTime) { - if (character.AnimController.CurrentHull == null || GetHullSafety(character.AnimController.CurrentHull) > MinSafety) + + currenthullSafety = OverrideCurrentHullSafety == null ? + GetHullSafety(character.AnimController.CurrentHull) : (float)OverrideCurrentHullSafety; + + if (character.AnimController.CurrentHull == null || currenthullSafety > MinSafety) { character.AIController.SteeringManager.SteeringSeek(character.AnimController.CurrentHull.SimPosition); character.AIController.SelectTarget(null); - gotoObjective = null; + goToObjective = null; return; } if (searchHullTimer>0.0f) { searchHullTimer -= deltaTime; - return; + //return; } else { @@ -67,37 +73,35 @@ namespace Barotrauma if (bestHull != null) { - var path = pathSteering.PathFinder.FindPath(character.SimPosition, bestHull.SimPosition); - if (pathSteering.CurrentPath != null && pathSteering.CurrentPath.Cost < path.Cost && !pathSteering.CurrentPath.Unreachable && gotoObjective!=null) - { - return; - } - else - { - pathSteering.SetPath(path); - } + //var path = pathSteering.PathFinder.FindPath(character.SimPosition, bestHull.SimPosition); + //if (pathSteering.CurrentPath == null || (pathSteering.CurrentPath.NextNode==null && pathSteering.CurrentPath.Cost > path.Cost) || + // pathSteering.CurrentPath.Unreachable || goToObjective==null) + //{ + + //pathSteering.SetPath(path); + goToObjective = new AIObjectiveGoTo(bestHull, character); + //} - gotoObjective = new AIObjectiveGoTo(bestHull, character); - //character.AIController.SelectTarget(bestHull.AiTarget); + + //haracter.AIController.SelectTarget(bestHull.AiTarget); } searchHullTimer = SearchHullInterval; } - if (gotoObjective != null) + if (goToObjective != null) { var pathSteering = character.AIController.SteeringManager as IndoorsSteeringManager; if (pathSteering!=null && pathSteering.CurrentPath!= null && - pathSteering.CurrentPath.Unreachable && !unreachable.Contains(gotoObjective.Target)) + pathSteering.CurrentPath.Unreachable && !unreachable.Contains(goToObjective.Target)) { - unreachable.Add(gotoObjective.Target as Hull); + unreachable.Add(goToObjective.Target as Hull); } + + + goToObjective.TryComplete(deltaTime); } - - - - gotoObjective.TryComplete(deltaTime); } public override bool IsDuplicate(AIObjective otherObjective) @@ -125,7 +129,7 @@ namespace Barotrauma float safety = 100.0f - fireAmount; if (waterPercentage > 30.0f) safety -= waterPercentage; - if (hull.OxygenPercentage < 30.0f) safety -= (30.0f-hull.OxygenPercentage)*3.0f; + if (hull.OxygenPercentage < 30.0f) safety -= (30.0f-hull.OxygenPercentage)*5.0f; return safety; } diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGetItem.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGetItem.cs index 1b0c36abe..1c1542067 100644 --- a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGetItem.cs +++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGetItem.cs @@ -16,11 +16,14 @@ namespace Barotrauma private bool canBeCompleted; + public bool IgnoreContainedItems; + public override bool CanBeCompleted { get { return canBeCompleted; } } + public AIObjectiveGetItem(Character character, string itemName) : base (character, "") { @@ -39,7 +42,6 @@ namespace Barotrauma { targetItem.Pick(character, false, true); } - return; } if (currSearchIndex >= Item.ItemList.Count) @@ -47,20 +49,23 @@ namespace Barotrauma canBeCompleted = false; return; } - - if (Item.ItemList[currSearchIndex].HasTag(itemName) || Item.ItemList[currSearchIndex].Name == itemName) - { - targetItem = Item.ItemList[currSearchIndex]; - - while (targetItem.container != null) - { - targetItem = targetItem.container; - } - - subObjectives.Add(new AIObjectiveGoTo(targetItem.Position, character)); - } currSearchIndex++; + + if (!Item.ItemList[currSearchIndex].HasTag(itemName) && Item.ItemList[currSearchIndex].Name != itemName) return; + if (IgnoreContainedItems && Item.ItemList[currSearchIndex].container != null) return; + + targetItem = Item.ItemList[currSearchIndex]; + + Item moveToTarget = targetItem; + while (moveToTarget.container != null) + { + moveToTarget = moveToTarget.container; + } + + subObjectives.Add(new AIObjectiveGoTo(moveToTarget, character)); + + } public override bool IsDuplicate(AIObjective otherObjective) diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs index 60fcc020a..ba7e16d85 100644 --- a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs +++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveGoTo.cs @@ -35,14 +35,15 @@ namespace Barotrauma : base (character, "") { this.target = target; - this.repeat = false; + this.repeat = repeat; } - public AIObjectiveGoTo(Vector2 targetPos, Character character) + public AIObjectiveGoTo(Vector2 simPos, Character character, bool repeat = false) : base(character, "") { - this.targetPos = targetPos; + this.targetPos = simPos; + this.repeat = repeat; } protected override void Act(float deltaTime) diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveIdle.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveIdle.cs index 42f55569a..1c2b2c4cb 100644 --- a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveIdle.cs +++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveIdle.cs @@ -8,6 +8,8 @@ namespace Barotrauma { class AIObjectiveIdle : AIObjective { + const float WallAvoidDistance = 150.0f; + AITarget currentTarget; private float newTargetTimer; @@ -33,40 +35,30 @@ namespace Barotrauma { currentTarget = FindRandomTarget(); - if (currentTarget!=null) + if (currentTarget != null) { var path = pathSteering.PathFinder.FindPath(character.SimPosition, currentTarget.SimPosition); - if (path.Cost > 200.0f) - { - return; - } - else - { - pathSteering.SetPath(path); - } + if (path.Cost > 200.0f) return; + + pathSteering.SetPath(path); } newTargetTimer = currentTarget == null ? 5.0f : 10.0f; } - else - { - newTargetTimer -= deltaTime; - } - - - if (currentTarget == null) return; - - + + newTargetTimer -= deltaTime; + //wander randomly if reached the end of the path or the target is unreachable - if (pathSteering!=null && pathSteering.CurrentPath != null && - (pathSteering.CurrentPath.NextNode == null || pathSteering.CurrentPath.Unreachable)) + if (pathSteering==null || (pathSteering.CurrentPath != null && + (pathSteering.CurrentPath.NextNode == null || pathSteering.CurrentPath.Unreachable))) { - if (character.Position.X < character.AnimController.CurrentHull.Rect.X + 200.0f) + //steer away from edges of the hull + if (character.Position.X < character.AnimController.CurrentHull.Rect.X + WallAvoidDistance) { pathSteering.SteeringManual(deltaTime, Vector2.UnitX); } - else if (character.Position.X > character.AnimController.CurrentHull.Rect.Right - 200.0f) + else if (character.Position.X > character.AnimController.CurrentHull.Rect.Right - WallAvoidDistance) { pathSteering.SteeringManual(deltaTime, -Vector2.UnitX); } @@ -75,8 +67,8 @@ namespace Barotrauma return; } + if (currentTarget == null) return; character.AIController.SteeringManager.SteeringSeek(currentTarget.SimPosition); - } private AITarget FindRandomTarget() @@ -111,7 +103,7 @@ namespace Barotrauma public override bool IsDuplicate(AIObjective otherObjective) { - return true; + return (otherObjective as AIObjectiveIdle != null); } } } diff --git a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveManager.cs b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveManager.cs index 01fd407b6..29a93b3eb 100644 --- a/Subsurface/Source/Characters/AI/Objectives/AIObjectiveManager.cs +++ b/Subsurface/Source/Characters/AI/Objectives/AIObjectiveManager.cs @@ -88,6 +88,9 @@ namespace Barotrauma case "follow": currentOrder = new AIObjectiveGoTo(Character.Controlled, character, true); break; + case "wait": + currentOrder = new AIObjectiveGoTo(character.SimPosition, character, true); + break; default: if (order.TargetItem == null) return; diff --git a/Subsurface/Source/Characters/AI/Order.cs b/Subsurface/Source/Characters/AI/Order.cs index 1f8ccc527..205ede5cd 100644 --- a/Subsurface/Source/Characters/AI/Order.cs +++ b/Subsurface/Source/Characters/AI/Order.cs @@ -27,11 +27,14 @@ namespace Barotrauma PrefabList.Add(new Order("Follow", "Following")); + PrefabList.Add(new Order("Dismiss", "Dismissed")); + + PrefabList.Add(new Order("Wait", "Wait")); + PrefabList.Add(new Order("Operate Reactor", "Operating reactor", typeof(Reactor), new string[] {"Power up", "Shutdown"})); PrefabList.Add(new Order("Operate Railgun", "Operating railgun", typeof(Turret), new string[] { "Fire at will", "Hold fire" })); - PrefabList.Add(new Order("Dismiss", "Dismissed")); } private Order(string name, string doingText, Type itemComponentType, string[] parameters = null) diff --git a/Subsurface/Source/Characters/AI/SteeringManager.cs b/Subsurface/Source/Characters/AI/SteeringManager.cs index c931edc79..92962fbc6 100644 --- a/Subsurface/Source/Characters/AI/SteeringManager.cs +++ b/Subsurface/Source/Characters/AI/SteeringManager.cs @@ -52,7 +52,7 @@ namespace Barotrauma public void SteeringManual(float deltaTime, Vector2 velocity) { - steering += velocity * deltaTime; + steering += velocity; } public virtual void Update(float speed = 1.0f) diff --git a/Subsurface/Source/Characters/AI/SteeringPath.cs b/Subsurface/Source/Characters/AI/SteeringPath.cs index 428ba2af0..671421195 100644 --- a/Subsurface/Source/Characters/AI/SteeringPath.cs +++ b/Subsurface/Source/Characters/AI/SteeringPath.cs @@ -12,7 +12,7 @@ namespace Barotrauma public bool Unreachable { get; - private set; + set; } public SteeringPath(bool unreachable = false) diff --git a/Subsurface/Source/Characters/AI/PathSteeringManager.cs b/Subsurface/Source/Characters/AI/ÍndoorsSteeringManager.cs similarity index 89% rename from Subsurface/Source/Characters/AI/PathSteeringManager.cs rename to Subsurface/Source/Characters/AI/ÍndoorsSteeringManager.cs index 2bdedfea9..f0f0e90c4 100644 --- a/Subsurface/Source/Characters/AI/PathSteeringManager.cs +++ b/Subsurface/Source/Characters/AI/ÍndoorsSteeringManager.cs @@ -71,7 +71,7 @@ namespace Barotrauma return DiffToCurrentNode(); } - + Vector2 diff = DiffToCurrentNode(); if (diff == Vector2.Zero) return -host.Steering; @@ -85,10 +85,18 @@ namespace Barotrauma if (canOpenDoors) CheckDoorsInPath(); - currentPath.CheckProgress(host.SimPosition, character.AnimController.InWater ? 1.0f : 0.6f); + float allowedDistance = character.AnimController.InWater ? 1.0f : 0.6f; + if (currentPath.CurrentNode!=null && currentPath.CurrentNode.SimPosition.Y > character.SimPosition.Y+1.0f) allowedDistance*=0.5f; + + currentPath.CheckProgress(host.SimPosition, allowedDistance); if (currentPath.CurrentNode == null) return Vector2.Zero; + //if (currentPath.CurrentNode.SimPosition.Y > character.SimPosition.Y+1.0f && character.AnimController.Stairs == null) + //{ + // return currentPath.PrevNode.SimPosition - host.SimPosition; + //} + return currentPath.CurrentNode.SimPosition - host.SimPosition; } @@ -109,6 +117,7 @@ namespace Barotrauma if (door.IsOpen != open) { var buttons = door.Item.GetConnectedComponents(); + foreach (Controller controller in buttons) { if (Vector2.Distance(controller.Item.SimPosition, character.SimPosition) > controller.Item.PickDistance * 2.0f) continue; @@ -131,6 +140,8 @@ namespace Barotrauma if (!canOpenDoors) return null; var doorButtons = nextNode.Waypoint.ConnectedGap.ConnectedDoor.Item.GetConnectedComponents(); + if (!doorButtons.Any()) return null; + foreach (Controller button in doorButtons) { if (Math.Sign(button.Item.Position.X - nextNode.Waypoint.Position.X) != diff --git a/Subsurface/Source/Characters/Animation/HumanoidAnimController.cs b/Subsurface/Source/Characters/Animation/HumanoidAnimController.cs index eb0db9158..2f27711f4 100644 --- a/Subsurface/Source/Characters/Animation/HumanoidAnimController.cs +++ b/Subsurface/Source/Characters/Animation/HumanoidAnimController.cs @@ -250,10 +250,13 @@ namespace Barotrauma float shortestAngle = leg.Rotation - torso.Rotation; - if (Math.Abs(shortestAngle)<2.5f) continue; - //leg = GetLimb((i == 0) ? LimbType.LeftLeg : LimbType.RightLeg); + if (Math.Abs(shortestAngle)<2.4f) continue; + leg.body.ApplyTorque(-shortestAngle*10.0f); + leg = GetLimb((i == 0) ? LimbType.LeftThigh : LimbType.RightThigh); + leg.body.ApplyTorque(-shortestAngle * 5.0f); + // float torsoRot = MathHelper.WrapAngle(torso.Rotation); // torsoRot = MathHelper.ToDegrees(torsoRot); diff --git a/Subsurface/Source/Characters/Character.cs b/Subsurface/Source/Characters/Character.cs index 4b427422f..f6338ae59 100644 --- a/Subsurface/Source/Characters/Character.cs +++ b/Subsurface/Source/Characters/Character.cs @@ -480,6 +480,13 @@ namespace Barotrauma return keys[(int)inputType].Held; } + public void SetInput(InputType inputType, bool hit, bool held) + { + keys[(int)inputType].Hit = hit; + keys[(int)inputType].Held = held; + + } + public void ClearInput(InputType inputType) { keys[(int)inputType].Hit = false; diff --git a/Subsurface/Source/GameMain.cs b/Subsurface/Source/GameMain.cs index ae0f61228..8f07a7eff 100644 --- a/Subsurface/Source/GameMain.cs +++ b/Subsurface/Source/GameMain.cs @@ -191,7 +191,7 @@ namespace Barotrauma Hull.renderer = new WaterRenderer(GraphicsDevice); - TitleScreen.LoadState = 1.0f; + TitleScreen.LoadState = 1.0f; yield return CoroutineStatus.Running; GUI.LoadContent(GraphicsDevice); @@ -203,19 +203,25 @@ namespace Barotrauma yield return CoroutineStatus.Running; JobPrefab.LoadAll(SelectedPackage.GetFilesOfType(ContentType.Jobs)); - TitleScreen.LoadState = 15.0f; - yield return CoroutineStatus.Running; - StructurePrefab.LoadAll(SelectedPackage.GetFilesOfType(ContentType.Structure)); - TitleScreen.LoadState = 25.0f; + TitleScreen.LoadState = 20.0f; yield return CoroutineStatus.Running; ItemPrefab.LoadAll(SelectedPackage.GetFilesOfType(ContentType.Item)); - TitleScreen.LoadState = 40.0f; + TitleScreen.LoadState = 30.0f; yield return CoroutineStatus.Running; Debug.WriteLine("sounds"); CoroutineManager.StartCoroutine(SoundPlayer.Init()); + + int i = 0; + while (!SoundPlayer.Initialized) + { + i++; + TitleScreen.LoadState = Math.Min((float)TitleScreen.LoadState + 40.0f/41, 70.0f); + yield return CoroutineStatus.Running; + } + TitleScreen.LoadState = 70.0f; yield return CoroutineStatus.Running; @@ -244,10 +250,9 @@ namespace Barotrauma LocationType.Init("Content/Map/locationTypes.xml"); MainMenuScreen.Select(); - yield return CoroutineStatus.Running; - TitleScreen.LoadState = 100.0f; - hasLoaded = true; + TitleScreen.LoadState = 100.0f; + hasLoaded = true; yield return CoroutineStatus.Success; } diff --git a/Subsurface/Source/Items/Components/Door.cs b/Subsurface/Source/Items/Components/Door.cs index 5944bf29b..210d4cc9c 100644 --- a/Subsurface/Source/Items/Components/Door.cs +++ b/Subsurface/Source/Items/Components/Door.cs @@ -244,6 +244,43 @@ namespace Barotrauma.Items.Components OpenState += deltaTime * ((isOpen) ? 2.0f : -2.0f); LinkedGap.Open = openState; } + + if (openState > 0.0f && openState < 1.0f) + { + //push characters out of the doorway when the door is closing/opening + Vector2 simPos = ConvertUnits.ToSimUnits(new Vector2(item.Rect.X, item.Rect.Y)); + Vector2 simSize = ConvertUnits.ToSimUnits(new Vector2(doorSprite.size.X, + item.Rect.Height * (1.0f - openState))); + + foreach (Character c in Character.CharacterList) + { + int dir = Math.Sign(c.SimPosition.X - item.SimPosition.X); + foreach (Limb l in c.AnimController.Limbs) + { + if (l.SimPosition.Y > simPos.Y || l.SimPosition.Y < simPos.Y - simSize.Y) continue; + + if (Math.Sign(l.SimPosition.X - item.SimPosition.X) != dir) + { + l.body.SetTransform(new Vector2(item.SimPosition.X + dir * simSize.X*1.2f, item.SimPosition.Y), l.body.Rotation); + SoundPlayer.PlayDamageSound(DamageSoundType.LimbBlunt, 1.0f, l.body.FarseerBody); + //c.AddDamage(item.SimPosition, DamageType.Blunt, 1.0f, 0.0f, 0.0f, true); + + l.body.ApplyLinearImpulse(new Vector2(dir * 0.5f, isOpen ? 0.0f : -1.0f)); + } + + if (Math.Abs(l.SimPosition.X - item.SimPosition.X) > simSize.X*0.5f) continue; + + + l.body.ApplyLinearImpulse(new Vector2(dir * 0.5f, isOpen ? 0.0f : -0.5f)); + c.StartStun(0.2f); + } + } + } + else + { + + body.Enabled = openState < 1.0f; + } item.SendSignal((isOpen) ? "1" : "0", "state_out"); @@ -278,32 +315,7 @@ namespace Barotrauma.Items.Components spriteBatch.Draw(doorSprite.Texture, new Vector2(item.Rect.Center.X, -item.Rect.Y), new Rectangle(doorSprite.SourceRect.X, (int)(doorSprite.size.Y * openState), (int)doorSprite.size.X, (int)(doorSprite.size.Y * (1.0f - openState))), - color, 0.0f, doorSprite.Origin, 1.0f, SpriteEffects.None, doorSprite.Depth); - - if (openState == 0.0f) - { - body.Enabled = true; - } - else - { - //push characters out of the doorway when the door is closing/opening - Vector2 simPos = ConvertUnits.ToSimUnits(new Vector2(item.Rect.X, item.Rect.Y)); - Vector2 simSize = ConvertUnits.ToSimUnits(new Vector2(item.Rect.Width, - item.Rect.Height * (1.0f - openState))); - - foreach (Character c in Character.CharacterList) - { - int dir = Math.Sign(c.AnimController.Limbs[0].SimPosition.X - simPos.X); - foreach (Limb l in c.AnimController.Limbs) - { - if (l.SimPosition.Y < simPos.Y || l.SimPosition.Y > simPos.Y - simSize.Y) continue; - if (Math.Abs(l.SimPosition.X - simPos.X) > simSize.X * 2.0f) continue; - - l.body.ApplyForce(new Vector2(dir * 10.0f, 0.0f)); - } - } - } - + color, 0.0f, doorSprite.Origin, 1.0f, SpriteEffects.None, doorSprite.Depth); } public override void OnMapLoaded() diff --git a/Subsurface/Source/Items/Components/Holdable/RangedWeapon.cs b/Subsurface/Source/Items/Components/Holdable/RangedWeapon.cs index fbb0f21ff..c6d50831d 100644 --- a/Subsurface/Source/Items/Components/Holdable/RangedWeapon.cs +++ b/Subsurface/Source/Items/Components/Holdable/RangedWeapon.cs @@ -90,26 +90,18 @@ namespace Barotrauma.Items.Components + Rand.Range(-degreeOfFailure, degreeOfFailure)); projectile.Use(deltaTime); + projectileComponent.User = character; projectile.body.ApplyTorque(projectile.body.Mass * degreeOfFailure * Rand.Range(-10.0f, 10.0f)); - //recoil + //recoil item.body.ApplyLinearImpulse( new Vector2((float)Math.Cos(projectile.body.Rotation), (float)Math.Sin(projectile.body.Rotation)) * item.body.Mass * -50.0f); - //else - //{ - projectileComponent.ignoredBodies = limbBodies; - - //recoil - //item.body.ApplyLinearImpulse( - // new Vector2((float)Math.Cos(projectile.body.Rotation), (float)Math.Sin(projectile.body.Rotation)) * -item.body.Mass); - //} + projectileComponent.ignoredBodies = limbBodies; item.RemoveContained(projectile); - - Rope rope = item.GetComponent(); if (rope != null) rope.Attach(projectile); @@ -117,9 +109,8 @@ namespace Barotrauma.Items.Components } - return false; - + return false; } - + } } diff --git a/Subsurface/Source/Items/Components/Projectile.cs b/Subsurface/Source/Items/Components/Projectile.cs index 3489cba01..719dac46c 100644 --- a/Subsurface/Source/Items/Components/Projectile.cs +++ b/Subsurface/Source/Items/Components/Projectile.cs @@ -22,6 +22,8 @@ namespace Barotrauma.Items.Components public List ignoredBodies; + public Character User; + [HasDefaultValue(10.0f, false)] public float LaunchImpulse { @@ -127,17 +129,15 @@ namespace Barotrauma.Items.Components { if (stickJoint != null && stickJoint.JointTranslation < 0.01f) { - if (stickTarget!=null) + if (stickTarget != null) { try { item.body.FarseerBody.RestoreCollisionWith(stickTarget); } - catch (Exception e) + catch { -#if DEBUG - DebugConsole.ThrowError("Failed to restore collision with stickTarget", e); -#endif + //the body that the projectile was stuck to has been removed } stickTarget = null; @@ -147,11 +147,9 @@ namespace Barotrauma.Items.Components { GameMain.World.RemoveJoint(stickJoint); } - catch (Exception e) + catch { -#if DEBUG - DebugConsole.ThrowError("Failed to remove stickJoint", e); -#endif + //the body that the projectile was stuck to has been removed } stickJoint = null; @@ -165,17 +163,17 @@ namespace Barotrauma.Items.Components if (ignoredBodies.Contains(f2.Body)) return false; AttackResult attackResult = new AttackResult(0.0f, 0.0f); - if (attack!=null) + if (attack != null) { Limb limb; Structure structure; if ((limb = (f2.Body.UserData as Limb)) != null) - { - attackResult = attack.DoDamage(null, limb.character, item.SimPosition, 1.0f); + { + attackResult = attack.DoDamage(User, limb.character, item.SimPosition, 1.0f); } else if ((structure = (f2.Body.UserData as Structure)) != null) { - attackResult = attack.DoDamage(null, structure, item.SimPosition, 1.0f); + attackResult = attack.DoDamage(User, structure, item.SimPosition, 1.0f); } } diff --git a/Subsurface/Source/Items/Components/Turret.cs b/Subsurface/Source/Items/Components/Turret.cs index b0a9404cc..b7f820669 100644 --- a/Subsurface/Source/Items/Components/Turret.cs +++ b/Subsurface/Source/Items/Components/Turret.cs @@ -161,7 +161,7 @@ namespace Barotrauma.Items.Components { var projectiles = GetLoadedProjectiles(); - if (projectiles.Count==0 || (projectiles.Count==1 && objective.Option.ToLower()=="hold fire")) + if (projectiles.Count==0 || (projectiles.Count==1 && objective.Option.ToLower()!="fire at will")) { ItemContainer container = null; foreach (MapEntity e in item.linkedTo) @@ -174,8 +174,10 @@ namespace Barotrauma.Items.Components } if (container == null || container.ContainableItems.Count==0) return true; - - objective.AddSubObjective(new AIObjectiveContainItem(character, container.ContainableItems[0].Names[0], container)); + + var containShellObjective = new AIObjectiveContainItem(character, container.ContainableItems[0].Names[0], container); + containShellObjective.IgnoreAlreadyContainedItems = true; + objective.AddSubObjective(containShellObjective); return false; } else if (GetAvailablePower() < powerConsumption) @@ -186,7 +188,7 @@ namespace Barotrauma.Items.Components PowerContainer batteryToLoad = null; foreach (PowerContainer battery in batteries) { - if (batteryToLoad==null || battery.Charge < lowestCharge) + if (batteryToLoad == null || battery.Charge < lowestCharge) { batteryToLoad = battery; lowestCharge = battery.Charge; @@ -205,7 +207,6 @@ namespace Barotrauma.Items.Components } //enough shells and power - Character closestEnemy = null; float closestDist = 3000.0f; foreach (Character enemy in Character.CharacterList) @@ -256,6 +257,13 @@ namespace Barotrauma.Items.Components return availablePower; } + public override void Remove() + { + base.Remove(); + + barrelSprite.Remove(); + } + private List GetLoadedProjectiles(bool returnFirst = false) { List projectiles = new List(); diff --git a/Subsurface/Source/Screens/LobbyScreen.cs b/Subsurface/Source/Screens/LobbyScreen.cs index d1f02bf5d..373f0b185 100644 --- a/Subsurface/Source/Screens/LobbyScreen.cs +++ b/Subsurface/Source/Screens/LobbyScreen.cs @@ -5,6 +5,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; +using System.Globalization; namespace Barotrauma { @@ -19,8 +20,7 @@ namespace Barotrauma private int selectedRightPanel; - private GUIListBox characterList; - private GUIListBox hireList; + private GUIListBox characterList, hireList; private GUIListBox selectedItemList, itemList; @@ -36,7 +36,7 @@ namespace Barotrauma private string CostTextGetter() { - return "Cost: "+selectedItemCost.ToString(); + return "Cost: "+selectedItemCost.ToString()+" credits"; } private int selectedItemCost @@ -183,32 +183,6 @@ namespace Barotrauma bottomPanel[(int)PanelTab.CurrentLocation].ClearChildren(); bottomPanel[(int)PanelTab.CurrentLocation].UserData = location; - //rightPanel[(int)PanelTab.Hire].Padding = GUI.style.smallPadding; - - //for (int i = 0; i < Enum.GetNames(typeof(PanelTab)).Length; i++ ) - //{ - - // float size = Math.Max( - // (float)GameMain.GraphicsWidth / (float)location.Type.Background.SourceRect.Width, - // (float)GameMain.GraphicsHeight / (float)location.Type.Background.SourceRect.Height); - // location.Type.Background.size = new Vector2( - // location.Type.Background.SourceRect.Width*size, - // location.Type.Background.SourceRect.Height*size); - - - // topPanel.sprites.Clear(); - // topPanel.TileSprites = false; - // topPanel.sprites.Add(location.Type.Background); - - // bottomPanel[i].sprites.Clear(); - // bottomPanel[i].TileSprites = false; - // bottomPanel[i].sprites.Add(location.Type.Background); - //} - - //new GUITextBlock(new Rectangle(0, 0, 200, 25), - // "Location: "+location.Name, GUI.Style, bottomPanel[(int)PanelTab.CurrentLocation]); - //new GUITextBlock(new Rectangle(0, 20, 200, 25), - // "("+location.Type.Name+")", GUI.Style, bottomPanel[(int)PanelTab.CurrentLocation]); if (location.HireManager != null) { @@ -257,17 +231,17 @@ namespace Barotrauma if (location == null) return; - new GUITextBlock(new Rectangle(0, 0, 0, 0), location.Name, Color.Black * 0.8f, Color.White, Alignment.TopLeft, null, locationPanel).Font = GUI.LargeFont; + new GUITextBlock(new Rectangle(0, 0, 250, 0), location.Name, GUI.Style, Alignment.TopLeft, Alignment.TopCenter, locationPanel, true, GUI.LargeFont); if (GameMain.GameSession.Map.SelectedConnection != null && GameMain.GameSession.Map.SelectedConnection.Quest != null) { var quest = GameMain.GameSession.Map.SelectedConnection.Quest; - new GUITextBlock(new Rectangle(0, 40, 0, 20), "Quest: "+quest.Name, Color.Black*0.8f, Color.White, Alignment.TopLeft, null, locationPanel); + new GUITextBlock(new Rectangle(0, 80, 0, 20), "Quest: "+quest.Name, Color.Black*0.8f, Color.White, Alignment.TopLeft, null, locationPanel); - new GUITextBlock(new Rectangle(0, 60, 0, 20), "Reward: " + quest.Reward, Color.Black * 0.8f, Color.White, Alignment.TopLeft, null, locationPanel); + new GUITextBlock(new Rectangle(0, 100, 0, 20), "Reward: " + quest.Reward+" credits", Color.Black * 0.8f, Color.White, Alignment.TopLeft, null, locationPanel); - new GUITextBlock(new Rectangle(0, 80, 0, 0), quest.Description, Color.Black * 0.8f, Color.White, Alignment.TopLeft, null, locationPanel, true); + new GUITextBlock(new Rectangle(0, 120, 0, 0), quest.Description, Color.Black * 0.8f, Color.White, Alignment.TopLeft, null, locationPanel, true); } @@ -282,15 +256,6 @@ namespace Barotrauma foreach (CharacterInfo c in CrewManager.characterInfos) { c.CreateCharacterFrame(characterList, c.Name + " ("+c.Job.Name+") ", c); - - //GUITextBlock textBlock = new GUITextBlock( - // new Rectangle(0, 0, 0, 25), - // c.Name + " (" + c.Job.Name + ")", GUI.Style, - // Alignment.Left, - // Alignment.Left, - // characterList, false, GameMain.GraphicsWidth<1000 ? GUI.SmallFont : GUI.Font); - //textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f); - //textBlock.UserData = c; } } @@ -458,7 +423,7 @@ namespace Barotrauma private string GetMoney() { - return "Money: " + ((GameMain.GameSession == null) ? "" : CrewManager.Money.ToString()); + return "Money: " + ((GameMain.GameSession == null) ? "0" : string.Format(CultureInfo.InvariantCulture, "{0:N0}", CrewManager.Money)) + " credits"; } private bool SelectCharacter(GUIComponent component, object selection) diff --git a/Subsurface/Source/Sounds/SoundPlayer.cs b/Subsurface/Source/Sounds/SoundPlayer.cs index b82a845f6..48878cc98 100644 --- a/Subsurface/Source/Sounds/SoundPlayer.cs +++ b/Subsurface/Source/Sounds/SoundPlayer.cs @@ -68,11 +68,11 @@ namespace Barotrauma private static float currMusicVolume; private static Sound startDrone; + + public static bool Initialized; public static IEnumerable Init() { - - startDrone = Sound.Load("Content/Sounds/startDrone.ogg", false); startDrone.Play(); @@ -148,6 +148,8 @@ namespace Barotrauma } } + Initialized = true; + yield return CoroutineStatus.Success; } diff --git a/Subsurface/Source/Sprite.cs b/Subsurface/Source/Sprite.cs index ceb73925d..ab6af11d7 100644 --- a/Subsurface/Source/Sprite.cs +++ b/Subsurface/Source/Sprite.cs @@ -182,21 +182,30 @@ namespace Barotrauma public void Draw(SpriteBatch spriteBatch, Vector2 pos, float rotate=0.0f, float scale=1.0f, SpriteEffects spriteEffect = SpriteEffects.None) { - spriteBatch.Draw(texture, pos + offset, sourceRect, Color.White, rotation + rotate, origin, scale, spriteEffect, depth); + this.Draw(spriteBatch, pos, Color.White, rotate, scale, spriteEffect); } public void Draw(SpriteBatch spriteBatch, Vector2 pos, Color color, float rotate = 0.0f, float scale = 1.0f, SpriteEffects spriteEffect = SpriteEffects.None, float? depth = null) { - spriteBatch.Draw(texture, pos + offset, sourceRect, color, rotation + rotate, origin, scale, spriteEffect, depth==null ? this.depth : (float)depth); + this.Draw(spriteBatch, pos, color, this.origin, rotate, new Vector2(scale,scale), spriteEffect, depth); } public void Draw(SpriteBatch spriteBatch, Vector2 pos, Color color, Vector2 origin, float rotate = 0.0f, float scale = 1.0f, SpriteEffects spriteEffect = SpriteEffects.None, float? depth = null) { - spriteBatch.Draw(texture, pos + offset, sourceRect, color, rotation + rotate, origin, scale, spriteEffect, depth == null ? this.depth : (float)depth); + this.Draw(spriteBatch, pos, color, origin, rotate, new Vector2(scale, scale), spriteEffect, depth); } public void Draw(SpriteBatch spriteBatch, Vector2 pos, Color color, Vector2 origin, float rotate, Vector2 scale, SpriteEffects spriteEffect = SpriteEffects.None, float? depth = null) { + //for (int x = -1; x < 3; x+=2 ) + //{ + // for (int y = -1; y < 3; y+=2 ) + // { + + // spriteBatch.Draw(texture, pos + offset + new Vector2(x, y)*1.0f, sourceRect, Color.Black, rotation + rotate, origin, scale, spriteEffect, (depth == null ? this.depth : (float)depth)+0.0001f); + // } + //} + spriteBatch.Draw(texture, pos + offset, sourceRect, color, rotation + rotate, origin, scale, spriteEffect, depth == null ? this.depth : (float)depth); } @@ -214,14 +223,14 @@ namespace Barotrauma int xTiles = (int)Math.Ceiling((targetSize.X+startOffset.X) / sourceRect.Width); //how many times the texture needs to be drawn on the y-axis int yTiles = (int)Math.Ceiling((targetSize.Y+startOffset.Y) / sourceRect.Height); - - Vector2 position = pos-startOffset; + + Vector2 position = pos - startOffset; Rectangle drawRect = sourceRect; position.X = pos.X; - for (int x = 0 ; x - - Subsurface_contentContent + + Barotrauma_contentContent Content {8C1D2051-F0F3-457B-AAAE-4E155FC7C75C} diff --git a/Subsurface_content/Subsurface_content/Barotrauma_content.csproj.PSM.cachefile b/Subsurface_content/Subsurface_content/Barotrauma_content.csproj.PSM.cachefile new file mode 100644 index 000000000..2a3436749 --- /dev/null +++ b/Subsurface_content/Subsurface_content/Barotrauma_content.csproj.PSM.cachefile @@ -0,0 +1,6 @@ +Content\SpriteFont1.xnb +Content\SmallFont.xnb +Content\LargeFont.xnb +Content\SpriteFont1.spritefont +Content\SmallFont.spritefont +Content\LargeFont.spritefont diff --git a/Subsurface_content/Subsurface_content/Subsurface_content.csproj.user b/Subsurface_content/Subsurface_content/Barotrauma_content.csproj.user similarity index 100% rename from Subsurface_content/Subsurface_content/Subsurface_content.csproj.user rename to Subsurface_content/Subsurface_content/Barotrauma_content.csproj.user diff --git a/Subsurface_content/Subsurface_contentContent/Subsurface_contentContent.contentproj b/Subsurface_content/Subsurface_contentContent/Barotrauma_contentContent.contentproj similarity index 100% rename from Subsurface_content/Subsurface_contentContent/Subsurface_contentContent.contentproj rename to Subsurface_content/Subsurface_contentContent/Barotrauma_contentContent.contentproj diff --git a/UpgradeLog.htm b/UpgradeLog.htm deleted file mode 100644 index c8914030b..000000000 Binary files a/UpgradeLog.htm and /dev/null differ diff --git a/UpgradeLog2.htm b/UpgradeLog2.htm deleted file mode 100644 index c8914030b..000000000 Binary files a/UpgradeLog2.htm and /dev/null differ