projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
conditionally generate the miniswig wrapper like it used to in autoconf+jam
[supertux.git]
/
src
/
trigger
/
switch.cpp
diff --git
a/src/trigger/switch.cpp
b/src/trigger/switch.cpp
index
068b0f4
..
23f5754
100644
(file)
--- a/
src/trigger/switch.cpp
+++ b/
src/trigger/switch.cpp
@@
-18,12
+18,18
@@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <config.h>
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <config.h>
+#include <stdexcept>
#include "switch.hpp"
#include "object_factory.hpp"
#include "sprite/sprite.hpp"
#include "sprite/sprite_manager.hpp"
#include "sector.hpp"
#include "switch.hpp"
#include "object_factory.hpp"
#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)
Switch::Switch(const lisp::Lisp& reader)
: state(OFF)
@@
-35,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");
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()
}
Switch::~Switch()
@@
-97,6
+104,7
@@
Switch::event(Player& , EventType type)
switch (state) {
case OFF:
sprite->set_action("turnon", 1);
switch (state) {
case OFF:
sprite->set_action("turnon", 1);
+ sound_manager->play( SWITCH_SOUND );
state = TURN_ON;
break;
case TURN_ON:
state = TURN_ON;
break;
case TURN_ON:
@@
-110,4
+118,3
@@
Switch::event(Player& , EventType type)
}
IMPLEMENT_FACTORY(Switch, "switch");
}
IMPLEMENT_FACTORY(Switch, "switch");
-