Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/soundext.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/client/soundext.cc b/src/client/soundext.cc
index 477919c..ed22612 100644
--- a/src/client/soundext.cc
+++ b/src/client/soundext.cc
@@ -133,13 +133,18 @@ SoundExt::SoundExt(core::Entity *entity) : core::Extension(core::Extension::Soun
} else if (entity->type() == core::Entity::Projectile) {
core::EntityProjectile *projectile = static_cast<core::EntityProjectile *>(entity);
-
- state_engineeventsource = audio::Sources::get();
- if (state_engineeventsource) {
+ // if the sound name is set
+ if (projectile->projectile_soundname().size()) {
state_impulsestartbuffer = audio::Buffers::load("projectiles/" + projectile->projectile_soundname());
-
- audio::update_source(state_engineeventsource, entity->location(), math::Vector3f());
- audio::play(state_engineeventsource, state_impulsestartbuffer);
+ // if the sound file was loaded
+ if (state_impulsestartbuffer) {
+ state_engineeventsource = audio::Sources::get();
+ // of the OpenAL source is available
+ if (state_engineeventsource) {
+ audio::update_source(state_engineeventsource, entity->location(), math::Vector3f());
+ audio::play(state_engineeventsource, state_impulsestartbuffer);
+ }
+ }
}
}