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.

203 lines
6.5 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: replaces the cl_*.cpp files with stubs
  4. //
  5. //=============================================================================//
  6. #include "client_pch.h"
  7. #ifdef DEDICATED
  8. #include "hltvclientstate.h"
  9. #include "netconsole.h"
  10. #include "convar.h"
  11. #include "enginestats.h"
  12. #include "bspfile.h" // dworldlight_t
  13. #include "audio/public/soundservice.h"
  14. ISoundServices *g_pSoundServices = NULL;
  15. Vector listener_origin;
  16. // memdbgon must be the last include file in a .cpp file!!!
  17. #include "tier0/memdbgon.h"
  18. #define MAXPRINTMSG 4096
  19. CEngineStats g_EngineStats;
  20. ClientClass *g_pClientClassHead = NULL;
  21. bool g_bReplayLoadedTools = false;
  22. bool CL_IsHL2Demo()
  23. {
  24. return false;
  25. }
  26. bool CL_IsPortalDemo()
  27. {
  28. return false;
  29. }
  30. bool HandleRedirectAndDebugLog( const char *msg );
  31. void BeginLoadingUpdates( MaterialNonInteractiveMode_t mode ) {}
  32. void RefreshScreenIfNecessary() {}
  33. void EndLoadingUpdates() {}
  34. void Con_ColorPrintf( const Color& clr, const char *fmt, ... )
  35. {
  36. va_list argptr;
  37. char msg[MAXPRINTMSG];
  38. static bool inupdate;
  39. if ( !host_initialized )
  40. return;
  41. va_start (argptr,fmt);
  42. Q_vsnprintf (msg,sizeof( msg ), fmt,argptr);
  43. va_end (argptr);
  44. if ( !HandleRedirectAndDebugLog( msg ) )
  45. {
  46. return;
  47. }
  48. SendStringToNetConsoles( msg );
  49. #if defined( LINUX )
  50. // linux prints output elsewhere. This disables standard printf's to keep from double printing all linux output
  51. #elif POSIX
  52. printf( "%s", msg );
  53. #else
  54. Msg( "%s", msg );
  55. #endif
  56. }
  57. void Con_NPrintf( int pos, const char *fmt, ... )
  58. {
  59. va_list argptr;
  60. char text[4096];
  61. va_start (argptr, fmt);
  62. Q_vsnprintf(text, sizeof( text ), fmt, argptr);
  63. va_end (argptr);
  64. return;
  65. // printf( "%s", text );
  66. }
  67. void SCR_UpdateScreen (void)
  68. {
  69. }
  70. void SCR_EndLoadingPlaque (void)
  71. {
  72. }
  73. void ClientDLL_FrameStageNotify( ClientFrameStage_t frameStage )
  74. {
  75. }
  76. ClientClass *ClientDLL_GetAllClasses( void )
  77. {
  78. return g_pClientClassHead;
  79. }
  80. #define LIGHT_MIN_LIGHT_VALUE 0.03f
  81. float ComputeLightRadius( dworldlight_t *pLight, bool bIsHDR )
  82. {
  83. float flLightRadius = pLight->radius;
  84. if (flLightRadius == 0.0f)
  85. {
  86. // Compute the light range based on attenuation factors
  87. float flIntensity = sqrtf( DotProduct( pLight->intensity, pLight->intensity ) );
  88. if (pLight->quadratic_attn == 0.0f)
  89. {
  90. if (pLight->linear_attn == 0.0f)
  91. {
  92. // Infinite, but we're not going to draw it as such
  93. flLightRadius = 2000;
  94. }
  95. else
  96. {
  97. flLightRadius = (flIntensity / LIGHT_MIN_LIGHT_VALUE - pLight->constant_attn) / pLight->linear_attn;
  98. }
  99. }
  100. else
  101. {
  102. float a = pLight->quadratic_attn;
  103. float b = pLight->linear_attn;
  104. float c = pLight->constant_attn - flIntensity / LIGHT_MIN_LIGHT_VALUE;
  105. float discrim = b * b - 4 * a * c;
  106. if (discrim < 0.0f)
  107. {
  108. // Infinite, but we're not going to draw it as such
  109. flLightRadius = 2000;
  110. }
  111. else
  112. {
  113. flLightRadius = (-b + sqrtf(discrim)) / (2.0f * a);
  114. if (flLightRadius < 0)
  115. flLightRadius = 0;
  116. }
  117. }
  118. }
  119. return flLightRadius;
  120. }
  121. CClientState::CClientState() {}
  122. CClientState::~CClientState() {}
  123. void CClientState::ConnectionStart( INetChannel *chan ){}
  124. void CClientState::ConnectionStop(){}
  125. bool CClientState::SVCMsg_HltvReplay( const CSVCMsg_HltvReplay &msg ){ return false; }
  126. void CClientState::ConnectionClosing( const char * reason ) {}
  127. void CClientState::ConnectionCrashed( const char * reason ) {}
  128. bool CClientState::ProcessConnectionlessPacket( netpacket_t *packet ){ return false; }
  129. void CClientState::PacketStart(int incoming_sequence, int outgoing_acknowledged) {}
  130. void CClientState::PacketEnd( void ) {}
  131. void CClientState::FileRequested(const char *fileName, unsigned int transferID, bool bIsReplayDemoFile ) {}
  132. void CClientState::Disconnect( bool showmainmenu ) {}
  133. void CClientState::FullConnect( const ns_address &adr, int nEncryptionKey ) {}
  134. bool CClientState::SetSignonState ( int state, int count, const CNETMsg_SignonState *msg ) { return false;}
  135. void CClientState::SendClientInfo( void ) {}
  136. void CClientState::SendLoadingProgress( int nProgress ) {}
  137. void CClientState::SendServerCmdKeyValues( KeyValues *pKeyValues ) {}
  138. void CClientState::InstallStringTableCallback( char const *tableName ) {}
  139. bool CClientState::InstallEngineStringTableCallback( char const *tableName ) { return false;}
  140. void CClientState::ReadPacketEntities( CEntityReadInfo &u ) {}
  141. const char *CClientState::GetCDKeyHash( void ) { return "123";}
  142. void CClientState::Clear( void ) {}
  143. bool CClientState::SVCMsg_UserMessage( const CSVCMsg_UserMessage& msg ) { return true; }
  144. bool CClientState::SVCMsg_GameEvent( const CSVCMsg_GameEvent& msg) { return true; }
  145. bool CClientState::SVCMsg_BSPDecal( const CSVCMsg_BSPDecal& msg ) OVERRIDE { return true; }
  146. bool CClientState::SVCMsg_CrosshairAngle( const CSVCMsg_CrosshairAngle& msg ) OVERRIDE { return true; }
  147. bool CClientState::SVCMsg_FixAngle( const CSVCMsg_FixAngle &msg ) OVERRIDE { return true; }
  148. bool CClientState::SVCMsg_VoiceData( const CSVCMsg_VoiceData& msg ) OVERRIDE { return true; }
  149. bool CClientState::SVCMsg_VoiceInit( const CSVCMsg_VoiceInit& msg ) OVERRIDE { return true; }
  150. bool CClientState::SVCMsg_SetPause( const CSVCMsg_SetPause& msg ) OVERRIDE { return true; }
  151. bool CClientState::SVCMsg_ClassInfo( const CSVCMsg_ClassInfo& msg ) OVERRIDE { return true; }
  152. bool CClientState::NETMsg_StringCmd( const CNETMsg_StringCmd& msg ) OVERRIDE { return true; }
  153. bool CClientState::SVCMsg_ServerInfo( const CSVCMsg_ServerInfo& msg ) OVERRIDE { return true; }
  154. bool CClientState::NETMsg_Tick( const CNETMsg_Tick& msg ) OVERRIDE { return true; }
  155. bool CClientState::SVCMsg_TempEntities( const CSVCMsg_TempEntities& msg ) { return true; }
  156. bool CClientState::SVCMsg_PacketEntities( const CSVCMsg_PacketEntities& msg ) { return true; }
  157. bool CClientState::SVCMsg_Sounds( const CSVCMsg_Sounds& msg ) OVERRIDE { return true; }
  158. bool CClientState::SVCMsg_Prefetch( const CSVCMsg_Prefetch& msg ) OVERRIDE { return true; }
  159. bool CClientState::SVCMsg_PaintmapData( const CSVCMsg_PaintmapData& msg ) { return true; }
  160. bool CClientState::SVCMsg_EntityMsg( const CSVCMsg_EntityMsg& msg ) { return true; }
  161. float CClientState::GetTime() const { return 0.0f;}
  162. void CClientState::FileDenied(const char *fileName, unsigned int transferID, bool bIsReplayDemoFile ){}
  163. void CClientState::FileReceived( const char * fileName, unsigned int transferID, bool bIsReplayDemoFile ) {}
  164. void CClientState::RunFrame() {}
  165. void CClientState::ConsistencyCheck( bool bChanged ) {}
  166. bool CClientState::HookClientStringTable( char const *tableName ) { return false; }
  167. CClientState cl;
  168. float CL_GetHltvReplayTimeScale()
  169. {
  170. return 1.0f;
  171. }
  172. #endif