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.

210 lines
6.4 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef CS_CLIENTMODE_H
  7. #define CS_CLIENTMODE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "clientmode_shared.h"
  12. #include "counterstrikeviewport.h"
  13. #include "matchmaking/imatchframework.h"
  14. #include "c_cs_player.h"
  15. #include "usermessages.h"
  16. enum PostProcessEffect_t
  17. {
  18. POST_EFFECT_DEFAULT = 0,
  19. POST_EFFECT_LOW_HEATH, // 1st person event
  20. POST_EFFECT_VERY_LOW_HEATH,
  21. POST_EFFECT_IN_BUY_MENU, // 1st person event
  22. POST_EFFECT_DEATH_CAM, // 1st person event
  23. POST_EFFECT_SPECTATING, // 1st person state
  24. POST_EFFECT_IN_FIRE,
  25. POST_EFFECT_ZOOMED_RIFLE,
  26. POST_EFFECT_ZOOMED_SNIPER,
  27. POST_EFFECT_ZOOMED_SNIPER_MOVING,
  28. POST_EFFECT_UNDER_WATER,
  29. POST_EFFECT_ROUND_END_VIA_BOMBING,
  30. POST_EFFECT_SPEC_CAMERA_LERPING,
  31. POST_EFFECT_MAP_CONTROLLED,
  32. POST_EFFECT_DEATH_CAM_BODYSHOT, // 1st person event
  33. POST_EFFECT_DEATH_CAM_HEADSHOT, // 1st person event
  34. NUM_POST_EFFECTS
  35. };
  36. enum RoundStatus_t
  37. {
  38. ROUND_UNKNOWN = 0,
  39. ROUND_STARTED,
  40. ROUND_ENDED,
  41. ROUND_ENDED_VIA_BOMBING
  42. };
  43. struct PostProcessEffectParams_t
  44. {
  45. float fLocalContrastStrength;
  46. float fLocalContrastEdgeStrength;
  47. float fVignetteStart;
  48. float fVignetteEnd;
  49. float fVignetteBlurStrength;
  50. float fFadeToBlackStrength;
  51. };
  52. enum SyncKeyBindingValueDirection_t
  53. {
  54. KEYBINDING_WRITE_TO_TITLEDATA,
  55. KEYBINDING_READ_FROM_TITLEDATA
  56. };
  57. class SpecCameraPosition_t
  58. {
  59. public:
  60. Vector vecPosition;
  61. Vector vecAngles;
  62. float flWeight;
  63. };
  64. class ClientModeCSNormal : public ClientModeShared, public IMatchEventsSink
  65. {
  66. DECLARE_CLASS( ClientModeCSNormal, ClientModeShared );
  67. private:
  68. // IClientMode overrides.
  69. public:
  70. ClientModeCSNormal();
  71. ~ClientModeCSNormal();
  72. virtual void OnEvent( KeyValues *pEvent );
  73. virtual void Init();
  74. virtual void InitViewport();
  75. // dgoodenough - fix GCC shortcoming
  76. // PS3_BUILDFIX
  77. virtual void InitViewport( bool bOnlyBaseClass = false );
  78. virtual void Update();
  79. virtual void LevelShutdown( void );
  80. virtual int KeyInput( int down, ButtonCode_t keynum, const char *pszCurrentBinding );
  81. int GetDeathMessageStartHeight( void );
  82. virtual void FireGameEvent( IGameEvent *event );
  83. virtual void PostRenderVGui();
  84. virtual void PreRender(CViewSetup *pSetup) OVERRIDE;
  85. virtual bool ShouldDrawViewModel( void );
  86. virtual bool CanRecordDemo( char *errorMsg, int length ) const;
  87. virtual wchar_t* GetServerName( void ) { return m_pServerName; }
  88. virtual void SetServerName( wchar_t *name );
  89. virtual wchar_t* GetMapName( void ) { return m_pMapName; }
  90. virtual void SetMapName( wchar_t *name );
  91. virtual void SetBlurFade( float scale );
  92. virtual float GetBlurFade( void ) { return 0; }
  93. virtual void DoPostScreenSpaceEffects( const CViewSetup *pSetup );
  94. virtual void UpdateColorCorrectionWeights( void );
  95. virtual void OnColorCorrectionWeightsReset( void );
  96. virtual float GetColorCorrectionScale( void ) const;
  97. void SetupStaticCameras( void );
  98. bool GetIdealCameraPosForPlayer( int playerindex );
  99. void LoadPostProcessParamsFromFile( const char* pFileName = NULL );
  100. void UpdatePostProcessingEffects();
  101. void PostProcessLerpTo( PostProcessEffect_t effectID, float fFadeDuration = 0.75f, const PostProcessParameters_t* pTargetParams = NULL );
  102. void PostProcessLerpTo( PostProcessEffect_t effectID, const C_PostProcessController* pPPController );
  103. void DoPostProcessParamLerp();
  104. void LerpPostProcessParam( float fAmount, PostProcessParameters_t& result, const PostProcessParameters_t& from,
  105. const PostProcessParameters_t& to ) const;
  106. PostProcessEffect_t PostProcessEffectFromName( const char* pName ) const;
  107. void GetDefaultPostProcessingParams( C_CSPlayer* pPlayer, PostProcessEffectParams_t* pParams );
  108. void SyncCurrentKeyBindingsToDeviceTitleData( int iController, int eDevice, const SyncKeyBindingValueDirection_t eOp );
  109. void CheckTitleDataStorageConnected( void );
  110. #if !defined(NO_STEAM) && !defined (_PS3)
  111. STEAM_CALLBACK_MANUAL( ClientModeCSNormal, OnScreenshotRequested, ScreenshotRequested_t, m_CallbackScreenshotRequested );
  112. #endif
  113. CUserMessageBinder m_UMCMsgKillCam;
  114. CUserMessageBinder m_UMCMsgMatchEndConditions;
  115. CUserMessageBinder m_UMCMsgDisconnectToLobby;
  116. CUserMessageBinder m_UMCMsgDisplayInventory;
  117. CUserMessageBinder m_UMCMsgWarmupHasEnded;
  118. CUserMessageBinder m_UMCMsgServerRankUpdate;
  119. CUserMessageBinder m_UMCMsgServerRankRevealAll;
  120. CUserMessageBinder m_UMCMsgScoreLeaderboardData;
  121. CUserMessageBinder m_UMCMsgGlowPropTurnOff;
  122. CUserMessageBinder m_UMCMsgXpUpdate;
  123. CUserMessageBinder m_UMCMsgQuestProgress;
  124. CUserMessageBinder m_UMCMsgPlayerDecalDigitalSignature;
  125. private:
  126. //int CameraSortFunction( SpecCameraPosition_t* entry1, SpecCameraPosition_t* entry2 );
  127. wchar_t m_pServerName[256];
  128. wchar_t m_pMapName[256];
  129. CHandle<C_ColorCorrection> m_hCurrentColorCorrection;
  130. // void UpdateSpectatorMode( void );
  131. ClientCCHandle_t m_CCKillCamReplay; // handle to death cc effect
  132. float m_CCKillCamReplayPercent;
  133. ClientCCHandle_t m_CCDeathHandle; // handle to death cc effect
  134. float m_CCDeathPercent;
  135. ClientCCHandle_t m_CCFreezePeriodHandle_CT;
  136. float m_CCFreezePeriodPercent_CT;
  137. ClientCCHandle_t m_CCFreezePeriodHandle_T;
  138. float m_CCFreezePeriodPercent_T;
  139. ClientCCHandle_t m_CCPlayerFlashedHandle;
  140. float m_CCPlayerFlashedPercent;
  141. RoundStatus_t m_iRoundStatus;
  142. float m_fDelayedCTWinTime;
  143. static PostProcessParameters_t ms_postProcessParams[];
  144. static const char* ms_postProcessEffectNames[];
  145. PostProcessEffect_t m_activePostProcessEffect;
  146. PostProcessEffect_t m_lastPostProcessEffect;
  147. const C_PostProcessController* m_pActivePostProcessController;
  148. CountdownTimer m_postProcessEffectCountdown;
  149. PostProcessParameters_t m_postProcessLerpStartParams;
  150. PostProcessParameters_t m_postProcessLerpEndParams;
  151. PostProcessParameters_t m_postProcessCurrentParams;
  152. CUtlVector< SpecCameraPosition_t > m_SpecCameraPositions;
  153. int m_nRoundMVP;
  154. public:
  155. struct CQuestUncommittedProgress_t
  156. {
  157. uint32 m_numNormalPoints;
  158. double m_dblNormalPointsProgressTime;
  159. uint32 m_numNormalPointsProgressBaseline;
  160. bool m_bIsEventQuest;
  161. };
  162. static CUtlMap< uint32, CQuestUncommittedProgress_t, uint32, CDefLess< uint32 > > sm_mapQuestProgressUncommitted;
  163. static ScoreLeaderboardData s_ScoreLeaderboardData;
  164. static uint32 s_numLevelTransitions;
  165. };
  166. extern IClientMode *GetClientModeNormal();
  167. extern ClientModeCSNormal* GetClientModeCSNormal();
  168. #endif // CS_CLIENTMODE_H