-
Notifications
You must be signed in to change notification settings - Fork 0
/
prologue.c
393 lines (351 loc) · 17.1 KB
/
prologue.c
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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
#include <gb/gb.h>
#include "machine.c"
#include "tiles/introscreen1tiles.c"
#include "tiles/introscreen2tiles.c"
#include "tiles/introscreen3tiles.c"
#include "maps/introscreen1map.c"
#include "maps/introscreen2map.c"
#include "maps/introscreen3map.c"
#include "hUGEDriver.h"
extern const hUGESong_t prologuethemept1, prologuethemept2;
extern UINT8 i, oamidx, cloudposx, sceneryposx, camtileidx;
extern Machine * pl;
const UINT8 prologuetxtpt1[] = {
0x0E, 0x1F, 0x1C, 0x13, 0x18, 0x11, 0x00, 0x1E, 0x12, 0x0F, 0x00, 0x16, 0x0B, 0x1E, 0x0F, 0xFE,
0x03, 0x02, 0x00, 0x0D, 0x0F, 0x18, 0x1E, 0x1F, 0x1C, 0x23, 0x00, 0x13, 0x18, 0x00, 0x0B, 0xFE,
0x10, 0x0B, 0x1C, 0x0B, 0x21, 0x0B, 0x23, 0x00, 0x21, 0x19, 0x1C, 0x16, 0x0E, 0xFE,
0x1A, 0x0F, 0x0B, 0x0D, 0x0F, 0x00, 0x21, 0x0B, 0x1D, 0x00, 0x10, 0x1C, 0x0B, 0x11, 0x13, 0x16, 0x0F, 0xFE,
0x0B, 0x1D, 0x00, 0x13, 0x1E, 0x1D, 0x00, 0x0D, 0x19, 0x1F, 0x18, 0x1E, 0x1C, 0x13, 0x0F, 0x1D, 0xFE,
0x0D, 0x19, 0x17, 0x1A, 0x0F, 0x1E, 0x0F, 0x0E, 0x00, 0x10, 0x19, 0x1C, 0xFE,
0x1E, 0x0F, 0x0D, 0x12, 0x18, 0x19, 0x16, 0x19, 0x11, 0x13, 0x0D, 0x0B, 0x16, 0x00, 0x0B, 0x18, 0x0E, 0xFE,
0x17, 0x13, 0x16, 0x13, 0x1E, 0x0B, 0x1C, 0x23, 0xFE,
0x1D, 0x1F, 0x1A, 0x0F, 0x1C, 0x13, 0x19, 0x1C, 0x13, 0x1E, 0x23, 0x26, 0xFE,
0x19, 0x18, 0x0F, 0x00, 0x19, 0x10, 0x00, 0x1E, 0x12, 0x0F, 0x17, 0x29, 0xFE,
0x19, 0x0D, 0x0F, 0x0B, 0x18, 0x13, 0x0B, 0x29, 0x00, 0x0C, 0x1F, 0x13, 0x16, 0x1E, 0x00, 0x1E, 0x12, 0x0F, 0xFE,
0x16, 0x0B, 0x1C, 0x11, 0x0F, 0x1D, 0x1E, 0x00, 0x0B, 0x18,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x1E, 0x12, 0x0F, 0x00, 0x0B, 0x18, 0x18, 0x13, 0x12, 0x13, 0x16, 0x0B, 0x1E, 0x19, 0x1C, 0x26, 0xFE,
0x10, 0x19, 0x1C, 0x00, 0x04, 0x00, 0x17, 0x19, 0x18, 0x1E, 0x12, 0x1D, 0x00, 0x13, 0x1E, 0xFE,
0x11, 0x0B, 0x20, 0x0F, 0x00, 0x1F, 0x1D, 0x00, 0x0B, 0x18, 0x00, 0x0F, 0x0E, 0x11, 0x0F, 0x29, 0xFE,
0x1F, 0x18, 0x1E, 0x13, 0x16, 0x00, 0x19, 0x18, 0x0F, 0x00, 0x0E, 0x0B, 0x23, 0x26, 0x26, 0x26, 0xFE, 0xFF
};
const UINT8 prologuetxtpt2[] = {
0x2B, 0x00, 0x21, 0x0F, 0x00, 0x16, 0x19, 0x1D, 0x1E, 0x00, 0x0D, 0x19, 0x18, 0x1E, 0x0B, 0x0D, 0x1E, 0xFE,
0x21, 0x13, 0x1E, 0x12, 0x00, 0x10, 0x19, 0x1C, 0x1E, 0x00, 0x1D, 0x1E, 0x1C, 0x0B, 0x1E, 0x19, 0x1D, 0x26, 0xFE,
0x21, 0x0F, 0x00, 0x0B, 0x1C, 0x0F, 0x00, 0x11, 0x0F, 0x1E, 0x1E, 0x13, 0x18, 0x11, 0x00, 0x18, 0x19, 0xFE,
0x1D, 0x13, 0x11, 0x18, 0x0B, 0x16, 0x26, 0xFE,
0x16, 0x0B, 0x1E, 0x0F, 0x1C, 0x00, 0x1E, 0x12, 0x0B, 0x1E, 0x00, 0x0E, 0x0B, 0x23, 0x26, 0x26, 0x26, 0xFE, 0xFE,
0x2B, 0x00, 0x13, 0x18, 0x0D, 0x19, 0x17, 0x13, 0x18, 0x11, 0x00, 0x1D, 0x13, 0x11, 0x18, 0x0B, 0x16, 0xFE,
0x10, 0x1C, 0x19, 0x17, 0x00, 0x10, 0x19, 0x1C, 0x1E, 0x00, 0x1D, 0x1E, 0x1C, 0x0B, 0x1E, 0x19, 0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x12, 0x0F, 0x17, 0x00, 0x13, 0x10, 0x00, 0x18, 0x0F, 0x0F, 0x0E, 0x00, 0x0C, 0x0F, 0x26, 0xFE,
0x13, 0x10, 0x00, 0x23, 0x19, 0x1F, 0x00, 0x1E, 0x1C, 0x23, 0x00, 0x1E, 0x19, 0xFE,
0x16, 0x13, 0x0C, 0x0F, 0x1C, 0x0B, 0x1E, 0x0F, 0x00, 0x13, 0x1E, 0x00, 0x0C, 0x23, 0xFE,
0x10, 0x19, 0x1C, 0x0D, 0x0F, 0x00, 0x13, 0x00, 0x21, 0x13, 0x16, 0x16, 0x00, 0x18, 0x19, 0x1E, 0xFE,
0x12, 0x0F, 0x1D, 0x13, 0x1E, 0x0B, 0x1E, 0x0F, 0x00, 0x1E, 0x19, 0xFE,
0x0E, 0x0F, 0x1D, 0x1E, 0x1C, 0x19, 0x23, 0x00, 0x1E, 0x12, 0x0F, 0xFE,
0x0D, 0x13, 0x1E, 0x23, 0x00, 0x21, 0x13, 0x1E, 0x12, 0x00, 0x1E, 0x12, 0x0F, 0xFE,
0x0B, 0x18, 0x18, 0x13, 0x12, 0x13, 0x16, 0x0B, 0x1E, 0x19, 0x1C, 0x26, 0xFE,
0x13, 0x00, 0x21, 0x13, 0x16, 0x16, 0x00, 0x16, 0x0F, 0x0B, 0x20, 0x0F, 0x00, 0x13, 0x1E, 0xFE,
0x1F, 0x18, 0x12, 0x0B, 0x1C, 0x17, 0x0F, 0x0E, 0x00, 0x19, 0x18, 0x16, 0x23, 0xFE,
0x1F, 0x18, 0x0E, 0x0F, 0x1C, 0x00, 0x19, 0x18, 0x0F, 0xFE,
0x0D, 0x19, 0x18, 0x0E, 0x13, 0x1E, 0x13, 0x19, 0x18, 0x00, 0x2B, 0xFE,
0x23, 0x19, 0x1F, 0x1C, 0x00, 0x1E, 0x13, 0x1E, 0x16, 0x0F, 0x00, 0x0B, 0x18, 0x0E, 0xFE,
0x10, 0x1F, 0x16, 0x16, 0x00, 0x0D, 0x19, 0x18, 0x1E, 0x1C, 0x19, 0x16, 0xFE,
0x19, 0x20, 0x0F, 0x1C, 0x00, 0x19, 0x0D, 0x0F, 0x0B, 0x18, 0x13, 0x0B, 0x2A, 0x1D, 0xFE,
0x17, 0x13, 0x16, 0x13, 0x1E, 0x0B, 0x1C, 0x23, 0x27, 0xFE,
0x13, 0x00, 0x12, 0x0B, 0x20, 0x0F, 0x00, 0x0C, 0x13, 0x11, 0x00, 0x1A, 0x16, 0x0B, 0x18, 0x1D, 0x27, 0xFE,
0x13, 0x00, 0x21, 0x13, 0x16, 0x16, 0x00, 0x1D, 0x19, 0x19, 0x18, 0x00, 0x1C, 0x1F, 0x16, 0x0F, 0xFE,
0x19, 0x20, 0x0F, 0x1C, 0x00, 0x1E, 0x12, 0x0F, 0x00, 0x21, 0x12, 0x19, 0x16, 0x0F, 0xFE,
0x21, 0x19, 0x1C, 0x16, 0x0E, 0x27, 0x00, 0x19, 0x18, 0x0F, 0x00, 0x19, 0x10, 0x00, 0x17, 0x23, 0xFE,
0x1F, 0x18, 0x13, 0x1E, 0x1D, 0x00, 0x13, 0x1D, 0x00, 0x19, 0x18, 0x00, 0x13, 0x1E, 0x1D, 0xFE,
0x21, 0x0B, 0x23, 0x00, 0x1E, 0x19, 0x00, 0x12, 0x1B, 0x00, 0x1E, 0x19, 0x00, 0x1D, 0x1E, 0x0B, 0x1C, 0x1E, 0xFE,
0x18, 0x0F, 0x11, 0x19, 0x1E, 0x13, 0x0B, 0x1E, 0x13, 0x19, 0x18, 0x1D, 0x26, 0xFE,
0x12, 0x0B, 0x12, 0x0B, 0x12, 0x0B, 0x12, 0x0B, 0x27, 0xFE,
0x23, 0x19, 0x1F, 0x00, 0x12, 0x0B, 0x20, 0x0F, 0x00, 0x02, 0x03, 0x00, 0x12, 0x19, 0x1F, 0x1C, 0x1D, 0x26, 0xFE,
0x0B, 0x10, 0x1E, 0x0F, 0x1C, 0x00, 0x1E, 0x12, 0x0B, 0x1E, 0xFE,
0x13, 0x00, 0x0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x19, 0x1F, 0x11, 0x12, 0x1E, 0x00, 0x1E, 0x19, 0xFE,
0x14, 0x1F, 0x1D, 0x1E, 0x13, 0x0D, 0x0F, 0x26, 0xFE,
0xFE, 0xFE,
0x21, 0x0F, 0x00, 0x0E, 0x19, 0x00, 0x18, 0x19, 0x1E, 0x00, 0x0F, 0x22, 0x1A, 0x0F, 0x0D, 0x1E, 0xFE,
0x1E, 0x12, 0x0F, 0x00, 0x0F, 0x18, 0x0F, 0x17, 0x23, 0x00, 0x1E, 0x19, 0xFE,
0x12, 0x0B, 0x1C, 0x17, 0x00, 0x1E, 0x12, 0x0F, 0x00, 0x0D, 0x13, 0x1E, 0x23, 0x00, 0x19, 0x20, 0x0F, 0x1C, 0xFE,
0x0B, 0x00, 0x1D, 0x13, 0x18, 0x11, 0x16, 0x0F, 0x00, 0x0B, 0x11, 0x0F, 0x18, 0x1E, 0x26, 0xFE,
0x20, 0x13, 0x18, 0x0D, 0x0F, 0x29, 0x00, 0x23, 0x19, 0x1F, 0x00, 0x0B, 0x1C, 0x0F, 0xFE,
0x1E, 0x12, 0x13, 0x1D, 0x00, 0x0D, 0x19, 0x1F, 0x18, 0x1E, 0x1C, 0x23, 0x2A, 0x1D, 0xFE,
0x19, 0x18, 0x16, 0x23, 0x00, 0x12, 0x19, 0x1A, 0x0F, 0x27, 0x00, 0x21, 0x0F, 0x00, 0x15, 0x18, 0x19, 0x21, 0xFE,
0x23, 0x19, 0x1F, 0x00, 0x0D, 0x0B, 0x18, 0x00, 0x0E, 0x19, 0x00, 0x13, 0x1E, 0x27, 0xFE,
0x11, 0x19, 0x19, 0x0E, 0x00, 0x16, 0x1F, 0x0D, 0x15, 0x27, 0xFE,
0xFE, 0xFE, 0xFF
};
const UINT8 prologuescrndur = 180; // Total time a text page stays on the screen after being drawn during prologue
void custom_delay(UINT8 cycles) NONBANKED;
void reset_sprites(UINT8 fstsprite, UINT8 lastsprite) NONBANKED;
void anim_blackout() NONBANKED;
void place_machine(Machine * mch, UINT8 x, UINT8 y) NONBANKED;
void move_machine(Machine * mch, INT8 speedx, INT8 speedy) NONBANKED;
void init_player() NONBANKED;
void toggle_mute_music(UINT8 toggleon) NONBANKED;
void stop_prologue_song() BANKED;
void anim_inverted_bw_to_blackout_prlg() BANKED;
void anim_blackout_to_inverted_bw_prlg() BANKED;
UINT8 erase_prologue_screen_text() BANKED;
void scroll_prologue_pannel() BANKED;
UINT8 draw_prologue_text(const UINT8 * textstart) BANKED;
void show_static_noise() BANKED;
void increment_pannel_position() BANKED;
void play_prologue() BANKED;
void stop_prologue_song() BANKED {
toggle_mute_music(1);
remove_VBL(hUGE_dosound);
}
void anim_inverted_bw_to_blackout_prlg() BANKED {
for(UINT8 blkstep = 0; blkstep != 21; blkstep++) {
switch(blkstep) {
case 1:
BGP_REG = OBP0_REG = 0x67;
break;
case 10:
BGP_REG = OBP0_REG = 0xAB;
break;
case 20:
BGP_REG = OBP0_REG = 0xFF;
break;
}
wait_vbl_done();
}
}
void anim_blackout_to_inverted_bw_prlg() BANKED {
OBP0_REG = 0xE4;
for(UINT8 blkstep = 0; blkstep != 21; blkstep++) {
switch(blkstep) {
case 1:
BGP_REG = 0xBF;
break;
case 10:
BGP_REG = 0x7B;
break;
case 20:
BGP_REG = 0x27;
break;
}
wait_vbl_done();
}
}
UINT8 erase_prologue_screen_text() BANKED {
UINT8 rowidx;
for(rowidx = 10; rowidx != 18; rowidx += 2) {
for(i = 1; i != 19; i++) {
if(joypad() & J_START) { // Skip prologue
return 1;
}
set_bkg_tile_xy(i, rowidx, 0x00);
wait_vbl_done();
}
}
return 0;
}
void scroll_prologue_pannel() BANKED {
switch(LYC_REG) {
case 0x07:
move_bkg(sceneryposx, 0);
LYC_REG = 0x48;
break;
case 0x48:
move_bkg(0, 0);
LYC_REG = 0x07;
break;
}
}
UINT8 draw_prologue_text(const UINT8 * textstart) BANKED {
const UINT8 * txtptr = textstart;
UINT8 rowidx = 10, colidx = 1, screentime = 0, skiptxt = 0;
while(*txtptr != 0xFF) {
if(screentime == 0) {
if(*txtptr == 0xFE) { // Reached line end
if(rowidx == 16) { // Reached end of the screen
screentime = 1;
} else {
rowidx += 2;
}
colidx = 1;
} else {
set_bkg_tile_xy(colidx, rowidx, *txtptr);
colidx++;
custom_delay(4);
}
txtptr++;
} else if(screentime == prologuescrndur) {
rowidx = 10;
screentime = 0;
skiptxt = erase_prologue_screen_text();
} else {
screentime++;
if(joypad() & J_A) {
screentime = prologuescrndur;
}
}
if(joypad() & J_START) { // Skip prologue
skiptxt = 1;
}
if(skiptxt == 1) {
break;
}
wait_vbl_done();
}
if(skiptxt == 0) {
custom_delay(prologuescrndur);
erase_prologue_screen_text();
}
return skiptxt;
}
void show_static_noise() BANKED {
if(cloudposx == 5) {
fill_bkg_rect(3, 1, 14, 8, oamidx);
cloudposx = 0;
}
oamidx = oamidx == 104 ? 101 : oamidx + 1;
cloudposx++;
}
void increment_pannel_position() BANKED {
__critical {
if(pl->cyccount != 3 && pl->cyccount != 4) {
if(cloudposx == 255) {
pl->cyccount++;
}
cloudposx++;
}
sceneryposx += pl->cyccount; // Used as scroll speed
}
}
void play_prologue() BANKED {
UINT8 skipprologue = 0;
oamidx = 0;
init_player();
// Part 1
fill_bkg_rect(0, 0, 32 ,18, 0);
set_bkg_data(44, 61, introscreen1tiles);
set_bkg_tiles(3, 1, 14, 8, introscreen1map);
anim_blackout_to_inverted_bw_prlg();
hUGE_init(&prologuethemept1);
add_VBL(hUGE_dosound);
skipprologue = draw_prologue_text(prologuetxtpt1);
if(skipprologue == 1) {
stop_prologue_song();
anim_inverted_bw_to_blackout_prlg();
return;
}
pl->cyccount = 4; // Raising scroll speed
for(i = 0; i != 3; i++) { // Blinking effect
fill_bkg_rect(0, 0, 32 ,18, 0);
custom_delay(30);
set_bkg_tiles(3, 1, 14, 8, introscreen1map);
}
// Part 2
oamidx = 101; // Used during static noise simulation as an iterator
cloudposx = 0; // Used during static noise simulation as an iterator
sceneryposx = 0;
STAT_REG = 0x45;
LYC_REG = 0x07;
add_LCD(show_static_noise);
enable_interrupts();
set_interrupts(VBL_IFLAG | LCD_IFLAG);
anim_blackout_to_inverted_bw_prlg();
skipprologue = draw_prologue_text(prologuetxtpt2);
remove_LCD(show_static_noise);
move_bkg(0, 0);
if(skipprologue == 1) {
stop_prologue_song();
return;
}
// Part 3
set_bkg_data(44, 30, introscreen2tiles);
fill_bkg_rect(3, 1, 14, 8, 0);
custom_delay(15);
set_bkg_tiles(4, 1, 12, 8, introscreen2map);
skipprologue = draw_prologue_text(prologuetxtpt3);
anim_inverted_bw_to_blackout_prlg();
stop_prologue_song();
if(skipprologue == 1) {
return;
}
// Part 4
cloudposx = 0; // Used to determine when scroll speed should be changed
pl->cyccount = 1; // Used as a scroll speed
set_bkg_data(44, 17, introscreen3tiles);
for(i = 0; i != 32; i += 8) {
set_bkg_tiles(i, 1, 8, 8, introscreen3map);
}
add_LCD(increment_pannel_position);
add_LCD(scroll_prologue_pannel);
place_machine(pl, 248, 64);
anim_blackout_to_inverted_bw_prlg();
while(pl->x != 24) {
move_machine(pl, 1, 0);
wait_vbl_done();
}
hUGE_init(&prologuethemept2);
add_VBL(hUGE_dosound);
draw_prologue_text(prologuetxtpt4);
while(pl->x != 170) {
move_machine(pl, 1, 0);
wait_vbl_done();
}
stop_prologue_song();
anim_inverted_bw_to_blackout_prlg();
__critical {
remove_LCD(increment_pannel_position);
remove_LCD(scroll_prologue_pannel);
}
move_bkg(0, 0);
reset_sprites(0, 3);
}