Merge branch 'feature/init-cleanup'
[supertux.git] / src / badguy / haywire.cpp
index 97d1ead..f3d7242 100644 (file)
@@ -34,13 +34,15 @@ Haywire::Haywire(const Reader& reader) :
   is_exploding(false),
   time_until_explosion(0.0f),
   is_stunned(false),
-  time_stunned(0.0f)
+  time_stunned(0.0f),
+  ticking(),
+  grunting()
 {
   walk_speed = 80;
   max_drop_height = 16;
 
   //Prevent stutter when Tux jumps on Mr Bomb
-  sound_manager->preload("sounds/explosion.wav");
+  SoundManager::current()->preload("sounds/explosion.wav");
 
   //Check if we need another sprite
   if( !reader.get( "sprite", sprite_name ) ){
@@ -51,7 +53,7 @@ Haywire::Haywire(const Reader& reader) :
     return;
   }
   //Replace sprite
-  sprite = sprite_manager->create( sprite_name );
+  sprite = SpriteManager::current()->create( sprite_name );
 }
 
 HitResponse
@@ -81,7 +83,7 @@ Haywire::collision_squished(GameObject& object)
       player->bounce (*this);
     return true;
   }
-  
+
   if(WalkingBadguy::is_frozen()) {
     WalkingBadguy::unfreeze();
   }
@@ -94,16 +96,16 @@ Haywire::collision_squished(GameObject& object)
     time_until_explosion = TIME_EXPLOSION;
     is_exploding = true;
 
-    ticking.reset(sound_manager->create_sound_source("sounds/fizz.wav"));
+    ticking = SoundManager::current()->create_sound_source("sounds/fizz.wav");
     ticking->set_position(get_pos());
     ticking->set_looping(true);
     ticking->set_reference_distance(32);
     ticking->play();
-    grunting.reset(sound_manager->create_sound_source("sounds/grunts.ogg"));
+    grunting = SoundManager::current()->create_sound_source("sounds/grunts.ogg");
     grunting->set_position(get_pos());
     grunting->set_looping(true);
     grunting->set_reference_distance(32);
-    grunting->play();    
+    grunting->play();
   }
 
   time_stunned = TIME_STUNNED;
@@ -178,13 +180,6 @@ Haywire::kill_fall()
   run_dead_script();
 }
 
-void
-Haywire::freeze()
-{
-  WalkingBadguy::freeze();
-  sprite->set_action(dir == LEFT ? "iced-left" : "iced-right");
-}
-
 bool
 Haywire::is_freezable() const
 {