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

Comparing cfmaps/cfmap2html (file contents):
Revision 1.12 by root, Sun Nov 20 05:02:58 2005 UTC vs.
Revision 1.13 by root, Sun Nov 20 08:04:19 2005 UTC

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
20our $VERSION = '1.12'; 20our $VERSION = '1.2';
21 21
22use Storable; 22use Storable;
23 23
24my $LIBDIR = $ENV{CROSSFIRE_LIBDIR} 24my $LIBDIR = $ENV{CROSSFIRE_LIBDIR}
25 or die "\$CROSSFIRE_LIBDIR must be set\n"; 25 or die "\$CROSSFIRE_LIBDIR must be set\n";
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",
71 "<link rel='alternate stylesheet' type='text/css' media='all' href='/plain.css' title='Hide Overlays'/>\n",
70 "<style type='text/css'>\n", 72 "<style type='text/css'>\n",
71 ".map { width: ${W}px; height: ${H}px; background-image: url($path[-1].png); }\n", 73 ".map { width: ${W}px; height: ${H}px; background-image: url($path[-1].png); }\n",
72 ".enlarge { width: ${W2}px; height: 600px; }\n", 74 ".enlarge { width: ${W2}px; height: 600px; }\n",
73 "</style>", 75 "</style>",
74 "</head>", 76 "</head>",
109 "</p>"; 111 "</p>";
110 112
111 print "<table class='map'>"; 113 print "<table class='map'>";
112 114
113 my %ignore = map +($_ => 1), qw(name _name x y); 115 my %ignore = map +($_ => 1), qw(name _name x y);
116 my %is_exit = map +($_ => 1), 41, 57, 66;
114 117
115 for my $y (0.. $meta->{height} - 1) { 118 for my $y (0.. $meta->{height} - 1) {
116 print "<tr>"; 119 print "<tr>";
117 for my $x (0.. $meta->{width} - 1) { 120 for my $x (0.. $meta->{width} - 1) {
118 print "<td>";
119 if (my $as = $meta->{map}[$x][$y]) { 121 if (my $as = $meta->{map}[$x][$y]) {
122 my @class;
123
124 push @class, "fishy" if grep $_->{invisible} || $_->{face} || exists $_->{no_pass}, @$as;
125 push @class, "exit" if grep $is_exit{$arch->{$_->{_name}}{type}}, @$as;
126
127 my @connected = grep $_, map $_->{connected}, @$as;
128
129 print "<td", (@class ? " class='" . (join " ", @class) . "'" : ""), ">";
130 print "<div>";
131 print "<span class='c'>", (join ", ", @connected), "</span>" if @connected;
120 print "<div><div>($x|$y)"; 132 print "<div>($x|$y)";
121 133
122 sub print_archs { 134 sub print_archs {
123 print "<ul>"; 135 print "<ul>";
124 for my $a (@{$_[0]}) { 136 for my $a (@{$_[0]}) {
125 my $o = $arch->{$a->{_name}}; 137 my $o = $arch->{$a->{_name}};
130 print "<li><a href='/arc.xhtml#", (lc $a->{_name}), "'>$aname \"$name\"</a>\n"; 142 print "<li><a href='/arc.xhtml#", (lc $a->{_name}), "'>$aname \"$name\"</a>\n";
131 for (sort keys %$a) { 143 for (sort keys %$a) {
132 next if $ignore{$_}; 144 next if $ignore{$_};
133 my $v = escape_html $a->{$_}; 145 my $v = escape_html $a->{$_};
134 146
135 if ($_ eq "slaying" && ($type == 41 || $type == 57 || $type == 66)) { # door, teleporter, player_changer 147 if ($_ eq "slaying" && $is_exit{$type}) { # door, teleporter, player_changer
136 $a->{msg} =~ /^final_map\s*(\S+)\s*$/m, $v = $1 148 $a->{msg} =~ /^final_map\s*(\S+)\s*$/m, $v = $1
137 if $v eq "/!"; # random map 149 if $v eq "/!"; # random map
138 150
139 print "slaying => <a href='$v.xhtml'>$v</a>\n"; 151 print "slaying => <a href='$v.xhtml'>$v</a>\n";
140 } elsif ($_ eq "other_arch") { 152 } elsif ($_ eq "other_arch") {
152 } 164 }
153 print "</ul>"; 165 print "</ul>";
154 } 166 }
155 167
156 print_archs $as; 168 print_archs $as;
157 print "</div></div>"; 169 print "</div></div></td>";
170 } else {
171 print "<td/>";
158 } 172 }
159 print "</td>";
160 } 173 }
161 print "</tr>"; 174 print "</tr>";
162 } 175 }
163 176
164 print "</table><p class='footer'>created by <a href='http://software.schmorp.de/#crossfire'>cfmap2html</a> version $VERSION</p>", 177 print "</table><p class='footer'>created by <a href='http://software.schmorp.de/#crossfire'>cfmap2html</a> version $VERSION</p>",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines