music_gui.c
author belugas
Tue, 03 Oct 2006 02:08:15 +0000
changeset 4709 eff35edfb653
parent 4634 897461a3e9ca
child 4719 413b21513ef7
permissions -rw-r--r--
(svn r6619) -Codechange: Use accessors for disabled_state.
Another step toward merging XTDwidget.
The only two files not converted (window.h and widget.c) will be done at the very last commit)
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     2
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     3
#include "stdafx.h"
1891
92a3b0aa0946 (svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents: 1884
diff changeset
     4
#include "openttd.h"
507
8aa8100b0b22 (svn r815) Include strings.h only in the files which need it.
tron
parents: 341
diff changeset
     5
#include "table/strings.h"
2163
637ec3c361f5 (svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents: 2159
diff changeset
     6
#include "functions.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
#include "window.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     8
#include "gfx.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     9
#include "sound.h"
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    10
#include "hal.h"
2159
3b634157c3b2 (svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents: 2155
diff changeset
    11
#include "macros.h"
3b634157c3b2 (svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents: 2155
diff changeset
    12
#include "variables.h"
4120
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
    13
#include "music.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    14
2155
aa88ed6fe2e3 (svn r2665) Move some variables, which are only used by music_gui.c, there
tron
parents: 2140
diff changeset
    15
static byte _music_wnd_cursong;
aa88ed6fe2e3 (svn r2665) Move some variables, which are only used by music_gui.c, there
tron
parents: 2140
diff changeset
    16
static bool _song_is_active;
4120
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
    17
static byte _cur_playlist[NUM_SONGS_PLAYLIST];
2155
aa88ed6fe2e3 (svn r2665) Move some variables, which are only used by music_gui.c, there
tron
parents: 2140
diff changeset
    18
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    19
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    20
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    21
static byte _playlist_all[] = {
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
    22
	1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 0
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    23
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    24
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    25
static byte _playlist_old_style[] = {
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
    26
	1, 8, 2, 9, 14, 15, 19, 13, 0
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    27
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    28
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    29
static byte _playlist_new_style[] = {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    30
	6, 11, 10, 17, 21, 18, 5, 0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    31
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    32
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    33
static byte _playlist_ezy_street[] = {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    34
	12, 7, 16, 3, 20, 4, 0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    35
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    36
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    37
static byte * const _playlists[] = {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    38
	_playlist_all,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    39
	_playlist_old_style,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    40
	_playlist_new_style,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    41
	_playlist_ezy_street,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    42
	msf.custom_1,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    43
	msf.custom_2,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    44
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    45
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 867
diff changeset
    46
static void SkipToPrevSong(void)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    47
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    48
	byte *b = _cur_playlist;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    49
	byte *p = b;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    50
	byte t;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    51
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    52
	// empty playlist
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
    53
	if (b[0] == 0) return;
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 176
diff changeset
    54
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    55
	// find the end
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    56
	do p++; while (p[0] != 0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    57
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    58
	// and copy the bytes
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    59
	t = *--p;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    60
	while (p != b) {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    61
		p--;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    62
		p[1] = p[0];
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    63
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    64
	*b = t;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    65
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    66
	_song_is_active = false;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    67
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    68
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 867
diff changeset
    69
static void SkipToNextSong(void)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    70
{
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
    71
	byte* b = _cur_playlist;
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
    72
	byte t;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    73
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
    74
	t = b[0];
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
    75
	if (t != 0) {
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
    76
		while (b[1] != 0) {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    77
			b[0] = b[1];
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    78
			b++;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    79
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    80
		b[0] = t;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    81
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    82
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    83
	_song_is_active = false;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    84
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    85
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    86
static void MusicVolumeChanged(byte new_vol)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    87
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    88
	_music_driver->set_volume(new_vol);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    89
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    90
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 867
diff changeset
    91
static void DoPlaySong(void)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    92
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    93
	char filename[256];
4120
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
    94
	snprintf(filename, sizeof(filename), "%s%s",
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
    95
		_path.gm_dir, origin_songs_specs[_music_wnd_cursong - 1].filename);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    96
	_music_driver->play_song(filename);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    97
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    98
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 867
diff changeset
    99
static void DoStopMusic(void)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   100
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   101
	_music_driver->stop_song();
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   102
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   103
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 867
diff changeset
   104
static void SelectSongToPlay(void)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   105
{
2247
fe3f618ebcae (svn r2767) -Fix: fixed potential mem-leak
truelight
parents: 2186
diff changeset
   106
	uint i = 0;
4120
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   107
	uint j = 0;
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   108
	char filename[256];
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   109
2247
fe3f618ebcae (svn r2767) -Fix: fixed potential mem-leak
truelight
parents: 2186
diff changeset
   110
	memset(_cur_playlist, 0, sizeof(_cur_playlist));
1884
ae1d6213c6dd (svn r2390) - Codechange: Fix some warnings on GCC 4.0.0
hackykid
parents: 1724
diff changeset
   111
	do {
4120
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   112
		snprintf(filename, sizeof(filename),  "%s%s",
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   113
		_path.gm_dir, origin_songs_specs[_playlists[msf.playlist][i]].filename);
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   114
		//we are now checking for the existence of that file prior
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   115
		//to add it to the list of available songs
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   116
		if (FileExists(filename)) {
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   117
			_cur_playlist[j] = _playlists[msf.playlist][i];
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   118
			j++;
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   119
		}
2247
fe3f618ebcae (svn r2767) -Fix: fixed potential mem-leak
truelight
parents: 2186
diff changeset
   120
	} while (_playlists[msf.playlist][i++] != 0 && i < lengthof(_cur_playlist) - 1);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   121
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   122
	if (msf.shuffle) {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   123
		i = 500;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   124
		do {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   125
			uint32 r = InteractiveRandom();
2140
d708eb80ab8b (svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
tron
parents: 2133
diff changeset
   126
			byte *a = &_cur_playlist[GB(r, 0, 5)];
d708eb80ab8b (svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
tron
parents: 2133
diff changeset
   127
			byte *b = &_cur_playlist[GB(r, 8, 5)];
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   128
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   129
			if (*a != 0 && *b != 0) {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   130
				byte t = *a;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   131
				*a = *b;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   132
				*b = t;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   133
			}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   134
		} while (--i);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   135
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   136
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   137
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 867
diff changeset
   138
static void StopMusic(void)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   139
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   140
	_music_wnd_cursong = 0;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   141
	DoStopMusic();
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   142
	_song_is_active = false;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   143
	InvalidateWindowWidget(WC_MUSIC_WINDOW, 0, 9);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   144
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   145
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 867
diff changeset
   146
static void PlayPlaylistSong(void)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   147
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   148
	if (_cur_playlist[0] == 0) {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   149
		SelectSongToPlay();
4120
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   150
		//if there is not songs in the playlist, it may indicate
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   151
		//no file on the gm folder, or even no gm folder.
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   152
		//Stop the playback, then
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   153
		if (_cur_playlist[0] == 0) {
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   154
			_song_is_active = false;
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   155
			_music_wnd_cursong = 0;
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   156
			msf.playing = false;
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   157
			return;
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   158
		}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   159
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   160
	_music_wnd_cursong = _cur_playlist[0];
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   161
	DoPlaySong();
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   162
	_song_is_active = true;
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 176
diff changeset
   163
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   164
	InvalidateWindowWidget(WC_MUSIC_WINDOW, 0, 9);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   165
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   166
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 867
diff changeset
   167
void ResetMusic(void)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   168
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   169
	_music_wnd_cursong = 1;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   170
	DoPlaySong();
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   171
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   172
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 867
diff changeset
   173
void MusicLoop(void)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   174
{
3052
95e4eaf303d5 (svn r3641) - Rename MusicFilesettings 'btn_down' to more sensible 'playing'
Darkvater
parents: 2952
diff changeset
   175
	if (!msf.playing && _song_is_active) {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   176
		StopMusic();
3052
95e4eaf303d5 (svn r3641) - Rename MusicFilesettings 'btn_down' to more sensible 'playing'
Darkvater
parents: 2952
diff changeset
   177
	} else if (msf.playing && !_song_is_active) {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   178
		PlayPlaylistSong();
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   179
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   180
4120
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   181
	if (!_song_is_active) return;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   182
1724
f2df13e9b628 (svn r2228) - Fix: [ 1188986 ] Song in main menu screen should loop when it ends.
Darkvater
parents: 1608
diff changeset
   183
	if (!_music_driver->is_song_playing()) {
f2df13e9b628 (svn r2228) - Fix: [ 1188986 ] Song in main menu screen should loop when it ends.
Darkvater
parents: 1608
diff changeset
   184
		if (_game_mode != GM_MENU) {
f2df13e9b628 (svn r2228) - Fix: [ 1188986 ] Song in main menu screen should loop when it ends.
Darkvater
parents: 1608
diff changeset
   185
			StopMusic();
f2df13e9b628 (svn r2228) - Fix: [ 1188986 ] Song in main menu screen should loop when it ends.
Darkvater
parents: 1608
diff changeset
   186
			SkipToNextSong();
f2df13e9b628 (svn r2228) - Fix: [ 1188986 ] Song in main menu screen should loop when it ends.
Darkvater
parents: 1608
diff changeset
   187
			PlayPlaylistSong();
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
   188
		} else {
1724
f2df13e9b628 (svn r2228) - Fix: [ 1188986 ] Song in main menu screen should loop when it ends.
Darkvater
parents: 1608
diff changeset
   189
			ResetMusic();
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
   190
		}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   191
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   192
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   193
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   194
static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   195
{
2952
6a26eeda9679 (svn r3511) More whitespace ([FS#46] by Rubidium)
tron
parents: 2791
diff changeset
   196
	switch (e->event) {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   197
	case WE_PAINT: {
2630
35249d2ded3e (svn r3172) static, const
tron
parents: 2247
diff changeset
   198
		const byte* p;
2133
098c9da8292e (svn r2643) Get rid of some unnecessary casts
tron
parents: 1938
diff changeset
   199
		uint i;
098c9da8292e (svn r2643) Get rid of some unnecessary casts
tron
parents: 1938
diff changeset
   200
		int y;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   201
4709
eff35edfb653 (svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents: 4634
diff changeset
   202
		SetWindowWidgetDisabledState(w, 11, msf.playlist <= 3);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   203
		w->click_state |= 0x18;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   204
		DrawWindowWidgets(w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   205
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   206
		GfxFillRect(3, 23, 3+177,23+191,0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   207
		GfxFillRect(251, 23, 251+177,23+191,0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   208
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   209
		DrawStringCentered(92, 15, STR_01EE_TRACK_INDEX, 0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   210
534
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   211
		SetDParam(0, STR_01D5_ALL + msf.playlist);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   212
		DrawStringCentered(340, 15, STR_01EF_PROGRAM, 0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   213
2133
098c9da8292e (svn r2643) Get rid of some unnecessary casts
tron
parents: 1938
diff changeset
   214
		for (i = 1; i <= NUM_SONGS_AVAILABLE; i++) {
534
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   215
			SetDParam(0, i);
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   216
			SetDParam(2, i);
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   217
			SetDParam(1, SPECSTR_SONGNAME);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   218
			DrawString(4, 23+(i-1)*6, (i < 10) ? STR_01EC_0 : STR_01ED, 0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   219
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   220
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
   221
		for (i = 0; i != 6; i++) {
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
   222
			DrawStringCentered(216, 45 + i * 8, STR_01D5_ALL + i, (i == msf.playlist) ? 0xC : 0x10);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   223
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   224
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 176
diff changeset
   225
		DrawStringCentered(216, 45+8*6+16, STR_01F0_CLEAR, 0);
4468
fb18502e2c12 (svn r6253) Comment out code with #if 0, not //. Join statements which needlessly span many lines into fewer lines
tron
parents: 4432
diff changeset
   226
#if 0
fb18502e2c12 (svn r6253) Comment out code with #if 0, not //. Join statements which needlessly span many lines into fewer lines
tron
parents: 4432
diff changeset
   227
		DrawStringCentered(216, 45 + 8 * 6 + 16 * 2, STR_01F1_SAVE, 0);
fb18502e2c12 (svn r6253) Comment out code with #if 0, not //. Join statements which needlessly span many lines into fewer lines
tron
parents: 4432
diff changeset
   228
#endif
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   229
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   230
		y = 23;
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
   231
		for (p = _playlists[msf.playlist], i = 0; (i = *p) != 0; p++) {
534
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   232
			SetDParam(0, i);
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
   233
			SetDParam(1, SPECSTR_SONGNAME);
534
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   234
			SetDParam(2, i);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   235
			DrawString(252, y, (i < 10) ? STR_01EC_0 : STR_01ED, 0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   236
			y += 6;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   237
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   238
		break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   239
	}
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 176
diff changeset
   240
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   241
	case WE_CLICK:
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4468
diff changeset
   242
		switch (e->we.click.widget) {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   243
		case 3: { /* add to playlist */
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4468
diff changeset
   244
			int y = (e->we.click.pt.y - 23) / 6;
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
   245
			uint i;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   246
			byte *p;
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
   247
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   248
			if (msf.playlist < 4) return;
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
   249
			if (!IS_INT_INSIDE(y, 0, NUM_SONGS_AVAILABLE)) return;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   250
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   251
			p = _playlists[msf.playlist];
4120
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   252
			for (i = 0; i != NUM_SONGS_PLAYLIST - 1; i++) {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   253
				if (p[i] == 0) {
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
   254
					p[i] = y + 1;
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
   255
					p[i + 1] = 0;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   256
					SetWindowDirty(w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   257
					SelectSongToPlay();
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   258
					break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   259
				}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   260
			}
4120
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   261
		} break;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   262
4120
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   263
		case 4: { /* remove from playlist */
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4468
diff changeset
   264
			int y = (e->we.click.pt.y - 23) / 6;
4120
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   265
			uint i;
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   266
			byte *p;
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   267
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   268
			if (msf.playlist < 4) return;
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   269
			if (!IS_INT_INSIDE(y, 0, NUM_SONGS_AVAILABLE)) return;
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   270
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   271
			p = _playlists[msf.playlist];
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   272
			for (i = y; i != NUM_SONGS_PLAYLIST - 1; i++) {
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   273
				p[i] = p[i + 1];
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   274
				}
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   275
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   276
			SetWindowDirty(w);
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   277
			SelectSongToPlay();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   278
		} break;
4120
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   279
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   280
		case 11: /* clear */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   281
			_playlists[msf.playlist][0] = 0;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   282
			SetWindowDirty(w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   283
			StopMusic();
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   284
			SelectSongToPlay();
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   285
			break;
4120
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   286
4432
33631ac88c40 (svn r6195) -Codechange: do not use '//' in '/* ... */' style comments and '/*' or '*/' in '//' style comments.
rubidium
parents: 4344
diff changeset
   287
#if 0
33631ac88c40 (svn r6195) -Codechange: do not use '//' in '/* ... */' style comments and '/*' or '*/' in '//' style comments.
rubidium
parents: 4344
diff changeset
   288
		case 12: /* save */
33631ac88c40 (svn r6195) -Codechange: do not use '//' in '/* ... */' style comments and '/*' or '*/' in '//' style comments.
rubidium
parents: 4344
diff changeset
   289
			ShowInfo("MusicTrackSelectionWndProc:save not implemented\n");
33631ac88c40 (svn r6195) -Codechange: do not use '//' in '/* ... */' style comments and '/*' or '*/' in '//' style comments.
rubidium
parents: 4344
diff changeset
   290
			break;
33631ac88c40 (svn r6195) -Codechange: do not use '//' in '/* ... */' style comments and '/*' or '*/' in '//' style comments.
rubidium
parents: 4344
diff changeset
   291
#endif
4120
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   292
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   293
		case 5: case 6: case 7: case 8: case 9: case 10: /* set playlist */
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4468
diff changeset
   294
			msf.playlist = e->we.click.widget - 5;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   295
			SetWindowDirty(w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   296
			InvalidateWindow(WC_MUSIC_WINDOW, 0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   297
			StopMusic();
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   298
			SelectSongToPlay();
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   299
			break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   300
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   301
		break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   302
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   303
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   304
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   305
static const Widget _music_track_selection_widgets[] = {
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   306
{   WWT_CLOSEBOX,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,                         STR_018B_CLOSE_WINDOW},
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 654
diff changeset
   307
{    WWT_CAPTION,   RESIZE_NONE,    14,    11,   431,     0,    13, STR_01EB_MUSIC_PROGRAM_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   308
{     WWT_IMGBTN,   RESIZE_NONE,    14,     0,   431,    14,   217, 0x0,                              STR_NULL},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   309
{     WWT_IMGBTN,   RESIZE_NONE,    14,     2,   181,    22,   215, 0x0,                              STR_01FA_CLICK_ON_MUSIC_TRACK_TO},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   310
{     WWT_IMGBTN,   RESIZE_NONE,    14,   250,   429,    22,   215, 0x0,                              STR_CLICK_ON_TRACK_TO_REMOVE},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   311
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   186,   245,    44,    51, 0x0,                              STR_01F3_SELECT_ALL_TRACKS_PROGRAM},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   312
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   186,   245,    52,    59, 0x0,                              STR_01F4_SELECT_OLD_STYLE_MUSIC},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   313
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   186,   245,    60,    67, 0x0,                              STR_01F5_SELECT_NEW_STYLE_MUSIC},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   314
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   186,   245,    68,    75, 0x0,                              STR_0330_SELECT_EZY_STREET_STYLE},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   315
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   186,   245,    76,    83, 0x0,                              STR_01F6_SELECT_CUSTOM_1_USER_DEFINED},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   316
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   186,   245,    84,    91, 0x0,                              STR_01F7_SELECT_CUSTOM_2_USER_DEFINED},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   317
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   186,   245,   108,   115, 0x0,                              STR_01F8_CLEAR_CURRENT_PROGRAM_CUSTOM1},
4468
fb18502e2c12 (svn r6253) Comment out code with #if 0, not //. Join statements which needlessly span many lines into fewer lines
tron
parents: 4432
diff changeset
   318
#if 0
fb18502e2c12 (svn r6253) Comment out code with #if 0, not //. Join statements which needlessly span many lines into fewer lines
tron
parents: 4432
diff changeset
   319
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   186,   245,   124,   131, 0x0,                              STR_01F9_SAVE_MUSIC_SETTINGS},
fb18502e2c12 (svn r6253) Comment out code with #if 0, not //. Join statements which needlessly span many lines into fewer lines
tron
parents: 4432
diff changeset
   320
#endif
176
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 0
diff changeset
   321
{   WIDGETS_END},
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   322
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   323
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   324
static const WindowDesc _music_track_selection_desc = {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   325
	104, 131, 432, 218,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   326
	WC_MUSIC_TRACK_SELECTION,0,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   327
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   328
	_music_track_selection_widgets,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   329
	MusicTrackSelectionWndProc
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   330
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   331
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 867
diff changeset
   332
static void ShowMusicTrackSelection(void)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   333
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   334
	AllocateWindowDescFront(&_music_track_selection_desc, 0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   335
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   336
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   337
static void MusicWindowWndProc(Window *w, WindowEvent *e)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   338
{
2952
6a26eeda9679 (svn r3511) More whitespace ([FS#46] by Rubidium)
tron
parents: 2791
diff changeset
   339
	switch (e->event) {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   340
	case WE_PAINT: {
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
   341
		uint i;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   342
		StringID str;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   343
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   344
		w->click_state |= 0x280;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   345
		DrawWindowWidgets(w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   346
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   347
		GfxFillRect(187, 16, 200, 33, 0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   348
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
   349
		for (i = 0; i != 8; i++) {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   350
			int color = 0xD0;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   351
			if (i > 4) {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   352
				color = 0xBF;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   353
				if (i > 6) {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   354
					color = 0xB8;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   355
				}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   356
			}
4120
90e678fd7d8d (svn r5464) [Behaviour Fix] : When starting the game, the system will now verify the presence of music files in gm forlder.
belugas
parents: 3052
diff changeset
   357
			GfxFillRect(187, NUM_SONGS_PLAYLIST - i * 2, 200, NUM_SONGS_PLAYLIST - i * 2, color);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   358
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   359
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   360
		GfxFillRect(60, 46, 239, 52, 0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   361
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
   362
		if (_song_is_active == 0 || _music_wnd_cursong == 0) {
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
   363
			str = STR_01E3;
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
   364
		} else {
534
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   365
			SetDParam(0, _music_wnd_cursong);
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
   366
			str = (_music_wnd_cursong < 10) ? STR_01E4_0 : STR_01E5;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   367
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   368
		DrawString(62, 46, str, 0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   369
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   370
		str = STR_01E6;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   371
		if (_song_is_active != 0 && _music_wnd_cursong != 0) {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   372
			str = STR_01E7;
534
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   373
			SetDParam(0, SPECSTR_SONGNAME);
17ab2f22ff74 (svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents: 507
diff changeset
   374
			SetDParam(1, _music_wnd_cursong);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   375
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   376
		DrawStringCentered(155, 46, str, 0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   377
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   378
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   379
		DrawString(60, 38, STR_01E8_TRACK_XTITLE, 0);
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 176
diff changeset
   380
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
   381
		for (i = 0; i != 6; i++) {
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
   382
			DrawStringCentered(25 + i * 50, 59, STR_01D5_ALL + i, msf.playlist == i ? 0xC : 0x10);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   383
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   384
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   385
		DrawStringCentered(31, 43, STR_01E9_SHUFFLE, (msf.shuffle ? 0xC : 0x10));
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   386
		DrawStringCentered(269, 43, STR_01EA_PROGRAM, 0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   387
		DrawStringCentered(141, 15, STR_01DB_MUSIC_VOLUME, 0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   388
		DrawStringCentered(141, 29, STR_01DD_MIN_MAX, 0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   389
		DrawStringCentered(247, 15, STR_01DC_EFFECTS_VOLUME, 0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   390
		DrawStringCentered(247, 29, STR_01DD_MIN_MAX, 0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   391
1938
21bd6ef5f85e (svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents: 1891
diff changeset
   392
		DrawFrameRect(108, 23, 174, 26, 14, FR_LOWERED);
21bd6ef5f85e (svn r2444) - CodeChange: Add an enum for demagicifying the values of the 'flags' parameter of DrawFrameRect(). (_Abraxa_)
hackykid
parents: 1891
diff changeset
   393
		DrawFrameRect(214, 23, 280, 26, 14, FR_LOWERED);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   394
4468
fb18502e2c12 (svn r6253) Comment out code with #if 0, not //. Join statements which needlessly span many lines into fewer lines
tron
parents: 4432
diff changeset
   395
		DrawFrameRect(
fb18502e2c12 (svn r6253) Comment out code with #if 0, not //. Join statements which needlessly span many lines into fewer lines
tron
parents: 4432
diff changeset
   396
			108 + msf.music_vol / 2, 22, 111 + msf.music_vol / 2, 28, 14, 0
fb18502e2c12 (svn r6253) Comment out code with #if 0, not //. Join statements which needlessly span many lines into fewer lines
tron
parents: 4432
diff changeset
   397
		);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   398
4468
fb18502e2c12 (svn r6253) Comment out code with #if 0, not //. Join statements which needlessly span many lines into fewer lines
tron
parents: 4432
diff changeset
   399
		DrawFrameRect(
fb18502e2c12 (svn r6253) Comment out code with #if 0, not //. Join statements which needlessly span many lines into fewer lines
tron
parents: 4432
diff changeset
   400
			214 + msf.effect_vol / 2, 22, 217 + msf.effect_vol / 2, 28, 14, 0
fb18502e2c12 (svn r6253) Comment out code with #if 0, not //. Join statements which needlessly span many lines into fewer lines
tron
parents: 4432
diff changeset
   401
		);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   402
	} break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   403
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   404
	case WE_CLICK:
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4468
diff changeset
   405
		switch (e->we.click.widget) {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   406
		case 2: // skip to prev
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   407
			if (!_song_is_active)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   408
				return;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   409
			SkipToPrevSong();
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   410
			break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   411
		case 3: // skip to next
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   412
			if (!_song_is_active)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   413
				return;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   414
			SkipToNextSong();
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   415
			break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   416
		case 4: // stop playing
3052
95e4eaf303d5 (svn r3641) - Rename MusicFilesettings 'btn_down' to more sensible 'playing'
Darkvater
parents: 2952
diff changeset
   417
			msf.playing = false;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   418
			break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   419
		case 5: // start playing
3052
95e4eaf303d5 (svn r3641) - Rename MusicFilesettings 'btn_down' to more sensible 'playing'
Darkvater
parents: 2952
diff changeset
   420
			msf.playing = true;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   421
			break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   422
		case 6:{ // volume sliders
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   423
			byte *vol,new_vol;
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4468
diff changeset
   424
			int x = e->we.click.pt.x - 88;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   425
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   426
			if (x < 0)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   427
				return;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   428
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   429
			vol = &msf.music_vol;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   430
			if (x >= 106) {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   431
				vol = &msf.effect_vol;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   432
				x -= 106;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   433
			}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   434
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   435
			new_vol = min(max(x-21,0)*2,127);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   436
			if (new_vol != *vol) {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   437
				*vol = new_vol;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   438
				if (vol == &msf.music_vol)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   439
					MusicVolumeChanged(new_vol);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   440
				SetWindowDirty(w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   441
			}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   442
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   443
			_left_button_clicked = false;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   444
		} break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   445
		case 10: //toggle shuffle
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   446
			msf.shuffle ^= 1;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   447
			StopMusic();
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   448
			SelectSongToPlay();
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   449
			break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   450
		case 11: //show track selection
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   451
			ShowMusicTrackSelection();
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   452
			break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   453
		case 12: case 13: case 14: case 15: case 16: case 17: // playlist
4634
897461a3e9ca (svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents: 4468
diff changeset
   454
			msf.playlist = e->we.click.widget - 12;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   455
			SetWindowDirty(w);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   456
			InvalidateWindow(WC_MUSIC_TRACK_SELECTION, 0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   457
			StopMusic();
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   458
			SelectSongToPlay();
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   459
			break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   460
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   461
		break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   462
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   463
	case WE_MOUSELOOP:
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   464
		InvalidateWindowWidget(WC_MUSIC_WINDOW, 0, 7);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   465
		break;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   466
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   467
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   468
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   469
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   470
static const Widget _music_window_widgets[] = {
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   471
{   WWT_CLOSEBOX,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,              STR_018B_CLOSE_WINDOW},
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 654
diff changeset
   472
{    WWT_CAPTION,   RESIZE_NONE,    14,    11,   299,     0,    13, STR_01D2_JAZZ_JUKEBOX, STR_018C_WINDOW_TITLE_DRAG_THIS},
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   473
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,     0,    21,    14,    35, 0x2C5,                 STR_01DE_SKIP_TO_PREVIOUS_TRACK},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   474
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,    22,    43,    14,    35, 0x2C6,                 STR_01DF_SKIP_TO_NEXT_TRACK_IN_SELECTION},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   475
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,    44,    65,    14,    35, 0x2C7,                 STR_01E0_STOP_PLAYING_MUSIC},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   476
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,    66,    87,    14,    35, 0x2C8,                 STR_01E1_START_PLAYING_MUSIC},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   477
{     WWT_IMGBTN,   RESIZE_NONE,    14,    88,   299,    14,    35, 0x0,                   STR_01E2_DRAG_SLIDERS_TO_SET_MUSIC},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   478
{     WWT_IMGBTN,   RESIZE_NONE,    14,   186,   201,    15,    34, 0x0,                   STR_NULL},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   479
{     WWT_IMGBTN,   RESIZE_NONE,    14,     0,   299,    36,    57, 0x0,                   STR_NULL},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   480
{     WWT_IMGBTN,   RESIZE_NONE,    14,    59,   240,    45,    53, 0x0,                   STR_NULL},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   481
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,     6,    55,    42,    49, 0x0,                   STR_01FB_TOGGLE_PROGRAM_SHUFFLE},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   482
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   244,   293,    42,    49, 0x0,                   STR_01FC_SHOW_MUSIC_TRACK_SELECTION},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   483
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,     0,    49,    58,    65, 0x0,                   STR_01F3_SELECT_ALL_TRACKS_PROGRAM},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   484
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,    50,    99,    58,    65, 0x0,                   STR_01F4_SELECT_OLD_STYLE_MUSIC},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   485
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   100,   149,    58,    65, 0x0,                   STR_01F5_SELECT_NEW_STYLE_MUSIC},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   486
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   150,   199,    58,    65, 0x0,                   STR_0330_SELECT_EZY_STREET_STYLE},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   487
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   200,   249,    58,    65, 0x0,                   STR_01F6_SELECT_CUSTOM_1_USER_DEFINED},
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4120
diff changeset
   488
{ WWT_PUSHIMGBTN,   RESIZE_NONE,    14,   250,   299,    58,    65, 0x0,                   STR_01F7_SELECT_CUSTOM_2_USER_DEFINED},
176
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 0
diff changeset
   489
{   WIDGETS_END},
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   490
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   491
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   492
static const WindowDesc _music_window_desc = {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   493
	0, 22, 300, 66,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   494
	WC_MUSIC_WINDOW,0,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   495
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   496
	_music_window_widgets,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   497
	MusicWindowWndProc
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   498
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   499
1093
e8d26c7dc42f (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 867
diff changeset
   500
void ShowMusicWindow(void)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   501
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   502
	AllocateWindowDescFront(&_music_window_desc, 0);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   503
}