… | |
… | |
1263 | $table |
1263 | $table |
1264 | } |
1264 | } |
1265 | |
1265 | |
1266 | my %SORT_ORDER = ( |
1266 | my %SORT_ORDER = ( |
1267 | type => undef, |
1267 | type => undef, |
1268 | mtime => sub { sort { |
1268 | mtime => sub { |
|
|
1269 | my $NOW = time; |
|
|
1270 | sort { |
|
|
1271 | my $atime = $a->{mtime} - $NOW; $atime = $atime < 5 * 60 ? int $atime / 60 : 6; |
|
|
1272 | my $btime = $b->{mtime} - $NOW; $btime = $btime < 5 * 60 ? int $btime / 60 : 6; |
|
|
1273 | |
1269 | ($a->{flags} & F_LOCKED) <=> ($b->{flags} & F_LOCKED) |
1274 | ($a->{flags} & F_LOCKED) <=> ($b->{flags} & F_LOCKED) |
1270 | or $b->{mtime} <=> $a->{mtime} |
1275 | or $btime <=> $atime |
1271 | or $a->{type} <=> $b->{type} |
1276 | or $a->{type} <=> $b->{type} |
|
|
1277 | } @_ |
1272 | } @_ }, |
1278 | }, |
1273 | weight => sub { sort { |
1279 | weight => sub { sort { |
1274 | $a->{weight} * ($a->{nrof} || 1) <=> $b->{weight} * ($b->{nrof} || 1) |
1280 | $a->{weight} * ($a->{nrof} || 1) <=> $b->{weight} * ($b->{nrof} || 1) |
1275 | or $a->{type} <=> $b->{type} |
1281 | or $a->{type} <=> $b->{type} |
1276 | } @_ }, |
1282 | } @_ }, |
1277 | ); |
1283 | ); |
… | |
… | |
1914 | CFPlus::Mix_AllocateChannels 8; |
1920 | CFPlus::Mix_AllocateChannels 8; |
1915 | CFPlus::MixMusic::volume $CFG->{bgm_volume} * 128; |
1921 | CFPlus::MixMusic::volume $CFG->{bgm_volume} * 128; |
1916 | |
1922 | |
1917 | audio_music_finished; |
1923 | audio_music_finished; |
1918 | |
1924 | |
|
|
1925 | local $_; |
1919 | while (<$fh>) { |
1926 | while (<$fh>) { |
1920 | last; |
|
|
1921 | next if /^\s*#/; |
1927 | next if /^\s*#/; |
1922 | next if /^\s*$/; |
1928 | next if /^\s*$/; |
1923 | |
1929 | |
1924 | my ($file, $volume, $event) = split /\s+/, $_, 3; |
1930 | my ($file, $volume, $event) = split /\s+/, $_, 3; |
1925 | |
1931 | |
1926 | push @SOUNDS, "$volume,$file"; |
1932 | push @SOUNDS, "$volume,$file"; |
1927 | |
1933 | |
1928 | # $AUDIO_CHUNKS{"$volume,$file"} ||= do { |
1934 | $AUDIO_CHUNKS{"$volume,$file"} ||= do { |
1929 | # my $chunk = new_from_file CFPlus::MixChunk CFPlus::find_rcfile "sounds/$file"; |
1935 | my $chunk = new_from_file CFPlus::MixChunk CFPlus::find_rcfile "sounds/$file"; |
1930 | # $chunk->volume ($volume * 128 / 100); |
1936 | $chunk->volume ($volume * 128 / 100); |
1931 | # $chunk |
1937 | $chunk |
1932 | # }; |
1938 | }; |
1933 | } |
1939 | } |
1934 | } else { |
1940 | } else { |
1935 | status "unable to open sound config: $!"; |
1941 | status "unable to open sound config: $!"; |
1936 | } |
1942 | } |
1937 | } |
1943 | } |