Mercurial > touhou
comparison pytouhou/vm/msgrunner.py @ 336:72ef7e24b373
Fix MSG skipping.
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Sun, 01 Jul 2012 18:06:11 +0200 |
parents | 1b4f04b08729 |
children | 61caded6b4f5 |
comparison
equal
deleted
inserted
replaced
335:2350147cf043 | 336:72ef7e24b373 |
---|---|
26 | 26 |
27 | 27 |
28 class MSGRunner(object): | 28 class MSGRunner(object): |
29 __metaclass__ = MetaRegistry | 29 __metaclass__ = MetaRegistry |
30 __slots__ = ('_msg', '_game', 'frame', 'sleep_time', 'allow_skip', | 30 __slots__ = ('_msg', '_game', 'frame', 'sleep_time', 'allow_skip', |
31 'frozen', 'faces', 'ended', 'instruction_pointer') | 31 'skipping', 'frozen', 'faces', 'ended', 'instruction_pointer') |
32 | 32 |
33 def __init__(self, msg, script, game): | 33 def __init__(self, msg, script, game): |
34 self._msg = msg.msgs[script + 10 * (game.players[0].state.character // 2)] | 34 self._msg = msg.msgs[script + 10 * (game.players[0].state.character // 2)] |
35 self._game = game | 35 self._game = game |
36 self.frame = 0 | 36 self.frame = 0 |
37 self.sleep_time = 0 | 37 self.sleep_time = 0 |
38 self.allow_skip = True | 38 self.allow_skip = True |
39 self.skipping = False | |
39 self.frozen = False | 40 self.frozen = False |
40 | 41 |
41 self.faces = [None, None] | 42 self.faces = [None, None] |
42 game.msg_sprites = self.objects | 43 game.msg_sprites = self.objects |
43 self.ended = False | 44 self.ended = False |
115 face.load(index) | 116 face.load(index) |
116 | 117 |
117 | 118 |
118 @instruction(4) | 119 @instruction(4) |
119 def pause(self, duration): | 120 def pause(self, duration): |
120 self.sleep_time = duration | 121 if not (self.skipping and self.allow_skip): |
122 self.sleep_time = duration | |
121 | 123 |
122 | 124 |
123 @instruction(5) | 125 @instruction(5) |
124 def animate(self, side, effect): | 126 def animate(self, side, effect): |
125 face = self.faces[side] | 127 face = self.faces[side] |