From b94b79f8e2a5778480c34f43110678fd023a3ffb Mon Sep 17 00:00:00 2001 From: qndel Date: Mon, 13 May 2019 00:57:15 +0200 Subject: [PATCH] RndSFX bin exact --- Source/effects.cpp | 57 +++++++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/Source/effects.cpp b/Source/effects.cpp index 914e4048a..acbb47af2 100644 --- a/Source/effects.cpp +++ b/Source/effects.cpp @@ -1070,34 +1070,35 @@ void stream_play(TSFX *pSFX, int lVolume, int lPan) int RndSFX(int psfx) { - int v1; // esi - int v3; // [esp-4h] [ebp-8h] - - v1 = psfx; - switch (psfx) { - case PS_WARR69: - goto LABEL_12; - case PS_WARR14: - case PS_WARR15: - case PS_WARR16: - goto LABEL_19; - case PS_MAGE69: - case PS_ROGUE69: - case PS_SWING: - case LS_ACID: - case IS_FMAG: - case IS_MAGIC: - case IS_BHIT: - LABEL_12: - v3 = 2; - LABEL_15: - return v1 + random(165, v3); - case PS_WARR2: - LABEL_19: - v3 = 3; - goto LABEL_15; - } - return psfx; + int nRand; + + if (psfx == PS_WARR69) + nRand = 2; + else if (psfx == PS_WARR14) + nRand = 3; + else if (psfx == PS_WARR15) + nRand = 3; + else if (psfx == PS_WARR16) + nRand = 3; + else if (psfx == PS_MAGE69) + nRand = 2; + else if (psfx == PS_ROGUE69) + nRand = 2; + else if (psfx == PS_SWING) + nRand = 2; + else if (psfx == LS_ACID) + nRand = 2; + else if (psfx == IS_FMAG) + nRand = 2; + else if (psfx == IS_MAGIC) + nRand = 2; + else if (psfx == IS_BHIT) + nRand = 2; + else if (psfx == PS_WARR2) + nRand = 3; + else + return psfx; + return psfx + random(165, nRand); } void PlaySfxLoc(int psfx, int x, int y)