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.

98 lines
3.1 KiB

  1. //========= Copyright � 1996-2009, Valve Corporation, All rights reserved. ============//
  2. //
  3. //=============================================================================//
  4. #ifndef PAINT_STREAM_MANAGER_H
  5. #define PAINT_STREAM_MANAGER_H
  6. #include "paint_color_manager.h"
  7. #include "mempool.h"
  8. #ifdef CLIENT_DLL
  9. #include "c_baseentity.h"
  10. #include "c_paintblob.h"
  11. #else
  12. #include "baseentity.h"
  13. #include "cpaintblob.h"
  14. #endif
  15. #ifdef CLIENT_DLL
  16. class C_PaintStream;
  17. #else
  18. class CPaintStream;
  19. #endif
  20. class CBasePaintBlob;
  21. //The blob impact effects. (Only on client)
  22. struct PaintBlobImpactEffect_t
  23. {
  24. Vector vecPosition;
  25. float flTime;
  26. };
  27. enum PaintImpactEffect
  28. {
  29. PAINT_STREAM_IMPACT_EFFECT,
  30. PAINT_DRIP_IMPACT_EFFECT,
  31. PAINT_IMPACT_EFFECT_COUNT
  32. };
  33. typedef CUtlVector<PaintBlobImpactEffect_t> PaintBlobImpactEffectVector_t;
  34. typedef float TimeStamp;
  35. typedef CUtlVector<TimeStamp> TimeStampVector;
  36. typedef CUtlVectorFixedGrowable<Vector, 32> PaintImpactPositionVector;
  37. class CPaintStreamManager : public CAutoGameSystemPerFrame
  38. {
  39. public:
  40. CPaintStreamManager( char const *name );
  41. ~CPaintStreamManager();
  42. //CAutoGameSystem members
  43. virtual char const *Name() { return "PaintStreamManager"; }
  44. virtual void LevelInitPreEntity();
  45. virtual void LevelInitPostEntity();
  46. virtual void LevelShutdownPostEntity();
  47. #ifdef CLIENT_DLL
  48. virtual void Update( float frametime );
  49. #else
  50. virtual void PreClientUpdate( void );
  51. #endif
  52. void RemoveAllPaintBlobs( void );
  53. const char *GetPaintMaterialName( int type );
  54. void CreatePaintImpactParticles( const Vector &vecPosition, const Vector &vecNormal, int paintType );
  55. float PlayPaintImpactSound( const Vector &vecPosition, PaintImpactEffect impactEffect );
  56. void PlayMultiplePaintImpactSounds( TimeStampVector& channelTimeStamps, int maxChannels, const PaintImpactPositionVector& positions, PaintImpactEffect impactEffect );
  57. void QueuePaintImpactEffect( const Vector &vecPosition, const Vector &vecNormal, int paintType, PaintImpactEffect impactEffect );
  58. void AllocatePaintBlobPool( int nMaxBlobs );
  59. CPaintBlob* AllocatePaintBlob( bool bSilent = false );
  60. void FreeBlob( CPaintBlob* pBlob );
  61. private:
  62. void PaintStreamUpdate();
  63. void UpdatePaintImpactEffects( float flDeltaTime, PaintBlobImpactEffectVector_t &paintImpactEffects );
  64. bool ShouldPlayImpactEffect( const Vector& vecPosition, PaintBlobImpactEffectVector_t &paintImpactEffects, int minEffects, int maxEffects, float flDistanceThreshold );
  65. void PlayPaintImpactParticles( const Vector &vecPosition, const Vector &vecNormal, int paintType );
  66. PaintBlobImpactEffectVector_t m_PaintImpactParticles;
  67. static const char* const m_pPaintMaterialNames[PAINT_POWER_TYPE_COUNT_PLUS_NO_POWER];
  68. float PlayPaintImpactSound( const EmitSound_t& emitParams );
  69. static const char* GetPaintSoundEffectName( unsigned int impactEffect );
  70. static const char* const s_SoundEffectNames[PAINT_IMPACT_EFFECT_COUNT];
  71. CClassMemoryPool< CPaintBlob > *m_pBlobPool;
  72. };
  73. extern CPaintStreamManager PaintStreamManager;
  74. #endif //PAINT_STREAM_MANAGER_H