… | |
… | |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | # GNU General Public License for more details. |
14 | # GNU General Public License for more details. |
15 | # |
15 | # |
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 cfmaps; 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 | our $VERSION = '1.212'; |
20 | our $VERSION = '2.001'; |
21 | |
21 | |
22 | use Storable; |
22 | use Crossfire 1.0; |
23 | |
|
|
24 | my $LIBDIR = $ENV{CROSSFIRE_LIBDIR} |
|
|
25 | or die "\$CROSSFIRE_LIBDIR must be set\n"; |
|
|
26 | |
23 | |
27 | my $T = 32; |
24 | my $T = 32; |
28 | |
25 | |
29 | my $arch; |
26 | my $arch; |
30 | |
27 | |
… | |
… | |
32 | local $_ = shift; |
29 | local $_ = shift; |
33 | s/([<>&])/sprintf "&#%d;", ord $1/ge; |
30 | s/([<>&])/sprintf "&#%d;", ord $1/ge; |
34 | $_ |
31 | $_ |
35 | } |
32 | } |
36 | |
33 | |
|
|
34 | my @cfmap2png; |
|
|
35 | |
37 | for my $path (@ARGV) { |
36 | for my $path (@ARGV) { |
38 | (my $base = $path) =~ s/\.map//; |
37 | (my $base = $path) =~ s/\.map//; |
39 | # print STDERR "$path\n"; |
38 | # print STDERR "$path\n"; |
40 | |
39 | |
41 | if (!-e "$base.png" |
40 | if (!-e "$base.png" |
42 | || !-e "$base.pst" |
41 | || !-e "$base.pst" |
43 | || -M "$base.pst" > -M $path |
42 | || -M "$base.pst" > -M $path |
44 | || -M "$base.png" > -M $path) { |
43 | || -M "$base.png" > -M $path) { |
45 | # regenerate png and metainfo |
44 | # regenerate png and metainfo |
|
|
45 | push @cfmap2png, $path; |
|
|
46 | }; |
|
|
47 | } |
46 | |
48 | |
47 | system "cfmap2png", $path; |
49 | system "cfmap2png", @cfmap2png |
48 | }; |
50 | if @cfmap2png; |
49 | |
51 | |
|
|
52 | for my $path (@ARGV) { |
|
|
53 | (my $base = $path) =~ s/\.map//; |
50 | if (!-e "$base.xhtml" |
54 | if (!-e "$base.xhtml" |
51 | || -M "$base.xhtml" > -M "$base.pst") { |
55 | || -M "$base.xhtml" > -M "$base.pst") { |
52 | $arch ||= Storable::retrieve "$LIBDIR/archetypes.pst"; |
56 | |
|
|
57 | Crossfire::load_archetypes |
|
|
58 | unless %ARCH; |
|
|
59 | |
53 | my $meta = Storable::retrieve "$base.pst"; |
60 | my $meta = Storable::retrieve "$base.pst"; |
54 | |
61 | |
55 | open my $fh, ">:utf8", "$path.xhtml" |
62 | open my $fh, ">:utf8", "$base.xhtml" |
56 | or die "$path.xhtml: $!"; |
63 | or die "$base.xhtml: $!"; |
57 | |
64 | |
58 | select $fh; |
65 | select $fh; |
59 | |
66 | |
60 | my $W = $meta->{width} * $T; |
67 | my $W = $meta->{width} * $T; |
61 | my $H = $meta->{height} * $T; |
68 | my $H = $meta->{height} * $T; |
62 | |
69 | |
63 | my $W2 = $W + 600; |
70 | my $W2 = $W + 600; |
64 | |
71 | |
65 | my (@path) = split /\//, $path; |
72 | my (@path) = split /\//, $base; |
66 | |
73 | |
67 | print "<?xml version='1.0' encoding='utf-8'?>", |
74 | print "<?xml version='1.0' encoding='utf-8'?>", |
68 | '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">', |
75 | '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">', |
69 | "<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>", |
76 | "<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>", |
70 | "<head>", |
77 | "<head>", |