From c2a54acae3665362a8f6b0eafe359c965197381e Mon Sep 17 00:00:00 2001 From: kaysrishaq <62462173+kaysrishaq@users.noreply.github.com> Date: Thu, 14 May 2020 07:17:58 -0400 Subject: [PATCH] Minor reorganization --- src/s_sound.c | 2 +- src/s_sound.h | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/s_sound.c b/src/s_sound.c index 2797ec252..32c4a2fbc 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2206,7 +2206,7 @@ static lumpnum_t S_GetMusicLumpNum(const char *mname) if (PREFAVAILABLE(midipref, mname)) return W_GetNumForName(va(midipref ? "d_%s":"o_%s", mname)); - else if (ELSEAVAILABLE(midipref, mname)) + else if (PREFAVAILABLE(!midipref, mname)) return W_GetNumForName(va(midipref ? "o_%s":"d_%s", mname)); else return LUMPERROR; diff --git a/src/s_sound.h b/src/s_sound.h index 8b5c2aa1a..f2c6f0e62 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -48,14 +48,6 @@ extern consvar_t cv_gamemidimusic; extern consvar_t cv_gamesounds; extern consvar_t cv_musicpref; -#define PREFAVAILABLE(pref, music) (pref ? \ - (!S_MIDIMusicDisabled() && S_MIDIExists(music)) : \ - (!S_DigMusicDisabled() && S_DigExists(music))) - -#define ELSEAVAILABLE(pref, music) (pref ? \ - (!S_DigMusicDisabled() && S_DigExists(music)) : \ - (!S_MIDIMusicDisabled() && S_MIDIExists(music))) - extern consvar_t cv_playmusicifunfocused; extern consvar_t cv_playsoundsifunfocused; @@ -191,6 +183,12 @@ boolean S_MusicExists(const char *mname, boolean checkMIDI, boolean checkDigi); #define S_DigExists(a) S_MusicExists(a, false, true) #define S_MIDIExists(a) S_MusicExists(a, true, false) +// Returns whether the preferred format a (true = MIDI, false = Digital) +// exists and is enabled for musicname b +#define PREFAVAILABLE(a, b) (a ? \ + (!S_MIDIMusicDisabled() && S_MIDIExists(b)) : \ + (!S_DigMusicDisabled() && S_DigExists(b))) + // // Music Effects //