Fix for bug 3109198: sound for a powerup zipper was not played anymore.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6637 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-11-18 05:58:34 +00:00
parent 4959703ec3
commit 2f5bfd02cc
5 changed files with 10 additions and 8 deletions

View File

@ -54,7 +54,7 @@ public:
StateManager::ActivePlayer *getPlayer () {return m_player;}
virtual void reset () {};
virtual void update (float dt) {};
virtual void handleZipper () {};
virtual void handleZipper (bool play_sound) {};
virtual void collectedItem (const Item &item, int add_info=-1,
float previous_energy=0) {};

View File

@ -367,13 +367,13 @@ void PlayerController::finishedRace(float time)
//-----------------------------------------------------------------------------
/** Called when a kart hits or uses a zipper.
*/
void PlayerController::handleZipper()
void PlayerController::handleZipper(bool play_sound)
{
// Only play a zipper sound if it's not already playing, and
// if the material has changed (to avoid machine gun effect
// on conveyor belt zippers).
if (m_wee_sound->getStatus() != SFXManager::SFX_PLAYING &&
m_kart->getMaterial()!=m_kart->getLastMaterial())
if (play_sound || (m_wee_sound->getStatus() != SFXManager::SFX_PLAYING &&
m_kart->getMaterial()!=m_kart->getLastMaterial() ) )
{
m_wee_sound->play();
}

View File

@ -52,7 +52,7 @@ public:
~PlayerController ();
void update (float);
void action (PlayerAction action, int value);
void handleZipper ();
void handleZipper (bool play_sound);
void collectedItem (const Item &item, int add_info=-1,
float previous_energy=0);
virtual void setPosition (int p);

View File

@ -894,8 +894,10 @@ void Kart::update(float dt)
* \param material If not NULL, will be used to determine the zipper
* parameters, otherwise the defaults from kart properties
* will be used.
* \param play_sound If true this will cause a sfx to be played even if the
* terrain hasn't changed. It is used by the zipper powerup.
*/
void Kart::handleZipper(const Material *material)
void Kart::handleZipper(const Material *material, bool play_sound)
{
/** The additional speed allowed on top of the kart-specific maximum kart
* speed. */
@ -943,7 +945,7 @@ void Kart::handleZipper(const Material *material)
m_vehicle->activateZipper(speed);
// Play custom character sound (weee!)
playCustomSFX(SFXManager::CUSTOM_ZIPPER);
m_controller->handleZipper();
m_controller->handleZipper(play_sound);
} // handleZipper
// -----------------------------------------------------------------------------

View File

@ -231,7 +231,7 @@ public:
void updatedWeight ();
virtual void collectedItem (Item *item, int random_attachment);
virtual void reset ();
virtual void handleZipper (const Material *m=NULL);
virtual void handleZipper (const Material *m=NULL, bool play_sound=false);
virtual void crashed (Kart *k);
virtual void update (float dt);