1 | #!/opt/bin/perl |
1 | #!/opt/bin/perl |
2 | |
2 | |
|
|
3 | # cfarch2png - convert crossfire maps to png+metadata |
|
|
4 | # Copyright (C) 2005 Marc Lehmann <gvpe@schmorp.de> |
|
|
5 | # |
|
|
6 | # CFARCH2PNG is free software; you can redistribute it and/or modify |
|
|
7 | # it under the terms of the GNU General Public License as published by |
|
|
8 | # the Free Software Foundation; either version 2 of the License, or |
|
|
9 | # (at your option) any later version. |
|
|
10 | # |
|
|
11 | # This program is distributed in the hope that it will be useful, |
|
|
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
14 | # GNU General Public License for more details. |
|
|
15 | # |
|
|
16 | # You should have received a copy of the GNU General Public License |
|
|
17 | # along with gvpe; if not, write to the Free Software |
|
|
18 | # Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
|
19 | |
3 | # tower of stars: missing craters? |
20 | # tower of stars: missing craters? |
|
|
21 | |
|
|
22 | our $VERSION = '1.01'; |
4 | |
23 | |
5 | use strict; |
24 | use strict; |
6 | |
25 | |
7 | use Storable; |
26 | use Storable; |
8 | use List::Util qw(max); |
27 | use List::Util qw(max); |
9 | |
28 | |
10 | use Gtk2; |
29 | use Gtk2; |
11 | |
|
|
12 | our $VERSION = '1.0'; |
|
|
13 | |
30 | |
14 | #init Gtk2::Gdk; |
31 | #init Gtk2::Gdk; |
15 | |
32 | |
16 | my $LIB = $ENV{CROSSFIRE_LIBDIR} |
33 | my $LIB = $ENV{CROSSFIRE_LIBDIR} |
17 | or die "\$CROSSFIRE_LIBDIR must be set\n"; |
34 | or die "\$CROSSFIRE_LIBDIR must be set\n"; |
… | |
… | |
262 | } |
279 | } |
263 | } |
280 | } |
264 | |
281 | |
265 | my $map_pb = new Gtk2::Gdk::Pixbuf "rgb", 1, 8, $mapx * T, $mapy * T |
282 | my $map_pb = new Gtk2::Gdk::Pixbuf "rgb", 1, 8, $mapx * T, $mapy * T |
266 | or die; |
283 | or die; |
267 | $map_pb->fill (0x00000000); |
284 | $map_pb->fill (0xffffff00); |
268 | |
285 | |
269 | # second pass, render all the stuff |
286 | # second pass, render all the stuff |
270 | for my $level (sort { $a <=> $b } keys %draw_info) { |
287 | for my $level (sort { $a <=> $b } keys %draw_info) { |
271 | my $v = $draw_info{$level}; |
288 | my $v = $draw_info{$level}; |
272 | while (my ($sface, $info) = each %$v) { |
289 | while (my ($sface, $info) = each %$v) { |