From: Ryan Flegel Date: Wed, 14 May 2008 01:48:36 +0000 (+0000) Subject: Applied sound pre-loading patch from mathnerd314 (#331) X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=e7505c3c66a8fd9735317c0cfa0cc4d9161d53da;p=supertux.git Applied sound pre-loading patch from mathnerd314 (#331) SVN-Revision: 5468 --- diff --git a/src/badguy/ghosttree.cpp b/src/badguy/ghosttree.cpp index 82c74cd65..e3436215c 100644 --- a/src/badguy/ghosttree.cpp +++ b/src/badguy/ghosttree.cpp @@ -40,6 +40,8 @@ GhostTree::GhostTree(const lisp::Lisp& lisp) { glow_sprite.reset(sprite_manager->create("images/creatures/ghosttree/ghosttree-glow.sprite")); set_colgroup_active(COLGROUP_TOUCHABLE); + sound_manager->preload("sounds/tree_howling.ogg"); + sound_manager->preload("sounds/tree_suck.ogg"); } GhostTree::~GhostTree() diff --git a/src/badguy/jumpy.cpp b/src/badguy/jumpy.cpp index 3d8125244..defb54595 100644 --- a/src/badguy/jumpy.cpp +++ b/src/badguy/jumpy.cpp @@ -28,6 +28,8 @@ static const float JUMPY_LOW_TOLERANCE=2; Jumpy::Jumpy(const lisp::Lisp& reader) : BadGuy(reader, "images/creatures/snowjumpy/snowjumpy.sprite"), groundhit_pos_set(false) { + // TODO create a nice sound for this... + //sound_manager->preload("sounds/skid.wav"); } void diff --git a/src/badguy/mole.cpp b/src/badguy/mole.cpp index 54dfe1710..32a86e58b 100644 --- a/src/badguy/mole.cpp +++ b/src/badguy/mole.cpp @@ -36,12 +36,18 @@ Mole::Mole(const lisp::Lisp& reader) : BadGuy(reader, "images/creatures/mole/mole.sprite", LAYER_TILES-1), state(PRE_THROWING) { physic.enable_gravity(false); + sound_manager->preload("sounds/fall.wav"); + sound_manager->preload("sounds/squish.wav"); + sound_manager->preload("sounds/dartfire.wav"; } Mole::Mole(const Vector& pos) : BadGuy(pos, "images/creatures/mole/mole.sprite", LAYER_TILES-1), state(PRE_THROWING) { physic.enable_gravity(false); + sound_manager->preload("sounds/fall.wav"); + sound_manager->preload("sounds/squish.wav"); + sound_manager->preload("sounds/dartfire.wav"; } void diff --git a/src/badguy/mole_rock.cpp b/src/badguy/mole_rock.cpp index 5de7914f8..14529c997 100644 --- a/src/badguy/mole_rock.cpp +++ b/src/badguy/mole_rock.cpp @@ -27,6 +27,8 @@ MoleRock::MoleRock(const lisp::Lisp& reader) { physic.enable_gravity(true); countMe = false; + sound_manager->preload("sounds/fall.wav"); + sound_manager->preload("sounds/stomp.wav"); } MoleRock::MoleRock(const Vector& pos, const Vector& velocity, const BadGuy* parent = 0) @@ -34,11 +36,15 @@ MoleRock::MoleRock(const Vector& pos, const Vector& velocity, const BadGuy* pare { physic.enable_gravity(true); countMe = false; + sound_manager->preload("sounds/fall.wav"); + sound_manager->preload("sounds/stomp.wav"); } MoleRock::MoleRock(const MoleRock& other) : BadGuy(other), parent(other.parent), initial_velocity(Vector(0, -400)) { + sound_manager->preload("sounds/fall.wav"); + sound_manager->preload("sounds/stomp.wav"); } MoleRock::~MoleRock() diff --git a/src/badguy/stumpy.cpp b/src/badguy/stumpy.cpp index 5f9b7aefd..2cac026a1 100644 --- a/src/badguy/stumpy.cpp +++ b/src/badguy/stumpy.cpp @@ -32,7 +32,6 @@ Stumpy::Stumpy(const lisp::Lisp& reader) { walk_speed = WALKSPEED; max_drop_height = 16; - sound_manager->preload("sounds/mr_tree.ogg"); sound_manager->preload("sounds/mr_treehit.ogg"); } diff --git a/src/object/ambient_sound.cpp b/src/object/ambient_sound.cpp index 14df03828..d1169d287 100644 --- a/src/object/ambient_sound.cpp +++ b/src/object/ambient_sound.cpp @@ -109,6 +109,7 @@ AmbientSound::AmbientSound(Vector pos, float factor, float bias, float vol, std: silence_distance = 1/distance_factor; sound_source = 0; // not playing at the beginning + sound_manager->preload(sample); latency=0; } diff --git a/src/object/flower.cpp b/src/object/flower.cpp index 71cacf2f8..ec2462c70 100644 --- a/src/object/flower.cpp +++ b/src/object/flower.cpp @@ -40,6 +40,7 @@ Flower::Flower(BonusType _type) } else if(type == ICE_BONUS) { sprite = sprite_manager->create("images/powerups/iceflower/iceflower.sprite"); + sound_manager->preload("sounds/fire-flower.wav"); } else { assert(false); } diff --git a/src/object/invisible_block.cpp b/src/object/invisible_block.cpp index 01302bf21..96be2e650 100644 --- a/src/object/invisible_block.cpp +++ b/src/object/invisible_block.cpp @@ -33,7 +33,6 @@ InvisibleBlock::InvisibleBlock(const Vector& pos) { bbox.set_pos(pos); sound_manager->preload("sounds/brick.wav"); - sound_manager->preload("sounds/brick.wav"); } void diff --git a/src/object/player.cpp b/src/object/player.cpp index f2937e3b2..89b6a8d6d 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -113,7 +113,6 @@ Player::Player(PlayerStatus* _player_status, const std::string& name) sound_manager->preload("sounds/flip.wav"); sound_manager->preload("sounds/invincible_start.ogg"); sound_manager->preload("sounds/splash.ogg"); - sound_manager->preload("sounds/shoot.wav"); init(); } diff --git a/src/sector.cpp b/src/sector.cpp index 688bba31c..625a00b42 100644 --- a/src/sector.cpp +++ b/src/sector.cpp @@ -83,6 +83,8 @@ Sector::Sector(Level* parent) add_object(new DisplayEffect("Effect")); add_object(new TextObject("Text")); + sound_manager->preload("sounds/shoot.wav"); + // create a new squirrel table for the sector using namespace Scripting; diff --git a/src/trigger/door.cpp b/src/trigger/door.cpp index f8d2b7286..4f7e50b6a 100644 --- a/src/trigger/door.cpp +++ b/src/trigger/door.cpp @@ -41,6 +41,8 @@ Door::Door(const lisp::Lisp& reader) sprite = sprite_manager->create("images/objects/door/door.sprite"); sprite->set_action("closed"); bbox.set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height()); + + sound_manager->preload("sounds/door.wav"); } Door::Door(int x, int y, std::string sector, std::string spawnpoint) @@ -53,6 +55,8 @@ Door::Door(int x, int y, std::string sector, std::string spawnpoint) sprite = sprite_manager->create("images/objects/door/door.sprite"); sprite->set_action("closed"); bbox.set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height()); + + sound_manager->preload("sounds/door.wav"); } Door::~Door() @@ -72,7 +76,7 @@ Door::write(lisp::Writer& writer) writer.write_string("sector", target_sector); writer.write_string("spawnpoint", target_spawnpoint); - sound_manager->preload("sounds/door.wav"); + writer.end_list("door"); }