diff options
author | Stijn Buys <ingar@osirion.org> | 2011-07-05 18:36:37 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2011-07-05 18:36:37 +0000 |
commit | 2c10d5b9b8a9f651006e4f7b376b21ee0713b398 (patch) | |
tree | a9a143202980ce8f16b7ea0ab05d9cb3e7b05cae /src | |
parent | 91356abaf6cb09a1c72f9a8c374487ab66ecde13 (diff) |
Added support for a jump engine start sound, correted a typo in client.h.
Diffstat (limited to 'src')
-rw-r--r-- | src/client/client.h | 2 | ||||
-rw-r--r-- | src/client/soundext.cc | 18 | ||||
-rw-r--r-- | src/client/soundext.h | 2 |
3 files changed, 19 insertions, 3 deletions
diff --git a/src/client/client.h b/src/client/client.h index ddc6dd5..19a760f 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -73,7 +73,7 @@ public: return client_testmodelview; } - /// local client seds a chat message + /// local client sends a chat message inline void say(std::string const &text) { func_say(text); } diff --git a/src/client/soundext.cc b/src/client/soundext.cc index fbed639..b07cc35 100644 --- a/src/client/soundext.cc +++ b/src/client/soundext.cc @@ -94,6 +94,7 @@ SoundExt::SoundExt(core::Entity *entity) : core::Extension(core::Extension::Soun state_impulseloopbuffer = 0; state_impulsestartbuffer = 0; state_impulsestopbuffer = 0; + state_jumpstartbuffer = 0; state_engineloopbuffer = 0; state_engineloopsource = 0; @@ -116,11 +117,12 @@ SoundExt::SoundExt(core::Entity *entity) : core::Extension(core::Extension::Soun soundname << "engines/loop" << std::setfill('0') << std::setw(2) << enginesoundset; state_thusterloopbuffer = audio::Buffers::load(soundname.str()); - // load impulse sound - // FIXME load impulse sound set + // load sound set + // FIXME alway sound set 0 for now state_impulseloopbuffer = audio::Buffers::load("engines/impulse_loop00"); state_impulsestartbuffer = audio::Buffers::load("engines/impulse_start00"); state_impulsestopbuffer = audio::Buffers::load("engines/impulse_stop00"); + state_jumpstartbuffer = audio::Buffers::load("engines/jump_start00"); state_engineloopsource = audio::Sources::get(); state_engineeventsource = audio::Sources::get(); @@ -173,6 +175,7 @@ void SoundExt::clear() state_impulseloopbuffer = 0; state_impulsestartbuffer = 0; state_impulsestopbuffer = 0; + state_jumpstartbuffer = 0; state_engineloopbuffer = 0; state_engineloopsource = 0; @@ -218,6 +221,17 @@ void SoundExt::frame(float elapsed) state_engineeventbuffer = audio::play(state_engineeventsource, state_impulsestartbuffer); } + + } else if (entity->state() == core::Entity::JumpInitiate) { + + if (state_engineeventbuffer != state_jumpstartbuffer) { + audio::update_source(state_engineeventsource, + entity->location() - entity->axis().forward() * r , + entity->axis().forward() * speed); + + state_engineeventbuffer = audio::play(state_engineeventsource, state_jumpstartbuffer); + } + } else if (entity->state() == core::Entity::Impulse) { state_engineeventbuffer = state_impulseloopbuffer; diff --git a/src/client/soundext.h b/src/client/soundext.h index 9991b69..becaa8e 100644 --- a/src/client/soundext.h +++ b/src/client/soundext.h @@ -83,6 +83,8 @@ private: size_t state_impulsestartbuffer; /// index of the audio buffer containing the impulse drive stop sound size_t state_impulsestopbuffer; + /// index of the audio buffer containing the jump engine start sound + size_t state_jumpstartbuffer; /// index of the audio buffer currently looping in enginesource size_t state_engineloopbuffer; |