Mercurial > touhou
comparison pytouhou/vm/msgrunner.py @ 456:cae1ae9de430
Add native text support, MSG instructions 3 and 8, and text at the beginning of a stage.
| author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
|---|---|
| date | Tue, 16 Jul 2013 21:11:40 +0200 |
| parents | 9589a01e6edf |
| children | 2276229282fd |
comparison
equal
deleted
inserted
replaced
| 455:6864a38b2413 | 456:cae1ae9de430 |
|---|---|
| 83 | 83 |
| 84 def end(self): | 84 def end(self): |
| 85 self._game.msg_runner = None | 85 self._game.msg_runner = None |
| 86 self._game.msg_wait = False | 86 self._game.msg_wait = False |
| 87 self.ended = True | 87 self.ended = True |
| 88 self._game.texts = [None] * 4 + self._game.texts[4:] | |
| 88 | 89 |
| 89 | 90 |
| 90 @instruction(0) | 91 @instruction(0) |
| 91 def unknown0(self): | 92 def unknown0(self): |
| 92 if self.allow_skip: | 93 if self.allow_skip: |
| 102 @instruction(2) | 103 @instruction(2) |
| 103 def change_face(self, side, index): | 104 def change_face(self, side, index): |
| 104 face = self._game.faces[side] | 105 face = self._game.faces[side] |
| 105 if face: | 106 if face: |
| 106 face.load(index) | 107 face.load(index) |
| 108 | |
| 109 | |
| 110 @instruction(3) | |
| 111 def display_text(self, side, index, text): | |
| 112 if index == 0: | |
| 113 self._game.texts[0] = None | |
| 114 self._game.texts[1] = None | |
| 115 self._game.texts[index] = self._game.new_native_text((64, 372 + index * 24), text) | |
| 116 self._game.texts[index].set_timeout(-1, effect='fadeout', duration=15) | |
| 107 | 117 |
| 108 | 118 |
| 109 @instruction(4) | 119 @instruction(4) |
| 110 def pause(self, duration): | 120 def pause(self, duration): |
| 111 if not (self.skipping and self.allow_skip): | 121 if not (self.skipping and self.allow_skip): |
| 127 @instruction(7) | 137 @instruction(7) |
| 128 def change_music(self, track): | 138 def change_music(self, track): |
| 129 self._game.music.play(track) | 139 self._game.music.play(track) |
| 130 | 140 |
| 131 | 141 |
| 142 @instruction(8) | |
| 143 def display_description(self, side, index, text): | |
| 144 assert side == 1 # It shouldn’t crash when it’s something else. | |
| 145 self._game.texts[2 + index] = self._game.new_native_text((336, 320 + index * 18), text, align='right') | |
| 146 | |
| 147 | |
| 132 @instruction(10) | 148 @instruction(10) |
| 133 def freeze(self): | 149 def freeze(self): |
| 134 self.frozen = True | 150 self.frozen = True |
| 135 | 151 |
| 136 | 152 |
