TileNode.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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/TileNode.h $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 2/08/01 10:09a $*
  29. * *
  30. * $Revision:: 16 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef __TILE_NODE_H
  39. #define __TILE_NODE_H
  40. #include "node.h"
  41. #include "vector.h"
  42. #include "icons.h"
  43. #include "staticphys.h"
  44. // Forward declarations
  45. class PresetClass;
  46. ////////////////////////////////////////////////////////////////////////////
  47. //
  48. // TileNodeClass
  49. //
  50. ////////////////////////////////////////////////////////////////////////////
  51. class TileNodeClass : public NodeClass
  52. {
  53. public:
  54. //////////////////////////////////////////////////////////////////
  55. // Public constructors/destructors
  56. //////////////////////////////////////////////////////////////////
  57. TileNodeClass (PresetClass *preset = NULL);
  58. TileNodeClass (const TileNodeClass &src);
  59. ~TileNodeClass (void);
  60. //////////////////////////////////////////////////////////////
  61. // Public operators
  62. //////////////////////////////////////////////////////////////
  63. const TileNodeClass &operator= (const TileNodeClass &src);
  64. //////////////////////////////////////////////////////////////////
  65. // Public methods
  66. //////////////////////////////////////////////////////////////////
  67. // From PersistClass
  68. virtual const PersistFactoryClass & Get_Factory (void) const;
  69. //
  70. // RTTI
  71. //
  72. TileNodeClass *As_TileNodeClass (void) { return this; }
  73. // From NodeClass
  74. void Initialize (void);
  75. NodeClass * Clone (void) { return new TileNodeClass (*this); }
  76. NODE_TYPE Get_Type (void) const { return NODE_TYPE_TILE; }
  77. int Get_Icon_Index (void) const { return TILE_ICON; }
  78. PhysClass * Peek_Physics_Obj (void) const { return m_PhysObj; }
  79. bool Is_Static (void) const { return true; }
  80. bool Can_Be_Rotated_Freely (void) const { return true; }
  81. void Set_ID (uint32 id);
  82. void Update_Cached_Vis_IDs (void);
  83. void Pre_Export (void);
  84. void Post_Export (void);
  85. //
  86. // From PersistClass
  87. //
  88. bool Save (ChunkSaveClass &csave);
  89. bool Load (ChunkLoadClass &cload);
  90. //
  91. // Notifications
  92. //
  93. void On_Rotate (void);
  94. void On_Translate (void);
  95. void On_Transform (void);
  96. protected:
  97. //////////////////////////////////////////////////////////////////
  98. // Protected methods
  99. //////////////////////////////////////////////////////////////////
  100. bool Load_Variables (ChunkLoadClass &cload);
  101. //////////////////////////////////////////////////////////////////
  102. // Protected member data
  103. //////////////////////////////////////////////////////////////////
  104. StaticPhysClass * m_PhysObj;
  105. uint32 m_VisObjectID;
  106. uint32 m_VisSectorID;
  107. };
  108. //////////////////////////////////////////////////////////////////
  109. // Set_ID
  110. //////////////////////////////////////////////////////////////////
  111. inline void
  112. TileNodeClass::Set_ID (uint32 id)
  113. {
  114. if (m_PhysObj != NULL) {
  115. m_PhysObj->Set_ID (id);
  116. }
  117. NodeClass::Set_ID (id);
  118. return ;
  119. }
  120. //////////////////////////////////////////////////////////////////
  121. // On_Rotate
  122. //////////////////////////////////////////////////////////////////
  123. inline void
  124. TileNodeClass::On_Rotate (void)
  125. {
  126. NodeClass::On_Rotate ();
  127. //
  128. // Update the cull-link index
  129. //
  130. Update_Cached_Cull_Link ();
  131. return ;
  132. }
  133. //////////////////////////////////////////////////////////////////
  134. // On_Translate
  135. //////////////////////////////////////////////////////////////////
  136. inline void
  137. TileNodeClass::On_Translate (void)
  138. {
  139. NodeClass::On_Translate ();
  140. //
  141. // Update the cull-link index
  142. //
  143. Update_Cached_Cull_Link ();
  144. return ;
  145. }
  146. //////////////////////////////////////////////////////////////////
  147. // On_Transform
  148. //////////////////////////////////////////////////////////////////
  149. inline void
  150. TileNodeClass::On_Transform (void)
  151. {
  152. NodeClass::On_Transform ();
  153. //
  154. // Update the cull-link index
  155. //
  156. Update_Cached_Cull_Link ();
  157. return ;
  158. }
  159. #endif //__TILE_NODE_H