Added support for kart-specific engine sounds. Updated kart files accordingly.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2485 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
stevo14 2008-11-20 09:11:27 +00:00
parent 49d9aeb365
commit 4975c09c1f
5 changed files with 26 additions and 8 deletions

View File

@ -130,7 +130,8 @@ void SFXManager::loadSfx()
loadSingleSfx(lisp, "prestart", SOUND_PRESTART );
loadSingleSfx(lisp, "start", SOUND_START );
loadSingleSfx(lisp, "missile_lock", SOUND_MISSILE_LOCK );
loadSingleSfx(lisp, "engine", SOUND_ENGINE );
loadSingleSfx(lisp, "engine_small", SOUND_ENGINE_SMALL );
loadSingleSfx(lisp, "engine_large", SOUND_ENGINE_LARGE );
} // loadSfx
//----------------------------------------------------------------------------
void SFXManager::loadSingleSfx(const lisp::Lisp* lisp,

View File

@ -48,7 +48,7 @@ public:
SOUND_UGH, SOUND_SKID, SOUND_WINNER, SOUND_CRASH, SOUND_GRAB, SOUND_SHOT, SOUND_WEE,
SOUND_EXPLOSION, SOUND_BZZT, SOUND_BEEP, SOUND_BACK_MENU, SOUND_USE_ANVIL,
SOUND_USE_PARACHUTE, SOUND_SELECT_MENU, SOUND_MOVE_MENU, SOUND_FULL,
SOUND_PRESTART, SOUND_START, SOUND_MISSILE_LOCK, SOUND_ENGINE,
SOUND_PRESTART, SOUND_START, SOUND_MISSILE_LOCK, SOUND_ENGINE_SMALL, SOUND_ENGINE_LARGE,
NUM_SOUNDS
};

View File

@ -102,10 +102,10 @@ Kart::Kart (const std::string& kart_name, int position,
m_rescue = false;
m_wheel_rotation = 0;
m_engine_sound = sfx_manager->newSFX(SFXManager::SOUND_ENGINE );
m_beep_sound = sfx_manager->newSFX(SFXManager::SOUND_BEEP );
m_crash_sound = sfx_manager->newSFX(SFXManager::SOUND_CRASH );
m_skid_sound = sfx_manager->newSFX(SFXManager::SOUND_SKID );
m_engine_sound = sfx_manager->newSFX(m_kart_properties->getEngineSfxType());
m_beep_sound = sfx_manager->newSFX( SFXManager::SOUND_BEEP );
m_crash_sound = sfx_manager->newSFX( SFXManager::SOUND_CRASH );
m_skid_sound = sfx_manager->newSFX( SFXManager::SOUND_SKID );
if(!m_engine_sound)
{

View File

@ -70,7 +70,8 @@ KartProperties::KartProperties() : m_icon_material(0)
m_camera_max_accel = m_camera_max_brake =
m_camera_distance = UNDEFINED;
m_gravity_center_shift = Vec3(UNDEFINED);
m_color.setValue(1.0f, 0.0f, 0.0f);
m_color.setValue(1.0f, 0.0f, 0.0f);
m_engine_sfx_type = SFXManager::SOUND_ENGINE_SMALL;
} // KartProperties
//-----------------------------------------------------------------------------
@ -183,7 +184,18 @@ void KartProperties::getAllData(const lisp::Lisp* lisp)
lisp->get("engine-power", m_engine_power);
lisp->get("time-full-steer", m_time_full_steer);
lisp->get("brake-factor", m_brake_factor);
lisp->get("mass", m_mass);
lisp->get("mass", m_mass);
std::string sfx_type_string;
lisp->get("engine-sound", sfx_type_string);
if(sfx_type_string == "large")
{
m_engine_sfx_type = SFXManager::SOUND_ENGINE_LARGE;
}
else if(sfx_type_string == "small")
{
m_engine_sfx_type = SFXManager::SOUND_ENGINE_SMALL;
}
std::vector<float> v;
if(lisp->getVector("max-speed-radius", v))

View File

@ -26,6 +26,7 @@
#include "vec3.hpp"
#include "karts/kart_model.hpp"
#include "lisp/lisp.hpp"
#include "audio/sfx_manager.hpp"
class Material;
class ssgEntity;
@ -98,6 +99,8 @@ protected:
*m_wheel_transform[4]; /**< The transform for the wheels, used
* to rotate the wheels and display
* the suspension in the race. */
SFXManager::SFXType m_engine_sfx_type;
// bullet physics data
// -------------------
float m_suspension_stiffness;
@ -166,6 +169,8 @@ public:
float getWheelieRestoreRate () const {return m_wheelie_restore_rate; }
float getWheelieSpeedBoost () const {return m_wheelie_speed_boost; }
float getWheeliePowerBoost () const {return m_wheelie_power_boost; }
SFXManager::SFXType getEngineSfxType()
const {return m_engine_sfx_type; }
//bullet physics get functions
float getSuspensionStiffness () const {return m_suspension_stiffness; }