CnC_Remastered_Collection

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

ENDING.CPP (6314B)


      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/ENDING.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 : 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 
     37 void GDI_Ending(void)
     38 {
     39 #ifdef NEVER
     40 	if (TempleIoned) {
     41 		Play_Movie("GDIFINB");
     42 	} else {
     43 		Play_Movie("GDIFINA");
     44 	}
     45 
     46 	Score.Presentation();
     47 
     48 	if (TempleIoned) {
     49 		Play_Movie("GDIEND2");
     50 	} else {
     51 		Play_Movie("GDIEND1");
     52 	}
     53 	Play_Movie("CC2TEASE");
     54 #endif
     55 }
     56 
     57 
     58 /***********************************************************************************************
     59  * Nod_Ending -- play ending movies for Nod players                                            *
     60  *                                                                                             *
     61  * INPUT:   none                                                                               *
     62  *                                                                                             *
     63  * OUTPUT:  none                                                                               *
     64  *                                                                                             *
     65  * WARNINGS:                                                                                   *
     66  *                                                                                             *
     67  * HISTORY:                                                                                    *
     68  *   7/10/1995 BWG : Created.                                                                  *
     69  *=============================================================================================*/
     70 void Nod_Ending(void)
     71 {
     72 #ifdef NEVER
     73 	static char const _tanpal[]={0x0,0x0,0xED,0x0,0x2C,0x0,0xFB,0x0,0xFD,0x0,0x0,0x0,0x0,0x0,0x52,0x0};
     74 
     75 	char fname[12];
     76 	char * satpic = new char[64000];
     77 	int oldfontxspacing = FontXSpacing;
     78 	void const * oldfont;
     79 
     80 	Score.Presentation();
     81 
     82 	oldfont = Set_Font(ScoreFontPtr);
     83 
     84 	void * localpal = Load_Alloc_Data(CCFileClass("SATSEL.PAL"));
     85 	Load_Uncompress(CCFileClass("SATSEL.CPS"), HidPage, HidPage);
     86 	memcpy(satpic, HidPage.Get_Buffer(), 64000);
     87 
     88 	void * kanefinl = Load_Sample("KANEFINL.AUD");
     89 	void * loopie6m = Load_Sample("LOOPIE6M.AUD");
     90 
     91 	Play_Movie("NODFINAL", THEME_NONE, false);
     92 
     93 	Hide_Mouse();
     94 	Wait_Vert_Blank(VertBlank);
     95 	Set_Palette(localpal);
     96 	memcpy(SeenBuff.Get_Buffer(), satpic, 64000);
     97 	Show_Mouse();
     98 
     99 	Keyboard->Clear();
    100 	Play_Sample(kanefinl, 255, 128);
    101 	Play_Sample(loopie6m, 255, 128);
    102 
    103 	bool mouseshown = false;
    104 	bool done = false;
    105 	int selection = 1;
    106 	bool printedtext = false;
    107 	while (!done) {
    108 		if (!printedtext && !Is_Sample_Playing(kanefinl)) {
    109 			printedtext++;
    110 			Alloc_Object(new ScorePrintClass(Text_String(TXT_SEL_TARGET), 0, 180, _tanpal));
    111 			mouseshown = true;
    112 			Show_Mouse();
    113 		}
    114 		Call_Back_Delay(1);
    115 		if (!Keyboard->Check()) {
    116 			if (!Is_Sample_Playing(loopie6m))	Play_Sample(loopie6m, 255, 128);
    117 		} else {
    118 			if (Is_Sample_Playing(kanefinl)) {
    119 				Clear_KeyBuffer();
    120 			} else {
    121 				int key = Keyboard->Get();
    122 				if ((key & 0xFF) == KN_LMOUSE && !(key & KN_RLSE_BIT)) {
    123 					int mousex = MouseQX;
    124 					int mousey = MouseQY;
    125 					if (mousey >= 22 && mousey <= 177) {
    126 						done++;
    127 						if (mousex <  160 && mousey <  100) selection = 2;
    128 						if (mousex <  160 && mousey >= 100) selection = 3;
    129 						if (mousex >= 160 && mousey >= 100) selection = 4;
    130 					}
    131 				}
    132 			}
    133 		}
    134 	}
    135 	if (mouseshown) Hide_Mouse();
    136 	delete satpic;
    137 
    138 /* get rid of all the animating objects */
    139 	for (int i = 0; i < MAXSCOREOBJS; i++) if (ScoreObjs[i]) {
    140 		delete ScoreObjs[i];
    141 		ScoreObjs[i] = 0;
    142 	}
    143 	// erase the "choose a target" text
    144 	SeenBuff.Fill_Rect(0, 180, 319, 199, 0);
    145 
    146 	Hide_Mouse();
    147 	Keyboard->Clear();
    148 
    149 	Set_Font(oldfont);
    150 	FontXSpacing = oldfontxspacing;
    151 	Free_Sample(kanefinl);
    152 	Free_Sample(loopie6m);
    153 
    154 	sprintf(fname, "NODEND%d", selection);
    155 	PreserveVQAScreen = 1;
    156 	Play_Movie(fname);
    157 
    158 	Play_Movie("CC2TEASE");
    159 #endif
    160 }