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.

99 lines
3.8 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef HLTVCLIENTSTATE_H
  7. #define HLTVCLIENTSTATE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "baseclientstate.h"
  12. class CClientFrame;
  13. class CHLTVServer;
  14. class CMsg_CVars;
  15. extern ConVar tv_name;
  16. class CHLTVClientState : public CBaseClientState
  17. {
  18. friend class CHLTVServer;
  19. public:
  20. CHLTVClientState( CHLTVServer *pHltvServer );
  21. virtual ~CHLTVClientState();
  22. public:
  23. const char *GetCDKeyHash() { return "HLTVHLTVHLTVHLTVHLTVHLTVHLTVHLTV"; }; // haha
  24. bool SetSignonState ( int state, int count, const CNETMsg_SignonState *msg ) OVERRIDE;
  25. void SendClientInfo( void );
  26. void PacketEnd( void );
  27. void Clear( void );
  28. void RunFrame ( void );
  29. void InstallStringTableCallback( char const *tableName );
  30. virtual bool HookClientStringTable( char const *tableName );
  31. virtual const char *GetClientName() { return tv_name.GetString(); }
  32. void ConnectionCrashed( const char * reason );
  33. void ConnectionClosing( const char * reason );
  34. virtual void Disconnect( bool bShowMainMenu = true ) OVERRIDE;
  35. int GetConnectionRetryNumber() const;
  36. void ReadEnterPVS( CEntityReadInfo &u );
  37. void ReadLeavePVS( CEntityReadInfo &u );
  38. void ReadDeltaEnt( CEntityReadInfo &u );
  39. void ReadPreserveEnt( CEntityReadInfo &u );
  40. void ReadDeletions( CEntityReadInfo &u );
  41. void ReadPacketEntities( CEntityReadInfo &u );
  42. void CopyNewEntity( CEntityReadInfo &u, int iClass, int iSerialNum );
  43. virtual bool IsClientStateTv() const { return true; }
  44. public: // IServerMessageHandlers
  45. virtual bool NETMsg_StringCmd( const CNETMsg_StringCmd& msg ) OVERRIDE;
  46. virtual bool NETMsg_SetConVar( const CNETMsg_SetConVar& msg ) OVERRIDE;
  47. virtual bool NETMsg_PlayerAvatarData( const CNETMsg_PlayerAvatarData& msg ) OVERRIDE;
  48. virtual bool SVCMsg_ServerInfo( const CSVCMsg_ServerInfo& msg ) OVERRIDE;
  49. virtual bool SVCMsg_ClassInfo( const CSVCMsg_ClassInfo& msg ) OVERRIDE;
  50. virtual bool SVCMsg_SetView( const CSVCMsg_SetView& msg ) OVERRIDE;
  51. virtual bool SVCMsg_VoiceInit( const CSVCMsg_VoiceInit& msg ) OVERRIDE;
  52. virtual bool SVCMsg_VoiceData( const CSVCMsg_VoiceData& msg ) OVERRIDE;
  53. virtual bool SVCMsg_FixAngle( const CSVCMsg_FixAngle& msg ) OVERRIDE;
  54. virtual bool SVCMsg_Prefetch( const CSVCMsg_Prefetch& msg ) OVERRIDE;
  55. virtual bool SVCMsg_CrosshairAngle( const CSVCMsg_CrosshairAngle& msg ) OVERRIDE;
  56. virtual bool SVCMsg_BSPDecal( const CSVCMsg_BSPDecal& msg ) OVERRIDE;
  57. virtual bool SVCMsg_Menu( const CSVCMsg_Menu& msg ) OVERRIDE;
  58. virtual bool SVCMsg_UserMessage( const CSVCMsg_UserMessage& msg ) OVERRIDE;
  59. virtual bool SVCMsg_PaintmapData( const CSVCMsg_PaintmapData& msg ) OVERRIDE;
  60. virtual bool SVCMsg_GameEvent( const CSVCMsg_GameEvent& msg ) OVERRIDE;
  61. virtual bool SVCMsg_GameEventList( const CSVCMsg_GameEventList &msg ) OVERRIDE;
  62. virtual bool SVCMsg_TempEntities( const CSVCMsg_TempEntities &msg ) OVERRIDE;
  63. virtual bool SVCMsg_PacketEntities( const CSVCMsg_PacketEntities &msg ) OVERRIDE;
  64. virtual bool SVCMsg_Sounds( const CSVCMsg_Sounds& msg ) OVERRIDE;
  65. virtual bool SVCMsg_EntityMsg( const CSVCMsg_EntityMsg& msg) OVERRIDE;
  66. virtual bool SVCMsg_EncryptedData( const CSVCMsg_EncryptedData& msg ) OVERRIDE;
  67. public:
  68. void SendPacket();
  69. void UpdateStats();
  70. void SetLocalInfoConvarsForUpstreamConnection( CMsg_CVars &cvars, bool bMaxSlots = false );
  71. CClientFrame *m_pNewClientFrame; // not NULL if we just got a packet with a new entity frame
  72. CClientFrame *m_pCurrentClientFrame; // NULL or pointer to last entity frame
  73. bool m_bSaveMemory; //compress data as much as possible to keep whole demos in memory
  74. float m_fNextSendUpdateTime;
  75. CHLTVServer *m_pHLTV; // HLTV server this client state belongs too.
  76. int eventid_hltv_status;
  77. int eventid_hltv_title;
  78. };
  79. #endif // HLTVCLIENTSTATE_H