Skip to content

Commit a92b1b3

Browse files
committed
Fixed wound sounds blocking each other too much
1 parent 34552e8 commit a92b1b3

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

Source/Entities/AEmitter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,9 @@ void AEmitter::Update() {
397397
float throttleFactor = GetThrottleFactor();
398398
m_FlashScale = throttleFactor;
399399
// Check burst triggering against whether the spacing is fulfilled
400-
if (m_PlayBurstSound && m_BurstTriggered && CanTriggerBurst()) {
400+
if (m_BurstTriggered && CanTriggerBurst()) {
401401
// Play burst sound
402-
if (m_BurstSound) {
402+
if (m_BurstSound && m_PlayBurstSound) {
403403
m_BurstSound->Play(m_Pos);
404404
}
405405
// Start timing until next burst

Source/Entities/MOSRotating.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void MOSRotating::Clear() {
5656
m_RecoilForce.Reset();
5757
m_RecoilOffset.Reset();
5858
m_Wounds.clear();
59-
m_WoundBurstSoundPlayedThisFrame = false;
59+
m_WoundBurstSoundsPlayedThisFrame = {};
6060
m_Attachables.clear();
6161
m_ReferenceHardcodedAttachableUniqueIDs.clear();
6262
m_HardcodedAttachableUniqueIDsAndSetters.clear();
@@ -462,10 +462,14 @@ void MOSRotating::AddWound(AEmitter* woundToAdd, const Vector& parentOffsetToSet
462462
woundToAdd->SetParent(this);
463463
woundToAdd->SetIsWound(true);
464464
if (woundToAdd->GetBurstSound()) {
465-
if (m_WoundBurstSoundPlayedThisFrame) {
466-
woundToAdd->SetPlayBurstSound(false);
465+
std::string burstSound = woundToAdd->GetBurstSound()->GetPresetName();
466+
for (int i = 0; i < m_WoundBurstSoundsPlayedThisFrame.size(); i++) {
467+
if (burstSound == m_WoundBurstSoundsPlayedThisFrame[i]) {
468+
woundToAdd->SetPlayBurstSound(false);
469+
break;
470+
}
467471
}
468-
m_WoundBurstSoundPlayedThisFrame = true;
472+
m_WoundBurstSoundsPlayedThisFrame.push_back(burstSound);
469473
}
470474
if (woundToAdd->HasNoSetDamageMultiplier()) {
471475
woundToAdd->SetDamageMultiplier(1.0F);
@@ -1366,7 +1370,7 @@ void MOSRotating::Update() {
13661370
m_Rotation += radsToGo * m_OrientToVel * velInfluence;
13671371
}
13681372

1369-
m_WoundBurstSoundPlayedThisFrame = false;
1373+
m_WoundBurstSoundsPlayedThisFrame = {};
13701374

13711375
for (auto woundItr = m_Wounds.begin(); woundItr != m_Wounds.end();) {
13721376
AEmitter* wound = *woundItr;

Source/Entities/MOSRotating.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ namespace RTE {
541541
// The list of wound AEmitters currently attached to this MOSRotating, and owned here as well.
542542
std::vector<AEmitter*> m_Wounds;
543543
// Whether we added a wound with a BurstSound this frame or not, so we can disable further ones to avoid audio spam.
544-
bool m_WoundBurstSoundPlayedThisFrame;
544+
std::vector<std::string> m_WoundBurstSoundsPlayedThisFrame;
545545
// The list of Attachables currently attached and Owned by this.
546546
std::list<Attachable*> m_Attachables;
547547
std::unordered_set<unsigned long> m_ReferenceHardcodedAttachableUniqueIDs; //!< An unordered set is filled with the Unique IDs of all of the reference object's hardcoded Attachables when using the copy Create.

0 commit comments

Comments
 (0)