ZoneNode.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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/ZoneNode.h $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 10/09/00 1:11p $*
  29. * *
  30. * $Revision:: 3 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef __ZONE_NODE_H
  39. #define __ZONE_NODE_H
  40. #include "objectnode.h"
  41. #include "icons.h"
  42. #include "spawn.h"
  43. #include "GrabHandles.h"
  44. // Forward declarations
  45. class PresetClass;
  46. class ScriptZoneGameObj;
  47. ////////////////////////////////////////////////////////////////////////////
  48. //
  49. // ZoneNodeClass
  50. //
  51. ////////////////////////////////////////////////////////////////////////////
  52. class ZoneNodeClass : public ObjectNodeClass
  53. {
  54. public:
  55. //////////////////////////////////////////////////////////////////
  56. // Public constructors/destructors
  57. //////////////////////////////////////////////////////////////////
  58. ZoneNodeClass (PresetClass *preset = NULL);
  59. ZoneNodeClass (const ZoneNodeClass &src);
  60. ~ZoneNodeClass (void);
  61. //////////////////////////////////////////////////////////////
  62. // Public operators
  63. //////////////////////////////////////////////////////////////
  64. const ZoneNodeClass &operator= (const ZoneNodeClass &src);
  65. //////////////////////////////////////////////////////////////////
  66. // Public methods
  67. //////////////////////////////////////////////////////////////////
  68. //
  69. // From PersistClass
  70. //
  71. virtual const PersistFactoryClass & Get_Factory (void) const;
  72. virtual bool Save (ChunkSaveClass &csave);
  73. virtual bool Load (ChunkLoadClass &cload);
  74. // From NodeClass
  75. NodeClass * Clone (void) { return new ZoneNodeClass (*this); }
  76. void Initialize (void);
  77. NODE_TYPE Get_Type (void) const { return NODE_TYPE_ZONE; }
  78. int Get_Icon_Index (void) const { return ZONE_ICON; }
  79. PhysClass * Peek_Physics_Obj (void) const;
  80. bool Is_Static (void) const { return false; }
  81. void Hide (bool hide);
  82. //
  83. // Scene methods
  84. //
  85. void Add_To_Scene (void);
  86. void Remove_From_Scene (void);
  87. //
  88. // Notifications
  89. //
  90. void On_Rotate (void);
  91. void On_Translate (void);
  92. void On_Transform (void);
  93. //
  94. // Export methods
  95. //
  96. void Pre_Export (void);
  97. void Post_Export (void);
  98. //
  99. // Zone edit methods
  100. //
  101. void On_Vertex_Drag_Begin (int vertex_index);
  102. void On_Vertex_Drag (int vertex_index, POINT point);
  103. //
  104. // ZoneNodeClass specific
  105. //
  106. Box3DClass * Get_Box (void);
  107. ScriptZoneGameObj * Get_Zone_Obj (void) const { return (ScriptZoneGameObj *)m_GameObj; }
  108. protected:
  109. //////////////////////////////////////////////////////////////////
  110. // Protected methods
  111. //////////////////////////////////////////////////////////////////
  112. void Update_Zone_Obj (void);
  113. private:
  114. //////////////////////////////////////////////////////////////////
  115. // Private member data
  116. //////////////////////////////////////////////////////////////////
  117. Box3DPhysClass * m_PhysObj;
  118. GrabHandlesClass m_GrabHandles;
  119. Vector3 m_FirstPoint;
  120. Vector3 m_CachedSize;
  121. };
  122. //////////////////////////////////////////////////////////////////
  123. // Peek_Physics_Obj
  124. //////////////////////////////////////////////////////////////////
  125. inline PhysClass *
  126. ZoneNodeClass::Peek_Physics_Obj (void) const
  127. {
  128. return m_PhysObj;
  129. }
  130. //////////////////////////////////////////////////////////////////
  131. // On_Rotate
  132. //////////////////////////////////////////////////////////////////
  133. inline void
  134. ZoneNodeClass::On_Rotate (void)
  135. {
  136. if (m_IsInScene) {
  137. m_GrabHandles.Position_Around_Node (this);
  138. }
  139. Update_Zone_Obj ();
  140. NodeClass::On_Rotate ();
  141. return ;
  142. }
  143. //////////////////////////////////////////////////////////////////
  144. // On_Translate
  145. //////////////////////////////////////////////////////////////////
  146. inline void
  147. ZoneNodeClass::On_Translate (void)
  148. {
  149. if (m_IsInScene) {
  150. m_GrabHandles.Position_Around_Node (this);
  151. }
  152. Update_Zone_Obj ();
  153. NodeClass::On_Translate ();
  154. return ;
  155. }
  156. //////////////////////////////////////////////////////////////////
  157. // On_Transform
  158. //////////////////////////////////////////////////////////////////
  159. inline void
  160. ZoneNodeClass::On_Transform (void)
  161. {
  162. if (m_IsInScene) {
  163. m_GrabHandles.Position_Around_Node (this);
  164. }
  165. Update_Zone_Obj ();
  166. NodeClass::On_Transform ();
  167. return ;
  168. }
  169. //////////////////////////////////////////////////////////////////
  170. // Get_Box
  171. //////////////////////////////////////////////////////////////////
  172. inline Box3DClass *
  173. ZoneNodeClass::Get_Box (void)
  174. {
  175. Box3DClass *box = NULL;
  176. if (m_PhysObj != NULL) {
  177. box = m_PhysObj->Get_Box ();
  178. }
  179. return box;
  180. }
  181. #endif //__ZONE_NODE_H