From: LMH Date: Tue, 17 Sep 2013 06:33:03 +0000 (-1000) Subject: New sounds: cracking, icecrash, pop, and sizzle. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=2da0aee5449da7a482152d9544553d68d70a7bed;p=supertux.git New sounds: cracking, icecrash, pop, and sizzle. 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. --- diff --git a/data/sounds/cracking.wav b/data/sounds/cracking.wav new file mode 100644 index 000000000..b8228c8aa 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 index 000000000..f4c6600a4 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 index 000000000..c87676f4d 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 index 000000000..a69f8a71e 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 index 000000000..2978a53f8 Binary files /dev/null and b/data/sounds/sizzle.ogg differ diff --git a/src/badguy/flame.cpp b/src/badguy/flame.cpp index 705344cf8..a06039f2d 100644 --- a/src/badguy/flame.cpp +++ b/src/badguy/flame.cpp @@ -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); diff --git a/src/badguy/iceflame.cpp b/src/badguy/iceflame.cpp index 2de434d28..716003663 100644 --- a/src/badguy/iceflame.cpp +++ b/src/badguy/iceflame.cpp @@ -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); diff --git a/src/badguy/livefire.cpp b/src/badguy/livefire.cpp index 1fa5cba08..9fb56a734 100644 --- a/src/badguy/livefire.cpp +++ b/src/badguy/livefire.cpp @@ -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); diff --git a/src/badguy/livefire.hpp b/src/badguy/livefire.hpp index ff0db6629..e1c6e8acc 100644 --- a/src/badguy/livefire.hpp +++ b/src/badguy/livefire.hpp @@ -37,6 +37,7 @@ public: private: SpritePtr lightsprite; + std::string death_sound; protected: enum SState { diff --git a/src/badguy/short_fuse.cpp b/src/badguy/short_fuse.cpp index 127691fe2..8b07a3eed 100644 --- a/src/badguy/short_fuse.cpp +++ b/src/badguy/short_fuse.cpp @@ -15,7 +15,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#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; diff --git a/src/badguy/snowman.cpp b/src/badguy/snowman.cpp index 5cbd5c7b0..a10951fc7 100644 --- a/src/badguy/snowman.cpp +++ b/src/badguy/snowman.cpp @@ -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(); diff --git a/src/badguy/stalactite.cpp b/src/badguy/stalactite.cpp index 791cdc955..5e6e83753 100644 --- a/src/badguy/stalactite.cpp +++ b/src/badguy/stalactite.cpp @@ -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; diff --git a/src/object/explosion.cpp b/src/object/explosion.cpp index 3af1c15e0..543ef2b3f 100644 --- a/src/object/explosion.cpp +++ b/src/object/explosion.cpp @@ -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 diff --git a/src/object/weak_block.cpp b/src/object/weak_block.cpp index f5c23fdd3..6b89cc182 100644 --- a/src/object/weak_block.cpp +++ b/src/object/weak_block.cpp @@ -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