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.

169 lines
5.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //=======================================================================================//
  4. #ifndef TF_HUD_SAXXYCONTEST_H
  5. #define TF_HUD_SAXXYCONTEST_H
  6. #ifdef _WIN32
  7. #pragma once
  8. #endif
  9. #include <vgui_controls/EditablePanel.h>
  10. #include "game_controls/basemodel_panel.h"
  11. using namespace vgui;
  12. class KeyValues;
  13. class CExButton;
  14. //-----------------------------------------------------------------------------
  15. // Purpose:
  16. //-----------------------------------------------------------------------------
  17. class CSaxxyAwardsPanel : public vgui::EditablePanel
  18. {
  19. DECLARE_CLASS_SIMPLE( CSaxxyAwardsPanel, vgui::EditablePanel );
  20. public:
  21. CSaxxyAwardsPanel( Panel *pParent, const char *pName );
  22. ~CSaxxyAwardsPanel();
  23. virtual void ApplySettings( KeyValues *pInResourceData );
  24. void Refresh();
  25. private:
  26. virtual void ApplySchemeSettings( IScheme *pScheme );
  27. virtual void PerformLayout();
  28. virtual void OnCommand( const char *pCommand );
  29. virtual void PaintBackground();
  30. struct FlashInfo_t
  31. {
  32. int m_nCenterX;
  33. int m_nCenterY;
  34. int m_nCurW;
  35. int m_nCurH;
  36. int m_nMinSize;
  37. int m_nMaxSize;
  38. float m_flStartTime;
  39. float m_flLifeLength;
  40. ImagePanel *m_pPanel;
  41. bool m_bInUse;
  42. };
  43. void Init();
  44. void OnTick();
  45. void UpdateMousePos( float flElapsed );
  46. void RotateModel( float flElapsed );
  47. void CurtainsThink();
  48. void FlashThink( bool bOtherPanelsOpen );
  49. void SpotlightThink();
  50. void ClapsThink( float flCurTime, float flElapsed, bool bOtherPanelsOpen );
  51. void SetupContestPanels();
  52. bool CreateFlash();
  53. void PlaceFlash( FlashInfo_t *pFlashInfo );
  54. void ClearFlash( FlashInfo_t *pFlashInfo );
  55. void ClearFlashes();
  56. void PlaySomeClaps();
  57. void SetNextPossibleClapTime( float *pClapTime );
  58. int GetActiveFlashCount() const;
  59. int GetUnusedFlashCount() const;
  60. int GetUnusedFlashSlot() const;
  61. float GetCurrentTime() const;
  62. bool InInitialFreakoutPeriod() const;
  63. bool InFreakoutMode() const;
  64. bool CurtainsClosed() const;
  65. bool FlashingStartTimePassed() const;
  66. bool AreOtherPanelsOpen( float flCurTime );
  67. bool AreNonMainMenuPanelsOpen( VPANEL vRoot, const char **pCarePanels, int nNumCarePanels );
  68. VPANEL GetDialogsParent();
  69. enum Consts_t
  70. {
  71. MAX_FLASHES = 3,
  72. MAX_GLOWS = 2,
  73. MAX_CLAPS = 2,
  74. };
  75. CBaseModelPanel *m_pSaxxyModelPanel;
  76. Vector m_vSaxxyDefaultPos;
  77. CExButton *m_pSubmitButton;
  78. Panel *m_pInfoLabel;
  79. Panel *m_pContestOverLabel;
  80. EditablePanel *m_pBackgroundPanel;
  81. ImagePanel *m_pStageBgPanel;
  82. EditablePanel *m_pCurtainPanel; // Main container panel
  83. ImagePanel *m_pSpotlightPanel;
  84. float m_aClapPlayTimes[MAX_CLAPS];
  85. float m_flShowTime;
  86. float m_flNextPanelTestTime;
  87. VPANEL m_vDialogsParent;
  88. struct CurtainInfo_t
  89. {
  90. CurtainInfo_t() : m_pPanel( NULL ) {}
  91. ImagePanel *m_pPanel;
  92. int m_aInitialPos[2];
  93. };
  94. CurtainInfo_t m_Curtains[2]; // [0] = left, [1] = right
  95. float m_flCurtainStartAnimTime;
  96. KeyValues *m_pCameraFlashKv;
  97. QAngle m_angModelRot;
  98. FlashInfo_t m_aFlashes[ MAX_FLASHES ];
  99. int m_nNumTargetFlashes;
  100. float m_aFilteredMousePos[2][2]; // [0][0] and [0][1] is current mouse pos (x,y). [1][0] and [1][1] are target (x,y).
  101. float m_flLastTickTime;
  102. float m_flEarliestNextFlashTime;
  103. float m_flGlowFade;
  104. static int sm_nShowCounter; // Will be 0 when the game first loads, and nonzero otherwise
  105. CPanelAnimationVarAliasType( int, m_nFlashBoundsX, "flashbounds_x", "0", "proportional_xpos" );
  106. CPanelAnimationVarAliasType( int, m_nFlashBoundsY, "flashbounds_y", "0", "proportional_ypos" );
  107. CPanelAnimationVarAliasType( int, m_nFlashBoundsW, "flashbounds_w", "0", "proportional_xpos" );
  108. CPanelAnimationVarAliasType( int, m_nFlashBoundsH, "flashbounds_h", "0", "proportional_ypos" );
  109. CPanelAnimationVarAliasType( int, m_nFlashStartSizeMin, "flashstartsize_min", "0", "proportional_xpos" );
  110. CPanelAnimationVarAliasType( int, m_nFlashStartSizeMax, "flashstartsize_max", "0", "proportional_xpos" );
  111. CPanelAnimationVar( float, m_flFlashMaxScale, "flash_maxscale", "0.0f" );
  112. CPanelAnimationVar( float, m_flFlashLifeLengthMin, "flash_lifelength_min", "0.0f" );
  113. CPanelAnimationVar( float, m_flFlashLifeLengthMax, "flash_lifelength_max", "0.0f" );
  114. CPanelAnimationVar( float, m_flCurtainAnimDuration, "curtain_anim_duration", "0.0f" );
  115. CPanelAnimationVar( float, m_flOpenCurtainsTime, "curtain_open_time", "0.0f" );
  116. CPanelAnimationVar( float, m_flInitialFreakoutDuration, "initial_freakout_duration", "0.0f" );
  117. CPanelAnimationVar( float, m_flFlashStartTime, "flash_start_time", "0.0f" );
  118. CPanelAnimationVar( float, m_flClapSoundDuration, "clap_sound_duration", "0.0f" );
  119. };
  120. //-----------------------------------------------------------------------------
  121. // Purpose:
  122. //-----------------------------------------------------------------------------
  123. class CSaxxyAwardsSubmitForm : public vgui::EditablePanel
  124. {
  125. DECLARE_CLASS_SIMPLE( CSaxxyAwardsSubmitForm, vgui::EditablePanel );
  126. public:
  127. CSaxxyAwardsSubmitForm( Panel *pParent );
  128. private:
  129. virtual void ApplySchemeSettings( IScheme *pScheme );
  130. virtual void PerformLayout();
  131. virtual void OnCommand( const char *pCommand );
  132. virtual void OnKeyCodeTyped( vgui::KeyCode nCode );
  133. void Close();
  134. vgui::TextEntry *m_pURLInput;
  135. vgui::ComboBox *m_pCategoryCombo;
  136. };
  137. #endif //TF_HUD_SAXXYCONTEST_H