Mercurial > touhou
annotate pytouhou/vm/msgrunner.py @ 350:b3049fb5c448
Fix remaining lives display issue
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Sat, 07 Jul 2012 21:32:49 +0200 |
parents | 61caded6b4f5 |
children | 69ec72b990a4 |
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', |
336 | 31 'skipping', 'frozen', 'faces', 'ended', 'instruction_pointer') |
286
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 |
336 | 39 self.skipping = False |
286
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
40 self.frozen = False |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
41 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
42 self.faces = [None, None] |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
43 game.msg_sprites = self.objects |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
44 self.ended = False |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
45 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
46 self.instruction_pointer = 0 |
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 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
49 def objects(self): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
50 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
|
51 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
52 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
53 def run_iteration(self): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
54 while True: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
55 if self.ended: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
56 return False |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
57 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
58 try: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
59 frame, instr_type, args = self._msg[self.instruction_pointer] |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
60 except IndexError: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
61 self.end() |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
62 return False |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
63 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
64 if frame > self.frame: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
65 break |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
66 else: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
67 self.instruction_pointer += 1 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
68 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
69 if frame == self.frame: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
70 try: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
71 callback = self._handlers[instr_type] |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
72 except KeyError: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
73 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
|
74 else: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
75 callback(self, *args) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
76 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
77 if not self.frozen: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
78 if self.sleep_time > 0: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
79 self.sleep_time -= 1 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
80 else: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
81 self.frame += 1 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
82 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
83 for face in self.faces: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
84 if face: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
85 face.update() |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
86 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
87 return True |
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 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
90 def skip(self): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
91 self.sleep_time = 0 |
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 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
94 def end(self): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
95 self._game.msg_runner = None |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
96 self._game.msg_wait = False |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
97 self.ended = True |
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 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
100 @instruction(0) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
101 def unknown0(self): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
102 if self.allow_skip: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
103 raise Exception #TODO: seems to crash the game, but why? |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
104 self.end() |
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 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
107 @instruction(1) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
108 def enter(self, side, effect): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
109 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
|
110 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
111 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
112 @instruction(2) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
113 def change_face(self, side, index): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
114 face = self.faces[side] |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
115 if face: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
116 face.load(index) |
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 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
119 @instruction(4) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
120 def pause(self, duration): |
336 | 121 if not (self.skipping and self.allow_skip): |
122 self.sleep_time = duration | |
286
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
123 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
124 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
125 @instruction(5) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
126 def animate(self, side, effect): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
127 face = self.faces[side] |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
128 if face: |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
129 face.animate(effect) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
130 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
131 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
132 @instruction(6) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
133 def spawn_enemy_sprite(self): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
134 self._game.msg_wait = False |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
135 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
136 |
321
61adb5453e46
Implement music playback.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
286
diff
changeset
|
137 @instruction(7) |
61adb5453e46
Implement music playback.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
286
diff
changeset
|
138 def change_music(self, track): |
341
61caded6b4f5
Clean music playback API a little.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
336
diff
changeset
|
139 self._game.music.play(track) |
321
61adb5453e46
Implement music playback.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
286
diff
changeset
|
140 |
61adb5453e46
Implement music playback.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
286
diff
changeset
|
141 |
286
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
142 @instruction(10) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
143 def freeze(self): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
144 self.frozen = True |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
145 |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
146 |
331
1b4f04b08729
Add the story mode.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
321
diff
changeset
|
147 @instruction(11) |
1b4f04b08729
Add the story mode.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
321
diff
changeset
|
148 def next_stage(self): |
1b4f04b08729
Add the story mode.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
321
diff
changeset
|
149 raise NextStage |
1b4f04b08729
Add the story mode.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
321
diff
changeset
|
150 |
1b4f04b08729
Add the story mode.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
321
diff
changeset
|
151 |
286
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
152 @instruction(13) |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
153 def set_allow_skip(self, boolean): |
4838e9bab0f9
Implement dialogs (MSG files).
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff
changeset
|
154 self.allow_skip = bool(boolean) |