diff options
author | Stijn Buys <ingar@osirion.org> | 2012-12-28 22:55:35 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2012-12-28 22:55:35 +0000 |
commit | f416e6b792e5dda143f60b7a2724db6b3ec33d75 (patch) | |
tree | 553ddcaa6c60489904a8db818eff688c0b85a437 /src/client | |
parent | fe96eee5db2acbef1ea0f360b180fd9f8f990444 (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')
-rw-r--r-- | src/client/mapwindow.cc | 6 | ||||
-rw-r--r-- | src/client/soundext.cc | 29 | ||||
-rw-r--r-- | src/client/soundext.h | 2 | ||||
-rw-r--r-- | src/client/targets.cc | 2 |
4 files changed, 27 insertions, 12 deletions
diff --git a/src/client/mapwindow.cc b/src/client/mapwindow.cc index c8ebaa8..19cf687 100644 --- a/src/client/mapwindow.cc +++ b/src/client/mapwindow.cc @@ -238,8 +238,10 @@ void MapWindow::show_entity_info(const core::Entity *entity) mapwindow_modelview->set_colors(globe->color(), globe->color_second()); mapwindow_modelview->set_globetexturename( globe->texturename(), - globe->has_flag(core::Entity::Bright), - globe->coronaname() + globe->coronaname(), + globe->ringsname(), + globe->has_flag(core::Entity::Bright) + ); mapwindow_modelview->set_zoom(2.5f); if (globe->has_flag(core::Entity::Bright)) { 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++) { diff --git a/src/client/soundext.h b/src/client/soundext.h index cf5585e..2750afd 100644 --- a/src/client/soundext.h +++ b/src/client/soundext.h @@ -73,8 +73,6 @@ public: typedef std::list<client::Sound *> Sounds; private: - void clear(); - /// index of the audio buffer containing the thruster sound loop size_t state_thusterloopbuffer; /// index of the audio buffer containing the impulse sound loop diff --git a/src/client/targets.cc b/src/client/targets.cc index c76d621..6809939 100644 --- a/src/client/targets.cc +++ b/src/client/targets.cc @@ -341,7 +341,7 @@ void frame() core::Entity *entity = (*it); // render entity sound - if ((entity->type() == core::Entity::Controlable) || (entity->model() && entity->model()->sounds().size())) { + if ((entity->type() == core::Entity::Controlable) || (entity->type() == core::Entity::Projectile) || (entity->model() && entity->model()->sounds().size())) { render_entity_sound(entity); } |