ENDING.CPP (9637B)
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 9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 10 // in the hope that it will be useful, but with permitted additional restrictions 11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 12 // distributed with this program. You should have received a copy of the 13 // GNU General Public License along with permitted additional restrictions 14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection 15 16 /* $Header: F:\projects\c&c\vcs\code\ending.cpv 1.5 16 Oct 1995 16:50:30 JOE_BOSTIC $ */ 17 /*********************************************************************************************** 18 *** 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 *** 19 *********************************************************************************************** 20 * * 21 * Project Name : Command & Conquer * 22 * * 23 * File Name : ENDING.H * 24 * * 25 * Programmer : Barry W. Green * 26 * * 27 * Start Date : July 10, 1995 * 28 * * 29 * Last Update : July 10, 1995 [BWG] * 30 * * 31 *---------------------------------------------------------------------------------------------* 32 * Functions: * 33 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 34 35 #include "function.h" 36 #include "textblit.h" 37 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 Blit_Hid_Page_To_Seen_Buff(); 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 50 #else 51 if (TempleIoned) { 52 Play_Movie("GDIFINB"); 53 } else { 54 Play_Movie("GDIFINA"); 55 } 56 57 Score.Presentation(); 58 59 if (TempleIoned) { 60 Play_Movie("GDIEND2"); 61 } else { 62 Play_Movie("GDIEND1"); 63 } 64 65 CountDownTimerClass count; 66 if (CCFileClass("TRAILER.VQA").Is_Available()) { 67 Fade_Palette_To(BlackPalette, FADE_PALETTE_MEDIUM, Call_Back); 68 Load_Uncompress(CCFileClass("ATTRACT2.CPS"), SysMemPage, SysMemPage, Palette); 69 SysMemPage.Scale(SeenBuff, 0, 0, 0, 0, 320, 199, 640, 398); 70 Fade_Palette_To(Palette, FADE_PALETTE_MEDIUM, Call_Back); 71 Clear_KeyBuffer(); 72 count.Set(TIMER_SECOND*3); 73 while (count.Time()) { 74 Call_Back(); 75 } 76 Fade_Palette_To(BlackPalette, FADE_PALETTE_MEDIUM, Call_Back); 77 78 Play_Movie("TRAILER"); // Red Alert teaser. 79 } 80 81 Fade_Palette_To(BlackPalette, FADE_PALETTE_MEDIUM, Call_Back); 82 Load_Uncompress(CCFileClass("ATTRACT2.CPS"), SysMemPage, SysMemPage, Palette); 83 SysMemPage.Scale(SeenBuff, 0, 0, 0, 0, 320, 199, 640, 398); 84 Fade_Palette_To(Palette, FADE_PALETTE_MEDIUM, Call_Back); 85 Clear_KeyBuffer(); 86 // CountDownTimerClass count; 87 count.Set(TIMER_SECOND*3); 88 while (count.Time()) { 89 Call_Back(); 90 } 91 Fade_Palette_To(BlackPalette, FADE_PALETTE_MEDIUM, Call_Back); 92 93 Play_Movie("CC2TEASE"); 94 #endif 95 } 96 97 98 #ifndef DEMO 99 /*********************************************************************************************** 100 * Nod_Ending -- play ending movies for Nod players * 101 * * 102 * INPUT: none * 103 * * 104 * OUTPUT: none * 105 * * 106 * WARNINGS: * 107 * * 108 * HISTORY: * 109 * 7/10/1995 BWG : Created. * 110 *=============================================================================================*/ 111 void Nod_Ending(void) 112 { 113 static unsigned char const _tanpal[]={0x0,0xED,0xED,0x2C,0x2C,0xFB,0xFB,0xFD,0xFD,0x0,0x0,0x0,0x0,0x0,0x52,0x0}; 114 115 char fname[12]; 116 #ifdef NOT_FOR_WIN95 117 char *satpic = new char[64000]; 118 #endif //NOT_FOR_WIN95 119 int oldfontxspacing = FontXSpacing; 120 void const *oldfont; 121 122 Score.Presentation(); 123 124 oldfont = Set_Font(ScoreFontPtr); 125 126 PseudoSeenBuff = new GraphicBufferClass(320,200,(void*)NULL); 127 TextPrintBuffer = new GraphicBufferClass(SeenBuff.Get_Width(), SeenBuff.Get_Height(), (void*)NULL); 128 TextPrintBuffer->Clear(); 129 BlitList.Clear(); 130 SeenBuff.Clear(); 131 HidPage.Clear(); 132 PseudoSeenBuff->Clear(); 133 134 void * localpal = Load_Alloc_Data(CCFileClass("SATSEL.PAL")); 135 Load_Uncompress(CCFileClass("SATSEL.CPS"), SysMemPage, SysMemPage); 136 #ifdef NOT_FOR_WIN95 137 memcpy(satpic, HidPage.Get_Buffer(), 64000); 138 #else 139 SysMemPage.Blit(*PseudoSeenBuff); 140 #endif //NOT_FOR_WIN95 141 void *kanefinl = Load_Sample("KANEFINL.AUD"); 142 void *loopie6m = Load_Sample("LOOPIE6M.AUD"); 143 144 Play_Movie("NODFINAL", THEME_NONE, false); 145 146 Hide_Mouse(); 147 Wait_Vert_Blank(); 148 Set_Palette(localpal); 149 #ifdef NOT_FOR_WIN95 150 memcpy(SeenBuff.Get_Buffer(), satpic, 64000); 151 #endif //NOT_FOR_WIN95 152 Show_Mouse(); 153 154 InterpolationPaletteChanged = TRUE; 155 InterpolationPalette = (unsigned char*)localpal; 156 Increase_Palette_Luminance(InterpolationPalette , 30,30,30,63); 157 Read_Interpolation_Palette("SATSELIN.PAL"); 158 Interpolate_2X_Scale(PseudoSeenBuff, &SeenBuff,"SATSELIN.PAL"); 159 160 Keyboard::Clear(); 161 Play_Sample(kanefinl,255,128); 162 Play_Sample(loopie6m,255,128); 163 164 bool mouseshown = false; 165 bool done = false; 166 int selection = 1; 167 bool printedtext = false; 168 while (!done) { 169 if (!printedtext && !Is_Sample_Playing(kanefinl)) { 170 printedtext++; 171 Alloc_Object(new ScorePrintClass(Text_String(TXT_SEL_TARGET), 0, 180,_tanpal)); 172 mouseshown = true; 173 Show_Mouse(); 174 } 175 Call_Back_Delay(1); 176 if (!Keyboard::Check()) { 177 if (!Is_Sample_Playing(loopie6m)) Play_Sample(loopie6m,255,128); 178 } else { 179 if (Is_Sample_Playing(kanefinl)) { 180 Clear_KeyBuffer(); 181 } else { 182 int key = Keyboard::Get(); 183 if ((key & 0x10FF) == KN_LMOUSE && !(key & KN_RLSE_BIT)) { 184 int mousex = _Kbd->MouseQX; 185 int mousey = _Kbd->MouseQY; 186 if (mousey >= 22*2 && mousey <= 177*2) { 187 done++; 188 if (mousex < 160*2 && mousey < 100*2) selection = 2; 189 if (mousex < 160*2 && mousey >= 100*2) selection = 3; 190 if (mousex >= 160*2 && mousey >= 100*2) selection = 4; 191 } 192 } 193 } 194 } 195 } 196 if (mouseshown) Hide_Mouse(); 197 #ifdef NOT_FOR_WIN95 198 delete satpic; 199 #else 200 delete PseudoSeenBuff; 201 #endif //NOT_FOR_WIN95 202 203 /* get rid of all the animating objects */ 204 for (int i = 0; i < MAXSCOREOBJS; i++) if (ScoreObjs[i]) { 205 delete ScoreObjs[i]; 206 ScoreObjs[i] = 0; 207 } 208 // erase the "choose a target" text 209 SeenBuff.Fill_Rect(0,180*2,319*2,199*2,0); 210 TextPrintBuffer->Fill_Rect(0,180*2,319*2,199*2,0); 211 212 Hide_Mouse(); 213 Keyboard::Clear(); 214 215 Set_Font(oldfont); 216 FontXSpacing = oldfontxspacing; 217 Free_Sample(kanefinl); 218 Free_Sample(loopie6m); 219 220 sprintf(fname,"NODEND%d",selection); 221 PreserveVQAScreen = 1; 222 Play_Movie(fname); 223 224 CountDownTimerClass count; 225 if (CCFileClass("TRAILER.VQA").Is_Available()) { 226 Fade_Palette_To(BlackPalette, FADE_PALETTE_MEDIUM, Call_Back); 227 Load_Uncompress(CCFileClass("ATTRACT2.CPS"), SysMemPage, SysMemPage, Palette); 228 SysMemPage.Scale(SeenBuff, 0, 0, 0, 0, 320, 199, 640, 398); 229 Fade_Palette_To(Palette, FADE_PALETTE_MEDIUM, Call_Back); 230 Clear_KeyBuffer(); 231 count.Set(TIMER_SECOND*3); 232 while (count.Time()) { 233 Call_Back(); 234 } 235 Fade_Palette_To(BlackPalette, FADE_PALETTE_MEDIUM, Call_Back); 236 237 Play_Movie("TRAILER"); // Red Alert teaser. 238 } 239 240 Fade_Palette_To(BlackPalette, FADE_PALETTE_MEDIUM, Call_Back); 241 Load_Uncompress(CCFileClass("ATTRACT2.CPS"), SysMemPage, SysMemPage, Palette); 242 SysMemPage.Scale(SeenBuff, 0, 0, 0, 0, 320, 199, 640, 398); 243 Fade_Palette_To(Palette, FADE_PALETTE_MEDIUM, Call_Back); 244 Clear_KeyBuffer(); 245 // CountDownTimerClass count; 246 count.Set(TIMER_SECOND*3); 247 while (count.Time()) { 248 Call_Back(); 249 } 250 Fade_Palette_To(BlackPalette, FADE_PALETTE_MEDIUM, Call_Back); 251 252 Play_Movie("CC2TEASE"); 253 254 delete [] localpal; 255 delete TextPrintBuffer; 256 BlitList.Clear(); 257 } 258 #endif