Skip to content

Commit

Permalink
Fix sounds without an object target being audible in every section
Browse files Browse the repository at this point in the history
  • Loading branch information
Fulgen301 committed Jul 25, 2024
1 parent a3e59ad commit 1eeb7e3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/C4Script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2457,13 +2457,13 @@ static bool FnSound(C4AulContext *cthr, C4String *szSound, bool fGlobal, C4Objec
return true;
// try to play effect
C4SoundSystem::TargetVariant target;
if (fGlobal)
if (pObj)
{
target.emplace<C4Section *>(&cthr->GetSection());
target.emplace<C4Object *>(pObj);
}
else
{
target.emplace<C4Object *>(pObj);
target.emplace<C4Section *>(&cthr->GetSection());
}
if (iLoop >= 0)
StartSoundEffect(FnStringPar(szSound), !!iLoop, iLevel, target, iCustomFalloffDistance);
Expand Down

0 comments on commit 1eeb7e3

Please sign in to comment.