-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpalettes.asm
66 lines (59 loc) · 1.14 KB
/
palettes.asm
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
InitMapSprites::
jpfar _InitMapSprites
RestoreScreenTilesAndReloadTilePatterns::
call ClearSprites
ld a, $1
ld [wUpdateSpritesEnabled], a
call ReloadMapSpriteTilePatterns
call LoadScreenTilesFromBuffer2
call LoadTextBoxTilePatterns
call RunDefaultPaletteCommand
jr Delay3
GBPalWhiteOutWithDelay3::
call GBPalWhiteOut
Delay3::
; The bg map is updated each frame in thirds.
; Wait three frames to let the bg map fully update.
ld c, 3
jp DelayFrames
GBPalNormal::
; Reset BGP and OBP0.
ld a, %11100100 ; 3210
ldh [rBGP], a
ld a, %11010000 ; 3100
ldh [rOBP0], a
call UpdateGBCPal_BGP
call UpdateGBCPal_OBP0
call UpdateGBCPal_OBP1
ret
GBPalWhiteOut::
; White out all palettes.
xor a
ldh [rBGP], a
ldh [rOBP0], a
ldh [rOBP1], a
call UpdateGBCPal_BGP
call UpdateGBCPal_OBP0
call UpdateGBCPal_OBP1
ret
RunDefaultPaletteCommand::
ld b, SET_PAL_DEFAULT
RunPaletteCommand::
ld a, [wOnSGB]
and a
ret z
predef_jump _RunPaletteCommand
GetHealthBarColor::
; Return at hl the palette of
; an HP bar e pixels long.
ld a, e
cp 27
ld d, 0 ; green
jr nc, .gotColor
cp 10
inc d ; yellow
jr nc, .gotColor
inc d ; red
.gotColor
ld [hl], d
ret