ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cfmaps/cfmap2png
(Generate patch)

Comparing cfmaps/cfmap2png (file contents):
Revision 1.10 by root, Sun Nov 20 01:31:21 2005 UTC vs.
Revision 1.14 by root, Mon Nov 28 13:19:12 2005 UTC

16# You should have received a copy of the GNU General Public License 16# You should have received a copy of the GNU General Public License
17# along with gvpe; if not, write to the Free Software 17# along with gvpe; if not, write to the Free Software
18# Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18# Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 19
20# tower of stars: missing craters? 20# tower of stars: missing craters?
21# world_108_123 (8|18), hole below grass but shouldn't?
21 22
22our $VERSION = '1.1'; 23our $VERSION = '1.11';
23 24
24use strict; 25use strict;
25 26
26use Storable; 27use Storable;
27use List::Util qw(max); 28use List::Util qw(max);
232 or (warn "$mapname: arch '$a->{_name}' not found at ($x|$y)\n"), next; 233 or (warn "$mapname: arch '$a->{_name}' not found at ($x|$y)\n"), next;
233 234
234 my $smoothlevel = exists $a->{smoothlevel} ? $a->{smoothlevel} : $o->{smoothlevel}; 235 my $smoothlevel = exists $a->{smoothlevel} ? $a->{smoothlevel} : $o->{smoothlevel};
235 my $is_floor = exists $a->{is_floor} ? $a->{is_floor} : $o->{is_floor}; 236 my $is_floor = exists $a->{is_floor} ? $a->{is_floor} : $o->{is_floor};
236 my $level = $smoothlevel ? $smoothlevel 237 my $level = $smoothlevel ? $smoothlevel
237 : $is_floor ? 0 238 : $is_floor ? $layer - 1000
238 : 256 + $layer; 239 : $layer + 1000;
239 240
240 while ($o) { 241 while ($o) {
241 my $face = $a->{face} || $o->{face}; 242 my $face = $a->{face} || $o->{face};
242 243
243 my $pb = tile $face 244 my $pb = tile $face
299 my ($x, $y) = split $;, $xy; 300 my ($x, $y) = split $;, $xy;
300 301
301 next if $x < 0 || $x >= $mapx 302 next if $x < 0 || $x >= $mapx
302 || $y < 0 || $y >= $mapy; 303 || $y < 0 || $y >= $mapy;
303 304
304 # bits is 00XX XXXX YYYY YYFX cccc CCCC BBBB 305 # bits is xxxx xxxx yyyy yyyy __fn cccc CCCC bbbb
305 # X don't draw
306 # F full tile draw with x|y bigface displacement 306 # f full tile draw with x|y bigface displacement
307 # c maybe draw these corners
308 # C do not draw these corners 307 # n do not draw borders&corners
308 # c draw these corners, but...
309 # C ... not these
309 # b draw these borders 310 # b draw these borders
310 311
311 if ($bits & 0x2000) { 312 if ($bits & 0x2000) {
312 my $dx = (($bits >> 24) & 0xff) - 128; 313 my $dx = (($bits >> 24) & 0xff) - 128;
313 my $dy = (($bits >> 16) & 0xff) - 128; 314 my $dy = (($bits >> 16) & 0xff) - 128;
366 my $mapa = read_arch $file; 367 my $mapa = read_arch $file;
367 my ($pb, $meta) = cfmap_render $mapa, $file; 368 my ($pb, $meta) = cfmap_render $mapa, $file;
368 $pb->save ("$file.png~", "png"); 369 $pb->save ("$file.png~", "png");
369 system "convert", "$file.png~", "-filter" => "lanczos", "-geometry" => "3.125%", "-quality" => 85, "$file.jpg"; 370 system "convert", "$file.png~", "-filter" => "lanczos", "-geometry" => "3.125%", "-quality" => 85, "$file.jpg";
370 #system "mogrify", "-colors" => 65536, "$file.png~"; # destroys transparency 371 #system "mogrify", "-colors" => 65536, "$file.png~"; # destroys transparency
371 system "pngcrush", "-q", "-m" => 7, "-rem", "alla", "-cc", "-reduce", "$file.png~", "$file.png"; 372# system "pngcrush", "-q", "-m" => 7, "-rem", "alla", "-cc", "-reduce", "$file.png~", "$file.png";
373 system "pngnq <\Q$file.png~\E >\Q$file.png\E";
372 unlink "$file.png~"; 374 unlink "$file.png~";
373 Storable::nstore $meta, "$file.pst"; 375 Storable::nstore $meta, "$file.pst";
374} 376}
375 377
376 378

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines