WaypointNode.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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/WaypointNode.h $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 2/08/01 10:15a $*
  29. * *
  30. * $Revision:: 4 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef __WAYPOINT_NODE_H
  39. #define __WAYPOINT_NODE_H
  40. #include "node.h"
  41. #include "vector.h"
  42. #include "icons.h"
  43. #include "decophys.h"
  44. // Forward declarations
  45. class PresetClass;
  46. class WaypathNodeClass;
  47. ////////////////////////////////////////////////////////////////////////////
  48. //
  49. // WaypointNodeClass
  50. //
  51. ////////////////////////////////////////////////////////////////////////////
  52. class WaypointNodeClass : public NodeClass
  53. {
  54. public:
  55. //////////////////////////////////////////////////////////////////
  56. // Public flags
  57. //////////////////////////////////////////////////////////////////
  58. typedef enum
  59. {
  60. FLAG_REQUIRES_JUMP = 0x00000001,
  61. } FLAGS;
  62. typedef enum
  63. {
  64. MODEL_START_PT = 1,
  65. MODEL_MIDDLE_PT,
  66. MODEL_END_PT,
  67. } MODEL;
  68. //////////////////////////////////////////////////////////////////
  69. // Public constructors/destructors
  70. //////////////////////////////////////////////////////////////////
  71. WaypointNodeClass (PresetClass *preset = NULL);
  72. WaypointNodeClass (const WaypointNodeClass &src);
  73. ~WaypointNodeClass (void);
  74. //////////////////////////////////////////////////////////////
  75. // Public operators
  76. //////////////////////////////////////////////////////////////
  77. const WaypointNodeClass &operator= (const WaypointNodeClass &src);
  78. //////////////////////////////////////////////////////////////////
  79. // Public methods
  80. //////////////////////////////////////////////////////////////////
  81. //
  82. // From PersistClass
  83. //
  84. virtual const PersistFactoryClass & Get_Factory (void) const;
  85. //
  86. // RTTI
  87. //
  88. WaypointNodeClass *As_WaypointNodeClass (void) { return this; }
  89. //
  90. // From NodeClass
  91. //
  92. void Initialize (void);
  93. NodeClass * Clone (void) { return new WaypointNodeClass (*this); }
  94. NODE_TYPE Get_Type (void) const { return NODE_TYPE_WAYPOINT; }
  95. int Get_Icon_Index (void) const { return WAYPATH_ICON; }
  96. PhysClass * Peek_Physics_Obj (void) const { return m_PhysObj; }
  97. bool Is_Static (void) const { return false; }
  98. bool Show_Settings_Dialog (void);
  99. bool Can_Be_Rotated_Freely (void) const { return false; }
  100. void On_Transform (void);
  101. void On_Translate (void);
  102. void On_Delete (void);
  103. //
  104. // Export methods
  105. //
  106. void Pre_Export (void);
  107. void Post_Export (void);
  108. // From PersistClass
  109. bool Save (ChunkSaveClass &csave);
  110. bool Load (ChunkLoadClass &cload);
  111. //
  112. // WaypointNodeClass specific
  113. //
  114. WaypathNodeClass *Peek_Waypath (void) const;
  115. void Set_Waypath (WaypathNodeClass *waypath);
  116. void Set_Model (WaypointNodeClass::MODEL model);
  117. void Set_Flags (int flags);
  118. void Set_Flag (int flag, bool onoff);
  119. bool Get_Flag (int flag);
  120. float Get_Speed (void) const;
  121. void Set_Speed (float speed);
  122. protected:
  123. //////////////////////////////////////////////////////////////////
  124. // Protected methods
  125. //////////////////////////////////////////////////////////////////
  126. //
  127. // Save/load methods
  128. //
  129. bool Load_Variables (ChunkLoadClass &cload);
  130. //
  131. // Model methods
  132. //
  133. void Update_Model (void);
  134. //
  135. // Parent methods
  136. //
  137. void Parent_Set_Transform (const Matrix3D &tm);
  138. void Parent_Set_Position (const Vector3 &pos);
  139. //////////////////////////////////////////////////////////////////
  140. // Protected member data
  141. //////////////////////////////////////////////////////////////////
  142. DecorationPhysClass * m_PhysObj;
  143. WaypathNodeClass * m_Waypath;
  144. float m_Speed;
  145. int m_Flags;
  146. MODEL m_ModelType;
  147. //////////////////////////////////////////////////////////////////
  148. // Friends
  149. //////////////////////////////////////////////////////////////////
  150. friend class WaypathNodeClass;
  151. };
  152. //////////////////////////////////////////////////////////////////
  153. // Set_Waypath
  154. //////////////////////////////////////////////////////////////////
  155. inline void
  156. WaypointNodeClass::Set_Waypath (WaypathNodeClass *waypath)
  157. {
  158. m_Waypath = waypath;
  159. }
  160. //////////////////////////////////////////////////////////////////
  161. // Peek_Waypath
  162. //////////////////////////////////////////////////////////////////
  163. inline WaypathNodeClass *
  164. WaypointNodeClass::Peek_Waypath (void) const
  165. {
  166. return m_Waypath;
  167. }
  168. //////////////////////////////////////////////////////////////////
  169. // Get_Speed
  170. //////////////////////////////////////////////////////////////////
  171. inline float
  172. WaypointNodeClass::Get_Speed (void) const
  173. {
  174. return m_Speed;
  175. }
  176. //////////////////////////////////////////////////////////////////
  177. // Set_Speed
  178. //////////////////////////////////////////////////////////////////
  179. inline void
  180. WaypointNodeClass::Set_Speed (float speed)
  181. {
  182. m_Speed = speed;
  183. return ;
  184. }
  185. #endif //__WAYPOINT_NODE_H