summaryrefslogtreecommitdiff
path: root/extras/crystal.py
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2012-05-05 01:42:34 -0500
committerBryan Bishop <kanzure@gmail.com>2012-05-05 01:42:34 -0500
commitd16a6debfff13f28547a18e305f5a6820bd9f2dd (patch)
treef40ed0933be8cf6990ab90250bc4e107ab601b14 /extras/crystal.py
parenta9a1e084a1aeb8235e93351d2ed5dbac66461fe6 (diff)
by default allow MovementCommand to handle <$45s
Diffstat (limited to 'extras/crystal.py')
-rw-r--r--extras/crystal.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/extras/crystal.py b/extras/crystal.py
index a4b12f999..9070bf5f0 100644
--- a/extras/crystal.py
+++ b/extras/crystal.py
@@ -1879,6 +1879,9 @@ class DataByteWordMacro(Command):
def to_asm(self): pass
class MovementCommand(Command):
+ # by default.. handle all the <$45s
+ id = [0, 4, 8, 0x0C, 0x10, 0x14, 0x18, 0x1C, 0x20, 0x24, 0x28, 0x2C, 0x30, 0x34, 0x3A, 0x3B, 0x3D]
+
# the vast majority of movement commands do not end the movement script
end = False
@@ -1908,16 +1911,14 @@ class MovementCommand(Command):
def to_asm(self):
if ord(rom[self.address]) < 0x45:
byte = ord(rom[self.address])
-
- base = [0, 4, 8, 0x0C, 0x10, 0x14, 0x18, 0x1C, 0x20, 0x24, 0x28, 0x2C, 0x30, 0x34, 0x3A, 0x3B, 0x3D]
- if byte in base:
+ if byte in self.base:
modulator = "down"
- elif byte in [x+1 for x in base]:
+ elif byte in [x+1 for x in self.base]:
modulator = "up"
- elif byte in [x+2 for x in base]:
+ elif byte in [x+2 for x in self.base]:
modulator = "left"
- elif byte in [x+3 for x in base]:
+ elif byte in [x+3 for x in self.base]:
modulator = "right"
else:
raise Exception, "can't figure out direction- this should never happen"
@@ -1928,8 +1929,7 @@ class MovementCommand(Command):
movement_command_classes = inspect.getmembers(sys.modules[__name__], \
lambda obj: inspect.isclass(obj) and \
- issubclass(obj, MovementCommand) and \
- obj != MovementCommand)
+ issubclass(obj, MovementCommand))
class ApplyMovementData:
base_label = "MovementData_"