… | |
… | |
156 | and die "map installation failed.\n"; |
156 | and die "map installation failed.\n"; |
157 | |
157 | |
158 | print "maps installed successfully.\n"; |
158 | print "maps installed successfully.\n"; |
159 | } |
159 | } |
160 | |
160 | |
|
|
161 | our %WALL_SUFFIX = ( |
|
|
162 | "0" => "⬤", |
|
|
163 | "1_3" => "╸", |
|
|
164 | "1_4" => "╺", |
|
|
165 | "2_1_2" => "━", |
|
|
166 | |
|
|
167 | "1_2" => "╹", |
|
|
168 | "2_2_4" => "┛", |
|
|
169 | "2_2_1" => "┗", |
|
|
170 | "3_1" => "┻", |
|
|
171 | |
|
|
172 | "1_1" => "╻", |
|
|
173 | "2_2_3" => "┓", |
|
|
174 | "2_2_2" => "┏", |
|
|
175 | "3_3" => "┳", |
|
|
176 | |
|
|
177 | "2_1_1" => "┃", |
|
|
178 | "3_4" => "┫", |
|
|
179 | "3_2" => "┣", |
|
|
180 | "4" => "╋", |
|
|
181 | ); |
|
|
182 | |
|
|
183 | sub autoglyph { |
|
|
184 | my ($stem, $face) = @_; |
|
|
185 | |
|
|
186 | if ($stem =~ /^wall\/|Nimwall/) { |
|
|
187 | while (my ($k, $v) = each %WALL_SUFFIX) { |
|
|
188 | return $v if $stem =~ /_$k.x11/; |
|
|
189 | } |
|
|
190 | |
|
|
191 | "+" |
|
|
192 | |
|
|
193 | } elsif ($stem =~ /^floor\/|^ground\/|Nimfloor/) { |
|
|
194 | "." |
|
|
195 | |
|
|
196 | } elsif ($stem =~ /^player\//) { |
|
|
197 | "\@" |
|
|
198 | |
|
|
199 | } else { |
|
|
200 | substr $stem, 0, 1 |
|
|
201 | } |
|
|
202 | } |
|
|
203 | |
161 | { |
204 | { |
162 | our %ANIMINFO; |
205 | our %ANIMINFO; |
163 | our %FACEINFO; |
206 | our %FACEINFO; |
164 | our %RESOURCE; |
207 | our %RESOURCE; |
165 | our @ARC; |
208 | our @ARC; |
… | |
… | |
174 | our $c_trs = new Coro::Channel; |
217 | our $c_trs = new Coro::Channel; |
175 | our $c_res = new Coro::Channel; |
218 | our $c_res = new Coro::Channel; |
176 | |
219 | |
177 | our @c_png; |
220 | our @c_png; |
178 | |
221 | |
179 | sub commit_png($$$) { |
222 | sub commit_png($$$$) { |
180 | my ($name, $data, $T) = @_; |
223 | my ($stem, $name, $data, $T) = @_; |
181 | |
224 | |
|
|
225 | $FACEINFO{$name}{"stem"} = substr $stem, 1 + length $PATH; |
182 | $FACEINFO{$name}{"data$T"} = $data; |
226 | $FACEINFO{$name}{"data$T"} = $data; |
183 | } |
227 | } |
184 | |
228 | |
185 | sub process_png { |
229 | sub process_png { |
186 | while (@c_png) { |
230 | while (@c_png) { |
… | |
… | |
404 | |
448 | |
405 | if (0 > aio_load $file, $tile) { |
449 | if (0 > aio_load $file, $tile) { |
406 | die "$path: unable to read tile +$x+$y, aborting.\n"; |
450 | die "$path: unable to read tile +$x+$y, aborting.\n"; |
407 | } |
451 | } |
408 | IO::AIO::aio_unlink $file unless $CACHE; |
452 | IO::AIO::aio_unlink $file unless $CACHE; |
409 | commit_png $x|$y ? "$face+$x+$y" : $face, $tile, $T; |
453 | commit_png $stem, $x|$y ? "$face+$x+$y" : $face, $tile, $T; |
410 | } |
454 | } |
411 | } else { |
455 | } else { |
412 | # use as-is (either small, use smooth) |
456 | # use as-is (either small, use smooth) |
413 | commit_png $face, $png, $T; |
457 | commit_png $stem, $face, $png, $T; |
414 | } |
458 | } |
415 | |
459 | |
416 | aio_unlink $path if $delete; |
460 | aio_unlink $path if $delete; |
417 | } |
461 | } |
418 | } |
462 | } |
… | |
… | |
433 | |
477 | |
434 | $o->{editor_folder} ||= "\x00$dir"; # horrible kludge |
478 | $o->{editor_folder} ||= "\x00$dir"; # horrible kludge |
435 | |
479 | |
436 | my $visibility = delete $o->{visibility}; |
480 | my $visibility = delete $o->{visibility}; |
437 | my $magicmap = delete $o->{magicmap}; |
481 | my $magicmap = delete $o->{magicmap}; |
|
|
482 | my $glyph = delete $o->{glyph}; |
438 | |
483 | |
439 | # find upper left corner :/ |
484 | # find upper left corner :/ |
440 | # omg, this is sooo broken |
485 | # omg, this is sooo broken |
441 | my ($dx, $dy); |
486 | my ($dx, $dy); |
442 | for (my $o = $o; $o; $o = $o->{more}) { |
487 | for (my $o = $o; $o; $o = $o->{more}) { |
… | |
… | |
452 | |
497 | |
453 | $o->{face} .= $ext unless /^blank.x11$|^empty.x11$/ || !$o->{face}; |
498 | $o->{face} .= $ext unless /^blank.x11$|^empty.x11$/ || !$o->{face}; |
454 | |
499 | |
455 | $visibility = delete $o->{visibility} if exists $o->{visibility}; |
500 | $visibility = delete $o->{visibility} if exists $o->{visibility}; |
456 | $magicmap = delete $o->{magicmap} if exists $o->{magicmap}; |
501 | $magicmap = delete $o->{magicmap} if exists $o->{magicmap}; |
|
|
502 | $glyph = delete $o->{glyph} if exists $o->{glyph}; |
457 | |
503 | |
458 | my $anim = delete $o->{anim}; |
504 | my $anim = delete $o->{anim}; |
459 | |
505 | |
460 | if ($anim) { |
506 | if ($anim) { |
461 | # possibly add $ext to the animation name to avoid |
507 | # possibly add $ext to the animation name to avoid |
… | |
… | |
492 | |
538 | |
493 | next if $face =~ /^blank.x11$|^empty.x11$/; |
539 | next if $face =~ /^blank.x11$|^empty.x11$/; |
494 | |
540 | |
495 | $info->{visibility} = $visibility if defined $visibility; |
541 | $info->{visibility} = $visibility if defined $visibility; |
496 | $info->{magicmap} = $magicmap if defined $magicmap; |
542 | $info->{magicmap} = $magicmap if defined $magicmap; |
|
|
543 | $info->{glyph} = $glyph if defined $glyph; |
497 | } |
544 | } |
498 | |
545 | |
499 | if (my $smooth = delete $o->{smoothface}) { |
546 | if (my $smooth = delete $o->{smoothface}) { |
500 | my %kv = split /\s+/, $smooth; |
547 | my %kv = split /\s+/, $smooth; |
501 | my $level = $o->{smoothlevel}; #TODO: delete from $o if !gcfclient-support |
548 | my $level = $o->{smoothlevel}; #TODO: delete from $o if !gcfclient-support |
… | |
… | |
570 | if ($meta->{license} =~ s/^#//) { |
617 | if ($meta->{license} =~ s/^#//) { |
571 | $meta->{license} = ({ |
618 | $meta->{license} = ({ |
572 | "pd" => "Public Domain", |
619 | "pd" => "Public Domain", |
573 | "gpl" => "GNU General Public License, version 3.0 or any later", |
620 | "gpl" => "GNU General Public License, version 3.0 or any later", |
574 | "cc/by/2.0" => "Licensed under Creative Commons Attribution 2.0 http://creativecommons.org/licenses/by/2.0/", |
621 | "cc/by/2.0" => "Licensed under Creative Commons Attribution 2.0 http://creativecommons.org/licenses/by/2.0/", |
|
|
622 | "cc/by/2.1" => "Licensed under Creative Commons Attribution 2.1 http://creativecommons.org/licenses/by/2.1/", |
575 | "cc/by/2.5" => "Licensed under Creative Commons Attribution 2.5 http://creativecommons.org/licenses/by/2.5/", |
623 | "cc/by/2.5" => "Licensed under Creative Commons Attribution 2.5 http://creativecommons.org/licenses/by/2.5/", |
576 | "cc/by/3.0" => "Licensed under Creative Commons Attribution 3.0 http://creativecommons.org/licenses/by/3.0/", |
624 | "cc/by/3.0" => "Licensed under Creative Commons Attribution 3.0 http://creativecommons.org/licenses/by/3.0/", |
577 | })->{$meta->{license}} |
625 | })->{$meta->{license}} |
578 | || warn "$dir/$file: license tag '$meta->{license}' not found."; |
626 | || warn "$dir/$file: license tag '$meta->{license}' not found."; |
|
|
627 | } |
|
|
628 | |
|
|
629 | if (!exists $meta->{author} && $meta->{source} =~ m%^http://www.jamendo.com/en/artist/(.*)$%) { |
|
|
630 | ($meta->{author} = $1) =~ s/_/ /g; |
579 | } |
631 | } |
580 | |
632 | |
581 | $file =~ s/\.res$//; |
633 | $file =~ s/\.res$//; |
582 | $file =~ s/\.(ogg|wav|jpg|png)$//; |
634 | $file =~ s/\.(ogg|wav|jpg|png)$//; |
583 | |
635 | |
… | |
… | |
791 | make_hash $k, $v->{data64}, $v->{hash64}; |
843 | make_hash $k, $v->{data64}, $v->{hash64}; |
792 | |
844 | |
793 | #length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n"; |
845 | #length $v->{data32} <= 10000 or warn "$k: face32 larger than 10000 bytes, will not work with crossfire client.\n"; |
794 | #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n"; |
846 | #length $v->{data64} <= 10000 or warn "$k: face64 larger than 10000 bytes.\n"; |
795 | |
847 | |
|
|
848 | my $stem = delete $v->{stem}; |
|
|
849 | $v->{glyph} //= autoglyph $stem, $v; |
|
|
850 | |
796 | if (my $magicmap = $v->{magicmap}) { |
851 | if (my $magicmap = $v->{magicmap}) { |
797 | $magicmap =~ y/A-Z_\-/a-z/d; |
852 | $magicmap =~ y/A-Z_\-/a-z/d; |
798 | $v->{magicmap} = $COLOR{$magicmap}; |
853 | $v->{magicmap} = $COLOR{$magicmap}; |
799 | } |
854 | } |
800 | |
855 | |