BaikonurLaunchPower.cpp 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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: BaikonurLaunchPower.cpp////////////////////////////////////////////////
  24. //-----------------------------------------------------------------------------
  25. //
  26. // Electronic Arts Pacific.
  27. //
  28. // Confidential Information
  29. // Copyright (C) 2002 - All Rights Reserved
  30. //
  31. //-----------------------------------------------------------------------------
  32. //
  33. // Created: November 2002
  34. //
  35. // Filename: BaikonurLaunchPower.cpp
  36. //
  37. // Author: Kris Morness
  38. //
  39. // Purpose: Triggers the beginning of the launch for the baikonur launch tower.
  40. // This is used only by script to trigger the GLA end game.
  41. //-----------------------------------------------------------------------------
  42. ///////////////////////////////////////////////////////////////////////////////
  43. #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
  44. #include "Common/Player.h"
  45. #include "Common/ThingFactory.h"
  46. #include "Common/Xfer.h"
  47. #include "GameLogic/GameLogic.h"
  48. #include "GameLogic/Object.h"
  49. #include "GameLogic/Module/BaikonurLaunchPower.h"
  50. BaikonurLaunchPowerModuleData::BaikonurLaunchPowerModuleData( void )
  51. {
  52. }
  53. // ------------------------------------------------------------------------------------------------
  54. // ------------------------------------------------------------------------------------------------
  55. /*static*/ void BaikonurLaunchPowerModuleData::buildFieldParse(MultiIniFieldParse& p)
  56. {
  57. SpecialPowerModuleData::buildFieldParse( p );
  58. static const FieldParse dataFieldParse[] =
  59. {
  60. { "DetonationObject", INI::parseAsciiString, NULL, offsetof( BaikonurLaunchPowerModuleData, m_detonationObject ) },
  61. { 0, 0, 0, 0 }
  62. };
  63. p.add(dataFieldParse);
  64. } // end buildFieldParse
  65. // ------------------------------------------------------------------------------------------------
  66. BaikonurLaunchPower::BaikonurLaunchPower( Thing *thing, const ModuleData *moduleData )
  67. : SpecialPowerModule( thing, moduleData )
  68. {
  69. }
  70. // ------------------------------------------------------------------------------------------------
  71. BaikonurLaunchPower::~BaikonurLaunchPower( void )
  72. {
  73. }
  74. // ------------------------------------------------------------------------------------------------
  75. void BaikonurLaunchPower::doSpecialPower( UnsignedInt commandOptions )
  76. {
  77. if (getObject()->isDisabled())
  78. return;
  79. // call the base class action cause we are *EXTENDING* functionality
  80. SpecialPowerModule::doSpecialPower( commandOptions );
  81. getObject()->setModelConditionState( MODELCONDITION_DOOR_1_OPENING );
  82. }
  83. // ------------------------------------------------------------------------------------------------
  84. void BaikonurLaunchPower::doSpecialPowerAtLocation( const Coord3D *loc, Real angle, UnsignedInt commandOptions )
  85. {
  86. if (getObject()->isDisabled())
  87. return;
  88. const BaikonurLaunchPowerModuleData *data = getBaikonurLaunchPowerModuleData();
  89. // call the base class action cause we are *EXTENDING* functionality
  90. SpecialPowerModule::doSpecialPowerAtLocation( loc, angle, commandOptions );
  91. //Create the detonation
  92. const ThingTemplate *thing = TheThingFactory->findTemplate( data->m_detonationObject );
  93. if( thing )
  94. {
  95. Object *detonation = TheThingFactory->newObject( thing, getObject()->getTeam() );
  96. if( detonation )
  97. {
  98. detonation->setPosition( loc );
  99. }
  100. }
  101. }
  102. // ------------------------------------------------------------------------------------------------
  103. /** CRC */
  104. // ------------------------------------------------------------------------------------------------
  105. void BaikonurLaunchPower::crc( Xfer *xfer )
  106. {
  107. // extend base class
  108. SpecialPowerModule::crc( xfer );
  109. } // end crc
  110. // ------------------------------------------------------------------------------------------------
  111. /** Xfer method
  112. * Version Info:
  113. * 1: Initial version */
  114. // ------------------------------------------------------------------------------------------------
  115. void BaikonurLaunchPower::xfer( Xfer *xfer )
  116. {
  117. // version
  118. XferVersion currentVersion = 1;
  119. XferVersion version = currentVersion;
  120. xfer->xferVersion( &version, currentVersion );
  121. // extend base class
  122. SpecialPowerModule::xfer( xfer );
  123. } // end xfer
  124. // ------------------------------------------------------------------------------------------------
  125. /** Load post process */
  126. // ------------------------------------------------------------------------------------------------
  127. void BaikonurLaunchPower::loadPostProcess( void )
  128. {
  129. // extend base class
  130. SpecialPowerModule::loadPostProcess();
  131. } // end loadPostProcess