diff options
author | Stijn Buys <ingar@osirion.org> | 2013-11-23 15:31:34 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2013-11-23 15:31:34 +0000 |
commit | ba3c01738cba3a842b2fe02f6b0f4e5fec454179 (patch) | |
tree | 0814236c44c48e21eade3732006305f66ca9d5a4 /src/client | |
parent | 93bb759aeb71537a98386693918b28b37961a103 (diff) |
Play sounds when getting hit.
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/soundext.cc | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/client/soundext.cc b/src/client/soundext.cc index 09c83d8..dd86a70 100644 --- a/src/client/soundext.cc +++ b/src/client/soundext.cc @@ -295,6 +295,18 @@ void SoundExt::frame(float elapsed) pitch = 1.0f; gain = 0.0f; // loop buffer gain + } else if (controlable->state() == core::Entity::Docked) { + + if (state_engineloopbuffer) { + audio::stop(state_engineloopsource); + state_engineloopbuffer = 0; + } + if (state_engineeventbuffer) { + audio::stop(state_engineeventsource); + state_engineeventbuffer = 0; + } + gain = 0.0f; // loop buffer gain + } else { if ((state_engineeventbuffer == state_impulsestartbuffer) || (state_engineeventbuffer == state_impulseloopbuffer)) { @@ -310,11 +322,13 @@ void SoundExt::frame(float elapsed) } } - audio::update_source(state_engineloopsource, - controlable->location() - controlable->axis().forward() * r ,velocity, pitch, gain); + if (state_engineloopbuffer) { + audio::update_source(state_engineloopsource, controlable->location() - controlable->axis().forward() * r ,velocity, pitch, gain); + } - audio::update_source(state_engineeventsource, - controlable->location() - controlable->axis().forward() * r , velocity); + if (state_engineeventbuffer) { + audio::update_source(state_engineeventsource, controlable->location() - controlable->axis().forward() * r , velocity); + } } else if (entity()->type() == core::Entity::Dynamic) { |