… | |
… | |
69 | our $TMPDIR = "$LOCALDIR/" . tmpdir; |
69 | our $TMPDIR = "$LOCALDIR/" . tmpdir; |
70 | our $UNIQUEDIR = "$LOCALDIR/" . uniquedir; |
70 | our $UNIQUEDIR = "$LOCALDIR/" . uniquedir; |
71 | our $PLAYERDIR = "$LOCALDIR/" . playerdir; |
71 | our $PLAYERDIR = "$LOCALDIR/" . playerdir; |
72 | our $RANDOMDIR = "$LOCALDIR/random"; |
72 | our $RANDOMDIR = "$LOCALDIR/random"; |
73 | our $BDBDIR = "$LOCALDIR/db"; |
73 | our $BDBDIR = "$LOCALDIR/db"; |
|
|
74 | our %RESOURCE; |
74 | |
75 | |
75 | our $TICK = MAX_TIME * 1e-6; # this is a CONSTANT(!) |
76 | our $TICK = MAX_TIME * 1e-6; # this is a CONSTANT(!) |
76 | our $TICK_WATCHER; |
77 | our $TICK_WATCHER; |
77 | our $AIO_POLL_WATCHER; |
78 | our $AIO_POLL_WATCHER; |
78 | our $NEXT_RUNTIME_WRITE; # when should the runtime file be written |
79 | our $NEXT_RUNTIME_WRITE; # when should the runtime file be written |
… | |
… | |
3149 | { |
3150 | { |
3150 | my $faces = $facedata->{faceinfo}; |
3151 | my $faces = $facedata->{faceinfo}; |
3151 | |
3152 | |
3152 | while (my ($face, $info) = each %$faces) { |
3153 | while (my ($face, $info) = each %$faces) { |
3153 | my $idx = (cf::face::find $face) || cf::face::alloc $face; |
3154 | my $idx = (cf::face::find $face) || cf::face::alloc $face; |
|
|
3155 | |
3154 | cf::face::set_visibility $idx, $info->{visibility}; |
3156 | cf::face::set_visibility $idx, $info->{visibility}; |
3155 | cf::face::set_magicmap $idx, $info->{magicmap}; |
3157 | cf::face::set_magicmap $idx, $info->{magicmap}; |
3156 | cf::face::set_data $idx, 0, $info->{data32}, Digest::MD5::md5 $info->{data32}; |
3158 | cf::face::set_data $idx, 0, $info->{data32}, Digest::MD5::md5 $info->{data32}; |
3157 | cf::face::set_data $idx, 1, $info->{data64}, Digest::MD5::md5 $info->{data64}; |
3159 | cf::face::set_data $idx, 1, $info->{data64}, Digest::MD5::md5 $info->{data64}; |
3158 | |
3160 | |
3159 | cf::cede_to_tick; |
3161 | cf::cede_to_tick; |
3160 | } |
3162 | } |
3161 | |
3163 | |
3162 | while (my ($face, $info) = each %$faces) { |
3164 | while (my ($face, $info) = each %$faces) { |
3163 | next unless $info->{smooth}; |
3165 | next unless $info->{smooth}; |
|
|
3166 | |
3164 | my $idx = cf::face::find $face |
3167 | my $idx = cf::face::find $face |
3165 | or next; |
3168 | or next; |
|
|
3169 | |
3166 | if (my $smooth = cf::face::find $info->{smooth}) { |
3170 | if (my $smooth = cf::face::find $info->{smooth}) { |
3167 | cf::face::set_smooth $idx, $smooth; |
3171 | cf::face::set_smooth $idx, $smooth; |
3168 | cf::face::set_smoothlevel $idx, $info->{smoothlevel}; |
3172 | cf::face::set_smoothlevel $idx, $info->{smoothlevel}; |
3169 | } else { |
3173 | } else { |
3170 | warn "smooth face '$info->{smooth}' not found for face '$face'"; |
3174 | warn "smooth face '$info->{smooth}' not found for face '$face'"; |
… | |
… | |
3188 | { |
3192 | { |
3189 | # TODO: for gcfclient pleasure, we should give resources |
3193 | # TODO: for gcfclient pleasure, we should give resources |
3190 | # that gcfclient doesn't grok a >10000 face index. |
3194 | # that gcfclient doesn't grok a >10000 face index. |
3191 | my $res = $facedata->{resource}; |
3195 | my $res = $facedata->{resource}; |
3192 | |
3196 | |
3193 | my $soundconf = delete $res->{"res/sound.conf"}; |
|
|
3194 | |
|
|
3195 | while (my ($name, $info) = each %$res) { |
3197 | while (my ($name, $info) = each %$res) { |
|
|
3198 | if (defined $info->{type}) { |
3196 | my $idx = (cf::face::find $name) || cf::face::alloc $name; |
3199 | my $idx = (cf::face::find $name) || cf::face::alloc $name; |
3197 | my $data; |
3200 | my $data; |
3198 | |
3201 | |
3199 | if ($info->{type} & 1) { |
3202 | if ($info->{type} & 1) { |
3200 | # prepend meta info |
3203 | # prepend meta info |
3201 | |
3204 | |
3202 | my $meta = $enc->encode ({ |
3205 | my $meta = $enc->encode ({ |
3203 | name => $name, |
3206 | name => $name, |
3204 | %{ $info->{meta} || {} }, |
3207 | %{ $info->{meta} || {} }, |
3205 | }); |
3208 | }); |
3206 | |
3209 | |
3207 | $data = pack "(w/a*)*", $meta, $info->{data}; |
3210 | $data = pack "(w/a*)*", $meta, $info->{data}; |
|
|
3211 | } else { |
|
|
3212 | $data = $info->{data}; |
|
|
3213 | } |
|
|
3214 | |
|
|
3215 | cf::face::set_data $idx, 0, $data, Digest::MD5::md5 $data; |
|
|
3216 | cf::face::set_type $idx, $info->{type}; |
3208 | } else { |
3217 | } else { |
3209 | $data = $info->{data}; |
3218 | $RESOURCE{$name} = $info; |
3210 | } |
3219 | } |
3211 | |
3220 | |
3212 | cf::face::set_data $idx, 0, $data, Digest::MD5::md5 $data; |
|
|
3213 | cf::face::set_type $idx, $info->{type}; |
|
|
3214 | |
|
|
3215 | cf::cede_to_tick; |
3221 | cf::cede_to_tick; |
3216 | } |
3222 | } |
3217 | |
3223 | |
3218 | if ($soundconf) { |
3224 | if (my $soundconf = delete $res->{"res/sound.conf"}) { |
3219 | $soundconf = $enc->decode (delete $soundconf->{data}); |
3225 | $soundconf = $enc->decode (delete $soundconf->{data}); |
3220 | |
3226 | |
3221 | for (0 .. SOUND_CAST_SPELL_0 - 1) { |
3227 | for (0 .. SOUND_CAST_SPELL_0 - 1) { |
3222 | my $sound = $soundconf->{compat}[$_] |
3228 | my $sound = $soundconf->{compat}[$_] |
3223 | or next; |
3229 | or next; |