-
Notifications
You must be signed in to change notification settings - Fork 9
/
fade.c
53 lines (46 loc) · 864 Bytes
/
fade.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
#include <gb/gb.h>
#include "sound.h"
#include "fade.h"
const UINT8 fadePals[] = {
0xE4U, // 11100100
0x90U, // 10010000
0x40U, // 01000000
0x00U // 00000000
};
const UINT8 spriteFadePals[] = {
0xD0U, // 11010000
0x80U, // 10000000
0x40U, // 01000000
0x00U // 00000000
};
void fadeToWhite(UBYTE delay) {
UINT8 i, j;
for(i = 1U; i != 4U; ++i) {
BGP_REG = spriteFadePals[i];
for(j = 0U; j != delay; ++j) {
snd_update();
wait_vbl_done();
}
}
}
void fadeSpritesToWhite(UBYTE delay) {
UINT8 i, j;
for(i = 1U; i != 4U; ++i) {
OBP0_REG = fadePals[i];
for(j = 0U; j != delay; ++j) {
snd_update();
wait_vbl_done();
}
}
}
void fadeFromWhite(UBYTE delay) {
UINT8 i, j;
for(i = 3U; i != 0U; --i) {
BGP_REG = fadePals[i];
for(j = 0U; j != delay; ++j) {
snd_update();
wait_vbl_done();
}
}
BGP_REG = fadePals[0U];
}