buildingchildnode.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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/buildingchildnode.h $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 2/23/01 7:00p $*
  29. * *
  30. * $Revision:: 2 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef __BUILDINGCHILDNODE_H
  39. #define __BUILDINGCHILDNODE_H
  40. #include "node.h"
  41. #include "vector.h"
  42. #include "icons.h"
  43. #include "decophys.h"
  44. #include "buildingnode.h"
  45. ////////////////////////////////////////////////////////////////////////////
  46. // Forward declarations
  47. ////////////////////////////////////////////////////////////////////////////
  48. class PresetClass;
  49. ////////////////////////////////////////////////////////////////////////////
  50. //
  51. // BuildingChildNodeClass
  52. //
  53. ////////////////////////////////////////////////////////////////////////////
  54. class BuildingChildNodeClass : public NodeClass
  55. {
  56. public:
  57. //////////////////////////////////////////////////////////////////
  58. // Public constructors/destructors
  59. //////////////////////////////////////////////////////////////////
  60. BuildingChildNodeClass (PresetClass *preset = NULL);
  61. BuildingChildNodeClass (const BuildingChildNodeClass &src);
  62. ~BuildingChildNodeClass (void);
  63. //////////////////////////////////////////////////////////////
  64. // Public operators
  65. //////////////////////////////////////////////////////////////
  66. const BuildingChildNodeClass &operator= (const BuildingChildNodeClass &src);
  67. //////////////////////////////////////////////////////////////////
  68. // Public methods
  69. //////////////////////////////////////////////////////////////////
  70. //
  71. // BuildingChildNodeClass specific
  72. //
  73. BuildingNodeClass * Peek_Building (void) const { return Building; }
  74. void Set_Building (BuildingNodeClass *node) { Building = node; }
  75. //
  76. // From PersistClass
  77. //
  78. virtual const PersistFactoryClass & Get_Factory (void) const;
  79. //
  80. // From NodeClass
  81. //
  82. void Initialize (void);
  83. NodeClass * Clone (void) { return new BuildingChildNodeClass (*this); }
  84. NODE_TYPE Get_Type (void) const { return NODE_TYPE_BUILDING_CHILD_NODE; }
  85. int Get_Icon_Index (void) const { return BUILDING_ICON; }
  86. PhysClass * Peek_Physics_Obj (void) const { return PhysObj; }
  87. bool Is_Static (void) const { return false; }
  88. bool Show_Settings_Dialog (void) { return true; }
  89. bool Can_Be_Rotated_Freely (void) const { return true; }
  90. void On_Delete (void);
  91. NodeClass * Get_Parent_Node (void) const { return Building; }
  92. //
  93. // Notifications
  94. //
  95. void On_Rotate (void);
  96. void On_Translate (void);
  97. void On_Transform (void);
  98. //
  99. // Export methods
  100. //
  101. void Pre_Export (void);
  102. void Post_Export (void);
  103. // From PersistClass
  104. bool Save (ChunkSaveClass &csave);
  105. bool Load (ChunkLoadClass &cload);
  106. protected:
  107. //////////////////////////////////////////////////////////////////
  108. // Protected methods
  109. //////////////////////////////////////////////////////////////////
  110. bool Load_Variables (ChunkLoadClass &cload);
  111. //////////////////////////////////////////////////////////////////
  112. // Protected member data
  113. //////////////////////////////////////////////////////////////////
  114. DecorationPhysClass * PhysObj;
  115. BuildingNodeClass * Building;
  116. };
  117. //////////////////////////////////////////////////////////////////
  118. // On_Rotate
  119. //////////////////////////////////////////////////////////////////
  120. inline void
  121. BuildingChildNodeClass::On_Rotate (void)
  122. {
  123. if (Building != NULL) {
  124. Building->Update_Lines ();
  125. }
  126. NodeClass::On_Rotate ();
  127. return ;
  128. }
  129. //////////////////////////////////////////////////////////////////
  130. // On_Translate
  131. //////////////////////////////////////////////////////////////////
  132. inline void
  133. BuildingChildNodeClass::On_Translate (void)
  134. {
  135. if (Building != NULL) {
  136. Building->Update_Lines ();
  137. }
  138. NodeClass::On_Translate ();
  139. return ;
  140. }
  141. //////////////////////////////////////////////////////////////////
  142. // On_Transform
  143. //////////////////////////////////////////////////////////////////
  144. inline void
  145. BuildingChildNodeClass::On_Transform (void)
  146. {
  147. if (Building != NULL) {
  148. Building->Update_Lines ();
  149. }
  150. NodeClass::On_Transform ();
  151. return ;
  152. }
  153. #endif //__BUILDINGCHILDNODE_H