GhostObject.cpp 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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 GhostObject.cpp ///////////////////////////////////////////////////////////////////////////
  24. // Simple base object
  25. // Author: Michael S. Booth, October 2000
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
  28. #include "Common/Xfer.h"
  29. #include "GameLogic/GameLogic.h"
  30. #include "GameLogic/GhostObject.h"
  31. #include "GameLogic/Object.h"
  32. GhostObjectManager *TheGhostObjectManager=NULL;
  33. //-------------------------------------------------------------------------------------------------
  34. //-------------------------------------------------------------------------------------------------
  35. GhostObject::GhostObject(void):
  36. //Added By Sadullah Nader
  37. //Initializations missing and needed
  38. m_parentAngle(0.0f),
  39. m_parentGeometryIsSmall(0.0f),
  40. m_parentGeometryMajorRadius(0.0f),
  41. m_parentGeometryminorRadius(0.0f),
  42. m_parentObject(NULL),
  43. m_partitionData(NULL)
  44. {
  45. m_parentPosition.zero();
  46. // End Initializations
  47. } // end Object
  48. // ------------------------------------------------------------------------------------------------
  49. // ------------------------------------------------------------------------------------------------
  50. GhostObject::~GhostObject()
  51. {
  52. }
  53. // ------------------------------------------------------------------------------------------------
  54. /** CRC */
  55. // ------------------------------------------------------------------------------------------------
  56. void GhostObject::crc( Xfer *xfer )
  57. {
  58. } // end crc
  59. // ------------------------------------------------------------------------------------------------
  60. /** Xfer Method
  61. * Version Info:
  62. * 1: Initial version */
  63. // ------------------------------------------------------------------------------------------------
  64. void GhostObject::xfer( Xfer *xfer )
  65. {
  66. // version
  67. XferVersion currentVersion = 1;
  68. XferVersion version = currentVersion;
  69. xfer->xferVersion( &version, currentVersion );
  70. // parent object
  71. ObjectID parentObjectID = INVALID_ID;
  72. if( m_parentObject )
  73. parentObjectID = m_parentObject->getID();
  74. xfer->xferObjectID( &parentObjectID );
  75. if( xfer->getXferMode() == XFER_LOAD )
  76. {
  77. // tie up parent object pointer
  78. m_parentObject = TheGameLogic->findObjectByID( parentObjectID );
  79. // sanity
  80. if( parentObjectID != INVALID_ID && m_parentObject == NULL )
  81. {
  82. DEBUG_CRASH(( "GhostObject::xfer - Unable to connect m_parentObject\n" ));
  83. throw INI_INVALID_DATA;
  84. } // end if
  85. } // end if
  86. // parent geometry type
  87. xfer->xferUser( &m_parentGeometryType, sizeof( GeometryType ) );
  88. // parent geometry is small
  89. xfer->xferBool( &m_parentGeometryIsSmall );
  90. // parent geometry major radius
  91. xfer->xferReal( &m_parentGeometryMajorRadius );
  92. // parent geometry minor radius
  93. xfer->xferReal( &m_parentGeometryminorRadius );
  94. // parent angle
  95. xfer->xferReal( &m_parentAngle );
  96. // parent position
  97. xfer->xferCoord3D( &m_parentPosition );
  98. // partition data
  99. ///@todo write me ---> !!!!!
  100. // PartitionData *m_partitionData; ///< our PartitionData
  101. } // end xfer
  102. // ------------------------------------------------------------------------------------------------
  103. /** Load post process */
  104. // ------------------------------------------------------------------------------------------------
  105. void GhostObject::loadPostProcess( void )
  106. {
  107. } // end loadPostProcess
  108. // ------------------------------------------------------------------------------------------------
  109. // ------------------------------------------------------------------------------------------------
  110. GhostObjectManager::GhostObjectManager(void)
  111. {
  112. m_lockGhostObjects = FALSE;
  113. m_saveLockGhostObjects = FALSE;
  114. m_localPlayer = 0;
  115. }
  116. // ------------------------------------------------------------------------------------------------
  117. // ------------------------------------------------------------------------------------------------
  118. GhostObjectManager::~GhostObjectManager()
  119. {
  120. }
  121. // ------------------------------------------------------------------------------------------------
  122. // ------------------------------------------------------------------------------------------------
  123. void GhostObjectManager::reset(void)
  124. {
  125. }
  126. // ------------------------------------------------------------------------------------------------
  127. // ------------------------------------------------------------------------------------------------
  128. GhostObject *GhostObjectManager::addGhostObject(Object *object, PartitionData *pd)
  129. {
  130. return 0;
  131. }
  132. // ------------------------------------------------------------------------------------------------
  133. // ------------------------------------------------------------------------------------------------
  134. void GhostObjectManager::removeGhostObject(GhostObject *mod)
  135. {
  136. }
  137. // ------------------------------------------------------------------------------------------------
  138. // ------------------------------------------------------------------------------------------------
  139. void GhostObjectManager::updateOrphanedObjects(int *playerIndexList, int numNonLocalPlayers)
  140. {
  141. }
  142. // ------------------------------------------------------------------------------------------------
  143. // ------------------------------------------------------------------------------------------------
  144. void GhostObjectManager::releasePartitionData(void)
  145. {
  146. }
  147. // ------------------------------------------------------------------------------------------------
  148. // ------------------------------------------------------------------------------------------------
  149. void GhostObjectManager::restorePartitionData(void)
  150. {
  151. }
  152. // ------------------------------------------------------------------------------------------------
  153. // ------------------------------------------------------------------------------------------------
  154. void GhostObjectManager::crc( Xfer *xfer )
  155. {
  156. } // end crc
  157. // ------------------------------------------------------------------------------------------------
  158. /** Xfer Method:
  159. * Version Info:
  160. * 1: Initial version */
  161. // ------------------------------------------------------------------------------------------------
  162. void GhostObjectManager::xfer( Xfer *xfer )
  163. {
  164. // version
  165. XferVersion currentVersion = 1;
  166. XferVersion version = currentVersion;
  167. xfer->xferVersion( &version, currentVersion );
  168. // local player
  169. xfer->xferInt( &m_localPlayer );
  170. } // end xfer
  171. // ------------------------------------------------------------------------------------------------
  172. /** Load post process */
  173. // ------------------------------------------------------------------------------------------------
  174. void GhostObjectManager::loadPostProcess( void )
  175. {
  176. } // end loadPostProcess