Add a cvar to switch behavior when misc track 0 is requested

OGG_OpenName(): add ogg_ignoretrack0 cvar to set whether we respect
default playback behaviour when track 0 is requested to be played via
standard cd audio playback.

Submitted by: ewe2
This commit is contained in:
Sean Dwyer 2015-10-14 22:03:06 +11:00 committed by Yamagi Burmeister
parent 123e409a2e
commit 159a3b8607

View file

@ -56,6 +56,7 @@ cvar_t *ogg_check; /* Check Ogg files or not. */
cvar_t *ogg_playlist; /* Playlist. */ cvar_t *ogg_playlist; /* Playlist. */
cvar_t *ogg_sequence; /* Sequence play indicator. */ cvar_t *ogg_sequence; /* Sequence play indicator. */
cvar_t *ogg_volume; /* Music volume. */ cvar_t *ogg_volume; /* Music volume. */
cvar_t *ogg_ignoretrack0; /* Toggle track 0 playing */
OggVorbis_File ovFile; /* Ogg Vorbis file. */ OggVorbis_File ovFile; /* Ogg Vorbis file. */
vorbis_info *ogg_info; /* Ogg Vorbis file information */ vorbis_info *ogg_info; /* Ogg Vorbis file information */
int ogg_numbufs; /* Number of buffers for OpenAL */ int ogg_numbufs; /* Number of buffers for OpenAL */
@ -95,6 +96,7 @@ OGG_Init(void)
ogg_playlist = Cvar_Get("ogg_playlist", "playlist", CVAR_ARCHIVE); ogg_playlist = Cvar_Get("ogg_playlist", "playlist", CVAR_ARCHIVE);
ogg_sequence = Cvar_Get("ogg_sequence", "loop", CVAR_ARCHIVE); ogg_sequence = Cvar_Get("ogg_sequence", "loop", CVAR_ARCHIVE);
ogg_volume = Cvar_Get("ogg_volume", "0.7", CVAR_ARCHIVE); ogg_volume = Cvar_Get("ogg_volume", "0.7", CVAR_ARCHIVE);
ogg_ignoretrack0 = Cvar_Get("ogg_ignoretrack0", "0", CVAR_ARCHIVE);
/* Console commands. */ /* Console commands. */
Cmd_AddCommand("ogg_list", OGG_ListCmd); Cmd_AddCommand("ogg_list", OGG_ListCmd);
@ -497,8 +499,8 @@ OGG_OpenName(char *filename)
char *name; /* File name. */ char *name; /* File name. */
int i; /* Loop counter. */ int i; /* Loop counter. */
/* If the track name is '00', stop playback */ /* If the track name is '00', and ogg_ignoretrack0 is set to 0, stop playback */
if (!strncmp(filename, "00", sizeof(char) * 3)) if ((!strncmp(filename, "00", sizeof(char) * 3)) && ogg_ignoretrack0->value == 0)
{ {
OGG_PauseCmd(); OGG_PauseCmd();
return false; return false;