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.

136 lines
3.5 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef FX_EXPLOSION_H
  8. #define FX_EXPLOSION_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "particle_collision.h"
  13. #include "glow_overlay.h"
  14. //JDW: For now we're clamping this value
  15. #define EXPLOSION_FORCE_MAX 2
  16. #define EXPLOSION_FORCE_MIN 2
  17. //-----------------------------------------------------------------------------
  18. // Purpose:
  19. //-----------------------------------------------------------------------------
  20. class C_BaseExplosionEffect
  21. {
  22. private:
  23. static C_BaseExplosionEffect m_instance;
  24. public:
  25. ~C_BaseExplosionEffect( void ) {}
  26. static C_BaseExplosionEffect &Instance( void ) { return m_instance; }
  27. virtual void Create( const Vector &position, float force, float scale, int flags );
  28. protected:
  29. C_BaseExplosionEffect( void );
  30. virtual void PlaySound( void );
  31. virtual void CreateCore( void );
  32. virtual void CreateDebris( void );
  33. virtual void CreateMisc( void );
  34. virtual void CreateDynamicLight( void );
  35. float ScaleForceByDeviation( Vector &deviant, Vector &source, float spread, float *force = NULL );
  36. float Probe( const Vector &origin, Vector *direction, float strength );
  37. void GetForceDirection( const Vector &origin, float magnitude, Vector *resultDirection, float *resultForce );
  38. protected:
  39. Vector m_vecOrigin;
  40. Vector m_vecDirection;
  41. float m_flForce;
  42. float m_flScale;
  43. int m_fFlags;
  44. PMaterialHandle m_Material_Smoke;
  45. PMaterialHandle m_Material_Embers[2];
  46. PMaterialHandle m_Material_FireCloud;
  47. };
  48. //Singleton accessor
  49. extern C_BaseExplosionEffect &BaseExplosionEffect( void );
  50. //
  51. // CExplosionOverlay
  52. //
  53. class CExplosionOverlay : public CWarpOverlay
  54. {
  55. public:
  56. virtual bool Update( void );
  57. public:
  58. float m_flLifetime;
  59. Vector m_vBaseColors[MAX_SUN_LAYERS];
  60. };
  61. //-----------------------------------------------------------------------------
  62. // Purpose: Water explosion
  63. //-----------------------------------------------------------------------------
  64. class C_WaterExplosionEffect : public C_BaseExplosionEffect
  65. {
  66. typedef C_BaseExplosionEffect BaseClass;
  67. public:
  68. static C_WaterExplosionEffect &Instance( void ) { return m_waterinstance; }
  69. virtual void Create( const Vector &position, float force, float scale, int flags );
  70. protected:
  71. virtual void CreateCore( void );
  72. virtual void CreateDebris( void );
  73. virtual void CreateMisc( void );
  74. virtual void PlaySound( void );
  75. private:
  76. Vector m_vecWaterSurface;
  77. float m_flDepth; // Depth below the water surface (used for surface effect)
  78. Vector m_vecColor; // Lighting tint information
  79. float m_flLuminosity; // Luminosity information
  80. static C_WaterExplosionEffect m_waterinstance;
  81. };
  82. //Singleton accessor
  83. extern C_WaterExplosionEffect &WaterExplosionEffect( void );
  84. //-----------------------------------------------------------------------------
  85. // Purpose: Water explosion
  86. //-----------------------------------------------------------------------------
  87. class C_MegaBombExplosionEffect : public C_BaseExplosionEffect
  88. {
  89. typedef C_BaseExplosionEffect BaseClass;
  90. public:
  91. static C_MegaBombExplosionEffect &Instance( void ) { return m_megainstance; }
  92. protected:
  93. virtual void CreateCore( void );
  94. virtual void CreateDebris( void ) { };
  95. virtual void CreateMisc( void ) { };
  96. virtual void PlaySound( void ) { };
  97. private:
  98. static C_MegaBombExplosionEffect m_megainstance;
  99. };
  100. //Singleton accessor
  101. extern C_MegaBombExplosionEffect &MegaBombExplosionEffect( void );
  102. #endif // FX_EXPLOSION_H