INTRO.CPP (11037B)
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\intro.cpv 1.6 16 Oct 1995 16:50:18 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 : INTRO.H * 24 * * 25 * Programmer : Barry W. Green * 26 * * 27 * Start Date : May 8, 1995 * 28 * * 29 * Last Update : May 8, 1995 [BWG] * 30 * * 31 *---------------------------------------------------------------------------------------------* 32 * Functions: * 33 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 34 35 #include "function.h" 36 #include "textblit.h" 37 38 #ifndef DEMO 39 40 41 #if (0) //PG_TO_FIX 42 VQAHandle *Open_Movie(char *name); 43 VQAHandle *Open_Movie(char *name) 44 { 45 if (!Debug_Quiet && Get_Digi_Handle() != -1) { 46 AnimControl.OptionFlags |= VQAOPTF_AUDIO; 47 } else { 48 AnimControl.OptionFlags &= ~VQAOPTF_AUDIO; 49 } 50 51 VQAHandle * vqa = VQA_Alloc(); 52 if (vqa) { 53 VQA_Init(vqa, MixFileHandler); 54 55 if (VQA_Open(vqa, name, &AnimControl) != 0) { 56 VQA_Free(vqa); 57 vqa = 0; 58 } 59 } 60 return(vqa); 61 } 62 #endif //(0) 63 64 /*********************************************************************************************** 65 * Choose_Side -- play the introduction movies, select house * 66 * * 67 * INPUT: none * 68 * * 69 * OUTPUT: none * 70 * * 71 * WARNINGS: * 72 * * 73 * HISTORY: * 74 * 5/08/1995 BWG : Created. * 75 *=============================================================================================*/ 76 void Choose_Side(void) 77 { 78 //static char const _yellowpal[]={0x0,0x0,0xC9,0x0,0xBA,0x0,0x93,0x0,0x61,0x0,0x0,0x0,0x0,0x0,0xEE,0x0}; 79 //static char const _redpal[] ={0x0,0x0,0xA8,0x0,0xD9,0x0,0xDA,0x0,0xE1,0x0,0x0,0x0,0x0,0x0,0xD4,0x0}; 80 //static char const _graypal[] ={0x0,0x0,0x17,0x0,0x10,0x0,0x12,0x0,0x14,0x0,0x0,0x0,0x0,0x0,0x1C,0x0}; 81 82 // PG_TO_FIX 83 // Chose GDI 84 Whom = HOUSE_GOOD; 85 ScenPlayer = SCEN_PLAYER_GDI; 86 return; 87 88 #if (0) 89 90 91 static char const _yellowpal[]={0x0,0xC9,0xBA,0x93,0x61,0xEE,0xee,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}; 92 static char const _redpal[] ={0x0,0xa8,0xd9,0xda,0xe1,0xd4,0xDA,0x0,0xE1,0x0,0x0,0x0,0x0,0x0,0xD4,0x0}; 93 static char const _graypal[] ={0x0,0x17,0x10,0x12,0x14,0x1c,0x12,0x1c,0x14,0x0,0x0,0x0,0x0,0x0,0x1C,0x0}; 94 95 96 void *anim; 97 VQAHandle *gdibrief=0, *nodbrief=0; 98 void const *staticaud, *oldfont; 99 void const *speechg, *speechn, *speech; 100 int statichandle, speechhandle, speechplaying = 0; 101 int oldfontxspacing = FontXSpacing; 102 int setpalette = 0; 103 int gdi_start_palette; 104 105 MEMORYSTATUS mem_info; 106 mem_info.dwLength=sizeof(mem_info); 107 GlobalMemoryStatus(&mem_info); 108 109 TextPrintBuffer = new GraphicBufferClass(SeenBuff.Get_Width(), SeenBuff.Get_Height(), (void*)NULL); 110 TextPrintBuffer->Clear(); 111 BlitList.Clear(); 112 PseudoSeenBuff = new GraphicBufferClass(320,200,(void*)NULL); 113 int frame = 0, endframe = 255, selection = 0, lettersdone = 0; 114 115 Hide_Mouse(); 116 /* Change to the six-point font for Text_Print */ 117 oldfont = Set_Font(ScoreFontPtr); 118 119 Call_Back(); 120 121 staticaud = Load_Alloc_Data(CCFileClass("STRUGGLE.AUD")); 122 speechg = Load_Alloc_Data(CCFileClass("GDI_SLCT.AUD")); 123 speechn = Load_Alloc_Data(CCFileClass("NOD_SLCT.AUD")); 124 125 // staticaud = MixFileClass::Retrieve("STRUGGLE.AUD"); 126 // speechg = MixFileClass::Retrieve("GDI_SLCT.AUD"); 127 // speechn = MixFileClass::Retrieve("NOD_SLCT.AUD"); 128 129 if (Special.IsFromInstall){ 130 if (mem_info.dwTotalPhys >= 12*1024*1024){ 131 VisiblePage.Clear(); 132 PreserveVQAScreen = 1; 133 Play_Movie("INTRO2", THEME_NONE, false); 134 } 135 BreakoutAllowed = true; 136 } 137 138 //anim = Open_Animation("CHOOSE.WSA",NULL,0L,(WSAOpenType)(WSA_OPEN_FROM_MEM | WSA_OPEN_TO_PAGE),Palette); 139 anim = Open_Animation("CHOOSE.WSA",NULL,0L,(WSAOpenType)(WSA_OPEN_FROM_DISK | WSA_OPEN_TO_PAGE),Palette); 140 Call_Back(); 141 InterpolationPaletteChanged = TRUE; 142 InterpolationPalette = Palette; 143 Read_Interpolation_Palette("SIDES.PAL"); 144 145 nodbrief = Open_Movie("NOD1PRE.VQA"); 146 gdi_start_palette = Load_Interpolated_Palettes("NOD1PRE.VQP"); 147 Call_Back(); 148 gdibrief = Open_Movie("GDI1.VQA"); 149 Load_Interpolated_Palettes("GDI1.VQP" , TRUE); 150 151 WWMouse->Erase_Mouse(&HidPage, TRUE); 152 HiddenPage.Clear(); 153 PseudoSeenBuff->Clear(); 154 SysMemPage.Clear(); 155 //if (!Special.IsFromInstall) { 156 VisiblePage.Clear(); 157 Set_Palette(Palette); 158 //} else { 159 //setpalette = 1; 160 //} 161 162 statichandle = Play_Sample(staticaud,255,64); 163 CountDownTimerClass sample_timer; 164 sample_timer.Set(0x3f); 165 Alloc_Object(new ScorePrintClass(TXT_GDI_NAME, 0, 180,_yellowpal)); 166 #ifdef FRENCH 167 Alloc_Object(new ScorePrintClass(TXT_GDI_NAME2, 0, 187,_yellowpal)); 168 #endif 169 Alloc_Object(new ScorePrintClass(TXT_NOD_NAME, 180, 180,_redpal)); 170 171 #ifdef GERMAN 172 Alloc_Object(new ScorePrintClass(TXT_SEL_TRANS,57, 190,_graypal)); 173 #else 174 #ifdef FRENCH 175 Alloc_Object(new ScorePrintClass(TXT_SEL_TRANS,103, 194,_graypal)); 176 #else 177 Alloc_Object(new ScorePrintClass(TXT_SEL_TRANS,103, 190,_graypal)); 178 #endif 179 #endif 180 Keyboard::Clear(); 181 182 while (Get_Mouse_State()) Show_Mouse(); 183 184 while (endframe != frame || (speechplaying && Is_Sample_Playing(speech)) ) { 185 Animate_Frame(anim, SysMemPage, frame++); 186 if (setpalette) { 187 Wait_Vert_Blank(); 188 Set_Palette(Palette); 189 setpalette = 0; 190 } 191 SysMemPage.Blit(*PseudoSeenBuff,0,22, 0,22, 320,156); 192 193 /* 194 ** If the sample has stopped or is about to then restart it 195 */ 196 if (!Is_Sample_Playing(staticaud) || !sample_timer.Time()) { 197 Stop_Sample(statichandle); 198 statichandle = Play_Sample(staticaud,255,64); 199 sample_timer.Set(0x3f); 200 } 201 Call_Back_Delay(3); // delay only if haven't clicked 202 203 /* keep the mouse hidden until the letters are thru printing */ 204 if (!lettersdone) { 205 lettersdone = true; 206 for(int i=0; i < MAXSCOREOBJS; i++) if (ScoreObjs[i]) lettersdone = 0; 207 if (lettersdone) { 208 Show_Mouse(); 209 } 210 } 211 if (frame >= Get_Animation_Frame_Count(anim)) frame = 0; 212 if (Keyboard::Check() && endframe == 255) { 213 if ((Keyboard::Get() & 0x10FF) == KN_LMOUSE) { 214 if ((_Kbd->MouseQY > 48*2) && (_Kbd->MouseQY < 150*2)) { 215 if ((_Kbd->MouseQX > 18*2) && (_Kbd->MouseQX < 148*2)) { 216 217 // Chose GDI 218 Whom = HOUSE_GOOD; 219 ScenPlayer = SCEN_PLAYER_GDI; 220 endframe = 0; 221 speechhandle = Play_Sample(speechg); 222 speechplaying = true; 223 speech = speechg; 224 225 } else if ((_Kbd->MouseQX > 160*2) && (_Kbd->MouseQX < 300*2)) { 226 // Chose Nod 227 selection = 1; 228 endframe = 14; 229 Whom = HOUSE_BAD; 230 ScenPlayer = SCEN_PLAYER_NOD; 231 speechhandle = Play_Sample(speechn); 232 speechplaying = true; 233 speech = speechn; 234 } 235 } 236 } 237 } 238 } 239 240 Hide_Mouse(); 241 Close_Animation(anim); 242 243 // erase the "choose side" text 244 PseudoSeenBuff->Fill_Rect(0,180,319,199,0); 245 SeenBuff.Fill_Rect(0,180*2, 319*2, 199*2, 0); 246 Interpolate_2X_Scale (PseudoSeenBuff , &SeenBuff ,"SIDES.PAL"); 247 Keyboard::Clear(); 248 SysMemPage.Clear(); 249 250 /* 251 ** Skip the briefings if we're in special mode. 252 */ 253 if (Special.IsJurassic && AreThingiesEnabled) { 254 if (nodbrief) { 255 VQA_Close(nodbrief); 256 VQA_Free(nodbrief); 257 nodbrief = NULL; 258 } 259 if (gdibrief) { 260 VQA_Close(gdibrief); 261 VQA_Free(gdibrief); 262 gdibrief = NULL; 263 } 264 } 265 266 /* play the scenario 1 briefing movie */ 267 if (Whom == HOUSE_GOOD) { 268 if (nodbrief) { 269 VQA_Close(nodbrief); 270 VQA_Free(nodbrief); 271 } 272 if (gdibrief) { 273 PaletteCounter = gdi_start_palette; 274 VQA_Play(gdibrief, VQAMODE_RUN); 275 VQA_Close(gdibrief); 276 VQA_Free(gdibrief); 277 } 278 } else { 279 if (gdibrief) { 280 VQA_Close(gdibrief); 281 VQA_Free(gdibrief); 282 } 283 if (nodbrief) { 284 VQA_Play(nodbrief, VQAMODE_RUN); 285 VQA_Close(nodbrief); 286 VQA_Free(nodbrief); 287 } 288 } 289 290 Free_Interpolated_Palettes(); 291 Set_Primary_Buffer_Format(); 292 /* get rid of all the animating objects */ 293 for (int i = 0; i < MAXSCOREOBJS; i++) if (ScoreObjs[i]) { 294 delete ScoreObjs[i]; 295 ScoreObjs[i] = 0; 296 } 297 298 if (Whom == HOUSE_GOOD) { 299 /* 300 ** Make sure the screen's fully clear after the movie plays 301 */ 302 VisiblePage.Clear(); 303 memset(BlackPalette, 0x01, 768); 304 Set_Palette(BlackPalette); 305 memset(BlackPalette, 0x00, 768); 306 } else { 307 PreserveVQAScreen = 1; 308 } 309 Free(staticaud); 310 Free(speechg); 311 Free(speechn); 312 313 Set_Font(oldfont); 314 FontXSpacing = oldfontxspacing; 315 316 delete PseudoSeenBuff; 317 delete TextPrintBuffer; 318 TextPrintBuffer = NULL; 319 BlitList.Clear(); 320 321 #endif 322 } 323 #endif