summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2013-11-22 21:04:10 -0600
committerBryan Bishop <kanzure@gmail.com>2013-11-22 21:04:10 -0600
commit8767c40b04fb97364cbcacb4dea8a985e4829866 (patch)
tree2d1a9b62d095e1e7d5b47efa0cb5ce57b8154290
parent9d2a0c3b60821cd14f9a9efb6d0f50b465f00c63 (diff)
move the map offsets out of main()
This is a function that is necessary outside of the context of a main method.
-rw-r--r--pokemontools/crystal.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/pokemontools/crystal.py b/pokemontools/crystal.py
index cdab01f..c195ad9 100644
--- a/pokemontools/crystal.py
+++ b/pokemontools/crystal.py
@@ -6044,7 +6044,7 @@ def find_incbin_to_replace_for(address, debug=False, rom_file=None):
incbin = processed_incbins[incbin_key]
start = incbin["start"]
end = incbin["end"]
- if debug:
+ nf debug:
argstuff = {
"start": start,
"end": end,
@@ -6953,6 +6953,13 @@ Command.trainer_group_maximums = trainer_group_maximums
SingleByteParam.map_internal_ids = map_internal_ids
MultiByteParam.map_internal_ids = map_internal_ids
+def add_map_offsets_into_map_names(map_group_offsets, map_names=None):
+ """
+ Add the offsets for each map into the map_names variable.
+ """
+ # add the offsets into our map structure, why not (johto maps only)
+ return [map_names[map_group_id+1].update({"offset": offset}) for map_group_id, offset in enumerate(map_group_offsets)]
+
def main(rom=None):
if not rom:
# read the rom and figure out the offsets for maps
@@ -6961,8 +6968,7 @@ def main(rom=None):
# figure out the map offsets
map_group_offsets = load_map_group_offsets(map_group_pointer_table=map_group_pointer_table, map_group_count=map_group_count, rom=rom)
- # add the offsets into our map structure, why not (johto maps only)
- [map_names[map_group_id+1].update({"offset": offset}) for map_group_id, offset in enumerate(map_group_offsets)]
+ add_map_offsets_into_map_names(map_group_offsets, map_names=map_names)
# parse map header bytes for each map
parse_all_map_headers(map_names, all_map_headers=all_map_headers)