TerrainSectionPersist.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*
  2. ** Command & Conquer Renegade(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. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : LevelEdit *
  23. * *
  24. * $Archive:: /Commando/Code/Tools/LevelEdit/TerrainSectionPersist.h $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 11/29/01 12:17p $*
  29. * *
  30. * $Revision:: 5 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef __TERRAIN_SECTION_PERSIST_H
  39. #define __TERRAIN_SECTION_PERSIST_H
  40. #include "bittype.h"
  41. #include "vector3.h"
  42. #include "wwstring.h"
  43. #include "vector.h"
  44. ////////////////////////////////////////////////////////////////////////////
  45. // Forward declarations
  46. ////////////////////////////////////////////////////////////////////////////
  47. class NodeClass;
  48. class ChunkSaveClass;
  49. class ChunkLoadClass;
  50. class TerrainSectionPersistClass;
  51. class TerrainNodeClass;
  52. ////////////////////////////////////////////////////////////////////////////
  53. //
  54. // TerrainSectionPersistListClass
  55. //
  56. ////////////////////////////////////////////////////////////////////////////
  57. class TerrainSectionPersistListClass : public DynamicVectorClass<TerrainSectionPersistClass *>
  58. {
  59. public:
  60. //////////////////////////////////////////////////////////////////
  61. // Public constructors/destructors
  62. //////////////////////////////////////////////////////////////////
  63. virtual ~TerrainSectionPersistListClass (void) { Free_List (); }
  64. //////////////////////////////////////////////////////////////////
  65. // Public methods
  66. //////////////////////////////////////////////////////////////////
  67. void Build_List (DynamicVectorClass<NodeClass *> &node_list);
  68. void Assign_Section_IDs (TerrainNodeClass *node);
  69. void Initialize_Virgin_Sections (void);
  70. void Free_List (void);
  71. void Save (ChunkSaveClass &csave);
  72. void Load (ChunkLoadClass &cload);
  73. private:
  74. //////////////////////////////////////////////////////////////////
  75. // Private member data
  76. //////////////////////////////////////////////////////////////////
  77. DynamicVectorClass<NodeClass *> m_VirginSections;
  78. };
  79. ////////////////////////////////////////////////////////////////////////////
  80. //
  81. // TerrainSectionPersistClass
  82. //
  83. ////////////////////////////////////////////////////////////////////////////
  84. class TerrainSectionPersistClass
  85. {
  86. public:
  87. //////////////////////////////////////////////////////////////////
  88. // Public constructors/destructors
  89. //////////////////////////////////////////////////////////////////
  90. TerrainSectionPersistClass (void);
  91. virtual ~TerrainSectionPersistClass (void);
  92. //////////////////////////////////////////////////////////////////
  93. // Public methods
  94. //////////////////////////////////////////////////////////////////
  95. //
  96. // Initialization
  97. //
  98. void Initialize (NodeClass *node);
  99. void Apply (NodeClass *node);
  100. void Initialize_Virgin_Sections (void) { m_TerrainSectionInfo.Initialize_Virgin_Sections (); }
  101. //
  102. // Save/load stuff
  103. //
  104. bool Save (ChunkSaveClass &csave);
  105. bool Load (ChunkLoadClass &cload);
  106. //
  107. // Accessors
  108. //
  109. const Vector3 & Get_Position (void) const { return m_Position; }
  110. uint32 Get_Def_ID (void) const { return m_DefinitionID; }
  111. int Get_Instance_ID (void) const { return m_InstanceID; }
  112. uint32 Get_Vis_Obj_ID (void) const { return m_VisObjectID; }
  113. uint32 Get_Vis_Sector_ID (void) const { return m_VisSectorID; }
  114. uint32 Get_Cull_Link (void) const { return m_CullLink; }
  115. const StringClass & Get_Name (void) const { return m_Name; }
  116. protected:
  117. //////////////////////////////////////////////////////////////////
  118. // Protected methods
  119. //////////////////////////////////////////////////////////////////
  120. bool Save_Variables (ChunkSaveClass &csave);
  121. bool Load_Variables (ChunkLoadClass &cload);
  122. private:
  123. //////////////////////////////////////////////////////////////////
  124. // Private member data
  125. //////////////////////////////////////////////////////////////////
  126. Vector3 m_Position;
  127. uint32 m_DefinitionID;
  128. int m_InstanceID;
  129. uint32 m_VisObjectID;
  130. uint32 m_VisSectorID;
  131. uint32 m_CullLink;
  132. StringClass m_Name;
  133. TerrainSectionPersistListClass m_TerrainSectionInfo;
  134. };
  135. #endif //__TERRAIN_SECTION_PERSIST_H