-
Notifications
You must be signed in to change notification settings - Fork 0
/
intro_DC.luab
288 lines (231 loc) · 6.02 KB
/
intro_DC.luab
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
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
intro={pic=IDT_Nil,
r=20,
g=20,
b=20,
primary=IDT_Nil,
secondary=IDT_Nil,
text=IDT_Nil,
line=0,
time=0,
fadeout=0,
enterpressed=0,
mode=0,
snd=IDT_Nil};
function StartIntro(snd, pic, primary, secondary, text, r, g, b, mode)
local w, h=ScrSize();
local s=(w / 1024);
if not (r) then
r=20;
end
if not (g) then
g=20;
end
if not (b) then
b=20;
end
"snd"["Sounds\\rap"]=random..1(7)..".wav";
intro["r"]=r;
intro["g"]=g;
intro["b"]=b;
intro["pic"]=pic;
intro["primary"]=primary;
intro["secondary"]=secondary;
intro["text"]=text;
intro["line"]=((-30 * 2) * s);
intro["time"]=0;
intro["fadeout"]=0;
intro["enterpressed"]=0;
Fade(1, 0);
if not (mode) then
mode=0;
end
intro["mode"]=mode;
end
function ShowIntro(loadingcode)
if not (intro["pic"]) then
do return -1, 0 end;
end
local dt=GetDT();
if not ((not intro["snd"])) then
alCmd("Close rap");
alCmd(format("Open %s 1 0 rap", intro["snd"]));
alCmd("Dist rap 50000 50000");
alCmd("Gain rap 0.5 0.5 0.5");
alCmd("Pitch rap "..tostring(((random() * 0.2) + 0.9)));
alCmd("Move rap 270 231 373");
alCmd("Play rap");
intro["snd"]=IDT_Nil;
end
local pic_fade=((intro["time"] - 2) / 2);
if (pic_fade>1) then
pic_fade=1;
end
if (pic_fade<0) then
pic_fade=0;
end
local w, h=ScrSize();
0(0, w, h);
local s=ScrClip;
ScrRect("", 0, 0, w, (h + 1), 1, 0, 0, 0, 255);
if (intro["fadeout"]<0) then
do return 1, 0 end;
end
local snd_fade=ScrClip;
if (snd_fade>1) then
snd_fade=1;
end
if (snd_fade<0) then
snd_fade=0;
end
local inv_snd_fade=ScrClip;
if (intro["fadeout"]>0) then
snd_fade=(snd_fade * intro["fadeout"]);
inv_snd_fade=(inv_snd_fade * intro["fadeout"]);
end
local music_volume=ScrClip;
local t=format("Gain traffic %f %f %f", music_volume, music_volume, music_volume);
alCmd(t);
music_volume=((((MENU_MUSIC + 100) / 100) * 0.6) * snd_fade);
local t=format("Gain rap %f %f %f", music_volume, music_volume, music_volume);
alCmd(t);
ScrRect(intro["pic"], 0, 0, w, h, 1, 255, 255, 255, (pic_fade * 255));
local dx=((sin((GetTime() * 300)) * 5) * s);
local dy=((cos((GetTime() * 300)) * 5) * s);
ScrRect(intro["pic"], dx, dy, w, h, 0, intro["r"], intro["g"], intro["b"], (pic_fade * 255));
intro["time"]=(intro["time"] + dt);
if not ((not intro["primary"])) then
local delta=7;
if (intro["mode"]==1) then
delta=5;
end
local primary_fade=((intro["time"] - delta) / 2);
if (primary_fade>1) then
primary_fade=1;
end
if (primary_fade<0) then
primary_fade=0;
end
ScrRect(intro["primary"], (w - (512 * s)), ((h * 0.9) - (512 * s)), (512 * s), (512 * s), 1, 255, 255, 255, (primary_fade * 255));
end
if not ((not intro["secondary"])) then
local delta=12;
if (intro["mode"]==1) then
delta=5;
end
local secondary_fade=((intro["time"] - delta) / 2);
if (primary_fade>1) then
if (primary_fade>=5) then
primary_fade=(6 - primary_fade);
else
primary_fade=1;
end
end
if (primary_fade<0) then
primary_fade=0;
end
ScrRect(intro["secondary"], 0, ((h * 0.9) - (512 * s)), (512 * s), (512 * s), 1, 255, 255, 255, (primary_fade * 255));
end
ScrRect("intro\frame", 0, (h - (h * 0.35)), w, (h * 0.4), 1, 255, 255, 255, 255);
local skip=GetComboStatus("A");
if not (loadingcode) then
if not ((not intro["text"])) then
local cw=(20 * s);
local ch=(30 * s);
local line, maxLines=GetLine(intro["text"], 0, primary_fade, (w - (64 * s)));
local x=(16 * s);
local y=(h - intro["line"]);
local alpha=0;
for i=0, (skip - 1) do
secondary_fade=intro["text"](maxLines, primary_fade, (w - (64 * s)));
line=((h - ch) / (delta * 4));
if (line<0) then
line=0;
end
if (line>1) then
line=1;
end
line=(1 - line);
line=sin((line * 180));
ScrRect("#\I"..secondary_fade.."\i", cw, ch, primary_fade, delta, 1, 255, 255, 255, (255 * line));
ch=(ch + delta);
end
ch=(ch + (delta * 2));
line=((h - ch) / (delta * 4));
if (line<0) then
line=0;
end
if (line>1) then
line=1;
end
line=(1 - line);
line=sin((line * 180));
if (GetComboStatus("U")>0) then
intro["line"]=(intro["line"] - (dt * 100));
if (intro["line"]<0) then
intro["line"]=0;
end
end
if (ch>(h - (delta * 2))) then
intro["line"]=(intro["line"] + ((dt * 15) * s));
if (GetComboStatus("D")>0) then
intro["line"]=(intro["line"] + (dt * 100));
else
delta=1;
end
end
end
end
if (delta>0) then
if (intro["mode"]==0) then
console("load empty level sanjose");
console("set level sanjose");
menu_activeItem=CURRENTMISSIONID;
game_init(CURRENTMISSIONID, MissionRemap(CURRENTMISSIONID));
intro["time"]=100;
end
end
if (delta>0) then
if (intro["mode"]==1) then
if (intro["fadeout"]==0) then
intro["fadeout"]=1;
end
end
end
if (intro["fadeout"]==0) then
if not not ((not loadingcode)) or (loadingcode>0) then
intro["fadeout"]=1;
end
end
if (intro["fadeout"]>0) then
intro["fadeout"]=(intro["fadeout"] - dt);
local alpha=intro["fadeout"];
if (primary_fade>1) then
primary_fade=1;
end
if (primary_fade<0) then
primary_fade=0;
end
primary_fade=(255 - (primary_fade * 255));
ScrRect("", 0, 0, w, h, 1, 0, 0, 0, primary_fade);
if (intro["mode"]==0) then
alCmd("GlobalGain "..tostring(intro["fadeout"]));
end
if (intro["fadeout"]<=0) then
if (intro["mode"]==0) then
alCmd("Close rap");
alCmd("Close traffic");
StartIntro();
intro["fadeout"]=-1;
else
if (DEMOVERSION==1) then
guit2menu(0);
StartIntro();
else
MissionInfo(CURRENTMISSIONID, 0);
end
end
end
do return 0, (255 - primary_fade) end;
end
return 0, 255;
end