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.

519 lines
19 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef ITEM_MODEL_PANEL_H
  8. #define ITEM_MODEL_PANEL_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <vgui_controls/Panel.h>
  13. #include <vgui_controls/Frame.h>
  14. #include <vgui_controls/Tooltip.h>
  15. #include "basemodel_panel.h"
  16. #include "basemodelpanel.h"
  17. #include "econ_controls.h"
  18. #define ITEM_MODEL_IMAGE_CACHE_SIZE 3
  19. #define ATTRIB_LABEL_INDENT XRES(5)
  20. class CEconItemView;
  21. class CItemModelPanel;
  22. class CItemMaterialCustomizationIconPanel;
  23. class CIconRenderReceiver;
  24. class CEmbeddedItemModelPanel;
  25. enum itempanel_tooltippos_t
  26. {
  27. IPTTP_LEFT,
  28. IPTTP_RIGHT,
  29. IPTTP_LEFT_CENTERED,
  30. IPTTP_RIGHT_CENTERED,
  31. IPTTP_ABOVE,
  32. IPTTP_BELOW,
  33. NUM_POSITIONS_PER_STRATEGY
  34. };
  35. enum itempanel_tooltip_strategies_t
  36. {
  37. IPTTP_LEFT_SIDE,
  38. IPTTP_RIGHT_SIDE,
  39. IPTTP_TOP_SIDE,
  40. IPTTP_BOTTOM_SIDE,
  41. NUM_IPTTP_STRATEGIES,
  42. };
  43. extern itempanel_tooltippos_t g_iTooltipStrategies[NUM_IPTTP_STRATEGIES][NUM_POSITIONS_PER_STRATEGY];
  44. struct item_model_cache_t
  45. {
  46. item_model_cache_t()
  47. {
  48. Clear();
  49. }
  50. void Clear()
  51. {
  52. iItemID = INVALID_ITEM_ID;
  53. iItemDefinitionIndex = INVALID_ITEM_DEF_INDEX;
  54. iWidth = 0;
  55. iHeight = 0;
  56. m_hModelPanelLock = NULL;
  57. }
  58. itemid_t iItemID;
  59. item_definition_index_t iItemDefinitionIndex;
  60. int iWidth;
  61. int iHeight;
  62. vgui::DHANDLE<CEmbeddedItemModelPanel> m_hModelPanelLock;
  63. };
  64. class CItemMaterialCustomizationIconPanel : public vgui::Panel
  65. {
  66. DECLARE_CLASS_SIMPLE( CItemMaterialCustomizationIconPanel, vgui::Panel );
  67. public:
  68. CItemMaterialCustomizationIconPanel( vgui::Panel *pParent, const char *pName );
  69. virtual ~CItemMaterialCustomizationIconPanel();
  70. // Custom painting
  71. virtual void PaintBackground( void );
  72. void DrawQuad( int iSubtileIndex, int iSubtileCount );
  73. int m_iPaintSplat;
  74. // UGC file of custom texture we are using. 0 in the more common case of none.
  75. uint64 m_hUGCId;
  76. // Paint color.
  77. CUtlVector<Color> m_colPaintColors;
  78. };
  79. //-----------------------------------------------------------------------------
  80. // Purpose: The model panel that's embedded inside the CItemModelPanel vgui panel
  81. //-----------------------------------------------------------------------------
  82. class CEmbeddedItemModelPanel : public CBaseModelPanel
  83. {
  84. DECLARE_CLASS_SIMPLE( CEmbeddedItemModelPanel, CBaseModelPanel );
  85. public:
  86. CEmbeddedItemModelPanel( vgui::Panel *pParent, const char *pName );
  87. virtual ~CEmbeddedItemModelPanel();
  88. virtual void PerformLayout( void ) OVERRIDE;
  89. virtual void Paint( void );
  90. virtual void RenderingRootModel( IMatRenderContext *pRenderContext, CStudioHdr *pStudioHdr, MDLHandle_t mdlHandle, matrix3x4_t *pWorldMatrix ) OVERRIDE;
  91. virtual IMaterial *GetOverrideMaterial( MDLHandle_t mdlHandle ) OVERRIDE;
  92. CEconItemView* GetItem() const { return m_pItem; }
  93. void SetItem( CEconItemView *pItem );
  94. bool IsForcingModelUsage( void ) { return m_bForceUseModel; }
  95. void SetForceModelUsage( bool bUseModel ) { m_bForceUseModel = bUseModel; }
  96. bool IsImageNotLoaded( void ) const;
  97. bool IsLoadingWeaponSkin( void ) const;
  98. enum InventoryImageType_t
  99. {
  100. IMAGETYPE_SMALL,
  101. IMAGETYPE_LARGE,
  102. IMAGETYPE_DETAILED, // show in detailed view if present -- defaults to "large" image if not
  103. };
  104. InventoryImageType_t GetInventoryImageType() const { return static_cast<InventoryImageType_t>( m_iInventoryImageType ); }
  105. void SetInventoryImageType( InventoryImageType_t eNewImageType ) { m_iInventoryImageType = (int)eNewImageType; }
  106. void LoadInventoryImage();
  107. void SetGreyedOut( bool bGreyedOut ) { m_bGreyedOut = bGreyedOut; }
  108. void SetModelHidden( bool bModelHidden ) { m_bModelIsHidden = bModelHidden; }
  109. ITexture *GetCachedGeneratedIcon();
  110. bool m_bOfflineIconGeneration;
  111. private:
  112. bool UseRenderTargetAsIcon() const { return m_bUseRenderTargetAsIcon || m_bUseItemRenderTarget; }
  113. CEconItemView *m_pItem; // For directly specifying the item associated with this panel.
  114. int m_iTextureID;
  115. CUtlMap<int, int> m_iOverlayTextureIDs;
  116. const char* m_pszToolTargetItemImage;
  117. int m_iToolTargetItemTextureID;
  118. Vector m_vecToolTargetItemImageOffset;
  119. bool m_bImageNotLoaded;
  120. bool m_bGreyedOut;
  121. bool m_bModelIsHidden;
  122. bool m_bUseRenderTargetAsIcon; // same as m_bUseItemRenderTarget but set by attribute instead of res file
  123. void CleanUpCachedWeaponIcon();
  124. bool m_bWeaponAllowInspect;
  125. int m_iCachedTextureID;
  126. CIconRenderReceiver *m_pCachedWeaponIcon;
  127. IMaterial *m_pCachedWeaponMaterial;
  128. MDLData_t m_ItemModel;
  129. int m_iPedestalAttachment;
  130. void UpdateCameraForIcon();
  131. int m_iCameraAttachment;
  132. bool RenderStatTrack( CStudioHdr *pStudioHdr, matrix3x4_t *pWorldMatrix );
  133. MDLData_t m_StatTrackModel;
  134. bool RenderAttachedModels( CStudioHdr *pStudioHdr, matrix3x4_t *pWorldMatrix );
  135. void LoadAttachedModel( attachedmodel_t *pModel );
  136. CUtlVector< MDLData_t > m_AttachedModels;
  137. float m_flStatTrackScale;
  138. CPanelAnimationVar( bool, m_bForceUseModel, "force_use_model", "0" );
  139. CPanelAnimationVar( bool, m_bUseItemRenderTarget, "use_item_rendertarget", "0" );
  140. CPanelAnimationVar( int, m_iInventoryImageType, "inventory_image_type", "0" );
  141. CPanelAnimationVar( bool, m_bForceSquareImage, "force_square_image", "0" );
  142. CPanelAnimationVar( float, m_flModelRotateYawSpeed, "model_rotate_yaw_speed", "0" );
  143. CPanelAnimationVar( bool, m_bUsePedestal, "use_pedestal", "0" );
  144. bool UpdateParticle(
  145. IMatRenderContext *pRenderContext,
  146. CStudioHdr *pStudioHdr,
  147. MDLHandle_t mdlHandle,
  148. matrix3x4_t *pWorldMatrix
  149. );
  150. particle_data_t *m_pItemParticle;
  151. #ifdef STAGING_ONLY
  152. double m_flStartUpdateTime;
  153. #endif // STAGING_ONLY
  154. };
  155. IMaterial* GetMaterialForImage( CEmbeddedItemModelPanel::InventoryImageType_t eImageType, const char* pszBaseName );
  156. //-----------------------------------------------------------------------------
  157. // Purpose:
  158. //-----------------------------------------------------------------------------
  159. class CItemModelPanel : public vgui::EditablePanel
  160. {
  161. DECLARE_CLASS_SIMPLE( CItemModelPanel, vgui::EditablePanel );
  162. public:
  163. CItemModelPanel( vgui::Panel *parent, const char *name );
  164. virtual ~CItemModelPanel( void );
  165. virtual void ApplySchemeSettings( vgui::IScheme *pScheme ) OVERRIDE;
  166. virtual void ApplySettings( KeyValues *inResourceData ) OVERRIDE;
  167. virtual void PerformLayout( void ) OVERRIDE;
  168. virtual void PaintTraverse( bool forceRepaint, bool allowForce ) OVERRIDE;
  169. virtual void OnSizeChanged( int newWide, int newTall );
  170. void ResizeLabels( void );
  171. virtual void SetItem( const CEconItemView *pItem );
  172. void SetEconItem( CEconItem* pItem );
  173. bool HasItem( void );
  174. CEconItemView *GetItem( void ) { return ( m_ItemData.IsValid() ? &m_ItemData : NULL ); }
  175. bool ModelIsHidden( void ) const { return m_bHideModel; }
  176. void SetModelIsHidden( bool bHideModel );
  177. virtual void OnTick() OVERRIDE;
  178. void SetNeedsToLoad();
  179. bool LoadData();
  180. void LoadDataCompleted();
  181. CExLabel *GetNameLabel( void ) { return m_pItemNameLabel; }
  182. // Functionality to allow custom blobs of text to be displayed
  183. void SetNoItemText( const char *pszText );
  184. void SetNoItemText( const wchar_t *pwszTitleOverride, const wchar_t *pwszAttribs = NULL, int iNegAttribsBegin = 0 );
  185. // Button functionality
  186. void SetActAsButton( bool bClickable, bool bMouseOver );
  187. virtual void NavigateTo();
  188. virtual void NavigateFrom();
  189. virtual void OnCursorEntered();
  190. virtual void OnCursorExited();
  191. virtual void OnMousePressed(vgui::MouseCode code);
  192. virtual void OnMouseDoublePressed(vgui::MouseCode code);
  193. virtual void OnMouseReleased(vgui::MouseCode code);
  194. virtual void OnKeyCodePressed( vgui::KeyCode code );
  195. MESSAGE_FUNC_INT_INT( OnCursorMoved, "OnCursorMoved", x, y );
  196. void SetSelected( bool bSelected ) { m_bSelected = bSelected; }
  197. bool IsSelected( void ) { return m_bSelected; }
  198. void SetAttribOnly( bool bAttribs ) { m_bAttribOnly = bAttribs; }
  199. void SetTextYPos( int iPos ) { m_iTextYPos = iPos; }
  200. bool IsEquipped( void );
  201. void SetShowEquipped( bool bShow ) { m_bShowEquipped = bShow; UpdateEquippedLabel(); }
  202. void SetForceShowEquipped( bool bForce ) { m_bForceShowEquipped = bForce; UpdateEquippedLabel(); }
  203. void SetGreyedOut( const char *pszGreyedOutReason ); // pass in NULL for "not greyed out"
  204. void SetShowGreyedOutTooltip( bool bShow ) { m_bShowGreyedOutTooltip = bShow; }
  205. bool IsGreyedOut( void ) const { return m_pszGreyedOutReason != NULL; }
  206. const char *GetGreyedOutReason( void ) const { return m_pszGreyedOutReason; }
  207. bool ShouldShowTooltip( void ) { return (!IsGreyedOut() || m_bShowGreyedOutTooltip); }
  208. void SetShowQuantity( bool bShow ) { m_bShowQuantity = bShow; }
  209. void UpdatePanels( void );
  210. void SendPanelEnterExits( bool bSend ) { m_bShouldSendPanelEnterExits = bSend; }
  211. void SetShouldShowOthersGiftWrappedItems( bool bShow ) { m_bShowOthersGiftWrappedItems = bShow; }
  212. void Dragged( bool bDragging );
  213. void HideContainedItemPanel();
  214. void ShowContainedItemPanel( const CEconItemView *pItem );
  215. bool IsContainedItem() { return m_bContainedItem; }
  216. void SetContainedItem( bool bVal ) { m_bContainedItem = bVal; }
  217. void SetSkin( int iSkin );
  218. void SetItemStyle( style_index_t unStyle ) { m_ItemData.SetItemStyleOverride( unStyle ); }
  219. void SetNameOnly( bool bNameOnly ) { m_bNameOnly = bNameOnly; }
  220. void SetSpecialAttributesOnly( bool bSpecialOnly ) { m_bSpecialAttributesOnly = bSpecialOnly; }
  221. CEmbeddedItemModelPanel::InventoryImageType_t GetInventoryImageType() /*const*/ { return m_pModelPanel->GetInventoryImageType(); }
  222. void SetInventoryImageType( CEmbeddedItemModelPanel::InventoryImageType_t eNewImageType ) { m_pModelPanel->SetInventoryImageType( eNewImageType ); }
  223. void UpdateDescription();
  224. void DirtyDescription();
  225. virtual void OnCommand( const char *command ) OVERRIDE;
  226. void MakeFakeButton() { m_bFakeButton = true; }
  227. private:
  228. void UpdateEquippedLabel( void );
  229. void CleanupNoItemWChars( void );
  230. bool UpdateSeriesLabel();
  231. bool UpdateMatchesLabel();
  232. bool UpdateQuantityLabel();
  233. bool CheckRecipeMatches();
  234. int GetAttribWide( int iMaxWide ) { return (m_iTextWide ? m_iTextWide : (iMaxWide - (ATTRIB_LABEL_INDENT * 2))); }
  235. void LoadResFileForCurrentItem( bool bForceLoad );
  236. void HideAllModifierIcons();
  237. enum eLoadingType_t
  238. {
  239. LOADING_ICONS = 0,
  240. LOADING_DESCRIPTIONS,
  241. LOADING_RECIPE_MATCHES,
  242. NUM_LOADING_TYPES
  243. };
  244. enum eLoadedCollectionType_t
  245. {
  246. LOADED_COLLECTION_NONE,
  247. LOADED_COLLECTION_WEAPON,
  248. LOADED_COLLECTION_COSMETIC
  249. };
  250. vgui::DHANDLE<CEmbeddedItemModelPanel> m_pModelPanel;
  251. CExLabel *m_pItemNameLabel;
  252. vgui::Label *m_pItemAttribLabel;
  253. CExLabel *m_pItemCollectionNameLabel;
  254. vgui::Label *m_pItemCollectionListLabel;
  255. vgui::EditablePanel *m_pItemCollectionHighlight;
  256. eLoadedCollectionType_t m_nCollectionItemLoaded;
  257. vgui::Label *m_pItemEquippedLabel;
  258. vgui::Label *m_pItemQuantityLabel;
  259. vgui::ImagePanel *m_pVisionRestrictionImage;
  260. vgui::ImagePanel *m_pIsStrangeImage;
  261. vgui::ImagePanel *m_pIsUnusualImage;
  262. vgui::ImagePanel *m_pIsLoanerImage;
  263. vgui::Label *m_pSeriesLabel;
  264. vgui::Label *m_pMatchesLabel;
  265. vgui::EditablePanel *m_pMainContentContainer;
  266. vgui::ImagePanel *m_pLoadingSpinner;
  267. CEconItemView m_ItemData;
  268. vgui::HFont m_pFontNameSmallest;
  269. vgui::HFont m_pFontNameSmall;
  270. vgui::HFont m_pFontNameLarge;
  271. vgui::HFont m_pFontNameLarger;
  272. vgui::HFont m_pFontAttribSmallest;
  273. vgui::HFont m_pFontAttribSmall;
  274. vgui::HFont m_pFontAttribLarge;
  275. vgui::HFont m_pFontAttribLarger;
  276. const char *m_pszNoItemText;
  277. const wchar_t *m_pwcNoItemText;
  278. const wchar_t *m_pwcNoItemAttrib;
  279. Color m_NoItemTextColor;
  280. Color m_OrgItemTextColor;
  281. bool m_bClickable;
  282. bool m_bMouseOver;
  283. bool m_bSelected;
  284. bool m_bShowEquipped;
  285. bool m_bForceShowEquipped;
  286. const char *m_pszGreyedOutReason;
  287. bool m_bShowGreyedOutTooltip;
  288. bool m_bShouldSendPanelEnterExits;
  289. bool m_bShowQuantity;
  290. bool m_bContainedItem;
  291. bool m_bShowOthersGiftWrappedItems;
  292. bool m_bDescriptionDirty;
  293. int m_nRecipeMatchingIndex;
  294. static float sm_flLoadingTimeThisFrame;
  295. static int sm_nCurrentDecriptionUpdateFrame;
  296. static int sai_NumLoadingRequests[NUM_LOADING_TYPES];
  297. static eLoadingType_t se_CurrentLoadingTask;
  298. CUtlMap< attrib_definition_index_t, int > m_mapMatchingAttributes;
  299. CItemMaterialCustomizationIconPanel *m_pPaintIcon;
  300. vgui::ScalableImagePanel *m_pTF2Icon;
  301. CItemModelPanel *m_pContainedItemPanel;
  302. CPanelAnimationVar( bool, m_bSpecialAttributesOnly, "special_attributes_only", "0" );
  303. CPanelAnimationVarAliasType( int, m_iModelXPos, "model_xpos", "0", "proportional_int" );
  304. CPanelAnimationVarAliasType( int, m_iModelYPos, "model_ypos", "0", "proportional_int" );
  305. CPanelAnimationVarAliasType( int, m_iModelWide, "model_wide", "0", "proportional_int" );
  306. CPanelAnimationVarAliasType( int, m_iModelTall, "model_tall", "0", "proportional_int" );
  307. CPanelAnimationVar( bool, m_bModelCenterX, "model_center_x", "0" );
  308. CPanelAnimationVar( bool, m_bModelCenterY, "model_center_y", "0" );
  309. CPanelAnimationVarAliasType( int, m_iTF2IconOffsetX, "tf2_icon_offset_x", "0", "proportional_int" );
  310. CPanelAnimationVarAliasType( int, m_iTF2IconOffsetY, "tf2_icon_offset_y", "0", "proportional_int" );
  311. CPanelAnimationVar( bool, m_bNoItemFullPanel, "noitem_use_fullpanel", "0" );
  312. CPanelAnimationVar( bool, m_bTextCenter, "text_center", "0" );
  313. CPanelAnimationVar( bool, m_bTextCenterX, "text_center_x", "0" );
  314. CPanelAnimationVar( bool, m_bUseItemSounds, "use_item_sounds", "0" );
  315. CPanelAnimationVar( bool, m_bNameOnly, "name_only", "0" );
  316. CPanelAnimationVar( bool, m_bAttribOnly, "attrib_only", "0" );
  317. CPanelAnimationVar( bool, m_bModelOnly, "model_only", "0" );
  318. CPanelAnimationVar( bool, m_bHideModelDefault, "model_hide", "0" );
  319. bool m_bHideModel;
  320. CPanelAnimationVar( bool, m_bHidePaintIcon, "paint_icon_hide", "0" );
  321. CPanelAnimationVar( bool, m_bResizeToText, "resize_to_text", "0" );
  322. CPanelAnimationVar( int, m_iNameLabelAlignment, "name_label_alignment", "4" /*a_center*/ );
  323. CPanelAnimationVarAliasType( int, m_iTextXPos, "text_xpos", "0", "proportional_int" );
  324. CPanelAnimationVarAliasType( int, m_iTextYPos, "text_ypos", "0", "proportional_int" );
  325. CPanelAnimationVarAliasType( int, m_iTextWide, "text_wide", "0", "proportional_int" );
  326. CPanelAnimationVarAliasType( int, m_iTextYOffset, "text_yoffset", "0", "proportional_int" );
  327. CPanelAnimationVarAliasType( int, m_iHPadding, "padding_height", "0", "proportional_int" );
  328. CPanelAnimationVarAliasType( int, m_iMaxTextHeight, "max_text_height", "0", "proportional_int" );
  329. CPanelAnimationVar( int, m_iForceTextSize, "text_forcesize", "0" );
  330. CPanelAnimationVarAliasType( int, m_iEquippedInsetX, "inset_eq_x", "0", "proportional_int" );
  331. CPanelAnimationVarAliasType( int, m_iEquippedInsetY, "inset_eq_y", "0", "proportional_int" );
  332. CPanelAnimationVar( bool, m_bStandardTextColor, "standard_text_color", "0" );
  333. CPanelAnimationVar( bool, m_bIsMouseOverPanel, "is_mouseover", "0" );
  334. CPanelAnimationVarAliasType( int, m_iBaseWide, "wide", "0", "proportional_int" );
  335. CPanelAnimationVarAliasType( int, m_iBaseTall, "tall", "0", "proportional_int" );
  336. CPanelAnimationVarAliasType( int, m_iCollectionListXPos, "collection_list_xpos", "0", "proportional_int" );
  337. CPanelAnimationVarAliasType( int, m_iTextXPosCollection, "text_xpos_collection", "0", "proportional_int" );
  338. CPanelAnimationVar( bool, m_bHideCollectionPanel, "hide_collection_panel", "0" );
  339. CPanelAnimationVar( bool, m_bHideModifierIcons, "hide_modifier_icons", "0" );
  340. bool m_bFakeButton;
  341. };
  342. //-----------------------------------------------------------------------------
  343. // Purpose: Item model panel tooltip. Calls setvisible on the controlled panel
  344. // and positions it below/above the current panel.
  345. //-----------------------------------------------------------------------------
  346. class CItemModelPanelToolTip : public vgui::BaseTooltip
  347. {
  348. DECLARE_CLASS_SIMPLE( CItemModelPanelToolTip, vgui::BaseTooltip );
  349. public:
  350. CItemModelPanelToolTip(vgui::Panel *parent, const char *text = NULL);
  351. void SetText(const char *text) { return; }
  352. const char *GetText() { return NULL; }
  353. virtual void PerformLayout();
  354. virtual void ShowTooltip( vgui::Panel *currentPanel );
  355. virtual void HideTooltip();
  356. void SetupPanels( vgui::Panel *pParentPanel, CItemModelPanel *pMouseOverItemPanel ) { m_pParentPanel = pParentPanel; m_pMouseOverItemPanel = pMouseOverItemPanel; }
  357. void SetPositioningStrategy( itempanel_tooltip_strategies_t iStrat ) { m_iPositioningStrategy = iStrat; }
  358. private:
  359. void GetPosition( itempanel_tooltippos_t iTooltipPosition, CItemModelPanel *pItemPanel, int iItemX, int iItemY, int *iXPos, int *iYPos );
  360. bool ValidatePosition( CItemModelPanel *pItemPanel, int iItemX, int iItemY, int *iXPos, int *iYPos );
  361. private:
  362. CItemModelPanel *m_pMouseOverItemPanel; // This is the tooltip panel we make visible. Must be a CItemModelPanel.
  363. vgui::Panel *m_pParentPanel; // This is the panel that we send item entered/exited messages to
  364. vgui::DHANDLE<CItemModelPanel> m_hCurrentPanel;
  365. itempanel_tooltip_strategies_t m_iPositioningStrategy;
  366. bool m_bHorizontalPreferLeft;
  367. };
  368. //-----------------------------------------------------------------------------
  369. // Purpose: Generate a list of items that can be equipped for a given set of
  370. // restrictions (class/slot/region/etc.) and other data (count of dupes, etc.).
  371. // Used for crafting, loadout selection, quickswitch, and elsewhere.
  372. //-----------------------------------------------------------------------------
  373. class CEquippableItemsForSlotGenerator
  374. {
  375. public:
  376. // Flags that control how the data is generated.
  377. enum
  378. {
  379. kSlotGenerator_None = 0x00,
  380. kSlotGenerator_ShowDuplicates = 0x01,
  381. kSlotGenerator_EquippedSpecialHandling = 0x02,
  382. };
  383. enum EItemDisplayType
  384. {
  385. kSlotDisplay_Normal,
  386. kSlotDisplay_Disabled_EquipRegionConflict,
  387. kSlotDisplay_Invalid, // just used to tag unitialized instances
  388. };
  389. struct CEquippableResult
  390. {
  391. CEquippableResult()
  392. : m_pEconItemView( NULL )
  393. , m_eDisplayType( kSlotDisplay_Invalid )
  394. {
  395. //
  396. }
  397. CEquippableResult( CEconItemView *pEconItemView, EItemDisplayType eDisplayType = kSlotDisplay_Normal )
  398. : m_pEconItemView( pEconItemView )
  399. , m_eDisplayType( eDisplayType )
  400. {
  401. //
  402. }
  403. // This only exists to support Find() and ignores display state.
  404. bool operator==( const CEquippableResult& other ) const
  405. {
  406. return m_pEconItemView == other.m_pEconItemView;
  407. }
  408. CEconItemView *m_pEconItemView;
  409. EItemDisplayType m_eDisplayType;
  410. };
  411. typedef CUtlMap<struct item_stack_type_t, int> DuplicateCountMap_t;
  412. typedef CUtlVector<CEquippableResult> EquippableResultsVec_t;
  413. CEquippableItemsForSlotGenerator( int iClass, int iSlot, equip_region_mask_t unUsedEquipRegionMask, unsigned int unFlags );
  414. const EquippableResultsVec_t& GetDisplayItems() const { return m_vecDisplayItems; }
  415. CEconItemView *GetEquippedItem() const { return m_pEquippedItemView; }
  416. const DuplicateCountMap_t& GetDuplicateCountMap() const { return m_DuplicateCountsMap; }
  417. private:
  418. EquippableResultsVec_t m_vecDisplayItems;
  419. DuplicateCountMap_t m_DuplicateCountsMap;
  420. CEconItemView *m_pEquippedItemView; // if kSlotGenerator_EquippedSpecialHandling is passed in, this will store our equipped item; otherwise NULL
  421. };
  422. #endif // ITEM_MODEL_PANEL_H