Mercurial > touhou
annotate pytouhou/vm/msgrunner.py @ 331:1b4f04b08729
Add the story mode.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sat, 30 Jun 2012 19:37:21 +0200 |
parents | 61adb5453e46 |
children | 72ef7e24b373 |
rev | line source |
---|---|
286
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
1 # -*- encoding: utf-8 -*- |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
2 ## |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
3 ## Copyright (C) 2012 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
4 ## |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
5 ## This program is free software; you can redistribute it and/or modify |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
6 ## it under the terms of the GNU General Public License as published |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
7 ## by the Free Software Foundation; version 3 only. |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
8 ## |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
9 ## This program is distributed in the hope that it will be useful, |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
12 ## GNU General Public License for more details. |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
13 ## |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
14 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
15 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
16 from pytouhou.utils.helpers import get_logger |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
17 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
18 from pytouhou.vm.common import MetaRegistry, instruction |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
19 from pytouhou.game.face import Face |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
20 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
21 logger = get_logger(__name__) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
22 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
23 |
331
1b4f04b08729
Add the story mode.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
321
diff
changeset
|
24 class NextStage(Exception): |
1b4f04b08729
Add the story mode.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
321
diff
changeset
|
25 pass |
1b4f04b08729
Add the story mode.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
321
diff
changeset
|
26 |
1b4f04b08729
Add the story mode.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
321
diff
changeset
|
27 |
286
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
28 class MSGRunner(object): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
29 __metaclass__ = MetaRegistry |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
30 __slots__ = ('_msg', '_game', 'frame', 'sleep_time', 'allow_skip', |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
31 'frozen', 'faces', 'ended', 'instruction_pointer') |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
32 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
33 def __init__(self, msg, script, game): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
34 self._msg = msg.msgs[script + 10 * (game.players[0].state.character // 2)] |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
35 self._game = game |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
36 self.frame = 0 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
37 self.sleep_time = 0 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
38 self.allow_skip = True |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
39 self.frozen = False |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
40 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
41 self.faces = [None, None] |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
42 game.msg_sprites = self.objects |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
43 self.ended = False |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
44 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
45 self.instruction_pointer = 0 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
46 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
47 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
48 def objects(self): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
49 return [face for face in self.faces if face] if not self.ended else [] |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
50 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
51 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
52 def run_iteration(self): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
53 while True: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
54 if self.ended: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
55 return False |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
56 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
57 try: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
58 frame, instr_type, args = self._msg[self.instruction_pointer] |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
59 except IndexError: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
60 self.end() |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
61 return False |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
62 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
63 if frame > self.frame: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
64 break |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
65 else: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
66 self.instruction_pointer += 1 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
67 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
68 if frame == self.frame: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
69 try: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
70 callback = self._handlers[instr_type] |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
71 except KeyError: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
72 logger.warn('unhandled msg opcode %d (args: %r)', instr_type, args) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
73 else: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
74 callback(self, *args) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
75 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
76 if not self.frozen: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
77 if self.sleep_time > 0: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
78 self.sleep_time -= 1 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
79 else: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
80 self.frame += 1 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
81 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
82 for face in self.faces: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
83 if face: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
84 face.update() |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
85 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
86 return True |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
87 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
88 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
89 def skip(self): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
90 self.sleep_time = 0 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
91 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
92 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
93 def end(self): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
94 self._game.msg_runner = None |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
95 self._game.msg_wait = False |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
96 self.ended = True |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
97 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
98 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
99 @instruction(0) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
100 def unknown0(self): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
101 if self.allow_skip: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
102 raise Exception #TODO: seems to crash the game, but why? |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
103 self.end() |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
104 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
105 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
106 @instruction(1) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
107 def enter(self, side, effect): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
108 self.faces[side] = Face(self._game.msg_anm_wrapper, effect, side) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
109 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
110 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
111 @instruction(2) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
112 def change_face(self, side, index): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
113 face = self.faces[side] |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
114 if face: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
115 face.load(index) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
116 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
117 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
118 @instruction(4) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
119 def pause(self, duration): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
120 self.sleep_time = duration |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
121 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
122 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
123 @instruction(5) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
124 def animate(self, side, effect): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
125 face = self.faces[side] |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
126 if face: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
127 face.animate(effect) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
128 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
129 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
130 @instruction(6) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
131 def spawn_enemy_sprite(self): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
132 self._game.msg_wait = False |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
133 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
134 |
321
61adb5453e46
Implement music playback.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
286
diff
changeset
|
135 @instruction(7) |
61adb5453e46
Implement music playback.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
286
diff
changeset
|
136 def change_music(self, track): |
61adb5453e46
Implement music playback.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
286
diff
changeset
|
137 self._game.change_music(track) |
61adb5453e46
Implement music playback.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
286
diff
changeset
|
138 |
61adb5453e46
Implement music playback.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
286
diff
changeset
|
139 |
286
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
140 @instruction(10) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
141 def freeze(self): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
142 self.frozen = True |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
143 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
144 |
331
1b4f04b08729
Add the story mode.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
321
diff
changeset
|
145 @instruction(11) |
1b4f04b08729
Add the story mode.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
321
diff
changeset
|
146 def next_stage(self): |
1b4f04b08729
Add the story mode.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
321
diff
changeset
|
147 raise NextStage |
1b4f04b08729
Add the story mode.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
321
diff
changeset
|
148 |
1b4f04b08729
Add the story mode.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
321
diff
changeset
|
149 |
286
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
150 @instruction(13) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
151 def set_allow_skip(self, boolean): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
152 self.allow_skip = bool(boolean) |