… | |
… | |
61 | delete $MUSIC_QUEUE{$_}; |
61 | delete $MUSIC_QUEUE{$_}; |
62 | |
62 | |
63 | cf::get_slot 0.01, -10, "music scheduler"; |
63 | cf::get_slot 0.01, -10, "music scheduler"; |
64 | |
64 | |
65 | my $pl = cf::player::find_active $_ or next; |
65 | my $pl = cf::player::find_active $_ or next; |
66 | $pl->ob->active or next; |
66 | my $ob = $pl->ob; |
67 | my $ns = $pl->ns or next; |
67 | my $ns = $pl->ns or next; |
68 | $ns->extcmd or next; |
68 | $ns->extcmd or next; |
69 | my $map = $pl->ob->map or next; |
69 | my $map = $ob->map; |
|
|
70 | my $rgn = $ob->region; |
|
|
71 | |
|
|
72 | my $id = join "\x00", $map->path, $rgn->name; |
70 | |
73 | |
71 | my $faces = delete $ns->{music_play_once}; |
74 | my $faces = delete $ns->{music_play_once}; |
72 | $faces ||= $MUSIC_FACE_CACHE{$map} ||= do { |
75 | $faces ||= $MUSIC_FACE_CACHE{$id} ||= do { |
73 | # 1. map-specific music info |
76 | # 1. map-specific music info |
74 | parse_musiclist $map->{music} |
77 | parse_musiclist $map->{music} |
75 | or do { |
78 | or do { |
76 | # 2. fall back to region if no map-specific music |
79 | # 2. fall back to region if no map-specific music |
77 | my $rgn = $pl->ob->region |
80 | $rgn = $rgn->parent |
78 | or next; |
81 | while $rgn && !exists $rgn->{music}; |
79 | |
82 | |
80 | my $par = $rgn; |
|
|
81 | while () { |
|
|
82 | last if exists $par->{music}; |
|
|
83 | $par = $par->parent |
|
|
84 | or last; |
|
|
85 | } |
|
|
86 | |
|
|
87 | parse_musiclist $par->{music} |
83 | parse_musiclist $rgn->{music} |
88 | } |
84 | } |
89 | ; |
85 | ; |
90 | }; |
86 | }; |
91 | |
87 | |
92 | $faces |
88 | $faces |