summaryrefslogtreecommitdiff
path: root/game/client/history_resource.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/client/history_resource.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/client/history_resource.h')
-rw-r--r--game/client/history_resource.h96
1 files changed, 96 insertions, 0 deletions
diff --git a/game/client/history_resource.h b/game/client/history_resource.h
new file mode 100644
index 0000000..962b168
--- /dev/null
+++ b/game/client/history_resource.h
@@ -0,0 +1,96 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: Item pickup history displayed onscreen when items are picked up.
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef HISTORY_RESOURCE_H
+#define HISTORY_RESOURCE_H
+#pragma once
+
+#include "hudelement.h"
+#include "ehandle.h"
+
+#include <vgui_controls/Panel.h>
+
+enum
+{
+ HISTSLOT_EMPTY,
+ HISTSLOT_AMMO,
+ HISTSLOT_WEAP,
+ HISTSLOT_ITEM,
+ HISTSLOT_AMMODENIED,
+};
+
+namespace vgui
+{
+ class IScheme;
+}
+
+class C_BaseCombatWeapon;
+
+//-----------------------------------------------------------------------------
+// Purpose: Used to draw the history of ammo / weapon / item pickups by the player
+//-----------------------------------------------------------------------------
+class CHudHistoryResource : public CHudElement, public vgui::Panel
+{
+ DECLARE_CLASS_SIMPLE( CHudHistoryResource, vgui::Panel );
+private:
+ struct HIST_ITEM
+ {
+ HIST_ITEM()
+ {
+ // init this here, because the code that overwrites previous history items will use this
+ // to check to see if the item is empty
+ DisplayTime = 0.0f;
+ }
+ int type;
+ float DisplayTime; // the time at which this item should be removed from the history
+ int iCount;
+ int iId;
+ CHandle< C_BaseCombatWeapon > m_hWeapon;
+
+ CHudTexture *icon;
+ };
+
+ CUtlVector<HIST_ITEM> m_PickupHistory;
+
+public:
+
+ CHudHistoryResource( const char *pElementName );
+
+ // CHudElement overrides
+ virtual void Init( void );
+ virtual void Reset( void );
+ virtual bool ShouldDraw( void );
+ virtual void Paint( void );
+
+ virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
+
+ void AddToHistory( int iType, int iId, int iCount = 0 );
+ void AddToHistory( int iType, const char *szName, int iCount = 0 );
+ void AddToHistory( C_BaseCombatWeapon *weapon );
+ void MsgFunc_ItemPickup( bf_read &msg );
+ void MsgFunc_AmmoDenied( bf_read &msg );
+
+ void CheckClearHistory( void );
+ void SetHistoryGap( int iNewHistoryGap );
+ void AddIconToHistory( int iType, int iId, C_BaseCombatWeapon *weapon, int iCount, CHudTexture *icon );
+
+private:
+ // these vars are for hl1-port compatibility
+ int m_iHistoryGap;
+ int m_iCurrentHistorySlot;
+ bool m_bDoNotDraw;
+ wchar_t m_wcsAmmoFullMsg[16];
+ bool m_bNeedsDraw;
+
+ CPanelAnimationVarAliasType( float, m_flHistoryGap, "history_gap", "42", "proportional_float" );
+ CPanelAnimationVarAliasType( float, m_flIconInset, "icon_inset", "28", "proportional_float" );
+ CPanelAnimationVarAliasType( float, m_flTextInset, "text_inset", "26", "proportional_float" );
+ CPanelAnimationVar( vgui::HFont, m_hNumberFont, "NumberFont", "HudNumbersSmall" );
+ CPanelAnimationVar( vgui::HFont, m_hTextFont, "TextFont", "Default" );
+};
+
+#endif // HISTORY_RESOURCE_H