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>2012-12-28 22:55:35 +0000
committerStijn Buys <ingar@osirion.org>2012-12-28 22:55:35 +0000
commitf416e6b792e5dda143f60b7a2724db6b3ec33d75 (patch)
tree553ddcaa6c60489904a8db818eff688c0b85a437 /src/client/soundext.cc
parentfe96eee5db2acbef1ea0f360b180fd9f8f990444 (diff)
Support for rendering globes with rings,
removed hardcoded 'corona' prefix for corona textures, added support for projectile fire sounds.
Diffstat (limited to 'src/client/soundext.cc')
-rw-r--r--src/client/soundext.cc29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/client/soundext.cc b/src/client/soundext.cc
index aeb3bd1..477919c 100644
--- a/src/client/soundext.cc
+++ b/src/client/soundext.cc
@@ -11,6 +11,7 @@
#include "auxiliary/functions.h"
#include "core/gameinterface.h"
#include "core/entity.h"
+#include "core/entityprojectile.h"
#include "client/soundext.h"
#include "client/client.h"
#include "render/camera.h"
@@ -128,6 +129,18 @@ SoundExt::SoundExt(core::Entity *entity) : core::Extension(core::Extension::Soun
state_engineloopsource = audio::Sources::get();
state_engineeventsource = audio::Sources::get();
+
+
+ } else if (entity->type() == core::Entity::Projectile) {
+ core::EntityProjectile *projectile = static_cast<core::EntityProjectile *>(entity);
+
+ state_engineeventsource = audio::Sources::get();
+ if (state_engineeventsource) {
+ state_impulsestartbuffer = audio::Buffers::load("projectiles/" + projectile->projectile_soundname());
+
+ audio::update_source(state_engineeventsource, entity->location(), math::Vector3f());
+ audio::play(state_engineeventsource, state_impulsestartbuffer);
+ }
}
// load model sounds
@@ -152,11 +165,6 @@ SoundExt::SoundExt(core::Entity *entity) : core::Extension(core::Extension::Soun
SoundExt::~SoundExt()
{
- clear();
-}
-
-void SoundExt::clear()
-{
for (Sounds::iterator it = state_soundlist.begin(); it != state_soundlist.end(); it++) {
client::Sound *sound = *it;
if (sound->source()) {
@@ -193,11 +201,11 @@ void SoundExt::frame(float elapsed)
float pitch = 1.0f;
float gain = 0.0;
- float r = (entity()->model() ? entity()->model()->box().max().x() * entity()->radius() / entity()->model()->radius() : entity()->radius());
-
+ float r = (entity()->model() ? entity()->model()->box().max().x() * entity()->radius() / entity()->model()->radius() : entity()->radius());
math::Vector3f velocity;
if (entity()->type() == core::Entity::Controlable) {
+ // update engine sounds
core::EntityControlable *entity = static_cast<core::EntityControlable *>(this->entity());
speed = entity->speed();
@@ -271,6 +279,13 @@ void SoundExt::frame(float elapsed)
audio::update_source(state_engineeventsource,
entity->location() - entity->axis().forward() * r , velocity);
+
+ } else if (entity()->type() == core::Entity::Projectile) {
+
+ if (state_engineeventsource && !audio::Sources::is_playing(state_engineeventsource)) {
+ audio::Sources::remove(state_engineeventsource);
+ state_engineeventsource = 0;
+ }
}
for (Sounds::iterator it = state_soundlist.begin(); it != state_soundlist.end(); it++) {