INTRO.CPP 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. /* $Header: /CounterStrike/INTRO.CPP 1 3/03/97 10:24a Joe_bostic $ */
  15. /***********************************************************************************************
  16. *** 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 ***
  17. ***********************************************************************************************
  18. * *
  19. * Project Name : Command & Conquer *
  20. * *
  21. * File Name : INTRO.H *
  22. * *
  23. * Programmer : Barry W. Green *
  24. * *
  25. * Start Date : May 8, 1995 *
  26. * *
  27. * Last Update : May 8, 1995 [BWG] *
  28. * *
  29. *---------------------------------------------------------------------------------------------*
  30. * Functions: *
  31. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  32. #include "function.h"
  33. #if (0) //PG
  34. VQAHandle * Open_Movie(char * name);
  35. VQAHandle * Open_Movie(char * name)
  36. {
  37. if (!Debug_Quiet && Get_Digi_Handle() != -1) {
  38. AnimControl.OptionFlags |= VQAOPTF_AUDIO;
  39. } else {
  40. AnimControl.OptionFlags &= ~VQAOPTF_AUDIO;
  41. }
  42. VQAHandle * vqa = VQA_Alloc();
  43. if (vqa) {
  44. VQA_Init(vqa, MixFileHandler);
  45. if (VQA_Open(vqa, name, &AnimControl) != 0) {
  46. VQA_Free(vqa);
  47. vqa = 0;
  48. }
  49. }
  50. return(vqa);
  51. }
  52. #endif
  53. /***********************************************************************************************
  54. * Choose_Side -- play the introduction movies, select house *
  55. * *
  56. * INPUT: none *
  57. * *
  58. * OUTPUT: none *
  59. * *
  60. * WARNINGS: *
  61. * *
  62. * HISTORY: *
  63. * 5/08/1995 BWG : Created. *
  64. *=============================================================================================*/
  65. void Choose_Side(void) // ajw - In RA, all this did was play a movie. Denzil is using it in its original sense.
  66. {
  67. Whom = HOUSE_GOOD;
  68. #if (0) //PG
  69. if (Special.IsFromInstall) {
  70. #ifdef DVD // Denzil
  71. if( Using_DVD() )
  72. {
  73. Hide_Mouse();
  74. Load_Title_Page();
  75. GamePalette = CCPalette;
  76. HidPage.Blit(SeenPage);
  77. CCPalette.Set();
  78. Set_Logic_Page(SeenBuff);
  79. Show_Mouse();
  80. switch (WWMessageBox().Process(TXT_CHOOSE, TXT_ALLIES, TXT_SOVIET))
  81. {
  82. case 0:
  83. CurrentCD = 0;
  84. break;
  85. case 1:
  86. CurrentCD = 1;
  87. break;
  88. }
  89. Hide_Mouse();
  90. BlackPalette.Set(FADE_PALETTE_SLOW);
  91. SeenPage.Clear();
  92. }
  93. #endif
  94. Play_Movie(VQ_INTRO_MOVIE, THEME_NONE, false);
  95. }
  96. #endif
  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. }