From e8dc5d4f4d6068b11444d689974b70607aea5126 Mon Sep 17 00:00:00 2001 From: rforder Date: Sat, 22 Aug 2009 16:45:24 +0000 Subject: [PATCH] Improved location of custom SFX calls to avoid multiple calls being made simultaneously git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3906 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/items/attachment.cpp | 1 - src/karts/kart.cpp | 3 --- src/physics/physics.cpp | 9 +++++++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/items/attachment.cpp b/src/items/attachment.cpp index c7137863a..eb8dfcf0a 100644 --- a/src/items/attachment.cpp +++ b/src/items/attachment.cpp @@ -160,7 +160,6 @@ void Attachment::moveBombFromTo(Kart *from, Kart *to) from->getAttachment()->getTimeLeft()+ stk_config->m_bomb_time_increase, from); - to->playCustomSFX(SFXManager::CUSTOM_ATTACH); from->getAttachment()->clear(); } // moveBombFromTo diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index d188ce68b..3b42be6e2 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -862,9 +862,6 @@ void Kart::crashed(Kart *k) if(m_crash_sound->getStatus() != SFXManager::SFX_PLAYING) m_crash_sound->play(); - // If we hit another kart, yell at it! (play custom kart sound) - if (k != NULL) playCustomSFX(SFXManager::CUSTOM_CRASH); - m_bounce_back_time = 0.1f; } } // crashed diff --git a/src/physics/physics.cpp b/src/physics/physics.cpp index 8f4162b71..ffaf58510 100644 --- a/src/physics/physics.cpp +++ b/src/physics/physics.cpp @@ -192,6 +192,8 @@ void Physics::KartKartCollision(Kart *kartA, Kart *kartB) if(attachmentA->getPreviousOwner()!=kartB) { attachmentA->moveBombFromTo(kartA, kartB); + // Play appropriate SFX + kartB->playCustomSFX(SFXManager::CUSTOM_ATTACH); } } } @@ -199,6 +201,13 @@ void Physics::KartKartCollision(Kart *kartA, Kart *kartB) attachmentB->getPreviousOwner()!=kartA) { attachmentB->moveBombFromTo(kartB, kartA); + kartA->playCustomSFX(SFXManager::CUSTOM_ATTACH); + } + else + { + // No bombs exchanged, no explosions, tell the other driver to move it! + kartA->playCustomSFX(SFXManager::CUSTOM_CRASH); + kartB->playCustomSFX(SFXManager::CUSTOM_CRASH); } } // KartKartCollision