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.

153 lines
4.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef TF_HUD_FREEZEPANEL_H
  7. #define TF_HUD_FREEZEPANEL_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include <vgui_controls/EditablePanel.h>
  12. #include <game/client/iviewport.h>
  13. #include <vgui/IScheme.h>
  14. #include "hud.h"
  15. #include "hudelement.h"
  16. #include "tf_imagepanel.h"
  17. #include "tf_hud_playerstatus.h"
  18. #include "vgui_avatarimage.h"
  19. #include "item_model_panel.h"
  20. using namespace vgui;
  21. bool IsTakingAFreezecamScreenshot( void );
  22. //-----------------------------------------------------------------------------
  23. // Purpose: Custom health panel used in the freeze panel to show killer's health
  24. //-----------------------------------------------------------------------------
  25. class CTFFreezePanelHealth : public CTFHudPlayerHealth
  26. {
  27. public:
  28. CTFFreezePanelHealth( Panel *parent, const char *name ) : CTFHudPlayerHealth( parent, name )
  29. {
  30. }
  31. virtual const char *GetResFilename( void ) OVERRIDE { return "resource/UI/FreezePanelKillerHealth.res"; }
  32. virtual void OnThink()
  33. {
  34. // Do nothing. We're just preventing the base health panel from updating.
  35. }
  36. };
  37. //-----------------------------------------------------------------------------
  38. // Purpose:
  39. //-----------------------------------------------------------------------------
  40. class CTFFreezePanelCallout : public EditablePanel
  41. {
  42. DECLARE_CLASS_SIMPLE( CTFFreezePanelCallout, EditablePanel );
  43. public:
  44. CTFFreezePanelCallout( Panel *parent, const char *name );
  45. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  46. void UpdateForGib( int iGib, int iCount );
  47. void UpdateForRagdoll( void );
  48. private:
  49. vgui::Label *m_pGibLabel;
  50. };
  51. //-----------------------------------------------------------------------------
  52. // Purpose:
  53. //-----------------------------------------------------------------------------
  54. class CReplayReminderPanel;
  55. class CTFFreezePanel : public EditablePanel, public CHudElement
  56. {
  57. private:
  58. DECLARE_CLASS_SIMPLE( CTFFreezePanel, EditablePanel );
  59. public:
  60. CTFFreezePanel( const char *pElementName );
  61. static CTFFreezePanel *Instance();
  62. virtual void Reset();
  63. virtual void Init();
  64. virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
  65. virtual void FireGameEvent( IGameEvent * event );
  66. const char *GetResFilename( C_TFPlayer *pTFPlayer = NULL ) const;
  67. void ShowSnapshotPanel( bool bShow );
  68. void ShowSaveReplayPanel( bool bShow );
  69. void UpdateCallout( void );
  70. void ShowCalloutsIn( float flTime );
  71. void ShowSnapshotPanelIn( float flTime );
  72. void ShowSaveReplayPanelIn( float flTime );
  73. void Show();
  74. void Hide();
  75. virtual bool ShouldDraw( void );
  76. void OnThink( void );
  77. int HudElementKeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBinding );
  78. bool IsHoldingAfterScreenShot( void ) { return m_bHoldingAfterScreenshot; }
  79. void SendTauntAcknowledgement( const char *pszCommand, int iGibs = 0 );
  80. protected:
  81. CTFFreezePanelCallout *TestAndAddCallout( Vector &origin, Vector &vMins, Vector &vMaxs, CUtlVector<Vector> *vecCalloutsTL,
  82. CUtlVector<Vector> *vecCalloutsBR, Vector &vecFreezeTL, Vector &vecFreezeBR, Vector &vecStatTL, Vector &vecStatBR, int *iX, int *iY );
  83. private:
  84. static CTFFreezePanel *s_pFreezePanel;
  85. void DeleteCalloutPanels();
  86. void ShowNemesisPanel( bool bShow );
  87. const char *GetFilesafePlayerName( const char *pszOldName );
  88. CPanelAnimationVar( bool, m_bShouldScreenshotMovePanelToCorner, "screenshot_move_panel_to_corner", "1" );
  89. int m_iYBase;
  90. int m_iKillerIndex;
  91. CTFHudPlayerHealth *m_pKillerHealth;
  92. int m_iShowNemesisPanel;
  93. CUtlVector<CTFFreezePanelCallout*> m_pCalloutPanels;
  94. float m_flShowCalloutsAt;
  95. float m_flShowSnapshotReminderAt;
  96. float m_flShowReplayReminderAt;
  97. EditablePanel *m_pNemesisSubPanel;
  98. vgui::Label *m_pFreezeLabel;
  99. CTFImagePanel *m_pFreezePanelBG;
  100. CTFImagePanel *m_pFreezeTeamIcon;
  101. CAvatarImagePanel *m_pAvatar;
  102. vgui::Label *m_pKillerLabel;
  103. vgui::EditablePanel *m_pScreenshotPanel;
  104. #if defined( REPLAY_ENABLED )
  105. CReplayReminderPanel *m_pSaveReplayPanel;
  106. #endif
  107. vgui::EditablePanel *m_pBasePanel;
  108. CItemModelPanel *m_pItemPanel;
  109. int m_iBasePanelOriginalX;
  110. int m_iBasePanelOriginalY;
  111. int m_iItemPanelOriginalX;
  112. int m_iItemPanelOriginalY;
  113. int m_iKillerOriginalX;
  114. int m_iKillerOriginalY;
  115. bool m_bHoldingAfterScreenshot;
  116. enum
  117. {
  118. SHOW_NO_NEMESIS = 0,
  119. SHOW_NEW_NEMESIS,
  120. SHOW_REVENGE
  121. };
  122. CUtlString m_strCurrentFreezeCamResFile;
  123. };
  124. #endif // TF_HUD_FREEZEPANEL_H