DynamicShroudClearingRangeUpdate.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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: DynamicShroudClearingRangeUpdate.h /////////////////////////////////////////////////////////////////////////
  24. // Author: Graham Smallwood, August 2002
  25. // Desc: Changes the Objects shroud clearing range
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #pragma once
  28. #ifndef __DYNAMIC_SHROUD_RANGE_UPDATE_H_
  29. #define __DYNAMIC_SHROUD_RANGE_UPDATE_H_
  30. // INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
  31. #include "GameLogic/Module/UpdateModule.h"
  32. #include "GameClient/RadiusDecal.h"///< For the pseudo-wireframe decal effect
  33. #define GRID_FX_DECAL_COUNT (30)
  34. //-------------------------------------------------------------------------------------------------
  35. class DynamicShroudClearingRangeUpdateModuleData : public UpdateModuleData
  36. {
  37. public:
  38. UnsignedInt m_shrinkDelay; ///< wait until
  39. UnsignedInt m_shrinkTime; ///< then shrink this fast
  40. UnsignedInt m_growDelay; ///< wait until
  41. UnsignedInt m_growTime; ///< then grow this fast
  42. Real m_finalVision; ///< Then change to this
  43. UnsignedInt m_changeInterval; ///< And update my Object every this long
  44. UnsignedInt m_growInterval; ///< Update evey this long while growing
  45. Bool m_doSpySatFX; ///< Do I do the pseudo-wireframe decal and blip effects?
  46. RadiusDecalTemplate m_gridDecalTemplate;///< For the pseudo-wireframe decal effect
  47. DynamicShroudClearingRangeUpdateModuleData();
  48. static void buildFieldParse(MultiIniFieldParse& p);
  49. private:
  50. };
  51. //-------------------------------------------------------------------------------------------------
  52. //-------------------------------------------------------------------------------------------------
  53. class DynamicShroudClearingRangeUpdate : public UpdateModule
  54. {
  55. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( DynamicShroudClearingRangeUpdate, "DynamicShroudClearingRangeUpdate" )
  56. MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA( DynamicShroudClearingRangeUpdate, DynamicShroudClearingRangeUpdateModuleData )
  57. public:
  58. DynamicShroudClearingRangeUpdate( Thing *thing, const ModuleData* moduleData );
  59. // virtual destructor prototype provided by memory pool declaration
  60. virtual UpdateSleepTime update();
  61. void createGridDecals( const RadiusDecalTemplate& tmpl, Real radius, const Coord3D& pos );
  62. void killGridDecals( void );
  63. void animateGridDecals( void );
  64. protected:
  65. enum DSCRU_STATE
  66. {
  67. DSCRU_NOT_STARTED_YET,
  68. DSCRU_GROWING,
  69. DSCRU_SUSTAINING,
  70. DSCRU_SHRINKING,
  71. DSCRU_DONE_FOREVER,
  72. DSCRU_SLEEPING
  73. };
  74. DSCRU_STATE m_state;
  75. // Bool m_shrinkFinished; ///< Nothing left to do
  76. // Bool m_shrinkStarted; ///< Working it
  77. // UnsignedInt m_shrinkStartCountdown; ///< When I start to shrink
  78. // UnsignedInt m_shrinkDeadline; ///< When I am done
  79. //New Timer Parameters
  80. Int m_stateCountDown;
  81. Int m_totalFrames;
  82. UnsignedInt m_growStartDeadline;
  83. UnsignedInt m_sustainDeadline;
  84. UnsignedInt m_shrinkStartDeadline;
  85. UnsignedInt m_doneForeverFrame; ///< Just in case interval and state timing goes awry
  86. ///< This supercedes and makes us quit
  87. UnsignedInt m_changeIntervalCountdown;///< How long till I change my vision range again
  88. Bool m_decalsCreated; ///< Have I created the fx decals yet?
  89. Real m_visionChangePerInterval; ///< How much I change each time.
  90. Real m_nativeClearingRange; ///< What is my objects native vision range?
  91. Real m_currentClearingRange; ///<ToKeepTrackOfWhere We are at
  92. RadiusDecal m_gridDecal[GRID_FX_DECAL_COUNT];///< For the pseudo-wireframe decal effect
  93. };
  94. #endif