comparison pytouhou/games/eosd.py @ 503:c622eaf64428

Optimize GameRunner some more, fix replay, and remove Window dependency in Renderer.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 04 Oct 2013 14:27:11 +0200
parents 6be9c99a3a24
children 1bc014f9d572
comparison
equal deleted inserted replaced
502:3d3285918ba1 503:c622eaf64428
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, player_characters, continues, stage): 31 def __init__(self, resource_loader, player_characters, continues, stage,
32 width=384, height=448):
33 self.width, self.height = width, height
34
32 self.etama = resource_loader.get_multi_anm(('etama3.anm', 'etama4.anm')) 35 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, 36 self.bullet_types = [BulletType(self.etama[0], 0, 11, 14, 15, 16, hitbox_size=2,
34 type_id=0), 37 type_id=0),
35 BulletType(self.etama[0], 1, 12, 17, 18, 19, hitbox_size=3, 38 BulletType(self.etama[0], 1, 12, 17, 18, 19, hitbox_size=3,
36 type_id=1), 39 type_id=1),
97 100
98 101
99 102
100 class EoSDGame(Game): 103 class EoSDGame(Game):
101 def __init__(self, resource_loader, stage, rank, difficulty, 104 def __init__(self, resource_loader, stage, rank, difficulty,
102 common, nb_bullets_max=640, width=384, height=448, prng=None, 105 common, prng=None, hints=None, friendly_fire=True,
103 hints=None, friendly_fire=True): 106 nb_bullets_max=640):
104 107
105 self.etama = common.etama #XXX 108 self.etama = common.etama #XXX
106 try: 109 try:
107 self.enm_anm = resource_loader.get_multi_anm(('stg%denm.anm' % stage, 110 self.enm_anm = resource_loader.get_multi_anm(('stg%denm.anm' % stage,
108 'stg%denm2.anm' % stage)) 111 'stg%denm2.anm' % stage))
133 self.background = Background(self.std, background_anm) 136 self.background = Background(self.std, background_anm)
134 137
135 common.interface.start_stage(self, stage) 138 common.interface.start_stage(self, stage)
136 self.native_texts = [common.interface.stage_name, common.interface.song_name] 139 self.native_texts = [common.interface.stage_name, common.interface.song_name]
137 140
138 self.resource_loader = resource_loader #XXX: currently used for texture preload in pytouhou.ui.gamerunner. Wipe it!
139
140 Game.__init__(self, common.players, stage, rank, difficulty, 141 Game.__init__(self, common.players, stage, rank, difficulty,
141 common.bullet_types, common.laser_types, 142 common.bullet_types, common.laser_types,
142 common.item_types, nb_bullets_max, width, height, prng, 143 common.item_types, nb_bullets_max, common.width,
143 common.interface, hints, friendly_fire) 144 common.height, prng, common.interface, hints,
145 friendly_fire)
144 146
145 147
146 148
147 class EoSDInterface(object): 149 class EoSDInterface(object):
148 def __init__(self, resource_loader, player_state): 150 def __init__(self, resource_loader, player_state):