(63916eda9) Unstable v0.9.1001.0

This commit is contained in:
Juan Pablo Arce
2020-05-15 13:06:19 -03:00
parent a1ca41aa5d
commit 3d2b7bcf63
52 changed files with 364 additions and 164 deletions
@@ -19,11 +19,14 @@ namespace Barotrauma
var target = _selectedAiTarget ?? _lastAiTarget;
if (target != null && target.Entity != null)
{
var memory = GetTargetMemory(target);
Vector2 targetPos = memory.Location;
targetPos.Y = -targetPos.Y;
GUI.DrawLine(spriteBatch, pos, targetPos, Color.White * 0.5f, 0, 4);
GUI.DrawString(spriteBatch, pos - Vector2.UnitY * 60.0f, $"{target.Entity.ToString()} ({memory.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
var memory = GetTargetMemory(target, false);
if (memory != null)
{
Vector2 targetPos = memory.Location;
targetPos.Y = -targetPos.Y;
GUI.DrawLine(spriteBatch, pos, targetPos, Color.White * 0.5f, 0, 4);
GUI.DrawString(spriteBatch, pos - Vector2.UnitY * 60.0f, $"{target.Entity} ({memory.Priority.FormatZeroDecimal()})", Color.White, Color.Black);
}
}
}
else if (SelectedAiTarget?.Entity != null)
@@ -43,7 +46,7 @@ namespace Barotrauma
GUI.DrawRectangle(spriteBatch, wallTargetPos - new Vector2(10.0f, 10.0f), new Vector2(20.0f, 20.0f), Color.Orange, false);
GUI.DrawLine(spriteBatch, pos, wallTargetPos, Color.Orange * 0.5f, 0, 5);
}
GUI.DrawString(spriteBatch, pos - Vector2.UnitY * 60.0f, $"{SelectedAiTarget.Entity.ToString()} ({GetTargetMemory(SelectedAiTarget).Priority.FormatZeroDecimal()})", GUI.Style.Red, Color.Black);
GUI.DrawString(spriteBatch, pos - Vector2.UnitY * 60.0f, $"{SelectedAiTarget.Entity} ({GetTargetMemory(SelectedAiTarget, false)?.Priority.FormatZeroDecimal()})", GUI.Style.Red, Color.Black);
GUI.DrawString(spriteBatch, pos - Vector2.UnitY * 40.0f, $"({targetValue.FormatZeroDecimal()})", GUI.Style.Red, Color.Black);
}
@@ -568,6 +568,10 @@ namespace Barotrauma
{
LightSource.LightSprite.Depth = ActiveSprite.Depth;
}
if (LightSource.DeformableLightSprite != null)
{
LightSource.DeformableLightSprite.Sprite.Depth = ActiveSprite.Depth;
}
}
UpdateSpriteStates(deltaTime);
@@ -625,7 +629,11 @@ namespace Barotrauma
{
var deformation = SpriteDeformation.GetDeformation(Deformations, deformSprite.Size);
deformSprite.Deform(deformation);
LightSource?.DeformableLightSprite?.Deform(deformation);
if (LightSource != null && LightSource.DeformableLightSprite != null)
{
deformation = SpriteDeformation.GetDeformation(Deformations, deformSprite.Size, dir == Direction.Left);
LightSource.DeformableLightSprite.Deform(deformation);
}
}
else
{
@@ -438,11 +438,8 @@ namespace Barotrauma.Items.Components
if (Voltage < MinVoltage) { return; }
Rectangle velRect = new Rectangle(x + 20, y + 20, width - 40, height - 40);
Vector2 displaySubPos = (-sonar.DisplayOffset * sonar.Zoom) / sonar.Range * sonar.DisplayRadius * sonar.Zoom;
displaySubPos.Y = -displaySubPos.Y;
displaySubPos = displaySubPos.ClampLength(velRect.Width / 2);
displaySubPos = steerArea.Rect.Center.ToVector2() + displaySubPos;
Vector2 steeringOrigin = steerArea.Rect.Center.ToVector2();
if (!AutoPilot)
{
Vector2 unitSteeringInput = steeringInput / 100.0f;
@@ -450,18 +447,18 @@ namespace Barotrauma.Items.Components
Vector2 steeringInputPos = new Vector2(
steeringInput.X * (float)Math.Sqrt(1.0f - 0.5f * unitSteeringInput.Y * unitSteeringInput.Y),
-steeringInput.Y * (float)Math.Sqrt(1.0f - 0.5f * unitSteeringInput.X * unitSteeringInput.X));
steeringInputPos += displaySubPos;
steeringInputPos += steeringOrigin;
if (steeringIndicator != null)
{
Vector2 dir = steeringInputPos - displaySubPos;
Vector2 dir = steeringInputPos - steeringOrigin;
float angle = (float)Math.Atan2(dir.Y, dir.X);
steeringIndicator.Draw(spriteBatch, displaySubPos, Color.White, origin: steeringIndicator.Origin, rotate: angle,
steeringIndicator.Draw(spriteBatch, steeringOrigin, Color.White, origin: steeringIndicator.Origin, rotate: angle,
scale: new Vector2(dir.Length() / steeringIndicator.size.X, 1.0f));
}
else
{
GUI.DrawLine(spriteBatch, displaySubPos, steeringInputPos, Color.LightGray);
GUI.DrawLine(spriteBatch, steeringOrigin, steeringInputPos, Color.LightGray);
GUI.DrawRectangle(spriteBatch, new Rectangle((int)steeringInputPos.X - 5, (int)steeringInputPos.Y - 5, 10, 10), Color.White);
}
@@ -475,7 +472,7 @@ namespace Barotrauma.Items.Components
Sonar sonar = item.GetComponent<Sonar>();
if (sonar != null && controlledSub != null)
{
Vector2 displayPosToMaintain = ((posToMaintain.Value - sonar.DisplayOffset * sonar.Zoom - controlledSub.WorldPosition)) / sonar.Range * sonar.DisplayRadius * sonar.Zoom;
Vector2 displayPosToMaintain = ((posToMaintain.Value - controlledSub.WorldPosition)) / sonar.Range * sonar.DisplayRadius * sonar.Zoom;
displayPosToMaintain.Y = -displayPosToMaintain.Y;
displayPosToMaintain = displayPosToMaintain.ClampLength(velRect.Width / 2);
displayPosToMaintain = steerArea.Rect.Center.ToVector2() + displayPosToMaintain;
@@ -494,11 +491,11 @@ namespace Barotrauma.Items.Components
if (maintainPosOriginIndicator != null)
{
maintainPosOriginIndicator.Draw(spriteBatch, displaySubPos, GUI.Style.Orange, scale: 0.5f * sonar.Zoom);
maintainPosOriginIndicator.Draw(spriteBatch, steeringOrigin, GUI.Style.Orange, scale: 0.5f * sonar.Zoom);
}
else
{
GUI.DrawRectangle(spriteBatch, new Rectangle((int)displaySubPos.X - 5, (int)displaySubPos.Y - 5, 10, 10), GUI.Style.Orange);
GUI.DrawRectangle(spriteBatch, new Rectangle((int)steeringOrigin.X - 5, (int)steeringOrigin.Y - 5, 10, 10), GUI.Style.Orange);
}
}
}
@@ -508,20 +505,19 @@ namespace Barotrauma.Items.Components
Vector2 steeringPos = new Vector2(
targetVelocity.X * 0.9f * (float)Math.Sqrt(1.0f - 0.5f * unitTargetVel.Y * unitTargetVel.Y),
-targetVelocity.Y * 0.9f * (float)Math.Sqrt(1.0f - 0.5f * unitTargetVel.X * unitTargetVel.X));
steeringPos += displaySubPos;
steeringPos += steeringOrigin;
if (steeringIndicator != null)
{
Vector2 dir = steeringPos - displaySubPos;
Vector2 dir = steeringPos - steeringOrigin;
float angle = (float)Math.Atan2(dir.Y, dir.X);
steeringIndicator.Draw(spriteBatch, displaySubPos, Color.Gray, origin: steeringIndicator.Origin, rotate: angle,
steeringIndicator.Draw(spriteBatch, steeringOrigin, Color.Gray, origin: steeringIndicator.Origin, rotate: angle,
scale: new Vector2(dir.Length() / steeringIndicator.size.X, 0.7f));
}
else
{
GUI.DrawLine(spriteBatch,
displaySubPos,
steeringOrigin,
steeringPos,
Color.CadetBlue, 0, 2);
}
@@ -669,11 +665,7 @@ namespace Barotrauma.Items.Components
{
if (PlayerInput.PrimaryMouseButtonHeld() && !CrewManager.IsCommandInterfaceOpen && !GameSession.IsTabMenuOpen)
{
Vector2 displaySubPos = (-sonar.DisplayOffset * sonar.Zoom) / sonar.Range * sonar.DisplayRadius * sonar.Zoom;
displaySubPos.Y = -displaySubPos.Y;
displaySubPos = steerArea.Rect.Center.ToVector2() + displaySubPos;
Vector2 inputPos = PlayerInput.MousePosition - displaySubPos;
Vector2 inputPos = PlayerInput.MousePosition - steerArea.Rect.Center.ToVector2();
inputPos.Y = -inputPos.Y;
if (AutoPilot && !LevelStartSelected && !LevelEndSelected)
{
@@ -848,7 +840,6 @@ namespace Barotrauma.Items.Components
Vector2 newSteeringInput = steeringInput;
Vector2 newTargetVelocity = targetVelocity;
float newSteeringAdjustSpeed = steeringAdjustSpeed;
bool maintainPos = false;
Vector2? newPosToMaintain = null;
bool headingToStart = false;
@@ -859,8 +850,7 @@ namespace Barotrauma.Items.Components
if (autoPilot)
{
maintainPos = msg.ReadBoolean();
if (maintainPos)
if (msg.ReadBoolean())
{
newPosToMaintain = new Vector2(
msg.ReadSingle(),
@@ -138,7 +138,15 @@ namespace Barotrauma.Items.Components
partial void UpdateProjSpecific(float deltaTime)
{
FakeBrokenTimer -= deltaTime;
if (Character.Controlled == null || (Character.Controlled.CharacterHealth.GetAffliction("psychosis")?.Strength ?? 0.0f) <= 0.0f)
{
FakeBrokenTimer = 0.0f;
}
else
{
FakeBrokenTimer -= deltaTime;
}
item.FakeBroken = FakeBrokenTimer > 0.0f;
if (!GameMain.IsMultiplayer)
@@ -147,9 +147,9 @@ namespace Barotrauma
for (int i = 0; i < Prefab.BrokenSprites.Count;i++)
{
if (Prefab.BrokenSprites[i].FadeIn) { continue; }
float minCondition = i > 0 ? Prefab.BrokenSprites[i - i].MaxCondition : 0.0f;
if (condition <= minCondition ||
condition <= Prefab.BrokenSprites[i].MaxCondition && !Prefab.BrokenSprites[i].FadeIn)
if (condition <= minCondition || condition <= Prefab.BrokenSprites[i].MaxCondition)
{
activeSprite = Prefab.BrokenSprites[i].Sprite;
break;
@@ -232,6 +232,7 @@ namespace Barotrauma
BrokenItemSprite fadeInBrokenSprite = null;
float fadeInBrokenSpriteAlpha = 0.0f;
float displayCondition = FakeBroken ? 0.0f : condition;
Vector2 drawOffset = Vector2.Zero;
if (displayCondition < Prefab.Health)
{
for (int i = 0; i < Prefab.BrokenSprites.Count; i++)
@@ -241,7 +242,7 @@ namespace Barotrauma
float min = i > 0 ? Prefab.BrokenSprites[i - i].MaxCondition : 0.0f;
float max = Prefab.BrokenSprites[i].MaxCondition;
fadeInBrokenSpriteAlpha = 1.0f - ((displayCondition - min) / (max - min));
if (fadeInBrokenSpriteAlpha > 0.0f && fadeInBrokenSpriteAlpha < 1.0f)
if (fadeInBrokenSpriteAlpha > 0.0f && fadeInBrokenSpriteAlpha <= 1.0f)
{
fadeInBrokenSprite = Prefab.BrokenSprites[i];
}
@@ -250,6 +251,7 @@ namespace Barotrauma
if (displayCondition <= Prefab.BrokenSprites[i].MaxCondition)
{
activeSprite = Prefab.BrokenSprites[i].Sprite;
drawOffset = Prefab.BrokenSprites[i].Offset.ToVector2() * Scale;
break;
}
}
@@ -271,9 +273,13 @@ namespace Barotrauma
{
if (prefab.ResizeHorizontal || prefab.ResizeVertical)
{
activeSprite.DrawTiled(spriteBatch, new Vector2(DrawPosition.X - rect.Width / 2, -(DrawPosition.Y + rect.Height / 2)), new Vector2(rect.Width, rect.Height), color: color,
Vector2 size = new Vector2(rect.Width, rect.Height);
activeSprite.DrawTiled(spriteBatch, new Vector2(DrawPosition.X - rect.Width / 2, -(DrawPosition.Y + rect.Height / 2)) + drawOffset,
size, color: color,
textureScale: Vector2.One * Scale,
depth: depth);
fadeInBrokenSprite?.Sprite.DrawTiled(spriteBatch, new Vector2(DrawPosition.X - rect.Width / 2, -(DrawPosition.Y + rect.Height / 2)), new Vector2(rect.Width, rect.Height), color: color * fadeInBrokenSpriteAlpha,
fadeInBrokenSprite?.Sprite.DrawTiled(spriteBatch, new Vector2(DrawPosition.X - rect.Width / 2, -(DrawPosition.Y + rect.Height / 2)) + fadeInBrokenSprite.Offset.ToVector2() * Scale, size, color: color * fadeInBrokenSpriteAlpha,
textureScale: Vector2.One * Scale,
depth: depth - 0.000001f);
foreach (var decorativeSprite in Prefab.DecorativeSprites)
{
@@ -287,8 +293,8 @@ namespace Barotrauma
}
else
{
activeSprite.Draw(spriteBatch, new Vector2(DrawPosition.X, -DrawPosition.Y), color, SpriteRotation, Scale, activeSprite.effects, depth);
fadeInBrokenSprite?.Sprite.Draw(spriteBatch, new Vector2(DrawPosition.X, -DrawPosition.Y), color * fadeInBrokenSpriteAlpha, SpriteRotation, Scale, activeSprite.effects, depth - 0.000001f);
activeSprite.Draw(spriteBatch, new Vector2(DrawPosition.X, -DrawPosition.Y) + drawOffset, color, SpriteRotation, Scale, activeSprite.effects, depth);
fadeInBrokenSprite?.Sprite.Draw(spriteBatch, new Vector2(DrawPosition.X, -DrawPosition.Y) + fadeInBrokenSprite.Offset.ToVector2() * Scale, color * fadeInBrokenSpriteAlpha, SpriteRotation, Scale, activeSprite.effects, depth - 0.000001f);
foreach (var decorativeSprite in Prefab.DecorativeSprites)
{
if (!spriteAnimState[decorativeSprite].IsActive) { continue; }
@@ -1270,6 +1276,14 @@ namespace Barotrauma
inventory = container.Inventory;
}
}
else if (inventoryOwner == null)
{
DebugConsole.ThrowError($"Failed to spawn item \"{(itemIdentifier ?? "null")}\" in the inventory of an entity with the ID {inventoryId} (entity not found)");
}
else
{
DebugConsole.ThrowError($"Failed to spawn item \"{(itemIdentifier ?? "null")}\" in the inventory of \"{inventoryOwner} ({inventoryOwner.ID})\" (invalid entity, should be an item or a character)");
}
}
var item = new Item(itemPrefab, pos, sub)
@@ -14,12 +14,14 @@ namespace Barotrauma
public readonly float MaxCondition;
public readonly Sprite Sprite;
public readonly bool FadeIn;
public readonly Point Offset;
public BrokenItemSprite(Sprite sprite, float maxCondition, bool fadeIn)
public BrokenItemSprite(Sprite sprite, float maxCondition, bool fadeIn, Point offset)
{
Sprite = sprite;
MaxCondition = MathHelper.Clamp(maxCondition, 0.0f, 100.0f);
FadeIn = fadeIn;
Offset = offset;
}
}
@@ -31,6 +31,7 @@ namespace Barotrauma
Stream = sound.Stream;
Range = element.GetAttributeFloat("range", 1000.0f);
Volume = element.GetAttributeFloat("volume", 1.0f);
sound.DisableMuffle = element.GetAttributeBool("disablemuffle", false);
}
}
@@ -1574,7 +1574,10 @@ namespace Barotrauma.Steam
{
exists |= File.Exists(contentFilePath + ".dll");
}
return contentFilePath;
if (exists)
{
return contentFilePath;
}
}
string[] splitPath = contentFilePath.Split('/');
@@ -120,13 +120,13 @@ namespace Barotrauma.Particles
return CreateParticle(prefabName, position, new Vector2((float)Math.Cos(angle), (float)-Math.Sin(angle)) * speed, angle, hullGuess);
}
public Particle CreateParticle(string prefabName, Vector2 position, Vector2 velocity, float rotation=0.0f, Hull hullGuess = null)
public Particle CreateParticle(string prefabName, Vector2 position, Vector2 velocity, float rotation = 0.0f, Hull hullGuess = null)
{
ParticlePrefab prefab = FindPrefab(prefabName);
if (prefab == null)
{
DebugConsole.ThrowError("Particle prefab \"" + prefabName+"\" not found!");
DebugConsole.ThrowError("Particle prefab \"" + prefabName + "\" not found!");
return null;
}
@@ -135,7 +135,7 @@ namespace Barotrauma.Particles
public Particle CreateParticle(ParticlePrefab prefab, Vector2 position, Vector2 velocity, float rotation = 0.0f, Hull hullGuess = null, bool drawOnTop = false)
{
if (particleCount >= MaxParticles || prefab == null) return null;
if (particleCount >= MaxParticles || prefab == null || prefab.Sprites.Count == 0) { return null; }
Vector2 particleEndPos = prefab.CalculateEndPosition(position, velocity);
@@ -144,8 +144,8 @@ namespace Barotrauma.Particles
Rectangle expandedViewRect = MathUtils.ExpandRect(cam.WorldView, MaxOutOfViewDist);
if (minPos.X > expandedViewRect.Right || maxPos.X < expandedViewRect.X) return null;
if (minPos.Y > expandedViewRect.Y || maxPos.Y < expandedViewRect.Y - expandedViewRect.Height) return null;
if (minPos.X > expandedViewRect.Right || maxPos.X < expandedViewRect.X) { return null; }
if (minPos.Y > expandedViewRect.Y || maxPos.Y < expandedViewRect.Y - expandedViewRect.Height) { return null; }
if (particles[particleCount] == null) particles[particleCount] = new Particle();
@@ -255,6 +255,11 @@ namespace Barotrauma.Particles
}
}
if (Sprites.Count == 0)
{
DebugConsole.ThrowError($"Particle prefab \"{Name}\" in the file \"{file}\" has no sprites defined!");
}
//if velocity change in water is not given, it defaults to the normal velocity change
if (element.Attribute("velocitychangewater") == null)
{
@@ -469,7 +469,11 @@ namespace Barotrauma
public static bool IsCtrlDown()
{
#if !OSX
return KeyDown(Keys.LeftControl) || KeyDown(Keys.RightControl);
#else
return KeyDown(Keys.LeftWindows) || KeyDown(Keys.RightWindows);
#endif
}
public static void Update(double deltaTime)
@@ -1245,7 +1245,8 @@ namespace Barotrauma
string prevDir = Path.GetDirectoryName(Submarine.MainSub.Info.FilePath).CleanUpPath();
string[] subDirs = prevDir.Split('/');
bool forceToSubFolder = Steam.SteamManager.IsInitialized;
if (forceToSubFolder && subDirs.Length>1 && subDirs[0].Equals("Mods", StringComparison.InvariantCultureIgnoreCase))
bool isInSubFolder = subDirs.Length > 0 && subDirs[0].Equals("Submarines", StringComparison.InvariantCultureIgnoreCase);
if (forceToSubFolder && subDirs.Length > 1 && subDirs[0].Equals("Mods", StringComparison.InvariantCultureIgnoreCase))
{
string modName = subDirs[1];
ContentPackage contentPackage = ContentPackage.List.Find(p => p.Name.Equals(modName, StringComparison.InvariantCultureIgnoreCase));
@@ -1261,7 +1262,7 @@ namespace Barotrauma
}
}
}
savePath = Path.Combine(forceToSubFolder ? SubmarineInfo.SavePath : prevDir, savePath).CleanUpPath();
savePath = Path.Combine(forceToSubFolder && !isInSubFolder ? SubmarineInfo.SavePath : prevDir, savePath).CleanUpPath();
}
else
{
@@ -76,6 +76,8 @@ namespace Barotrauma.Sounds
protected set;
}
public bool DisableMuffle { get; set; }
/// <summary>
/// How many instances of the same sound clip can be playing at the same time
/// </summary>
@@ -644,8 +644,12 @@ namespace Barotrauma
float far = range ?? sound.BaseFar;
if (Vector2.DistanceSquared(new Vector2(GameMain.SoundManager.ListenerPosition.X, GameMain.SoundManager.ListenerPosition.Y), position) > far * far) return null;
return sound.Play(volume ?? sound.BaseGain, far, position, muffle: ShouldMuffleSound(Character.Controlled, position, far, hullGuess));
if (Vector2.DistanceSquared(new Vector2(GameMain.SoundManager.ListenerPosition.X, GameMain.SoundManager.ListenerPosition.Y), position) > far * far)
{
return null;
}
bool muffle = !sound.DisableMuffle && ShouldMuffleSound(Character.Controlled, position, far, hullGuess);
return sound.Play(volume ?? sound.BaseGain, far, position, muffle: muffle);
}
private static void UpdateMusic(float deltaTime)
@@ -109,12 +109,12 @@ namespace Barotrauma.SpriteDeformations
}
}
protected override void GetDeformation(out Vector2[,] deformation, out float multiplier)
protected override void GetDeformation(out Vector2[,] deformation, out float multiplier, bool inverse)
{
deformation = Deformation;
multiplier = CustomDeformationParams.Frequency <= 0.0f ?
CustomDeformationParams.Amplitude :
(float)Math.Sin(phase) * CustomDeformationParams.Amplitude;
(float)Math.Sin(inverse ? -phase : phase) * CustomDeformationParams.Amplitude;
multiplier *= Params.Strength;
}
@@ -54,7 +54,7 @@ namespace Barotrauma.SpriteDeformations
phase = Rand.Range(0.0f, MathHelper.TwoPi);
}
protected override void GetDeformation(out Vector2[,] deformation, out float multiplier)
protected override void GetDeformation(out Vector2[,] deformation, out float multiplier, bool inverse)
{
deformation = this.deformation;
multiplier = InflateParams.Frequency <= 0.0f ? InflateParams.Scale : (float)(Math.Sin(phase) + 1.0f) / 2.0f * InflateParams.Scale;
@@ -56,7 +56,7 @@ namespace Barotrauma.SpriteDeformations
public JointBendDeformation(XElement element) : base(element, new JointBendDeformationParams(element)) { }
protected override void GetDeformation(out Vector2[,] deformation, out float multiplier)
protected override void GetDeformation(out Vector2[,] deformation, out float multiplier, bool inverse)
{
deformation = Deformation;
multiplier = 1.0f;// this.multiplier;
@@ -47,7 +47,7 @@ namespace Barotrauma.SpriteDeformations
}
}
protected override void GetDeformation(out Vector2[,] deformation, out float multiplier)
protected override void GetDeformation(out Vector2[,] deformation, out float multiplier, bool inverse)
{
deformation = Deformation;
multiplier = NoiseDeformationParams.Amplitude * Params.Strength;
@@ -100,7 +100,7 @@ namespace Barotrauma.SpriteDeformations
}
}
protected override void GetDeformation(out Vector2[,] deformation, out float multiplier)
protected override void GetDeformation(out Vector2[,] deformation, out float multiplier, bool inverse)
{
deformation = Deformation;
multiplier = 1.0f;
@@ -195,11 +195,12 @@ namespace Barotrauma.SpriteDeformations
Deformation = new Vector2[Params.Resolution.X, Params.Resolution.Y];
}
protected abstract void GetDeformation(out Vector2[,] deformation, out float multiplier);
protected abstract void GetDeformation(out Vector2[,] deformation, out float multiplier, bool inverse);
public abstract void Update(float deltaTime);
public static Vector2[,] GetDeformation(IEnumerable<SpriteDeformation> animations, Vector2 scale)
private static readonly List<int> yValues = new List<int>();
public static Vector2[,] GetDeformation(IEnumerable<SpriteDeformation> animations, Vector2 scale, bool inverseY = false)
{
foreach (SpriteDeformation animation in animations)
{
@@ -221,8 +222,16 @@ namespace Barotrauma.SpriteDeformations
Vector2[,] deformation = new Vector2[resolution.X, resolution.Y];
foreach (SpriteDeformation animation in animations)
{
animation.GetDeformation(out Vector2[,] animDeformation, out float multiplier);
yValues.Clear();
for (int y = 0; y < resolution.Y; y++)
{
yValues.Add(y);
}
if (inverseY && animation is CustomDeformation)
{
yValues.Reverse();
}
animation.GetDeformation(out Vector2[,] animDeformation, out float multiplier, inverseY);
for (int x = 0; x < resolution.X; x++)
{
for (int y = 0; y < resolution.Y; y++)
@@ -230,13 +239,13 @@ namespace Barotrauma.SpriteDeformations
switch (animation.Params.BlendMode)
{
case DeformationBlendMode.Override:
deformation[x,y] = animDeformation[x,y] * scale * multiplier;
deformation[x, yValues[y]] = animDeformation[x, y] * scale * multiplier;
break;
case DeformationBlendMode.Add:
deformation[x, y] += animDeformation[x, y] * scale * multiplier;
deformation[x, yValues[y]] += animDeformation[x, y] * scale * multiplier;
break;
case DeformationBlendMode.Multiply:
deformation[x, y] *= animDeformation[x, y] * multiplier;
deformation[x, yValues[y]] *= animDeformation[x, y] * multiplier;
break;
}
}
@@ -15,7 +15,7 @@ namespace Barotrauma
private static HashSet<StatusEffect> ActiveLoopingSounds = new HashSet<StatusEffect>();
private static double LastMuffleCheckTime;
private List<RoundSound> sounds = new List<RoundSound>();
private readonly List<RoundSound> sounds = new List<RoundSound>();
private SoundSelectionMode soundSelectionMode;
private SoundChannel soundChannel;
private Entity soundEmitter;
@@ -76,7 +76,7 @@ namespace Barotrauma
}
else
{
int selectedSoundIndex = 0;
int selectedSoundIndex;
if (soundSelectionMode == SoundSelectionMode.ItemSpecific && entity is Item item)
{
selectedSoundIndex = item.ID % sounds.Count;
@@ -208,7 +208,7 @@ namespace Barotrauma
}
else
{
DebugConsole.NewMessage($"Could not compress a texture because the dimensions are a multiple of 4 (path: {path ?? "null"}, size: {width}x{height})", Color.Orange);
DebugConsole.NewMessage($"Could not compress a texture because the dimensions aren't a multiple of 4 (path: {path ?? "null"}, size: {width}x{height})", Color.Orange);
}
}