From: terencehill Date: Sun, 4 Aug 2013 11:58:45 +0000 (+0200) Subject: Pause/play, Prev and Next shouldn't work if the playlist isn't playing X-Git-Tag: xonotic-v0.8.1~157^2~12 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=42e5c295f983ba7d08a158cfe28515bba78c99c9;p=xonotic%2Fxonotic-data.pk3dir.git Pause/play, Prev and Next shouldn't work if the playlist isn't playing --- diff --git a/qcsrc/menu/xonotic/playlist.c b/qcsrc/menu/xonotic/playlist.c index 0c3949185..d9ca2f7df 100644 --- a/qcsrc/menu/xonotic/playlist.c +++ b/qcsrc/menu/xonotic/playlist.c @@ -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"); }