SpectreGunshipUpdate.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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: SpectreGunshipUpdate.h //////////////////////////////////////////////////////////////////////////
  24. // Author: Mark Lorenzen, April 2003
  25. // Desc: Update module to handle weapon firing of the SpectreGunship Generals special power.
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #pragma once
  28. #ifndef __SPECTRE_GUNSHIP_UPDATE_H_
  29. #define __SPECTRE_GUNSHIP_UPDATE_H_
  30. // INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
  31. #include "Common/KindOf.h"
  32. #include "GameLogic/Module/SpecialPowerUpdateModule.h"
  33. // FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
  34. class SpecialPowerModule;
  35. class ParticleSystem;
  36. class FXList;
  37. class AudioEventRTS;
  38. enum ParticleSystemID;
  39. //#define MAX_OUTER_NODES 16
  40. //#define TRACKERS
  41. //#define PUCK
  42. //-------------------------------------------------------------------------------------------------
  43. //-------------------------------------------------------------------------------------------------
  44. class SpectreGunshipUpdateModuleData : public ModuleData
  45. {
  46. public:
  47. SpecialPowerTemplate *m_specialPowerTemplate;
  48. WeaponTemplate *m_howitzerWeaponTemplate;
  49. // AsciiString m_gunshipTemplateName;
  50. AsciiString m_gattlingTemplateName;
  51. // AsciiString m_howitzerTemplateName;
  52. RadiusDecalTemplate m_attackAreaDecalTemplate;
  53. RadiusDecalTemplate m_targetingReticleDecalTemplate;
  54. UnsignedInt m_orbitFrames;
  55. UnsignedInt m_howitzerFiringRate;
  56. UnsignedInt m_howitzerFollowLag;
  57. Real m_attackAreaRadius;
  58. Real m_targetingReticleRadius;
  59. Real m_gunshipOrbitRadius;
  60. Real m_strafingIncrement;
  61. Real m_orbitInsertionSlope;
  62. Real m_randomOffsetForHowitzer;
  63. const ParticleSystemTemplate * m_gattlingStrafeFXParticleSystem;
  64. SpectreGunshipUpdateModuleData();
  65. static void buildFieldParse(MultiIniFieldParse& p);
  66. private:
  67. };
  68. enum GunshipStatus
  69. {
  70. GUNSHIP_STATUS_INSERTING,
  71. GUNSHIP_STATUS_ORBITING,
  72. GUNSHIP_STATUS_DEPARTING,
  73. GUNSHIP_STATUS_IDLE,
  74. };
  75. //-------------------------------------------------------------------------------------------------
  76. /** The default update module */
  77. //-------------------------------------------------------------------------------------------------
  78. class SpectreGunshipUpdate : public SpecialPowerUpdateModule
  79. {
  80. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( SpectreGunshipUpdate, "SpectreGunshipUpdate" )
  81. MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA( SpectreGunshipUpdate, SpectreGunshipUpdateModuleData );
  82. public:
  83. SpectreGunshipUpdate( Thing *thing, const ModuleData* moduleData );
  84. // virtual destructor prototype provided by memory pool declaration
  85. // SpecialPowerUpdateInterface
  86. virtual Bool initiateIntentToDoSpecialPower(const SpecialPowerTemplate *specialPowerTemplate, const Object *targetObj, const Coord3D *targetPos, const Waypoint *way, UnsignedInt commandOptions );
  87. virtual Bool isSpecialAbility() const { return false; }
  88. virtual Bool isSpecialPower() const { return true; }
  89. virtual Bool isActive() const {return m_status < GUNSHIP_STATUS_DEPARTING;}
  90. virtual SpecialPowerUpdateInterface* getSpecialPowerUpdateInterface() { return this; }
  91. virtual CommandOption getCommandOption() const { return (CommandOption)0; }
  92. virtual Bool isPowerCurrentlyInUse( const CommandButton *command = NULL ) const;
  93. virtual void onObjectCreated();
  94. virtual UpdateSleepTime update();
  95. void cleanUp();
  96. virtual Bool doesSpecialPowerHaveOverridableDestinationActive() const;
  97. virtual Bool doesSpecialPowerHaveOverridableDestination() const { return true; } //Does it have it, even if it's not active?
  98. virtual void setSpecialPowerOverridableDestination( const Coord3D *loc );
  99. // Disabled conditions to process (termination conditions!)
  100. virtual DisabledMaskType getDisabledTypesToProcess() const { return MAKE_DISABLED_MASK4( DISABLED_SUBDUED, DISABLED_UNDERPOWERED, DISABLED_EMP, DISABLED_HACKED ); }
  101. protected:
  102. void setLogicalStatus( GunshipStatus newStatus ) { m_status = newStatus; }
  103. void disengageAndDepartAO( Object *gunship );
  104. Bool isPointOffMap( const Coord3D& testPos ) const;
  105. Bool isFairDistanceFromShip( Object *target );
  106. SpecialPowerModuleInterface* m_specialPowerModule;
  107. void friend_enableAfterburners(Bool v);
  108. Coord3D m_initialTargetPosition;
  109. Coord3D m_overrideTargetDestination;
  110. Coord3D m_satellitePosition;
  111. Coord3D m_gattlingTargetPosition;
  112. Coord3D m_positionToShootAt;
  113. GunshipStatus m_status;
  114. UnsignedInt m_okToFireHowitzerCounter;
  115. UnsignedInt m_orbitEscapeFrame;
  116. // ObjectID m_howitzerID;
  117. ObjectID m_gattlingID;
  118. RadiusDecal m_attackAreaDecal;
  119. RadiusDecal m_targetingReticleDecal;
  120. #if defined TRACKERS
  121. RadiusDecal m_howitzerTrackerDecal;
  122. #endif
  123. AudioEventRTS m_afterburnerSound;
  124. AudioEventRTS m_howitzerFireSound;
  125. };
  126. #endif // __SPECTRE_GUNSHIP_UPDATE_H_