@@ -757,69 +757,76 @@ void CS2Fixes::Hook_PostEvent(CSplitScreenSlot nSlot, bool bLocalOnly, int nClie
757757 if (g_cvarEnableNoShake.Get ())
758758 *(uint64*)clients &= ~g_playerManager->GetNoShakeMask ();
759759 }
760- else if (g_cvarEnableStopSound. Get () && info->m_MessageId == GE_SosStartSoundEvent)
760+ else if (info->m_MessageId == GE_SosStartSoundEvent)
761761 {
762- static std::set<uint32> soundEventHashes;
763762 auto msg = const_cast <CNetMessage*>(pData)->ToPB <CMsgSosStartSoundEvent>();
764763
765- ExecuteOnce (
766- soundEventHashes.insert (GetSoundEventHash (" Weapon_Knife.HitWall" ));
767- soundEventHashes.insert (GetSoundEventHash (" Weapon_Knife.Slash" ));
768- soundEventHashes.insert (GetSoundEventHash (" Weapon_Knife.Hit" ));
769- soundEventHashes.insert (GetSoundEventHash (" Weapon_Knife.Stab" ));
770- soundEventHashes.insert (GetSoundEventHash (" Weapon_sg556.ZoomIn" ));
771- soundEventHashes.insert (GetSoundEventHash (" Weapon_sg556.ZoomOut" ));
772- soundEventHashes.insert (GetSoundEventHash (" Weapon_AUG.ZoomIn" ));
773- soundEventHashes.insert (GetSoundEventHash (" Weapon_AUG.ZoomOut" ));
774- soundEventHashes.insert (GetSoundEventHash (" Weapon_SSG08.Zoom" ));
775- soundEventHashes.insert (GetSoundEventHash (" Weapon_SSG08.ZoomOut" ));
776- soundEventHashes.insert (GetSoundEventHash (" Weapon_SCAR20.Zoom" ));
777- soundEventHashes.insert (GetSoundEventHash (" Weapon_SCAR20.ZoomOut" ));
778- soundEventHashes.insert (GetSoundEventHash (" Weapon_G3SG1.Zoom" ));
779- soundEventHashes.insert (GetSoundEventHash (" Weapon_G3SG1.ZoomOut" ));
780- soundEventHashes.insert (GetSoundEventHash (" Weapon_AWP.Zoom" ));
781- soundEventHashes.insert (GetSoundEventHash (" Weapon_AWP.ZoomOut" ));
782- soundEventHashes.insert (GetSoundEventHash (" Weapon_Revolver.Prepare" ));
783- soundEventHashes.insert (GetSoundEventHash (" Weapon.AutoSemiAutoSwitch" )););
784-
785- if (!soundEventHashes.contains (msg->soundevent_hash ()))
786- return ;
787-
788- uint64 stopSoundMask = g_playerManager->GetStopSoundMask ();
789- uint64 silenceSoundMask = g_playerManager->GetSilenceSoundMask ();
790-
791- if (!msg->has_source_entity_index ())
792- return ;
793-
794- CBaseEntity* pSourceEntity = (CBaseEntity*)g_pEntitySystem->GetEntityInstance (CEntityIndex (msg->source_entity_index ()));
795- int playerSlot = -1 ;
796-
797- if (!pSourceEntity)
798- return ;
799-
800- if (!V_strcasecmp (pSourceEntity->GetClassname (), " player" ))
801- {
802- playerSlot = ((CCSPlayerPawn*)pSourceEntity)->GetController ()->GetPlayerSlot ();
803- }
804- else if (!V_strncasecmp (pSourceEntity->GetClassname (), " weapon_" , 7 ))
764+ if (g_cvarEnableZR.Get ())
765+ ZR_PostEventAbstract_SosStartSoundEvent (clients, msg);
766+
767+ if (g_cvarEnableStopSound.Get ())
805768 {
806- CCSPlayerPawn* pPawn = (CCSPlayerPawn*)pSourceEntity->m_hOwnerEntity ().Get ();
769+ static std::set<uint32> soundEventHashes;
770+
771+ ExecuteOnce (
772+ soundEventHashes.insert (GetSoundEventHash (" Weapon_Knife.HitWall" ));
773+ soundEventHashes.insert (GetSoundEventHash (" Weapon_Knife.Slash" ));
774+ soundEventHashes.insert (GetSoundEventHash (" Weapon_Knife.Hit" ));
775+ soundEventHashes.insert (GetSoundEventHash (" Weapon_Knife.Stab" ));
776+ soundEventHashes.insert (GetSoundEventHash (" Weapon_sg556.ZoomIn" ));
777+ soundEventHashes.insert (GetSoundEventHash (" Weapon_sg556.ZoomOut" ));
778+ soundEventHashes.insert (GetSoundEventHash (" Weapon_AUG.ZoomIn" ));
779+ soundEventHashes.insert (GetSoundEventHash (" Weapon_AUG.ZoomOut" ));
780+ soundEventHashes.insert (GetSoundEventHash (" Weapon_SSG08.Zoom" ));
781+ soundEventHashes.insert (GetSoundEventHash (" Weapon_SSG08.ZoomOut" ));
782+ soundEventHashes.insert (GetSoundEventHash (" Weapon_SCAR20.Zoom" ));
783+ soundEventHashes.insert (GetSoundEventHash (" Weapon_SCAR20.ZoomOut" ));
784+ soundEventHashes.insert (GetSoundEventHash (" Weapon_G3SG1.Zoom" ));
785+ soundEventHashes.insert (GetSoundEventHash (" Weapon_G3SG1.ZoomOut" ));
786+ soundEventHashes.insert (GetSoundEventHash (" Weapon_AWP.Zoom" ));
787+ soundEventHashes.insert (GetSoundEventHash (" Weapon_AWP.ZoomOut" ));
788+ soundEventHashes.insert (GetSoundEventHash (" Weapon_Revolver.Prepare" ));
789+ soundEventHashes.insert (GetSoundEventHash (" Weapon.AutoSemiAutoSwitch" )););
790+
791+ if (!soundEventHashes.contains (msg->soundevent_hash ()))
792+ return ;
793+
794+ uint64 stopSoundMask = g_playerManager->GetStopSoundMask ();
795+ uint64 silenceSoundMask = g_playerManager->GetSilenceSoundMask ();
796+
797+ if (!msg->has_source_entity_index ())
798+ return ;
799+
800+ CBaseEntity* pSourceEntity = (CBaseEntity*)g_pEntitySystem->GetEntityInstance (CEntityIndex (msg->source_entity_index ()));
801+ int playerSlot = -1 ;
802+
803+ if (!pSourceEntity)
804+ return ;
805+
806+ if (!V_strcasecmp (pSourceEntity->GetClassname (), " player" ))
807+ {
808+ playerSlot = ((CCSPlayerPawn*)pSourceEntity)->GetController ()->GetPlayerSlot ();
809+ }
810+ else if (!V_strncasecmp (pSourceEntity->GetClassname (), " weapon_" , 7 ))
811+ {
812+ CCSPlayerPawn* pPawn = (CCSPlayerPawn*)pSourceEntity->m_hOwnerEntity ().Get ();
807813
808- if (pPawn && pPawn->IsPawn ())
809- playerSlot = pPawn->GetController ()->GetPlayerSlot ();
810- }
814+ if (pPawn && pPawn->IsPawn ())
815+ playerSlot = pPawn->GetController ()->GetPlayerSlot ();
816+ }
811817
812- // Remove player who triggered this sound from masks
813- // Because some of these sounds never get played locally (Zoom's, Knife Hit/Stab)
814- if (playerSlot != -1 && g_playerManager->IsPlayerUsingStopSound (playerSlot))
815- stopSoundMask &= ~((uint64)1 << playerSlot);
818+ // Remove player who triggered this sound from masks
819+ // Because some of these sounds never get played locally (Zoom's, Knife Hit/Stab)
820+ if (playerSlot != -1 && g_playerManager->IsPlayerUsingStopSound (playerSlot))
821+ stopSoundMask &= ~((uint64)1 << playerSlot);
816822
817- if (playerSlot != -1 && g_playerManager->IsPlayerUsingSilenceSound (playerSlot))
818- silenceSoundMask &= ~((uint64)1 << playerSlot);
823+ if (playerSlot != -1 && g_playerManager->IsPlayerUsingSilenceSound (playerSlot))
824+ silenceSoundMask &= ~((uint64)1 << playerSlot);
819825
820- // Filter out people using stop/silence sound from hearing this sound from other players
821- *(uint64*)clients &= ~stopSoundMask;
822- *(uint64*)clients &= ~silenceSoundMask;
826+ // Filter out people using stop/silence sound from hearing this sound from other players
827+ *(uint64*)clients &= ~stopSoundMask;
828+ *(uint64*)clients &= ~silenceSoundMask;
829+ }
823830 }
824831}
825832
0 commit comments