]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Pause/play, Prev and Next shouldn't work if the playlist isn't playing
authorterencehill <piuntn@gmail.com>
Sun, 4 Aug 2013 11:58:45 +0000 (13:58 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 4 Aug 2013 11:58:45 +0000 (13:58 +0200)
qcsrc/menu/xonotic/playlist.c

index 0c39491859e8cd20d4990a2f4ebbd5e5a8e3b79d..d9ca2f7df4160b3f0e29c4b77504566b0aa01083 100644 (file)
@@ -173,7 +173,7 @@ void XonoticPlayList_stopSound(entity me)
 {
        // STOP: list 0 is disabled by setting the index to -1
        // we set sampleposition0 to -1 to indicate that music is stopped
-       if(cvar("music_playlist_index") != -1) // == 0 doesn't work when paused
+       if(cvar("music_playlist_index") == 0 || cvar("music_playlist_index") == 999)
        {
                cvar_set("music_playlist_index", "-1");
                localcmd("\nwait; music_playlist_sampleposition0 -1\n");
@@ -192,6 +192,8 @@ void XonoticPlayList_startSound(entity me, float offset)
        me.nItems = tokenize_console(cvar_string("music_playlist_list0"));
        if(offset)
        {
+               if(cvar("music_playlist_index") == -1)
+                       return;
                f = bound(0, cvar("music_playlist_current0") + offset, me.nItems - 1);
                if(f == cvar("music_playlist_current0"))
                        return;
@@ -232,7 +234,7 @@ void XonoticPlayList_pauseSound(entity me)
        // (we reset sampleposition0 to 0 to mark the track as in playing back state)
        if(cvar("music_playlist_index") == 0)
                localcmd("\nmusic_playlist_index 999\n");
-       else
+       else if(cvar("music_playlist_index") == 999)
                localcmd("\nmusic_playlist_index 0; wait; music_playlist_sampleposition0 0\n");
 }