LoadScreen.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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: 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. #include "GameClient/ChallengeGenerals.h"
  38. // FORWARD REFERENCES /////////////////////////////////////////////////////////
  39. // TYPE DEFINES ///////////////////////////////////////////////////////////////
  40. class VideoBuffer;
  41. class VideoStreamInterface;
  42. class WindowVideoManager;
  43. ///////////////////////////////////////////////////////////////////////////////////////////////////
  44. // Class LoadScreen is the parent class for each other kind of load screen
  45. ///////////////////////////////////////////////////////////////////////////////////////////////////
  46. class LoadScreen
  47. {
  48. public:
  49. LoadScreen( void );
  50. virtual ~LoadScreen( void );
  51. virtual void init( GameInfo *game ) = 0; ///< Init the loadscreen
  52. virtual void reset( void ) = 0; ///< Reset the system
  53. virtual void update( void ) = 0; ///< Update the state of the slider bars
  54. virtual void update( Int percent ); ///< Update the state of the slider bars
  55. virtual void processProgress(Int playerId, Int percentage) = 0;
  56. virtual void setProgressRange( Int min, Int max ) = 0;
  57. protected:
  58. void setLoadScreen( GameWindow *g ) { m_loadScreen = g; }
  59. GameWindow *m_loadScreen; ///< The GameWindow that is our loadscreen
  60. private:
  61. };
  62. ///////////////////////////////////////////////////////////////////////////////////////////////////
  63. // class SinglePlayerLoadScreen is to be used only when we're loading a single player mission
  64. ///////////////////////////////////////////////////////////////////////////////////////////////////
  65. class SinglePlayerLoadScreen : public LoadScreen
  66. {
  67. public:
  68. SinglePlayerLoadScreen( void );
  69. virtual ~SinglePlayerLoadScreen( void );
  70. virtual void init( GameInfo *game ); ///< Init the loadscreen
  71. virtual void reset( void ); ///< Reset the system
  72. virtual void update( void )
  73. {
  74. DEBUG_CRASH(("Call update(Int) instead. This update isn't supported"));
  75. };
  76. virtual void update(Int percent); ///< Update the state of the progress bar
  77. virtual void processProgress(Int playerId, Int percentage)
  78. {
  79. DEBUG_CRASH(("We Got to a single player load screen throw the Network..."));
  80. }
  81. virtual void setProgressRange( Int min, Int max );
  82. private:
  83. GameWindow *m_progressBar; ///< Pointer to the Progress Bar on the window
  84. GameWindow *m_percent;
  85. GameWindow *m_objectiveWin;
  86. GameWindow *m_objectiveLines[MAX_OBJECTIVE_LINES];
  87. GameWindow *m_unitDesc[MAX_DISPLAYED_UNITS];
  88. GameWindow *m_location;
  89. Int m_currentObjectiveLine;
  90. Int m_currentObjectiveLineCharacter;
  91. Int m_currentObjectiveWidthOffset;
  92. Bool m_finishedObjectiveText;
  93. UnicodeString m_unicodeObjectiveLines[MAX_OBJECTIVE_LINES];
  94. VideoBuffer *m_videoBuffer;
  95. VideoStreamInterface *m_videoStream;
  96. void moveWindows( Int frame );
  97. AudioEventRTS m_ambientLoop;
  98. AudioHandle m_ambientLoopHandle;
  99. };
  100. ///////////////////////////////////////////////////////////////////////////////////////////////////
  101. // class ChallengeLoadScreen is to be used only when we're loading a Generals' Challenge mission
  102. ///////////////////////////////////////////////////////////////////////////////////////////////////
  103. class ChallengeLoadScreen : public LoadScreen
  104. {
  105. public:
  106. ChallengeLoadScreen( void );
  107. virtual ~ChallengeLoadScreen( void );
  108. virtual void init( GameInfo *game ); ///< Init the loadscreen
  109. virtual void reset( void ); ///< Reset the system
  110. virtual void update( void )
  111. {
  112. DEBUG_CRASH(("Call update(Int) instead. This update isn't supported"));
  113. };
  114. virtual void update(Int percent); ///< Update the state of the progress bar
  115. virtual void processProgress(Int playerId, Int percentage)
  116. {
  117. DEBUG_CRASH(("We Got to a single player load screen throw the Network..."));
  118. }
  119. virtual void setProgressRange( Int min, Int max );
  120. private:
  121. GameWindow *m_progressBar; ///< Pointer to the Progress Bar on the window
  122. VideoBuffer *m_videoBuffer;
  123. VideoStreamInterface *m_videoStream;
  124. WindowVideoManager *m_wndVideoManager;
  125. AudioEventRTS m_ambientLoop;
  126. AudioHandle m_ambientLoopHandle;
  127. GameWindow *m_bioNameLeft;
  128. GameWindow *m_bioAgeLeft;
  129. GameWindow *m_bioBirthplaceLeft;
  130. GameWindow *m_bioStrategyLeft;
  131. GameWindow *m_bioBigNameEntryLeft;
  132. GameWindow *m_bioNameEntryLeft;
  133. GameWindow *m_bioAgeEntryLeft;
  134. GameWindow *m_bioBirthplaceEntryLeft;
  135. GameWindow *m_bioStrategyEntryLeft;
  136. GameWindow *m_bioNameRight;
  137. GameWindow *m_bioAgeRight;
  138. GameWindow *m_bioBirthplaceRight;
  139. GameWindow *m_bioStrategyRight;
  140. GameWindow *m_bioBigNameEntryRight;
  141. GameWindow *m_bioNameEntryRight;
  142. GameWindow *m_bioAgeEntryRight;
  143. GameWindow *m_bioBirthplaceEntryRight;
  144. GameWindow *m_bioStrategyEntryRight;
  145. GameWindow *m_portraitLeft;
  146. GameWindow *m_portraitRight;
  147. GameWindow *m_portraitMovieLeft;
  148. GameWindow *m_portraitMovieRight;
  149. // GameWindow *m_overlayReticleCrosshairs;
  150. GameWindow *m_overlayReticleCircleLineOuter;
  151. GameWindow *m_overlayReticleCircleLineInner;
  152. GameWindow *m_overlayReticleCircleAlphaOuter;
  153. GameWindow *m_overlayReticleCircleAlphaInner;
  154. GameWindow *m_overlayVsBackdrop;
  155. GameWindow *m_overlayVs;
  156. void activatePieces( Int frame, const GeneralPersona *generalPlayer, const GeneralPersona *generalOpponent );
  157. void activatePiecesMinSpec(const GeneralPersona *generalPlayer, const GeneralPersona *generalOpponent);
  158. };
  159. ///////////////////////////////////////////////////////////////////////////////////////////////////
  160. // class ShellGameLoadScreen is to be used for the Shell Game loadscreen
  161. //// ///////////////////////////////////////////////////////////////////////////////////////////////
  162. class ShellGameLoadScreen : public LoadScreen
  163. {
  164. public:
  165. ShellGameLoadScreen( void );
  166. virtual ~ShellGameLoadScreen( void );
  167. virtual void init( GameInfo *game ); ///< Init the loadscreen
  168. virtual void reset( void ); ///< Reset the system
  169. virtual void update( void )
  170. {
  171. DEBUG_CRASH(("Call update(Int) instead. This update isn't supported"));
  172. };
  173. virtual void update(Int percent); ///< Update the state of the progress bar
  174. virtual void processProgress(Int playerId, Int percentage)
  175. {
  176. DEBUG_CRASH(("We Got to a single player load screen throw the Network..."));
  177. }
  178. virtual void setProgressRange( Int min, Int max ) { }
  179. private:
  180. GameWindow *m_progressBar ; ///< Pointer to the Progress Bar on the window
  181. };
  182. ///////////////////////////////////////////////////////////////////////////////////////////////////
  183. // class MultiPlayerLoadScreen is to be used for multiplayer communication on the loadscreens
  184. //// ///////////////////////////////////////////////////////////////////////////////////////////////
  185. class MultiPlayerLoadScreen : public LoadScreen
  186. {
  187. public:
  188. MultiPlayerLoadScreen( void );
  189. virtual ~MultiPlayerLoadScreen( void );
  190. virtual void init( GameInfo *game ); ///< Init the loadscreen
  191. virtual void reset( void ); ///< Reset the system
  192. virtual void update( void )
  193. {
  194. DEBUG_CRASH(("Call update(Int) instead. This update isn't supported"));
  195. };
  196. virtual void update(Int percent); ///< Update the state of the progress bar
  197. void processProgress(Int playerId, Int percentage);
  198. virtual void setProgressRange( Int min, Int max ) { }
  199. private:
  200. GameWindow *m_progressBars[MAX_SLOTS]; ///< pointer array to all the progress bars on the window
  201. GameWindow *m_playerNames[MAX_SLOTS]; ///< pointer array to all the static text player names on the window
  202. GameWindow *m_playerSide[MAX_SLOTS]; ///< pointer array to all the static text player sides
  203. Int m_playerLookup[MAX_SLOTS]; ///< lookup table to translate network slot info screen slot (to account for holes in the slot list)
  204. GameWindow *m_mapPreview;
  205. GameWindow *m_buttonMapStartPosition[MAX_SLOTS];
  206. GameWindow *m_portraitLocalGeneral;
  207. GameWindow *m_featuresLocalGeneral;
  208. GameWindow *m_nameLocalGeneral;
  209. };
  210. ///////////////////////////////////////////////////////////////////////////////////////////////////
  211. // class MultiPlayerLoadScreen is to be used for multiplayer communication on the loadscreens
  212. //// ///////////////////////////////////////////////////////////////////////////////////////////////
  213. class GameSpyLoadScreen : public LoadScreen
  214. {
  215. public:
  216. GameSpyLoadScreen( void );
  217. virtual ~GameSpyLoadScreen( void );
  218. virtual void init( GameInfo *game ); ///< Init the loadscreen
  219. virtual void reset( void ); ///< Reset the system
  220. virtual void update( void )
  221. {
  222. DEBUG_CRASH(("Call update(Int) instead. This update isn't supported"));
  223. };
  224. virtual void update(Int percent); ///< Update the state of the progress bar
  225. void processProgress(Int playerId, Int percentage);
  226. virtual void setProgressRange( Int min, Int max ) { }
  227. private:
  228. GameWindow *m_progressBars[MAX_SLOTS]; ///< pointer array to all the progress bars on the window
  229. GameWindow *m_playerNames[MAX_SLOTS]; ///< pointer array to all the static text player names on the window
  230. GameWindow *m_playerSide[MAX_SLOTS]; ///< pointer array to all the static text player sides
  231. GameWindow *m_playerFavoriteFactions[MAX_SLOTS]; ///< pointer array to all the static text player sides
  232. GameWindow *m_playerTotalDisconnects[MAX_SLOTS]; ///< pointer array to all the static text player sides
  233. GameWindow *m_playerWin[MAX_SLOTS]; ///< pointer array to all the static text player sides
  234. GameWindow *m_playerWinLosses[MAX_SLOTS]; ///< pointer array to all the static text player sides
  235. GameWindow *m_playerRank[MAX_SLOTS]; ///< pointer array to all the static text player sides
  236. GameWindow *m_playerOfficerMedal[MAX_SLOTS]; ///< pointer array to all the static text player munkees
  237. GameWindow *m_mapPreview;
  238. GameWindow *m_buttonMapStartPosition[MAX_SLOTS];
  239. Int m_playerLookup[MAX_SLOTS]; ///< lookup table to translate network slot info screen slot (to account for holes in the slot list)
  240. GameWindow *m_portraitLocalGeneral;
  241. GameWindow *m_featuresLocalGeneral;
  242. GameWindow *m_nameLocalGeneral;
  243. };
  244. ///////////////////////////////////////////////////////////////////////////////////////////////////
  245. // class MapTransferLoadScreen is to be used for map transfers before multiplayer game load screens
  246. //// ///////////////////////////////////////////////////////////////////////////////////////////////
  247. class MapTransferLoadScreen : public LoadScreen
  248. {
  249. public:
  250. MapTransferLoadScreen( void );
  251. virtual ~MapTransferLoadScreen( void );
  252. virtual void init( GameInfo *game ); ///< Init the loadscreen
  253. virtual void reset( void ); ///< Reset the system
  254. virtual void update( void )
  255. {
  256. DEBUG_CRASH(("Call update(Int) instead. This update isn't supported"));
  257. };
  258. virtual void update(Int percent); ///< Update the state of the progress bar
  259. virtual void processProgress(Int playerId, Int percentage)
  260. {
  261. DEBUG_CRASH(("Call processProgress(Int, Int, AsciiString) instead."));
  262. }
  263. void processProgress(Int playerId, Int percentage, AsciiString stateStr);
  264. virtual void setProgressRange( Int min, Int max ) { }
  265. void processTimeout(Int secondsLeft);
  266. void setCurrentFilename(AsciiString filename);
  267. private:
  268. GameWindow *m_progressBars[MAX_SLOTS]; ///< pointer array to all the progress bars on the window
  269. GameWindow *m_playerNames[MAX_SLOTS]; ///< pointer array to all the static text player names on the window
  270. GameWindow *m_progressText[MAX_SLOTS]; ///< pointer array to all the static text player sides
  271. Int m_playerLookup[MAX_SLOTS]; ///< lookup table to translate network slot info screen slot (to account for holes in the slot list)
  272. Int m_oldProgress[MAX_SLOTS]; ///< old vals, so we can call processProgress() every frame and not touch the GUI
  273. GameWindow *m_fileNameText;
  274. GameWindow *m_timeoutText;
  275. Int m_oldTimeout; ///< old val, so we can call processTimeout() every frame and not touch the GUI
  276. };
  277. #endif //_LOADSCREEN_H_