Fixed #1064.
Also added separated bowling roll and shoot sounds. Now bowling_roll can be played in a loop. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14219 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
9ce3a75377
commit
414ad5b24b
@ -18,6 +18,8 @@
|
||||
|
||||
#include "items/bowling.hpp"
|
||||
|
||||
#include "audio/sfx_base.hpp"
|
||||
#include "audio/sfx_manager.hpp"
|
||||
#include "graphics/hit_sfx.hpp"
|
||||
#include "graphics/material.hpp"
|
||||
#include "io/xml_node.hpp"
|
||||
@ -74,8 +76,22 @@ Bowling::Bowling(AbstractKart *kart)
|
||||
// should not live forever, auto-destruct after 20 seconds
|
||||
m_max_lifespan = 20;
|
||||
|
||||
m_roll_sfx = sfx_manager->createSoundSource("bowling_roll");
|
||||
m_roll_sfx->play();
|
||||
m_roll_sfx->setLoop(true);
|
||||
|
||||
} // Bowling
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Destructor, removes any playing sfx.
|
||||
*/
|
||||
Bowling::~Bowling()
|
||||
{
|
||||
if(m_roll_sfx->getStatus()==SFXManager::SFX_PLAYING)
|
||||
m_roll_sfx->stop();
|
||||
sfx_manager->deleteSFX(m_roll_sfx);
|
||||
} // ~RubberBall
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Initialises this object with data from the power.xml file.
|
||||
* \param node XML Node
|
||||
@ -200,6 +216,10 @@ bool Bowling::updateAndDelete(float dt)
|
||||
hit(NULL);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (m_roll_sfx->getStatus()==SFXManager::SFX_PLAYING)
|
||||
m_roll_sfx->position(getXYZ());
|
||||
|
||||
return false;
|
||||
} // updateAndDelete
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -29,6 +29,7 @@ using namespace irr;
|
||||
#include "items/flyable.hpp"
|
||||
|
||||
class XMLNode;
|
||||
class SFXBase;
|
||||
|
||||
/**
|
||||
* \ingroup items
|
||||
@ -45,8 +46,12 @@ private:
|
||||
* kart was hit. */
|
||||
bool m_has_hit_kart;
|
||||
|
||||
/** A sound effect for rolling ball. */
|
||||
SFXBase *m_roll_sfx;
|
||||
|
||||
public:
|
||||
Bowling(AbstractKart* kart);
|
||||
Bowling(AbstractKart* kart);
|
||||
virtual ~Bowling();
|
||||
static void init(const XMLNode &node, scene::IMesh *bowling);
|
||||
virtual bool updateAndDelete(float dt);
|
||||
virtual const core::stringw getHitString(const AbstractKart *kart) const;
|
||||
|
@ -152,7 +152,7 @@ void Powerup::set(PowerupManager::PowerupType type, int n)
|
||||
break ;
|
||||
|
||||
case PowerupManager::POWERUP_BOWLING:
|
||||
m_sound_use = sfx_manager->createSoundSource("bowling_roll");
|
||||
m_sound_use = sfx_manager->createSoundSource("bowling_shoot");
|
||||
break ;
|
||||
|
||||
case PowerupManager::POWERUP_ANVIL:
|
||||
|
Loading…
Reference in New Issue
Block a user