shithub: pokecrystal

Download patch

ref: 256795769263d5fc392e1ca4b56736832a4a9d64
parent: cb5eae3e9de8c1a79ce6b69a70fb4a5dd0b73d9b
author: Bryan Bishop <[email protected]>
date: Tue May 22 07:50:25 EDT 2012

use EncodedText for stringtotext params

--- a/extras/crystal.py
+++ b/extras/crystal.py
@@ -1756,8 +1756,21 @@
         #self.text = TextScript(address, map_group=self.map_group, map_id=self.map_id, debug=self.debug)
         self.text = parse_text_engine_script_at(address, map_group=self.map_group, map_id=self.map_id, debug=self.debug)
 
-        string_to_text_texts.append(self.text)
+    def get_dependencies(self, recompute=False, global_dependencies=set()):
+        global_dependencies.add(self.text)
+        return [self.text]
 
+class EncodedTextLabelParam(PointerLabelParam):
+    def parse(self):
+        PointerLabelParam.parse(self)
+
+        address = calculate_pointer_from_bytes_at(self.address, bank=False)
+        self.parsed_address = address
+        self.text = EncodedText(address, map_group=self.map_group, map_id=self.map_id, debug=self.debug)
+
+        if isinstance(self.text, EncodedText):
+            string_to_text_texts.append(self.text)
+
     def get_dependencies(self, recompute=False, global_dependencies=set()):
         global_dependencies.add(self.text)
         return [self.text]
@@ -2769,7 +2782,7 @@
     0x41: ["itemtotext", ["item", ItemLabelByte], ["memory", SingleByteParam]],
     0x42: ["mapnametotext", ["memory", SingleByteParam]], #not pksv
     0x43: ["trainertotext", ["trainer_id", TrainerGroupParam], ["trainer_group", TrainerIdParam], ["memory", SingleByteParam]],
-    0x44: ["stringtotext", ["text_pointer", RawTextPointerLabelParam], ["memory", SingleByteParam]],
+    0x44: ["stringtotext", ["text_pointer", EncodedTextLabelParam], ["memory", SingleByteParam]],
     0x45: ["itemnotify"],
     0x46: ["pocketisfull"],
     0x47: ["loadfont"],