RiderChangeContain.h 4.5 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: RiderChangeContain.cpp //////////////////////////////////////////////////////////////////////
  24. // Author: Kris Morness, May 2003
  25. // Desc: Contain module for the combat bike (transport that switches units).
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #pragma once
  28. #ifndef __RIDER_CHANGE_CONTAIN_H
  29. #define __RIDER_CHANGE_CONTAIN_H
  30. // USER INCLUDES //////////////////////////////////////////////////////////////////////////////////
  31. #include "GameLogic/Module/TransportContain.h"
  32. #define MAX_RIDERS 8 //***NOTE: If you change this, make sure you update the parsing section!
  33. enum WeaponSetType;
  34. enum ObjectStatusType;
  35. enum LocomotorSetType;
  36. struct RiderInfo
  37. {
  38. AsciiString m_templateName;
  39. WeaponSetType m_weaponSetFlag;
  40. ModelConditionFlagType m_modelConditionFlagType;
  41. ObjectStatusType m_objectStatusType;
  42. AsciiString m_commandSet;
  43. LocomotorSetType m_locomotorSetType;
  44. };
  45. //-------------------------------------------------------------------------------------------------
  46. class RiderChangeContainModuleData : public TransportContainModuleData
  47. {
  48. public:
  49. RiderInfo m_riders[ MAX_RIDERS ];
  50. UnsignedInt m_scuttleFrames;
  51. ModelConditionFlagType m_scuttleState;
  52. RiderChangeContainModuleData();
  53. static void buildFieldParse(MultiIniFieldParse& p);
  54. static void parseRiderInfo( INI* ini, void *instance, void *store, const void* /*userData*/ );
  55. };
  56. //-------------------------------------------------------------------------------------------------
  57. class RiderChangeContain : public TransportContain
  58. {
  59. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( RiderChangeContain, "RiderChangeContain" )
  60. MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA( RiderChangeContain, RiderChangeContainModuleData )
  61. public:
  62. RiderChangeContain( Thing *thing, const ModuleData* moduleData );
  63. // virtual destructor prototype provided by memory pool declaration
  64. virtual Bool isValidContainerFor( const Object* obj, Bool checkCapacity) const;
  65. virtual void onCapture( Player *oldOwner, Player *newOwner ); // have to kick everyone out on capture.
  66. virtual void onContaining( Object *obj, Bool wasSelected ); ///< object now contains 'obj'
  67. virtual void onRemoving( Object *obj ); ///< object no longer contains 'obj'
  68. virtual UpdateSleepTime update(); ///< called once per frame
  69. virtual Bool isRiderChangeContain() const { return TRUE; }
  70. virtual const Object *friend_getRider() const;
  71. virtual Int getContainMax( void ) const;
  72. virtual Int getExtraSlotsInUse( void ) { return m_extraSlotsInUse; }///< Transports have the ability to carry guys how take up more than spot.
  73. 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.
  74. virtual ExitDoorType reserveDoorForExit( const ThingTemplate* objType, Object *specificObject );
  75. virtual void unreserveDoorForExit( ExitDoorType exitDoor );
  76. virtual Bool isDisplayedOnControlBar() const {return TRUE;}///< Does this container display its contents on the ControlBar?
  77. virtual Bool getContainerPipsToShow( Int& numTotal, Int& numFull );
  78. protected:
  79. // exists primarily for RiderChangeContain to override
  80. virtual void killRidersWhoAreNotFreeToExit();
  81. virtual Bool isSpecificRiderFreeToExit(Object* obj);
  82. virtual void createPayload();
  83. private:
  84. Int m_extraSlotsInUse;
  85. UnsignedInt m_frameExitNotBusy;
  86. UnsignedInt m_scuttledOnFrame;
  87. Bool m_containing; //doesn't require xfer.
  88. };
  89. #endif // __RIDER_CHANGE_CONTAIN_H