W3DGhostObject.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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: W3DGhostObject.h ////////////////////////////////////////////////////////////
  24. // Placeholder for objects that have been deleted but need to be maintained because
  25. // a player can see them fogged.
  26. // Author: Mark Wilczynski, August 2002
  27. #pragma once
  28. #ifndef _W3DGHOSTOBJECT_H_
  29. #define _W3DGHOSTOBJECT_H_
  30. #include "GameLogic/GhostObject.h"
  31. #include "Lib/BaseType.h"
  32. #include "Common/GameCommon.h"
  33. #include "GameClient/DrawableInfo.h"
  34. class Object;
  35. class W3DGhostObjectManager;
  36. class W3DRenderObjectSnapshot;
  37. class PartitionData;
  38. class W3DGhostObject: public GhostObject
  39. {
  40. friend W3DGhostObjectManager;
  41. public:
  42. W3DGhostObject();
  43. virtual ~W3DGhostObject();
  44. virtual void snapShot(int playerIndex);
  45. virtual void updateParentObject(Object *object, PartitionData *mod);
  46. virtual void freeSnapShot(int playerIndex);
  47. protected:
  48. virtual void crc( Xfer *xfer);
  49. virtual void xfer( Xfer *xfer );
  50. virtual void loadPostProcess( void );
  51. void removeParentObject(void);
  52. void restoreParentObject(void); ///< restore the original non-ghosted object to scene.
  53. void addToScene(int playerIndex);
  54. void removeFromScene(int playerIndex);
  55. void release(void); ///< used by manager to return object to free store.
  56. void getShroudStatus(int playerIndex); ///< used to get the partition manager to update ghost objects without parent objects.
  57. void freeAllSnapShots(void); ///< used to free all snapshots from all players.
  58. W3DRenderObjectSnapshot *m_parentSnapshots[MAX_PLAYER_COUNT];
  59. DrawableInfo m_drawableInfo;
  60. ///@todo this list should really be part of the device independent base class (CBD 12-3-2002)
  61. W3DGhostObject *m_nextSystem;
  62. W3DGhostObject *m_prevSystem;
  63. };
  64. class W3DGhostObjectManager : public GhostObjectManager
  65. {
  66. public:
  67. W3DGhostObjectManager();
  68. virtual ~W3DGhostObjectManager();
  69. virtual void reset(void);
  70. virtual GhostObject *addGhostObject(Object *object, PartitionData *pd);
  71. virtual void removeGhostObject(GhostObject *mod);
  72. virtual void setLocalPlayerIndex(int index);
  73. virtual void updateOrphanedObjects(int *playerIndexList, int numNonLocalPlayers);
  74. virtual void W3DGhostObjectManager::releasePartitionData(void);
  75. virtual void W3DGhostObjectManager::restorePartitionData(void);
  76. protected:
  77. virtual void crc( Xfer *xfer );
  78. virtual void xfer( Xfer *xfer );
  79. virtual void loadPostProcess( void );
  80. ///@todo this list should really be part of the device independent base class (CBD 12-3-2002)
  81. W3DGhostObject *m_freeModules;
  82. W3DGhostObject *m_usedModules;
  83. };
  84. #endif // _W3DGHOSTOBJECT_H_