Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2009-01-24 21:22:39 +0000
committerStijn Buys <ingar@osirion.org>2009-01-24 21:22:39 +0000
commit6844f88a70a7b746b74696e80a21d9b8f740afcb (patch)
treed83eb16415645c589ffe846178ce4e27519ee627 /src/client
parent751c9ad855e689ea119c5b38c6d530ecc8a33bc7 (diff)
fixes a crash when going to impulse in a ship with an unkown model
Diffstat (limited to 'src/client')
-rw-r--r--src/client/soundext.cc20
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);
}
}