Counter Strike : Global Offensive Source Code
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.

143 lines
4.6 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. // $NoKeywords: $
  8. //=============================================================================//
  9. #if !defined( CLIENTMODE_NORMAL_H )
  10. #define CLIENTMODE_NORMAL_H
  11. #ifdef _WIN32
  12. #pragma once
  13. #endif
  14. #include "iclientmode.h"
  15. #include "GameEventListener.h"
  16. #include <baseviewport.h>
  17. #include "usermessages.h"
  18. class CBaseHudChat;
  19. class CBaseHudWeaponSelection;
  20. class CViewSetup;
  21. class C_BaseEntity;
  22. class C_BasePlayer;
  23. namespace vgui
  24. {
  25. class Panel;
  26. }
  27. #define ACHIEVEMENT_ANNOUNCEMENT_MIN_TIME 10
  28. #define USERID2PLAYER(i) ToBasePlayer( ClientEntityList().GetEnt( engine->GetPlayerForUserID( i ) ) )
  29. extern IClientMode *GetClientModeNormal(); // must be implemented
  30. extern IClientMode *GetFullscreenClientMode();
  31. // This class implements client mode functionality common to HL2 and TF2.
  32. class ClientModeShared : public IClientMode, public CGameEventListener
  33. {
  34. // IClientMode overrides.
  35. public:
  36. DECLARE_CLASS_NOBASE( ClientModeShared );
  37. ClientModeShared();
  38. virtual ~ClientModeShared();
  39. virtual void Init();
  40. virtual void InitViewport();
  41. virtual void VGui_Shutdown();
  42. virtual void Shutdown();
  43. virtual void LevelInit( const char *newmap );
  44. virtual void LevelShutdown( void );
  45. virtual void Enable();
  46. virtual void EnableWithRootPanel( vgui::VPANEL pRoot );
  47. virtual void Disable();
  48. virtual void Layout( bool bForce = false );
  49. virtual void ReloadScheme( void );
  50. virtual void ReloadSchemeWithRoot( vgui::VPANEL pRoot );
  51. virtual void OverrideView( CViewSetup *pSetup );
  52. virtual bool OverrideRenderBounds( int &x, int &y, int &w, int &h, int &insetX, int &insetY ) { return false; }
  53. virtual void OverrideAudioState( AudioState_t *pAudioState ) { return; }
  54. virtual bool ShouldDrawDetailObjects( );
  55. virtual bool ShouldDrawEntity(C_BaseEntity *pEnt);
  56. virtual bool ShouldDrawLocalPlayer( C_BasePlayer *pPlayer );
  57. virtual bool ShouldDrawViewModel();
  58. virtual bool ShouldDrawParticles( );
  59. virtual bool ShouldDrawCrosshair( void );
  60. virtual void AdjustEngineViewport( int& x, int& y, int& width, int& height );
  61. virtual void PreRender(CViewSetup *pSetup);
  62. virtual void PostRender();
  63. virtual void PostRenderVGui();
  64. virtual void ProcessInput(bool bActive);
  65. virtual bool CreateMove( float flInputSampleTime, CUserCmd *cmd );
  66. virtual void Update();
  67. virtual void SetBlurFade( float scale ) {}
  68. virtual float GetBlurFade( void ) { return 0.0f; }
  69. // Input
  70. virtual int KeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBinding );
  71. virtual int HudElementKeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBinding );
  72. virtual void OverrideMouseInput( float *x, float *y );
  73. virtual void StartMessageMode( int iMessageModeType );
  74. virtual vgui::Panel *GetMessagePanel();
  75. virtual void ActivateInGameVGuiContext( vgui::Panel *pPanel );
  76. virtual void DeactivateInGameVGuiContext();
  77. // The mode can choose to not draw fog
  78. virtual bool ShouldDrawFog( void );
  79. virtual float GetViewModelFOV( void );
  80. virtual vgui::Panel* GetViewport() { return m_pViewport; }
  81. virtual vgui::Panel *GetPanelFromViewport( const char *pchNamePath );
  82. // Gets at the viewports vgui panel animation controller, if there is one...
  83. virtual vgui::AnimationController *GetViewportAnimationController()
  84. { return m_pViewport->GetAnimationController(); }
  85. virtual void FireGameEvent( IGameEvent *event );
  86. virtual bool CanRecordDemo( char *errorMsg, int length ) const { return true; }
  87. virtual int HandleSpectatorKeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBinding );
  88. virtual void InitChatHudElement( void );
  89. virtual void InitWeaponSelectionHudElement( void );
  90. virtual wchar_t* GetServerName( void ) { return NULL; }
  91. virtual void SetServerName( wchar_t *name ) {}
  92. virtual wchar_t* GetMapName( void ) { return NULL; }
  93. virtual void SetMapName( wchar_t *name ) {}
  94. virtual void UpdateCameraManUIState( int iType, int nOptionalParam, uint64 xuid );
  95. virtual void ScoreboardOff( void );
  96. virtual void GraphPageChanged( void );
  97. CUserMessageBinder m_UMCMsgVGUIMenu;
  98. CUserMessageBinder m_UMCMsgRumble;
  99. protected:
  100. CBaseViewport *m_pViewport;
  101. int GetSplitScreenPlayerSlot() const;
  102. private:
  103. // Message mode handling
  104. // All modes share a common chat interface
  105. CBaseHudChat *m_pChatElement;
  106. vgui::HCursor m_CursorNone;
  107. CBaseHudWeaponSelection *m_pWeaponSelection;
  108. int m_nRootSize[2];
  109. };
  110. bool ContainsBinding( const char *pszBindingString, const char *pszBinding, bool bSearchAliases = true );
  111. void SendCameraManUIStateChange( HltvUiType_t eventType, int nOptionalParam = 0 );
  112. #endif // CLIENTMODE_NORMAL_H