ParachuteContain.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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: ParachuteContain.h ////////////////////////////////////////////////////////////////////////
  24. // Author: Steven Johnson, March 2002
  25. // Desc: Contain module for transport units.
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #pragma once
  28. #ifndef __ParachuteContain_H_
  29. #define __ParachuteContain_H_
  30. // USER INCLUDES //////////////////////////////////////////////////////////////////////////////////
  31. #include "GameLogic/Module/OpenContain.h"
  32. //-------------------------------------------------------------------------------------------------
  33. class ParachuteContainModuleData : public OpenContainModuleData
  34. {
  35. public:
  36. Real m_pitchRateMax;
  37. Real m_rollRateMax;
  38. Real m_lowAltitudeDamping;
  39. Real m_paraOpenDist; ///< deploy the parachute when we have traveled this far
  40. Real m_freeFallDamagePercent;
  41. Real m_killWhenLandingInWaterSlop;
  42. AudioEventRTS m_parachuteOpenSound;
  43. ParachuteContainModuleData();
  44. static void buildFieldParse(MultiIniFieldParse& p);
  45. };
  46. //-------------------------------------------------------------------------------------------------
  47. class ParachuteContain : public OpenContain
  48. {
  49. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( ParachuteContain, "ParachuteContain" )
  50. MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA( ParachuteContain, ParachuteContainModuleData )
  51. public:
  52. ParachuteContain( Thing *thing, const ModuleData* moduleData );
  53. // virtual destructor prototype provided by memory pool declaration
  54. virtual void onDrawableBoundToObject();
  55. virtual Bool isValidContainerFor( const Object* obj, bool checkCapacity) const;
  56. virtual Bool isEnclosingContainerFor( const Object *obj ) const { return FALSE; } ///< Does this type of Contain Visibly enclose its contents?
  57. virtual Bool isSpecialZeroSlotContainer() const { return true; }
  58. virtual void onContaining( Object *obj, Bool wasSelected ); ///< object now contains 'obj'
  59. virtual void onRemoving( Object *obj ); ///< object no longer contains 'obj'
  60. virtual UpdateSleepTime update(); ///< called once per frame
  61. virtual void containReactToTransformChange();
  62. virtual void onCollide( Object *other, const Coord3D *loc, const Coord3D *normal );
  63. virtual void onDie( const DamageInfo * damageInfo );
  64. virtual void setOverrideDestination( const Coord3D *override ); ///< Instead of falling peacefully towards a clear spot, I will now aim here
  65. protected:
  66. virtual Bool isFullyEnclosingContainer() const { return false; }
  67. virtual void positionContainedObjectsRelativeToContainer();
  68. private:
  69. void positionRider(Object* obj);
  70. void updateBonePositions();
  71. void updateOffsetsFromBones();
  72. void calcSwayMtx(const Coord3D* offset, Matrix3D* mtx);
  73. void setSwayMatrices();
  74. Real m_pitch;
  75. Real m_roll;
  76. Real m_pitchRate;
  77. Real m_rollRate;
  78. Real m_startZ;
  79. Bool m_isLandingOverrideSet;
  80. Coord3D m_landingOverride;
  81. Coord3D m_riderAttachBone;
  82. Coord3D m_riderSwayBone;
  83. Coord3D m_paraAttachBone;
  84. Coord3D m_paraSwayBone;
  85. Coord3D m_riderAttachOffset;
  86. Coord3D m_riderSwayOffset;
  87. Coord3D m_paraAttachOffset;
  88. Coord3D m_paraSwayOffset;
  89. Bool m_needToUpdateRiderBones;
  90. Bool m_needToUpdateParaBones;
  91. Bool m_opened;
  92. };
  93. #endif // __ParachuteContain_H_