mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-18 10:02:12 +00:00
Fix shuffle playback and it's menu integration.
This commit is contained in:
parent
2406597356
commit
4a602227d1
3 changed files with 27 additions and 27 deletions
|
@ -1199,29 +1199,22 @@ CDShuffleFunc(void *unused)
|
||||||
Cvar_SetValue("cd_shuffle", s_options_cdshuffle_box.curvalue);
|
Cvar_SetValue("cd_shuffle", s_options_cdshuffle_box.curvalue);
|
||||||
|
|
||||||
#ifdef OGG
|
#ifdef OGG
|
||||||
cvar_t *ogg;
|
cvar_t *ogg_enable= Cvar_Get("ogg_enable", "1", CVAR_ARCHIVE);
|
||||||
ogg = Cvar_Get("ogg_enable", "1", CVAR_ARCHIVE);
|
int track = (int)strtol(cl.configstrings[CS_CDTRACK], (char **)NULL, 10);
|
||||||
|
|
||||||
if (s_options_cdshuffle_box.curvalue)
|
if (s_options_cdshuffle_box.curvalue)
|
||||||
{
|
{
|
||||||
Cvar_Set("ogg_sequence", "random");
|
Cvar_Set("cd_shuffle", "1");
|
||||||
|
|
||||||
if (ogg->value)
|
|
||||||
{
|
|
||||||
OGG_PlayTrack(-1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Cvar_Set("ogg_sequence", "loop");
|
Cvar_Set("cd_shuffle", "0");
|
||||||
|
|
||||||
if (ogg->value)
|
|
||||||
{
|
|
||||||
int track = (int)strtol(cl.configstrings[CS_CDTRACK], (char **)NULL, 10);
|
|
||||||
OGG_PlayTrack(track);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ogg_enable->value)
|
||||||
|
{
|
||||||
|
OGG_PlayTrack(track);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1249,6 +1242,7 @@ EnableOGGMusic(void *unused)
|
||||||
CDAudio_Stop();
|
CDAudio_Stop();
|
||||||
#endif
|
#endif
|
||||||
OGG_Init();
|
OGG_Init();
|
||||||
|
OGG_InitTrackList();
|
||||||
OGG_Stop();
|
OGG_Stop();
|
||||||
|
|
||||||
int track = (int)strtol(cl.configstrings[CS_CDTRACK], (char **)NULL, 10);
|
int track = (int)strtol(cl.configstrings[CS_CDTRACK], (char **)NULL, 10);
|
||||||
|
|
|
@ -39,6 +39,7 @@ typedef enum
|
||||||
STOP
|
STOP
|
||||||
} ogg_status_t;
|
} ogg_status_t;
|
||||||
|
|
||||||
|
void OGG_InitTrackList(void);
|
||||||
void OGG_Init(void);
|
void OGG_Init(void);
|
||||||
void OGG_PlayTrack(int track);
|
void OGG_PlayTrack(int track);
|
||||||
void OGG_Read(void);
|
void OGG_Read(void);
|
||||||
|
|
|
@ -41,16 +41,17 @@
|
||||||
#include "header/local.h"
|
#include "header/local.h"
|
||||||
#include "header/vorbis.h"
|
#include "header/vorbis.h"
|
||||||
|
|
||||||
static char ovBuf[4096]; /* Buffer for sound. */
|
static char ovBuf[4096]; /* Buffer for sound. */
|
||||||
static cvar_t *ogg_ignoretrack0; /* Toggle track 0 playing */
|
static cvar_t *cd_shuffle; /* Shuffle playback */
|
||||||
static cvar_t *ogg_volume; /* Music volume. */
|
static cvar_t *ogg_ignoretrack0; /* Toggle track 0 playing */
|
||||||
static int ogg_curfile; /* Index of currently played file. */
|
static cvar_t *ogg_volume; /* Music volume. */
|
||||||
static int ogg_numbufs; /* Number of buffers for OpenAL */
|
static int ogg_curfile; /* Index of currently played file. */
|
||||||
static int ovSection; /* Position in Ogg Vorbis file. */
|
static int ogg_numbufs; /* Number of buffers for OpenAL */
|
||||||
static ogg_status_t ogg_status; /* Status indicator. */
|
static int ovSection; /* Position in Ogg Vorbis file. */
|
||||||
static OggVorbis_File ovFile; /* Ogg Vorbis file. */
|
static ogg_status_t ogg_status; /* Status indicator. */
|
||||||
static qboolean ogg_started = false; /* Initialization flag. */
|
static OggVorbis_File ovFile; /* Ogg Vorbis file. */
|
||||||
static vorbis_info *ogg_info; /* Ogg Vorbis file information */
|
static qboolean ogg_started; /* Initialization flag. */
|
||||||
|
static vorbis_info *ogg_info; /* Ogg Vorbis file information */
|
||||||
|
|
||||||
enum { MAX_NUM_OGGTRACKS = 32 };
|
enum { MAX_NUM_OGGTRACKS = 32 };
|
||||||
static char* oggTracks[MAX_NUM_OGGTRACKS];
|
static char* oggTracks[MAX_NUM_OGGTRACKS];
|
||||||
|
@ -286,6 +287,7 @@ OGG_Stream(void)
|
||||||
void
|
void
|
||||||
OGG_PlayTrack(int trackNo)
|
OGG_PlayTrack(int trackNo)
|
||||||
{
|
{
|
||||||
|
// Track 0 means "stop music".
|
||||||
if(trackNo == 0)
|
if(trackNo == 0)
|
||||||
{
|
{
|
||||||
if(ogg_ignoretrack0->value == 0)
|
if(ogg_ignoretrack0->value == 0)
|
||||||
|
@ -294,7 +296,9 @@ OGG_PlayTrack(int trackNo)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(trackNo == -1) // random track
|
|
||||||
|
// Player has requested shuffle playback.
|
||||||
|
if(cd_shuffle->value)
|
||||||
{
|
{
|
||||||
if(oggMaxFileIndex >= 0)
|
if(oggMaxFileIndex >= 0)
|
||||||
{
|
{
|
||||||
|
@ -546,8 +550,9 @@ OGG_Init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cvars
|
// Cvars
|
||||||
ogg_volume = Cvar_Get("ogg_volume", "0.7", CVAR_ARCHIVE);
|
cd_shuffle = Cvar_Get("cd_shuffle", "0", CVAR_ARCHIVE);
|
||||||
ogg_ignoretrack0 = Cvar_Get("ogg_ignoretrack0", "0", CVAR_ARCHIVE);
|
ogg_ignoretrack0 = Cvar_Get("ogg_ignoretrack0", "0", CVAR_ARCHIVE);
|
||||||
|
ogg_volume = Cvar_Get("ogg_volume", "0.7", CVAR_ARCHIVE);
|
||||||
|
|
||||||
// Commands
|
// Commands
|
||||||
Cmd_AddCommand("ogg", OGG_Cmd);
|
Cmd_AddCommand("ogg", OGG_Cmd);
|
||||||
|
|
Loading…
Reference in a new issue