shithub: pokecrystal

Download patch

ref: a27a7f2892e5b24f4446d46c892b7d38ff3f6970
parent: 2c73f020a66e36bda80ff61ea24285527e67625c
author: Bryan Bishop <[email protected]>
date: Sun May 20 05:37:43 EDT 2012

reuse pre-existing/pre-inserted MapBlockData objects when possible

--- a/extras/crystal.py
+++ b/extras/crystal.py
@@ -4743,14 +4743,16 @@
         self.height = DecimalParam(address=address+1)
         self.width  = DecimalParam(address=address+2)
 
-        #TODO: process blockdata ?
         #bank appears first
         ###self.blockdata_address = PointerLabelBeforeBank(address+3)
         self.blockdata_address = calculate_pointer_from_bytes_at(address+3, bank=True)
-        self.blockdata = MapBlockData(self.blockdata_address, map_group=self.map_group, map_id=self.map_id, debug=self.debug, width=self.width, height=self.height)
+        xyz = script_parse_table[self.blockdata_address]
+        if xyz == None:
+            self.blockdata = MapBlockData(self.blockdata_address, map_group=self.map_group, map_id=self.map_id, debug=self.debug, width=self.width, height=self.height)
+        else:
+            self.blockdata = xyz
 
         #bank appears first
-        #TODO: process MapScriptHeader
         ###self.script_address = PointerLabelBeforeBank(address+6)
         self.script_header_address = calculate_pointer_from_bytes_at(address+6, bank=True)
         self.script_header = MapScriptHeader(self.script_header_address, map_group=self.map_group, map_id=self.map_id, debug=self.debug)