Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.6 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. //
  9. // hud_msg.cpp
  10. //
  11. #include "cbase.h"
  12. #include "clientmode.h"
  13. #include "hudelement.h"
  14. #include "keyvalues.h"
  15. #include "vgui_controls/AnimationController.h"
  16. #include "engine/IEngineSound.h"
  17. #include <bitbuf.h>
  18. // memdbgon must be the last include file in a .cpp file!!!
  19. #include "tier0/memdbgon.h"
  20. /// USER-DEFINED SERVER MESSAGE HANDLERS
  21. bool CHud::MsgFunc_ResetHUD( const CCSUsrMsg_ResetHud& msg )
  22. {
  23. ResetHUD();
  24. return true;
  25. }
  26. void CHud::ResetHUD()
  27. {
  28. // clear all hud data
  29. GetClientMode()->GetViewportAnimationController()->CancelAllAnimations();
  30. for ( int i = 0; i < GetHudList().Count(); i++ )
  31. {
  32. #if defined ( PORTAL2 )
  33. // 78342: We don't want to clear hud chat every spawn as our
  34. // MP re-spawns players every death... losing chat is a big deal in p2 coop.
  35. if ( V_strcmp( GetHudList()[i]->GetName(), "CHudChat" ) == 0 )
  36. continue;
  37. #endif
  38. GetHudList()[i]->Reset();
  39. }
  40. GetClientMode()->GetViewportAnimationController()->RunAllAnimationsToCompletion();
  41. // reset sensitivity
  42. m_flMouseSensitivity = 0;
  43. m_flMouseSensitivityFactor = 0;
  44. }
  45. //-----------------------------------------------------------------------------
  46. // Purpose:
  47. //-----------------------------------------------------------------------------
  48. bool CHud::MsgFunc_SendAudio(const CCSUsrMsg_SendAudio& msg )
  49. {
  50. CLocalPlayerFilter filter;
  51. C_BaseEntity::EmitSound( filter, SOUND_FROM_LOCAL_PLAYER, msg.radio_sound().c_str() );
  52. return true;
  53. }