diff --git a/Subsurface/Barotrauma.csproj b/Subsurface/Barotrauma.csproj index 4b40ce47b..0fb8587a2 100644 --- a/Subsurface/Barotrauma.csproj +++ b/Subsurface/Barotrauma.csproj @@ -374,6 +374,21 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + PreserveNewest diff --git a/Subsurface/Content/Characters/Human/fhead7[black].png b/Subsurface/Content/Characters/Human/fhead7[black].png new file mode 100644 index 000000000..39ca24616 Binary files /dev/null and b/Subsurface/Content/Characters/Human/fhead7[black].png differ diff --git a/Subsurface/Content/Characters/Human/ftorso[black].png b/Subsurface/Content/Characters/Human/ftorso[black].png new file mode 100644 index 000000000..614a09857 Binary files /dev/null and b/Subsurface/Content/Characters/Human/ftorso[black].png differ diff --git a/Subsurface/Content/Characters/Human/head7[black].png b/Subsurface/Content/Characters/Human/head7[black].png new file mode 100644 index 000000000..e4983dc8c Binary files /dev/null and b/Subsurface/Content/Characters/Human/head7[black].png differ diff --git a/Subsurface/Content/Characters/Human/head8[black].png b/Subsurface/Content/Characters/Human/head8[black].png new file mode 100644 index 000000000..9d7d09059 Binary files /dev/null and b/Subsurface/Content/Characters/Human/head8[black].png differ diff --git a/Subsurface/Content/Characters/Human/human.xml b/Subsurface/Content/Characters/Human/human.xml index 28e4be637..1fdb2ec3a 100644 --- a/Subsurface/Content/Characters/Human/human.xml +++ b/Subsurface/Content/Characters/Human/human.xml @@ -1,5 +1,5 @@  - + diff --git a/Subsurface/Content/Characters/Human/torso[black].png b/Subsurface/Content/Characters/Human/torso[black].png new file mode 100644 index 000000000..b06dc1170 Binary files /dev/null and b/Subsurface/Content/Characters/Human/torso[black].png differ diff --git a/Subsurface/Source/Characters/CharacterHUD.cs b/Subsurface/Source/Characters/CharacterHUD.cs index cf2256f4e..153a75154 100644 --- a/Subsurface/Source/Characters/CharacterHUD.cs +++ b/Subsurface/Source/Characters/CharacterHUD.cs @@ -179,7 +179,7 @@ namespace Barotrauma new Vector2(GameMain.GraphicsWidth / damageOverlay.size.X, GameMain.GraphicsHeight / damageOverlay.size.Y)); } - if (character.IsUnconscious) + if (character.IsUnconscious && !character.IsDead) { if (suicideButton == null) { diff --git a/Subsurface/Source/Characters/CharacterInfo.cs b/Subsurface/Source/Characters/CharacterInfo.cs index 00d975eea..fb0a2be65 100644 --- a/Subsurface/Source/Characters/CharacterInfo.cs +++ b/Subsurface/Source/Characters/CharacterInfo.cs @@ -2,6 +2,8 @@ using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; +using System.IO; +using System.Linq; using System.Xml.Linq; namespace Barotrauma @@ -45,6 +47,12 @@ namespace Barotrauma } } + public List SpriteTags + { + get; + private set; + } + public int HeadSpriteId { get { return headSpriteId; } @@ -92,6 +100,8 @@ namespace Barotrauma pickedItems = new List(); + SpriteTags = new List(); + //ID = -1; XDocument doc = ToolBox.TryLoadXml(file); @@ -171,8 +181,30 @@ namespace Barotrauma spritePath = spritePath.Replace("[GENDER]", (this.gender == Gender.Female) ? "f" : ""); spritePath = spritePath.Replace("[HEADID]", HeadSpriteId.ToString()); - - headSprite = new Sprite(spriteElement, "", spritePath); + + string fileName = Path.GetFileNameWithoutExtension(spritePath); + + //go through the files in the directory to find a matching sprite + var files = Directory.GetFiles(Path.GetDirectoryName(spritePath)).ToList(); + foreach (string file in files) + { + string fileWithoutTags = Path.GetFileNameWithoutExtension(file); + fileWithoutTags = fileWithoutTags.Split('[', ']').First(); + + if (fileWithoutTags != fileName) continue; + + headSprite = new Sprite(spriteElement, "", file); + + //extract the tags out of the filename + SpriteTags = file.Split('[', ']').Skip(1).ToList(); + if (SpriteTags.Any()) + { + SpriteTags.RemoveAt(SpriteTags.Count-1); + } + + break; + } + break; } } diff --git a/Subsurface/Source/Characters/Limb.cs b/Subsurface/Source/Characters/Limb.cs index a1e7d6a76..2a77e3192 100644 --- a/Subsurface/Source/Characters/Limb.cs +++ b/Subsurface/Source/Characters/Limb.cs @@ -8,6 +8,8 @@ using Microsoft.Xna.Framework.Graphics; using Barotrauma.Items.Components; using System.Collections.Generic; using Barotrauma.Lights; +using System.Linq; +using System.IO; namespace Barotrauma { @@ -273,14 +275,34 @@ namespace Barotrauma case "sprite": string spritePath = subElement.Attribute("texture").Value; - if (character.Info!=null) + string spritePathWithTags = spritePath; + + if (character.Info != null) { spritePath = spritePath.Replace("[GENDER]", (character.Info.Gender == Gender.Female) ? "f" : ""); spritePath = spritePath.Replace("[HEADID]", character.Info.HeadSpriteId.ToString()); + + if (character.Info.HeadSprite != null && character.Info.SpriteTags.Any()) + { + string tags = ""; + character.Info.SpriteTags.ForEach(tag => tags += "[" + tag + "]"); + + spritePathWithTags = Path.Combine( + Path.GetDirectoryName(spritePath), + Path.GetFileNameWithoutExtension(spritePath) + tags + Path.GetExtension(spritePath)); + } } + if (File.Exists(spritePathWithTags)) + { + sprite = new Sprite(subElement, "", spritePathWithTags); + } + else + { + + sprite = new Sprite(subElement, "", spritePath); + } - sprite = new Sprite(subElement, "", spritePath); break; case "damagedsprite": string damagedSpritePath = subElement.Attribute("texture").Value;