Mercurial > touhou
comparison pytouhou/vm/msgrunner.py @ 516:577c3a88fb67
Merge the lists Game.texts and Game.native_texts into the Game.texts dict.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sun, 11 May 2014 20:25:07 +0200 |
parents | 6be9c99a3a24 |
children | e35a083d4208 |
comparison
equal
deleted
inserted
replaced
515:b3193b43a86c | 516:577c3a88fb67 |
---|---|
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 texts = self._game.texts |
89 if 'boss_name' in texts: | |
90 del texts['boss_name'] | |
91 if 'boss_title' in texts: | |
92 del texts['boss_title'] | |
93 if 'dialog_0' in texts: | |
94 del texts['dialog_0'] | |
95 if 'dialog_1' in texts: | |
96 del texts['dialog_1'] | |
89 | 97 |
90 | 98 |
91 @instruction(0) | 99 @instruction(0) |
92 def unknown0(self): | 100 def unknown0(self): |
93 if self.allow_skip: | 101 if self.allow_skip: |
107 face.load(index) | 115 face.load(index) |
108 | 116 |
109 | 117 |
110 @instruction(3) | 118 @instruction(3) |
111 def display_text(self, side, index, text): | 119 def display_text(self, side, index, text): |
120 texts = self._game.texts | |
112 if index == 0: | 121 if index == 0: |
113 self._game.texts[0] = None | 122 if 'dialog_0' in texts: |
114 self._game.texts[1] = None | 123 del texts['dialog_0'] |
115 self._game.texts[index] = self._game.new_native_text((64, 372 + index * 24), text) | 124 if 'dialog_1' in texts: |
116 self._game.texts[index].set_timeout(0, effect='fadeout', duration=15) | 125 del texts['dialog_1'] |
126 texts['dialog_%d' % index] = self._game.new_native_text((64, 372 + index * 24), text) | |
127 texts['dialog_%d' % index].set_timeout(0, effect='fadeout', duration=15) | |
117 | 128 |
118 | 129 |
119 @instruction(4) | 130 @instruction(4) |
120 def pause(self, duration): | 131 def pause(self, duration): |
121 if not (self.skipping and self.allow_skip): | 132 if not (self.skipping and self.allow_skip): |
140 | 151 |
141 | 152 |
142 @instruction(8) | 153 @instruction(8) |
143 def display_description(self, side, index, text): | 154 def display_description(self, side, index, text): |
144 assert side == 1 # It shouldn’t crash when it’s something else. | 155 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') | 156 key = 'boss_name' if index == 0 else 'boss_title' |
157 self._game.texts[key] = self._game.new_native_text((336, 320 + index * 18), text, align='right') | |
146 | 158 |
147 | 159 |
148 @instruction(10) | 160 @instruction(10) |
149 def freeze(self): | 161 def freeze(self): |
150 self.frozen = True | 162 self.frozen = True |