29 #include "table/strings.h"
91 while (*playlist != 0 && playlist <= last) {
97 for (byte *p = playlist; *p != 0 && p <= last; p++) {
121 int id = k * NUM_SONGS_CLASS + i + 1;
123 _playlists[k + 1][j++] =
id + 1;
126 _playlists[k + 1][j] = 0;
140 static void SkipToPrevSong()
146 if (b[0] == 0)
return;
148 do p++;
while (p[0] != 0);
160 static void SkipToNextSong()
177 static void MusicVolumeChanged(byte new_vol)
182 static void DoPlaySong()
184 char filename[MAX_PATH];
192 static void DoStopMusic()
198 static void SelectSongToPlay()
223 uint32 r = InteractiveRandom();
227 if (*a != 0 && *b != 0) {
236 static void StopMusic()
244 static void PlayPlaylistSong()
282 if (_game_mode != GM_MENU) {
292 static void SelectPlaylist(byte list)
325 if (!gui_scope)
return;
326 for (
int i = 0; i < 6; i++) {
339 for (
int i = 0; i < 6; i++) {
340 SetDParam(0, STR_MUSIC_PLAYLIST_ALL + i);
343 d.width += padding.width;
344 d.height += padding.height;
360 d.width =
max(d.width, d2.width);
361 d.height += d2.height;
363 d.width += padding.width;
364 d.height += padding.height;
469 static const NWidgetPart _nested_music_track_selection_widgets[] = {
505 static WindowDesc _music_track_selection_desc(
509 _nested_music_track_selection_widgets,
lengthof(_nested_music_track_selection_widgets)
512 static void ShowMusicTrackSelection()
514 AllocateWindowDescFront<MusicTrackSelectionWindow>(&_music_track_selection_desc, 0);
518 static const int slider_width = 3;
535 d.width += padding.width;
536 d.height += padding.height;
574 StringID str = STR_MUSIC_TRACK_NONE;
578 str = STR_MUSIC_TRACK_DIGIT;
586 StringID str = STR_MUSIC_TITLE_NONE;
588 str = STR_MUSIC_TITLE_NAME;
598 int x = (volume * (r.right - r.left) / 127);
604 DrawFrameRect(x, r.top, x + slider_width, r.bottom, COLOUR_GREY, FR_NONE);
617 if (!gui_scope)
return;
618 for (
int i = 0; i < 6; i++) {
648 int x = pt.x - this->GetWidget<NWidgetBase>(widget)->pos_x;
654 if (new_vol != *vol) {
674 ShowMusicTrackSelection();
688 static const NWidgetPart _nested_music_window_widgets[] = {
711 NWidget(
WWT_EMPTY, COLOUR_GREY,
WID_M_MUSIC_VOL),
SetMinimalSize(67, 0),
SetMinimalTextLines(1, 0),
SetFill(1, 0),
SetDataTip(0x0, STR_MUSIC_TOOLTIP_DRAG_SLIDERS_TO_SET_MUSIC),
724 NWidget(
WWT_EMPTY, COLOUR_GREY,
WID_M_EFFECT_VOL),
SetMinimalSize(67, 0),
SetMinimalTextLines(1, 0),
SetFill(1, 0),
SetDataTip(0x0, STR_MUSIC_TOOLTIP_DRAG_SLIDERS_TO_SET_MUSIC),
774 _nested_music_window_widgets,
lengthof(_nested_music_window_widgets)
777 void ShowMusicWindow()
780 AllocateWindowDescFront<MusicWindow>(&_music_window_desc, 0);