Listbox: highlight item under the cursor
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / playlist.qc
index 18b4fc3..9730e84 100644 (file)
@@ -4,7 +4,7 @@ CLASS(XonoticPlayList) EXTENDS(XonoticListBox)
        ATTRIB(XonoticPlayList, rowsPerItem, float, 1)
        METHOD(XonoticPlayList, resizeNotify, void(entity, vector, vector, vector, vector))
        METHOD(XonoticPlayList, draw, void(entity))
-       METHOD(XonoticPlayList, drawListBoxItem, void(entity, float, vector, float))
+       METHOD(XonoticPlayList, drawListBoxItem, void(entity, int, vector, bool, float))
        METHOD(XonoticPlayList, stopSound, void(entity))
        METHOD(XonoticPlayList, startSound, void(entity, float))
        METHOD(XonoticPlayList, resumeSound, void(entity))
@@ -88,7 +88,7 @@ void XonoticPlayList_addToPlayList(entity me, string track)
 
 void XonoticPlayList_removeSelectedFromPlayList(entity me)
 {
-       float i, cpt = FALSE;
+       float i, cpt = false;
        string s = "";
        me.nItems = tokenize_console(cvar_string("music_playlist_list0"));
        if(me.nItems == 0)
@@ -102,7 +102,7 @@ void XonoticPlayList_removeSelectedFromPlayList(entity me)
                        if(cvar("music_playlist_index") == 0 || cvar("music_playlist_index") == 999)
                        {
                                if(cvar("music_playlist_current0") == i)
-                                       cpt = TRUE; // current playing track (we can't start next track here because startSound calls tokenize_console)
+                                       cpt = true; // current playing track (we can't start next track here because startSound calls tokenize_console)
                                else if(cvar("music_playlist_current0") > i)
                                        cvar_set("music_playlist_current0", ftos(cvar("music_playlist_current0") - 1));
                        }
@@ -170,11 +170,13 @@ void XonoticPlayList_draw(entity me)
        SUPER(XonoticPlayList).draw(me);
 }
 
-void XonoticPlayList_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticPlayList_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, float highlightedTime)
 {
        string s;
        if(isSelected)
                draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, SKINALPHA_LISTBOX_SELECTED);
+       else if(highlightedTime)
+               draw_Fill('0 0 0', '1 1 0', SKINCOLOR_LISTBOX_SELECTED, getHighlightAlpha(SKINALPHA_LISTBOX_SELECTED * 0.1, highlightedTime));
 
        if(i == me.playingTrack)
        {