HighlanderBody.cpp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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: HighlanderBody.cpp ////////////////////////////////////////////////////////////////////////
  24. // Author: Graham Smallwood, November 2002
  25. // Desc: Takes damage according to armor, but can't die from normal damage. Can die from Unresistable though
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. // INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
  28. #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
  29. #include "Common/Xfer.h"
  30. #include "GameLogic/Module/HighlanderBody.h"
  31. // PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////////////////////////
  32. //-------------------------------------------------------------------------------------------------
  33. //-------------------------------------------------------------------------------------------------
  34. HighlanderBody::HighlanderBody( Thing *thing, const ModuleData* moduleData )
  35. : ActiveBody( thing, moduleData )
  36. {
  37. }
  38. //-------------------------------------------------------------------------------------------------
  39. //-------------------------------------------------------------------------------------------------
  40. HighlanderBody::~HighlanderBody( void )
  41. {
  42. }
  43. // ------------------------------------------------------------------------------------------------
  44. // ------------------------------------------------------------------------------------------------
  45. void HighlanderBody::attemptDamage( DamageInfo *damageInfo )
  46. {
  47. // Bind to one hitpoint remaining afterwards, unless it is Unresistable damage
  48. if( damageInfo->in.m_damageType != DAMAGE_UNRESISTABLE )
  49. damageInfo->in.m_amount = min( damageInfo->in.m_amount, getHealth() - 1 );
  50. ActiveBody::attemptDamage(damageInfo);
  51. }
  52. // ------------------------------------------------------------------------------------------------
  53. /** CRC */
  54. // ------------------------------------------------------------------------------------------------
  55. void HighlanderBody::crc( Xfer *xfer )
  56. {
  57. // extend base class
  58. ActiveBody::crc( xfer );
  59. } // end crc
  60. // ------------------------------------------------------------------------------------------------
  61. /** Xfer method
  62. * Version Info:
  63. * 1: Initial version */
  64. // ------------------------------------------------------------------------------------------------
  65. void HighlanderBody::xfer( Xfer *xfer )
  66. {
  67. // version
  68. XferVersion currentVersion = 1;
  69. XferVersion version = currentVersion;
  70. xfer->xferVersion( &version, currentVersion );
  71. // extend base class
  72. ActiveBody::xfer( xfer );
  73. } // end xfer
  74. // ------------------------------------------------------------------------------------------------
  75. /** Load post process */
  76. // ------------------------------------------------------------------------------------------------
  77. void HighlanderBody::loadPostProcess( void )
  78. {
  79. // extend base class
  80. ActiveBody::loadPostProcess();
  81. } // end loadPostProcess