From 5bae2ec3bbf61bc1c91f1d42ca11273d8d0aad05 Mon Sep 17 00:00:00 2001 From: Bryan Bishop Date: Sat, 5 May 2012 01:42:34 -0500 Subject: by default allow MovementCommand to handle <$45s original-commit-id: d16a6debfff13f28547a18e305f5a6820bd9f2dd --- crystal.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'crystal.py') diff --git a/crystal.py b/crystal.py index a4b12f9..9070bf5 100644 --- a/crystal.py +++ b/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_" -- cgit v1.2.3