From e84a5b2062ff5e9b010447e3a3c78dd67a653166 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Sun, 1 Sep 2013 02:27:44 -0500 Subject: make extras/ a submodule Use pokemontools v1.3.0 and use the same preprocessor as the pokecrystal project. --- extras | 1 + extras/connection_helper.py | 104 -------------------------------------------- 2 files changed, 1 insertion(+), 104 deletions(-) create mode 160000 extras delete mode 100644 extras/connection_helper.py (limited to 'extras/connection_helper.py') diff --git a/extras b/extras new file mode 160000 index 00000000..795cd58a --- /dev/null +++ b/extras @@ -0,0 +1 @@ +Subproject commit 795cd58a70c80082003e40127241cfaefa0fae8b diff --git a/extras/connection_helper.py b/extras/connection_helper.py deleted file mode 100644 index c15b3582..00000000 --- a/extras/connection_helper.py +++ /dev/null @@ -1,104 +0,0 @@ -#author: Bryan Bishop -#date: 2012-01-15 -#help with connection math -import extract_maps -from pretty_map_headers import map_constants, map_name_cleaner, offset_to_pointer - -def print_connections(map_id, in_connection_id=None, do_output=False): - map1 = extract_maps.map_headers[map_id] - map1_name = map1["name"] - connections = map1["connections"] - output = "" - - if in_connection_id != None: - connections2 = {} - connections2[in_connection_id] = connections[in_connection_id] - connections = connections2 - - for connection_id in connections: - connection = connections[connection_id] - direction = connection["direction"] - connected_pointer = int(connection["connected_map_tile_pointer"], 16) - current_pointer = int(connection["current_map_tile_pointer"], 16) - map2_id = connection["map_id"] - map2 = extract_maps.map_headers[map2_id] - map2_name = map2["name"] - map2_cname = map_name_cleaner(map2["name"], None)[:-2] - map2_bank = int(map2["bank"], 16) - map2_blocks_pointer = offset_to_pointer(int(map2["map_pointer"], 16)) - map2_height = int(map2["y"], 16) - map2_width = int(map2["x"], 16) - - output += map1_name + " (id=" + str(map_id) + ") " + direction + " to " + map2_name + "\n" - output += "map2 blocks pointer: " + hex(map2_blocks_pointer) + "\n" - output += "map2 height: " + str(map2_height) + "\n" - output += "map2 width: " + str(map2_width) + "\n" - output += "map1 connection pointer: " + hex(connected_pointer) + "\n" - - shift = 0 - #not sure about the calculated shift for NORTH or SOUTH - if direction == "NORTH": - calculated = map2_blocks_pointer + (map2_height - 3) * map2_width - result = connected_pointer - calculated - if result != 0: - shift = result #seems to always be 2? - calculated = map2_blocks_pointer + (map2_height - 3) * map2_width + shift - output += "shift: " + str(shift) + "\n" - formula = map2_cname + "Blocks + (" + map2_cname + "Height - 3) * " + map2_cname + "Width + " + str(shift) - else: - formula = map2_cname + "Blocks + (" + map2_cname + "Height - 3) * " + map2_cname + "Width" - elif direction == "SOUTH": - calculated = map2_blocks_pointer - result = connected_pointer - calculated - formula = map2_cname + "Blocks" - if result != 0: - shift = result - calculated = map2_blocks_pointer + shift - output += "shift: " + str(shift) + "\n" - formula += " + " + str(shift) - elif direction == "WEST": - calculated = map2_blocks_pointer - 3 + (map2_width) - result = connected_pointer - calculated - formula = map2_cname + "Blocks - 3 + (" + map2_cname + "Width)" - if result != 0: - shift = result / map2_width - shift += 1 - calculated = map2_blocks_pointer - 3 + (map2_width * shift) - output += "shift: " + str(shift) + "\n" - formula = map2_cname + "Blocks - 3 + (" + map2_cname + "Width * " + str(shift) + ")" - elif direction == "EAST": - calculated = map2_blocks_pointer + (map2_width) - result = connected_pointer - calculated - output += ".. result is: " + str(result) + "\n" - formula = map2_cname + "Blocks + (" + map2_cname + "Width)" - if result != 0: - shift = result / map2_width - shift += 1 - calculated = map2_blocks_pointer + (map2_width * shift) - output += "shift: " + str(shift) + "\n" - formula = map2_cname + "Blocks" + " + (" + map2_cname + "Width * " + str(shift) + ")" - - output += "formula: " + formula + "\n" - - result = connected_pointer - calculated - output += "result: " + str(result) + "\n" - - output += "\n\n" - - if in_connection_id != None: - return formula - if do_output == True: - return output - -if __name__ == "__main__": - extract_maps.load_rom() - extract_maps.load_map_pointers() - extract_maps.read_all_map_headers() - - #trouble: - #print_connections(13) - #print_connections(15) - - for map_id in extract_maps.map_headers.keys(): - if map_id not in extract_maps.bad_maps: - print print_connections(map_id, do_output=True) -- cgit v1.2.3 From 423c9ef70b49c2786b9f708b32364800cda45e79 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Sun, 1 Sep 2013 16:26:26 -0500 Subject: bump submodule to get a gbz80disasm fix --- extras | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extras/connection_helper.py') diff --git a/extras b/extras index 795cd58a..7aa016fb 160000 --- a/extras +++ b/extras @@ -1 +1 @@ -Subproject commit 795cd58a70c80082003e40127241cfaefa0fae8b +Subproject commit 7aa016fb528bcc8dcb30c6a887957851623eccc0 -- cgit v1.2.3