]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Playback again the menu track when the music player is stopped (3 seconds later)
authorterencehill <piuntn@gmail.com>
Mon, 7 May 2012 17:12:01 +0000 (19:12 +0200)
committerterencehill <piuntn@gmail.com>
Mon, 7 May 2012 17:12:01 +0000 (19:12 +0200)
qcsrc/menu/xonotic/soundlist.c

index fea84a7ce1d19c5e269404f45854e5d50092b1ca..784b38c9633633c15cf0844bf53ba803a38af4e6 100644 (file)
@@ -164,10 +164,14 @@ void SoundList_Filter_Change(entity box, entity me)
 
 void XonoticSoundList_stopSound(entity me)
 {
-       // STOP: list 0 is disabled by setting the index to 999
+       // STOP: list 0 is disabled by setting the index to -1
        // we set sampleposition0 to -1 to indicate that music is stopped
-       cvar_set("music_playlist_index", "999");
-       localcmd("\nwait; music_playlist_sampleposition0 -1\n");
+       if(cvar("music_playlist_index") != -1) // == 0 doesn't work when paused
+       {
+               cvar_set("music_playlist_index", "-1");
+               localcmd("\nwait; music_playlist_sampleposition0 -1\n");
+               localcmd("\ndefer 3 \"cd play $menu_cdtrack\"\n");
+       }
 }
 
 void StopSound_Click(entity btn, entity me)