… | |
… | |
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 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 | our $VERSION = '1.2'; |
20 | our $VERSION = '1.21'; |
21 | |
21 | |
22 | use Storable; |
22 | use Storable; |
23 | |
23 | |
24 | my $LIBDIR = $ENV{CROSSFIRE_LIBDIR} |
24 | my $LIBDIR = $ENV{CROSSFIRE_LIBDIR} |
25 | or die "\$CROSSFIRE_LIBDIR must be set\n"; |
25 | or die "\$CROSSFIRE_LIBDIR must be set\n"; |
… | |
… | |
60 | my $W2 = $W + 600; |
60 | my $W2 = $W + 600; |
61 | |
61 | |
62 | my (@path) = split /\//, $path; |
62 | my (@path) = split /\//, $path; |
63 | |
63 | |
64 | print "<?xml version='1.0' encoding='utf-8'?>", |
64 | print "<?xml version='1.0' encoding='utf-8'?>", |
65 | "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">", |
65 | '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">', |
66 | "<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>", |
66 | "<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en'>", |
67 | "<head>", |
67 | "<head>", |
68 | "<title>Crossfire Map \"$path\"</title>", |
68 | "<title>Crossfire Map \"$path\"</title>", |
69 | "<link rel='stylesheet' type='text/css' media='all' href='/common.css'/>\n", |
69 | "<link rel='stylesheet' type='text/css' media='all' href='/common.css'/>\n", |
70 | "<link rel='stylesheet' type='text/css' media='all' href='/overlay.css' title='Show Overlays'/>\n", |
70 | "<link rel='stylesheet' type='text/css' media='all' href='/overlay.css' title='Show Overlays'/>\n", |
… | |
… | |
119 | print "<tr>"; |
119 | print "<tr>"; |
120 | for my $x (0.. $meta->{width} - 1) { |
120 | for my $x (0.. $meta->{width} - 1) { |
121 | if (my $as = $meta->{map}[$x][$y]) { |
121 | if (my $as = $meta->{map}[$x][$y]) { |
122 | my @class; |
122 | my @class; |
123 | |
123 | |
124 | push @class, "fishy" if grep $_->{invisible} || $_->{face} || exists $_->{no_pass}, @$as; |
124 | push @class, "fishy" if grep $_->{invisible} || $_->{face} || exists $_->{no_pass} || exists $_->{no_pick}, @$as; |
125 | push @class, "exit" if grep $is_exit{$arch->{$_->{_name}}{type}} && $_->{slaying}, @$as; |
125 | push @class, "exit" if grep $is_exit{$arch->{$_->{_name}}{type}} && $_->{slaying}, @$as; |
|
|
126 | push @class, "dialog" if grep $_->{msg} =~ /^\@match/m, @$as; |
126 | |
127 | |
127 | print "<td", (@class ? " class='" . (join " ", @class) . "'" : ""), ">"; |
128 | print "<td", (@class ? " class='" . (join " ", @class) . "'" : ""), ">"; |
128 | print "<div>"; |
129 | print "<div>"; |
129 | |
130 | |
130 | print join "\n", map "<span class='c'>$_</span>", |
131 | print join "\n", map "<span class='c'>$_</span>", |
… | |
… | |
139 | my $o = $arch->{$a->{_name}}; |
140 | my $o = $arch->{$a->{_name}}; |
140 | my $type = $a->{type} || $o->{type}; |
141 | my $type = $a->{type} || $o->{type}; |
141 | my $aname = escape_html $a->{_name}; |
142 | my $aname = escape_html $a->{_name}; |
142 | my $name = escape_html $a->{name} || $o->{name}; |
143 | my $name = escape_html $a->{name} || $o->{name}; |
143 | |
144 | |
144 | print "<li><a href='/arc.xhtml#", (lc $a->{_name}), "'>$aname \"$name\"</a>\n"; |
145 | print "<li><a href='/a/$a->{_name}'>$aname \"$name\"</a>\n"; |
145 | for (sort keys %$a) { |
146 | for (sort keys %$a) { |
146 | next if $ignore{$_}; |
147 | next if $ignore{$_}; |
147 | my $v = escape_html $a->{$_}; |
148 | my $v = escape_html $a->{$_}; |
148 | |
149 | |
149 | if ($_ eq "slaying" && $is_exit{$type}) { # door, teleporter, player_changer |
150 | if ($_ eq "slaying" && $is_exit{$type}) { # door, teleporter, player_changer |
150 | $a->{msg} =~ /^final_map\s*(\S+)\s*$/m, $v = $1 |
151 | $a->{msg} =~ /^final_map\s*(\S+)\s*$/m, $v = $1 |
151 | if $v eq "/!"; # random map |
152 | if $v eq "/!"; # random map |
152 | |
153 | |
153 | print "slaying => <a href='$v.xhtml'>$v</a>\n"; |
154 | print "slaying => <a href='$v.xhtml'>$v</a>\n"; |
154 | } elsif ($_ eq "other_arch") { |
155 | } elsif ($_ eq "other_arch") { |
155 | print "$_ => <a href='/arc.xhtml#", (lc $a->{$_}), "'>$v</a>\n"; |
156 | print "$_ => <a href='/a/$a->{$_}'>$v</a>\n"; |
156 | } elsif ($_ eq "inventory") { |
157 | } elsif ($_ eq "inventory") { |
157 | print "inventory =>\n"; |
158 | print "inventory =>\n"; |
158 | print_archs ($a->{$_}); |
159 | print_archs ($a->{$_}); |
159 | } elsif ($_ eq "msg") { |
160 | } elsif ($_ eq "msg") { |
160 | print "<p class='m'>$v</p>"; |
161 | print "<p class='m'>$v</p>"; |
… | |
… | |
179 | print "</table><p class='footer'>created by <a href='http://software.schmorp.de/#crossfire'>cfmap2html</a> version $VERSION</p>", |
180 | print "</table><p class='footer'>created by <a href='http://software.schmorp.de/#crossfire'>cfmap2html</a> version $VERSION</p>", |
180 | "<p class='enlarge'/></body></html>"; |
181 | "<p class='enlarge'/></body></html>"; |
181 | |
182 | |
182 | close $fh; |
183 | close $fh; |
183 | |
184 | |
184 | system "gzip", "-7f", "$path.xhtml"; |
185 | #system "gzip", "-7f", "$path.xhtml"; |
185 | } |
186 | } |
186 | |
187 | |