RayEffect.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. ** Command & Conquer Generals Zero Hour(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. ////////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // FILE: RayEffect.h //////////////////////////////////////////////////////////////////////////////
  24. // Created: Colin Day, May 2001
  25. // Desc: Ray effect manager
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #pragma once
  28. #ifndef __RAYEFFECT_H_
  29. #define __RAYEFFECT_H_
  30. // INCLUDE ////////////////////////////////////////////////////////////////////////////////////////
  31. #include "Lib/BaseType.h"
  32. #include "Common/SubsystemInterface.h"
  33. // FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
  34. class Drawable;
  35. //-------------------------------------------------------------------------------------------------
  36. /** Data the ray effect system keeps for an entry */
  37. //-------------------------------------------------------------------------------------------------
  38. struct RayEffectData
  39. {
  40. const Drawable *draw; ///< the drawable
  41. Coord3D startLoc; ///< start location for ray
  42. Coord3D endLoc; ///< end location for ray
  43. }; // end RayEffectData
  44. //-------------------------------------------------------------------------------------------------
  45. /** This class maintains all the ray effects visible in the world */
  46. //-------------------------------------------------------------------------------------------------
  47. class RayEffectSystem : public SubsystemInterface
  48. {
  49. public:
  50. RayEffectSystem( void );
  51. ~RayEffectSystem( void );
  52. virtual void init( void );
  53. virtual void reset( void );
  54. virtual void update( void ) { }
  55. /// add a ray effect entry for this drawable
  56. void addRayEffect( const Drawable *draw, const Coord3D *startLoc, const Coord3D *endLoc );
  57. /// given a drawable, remove its effect from the system
  58. void deleteRayEffect( const Drawable *draw );
  59. /** given a drawable, if it is in the ray effect system list retrieve
  60. the ray effect data for its entry */
  61. void getRayEffectData( const Drawable *draw, RayEffectData *effectData );
  62. protected:
  63. /// find an effect data entry based on the drawable
  64. RayEffectData *findEntry( const Drawable *draw );
  65. enum
  66. {
  67. MAX_RAY_EFFECTS = 128
  68. };
  69. RayEffectData m_effectData[ MAX_RAY_EFFECTS ]; ///< all the ray effects
  70. }; // end RayEffectSystem
  71. // EXTERN /////////////////////////////////////////////////////////////////////////////////////////
  72. extern RayEffectSystem *TheRayEffects; ///< the ray effects singleton external
  73. #endif // $label