CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

INTRO.CPP (9831B)


      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: /CounterStrike/INTRO.CPP 1     3/03/97 10:24a 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 
     37 
     38 #if (0) //PG
     39 VQAHandle * Open_Movie(char * name);
     40 VQAHandle * Open_Movie(char * name)
     41 {
     42 	if (!Debug_Quiet && Get_Digi_Handle() != -1) {
     43 		AnimControl.OptionFlags |= VQAOPTF_AUDIO;
     44 	} else {
     45 		AnimControl.OptionFlags &= ~VQAOPTF_AUDIO;
     46 	}
     47 
     48 	VQAHandle * vqa = VQA_Alloc();
     49 	if (vqa) {
     50 		VQA_Init(vqa, MixFileHandler);
     51 
     52 		if (VQA_Open(vqa, name, &AnimControl) != 0) {
     53 			VQA_Free(vqa);
     54 			vqa = 0;
     55 		}
     56 	}
     57 	return(vqa);
     58 }
     59 #endif
     60 
     61 /***********************************************************************************************
     62  * Choose_Side -- play the introduction movies, select house                                   *
     63  *                                                                                             *
     64  * INPUT:   none                                                                               *
     65  *                                                                                             *
     66  * OUTPUT:  none                                                                               *
     67  *                                                                                             *
     68  * WARNINGS:                                                                                   *
     69  *                                                                                             *
     70  * HISTORY:                                                                                    *
     71  *   5/08/1995 BWG : Created.                                                                  *
     72  *=============================================================================================*/
     73 void Choose_Side(void)		//	ajw - In RA, all this did was play a movie. Denzil is using it in its original sense.
     74 {
     75 
     76 	Whom = HOUSE_GOOD;
     77 
     78 #if (0)	//PG
     79 	if (Special.IsFromInstall) {
     80 		#ifdef DVD // Denzil
     81 		if( Using_DVD() )
     82 		{
     83 			Hide_Mouse();
     84 			Load_Title_Page();
     85 			GamePalette = CCPalette;
     86 			HidPage.Blit(SeenPage);
     87 			CCPalette.Set();
     88 			Set_Logic_Page(SeenBuff);
     89 			Show_Mouse();
     90 			
     91 			switch (WWMessageBox().Process(TXT_CHOOSE, TXT_ALLIES, TXT_SOVIET))
     92 				{
     93 				case 0:
     94 					CurrentCD = 0;
     95 				break;
     96 
     97 				case 1:
     98 					CurrentCD = 1;
     99 				break;
    100 				}
    101 
    102 			Hide_Mouse();
    103 			BlackPalette.Set(FADE_PALETTE_SLOW);
    104 			SeenPage.Clear();
    105 		}
    106 		#endif
    107 		
    108 		Play_Movie(VQ_INTRO_MOVIE, THEME_NONE, false);
    109 	}
    110 #endif
    111 //	Scen.ScenPlayer = SCEN_PLAYER_GREECE;
    112 
    113 #ifdef OBSOLETE
    114 	static char const _yellowpal[]={0x0,0x0,0xC9,0x0,0xBA,0x0,0x93,0x0,0x61,0x0,0x0,0x0,0x0,0x0,0xEE,0x0};
    115 	static char const _redpal[]   ={0x0,0x0,0xA8,0x0,0xD9,0x0,0xDA,0x0,0xE1,0x0,0x0,0x0,0x0,0x0,0xD4,0x0};
    116 	static char const _graypal[]  ={0x0,0x0,0x17,0x0,0x10,0x0,0x12,0x0,0x14,0x0,0x0,0x0,0x0,0x0,0x1C,0x0};
    117 
    118 	void * anim;
    119 	VQAHandle * gdibrief=0, * nodbrief=0;
    120 	void const * staticaud, * oldfont;
    121 	void const * speechg, * speechn, * speech;
    122 	int statichandle, speechhandle, speechplaying = 0;
    123 	int oldfontxspacing = FontXSpacing;
    124 	int setpalette = 0;
    125 
    126 	int frame = 0, endframe = 255, selection = 0, lettersdone = 0;
    127 
    128 	Hide_Mouse();
    129 /* Change to the six-point font for Text_Print */
    130 	oldfont = Set_Font(ScoreFontPtr);
    131 
    132 	Call_Back();
    133 
    134 	staticaud = Load_Alloc_Data(CCFileClass("STRUGGLE.AUD"));
    135 	speechg = Load_Alloc_Data(CCFileClass("GDI_SLCT.AUD"));
    136 	speechn = Load_Alloc_Data(CCFileClass("NOD_SLCT.AUD"));
    137 
    138 //	staticaud = MixFileClass::Retrieve("STRUGGLE.AUD");
    139 //	speechg = MixFileClass::Retrieve("GDI_SLCT.AUD");
    140 //	speechn = MixFileClass::Retrieve("NOD_SLCT.AUD");
    141 
    142 	anim = Open_Animation("CHOOSE.WSA", NULL, 0L, (WSAOpenType)(WSA_OPEN_FROM_MEM | WSA_OPEN_TO_PAGE), Palette);
    143 	Call_Back();
    144 
    145 	nodbrief = Open_Movie("NOD1PRE.VQA");
    146 	Call_Back();
    147 	gdibrief = Open_Movie("GDI1.VQA");
    148 
    149 	if (Special.IsFromInstall) {
    150 		Set_Video_Mode(MCGA_MODE);
    151 		PreserveVQAScreen = 1;
    152 //		Hide_Mouse();
    153 		Play_Movie("INTRO2", THEME_NONE, false);
    154 		Show_Mouse();
    155 	}
    156 
    157 	HidPage.Clear();
    158 	if (!Special.IsFromInstall) {
    159 		SeenPage.Clear();
    160 //		Set_Palette(Palette);
    161 		Palette.Set();
    162 	} else {
    163 		setpalette = 1;
    164 	}
    165 
    166 	statichandle = Play_Sample(staticaud, 255, 64);
    167 	Alloc_Object(new ScorePrintClass(TXT_GDI_NAME,   0, 180, _yellowpal));
    168 #ifdef FRENCH
    169 	Alloc_Object(new ScorePrintClass(TXT_GDI_NAME2,  0, 187, _yellowpal));
    170 #endif
    171 	Alloc_Object(new ScorePrintClass(TXT_NOD_NAME, 180, 180, _redpal));
    172 
    173 #ifdef GERMAN
    174 	Alloc_Object(new ScorePrintClass(TXT_SEL_TRANS, 57, 190, _graypal));
    175 #else
    176 #ifdef FRENCH
    177 	Alloc_Object(new ScorePrintClass(TXT_SEL_TRANS, 103, 194, _graypal));
    178 #else
    179 	Alloc_Object(new ScorePrintClass(TXT_SEL_TRANS, 103, 190, _graypal));
    180 #endif
    181 #endif
    182 	Keyboard->Clear();
    183 
    184 	while (endframe != frame || (speechplaying && Is_Sample_Playing(speech)) ) {
    185 		Animate_Frame(anim, HidPage, frame++);
    186 		Hide_Mouse();
    187 		if (setpalette) {
    188 			Wait_Vert_Blank(VertBlank);
    189 			//Set_Palette(Palette);
    190 			Palette.Set();
    191 			setpalette = 0;
    192 		}
    193 		HidPage.Blit(SeenPage, 0, 22, 0, 22, 320, 156);
    194 		Show_Mouse();
    195 
    196 		if (!Is_Sample_Playing(staticaud)) statichandle = Play_Sample(staticaud, 255, 64);
    197 		Call_Back_Delay(3);	// delay only if haven't clicked
    198 
    199 		/* keep the mouse hidden until the letters are thru printing */
    200 		if (!lettersdone) {
    201 			lettersdone = true;
    202 			for (int i=0; i < MAXSCOREOBJS; i++) if (ScoreObjs[i]) lettersdone = 0;
    203 			if (lettersdone) {
    204 				Show_Mouse();
    205 			}
    206 		}
    207 		if (frame >= Get_Animation_Frame_Count(anim)) frame = 0;
    208 		if (Keyboard->Check() && endframe == 255) {
    209 			if ((Keyboard->Get() & 0xFF) == KN_LMOUSE) {
    210 				if ((MouseQY > 48) && (MouseQY < 150)) {
    211 					if ((MouseQX > 18) && (MouseQX < 148)) {
    212 
    213 					// Chose GDI
    214 						Whom = HOUSE_GOOD;
    215 						ScenPlayer = SCEN_PLAYER_GDI;
    216 						endframe = 0;
    217 						speechhandle = Play_Sample(speechg);
    218 						speechplaying = true;
    219 						speech = speechg;
    220 					} else if ((MouseQX > 160) && (MouseQX < 300)) {
    221 					// Chose Nod
    222 						selection = 1;
    223 						endframe = 14;
    224 						Whom = HOUSE_BAD;
    225 						ScenPlayer = SCEN_PLAYER_NOD;
    226 						speechhandle = Play_Sample(speechn);
    227 						speechplaying = true;
    228 						speech = speechn;
    229 					}
    230 				}
    231 			}
    232 		}
    233 	}
    234 
    235 	Hide_Mouse();
    236 	Close_Animation(anim);
    237 
    238 	// erase the "choose side" text
    239 	SeenBuff.Fill_Rect(0, 180, 319, 199, 0);
    240 
    241 	Keyboard->Clear();
    242 
    243 	/* play the scenario 1 briefing movie */
    244 	if (Whom == HOUSE_GOOD) {
    245 		if (nodbrief) {
    246 			VQA_Close(nodbrief);
    247 			VQA_Free(nodbrief);
    248 		}
    249 		if (gdibrief) {
    250 #ifdef CHEAT_KEYS
    251 #else
    252 			VQA_Play(gdibrief, VQAMODE_RUN);
    253 #endif
    254 			VQA_Close(gdibrief);
    255 			VQA_Free(gdibrief);
    256 		}
    257 	} else {
    258 		if (gdibrief) {
    259 			VQA_Close(gdibrief);
    260 			VQA_Free(gdibrief);
    261 		}
    262 		if (nodbrief) {
    263 #ifdef CHEAT_KEYS
    264 #else
    265 			VQA_Play(nodbrief, VQAMODE_RUN);
    266 #endif
    267 			VQA_Close(nodbrief);
    268 			VQA_Free(nodbrief);
    269 		}
    270 	}
    271 
    272 /* get rid of all the animating objects */
    273 	for (int i = 0; i < MAXSCOREOBJS; i++) if (ScoreObjs[i]) {
    274 		delete ScoreObjs[i];
    275 		ScoreObjs[i] = 0;
    276 	}
    277 
    278 	if (Whom == HOUSE_GOOD) {
    279 		/*
    280 		** Make sure the screen's fully clear after the movie plays
    281 		*/
    282 		SeenPage.Clear();
    283 
    284 		BlackPalette.Adjust(WhitePalette, 0x08);
    285 		BlackPalette.Set();
    286 		BlackPalette.Adjust(0xFF);
    287 		BlackPalette.Set();
    288 
    289 //		memset(BlackPalette, 0x01, 768);
    290 //		Set_Palette(BlackPalette);
    291 //		memset(BlackPalette, 0x00, 768);
    292 	} else {
    293 		PreserveVQAScreen = 1;
    294 	}
    295 	Free(staticaud);
    296 	Free(speechg);
    297 	Free(speechn);
    298 
    299 	Set_Font(oldfont);
    300 	FontXSpacing = oldfontxspacing;
    301 #endif
    302 }