added new bowling ball sounds, and cleaned up powrup sounds to make it easier to use different sounds for different weapons while instanciating less objects
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2564 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
45e00400a3
commit
ea07179d46
@ -111,27 +111,29 @@ void SFXManager::loadSfx()
|
|||||||
snprintf(msg, sizeof(msg), "No sfx-config node");
|
snprintf(msg, sizeof(msg), "No sfx-config node");
|
||||||
throw std::runtime_error(msg);
|
throw std::runtime_error(msg);
|
||||||
}
|
}
|
||||||
loadSingleSfx(lisp, "ugh", SOUND_UGH );
|
loadSingleSfx(lisp, "ugh", SOUND_UGH );
|
||||||
loadSingleSfx(lisp, "skid", SOUND_SKID );
|
loadSingleSfx(lisp, "skid", SOUND_SKID );
|
||||||
loadSingleSfx(lisp, "winner", SOUND_WINNER );
|
loadSingleSfx(lisp, "bowling_roll", SOUND_BOWLING_ROLL );
|
||||||
loadSingleSfx(lisp, "crash", SOUND_CRASH );
|
loadSingleSfx(lisp, "bowling_strike",SOUND_BOWLING_STRIKE );
|
||||||
loadSingleSfx(lisp, "grab", SOUND_GRAB );
|
loadSingleSfx(lisp, "winner", SOUND_WINNER );
|
||||||
loadSingleSfx(lisp, "shot", SOUND_SHOT );
|
loadSingleSfx(lisp, "crash", SOUND_CRASH );
|
||||||
loadSingleSfx(lisp, "wee", SOUND_WEE );
|
loadSingleSfx(lisp, "grab", SOUND_GRAB );
|
||||||
loadSingleSfx(lisp, "explosion", SOUND_EXPLOSION );
|
loadSingleSfx(lisp, "shot", SOUND_SHOT );
|
||||||
loadSingleSfx(lisp, "bzzt", SOUND_BZZT );
|
loadSingleSfx(lisp, "wee", SOUND_WEE );
|
||||||
loadSingleSfx(lisp, "beep", SOUND_BEEP );
|
loadSingleSfx(lisp, "explosion", SOUND_EXPLOSION );
|
||||||
loadSingleSfx(lisp, "back_menu", SOUND_BACK_MENU );
|
loadSingleSfx(lisp, "bzzt", SOUND_BZZT );
|
||||||
loadSingleSfx(lisp, "use_anvil", SOUND_USE_ANVIL );
|
loadSingleSfx(lisp, "beep", SOUND_BEEP );
|
||||||
loadSingleSfx(lisp, "use_parachute", SOUND_USE_PARACHUTE);
|
loadSingleSfx(lisp, "back_menu", SOUND_BACK_MENU );
|
||||||
loadSingleSfx(lisp, "select_menu", SOUND_SELECT_MENU );
|
loadSingleSfx(lisp, "use_anvil", SOUND_USE_ANVIL );
|
||||||
loadSingleSfx(lisp, "move_menu", SOUND_MOVE_MENU );
|
loadSingleSfx(lisp, "use_parachute", SOUND_USE_PARACHUTE );
|
||||||
loadSingleSfx(lisp, "full", SOUND_FULL );
|
loadSingleSfx(lisp, "select_menu", SOUND_SELECT_MENU );
|
||||||
loadSingleSfx(lisp, "prestart", SOUND_PRESTART );
|
loadSingleSfx(lisp, "move_menu", SOUND_MOVE_MENU );
|
||||||
loadSingleSfx(lisp, "start", SOUND_START );
|
loadSingleSfx(lisp, "full", SOUND_FULL );
|
||||||
loadSingleSfx(lisp, "missile_lock", SOUND_MISSILE_LOCK );
|
loadSingleSfx(lisp, "prestart", SOUND_PRESTART );
|
||||||
loadSingleSfx(lisp, "engine_small", SOUND_ENGINE_SMALL );
|
loadSingleSfx(lisp, "start", SOUND_START );
|
||||||
loadSingleSfx(lisp, "engine_large", SOUND_ENGINE_LARGE );
|
loadSingleSfx(lisp, "missile_lock", SOUND_MISSILE_LOCK );
|
||||||
|
loadSingleSfx(lisp, "engine_small", SOUND_ENGINE_SMALL );
|
||||||
|
loadSingleSfx(lisp, "engine_large", SOUND_ENGINE_LARGE );
|
||||||
} // loadSfx
|
} // loadSfx
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void SFXManager::loadSingleSfx(const lisp::Lisp* lisp,
|
void SFXManager::loadSingleSfx(const lisp::Lisp* lisp,
|
||||||
|
@ -45,8 +45,8 @@ public:
|
|||||||
/** The different type of sound effects. */
|
/** The different type of sound effects. */
|
||||||
enum SFXType
|
enum SFXType
|
||||||
{
|
{
|
||||||
SOUND_UGH, SOUND_SKID, SOUND_WINNER, SOUND_CRASH, SOUND_GRAB, SOUND_SHOT, SOUND_WEE,
|
SOUND_UGH, SOUND_SKID, SOUND_BOWLING_ROLL, SOUND_BOWLING_STRIKE, SOUND_WINNER, SOUND_CRASH, SOUND_GRAB,
|
||||||
SOUND_EXPLOSION, SOUND_BZZT, SOUND_BEEP, SOUND_BACK_MENU, SOUND_USE_ANVIL,
|
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_USE_PARACHUTE, SOUND_SELECT_MENU, SOUND_MOVE_MENU, SOUND_FULL,
|
||||||
SOUND_PRESTART, SOUND_START, SOUND_MISSILE_LOCK, SOUND_ENGINE_SMALL, SOUND_ENGINE_LARGE,
|
SOUND_PRESTART, SOUND_START, SOUND_MISSILE_LOCK, SOUND_ENGINE_SMALL, SOUND_ENGINE_LARGE,
|
||||||
NUM_SOUNDS
|
NUM_SOUNDS
|
||||||
|
@ -34,9 +34,7 @@
|
|||||||
Powerup::Powerup(Kart* kart_)
|
Powerup::Powerup(Kart* kart_)
|
||||||
{
|
{
|
||||||
m_owner = kart_;
|
m_owner = kart_;
|
||||||
m_sound_shot = sfx_manager->newSFX(SFXManager::SOUND_SHOT);
|
m_sound_use = NULL;
|
||||||
m_sound_use_anvil = sfx_manager->newSFX(SFXManager::SOUND_USE_ANVIL);
|
|
||||||
m_sound_use_parachute = sfx_manager->newSFX(SFXManager::SOUND_USE_PARACHUTE);
|
|
||||||
reset();
|
reset();
|
||||||
} // Powerup
|
} // Powerup
|
||||||
|
|
||||||
@ -45,18 +43,15 @@ Powerup::Powerup(Kart* kart_)
|
|||||||
*/
|
*/
|
||||||
Powerup::~Powerup()
|
Powerup::~Powerup()
|
||||||
{
|
{
|
||||||
sfx_manager->deleteSFX(m_sound_shot);
|
sfx_manager->deleteSFX(m_sound_use);
|
||||||
sfx_manager->deleteSFX(m_sound_use_anvil);
|
|
||||||
sfx_manager->deleteSFX(m_sound_use_parachute);
|
|
||||||
|
|
||||||
} // ~Powerup
|
} // ~Powerup
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void Powerup::reset()
|
void Powerup::reset()
|
||||||
{
|
{
|
||||||
int type;
|
int type, number;
|
||||||
RaceManager::getWorld()->getDefaultCollectibles( type, m_number );
|
RaceManager::getWorld()->getDefaultCollectibles( type, number );
|
||||||
m_type = (PowerupType)type;
|
set( (PowerupType)type, number );
|
||||||
} // reset
|
} // reset
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -69,6 +64,39 @@ void Powerup::set(PowerupType type, int n)
|
|||||||
}
|
}
|
||||||
m_type=type;
|
m_type=type;
|
||||||
m_number=n;
|
m_number=n;
|
||||||
|
|
||||||
|
if(m_sound_use != NULL)
|
||||||
|
{
|
||||||
|
sfx_manager->deleteSFX(m_sound_use);
|
||||||
|
m_sound_use = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (m_type)
|
||||||
|
{
|
||||||
|
case POWERUP_ZIPPER:
|
||||||
|
break ;
|
||||||
|
|
||||||
|
case POWERUP_BOWLING:
|
||||||
|
m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_BOWLING_ROLL);
|
||||||
|
break ;
|
||||||
|
|
||||||
|
case POWERUP_ANVIL:
|
||||||
|
m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_USE_ANVIL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case POWERUP_PARACHUTE:
|
||||||
|
m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_USE_PARACHUTE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case POWERUP_NOTHING:
|
||||||
|
case POWERUP_CAKE:
|
||||||
|
case POWERUP_PLUNGER:
|
||||||
|
case POWERUP_BUBBLEGUM:
|
||||||
|
default :
|
||||||
|
m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_SHOT);
|
||||||
|
break ;
|
||||||
|
}
|
||||||
|
|
||||||
} // set
|
} // set
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -82,6 +110,9 @@ Material *Powerup::getIcon()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void Powerup::use()
|
void Powerup::use()
|
||||||
{
|
{
|
||||||
|
// FIXME - for some collectibles, set() is never called
|
||||||
|
if(m_sound_use == NULL) m_sound_use = sfx_manager->newSFX(SFXManager::SOUND_SHOT);
|
||||||
|
|
||||||
m_number--;
|
m_number--;
|
||||||
switch (m_type)
|
switch (m_type)
|
||||||
{
|
{
|
||||||
@ -91,15 +122,15 @@ void Powerup::use()
|
|||||||
case POWERUP_BOWLING:
|
case POWERUP_BOWLING:
|
||||||
case POWERUP_PLUNGER:
|
case POWERUP_PLUNGER:
|
||||||
|
|
||||||
m_sound_shot->position(m_owner->getXYZ());
|
m_sound_use->position(m_owner->getXYZ());
|
||||||
m_sound_shot->play();
|
m_sound_use->play();
|
||||||
projectile_manager->newProjectile(m_owner, m_type);
|
projectile_manager->newProjectile(m_owner, m_type);
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case POWERUP_BUBBLEGUM:
|
case POWERUP_BUBBLEGUM:
|
||||||
{
|
{
|
||||||
m_sound_shot->position(m_owner->getXYZ());
|
m_sound_use->position(m_owner->getXYZ());
|
||||||
m_sound_shot->play();
|
m_sound_use->play();
|
||||||
btVector3 pos = m_owner->getXYZ();
|
btVector3 pos = m_owner->getXYZ();
|
||||||
float z_coord = Track::NOHIT;
|
float z_coord = Track::NOHIT;
|
||||||
Vec3 normal;
|
Vec3 normal;
|
||||||
@ -128,8 +159,8 @@ void Powerup::use()
|
|||||||
kart->attach(ATTACH_ANVIL, stk_config->m_anvil_time);
|
kart->attach(ATTACH_ANVIL, stk_config->m_anvil_time);
|
||||||
kart->updatedWeight();
|
kart->updatedWeight();
|
||||||
kart->adjustSpeed(stk_config->m_anvil_speed_factor*0.5f);
|
kart->adjustSpeed(stk_config->m_anvil_speed_factor*0.5f);
|
||||||
m_sound_use_anvil->position(m_owner->getXYZ());
|
m_sound_use->position(m_owner->getXYZ());
|
||||||
m_sound_use_anvil->play();
|
m_sound_use->play();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,8 +188,8 @@ void Powerup::use()
|
|||||||
|
|
||||||
if(player_kart)
|
if(player_kart)
|
||||||
{
|
{
|
||||||
m_sound_use_parachute->position(player_kart->getXYZ());
|
m_sound_use->position(player_kart->getXYZ());
|
||||||
m_sound_use_parachute->play();
|
m_sound_use->play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -186,8 +217,7 @@ void Powerup::hitBonusBox(int n, const Item &item, int add_info)
|
|||||||
if(network_manager->getMode()==NetworkManager::NW_CLIENT)
|
if(network_manager->getMode()==NetworkManager::NW_CLIENT)
|
||||||
{
|
{
|
||||||
m_random.get(100); // keep random numbers in sync
|
m_random.get(100); // keep random numbers in sync
|
||||||
m_type = (PowerupType)add_info;
|
set( (PowerupType)add_info, 1);
|
||||||
m_number = 1;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const int SPECIAL_PROB = (int)(15.0 / ((float)RaceManager::getWorld()->getCurrentNumKarts() /
|
const int SPECIAL_PROB = (int)(15.0 / ((float)RaceManager::getWorld()->getCurrentNumKarts() /
|
||||||
@ -203,8 +233,7 @@ void Powerup::hitBonusBox(int n, const Item &item, int add_info)
|
|||||||
if(kart->isEliminated() || kart == m_owner) continue;
|
if(kart->isEliminated() || kart == m_owner) continue;
|
||||||
if(kart->getPosition() == 1 && kart->hasFinishedRace())
|
if(kart->getPosition() == 1 && kart->hasFinishedRace())
|
||||||
{
|
{
|
||||||
m_type = POWERUP_PARACHUTE;
|
set(POWERUP_PARACHUTE, 1);
|
||||||
m_number = 1;
|
|
||||||
if(network_manager->getMode()==NetworkManager::NW_SERVER)
|
if(network_manager->getMode()==NetworkManager::NW_SERVER)
|
||||||
{
|
{
|
||||||
race_state->itemCollected(m_owner->getWorldKartId(),
|
race_state->itemCollected(m_owner->getWorldKartId(),
|
||||||
@ -215,8 +244,8 @@ void Powerup::hitBonusBox(int n, const Item &item, int add_info)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_type = m_random.get(2) == 0 ? POWERUP_ANVIL : POWERUP_PARACHUTE;
|
set( (m_random.get(2) == 0 ? POWERUP_ANVIL : POWERUP_PARACHUTE), 1 );
|
||||||
m_number = 1;
|
|
||||||
if(network_manager->getMode()==NetworkManager::NW_SERVER)
|
if(network_manager->getMode()==NetworkManager::NW_SERVER)
|
||||||
{
|
{
|
||||||
race_state->itemCollected(m_owner->getWorldKartId(),
|
race_state->itemCollected(m_owner->getWorldKartId(),
|
||||||
@ -234,8 +263,7 @@ void Powerup::hitBonusBox(int n, const Item &item, int add_info)
|
|||||||
{
|
{
|
||||||
if(m_type==POWERUP_NOTHING)
|
if(m_type==POWERUP_NOTHING)
|
||||||
{
|
{
|
||||||
m_type = (PowerupType)add_info;
|
set( (PowerupType)add_info, n );
|
||||||
m_number = n;
|
|
||||||
}
|
}
|
||||||
else if((PowerupType)add_info==m_type)
|
else if((PowerupType)add_info==m_type)
|
||||||
{
|
{
|
||||||
@ -272,8 +300,7 @@ void Powerup::hitBonusBox(int n, const Item &item, int add_info)
|
|||||||
|
|
||||||
if(m_type==POWERUP_NOTHING)
|
if(m_type==POWERUP_NOTHING)
|
||||||
{
|
{
|
||||||
m_type=newC;
|
set( newC, n );
|
||||||
m_number = n;
|
|
||||||
}
|
}
|
||||||
else if(newC==m_type)
|
else if(newC==m_type)
|
||||||
{
|
{
|
||||||
|
@ -33,14 +33,12 @@ class Powerup
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
RandomGenerator m_random;
|
RandomGenerator m_random;
|
||||||
SFXBase *m_sound_shot;
|
SFXBase *m_sound_use;
|
||||||
SFXBase *m_sound_use_anvil;
|
|
||||||
SFXBase *m_sound_use_parachute;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
Kart* m_owner;
|
|
||||||
PowerupType m_type;
|
PowerupType m_type;
|
||||||
int m_number;
|
int m_number;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Kart* m_owner;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Powerup (Kart* kart_);
|
Powerup (Kart* kart_);
|
||||||
|
Loading…
Reference in New Issue
Block a user