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.

195 lines
5.3 KiB

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