diff options
-rw-r--r-- | extras/crystal.py | 33 | ||||
-rw-r--r-- | main.asm | 36 |
2 files changed, 54 insertions, 15 deletions
diff --git a/extras/crystal.py b/extras/crystal.py index 6502fa24f..3c003cd2d 100644 --- a/extras/crystal.py +++ b/extras/crystal.py @@ -1090,6 +1090,7 @@ class EncodedText: if not label: label = self.base_label + hex(address) self.label = Label(name=label, address=address, object=self) + self.dependencies = None self.parse() script_parse_table[self.address : self.last_address] = self @@ -1110,6 +1111,10 @@ class EncodedText: end_address = offset + jump #we want the address before $57 text = parse_text_at2(offset, end_address-offset, debug=self.debug) + + if jump == jump50: + text += "@" + self.text = text self.last_address = self.end_address = end_address @@ -1164,7 +1169,6 @@ class EncodedText: commands = process_00_subcommands(address, address+count, debug=debug) for (line_id, line) in commands.items(): output += parse_text_from_bytes(line, debug=debug, japanese=japanese) - output += "\n" texts.append([address, output]) return output @@ -1716,7 +1720,8 @@ class TrainerIdParam(SingleByteParam): trainer_group_id = self.parent.params[foundit].byte # check the rule to see whether to use an id or not - if "uses_numeric_trainer_ids" in trainer_group_names[trainer_group_id].keys(): + if ("uses_numeric_trainer_ids" in trainer_group_names[trainer_group_id].keys()) or \ + (not "trainer_names" in trainer_group_names[trainer_group_id].keys()): return str(self.byte) else: return trainer_group_names[trainer_group_id]["trainer_names"][self.byte-1] @@ -1740,6 +1745,7 @@ class MenuDataPointerParam(PointerLabelParam): pass +string_to_text_texts = [] class RawTextPointerLabelParam(PointerLabelParam): #not sure if these are always to a text script or raw text? def parse(self): @@ -1755,6 +1761,21 @@ class RawTextPointerLabelParam(PointerLabelParam): 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] + class TextPointerLabelParam(PointerLabelParam): """this is a pointer to a text script""" bank = False @@ -2762,7 +2783,7 @@ pksv_crystal_more = { 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"], @@ -3436,9 +3457,11 @@ class TrainerFragment(Command): # give this object a possibly better label label = "Trainer" - if "uses_numeric_trainer_ids" in trainer_group_names[trainer_group].keys(): + if ("uses_numeric_trainer_ids" in trainer_group_names[trainer_group].keys()) \ + or ("trainer_names" not in trainer_group_names[trainer_group].keys()): label += string.capwords(trainer_group_names[trainer_group]["constant"]) - if len(trainer_group_names[trainer_group]["trainer_names"]) > 1: + if "trainer_names" in trainer_group_names[trainer_group].keys() \ + and len(trainer_group_names[trainer_group]["trainer_names"]) > 1: label += str(trainer_id) else: label += string.capwords(trainer_group_names[trainer_group]["constant"]) + \ @@ -16508,7 +16508,7 @@ UnknownScript_0x5cdd5: ; 0x5cdd5 waitbutton 2writetext UnknownText_0x5d37b keeptextopen - stringtotext $4e33, $1 + stringtotext RadioCardText, $1 2call UnknownScript_0x5ce3e 2writetext UnknownText_0x5d3c0 keeptextopen @@ -16520,7 +16520,9 @@ UnknownScript_0x5ce2d: ; 0x5ce2d end ; 0x5ce33 -INCBIN "baserom.gbc",$5ce33,$5ce3e - $5ce33 +RadioCardText: ; 0x5ce33 + db "RADIO CARD@" +; 0x5ce3d UnknownScript_0x5ce3e: ; 0x5ce3e jumpstd $002f @@ -21282,7 +21284,9 @@ UnknownScript_0x69511: ; 0x69511 end ; 0x69523 -INCBIN "baserom.gbc",$69523,$69527 - $69523 +UnknownRawText_0x69523: ; 0x69523 + db "EGG@" +; 0x69527 UnknownScript_0x69527: ; 0x69527 jumpstd $0030 @@ -21743,6 +21747,7 @@ UnknownScript_0x69d96: ; 0x69d96 ; 0x69d98 GivePokeItem_0x69d98: ; 0x69d98 + INCBIN "baserom.gbc",$69d98,$2e UnknownScript_0x69dc6: ; 0x69dc6 @@ -29436,9 +29441,12 @@ UnknownScript_0x72169: ; 0x72169 UnknownScript_0x72172: ; 0x72172 jumpstd $002f -; 0x72175 + end +; 0x72176 -INCBIN "baserom.gbc",$72175,$7217b - $72175 +UnknownRawText_0x72176: ; 0x72176 + db "COIN@" +; 0x7217b UnknownScript_0x7217b: ; 0x7217b 2writetext UnknownText_0x7238a @@ -37448,7 +37456,9 @@ UnknownScript_0x7a572: ; 0x7a572 2jump $64f6 ; 0x7a578 -INCBIN "baserom.gbc",$7a578,$7a57e - $7a578 +UnknownRawText_0x7a578: ; 0x7a578 + db $54, "GEAR@" +; 0x7a57e UnknownScript_0x7a57e: ; 0x7a57e jumpstd $002f @@ -41927,9 +41937,12 @@ UnknownScript_0x7ee80: ; 0x7ee80 UnknownScript_0x7ee94: ; 0x7ee94 jumpstd $002f -; 0x7ee97 + end +; 0x7ee98 -INCBIN "baserom.gbc",$7ee97,$7eea2 - $7ee97 +UnknownRawText_0x7ee98: ; 0x7ee98 + db "EXPN CARD@" +; 0x7eea2 UnknownScript_0x7eea2: ; 0x7eea2 faceplayer @@ -83603,9 +83616,12 @@ UnknownScript_0x19c01f: ; 0x19c01f UnknownScript_0x19c097: ; 0x19c097 jumpstd $002f -; 0x19c09a + end +; 0x19c09b -INCBIN "baserom.gbc",$19c09a,$0a +UnknownRawText_0x19c09b: ; 0x19c09b + db "MAP CARD@" +; 0x19c0a4 UnknownScript_0x19c0a4: ; 0x19c0a4 2writetext UnknownText_0x19c49f |