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.

136 lines
3.5 KiB

  1. //========= Copyright 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. int m_fFlags;
  43. PMaterialHandle m_Material_Smoke;
  44. PMaterialHandle m_Material_Embers[2];
  45. PMaterialHandle m_Material_FireCloud;
  46. };
  47. //Singleton accessor
  48. extern C_BaseExplosionEffect &BaseExplosionEffect( void );
  49. //
  50. // CExplosionOverlay
  51. //
  52. class CExplosionOverlay : public CWarpOverlay
  53. {
  54. public:
  55. virtual bool Update( void );
  56. public:
  57. float m_flLifetime;
  58. Vector m_vBaseColors[MAX_SUN_LAYERS];
  59. };
  60. //-----------------------------------------------------------------------------
  61. // Purpose: Water explosion
  62. //-----------------------------------------------------------------------------
  63. class C_WaterExplosionEffect : public C_BaseExplosionEffect
  64. {
  65. typedef C_BaseExplosionEffect BaseClass;
  66. public:
  67. static C_WaterExplosionEffect &Instance( void ) { return m_waterinstance; }
  68. virtual void Create( const Vector &position, float force, float scale, int flags );
  69. protected:
  70. virtual void CreateCore( void );
  71. virtual void CreateDebris( void );
  72. virtual void CreateMisc( void );
  73. virtual void PlaySound( void );
  74. private:
  75. Vector m_vecWaterSurface;
  76. float m_flDepth; // Depth below the water surface (used for surface effect)
  77. Vector m_vecColor; // Lighting tint information
  78. float m_flLuminosity; // Luminosity information
  79. static C_WaterExplosionEffect m_waterinstance;
  80. };
  81. //Singleton accessor
  82. extern C_WaterExplosionEffect &WaterExplosionEffect( void );
  83. //-----------------------------------------------------------------------------
  84. // Purpose: Water explosion
  85. //-----------------------------------------------------------------------------
  86. class C_MegaBombExplosionEffect : public C_BaseExplosionEffect
  87. {
  88. typedef C_BaseExplosionEffect BaseClass;
  89. public:
  90. static C_MegaBombExplosionEffect &Instance( void ) { return m_megainstance; }
  91. protected:
  92. virtual void CreateCore( void );
  93. virtual void CreateDebris( void ) { };
  94. virtual void CreateMisc( void ) { };
  95. virtual void PlaySound( void ) { };
  96. private:
  97. static C_MegaBombExplosionEffect m_megainstance;
  98. };
  99. //Singleton accessor
  100. extern C_MegaBombExplosionEffect &MegaBombExplosionEffect( void );
  101. #endif // FX_EXPLOSION_H