From 379b7c92be6d3b0b40a1b5f4527b94c8b497606e Mon Sep 17 00:00:00 2001 From: Juliano Goncalves Date: Thu, 1 Oct 2020 21:52:09 -0300 Subject: [PATCH] :sparkles: Allow playing specific sounds with 'PlaySfx' --- Source/effects.cpp | 7 +++++-- Source/effects.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Source/effects.cpp b/Source/effects.cpp index 36f7fee0a..904675ae3 100644 --- a/Source/effects.cpp +++ b/Source/effects.cpp @@ -1277,9 +1277,12 @@ static int RndSFX(int psfx) return psfx + random_(165, nRand); } -void PlaySFX(int psfx) +void PlaySFX(int psfx, bool randomizeByCategory) { - psfx = RndSFX(psfx); + if (randomizeByCategory) { + psfx = RndSFX(psfx); + } + PlaySFX_priv(&sgSFX[psfx], FALSE, 0, 0); } diff --git a/Source/effects.h b/Source/effects.h index 0d9e05111..fe630d3b4 100644 --- a/Source/effects.h +++ b/Source/effects.h @@ -21,7 +21,7 @@ void InitMonsterSND(int monst); void FreeMonsterSnd(); BOOL calc_snd_position(int x, int y, int *plVolume, int *plPan); void PlayEffect(int i, int mode); -void PlaySFX(int psfx); +void PlaySFX(int psfx, bool randomizeByCategory = true); void PlaySfxLoc(int psfx, int x, int y); void sound_stop(); void sound_update();