… | |
… | |
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" }; |
… | |
… | |
174 | |
173 | |
175 | (my $base = $stem) =~ s/^.*\///; |
174 | (my $base = $stem) =~ s/^.*\///; |
176 | |
175 | |
177 | my $fi = $FACEINFO{$base}; |
176 | my $fi = $FACEINFO{$base}; |
178 | unless ($fi) { |
177 | unless ($fi) { |
179 | warn "$path: <$base> not referenced by any archetype, skipping.\n"; |
178 | #warn "$path: <$base> not referenced by any archetype, skipping.\n"; |
180 | next; |
179 | #next; |
181 | } |
180 | } |
182 | |
181 | |
183 | my $arc = $FACEINFO{$base}{arc} |
182 | my $arc = $fi->{arc} || { }; |
184 | or die "FATAL: internal error <$base>, cannot continue"; |
|
|
185 | |
183 | |
186 | unless ($path =~ /~$/) { |
184 | unless ($path =~ /~$/) { |
187 | # possibly enlarge |
185 | # possibly enlarge |
188 | if (0 > aio_stat "$stem.64x64.png") { |
186 | if (0 > aio_stat "$stem.64x64.png") { |
189 | my $other = "$stem.64x64.png~"; |
187 | my $other = "$stem.64x64.png~"; |
… | |
… | |
426 | facings => $facings, |
424 | facings => $facings, |
427 | frames => \@frames, |
425 | frames => \@frames, |
428 | }; |
426 | }; |
429 | } |
427 | } |
430 | |
428 | |
431 | for my $face ($o->{face} || (), @{$anim || []}) { |
429 | for ($o->{face} || (), @{$anim || []}) { |
432 | next if $face =~ /^facings\s/; |
430 | next if /^facings\s/; |
|
|
431 | |
|
|
432 | my $face = $_; |
|
|
433 | $face =~ s/\+\d+\+\d+$//; # remove tile offset coordinates |
433 | |
434 | |
434 | my $info = $FACEINFO{$face} ||= { }; |
435 | my $info = $FACEINFO{$face} ||= { }; |
435 | $info->{arc} = $o; |
436 | $info->{arc} = $o; |
436 | |
437 | |
437 | next if $face =~ /^blank.x11$|^empty.x11$/; |
438 | next if $face =~ /^blank.x11$|^empty.x11$/; |
… | |
… | |
521 | substr $dir, 0, 1 + length $PATH, ""; |
522 | substr $dir, 0, 1 + length $PATH, ""; |
522 | |
523 | |
523 | $RESOURCE{"$dir/$file"} = { |
524 | $RESOURCE{"$dir/$file"} = { |
524 | type => (delete $meta->{type}) || $type, |
525 | type => (delete $meta->{type}) || $type, |
525 | data => $data, |
526 | data => $data, |
526 | chksum => (Digest::MD5::md5 $data), |
|
|
527 | %$meta ? (meta => $meta) : (), |
527 | %$meta ? (meta => $meta) : (), |
528 | }; |
528 | }; |
529 | } |
529 | } |
530 | } |
530 | } |
531 | |
531 | |
… | |
… | |
681 | length $v->{data64} or warn "$k: face has no png64. this will not work very well.\n"; |
681 | length $v->{data64} or warn "$k: face has no png64. this will not work very well.\n"; |
682 | |
682 | |
683 | length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n"; |
683 | 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"; |
684 | #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n"; |
685 | |
685 | |
686 | $v->{chksum32} = Digest::MD5::md5 $v->{data32}; |
|
|
687 | $v->{chksum64} = Digest::MD5::md5 $v->{data64}; |
|
|
688 | |
|
|
689 | if (my $magicmap = $v->{magicmap}) { |
686 | if (my $magicmap = $v->{magicmap}) { |
690 | $magicmap =~ y/A-Z_\-/a-z/d; |
687 | $magicmap =~ y/A-Z_\-/a-z/d; |
691 | $v->{magicmap} = $COLOR{$magicmap}; |
688 | $v->{magicmap} = $COLOR{$magicmap}; |
692 | } |
689 | } |
693 | |
690 | |