ParticleUplinkCannonUpdate.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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: ParticleUplinkCannonUpdate.h //////////////////////////////////////////////////////////////////////////
  24. // Author: Kris Morness, September 2002
  25. // Desc: Update module to handle building states and weapon firing of the particle uplink cannon.
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #pragma once
  28. #ifndef __PARTICLE_UPLINK_CANNON_UPDATE_H_
  29. #define __PARTICLE_UPLINK_CANNON_UPDATE_H_
  30. // INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
  31. #include "Common/KindOf.h"
  32. #include "Common/Science.h"
  33. #include "GameLogic/Module/SpecialPowerUpdateModule.h"
  34. // FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
  35. class SpecialPowerModule;
  36. class ParticleSystem;
  37. class FXList;
  38. class AudioEventRTS;
  39. enum ParticleSystemID;
  40. #define MAX_OUTER_NODES 16
  41. //-------------------------------------------------------------------------------------------------
  42. //-------------------------------------------------------------------------------------------------
  43. class ParticleUplinkCannonUpdateModuleData : public ModuleData
  44. {
  45. public:
  46. UnsignedInt m_beginChargeFrames;
  47. UnsignedInt m_raiseAntennaFrames;
  48. UnsignedInt m_readyDelayFrames;
  49. UnsignedInt m_widthGrowFrames;
  50. UnsignedInt m_beamTravelFrames;
  51. UnsignedInt m_totalFiringFrames;
  52. UnsignedInt m_framesBetweenLaunchFXRefresh;
  53. AsciiString m_outerEffectBaseBoneName;
  54. UnsignedInt m_outerEffectNumBones;
  55. AsciiString m_outerNodesLightFlareParticleSystemName;
  56. AsciiString m_outerNodesMediumFlareParticleSystemName;
  57. AsciiString m_outerNodesIntenseFlareParticleSystemName;
  58. AsciiString m_connectorBoneName;
  59. AsciiString m_connectorMediumLaserNameName;
  60. AsciiString m_connectorIntenseLaserNameName;
  61. AsciiString m_connectorMediumFlareParticleSystemName;
  62. AsciiString m_connectorIntenseFlareParticleSystemName;
  63. AsciiString m_laserBaseLightFlareParticleSystemName;
  64. AsciiString m_laserBaseMediumFlareParticleSystemName;
  65. AsciiString m_laserBaseIntenseFlareParticleSystemName;
  66. AsciiString m_fireBoneName;
  67. AsciiString m_particleBeamLaserName;
  68. FXList *m_groundHitFX;
  69. FXList *m_beamLaunchFX;
  70. Real m_swathOfDeathDistance;
  71. Real m_swathOfDeathAmplitude;
  72. UnsignedInt m_totalScorchMarks;
  73. Real m_scorchMarkScalar;
  74. UnsignedInt m_totalDamagePulses;
  75. Real m_damagePerSecond;
  76. DamageType m_damageType;
  77. DeathType m_deathType;
  78. Real m_damageRadiusScalar;
  79. Real m_revealRange;
  80. SpecialPowerTemplate *m_specialPowerTemplate;
  81. AsciiString m_powerupSoundName;
  82. AsciiString m_unpackToReadySoundName;
  83. AsciiString m_firingToIdleSoundName;
  84. AsciiString m_annihilationSoundName;
  85. AsciiString m_damagePulseRemnantObjectName;
  86. Real m_manualDrivingSpeed;
  87. Real m_manualFastDrivingSpeed;
  88. UnsignedInt m_doubleClickToFastDriveDelay;
  89. ParticleUplinkCannonUpdateModuleData();
  90. static void buildFieldParse(MultiIniFieldParse& p);
  91. private:
  92. };
  93. enum PUCStatus
  94. {
  95. STATUS_IDLE,
  96. STATUS_CHARGING,
  97. STATUS_PREPARING,
  98. STATUS_ALMOST_READY,
  99. STATUS_READY_TO_FIRE,
  100. STATUS_PREFIRE,
  101. STATUS_FIRING,
  102. STATUS_POSTFIRE,
  103. STATUS_PACKING,
  104. };
  105. enum LaserStatus
  106. {
  107. LASERSTATUS_NONE,
  108. LASERSTATUS_BORN,
  109. LASERSTATUS_DECAYING,
  110. LASERSTATUS_DEAD,
  111. };
  112. enum IntensityTypes
  113. {
  114. IT_LIGHT,
  115. IT_MEDIUM,
  116. IT_INTENSE,
  117. IT_FINISH,
  118. };
  119. //-------------------------------------------------------------------------------------------------
  120. /** The default update module */
  121. //-------------------------------------------------------------------------------------------------
  122. class ParticleUplinkCannonUpdate : public SpecialPowerUpdateModule
  123. {
  124. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( ParticleUplinkCannonUpdate, "ParticleUplinkCannonUpdate" )
  125. MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA( ParticleUplinkCannonUpdate, ParticleUplinkCannonUpdateModuleData );
  126. public:
  127. ParticleUplinkCannonUpdate( Thing *thing, const ModuleData* moduleData );
  128. // virtual destructor prototype provided by memory pool declaration
  129. // SpecialPowerUpdateInterface
  130. virtual Bool initiateIntentToDoSpecialPower(const SpecialPowerTemplate *specialPowerTemplate, const Object *targetObj, const Coord3D *targetPos, const Waypoint *way, UnsignedInt commandOptions );
  131. virtual Bool isSpecialAbility() const { return false; }
  132. virtual Bool isSpecialPower() const { return true; }
  133. virtual Bool isActive() const {return m_status != STATUS_IDLE;}
  134. virtual SpecialPowerUpdateInterface* getSpecialPowerUpdateInterface() { return this; }
  135. virtual CommandOption getCommandOption() const { return (CommandOption)0; }
  136. virtual Bool isPowerCurrentlyInUse( const CommandButton *command = NULL ) const;
  137. virtual ScienceType getExtraRequiredScience() const { return SCIENCE_INVALID; } //Does this object have more than one special power module with the same spTemplate?
  138. virtual void onObjectCreated();
  139. virtual UpdateSleepTime update();
  140. void removeAllEffects();
  141. void createOuterNodeParticleSystems( IntensityTypes intensity );
  142. void createConnectorLasers( IntensityTypes intensity );
  143. void createConnectorFlare( IntensityTypes intensity );
  144. void createLaserBaseFlare( IntensityTypes intensity );
  145. void createGroundToOrbitLaser( UnsignedInt growthFrames );
  146. void createOrbitToTargetLaser( UnsignedInt growthFrames );
  147. void createGroundHitParticleSystem( IntensityTypes intensity );
  148. Bool calculateDefaultInformation();
  149. Bool calculateUpBonePositions();
  150. virtual Bool doesSpecialPowerHaveOverridableDestinationActive() const; //Is it active now?
  151. virtual Bool doesSpecialPowerHaveOverridableDestination() const { return true; } //Does it have it, even if it's not active?
  152. virtual void setSpecialPowerOverridableDestination( const Coord3D *loc );
  153. // Disabled conditions to process (termination conditions!)
  154. virtual DisabledMaskType getDisabledTypesToProcess() const { return MAKE_DISABLED_MASK4( DISABLED_SUBDUED, DISABLED_UNDERPOWERED, DISABLED_EMP, DISABLED_HACKED ); }
  155. protected:
  156. void setLogicalStatus( PUCStatus status );
  157. void setClientStatus( PUCStatus status, Bool revealThisFrame );
  158. void killEverything();
  159. SpecialPowerModuleInterface* m_specialPowerModule;
  160. AudioEventRTS m_powerupSound;
  161. AudioEventRTS m_unpackToReadySound;
  162. AudioEventRTS m_firingToIdleSound;
  163. AudioEventRTS m_annihilationSound;
  164. Matrix3D m_outerNodeOrientations[ MAX_OUTER_NODES ];
  165. Coord3D m_outerNodePositions[ MAX_OUTER_NODES ];
  166. Coord3D m_connectorNodePosition;
  167. Coord3D m_laserOriginPosition;
  168. Coord3D m_initialTargetPosition;
  169. Coord3D m_currentTargetPosition;
  170. Coord3D m_overrideTargetDestination;
  171. PUCStatus m_status;
  172. LaserStatus m_laserStatus;
  173. UnsignedInt m_frames;
  174. ParticleSystemID m_outerSystemIDs[ MAX_OUTER_NODES ];
  175. DrawableID m_laserBeamIDs[ MAX_OUTER_NODES ];
  176. DrawableID m_groundToOrbitBeamID;
  177. DrawableID m_orbitToTargetBeamID;
  178. ParticleSystemID m_connectorSystemID;
  179. ParticleSystemID m_laserBaseSystemID;
  180. UnsignedInt m_scorchMarksMade;
  181. UnsignedInt m_nextScorchMarkFrame;
  182. UnsignedInt m_nextLaunchFXFrame;
  183. UnsignedInt m_damagePulsesMade;
  184. UnsignedInt m_nextDamagePulseFrame;
  185. UnsignedInt m_startAttackFrame;
  186. UnsignedInt m_startDecayFrame;
  187. UnsignedInt m_lastDrivingClickFrame;
  188. UnsignedInt m_2ndLastDrivingClickFrame;
  189. UnsignedInt m_nextDestWaypointID;
  190. Bool m_upBonesCached;
  191. Bool m_defaultInfoCached;
  192. Bool m_invalidSettings;
  193. Bool m_manualTargetMode;
  194. Bool m_scriptedWaypointMode;
  195. Bool m_clientShroudedLastFrame;
  196. };
  197. #endif