LaserUpdate.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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: LaserUpdate.h //////////////////////////////////////////////////////////////////////////
  24. // Author: Kris Morness, July 2002
  25. // Desc: Handles laser update processing for render purposes and game control.
  26. // Modifications: Kris Morness - Oct 2002 -- moved to Client update (will rename later)
  27. ///////////////////////////////////////////////////////////////////////////////////////////////////
  28. #pragma once
  29. #ifndef __LASER_UPDATE_H
  30. #define __LASER_UPDATE_H
  31. // INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
  32. #include "Common/ClientUpdateModule.h"
  33. // FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
  34. class Thing;
  35. class Vector3;
  36. enum ParticleSystemID;
  37. //-------------------------------------------------------------------------------------------------
  38. //-------------------------------------------------------------------------------------------------
  39. class LaserUpdateModuleData : public ClientUpdateModuleData
  40. {
  41. public:
  42. AsciiString m_particleSystemName; ///< Used for the muzzle flare while laser active.
  43. AsciiString m_targetParticleSystemName; ///< Used for the target effect while laser active.
  44. Real m_punchThroughScalar; ///< If non-zero, length modifier when we used to have a target object and now don't
  45. LaserUpdateModuleData();
  46. static void buildFieldParse(MultiIniFieldParse& p);
  47. private:
  48. };
  49. //-------------------------------------------------------------------------------------------------
  50. /** The default update module */
  51. //-------------------------------------------------------------------------------------------------
  52. class LaserUpdate : public ClientUpdateModule
  53. {
  54. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( LaserUpdate, "LaserUpdate" )
  55. MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA( LaserUpdate, LaserUpdateModuleData );
  56. public:
  57. LaserUpdate( Thing *thing, const ModuleData* moduleData );
  58. // virtual destructor prototype provided by memory pool declaration
  59. //Actually puts the laser in the world.
  60. void initLaser( const Object *parent, const Object *target, const Coord3D *startPos, const Coord3D *endPos, AsciiString parentBoneName, Int sizeDeltaFrames = 0 );
  61. void setDecayFrames( UnsignedInt decayFrames );
  62. const Coord3D* getStartPos() { return &m_startPos; }
  63. const Coord3D* getEndPos() { return &m_endPos; }
  64. Real getCurrentLaserRadius() const;
  65. void setDirty( Bool dirty ) { m_dirty = dirty; }
  66. Bool isDirty() { return m_dirty; }
  67. Real getWidthScale() const { return m_currentWidthScalar; }
  68. virtual void clientUpdate();
  69. protected:
  70. void updateStartPos(); ///< figures out and sets startPos
  71. void updateEndPos(); ///< figures out and sets endPos
  72. //If the master dies, so will this laser (although if it has a fade delay, it'll just skip to the fade)
  73. Coord3D m_startPos;
  74. Coord3D m_endPos;
  75. DrawableID m_parentID;
  76. DrawableID m_targetID;
  77. Bool m_dirty;
  78. ParticleSystemID m_particleSystemID;
  79. ParticleSystemID m_targetParticleSystemID;
  80. Bool m_widening;
  81. Bool m_decaying;
  82. UnsignedInt m_widenStartFrame;
  83. UnsignedInt m_widenFinishFrame;
  84. Real m_currentWidthScalar;
  85. UnsignedInt m_decayStartFrame;
  86. UnsignedInt m_decayFinishFrame;
  87. AsciiString m_parentBoneName;
  88. };
  89. #endif