TransitionNode.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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/TransitionNode.h $*
  25. * *
  26. * Author:: Patrick Smith *
  27. * *
  28. * $Modtime:: 11/17/01 10:44a $*
  29. * *
  30. * $Revision:: 5 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #if defined(_MSC_VER)
  36. #pragma once
  37. #endif
  38. #ifndef __TRANSITION_NODE_H
  39. #define __TRANSITION_NODE_H
  40. #include "node.h"
  41. #include "icons.h"
  42. #include "transitiongameobj.h"
  43. // Forward declarations
  44. class PresetClass;
  45. class PhysClass;
  46. ////////////////////////////////////////////////////////////////////////////
  47. //
  48. // TransitionNodeClass
  49. //
  50. ////////////////////////////////////////////////////////////////////////////
  51. class TransitionNodeClass : public NodeClass
  52. {
  53. public:
  54. //////////////////////////////////////////////////////////////////
  55. // Public constructors/destructors
  56. //////////////////////////////////////////////////////////////////
  57. TransitionNodeClass (PresetClass *preset = NULL);
  58. TransitionNodeClass (const TransitionNodeClass &src);
  59. ~TransitionNodeClass (void);
  60. //////////////////////////////////////////////////////////////
  61. // Public operators
  62. //////////////////////////////////////////////////////////////
  63. const TransitionNodeClass &operator= (const TransitionNodeClass &src);
  64. //////////////////////////////////////////////////////////////////
  65. // Public methods
  66. //////////////////////////////////////////////////////////////////
  67. //
  68. // From PersistClass
  69. //
  70. virtual const PersistFactoryClass & Get_Factory (void) const;
  71. //
  72. // From NodeClass
  73. //
  74. NodeClass * Clone (void) { return new TransitionNodeClass (*this); }
  75. void Initialize (void);
  76. NODE_TYPE Get_Type (void) const { return NODE_TYPE_TRANSITION; }
  77. int Get_Icon_Index (void) const { return TRANSITION_ICON; }
  78. PhysClass * Peek_Physics_Obj (void) const;
  79. bool Is_Static (void) const { return false; }
  80. void Add_To_Scene (void);
  81. void Remove_From_Scene (void);
  82. //
  83. // Notifications
  84. //
  85. void On_Rotate (void);
  86. void On_Translate (void);
  87. void On_Transform (void);
  88. //
  89. // Export methods
  90. //
  91. void Pre_Export (void);
  92. void Post_Export (void);
  93. //
  94. // Transition Specific
  95. //
  96. int Get_Transition_Count (void) const;
  97. TransitionInstanceClass * Get_Transition (int index);
  98. TransitionGameObj * Get_Transition_Game_Obj (void) { return m_TransitionObj; }
  99. int Find_Transition (TransitionDataClass::StyleType type);
  100. protected:
  101. //////////////////////////////////////////////////////////////////
  102. // Protected methods
  103. //////////////////////////////////////////////////////////////////
  104. private:
  105. //////////////////////////////////////////////////////////////////
  106. // Private member data
  107. //////////////////////////////////////////////////////////////////
  108. PhysClass * m_PhysObj;
  109. TransitionGameObj * m_TransitionObj;
  110. };
  111. //////////////////////////////////////////////////////////////////
  112. // Peek_Physics_Obj
  113. //////////////////////////////////////////////////////////////////
  114. inline PhysClass *
  115. TransitionNodeClass::Peek_Physics_Obj (void) const
  116. {
  117. return m_PhysObj;
  118. }
  119. //////////////////////////////////////////////////////////////////
  120. // On_Rotate
  121. //////////////////////////////////////////////////////////////////
  122. inline void
  123. TransitionNodeClass::On_Rotate (void)
  124. {
  125. if (m_TransitionObj != NULL) {
  126. m_TransitionObj->Set_Transform (m_Transform);
  127. m_TransitionObj->Update_Transitions ();
  128. }
  129. NodeClass::On_Rotate ();
  130. return ;
  131. }
  132. //////////////////////////////////////////////////////////////////
  133. // On_Translate
  134. //////////////////////////////////////////////////////////////////
  135. inline void
  136. TransitionNodeClass::On_Translate (void)
  137. {
  138. if (m_TransitionObj != NULL) {
  139. m_TransitionObj->Set_Transform (m_Transform);
  140. m_TransitionObj->Update_Transitions ();
  141. }
  142. NodeClass::On_Translate ();
  143. return ;
  144. }
  145. //////////////////////////////////////////////////////////////////
  146. // On_Transform
  147. //////////////////////////////////////////////////////////////////
  148. inline void
  149. TransitionNodeClass::On_Transform (void)
  150. {
  151. if (m_TransitionObj != NULL) {
  152. m_TransitionObj->Set_Transform (m_Transform);
  153. m_TransitionObj->Update_Transitions ();
  154. }
  155. NodeClass::On_Transform ();
  156. return ;
  157. }
  158. //////////////////////////////////////////////////////////////////
  159. // Get_Transition_Count
  160. //////////////////////////////////////////////////////////////////
  161. inline int
  162. TransitionNodeClass::Get_Transition_Count (void) const
  163. {
  164. int count = 0;
  165. if (m_TransitionObj != NULL) {
  166. count = m_TransitionObj->Get_Transition_Count ();
  167. }
  168. return count;
  169. }
  170. //////////////////////////////////////////////////////////////////
  171. // Get_Transition
  172. //////////////////////////////////////////////////////////////////
  173. inline TransitionInstanceClass *
  174. TransitionNodeClass::Get_Transition (int index)
  175. {
  176. TransitionInstanceClass *transition = NULL;
  177. if ( m_TransitionObj != NULL &&
  178. index >= 0 &&
  179. index < Get_Transition_Count ())
  180. {
  181. transition = m_TransitionObj->Get_Transition (index);
  182. }
  183. return transition;
  184. }
  185. #endif //__TRANSITION_NODE_H