summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2013-12-25 06:44:31 -0500
committeryenatch <yenatch@gmail.com>2013-12-25 06:44:31 -0500
commit906472a8f1758743a04beb1727f7d05b72174596 (patch)
tree4c654ecebb6285ef5f33cdbbe57381a918e3cd22
parentbddb346ca075e8cc666957b190207c68e1152a76 (diff)
battle_animations: docstring for BattleAnim, consistent sorting
-rw-r--r--pokemontools/battle_animations.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/pokemontools/battle_animations.py b/pokemontools/battle_animations.py
index 4b641e7..678e9ce 100644
--- a/pokemontools/battle_animations.py
+++ b/pokemontools/battle_animations.py
@@ -148,6 +148,17 @@ class BattleAnimWait(Command):
class BattleAnim:
+ """
+ A list of battle animation commands read from a given address.
+
+ Results in a list of commands (self.output) and a list of labels (self.labels).
+ Format is (address, asm, last_address). Includes any subroutines and their output.
+
+ To convert to text, use self.to_asm().
+
+ For combining multiple BattleAnims, take self.output + self.labels from each
+ and sort with sort_asms.
+ """
def __init__(self, address, base_label=None, label=None, used_labels=[], macros=[]):
self.start_address = address
@@ -227,11 +238,10 @@ class BattleAnim:
self.labels = list(set(self.labels))
def to_asm(self):
- output = sorted(self.output + self.labels, key = lambda (x, y, z): (x, z))
+ output = sort_asms(self.output + self.labels)
text = ''
for (address, asm, last_address) in output:
text += asm + '\n'
- #text += '; %x\n' % last_address
return text
def get_command_class(self, cmd):