aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2016-09-21 02:37:42 -0400
committerB. Watson <yalhcru@gmail.com>2016-09-21 02:37:42 -0400
commit421107aae8b2ab6bb67f566238716992fbd5bd02 (patch)
tree518453ce80fe9156a3366375aa4a0c812b1bcbd0
parentbafd1a1b22e5b07638046331feb7fb13053315b4 (diff)
downloadjumpmanjr-421107aae8b2ab6bb67f566238716992fbd5bd02.tar.gz
renderlevels.pl now prints symbolic shape names
-rw-r--r--renderlevels.pl21
1 files changed, 19 insertions, 2 deletions
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, "<main.info" or die $!;
+while(<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, "<jumpmanjr.rom" or die $!;
if((read ROM, $rom, 0x4000, 0x8000) != 0x4000) {
die "couldn't read ROM\n";