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