diff --git a/Barotrauma/BarotraumaClient/Barotrauma b/Barotrauma/BarotraumaClient/Barotrauma
new file mode 100755
index 000000000..2a9280054
--- /dev/null
+++ b/Barotrauma/BarotraumaClient/Barotrauma
@@ -0,0 +1,35 @@
+#!/bin/bash
+# MonoKickstart Shell Script
+# Written by Ethan "flibitijibibo" Lee
+
+# Move to script's directory
+cd "`dirname "$0"`"
+
+# Get the system architecture
+UNAME=`uname`
+ARCH=`uname -m`
+
+# MonoKickstart picks the right libfolder, so just execute the right binary.
+if [ "$UNAME" == "Darwin" ]; then
+ # ... Except on OSX.
+ export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:./osx/
+
+ # El Capitan is a total idiot and wipes this variable out, making the
+ # Steam overlay disappear. This sidesteps "System Integrity Protection"
+ # and resets the variable with Valve's own variable (they provided this
+ # fix by the way, thanks Valve!). Note that you will need to update your
+ # launch configuration to the script location, NOT just the app location
+ # (i.e. Kick.app/Contents/MacOS/Kick, not just Kick.app).
+ # -flibit
+ if [ "$STEAM_DYLD_INSERT_LIBRARIES" != "" ] && [ "$DYLD_INSERT_LIBRARIES" == "" ]; then
+ export DYLD_INSERT_LIBRARIES="$STEAM_DYLD_INSERT_LIBRARIES"
+ fi
+
+ ./Barotrauma.bin.osx $@
+else
+ if [ "$ARCH" == "x86_64" ]; then
+ ./Barotrauma.bin.x86_64 $@
+ else
+ ./Barotrauma.bin.x86 $@
+ fi
+fi
diff --git a/Barotrauma/BarotraumaClient/Barotrauma.bin.osx b/Barotrauma/BarotraumaClient/Barotrauma.bin.osx
new file mode 100644
index 000000000..98bf55fc7
Binary files /dev/null and b/Barotrauma/BarotraumaClient/Barotrauma.bin.osx differ
diff --git a/Barotrauma/BarotraumaClient/Barotrauma.bin.x86 b/Barotrauma/BarotraumaClient/Barotrauma.bin.x86
new file mode 100755
index 000000000..c7c060f04
Binary files /dev/null and b/Barotrauma/BarotraumaClient/Barotrauma.bin.x86 differ
diff --git a/Barotrauma/BarotraumaClient/Barotrauma.bin.x86_64 b/Barotrauma/BarotraumaClient/Barotrauma.bin.x86_64
new file mode 100755
index 000000000..47535d05b
Binary files /dev/null and b/Barotrauma/BarotraumaClient/Barotrauma.bin.x86_64 differ
diff --git a/Barotrauma/BarotraumaClient/ClientCode.projitems b/Barotrauma/BarotraumaClient/ClientCode.projitems
index 1b79fd2eb..e2df0a544 100644
--- a/Barotrauma/BarotraumaClient/ClientCode.projitems
+++ b/Barotrauma/BarotraumaClient/ClientCode.projitems
@@ -43,8 +43,12 @@
-
+
+
+
+
+
diff --git a/Barotrauma/BarotraumaClient/LinuxClient.csproj b/Barotrauma/BarotraumaClient/LinuxClient.csproj
index f0fa4331e..f0d80d9ee 100644
--- a/Barotrauma/BarotraumaClient/LinuxClient.csproj
+++ b/Barotrauma/BarotraumaClient/LinuxClient.csproj
@@ -193,6 +193,60 @@
PreserveNewest
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
diff --git a/Barotrauma/BarotraumaClient/MacClient.csproj b/Barotrauma/BarotraumaClient/MacClient.csproj
index 29dd488d3..f9fdba9c8 100644
--- a/Barotrauma/BarotraumaClient/MacClient.csproj
+++ b/Barotrauma/BarotraumaClient/MacClient.csproj
@@ -188,7 +188,62 @@
PreserveNewest
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
+ PreserveNewest
+
+
diff --git a/Barotrauma/BarotraumaClient/Mono.Posix.dll b/Barotrauma/BarotraumaClient/Mono.Posix.dll
new file mode 100755
index 000000000..6f4550923
Binary files /dev/null and b/Barotrauma/BarotraumaClient/Mono.Posix.dll differ
diff --git a/Barotrauma/BarotraumaClient/Mono.Security.dll b/Barotrauma/BarotraumaClient/Mono.Security.dll
new file mode 100755
index 000000000..a50cd152c
Binary files /dev/null and b/Barotrauma/BarotraumaClient/Mono.Security.dll differ
diff --git a/Barotrauma/BarotraumaClient/Properties/AssemblyInfo.cs b/Barotrauma/BarotraumaClient/Properties/AssemblyInfo.cs
index b67af8559..5e2918897 100644
--- a/Barotrauma/BarotraumaClient/Properties/AssemblyInfo.cs
+++ b/Barotrauma/BarotraumaClient/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.8.9.10")]
-[assembly: AssemblyFileVersion("0.8.9.10")]
+[assembly: AssemblyVersion("0.8.10.0")]
+[assembly: AssemblyFileVersion("0.8.10.0")]
diff --git a/Barotrauma/BarotraumaClient/SharpFont.dll.config b/Barotrauma/BarotraumaClient/SharpFont.dll.config
index 719e30c78..8129b80cb 100755
--- a/Barotrauma/BarotraumaClient/SharpFont.dll.config
+++ b/Barotrauma/BarotraumaClient/SharpFont.dll.config
@@ -1,6 +1,6 @@
-
+
diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs b/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs
index da396dad7..667d29d62 100644
--- a/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs
+++ b/Barotrauma/BarotraumaClient/Source/Characters/Animation/Ragdoll.cs
@@ -264,35 +264,17 @@ namespace Barotrauma
partial void ImpactProjSpecific(float impact, Body body)
{
- float volume = Math.Min(impact - 3.0f, 1.0f);
+ float volume = MathHelper.Clamp(impact - 3.0f, 0.5f, 1.0f);
- if (body.UserData is Limb && character.Stun <= 0f)
+ if (body.UserData is Limb limb && character.Stun <= 0f)
{
- Limb limb = (Limb)body.UserData;
- if (impact > 3.0f && limb.LastImpactSoundTime < Timing.TotalTime - Limb.SoundInterval)
- {
- limb.LastImpactSoundTime = (float)Timing.TotalTime;
- if (!string.IsNullOrWhiteSpace(limb.HitSoundTag))
- {
- SoundPlayer.PlaySound(limb.HitSoundTag, volume, impact * 100.0f, limb.WorldPosition, character.CurrentHull);
- }
- foreach (WearableSprite wearable in limb.WearingItems)
- {
- if (limb.type == wearable.Limb && !string.IsNullOrWhiteSpace(wearable.Sound))
- {
- SoundPlayer.PlaySound(wearable.Sound, volume, impact * 100.0f, limb.WorldPosition, character.CurrentHull);
- }
- }
- }
+ if (impact > 3.0f) { PlayImpactSound(limb); }
}
else if (body.UserData is Limb || body == Collider.FarseerBody)
{
- if (!character.IsRemotePlayer)
+ if (!character.IsRemotePlayer && impact > ImpactTolerance)
{
- if (impact > ImpactTolerance)
- {
- SoundPlayer.PlayDamageSound("LimbBlunt", strongestImpact, Collider);
- }
+ SoundPlayer.PlayDamageSound("LimbBlunt", strongestImpact, Collider);
}
}
if (Character.Controlled == character)
@@ -301,6 +283,29 @@ namespace Barotrauma
}
}
+ public void PlayImpactSound(Limb limb)
+ {
+ limb.LastImpactSoundTime = (float)Timing.TotalTime;
+ if (!string.IsNullOrWhiteSpace(limb.HitSoundTag))
+ {
+ bool inWater = limb.inWater;
+ if (character.CurrentHull != null &&
+ character.CurrentHull.Surface > character.CurrentHull.Rect.Y - character.CurrentHull.Rect.Height &&
+ limb.SimPosition.Y < ConvertUnits.ToSimUnits(character.CurrentHull.Rect.Y - character.CurrentHull.Rect.Height) + limb.body.GetMaxExtent())
+ {
+ inWater = true;
+ }
+ SoundPlayer.PlaySound(inWater ? "footstep_water" : limb.HitSoundTag, limb.WorldPosition, hullGuess: character.CurrentHull);
+ }
+ foreach (WearableSprite wearable in limb.WearingItems)
+ {
+ if (limb.type == wearable.Limb && !string.IsNullOrWhiteSpace(wearable.Sound))
+ {
+ SoundPlayer.PlaySound(wearable.Sound, limb.WorldPosition, hullGuess: character.CurrentHull);
+ }
+ }
+ }
+
partial void Splash(Limb limb, Hull limbHull)
{
//create a splash particle
@@ -363,6 +368,8 @@ namespace Barotrauma
partial void UpdateProjSpecific(float deltaTime)
{
+ if (!character.Enabled || SimplePhysicsEnabled) { return; }
+
LimbJoints.ForEach(j => j.UpdateDeformations(deltaTime));
foreach (var deformation in SpriteDeformations)
{
@@ -393,7 +400,7 @@ namespace Barotrauma
}
}
- partial void SeverLimbJointProjSpecific(LimbJoint limbJoint)
+ partial void SeverLimbJointProjSpecific(LimbJoint limbJoint, bool playSound = true)
{
foreach (Limb limb in new Limb[] { limbJoint.LimbA, limbJoint.LimbB })
{
@@ -411,6 +418,11 @@ namespace Barotrauma
character.CurrentHull?.AddDecal(character.BloodDecalName, limb.WorldPosition, MathHelper.Clamp(limb.Mass, 0.5f, 2.0f));
}
}
+
+ if (playSound)
+ {
+ SoundPlayer.PlayDamageSound("Gore", 1.0f, limbJoint.LimbA.body);
+ }
}
public virtual void Draw(SpriteBatch spriteBatch, Camera cam)
@@ -428,14 +440,15 @@ namespace Barotrauma
return;
}
- //foreach (Limb limb in Limbs)
- //{
- // limb.Draw(spriteBatch, cam);
- //}
+ Color? color = null;
+ if (character.ExternalHighlight)
+ {
+ color = Color.Lerp(Color.White, Color.OrangeRed, (float)Math.Sin(Timing.TotalTime * 3.5f));
+ }
for (int i = 0; i < limbs.Length; i++)
{
- inversedLimbDrawOrder[i].Draw(spriteBatch, cam);
+ inversedLimbDrawOrder[i].Draw(spriteBatch, cam, color);
}
LimbJoints.ForEach(j => j.Draw(spriteBatch));
}
diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Attack.cs b/Barotrauma/BarotraumaClient/Source/Characters/Attack.cs
index 7d293d643..3b3626b65 100644
--- a/Barotrauma/BarotraumaClient/Source/Characters/Attack.cs
+++ b/Barotrauma/BarotraumaClient/Source/Characters/Attack.cs
@@ -50,7 +50,7 @@ namespace Barotrauma
if (sound != null)
{
- SoundPlayer.PlaySound(sound.Sound, sound.Volume, sound.Range, worldPosition);
+ SoundPlayer.PlaySound(sound.Sound, worldPosition, sound.Volume, sound.Range);
}
}
}
diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs
index 4e611d6a6..2eff39aa6 100644
--- a/Barotrauma/BarotraumaClient/Source/Characters/Character.cs
+++ b/Barotrauma/BarotraumaClient/Source/Characters/Character.cs
@@ -33,6 +33,8 @@ namespace Barotrauma
private List sounds;
+ public bool ExternalHighlight;
+
//the Character that the player is currently controlling
private static Character controlled;
@@ -109,6 +111,33 @@ namespace Barotrauma
get { return gibEmitters; }
}
+ public class ObjectiveEntity
+ {
+ public Entity Entity;
+ public Sprite Sprite;
+ public Color Color;
+
+ public ObjectiveEntity(Entity entity, Sprite sprite, Color? color = null)
+ {
+ Entity = entity;
+ Sprite = sprite;
+ if (color.HasValue)
+ {
+ Color = color.Value;
+ }
+ else
+ {
+ Color = Color.White;
+ }
+ }
+ }
+
+ private List activeObjectiveEntities = new List();
+ public IEnumerable ActiveObjectiveEntities
+ {
+ get { return activeObjectiveEntities; }
+ }
+
partial void InitProjSpecific(XDocument doc)
{
soundInterval = doc.Root.GetAttributeFloat("soundinterval", 10.0f);
@@ -728,15 +757,29 @@ namespace Barotrauma
var matchingSoundsList = matchingSounds.ToList();
var selectedSound = matchingSoundsList[Rand.Int(matchingSoundsList.Count)];
- soundChannel = SoundPlayer.PlaySound(selectedSound.Sound, selectedSound.Volume, selectedSound.Range, AnimController.WorldPosition, CurrentHull);
+ soundChannel = SoundPlayer.PlaySound(selectedSound.Sound, AnimController.WorldPosition, selectedSound.Volume, selectedSound.Range, CurrentHull);
soundTimer = soundInterval;
}
+ public void AddActiveObjectiveEntity(Entity entity, Sprite sprite, Color? color = null)
+ {
+ if (activeObjectiveEntities.Any(aoe => aoe.Entity == entity)) return;
+ ObjectiveEntity objectiveEntity = new ObjectiveEntity(entity, sprite, color);
+ activeObjectiveEntities.Add(objectiveEntity);
+ }
+
+ public void RemoveActiveObjectiveEntity(Entity entity)
+ {
+ ObjectiveEntity found = activeObjectiveEntities.Find(aoe => aoe.Entity == entity);
+ if (found == null) return;
+ activeObjectiveEntities.Remove(found);
+ }
+
partial void ImplodeFX()
{
Vector2 centerOfMass = AnimController.GetCenterOfMass();
- SoundPlayer.PlaySound("implode", 1.0f, 150.0f, WorldPosition);
+ SoundPlayer.PlaySound("implode", WorldPosition);
for (int i = 0; i < 10; i++)
{
diff --git a/Barotrauma/BarotraumaClient/Source/Characters/CharacterHUD.cs b/Barotrauma/BarotraumaClient/Source/Characters/CharacterHUD.cs
index a2137e660..441ae6a6e 100644
--- a/Barotrauma/BarotraumaClient/Source/Characters/CharacterHUD.cs
+++ b/Barotrauma/BarotraumaClient/Source/Characters/CharacterHUD.cs
@@ -168,7 +168,12 @@ namespace Barotrauma
DrawOrderIndicator(spriteBatch, cam, character, character.CurrentOrder, 1.0f);
}
}
-
+
+ foreach (Character.ObjectiveEntity objectiveEntity in character.ActiveObjectiveEntities)
+ {
+ DrawObjectiveIndicator(spriteBatch, cam, character, objectiveEntity, 1.0f);
+ }
+
foreach (Item brokenItem in brokenItems)
{
float dist = Vector2.Distance(character.WorldPosition, brokenItem.WorldPosition);
@@ -371,5 +376,13 @@ namespace Barotrauma
orderIndicatorCount[target] = orderIndicatorCount[target] + 1;
}
+
+ private static void DrawObjectiveIndicator(SpriteBatch spriteBatch, Camera cam, Character character, Character.ObjectiveEntity objectiveEntity, float iconAlpha = 1.0f)
+ {
+ if (objectiveEntity == null) return;
+
+ Vector2 drawPos = objectiveEntity.Entity.WorldPosition;// + Vector2.UnitX * objectiveEntity.Sprite.size.X * 1.5f;
+ GUI.DrawIndicator(spriteBatch, drawPos, cam, 100.0f, objectiveEntity.Sprite, objectiveEntity.Color * iconAlpha);
+ }
}
}
diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Health/CharacterHealth.cs b/Barotrauma/BarotraumaClient/Source/Characters/Health/CharacterHealth.cs
index 777bc7775..34ebcb336 100644
--- a/Barotrauma/BarotraumaClient/Source/Characters/Health/CharacterHealth.cs
+++ b/Barotrauma/BarotraumaClient/Source/Characters/Health/CharacterHealth.cs
@@ -96,6 +96,11 @@ namespace Barotrauma
private const float UpdateDisplayedAfflictionsInterval = 0.5f;
private List currentDisplayedAfflictions = new List();
+ public bool MouseOnElement
+ {
+ get { return highlightedLimbIndex > -1 || GUI.MouseOn == dropItemArea; }
+ }
+
private static CharacterHealth openHealthWindow;
public static CharacterHealth OpenHealthWindow
{
@@ -131,6 +136,17 @@ namespace Barotrauma
}
}
+ public GUIButton CPRButton
+ {
+ get { return cprButton; }
+ }
+
+ public float HealthBarPulsateTimer
+ {
+ get { return healthBarPulsateTimer; }
+ set { healthBarPulsateTimer = MathHelper.Clamp(value, 0.0f, 10.0f); }
+ }
+
static CharacterHealth()
{
damageOverlay = new Sprite("Content/UI/damageOverlay.png", Vector2.Zero);
@@ -172,18 +188,16 @@ namespace Barotrauma
afflictionInfoContainer = new GUIListBox(new RectTransform(new Vector2(0.7f, 0.85f), paddedInfoFrame.RectTransform, Anchor.BottomLeft));
- new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.08f), paddedInfoFrame.RectTransform), TextManager.Get("SuitableTreatments"), textAlignment: Alignment.TopRight);
- lowSkillIndicator = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.07f), paddedInfoFrame.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, 0.08f) },
- TextManager.Get("LowMedicalSkillWarning"), Color.Orange, textAlignment: Alignment.Center, font: GUI.SmallFont, wrap: true)
+ lowSkillIndicator = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), paddedInfoFrame.RectTransform, Anchor.TopRight),
+ TextManager.Get("LowMedicalSkillWarning"), Color.Orange, textAlignment: Alignment.TopRight, font: GUI.SmallFont, wrap: true)
{
Visible = false
};
- recommendedTreatmentContainer = new GUIListBox(new RectTransform(new Vector2(0.28f, 0.5f), paddedInfoFrame.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, 0.15f) })
- {
- Spacing = 10
- };
+ new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), paddedInfoFrame.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.05f) }, TextManager.Get("SuitableTreatments"), textAlignment: Alignment.BottomRight);
+
+ recommendedTreatmentContainer = new GUIListBox(new RectTransform(new Vector2(0.28f, 0.5f), paddedInfoFrame.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, 0.12f) });
dropItemArea = new GUIFrame(new RectTransform(new Vector2(0.28f, 0.3f), paddedInfoFrame.RectTransform, Anchor.BottomRight)
- { RelativeOffset = new Vector2(0.0f, 0.0f) }, style: null)
+ { RelativeOffset = new Vector2(0.02f, 0.0f) }, style: null)
{
ToolTip = TextManager.Get("HealthItemUseTip")
};
@@ -584,9 +598,18 @@ namespace Barotrauma
var affliction = GetAllAfflictions(a => a.Prefab.IndicatorLimb != LimbType.None)
.OrderByDescending(a => a.DamagePerSecond)
.ThenByDescending(a => a.Strength).FirstOrDefault();
- var limbHealth = GetMathingLimbHealth(affliction);
- if (limbHealth != null)
+ if (affliction.DamagePerSecond > 0 || affliction.Strength > 0)
{
+ var limbHealth = GetMathingLimbHealth(affliction);
+ if (limbHealth != null)
+ {
+ selectedLimbIndex = limbHealths.IndexOf(limbHealth);
+ }
+ }
+ else
+ {
+ // If no affliction is critical, select the limb which has most damage.
+ var limbHealth = limbHealths.OrderByDescending(l => l.TotalDamage).FirstOrDefault();
selectedLimbIndex = limbHealths.IndexOf(limbHealth);
}
}
@@ -928,7 +951,7 @@ namespace Barotrauma
{
afflictionInfoContainer.Content.ClearChildren();
recommendedTreatmentContainer.Content.ClearChildren();
-
+
float characterSkillLevel = Character.Controlled == null ? 0.0f : Character.Controlled.GetSkillLevel("medical");
//random variance is 200% when the skill is 0
@@ -1023,14 +1046,15 @@ namespace Barotrauma
{
ItemPrefab item = MapEntityPrefab.Find(name: null, identifier: treatment.Key, showErrorMessages: false) as ItemPrefab;
if (item == null) continue;
- int slotSize = (int)(recommendedTreatmentContainer.Content.Rect.Width * 0.8f);
+ int slotSize = (int)(recommendedTreatmentContainer.Content.Rect.Width * 0.5f);
- var itemSlot = new GUIButton(new RectTransform(new Point(slotSize), recommendedTreatmentContainer.Content.RectTransform, Anchor.TopCenter),
- text: "", style: "InventorySlotSmall")
+ var itemSlot = new GUIFrame(new RectTransform(new Point(recommendedTreatmentContainer.Content.Rect.Width, slotSize), recommendedTreatmentContainer.Content.RectTransform, Anchor.TopCenter),
+ style: "InnerGlow")
{
- UserData = item
+ UserData = item,
+ CanBeFocused = false
};
- itemSlot.Color = ToolBox.GradientLerp(treatment.Value, Color.Red, Color.White, Color.LightGreen);
+ itemSlot.Color = ToolBox.GradientLerp(treatment.Value, Color.Red, Color.Orange, Color.LightGreen);
Sprite itemSprite = item.InventoryIcon ?? item.sprite;
Color itemColor = itemSprite == item.sprite ? item.SpriteColor : item.InventoryIconColor;
@@ -1414,6 +1438,8 @@ namespace Barotrauma
{
foreach (Limb limb in Character.AnimController.Limbs)
{
+ if (limb.HealthIndex < 0 || limb.HealthIndex >= limbHealths.Count) { continue; }
+
limb.BurnOverlayStrength = 0.0f;
limb.DamageOverlayStrength = 0.0f;
if (limbHealths[limb.HealthIndex].Afflictions.Count == 0) continue;
diff --git a/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs b/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs
index 0db66467c..63beecb56 100644
--- a/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs
+++ b/Barotrauma/BarotraumaClient/Source/Characters/Limb.cs
@@ -292,10 +292,10 @@ namespace Barotrauma
if (!string.IsNullOrWhiteSpace(damageModifier.DamageSound))
{
damageSoundType = damageModifier.DamageSound;
- SoundPlayer.PlayDamageSound(damageSoundType, Math.Max(damage, bleedingDamage), WorldPosition);
break;
}
}
+ SoundPlayer.PlayDamageSound(damageSoundType, Math.Max(damage, bleedingDamage), WorldPosition);
}
// Always spawn damage particles
diff --git a/Barotrauma/BarotraumaClient/Source/DebugConsole.cs b/Barotrauma/BarotraumaClient/Source/DebugConsole.cs
index 697d8f31d..a3b0fdc51 100644
--- a/Barotrauma/BarotraumaClient/Source/DebugConsole.cs
+++ b/Barotrauma/BarotraumaClient/Source/DebugConsole.cs
@@ -346,7 +346,7 @@ namespace Barotrauma
}
}));
- commands.Add(new Command("mainmenuscreen|mainmenu|menu", "mainmenu/menu: Go to the main menu.", (string[] args) =>
+ commands.Add(new Command("mainmenu|menu", "mainmenu/menu: Go to the main menu.", (string[] args) =>
{
GameMain.GameSession = null;
@@ -359,12 +359,16 @@ namespace Barotrauma
GameMain.MainMenuScreen.Select();
}));
- commands.Add(new Command("gamescreen|game", "gamescreen/game: Go to the \"in-game\" view.", (string[] args) =>
+ commands.Add(new Command("game", "gamescreen/game: Go to the \"in-game\" view.", (string[] args) =>
{
+ if (Screen.Selected == GameMain.SubEditorScreen)
+ {
+ NewMessage("WARNING: Switching directly from the submarine editor to the game view may cause bugs and crashes. Use with caution.", Color.Orange);
+ }
GameMain.GameScreen.Select();
}));
- commands.Add(new Command("editsubscreen|editsub|subeditor", "editsub/subeditor: Switch to the submarine editor.", (string[] args) =>
+ commands.Add(new Command("editsubs|subeditor", "editsubs/subeditor: Switch to the Submarine Editor to create or edit submarines.", (string[] args) =>
{
if (args.Length > 0)
{
@@ -373,23 +377,27 @@ namespace Barotrauma
GameMain.SubEditorScreen.Select();
}));
- commands.Add(new Command("editparticles|particleeditor", "", (string[] args) =>
+ commands.Add(new Command("editparticles|particleeditor", "editparticles/particleeditor: Switch to the Particle Editor to edit particle effects.", (string[] args) =>
{
GameMain.ParticleEditorScreen.Select();
}));
- commands.Add(new Command("editlevels|editlevel|leveleditor", "", (string[] args) =>
+ commands.Add(new Command("editlevels|leveleditor", "editlevels/leveleditor: Switch to the Level Editor to edit levels.", (string[] args) =>
{
GameMain.LevelEditorScreen.Select();
}));
- commands.Add(new Command("editsprites|editsprite|spriteeditor|spriteedit", "", (string[] args) =>
+ commands.Add(new Command("editsprites|spriteeditor", "editsprites/spriteeditor: Switch to the Sprite Editor to edit the source rects and origins of sprites.", (string[] args) =>
{
GameMain.SpriteEditorScreen.Select();
}));
- commands.Add(new Command("charactereditor|editcharacter|editcharacters|editanimation|editanimations|animedit|animationeditor|animeditor|animationedit", "charactereditor: Edit characters, animations, ragdolls....", (string[] args) =>
+ commands.Add(new Command("editcharacters|charactereditor", "editcharacters/charactereditor: Switch to the Character Editor to edit/create the ragdolls and animations of characters.", (string[] args) =>
{
+ if (Screen.Selected == GameMain.GameScreen)
+ {
+ NewMessage("WARNING: Switching between the character editor and the game view may cause odd behaviour or bugs. Use with caution.", Color.Orange);
+ }
GameMain.CharacterEditorScreen.Select();
}));
@@ -555,6 +563,37 @@ namespace Barotrauma
}
}));
+ commands.Add(new Command("resetselected", "Reset selected items and structures to prefabs. Only applicable in the subeditor.", args =>
+ {
+ if (Screen.Selected == GameMain.SubEditorScreen)
+ {
+ foreach (MapEntity entity in MapEntity.SelectedList)
+ {
+ if (entity is Item item)
+ {
+ item.Reset();
+ }
+ else if (entity is Structure structure)
+ {
+ structure.Reset();
+ }
+ }
+ foreach (MapEntity entity in MapEntity.SelectedList)
+ {
+ if (entity is Item item)
+ {
+ item.CreateEditingHUD();
+ break;
+ }
+ else if (entity is Structure structure)
+ {
+ structure.CreateEditingHUD();
+ break;
+ }
+ }
+ }
+ }));
+
commands.Add(new Command("alpha", "Change the alpha (as bytes from 0 to 255) of the selected item/structure instances. Applied only in the subeditor.", (string[] args) =>
{
if (Screen.Selected == GameMain.SubEditorScreen)
@@ -1057,8 +1096,8 @@ namespace Barotrauma
List lines = new List();
foreach (MapEntityPrefab me in MapEntityPrefab.List)
{
- lines.Add("" + me.Name + "" + me.Identifier + ".Name>");
- lines.Add("" + me.Description + "" + me.Identifier + ".Description>");
+ lines.Add("" + me.Name + "");
+ lines.Add("" + me.Description + "");
}
File.WriteAllLines(filePath, lines);
}));
@@ -1488,7 +1527,7 @@ namespace Barotrauma
character.AnimController.ResetRagdoll();
}, isCheat: true));
- commands.Add(new Command("reloadwearables|reloadlimbs", "Reloads the sprites of all limbs and wearable sprites (clothing) of the controlled character. Provide id or name if you want to target another character.", args =>
+ commands.Add(new Command("reloadwearables", "Reloads the sprites of all limbs and wearable sprites (clothing) of the controlled character. Provide id or name if you want to target another character.", args =>
{
var character = (args.Length == 0) ? Character.Controlled : FindMatchingCharacter(args, true);
if (character == null)
@@ -1499,6 +1538,26 @@ namespace Barotrauma
ReloadWearables(character);
}, isCheat: true));
+ commands.Add(new Command("loadwearable", "Force select certain variant for the selected character.", args =>
+ {
+ var character = Character.Controlled;
+ if (character == null)
+ {
+ ThrowError("Not controlling any character.");
+ return;
+ }
+ if (args.Length == 0)
+ {
+ ThrowError("No arguments provided! Give an index number for the variant starting from 1.");
+ return;
+ }
+ if (int.TryParse(args[0], out int variant))
+ {
+ ReloadWearables(character, variant);
+ }
+
+ }, isCheat: true));
+
commands.Add(new Command("reloadsprite|reloadsprites", "Reloads the sprites of the selected item(s)/structure(s) (hovering over or selecting in the subeditor) or the controlled character. Can also reload sprites by entity id or by the name attribute (sprite element). Example 1: reloadsprite id itemid. Example 2: reloadsprite name \"Sprite name\"", args =>
{
if (Screen.Selected is SpriteEditorScreen)
@@ -1646,7 +1705,7 @@ namespace Barotrauma
}, isCheat: true));
}
- private static void ReloadWearables(Character character)
+ private static void ReloadWearables(Character character, int variant = 0)
{
foreach (var limb in character.AnimController.Limbs)
{
@@ -1655,11 +1714,17 @@ namespace Barotrauma
limb.DeformSprite?.Sprite.ReloadTexture();
foreach (var wearable in limb.WearingItems)
{
+ if (variant > 0 && wearable.Variant > 0)
+ {
+ wearable.Variant = variant;
+ }
+ wearable.RefreshPath();
wearable.Sprite.ReloadXML();
wearable.Sprite.ReloadTexture();
}
foreach (var wearable in limb.OtherWearables)
{
+ wearable.RefreshPath();
wearable.Sprite.ReloadXML();
wearable.Sprite.ReloadTexture();
}
diff --git a/Barotrauma/BarotraumaClient/Source/Fonts/ScalableFont.cs b/Barotrauma/BarotraumaClient/Source/Fonts/ScalableFont.cs
index 5dc29999c..7a63b7cb6 100644
--- a/Barotrauma/BarotraumaClient/Source/Fonts/ScalableFont.cs
+++ b/Barotrauma/BarotraumaClient/Source/Fonts/ScalableFont.cs
@@ -7,7 +7,7 @@ using System.Xml.Linq;
namespace Barotrauma
{
- public class ScalableFont
+ public class ScalableFont : IDisposable
{
private static List FontList = new List();
private static Library Lib = null;
@@ -30,7 +30,7 @@ namespace Barotrauma
set
{
size = value;
- if (graphicsDevice!=null) RenderAtlas(graphicsDevice, charRanges, texDims, baseChar);
+ if (graphicsDevice != null) RenderAtlas(graphicsDevice, charRanges, texDims, baseChar);
}
}
@@ -279,7 +279,7 @@ namespace Barotrauma
if (text[i] == '\n')
{
currentLineX = 0.0f;
- retVal.Y += baseHeight * 18 / 10;
+ retVal.Y += baseHeight * 1.8f;
continue;
}
uint charIndex = text[i];
@@ -302,5 +302,15 @@ namespace Barotrauma
}
return retVal;
}
+
+ public void Dispose()
+ {
+ FontList.Remove(this);
+ foreach (Texture2D texture in textures)
+ {
+ texture.Dispose();
+ }
+ textures.Clear();
+ }
}
}
diff --git a/Barotrauma/BarotraumaClient/Source/GUI/ChatBox.cs b/Barotrauma/BarotraumaClient/Source/GUI/ChatBox.cs
index 64fecb33b..ff3cd1dae 100644
--- a/Barotrauma/BarotraumaClient/Source/GUI/ChatBox.cs
+++ b/Barotrauma/BarotraumaClient/Source/GUI/ChatBox.cs
@@ -18,15 +18,27 @@ namespace Barotrauma
private GUITextBox inputBox;
private GUIButton toggleButton;
-
- private GUIButton radioButton;
-
+
private Point screenResolution;
private bool isSinglePlayer;
public bool IsSinglePlayer => isSinglePlayer;
- private bool toggleOpen = true;
+ private bool _toggleOpen = true;
+ public bool ToggleOpen
+ {
+ get { return _toggleOpen; }
+ set
+ {
+ if (_toggleOpen == value) { return; }
+ _toggleOpen = GameMain.Config.ChatOpen = value;
+ foreach (GUIComponent child in ToggleButton.Children)
+ {
+ child.SpriteEffects = _toggleOpen == (HUDLayoutSettings.ChatBoxAlignment == Alignment.Right) ?
+ SpriteEffects.FlipHorizontally : SpriteEffects.None;
+ }
+ }
+ }
private float openState;
private float prevUIScale;
@@ -46,12 +58,7 @@ namespace Barotrauma
{
get { return guiFrame; }
}
-
- public GUIButton RadioButton
- {
- get { return radioButton; }
- }
-
+
public GUITextBox InputBox
{
get { return inputBox; }
@@ -81,12 +88,7 @@ namespace Barotrauma
toggleButton.OnClicked += (GUIButton btn, object userdata) =>
{
- toggleOpen = !toggleOpen;
- foreach (GUIComponent child in btn.Children)
- {
- child.SpriteEffects = toggleOpen == (HUDLayoutSettings.ChatBoxAlignment == Alignment.Right) ?
- SpriteEffects.FlipHorizontally : SpriteEffects.None;
- }
+ ToggleOpen = !ToggleOpen;
return true;
};
@@ -100,30 +102,8 @@ namespace Barotrauma
{
gui.Text = "";
};
-
- radioButton = new GUIButton(new RectTransform(new Vector2(0.1f, 2.0f), inputBox.RectTransform,
- HUDLayoutSettings.ChatBoxAlignment == Alignment.Right ? Anchor.BottomRight : Anchor.BottomLeft,
- HUDLayoutSettings.ChatBoxAlignment == Alignment.Right ? Pivot.TopRight : Pivot.TopLeft),
- style: null);
- new GUIImage(new RectTransform(Vector2.One, radioButton.RectTransform), radioIcon, scaleToFit: true);
- radioButton.OnClicked = (GUIButton btn, object userData) =>
- {
- if (inputBox.Selected)
- {
- inputBox.Text = "";
- inputBox.Deselect();
- }
- else
- {
- inputBox.Select();
- var radioItem = Character.Controlled?.Inventory?.Items.FirstOrDefault(i => i?.GetComponent() != null);
- if (radioItem != null && Character.Controlled.HasEquippedItem(radioItem) && radioItem.GetComponent().CanTransmit())
- {
- inputBox.Text = "r; ";
- }
- }
- return true;
- };
+
+ ToggleOpen = GameMain.Config.ChatOpen;
}
public bool TypingChatMessage(GUITextBox textBox, string text)
@@ -228,7 +208,7 @@ namespace Barotrauma
chatBox.UpdateScrollBarSize();
- if (!toggleOpen)
+ if (!ToggleOpen)
{
var popupMsg = new GUIFrame(new RectTransform(Vector2.One, guiFrame.RectTransform), style: "GUIToolTip")
{
@@ -313,9 +293,7 @@ namespace Barotrauma
prevUIScale = GUI.Scale;
}
-
-
- if (toggleOpen || (inputBox != null && inputBox.Selected))
+ if (ToggleOpen || (inputBox != null && inputBox.Selected))
{
openState += deltaTime * 5.0f;
//delete all popup messages when the chatbox is open
@@ -359,7 +337,6 @@ namespace Barotrauma
}
openState = MathHelper.Clamp(openState, 0.0f, 1.0f);
int hiddenBoxOffset = guiFrame.Rect.Width + toggleButton.Rect.Width;
- if (radioButton != null) hiddenBoxOffset += (int)(radioButton.Rect.Width * 1.5f);
guiFrame.RectTransform.AbsoluteOffset =
new Point((int)MathHelper.SmoothStep(hiddenBoxOffset * (HUDLayoutSettings.ChatBoxAlignment == Alignment.Left ? -1 : 1), 0, openState), 0);
}
diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs
index 87ccc8154..bb18cab55 100644
--- a/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs
+++ b/Barotrauma/BarotraumaClient/Source/GUI/GUI.cs
@@ -129,6 +129,8 @@ namespace Barotrauma
get { return pauseMenuOpen; }
}
+ public static bool PreventPauseMenuToggle = false;
+
public static Color ScreenOverlayColor
{
get;
@@ -1413,6 +1415,7 @@ namespace Barotrauma
public static void TogglePauseMenu()
{
if (Screen.Selected == GameMain.MainMenuScreen) return;
+ if (PreventPauseMenuToggle) return;
settingsMenuOpen = false;
@@ -1546,9 +1549,9 @@ namespace Barotrauma
if (GameMain.GameSession != null)
{
- if (ContextualTutorial.Initialized && GameMain.GameSession.GameMode is SinglePlayerCampaign)
+ if (Tutorial.Initialized)
{
- ((SinglePlayerCampaign)GameMain.GameSession.GameMode).ContextualTutorial.Stop();
+ ((TutorialMode)GameMain.GameSession.GameMode).Tutorial.Stop();
}
if (GameSettings.SendUserStatistics)
@@ -1559,6 +1562,8 @@ namespace Barotrauma
}
GameMain.GameSession = null;
}
+
+ GUIMessageBox.CloseAll();
GameMain.MainMenuScreen.Select();
@@ -1566,7 +1571,7 @@ namespace Barotrauma
}
///
- /// Displays a message at the center of the screen, automatically preventing overlapping with other centered messages
+ /// Displays a message at the center of the screen, automatically preventing overlapping with other centered messages. TODO: Allow to show messages at the middle of the screen (instead of the top center).
///
public static void AddMessage(string message, Color color, float? lifeTime = null, bool playSound = true, ScalableFont font = null)
{
diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUIButton.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIButton.cs
index 7917d904f..c4746fa69 100644
--- a/Barotrauma/BarotraumaClient/Source/GUI/GUIButton.cs
+++ b/Barotrauma/BarotraumaClient/Source/GUI/GUIButton.cs
@@ -168,6 +168,11 @@ namespace Barotrauma
if (frame != null) frame.ApplyStyle(style);
}
+ public override void Flash(Color? color = null, float flashDuration = 1.5f, bool useRectangleFlash = false, Vector2? flashRectInflate = null)
+ {
+ Frame.Flash(color, flashDuration, useRectangleFlash, flashRectInflate);
+ }
+
protected override void Draw(SpriteBatch spriteBatch)
{
//do nothing
diff --git a/Barotrauma/BarotraumaClient/Source/GUI/GUIComponent.cs b/Barotrauma/BarotraumaClient/Source/GUI/GUIComponent.cs
index c836b1f41..6f56b0654 100644
--- a/Barotrauma/BarotraumaClient/Source/GUI/GUIComponent.cs
+++ b/Barotrauma/BarotraumaClient/Source/GUI/GUIComponent.cs
@@ -121,11 +121,19 @@ namespace Barotrauma
protected Color selectedColor;
protected Color pressedColor;
+ private CoroutineHandle pulsateCoroutine;
+
protected ComponentState state;
protected Color flashColor;
protected float flashDuration = 1.5f;
+ private bool useRectangleFlash;
+ public float FlashTimer
+ {
+ get { return flashTimer; }
+ }
protected float flashTimer;
+ private Vector2 flashRectInflate;
public bool IgnoreLayoutGroups;
@@ -261,6 +269,8 @@ namespace Barotrauma
set { pressedColor = value; }
}
+ public bool ExternalHighlight = false;
+
private RectTransform rectTransform;
public RectTransform RectTransform
{
@@ -435,11 +445,21 @@ namespace Barotrauma
int flashCycleCount = (int)Math.Max(flashDuration, 1);
float flashCycleDuration = flashDuration / flashCycleCount;
+ Rectangle flashRect = Rect;
+ flashRect.Inflate(flashRectInflate.X, flashRectInflate.Y);
+
//MathHelper.Pi * 0.8f -> the curve goes from 144 deg to 0,
//i.e. quickly bumps up from almost full brightness to full and then fades out
- GUI.UIGlow.Draw(spriteBatch,
- rect,
- flashColor * (float)Math.Sin(flashTimer % flashCycleDuration / flashCycleDuration * MathHelper.Pi * 0.8f));
+ if (!useRectangleFlash)
+ {
+ GUI.UIGlow.Draw(spriteBatch,
+ flashRect,
+ flashColor * (float)Math.Sin(flashTimer % flashCycleDuration / flashCycleDuration * MathHelper.Pi * 0.8f));
+ }
+ else
+ {
+ GUI.DrawRectangle(spriteBatch, flashRect, flashColor * (float)Math.Sin(flashTimer % flashCycleDuration / flashCycleDuration * MathHelper.Pi * 0.8f), true);
+ }
}
}
@@ -487,9 +507,11 @@ namespace Barotrauma
color = new Color(color.R / 255.0f, color.G / 255.0f, color.B / 255.0f, a);
}
- public virtual void Flash(Color? color = null, float flashDuration = 1.5f)
+ public virtual void Flash(Color? color = null, float flashDuration = 1.5f, bool useRectangleFlash = false, Vector2? flashRectInflate = null)
{
flashTimer = flashDuration;
+ this.flashRectInflate = flashRectInflate ?? Vector2.Zero;
+ this.useRectangleFlash = useRectangleFlash;
this.flashDuration = flashDuration;
flashColor = (color == null) ? Color.Red : (Color)color;
}
@@ -507,9 +529,7 @@ namespace Barotrauma
while (t < duration)
{
t += CoroutineManager.DeltaTime;
-
SetAlpha(MathHelper.Lerp(startA, to, t / duration));
-
yield return CoroutineStatus.Running;
}
@@ -523,6 +543,28 @@ namespace Barotrauma
yield return CoroutineStatus.Success;
}
+ public void Pulsate(Vector2 startScale, Vector2 endScale, float duration)
+ {
+ if (CoroutineManager.IsCoroutineRunning(pulsateCoroutine))
+ {
+ return;
+ }
+ pulsateCoroutine = CoroutineManager.StartCoroutine(DoPulsate(startScale, endScale, duration), "Pulsate" + ToString());
+ }
+
+ private IEnumerable