comparison pytouhou/games/eosd.py @ 487:711c75115675

Various netplay-related fixes.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 28 Sep 2013 20:11:41 +0200
parents 06f0eeb519bb
children 887de1309491
comparison
equal deleted inserted replaced
486:2f53be1b2f60 487:711c75115675
26 26
27 from pytouhou.vm.eclrunner import ECLMainRunner 27 from pytouhou.vm.eclrunner import ECLMainRunner
28 28
29 29
30 class EoSDCommon(object): 30 class EoSDCommon(object):
31 def __init__(self, resource_loader): 31 def __init__(self, resource_loader, player_state):
32 self.etama = resource_loader.get_multi_anm(('etama3.anm', 'etama4.anm')) 32 self.etama = resource_loader.get_multi_anm(('etama3.anm', 'etama4.anm'))
33 self.bullet_types = [BulletType(self.etama[0], 0, 11, 14, 15, 16, hitbox_size=2, 33 self.bullet_types = [BulletType(self.etama[0], 0, 11, 14, 15, 16, hitbox_size=2,
34 type_id=0), 34 type_id=0),
35 BulletType(self.etama[0], 1, 12, 17, 18, 19, hitbox_size=3, 35 BulletType(self.etama[0], 1, 12, 17, 18, 19, hitbox_size=3,
36 type_id=1), 36 type_id=1),
73 ('face09a.anm', 'face09b.anm'), 73 ('face09a.anm', 'face09b.anm'),
74 ('face09b.anm', 'face10a.anm', 'face10b.anm'), 74 ('face09b.anm', 'face10a.anm', 'face10b.anm'),
75 ('face08a.anm', 'face12a.anm', 'face12b.anm', 'face12c.anm')] 75 ('face08a.anm', 'face12a.anm', 'face12b.anm', 'face12c.anm')]
76 76
77 self.characters = resource_loader.get_eosd_characters() 77 self.characters = resource_loader.get_eosd_characters()
78 self.interface = EoSDInterface(resource_loader) 78 self.interface = EoSDInterface(resource_loader, player_state)
79 79
80 80
81 81
82 class EoSDGame(Game): 82 class EoSDGame(Game):
83 def __init__(self, resource_loader, player_states, stage, rank, difficulty, 83 def __init__(self, resource_loader, player_states, stage, rank, difficulty,
127 common.interface, hints) 127 common.interface, hints)
128 128
129 129
130 130
131 class EoSDInterface(object): 131 class EoSDInterface(object):
132 def __init__(self, resource_loader): 132 def __init__(self, resource_loader, player_state):
133 self.game = None 133 self.game = None
134 self.player_state = player_state
134 front = resource_loader.get_single_anm('front.anm') 135 front = resource_loader.get_single_anm('front.anm')
135 self.ascii_anm = resource_loader.get_single_anm('ascii.anm') 136 self.ascii_anm = resource_loader.get_single_anm('ascii.anm')
136 137
137 self.width = 640 138 self.width = 640
138 self.height = 480 139 self.height = 480
219 for elem in self.level_start: 220 for elem in self.level_start:
220 elem.update() 221 elem.update()
221 if elem.removed: #XXX 222 if elem.removed: #XXX
222 self.level_start = [] 223 self.level_start = []
223 224
224 player_state = self.game.players[0].state 225 player_state = self.player_state
225 226
226 self.highscore = max(self.highscore, player_state.effective_score) 227 self.highscore = max(self.highscore, player_state.effective_score)
227 self.labels['highscore'].set_text('%09d' % self.highscore) 228 self.labels['highscore'].set_text('%09d' % self.highscore)
228 self.labels['score'].set_text('%09d' % player_state.effective_score) 229 self.labels['score'].set_text('%09d' % player_state.effective_score)
229 self.labels['power'].set_text('%d' % player_state.power) 230 self.labels['power'].set_text('%d' % player_state.power)