shithub: pokecrystal

Download patch

ref: d16a6debfff13f28547a18e305f5a6820bd9f2dd
parent: a9a1e084a1aeb8235e93351d2ed5dbac66461fe6
author: Bryan Bishop <[email protected]>
date: Fri May 4 21:42:34 EDT 2012

by default allow MovementCommand to handle <$45s

--- a/extras/crystal.py
+++ b/extras/crystal.py
@@ -1879,6 +1879,9 @@
     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 @@
     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 @@
 
 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_"