LoadScreen.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. /*
  2. ** Command & Conquer Generals(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: LoadScreen.h /////////////////////////////////////////////////////////////////////////////////
  24. // Author: Chris Huybregts, March 2002
  25. // Desc: The file will hold the LoadScreen Base class and it's derived classes
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #pragma once
  28. #ifndef _LOADSCREEN_H_
  29. #define _LOADSCREEN_H_
  30. // SYSTEM INCLUDES ////////////////////////////////////////////////////////////
  31. // USER INCLUDES //////////////////////////////////////////////////////////////
  32. #include "Lib/BaseType.h"
  33. #include "Common/SubsystemInterface.h"
  34. #include "GameClient/GameWindow.h"
  35. #include "GameNetwork/GameInfo.h"
  36. #include "GameClient/CampaignManager.h"
  37. // FORWARD REFERENCES /////////////////////////////////////////////////////////
  38. // TYPE DEFINES ///////////////////////////////////////////////////////////////
  39. class VideoBuffer;
  40. class VideoStreamInterface;
  41. ///////////////////////////////////////////////////////////////////////////////////////////////////
  42. // Class LoadScreen is the parent class for each other kind of load screen
  43. ///////////////////////////////////////////////////////////////////////////////////////////////////
  44. class LoadScreen
  45. {
  46. public:
  47. LoadScreen( void );
  48. virtual ~LoadScreen( void );
  49. virtual void init( GameInfo *game ) = 0; ///< Init the loadscreen
  50. virtual void reset( void ) = 0; ///< Reset the system
  51. virtual void update( void ) = 0; ///< Update the state of the slider bars
  52. virtual void update( Int percent ); ///< Update the state of the slider bars
  53. virtual void processProgress(Int playerId, Int percentage) = 0;
  54. virtual void setProgressRange( Int min, Int max ) = 0;
  55. protected:
  56. void setLoadScreen( GameWindow *g ) { m_loadScreen = g; }
  57. GameWindow *m_loadScreen; ///< The GameWindow that is our loadscreen
  58. private:
  59. };
  60. ///////////////////////////////////////////////////////////////////////////////////////////////////
  61. // class SinglePlayerLoadScreen is to be used only when we're loading a single player mission
  62. ///////////////////////////////////////////////////////////////////////////////////////////////////
  63. class SinglePlayerLoadScreen : public LoadScreen
  64. {
  65. public:
  66. SinglePlayerLoadScreen( void );
  67. virtual ~SinglePlayerLoadScreen( void );
  68. virtual void init( GameInfo *game ); ///< Init the loadscreen
  69. virtual void reset( void ); ///< Reset the system
  70. virtual void update( void )
  71. {
  72. DEBUG_CRASH(("Call update(Int) instead. This update isn't supported"));
  73. };
  74. virtual void update(Int percent); ///< Update the state of the progress bar
  75. virtual void processProgress(Int playerId, Int percentage)
  76. {
  77. DEBUG_CRASH(("We Got to a single player load screen throw the Network..."));
  78. }
  79. virtual void setProgressRange( Int min, Int max );
  80. private:
  81. GameWindow *m_progressBar; ///< Pointer to the Progress Bar on the window
  82. GameWindow *m_percent;
  83. GameWindow *m_objectiveWin;
  84. GameWindow *m_objectiveLines[MAX_OBJECTIVE_LINES];
  85. GameWindow *m_unitDesc[MAX_DISPLAYED_UNITS];
  86. GameWindow *m_location;
  87. Int m_currentObjectiveLine;
  88. Int m_currentObjectiveLineCharacter;
  89. Int m_currentObjectiveWidthOffset;
  90. Bool m_finishedObjectiveText;
  91. UnicodeString m_unicodeObjectiveLines[MAX_OBJECTIVE_LINES];
  92. VideoBuffer *m_videoBuffer;
  93. VideoStreamInterface *m_videoStream;
  94. void moveWindows( Int frame );
  95. AudioEventRTS m_ambientLoop;
  96. AudioHandle m_ambientLoopHandle;
  97. };
  98. ///////////////////////////////////////////////////////////////////////////////////////////////////
  99. // class ShellGameLoadScreen is to be used for the Shell Game loadscreen
  100. //// ///////////////////////////////////////////////////////////////////////////////////////////////
  101. class ShellGameLoadScreen : public LoadScreen
  102. {
  103. public:
  104. ShellGameLoadScreen( void );
  105. virtual ~ShellGameLoadScreen( void );
  106. virtual void init( GameInfo *game ); ///< Init the loadscreen
  107. virtual void reset( void ); ///< Reset the system
  108. virtual void update( void )
  109. {
  110. DEBUG_CRASH(("Call update(Int) instead. This update isn't supported"));
  111. };
  112. virtual void update(Int percent); ///< Update the state of the progress bar
  113. virtual void processProgress(Int playerId, Int percentage)
  114. {
  115. DEBUG_CRASH(("We Got to a single player load screen throw the Network..."));
  116. }
  117. virtual void setProgressRange( Int min, Int max ) { }
  118. private:
  119. GameWindow *m_progressBar ; ///< Pointer to the Progress Bar on the window
  120. };
  121. ///////////////////////////////////////////////////////////////////////////////////////////////////
  122. // class MultiPlayerLoadScreen is to be used for multiplayer communication on the loadscreens
  123. //// ///////////////////////////////////////////////////////////////////////////////////////////////
  124. class MultiPlayerLoadScreen : public LoadScreen
  125. {
  126. public:
  127. MultiPlayerLoadScreen( void );
  128. virtual ~MultiPlayerLoadScreen( void );
  129. virtual void init( GameInfo *game ); ///< Init the loadscreen
  130. virtual void reset( void ); ///< Reset the system
  131. virtual void update( void )
  132. {
  133. DEBUG_CRASH(("Call update(Int) instead. This update isn't supported"));
  134. };
  135. virtual void update(Int percent); ///< Update the state of the progress bar
  136. void processProgress(Int playerId, Int percentage);
  137. virtual void setProgressRange( Int min, Int max ) { }
  138. private:
  139. GameWindow *m_progressBars[MAX_SLOTS]; ///< pointer array to all the progress bars on the window
  140. GameWindow *m_playerNames[MAX_SLOTS]; ///< pointer array to all the static text player names on the window
  141. GameWindow *m_playerSide[MAX_SLOTS]; ///< pointer array to all the static text player sides
  142. Int m_playerLookup[MAX_SLOTS]; ///< lookup table to translate network slot info screen slot (to account for holes in the slot list)
  143. GameWindow *m_mapPreview;
  144. GameWindow *m_buttonMapStartPosition[MAX_SLOTS];
  145. };
  146. ///////////////////////////////////////////////////////////////////////////////////////////////////
  147. // class MultiPlayerLoadScreen is to be used for multiplayer communication on the loadscreens
  148. //// ///////////////////////////////////////////////////////////////////////////////////////////////
  149. class GameSpyLoadScreen : public LoadScreen
  150. {
  151. public:
  152. GameSpyLoadScreen( void );
  153. virtual ~GameSpyLoadScreen( void );
  154. virtual void init( GameInfo *game ); ///< Init the loadscreen
  155. virtual void reset( void ); ///< Reset the system
  156. virtual void update( void )
  157. {
  158. DEBUG_CRASH(("Call update(Int) instead. This update isn't supported"));
  159. };
  160. virtual void update(Int percent); ///< Update the state of the progress bar
  161. void processProgress(Int playerId, Int percentage);
  162. virtual void setProgressRange( Int min, Int max ) { }
  163. private:
  164. GameWindow *m_progressBars[MAX_SLOTS]; ///< pointer array to all the progress bars on the window
  165. GameWindow *m_playerNames[MAX_SLOTS]; ///< pointer array to all the static text player names on the window
  166. GameWindow *m_playerSide[MAX_SLOTS]; ///< pointer array to all the static text player sides
  167. GameWindow *m_playerFavoriteFactions[MAX_SLOTS]; ///< pointer array to all the static text player sides
  168. GameWindow *m_playerTotalDisconnects[MAX_SLOTS]; ///< pointer array to all the static text player sides
  169. GameWindow *m_playerWin[MAX_SLOTS]; ///< pointer array to all the static text player sides
  170. GameWindow *m_playerWinLosses[MAX_SLOTS]; ///< pointer array to all the static text player sides
  171. GameWindow *m_playerRank[MAX_SLOTS]; ///< pointer array to all the static text player sides
  172. GameWindow *m_playerOfficerMedal[MAX_SLOTS]; ///< pointer array to all the static text player munkees
  173. GameWindow *m_mapPreview;
  174. GameWindow *m_buttonMapStartPosition[MAX_SLOTS];
  175. Int m_playerLookup[MAX_SLOTS]; ///< lookup table to translate network slot info screen slot (to account for holes in the slot list)
  176. };
  177. ///////////////////////////////////////////////////////////////////////////////////////////////////
  178. // class MapTransferLoadScreen is to be used for map transfers before multiplayer game load screens
  179. //// ///////////////////////////////////////////////////////////////////////////////////////////////
  180. class MapTransferLoadScreen : public LoadScreen
  181. {
  182. public:
  183. MapTransferLoadScreen( void );
  184. virtual ~MapTransferLoadScreen( void );
  185. virtual void init( GameInfo *game ); ///< Init the loadscreen
  186. virtual void reset( void ); ///< Reset the system
  187. virtual void update( void )
  188. {
  189. DEBUG_CRASH(("Call update(Int) instead. This update isn't supported"));
  190. };
  191. virtual void update(Int percent); ///< Update the state of the progress bar
  192. virtual void processProgress(Int playerId, Int percentage)
  193. {
  194. DEBUG_CRASH(("Call processProgress(Int, Int, AsciiString) instead."));
  195. }
  196. void processProgress(Int playerId, Int percentage, AsciiString stateStr);
  197. virtual void setProgressRange( Int min, Int max ) { }
  198. void processTimeout(Int secondsLeft);
  199. void setCurrentFilename(AsciiString filename);
  200. private:
  201. GameWindow *m_progressBars[MAX_SLOTS]; ///< pointer array to all the progress bars on the window
  202. GameWindow *m_playerNames[MAX_SLOTS]; ///< pointer array to all the static text player names on the window
  203. GameWindow *m_progressText[MAX_SLOTS]; ///< pointer array to all the static text player sides
  204. Int m_playerLookup[MAX_SLOTS]; ///< lookup table to translate network slot info screen slot (to account for holes in the slot list)
  205. Int m_oldProgress[MAX_SLOTS]; ///< old vals, so we can call processProgress() every frame and not touch the GUI
  206. GameWindow *m_fileNameText;
  207. GameWindow *m_timeoutText;
  208. Int m_oldTimeout; ///< old val, so we can call processTimeout() every frame and not touch the GUI
  209. };
  210. #endif //_LOADSCREEN_H_