CoverSpotNode.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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/CoverSpotNode.h $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 7/25/01 4:26p $*
  29. * *
  30. * $Revision:: 11 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef __COVERSPOT_NODE_H
  39. #define __COVERSPOT_NODE_H
  40. #include "node.h"
  41. #include "vector.h"
  42. #include "icons.h"
  43. #include "decophys.h"
  44. #include "editorphys.h"
  45. #include "segline.h"
  46. #include "editorline.h"
  47. ////////////////////////////////////////////////////////////////////////////
  48. // Forward declarations
  49. ////////////////////////////////////////////////////////////////////////////
  50. class PresetClass;
  51. class CoverAttackPointNodeClass;
  52. class CoverEntryClass;
  53. ////////////////////////////////////////////////////////////////////////////
  54. //
  55. // CoverSpotNodeClass
  56. //
  57. ////////////////////////////////////////////////////////////////////////////
  58. class CoverSpotNodeClass : public NodeClass
  59. {
  60. public:
  61. //////////////////////////////////////////////////////////////////
  62. // Public constructors/destructors
  63. //////////////////////////////////////////////////////////////////
  64. CoverSpotNodeClass (PresetClass *preset = NULL);
  65. CoverSpotNodeClass (const CoverSpotNodeClass &src);
  66. ~CoverSpotNodeClass (void);
  67. //////////////////////////////////////////////////////////////
  68. // Public operators
  69. //////////////////////////////////////////////////////////////
  70. const CoverSpotNodeClass &operator= (const CoverSpotNodeClass &src);
  71. //////////////////////////////////////////////////////////////////
  72. // Public methods
  73. //////////////////////////////////////////////////////////////////
  74. //
  75. // CoverSpotNodeClass specific
  76. //
  77. CoverAttackPointNodeClass *Add_Attack_Point (const Matrix3D &tm);
  78. void Remove_Attack_Point (CoverAttackPointNodeClass *attack_point);
  79. bool Requires_Crouch (void) const { return m_RequiresCrouch; }
  80. void Set_Requires_Crouch (bool onoff) { m_RequiresCrouch = onoff; }
  81. void Update_Lines (void);
  82. //
  83. // From PersistClass
  84. //
  85. virtual const PersistFactoryClass & Get_Factory (void) const;
  86. void On_Post_Load (void);
  87. //
  88. // From NodeClass
  89. //
  90. void Initialize (void);
  91. NodeClass * Clone (void) { return new CoverSpotNodeClass (*this); }
  92. NODE_TYPE Get_Type (void) const { return NODE_TYPE_COVER_SPOT; }
  93. int Get_Icon_Index (void) const { return OBJECT_ICON; }
  94. PhysClass * Peek_Physics_Obj (void) const { return m_PhysObj; }
  95. PhysClass * Peek_Collision_Obj (void) const;
  96. bool Is_Static (void) const { return false; }
  97. bool Show_Settings_Dialog (void);
  98. bool Can_Be_Rotated_Freely (void) const { return true; }
  99. void Add_To_Scene (void);
  100. void Remove_From_Scene (void);
  101. void Hide (bool hide);
  102. NodeClass * Add_Child_Node (const Matrix3D &tm);
  103. bool Can_Add_Child_Nodes (void) const { return true; }
  104. int Get_Sub_Node_Count (void) const { return m_AttackPointNodes.Count (); }
  105. NodeClass * Get_Sub_Node (int index);
  106. //
  107. // Notifications
  108. //
  109. void On_Rotate (void);
  110. void On_Translate (void);
  111. void On_Transform (void);
  112. //
  113. // Export methods
  114. //
  115. void Pre_Export (void);
  116. void Post_Export (void);
  117. // From PersistClass
  118. bool Save (ChunkSaveClass &csave);
  119. bool Load (ChunkLoadClass &cload);
  120. protected:
  121. //////////////////////////////////////////////////////////////////
  122. // Protected methods
  123. //////////////////////////////////////////////////////////////////
  124. bool Load_Variables (ChunkLoadClass &cload);
  125. void Free_Attack_Points (void);
  126. //////////////////////////////////////////////////////////////////
  127. // Protected member data
  128. //////////////////////////////////////////////////////////////////
  129. DecorationPhysClass * m_PhysObj;
  130. DynamicVectorClass<CoverAttackPointNodeClass *> m_AttackPointNodes;
  131. DynamicVectorClass<EditorLineClass *> m_AttackPointLines;
  132. DynamicVectorClass<Matrix3D> m_AttackPointLoadList;
  133. bool m_RequiresCrouch;
  134. CoverEntryClass * m_GameCoverSpot;
  135. static PhysClass * _TheCollisionObj;
  136. static int _InstanceCount;
  137. };
  138. //////////////////////////////////////////////////////////////////
  139. // On_Rotate
  140. //////////////////////////////////////////////////////////////////
  141. inline void
  142. CoverSpotNodeClass::On_Rotate (void)
  143. {
  144. Update_Lines ();
  145. NodeClass::On_Rotate ();
  146. return ;
  147. }
  148. //////////////////////////////////////////////////////////////////
  149. // On_Translate
  150. //////////////////////////////////////////////////////////////////
  151. inline void
  152. CoverSpotNodeClass::On_Translate (void)
  153. {
  154. Update_Lines ();
  155. NodeClass::On_Translate ();
  156. return ;
  157. }
  158. //////////////////////////////////////////////////////////////////
  159. // On_Transform
  160. //////////////////////////////////////////////////////////////////
  161. inline void
  162. CoverSpotNodeClass::On_Transform (void)
  163. {
  164. Update_Lines ();
  165. NodeClass::On_Transform ();
  166. return ;
  167. }
  168. #endif //__COVERSPOT_NODE_H