comparison pytouhou/games/eosd.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 18e4b121646b
children 5f5955635d2c
comparison
equal deleted inserted replaced
455:6864a38b2413 456:cae1ae9de430
19 from pytouhou.game.lasertype import LaserType 19 from pytouhou.game.lasertype import LaserType
20 from pytouhou.game.itemtype import ItemType 20 from pytouhou.game.itemtype import ItemType
21 from pytouhou.game.player import Player 21 from pytouhou.game.player import Player
22 from pytouhou.game.orb import Orb 22 from pytouhou.game.orb import Orb
23 from pytouhou.game.effect import Effect 23 from pytouhou.game.effect import Effect
24 from pytouhou.game.text import Text, Counter, Gauge 24 from pytouhou.game.text import Text, Counter, Gauge, NativeText
25 from pytouhou.game.background import Background 25 from pytouhou.game.background import Background
26 26
27 from pytouhou.vm.eclrunner import ECLMainRunner 27 from pytouhou.vm.eclrunner import ECLMainRunner
28 28
29 29
108 for sprite in anm.sprites.values(): 108 for sprite in anm.sprites.values():
109 self.msg_anm[i].append((anm, sprite)) 109 self.msg_anm[i].append((anm, sprite))
110 110
111 players = [EoSDPlayer(state, self, resource_loader, common.characters[state.character]) for state in player_states] 111 players = [EoSDPlayer(state, self, resource_loader, common.characters[state.character]) for state in player_states]
112 112
113 common.interface.start_stage(self, stage)
114
115 # Load stage data 113 # Load stage data
116 self.std = resource_loader.get_stage('stage%d.std' % stage) 114 self.std = resource_loader.get_stage('stage%d.std' % stage)
117 115
118 background_anm = resource_loader.get_single_anm('stg%dbg.anm' % stage) 116 background_anm = resource_loader.get_single_anm('stg%dbg.anm' % stage)
119 self.background = Background(self.std, background_anm) 117 self.background = Background(self.std, background_anm)
118
119 common.interface.start_stage(self, stage)
120 self.native_texts = [common.interface.stage_name, common.interface.song_name]
120 121
121 self.resource_loader = resource_loader #XXX: currently used for texture preload in pytouhou.ui.gamerunner. Wipe it! 122 self.resource_loader = resource_loader #XXX: currently used for texture preload in pytouhou.ui.gamerunner. Wipe it!
122 123
123 Game.__init__(self, players, stage, rank, difficulty, 124 Game.__init__(self, players, stage, rank, difficulty,
124 common.bullet_types, common.laser_types, 125 common.bullet_types, common.laser_types,
181 text = 'STAGE %d' % stage 182 text = 'STAGE %d' % stage
182 elif stage == 6: 183 elif stage == 6:
183 text = 'FINAL STAGE' 184 text = 'FINAL STAGE'
184 elif stage == 7: 185 elif stage == 7:
185 text = 'EXTRA STAGE' 186 text = 'EXTRA STAGE'
187
188 self.stage_name = NativeText((192, 200), unicode(game.std.name), shadow=True, align='center')
189 self.stage_name.set_timeout(240, effect='fadeout', duration=60, start=120)
190
191 self.set_song_name(game.std.bgms[0][0])
192
186 self.level_start = [Text((16+384/2, 200), self.ascii_anm, text=text, align='center')] #TODO: find the exact location. 193 self.level_start = [Text((16+384/2, 200), self.ascii_anm, text=text, align='center')] #TODO: find the exact location.
187 self.level_start[0].set_timeout(240, effect='fadeout', duration=60, start=120) 194 self.level_start[0].set_timeout(240, effect='fadeout', duration=60, start=120)
188 self.level_start[0].set_color('yellow') 195 self.level_start[0].set_color('yellow')
189 #TODO: use the system text for the stage name, and the song name. 196
197
198 def set_song_name(self, name):
199 #TODO: use the correct animation.
200 self.song_name = NativeText((384, 432), u'♪ ' + name, shadow=True, align='right')
201 self.song_name.set_timeout(240, effect='fadeout', duration=60, start=120)
190 202
191 203
192 def set_boss_life(self): 204 def set_boss_life(self):
193 if not self.game.boss: 205 if not self.game.boss:
194 return 206 return