diff options
author | Stijn Buys <ingar@osirion.org> | 2013-11-17 15:17:04 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2013-11-17 15:17:04 +0000 |
commit | c68a2899dc63850d77f79eaa65125f6d503fc83a (patch) | |
tree | 8fdb2d522736744c766ea2de30d38097b7644491 | |
parent | 302f11ce816ffe4b51f48c42972bb58475bcca5d (diff) |
Added support for explosion sounds,
updated list of attributions,
updated starsystem roadmap.
-rw-r--r-- | doc/attributions.html | 39 | ||||
-rw-r--r-- | doc/starsystem_roadmap.html | 44 | ||||
-rw-r--r-- | src/audio/audio.cc | 15 | ||||
-rw-r--r-- | src/audio/audio.h | 3 | ||||
-rw-r--r-- | src/client/soundext.cc | 67 | ||||
-rw-r--r-- | src/client/soundext.h | 2 |
6 files changed, 128 insertions, 42 deletions
diff --git a/doc/attributions.html b/doc/attributions.html index 3330b2c..fe90294 100644 --- a/doc/attributions.html +++ b/doc/attributions.html @@ -70,6 +70,7 @@ <tr> <td colspan=3> + <hr> <h3 class="content">Maps</h3> </td> </tr> @@ -388,6 +389,7 @@ <tr> <td colspan=3> + <hr> <h3 class="content">Models</h3> </td> </tr> @@ -421,10 +423,19 @@ <tr> <td colspan=3> + <hr> <h3 class="content">Sounds</h3> </td> </tr> <tr> + <td>sounds/game</td> + <td>mount.wav</a> + <td> + doorslam2a.wav by <a href="http://www.berklee.edu/">The Berklee College of Music</a>, + from the <a href="http://wiki.laptop.org/go/Free_sound_samples">OLPC Free Sound Samples</a>, edited by Ingar + </td> + </tr> + <tr> <td>sounds/engines</td> <td>loop00.wav</td> <td> @@ -450,7 +461,8 @@ <td>sounds/engines</td> <td>jump_start00.wav</td> <td> - <a href="http://www.freesound.org/samplesViewSingle.php?id=70044">juskiddink</a> <span class="superscript">Freesound</span> + Gliss FX 01.wav by <a href="http://www.greg-tripi.com/">Gregory Tripi</a>, + from the <a href="http://wiki.laptop.org/go/Free_sound_samples">OLPC Free Sound Samples</a>, edited by Ingar </td> </tr> @@ -488,8 +500,8 @@ <td>sounds/projectiles</td> <td>metrion.wav</td> <td> - laser4.wav by Matt Lange, edited by Ingar - from the <a href="http://wiki.laptop.org/go/Free_sound_samples">OLPC Free Sound Samples</a> + laser4.wav by Matt Lange, + from the <a href="http://wiki.laptop.org/go/Free_sound_samples">OLPC Free Sound Samples</a>, edited by Ingar </td> </tr> <tr> @@ -505,6 +517,7 @@ <tr> <td colspan=3> + <hr> <h3 class="content">Textures</h3> </td> </tr> @@ -580,6 +593,15 @@ </tr> <tr> <td>textures/planets</td> + <td>dagon.png</td> + <td> + Golivani from + <a href="http://www.celestiamotherlode.net/catalog/show_addon_details.php?addon_id=1613">Boliverius Alvera Sagittarii</a> by + <a href="http://www.celestiamotherlode.net/catalog/show_creator_details.php?creator_id=236">kristoffer</a> + </td> + </tr> + <tr> + <td>textures/planets</td> <td>finnmark.png</td> <td> <a href="http://www.celestiamotherlode.net/catalog/show_addon_details.php?addon_id=227">Sedna</a> by @@ -621,7 +643,16 @@ Denirona from the Edin system by <a href="http://www.celestiamotherlode.net/catalog/show_creator_details.php?creator_id=101">kikinho</a> </td> - </tr> + </tr> + <tr> + <td>textures/planets</td> + <td>rasheen.png</td> + <td> + Moon2 from + <a href="http://www.celestiamotherlode.net/catalog/show_addon_details.php?addon_id=1613">Boliverius Alvera Sagittarii</a> by + <a href="http://www.celestiamotherlode.net/catalog/show_creator_details.php?creator_id=236">kristoffer</a> + </td> + </tr> <tr> <td>textures/planets</td> <td>seymour.png</td> diff --git a/doc/starsystem_roadmap.html b/doc/starsystem_roadmap.html index 9a3efac..cbf5e9c 100644 --- a/doc/starsystem_roadmap.html +++ b/doc/starsystem_roadmap.html @@ -106,15 +106,22 @@ <h4 class="content">Praetoria system</h4> <ul class="content"> <li class="content">planet Praetoria - <li class="content">Caesar, Praetorian moon + <li class="content">Caesar, lifeless planet </ul> <h4 class="content">Carthagio system</h4> <ul class="content"> + <li class="content">Planet Carthagio, industrial planet <li class="content">solar array + <li class="content">Medusa gas mining facility, phosphine production </ul> <h4 class="content">Hellas system</h4> - +<ul class="content"> + <li class="content">Trireme station, PEX headquarters +</ul> <h4 class="content">Phoenicia system</h4> +<ul class="content"> + <li class="content">Racetrack +</ul> <!-- House Dagon =================================================== --> @@ -156,7 +163,7 @@ Planet Brogha is the largest exporter of agricultural products in the Independent Colonies. </p> <ul class="content"> - <li class="content">planet Brogha + <li class="content">planet Brogha, agricultural planet <li class="content">Cantor observatory </ul> @@ -165,15 +172,15 @@ Planet Antwerp is the headquarters of the Colonial Militia. </p> <ul class="content"> - <li class="content">planet Antwerp - <li class="content">starbase Helianthos (guards the border) - <li class="content">Buccaneer's Den pirate base + <li class="content">planet Antwerpm nilitia headquarters + <li class="content">starbase Helianthos, guards the border + <li class="content">Hoboken, pirate base </ul> <h4 class="content">Kronenbaden system</h4> <ul class="content"> - <li class="content">planet Baden - <li class="content">planet Krone + <li class="content">planet Baden, agricultural planet + <li class="content">planet Krone, industrial planet </ul> <h4 class="content">Khorsand system</h4> @@ -275,11 +282,10 @@ <p class="content"> Camorra is a system claimed by pirates </p> - <ul class="content"> - <li class="content">Port Royal, asteroid pirate base + <li class="content">planet Naples, pirate base </ul> - + <!-- Southern Rim ================================================== --> <hr> @@ -296,16 +302,16 @@ <h4 class="content">Rinn system</h4> <h4 class="content">Amiras system</h4> - + <!-- Tsu-Khan Empire =============================================== --> <hr> <h3 class="content">Tsu-Khan Empire</h3> <h4 class="content">Kiana system</h4> - <ul class="content"> - <li class="content">Kiana Prime - </ul> +<ul class="content"> + <li class="content">Kiana Prime +</ul> <h4 class="content">Alpha Kosiya</h4> @@ -328,9 +334,12 @@ <ul class="content"> <li class="content">Micron Corporation <li class="content">AMTEL Tech Conglomerate - <li class="content">Joint Miners Association + <li class="content">Joint Miners Association (JMA) <li class="content">Merchants Association <li class="content">Mercenaries Guild + <li class="content">Praetorian Express (PEX) + <li class="content">Praetorian Guard + <li class="content">Universal Research </ul> </div> <!-- div content --> @@ -347,7 +356,7 @@ </a> </div> <p> - Copyright © 2007-2012 Project::OSiRiON + Copyright © 2007-2013 Project::OSiRiON </p> </div> @@ -356,4 +365,3 @@ </html> - diff --git a/src/audio/audio.cc b/src/audio/audio.cc index 304174c..3f505c0 100644 --- a/src/audio/audio.cc +++ b/src/audio/audio.cc @@ -193,6 +193,21 @@ size_t loop(size_t source_index, size_t buffer_index, float pitch, float gain) return buffer_index; } +size_t stop(size_t source_index) +{ + if (!audio_initialized) + return 0; + + ALuint source = Sources::source(source_index); + ALint srcstate = 0; + alGetSourcei(source , AL_SOURCE_STATE , &srcstate); + if (srcstate == AL_PLAYING) { + alSourceStop(source); + } + + return source_index; +} + size_t loop(size_t source_index, const char *name, float pitch, float gain) { if (!audio_initialized) diff --git a/src/audio/audio.h b/src/audio/audio.h index bab3402..f95e872 100644 --- a/src/audio/audio.h +++ b/src/audio/audio.h @@ -54,6 +54,9 @@ size_t loop(size_t source_index, const char *name, float pitch = 1.0f, float gai /// play a looping sound from a specified buffer on a specified source size_t loop(size_t source_index, size_t buffer_index, float pitch, float gain); +/// stop playback of a specific source +size_t stop(size_t source_index); + /// update source parameters void update_source(size_t source_index, math::Vector3f const & location, math::Vector3f const & velocity, float pitch = 1.0f, float gain = 1.0f); diff --git a/src/client/soundext.cc b/src/client/soundext.cc index ed22612..397a420 100644 --- a/src/client/soundext.cc +++ b/src/client/soundext.cc @@ -56,7 +56,7 @@ void render_entity_sound(core::Entity *entity) return; } - if (!ext_render(entity) || (ext_render(entity)->distance() > core::range::fxdistance) || (!ext_render(entity)->power())) { + if (!ext_render(entity) || (ext_render(entity)->distance() > core::range::fxdistance)) { if (ext_sound(entity)) delete ext_sound(entity); return; @@ -97,6 +97,7 @@ SoundExt::SoundExt(core::Entity *entity) : core::Extension(core::Extension::Soun state_impulsestopbuffer = 0; state_jumpstartbuffer = 0; state_jumpstopbuffer = 0; + state_explosionbuffer = 0; state_engineloopbuffer = 0; state_engineloopsource = 0; @@ -126,6 +127,8 @@ SoundExt::SoundExt(core::Entity *entity) : core::Extension(core::Extension::Soun state_impulsestopbuffer = audio::Buffers::load("engines/impulse_stop00"); state_jumpstartbuffer = audio::Buffers::load("engines/jump_start00"); state_jumpstopbuffer = audio::Buffers::load("engines/jump_stop00"); + + state_explosionbuffer = audio::Buffers::load("fx/explosion01"); state_engineloopsource = audio::Sources::get(); state_engineeventsource = audio::Sources::get(); @@ -192,6 +195,7 @@ SoundExt::~SoundExt() state_impulsestopbuffer = 0; state_jumpstartbuffer = 0; state_jumpstopbuffer = 0; + state_explosionbuffer = 0; state_engineloopbuffer = 0; state_engineloopsource = 0; @@ -211,52 +215,52 @@ void SoundExt::frame(float elapsed) if (entity()->type() == core::Entity::Controlable) { // update engine sounds - core::EntityControlable *entity = static_cast<core::EntityControlable *>(this->entity()); + core::EntityControlable *controlable = static_cast<core::EntityControlable *>(this->entity()); - speed = entity->speed(); + speed = controlable->speed(); if (snd_doppler->value()) - velocity.assign(entity->axis().forward() * speed); + velocity.assign(controlable->axis().forward() * speed); - if (entity->state() == core::Entity::Impulse) { + if (controlable->state() == core::Entity::Impulse) { pitch = 1.0f; gain = 1.0f; } else { - pitch = 0.2f + entity->thrust() * 0.8f; + pitch = 0.2f + controlable->thrust() * 0.8f; gain = 1.0f; } - if (entity->state() == core::Entity::ImpulseInitiate) { + if (controlable->state() == core::Entity::ImpulseInitiate) { if (state_engineeventbuffer != state_impulsestartbuffer) { audio::update_source(state_engineeventsource, - entity->location() - entity->axis().forward() * r , - entity->axis().forward() * speed); + controlable->location() - controlable->axis().forward() * r , + controlable->axis().forward() * speed); state_engineeventbuffer = audio::play(state_engineeventsource, state_impulsestartbuffer); } - } else if (entity->state() == core::Entity::JumpInitiate) { + } else if (controlable->state() == core::Entity::JumpInitiate) { if (state_engineeventbuffer != state_jumpstartbuffer) { audio::update_source(state_engineeventsource, - entity->location() - entity->axis().forward() * r , - entity->axis().forward() * speed); + controlable->location() - controlable->axis().forward() * r , + controlable->axis().forward() * speed); state_engineeventbuffer = audio::play(state_engineeventsource, state_jumpstartbuffer); } - } else if (entity->state() == core::Entity::Jump) { + } else if (controlable->state() == core::Entity::Jump) { if (state_engineeventbuffer != state_jumpstopbuffer) { audio::update_source(state_engineeventsource, - entity->location() - entity->axis().forward() * r , - entity->axis().forward() * speed); + controlable->location() - controlable->axis().forward() * r , + controlable->axis().forward() * speed); state_engineeventbuffer = audio::play(state_engineeventsource, state_jumpstopbuffer); } - } else if (entity->state() == core::Entity::Impulse) { + } else if (controlable->state() == core::Entity::Impulse) { state_engineeventbuffer = state_impulseloopbuffer; @@ -264,12 +268,35 @@ void SoundExt::frame(float elapsed) state_engineloopbuffer = audio::loop(state_engineloopsource, state_impulseloopbuffer, pitch, 0); } pitch = 1.0f; + + } else if (controlable->state() == core::Entity::Destroyed) { + + if (state_engineloopbuffer) { + audio::stop(state_engineloopbuffer); + state_engineloopbuffer = 0; + } + if (state_engineeventbuffer != state_explosionbuffer) { + audio::update_source(state_engineeventsource, + controlable->location() - controlable->axis().forward() * r , + controlable->axis().forward() * speed); + + // pack random explosion sound + if (math::randomf(100.0f) < 50.0f) { + state_explosionbuffer = audio::Buffers::load("fx/explosion01"); + } else { + state_explosionbuffer = audio::Buffers::load("fx/explosion02"); + } + state_engineeventbuffer = audio::play(state_engineeventsource, state_explosionbuffer); + } + pitch = 1.0f; + gain = 0.0f; // loop buffer gain + } else { if ((state_engineeventbuffer == state_impulsestartbuffer) || (state_engineeventbuffer == state_impulseloopbuffer)) { audio::update_source(state_engineeventsource, - entity->location() - entity->axis().forward() * r , - entity->axis().forward() * speed); + controlable->location() - controlable->axis().forward() * r , + controlable->axis().forward() * speed); state_engineeventbuffer = audio::play(state_engineeventsource, state_impulsestopbuffer); } state_engineeventbuffer = 0; @@ -280,10 +307,10 @@ void SoundExt::frame(float elapsed) } audio::update_source(state_engineloopsource, - entity->location() - entity->axis().forward() * r ,velocity, pitch, gain); + controlable->location() - controlable->axis().forward() * r ,velocity, pitch, gain); audio::update_source(state_engineeventsource, - entity->location() - entity->axis().forward() * r , velocity); + controlable->location() - controlable->axis().forward() * r , velocity); } else if (entity()->type() == core::Entity::Projectile) { diff --git a/src/client/soundext.h b/src/client/soundext.h index 2750afd..1cadae6 100644 --- a/src/client/soundext.h +++ b/src/client/soundext.h @@ -85,6 +85,8 @@ private: size_t state_jumpstartbuffer; /// index of the audio buffer containing the jump engine stop sound size_t state_jumpstopbuffer; + /// index of the audio buffer containing the explosion sound + size_t state_explosionbuffer; /// index of the audio buffer currently looping in enginesource size_t state_engineloopbuffer; |