diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/soundext.cc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/client/soundext.cc b/src/client/soundext.cc index 4b3e1c7..02613e1 100644 --- a/src/client/soundext.cc +++ b/src/client/soundext.cc @@ -98,6 +98,8 @@ void SoundExt::frame(float elapsed) float speed = entity->speed(); float pitch = 1.0f; float gain = 0.0; + float r = ( entity->model() ? entity->model()->maxbbox().x : entity->radius()); + if (entity->eventstate() == core::Entity::Impulse) { pitch = 1.0f; gain = 1.0f; @@ -110,7 +112,9 @@ void SoundExt::frame(float elapsed) if (state_engineeventbuffer != state_impulsestartbuffer) { audio::update_source(state_engineeventsource, - entity->location() - entity->axis().forward() * entity->model()->maxbbox().y , entity->axis().forward() * speed); + entity->location() - entity->axis().forward() * r , + entity->axis().forward() * speed); + state_engineeventbuffer = audio::play(state_engineeventsource, state_impulsestartbuffer); } } else if (entity->eventstate() == core::Entity::Impulse) { @@ -123,9 +127,10 @@ void SoundExt::frame(float elapsed) pitch = 1.0f; } else { - if (state_engineeventbuffer == state_impulseloopbuffer) { + if (state_engineeventbuffer == state_impulseloopbuffer) { audio::update_source(state_engineeventsource, - entity->location() - entity->axis().forward() * entity->model()->maxbbox().y , entity->axis().forward() * speed); + entity->location() - entity->axis().forward() * r , + entity->axis().forward() * speed); state_engineeventbuffer = audio::play(state_engineeventsource, state_impulsestopbuffer); } state_engineeventbuffer = 0; @@ -135,16 +140,11 @@ void SoundExt::frame(float elapsed) } } - - float x = entity->radius(); - if (entity->model()) - x = entity->model()->maxbbox().x; - audio::update_source(state_engineloopsource, - entity->location() - entity->axis().forward() * x , entity->axis().forward() * speed, pitch, gain); + entity->location() - entity->axis().forward() * r , entity->axis().forward() * speed, pitch, gain); audio::update_source(state_engineeventsource, - entity->location() - entity->axis().forward() * x , entity->axis().forward() * speed); + entity->location() - entity->axis().forward() * r , entity->axis().forward() * speed); } } |