use EncodedText for stringtotext params

This commit is contained in:
Bryan Bishop 2012-05-22 11:50:25 -05:00
parent cb5eae3e9d
commit 2567957692

View File

@ -1756,6 +1756,19 @@ class RawTextPointerLabelParam(PointerLabelParam):
#self.text = TextScript(address, map_group=self.map_group, map_id=self.map_id, debug=self.debug) #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) self.text = parse_text_engine_script_at(address, map_group=self.map_group, map_id=self.map_id, debug=self.debug)
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) string_to_text_texts.append(self.text)
def get_dependencies(self, recompute=False, global_dependencies=set()): def get_dependencies(self, recompute=False, global_dependencies=set()):
@ -2769,7 +2782,7 @@ pksv_crystal_more = {
0x41: ["itemtotext", ["item", ItemLabelByte], ["memory", SingleByteParam]], 0x41: ["itemtotext", ["item", ItemLabelByte], ["memory", SingleByteParam]],
0x42: ["mapnametotext", ["memory", SingleByteParam]], #not pksv 0x42: ["mapnametotext", ["memory", SingleByteParam]], #not pksv
0x43: ["trainertotext", ["trainer_id", TrainerGroupParam], ["trainer_group", TrainerIdParam], ["memory", SingleByteParam]], 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"], 0x45: ["itemnotify"],
0x46: ["pocketisfull"], 0x46: ["pocketisfull"],
0x47: ["loadfont"], 0x47: ["loadfont"],