diff options
author | Bryan Bishop <kanzure@gmail.com> | 2012-01-15 12:10:35 -0600 |
---|---|---|
committer | Bryan Bishop <kanzure@gmail.com> | 2012-01-15 12:10:35 -0600 |
commit | 7128a9cb43f3595cc0b736310a7afbd4ac7c7745 (patch) | |
tree | e511e47f27b2ffd35d67a73ccb24d5ec8b8b8558 | |
parent | 254dfd6f30fb9d42e3af8848c30f03d1f7841b46 (diff) |
script to generate map height/width constants
hg-commit-id: fbcc1e98685a
-rw-r--r-- | extras/make_map_size_constants.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/extras/make_map_size_constants.py b/extras/make_map_size_constants.py new file mode 100644 index 00000000..70be3b02 --- /dev/null +++ b/extras/make_map_size_constants.py @@ -0,0 +1,29 @@ +#!/usr/bin/python +#author: Bryan Bishop <kanzure@gmail.com> +#date: 2012-01-15 +#dump map height/width constants +import extract_maps +from pretty_map_headers import map_name_cleaner + +def get_map_size_constants(): + output = "" + for map_id in extract_maps.map_headers.keys(): + if map_id in extract_maps.bad_maps: continue #skip + + map2 = extract_maps.map_headers[map_id] + base_name = map_name_cleaner(map2["name"], None)[:-2] + + height = int(map2["y"], 16) + width = int(map2["x"], 16) + + output += "; " + base_name + "_h map_id=" + str(map_id) + "\n" + output += base_name + "Height EQU $%.2x\n" % (height) + output += base_name + "Width EQU $%.2x\n" % (width) + output += "\n" + return output + +if __name__ == "__main__": + extract_maps.load_rom() + extract_maps.load_map_pointers() + extract_maps.read_all_map_headers() + print get_map_size_constants() |