Skip to content

Commit b398d5c

Browse files
authored
bugfix(audio): Restore retail compatibility after optimization change in AudioManager::addAudioEvent (#2132)
1 parent 8913a77 commit b398d5c

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

Core/GameEngine/Source/Common/Audio/GameAudio.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -443,10 +443,14 @@ AudioHandle AudioManager::addAudioEvent(const AudioEventRTS *eventToAdd)
443443
break;
444444
}
445445

446-
if (!eventToAdd->getUninterruptable()) {
447-
if (!shouldPlayLocally(eventToAdd)) {
448-
return AHSV_NotForLocal;
449-
}
446+
// TheSuperHackers @info Scripted audio events are logical, i.e. synchronized across clients.
447+
// This early return cannot be taken for such audio events as it skips code that changes the logical game seed values.
448+
const Bool logicalAudio = eventToAdd->getIsLogicalAudio();
449+
const Bool notForLocal = !eventToAdd->getUninterruptable() && !shouldPlayLocally(eventToAdd);
450+
451+
if (!logicalAudio && notForLocal)
452+
{
453+
return AHSV_NotForLocal;
450454
}
451455

452456
AudioEventRTS *audioEvent = MSGNEW("AudioEventRTS") AudioEventRTS(*eventToAdd); // poolify
@@ -463,6 +467,12 @@ AudioHandle AudioManager::addAudioEvent(const AudioEventRTS *eventToAdd)
463467
}
464468
}
465469

470+
if (notForLocal)
471+
{
472+
releaseAudioEventRTS(audioEvent);
473+
return AHSV_NotForLocal;
474+
}
475+
466476
// cull muted audio
467477
if (audioEvent->getVolume() < m_audioSettings->m_minVolume) {
468478
#ifdef INTENSIVE_AUDIO_DEBUG

0 commit comments

Comments
 (0)