… | |
… | |
177 | |
177 | |
178 | # reduce smoothfaces >10000 bytes |
178 | # reduce smoothfaces >10000 bytes |
179 | if ($stem =~ /_S\./ && (-s "$other~") > 10000) { |
179 | if ($stem =~ /_S\./ && (-s "$other~") > 10000) { |
180 | my $ncolor = 256; |
180 | my $ncolor = 256; |
181 | while () { |
181 | while () { |
182 | system "<\Q$other~\E $PNGNQ -n$ncolor >\Q$other~~\E"; |
182 | system "<\Q$other~\E $PNGNQ -s1 -n$ncolor >\Q$other~~\E"; |
183 | system $OPTIPNG, "-i0", "-q", "$other~~"; |
183 | system $OPTIPNG, "-i0", "-q", "$other~~"; |
184 | last if 10000 > -s "$other~~"; |
184 | last if 10000 > -s "$other~~"; |
185 | $ncolor = int $ncolor * 0.9; |
185 | $ncolor = int $ncolor * 0.9; |
186 | $ncolor > 8 or die "cannot reduce filesize to < 10000 bytes"; |
186 | $ncolor > 8 or die "cannot reduce filesize to < 10000 bytes"; |
187 | } |
187 | } |
188 | |
188 | |
189 | printf "reduced %s from %d to %d bytes using %d colours.\n", |
189 | printf "reduced %s from %d to %d bytes using %d colours.\n", |
190 | $other, -s "$other~", -s "$other~~", $ncolor |
190 | $other, -s "$other~", -s "$other~~", $ncolor |
191 | if $VERBOSE > 0; |
191 | if $VERBOSE >= 2; |
192 | rename "$other~~", "$other~"; |
192 | rename "$other~~", "$other~"; |
193 | } |
193 | } |
194 | |
194 | |
195 | die "$other~ has zero size, aborting." unless -s "$other~"; |
195 | die "$other~ has zero size, aborting." unless -s "$other~"; |
196 | rename "$other~", $other; |
196 | rename "$other~", $other; |
… | |
… | |
386 | } elsif ($file =~ /\.trs$/) { |
386 | } elsif ($file =~ /\.trs$/) { |
387 | push @trs, [$path, $file]; |
387 | push @trs, [$path, $file]; |
388 | } elsif ($file =~ /\.arc$/) { |
388 | } elsif ($file =~ /\.arc$/) { |
389 | push @arc, [$path, $file]; |
389 | push @arc, [$path, $file]; |
390 | } else { |
390 | } else { |
391 | warn "ignoring $path/$file\n" if $VERBOSE >= 2; |
391 | warn "ignoring $path/$file\n" if $VERBOSE >= 3; |
392 | } |
392 | } |
393 | } |
393 | } |
394 | }; |
394 | }; |
395 | } |
395 | } |
396 | |
396 | |
… | |
… | |
457 | |
457 | |
458 | last; |
458 | last; |
459 | } |
459 | } |
460 | } |
460 | } |
461 | |
461 | |
|
|
462 | # remove base classes (by naming scheme, should use something like "baseclass xxx" to inherit |
|
|
463 | @ARC = grep $_->{_name} !~ /^(?:type|class)_/, @ARC; |
|
|
464 | |
462 | open my $fh, ">:utf8", "$DATADIR/archetypes~" |
465 | open my $fh, ">:utf8", "$DATADIR/archetypes~" |
463 | or die "$DATADIR/archetypes~: $!"; |
466 | or die "$DATADIR/archetypes~: $!"; |
464 | print $fh Crossfire::archlist_to_string [sort { $a->{_name} cmp $b->{_name} } @ARC]; |
467 | print $fh Crossfire::archlist_to_string [sort { $a->{_name} cmp $b->{_name} } @ARC]; |
465 | } |
468 | } |
466 | |
469 | |