ENDING.CPP 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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: F:\projects\c&c\vcs\code\ending.cpv 1.5 16 Oct 1995 16:50:30 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 : ENDING.H *
  22. * *
  23. * Programmer : Barry W. Green *
  24. * *
  25. * Start Date : July 10, 1995 *
  26. * *
  27. * Last Update : July 10, 1995 [BWG] *
  28. * *
  29. *---------------------------------------------------------------------------------------------*
  30. * Functions: *
  31. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  32. #include "function.h"
  33. #include "textblit.h"
  34. void GDI_Ending(void)
  35. {
  36. #ifdef DEMO
  37. Fade_Palette_To(BlackPalette, FADE_PALETTE_MEDIUM, Call_Back);
  38. Load_Title_Screen("DEMOPIC.PCX", &HidPage, Palette);
  39. Blit_Hid_Page_To_Seen_Buff();
  40. Fade_Palette_To(Palette, FADE_PALETTE_MEDIUM, Call_Back);
  41. Clear_KeyBuffer();
  42. Get_Key_Num();
  43. Fade_Palette_To(BlackPalette, FADE_PALETTE_MEDIUM, Call_Back);
  44. VisiblePage.Clear();
  45. #else
  46. if (TempleIoned) {
  47. Play_Movie("GDIFINB");
  48. } else {
  49. Play_Movie("GDIFINA");
  50. }
  51. Score.Presentation();
  52. if (TempleIoned) {
  53. Play_Movie("GDIEND2");
  54. } else {
  55. Play_Movie("GDIEND1");
  56. }
  57. CountDownTimerClass count;
  58. if (CCFileClass("TRAILER.VQA").Is_Available()) {
  59. Fade_Palette_To(BlackPalette, FADE_PALETTE_MEDIUM, Call_Back);
  60. Load_Uncompress(CCFileClass("ATTRACT2.CPS"), SysMemPage, SysMemPage, Palette);
  61. SysMemPage.Scale(SeenBuff, 0, 0, 0, 0, 320, 199, 640, 398);
  62. Fade_Palette_To(Palette, FADE_PALETTE_MEDIUM, Call_Back);
  63. Clear_KeyBuffer();
  64. count.Set(TIMER_SECOND*3);
  65. while (count.Time()) {
  66. Call_Back();
  67. }
  68. Fade_Palette_To(BlackPalette, FADE_PALETTE_MEDIUM, Call_Back);
  69. Play_Movie("TRAILER"); // Red Alert teaser.
  70. }
  71. Fade_Palette_To(BlackPalette, FADE_PALETTE_MEDIUM, Call_Back);
  72. Load_Uncompress(CCFileClass("ATTRACT2.CPS"), SysMemPage, SysMemPage, Palette);
  73. SysMemPage.Scale(SeenBuff, 0, 0, 0, 0, 320, 199, 640, 398);
  74. Fade_Palette_To(Palette, FADE_PALETTE_MEDIUM, Call_Back);
  75. Clear_KeyBuffer();
  76. // CountDownTimerClass count;
  77. count.Set(TIMER_SECOND*3);
  78. while (count.Time()) {
  79. Call_Back();
  80. }
  81. Fade_Palette_To(BlackPalette, FADE_PALETTE_MEDIUM, Call_Back);
  82. Play_Movie("CC2TEASE");
  83. #endif
  84. }
  85. #ifndef DEMO
  86. /***********************************************************************************************
  87. * Nod_Ending -- play ending movies for Nod players *
  88. * *
  89. * INPUT: none *
  90. * *
  91. * OUTPUT: none *
  92. * *
  93. * WARNINGS: *
  94. * *
  95. * HISTORY: *
  96. * 7/10/1995 BWG : Created. *
  97. *=============================================================================================*/
  98. void Nod_Ending(void)
  99. {
  100. static unsigned char const _tanpal[]={0x0,0xED,0xED,0x2C,0x2C,0xFB,0xFB,0xFD,0xFD,0x0,0x0,0x0,0x0,0x0,0x52,0x0};
  101. char fname[12];
  102. #ifdef NOT_FOR_WIN95
  103. char *satpic = new char[64000];
  104. #endif //NOT_FOR_WIN95
  105. int oldfontxspacing = FontXSpacing;
  106. void const *oldfont;
  107. Score.Presentation();
  108. oldfont = Set_Font(ScoreFontPtr);
  109. PseudoSeenBuff = new GraphicBufferClass(320,200,(void*)NULL);
  110. TextPrintBuffer = new GraphicBufferClass(SeenBuff.Get_Width(), SeenBuff.Get_Height(), (void*)NULL);
  111. TextPrintBuffer->Clear();
  112. BlitList.Clear();
  113. SeenBuff.Clear();
  114. HidPage.Clear();
  115. PseudoSeenBuff->Clear();
  116. void * localpal = Load_Alloc_Data(CCFileClass("SATSEL.PAL"));
  117. Load_Uncompress(CCFileClass("SATSEL.CPS"), SysMemPage, SysMemPage);
  118. #ifdef NOT_FOR_WIN95
  119. memcpy(satpic, HidPage.Get_Buffer(), 64000);
  120. #else
  121. SysMemPage.Blit(*PseudoSeenBuff);
  122. #endif //NOT_FOR_WIN95
  123. void *kanefinl = Load_Sample("KANEFINL.AUD");
  124. void *loopie6m = Load_Sample("LOOPIE6M.AUD");
  125. Play_Movie("NODFINAL", THEME_NONE, false);
  126. Hide_Mouse();
  127. Wait_Vert_Blank();
  128. Set_Palette(localpal);
  129. #ifdef NOT_FOR_WIN95
  130. memcpy(SeenBuff.Get_Buffer(), satpic, 64000);
  131. #endif //NOT_FOR_WIN95
  132. Show_Mouse();
  133. InterpolationPaletteChanged = TRUE;
  134. InterpolationPalette = (unsigned char*)localpal;
  135. Increase_Palette_Luminance(InterpolationPalette , 30,30,30,63);
  136. Read_Interpolation_Palette("SATSELIN.PAL");
  137. Interpolate_2X_Scale(PseudoSeenBuff, &SeenBuff,"SATSELIN.PAL");
  138. Keyboard::Clear();
  139. Play_Sample(kanefinl,255,128);
  140. Play_Sample(loopie6m,255,128);
  141. bool mouseshown = false;
  142. bool done = false;
  143. int selection = 1;
  144. bool printedtext = false;
  145. while (!done) {
  146. if (!printedtext && !Is_Sample_Playing(kanefinl)) {
  147. printedtext++;
  148. Alloc_Object(new ScorePrintClass(Text_String(TXT_SEL_TARGET), 0, 180,_tanpal));
  149. mouseshown = true;
  150. Show_Mouse();
  151. }
  152. Call_Back_Delay(1);
  153. if (!Keyboard::Check()) {
  154. if (!Is_Sample_Playing(loopie6m)) Play_Sample(loopie6m,255,128);
  155. } else {
  156. if (Is_Sample_Playing(kanefinl)) {
  157. Clear_KeyBuffer();
  158. } else {
  159. int key = Keyboard::Get();
  160. if ((key & 0x10FF) == KN_LMOUSE && !(key & KN_RLSE_BIT)) {
  161. int mousex = _Kbd->MouseQX;
  162. int mousey = _Kbd->MouseQY;
  163. if (mousey >= 22*2 && mousey <= 177*2) {
  164. done++;
  165. if (mousex < 160*2 && mousey < 100*2) selection = 2;
  166. if (mousex < 160*2 && mousey >= 100*2) selection = 3;
  167. if (mousex >= 160*2 && mousey >= 100*2) selection = 4;
  168. }
  169. }
  170. }
  171. }
  172. }
  173. if (mouseshown) Hide_Mouse();
  174. #ifdef NOT_FOR_WIN95
  175. delete satpic;
  176. #else
  177. delete PseudoSeenBuff;
  178. #endif //NOT_FOR_WIN95
  179. /* get rid of all the animating objects */
  180. for (int i = 0; i < MAXSCOREOBJS; i++) if (ScoreObjs[i]) {
  181. delete ScoreObjs[i];
  182. ScoreObjs[i] = 0;
  183. }
  184. // erase the "choose a target" text
  185. SeenBuff.Fill_Rect(0,180*2,319*2,199*2,0);
  186. TextPrintBuffer->Fill_Rect(0,180*2,319*2,199*2,0);
  187. Hide_Mouse();
  188. Keyboard::Clear();
  189. Set_Font(oldfont);
  190. FontXSpacing = oldfontxspacing;
  191. Free_Sample(kanefinl);
  192. Free_Sample(loopie6m);
  193. sprintf(fname,"NODEND%d",selection);
  194. PreserveVQAScreen = 1;
  195. Play_Movie(fname);
  196. CountDownTimerClass count;
  197. if (CCFileClass("TRAILER.VQA").Is_Available()) {
  198. Fade_Palette_To(BlackPalette, FADE_PALETTE_MEDIUM, Call_Back);
  199. Load_Uncompress(CCFileClass("ATTRACT2.CPS"), SysMemPage, SysMemPage, Palette);
  200. SysMemPage.Scale(SeenBuff, 0, 0, 0, 0, 320, 199, 640, 398);
  201. Fade_Palette_To(Palette, FADE_PALETTE_MEDIUM, Call_Back);
  202. Clear_KeyBuffer();
  203. count.Set(TIMER_SECOND*3);
  204. while (count.Time()) {
  205. Call_Back();
  206. }
  207. Fade_Palette_To(BlackPalette, FADE_PALETTE_MEDIUM, Call_Back);
  208. Play_Movie("TRAILER"); // Red Alert teaser.
  209. }
  210. Fade_Palette_To(BlackPalette, FADE_PALETTE_MEDIUM, Call_Back);
  211. Load_Uncompress(CCFileClass("ATTRACT2.CPS"), SysMemPage, SysMemPage, Palette);
  212. SysMemPage.Scale(SeenBuff, 0, 0, 0, 0, 320, 199, 640, 398);
  213. Fade_Palette_To(Palette, FADE_PALETTE_MEDIUM, Call_Back);
  214. Clear_KeyBuffer();
  215. // CountDownTimerClass count;
  216. count.Set(TIMER_SECOND*3);
  217. while (count.Time()) {
  218. Call_Back();
  219. }
  220. Fade_Palette_To(BlackPalette, FADE_PALETTE_MEDIUM, Call_Back);
  221. Play_Movie("CC2TEASE");
  222. delete [] localpal;
  223. delete TextPrintBuffer;
  224. BlitList.Clear();
  225. }
  226. #endif