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.

51 lines
1.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Entity that propagates general data needed by clients for every player.
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef PLAYER_RESOURCE_H
  8. #define PLAYER_RESOURCE_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "shareddefs.h"
  13. class CPlayerResource : public CBaseEntity
  14. {
  15. DECLARE_CLASS( CPlayerResource, CBaseEntity );
  16. public:
  17. DECLARE_SERVERCLASS();
  18. DECLARE_DATADESC();
  19. virtual void Spawn( void );
  20. virtual void Init( int iIndex );
  21. virtual int ObjectCaps( void ) { return BaseClass::ObjectCaps() | FCAP_DONT_SAVE; }
  22. virtual void ResourceThink( void );
  23. virtual void UpdatePlayerData( void );
  24. virtual int UpdateTransmitState( void );
  25. protected:
  26. virtual void UpdateConnectedPlayer( int iIndex, CBasePlayer *pPlayer );
  27. virtual void UpdateDisconnectedPlayer( int iIndex );
  28. // Data for each player that's propagated to all clients
  29. // Stored in individual arrays so they can be sent down via datatables
  30. CNetworkArray( int, m_iPing, MAX_PLAYERS+1 );
  31. CNetworkArray( int, m_iScore, MAX_PLAYERS+1 );
  32. CNetworkArray( int, m_iDeaths, MAX_PLAYERS+1 );
  33. CNetworkArray( int, m_bConnected, MAX_PLAYERS+1 );
  34. CNetworkArray( int, m_iTeam, MAX_PLAYERS+1 );
  35. CNetworkArray( int, m_bAlive, MAX_PLAYERS+1 );
  36. CNetworkArray( int, m_iHealth, MAX_PLAYERS+1 );
  37. CNetworkArray( uint32, m_iAccountID, MAX_PLAYERS+1 );
  38. CNetworkArray( int, m_bValid, MAX_PLAYERS+1 );
  39. int m_nUpdateCounter;
  40. };
  41. extern CPlayerResource *g_pPlayerResource;
  42. #endif // PLAYER_RESOURCE_H