INTRO.CPP 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. /*
  2. ** Command & Conquer Red Alert(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. /* $Header: /CounterStrike/INTRO.CPP 1 3/03/97 10:24a Joe_bostic $ */
  19. /***********************************************************************************************
  20. *** 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 ***
  21. ***********************************************************************************************
  22. * *
  23. * Project Name : Command & Conquer *
  24. * *
  25. * File Name : INTRO.H *
  26. * *
  27. * Programmer : Barry W. Green *
  28. * *
  29. * Start Date : May 8, 1995 *
  30. * *
  31. * Last Update : May 8, 1995 [BWG] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #include "function.h"
  37. VQAHandle * Open_Movie(char * name);
  38. VQAHandle * Open_Movie(char * name)
  39. {
  40. if (!Debug_Quiet && Get_Digi_Handle() != -1) {
  41. AnimControl.OptionFlags |= VQAOPTF_AUDIO;
  42. } else {
  43. AnimControl.OptionFlags &= ~VQAOPTF_AUDIO;
  44. }
  45. VQAHandle * vqa = VQA_Alloc();
  46. if (vqa) {
  47. VQA_Init(vqa, MixFileHandler);
  48. if (VQA_Open(vqa, name, &AnimControl) != 0) {
  49. VQA_Free(vqa);
  50. vqa = 0;
  51. }
  52. }
  53. return(vqa);
  54. }
  55. /***********************************************************************************************
  56. * Choose_Side -- play the introduction movies, select house *
  57. * *
  58. * INPUT: none *
  59. * *
  60. * OUTPUT: none *
  61. * *
  62. * WARNINGS: *
  63. * *
  64. * HISTORY: *
  65. * 5/08/1995 BWG : Created. *
  66. *=============================================================================================*/
  67. void Choose_Side(void) // ajw - In RA, all this did was play a movie. Denzil is using it in its original sense.
  68. {
  69. Whom = HOUSE_GOOD;
  70. if (Special.IsFromInstall) {
  71. #ifdef DVD // Denzil
  72. if( Using_DVD() )
  73. {
  74. Hide_Mouse();
  75. Load_Title_Page();
  76. GamePalette = CCPalette;
  77. HidPage.Blit(SeenPage);
  78. CCPalette.Set();
  79. Set_Logic_Page(SeenBuff);
  80. Show_Mouse();
  81. switch (WWMessageBox().Process(TXT_CHOOSE, TXT_ALLIES, TXT_SOVIET))
  82. {
  83. case 0:
  84. CurrentCD = 0;
  85. break;
  86. case 1:
  87. CurrentCD = 1;
  88. break;
  89. }
  90. Hide_Mouse();
  91. BlackPalette.Set(FADE_PALETTE_SLOW);
  92. SeenPage.Clear();
  93. }
  94. #endif
  95. Play_Movie(VQ_INTRO_MOVIE, THEME_NONE, false);
  96. }
  97. // Scen.ScenPlayer = SCEN_PLAYER_GREECE;
  98. #ifdef OBSOLETE
  99. static char const _yellowpal[]={0x0,0x0,0xC9,0x0,0xBA,0x0,0x93,0x0,0x61,0x0,0x0,0x0,0x0,0x0,0xEE,0x0};
  100. static char const _redpal[] ={0x0,0x0,0xA8,0x0,0xD9,0x0,0xDA,0x0,0xE1,0x0,0x0,0x0,0x0,0x0,0xD4,0x0};
  101. static char const _graypal[] ={0x0,0x0,0x17,0x0,0x10,0x0,0x12,0x0,0x14,0x0,0x0,0x0,0x0,0x0,0x1C,0x0};
  102. void * anim;
  103. VQAHandle * gdibrief=0, * nodbrief=0;
  104. void const * staticaud, * oldfont;
  105. void const * speechg, * speechn, * speech;
  106. int statichandle, speechhandle, speechplaying = 0;
  107. int oldfontxspacing = FontXSpacing;
  108. int setpalette = 0;
  109. int frame = 0, endframe = 255, selection = 0, lettersdone = 0;
  110. Hide_Mouse();
  111. /* Change to the six-point font for Text_Print */
  112. oldfont = Set_Font(ScoreFontPtr);
  113. Call_Back();
  114. staticaud = Load_Alloc_Data(CCFileClass("STRUGGLE.AUD"));
  115. speechg = Load_Alloc_Data(CCFileClass("GDI_SLCT.AUD"));
  116. speechn = Load_Alloc_Data(CCFileClass("NOD_SLCT.AUD"));
  117. // staticaud = MixFileClass::Retrieve("STRUGGLE.AUD");
  118. // speechg = MixFileClass::Retrieve("GDI_SLCT.AUD");
  119. // speechn = MixFileClass::Retrieve("NOD_SLCT.AUD");
  120. anim = Open_Animation("CHOOSE.WSA", NULL, 0L, (WSAOpenType)(WSA_OPEN_FROM_MEM | WSA_OPEN_TO_PAGE), Palette);
  121. Call_Back();
  122. nodbrief = Open_Movie("NOD1PRE.VQA");
  123. Call_Back();
  124. gdibrief = Open_Movie("GDI1.VQA");
  125. if (Special.IsFromInstall) {
  126. Set_Video_Mode(MCGA_MODE);
  127. PreserveVQAScreen = 1;
  128. // Hide_Mouse();
  129. Play_Movie("INTRO2", THEME_NONE, false);
  130. Show_Mouse();
  131. }
  132. HidPage.Clear();
  133. if (!Special.IsFromInstall) {
  134. SeenPage.Clear();
  135. // Set_Palette(Palette);
  136. Palette.Set();
  137. } else {
  138. setpalette = 1;
  139. }
  140. statichandle = Play_Sample(staticaud, 255, 64);
  141. Alloc_Object(new ScorePrintClass(TXT_GDI_NAME, 0, 180, _yellowpal));
  142. #ifdef FRENCH
  143. Alloc_Object(new ScorePrintClass(TXT_GDI_NAME2, 0, 187, _yellowpal));
  144. #endif
  145. Alloc_Object(new ScorePrintClass(TXT_NOD_NAME, 180, 180, _redpal));
  146. #ifdef GERMAN
  147. Alloc_Object(new ScorePrintClass(TXT_SEL_TRANS, 57, 190, _graypal));
  148. #else
  149. #ifdef FRENCH
  150. Alloc_Object(new ScorePrintClass(TXT_SEL_TRANS, 103, 194, _graypal));
  151. #else
  152. Alloc_Object(new ScorePrintClass(TXT_SEL_TRANS, 103, 190, _graypal));
  153. #endif
  154. #endif
  155. Keyboard->Clear();
  156. while (endframe != frame || (speechplaying && Is_Sample_Playing(speech)) ) {
  157. Animate_Frame(anim, HidPage, frame++);
  158. Hide_Mouse();
  159. if (setpalette) {
  160. Wait_Vert_Blank(VertBlank);
  161. //Set_Palette(Palette);
  162. Palette.Set();
  163. setpalette = 0;
  164. }
  165. HidPage.Blit(SeenPage, 0, 22, 0, 22, 320, 156);
  166. Show_Mouse();
  167. if (!Is_Sample_Playing(staticaud)) statichandle = Play_Sample(staticaud, 255, 64);
  168. Call_Back_Delay(3); // delay only if haven't clicked
  169. /* keep the mouse hidden until the letters are thru printing */
  170. if (!lettersdone) {
  171. lettersdone = true;
  172. for (int i=0; i < MAXSCOREOBJS; i++) if (ScoreObjs[i]) lettersdone = 0;
  173. if (lettersdone) {
  174. Show_Mouse();
  175. }
  176. }
  177. if (frame >= Get_Animation_Frame_Count(anim)) frame = 0;
  178. if (Keyboard->Check() && endframe == 255) {
  179. if ((Keyboard->Get() & 0xFF) == KN_LMOUSE) {
  180. if ((MouseQY > 48) && (MouseQY < 150)) {
  181. if ((MouseQX > 18) && (MouseQX < 148)) {
  182. // Chose GDI
  183. Whom = HOUSE_GOOD;
  184. ScenPlayer = SCEN_PLAYER_GDI;
  185. endframe = 0;
  186. speechhandle = Play_Sample(speechg);
  187. speechplaying = true;
  188. speech = speechg;
  189. } else if ((MouseQX > 160) && (MouseQX < 300)) {
  190. // Chose Nod
  191. selection = 1;
  192. endframe = 14;
  193. Whom = HOUSE_BAD;
  194. ScenPlayer = SCEN_PLAYER_NOD;
  195. speechhandle = Play_Sample(speechn);
  196. speechplaying = true;
  197. speech = speechn;
  198. }
  199. }
  200. }
  201. }
  202. }
  203. Hide_Mouse();
  204. Close_Animation(anim);
  205. // erase the "choose side" text
  206. SeenBuff.Fill_Rect(0, 180, 319, 199, 0);
  207. Keyboard->Clear();
  208. /* play the scenario 1 briefing movie */
  209. if (Whom == HOUSE_GOOD) {
  210. if (nodbrief) {
  211. VQA_Close(nodbrief);
  212. VQA_Free(nodbrief);
  213. }
  214. if (gdibrief) {
  215. #ifdef CHEAT_KEYS
  216. #else
  217. VQA_Play(gdibrief, VQAMODE_RUN);
  218. #endif
  219. VQA_Close(gdibrief);
  220. VQA_Free(gdibrief);
  221. }
  222. } else {
  223. if (gdibrief) {
  224. VQA_Close(gdibrief);
  225. VQA_Free(gdibrief);
  226. }
  227. if (nodbrief) {
  228. #ifdef CHEAT_KEYS
  229. #else
  230. VQA_Play(nodbrief, VQAMODE_RUN);
  231. #endif
  232. VQA_Close(nodbrief);
  233. VQA_Free(nodbrief);
  234. }
  235. }
  236. /* get rid of all the animating objects */
  237. for (int i = 0; i < MAXSCOREOBJS; i++) if (ScoreObjs[i]) {
  238. delete ScoreObjs[i];
  239. ScoreObjs[i] = 0;
  240. }
  241. if (Whom == HOUSE_GOOD) {
  242. /*
  243. ** Make sure the screen's fully clear after the movie plays
  244. */
  245. SeenPage.Clear();
  246. BlackPalette.Adjust(WhitePalette, 0x08);
  247. BlackPalette.Set();
  248. BlackPalette.Adjust(0xFF);
  249. BlackPalette.Set();
  250. // memset(BlackPalette, 0x01, 768);
  251. // Set_Palette(BlackPalette);
  252. // memset(BlackPalette, 0x00, 768);
  253. } else {
  254. PreserveVQAScreen = 1;
  255. }
  256. Free(staticaud);
  257. Free(speechg);
  258. Free(speechn);
  259. Set_Font(oldfont);
  260. FontXSpacing = oldfontxspacing;
  261. #endif
  262. }