ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/player-env.ext
(Generate patch)

Comparing deliantra/server/ext/player-env.ext (file contents):
Revision 1.19 by root, Fri May 14 23:47:37 2010 UTC vs.
Revision 1.24 by root, Sun Nov 11 05:53:11 2012 UTC

45 push @face, $face 45 push @face, $face
46 if $face; 46 if $face;
47 } 47 }
48 } 48 }
49 49
50 # sort by size, smallest first, because it'S the fastest to download... 50 # sort by size, smallest first, because it's the fastest to download...
51 [ sort { (cf::face::get_data_size $a) <=> (cf::face::get_data_size $b) } @face ] 51 [ sort { ($cf::face::SIZE[0][$a]) <=> ($cf::face::SIZE[0][$b]) } @face ]
52} 52}
53 53
54our %MUSIC_QUEUE; 54our %MUSIC_QUEUE;
55 55
56our $MUSIC_SCHEDULER = cf::async_ext { 56our $MUSIC_SCHEDULER = cf::async_ext {
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;
69 my $map = $pl->ob->map or next; 68 my $map = $ob->map;
69 my $rgn = $ob->region;
70
71 my $id = join "\x00", $map->path, $rgn->name;
70 72
71 my $faces = delete $ns->{music_play_once}; 73 my $faces = delete $ns->{music_play_once};
72 $faces ||= $MUSIC_FACE_CACHE{$map} ||= do { 74 $faces ||= $MUSIC_FACE_CACHE{$id} ||= do {
73 # 1. map-specific music info 75 # 1. map-specific music info
74 parse_musiclist $map->{music} 76 parse_musiclist $map->{music}
75 or do { 77 or do {
76 # 2. fall back to region if no map-specific music 78 # 2. fall back to region if no map-specific music
77 my $rgn = $pl->ob->region 79 $rgn = $rgn->parent
78 or next; 80 while $rgn && !exists $rgn->{music};
79 81
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} 82 parse_musiclist $rgn->{music}
88 } 83 }
89 ; 84 ;
90 }; 85 };
91 86
92 $faces 87 $faces

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines