mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-14 00:50:38 +00:00
cd_sdl: prev and next commands must handle data tracks properly.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@951 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
75cc453f1a
commit
d6e0a8c020
1 changed files with 12 additions and 3 deletions
|
@ -219,6 +219,15 @@ void CDAudio_Resume(void)
|
||||||
pausetime = -1.0;
|
pausetime = -1.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int get_first_audiotrk (void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < cd_handle->numtracks; ++i)
|
||||||
|
if (cd_handle->track[i].type != SDL_DATA_TRACK)
|
||||||
|
return ++i;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static void CD_f (void)
|
static void CD_f (void)
|
||||||
{
|
{
|
||||||
const char *command;
|
const char *command;
|
||||||
|
@ -357,14 +366,14 @@ static void CD_f (void)
|
||||||
if (q_strcasecmp(command, "next") == 0)
|
if (q_strcasecmp(command, "next") == 0)
|
||||||
{
|
{
|
||||||
if (playTrack == cd_handle->numtracks)
|
if (playTrack == cd_handle->numtracks)
|
||||||
playTrack = 0;
|
playTrack = get_first_audiotrk() - 1;
|
||||||
CDAudio_Play(playTrack + 1, playLooping);
|
CDAudio_Play(playTrack + 1, playLooping);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (q_strcasecmp(command, "prev") == 0)
|
if (q_strcasecmp(command, "prev") == 0)
|
||||||
{
|
{
|
||||||
if (playTrack == 1)
|
if (playTrack == get_first_audiotrk())
|
||||||
playTrack = cd_handle->numtracks + 1;
|
playTrack = cd_handle->numtracks + 1;
|
||||||
CDAudio_Play(playTrack - 1, playLooping);
|
CDAudio_Play(playTrack - 1, playLooping);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue