From e7a7c45c3681e90cb9ab13d16935aae9860f1077 Mon Sep 17 00:00:00 2001 From: Howaner Date: Wed, 28 May 2014 16:39:59 +0200 Subject: Add throw sound and fix arrow server crash. --- src/Items/ItemThrowable.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/Items/ItemThrowable.h') diff --git a/src/Items/ItemThrowable.h b/src/Items/ItemThrowable.h index 35c2b8731..25935a1bc 100644 --- a/src/Items/ItemThrowable.h +++ b/src/Items/ItemThrowable.h @@ -31,6 +31,17 @@ public: Vector3d Pos = a_Player->GetThrowStartPos(); Vector3d Speed = a_Player->GetLookVector() * m_SpeedCoeff; + // Play sound + cFastRandom Random; + a_World->BroadcastSoundEffect( + "random.bow", + (int)std::floor(a_Player->GetPosX() * 8.0), + (int)std::floor((a_Player->GetPosY() - a_Player->GetHeight()) * 8.0), + (int)std::floor(a_Player->GetPosZ() * 8.0), + 0.5F, + 0.4F / (Random.NextFloat(1.0F) * 0.4F + 0.8F) + ); + if (a_World->CreateProjectile(Pos.x, Pos.y, Pos.z, m_ProjectileKind, a_Player, a_Player->GetEquippedItem(), &Speed) < 0) { return false; -- cgit v1.2.3