ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/cfplus
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/cfplus (file contents):
Revision 1.163 by root, Thu Jul 12 17:56:51 2007 UTC vs.
Revision 1.167 by root, Fri Jul 13 05:31:32 2007 UTC

501 $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); 501 $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER);
502 $SETUP_DIALOG->show; 502 $SETUP_DIALOG->show;
503 $PL_WINDOW->hide; 503 $PL_WINDOW->hide;
504 $SPELL_LIST->clear_spells; 504 $SPELL_LIST->clear_spells;
505 $CFPlus::UI::ROOT->emit (stop_game => ! ! $CONN); 505 $CFPlus::UI::ROOT->emit (stop_game => ! ! $CONN);
506
507 &audio_music_set ([]);
506 508
507 return unless $CONN; 509 return unless $CONN;
508 510
509 status "connection closed"; 511 status "connection closed";
510 512
2019 2021
2020 my $count = @$songs; 2022 my $count = @$songs;
2021 my @meta; 2023 my @meta;
2022 2024
2023 for my $name (@$songs) { 2025 for my $name (@$songs) {
2024 CFPlus::DB::get resmap => $name, sub { 2026 CFPlus::DB::get "res-metadata" => $name, sub {
2025 my ($data) = @_; 2027 my ($data) = @_;
2026 2028
2027 if ($data) { 2029 if ($data) {
2028 $data = JSON::XS->new->utf8->decode ($data); 2030 $data = JSON::XS->new->utf8->decode ($data);
2029 $data->{path} = CFPlus::DB::path_of $name; 2031 $data->{path} = CFPlus::DB::path_of $name;
2041} 2043}
2042 2044
2043sub audio_music_changed { 2045sub audio_music_changed {
2044 return unless $CFG->{bgm_enable}; 2046 return unless $CFG->{bgm_enable};
2045 2047
2046 # default MUSIC_WANT, undef/0 == MUSIC_DEFAULT 2048 # default MUSIC_WANT == MUSIC_DEFAULT
2047 @MUSIC_WANT = { path => CFPlus::find_rcfile "music/$MUSIC_DEFAULT" } unless @MUSIC_WANT; 2049 @MUSIC_WANT = { path => CFPlus::find_rcfile "music/$MUSIC_DEFAULT" } unless @MUSIC_WANT;
2048 2050
2049 # if the currently playing song is acceptable, let it continue 2051 # if the currently playing song is acceptable, let it continue
2052 return if $MUSIC_PLAYING
2050 return if grep $MUSIC_PLAYING eq $_->{path}, @MUSIC_WANT; 2053 && grep $MUSIC_PLAYING->{path} eq $_->{path}, @MUSIC_WANT;
2051 2054
2052 if (defined $MUSIC_PLAYING) { 2055 if ($MUSIC_PLAYING) {
2053 warn "fade out";
2054 CFPlus::MixMusic::fade_out 2000; 2056 CFPlus::MixMusic::fade_out 1000;
2055 } else { 2057 } else {
2056 warn "new music\n";
2057
2058 my $music = $MUSIC_WANT [rand @MUSIC_WANT]; 2058 my $music = $MUSIC_WANT [rand @MUSIC_WANT];
2059 2059
2060 $MUSIC_PLAYING = $music->{path}; 2060 $MUSIC_PLAYING = $music;
2061 2061
2062 $MUSIC_PLAYER = new_from_file CFPlus::MixMusic $music->{path}; 2062 $MUSIC_PLAYER = new_from_file CFPlus::MixMusic $music->{path};
2063 $MUSIC_PLAYER->play (0); 2063 $MUSIC_PLAYER->play (0);
2064 } 2064 }
2065} 2065}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines