diff eosd @ 434:18e4b121646b

Move the common parts of EoSDGame outside, to not reallocate them at each stage.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 11 Aug 2013 14:30:52 +0200
parents 77c0e9a53795
children b0abb05811f7
line wrap: on
line diff
--- a/eosd
+++ b/eosd
@@ -55,7 +55,7 @@ import logging
 from pytouhou.ui.window import Window
 from pytouhou.resource.loader import Loader
 from pytouhou.ui.gamerunner import GameRunner
-from pytouhou.games.eosd import EoSDGame
+from pytouhou.games.eosd import EoSDCommon, EoSDGame
 from pytouhou.game.game import GameOver
 from pytouhou.game.player import PlayerState
 from pytouhou.formats.t6rp import T6RP, Level
@@ -145,6 +145,7 @@ def main(path, data, stage_num, rank, ch
 
     game_class = EoSDGameBossRush if boss_rush else EoSDGame
 
+    common = EoSDCommon(resource_loader)
     runner = GameRunner(window, resource_loader, skip=skip_replay)
     while True:
         if replay:
@@ -182,7 +183,7 @@ def main(path, data, stage_num, rank, ch
 
         hints_stage = hints.stages[stage_num - 1] if hints else None
 
-        game = game_class(resource_loader, states, stage_num, rank, difficulty, prng=prng, continues=continues, hints=hints_stage)
+        game = game_class(resource_loader, states, stage_num, rank, difficulty, common, prng=prng, continues=continues, hints=hints_stage)
 
         if not enable_particles:
             def new_particle(pos, anim, amp, number=1, reverse=False, duration=24):