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.

93 lines
2.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef HUD_RADAR_H
  7. #define HUD_RADAR_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "hudelement.h"
  12. #include <vgui_controls/Panel.h>
  13. #include <vgui_controls/Label.h>
  14. class C_CSPlayer;
  15. void Radar_FlashPlayer( int iPlayer );
  16. class CPlayerRadarFlash
  17. {
  18. public:
  19. CPlayerRadarFlash()
  20. {
  21. m_flNextRadarFlashTime = 0.0f;
  22. m_iNumRadarFlashes = 0;
  23. m_bRadarFlash = false;
  24. }
  25. float m_flNextRadarFlashTime; // when to next toggle the flash on the radar
  26. int m_iNumRadarFlashes; // how many flashes more to do
  27. bool m_bRadarFlash; // flash or do not, there is no try
  28. };
  29. class CHudRadar : public CHudElement, public vgui::Panel
  30. {
  31. public:
  32. DECLARE_CLASS_SIMPLE( CHudRadar, vgui::Panel );
  33. CHudRadar( const char *name );
  34. ~CHudRadar();
  35. virtual void Paint();
  36. virtual void Init();
  37. virtual void LevelInit();
  38. virtual bool ShouldDraw();
  39. virtual void SetVisible(bool state);
  40. virtual void Reset();
  41. void DrawRadar(void) { m_bHideRadar = false; }
  42. void HideRadar(void) { m_bHideRadar = true; }
  43. void MsgFunc_UpdateRadar(bf_read &msg );
  44. private:
  45. void WorldToRadar( const Vector location, const Vector origin, const QAngle angles, float &x, float &y, float &z_delta );
  46. void DrawPlayerOnRadar( int iPlayer, C_CSPlayer *pLocalPlayer );
  47. void DrawEntityOnRadar( CBaseEntity *pEnt, C_CSPlayer *pLocalPlayer, int flags, int r, int g, int b, int a );
  48. void FillRect( int x, int y, int w, int h );
  49. void DrawRadarDot( int x, int y, float z_diff, int iBaseDotSize, int flags, int r, int g, int b, int a );
  50. CHudTexture *m_pBackground;
  51. CHudTexture *m_pBackgroundTrans;
  52. float m_flNextBombFlashTime;
  53. bool m_bBombFlash;
  54. float m_flNextHostageFlashTime;
  55. bool m_bHostageFlash;
  56. bool m_bHideRadar;
  57. };
  58. class CHudLocation : public CHudElement, public vgui::Label
  59. {
  60. public:
  61. DECLARE_CLASS_SIMPLE( CHudLocation, vgui::Panel );
  62. CHudLocation( const char *name );
  63. virtual void Init();
  64. virtual void LevelInit();
  65. virtual bool ShouldDraw();
  66. virtual void ApplySchemeSettings(vgui::IScheme *pScheme);
  67. virtual void OnTick( void );
  68. private:
  69. Color m_fgColor;
  70. };
  71. #endif // HUD_RADAR_H