Fixed compiler warning
[supertux.git] / src / badguy / stalactite.cpp
index 791cdc9..84febae 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "badguy/stalactite.hpp"
 
+#include "audio/sound_manager.hpp"
 #include "math/random_generator.hpp"
 #include "object/bullet.hpp"
 #include "object/player.hpp"
@@ -34,6 +35,9 @@ Stalactite::Stalactite(const Reader& lisp) :
 {
   countMe = false;
   set_colgroup_active(COLGROUP_TOUCHABLE);
+  SoundManager::current()->preload("sounds/cracking.wav");
+  SoundManager::current()->preload("sounds/sizzle.ogg");
+  SoundManager::current()->preload("sounds/icecrash.ogg");
 }
 
 void
@@ -48,6 +52,7 @@ Stalactite::active_update(float elapsed_time)
          && player->get_bbox().p1.y < bbox.p2.y + SHAKE_RANGE_Y) {
         timer.start(SHAKE_TIME);
         state = STALACTITE_SHAKING;
+        SoundManager::current()->play("sounds/cracking.wav", get_pos());
       }
     }
   } else if(state == STALACTITE_SHAKING) {
@@ -71,6 +76,7 @@ Stalactite::squish()
   physic.set_velocity_y(0);
   set_state(STATE_SQUISHED);
   sprite->set_action("squished");
+  SoundManager::current()->play("sounds/icecrash.ogg", get_pos());
   set_group(COLGROUP_MOVING_ONLY_STATIC);
   run_dead_script();
 }
@@ -122,6 +128,9 @@ Stalactite::collision_bullet(Bullet& bullet, const CollisionHit& )
     timer.start(SHAKE_TIME);
     state = STALACTITE_SHAKING;
     bullet.remove_me();
+    if(bullet.get_type() == FIRE_BONUS)
+      SoundManager::current()->play("sounds/sizzle.ogg", get_pos());
+    SoundManager::current()->play("sounds/cracking.wav", get_pos());
   }
 
   return FORCE_MOVE;