PointDefenseLaserUpdate.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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: PointDefenseLaserUpdate.cpp //////////////////////////////////////////////////////////////////////////
  24. // Author: Kris Morness, August 2002
  25. // Desc: Update module to handle independent targeting of point defense laser.
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #pragma once
  28. #ifndef __POINT_DEFENSE_LASER_UPDATE_H_
  29. #define __POINT_DEFENSE_LASER_UPDATE_H_
  30. // INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
  31. #include "Common/KindOf.h"
  32. #include "GameLogic/Module/UpdateModule.h"
  33. // FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
  34. class ThingTemplate;
  35. class WeaponTemplate;
  36. //-------------------------------------------------------------------------------------------------
  37. //-------------------------------------------------------------------------------------------------
  38. class PointDefenseLaserUpdateModuleData : public ModuleData
  39. {
  40. public:
  41. WeaponTemplate *m_weaponTemplate;
  42. KindOfMaskType m_primaryTargetKindOf;
  43. KindOfMaskType m_secondaryTargetKindOf;
  44. UnsignedInt m_scanFrames;
  45. Real m_scanRange;
  46. Real m_velocityFactor;
  47. PointDefenseLaserUpdateModuleData();
  48. static void buildFieldParse(MultiIniFieldParse& p);
  49. private:
  50. };
  51. //-------------------------------------------------------------------------------------------------
  52. /** The default update module */
  53. //-------------------------------------------------------------------------------------------------
  54. class PointDefenseLaserUpdate : public UpdateModule
  55. {
  56. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( PointDefenseLaserUpdate, "PointDefenseLaserUpdate" )
  57. MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA( PointDefenseLaserUpdate, PointDefenseLaserUpdateModuleData );
  58. public:
  59. PointDefenseLaserUpdate( Thing *thing, const ModuleData* moduleData );
  60. // virtual destructor prototype provided by memory pool declaration
  61. virtual void onObjectCreated();
  62. virtual UpdateSleepTime update();
  63. Object* scanClosestTarget();
  64. void fireWhenReady();
  65. protected:
  66. ObjectID m_bestTargetID;
  67. Bool m_inRange;
  68. Int m_nextScanFrames;
  69. Int m_nextShotAvailableInFrames;
  70. };
  71. #endif