From 421107aae8b2ab6bb67f566238716992fbd5bd02 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 21 Sep 2016 02:37:42 -0400 Subject: renderlevels.pl now prints symbolic shape names --- renderlevels.pl | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'renderlevels.pl') diff --git a/renderlevels.pl b/renderlevels.pl index e967991..6373030 100644 --- a/renderlevels.pl +++ b/renderlevels.pl @@ -6,7 +6,7 @@ # this code won't win any beauty contests, but it does work. -$verbose = 0; # 0 = quiet, 2 = very chatty +$verbose = 2; # 0 = quiet, 2 = very chatty $black_is_white = 0; # 1 = draw all-black shapes in white. only affects # level09.png (the bombs are invisible there). @@ -37,7 +37,9 @@ sub getdelta { sub draw { my ($img, $shape, $dx, $dy, $xpos, $ypos, $copies) = @_; - warn sprintf "drawing shape %04x at $xpos, $ypos, $copies copies, delta ($dx, $dy)\n", $shape if $verbose > 1; + my $shaddr = sprintf("%04x", $shape); + my $shname = $shapes{$shaddr} || "???"; + warn sprintf "drawing shape $shname ($shaddr) at %02x,%02x copies $copies, delta ($dx, $dy)\n", $xpos, $ypos if $verbose > 1; my $white = 0; if($black_is_white && ($shape == 0x9c89 || $shape == 0x9ceb || $shape == 0x9c49)) { warn "drawing all-black shape in white\n"; @@ -65,6 +67,21 @@ sub draw { } } +#main() +open I, ") { + next unless /^label\s+{\s+name\s+"(sh_\w+)".*addr\s+\$([0-9a-fA-F]+);/; + $shapes{lc $2} = $1; +} +close I; + +if($verbose > 1) { + print "addr shape\n"; + for(sort keys %shapes) { + print "$_ $shapes{$_}\n"; + } +} + open ROM, "