music_gui.c
changeset 193 0a7025304867
parent 176 84990c4b9212
child 341 9d0ac356488a
equal deleted inserted replaced
192:614bba52258d 193:0a7025304867
    42 	byte t;
    42 	byte t;
    43 
    43 
    44 	// empty playlist
    44 	// empty playlist
    45 	if (b[0] == 0)
    45 	if (b[0] == 0)
    46 		return;
    46 		return;
    47 	
    47 
    48 	// find the end
    48 	// find the end
    49 	do p++; while (p[0] != 0);
    49 	do p++; while (p[0] != 0);
    50 
    50 
    51 	// and copy the bytes
    51 	// and copy the bytes
    52 	t = *--p;
    52 	t = *--p;
   130 			return;
   130 			return;
   131 	}
   131 	}
   132 	_music_wnd_cursong = _cur_playlist[0];
   132 	_music_wnd_cursong = _cur_playlist[0];
   133 	DoPlaySong();
   133 	DoPlaySong();
   134 	_song_is_active = true;
   134 	_song_is_active = true;
   135 	
   135 
   136 	InvalidateWindowWidget(WC_MUSIC_WINDOW, 0, 9);
   136 	InvalidateWindowWidget(WC_MUSIC_WINDOW, 0, 9);
   137 }
   137 }
   138 
   138 
   139 void ResetMusic()
   139 void ResetMusic()
   140 {
   140 {
   188 
   188 
   189 		for(i=0; i!=6; i++) {
   189 		for(i=0; i!=6; i++) {
   190 			DrawStringCentered(216, 45 + i*8, STR_01D5_ALL + i, (i==msf.playlist) ? 0xC : 0x10);
   190 			DrawStringCentered(216, 45 + i*8, STR_01D5_ALL + i, (i==msf.playlist) ? 0xC : 0x10);
   191 		}
   191 		}
   192 
   192 
   193 		DrawStringCentered(216, 45+8*6+16, STR_01F0_CLEAR, 0); 
   193 		DrawStringCentered(216, 45+8*6+16, STR_01F0_CLEAR, 0);
   194 		DrawStringCentered(216, 45+8*6+16*2, STR_01F1_SAVE, 0);
   194 		DrawStringCentered(216, 45+8*6+16*2, STR_01F1_SAVE, 0);
   195 
   195 
   196 		y = 23;
   196 		y = 23;
   197 		for(p = _playlists[msf.playlist],i=0; (i=*p) != 0; p++) {
   197 		for(p = _playlists[msf.playlist],i=0; (i=*p) != 0; p++) {
   198 			SET_DPARAM16(0, i);
   198 			SET_DPARAM16(0, i);
   201 			DrawString(252, y, (i < 10) ? STR_01EC_0 : STR_01ED, 0);
   201 			DrawString(252, y, (i < 10) ? STR_01EC_0 : STR_01ED, 0);
   202 			y += 6;
   202 			y += 6;
   203 		}
   203 		}
   204 		break;
   204 		break;
   205 	}
   205 	}
   206 	
   206 
   207 	case WE_CLICK:
   207 	case WE_CLICK:
   208 		switch(e->click.widget) {
   208 		switch(e->click.widget) {
   209 		case 3: { /* add to playlist */
   209 		case 3: { /* add to playlist */
   210 			int y = (e->click.pt.y - 23) / 6;
   210 			int y = (e->click.pt.y - 23) / 6;
   211 			int i;
   211 			int i;
   319 		}
   319 		}
   320 		DrawStringCentered(155, 46, str, 0);
   320 		DrawStringCentered(155, 46, str, 0);
   321 
   321 
   322 
   322 
   323 		DrawString(60, 38, STR_01E8_TRACK_XTITLE, 0);
   323 		DrawString(60, 38, STR_01E8_TRACK_XTITLE, 0);
   324 		
   324 
   325 		for(i=0; i!=6; i++) {
   325 		for(i=0; i!=6; i++) {
   326 			DrawStringCentered(25+i*50, 59, STR_01D5_ALL+i, msf.playlist == i ? 0xC : 0x10);
   326 			DrawStringCentered(25+i*50, 59, STR_01D5_ALL+i, msf.playlist == i ? 0xC : 0x10);
   327 		}
   327 		}
   328 
   328 
   329 		DrawStringCentered(31, 43, STR_01E9_SHUFFLE, (msf.shuffle ? 0xC : 0x10));
   329 		DrawStringCentered(31, 43, STR_01E9_SHUFFLE, (msf.shuffle ? 0xC : 0x10));
   334 		DrawStringCentered(247, 29, STR_01DD_MIN_MAX, 0);
   334 		DrawStringCentered(247, 29, STR_01DD_MIN_MAX, 0);
   335 
   335 
   336 		DrawFrameRect(108, 23, 174, 26, 14, 0x20);
   336 		DrawFrameRect(108, 23, 174, 26, 14, 0x20);
   337 		DrawFrameRect(214, 23, 280, 26, 14, 0x20);
   337 		DrawFrameRect(214, 23, 280, 26, 14, 0x20);
   338 
   338 
   339 		DrawFrameRect(108 + (msf.music_vol>>1), 
   339 		DrawFrameRect(108 + (msf.music_vol>>1),
   340 									22,
   340 									22,
   341 									111 + (msf.music_vol>>1),
   341 									111 + (msf.music_vol>>1),
   342 									28,
   342 									28,
   343 									14,
   343 									14,
   344 									0);
   344 									0);
   345 
   345 
   346 		DrawFrameRect(214 + (msf.effect_vol>>1), 
   346 		DrawFrameRect(214 + (msf.effect_vol>>1),
   347 									22,
   347 									22,
   348 									217 + (msf.effect_vol>>1),
   348 									217 + (msf.effect_vol>>1),
   349 									28,
   349 									28,
   350 									14,
   350 									14,
   351 									0);
   351 									0);
   369 		case 5: // start playing
   369 		case 5: // start playing
   370 			msf.btn_down = true;
   370 			msf.btn_down = true;
   371 			break;
   371 			break;
   372 		case 6:{ // volume sliders
   372 		case 6:{ // volume sliders
   373 			byte *vol,new_vol;
   373 			byte *vol,new_vol;
   374 			int x = e->click.pt.x - 88; 
   374 			int x = e->click.pt.x - 88;
   375 
   375 
   376 			if (x < 0)
   376 			if (x < 0)
   377 				return;
   377 				return;
   378 
   378 
   379 			vol = &msf.music_vol;
   379 			vol = &msf.music_vol;