… | |
… | |
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 | |