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.

96 lines
2.4 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef HUD_PDUMP_H
  7. #define HUD_PDUMP_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include <vgui_controls/Panel.h>
  12. #include "hudelement.h"
  13. #include "tier1/utlsortvector.h"
  14. namespace vgui
  15. {
  16. class IScheme;
  17. };
  18. class CPDumpPanel : public CHudElement, public vgui::Panel
  19. {
  20. DECLARE_CLASS_SIMPLE( CPDumpPanel, vgui::Panel );
  21. public:
  22. enum
  23. {
  24. DUMP_CLASSNAME_SIZE = 128,
  25. DUMP_STRING_SIZE = 128,
  26. };
  27. explicit CPDumpPanel( const char *pElementName );
  28. ~CPDumpPanel();
  29. DECLARE_MULTIPLY_INHERITED();
  30. virtual void ApplySettings( KeyValues *inResourceData );
  31. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  32. virtual void Paint( void );
  33. virtual bool ShouldDraw();
  34. // Remove dump info
  35. void Clear();
  36. void DumpEntity( C_BaseEntity *ent, int commands_acknowledged );
  37. void DumpComparision( const char *classname, const char *fieldname, const char *fieldtype,
  38. bool networked, bool noterrorchecked, bool differs, bool withintolerance, const char *value );
  39. private:
  40. void PredictionDumpColor( bool legend, bool predictable, bool networked, bool errorchecked, bool differs, bool withintolerance,
  41. int& r, int& g, int& b, int& a );
  42. //-----------------------------------------------------------------------------
  43. // Purpose: Stores some info about the various fields of an entity for display
  44. //-----------------------------------------------------------------------------
  45. struct DumpInfo
  46. {
  47. int index;
  48. char classname[ DUMP_CLASSNAME_SIZE ];
  49. bool networked;
  50. char fieldstring[ DUMP_STRING_SIZE ];
  51. bool differs;
  52. bool withintolerance;
  53. bool noterrorchecked;
  54. class CDumpInfoLess
  55. {
  56. public:
  57. bool Less( const DumpInfo &src1, const DumpInfo &src2, void *pCtx )
  58. {
  59. int str = Q_stricmp( src1.classname, src2.classname );
  60. if ( str < 0 )
  61. return true;
  62. else if ( str > 0 )
  63. return false;
  64. return src1.index < src2.index;
  65. }
  66. };
  67. };
  68. CUtlSortVector< DumpInfo, DumpInfo::CDumpInfoLess > m_DumpEntityInfo;
  69. EHANDLE m_hDumpEntity;
  70. int m_nCurrentIndex;
  71. CPanelAnimationVar( vgui::HFont, m_FontSmall, "ItemFont", "DebugOverlay" );
  72. CPanelAnimationVar( vgui::HFont, m_FontMedium, "LabelFont", "DebugOverlay" );
  73. CPanelAnimationVar( vgui::HFont, m_FontBig, "TitleFont", "DebugOverlay" );
  74. };
  75. CPDumpPanel *GetPDumpPanel();
  76. #endif // HUD_PDUMP_H