ChinookAIUpdate.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. // ChinookAIUpdate.h //////////
  24. // Author: Steven Johnson, June 2002
  25. #pragma once
  26. #ifndef _ChinookAIUpdate_H_
  27. #define _ChinookAIUpdate_H_
  28. #include "GameLogic/AIStateMachine.h"
  29. #include "GameLogic/Module/SupplyTruckAIUpdate.h"
  30. //-------------------------------------------------------------------------------------------------
  31. //-------------------------------------------------------------------------------------------------
  32. //-------------------------------------------------------------------------------------------------
  33. //-------------------------------------------------------------------------------------------------
  34. //-------------------------------------------------------------------------------------------------
  35. //-------------------------------------------------------------------------------------------------
  36. //-------------------------------------------------------------------------------------------------
  37. class ChinookAIUpdateModuleData : public SupplyTruckAIUpdateModuleData
  38. {
  39. public:
  40. AsciiString m_ropeName;
  41. AsciiString m_rotorWashParticleSystem;
  42. Real m_rappelSpeed;
  43. Real m_ropeDropSpeed;
  44. Real m_ropeWidth;
  45. Real m_ropeFinalHeight;
  46. Real m_ropeWobbleLen;
  47. Real m_ropeWobbleAmp;
  48. Real m_ropeWobbleRate;
  49. RGBColor m_ropeColor;
  50. UnsignedInt m_numRopes;
  51. UnsignedInt m_perRopeDelayMin;
  52. UnsignedInt m_perRopeDelayMax;
  53. Real m_minDropHeight;
  54. Bool m_waitForRopesToDrop;
  55. Int m_upgradedSupplyBoost;
  56. ChinookAIUpdateModuleData();
  57. static void buildFieldParse(MultiIniFieldParse& p);
  58. };
  59. //-------------------------------------------------------------------------------------------------
  60. enum ChinookFlightStatus // Stored in save file, don't renumber. jba.
  61. {
  62. CHINOOK_TAKING_OFF = 0,
  63. CHINOOK_FLYING = 1,
  64. CHINOOK_DOING_COMBAT_DROP = 2,
  65. CHINOOK_LANDING = 3,
  66. CHINOOK_LANDED = 4
  67. };
  68. //-------------------------------------------------------------------------------------------------
  69. class ChinookAIUpdate : public SupplyTruckAIUpdate
  70. {
  71. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( ChinookAIUpdate, "ChinookAIUpdate" )
  72. MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA( ChinookAIUpdate, ChinookAIUpdateModuleData )
  73. public:
  74. ChinookAIUpdate( Thing *thing, const ModuleData* moduleData );
  75. // virtual destructor prototype provided by memory pool declaration
  76. virtual UpdateSleepTime update();
  77. virtual void aiDoCommand(const AICommandParms* parms);
  78. virtual Bool chooseLocomotorSet(LocomotorSetType wst);
  79. // this is present solely for some transports to override, so that they can land before
  80. // allowing people to exit...
  81. virtual AIFreeToExitType getAiFreeToExit(const Object* exiter) const;
  82. virtual Bool isAllowedToAdjustDestination() const;
  83. virtual ObjectID getBuildingToNotPathAround() const;
  84. // this is present for subclasses (eg, Chinook) to override, to
  85. // prevent supply-ferry behavior in some cases (eg, when toting passengers)
  86. virtual Bool isAvailableForSupplying() const;
  87. virtual Bool isCurrentlyFerryingSupplies() const;
  88. virtual Bool isIdle() const;
  89. const ChinookAIUpdateModuleData* friend_getData() const { return getChinookAIUpdateModuleData(); }
  90. void friend_setFlightStatus(ChinookFlightStatus a) { m_flightStatus = a; }
  91. void recordOriginalPosition( const Coord3D &pos ) { m_originalPos.set( &pos ); }
  92. const Coord3D* getOriginalPosition() const { return &m_originalPos; }
  93. Int ChinookAIUpdate::getUpgradedSupplyBoost() const;
  94. protected:
  95. virtual AIStateMachine* makeStateMachine();
  96. virtual void privateCombatDrop( Object *target, const Coord3D& pos, CommandSourceType cmdSource );
  97. virtual void privateGetRepaired( Object *repairDepot, CommandSourceType cmdSource );///< get repaired at repair depot
  98. virtual void privateAttackObject( Object *victim, Int maxShotsToFire, CommandSourceType cmdSource );///< Extension. Also tell occupants to attackObject
  99. virtual void privateAttackPosition( const Coord3D *pos, Int maxShotsToFire, CommandSourceType cmdSource );///< Extension. Also tell occupants to attackPosition
  100. virtual void privateForceAttackObject( Object *victim, Int maxShotsToFire, CommandSourceType cmdSource );///< Extension. Also tell occupants to forceAttackObject
  101. virtual void privateIdle(CommandSourceType cmdSource);
  102. void private___TellPortableStructureToAttackWithMe( Object *victim, Int maxShotsToFire, CommandSourceType cmdSource );
  103. private:
  104. void setMyState( StateID cmd, Object* target, const Coord3D* pos, CommandSourceType cmdSource );
  105. void setAirfieldForHealing(ObjectID id);
  106. AICommandParmsStorage m_pendingCommand;
  107. ChinookFlightStatus m_flightStatus;
  108. ObjectID m_airfieldForHealing;
  109. Coord3D m_originalPos;
  110. Bool m_hasPendingCommand;
  111. };
  112. #endif