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.

200 lines
5.4 KiB

  1. //===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //===========================================================================//
  7. #ifndef CL_MAIN_H
  8. #define CL_MAIN_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "basetypes.h"
  13. #include "networkstringtable.h"
  14. #include "const.h"
  15. #include "utlvector.h"
  16. #include "checksum_crc.h"
  17. #include "cdll_int.h"
  18. #include "netmessages.h"
  19. #include "dlight.h"
  20. #include "iefx.h"
  21. #include "tier1/convar.h"
  22. #include "cmodel_engine.h"
  23. class CCommand;
  24. #define MAX_STYLESTRING 64
  25. #define MAX_ELIGHTS 64 // entity only point lights
  26. extern dlight_t cl_dlights[MAX_DLIGHTS];
  27. extern dlight_t cl_elights[MAX_ELIGHTS];
  28. extern bool g_bActiveDlights;
  29. extern bool g_bActiveElights;
  30. extern int g_ActiveDLightIndex[MAX_DLIGHTS];
  31. extern int g_ActiveELightIndex[MAX_ELIGHTS];
  32. extern int g_nNumActiveDLights;
  33. extern int g_nNumActiveELights;
  34. // These can be used for fast access to the leaf indices of each light.
  35. extern CFastPointLeafNum g_DLightLeafAccessors[MAX_DLIGHTS];
  36. extern CFastPointLeafNum g_ELightLeafAccessors[MAX_ELIGHTS];
  37. class CBaseClientState;
  38. class CEntityReadInfo;
  39. class CPureServerWhitelist;
  40. struct SoundInfo_t;
  41. #define DEFAULT_JPEG_QUALITY 50
  42. void CL_TakeJpeg( const char *name = NULL, int quality = DEFAULT_JPEG_QUALITY );
  43. struct MovieInfo_t
  44. {
  45. enum
  46. {
  47. FMOVIE_TGA = ( 1 << 0 ),
  48. FMOVIE_AVI = ( 1 << 1 ),
  49. FMOVIE_WAV = ( 1 << 2 ),
  50. FMOVIE_AVISOUND = ( 1 << 3 ),
  51. FMOVIE_JPG = ( 1<< 4 )
  52. };
  53. MovieInfo_t()
  54. {
  55. moviename[ 0 ] = 0;
  56. movieframe = 0;
  57. type = FMOVIE_TGA | FMOVIE_WAV;
  58. jpeg_quality = DEFAULT_JPEG_QUALITY;
  59. }
  60. void Reset()
  61. {
  62. moviename[ 0 ] = 0;
  63. movieframe = 0;
  64. type = FMOVIE_TGA | FMOVIE_WAV;
  65. jpeg_quality = DEFAULT_JPEG_QUALITY;
  66. }
  67. bool IsRecording() const
  68. {
  69. return moviename[ 0 ] != 0 ? true : false;
  70. }
  71. bool DoWav() const
  72. {
  73. return ( type & FMOVIE_WAV ) ? true : false;
  74. }
  75. bool DoTga() const
  76. {
  77. return ( type & FMOVIE_TGA ) ? true : false;
  78. }
  79. bool DoJpg() const
  80. {
  81. return ( type & FMOVIE_JPG ) ? true : false;
  82. }
  83. bool DoAVI() const
  84. {
  85. return ( type & FMOVIE_AVI ) ? true : false;
  86. }
  87. bool DoAVISound() const
  88. {
  89. return ( type & FMOVIE_AVISOUND ) ? true : false;
  90. }
  91. char moviename[ 256 ];
  92. int movieframe;
  93. int type;
  94. int jpeg_quality;
  95. };
  96. extern MovieInfo_t cl_movieinfo;
  97. //=============================================================================
  98. // cl_main.cpp
  99. //
  100. void CL_StartMovie( const char *filename, int flags, int nWidth, int nHeight, float flFrameRate, int jpeg_quality );
  101. bool CL_IsRecordingMovie();
  102. void CL_EndMovie();
  103. void CL_DecayLights( void );
  104. void CL_UpdateDAndELights( bool bUpdateDecay = false );
  105. void CL_AddSound( const SoundInfo_t &sound );
  106. void CL_DispatchSounds( void );
  107. void CL_DispatchSound( const SoundInfo_t &sound );
  108. void CL_SetServerTick( int tick );
  109. void CL_Init (void);
  110. void CL_Shutdown( void );
  111. void CL_FireEvents( void );
  112. void CL_NextDemo (void);
  113. void CL_TakeScreenshot(const char *name);
  114. const struct CPrecacheUserData* CL_GetPrecacheUserData( INetworkStringTable *table, int index );
  115. void Callback_ModelChanged( void *object, INetworkStringTable *stringTable, int stringNumber, const char *newString, const void *newData );
  116. void Callback_GenericChanged( void *object, INetworkStringTable *stringTable, int stringNumber, const char *newString, const void *newData );
  117. void Callback_SoundChanged( void *object, INetworkStringTable *stringTable, int stringNumber, const char *newString, const void *newData );
  118. void Callback_DecalChanged( void *object, INetworkStringTable *stringTable, int stringNumber, const char *newString, const void *newData );
  119. void Callback_InstanceBaselineChanged( void *object, INetworkStringTable *stringTable, int stringNumber, const char *newString, const void *newData );
  120. void Callback_UserInfoChanged( void *object, INetworkStringTable *stringTable, int stringNumber, const char *newString, const void *newData );
  121. void Callback_DynamicModelChanged( void *object, INetworkStringTable *stringTable, int stringNumber, const char *newString, const void *newData );
  122. void CL_InstallAndInvokeClientStringTableCallbacks();
  123. void CL_HookClientStringTables();
  124. void CL_LatchInterpolationAmount();
  125. // Resource
  126. void CL_RegisterResources ( void );
  127. //
  128. // cl_input
  129. //
  130. void CL_Move( float accumulated_extra_samples, bool bFinalTick );
  131. void CL_ExtraMouseUpdate( float remainder );
  132. void CL_ClearState (void);
  133. void CL_ReadPackets ( bool framefinished ); // Read packets from server and other sources (ping requests, etc.)
  134. //
  135. // cl_main.cpp
  136. //
  137. void CL_FullyConnected( void );
  138. void CL_Retry( void );
  139. void CL_HudMessage( const char *pMessage );
  140. void CL_CheckClientState( void );
  141. void CL_TakeSnapshotAndSwap();
  142. void CL_ReallocateDynamicData( int maxclients );
  143. void CL_SetupMapName( const char* pName, char* pFixedName, int maxlen );
  144. bool CL_CheckCRCs( const char *pszMap );
  145. bool CL_ShouldLoadBackgroundLevel( const CCommand &args );
  146. bool CL_IsHL2Demo();
  147. bool CL_IsPortalDemo();
  148. void CL_SetSteamCrashComment();
  149. void CL_CheckForPureServerWhitelist();
  150. void CL_HandlePureServerWhitelist( CPureServerWhitelist *pWhitelist );
  151. void CL_GetStartupImage( char *pOutBuffer, int nOutBufferSize );
  152. // Special mode where the client uses a console window and has no graphics. Useful for stress-testing a server
  153. // without having to round up 32 people.
  154. extern bool g_bTextMode;
  155. extern bool cl_takesnapshot;
  156. extern ConVar cl_language;
  157. #endif // CL_MAIN_H