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.111 by root, Fri Apr 22 02:03:12 2011 UTC vs.
Revision 1.117 by root, Sat Oct 15 05:06:49 2011 UTC

1#!@PERL@ 1#!@PERL@
2 2
3# 3#
4# This file is part of Deliantra, the Roguelike Realtime MMORPG. 4# This file is part of Deliantra, the Roguelike Realtime MMORPG.
5# 5#
6# Copyright (©) 2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 6# Copyright (©) 2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
7# 7#
8# Deliantra is free software: you can redistribute it and/or modify it under 8# Deliantra is free software: you can redistribute it and/or modify it under
9# the terms of the Affero GNU General Public License as published by the 9# the terms of the Affero GNU General Public License as published by the
10# Free Software Foundation, either version 3 of the License, or (at your 10# Free Software Foundation, either version 3 of the License, or (at your
11# option) any later version. 11# option) any later version.
107 khaki => 12, 107 khaki => 12,
108); 108);
109 109
110END { system "rm", "-rf", $TMPDIR } 110END { system "rm", "-rf", $TMPDIR }
111 111
112my $s_INT = EV::signal INT => sub { exit 1 }; 112my $s_INT = AE::signal INT => sub { exit 1 };
113my $s_TERM = EV::signal TERM => sub { exit 1 }; 113my $s_TERM = AE::signal TERM => sub { exit 1 };
114 114
115our %hash; 115our %hash;
116 116
117# here we could try to avoid collisions and reduce chksum size further 117# here we could try to avoid collisions and reduce chksum size further
118sub make_hash($\$\$;$) { 118sub make_hash($\$\$;$) {
119 my ($id, $dataref, $hashref, $clen) = @_; 119 my ($id, $dataref, $hashref, $clen) = @_;
120 120
121 my $hash = substr +(Digest::MD5::md5 $$dataref), 0, $clen || 4; 121 my $hash = substr +(Digest::MD5::md5 $$dataref), 0, $clen || 5;
122 122
123 if (exists $hash{$hash}) { 123 if (exists $hash{$hash}) {
124 # hash collision, but some files are simply identical 124 # hash collision, but some files are simply identical
125 if (${$hash{$hash}[1]} ne $$dataref) { 125 if (${$hash{$hash}[1]} ne $$dataref) {
126 warn "hash collision $hash{$hash}[0] vs. $id\n"; 126 warn "ERROR: hash collision $hash{$hash}[0] vs. $id (increase the default \$clen in make_hash?)\n";
127 exit 1; 127 exit 1;
128 } else { 128 } else {
129 print "$hash{$hash}[0] and $id are identical (which is fine).\n" if $VERBOSE >= 3; 129 print "$hash{$hash}[0] and $id are identical (which is fine).\n" if $VERBOSE >= 3;
130 } 130 }
131 } 131 }
132 $hash{$hash} = [$id, $dataref, $hashref]; 132 $hash{$hash} = [$id, $dataref, $hashref];
133 133
134 $$hashref = $hash; 134 $$hashref = $hash;
135}
136
137sub optipng($) {
138 system $OPTIPNG, "-o5", "-i0", "-q", $_[0];
139 die "$_[0] has zero size, aborting." unless -s $_[0];
135} 140}
136 141
137mkdir $TMPDIR, 0700 142mkdir $TMPDIR, 0700
138 or die "$TMPDIR: $!"; 143 or die "$TMPDIR: $!";
139 144
185 my (undef, $path) = @_; 190 my (undef, $path) = @_;
186 191
187 print "\nInstalling '$path' to '$DATADIR/maps'\n\n"; 192 print "\nInstalling '$path' to '$DATADIR/maps'\n\n";
188 193
189 if (!-f "$path/regions") { 194 if (!-f "$path/regions") {
190 warn "'$path' does not look like a maps directory ('regions' file is missing).\n"; 195 warn "ERROR: '$path' does not look like a maps directory ('regions' file is missing).\n";
191 exit 1 unless $FORCE; 196 exit 1 unless $FORCE;
192 } 197 }
193 198
194 system $RSYNC, "-av", "--chmod=u=rwX,go=rX", 199 system $RSYNC, "-av", "--chmod=u=rwX,go=rX",
195 "$path/.", "$DATADIR/maps/.", 200 "$path/.", "$DATADIR/maps/.",
205 our %FACEINFO; 210 our %FACEINFO;
206 our %RESOURCE; 211 our %RESOURCE;
207 our @ARC; 212 our @ARC;
208 our %ARC; 213 our %ARC;
209 our $TRS; 214 our $TRS;
215 our %PNG;
210 our $NFILE; 216 our $NFILE;
211 our $PATH; 217 our $PATH;
212 218
213 our $QUANTIZE = "+dither -colorspace RGB -colors 256"; 219 our $QUANTIZE = "+dither -colorspace RGB -colors 256";
214 220
231 my $png; 237 my $png;
232 aio_lstat $path; 238 aio_lstat $path;
233 my ($size, $mtime) = (stat _)[7,9]; 239 my ($size, $mtime) = (stat _)[7,9];
234 240
235 if (0 > aio_load $path, $png) { 241 if (0 > aio_load $path, $png) {
236 warn "$path: $!, skipping.\n"; 242 warn "ERROR: $path: $!, skipping.\n";
237 next; 243 next;
238 } 244 }
239 245
240 my $stem = $path; 246 my $stem = $path;
241 my $T; 247 my $T;
243 if ($stem =~ s/\.32x32\.png~?$//) { 249 if ($stem =~ s/\.32x32\.png~?$//) {
244 $T = 32; 250 $T = 32;
245 } elsif ($stem =~ s/\.64x64\.png~?$//) { 251 } elsif ($stem =~ s/\.64x64\.png~?$//) {
246 $T = 64; 252 $T = 64;
247 } else { 253 } else {
248 warn "$path: weird filename, skipping.\n"; 254 warn "ERROR: $path: weird filename, skipping.\n";
249 next; 255 next;
250 } 256 }
251 257
252 # quickly extract width and height of the (necessarily PNG) image 258 # quickly extract width and height of the (necessarily PNG) image
253 unless ($png =~ /^\x89PNG\x0d\x0a\x1a\x0a....IHDR(........)/s) { 259 unless ($png =~ /^\x89PNG\x0d\x0a\x1a\x0a....IHDR(........)/s) {
254 warn "$path: not a recognized png file, skipping.\n"; 260 warn "ERROR: $path: not a recognized png file, skipping.\n";
255 next; 261 next;
256 } 262 }
257 263
258 my ($w, $h) = unpack "NN", $1; 264 my ($w, $h) = unpack "NN", $1;
259 265
260 if ($w < $T || $h < $T) { 266 if ($w < $T || $h < $T) {
261 warn "$path: too small ($w $h), skipping.\n"; 267 warn "ERROR: $path: too small ($w $h), skipping.\n";
262 next; 268 next;
263 } 269 }
264 270
265 if ($w % $T || $h % $T) { 271 if ($w % $T || $h % $T) {
266 warn "$path: weird png size ($w $h), skipping.\n"; 272 warn "ERROR: $path: weird png size ($w $h), skipping.\n";
267 next; 273 next;
268 } 274 }
269 275
270 (my $base = $stem) =~ s/^.*\///; 276 (my $base = $stem) =~ s/^.*\///;
271 277
345 351
346 system "convert -depth 8 $SRC rgba:-" 352 system "convert -depth 8 $SRC rgba:-"
347 . "| $exec_prefix/bin/cfhq2xa $w $h 0" 353 . "| $exec_prefix/bin/cfhq2xa $w $h 0"
348 . "| convert -depth 8 -size ".($w * 2)."x".($h * 2)." rgba:- $CROP $QUANTIZE -quality 00 png32:\Q$other\E~" 354 . "| convert -depth 8 -size ".($w * 2)."x".($h * 2)." rgba:- $CROP $QUANTIZE -quality 00 png32:\Q$other\E~"
349 and die "convert/cfhq2xa pipeline error: status $? ($!)"; 355 and die "convert/cfhq2xa pipeline error: status $? ($!)";
350 system $OPTIPNG, "-i0", "-q", "$other~"; 356 optipng "$other~";
351 die "$other~ has zero size, aborting." unless -s "$other~";
352 rename "$other~", $other; 357 rename "$other~", $other;
353 }; 358 };
354 }; 359 };
355 360
356 push @c_png, [$other, !$CACHE]; 361 push @c_png, [$other, !$CACHE];
361 my $other = "$stem.32x32.png~"; 366 my $other = "$stem.32x32.png~";
362 367
363 make_file $path, $other, sub { 368 make_file $path, $other, sub {
364 fork_exec { 369 fork_exec {
365 system "convert png:\Q$path\E -geometry 50% -filter lanczos $QUANTIZE -quality 00 png32:\Q$other\E~"; 370 system "convert png:\Q$path\E -geometry 50% -filter lanczos $QUANTIZE -quality 00 png32:\Q$other\E~";
366 system $OPTIPNG, "-i0", "-q", "$other~"; 371 optipng "$other~";
367 372
368 # reduce smoothfaces >10000 bytes 373 # reduce smoothfaces >10000 bytes
369 # obsolete, no longer required 374 # obsolete, no longer required
370 if (0 && $stem =~ /_S\./ && (-s "$other~") > 10000) { 375 if (0 && $stem =~ /_S\./ && (-s "$other~") > 10000) {
371 my $ncolor = 256; 376 my $ncolor = 256;
372 while () { 377 while () {
373 system "<\Q$other~\E $PNGNQ -s1 -n$ncolor >\Q$other~~\E"; 378 system "<\Q$other~\E $PNGNQ -s1 -n$ncolor >\Q$other~~\E";
374 system $OPTIPNG, "-i0", "-q", "$other~~"; 379 optipng "$other~~";
375 last if 10000 > -s "$other~~"; 380 last if 10000 > -s "$other~~";
376 $ncolor = int $ncolor * 0.9; 381 $ncolor = int $ncolor * 0.9;
377 $ncolor > 8 or die "cannot reduce filesize to < 10000 bytes"; 382 $ncolor > 8 or die "cannot reduce filesize to < 10000 bytes";
378 } 383 }
379 384
392 push @c_png, [$other, !$CACHE]; 397 push @c_png, [$other, !$CACHE];
393 } 398 }
394 } 399 }
395 400
396 (my $face = $stem) =~ s/^.*\///; 401 (my $face = $stem) =~ s/^.*\///;
402
403 for (@{ $fi->{derive} }) {
404 my ($dir, $type) = @$_;
405
406 my $geom = "${T}x${T}";
407 my $dpath = "$dir/$type:$face.$geom.png~";
408
409 if ($type eq "buildmaterial") {
410 my $ov = "$PATH/mapbuilding/buildmaterial.png";
411 make_file [$path, $ov], $dpath, sub {
412 fork_exec {
413 system "$CONVERT -size 64x64 xc:transparent \\( \Q$path\E -geometry 52x52+6+6 \\) -composite \Q$ov\E -composite -geometry $geom png:\Q$dpath\E~";
414 optipng "$dpath~";
415 rename "$dpath~", $dpath;
416 };
417 };
418 } elsif ($type eq "buildmaterial-box") {
419 my $ov = "$PATH/mapbuilding/buildmaterial-box.png";
420 make_file [$path, $ov], $dpath, sub {
421 fork_exec {
422 system "$CONVERT \Q$ov\E "
423 . "\\( \Q$path\E -trim -geometry 34x31\\> "
424 . "-gravity center -background transparent -extent 37x34 +gravity "
425 . "-geometry +22+6 \\) -composite "
426 . "-geometry $geom png:\Q$dpath\E~";
427 optipng "$dpath~";
428 rename "$dpath~", $dpath;
429 };
430 };
431 } elsif ($type eq "buildmaterial-sbox") {
432 my $ov = "$PATH/mapbuilding/buildmaterial-sbox.png";
433 make_file [$path, $ov], $dpath, sub {
434 fork_exec {
435 system "$CONVERT \Q$ov\E "
436 . "\\( \Q$path\E -trim -geometry 16x24\\> "
437 . "-gravity center -background transparent -extent 18x26 +gravity "
438 . "-geometry +26+16 \\) -composite "
439 . "-geometry $geom png:\Q$dpath\E~";
440 optipng "$dpath~";
441 rename "$dpath~", $dpath;
442 };
443 };
444 } else {
445 warn "ERROR: facename $type:$face contains unsupported derivation type.\n";
446 }
447
448 aio_load $dpath, my $png;
449 IO::AIO::aio_unlink $dpath unless $CACHE;
450 commit_png "$dir/$type:$face", "$type:$face", $png, $T;
451 }
397 452
398 # split all bigfaces, but avoid smoothfaces (*_S) 453 # split all bigfaces, but avoid smoothfaces (*_S)
399 if (($w > $T || $h > $T) && $face !~ /_S\./) { 454 if (($w > $T || $h > $T) && $face !~ /_S\./) {
400 # split 455 # split
401 my @tile; 456 my @tile;
406 push @tile, [$x, $y, $file, (stat _)[9]]; 461 push @tile, [$x, $y, $file, (stat _)[9]];
407 } 462 }
408 } 463 }
409 464
410 my $mtime = (lstat $path)[9]; 465 my $mtime = (lstat $path)[9];
411 my @todo = grep { $_->[3] <= $mtime } @tile; 466 my @todo = grep { $_->[3] < $mtime } @tile;
412 if (@todo) { 467 if (@todo) {
413 fork_exec { 468 fork_exec {
414 open my $convert, "|-", $CONVERT, 469 open my $convert, "|-", $CONVERT,
415 "png:-", 470 "png:-",
416 (map { 471 (map {
431 print $convert $png; 486 print $convert $png;
432 close $convert; 487 close $convert;
433 488
434 # pass 2, optimise, and rename 489 # pass 2, optimise, and rename
435 for (@todo) { 490 for (@todo) {
436 system $OPTIPNG, "-o5", "-i0", "-q", "$_->[2]~"; 491 optipng "$_->[2]~";
437 die "$_->[2]~ has zero size, aborting." unless -s "$_->[2]~";
438 rename "$_->[2]~", $_->[2]; 492 rename "$_->[2]~", $_->[2];
439 } 493 }
440 }; 494 };
441 } 495 }
442 496
453 } else { 507 } else {
454 # use as-is (either small, use smooth) 508 # use as-is (either small, use smooth)
455 commit_png $stem, $face, $png, $T; 509 commit_png $stem, $face, $png, $T;
456 } 510 }
457 511
458 aio_unlink $path if $delete; 512 IO::AIO::aio_unlink $path if $delete;
459 } 513 }
460 } 514 }
461 515
462 sub process_faceinfo { 516 sub process_faceinfo {
463 my ($dir, $file) = @_; 517 my ($dir, $file) = @_;
464 my $path = "$dir/$file"; 518 my $path = "$dir/$file";
465 519
466 my $data; 520 my $data;
467 if (0 > aio_load $path, $data) { 521 if (0 > aio_load $path, $data) {
468 warn "$path: $!, skipping.\n"; 522 warn "ERROR: $path: $!, skipping.\n";
469 return; 523 return;
470 } 524 }
471 525
472 for (split /\n/, $data) { 526 for (split /\n/, $data) {
473 chomp; 527 chomp;
479 $glyph =~ s/^"(.+)"$/$1/; # allow for ""-style quoting 533 $glyph =~ s/^"(.+)"$/$1/; # allow for ""-style quoting
480 534
481 $fg = "white" if $fg eq "none"; # lots of faces have no fg colour yet 535 $fg = "white" if $fg eq "none"; # lots of faces have no fg colour yet
482 536
483 (my $fgi = $COLOR{$fg}) 537 (my $fgi = $COLOR{$fg})
484 // warn "WARNING: $path: $face specifies unknown foreground colour '$fg'.\n"; 538 // warn "ERROR: $path: $face specifies unknown foreground colour '$fg'.\n";
485 (my $bgi = $COLOR{$bg}) 539 (my $bgi = $COLOR{$bg})
486 // warn "WARNING: $path: $face specifies unknown background colour '$bg'.\n"; 540 // warn "ERROR: $path: $face specifies unknown background colour '$bg'.\n";
487 541
488 my $fi = $FACEINFO{$face} ||= { }; 542 my $fi = $FACEINFO{$face} ||= { };
489 $fi->{visibility} = $visibility * 1; 543 $fi->{visibility} = $visibility * 1;
490 $fi->{magicmap} = $fgi; # foreground colour becomes magicmap 544 $fi->{magicmap} = $fgi; # foreground colour becomes magicmap
491 545
560 next if /^facings\s/; 614 next if /^facings\s/;
561 615
562 my $face = $_; 616 my $face = $_;
563 $face =~ s/\+\d+\+\d+$//; # remove tile offset coordinates 617 $face =~ s/\+\d+\+\d+$//; # remove tile offset coordinates
564 618
565 my $info = $FACEINFO{$face} ||= { }; 619 # handle derived faces
620 if ($face =~ /^([^:]+):(.*)/) {
621 my ($type, $base) = ($1, $2);
622 push @{ $FACEINFO{$base}{derive} }, [$dir, $type];
623 }
624
566 $info->{arc} = $o; 625 $FACEINFO{$face}{arc} = $o;
567 626
568 next if $face =~ /^blank.x11$|^empty.x11$/; 627 next if $face =~ /^blank.x11$|^empty.x11$/;
569 } 628 }
570 629
571 if (my $smooth = delete $o->{smoothface}) { 630 if (my $smooth = delete $o->{smoothface}) {
587 my ($dir, $file) = @_; 646 my ($dir, $file) = @_;
588 my $path = "$dir/$file"; 647 my $path = "$dir/$file";
589 648
590 my $trs; 649 my $trs;
591 if (0 > aio_load $path, $trs) { 650 if (0 > aio_load $path, $trs) {
592 warn "$path: $!, skipping.\n"; 651 warn "ERROR: $path: $!, skipping.\n";
593 return; 652 return;
594 } 653 }
595 654
596 $TRS .= $trs; 655 $TRS .= $trs;
597 } 656 }
602 unless (exists $FILECACHE{$_[0]}) { 661 unless (exists $FILECACHE{$_[0]}) {
603 my $data; 662 my $data;
604 if (0 < aio_load $_[0], $data) { 663 if (0 < aio_load $_[0], $data) {
605 if ($_[1]) { 664 if ($_[1]) {
606 $data = eval { $_[1]->($data) }; 665 $data = eval { $_[1]->($data) };
607 warn "$_[0]: $@" if $@; 666 warn "ERROR: $_[0]: $@" if $@;
608 } 667 }
609 } 668 }
610 669
611 $FILECACHE{$_[0]} = $data; 670 $FILECACHE{$_[0]} = $data;
612 } 671 }
626 my @plt; 685 my @plt;
627 my %map; 686 my %map;
628 687
629 for (split /\n/, $plt) { 688 for (split /\n/, $plt) {
630 next unless /\S/; 689 next unless /\S/;
690 next if /^\s*#/;
631 691
632 /^([0-9a-fA-F]{3,6})\s*(.*?)\s*$/ 692 /^([0-9a-fA-F]{3,6})\s*(.*?)\s*$/
633 or die "unparseable palette entry for $base.plt: $_"; 693 or die "unparseable palette entry for $base.plt: $_";
634 694
635 my ($rgb, $name) = ($1, $2); 695 my ($rgb, $name) = ($1, $2);
710 "cc/by/2.0" => "Licensed under Creative Commons Attribution 2.0 http://creativecommons.org/licenses/by/2.0/", 770 "cc/by/2.0" => "Licensed under Creative Commons Attribution 2.0 http://creativecommons.org/licenses/by/2.0/",
711 "cc/by/2.1" => "Licensed under Creative Commons Attribution 2.1 http://creativecommons.org/licenses/by/2.1/", 771 "cc/by/2.1" => "Licensed under Creative Commons Attribution 2.1 http://creativecommons.org/licenses/by/2.1/",
712 "cc/by/2.5" => "Licensed under Creative Commons Attribution 2.5 http://creativecommons.org/licenses/by/2.5/", 772 "cc/by/2.5" => "Licensed under Creative Commons Attribution 2.5 http://creativecommons.org/licenses/by/2.5/",
713 "cc/by/3.0" => "Licensed under Creative Commons Attribution 3.0 http://creativecommons.org/licenses/by/3.0/", 773 "cc/by/3.0" => "Licensed under Creative Commons Attribution 3.0 http://creativecommons.org/licenses/by/3.0/",
714 })->{$meta->{license}} 774 })->{$meta->{license}}
715 || warn "$dir/$file: license tag '$meta->{license}' not found."; 775 || warn "ERROR: $dir/$file: license tag '$meta->{license}' not found.";
716 } 776 }
717 777
718 if (!exists $meta->{author} && $meta->{source} =~ m%^http://www.jamendo.com/en/artist/(.*)$%) { 778 if (!exists $meta->{author} && $meta->{source} =~ m%^http://www.jamendo.com/en/artist/(.*)$%) {
719 ($meta->{author} = $1) =~ s/_/ /g; 779 ($meta->{author} = $1) =~ s/_/ /g;
720 } 780 }
731 $data = JSON::XS::encode_json JSON::XS->relaxed->utf8->decode ($data); 791 $data = JSON::XS::encode_json JSON::XS->relaxed->utf8->decode ($data);
732 } elsif ($filter eq "perl2json") { 792 } elsif ($filter eq "perl2json") {
733 $data = eval $data; die if $@; 793 $data = eval $data; die if $@;
734 $data = JSON::XS::encode_json $data; 794 $data = JSON::XS::encode_json $data;
735 } else { 795 } else {
736 warn "$dir/$file: unknown filter $filter, skipping\n"; 796 warn "ERROR: $dir/$file: unknown filter $filter, skipping\n";
737 } 797 }
738 } 798 }
739 799
740 substr $dir, 0, 1 + length $PATH, ""; 800 substr $dir, 0, 1 + length $PATH, "";
741 801
788 } else { 848 } else {
789 $c_any->put ([\&process_res, $path, $file, undef]); 849 $c_any->put ([\&process_res, $path, $file, undef]);
790 } 850 }
791 851
792 } elsif ($file =~ /\.png$/) { 852 } elsif ($file =~ /\.png$/) {
793 push @c_png, ["$path/$file", 0]; 853 $PNG{$file} = $path;
794 854
795 } elsif ($file =~ /\.faceinfo$/) { 855 } elsif ($file =~ /\.faceinfo$/) {
796 $c_any->put ([\&process_faceinfo, $path, $file]); 856 $c_any->put ([\&process_faceinfo, $path, $file]);
797 857
798 } elsif ($file =~ /\.trs$/) { 858 } elsif ($file =~ /\.trs$/) {
851 "Unless you run verbosely, all following warning\n", 911 "Unless you run verbosely, all following warning\n",
852 "or error messages indicate serious problems.\n", 912 "or error messages indicate serious problems.\n",
853 "\n"; 913 "\n";
854 914
855 if (!-d "$path/treasures") { 915 if (!-d "$path/treasures") {
856 warn "'$path' does not look like an arch directory ('treasures' directory is missing).\n"; 916 warn "FATAL: '$path' does not look like an arch directory ('treasures' directory is missing).\n";
857 exit 1 unless $FORCE; 917 exit 1 unless $FORCE;
858 } 918 }
859 919
860 print "start file scan, arc, any processing...\n" if $VERBOSE; 920 print "starting file scan, arc, any processing...\n" if $VERBOSE;
861 921
862 my @a_arc = map +(async \&process_arc), 1..2; 922 my @a_arc = map +(async \&process_arc), 1..2;
863 my @a_any = map +(async \&process_any), 1..4; 923 my @a_any = map +(async \&process_any), 1..4;
864 924
865 find_files $path; 925 find_files $path;
866 926
867 $c_arc->shutdown; 927 $c_arc->shutdown;
868 $c_any->shutdown; 928 $c_any->shutdown;
869 929
870 $_->join for @a_arc; # need to parse all archetypes before png processing 930 $_->join for @a_arc; # need to parse all archetypes before png processing
931 print "finished arc processing...\n" if $VERBOSE;
871 932
933 # fill png queue
934 for (keys %FACEINFO) {
935 # we only expect source pngs to exist for non-derived
936 # faces, i.e. no split tiles (+x+x) and no face derivates
937 # (xxx:)
938 /^[^:]+\....$/
939 or next;
940
941 my $seen;
942
943 if (exists $PNG{"$_.32x32.png"}) {
944 push @c_png, ["$PNG{\"$_.32x32.png\"}/$_.32x32.png"];
945 $seen = 1;
946 }
947 if (exists $PNG{"$_.64x64.png"}) {
948 push @c_png, ["$PNG{\"$_.64x64.png\"}/$_.64x64.png"];
949 $seen = 1;
950 }
951
952 warn "ERROR: $_: face not found, expect problems.\n"
953 unless $seen;
954 }
955
872 print "end arc, start png processing...\n" if $VERBOSE; 956 print "starting png processing...\n" if $VERBOSE;
873 957
874 # eight png crunchers work fine for my 4x smp machine 958 # eight png crunchers work fine for my 4x smp machine
875 my @a_png = map +(async \&process_png), 1..8; 959 my @a_png = map +(async \&process_png), 1..8;
876 960
877 print "end any processing...\n" if $VERBOSE;
878 $_->join for @a_any; 961 $_->join for @a_any;
879
880 print "end png processing...\n" if $VERBOSE; 962 print "finished any processing...\n" if $VERBOSE;
963
881 $_->join for @a_png; 964 $_->join for @a_png;
965 print "finished png processing...\n" if $VERBOSE;
882 966
883 print "scanning done, processing results...\n" if $VERBOSE; 967 print "scanning done, processing results...\n" if $VERBOSE;
884 { 968 {
885 # remove path prefix from editor_folder 969 # remove path prefix from editor_folder
886 $_->{editor_folder} =~ /^\x00/ 970 $_->{editor_folder} =~ /^\x00/
904 delete @s{qw(_name more name name_pl)}; 988 delete @s{qw(_name more name name_pl)};
905 %$o = ( %s, %$o ); 989 %$o = ( %s, %$o );
906 ++$progress; 990 ++$progress;
907 } 991 }
908 } else { 992 } else {
909 warn "WARNING: archetype '$o->{_name}' tries to inherit from undefined archetype '$other', skipping.\n"; 993 warn "ERROR: archetype '$o->{_name}' tries to inherit from undefined archetype '$other', skipping.\n";
910 delete $ARC{$o->{_name}}; 994 delete $ARC{$o->{_name}};
911 } 995 }
912 } 996 }
913 } 997 }
914 998
951 } 1035 }
952 1036
953 { 1037 {
954 print "processing facedata...\n" if $VERBOSE; 1038 print "processing facedata...\n" if $VERBOSE;
955 while (my ($k, $v) = each %FACEINFO) { 1039 while (my ($k, $v) = each %FACEINFO) {
956 length $v->{data32} or warn "WARNING: face '$k' has no png32. this will not work (shoddy gcfclient will crash of course).\n"; 1040 length $v->{data32} or warn "ERROR: face '$k' has no png32 - this will not work.\n";
957 length $v->{data64} or warn "WARNING: face '$k' has no png64. this will not work very well.\n"; 1041 length $v->{data64} or warn "ERROR: face '$k' has no png64 - this will not work.\n";
958 1042
959 make_hash $k, $v->{data32}, $v->{hash32}; 1043 make_hash $k, $v->{data32}, $v->{hash32};
960 make_hash $k, $v->{data64}, $v->{hash64}; 1044 make_hash $k, $v->{data64}, $v->{hash64};
961 1045
962 #length $v->{data32} <= 10000 or warn "WARNING: face '$k' has face32 larger than 10000 bytes, will not work with crossfire client.\n"; 1046 #length $v->{data32} <= 10000 or warn "WARNING: face '$k' has face32 larger than 10000 bytes, will not work with crossfire client.\n";
963 #length $v->{data64} <= 10000 or warn "WARNING: face '$k' has face64 larger than 10000 bytes.\n"; 1047 #length $v->{data64} <= 10000 or warn "WARNING: face '$k' has face64 larger than 10000 bytes.\n";
964 1048
965 $v->{glyph} // warn "WARNING: face '$k' has glyph."; 1049 $v->{glyph} // warn "ERROR: face '$k' has no glyph - missing faceinfo entry?\n";
966 $v->{visibility} // warn "WARNING: face '$k' has no visibility info, missing faceinfo entry?\n"; 1050 $v->{visibility} // warn "ERROR: face '$k' has no visibility info - missing faceinfo entry?\n";
967 $v->{magicmap} // warn "WARNING: face '$k' has foreground colour."; 1051 $v->{magicmap} // warn "ERROR: face '$k' has no foreground colour - missing faceinfo entry?\n";
968 1052
969 delete @$v{qw(arc stem)}; # not used by the server 1053 delete @$v{qw(arc stem derive)}; # not used by the server
970 } 1054 }
971 1055
972 print "processing resources...\n" if $VERBOSE; 1056 print "processing resources...\n" if $VERBOSE;
973 my $enc = JSON::XS->new->utf8->canonical->relaxed; 1057 my $enc = JSON::XS->new->utf8->canonical->relaxed;
974 while (my ($k, $v) = each %RESOURCE) { 1058 while (my ($k, $v) = each %RESOURCE) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines