OCLSpecialPower.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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: OCLSpecialPower.h ////////////////////////////////////////////////////////////////////////
  24. // Author: Colin Day, April 2002
  25. // Desc: Special powers that are driven by object creation lists
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #pragma once
  28. #ifndef __OCLSPECIALPOWER_H_
  29. #define __OCLSPECIALPOWER_H_
  30. // USER INCLUDES //////////////////////////////////////////////////////////////////////////////////
  31. #include "GameLogic/Module/SpecialPowerModule.h"
  32. #include "Common/Science.h"
  33. // FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
  34. class ObjectCreationList;
  35. enum OCLCreateLocType
  36. {
  37. CREATE_AT_EDGE_NEAR_SOURCE,
  38. CREATE_AT_EDGE_NEAR_TARGET,
  39. CREATE_AT_LOCATION,
  40. USE_OWNER_OBJECT,
  41. CREATE_ABOVE_LOCATION,
  42. CREATE_AT_EDGE_FARTHEST_FROM_TARGET,
  43. };
  44. //-------------------------------------------------------------------------------------------------
  45. //-------------------------------------------------------------------------------------------------
  46. class OCLSpecialPowerModuleData : public SpecialPowerModuleData
  47. {
  48. public:
  49. struct Upgrades
  50. {
  51. ScienceType m_science;
  52. const ObjectCreationList* m_ocl;
  53. Upgrades() : m_science(SCIENCE_INVALID), m_ocl(NULL)
  54. {
  55. }
  56. };
  57. std::vector<Upgrades> m_upgradeOCL;
  58. const ObjectCreationList* m_defaultOCL;
  59. OCLCreateLocType m_createLoc;
  60. Bool m_isOCLAdjustPositionToPassable; ///< Adjust target to nearest Passable cell
  61. //We need to know what the final product is going to be for script placement calculations
  62. //for construction sites like the sneak attack.
  63. AsciiString m_referenceThingName;
  64. OCLSpecialPowerModuleData( void );
  65. static void buildFieldParse(MultiIniFieldParse& p);
  66. };
  67. //-------------------------------------------------------------------------------------------------
  68. //-------------------------------------------------------------------------------------------------
  69. class OCLSpecialPower : public SpecialPowerModule
  70. {
  71. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( OCLSpecialPower, "OCLSpecialPower" )
  72. MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA( OCLSpecialPower, OCLSpecialPowerModuleData )
  73. public:
  74. OCLSpecialPower( Thing *thing, const ModuleData* moduleData );
  75. // virtual destructor prototype provided by memory pool object
  76. virtual void doSpecialPower( UnsignedInt commandOptions );
  77. virtual void doSpecialPowerAtObject( Object *obj, UnsignedInt commandOptions );
  78. virtual void doSpecialPowerAtLocation( const Coord3D *loc, Real angle, UnsignedInt commandOptions );
  79. //If the special power launches a construction site, we need to know the final product for placement purposes.
  80. virtual const ThingTemplate* getReferenceThingTemplate() const;
  81. protected:
  82. const ObjectCreationList* findOCL() const;
  83. };
  84. #endif // end __OCLSPECIALPOWER_H_