Applied sound pre-loading patch from mathnerd314 (#331)
authorRyan Flegel <rflegel@gmail.com>
Wed, 14 May 2008 01:48:36 +0000 (01:48 +0000)
committerRyan Flegel <rflegel@gmail.com>
Wed, 14 May 2008 01:48:36 +0000 (01:48 +0000)
SVN-Revision: 5468

src/badguy/ghosttree.cpp
src/badguy/jumpy.cpp
src/badguy/mole.cpp
src/badguy/mole_rock.cpp
src/badguy/stumpy.cpp
src/object/ambient_sound.cpp
src/object/flower.cpp
src/object/invisible_block.cpp
src/object/player.cpp
src/sector.cpp
src/trigger/door.cpp

index 82c74cd..e343621 100644 (file)
@@ -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()
index 3d81252..defb545 100644 (file)
@@ -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
index 54dfe17..32a86e5 100644 (file)
@@ -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
index 5de7914..14529c9 100644 (file)
@@ -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()
index 5f9b7ae..2cac026 100644 (file)
@@ -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");
 }
 
index 14df038..d1169d2 100644 (file)
@@ -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;
 }
 
index 71cacf2..ec2462c 100644 (file)
@@ -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);
   }
index 01302bf..96be2e6 100644 (file)
@@ -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
index f2937e3..89b6a8d 100644 (file)
@@ -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();
 }
index 688bba3..625a00b 100644 (file)
@@ -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;
 
index f8d2b72..4f7e50b 100644 (file)
@@ -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");
 }