METHOD(XonoticPlayList, drawListBoxItem, void(entity, float, vector, float))
METHOD(XonoticPlayList, stopSound, void(entity))
METHOD(XonoticPlayList, startSound, void(entity, float))
+ METHOD(XonoticPlayList, resumeSound, void(entity))
METHOD(XonoticPlayList, pauseSound, void(entity))
- METHOD(XonoticPlayList, clickListBoxItem, void(entity, float, vector))
+ METHOD(XonoticPlayList, doubleClickListBoxItem, void(entity, float, vector))
METHOD(XonoticPlayList, keyDown, float(entity, float, float, float))
METHOD(XonoticPlayList, mouseDrag, float(entity, vector))
ATTRIB(XonoticPlayList, realUpperMargin, float, 0)
ATTRIB(XonoticPlayList, origin, vector, '0 0 0')
ATTRIB(XonoticPlayList, itemAbsSize, vector, '0 0 0')
-
- ATTRIB(XonoticPlayList, lastClickedSound, float, -1)
- ATTRIB(XonoticPlayList, lastClickedTime, float, 0)
ENDCLASS(XonoticPlayList)
entity makeXonoticPlayList();
{
float f = cvar("music_playlist_sampleposition0");
if(f <= 0 || (((time * 2) & 1) && f > 0))
- draw_Text(me.realUpperMargin * eY + (me.columnNumberOrigin + me.columnNumberSize) * eX, chr(0xE000 + 141), me.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
+ draw_Text(me.realUpperMargin * eY + (me.columnNumberOrigin + me.columnNumberSize) * eX, "\xE2\x96\xB6", me.realFontSize, '1 1 1', SKINALPHA_TEXT, 0);
}
s = ftos(i+1);
return;
}
else
+ {
f = me.selectedItem;
+ // if it was paused then resume
+ if(f == cvar("music_playlist_current0"))
+ if(cvar("music_playlist_index") == 999)
+ {
+ me.resumeSound(me);
+ return;
+ }
+ // if it was not paused then proceed with restart
+ }
+
// START: list 0 is disabled by setting the index to 999
// we set current0 to the selected track and sampleposition0 to 0 to forget the position that the engine saves in this frame (for this reason we need to wait a frame)
// then we switch back to list 0
me.startSound(me, +1);
}
+void XonoticPlayList_resumeSound(entity me)
+{
+ // RESUME: list 0 is enabled by setting the index to 0
+ // (we reset sampleposition0 to 0 to mark the track as in playing back state)
+ if(cvar("music_playlist_index") == 999)
+ localcmd("\nmusic_playlist_index 0; wait; music_playlist_sampleposition0 0\n");
+}
void XonoticPlayList_pauseSound(entity me)
{
// PAUSE: list 0 is disabled by setting the index to 999
// (we know the track is paused because the engine sets sampleposition0 to remember current position)
- // RESUME: list 0 is enabled by setting the index to 0
- // (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 if(cvar("music_playlist_index") == 999)
- localcmd("\nmusic_playlist_index 0; wait; music_playlist_sampleposition0 0\n");
+ else me.resumeSound(me);
}
void PauseSound_Click(entity btn, entity me)
me.pauseSound(me);
}
-void XonoticPlayList_clickListBoxItem(entity me, float i, vector where)
+void XonoticPlayList_doubleClickListBoxItem(entity me, float i, vector where)
{
- if(i == me.lastClickedSound)
- if(time < me.lastClickedTime + 0.3)
- {
- // DOUBLE CLICK!
- me.setSelected(me, i);
- me.startSound(me, 0);
- }
- me.lastClickedSound = i;
- me.lastClickedTime = time;
+ me.startSound(me, 0);
}
float XonoticPlayList_keyDown(entity me, float scan, float ascii, float shift)