… | |
… | |
202 | my $as = $col->[$y] || []; |
202 | my $as = $col->[$y] || []; |
203 | |
203 | |
204 | for my $layer (0 .. $#$as) { |
204 | for my $layer (0 .. $#$as) { |
205 | my $a = $as->[$layer]; |
205 | my $a = $as->[$layer]; |
206 | |
206 | |
|
|
207 | my $o = $a; |
|
|
208 | delete $o->{x}; |
|
|
209 | delete $o->{y}; |
|
|
210 | |
207 | my $o = $arch->{$a->{_name}} |
211 | my $os = $arch->{$a->{_name}} |
208 | or (warn "$mapname: arch '$a->{_name}' not found at ($x|$y)\n"), next; |
212 | or (warn "$mapname: arch '$a->{_name}' not found at ($x|$y)\n"), next; |
209 | |
213 | |
210 | $o = $arch->{$o->{other_arch}} while $o->{other_arch} && !$o->{face}; |
214 | for (1..10) { |
211 | |
215 | $o = { %$os, %$o }; |
212 | $o or die "arch $a->{_name} undefined at ($x|$y)\n"; |
216 | last unless exists $os->{other_arch}; |
|
|
217 | $o = $arch->{$os->{other_arch}}; |
|
|
218 | } |
213 | |
219 | |
214 | my $smooth_level = $o->{smoothlevel}; |
220 | my $smooth_level = $o->{smoothlevel}; |
215 | my $level = $smooth_level ? $smooth_level |
221 | my $level = $smooth_level ? $smooth_level |
216 | : $o->{is_floor} ? 0 |
222 | : $o->{is_floor} ? 0 |
217 | : $OBJ_LEVEL + $layer; |
223 | : $OBJ_LEVEL + $layer; |
218 | |
224 | |
219 | while ($o) { |
225 | while ($o) { |
220 | my $pb = tile $o->{face} |
226 | my $pb = tile $o->{face} |
221 | or (warn "$mapname: face '$o->{face}' not found for arch '$a->{_name}' at ($x|$y)\n"), last; |
227 | or (warn "$mapname: face '$o->{face}' not found for arch '$a->{_name}' at ($x|$y)\n"), last; |
222 | |
228 | |
223 | my $mx = $x + $o->{x}; |
229 | my $mx = $x + $o->{x}; |
224 | my $my = $y + $o->{y}; |
230 | my $my = $y + $o->{y}; |
225 | |
231 | |
226 | last if $mx >= $mapx |
232 | last if 0 > $mx || $mx >= $mapx |
227 | || $my >= $mapy; |
233 | || 0 > $my || $my >= $mapy; |
228 | |
234 | |
229 | # this is very ugly (some tiles are 32x33 or worse) |
235 | # this is very ugly (some tiles are 32x33 or worse) |
230 | my $bigface = $pb->get_width >= T*2 || $pb->get_height >= T*2; |
236 | my $bigface = $pb->get_width >= T*2 || $pb->get_height >= T*2; |
231 | |
237 | |
232 | if (my $sface = $smooth->{$o->{face}}) { |
238 | if (my $sface = $smooth->{$o->{face}}) { |