From 0787a91b484e283316770f19896a4406090450d7 Mon Sep 17 00:00:00 2001 From: Wolfgang Becker Date: Sun, 2 Jul 2006 20:50:13 +0000 Subject: [PATCH] Add some more sound_manager->preloads into object constructors SVN-Revision: 3843 --- src/badguy/dart.cpp | 6 ++++++ src/badguy/darttrap.cpp | 1 + src/badguy/mriceblock.cpp | 6 ++++++ src/badguy/mrtree.cpp | 2 ++ src/badguy/snail.cpp | 6 ++++++ src/badguy/yeti.cpp | 2 ++ src/object/block.cpp | 2 ++ src/object/fireworks.cpp | 1 + src/object/flower.cpp | 4 +++- src/object/growup.cpp | 1 + src/object/invisible_block.cpp | 1 + src/object/player.cpp | 1 + src/object/powerup.cpp | 2 ++ 13 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/badguy/dart.cpp b/src/badguy/dart.cpp index 7e2d5df9b..5e70e26da 100644 --- a/src/badguy/dart.cpp +++ b/src/badguy/dart.cpp @@ -33,6 +33,8 @@ Dart::Dart(const lisp::Lisp& reader) { physic.enable_gravity(false); countMe = false; + sound_manager->preload("sounds/darthit.wav"); + sound_manager->preload("sounds/stomp.wav"); } Dart::Dart(const Vector& pos, Direction d, const BadGuy* parent = 0) @@ -40,12 +42,16 @@ Dart::Dart(const Vector& pos, Direction d, const BadGuy* parent = 0) { physic.enable_gravity(false); countMe = false; + sound_manager->preload("sounds/darthit.wav"); + sound_manager->preload("sounds/stomp.wav"); } Dart::Dart(const Dart& other) : BadGuy(other), set_direction(other.set_direction), initial_direction(other.initial_direction), parent(other.parent) { sound_source.reset(sound_manager->create_sound_source(SOUNDFILE)); + sound_manager->preload("sounds/darthit.wav"); + sound_manager->preload("sounds/stomp.wav"); } Dart::~Dart() diff --git a/src/badguy/darttrap.cpp b/src/badguy/darttrap.cpp index 130eccab1..d86326bd5 100644 --- a/src/badguy/darttrap.cpp +++ b/src/badguy/darttrap.cpp @@ -33,6 +33,7 @@ DartTrap::DartTrap(const lisp::Lisp& reader) reader.get("fire-delay", fire_delay); reader.get("ammo", ammo); countMe = false; + sound_manager->preload("sounds/dartfire.wav"); } void diff --git a/src/badguy/mriceblock.cpp b/src/badguy/mriceblock.cpp index 49ed17040..efc155638 100644 --- a/src/badguy/mriceblock.cpp +++ b/src/badguy/mriceblock.cpp @@ -32,6 +32,9 @@ MrIceBlock::MrIceBlock(const lisp::Lisp& reader) : BadGuy(reader, "images/creatures/mr_iceblock/mr_iceblock.sprite"), ice_state(ICESTATE_NORMAL), squishcount(0) { set_direction = false; + sound_manager->preload("sounds/iceblock_bump.wav"); + sound_manager->preload("sounds/stomp.wav"); + sound_manager->preload("sounds/kick.wav"); } MrIceBlock::MrIceBlock(const Vector& pos, Direction d) @@ -39,6 +42,9 @@ MrIceBlock::MrIceBlock(const Vector& pos, Direction d) { set_direction = true; initial_direction = d; + sound_manager->preload("sounds/iceblock_bump.wav"); + sound_manager->preload("sounds/stomp.wav"); + sound_manager->preload("sounds/kick.wav"); } void diff --git a/src/badguy/mrtree.cpp b/src/badguy/mrtree.cpp index 2f848ce96..3f9221119 100644 --- a/src/badguy/mrtree.cpp +++ b/src/badguy/mrtree.cpp @@ -35,6 +35,8 @@ MrTree::MrTree(const lisp::Lisp& reader) : BadGuy(reader, "images/creatures/mr_tree/mr_tree.sprite"), mystate(STATE_BIG) { sprite->set_action(dir == LEFT ? "large-left" : "large-right"); + sound_manager->preload("sounds/mr_tree.ogg"); + sound_manager->preload("sounds/mr_treehit.ogg"); } void diff --git a/src/badguy/snail.cpp b/src/badguy/snail.cpp index c2da55673..dea697baf 100644 --- a/src/badguy/snail.cpp +++ b/src/badguy/snail.cpp @@ -33,6 +33,9 @@ Snail::Snail(const lisp::Lisp& reader) : BadGuy(reader, "images/creatures/snail/snail.sprite"), state(STATE_NORMAL), squishcount(0) { set_direction = false; + sound_manager->preload("sounds/iceblock_bump.wav"); + sound_manager->preload("sounds/stomp.wav"); + sound_manager->preload("sounds/kick.wav"); } Snail::Snail(const Vector& pos, Direction d) @@ -40,6 +43,9 @@ Snail::Snail(const Vector& pos, Direction d) { set_direction = true; initial_direction = d; + sound_manager->preload("sounds/iceblock_bump.wav"); + sound_manager->preload("sounds/stomp.wav"); + sound_manager->preload("sounds/kick.wav"); } void diff --git a/src/badguy/yeti.cpp b/src/badguy/yeti.cpp index 9f6924540..8528e828d 100644 --- a/src/badguy/yeti.cpp +++ b/src/badguy/yeti.cpp @@ -58,6 +58,8 @@ Yeti::Yeti(const lisp::Lisp& reader) hit_points = INITIAL_HITPOINTS; reader.get("dead-script", dead_script); countMe = false; + sound_manager->preload("sounds/yeti_gna.wav"); + sound_manager->preload("sounds/yeti_roar.wav"); } Yeti::~Yeti() diff --git a/src/object/block.cpp b/src/object/block.cpp index 6d0c5f4a6..3ab0d1bd0 100644 --- a/src/object/block.cpp +++ b/src/object/block.cpp @@ -54,6 +54,8 @@ Block::Block(Sprite* newsprite) bbox.set_size(32, 32.1); set_group(COLGROUP_STATIC); flags |= FLAG_SOLID; + sound_manager->preload("sounds/upgrade.wav"); + sound_manager->preload("sounds/brick.wav"); } Block::~Block() diff --git a/src/object/fireworks.cpp b/src/object/fireworks.cpp index a6333c506..d218c061b 100644 --- a/src/object/fireworks.cpp +++ b/src/object/fireworks.cpp @@ -32,6 +32,7 @@ Fireworks::Fireworks() { timer.start(.2); + sound_manager->preload("sounds/fireworks.wav"); } Fireworks::~Fireworks() diff --git a/src/object/flower.cpp b/src/object/flower.cpp index 5bfbfc485..4e4c87876 100644 --- a/src/object/flower.cpp +++ b/src/object/flower.cpp @@ -33,8 +33,10 @@ Flower::Flower(Type _type) { bbox.set_size(32, 32); - if(_type == FIREFLOWER) + if(_type == FIREFLOWER){ sprite = sprite_manager->create("images/powerups/fireflower/fireflower.sprite"); + sound_manager->preload("sounds/fire-flower.wav"); + } else sprite = sprite_manager->create("images/powerups/iceflower/iceflower.sprite"); diff --git a/src/object/growup.cpp b/src/object/growup.cpp index bdcb89404..32e3674e5 100644 --- a/src/object/growup.cpp +++ b/src/object/growup.cpp @@ -32,6 +32,7 @@ GrowUp::GrowUp() { physic.enable_gravity(true); physic.set_velocity_x(100); + sound_manager->preload("sounds/grow.wav"); } void diff --git a/src/object/invisible_block.cpp b/src/object/invisible_block.cpp index c923c11ab..d914b2bae 100644 --- a/src/object/invisible_block.cpp +++ b/src/object/invisible_block.cpp @@ -33,6 +33,7 @@ InvisibleBlock::InvisibleBlock(const Vector& pos) bbox.set_pos(pos); flags &= ~FLAG_SOLID; set_group(COLGROUP_MOVING); + sound_manager->preload("sounds/brick.wav"); } void diff --git a/src/object/player.cpp b/src/object/player.cpp index ebed28a85..3c2310633 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -118,6 +118,7 @@ Player::Player(PlayerStatus* _player_status) sound_manager->preload("sounds/hurt.wav"); sound_manager->preload("sounds/skid.wav"); sound_manager->preload("sounds/flip.wav"); + sound_manager->preload("sounds/invincible.wav"); init(); } diff --git a/src/object/powerup.cpp b/src/object/powerup.cpp index f274d485e..ebced415c 100644 --- a/src/object/powerup.cpp +++ b/src/object/powerup.cpp @@ -37,6 +37,8 @@ PowerUp::PowerUp(const lisp::Lisp& lisp) no_physics = false; lisp.get("disable-physics", no_physics); physic.enable_gravity(true); + sound_manager->preload("sounds/grow.wav"); + sound_manager->preload("sounds/fire-flower.wav"); } HitResponse -- 2.11.0