From 8916ad4fa413cc49ab541e75d375b21f70cd7320 Mon Sep 17 00:00:00 2001 From: aurhat Date: Sat, 25 Apr 2015 20:11:26 +0200 Subject: [PATCH] Fix playing weapon sounds No more sounds audible on the whole map in bot modes, when bots change weapon or have no ammo. Gun change sound in bot code was a duplicate, so removed. --- source/src/bot/bot.cpp | 1 - source/src/weapon.cpp | 14 +++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/source/src/bot/bot.cpp b/source/src/bot/bot.cpp index 44841131..4a6f15c2 100644 --- a/source/src/bot/bot.cpp +++ b/source/src/bot/bot.cpp @@ -289,7 +289,6 @@ bool CBot::SelectGun(int Gun) m_pMyEnt->gunselect = Gun; if(m_pMyEnt->weaponsel->type != Gun) { - audiomgr.playsound(S_GUNCHANGE, m_pMyEnt); m_pMyEnt->weaponswitch(m_pMyEnt->weapons[Gun]); m_iChangeWeaponDelay = lastmillis + 1000; } diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index f4844005..ad46e0f3 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -918,7 +918,8 @@ void weapon::updatetimers(int millis) void weapon::onselecting() { updatelastaction(owner); - audiomgr.playsound(S_GUNCHANGE, owner == player1? SP_HIGH : SP_NORMAL); + bool local = (owner == player1); + audiomgr.playsound(S_GUNCHANGE, owner, local ? SP_HIGH : SP_NORMAL); } void weapon::renderhudmodel() { renderhudmodel(owner->lastaction); } @@ -1193,7 +1194,13 @@ void grenades::renderstats() bool grenades::selectable() { return weapon::selectable() && state != GST_INHAND && mag; } void grenades::reset() { throwmillis = 0; quicknade = false; state = GST_NONE; } -void grenades::onselecting() { reset(); audiomgr.playsound(S_GUNCHANGE); } +void grenades::onselecting() +{ + reset(); + bool local = (owner == player1); + audiomgr.playsound(S_GUNCHANGE, owner, local ? SP_HIGH : SP_NORMAL); +} + void grenades::onownerdies() { reset(); @@ -1226,7 +1233,8 @@ bool gun::attack(vec &targ) updatelastaction(owner, attackmillis); if(!mag) { - audiomgr.playsoundc(S_NOAMMO); + bool local = (owner == player1); + audiomgr.playsound(S_NOAMMO, owner, local ? SP_HIGH : SP_NORMAL); gunwait += 250; owner->lastattackweapon = NULL; shots = 0;