changeset 159:4684d311a32d

Remove remaining pop_enemy/new_enemy mess
author Thibaut Girka <thib@sitedethib.com>
date Mon, 10 Oct 2011 19:01:23 +0200
parents 7769ce7be03c
children 606468ab4f7b
files pytouhou/game/enemy.py pytouhou/game/game.py pytouhou/vm/eclrunner.py
diffstat 3 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/pytouhou/game/enemy.py
+++ b/pytouhou/game/enemy.py
@@ -22,7 +22,7 @@ from math import cos, sin, atan2, pi
 
 
 class Enemy(object):
-    def __init__(self, pos, life, _type, bonus_dropped, anm_wrapper, game, pop_enemy):
+    def __init__(self, pos, life, _type, bonus_dropped, anm_wrapper, game):
         self._game = game
         self._anm_wrapper = anm_wrapper
         self._sprite = None
@@ -71,8 +71,6 @@ class Enemy(object):
         self.hitbox_half_size = (0, 0)
         self.screen_box = None
 
-        self.pop_enemy = pop_enemy
-
 
     def set_bullet_attributes(self, type_, anim, sprite_idx_offset,
                               bullets_per_shot, number_of_shots, speed, speed2,
--- a/pytouhou/game/game.py
+++ b/pytouhou/game/game.py
@@ -65,8 +65,8 @@ class Game(object):
         self.bullets = []
 
 
-    def new_enemy(self, pos, life, instr_type, bonus_dropped, pop_enemy):
-        enemy = Enemy(pos, life, instr_type, bonus_dropped, self.enm_anm_wrapper, self, pop_enemy)
+    def new_enemy(self, pos, life, instr_type, bonus_dropped):
+        enemy = Enemy(pos, life, instr_type, bonus_dropped, self.enm_anm_wrapper, self)
         self.enemies.append(enemy)
         return enemy
 
--- a/pytouhou/vm/eclrunner.py
+++ b/pytouhou/vm/eclrunner.py
@@ -69,7 +69,7 @@ class ECLMainRunner(object):
                 y = self._game.prng.rand_double() * 416
             if z < -990: #102h.exe@0x411881
                 y = self._game.prng.rand_double() * 800
-        enemy = self._game.new_enemy((x, y), life, instr_type, bonus_dropped, self._pop_enemy)
+        enemy = self._game.new_enemy((x, y), life, instr_type, bonus_dropped)
         process = ECLRunner(self._ecl, sub, enemy, self._game)
         self.processes.append(process)
         process.run_iteration()
@@ -682,7 +682,7 @@ class ECLRunner(object):
 
     @instruction(95)
     def pop_enemy(self, sub, x, y, z, life, bonus_dropped, unknown2):
-        self._enemy.pop_enemy(sub, 0, self._getval(x), self._getval(y), 0, life, bonus_dropped, unknown2, 0) # TODO: check about unknown values
+        self._game.ecl_runner._pop_enemy(sub, 0, self._getval(x), self._getval(y), 0, life, bonus_dropped, unknown2, 0) # TODO: check about unknown values
 
 
     @instruction(96)