DamDie.cpp 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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: DamDie.cpp ///////////////////////////////////////////////////////////////////////////////
  24. // Author: Colin Day, April 2002
  25. // Desc: The big water dam dying
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. // INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
  28. #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
  29. #include "Common/RandomValue.h"
  30. #include "Common/Xfer.h"
  31. #include "GameClient/ParticleSys.h"
  32. #include "GameClient/TerrainVisual.h"
  33. #include "GameLogic/GameLogic.h"
  34. #include "GameLogic/Object.h"
  35. #include "GameLogic/Module/AIUpdate.h"
  36. #include "GameLogic/Module/DamDie.h"
  37. ///////////////////////////////////////////////////////////////////////////////////////////////////
  38. ///////////////////////////////////////////////////////////////////////////////////////////////////
  39. ///////////////////////////////////////////////////////////////////////////////////////////////////
  40. // ------------------------------------------------------------------------------------------------
  41. // ------------------------------------------------------------------------------------------------
  42. DamDieModuleData::DamDieModuleData( void )
  43. {
  44. } // end DamDieModuleData
  45. // ------------------------------------------------------------------------------------------------
  46. // ------------------------------------------------------------------------------------------------
  47. /*static*/ void DamDieModuleData::buildFieldParse(MultiIniFieldParse& p)
  48. {
  49. DieModuleData::buildFieldParse( p );
  50. // static const FieldParse dataFieldParse[] =
  51. // {
  52. // { 0, 0, 0, 0 }
  53. // };
  54. //
  55. // p.add(dataFieldParse);
  56. } // end buildFieldParse
  57. ///////////////////////////////////////////////////////////////////////////////////////////////////
  58. ///////////////////////////////////////////////////////////////////////////////////////////////////
  59. ///////////////////////////////////////////////////////////////////////////////////////////////////
  60. // ------------------------------------------------------------------------------------------------
  61. // ------------------------------------------------------------------------------------------------
  62. DamDie::DamDie( Thing *thing, const ModuleData *moduleData )
  63. :DieModule( thing, moduleData )
  64. {
  65. } // end DamDie
  66. // ------------------------------------------------------------------------------------------------
  67. // ------------------------------------------------------------------------------------------------
  68. DamDie::~DamDie( void )
  69. {
  70. } // end ~DamDie
  71. // ------------------------------------------------------------------------------------------------
  72. // ------------------------------------------------------------------------------------------------
  73. void DamDie::onDie( const DamageInfo *damageInfo )
  74. {
  75. if (!isDieApplicable(damageInfo))
  76. return;
  77. // enable all the water wave objects on the map
  78. Object *obj;
  79. for( obj = TheGameLogic->getFirstObject(); obj; obj = obj->getNextObject() )
  80. {
  81. // only care aboue water waves
  82. if( obj->isKindOf( KINDOF_WAVEGUIDE ) == FALSE )
  83. continue;
  84. // clear any disabled status of the water wave
  85. obj->clearDisabled( DISABLED_DEFAULT );
  86. } // end for, obj
  87. } // end onDie
  88. // ------------------------------------------------------------------------------------------------
  89. /** CRC */
  90. // ------------------------------------------------------------------------------------------------
  91. void DamDie::crc( Xfer *xfer )
  92. {
  93. // extend base class
  94. DieModule::crc( xfer );
  95. } // end crc
  96. // ------------------------------------------------------------------------------------------------
  97. /** Xfer method
  98. * Version Info:
  99. * 1: Initial version */
  100. // ------------------------------------------------------------------------------------------------
  101. void DamDie::xfer( Xfer *xfer )
  102. {
  103. // version
  104. XferVersion currentVersion = 1;
  105. XferVersion version = currentVersion;
  106. xfer->xferVersion( &version, currentVersion );
  107. // extend base class
  108. DieModule::xfer( xfer );
  109. } // end xfer
  110. // ------------------------------------------------------------------------------------------------
  111. /** Load post process */
  112. // ------------------------------------------------------------------------------------------------
  113. void DamDie::loadPostProcess( void )
  114. {
  115. // extend base class
  116. DieModule::loadPostProcess();
  117. } // end loadPostProcess