From 230e9a886c784a8f94e62ccbac3048c6466cd315 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Sat, 6 Aug 2022 17:42:21 +0300 Subject: [PATCH] Fix geiger sounds interrupting other sounds (#303) --- cl_dll/geiger.cpp | 6 +++++- dlls/player.cpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cl_dll/geiger.cpp b/cl_dll/geiger.cpp index 89d2b951..daf13bbe 100644 --- a/cl_dll/geiger.cpp +++ b/cl_dll/geiger.cpp @@ -25,6 +25,7 @@ #include #include "parsemsg.h" +#include "event_api.h" DECLARE_MESSAGE( m_Geiger, Geiger ) @@ -175,7 +176,10 @@ int CHudGeiger::Draw( float flTime ) j += rand() & 1; sprintf( sz, "player/geiger%d.wav", j + 1 ); - PlaySound( sz, flvol ); + vec3_t view_ofs; + cl_entity_t *pthisplayer = gEngfuncs.GetLocalPlayer(); + gEngfuncs.pEventAPI->EV_LocalPlayerViewheight( view_ofs ); + gEngfuncs.pEventAPI->EV_PlaySound( pthisplayer->index, pthisplayer->origin + view_ofs, CHAN_STATIC, sz, flvol, ATTN_NORM, 0, PITCH_NORM ); } } diff --git a/dlls/player.cpp b/dlls/player.cpp index 44415ace..d95abee0 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -2333,7 +2333,7 @@ Things powered by the battery // if in range of radiation source, ping geiger counter -#define GEIGERDELAY 0.25f +#define GEIGERDELAY 0.28f void CBasePlayer::UpdateGeigerCounter( void ) {