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.

86 lines
2.9 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef DATATABLE_RECV_ENG_H
  8. #define DATATABLE_RECV_ENG_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "dt_recv.h"
  13. #include "bitbuf.h"
  14. #include "dt.h"
  15. #include "tier1/utlvector.h"
  16. class CStandardSendProxies;
  17. class CSVCMsg_SendTable;
  18. typedef intp SerializedEntityHandle_t;
  19. // ------------------------------------------------------------------------------------------ //
  20. // RecvTable functions.
  21. // ------------------------------------------------------------------------------------------ //
  22. // These are the module startup and shutdown routines.
  23. bool RecvTable_Init( RecvTable **pTables, int nTables );
  24. void RecvTable_Term( bool clearall = true );
  25. // After calling RecvTable_Init to provide the list of RecvTables, call this
  26. // as the server sends its SendTables over. If msg needs decoder
  27. // it will precalculate the necessary data to actually decode this type of
  28. // SendTable from the server. nDemoProtocol = 0 means current version.
  29. bool RecvTable_RecvClassInfos( const CSVCMsg_SendTable& msg, int nDemoProtocol = 0 );
  30. // After ALL the SendTables have been received, call this and it will create CRecvDecoders
  31. // for all the SendTable->RecvTable matches it finds.
  32. // Returns false if there is an unrecoverable error.
  33. //
  34. // bAllowMismatches is true when playing demos back so we can change datatables without breaking demos.
  35. // If pAnyMisMatches is non-null, it will be set to true if the client's recv tables mismatched the server's ones.
  36. bool RecvTable_CreateDecoders( const CStandardSendProxies *pSendProxies, bool bAllowMismatches, bool *pAnyMismatches=NULL );
  37. // objectID gets passed into proxies and can be used to track data on particular objects.
  38. // NOTE: this function can ONLY decode a buffer outputted from RecvTable_MergeDeltas
  39. // or RecvTable_CopyEncoding because if the way it follows the exclude prop bits.
  40. bool RecvTable_Decode(
  41. RecvTable *pTable,
  42. void *pStruct,
  43. SerializedEntityHandle_t handle,
  44. int objectID
  45. );
  46. // This acts like a RecvTable_Decode() call where all properties are written and all their values are zero.
  47. void RecvTable_DecodeZeros( RecvTable *pTable, void *pStruct, int objectID );
  48. // This writes all pNewState properties into pOut.
  49. //
  50. // If pOldState is non-null and contains any properties that aren't in pNewState, then
  51. // those properties are written to the output as well. Returns # of changed props
  52. bool RecvTable_MergeDeltas(
  53. RecvTable *pTable,
  54. SerializedEntityHandle_t oldState, // Can be invalid
  55. SerializedEntityHandle_t newState,
  56. SerializedEntityHandle_t mergedState,
  57. int objectID = - 1,
  58. CUtlVector< int > *pChangedProps = NULL
  59. );
  60. bool RecvTable_ReadFieldList(
  61. RecvTable *pTable,
  62. bf_read &buf,
  63. SerializedEntityHandle_t dest,
  64. int nObjectId,
  65. bool bUpdateDTI
  66. );
  67. #endif // DATATABLE_RECV_ENG_H