From 30c8470a524f5d09f157d5c1c59eb72c205d5085 Mon Sep 17 00:00:00 2001 From: Lane Kolbly Date: Tue, 19 Sep 2017 09:12:54 -0500 Subject: Changed BroadcastSoundEffect, SendSoundEffect, and CastThunderbolt parameters to vectors (#3959) * Made BroadcastSoundEffect take vector parameters. * Added docs for new vectored methods * Removed old code * Fixed lua warnings * Made old BroadcastSoundEffect not an override. * m_Block to m_BlockPos, used Vector3d constructor where prettier. * a_Block to a_BlockPos * Changed thunderbolt a_Block to a_BlockPos --- src/Entities/ArrowEntity.cpp | 6 +++--- src/Entities/ExpOrb.cpp | 2 +- src/Entities/Floater.cpp | 2 +- src/Entities/LeashKnot.cpp | 4 ++-- src/Entities/Pickup.cpp | 2 +- src/Entities/Player.cpp | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/Entities') diff --git a/src/Entities/ArrowEntity.cpp b/src/Entities/ArrowEntity.cpp index 2c1a1f005..4d104bd26 100644 --- a/src/Entities/ArrowEntity.cpp +++ b/src/Entities/ArrowEntity.cpp @@ -88,7 +88,7 @@ void cArrowEntity::OnHitSolidBlock(Vector3d a_HitPos, eBlockFace a_HitFace) m_HitBlockPos = Vector3i(X, Y, Z); // Broadcast arrow hit sound - m_World->BroadcastSoundEffect("entity.arrow.hit", static_cast(X), static_cast(Y), static_cast(Z), 0.5f, static_cast(0.75 + (static_cast((GetUniqueID() * 23) % 32)) / 64)); + m_World->BroadcastSoundEffect("entity.arrow.hit", BlockHit, 0.5f, static_cast(0.75 + (static_cast((GetUniqueID() * 23) % 32)) / 64)); if ((m_World->GetBlock(Hit) == E_BLOCK_TNT) && IsOnFire()) { @@ -129,7 +129,7 @@ void cArrowEntity::OnHitEntity(cEntity & a_EntityHit, Vector3d a_HitPos) } // Broadcast successful hit sound - GetWorld()->BroadcastSoundEffect("entity.arrow.hit_player", GetPosX(), GetPosY(), GetPosZ(), 0.5, static_cast(0.75 + (static_cast((GetUniqueID() * 23) % 32)) / 64)); + GetWorld()->BroadcastSoundEffect("entity.arrow.hit_player", GetPosition(), 0.5, static_cast(0.75 + (static_cast((GetUniqueID() * 23) % 32)) / 64)); Destroy(); } @@ -154,7 +154,7 @@ void cArrowEntity::CollectedBy(cPlayer & a_Dest) } GetWorld()->BroadcastCollectEntity(*this, a_Dest, 1); - GetWorld()->BroadcastSoundEffect("entity.item.pickup", GetPosX(), GetPosY(), GetPosZ(), 0.5, static_cast(0.75 + (static_cast((GetUniqueID() * 23) % 32)) / 64)); + GetWorld()->BroadcastSoundEffect("entity.item.pickup", GetPosition(), 0.5, static_cast(0.75 + (static_cast((GetUniqueID() * 23) % 32)) / 64)); m_bIsCollected = true; } } diff --git a/src/Entities/ExpOrb.cpp b/src/Entities/ExpOrb.cpp index 2d59206c2..4ae847bf8 100644 --- a/src/Entities/ExpOrb.cpp +++ b/src/Entities/ExpOrb.cpp @@ -61,7 +61,7 @@ void cExpOrb::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) LOGD("Player %s picked up an ExpOrb. His reward is %i", a_ClosestPlayer->GetName().c_str(), m_Reward); a_ClosestPlayer->DeltaExperience(m_Reward); - m_World->BroadcastSoundEffect("entity.experience_orb.pickup", GetPosX(), GetPosY(), GetPosZ(), 0.5f, (0.75f + (static_cast((GetUniqueID() * 23) % 32)) / 64)); + m_World->BroadcastSoundEffect("entity.experience_orb.pickup", GetPosition(), 0.5f, (0.75f + (static_cast((GetUniqueID() * 23) % 32)) / 64)); Destroy(true); return; diff --git a/src/Entities/Floater.cpp b/src/Entities/Floater.cpp index de5824068..4dc64cf53 100644 --- a/src/Entities/Floater.cpp +++ b/src/Entities/Floater.cpp @@ -112,7 +112,7 @@ void cFloater::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) if (m_CountDownTime <= 0) { m_BitePos = GetPosition(); - m_World->BroadcastSoundEffect("entity.bobber.splash", GetPosX(), GetPosY(), GetPosZ(), 1, 1); + m_World->BroadcastSoundEffect("entity.bobber.splash", GetPosition(), 1, 1); SetPosY(GetPosY() - 1); m_CanPickupItem = true; m_PickupCountDown = 20; diff --git a/src/Entities/LeashKnot.cpp b/src/Entities/LeashKnot.cpp index c251f9e9d..971032329 100644 --- a/src/Entities/LeashKnot.cpp +++ b/src/Entities/LeashKnot.cpp @@ -84,7 +84,7 @@ void cLeashKnot::TiePlayersLeashedMobs(cPlayer & a_Player, bool a_ShouldBroadcas void cLeashKnot::KilledBy(TakeDamageInfo & a_TDI) { super::KilledBy(a_TDI); - m_World->BroadcastSoundEffect("entity.leashknot.break", GetPosX(), GetPosY(), GetPosZ(), 1, 1); + m_World->BroadcastSoundEffect("entity.leashknot.break", GetPosition(), 1, 1); Destroy(); return; } @@ -131,7 +131,7 @@ void cLeashKnot::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) if (m_TicksToSelfDestroy <= 0) { Destroy(); - m_World->BroadcastSoundEffect("entity.leashknot.break", GetPosX(), GetPosY(), GetPosZ(), 1, 1); + m_World->BroadcastSoundEffect("entity.leashknot.break", GetPosition(), 1, 1); } } } diff --git a/src/Entities/Pickup.cpp b/src/Entities/Pickup.cpp index fcae586f6..26fe58252 100644 --- a/src/Entities/Pickup.cpp +++ b/src/Entities/Pickup.cpp @@ -248,7 +248,7 @@ bool cPickup::CollectedBy(cPlayer & a_Dest) m_World->BroadcastCollectEntity(*this, a_Dest, NumAdded); // Also send the "pop" sound effect with a somewhat random pitch (fast-random using EntityID ;) - m_World->BroadcastSoundEffect("entity.item.pickup", GetPosX(), GetPosY(), GetPosZ(), 0.5, (0.75f + (static_cast((GetUniqueID() * 23) % 32)) / 64)); + m_World->BroadcastSoundEffect("entity.item.pickup", GetPosition(), 0.5, (0.75f + (static_cast((GetUniqueID() * 23) % 32)) / 64)); if (m_Item.m_ItemCount <= 0) { // All of the pickup has been collected, schedule the pickup for destroying diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp index 8ce577b8f..0769499b1 100644 --- a/src/Entities/Player.cpp +++ b/src/Entities/Player.cpp @@ -2330,7 +2330,7 @@ void cPlayer::UseEquippedItem(int a_Amount) if (GetInventory().DamageEquippedItem(static_cast(a_Amount))) { - m_World->BroadcastSoundEffect("entity.item.break", GetPosX(), GetPosY(), GetPosZ(), 0.5f, static_cast(0.75 + (static_cast((GetUniqueID() * 23) % 32)) / 64)); + m_World->BroadcastSoundEffect("entity.item.break", GetPosition(), 0.5f, static_cast(0.75 + (static_cast((GetUniqueID() * 23) % 32)) / 64)); } } -- cgit v1.2.3