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.200 by root, Thu Aug 2 14:35:21 2007 UTC vs.
Revision 1.203 by root, Mon Aug 6 02:11:45 2007 UTC

239 my $meta = $CONN->{sound_meta}{$face} 239 my $meta = $CONN->{sound_meta}{$face}
240 or return; 240 or return;
241 241
242 # if its a jingle, play it as ambient music 242 # if its a jingle, play it as ambient music
243 if ($meta->{meta}{jingle}) { 243 if ($meta->{meta}{jingle}) {
244 delete $AUDIO_PLAY{$face}; # take the jingle out of the sound queue 244 if (delete $AUDIO_PLAY{$face}) { # take the jingle out of the sound queue
245 push @MUSIC_JINGLE, $meta; # push it oto the music/jingle queue 245 push @MUSIC_JINGLE, $meta; # push it oto the music/jingle queue
246 &audio_music_push ($face); 246 &audio_music_push ($face);
247 }
247 } else { 248 } else {
248 # fetch from database 249 # fetch from database
249 CFPlus::DB::get res_data => $meta->{name}, sub { 250 CFPlus::DB::get res_data => $meta->{name}, sub {
250 my $rwops = new CFPlus::RW $_[0]; 251 my $rwops = new CFPlus::RW $_[0];
251 my $chunk = new CFPlus::MixChunk $rwops; 252 my $chunk = new CFPlus::MixChunk $rwops
253 or Carp::confess "sound face $meta->{face} unloadable: " . CFPlus::Mix_GetError;
252 $chunk->volume (($meta->{meta}{volume} || 1) * 128); 254 $chunk->volume (($meta->{meta}{volume} || 1) * 128);
253 $AUDIO_CHUNK{$face} = $chunk; 255 $AUDIO_CHUNK{$face} = $chunk;
254 256
255 audio_sound_push ($face); 257 audio_sound_push ($face);
256 }; 258 };
308 my $rwops = $meta->{path} 310 my $rwops = $meta->{path}
309 ? new_from_file CFPlus::RW $meta->{path} 311 ? new_from_file CFPlus::RW $meta->{path}
310 : new CFPlus::RW $$MUSIC_PLAYING_DATA; 312 : new CFPlus::RW $$MUSIC_PLAYING_DATA;
311 313
312 $MUSIC_PLAYER = new CFPlus::MixMusic $rwops 314 $MUSIC_PLAYER = new CFPlus::MixMusic $rwops
313 or ((warn CFPlus::Mix_GetError), return); # pretty fatal error 315 or Carp::confess "music face $meta->{face} unloadable: " . CFPlus::Mix_GetError;
314 316
315 my $NOW = time; 317 my $NOW = time;
316 318
317 if ($MUSIC_PLAYING_META->{stop_time} > $NOW - $MUSIC_RESUME) { 319 if ($MUSIC_PLAYING_META->{stop_time} > $NOW - $MUSIC_RESUME) {
318 my $pos = $MUSIC_PLAYING_META->{stop_pos}; 320 my $pos = $MUSIC_PLAYING_META->{stop_pos};
351 @MUSIC_HAVE = { path => CFPlus::find_rcfile "music/$MUSIC_DEFAULT" } unless @MUSIC_HAVE; 353 @MUSIC_HAVE = { path => CFPlus::find_rcfile "music/$MUSIC_DEFAULT" } unless @MUSIC_HAVE;
352 $fade_out = 1000; 354 $fade_out = 1000;
353 } 355 }
354 356
355 # if the currently playing song is acceptable, let it continue 357 # if the currently playing song is acceptable, let it continue
356 return if $MUSIC_PLAYING_META
357 && grep $MUSIC_PLAYING_META == $_, @MUSIC_HAVE; 358 return if grep $MUSIC_PLAYING_META == $_, @MUSIC_HAVE;
358 359
359 my $NOW = time; 360 my $NOW = time;
360 361
361 if ($MUSIC_PLAYING_META) { 362 if ($MUSIC_PLAYING_META) {
362 $MUSIC_PLAYING_META->{stop_time} = $NOW; 363 $MUSIC_PLAYING_META->{stop_time} = $NOW;
1610sub media_window { 1611sub media_window {
1611 my $vb = new CFPlus::UI::VBox; 1612 my $vb = new CFPlus::UI::VBox;
1612 1613
1613 $vb->add (new CFPlus::UI::FancyFrame 1614 $vb->add (new CFPlus::UI::FancyFrame
1614 label => "Currently playing music", 1615 label => "Currently playing music",
1616 child => new CFPlus::UI::ScrolledWindow scroll_x => 1, scroll_y => 0,
1615 child => ($MUSIC_PLAYING_WIDGET = new CFPlus::UI::Label ellipsise => 0), 1617 child => ($MUSIC_PLAYING_WIDGET = new CFPlus::UI::Label ellipsise => 0, fontsize => 0.8),
1616 ); 1618 );
1617 1619
1618 $vb->add (new CFPlus::UI::FancyFrame 1620 $vb->add (new CFPlus::UI::FancyFrame
1619 label => "Other media used in this session", 1621 label => "Other media used in this session",
1622 expand => 1,
1620 child => ($LICENSE_WIDGET = new CFPlus::UI::TextScroller 1623 child => ($LICENSE_WIDGET = new CFPlus::UI::TextScroller
1621 expand => 1, fontsize => 0.8, padding_x => 4, padding_y => 4), 1624 expand => 1, fontsize => 0.8, padding_x => 4, padding_y => 4),
1622 ); 1625 );
1623 1626
1624 $vb 1627 $vb
1628}
1629
1630sub add_license {
1631 my ($meta) = @_;
1632
1633 $meta = $meta->{meta}
1634 or return;
1635
1636 $meta->{license} || $meta->{author} || $meta->{source}
1637 or return;
1638
1639 $LICENSE_WIDGET->add_paragraph ({
1640 fg => [1, 1, 1, 1],
1641 markup => "<small>"
1642 . "<b>Name:</b> " . (CFPlus::asxml $meta->{name}) . "\n"
1643 . "<b>Author:</b> " . (CFPlus::asxml $meta->{author}) . "\n"
1644 . "<b>Source:</b> " . (CFPlus::asxml $meta->{source}) . "\n"
1645 . "<b>License:</b> " . (CFPlus::asxml $meta->{license}) . "\n"
1646 . "</small>",
1647 });
1648 $LICENSE_WIDGET->scroll_to_bottom;
1625} 1649}
1626 1650
1627sub toggle_player_page { 1651sub toggle_player_page {
1628 my ($widget) = @_; 1652 my ($widget) = @_;
1629 1653

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines