HelicopterSlowDeathUpdate.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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: HelicopterSlowDeathUpdate.h //////////////////////////////////////////////////////////////
  24. // Author: Colin Day, March 2002
  25. // Desc: Helicoptor slow deaths
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #pragma once
  28. #ifndef __HelicopterSlowDeathBehavior_H_
  29. #define __HelicopterSlowDeathBehavior_H_
  30. // USER INCLUDES //////////////////////////////////////////////////////////////////////////////////
  31. #include "Common/AudioEventRTS.h"
  32. #include "GameLogic/Module/SlowDeathBehavior.h"
  33. // FORWARD DECLARATIONS ///////////////////////////////////////////////////////////////////////////
  34. class ParticleSystemTemplate;
  35. //-------------------------------------------------------------------------------------------------
  36. //-------------------------------------------------------------------------------------------------
  37. class HelicopterSlowDeathBehaviorModuleData : public SlowDeathBehaviorModuleData
  38. {
  39. public:
  40. HelicopterSlowDeathBehaviorModuleData( void );
  41. static void buildFieldParse(MultiIniFieldParse &p );
  42. Real m_spiralOrbitTurnRate; ///< (rads per frame) rate at which we do big circles down toward the ground
  43. Real m_spiralOrbitForwardSpeed; ///< (dist per frame) speed at which we move "forward" in the downward spiral
  44. Real m_spiralOrbitForwardSpeedDamping;///< every frame our forward speed in the orbit is adjusted by this amount
  45. Real m_minSelfSpin; ///< (rads per frame) min turning rate at which we spin around our center of gravity
  46. Real m_maxSelfSpin; ///< (rads per frame) max turning rate at which we spin around our center of gravity
  47. Real m_selfSpinUpdateDelay; ///< (frames) every this many frames we will update the self spin angle, but we'll keep it inbetween the min and max self spin
  48. Real m_selfSpinUpdateAmount; ///< (radian) when we update the self spin every SelfSpinUpdateDelay frames, we change it this much, but keep it between min and max self spin
  49. Real m_fallHowFast; ///< a fraction of gravity we use to modify the helicopert locmotor lift
  50. Real m_minBladeFlyOffDelay; ///< (frames) min frame that the blade will fly off at
  51. Real m_maxBladeFlyOffDelay; ///< (frames) max frame that the blade will fly off at
  52. const ParticleSystemTemplate *m_attachParticleSystem; ///< particle system to attach
  53. AsciiString m_attachParticleBone; ///< bone to attach particle system to
  54. Coord3D m_attachParticleLoc; ///< loc attach particle system to if bone not present
  55. AsciiString m_bladeObjectName; ///< object name of the blade piece
  56. AsciiString m_bladeBone; ///< bone name of main propeller blade
  57. const ObjectCreationList *m_oclEjectPilot; ///< OCL for ejecting pilot
  58. const FXList *m_fxBlade; ///< blade fly off event fx list
  59. const ObjectCreationList *m_oclBlade; ///< OCL at blade fly off event
  60. const FXList *m_fxHitGround; ///< fx for hitting the ground
  61. const ObjectCreationList *m_oclHitGround; ///< OCL at hit ground event
  62. const FXList *m_fxFinalBlowUp; ///< the final blow up
  63. const ObjectCreationList *m_oclFinalBlowUp;///< OCL at final blow up event
  64. Real m_delayFromGroundToFinalDeath; ///< (frames) delay from when we hit the ground to final BOOM!
  65. AsciiString m_finalRubbleObject; ///< final rubble object to create after it's ALL over
  66. Real m_maxBraking; ///< max braking we may use during death spiral
  67. // @todo propagate this up to SlowDeathBehaviorModuleData. I don't wanna do it today, cause its 4/3. jkmcd
  68. AudioEventRTS m_deathSound; ///< Sound played during death sequence.
  69. };
  70. //-------------------------------------------------------------------------------------------------
  71. //-------------------------------------------------------------------------------------------------
  72. class HelicopterSlowDeathBehavior : public SlowDeathBehavior
  73. {
  74. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( HelicopterSlowDeathBehavior, "HelicopterSlowDeathBehavior" )
  75. MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA( HelicopterSlowDeathBehavior, HelicopterSlowDeathBehaviorModuleData )
  76. public:
  77. HelicopterSlowDeathBehavior( Thing *thing, const ModuleData* moduleData );
  78. // virtual destructor prototype provided by memory pool declaration
  79. virtual void beginSlowDeath( const DamageInfo *damageInfo ); ///< begin the slow death cycle
  80. virtual UpdateSleepTime update();
  81. protected:
  82. Int m_orbitDirection; ///< -1 or +1 ... use ORBIT_DIRECTION_LEFT/RIGHT
  83. Real m_forwardAngle; /**< angle of the direction "forward" we want to move in our downspin
  84. which is independent of the actual direction angle of the object */
  85. Real m_forwardSpeed; ///< the speed we're travelling forward in our spiral orbit
  86. Real m_selfSpin; ///< rads per frame that we change our facing direction
  87. Bool m_selfSpinTowardsMax; ///< TRUE when our self spin rate is increasing towards the MaxSelfSpin
  88. UnsignedInt m_lastSelfSpinUpdateFrame; ///< frame we last updated the self spin on
  89. UnsignedInt m_bladeFlyOffFrame; ///< frame we throw the blade off at
  90. UnsignedInt m_hitGroundFrame; ///< frame we hit the ground on
  91. // @todo propagate this up to SlowDeathBehavior. I don't wanna do it today, cause its 4/3. jkmcd
  92. AudioEventRTS m_deathSound; ///< Sound played during death sequence.
  93. };
  94. #endif // end __HelicopterSlowDeathBehavior_H_