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:
parent
ea07179d46
commit
db6df068dd
@ -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
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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 ();
|
||||
};
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user