ProcessAnimateWindow.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. /*
  2. ** Command & Conquer Generals Zero Hour(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. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // FILE: ProcessAnimateWindow.h /////////////////////////////////////////////////
  24. //-----------------------------------------------------------------------------
  25. //
  26. // Electronic Arts Pacific.
  27. //
  28. // Confidential Information
  29. // Copyright (C) 2002 - All Rights Reserved
  30. //
  31. //-----------------------------------------------------------------------------
  32. //
  33. // created: Mar 2002
  34. //
  35. // Filename: ProcessAnimateWindow.h
  36. //
  37. // author: Chris Huybregts
  38. //
  39. // purpose: If a new animation is wanted to be added for the windows, All you
  40. // have to do is create a new class derived from ProcessAnimateWindow.
  41. // Then setup each of the virtual classes to process an AnimateWindow
  42. // class. The Update adn reverse functions get called every frame
  43. // by the shell and will continue to process the AdminWin until the
  44. // isFinished flag on the adminWin is set to true.
  45. //
  46. //-----------------------------------------------------------------------------
  47. ///////////////////////////////////////////////////////////////////////////////
  48. #pragma once
  49. #ifndef __PROCESSANIMATEWINDOW_H_
  50. #define __PROCESSANIMATEWINDOW_H_
  51. //-----------------------------------------------------------------------------
  52. // SYSTEM INCLUDES ////////////////////////////////////////////////////////////
  53. //-----------------------------------------------------------------------------
  54. //-----------------------------------------------------------------------------
  55. // USER INCLUDES //////////////////////////////////////////////////////////////
  56. //-----------------------------------------------------------------------------
  57. #include "Lib/BaseType.h"
  58. //-----------------------------------------------------------------------------
  59. // FORWARD REFERENCES /////////////////////////////////////////////////////////
  60. //-----------------------------------------------------------------------------
  61. class AnimateWindow;
  62. class GameWindow;
  63. //-----------------------------------------------------------------------------
  64. // TYPE DEFINES ///////////////////////////////////////////////////////////////
  65. //-----------------------------------------------------------------------------
  66. //-----------------------------------------------------------------------------
  67. class ProcessAnimateWindow
  68. {
  69. public:
  70. ProcessAnimateWindow( void ){};
  71. virtual ~ProcessAnimateWindow( void ){};
  72. virtual void initAnimateWindow( AnimateWindow *animWin ) = 0;
  73. virtual void initReverseAnimateWindow( AnimateWindow *animWin, UnsignedInt maxDelay = 0 ) = 0;
  74. virtual Bool updateAnimateWindow( AnimateWindow *animWin ) = 0;
  75. virtual Bool reverseAnimateWindow( AnimateWindow *animWin ) = 0;
  76. virtual void setMaxDuration(UnsignedInt maxDuration) { }
  77. };
  78. //-----------------------------------------------------------------------------
  79. class ProcessAnimateWindowSlideFromRight : public ProcessAnimateWindow
  80. {
  81. public:
  82. ProcessAnimateWindowSlideFromRight( void );
  83. virtual ~ProcessAnimateWindowSlideFromRight( void );
  84. virtual void initAnimateWindow( AnimateWindow *animWin );
  85. virtual void initReverseAnimateWindow( AnimateWindow *animWin, UnsignedInt maxDelay = 0 );
  86. virtual Bool updateAnimateWindow( AnimateWindow *animWin );
  87. virtual Bool reverseAnimateWindow( AnimateWindow *animWin );
  88. private:
  89. Coord2D m_maxVel; // top speed windows travel in x and y
  90. Int m_slowDownThreshold; // when widnows get this close to their resting
  91. // positions they start to slow down
  92. Real m_slowDownRatio; // how fast the windows slow down (smaller slows quicker)
  93. Real m_speedUpRatio; // how fast the windows speed up
  94. };
  95. //-----------------------------------------------------------------------------
  96. class ProcessAnimateWindowSlideFromLeft : public ProcessAnimateWindow
  97. {
  98. public:
  99. ProcessAnimateWindowSlideFromLeft( void );
  100. virtual ~ProcessAnimateWindowSlideFromLeft( void );
  101. virtual void initAnimateWindow( AnimateWindow *animWin );
  102. virtual void initReverseAnimateWindow( AnimateWindow *animWin, UnsignedInt maxDelay = 0 );
  103. virtual Bool updateAnimateWindow( AnimateWindow *animWin );
  104. virtual Bool reverseAnimateWindow( AnimateWindow *animWin );
  105. private:
  106. Coord2D m_maxVel; // top speed windows travel in x and y
  107. Int m_slowDownThreshold; // when widnows get this close to their resting
  108. // positions they start to slow down
  109. Real m_slowDownRatio; // how fast the windows slow down (smaller slows quicker)
  110. Real m_speedUpRatio; // how fast the windows speed up
  111. };
  112. //-----------------------------------------------------------------------------
  113. class ProcessAnimateWindowSlideFromTop : public ProcessAnimateWindow
  114. {
  115. public:
  116. ProcessAnimateWindowSlideFromTop( void );
  117. virtual ~ProcessAnimateWindowSlideFromTop( void );
  118. virtual void initAnimateWindow( AnimateWindow *animWin );
  119. virtual void initReverseAnimateWindow( AnimateWindow *animWin, UnsignedInt maxDelay = 0 );
  120. virtual Bool updateAnimateWindow( AnimateWindow *animWin );
  121. virtual Bool reverseAnimateWindow( AnimateWindow *animWin );
  122. private:
  123. Coord2D m_maxVel; // top speed windows travel in x and y
  124. Int m_slowDownThreshold; // when widnows get this close to their resting
  125. // positions they start to slow down
  126. Real m_slowDownRatio; // how fast the windows slow down (smaller slows quicker)
  127. Real m_speedUpRatio; // how fast the windows speed up
  128. };
  129. //-----------------------------------------------------------------------------
  130. class ProcessAnimateWindowSlideFromTopFast : public ProcessAnimateWindow
  131. {
  132. public:
  133. ProcessAnimateWindowSlideFromTopFast( void );
  134. virtual ~ProcessAnimateWindowSlideFromTopFast( void );
  135. virtual void initAnimateWindow( AnimateWindow *animWin );
  136. virtual void initReverseAnimateWindow( AnimateWindow *animWin, UnsignedInt maxDelay = 0 );
  137. virtual Bool updateAnimateWindow( AnimateWindow *animWin );
  138. virtual Bool reverseAnimateWindow( AnimateWindow *animWin );
  139. private:
  140. Coord2D m_maxVel; // top speed windows travel in x and y
  141. Int m_slowDownThreshold; // when widnows get this close to their resting
  142. // positions they start to slow down
  143. Real m_slowDownRatio; // how fast the windows slow down (smaller slows quicker)
  144. Real m_speedUpRatio; // how fast the windows speed up
  145. };
  146. //-----------------------------------------------------------------------------
  147. class ProcessAnimateWindowSlideFromBottom : public ProcessAnimateWindow
  148. {
  149. public:
  150. ProcessAnimateWindowSlideFromBottom( void );
  151. virtual ~ProcessAnimateWindowSlideFromBottom( void );
  152. virtual void initAnimateWindow( AnimateWindow *animWin );
  153. virtual void initReverseAnimateWindow( AnimateWindow *animWin, UnsignedInt maxDelay = 0 );
  154. virtual Bool updateAnimateWindow( AnimateWindow *animWin );
  155. virtual Bool reverseAnimateWindow( AnimateWindow *animWin );
  156. private:
  157. Coord2D m_maxVel; // top speed windows travel in x and y
  158. Int m_slowDownThreshold; // when widnows get this close to their resting
  159. // positions they start to slow down
  160. Real m_slowDownRatio; // how fast the windows slow down (smaller slows quicker)
  161. Real m_speedUpRatio; // how fast the windows speed up
  162. };
  163. //-----------------------------------------------------------------------------
  164. class ProcessAnimateWindowSpiral : public ProcessAnimateWindow
  165. {
  166. public:
  167. ProcessAnimateWindowSpiral( void );
  168. virtual ~ProcessAnimateWindowSpiral( void );
  169. virtual void initAnimateWindow( AnimateWindow *animWin );
  170. virtual void initReverseAnimateWindow( AnimateWindow *animWin, UnsignedInt maxDelay = 0 );
  171. virtual Bool updateAnimateWindow( AnimateWindow *animWin );
  172. virtual Bool reverseAnimateWindow( AnimateWindow *animWin );
  173. private:
  174. Real m_deltaTheta;
  175. Int m_maxR;
  176. };
  177. //-----------------------------------------------------------------------------
  178. class ProcessAnimateWindowSlideFromBottomTimed : public ProcessAnimateWindow
  179. {
  180. public:
  181. ProcessAnimateWindowSlideFromBottomTimed( void );
  182. virtual ~ProcessAnimateWindowSlideFromBottomTimed( void );
  183. virtual void initAnimateWindow( AnimateWindow *animWin );
  184. virtual void initReverseAnimateWindow( AnimateWindow *animWin, UnsignedInt maxDelay = 0 );
  185. virtual Bool updateAnimateWindow( AnimateWindow *animWin );
  186. virtual Bool reverseAnimateWindow( AnimateWindow *animWin );
  187. virtual void setMaxDuration(UnsignedInt maxDuration) { m_maxDuration = maxDuration; }
  188. private:
  189. UnsignedInt m_maxDuration;
  190. };
  191. class ProcessAnimateWindowSlideFromRightFast : public ProcessAnimateWindow
  192. {
  193. public:
  194. ProcessAnimateWindowSlideFromRightFast( void );
  195. virtual ~ProcessAnimateWindowSlideFromRightFast( void );
  196. virtual void initAnimateWindow( AnimateWindow *animWin );
  197. virtual void initReverseAnimateWindow( AnimateWindow *animWin, UnsignedInt maxDelay = 0 );
  198. virtual Bool updateAnimateWindow( AnimateWindow *animWin );
  199. virtual Bool reverseAnimateWindow( AnimateWindow *animWin );
  200. private:
  201. Coord2D m_maxVel; // top speed windows travel in x and y
  202. Int m_slowDownThreshold; // when widnows get this close to their resting
  203. // positions they start to slow down
  204. Real m_slowDownRatio; // how fast the windows slow down (smaller slows quicker)
  205. Real m_speedUpRatio; // how fast the windows speed up
  206. };
  207. //-----------------------------------------------------------------------------
  208. // INLINING ///////////////////////////////////////////////////////////////////
  209. //-----------------------------------------------------------------------------
  210. //-----------------------------------------------------------------------------
  211. // EXTERNALS //////////////////////////////////////////////////////////////////
  212. //-----------------------------------------------------------------------------
  213. #endif // __PROCESSANIMATEWINDOW_H_