Mercurial > touhou
diff pytouhou/vm/anmrunner.py @ 376:69ec72b990a4
Support more than one version of a vm.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Mon, 06 Aug 2012 23:10:09 +0200 |
parents | f3099ebf4f61 |
children | 40d5f3083ebc |
line wrap: on
line diff
--- a/pytouhou/vm/anmrunner.py +++ b/pytouhou/vm/anmrunner.py @@ -24,14 +24,14 @@ logger = get_logger(__name__) class ANMRunner(object): __metaclass__ = MetaRegistry __slots__ = ('_anm_wrapper', '_sprite', 'running', - 'sprite_index_offset', - 'script', 'instruction_pointer', 'frame', - 'waiting') + 'sprite_index_offset', 'script', 'instruction_pointer', + 'frame', 'waiting', 'handlers') def __init__(self, anm_wrapper, script_id, sprite, sprite_index_offset=0): self._anm_wrapper = anm_wrapper self._sprite = sprite + self.handlers = self._handlers[6] self.running = True self.waiting = False @@ -71,7 +71,7 @@ class ANMRunner(object): if frame == self.frame: try: - callback = self._handlers[opcode] + callback = self.handlers[opcode] except KeyError: logger.warn('unhandled opcode %d (args: %r)', opcode, args) else: