Team Fortress 2 Source Code as on 22/4/2020
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.

58 lines
1.4 KiB

  1. //========= Copyright 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. void CHud::MsgFunc_ResetHUD( bf_read &msg )
  22. {
  23. ResetHUD();
  24. }
  25. void CHud::ResetHUD()
  26. {
  27. // clear all hud data
  28. g_pClientMode->GetViewportAnimationController()->CancelAllAnimations();
  29. for ( int i = 0; i < m_HudList.Size(); i++ )
  30. {
  31. m_HudList[i]->Reset();
  32. }
  33. g_pClientMode->GetViewportAnimationController()->RunAllAnimationsToCompletion();
  34. #ifndef _XBOX
  35. // reset sensitivity
  36. m_flMouseSensitivity = 0;
  37. m_flMouseSensitivityFactor = 0;
  38. #endif
  39. }
  40. //-----------------------------------------------------------------------------
  41. // Purpose:
  42. //-----------------------------------------------------------------------------
  43. void CHud::MsgFunc_SendAudio( bf_read &msg )
  44. {
  45. char szString[2048];
  46. msg.ReadString( szString, sizeof(szString) );
  47. CLocalPlayerFilter filter;
  48. C_BaseEntity::EmitSound( filter, SOUND_FROM_LOCAL_PLAYER, szString );
  49. }