ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/utils/cfutil.in
(Generate patch)

Comparing deliantra/server/utils/cfutil.in (file contents):
Revision 1.56 by root, Sun Aug 19 15:47:56 2007 UTC vs.
Revision 1.60 by root, Mon Aug 27 02:43:38 2007 UTC

21use Crossfire; 21use Crossfire;
22use Coro; 22use Coro;
23use Coro::AIO; 23use Coro::AIO;
24use Coro::Util; 24use Coro::Util;
25use POSIX (); 25use POSIX ();
26use Digest::MD5;
27use Carp; 26use Carp;
28use Coro::Channel; 27use Coro::Channel;
29use Coro::Storable; $Storable::canonical = 1; 28use 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$/;
493 my ($dir, $file, $type) = @$job; 494 my ($dir, $file, $type) = @$job;
494 495
495 my $data; 496 my $data;
496 aio_load "$dir/$file", $data; 497 aio_load "$dir/$file", $data;
497 498
498 my $meta = load_cached "$dir/meta", sub { JSON::XS::from_json shift }; 499 my $meta = load_cached "$dir/meta", sub { JSON::XS->new->utf8->relaxed->decode (shift) };
499 500
500 next if $meta && !exists $meta->{$file}; 501 next if $meta && !exists $meta->{$file};
501 502
502 $meta = { 503 $meta = {
503 %{ $meta->{"" } || {} }, 504 %{ $meta->{"" } || {} },
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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines