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.

134 lines
4.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //===========================================================================//
  8. #ifndef ENGINECALLBACK_H
  9. #define ENGINECALLBACK_H
  10. #ifndef EIFACE_H
  11. #include "eiface.h"
  12. #endif
  13. class IFileSystem; // include filesystem.h
  14. class IEngineSound; // include engine/IEngineSound.h
  15. class IVEngineServer;
  16. class IVoiceServer;
  17. class IStaticPropMgrServer;
  18. class ISpatialPartition;
  19. class IVModelInfo;
  20. class IEngineTrace;
  21. class IGameEventManager2;
  22. class IVDebugOverlay;
  23. class IDataCache;
  24. class IMDLCache;
  25. class IServerEngineTools;
  26. class IXboxSystem;
  27. class CSteamAPIContext;
  28. class CSteamGameServerAPIContext;
  29. extern IVEngineServer *engine;
  30. extern IVoiceServer *g_pVoiceServer;
  31. extern IFileSystem *filesystem;
  32. extern IStaticPropMgrServer *staticpropmgr;
  33. extern ISpatialPartition *partition;
  34. extern IEngineSound *enginesound;
  35. extern IVModelInfo *modelinfo;
  36. extern IEngineTrace *enginetrace;
  37. extern IGameEventManager2 *gameeventmanager;
  38. extern IVDebugOverlay *debugoverlay;
  39. extern IDataCache *datacache;
  40. extern IMDLCache *mdlcache;
  41. extern IServerEngineTools *serverenginetools;
  42. extern IXboxSystem *xboxsystem; // 360 only
  43. extern CSteamAPIContext *steamapicontext; // available on game clients
  44. extern CSteamGameServerAPIContext *steamgameserverapicontext; //available on game servers
  45. //-----------------------------------------------------------------------------
  46. // Precaches a material
  47. //-----------------------------------------------------------------------------
  48. void PrecacheMaterial( const char *pMaterialName );
  49. //-----------------------------------------------------------------------------
  50. // Converts a previously precached material into an index
  51. //-----------------------------------------------------------------------------
  52. int GetMaterialIndex( const char *pMaterialName );
  53. //-----------------------------------------------------------------------------
  54. // Converts a previously precached material index into a string
  55. //-----------------------------------------------------------------------------
  56. const char *GetMaterialNameFromIndex( int nMaterialIndex );
  57. //-----------------------------------------------------------------------------
  58. // Precache-related methods for particle systems
  59. //-----------------------------------------------------------------------------
  60. void PrecacheParticleSystem( const char *pParticleSystemName );
  61. int GetParticleSystemIndex( const char *pParticleSystemName );
  62. const char *GetParticleSystemNameFromIndex( int nIndex );
  63. class IRecipientFilter;
  64. void EntityMessageBegin( CBaseEntity * entity, bool reliable = false );
  65. void UserMessageBegin( IRecipientFilter& filter, const char *messagename );
  66. void MessageEnd( void );
  67. // bytewise
  68. void MessageWriteByte( int iValue);
  69. void MessageWriteChar( int iValue);
  70. void MessageWriteShort( int iValue);
  71. void MessageWriteWord( int iValue );
  72. void MessageWriteLong( int iValue);
  73. void MessageWriteFloat( float flValue);
  74. void MessageWriteAngle( float flValue);
  75. void MessageWriteCoord( float flValue);
  76. void MessageWriteVec3Coord( const Vector& rgflValue);
  77. void MessageWriteVec3Normal( const Vector& rgflValue);
  78. void MessageWriteAngles( const QAngle& rgflValue);
  79. void MessageWriteString( const char *sz );
  80. void MessageWriteEntity( int iValue);
  81. void MessageWriteEHandle( CBaseEntity *pEntity ); //encoded as a long
  82. // bitwise
  83. void MessageWriteBool( bool bValue );
  84. void MessageWriteUBitLong( unsigned int data, int numbits );
  85. void MessageWriteSBitLong( int data, int numbits );
  86. void MessageWriteBits( const void *pIn, int nBits );
  87. #ifndef NO_STEAM
  88. /// Returns Steam ID, given player index. Returns an invalid SteamID upon
  89. /// failure
  90. extern CSteamID GetSteamIDForPlayerIndex( int iPlayerIndex );
  91. #endif
  92. // Bytewise
  93. #define WRITE_BYTE (MessageWriteByte)
  94. #define WRITE_CHAR (MessageWriteChar)
  95. #define WRITE_SHORT (MessageWriteShort)
  96. #define WRITE_WORD (MessageWriteWord)
  97. #define WRITE_LONG (MessageWriteLong)
  98. #define WRITE_FLOAT (MessageWriteFloat)
  99. #define WRITE_ANGLE (MessageWriteAngle)
  100. #define WRITE_COORD (MessageWriteCoord)
  101. #define WRITE_VEC3COORD (MessageWriteVec3Coord)
  102. #define WRITE_VEC3NORMAL (MessageWriteVec3Normal)
  103. #define WRITE_ANGLES (MessageWriteAngles)
  104. #define WRITE_STRING (MessageWriteString)
  105. #define WRITE_ENTITY (MessageWriteEntity)
  106. #define WRITE_EHANDLE (MessageWriteEHandle)
  107. // Bitwise
  108. #define WRITE_BOOL (MessageWriteBool)
  109. #define WRITE_UBITLONG (MessageWriteUBitLong)
  110. #define WRITE_SBITLONG (MessageWriteSBitLong)
  111. #define WRITE_BITS (MessageWriteBits)
  112. #endif //ENGINECALLBACK_H