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.

161 lines
4.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef TF_CLIENTMODE_H
  7. #define TF_CLIENTMODE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "clientmode_shared.h"
  12. #include "tf_viewport.h"
  13. #include "GameUI/IGameUI.h"
  14. #include "halloween/tf_weapon_spellbook.h"
  15. #include "tf_hud_teamgoal_tournament.h"
  16. class CHudMenuEngyBuild;
  17. class CHudMenuEngyDestroy;
  18. class CHudMenuSpyDisguise;
  19. class CTFFreezePanel;
  20. class CItemQuickSwitchPanel;
  21. class CHudEurekaEffectTeleportMenu;
  22. class CHudMenuTauntSelection;
  23. class CHudInspectPanel;
  24. class CHudUpgradePanel;
  25. #ifdef STAGING_ONLY
  26. class CHudMenuSpyBuild;
  27. #endif // STAGING_ONLY
  28. #if defined( _X360 )
  29. class CTFClientScoreBoardDialog;
  30. #endif
  31. class ClientModeTFNormal : public ClientModeShared
  32. {
  33. DECLARE_CLASS( ClientModeTFNormal, ClientModeShared );
  34. private:
  35. // IClientMode overrides.
  36. public:
  37. ClientModeTFNormal();
  38. virtual ~ClientModeTFNormal();
  39. virtual void Init();
  40. virtual void InitViewport();
  41. virtual void Shutdown();
  42. virtual void LevelInit( const char *newmap ) OVERRIDE;
  43. // virtual int KeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBinding );
  44. virtual float GetViewModelFOV( void );
  45. virtual bool ShouldDrawViewModel();
  46. virtual bool ShouldDrawCrosshair( void );
  47. virtual bool ShouldBlackoutAroundHUD() OVERRIDE;
  48. virtual HeadtrackMovementMode_t ShouldOverrideHeadtrackControl() OVERRIDE;
  49. int GetDeathMessageStartHeight( void );
  50. virtual void FireGameEvent( IGameEvent *event );
  51. virtual void PostRenderVGui();
  52. virtual bool CreateMove( float flInputSampleTime, CUserCmd *cmd );
  53. virtual int HudElementKeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBinding );
  54. virtual int HandleSpectatorKeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBinding );
  55. virtual bool DoPostScreenSpaceEffects( const CViewSetup *pSetup );
  56. virtual void Update();
  57. virtual void ComputeVguiResConditions( KeyValues *pkvConditions ) OVERRIDE;
  58. virtual bool IsInfoPanelAllowed() OVERRIDE;
  59. virtual void InfoPanelDisplayed() OVERRIDE;
  60. virtual bool IsHTMLInfoPanelAllowed() OVERRIDE;
  61. IGameUI *GameUI( void ) { return m_pGameUI; }
  62. const char *GetLastConnectedServerName( void ) const; // return the name of the last server we have connected to
  63. uint32 GetLastConnectedServerIP( void ) const; // return the IP of the last server we have connected to
  64. int GetLastConnectedServerPort( void ) const; // return the port of the last server we have connected to
  65. void PrintTextToChat( const char *pText, KeyValues *pKeyValues = NULL );
  66. void PrintTextToChatPlayer( int iPlayerIndex, const char *pText, KeyValues *pKeyValues = NULL );
  67. #if !defined(NO_STEAM)
  68. STEAM_CALLBACK_MANUAL( ClientModeTFNormal, OnScreenshotRequested, ScreenshotRequested_t, m_CallbackScreenshotRequested );
  69. #endif
  70. bool IsEngyBuildVisible() const;
  71. bool IsEngyDestroyVisible() const;
  72. bool IsEngyEurekaTeleportVisible() const;
  73. bool IsSpyDisguiseVisible() const;
  74. bool IsUpgradePanelVisible() const;
  75. bool IsTauntSelectPanelVisible() const;
  76. virtual void OnDemoRecordStart( char const* pDemoBaseName ) OVERRIDE;
  77. virtual void OnDemoRecordStop() OVERRIDE;
  78. private:
  79. // void UpdateSpectatorMode( void );
  80. private:
  81. CHudMenuEngyBuild *m_pMenuEngyBuild;
  82. CHudMenuEngyDestroy *m_pMenuEngyDestroy;
  83. CHudMenuSpyDisguise *m_pMenuSpyDisguise;
  84. CHudMenuTauntSelection *m_pMenuTauntSelection;
  85. CHudUpgradePanel *m_pMenuUpgradePanel;
  86. #ifdef STAGING_ONLY
  87. CHudMenuSpyBuild *m_pMenuSpyBuild;
  88. #endif // STAGING_ONLY
  89. CHudSpellMenu *m_pMenuSpell;
  90. CHudEurekaEffectTeleportMenu *m_pEurekaTeleportMenu;
  91. CHudTeamGoalTournament *m_pTeamGoalTournament;
  92. CTFFreezePanel *m_pFreezePanel;
  93. CItemQuickSwitchPanel *m_pQuickSwitch;
  94. CHudInspectPanel *m_pInspectPanel;
  95. IGameUI *m_pGameUI;
  96. bool m_wasConnectedLastUpdate;
  97. char *m_lastServerName;
  98. uint32 m_lastServerIP;
  99. int m_lastServerPort;
  100. uint32 m_lastServerConnectTime;
  101. float m_flNextAllowedHighFiveHintTime;
  102. bool m_bInfoPanelShown;
  103. bool m_bRestrictInfoPanel;
  104. void AskFavoriteOrBlacklist() const;
  105. #if defined( _X360 )
  106. CTFClientScoreBoardDialog *m_pScoreboard;
  107. #endif
  108. };
  109. inline const char *ClientModeTFNormal::GetLastConnectedServerName( void ) const
  110. {
  111. return m_lastServerName;
  112. }
  113. inline uint32 ClientModeTFNormal::GetLastConnectedServerIP( void ) const
  114. {
  115. return m_lastServerIP;
  116. }
  117. inline int ClientModeTFNormal::GetLastConnectedServerPort( void ) const
  118. {
  119. return m_lastServerPort;
  120. }
  121. extern IClientMode *GetClientModeNormal();
  122. extern ClientModeTFNormal* GetClientModeTFNormal();
  123. void PlayOutOfGameSound( const char *pszSound );
  124. float PlaySoundEntry( const char* pszSoundEntryName ); // Returns the duration of the sound
  125. #endif // TF_CLIENTMODE_H