New sounds: cracking, icecrash, pop, and sizzle.
authorLMH <lmh.0013@gmail.com>
Tue, 17 Sep 2013 06:33:03 +0000 (20:33 -1000)
committerTobias Markus <tobbi@mozilla-uk.org>
Sat, 26 Oct 2013 16:45:23 +0000 (18:45 +0200)
Also changed code to make use of them:
stalactite- cracking when disturbed, icecrash when hits, sizzle when hit with fire.
explosion(short_fuse)- firecracker instead of explosion.
snowman- pop when head comes off.
flame, iceflame, livefire, weak_block- sizzle when hit by bullet.

14 files changed:
data/sounds/cracking.wav [new file with mode: 0644]
data/sounds/firecracker.ogg [new file with mode: 0644]
data/sounds/icecrash.ogg [new file with mode: 0644]
data/sounds/pop.ogg [new file with mode: 0644]
data/sounds/sizzle.ogg [new file with mode: 0644]
src/badguy/flame.cpp
src/badguy/iceflame.cpp
src/badguy/livefire.cpp
src/badguy/livefire.hpp
src/badguy/short_fuse.cpp
src/badguy/snowman.cpp
src/badguy/stalactite.cpp
src/object/explosion.cpp
src/object/weak_block.cpp

diff --git a/data/sounds/cracking.wav b/data/sounds/cracking.wav
new file mode 100644 (file)
index 0000000..b8228c8
Binary files /dev/null and b/data/sounds/cracking.wav differ
diff --git a/data/sounds/firecracker.ogg b/data/sounds/firecracker.ogg
new file mode 100644 (file)
index 0000000..f4c6600
Binary files /dev/null and b/data/sounds/firecracker.ogg differ
diff --git a/data/sounds/icecrash.ogg b/data/sounds/icecrash.ogg
new file mode 100644 (file)
index 0000000..c87676f
Binary files /dev/null and b/data/sounds/icecrash.ogg differ
diff --git a/data/sounds/pop.ogg b/data/sounds/pop.ogg
new file mode 100644 (file)
index 0000000..a69f8a7
Binary files /dev/null and b/data/sounds/pop.ogg differ
diff --git a/data/sounds/sizzle.ogg b/data/sounds/sizzle.ogg
new file mode 100644 (file)
index 0000000..2978a53
Binary files /dev/null and b/data/sounds/sizzle.ogg differ
index 705344c..a06039f 100644 (file)
@@ -108,8 +108,7 @@ Flame::kill_fall()
 void
 Flame::freeze()
 {
-  //TODO: get unique death sound
-  sound_manager->play("sounds/fizz.wav", get_pos());
+  sound_manager->play("sounds/sizzle.ogg", get_pos());
   sprite->set_action("fade", 1);
   Sector::current()->add_object(new SpriteParticle("images/objects/particles/smoke.sprite", "default", bbox.get_middle(), ANCHOR_MIDDLE, Vector(0, -150), Vector(0,0), LAYER_BACKGROUNDTILES+2));
   set_group(COLGROUP_DISABLED);
index 2de434d..7160036 100644 (file)
@@ -40,8 +40,7 @@ Iceflame::Iceflame(const Reader& reader) :
   bbox.set_pos(Vector(start_position.x + cos(angle) * radius,
                       start_position.y + sin(angle) * radius));
   countMe = false;
-  //TODO: get unique death sound
-  sound_manager->preload("sounds/fizz.wav");
+  sound_manager->preload("sounds/sizzle.ogg");
   
   set_colgroup_active(COLGROUP_TOUCHABLE);
   
@@ -87,7 +86,7 @@ Iceflame::kill_fall()
 void
 Iceflame::ignite()
 {
-  sound_manager->play("sounds/fizz.wav", get_pos());
+  sound_manager->play("sounds/sizzle.ogg", get_pos());
   sprite->set_action("fade", 1);
   Sector::current()->add_object(new SpriteParticle("images/objects/particles/smoke.sprite", "default", bbox.get_middle(), ANCHOR_MIDDLE, Vector(0, -150), Vector(0,0), LAYER_BACKGROUNDTILES+2));
   set_group(COLGROUP_DISABLED);
index 1fa5cba..9fb56a7 100644 (file)
@@ -35,6 +35,7 @@ LiveFire::LiveFire(const Reader& reader) :
   max_drop_height = MAXDROPHEIGHT;
   lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
   lightsprite->set_color(Color(1.0f, 0.9f, 0.8f));
+  death_sound = "sounds/fall.wav";
 }
 
 void
@@ -86,19 +87,16 @@ LiveFire::active_update(float elapsed_time) {
         state = STATE_WAKING;
       }
     }
-
-    BadGuy::active_update(elapsed_time);
   }
-
-  if(state == STATE_WAKING) {
+  else if(state == STATE_WAKING) {
     if(sprite->animation_done()) {
       // start walking
       state = STATE_WALKING;
       WalkingBadguy::initialize();
     }
-
-    BadGuy::active_update(elapsed_time);
   }
+
+  BadGuy::active_update(elapsed_time);
 }
 
 void
@@ -117,6 +115,7 @@ void
 LiveFire::freeze()
 {
   // attempting to freeze a flame causes it to go out
+  death_sound = "sounds/sizzle.ogg";
   kill_fall();
 }
 
@@ -135,8 +134,7 @@ LiveFire::is_flammable() const
 void
 LiveFire::kill_fall()
 {
-  //TODO: get unique sound for ice-fire encounters
-  sound_manager->play("sounds/fall.wav", get_pos());
+  sound_manager->play(death_sound, get_pos());
   // throw a puff of smoke
   Vector ppos = bbox.get_middle();
   Vector pspeed = Vector(0, -150);
index ff0db66..e1c6e8a 100644 (file)
@@ -37,6 +37,7 @@ public:
 
 private:
   SpritePtr lightsprite;
+  std::string death_sound;
 
 protected:
   enum SState {
index 127691f..8b07a3e 100644 (file)
@@ -15,7 +15,6 @@
 //  You should have received a copy of the GNU General Public License
 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-#include "audio/sound_manager.hpp"
 #include "badguy/bomb.hpp"
 #include "badguy/short_fuse.hpp"
 #include "object/bullet.hpp"
@@ -36,9 +35,6 @@ ShortFuse::ShortFuse(const Reader& reader) :
   walk_speed = 100;
   max_drop_height = -1;
 
-  //Prevent stutter when Tux jumps on Mr Bomb
-  sound_manager->preload("sounds/explosion.wav");
-
   //Check if we need another sprite
   if( !reader.get( "sprite", sprite_name ) ){
     return;
index 5cbd5c7..a10951f 100644 (file)
@@ -26,12 +26,7 @@ Snowman::Snowman(const Reader& reader) :
   WalkingBadguy(reader, "images/creatures/snowman/snowman.sprite", "walk-left", "walk-right")
 {
   walk_speed = 40;
-}
-
-Snowman::Snowman(const Vector& pos, Direction d) :
-  WalkingBadguy(pos, d, "images/creatures/snowman/snowman.sprite", "walk-left", "walk-right")
-{
-  walk_speed = 40;
+  sound_manager->preload("sounds/pop.ogg");
 }
 
 void
@@ -63,8 +58,7 @@ Snowman::collision_bullet(Bullet& bullet, const CollisionHit& hit)
     // fire bullets destroy snowman's body
     loose_head();
 
-    // FIXME: the sound used here should differ since there is still a threat
-    sound_manager->play("sounds/fall.wav", get_pos());
+    sound_manager->play("sounds/pop.ogg", get_pos()); // this could be a different sound
     bullet.remove_me();
 
     return ABORT_MOVE;
@@ -84,8 +78,7 @@ Snowman::collision_squished(GameObject& object)
   if (player)
     player->bounce(*this);
 
-  // FIXME: the squish sound isn't best here
-  sound_manager->play("sounds/squish.wav", get_pos());
+  sound_manager->play("sounds/pop.ogg", get_pos());
 
   loose_head();
 
index 791cdc9..5e6e837 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);
+  sound_manager->preload("sounds/cracking.wav");
+  sound_manager->preload("sounds/sizzle.ogg");
+  sound_manager->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;
+        sound_manager->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");
+  sound_manager->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)
+      sound_manager->play("sounds/sizzle.ogg", get_pos());
+    sound_manager->play("sounds/cracking.wav", get_pos());
   }
 
   return FORCE_MOVE;
index 3af1c15..543ef2b 100644 (file)
@@ -38,6 +38,7 @@ Explosion::Explosion(const Vector& pos) :
   lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-large.sprite"))
 {
   sound_manager->preload("sounds/explosion.wav");
+  sound_manager->preload("sounds/firecracker.ogg");
   set_pos(get_pos() - (get_bbox().get_middle() - get_pos()));
   lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
   lightsprite->set_color(Color(0.6f, 0.6f, 0.6f));
@@ -52,6 +53,7 @@ Explosion::Explosion(const Reader& reader) :
   lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-large.sprite"))
 {
   sound_manager->preload("sounds/explosion.wav");
+  sound_manager->preload("sounds/firecracker.ogg");
   lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
   lightsprite->set_color(Color(0.6f, 0.6f, 0.6f));
 }
@@ -63,9 +65,13 @@ Explosion::explode()
     return;
   state = STATE_EXPLODING;
 
-  set_action("default", 1);
+  set_action("default", 1); //TODO: the less-threatening short_fuse explosion should look less-threatening
   sprite->set_animation_loops(1); //TODO: this is necessary because set_action will not set "loops" when "action" is the default action
-  sound_manager->play("sounds/explosion.wav", get_pos());
+  if (hurt)
+    sound_manager->play("sounds/explosion.wav", get_pos());
+  else
+    sound_manager->play("sounds/firecracker.ogg", get_pos());
+    
 
 #if 0
   // spawn some particles
index f5c23fd..6b89cc1 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "object/weak_block.hpp"
 
+#include "audio/sound_manager.hpp"
 #include "math/random_generator.hpp"
 #include "object/bullet.hpp"
 #include "object/explosion.hpp"
@@ -43,8 +44,11 @@ WeakBlock::WeakBlock(const Reader& lisp)
       sprite->set_action("normal");
     }
   }
-  lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
-  lightsprite->set_color(Color(0.3f, 0.2f, 0.1f));
+  if(sprite_name == "images/objects/weak_block/strawbox.sprite") {
+    lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
+    lightsprite->set_color(Color(0.3f, 0.2f, 0.1f));
+  } else if(sprite_name == "images/objects/weak_block/meltbox.sprite")
+    sound_manager->preload("sounds/sizzle.ogg");
 }
 
 HitResponse
@@ -165,6 +169,8 @@ WeakBlock::startBurning()
   if (state != STATE_NORMAL) return;
   state = STATE_BURNING;
   sprite->set_action("burning", 1);
+  if(sprite_name == "images/objects/weak_block/meltbox.sprite")
+    sound_manager->play("sounds/sizzle.ogg");
 }
 
 void