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.

99 lines
2.8 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Item pickup history displayed onscreen when items are picked up.
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef HISTORY_RESOURCE_H
  8. #define HISTORY_RESOURCE_H
  9. #pragma once
  10. #include "hudelement.h"
  11. #include "ehandle.h"
  12. #include <vgui_controls/Panel.h>
  13. enum
  14. {
  15. HISTSLOT_EMPTY,
  16. HISTSLOT_AMMO,
  17. HISTSLOT_WEAP,
  18. HISTSLOT_ITEM,
  19. HISTSLOT_AMMODENIED,
  20. };
  21. namespace vgui
  22. {
  23. class IScheme;
  24. }
  25. class C_BaseCombatWeapon;
  26. //-----------------------------------------------------------------------------
  27. // Purpose: Used to draw the history of ammo / weapon / item pickups by the player
  28. //-----------------------------------------------------------------------------
  29. class CHudHistoryResource : public CHudElement, public vgui::Panel
  30. {
  31. DECLARE_CLASS_SIMPLE( CHudHistoryResource, vgui::Panel );
  32. private:
  33. struct HIST_ITEM
  34. {
  35. HIST_ITEM()
  36. {
  37. // init this here, because the code that overwrites previous history items will use this
  38. // to check to see if the item is empty
  39. DisplayTime = 0.0f;
  40. }
  41. int type;
  42. float DisplayTime; // the time at which this item should be removed from the history
  43. int iCount;
  44. int iId;
  45. CHandle< C_BaseCombatWeapon > m_hWeapon;
  46. CHudTexture *icon;
  47. };
  48. CUtlVector<HIST_ITEM> m_PickupHistory;
  49. public:
  50. explicit CHudHistoryResource( const char *pElementName );
  51. // CHudElement overrides
  52. virtual void Init( void );
  53. virtual void Reset( void );
  54. virtual bool ShouldDraw( void );
  55. virtual void Paint( void );
  56. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  57. void AddToHistory( int iType, int iId, int iCount = 0 );
  58. void AddToHistory( int iType, const char *szName, int iCount = 0 );
  59. void AddToHistory( C_BaseCombatWeapon *weapon );
  60. bool MsgFunc_ItemPickup( const CCSUsrMsg_ItemPickup &msg );
  61. bool MsgFunc_AmmoDenied( const CCSUsrMsg_AmmoDenied &msg );
  62. CUserMessageBinder m_UMCMsgItemPickup;
  63. CUserMessageBinder m_UMCMsgAmmoDenied;
  64. void CheckClearHistory( void );
  65. void SetHistoryGap( int iNewHistoryGap );
  66. void AddIconToHistory( int iType, int iId, C_BaseCombatWeapon *weapon, int iCount, CHudTexture *icon );
  67. private:
  68. // these vars are for hl1-port compatibility
  69. int m_iHistoryGap;
  70. int m_iCurrentHistorySlot;
  71. bool m_bDoNotDraw;
  72. wchar_t m_wcsAmmoFullMsg[16];
  73. bool m_bNeedsDraw;
  74. CPanelAnimationVarAliasType( float, m_flHistoryGap, "history_gap", "42", "proportional_float" );
  75. CPanelAnimationVarAliasType( float, m_flIconInset, "icon_inset", "28", "proportional_float" );
  76. CPanelAnimationVarAliasType( float, m_flTextInset, "text_inset", "26", "proportional_float" );
  77. CPanelAnimationVar( vgui::HFont, m_hNumberFont, "NumberFont", "HudNumbersSmall" );
  78. CPanelAnimationVar( vgui::HFont, m_hTextFont, "TextFont", "Default" );
  79. };
  80. #endif // HISTORY_RESOURCE_H