… | |
… | |
21 | use Crossfire; |
21 | use Crossfire; |
22 | use Coro; |
22 | use Coro; |
23 | use Coro::AIO; |
23 | use Coro::AIO; |
24 | use Coro::Util; |
24 | use Coro::Util; |
25 | use POSIX (); |
25 | use POSIX (); |
26 | use Digest::MD5; |
|
|
27 | use Carp; |
26 | use Carp; |
28 | use Coro::Channel; |
27 | use Coro::Channel; |
29 | use Coro::Storable; $Storable::canonical = 1; |
28 | use Coro::Storable; $Storable::canonical = 1; |
30 | |
29 | |
31 | $SIG{QUIT} = sub { Carp::cluck "QUIT" }; |
30 | $SIG{QUIT} = sub { Carp::cluck "QUIT" }; |
… | |
… | |
426 | facings => $facings, |
425 | facings => $facings, |
427 | frames => \@frames, |
426 | frames => \@frames, |
428 | }; |
427 | }; |
429 | } |
428 | } |
430 | |
429 | |
431 | for my $face ($o->{face} || (), @{$anim || []}) { |
430 | for ($o->{face} || (), @{$anim || []}) { |
432 | next if $face =~ /^facings\s/; |
431 | next if /^facings\s/; |
|
|
432 | |
|
|
433 | my $face = $_; |
|
|
434 | $face =~ s/\+\d+\+\d+$//; # remove tile offset coordinates |
433 | |
435 | |
434 | my $info = $FACEINFO{$face} ||= { }; |
436 | my $info = $FACEINFO{$face} ||= { }; |
435 | $info->{arc} = $o; |
437 | $info->{arc} = $o; |
436 | |
438 | |
437 | next if $face =~ /^blank.x11$|^empty.x11$/; |
439 | next if $face =~ /^blank.x11$|^empty.x11$/; |
… | |
… | |
521 | substr $dir, 0, 1 + length $PATH, ""; |
523 | substr $dir, 0, 1 + length $PATH, ""; |
522 | |
524 | |
523 | $RESOURCE{"$dir/$file"} = { |
525 | $RESOURCE{"$dir/$file"} = { |
524 | type => (delete $meta->{type}) || $type, |
526 | type => (delete $meta->{type}) || $type, |
525 | data => $data, |
527 | data => $data, |
526 | chksum => (Digest::MD5::md5 $data), |
|
|
527 | %$meta ? (meta => $meta) : (), |
528 | %$meta ? (meta => $meta) : (), |
528 | }; |
529 | }; |
529 | } |
530 | } |
530 | } |
531 | } |
531 | |
532 | |
… | |
… | |
681 | length $v->{data64} or warn "$k: face has no png64. this will not work very well.\n"; |
682 | length $v->{data64} or warn "$k: face has no png64. this will not work very well.\n"; |
682 | |
683 | |
683 | length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n"; |
684 | length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n"; |
684 | #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n"; |
685 | #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n"; |
685 | |
686 | |
686 | $v->{chksum32} = Digest::MD5::md5 $v->{data32}; |
|
|
687 | $v->{chksum64} = Digest::MD5::md5 $v->{data64}; |
|
|
688 | |
|
|
689 | if (my $magicmap = $v->{magicmap}) { |
687 | if (my $magicmap = $v->{magicmap}) { |
690 | $magicmap =~ y/A-Z_\-/a-z/d; |
688 | $magicmap =~ y/A-Z_\-/a-z/d; |
691 | $v->{magicmap} = $COLOR{$magicmap}; |
689 | $v->{magicmap} = $COLOR{$magicmap}; |
692 | } |
690 | } |
693 | |
691 | |