… | |
… | |
81 | |
81 | |
82 | { |
82 | { |
83 | our %PNG32; |
83 | our %PNG32; |
84 | our %FACEINFO; |
84 | our %FACEINFO; |
85 | our @ARC; |
85 | our @ARC; |
|
|
86 | our $TRS; |
86 | our $NFILE; |
87 | our $NFILE; |
87 | our %ANIM; |
88 | our %ANIM; |
|
|
89 | our $SMOOTH; |
88 | |
90 | |
89 | our (@png, @trs, @arc); # files we are interested in |
91 | our (@png, @trs, @arc); # files we are interested in |
90 | |
92 | |
91 | sub commit_png { |
93 | sub commit_png { |
92 | my ($name, $data) = @_; |
94 | my ($name, $data) = @_; |
… | |
… | |
250 | my $info = $FACEINFO{$face} ||= {}; |
252 | my $info = $FACEINFO{$face} ||= {}; |
251 | |
253 | |
252 | $info->{visibility} = $visibility if defined $visibility; |
254 | $info->{visibility} = $visibility if defined $visibility; |
253 | $info->{magicmap} = $magicmap if defined $magicmap; |
255 | $info->{magicmap} = $magicmap if defined $magicmap; |
254 | } |
256 | } |
|
|
257 | |
|
|
258 | if (my $smooth = delete $o->{smoothface}) { |
|
|
259 | $SMOOTH .= "$smooth\n"; |
|
|
260 | } |
255 | } |
261 | } |
256 | } |
262 | } |
257 | } |
263 | } |
258 | } |
264 | } |
259 | |
265 | |
260 | sub process_trs { |
266 | sub process_trs { |
261 | while (@trs) { |
267 | while (@trs) { |
262 | my ($dir, $file) = @{pop @trs}; |
268 | my ($dir, $file) = @{pop @trs}; |
|
|
269 | my $path = "$dir/$file"; |
|
|
270 | |
|
|
271 | my $trs; |
|
|
272 | if (0 > aio_load $path, $trs) { |
|
|
273 | warn "$path: $!, skipping.\n"; |
|
|
274 | next; |
|
|
275 | } |
|
|
276 | |
|
|
277 | $TRS .= $trs; |
263 | } |
278 | } |
264 | } |
279 | } |
265 | |
280 | |
266 | sub find_files; |
281 | sub find_files; |
267 | sub find_files { |
282 | sub find_files { |
… | |
… | |
314 | } |
329 | } |
315 | |
330 | |
316 | { |
331 | { |
317 | open my $fh, ">:utf8", "$DATADIR/archetypes~" |
332 | open my $fh, ">:utf8", "$DATADIR/archetypes~" |
318 | or die "$DATADIR/archetypes~: $!"; |
333 | or die "$DATADIR/archetypes~: $!"; |
319 | substr $_->{editor_folder}, 0, length $path, "" for @ARC; |
334 | substr $_->{editor_folder}, 0, 1 + length $path, "" for @ARC; |
320 | print $fh Crossfire::archlist_to_string \@ARC; |
335 | print $fh Crossfire::archlist_to_string \@ARC; |
|
|
336 | } |
|
|
337 | |
|
|
338 | { |
|
|
339 | open my $fh, ">:utf8", "$DATADIR/smooth~" |
|
|
340 | or die "$DATADIR/smooth~: $!"; |
|
|
341 | print $fh $SMOOTH; |
|
|
342 | } |
|
|
343 | |
|
|
344 | { |
|
|
345 | open my $fh, ">:utf8", "$DATADIR/treasures~" |
|
|
346 | or die "$DATADIR/treasures~: $!"; |
|
|
347 | print $fh $TRS; |
321 | } |
348 | } |
322 | |
349 | |
323 | { |
350 | { |
324 | while (my ($k, $v) = each %FACEINFO) { |
351 | while (my ($k, $v) = each %FACEINFO) { |
325 | $v->{data32} ||= delete $PNG32{$k}; |
352 | $v->{data32} ||= delete $PNG32{$k}; |
326 | } |
353 | } |
327 | |
354 | |
328 | while (my ($k, $v) = each %FACEINFO) { |
355 | while (my ($k, $v) = each %FACEINFO) { |
329 | length $v->{data32} or warn "$k: face has no png32. this will crash the server.\n"; |
356 | length $v->{data32} or warn "$k: face has no png32. this will not work (shoddy gcfclient will crash of course).\n"; |
330 | |
357 | |
331 | $v->{chksum32} = Digest::MD5::md5 $v->{data32}; |
358 | $v->{chksum32} = Digest::MD5::md5 $v->{data32}; |
332 | } |
359 | } |
333 | |
360 | |
334 | open my $fh, ">:perlio", "$DATADIR/faces~" |
361 | open my $fh, ">:perlio", "$DATADIR/faces~" |
335 | or die "$DATADIR/faces~: $!"; |
362 | or die "$DATADIR/faces~: $!"; |
336 | |
363 | |
337 | print $fh Storable::nfreeze \%FACEINFO; |
364 | print $fh Storable::nfreeze \%FACEINFO; |
338 | |
|
|
339 | #use PApp::Util; warn PApp::Util::dumpval \%FACEINFO; |
|
|
340 | } |
365 | } |
341 | |
366 | |
342 | for (qw(archetypes faces animations)) { |
367 | for (qw(archetypes faces animations treasures smooth)) { |
343 | chmod 0644, "$DATADIR/$_~"; |
368 | chmod 0644, "$DATADIR/$_~"; |
344 | rename "$DATADIR/$_~", "$DATADIR/$_"; |
369 | rename "$DATADIR/$_~", "$DATADIR/$_"; |
345 | } |
370 | } |
346 | |
|
|
347 | die "--install-arch not fully implemented\n"; |
|
|
348 | } |
371 | } |
349 | } |
372 | } |
350 | |
373 | |
351 | Getopt::Long::Configure ("bundling", "no_ignore_case"); |
374 | Getopt::Long::Configure ("bundling", "no_ignore_case"); |
352 | GetOptions ( |
375 | GetOptions ( |