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

Comparing deliantra/Deliantra-Client/bin/deliantra (file contents):
Revision 1.7 by root, Mon Dec 3 22:48:25 2007 UTC vs.
Revision 1.10 by root, Sat Dec 22 06:51:08 2007 UTC

258 } else { 258 } else {
259 # fetch from database 259 # fetch from database
260 CFPlus::DB::get res_data => $meta->{name}, sub { 260 CFPlus::DB::get res_data => $meta->{name}, sub {
261 my $rwops = new CFPlus::RW $_[0]; 261 my $rwops = new CFPlus::RW $_[0];
262 my $chunk = new CFPlus::MixChunk $rwops 262 my $chunk = new CFPlus::MixChunk $rwops
263 or Carp::confess "sound face " . (JSON::XS::to_json $meta) . " unloadable: " . CFPlus::Mix_GetError; 263 or Carp::confess "sound face " . (JSON::XS::encode_json $meta) . " unloadable: " . CFPlus::Mix_GetError;
264 $chunk->volume (($meta->{data}{volume} || 1) * 128); 264 $chunk->volume (($meta->{data}{volume} || 1) * 128);
265 $AUDIO_CHUNK{$face} = $chunk; 265 $AUDIO_CHUNK{$face} = $chunk;
266 266
267 audio_sound_push ($face); 267 audio_sound_push ($face);
268 }; 268 };
344 return unless $SDL_MIXER; 344 return unless $SDL_MIXER;
345 345
346 my $fade_out; 346 my $fade_out;
347 347
348 if (@MUSIC_JINGLE) { 348 if (@MUSIC_JINGLE) {
349 $fade_out = 333;
349 @MUSIC_HAVE = $MUSIC_JINGLE[0]; 350 @MUSIC_HAVE = $MUSIC_JINGLE[0];
350 $fade_out = 333; 351
351 } else { 352 } else {
352 return unless $CFG->{bgm_enable}; 353 return unless $CFG->{bgm_enable};
353 354
354 my @have = 355 $fade_out = 700;
356
357 @MUSIC_HAVE =
355 grep $_ && $_->{data}, 358 grep $_ && $_->{data},
356 map $CONN->{face}[$_], 359 map $CONN->{face}[$_],
357 @$MUSIC_WANT; 360 @$MUSIC_WANT;
358 361
359 # randomize music a bit so that the order is not always the same 362 # randomize music a bit so that the order is not always the same
360 $_->{stop_time} ||= rand for @have; 363 $_->{stop_time} ||= rand for @MUSIC_HAVE;
361
362 @MUSIC_HAVE = @have
363 if @have;
364 364
365 # default MUSIC_HAVE == MUSIC_DEFAULT 365 # default MUSIC_HAVE == MUSIC_DEFAULT
366 @MUSIC_HAVE = { path => CFPlus::find_rcfile "music/$MUSIC_DEFAULT" } unless @MUSIC_HAVE; 366 @MUSIC_HAVE = { path => CFPlus::find_rcfile "music/$MUSIC_DEFAULT" }
367 $fade_out = 700; 367 unless @MUSIC_HAVE;
368 } 368 }
369 369
370 # if the currently playing song is acceptable, let it continue 370 # if the currently playing song is acceptable, let it continue
371 return if grep $MUSIC_PLAYING_META == $_, @MUSIC_HAVE; 371 return if grep $MUSIC_PLAYING_META == $_, @MUSIC_HAVE;
372 372
469 my ($conn, $flags, $prompt) = @_; 469 my ($conn, $flags, $prompt) = @_;
470 470
471 # FIXME: a very ugly hack to wait for stat update #d# 471 # FIXME: a very ugly hack to wait for stat update #d#
472 if ($prompt =~ /roll new stats/ and not $conn->{stat_change_with}) { 472 if ($prompt =~ /roll new stats/ and not $conn->{stat_change_with}) {
473 unless ($QUERY_TIMER) { 473 unless ($QUERY_TIMER) {
474 $QUERY_TIMER =
475 EV::timer 1, 0, sub { 474 $QUERY_TIMER = EV::timer 1, 0, sub {
476 server_query ($conn, $flags, $prompt, 1); 475 server_query ($conn, $flags, $prompt, 1);
477 $QUERY_TIMER = undef 476 $QUERY_TIMER = undef
478 }; 477 };
478
479 return; 479 return;
480 } 480 }
481 } 481 }
482 482
483 $conn->{query_dialog} = my $dialog = new CFPlus::UI::Toplevel 483 $conn->{query_dialog} = my $dialog = new CFPlus::UI::Toplevel
1350 my $ok = 0; 1350 my $ok = 0;
1351 1351
1352 CFPlus::background { 1352 CFPlus::background {
1353 my $ua = CFPlus::lwp_useragent; 1353 my $ua = CFPlus::lwp_useragent;
1354 1354
1355 CFPlus::background_msg CFPlus::from_json +(CFPlus::lwp_check $ua->get ($META_SERVER))->decoded_content; 1355 CFPlus::background_msg CFPlus::decode_json +(CFPlus::lwp_check $ua->get ($META_SERVER))->decoded_content;
1356 } sub { 1356 } sub {
1357 my ($msg) = @_; 1357 my ($msg) = @_;
1358 if ($msg) { 1358 if ($msg) {
1359 $table->clear; 1359 $table->clear;
1360 1360

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines