switch noise
authorWolfgang Becker <uafr@gmx.de>
Fri, 4 Aug 2006 23:58:40 +0000 (23:58 +0000)
committerWolfgang Becker <uafr@gmx.de>
Fri, 4 Aug 2006 23:58:40 +0000 (23:58 +0000)
SVN-Revision: 4121

data/sounds/switch.ogg [new file with mode: 0644]
src/trigger/switch.cpp

diff --git a/data/sounds/switch.ogg b/data/sounds/switch.ogg
new file mode 100644 (file)
index 0000000..e407dae
Binary files /dev/null and b/data/sounds/switch.ogg differ
index 49205fb..8b20a73 100644 (file)
 #include "sprite/sprite.hpp"
 #include "sprite/sprite_manager.hpp"
 #include "sector.hpp"
+#include "audio/sound_manager.hpp"
+
+namespace {
+ const std::string SWITCH_SOUND = "sounds/switch.ogg";
+}
 
 Switch::Switch(const lisp::Lisp& reader)
        : state(OFF)
@@ -36,6 +41,7 @@ Switch::Switch(const lisp::Lisp& reader)
   bbox.set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height());
 
   if (!reader.get("script", script)) throw std::runtime_error("no script set");
+  sound_manager->preload( SWITCH_SOUND );  
 }
 
 Switch::~Switch()
@@ -98,6 +104,7 @@ Switch::event(Player& , EventType type)
   switch (state) {
     case OFF:
        sprite->set_action("turnon", 1);
+        sound_manager->play( SWITCH_SOUND );
        state = TURN_ON;
       break;
     case TURN_ON: