From 2c10d5b9b8a9f651006e4f7b376b21ee0713b398 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 5 Jul 2011 18:36:37 +0000 Subject: Added support for a jump engine start sound, correted a typo in client.h. --- doc/attributions.html | 17 ++++++++++++----- src/client/client.h | 2 +- src/client/soundext.cc | 18 ++++++++++++++++-- src/client/soundext.h | 2 ++ 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/doc/attributions.html b/doc/attributions.html index e0f71ef..3c837b3 100644 --- a/doc/attributions.html +++ b/doc/attributions.html @@ -19,8 +19,7 @@ of the Create Commons Attribution-Share Alike 3.0 License.

- Files by nathanshadow - are distributed under the terms of the + Sound effects from the Freesound project are distributed under the terms and conditions of the Creative Commons Sampling Plus 1.0 license.

@@ -385,21 +384,29 @@ sounds/engines loop00.wav - nathanshadow + nathanshadow (Freesound) sounds/engines loop01.wav - nathanshadow + nathanshadow (Freesound) sounds/engines loop02.wav - nathanshadow + nathanshadow (Freesound) + + + + + sounds/engines + jump_start00.wav + + juskiddink (Freesound) 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; -- cgit v1.2.3