comparison pytouhou/game/game.py @ 217:577f45454402

Change background during spellcards.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 17 Dec 2011 21:18:39 +0100
parents d07506a2e16e
children 0595315d3880
comparison
equal deleted inserted replaced
216:a842ddd471fd 217:577f45454402
58 'stg%denm2.anm' % stage)) 58 'stg%denm2.anm' % stage))
59 self.etama4 = resource_loader.get_anm_wrapper(('etama4.anm',)) 59 self.etama4 = resource_loader.get_anm_wrapper(('etama4.anm',))
60 ecl = resource_loader.get_ecl('ecldata%d.ecl' % stage) 60 ecl = resource_loader.get_ecl('ecldata%d.ecl' % stage)
61 self.ecl_runner = ECLMainRunner(ecl, self) 61 self.ecl_runner = ECLMainRunner(ecl, self)
62 62
63 self.effect_anm_wrapper = resource_loader.get_anm_wrapper(('eff0%d.anm' % stage,))
64 self.effect = None
65
63 # See 102h.exe@0x413220 if you think you're brave enough. 66 # See 102h.exe@0x413220 if you think you're brave enough.
64 self.deaths_count = self.prng.rand_uint16() % 3 67 self.deaths_count = self.prng.rand_uint16() % 3
65 self.next_bonus = self.prng.rand_uint16() % 8 68 self.next_bonus = self.prng.rand_uint16() % 8
66 69
67 70
77 self.difficulty = self.difficulty_min 80 self.difficulty = self.difficulty_min
78 elif self.difficulty > self.difficulty_max: 81 elif self.difficulty > self.difficulty_max:
79 self.difficulty = self.difficulty_max 82 self.difficulty = self.difficulty_max
80 83
81 84
85 def enable_effect(self):
86 self.effect = Effect((0, 0), 0, self.effect_anm_wrapper)
87
88
89 def disable_effect(self):
90 self.effect = None
91
92
82 def drop_bonus(self, x, y, _type, end_pos=None): 93 def drop_bonus(self, x, y, _type, end_pos=None):
83 player = self.players[0] #TODO 94 player = self.players[0] #TODO
84 if _type > 6: 95 if _type > 6:
85 return 96 return
86 item_type = self.item_types[_type] 97 item_type = self.item_types[_type]
133 # 3. Let's play! 144 # 3. Let's play!
134 # In the original game, updates are done in prioritized functions called "chains" 145 # In the original game, updates are done in prioritized functions called "chains"
135 # We have to mimic this functionnality to be replay-compatible with the official game. 146 # We have to mimic this functionnality to be replay-compatible with the official game.
136 147
137 # Pri 6 is background 148 # Pri 6 is background
149 self.update_effect() #TODO: Pri unknown
138 self.update_players(keystate) # Pri 7 150 self.update_players(keystate) # Pri 7
139 self.update_enemies() # Pri 9 151 self.update_enemies() # Pri 9
140 self.update_effects() # Pri 10 152 self.update_effects() # Pri 10
141 self.update_bullets() # Pri 11 153 self.update_bullets() # Pri 11
142 # Pri 12 is HUD 154 # Pri 12 is HUD
143 155
144 # 4. Cleaning 156 # 4. Cleaning
145 self.cleanup() 157 self.cleanup()
146 158
147 self.frame += 1 159 self.frame += 1
160
161
162 def update_effect(self):
163 if self.effect is not None:
164 self.effect.update()
148 165
149 166
150 def update_enemies(self): 167 def update_enemies(self):
151 for enemy in self.enemies: 168 for enemy in self.enemies:
152 enemy.update() 169 enemy.update()