added strike sound when a bowling ball hits a kart

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2565 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2008-12-03 16:28:32 +00:00
parent ea07179d46
commit db6df068dd
8 changed files with 16 additions and 7 deletions

View File

@ -25,14 +25,14 @@
#include "audio/sfx_manager.hpp"
#include "utils/vec3.hpp"
Explosion::Explosion(const Vec3& coord) : ssgTransform()
Explosion::Explosion(const Vec3& coord, const int explosion_sound) : ssgTransform()
{
this->ref();
ssgCutout *cut = new ssgCutout();
addKid(cut); // derefing the explosion will free the cutout
m_seq = projectile_manager->getExplosionModel();
cut->addKid(m_seq);
m_explode_sound = sfx_manager->newSFX(SFXManager::SOUND_EXPLOSION);
m_explode_sound = sfx_manager->newSFX( (SFXManager::SFXType)explosion_sound );
init(coord);
} // Explosion

View File

@ -35,7 +35,7 @@ public:
int m_step ;
ssgSelector *m_seq ;
Explosion(const Vec3& coord);
Explosion(const Vec3& coord, const int explosion_sound);
~Explosion();
void init (const Vec3& coord);
void update (float delta_t);

View File

@ -104,6 +104,8 @@ public:
void explode (Kart* kart, MovingPhysics* moving_physics=NULL);
bool hasHit () { return m_has_hit_something; }
void reset () { Moveable::reset(); }
virtual int getExplosionSound() const { return SFXManager::SOUND_EXPLOSION; }
}; // Flyable
#endif

View File

@ -34,6 +34,8 @@ public:
static void init(const lisp::Lisp* lisp, ssgEntity* bowling);
virtual void update(float dt);
int getExplosionSound() const { return SFXManager::SOUND_BOWLING_STRIKE; }
}; // Bowling
#endif

View File

@ -66,6 +66,7 @@ public:
virtual ~Item ();
void update (float delta);
virtual void isCollected(float t=2.0f);
// ------------------------------------------------------------------------
/** Returns true if the Kart is close enough to hit this item, and
* the item is not deactivated anymore.

View File

@ -99,7 +99,7 @@ void ProjectileManager::update(float dt)
while(p!=m_active_projectiles.end())
{
if(! (*p)->hasHit()) { p++; continue; }
newExplosion((*p)->getXYZ());
newExplosion((*p)->getXYZ(), (*p)->getExplosionSound() );
Flyable *f=*p;
Projectiles::iterator pNext=m_active_projectiles.erase(p); // returns the next element
delete f;
@ -198,9 +198,9 @@ Flyable *ProjectileManager::newProjectile(Kart *kart, PowerupType type)
// -----------------------------------------------------------------------------
/** See if there is an old, unused explosion object available. If so,
* reuse this object, otherwise create a new one. */
Explosion* ProjectileManager::newExplosion(const Vec3& coord)
Explosion* ProjectileManager::newExplosion(const Vec3& coord, const int explosion_sound)
{
Explosion *e = new Explosion(coord);
Explosion *e = new Explosion(coord, explosion_sound);
m_active_explosions.push_back(e);
return e;
} // newExplosion

View File

@ -23,6 +23,7 @@
#include <vector>
#include <plib/ssg.h>
#include "items/powerup_manager.hpp"
#include "audio/sfx_manager.hpp"
class Vec3;
class Kart;
@ -63,7 +64,7 @@ public:
void cleanup ();
void update (float dt);
Flyable* newProjectile (Kart *kart, PowerupType type);
Explosion* newExplosion (const Vec3& coord);
Explosion* newExplosion (const Vec3& coord, const int explosion_sound=(SFXManager::SFXType)SFXManager::SOUND_EXPLOSION);
void Deactivate (Flyable *p) {}
void removeTextures ();
};

View File

@ -98,6 +98,9 @@ void StandardRace::getDefaultCollectibles(int& collectible_type, int& amount)
amount = race_manager->getNumLaps();
}
else World::getDefaultCollectibles(collectible_type, amount);
collectible_type = POWERUP_BOWLING;
amount = 5;
}
//-----------------------------------------------------------------------------
bool StandardRace::enableBonusBoxes()