AnimatedParticleSysBoneClientUpdate.cpp 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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: AnimatedParticleSysBoneClientUpdate.cpp //////////////////////////////////////////////////////////////////
  24. // Author: Mark Lorenzen, October 2002
  25. // Desc: client update module to translate particle systems with animation
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. // INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
  28. #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
  29. #include "GameClient/Drawable.h"
  30. #include "GameClient/Module/AnimatedParticleSysBoneClientUpdate.h"
  31. #include "Common/Player.h"
  32. #include "Common/PlayerList.h"
  33. #include "Common/ThingFactory.h"
  34. #include "Common/ThingTemplate.h"
  35. #include "Common/RandomValue.h"
  36. #include "Common/DrawModule.h"
  37. #include "Common/PerfTimer.h"
  38. #include "Common/Xfer.h"
  39. #include "GameLogic/Object.h"
  40. #include "GameLogic/ScriptEngine.h"
  41. //-------------------------------------------------------------------------------------------------
  42. //-------------------------------------------------------------------------------------------------
  43. AnimatedParticleSysBoneClientUpdate::AnimatedParticleSysBoneClientUpdate( Thing *thing, const ModuleData* moduleData ) :
  44. ClientUpdateModule( thing, moduleData )
  45. {
  46. m_life = 0;
  47. }
  48. //-------------------------------------------------------------------------------------------------
  49. //-------------------------------------------------------------------------------------------------
  50. AnimatedParticleSysBoneClientUpdate::~AnimatedParticleSysBoneClientUpdate( void )
  51. {
  52. }
  53. //-------------------------------------------------------------------------------------------------
  54. /** The client update callback. */
  55. //-------------------------------------------------------------------------------------------------
  56. void AnimatedParticleSysBoneClientUpdate::clientUpdate( void )
  57. {
  58. //THIS IS HAPPENING CLIENT-SIDE
  59. // I CAN DO WHAT I NEED HERE AND NOT HAVE TO BE LOGIC SYNC-SAFE
  60. ++m_life;
  61. Drawable *draw = getDrawable();
  62. if (draw)
  63. {
  64. for (DrawModule** dm = draw->getDrawModules(); *dm; ++dm)
  65. {
  66. ObjectDrawInterface* di = (*dm)->getObjectDrawInterface();
  67. if (di)
  68. {
  69. if (di->updateBonesForClientParticleSystems())
  70. break;
  71. }
  72. }
  73. }
  74. }
  75. // ------------------------------------------------------------------------------------------------
  76. /** CRC */
  77. // ------------------------------------------------------------------------------------------------
  78. void AnimatedParticleSysBoneClientUpdate::crc( Xfer *xfer )
  79. {
  80. // extend base class
  81. ClientUpdateModule::crc( xfer );
  82. } // end crc
  83. // ------------------------------------------------------------------------------------------------
  84. /** Xfer method
  85. * Version Info:
  86. * 1: Initial version */
  87. // ------------------------------------------------------------------------------------------------
  88. void AnimatedParticleSysBoneClientUpdate::xfer( Xfer *xfer )
  89. {
  90. // version
  91. XferVersion currentVersion = 1;
  92. XferVersion version = currentVersion;
  93. xfer->xferVersion( &version, currentVersion );
  94. // extend base class
  95. ClientUpdateModule::xfer( xfer );
  96. } // end xfer
  97. // ------------------------------------------------------------------------------------------------
  98. /** Load post process */
  99. // ------------------------------------------------------------------------------------------------
  100. void AnimatedParticleSysBoneClientUpdate::loadPostProcess( void )
  101. {
  102. // extend base class
  103. ClientUpdateModule::loadPostProcess();
  104. } // end loadPostProcess