--- cfmaps/cfmap2png 2005/11/17 11:51:08 1.1 +++ cfmaps/cfmap2png 2005/11/17 12:15:19 1.2 @@ -204,17 +204,23 @@ for my $layer (0 .. $#$as) { my $a = $as->[$layer]; - my $o = $arch->{$a->{_name}} - or (warn "$mapname: arch '$a->{_name}' not found at ($x|$y)\n"), next; + my $o = $a; + delete $o->{x}; + delete $o->{y}; - $o = $arch->{$o->{other_arch}} while $o->{other_arch} && !$o->{face}; + my $os = $arch->{$a->{_name}} + or (warn "$mapname: arch '$a->{_name}' not found at ($x|$y)\n"), next; - $o or die "arch $a->{_name} undefined at ($x|$y)\n"; + for (1..10) { + $o = { %$os, %$o }; + last unless exists $os->{other_arch}; + $o = $arch->{$os->{other_arch}}; + } my $smooth_level = $o->{smoothlevel}; my $level = $smooth_level ? $smooth_level : $o->{is_floor} ? 0 - : $OBJ_LEVEL + $layer; + : $OBJ_LEVEL + $layer; while ($o) { my $pb = tile $o->{face} @@ -223,8 +229,8 @@ my $mx = $x + $o->{x}; my $my = $y + $o->{y}; - last if $mx >= $mapx - || $my >= $mapy; + last if 0 > $mx || $mx >= $mapx + || 0 > $my || $my >= $mapy; # this is very ugly (some tiles are 32x33 or worse) my $bigface = $pb->get_width >= T*2 || $pb->get_height >= T*2;