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.

61 lines
2.2 KiB

  1. //========= Copyright � 1996-2007, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Game rules for Blob.
  4. //
  5. //=============================================================================//
  6. #ifndef BLOB_NETWORKBYPASS_H
  7. #define BLOB_NETWORKBYPASS_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "bitvec.h"
  12. #define BLOB_MAX_LEVEL_PARTICLES 4000 // maximum number of blob particles in a given level at any one time
  13. #define BLOB_MAX_LEVEL_PARTICLES_BITS 12 // the number of bits needed to represent the number of particles above (should be ceil(lg(BLOB_MAX_LEVEL_PARTICLES)))
  14. #define PARTICLEUSAGENUMINTS ((BLOB_MAX_LEVEL_PARTICLES + (BITS_PER_INT-1)) / BITS_PER_INT)
  15. #define BLOBPARTICLEPOSITION(x) (g_pBlobNetworkBypass->vParticlePositions[x])
  16. #define BLOBPARTICLERADIUS(x) (g_pBlobNetworkBypass->vParticleRadii[x])
  17. #define BLOBPARTICLECLOSESTSURFDIR(x) (g_pBlobNetworkBypass->vParticleClosestSurfDir[x])
  18. #ifdef CLIENT_DLL
  19. #define BLOBPARTICLEPOS_INTERP(x) (g_BlobParticleInterpolation.vInterpolatedPositions[x])
  20. #define BLOBPARTICLERADIUS_INTERP(x) (g_BlobParticleInterpolation.vInterpolatedRadii[x])
  21. #define BLOBPARTICLECLOSESTSURFDIR_INTERP(x) (g_BlobParticleInterpolation.vInterpolatedClosestSurfDir[x])
  22. #endif
  23. struct BlobNetworkBypass_t
  24. {
  25. //these 2 ints and bitvec help us communicate which particles contain valid data
  26. uint32 iNumParticlesAllocated;
  27. uint32 iHighestIndexUsed;
  28. CBitVec<BLOB_MAX_LEVEL_PARTICLES> bCurrentlyInUse;
  29. //actual data we want to communicate using the bypass
  30. Vector vParticlePositions[BLOB_MAX_LEVEL_PARTICLES];
  31. float vParticleRadii[BLOB_MAX_LEVEL_PARTICLES];
  32. Vector vParticleClosestSurfDir[BLOB_MAX_LEVEL_PARTICLES];
  33. float fTimeDataUpdated;
  34. bool bDataUpdated;
  35. };
  36. #ifdef CLIENT_DLL
  37. struct BlobParticleInterpolation_t
  38. {
  39. Vector vInterpolatedPositions[BLOB_MAX_LEVEL_PARTICLES];
  40. float vInterpolatedRadii[BLOB_MAX_LEVEL_PARTICLES];
  41. Vector vInterpolatedClosestSurfDir[BLOB_MAX_LEVEL_PARTICLES];
  42. };
  43. extern BlobParticleInterpolation_t g_BlobParticleInterpolation;
  44. #endif
  45. extern BlobNetworkBypass_t *g_pBlobNetworkBypass;
  46. #ifndef CLIENT_DLL
  47. int AllocateBlobNetworkBypassIndex( void );
  48. void ReleaseBlobNetworkBypassIndex( int iIndex );
  49. #endif
  50. #endif // BLOB_NETWORKBYPASS_H