… | |
… | |
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" }; |
… | |
… | |
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 = $FACEINFO{$base}{arc} |
184 | or die "FATAL: internal error, cannot continue"; |
183 | or die "FATAL: internal error <$base>, cannot continue"; |
185 | |
184 | |
186 | unless ($path =~ /~$/) { |
185 | unless ($path =~ /~$/) { |
187 | # possibly enlarge |
186 | # possibly enlarge |
188 | if (0 > aio_stat "$stem.64x64.png") { |
187 | if (0 > aio_stat "$stem.64x64.png") { |
189 | my $other = "$stem.64x64.png~"; |
188 | my $other = "$stem.64x64.png~"; |
… | |
… | |
199 | my ($wall_pfx, $wall_dir, $wall_sfx); |
198 | my ($wall_pfx, $wall_dir, $wall_sfx); |
200 | |
199 | |
201 | if ( |
200 | if ( |
202 | !$is_floor |
201 | !$is_floor |
203 | && !$arc->{alive} |
202 | && !$arc->{alive} |
204 | && $arc->{no_pass} |
203 | && $arc->{move_block} eq "all" |
205 | && $path =~ /^(.*_)([0-9A-F])(\.x11.*\.png)$/ |
204 | && $path =~ /^(.*_)([0-9A-F])(\.x11.*\.png)$/ |
206 | ) { |
205 | ) { |
207 | ($wall_pfx, $wall_dir, $wall_sfx) = ($1, hex $2, $3); |
206 | ($wall_pfx, $wall_dir, $wall_sfx) = ($1, hex $2, $3); |
208 | |
207 | |
209 | unless (grep { !-e sprintf "%s%X%s", $wall_pfx, $_, $wall_sfx } 0..15) { |
208 | unless (grep { !-e sprintf "%s%X%s", $wall_pfx, $_, $wall_sfx } 0..15) { |
… | |
… | |
427 | frames => \@frames, |
426 | frames => \@frames, |
428 | }; |
427 | }; |
429 | } |
428 | } |
430 | |
429 | |
431 | for my $face ($o->{face} || (), @{$anim || []}) { |
430 | for my $face ($o->{face} || (), @{$anim || []}) { |
432 | next if $face =~ /^facings\s|^blank.x11$|^empty.x11$/; |
431 | next if $face =~ /^facings\s/; |
433 | |
432 | |
434 | my $info = $FACEINFO{$face} ||= {}; |
433 | my $info = $FACEINFO{$face} ||= { }; |
435 | |
|
|
436 | $info->{arc} = $o; |
434 | $info->{arc} = $o; |
|
|
435 | |
|
|
436 | next if $face =~ /^blank.x11$|^empty.x11$/; |
|
|
437 | |
437 | $info->{visibility} = $visibility if defined $visibility; |
438 | $info->{visibility} = $visibility if defined $visibility; |
438 | $info->{magicmap} = $magicmap if defined $magicmap; |
439 | $info->{magicmap} = $magicmap if defined $magicmap; |
439 | } |
440 | } |
440 | |
441 | |
441 | if (my $smooth = delete $o->{smoothface}) { |
442 | if (my $smooth = delete $o->{smoothface}) { |
… | |
… | |
519 | substr $dir, 0, 1 + length $PATH, ""; |
520 | substr $dir, 0, 1 + length $PATH, ""; |
520 | |
521 | |
521 | $RESOURCE{"$dir/$file"} = { |
522 | $RESOURCE{"$dir/$file"} = { |
522 | type => (delete $meta->{type}) || $type, |
523 | type => (delete $meta->{type}) || $type, |
523 | data => $data, |
524 | data => $data, |
524 | chksum => (Digest::MD5::md5 $data), |
|
|
525 | %$meta ? (meta => $meta) : (), |
525 | %$meta ? (meta => $meta) : (), |
526 | }; |
526 | }; |
527 | } |
527 | } |
528 | } |
528 | } |
529 | |
529 | |
… | |
… | |
679 | length $v->{data64} or warn "$k: face has no png64. this will not work very well.\n"; |
679 | length $v->{data64} or warn "$k: face has no png64. this will not work very well.\n"; |
680 | |
680 | |
681 | length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n"; |
681 | length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n"; |
682 | #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n"; |
682 | #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n"; |
683 | |
683 | |
684 | $v->{chksum32} = Digest::MD5::md5 $v->{data32}; |
|
|
685 | $v->{chksum64} = Digest::MD5::md5 $v->{data64}; |
|
|
686 | |
|
|
687 | if (my $magicmap = $v->{magicmap}) { |
684 | if (my $magicmap = $v->{magicmap}) { |
688 | $magicmap =~ y/A-Z_\-/a-z/d; |
685 | $magicmap =~ y/A-Z_\-/a-z/d; |
689 | $v->{magicmap} = $COLOR{$magicmap}; |
686 | $v->{magicmap} = $COLOR{$magicmap}; |
690 | } |
687 | } |
691 | |
688 | |