diff --git a/src/s_sound.c b/src/s_sound.c index c565c33e7776a4b23f2d9a3cc66f35649e36016f..47a0e7b10a7ff29b119683bd4b4ec07fc7453e89 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2121,9 +2121,9 @@ static lumpnum_t S_GetMusicLumpNum(const char *mname) boolean midipref = cv_musicpref.value; if (S_PrefAvailable(midipref, mname)) - return W_GetNumForName(va(midipref ? "d_%s":"o_%s", mname)); + return W_GetNumForNameMusic(va(midipref ? "d_%s":"o_%s", mname)); else if (S_PrefAvailable(!midipref, mname)) - return W_GetNumForName(va(midipref ? "o_%s":"d_%s", mname)); + return W_GetNumForNameMusic(va(midipref ? "o_%s":"d_%s", mname)); else return LUMPERROR; } diff --git a/src/w_wad.c b/src/w_wad.c index cb744c8f9eb64a40a297d68efa4f5b758b9328bb..087699fda76864f35fd5fdde2a4969ea15539e69 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1493,6 +1493,24 @@ lumpnum_t W_GetNumForName(const char *name) return i; } +// +// W_GetNumForNameMusic +// +// Calls W_CheckNumForName, but does NOT bomb out if not found. +// Geared towards checking for music files where the lump not +// being found is not a call for a crash. +// +lumpnum_t W_GetNumForNameMusic(const char *name) +{ + lumpnum_t i; + + i = W_CheckNumForName(name); + + return i; +} + + + // // Like W_GetNumForName, but can find entries with long names // diff --git a/src/w_wad.h b/src/w_wad.h index d59e9abdf023feedf80dfba55f4230cf5b41b091..2921a2cab1a27ab2826e924558ab4d1e8990c74c 100644 --- a/src/w_wad.h +++ b/src/w_wad.h @@ -182,6 +182,7 @@ UINT16 W_CheckNumForFolderEndPK3(const char *name, UINT16 wad, UINT16 startlump) lumpnum_t W_CheckNumForMap(const char *name); lumpnum_t W_CheckNumForName(const char *name); +lumpnum_t W_CheckNumForNameMusic(const char *name); lumpnum_t W_CheckNumForLongName(const char *name); lumpnum_t W_GetNumForName(const char *name); // like W_CheckNumForName but I_Error on LUMPERROR lumpnum_t W_GetNumForLongName(const char *name);