Mercurial > touhou
comparison pytouhou/game/game.py @ 306:52d791bb7c32
Rename a few attributes/methods to make a little more sense.
| author | Thibaut Girka <thib@sitedethib.com> |
|---|---|
| date | Tue, 13 Mar 2012 19:18:14 +0100 |
| parents | 5492472963b0 |
| children | f0be7ea62330 |
comparison
equal
deleted
inserted
replaced
| 305:5492472963b0 | 306:52d791bb7c32 |
|---|---|
| 68 'stg%denm2.anm' % stage)) | 68 'stg%denm2.anm' % stage)) |
| 69 self.etama4 = resource_loader.get_anm_wrapper(('etama4.anm',)) | 69 self.etama4 = resource_loader.get_anm_wrapper(('etama4.anm',)) |
| 70 ecl = resource_loader.get_ecl('ecldata%d.ecl' % stage) | 70 ecl = resource_loader.get_ecl('ecldata%d.ecl' % stage) |
| 71 self.ecl_runner = ECLMainRunner(ecl, self) | 71 self.ecl_runner = ECLMainRunner(ecl, self) |
| 72 | 72 |
| 73 self.effect_anm_wrapper = resource_loader.get_anm_wrapper(('eff0%d.anm' % stage,)) | 73 self.spellcard_effect_anm_wrapper = resource_loader.get_anm_wrapper(('eff0%d.anm' % stage,)) |
| 74 self.effect = None | 74 self.spellcard_effect = None |
| 75 | 75 |
| 76 # See 102h.exe@0x413220 if you think you're brave enough. | 76 # See 102h.exe@0x413220 if you think you're brave enough. |
| 77 self.deaths_count = self.prng.rand_uint16() % 3 | 77 self.deaths_count = self.prng.rand_uint16() % 3 |
| 78 self.next_bonus = self.prng.rand_uint16() % 8 | 78 self.next_bonus = self.prng.rand_uint16() % 8 |
| 79 | 79 |
| 100 self.difficulty = self.difficulty_min | 100 self.difficulty = self.difficulty_min |
| 101 elif self.difficulty > self.difficulty_max: | 101 elif self.difficulty > self.difficulty_max: |
| 102 self.difficulty = self.difficulty_max | 102 self.difficulty = self.difficulty_max |
| 103 | 103 |
| 104 | 104 |
| 105 def enable_effect(self): | 105 def enable_spellcard_effect(self): |
| 106 self.effect = Effect((-32., -16.), 0, self.effect_anm_wrapper) #TODO: find why this offset is necessary. | 106 self.spellcard_effect = Effect((-32., -16.), 0, |
| 107 self.effect.sprite.allow_dest_offset = True #TODO: should be the role of anm’s 25th instruction. Investigate! | 107 self.spellcard_effect_anm_wrapper) #TODO: find why this offset is necessary. |
| 108 | 108 self.spellcard_effect.sprite.allow_dest_offset = True #TODO: should be the role of anm’s 25th instruction. Investigate! |
| 109 | 109 |
| 110 def disable_effect(self): | 110 |
| 111 self.effect = None | 111 def disable_spellcard_effect(self): |
| 112 self.spellcard_effect = None | |
| 112 | 113 |
| 113 | 114 |
| 114 def drop_bonus(self, x, y, _type, end_pos=None): | 115 def drop_bonus(self, x, y, _type, end_pos=None): |
| 115 player = self.players[0] #TODO | 116 player = self.players[0] #TODO |
| 116 if _type > 6: | 117 if _type > 6: |
| 176 # 3. Let's play! | 177 # 3. Let's play! |
| 177 # In the original game, updates are done in prioritized functions called "chains" | 178 # In the original game, updates are done in prioritized functions called "chains" |
| 178 # We have to mimic this functionnality to be replay-compatible with the official game. | 179 # We have to mimic this functionnality to be replay-compatible with the official game. |
| 179 | 180 |
| 180 # Pri 6 is background | 181 # Pri 6 is background |
| 181 self.update_effect() #TODO: Pri unknown | 182 self.update_background() #TODO: Pri unknown |
| 182 if self.msg_runner: | 183 if self.msg_runner: |
| 183 self.update_msg(keystate) # Pri ? | 184 self.update_msg(keystate) # Pri ? |
| 184 keystate &= ~3 # Remove the ability to attack (keystates 1 and 2). | 185 keystate &= ~3 # Remove the ability to attack (keystates 1 and 2). |
| 185 self.update_players(keystate) # Pri 7 | 186 self.update_players(keystate) # Pri 7 |
| 186 self.update_enemies() # Pri 9 | 187 self.update_enemies() # Pri 9 |
| 194 self.cleanup() | 195 self.cleanup() |
| 195 | 196 |
| 196 self.frame += 1 | 197 self.frame += 1 |
| 197 | 198 |
| 198 | 199 |
| 199 def update_effect(self): | 200 def update_background(self): |
| 200 if self.time_stop: | 201 if self.time_stop: |
| 201 return None | 202 return None |
| 202 if self.effect is not None: | 203 if self.spellcard_effect is not None: |
| 203 self.effect.update() | 204 self.spellcard_effect.update() |
| 205 #TODO: update the actual background here? | |
| 204 | 206 |
| 205 | 207 |
| 206 def update_enemies(self): | 208 def update_enemies(self): |
| 207 for enemy in self.enemies: | 209 for enemy in self.enemies: |
| 208 enemy.update() | 210 enemy.update() |
