Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/engine/gfx/screen_effects.asm
1271 views
1
; b = new color for BG color 0 (usually white) for 4 frames
2
ChangeBGPalColor0_4Frames:
3
call GetPredefRegisters
4
ldh a, [rBGP]
5
or b
6
ldh [rBGP], a
7
ld c, 4
8
call DelayFrames
9
ldh a, [rBGP]
10
and %11111100
11
ldh [rBGP], a
12
ret
13
14
PredefShakeScreenVertically:
15
; Moves the window down and then back in a sequence of progressively smaller
16
; numbers of pixels, starting at b.
17
call GetPredefRegisters
18
ld a, 1
19
ld [wDisableVBlankWYUpdate], a
20
xor a
21
.loop
22
ldh [hMutateWY], a
23
call .MutateWY
24
call .MutateWY
25
dec b
26
ld a, b
27
jr nz, .loop
28
xor a
29
ld [wDisableVBlankWYUpdate], a
30
ret
31
32
.MutateWY
33
ldh a, [hMutateWY]
34
xor b
35
ldh [hMutateWY], a
36
ldh [rWY], a
37
ld c, 3
38
jp DelayFrames
39
40
PredefShakeScreenHorizontally:
41
; Moves the window right and then back in a sequence of progressively smaller
42
; numbers of pixels, starting at b.
43
call GetPredefRegisters
44
xor a
45
.loop
46
ldh [hMutateWX], a
47
call .MutateWX
48
ld c, 1
49
call DelayFrames
50
call .MutateWX
51
dec b
52
ld a, b
53
jr nz, .loop
54
55
; restore normal WX
56
ld a, 7
57
ldh [rWX], a
58
ret
59
60
.MutateWX
61
ldh a, [hMutateWX]
62
xor b
63
ldh [hMutateWX], a
64
bit 7, a ; negative?
65
jr z, .skipZeroing
66
xor a ; zero a if it's negative
67
.skipZeroing
68
add 7
69
ldh [rWX], a
70
ld c, 4
71
jp DelayFrames
72
73