Add support for multiple crah sounds, update sfx credits

This commit is contained in:
auria.mg 2017-04-17 20:42:20 -04:00
parent 76491d13ec
commit 3fcf62a84a
3 changed files with 21 additions and 2 deletions

View File

@ -191,6 +191,7 @@ Voice acting
Sound effects
- Mike Koening and soundbible.com
- The Audio Monkey ( http://www.theaudiomonkey.co.uk )
- Battle For Wesnoth
- Iwan 'qubodup' Gabovitch
- The Trigger-Rally project

View File

@ -173,6 +173,8 @@ Kart::Kart (const std::string& ident, unsigned int world_kart_id,
m_engine_sound = SFXManager::get()->createSoundSource(m_kart_properties->getEngineSfxType());
m_beep_sound = SFXManager::get()->createSoundSource( "horn" );
m_crash_sound = SFXManager::get()->createSoundSource( "crash" );
m_crash_sound2 = SFXManager::get()->createSoundSource( "crash2");
m_crash_sound3 = SFXManager::get()->createSoundSource( "crash3");
m_boing_sound = SFXManager::get()->createSoundSource( "boing" );
m_goo_sound = SFXManager::get()->createSoundSource( "goo" );
m_skid_sound = SFXManager::get()->createSoundSource( "skid" );
@ -202,6 +204,8 @@ void Kart::init(RaceManager::KartType type)
m_goo_sound->setVolume(factor);
m_skid_sound->setVolume(factor);
m_crash_sound->setVolume(factor);
m_crash_sound2->setVolume(factor);
m_crash_sound3->setVolume(factor);
m_boing_sound->setVolume(factor);
m_beep_sound->setVolume(factor);
m_nitro_sound->setVolume(factor);
@ -254,6 +258,8 @@ Kart::~Kart()
m_engine_sound->deleteSFX();
m_crash_sound ->deleteSFX();
m_crash_sound2->deleteSFX();
m_crash_sound3->deleteSFX();
m_skid_sound ->deleteSFX();
m_goo_sound ->deleteSFX();
m_beep_sound ->deleteSFX();
@ -1357,6 +1363,8 @@ void Kart::update(float dt)
m_beep_sound->setPosition ( getXYZ() );
m_crash_sound->setPosition ( getXYZ() );
m_crash_sound2->setPosition ( getXYZ() );
m_crash_sound3->setPosition ( getXYZ() );
m_skid_sound->setPosition ( getXYZ() );
m_boing_sound->setPosition ( getXYZ() );
m_nitro_sound->setPosition ( getXYZ() );
@ -2163,9 +2171,17 @@ void Kart::playCrashSFX(const Material* m, AbstractKart *k)
}
else
{
if (m_crash_sound->getStatus() != SFXBase::SFX_PLAYING)
if (m_crash_sound->getStatus() != SFXBase::SFX_PLAYING
&& m_crash_sound2->getStatus() != SFXBase::SFX_PLAYING
&& m_crash_sound3->getStatus() != SFXBase::SFX_PLAYING)
{
m_crash_sound->play(getXYZ());
int idx = rand() % 3;
if (idx == 0)
m_crash_sound->play(getXYZ());
else if (idx == 1)
m_crash_sound2->play(getXYZ());
else
m_crash_sound3->play(getXYZ());
}
}
} // if lin_vel > 0.555

View File

@ -209,6 +209,8 @@ protected:
SFXBase *m_beep_sound;
SFXBase *m_engine_sound;
SFXBase *m_crash_sound;
SFXBase *m_crash_sound2;
SFXBase *m_crash_sound3;
SFXBase *m_terrain_sound;
SFXBase *m_nitro_sound;
/** A pointer to the previous terrain sound needs to be saved so that an