summaryrefslogtreecommitdiff
path: root/extras/crystal.py
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2012-04-21 02:25:56 -0500
committerBryan Bishop <kanzure@gmail.com>2012-04-21 02:25:56 -0500
commit06bc6699dadc2e48c0de6b3041c8619303972ba3 (patch)
treed5b4b215336b54bb5c673327164c62df4f163f66 /extras/crystal.py
parent64af1959ae3b90c386569d358dfe4870990c4058 (diff)
improve TrainerFragment.to_asm
Diffstat (limited to 'extras/crystal.py')
-rw-r--r--extras/crystal.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/extras/crystal.py b/extras/crystal.py
index 13ae06a0b..caa5158ab 100644
--- a/extras/crystal.py
+++ b/extras/crystal.py
@@ -1214,6 +1214,7 @@ class MultiByteParam():
def parse(self):
self.bytes = rom_interval(self.address, self.size, strings=False)
+ self.parsed_number = self.bytes[0] + (self.bytes[1] << 8)
if hasattr(self, "bank"):
self.parsed_address = calculate_pointer_from_bytes_at(self.address, bank=self.bank)
else:
@@ -2258,6 +2259,23 @@ class TrainerFragment(Command):
deps.extend(self.params[6].get_dependencies())
return deps
+ def to_asm(self):
+ xspacing = ""
+ output = ""
+ output += xspacing + "; bit/flag number\n"
+ output += xspacing + "db $%.2x"%(self.params[0].parsed_number)
+ output += "\n\n"+xspacing+"; trainer group && trainer id\n"
+ output += xspacing + "db %d, %d" % (self.params[1].byte, self.params[2].byte)
+ output += "\n\n"+xspacing+"; text when seen\n"
+ output += xspacing + "dw " + self.params[3].to_asm()
+ output += "\n\n"+xspacing+"; text when trainer beaten\n"
+ output += xspacing + "dw " + self.params[4].to_asm()
+ output += "\n\n"+xspacing+"; script when lost\n"
+ output += xspacing + "dw " + self.params[5].to_asm()
+ output += "\n\n"+xspacing+"; script when talk again\n"
+ output += xspacing + "dw " + self.params[6].to_asm()
+ return output
+
class TrainerFragmentParam(PointerLabelParam):
"""used by PeopleEvent to point to trainer data"""