Added SFX when karts hit karts back in.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2163 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
3be00a2d3f
commit
0eb36180bd
@ -215,7 +215,7 @@ public:
|
||||
virtual void collectedHerring (Herring* herring);
|
||||
virtual void reset ();
|
||||
virtual void handleZipper ();
|
||||
virtual void crashed () {};
|
||||
virtual void crashed (Kart *k) {};
|
||||
virtual void doLapCounting ();
|
||||
virtual void update (float dt);
|
||||
virtual void raceFinished (float time);
|
||||
|
@ -137,8 +137,8 @@ void Physics::update(float dt)
|
||||
*/
|
||||
void Physics::KartKartCollision(Kart *kartA, Kart *kartB)
|
||||
{
|
||||
kartA->crashed(); // will play crash sound for player karts
|
||||
kartB->crashed();
|
||||
kartA->crashed(kartB); // will play crash sound for player karts
|
||||
kartB->crashed(kartA);
|
||||
Attachment *attachmentA=kartA->getAttachment();
|
||||
Attachment *attachmentB=kartB->getAttachment();
|
||||
|
||||
@ -213,18 +213,14 @@ btScalar Physics::solveGroup(btCollisionObject** bodies, int numBodies,
|
||||
if(upB->is(UserPointer::UP_FLYABLE)) // 1.1 projectile hits track
|
||||
m_all_collisions.push_back(upB, upA);
|
||||
else if(upB->is(UserPointer::UP_KART))
|
||||
upB->getPointerKart()->crashed();
|
||||
upB->getPointerKart()->crashed(NULL);
|
||||
}
|
||||
// 2) object a is a kart
|
||||
// =====================
|
||||
else if(upA->is(UserPointer::UP_KART))
|
||||
{
|
||||
if(upB->is(UserPointer::UP_TRACK))
|
||||
// FIXME: sound disabled for now, since the chassis of the karts hits
|
||||
// the track when accelerating, causing a constant crash sfx
|
||||
// to be played. Might be fixed with better physics parameters
|
||||
// upA->getPointerKart()->crashed(); // Kart hit track
|
||||
;
|
||||
upA->getPointerKart()->crashed(NULL); // Kart hit track
|
||||
else if(upB->is(UserPointer::UP_FLYABLE))
|
||||
m_all_collisions.push_back(upB, upA); // 2.1 projectile hits kart
|
||||
else if(upB->is(UserPointer::UP_KART))
|
||||
|
@ -200,9 +200,9 @@ void PlayerKart::update(float dt)
|
||||
} // update
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void PlayerKart::crashed()
|
||||
void PlayerKart::crashed(Kart *kart)
|
||||
{
|
||||
Kart::crashed();
|
||||
Kart::crashed(kart);
|
||||
// A collision is usually reported several times, even when hitting
|
||||
// something only once. This results in a kind of 'machine gun'
|
||||
// noise by playing the crash sound over and over again. To prevent
|
||||
@ -211,11 +211,15 @@ void PlayerKart::crashed()
|
||||
|
||||
if(world->getTime() - m_time_last_crash_sound > 0.5f)
|
||||
{
|
||||
// FIXME: sound disabled for now, since the chassis of the karts hits
|
||||
// FIXME: sounds when hitting the track (i.e. the kart argument is NULL)
|
||||
// are disabled for now, since the chassis of the karts hits
|
||||
// the track when accelerating, causing a constant crash sfx
|
||||
// to be played. Might be fixed with better physics parameters
|
||||
//sound_manager->playSfx( SOUND_CRASH );
|
||||
m_time_last_crash_sound = world->getTime();
|
||||
if(kart)
|
||||
{
|
||||
sound_manager->playSfx( SOUND_CRASH );
|
||||
m_time_last_crash_sound = world->getTime();
|
||||
}
|
||||
}
|
||||
} // crashed
|
||||
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
void update (float);
|
||||
void addMessages ();
|
||||
void action (KartAction action, int value);
|
||||
void crashed ();
|
||||
void crashed (Kart *k);
|
||||
void handleZipper ();
|
||||
void collectedHerring (Herring* herring);
|
||||
virtual void setPosition (int p);
|
||||
|
@ -133,7 +133,7 @@ public:
|
||||
|
||||
void update (float delta) ;
|
||||
void reset ();
|
||||
virtual void crashed() {m_collided = true;};
|
||||
virtual void crashed(Kart *k) {if(k) m_collided = true;};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user