Fixed several sound-related issues that have been bothering me for ages, e.g.
* Sounds not playing when the structure is fully destroyed * Glass windows using wrong sound effects * Only one glassBreak sound was used despite there being 3
This commit is contained in:
@@ -453,10 +453,11 @@ namespace Barotrauma
|
||||
{
|
||||
damage = MathHelper.Clamp(damage+Rand.Range(-10.0f, 10.0f), 0.0f, 100.0f);
|
||||
var sounds = damageSounds.FindAll(s =>
|
||||
damage >= s.damageRange.X &&
|
||||
damage <= s.damageRange.Y &&
|
||||
s.damageRange == null ||
|
||||
(damage >= s.damageRange.X &&
|
||||
damage <= s.damageRange.Y) &&
|
||||
s.damageType == damageType &&
|
||||
(string.IsNullOrEmpty(s.requiredTag) || (tags != null && tags.Contains(s.requiredTag))));
|
||||
(tags == null ? string.IsNullOrEmpty(s.requiredTag) : tags.Contains(s.requiredTag)));
|
||||
|
||||
if (!sounds.Any()) return;
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
<damagesound file="Content/Sounds/Damage/GlassImpact3.ogg" damagerange="10.0,20.0" damagesoundtype="StructureBlunt" requiredtag="glass"/>
|
||||
|
||||
<damagesound file="Content/Sounds/Damage/GlassBreak1.ogg" damagerange="20.0,50.0" damagesoundtype="StructureBlunt" requiredtag="glass"/>
|
||||
<damagesound file="Content/Sounds/Damage/GlassBreak1.ogg" damagerange="25.0,80.0" damagesoundtype="StructureBlunt" requiredtag="glass"/>
|
||||
<damagesound file="Content/Sounds/Damage/GlassBreak1.ogg" damagerange="50.0,100.0" damagesoundtype="StructureBlunt" requiredtag="glass"/>
|
||||
<damagesound file="Content/Sounds/Damage/GlassBreak2.ogg" damagerange="25.0,80.0" damagesoundtype="StructureBlunt" requiredtag="glass"/>
|
||||
<damagesound file="Content/Sounds/Damage/GlassBreak3.ogg" damagerange="50.0,100.0" damagesoundtype="StructureBlunt" requiredtag="glass"/>
|
||||
|
||||
<damagesound file="Content/Sounds/Damage/StructureCrunch1.ogg" damagerange="0.0,40.0" damagesoundtype="StructureSlash"/>
|
||||
<damagesound file="Content/Sounds/Damage/StructureCrunch2.ogg" damagerange="5.0,70.0" damagesoundtype="StructureSlash"/>
|
||||
|
||||
@@ -506,15 +506,15 @@ namespace Barotrauma
|
||||
|
||||
float impact = Vector2.Dot(f2.Body.LinearVelocity, -normal)*f2.Body.Mass*0.1f;
|
||||
|
||||
if (impact < 10.0f) return true;
|
||||
|
||||
#if CLIENT
|
||||
SoundPlayer.PlayDamageSound(DamageSoundType.StructureBlunt, impact,
|
||||
new Vector2(
|
||||
sections[section].rect.X + sections[section].rect.Width / 2,
|
||||
sections[section].rect.Y - sections[section].rect.Height / 2));
|
||||
sections[section].rect.X + sections[section].rect.Width / 2,
|
||||
sections[section].rect.Y - sections[section].rect.Height / 2), tags: Tags);
|
||||
#endif
|
||||
|
||||
if (impact < 10.0f) return true;
|
||||
|
||||
AddDamage(section, impact);
|
||||
}
|
||||
}
|
||||
@@ -661,10 +661,10 @@ namespace Barotrauma
|
||||
#if CLIENT
|
||||
GameMain.ParticleManager.CreateParticle("dustcloud", SectionPosition(i), 0.0f, 0.0f);
|
||||
|
||||
if (playSound && !SectionBodyDisabled(i))
|
||||
if (playSound)// && !SectionBodyDisabled(i))
|
||||
{
|
||||
DamageSoundType damageSoundType = (attack.DamageType == DamageType.Blunt) ? DamageSoundType.StructureBlunt : DamageSoundType.StructureSlash;
|
||||
SoundPlayer.PlayDamageSound(damageSoundType, damageAmount, worldPosition);
|
||||
SoundPlayer.PlayDamageSound(damageSoundType, damageAmount, worldPosition, tags: Tags);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user