PropagandaTowerBehavior.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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: PropagandaTowerBehavior.h ////////////////////////////////////////////////////////////////
  24. // Author: Colin Day, August 2002
  25. // Desc: Behavior module for PropagandaTower
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #pragma once
  28. #ifndef __PROPAGANDA_TOWER_BEHAVIOR_H_
  29. #define __PROPAGANDA_TOWER_BEHAVIOR_H_
  30. // INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
  31. #include "GameLogic/Module/BehaviorModule.h"
  32. #include "GameLogic/Module/PropagandaTowerBehavior.h"
  33. #include "GameLogic/Module/UpdateModule.h"
  34. #include "GameLogic/Module/DieModule.h"
  35. // FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
  36. class ObjectTracker;
  37. class FXList;
  38. class UpgradeTemplate;
  39. // ------------------------------------------------------------------------------------------------
  40. // ------------------------------------------------------------------------------------------------
  41. class PropagandaTowerBehaviorModuleData: public UpdateModuleData
  42. {
  43. public:
  44. PropagandaTowerBehaviorModuleData( void );
  45. static void buildFieldParse( MultiIniFieldParse &p );
  46. Real m_scanRadius; ///< radius of our scan
  47. UnsignedInt m_scanDelayInFrames; ///< how frequently we do an update scan
  48. Real m_autoHealPercentPerSecond; ///< how much % of max health we heal per second
  49. const FXList *m_pulseFX; ///< FXList to play when scan is updated
  50. AsciiString m_upgradeRequired; ///< Upgrade required to use the upgraded pulse FX
  51. Real m_upgradedAutoHealPercentPerSecond; ///< Different percent to use for healing if upgraded too
  52. const FXList *m_upgradedPulseFX; ///< FXList to play for pulse when upgraded
  53. Bool m_affectsSelf; ///< Allow effect to affect ourselves
  54. };
  55. // ------------------------------------------------------------------------------------------------
  56. // ------------------------------------------------------------------------------------------------
  57. class PropagandaTowerBehavior : public UpdateModule,
  58. public DieModuleInterface
  59. {
  60. MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA( PropagandaTowerBehavior, PropagandaTowerBehaviorModuleData );
  61. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( PropagandaTowerBehavior, "PropagandaTowerBehavior" )
  62. public:
  63. PropagandaTowerBehavior( Thing *thing, const ModuleData *modData );
  64. // virtual destructor prototype provided by MemoryPoolObject
  65. // module methods
  66. static Int getInterfaceMask() { return UpdateModule::getInterfaceMask() | (MODULEINTERFACE_DIE); }
  67. virtual void onDelete( void );
  68. void onObjectCreated( void );
  69. // update module methods
  70. virtual UpdateSleepTime update( void );
  71. // die module methods
  72. virtual DieModuleInterface *getDie( void ) { return this; }
  73. virtual void onDie( const DamageInfo *damageInfo );
  74. virtual void onCapture( Player *oldOwner, Player *newOwner );
  75. // Disabled conditions to process. Need to process when disabled, because our update needs to actively let go
  76. // of our effect on people. We don't say "Be affected for n frames", we toggle people. We need to process
  77. // so we can toggle everyone off.
  78. virtual DisabledMaskType getDisabledTypesToProcess() const { return DISABLEDMASK_ALL; }
  79. // our own public module methods
  80. protected:
  81. virtual void removeAllInfluence( void ); ///< remove any influence we had on all objects we've affected
  82. virtual void doScan( void ); ///< do a scan
  83. virtual void effectLogic( Object *obj, Bool giving,
  84. const PropagandaTowerBehaviorModuleData *modData);///< give/remove effect on object
  85. UnsignedInt m_lastScanFrame; ///< last frame we did a scan on
  86. ObjectTracker *m_insideList; ///< objects that are inside our area of influence
  87. const UpgradeTemplate *m_upgradeRequired; ///< Upgrade required to use the upgraded pulse FX
  88. };
  89. #endif // end __PROPAGANDA_TOWER_BEHAVIOR_H_