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.

193 lines
5.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: replaces the cl_*.cpp files with stubs
  4. //
  5. //=============================================================================//
  6. #include "client_pch.h"
  7. #ifdef SWDS
  8. #include "hltvclientstate.h"
  9. #include "convar.h"
  10. #include "enginestats.h"
  11. #include "bspfile.h" // dworldlight_t
  12. #include "audio/public/soundservice.h"
  13. #include "tier0/systeminformation.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 CL_IsHL2Demo()
  22. {
  23. return false;
  24. }
  25. bool CL_IsPortalDemo()
  26. {
  27. return false;
  28. }
  29. bool HandleRedirectAndDebugLog( const char *msg );
  30. void BeginLoadingUpdates( MaterialNonInteractiveMode_t mode ) {}
  31. void RefreshScreenIfNecessary() {}
  32. void EndLoadingUpdates() {}
  33. void Con_ColorPrintf( const Color& clr, const char *fmt, ... )
  34. {
  35. va_list argptr;
  36. char msg[MAXPRINTMSG];
  37. static bool inupdate;
  38. if ( !host_initialized )
  39. return;
  40. va_start (argptr,fmt);
  41. Q_vsnprintf (msg,sizeof( msg ), fmt,argptr);
  42. va_end (argptr);
  43. if ( !HandleRedirectAndDebugLog( msg ) )
  44. {
  45. return;
  46. }
  47. return;
  48. // printf( "%s", msg );
  49. }
  50. void Con_NPrintf( int pos, const char *fmt, ... )
  51. {
  52. va_list argptr;
  53. char text[4096];
  54. va_start (argptr, fmt);
  55. Q_vsnprintf(text, sizeof( text ), fmt, argptr);
  56. va_end (argptr);
  57. return;
  58. // printf( "%s", text );
  59. }
  60. void SCR_UpdateScreen (void)
  61. {
  62. }
  63. void SCR_EndLoadingPlaque (void)
  64. {
  65. }
  66. void ClientDLL_FrameStageNotify( ClientFrameStage_t frameStage )
  67. {
  68. }
  69. ClientClass *ClientDLL_GetAllClasses( void )
  70. {
  71. return g_pClientClassHead;
  72. }
  73. #define LIGHT_MIN_LIGHT_VALUE 0.03f
  74. float ComputeLightRadius( dworldlight_t *pLight, bool bIsHDR )
  75. {
  76. float flLightRadius = pLight->radius;
  77. if (flLightRadius == 0.0f)
  78. {
  79. // Compute the light range based on attenuation factors
  80. float flIntensity = sqrtf( DotProduct( pLight->intensity, pLight->intensity ) );
  81. if (pLight->quadratic_attn == 0.0f)
  82. {
  83. if (pLight->linear_attn == 0.0f)
  84. {
  85. // Infinite, but we're not going to draw it as such
  86. flLightRadius = 2000;
  87. }
  88. else
  89. {
  90. flLightRadius = (flIntensity / LIGHT_MIN_LIGHT_VALUE - pLight->constant_attn) / pLight->linear_attn;
  91. }
  92. }
  93. else
  94. {
  95. float a = pLight->quadratic_attn;
  96. float b = pLight->linear_attn;
  97. float c = pLight->constant_attn - flIntensity / LIGHT_MIN_LIGHT_VALUE;
  98. float discrim = b * b - 4 * a * c;
  99. if (discrim < 0.0f)
  100. {
  101. // Infinite, but we're not going to draw it as such
  102. flLightRadius = 2000;
  103. }
  104. else
  105. {
  106. flLightRadius = (-b + sqrtf(discrim)) / (2.0f * a);
  107. if (flLightRadius < 0)
  108. flLightRadius = 0;
  109. }
  110. }
  111. }
  112. return flLightRadius;
  113. }
  114. CClientState::CClientState() {}
  115. CClientState::~CClientState() {}
  116. void CClientState::ConnectionClosing( const char * reason ) {}
  117. void CClientState::ConnectionCrashed( const char * reason ) {}
  118. bool CClientState::ProcessConnectionlessPacket( netpacket_t *packet ){ return false; }
  119. void CClientState::PacketStart(int incoming_sequence, int outgoing_acknowledged) {}
  120. void CClientState::PacketEnd( void ) {}
  121. void CClientState::FileReceived( const char *fileName, unsigned int transferID ) {}
  122. void CClientState::FileRequested( const char *fileName, unsigned int transferID ) {}
  123. void CClientState::FileDenied(const char *fileName, unsigned int transferID ) {}
  124. void CClientState::FileSent( const char *fileName, unsigned int transferID ) {}
  125. void CClientState::Disconnect( const char *pszReason, bool showmainmenu ) {}
  126. void CClientState::FullConnect( netadr_t &adr ) {}
  127. bool CClientState::SetSignonState ( int state, int count ) { return false;}
  128. void CClientState::SendClientInfo( void ) {}
  129. void CClientState::SendServerCmdKeyValues( KeyValues *pKeyValues ) {}
  130. void CClientState::InstallStringTableCallback( char const *tableName ) {}
  131. bool CClientState::InstallEngineStringTableCallback( char const *tableName ) { return false;}
  132. void CClientState::ReadEnterPVS( CEntityReadInfo &u ) {}
  133. void CClientState::ReadLeavePVS( CEntityReadInfo &u ) {}
  134. void CClientState::ReadDeltaEnt( CEntityReadInfo &u ) {}
  135. void CClientState::ReadPreserveEnt( CEntityReadInfo &u ) {}
  136. void CClientState::ReadDeletions( CEntityReadInfo &u ) {}
  137. const char *CClientState::GetCDKeyHash( void ) { return "123";}
  138. void CClientState::Clear( void ) {}
  139. bool CClientState::ProcessGameEvent(SVC_GameEvent *msg) { return true; }
  140. bool CClientState::ProcessUserMessage(SVC_UserMessage *msg) { return true; }
  141. bool CClientState::ProcessEntityMessage(SVC_EntityMessage *msg) { return true; }
  142. bool CClientState::ProcessBSPDecal( SVC_BSPDecal *msg ) { return true; }
  143. bool CClientState::ProcessCrosshairAngle( SVC_CrosshairAngle *msg ) { return true; }
  144. bool CClientState::ProcessFixAngle( SVC_FixAngle *msg ) { return true; }
  145. bool CClientState::ProcessVoiceData( SVC_VoiceData *msg ) { return true; }
  146. bool CClientState::ProcessVoiceInit( SVC_VoiceInit *msg ) { return true; }
  147. bool CClientState::ProcessSetPause( SVC_SetPause *msg ) { return true; }
  148. bool CClientState::ProcessSetPauseTimed( SVC_SetPauseTimed *msg ) { return true; }
  149. bool CClientState::ProcessClassInfo( SVC_ClassInfo *msg ) { return true; }
  150. bool CClientState::ProcessStringCmd( NET_StringCmd *msg ) { return true; }
  151. bool CClientState::ProcessServerInfo( SVC_ServerInfo *msg ) { return true; }
  152. bool CClientState::ProcessTick( NET_Tick *msg ) { return true; }
  153. bool CClientState::ProcessTempEntities( SVC_TempEntities *msg ) { return true; }
  154. bool CClientState::ProcessPacketEntities( SVC_PacketEntities *msg ) { return true; }
  155. bool CClientState::ProcessSounds( SVC_Sounds *msg ) { return true; }
  156. bool CClientState::ProcessPrefetch( SVC_Prefetch *msg ) {return true;}
  157. float CClientState::GetTime() const { return 0.0f;}
  158. void CClientState::RunFrame() {}
  159. bool CClientState::HookClientStringTable( char const *tableName ) { return false; }
  160. CClientState cl;
  161. char g_minidumpinfo[ 4096 ] = {0};
  162. PAGED_POOL_INFO_t g_pagedpoolinfo = { 0 };
  163. #endif