diff --git a/src/explosion.cpp b/src/explosion.cpp index 54fb7a722..3df8ad8cd 100644 --- a/src/explosion.cpp +++ b/src/explosion.cpp @@ -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 diff --git a/src/explosion.hpp b/src/explosion.hpp index 9703d5c24..48b357dc0 100644 --- a/src/explosion.hpp +++ b/src/explosion.hpp @@ -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); diff --git a/src/flyable.hpp b/src/flyable.hpp index f431544cf..82a91e987 100644 --- a/src/flyable.hpp +++ b/src/flyable.hpp @@ -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 diff --git a/src/items/bowling.hpp b/src/items/bowling.hpp index 608f5e0cd..b27475af4 100644 --- a/src/items/bowling.hpp +++ b/src/items/bowling.hpp @@ -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 diff --git a/src/items/item.hpp b/src/items/item.hpp index 9a9ea6a04..0a6a0d12f 100644 --- a/src/items/item.hpp +++ b/src/items/item.hpp @@ -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. diff --git a/src/items/projectile_manager.cpp b/src/items/projectile_manager.cpp index c0d279200..246853c88 100644 --- a/src/items/projectile_manager.cpp +++ b/src/items/projectile_manager.cpp @@ -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 diff --git a/src/items/projectile_manager.hpp b/src/items/projectile_manager.hpp index 0a4adad9e..43ce41075 100644 --- a/src/items/projectile_manager.hpp +++ b/src/items/projectile_manager.hpp @@ -23,6 +23,7 @@ #include #include #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 (); }; diff --git a/src/modes/standard_race.cpp b/src/modes/standard_race.cpp index 115f732ca..7edbbf9da 100644 --- a/src/modes/standard_race.cpp +++ b/src/modes/standard_race.cpp @@ -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()