… | |
… | |
888 | } |
888 | } |
889 | |
889 | |
890 | my @bgmusic = qw(game1.ogg game2.ogg game3.ogg game5.ogg game6.ogg ross1.ogg ross2.ogg ross3.ogg ross4.ogg ross5.ogg); #d# |
890 | my @bgmusic = qw(game1.ogg game2.ogg game3.ogg game5.ogg game6.ogg ross1.ogg ross2.ogg ross3.ogg ross4.ogg ross5.ogg); #d# |
891 | my $bgmusic;#TODO#hack#d# |
891 | my $bgmusic;#TODO#hack#d# |
892 | |
892 | |
|
|
893 | sub audio_channel_finished { |
|
|
894 | my ($channel) = @_; |
|
|
895 | |
|
|
896 | warn "channel $channel finished\n";#d# |
|
|
897 | } |
|
|
898 | |
893 | sub audio_music_finished { |
899 | sub audio_music_finished { |
894 | return unless $CFG->{bgm_enable}; |
900 | return unless $CFG->{bgm_enable}; |
895 | |
901 | |
896 | # TODO: hack, do play loop and mood music |
902 | # TODO: hack, do play loop and mood music |
897 | $bgmusic = new_from_file CFClient::MixMusic CFClient::find_rcfile "music/$bgmusic[0]"; |
903 | $bgmusic = new_from_file CFClient::MixMusic CFClient::find_rcfile "music/$bgmusic[0]"; |
… | |
… | |
1398 | video_init; |
1404 | video_init; |
1399 | } else { |
1405 | } else { |
1400 | CFClient::UI::feed_sdl_key_down_event ($_[0]); |
1406 | CFClient::UI::feed_sdl_key_down_event ($_[0]); |
1401 | } |
1407 | } |
1402 | }, |
1408 | }, |
1403 | CFClient::SDL_KEYUP => \&CFClient::UI::feed_sdl_key_up_event, |
1409 | CFClient::SDL_KEYUP => \&CFClient::UI::feed_sdl_key_up_event, |
1404 | CFClient::SDL_MOUSEMOTION => \&CFClient::UI::feed_sdl_motion_event, |
1410 | CFClient::SDL_MOUSEMOTION => \&CFClient::UI::feed_sdl_motion_event, |
1405 | CFClient::SDL_MOUSEBUTTONDOWN => \&CFClient::UI::feed_sdl_button_down_event, |
1411 | CFClient::SDL_MOUSEBUTTONDOWN => \&CFClient::UI::feed_sdl_button_down_event, |
1406 | CFClient::SDL_MOUSEBUTTONUP => \&CFClient::UI::feed_sdl_button_up_event, |
1412 | CFClient::SDL_MOUSEBUTTONUP => \&CFClient::UI::feed_sdl_button_up_event, |
1407 | CFClient::SDL_USEREVENT => \&audio_music_finished, |
1413 | CFClient::SDL_USEREVENT => sub { |
|
|
1414 | if ($_[0]{code} == 1) { |
|
|
1415 | audio_channel_finished $_[0]{data1}; |
|
|
1416 | } elsif ($_[0]{code} == 0) { |
|
|
1417 | audio_music_finished; |
|
|
1418 | } |
|
|
1419 | }, |
1408 | ); |
1420 | ); |
1409 | |
1421 | |
1410 | ############################################################################# |
1422 | ############################################################################# |
1411 | |
1423 | |
1412 | $SIG{INT} = $SIG{TERM} = sub { exit }; |
1424 | $SIG{INT} = $SIG{TERM} = sub { exit }; |