Add snd_tryformats cvar to disable automatic loading of .ogg and .flac versions of sound and music

git-svn-id: https://svn.eduke32.com/eduke32@8212 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-10-19 23:47:12 +00:00 committed by Christoph Oelckers
parent 873440f06c
commit c68c50ddca
3 changed files with 9 additions and 8 deletions

View file

@ -1060,26 +1060,26 @@ void G_LoadLookups(void)
////////// //////////
#ifdef FORMAT_UPGRADE_ELIGIBLE #ifdef FORMAT_UPGRADE_ELIGIBLE
int g_maybeUpgradeSoundFormats = 1;
static buildvfs_kfd S_TryFormats(char * const testfn, char * const fn_suffix, char const searchfirst) static buildvfs_kfd S_TryFormats(char * const testfn, char * const fn_suffix, char const searchfirst)
{ {
#ifdef HAVE_FLAC if (g_maybeUpgradeSoundFormats)
{ {
#ifdef HAVE_FLAC
Bstrcpy(fn_suffix, ".flac"); Bstrcpy(fn_suffix, ".flac");
buildvfs_kfd const fp = kopen4loadfrommod(testfn, searchfirst); buildvfs_kfd const ffp = kopen4loadfrommod(testfn, searchfirst);
if (fp != buildvfs_kfd_invalid) if (ffp != buildvfs_kfd_invalid)
return fp; return ffp;
}
#endif #endif
#ifdef HAVE_VORBIS #ifdef HAVE_VORBIS
{
Bstrcpy(fn_suffix, ".ogg"); Bstrcpy(fn_suffix, ".ogg");
buildvfs_kfd const fp = kopen4loadfrommod(testfn, searchfirst); buildvfs_kfd const fp = kopen4loadfrommod(testfn, searchfirst);
if (fp != buildvfs_kfd_invalid) if (fp != buildvfs_kfd_invalid)
return fp; return fp;
}
#endif #endif
}
return buildvfs_kfd_invalid; return buildvfs_kfd_invalid;
} }

View file

@ -142,6 +142,7 @@ extern void G_LoadLookups(void);
#if defined HAVE_FLAC || defined HAVE_VORBIS #if defined HAVE_FLAC || defined HAVE_VORBIS
# define FORMAT_UPGRADE_ELIGIBLE # define FORMAT_UPGRADE_ELIGIBLE
extern int g_maybeUpgradeSoundFormats;
extern buildvfs_kfd S_OpenAudio(const char *fn, char searchfirst, uint8_t ismusic); extern buildvfs_kfd S_OpenAudio(const char *fn, char searchfirst, uint8_t ismusic);
#else #else
# define S_OpenAudio(fn, searchfirst, ismusic) kopen4loadfrommod(fn, searchfirst) # define S_OpenAudio(fn, searchfirst, ismusic) kopen4loadfrommod(fn, searchfirst)

View file

@ -1696,7 +1696,7 @@ int32_t registerosdcommands(void)
{ "snd_numvoices", "the number of concurrent sounds", (void *)&ud.config.NumVoices, CVAR_INT, 1, 128 }, { "snd_numvoices", "the number of concurrent sounds", (void *)&ud.config.NumVoices, CVAR_INT, 1, 128 },
{ "snd_reversestereo", "reverses the stereo channels", (void *)&ud.config.ReverseStereo, CVAR_BOOL, 0, 1 }, { "snd_reversestereo", "reverses the stereo channels", (void *)&ud.config.ReverseStereo, CVAR_BOOL, 0, 1 },
{ "snd_speech", "enables/disables player speech", (void *)&ud.config.VoiceToggle, CVAR_INT, 0, 5 }, { "snd_speech", "enables/disables player speech", (void *)&ud.config.VoiceToggle, CVAR_INT, 0, 5 },
{ "snd_tryformats", "enables/disables automatic discovery of replacement sounds and music in .flac and .ogg formats", (void *)&g_maybeUpgradeSoundFormats, CVAR_BOOL, 0, 1 },
{ "team","change team in multiplayer", (void *)&ud.team, CVAR_INT|CVAR_MULTI, 0, 3 }, { "team","change team in multiplayer", (void *)&ud.team, CVAR_INT|CVAR_MULTI, 0, 3 },
#ifdef EDUKE32_TOUCH_DEVICES #ifdef EDUKE32_TOUCH_DEVICES