--- cfmaps/cfmap2html 2005/11/18 11:15:53 1.4
+++ cfmaps/cfmap2html 2005/11/18 12:04:12 1.5
@@ -11,6 +11,8 @@
umask 022;
+our $VERSION = '1.0';
+
sub escape_html($) {
local $_ = shift;
s/([<>&])/sprintf "%d;", ord $1/ge;
@@ -18,7 +20,7 @@
}
for my $path (@ARGV) {
- print "$path\n";
+# print STDERR "$path\n";
if (!-e "$path.png"
|| !-e "$path.pst"
@@ -75,7 +77,7 @@
"
";
print "",
- "";
+ "";
print "/ ";
for (0 .. $#path - 1) {
print "$path[$_] / ";
@@ -86,19 +88,21 @@
? ""
: ""
} 1..4;
+ #"}"# vim misparses without this comment
- print "$path[-1] ";
- print " | ",
+ print "$path[-1]",
+ "",
+ "[more about cfmaps.schmorp.de] ",
+ "",
" | $tile[0] | | ",
- "$tile[3] | ";
- print " | ",
+ " $tile[3] | ",
+ " | ",
"$tile[1] | ",
- " | $tile[2] | | ";
- print " |
";
+ " | $tile[2] | |
",
+ "";
my $W1 = $W + 600;
- print "[about cfmaps.schmorp.de]
";
print "",
escape_html $meta->{info}{msg},
"
";
@@ -112,34 +116,47 @@
for my $x (0.. $meta->{width} - 1) {
print "";
if (my $as = $meta->{map}[$x][$y]) {
- print "($x|$y) ";
- for my $a (@$as) {
- my $o = $arch->{$a->{_name}};
- print "- \"$o->{name}\" ($a->{_name})\n";
- for (sort keys %$a) {
- next if $ignore{$_};
- my $v = escape_html $a->{$_};
-
- if (($o->{type} == 66 || $o->{type} == 41) && $_ eq "slaying") { # door, teleporter
- $a->{msg} =~ /^final_map\s*(\S+)\s*$/m, $v = $1
- if $v eq "/!"; # random map
-
- print "slaying => $v\n";
- } elsif ($_ eq "msg") {
- print "
$v ";
- } else {
- print "$_ => $v\n";
+ print "($x|$y)";
+
+ sub print_archs {
+ print " ";
+ for my $a (@{$_[0]}) {
+ my $o = $arch->{$a->{_name}};
+ print "- \"$o->{name}\" ($a->{_name})\n";
+ for (sort keys %$a) {
+ next if $ignore{$_};
+ my $v = escape_html $a->{$_};
+
+ if (($o->{type} == 66 || $o->{type} == 41) && $_ eq "slaying") { # door, teleporter
+ $a->{msg} =~ /^final_map\s*(\S+)\s*$/m, $v = $1
+ if $v eq "/!"; # random map
+
+ print "slaying => $v\n";
+ } elsif ($_ eq "other_arch") {
+ print "$_ => $v\n";
+ } elsif ($_ eq "inventory") {
+ print "inventory =>\n";
+ print_archs ($a->{$_});
+ } elsif ($_ eq "msg") {
+ print "
$v ";
+ } else {
+ print "$_ => $v\n";
+ }
}
}
+ print " ";
}
- print " ";
+
+ print_archs $as;
+ print " ";
}
print " | ";
}
print "";
}
- print "