Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/home/palettes.asm
1270 views
1
RestoreScreenTilesAndReloadTilePatterns::
2
call ClearSprites
3
ld a, $1
4
ld [wUpdateSpritesEnabled], a
5
call ReloadMapSpriteTilePatterns
6
call LoadScreenTilesFromBuffer2
7
call LoadTextBoxTilePatterns
8
call RunDefaultPaletteCommand
9
jr Delay3
10
11
GBPalWhiteOutWithDelay3::
12
call GBPalWhiteOut
13
14
Delay3::
15
; The bg map is updated each frame in thirds.
16
; Wait three frames to let the bg map fully update.
17
ld c, 3
18
jp DelayFrames
19
20
GBPalNormal::
21
; Reset BGP and OBP0.
22
ld a, %11100100 ; 3210
23
ldh [rBGP], a
24
ld a, %11010000 ; 3100
25
ldh [rOBP0], a
26
ret
27
28
GBPalWhiteOut::
29
; White out all palettes.
30
xor a
31
ldh [rBGP], a
32
ldh [rOBP0], a
33
ldh [rOBP1], a
34
ret
35
36
RunDefaultPaletteCommand::
37
ld b, SET_PAL_DEFAULT
38
RunPaletteCommand::
39
ld a, [wOnSGB]
40
and a
41
ret z
42
predef_jump _RunPaletteCommand
43
44
GetHealthBarColor::
45
; Return at hl the palette of
46
; an HP bar e pixels long.
47
ld a, e
48
cp 27
49
ld d, 0 ; green
50
jr nc, .gotColor
51
cp 10
52
inc d ; yellow
53
jr nc, .gotColor
54
inc d ; red
55
.gotColor
56
ld [hl], d
57
ret
58
59