--- cfmaps/cfmap2png 2005/11/30 08:05:59 1.15 +++ cfmaps/cfmap2png 2005/12/12 01:37:11 1.16 @@ -18,9 +18,8 @@ # Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # tower of stars: missing craters? -# world_108_123 (8|18), hole below grass but shouldn't? -our $VERSION = '1.11'; +our $VERSION = '1.2'; use strict; @@ -77,6 +76,7 @@ } Storable::nstore \%smooth, "$path.pst"; + utime +(stat $path)[8,9], "$path.pst"; \%smooth } @@ -154,8 +154,10 @@ undef $parse_block; # work around bug in perl not freeing $fh etc. - Storable::nstore \%arc, "$path.pst" - if $cache; + if ($cache) { + Storable::nstore \%arc, "$path.pst"; + utime +(stat $path)[8,9], "$path.pst"; + } \%arc } @@ -225,7 +227,9 @@ my $col = $map->[$x]; for my $y (0 .. $mapy - 1) { my $as = $col->[$y] || []; - + + my $minsmooth = 0; + for my $layer (0 .. $#$as) { my $a = $as->[$layer]; @@ -233,10 +237,16 @@ or (warn "$mapname: arch '$a->{_name}' not found at ($x|$y)\n"), next; my $smoothlevel = exists $a->{smoothlevel} ? $a->{smoothlevel} : $o->{smoothlevel}; - my $is_floor = exists $a->{is_floor} ? $a->{is_floor} : $o->{is_floor}; - my $level = $smoothlevel ? $smoothlevel - : $is_floor ? $layer - 1000 - : $layer + 1000; + + # hack to ensure somewhat correct ordering in case of conflicting + # smoothlevel/stacking order + $smoothlevel = $minsmooth + 0.01 if $minsmooth >= $smoothlevel; + $minsmooth = $smoothlevel; + + #my $is_floor = exists $a->{is_floor} ? $a->{is_floor} : $o->{is_floor}; + my $level = $smoothlevel + $layer * 256; + + $level -= 100 * 256 if $o->{_name} eq "blocked"; while ($o) { my $face = $a->{face} || $o->{face}; @@ -280,6 +290,7 @@ } $o = $o->{more}; + $level = ($layer + 1000) * 2; # put "big things" on top, no matter what } } } @@ -366,13 +377,16 @@ for my $file (@ARGV) { my $mapa = read_arch $file; my ($pb, $meta) = cfmap_render $mapa, $file; - $pb->save ("$file.png~", "png"); - system "convert", "$file.png~", "-filter" => "lanczos", "-geometry" => "3.125%", "-quality" => 85, "$file.jpg"; + $pb->save ("$file.png~~", "png"); + system "convert", "$file.png~~", "-filter" => "lanczos", "-geometry" => "3.125%", "-quality" => 85, "$file.jpg"; #system "mogrify", "-colors" => 65536, "$file.png~"; # destroys transparency - system "pngcrush", "-q", "-m" => 7, "-rem", "alla", "-cc", "-reduce", "$file.png~", "$file.png"; + system "pngcrush", "-q", "-m" => 7, "-rem", "alla", "-cc", "-reduce", "$file.png~~", "$file.png~"; # system "pngnq <\Q$file.png~\E >\Q$file.png\E"; - unlink "$file.png~"; + unlink "$file.png~~"; Storable::nstore $meta, "$file.pst"; + utime +(stat $file)[8,9], "$file.pst"; + utime +(stat $file)[8,9], "$file.png~"; + rename "$file.png~", "$file.png"; }