TransportContain.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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: TransportContain.h ////////////////////////////////////////////////////////////////////////
  24. // Author: Steven Johnson, March 2002
  25. // Desc: Contain module for transport units.
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #pragma once
  28. #ifndef __TransportContain_H_
  29. #define __TransportContain_H_
  30. // USER INCLUDES //////////////////////////////////////////////////////////////////////////////////
  31. #include "GameLogic/Module/OpenContain.h"
  32. //-------------------------------------------------------------------------------------------------
  33. class TransportContainModuleData : public OpenContainModuleData
  34. {
  35. public:
  36. struct InitialPayload
  37. {
  38. AsciiString name;
  39. Int count;
  40. };
  41. Int m_slotCapacity; ///< max units that can be inside us
  42. Real m_exitPitchRate;
  43. AsciiString m_exitBone;
  44. InitialPayload m_initialPayload;
  45. Real m_healthRegen;
  46. UnsignedInt m_exitDelay;
  47. Bool m_scatterNearbyOnExit;
  48. Bool m_orientLikeContainerOnExit;
  49. Bool m_keepContainerVelocityOnExit;
  50. Bool m_goAggressiveOnExit;
  51. Bool m_armedRidersUpgradeWeaponSet;
  52. Bool m_resetMoodCheckTimeOnExit;
  53. Bool m_destroyRidersWhoAreNotFreeToExit;
  54. Bool m_isDelayExitInAir;
  55. TransportContainModuleData();
  56. static void buildFieldParse(MultiIniFieldParse& p);
  57. static void parseInitialPayload( INI* ini, void *instance, void *store, const void* /*userData*/ );
  58. };
  59. //-------------------------------------------------------------------------------------------------
  60. class TransportContain : public OpenContain
  61. {
  62. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( TransportContain, "TransportContain" )
  63. MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA( TransportContain, TransportContainModuleData )
  64. public:
  65. TransportContain( Thing *thing, const ModuleData* moduleData );
  66. // virtual destructor prototype provided by memory pool declaration
  67. virtual Bool isValidContainerFor( const Object* obj, Bool checkCapacity) const;
  68. virtual void onCapture( Player *oldOwner, Player *newOwner ); // have to kick everyone out on capture.
  69. virtual void onContaining( Object *obj, Bool wasSelected ); ///< object now contains 'obj'
  70. virtual void onRemoving( Object *obj ); ///< object no longer contains 'obj'
  71. virtual UpdateSleepTime update(); ///< called once per frame
  72. virtual Bool isRiderChangeContain() const { return FALSE; }
  73. virtual Bool isSpecialOverlordStyleContainer() const {return FALSE;}
  74. virtual Int getContainMax( void ) const;
  75. virtual Int getExtraSlotsInUse( void ) { return m_extraSlotsInUse; }///< Transports have the ability to carry guys how take up more than spot.
  76. virtual Bool isExitBusy() const; ///< Contain style exiters are getting the ability to space out exits, so ask this before reserveDoor as a kind of no-commitment check.
  77. virtual ExitDoorType reserveDoorForExit( const ThingTemplate* objType, Object *specificObject );
  78. virtual void unreserveDoorForExit( ExitDoorType exitDoor );
  79. virtual Bool isDisplayedOnControlBar() const {return TRUE;}///< Does this container display its contents on the ControlBar?
  80. protected:
  81. // exists primarily for TransportContain to override
  82. virtual void killRidersWhoAreNotFreeToExit();
  83. virtual Bool isSpecificRiderFreeToExit(Object* obj);
  84. virtual Bool isPassengerAllowedToFire( ObjectID id = INVALID_ID ) const; ///< Hey, can I shoot out of this container?
  85. virtual void createPayload();
  86. void letRidersUpgradeWeaponSet( void );
  87. Bool m_payloadCreated;
  88. private:
  89. Int m_extraSlotsInUse;
  90. UnsignedInt m_frameExitNotBusy;
  91. };
  92. #endif // __TransportContain_H_