ENDING.CPP 9.3 KB

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